春风项目四线(合箱线、总装线)
yyt
2024-01-23 054abe8ddf6a5ed24cefdb38f4175fb083fd79cd
提交 | 用户 | 时间
fd2207 1 <template>
2   <div class="app-container">
3     <el-card class="box-card">
054abe 4         <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
Y 5           <el-form-item label="节点" prop="node">
6             <el-input
7               v-model="queryParams.node"
8               placeholder="请输入节点"
9               clearable
10               @keyup.enter.native="handleQuery"
11             />
12           </el-form-item>
13           <el-form-item label="订阅类型" prop="rFunction">
14             <el-select v-model="queryParams.rFunction" placeholder="请选择订阅类型" clearable>
15               <el-option
16                 v-for="dict in dict.type.subscription_type"
17                 :key="dict.value"
18                 :label="dict.label"
19                 :value="dict.value"
20               />
21             </el-select>
22           </el-form-item>
23           <el-form-item label="工序编码" prop="process">
24             <el-select v-model="queryParams.process" placeholder="请选择工序编码" clearable>
25 <!--              <el-option-->
26 <!--                v-for="dict in dict.type.${dictType}"-->
27 <!--                :key="dict.value"-->
28 <!--                :label="dict.label"-->
29 <!--                :value="dict.value"-->
30 <!--              />-->
31             </el-select>
32           </el-form-item>
33           <el-form-item label="工序名称" prop="processName">
34             <el-input
35               v-model="queryParams.processName"
36               placeholder="请输入工序名称"
37               clearable
38               @keyup.enter.native="handleQuery"
39             />
40           </el-form-item>
41           <el-form-item label="状态" prop="state">
42             <el-select v-model="queryParams.state"  placeholder="请选择状态" clearable>
43               <el-option
44                 v-for="dict in dict.type.sys_normal_disable"
45                 :key="dict.value"
46                 :label="dict.label"
47                 :value="dict.value"
48               />
49             </el-select>
50           </el-form-item>
51           <el-form-item style="float: right">
52             <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
53             <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
54           </el-form-item>
55         </el-form>
fd2207 56     </el-card>
57
58     <el-card style="margin-top: 10px" class="box-card">
054abe 59         <el-row :gutter="10" class="mb8">
Y 60           <el-col :span="1.5">
61             <el-button
62               type="primary"
63               plain
64               icon="el-icon-plus"
65               size="mini"
66               @click="handleAdd"
67               v-hasPermi="['main:opcuaconfig:add']"
68             >新增</el-button>
69           </el-col>
70           <el-col :span="1.5">
71             <el-button
72               type="success"
73               plain
74               icon="el-icon-edit"
75               size="mini"
76               :disabled="single"
77               @click="handleUpdate"
78               v-hasPermi="['main:opcuaconfig:edit']"
79             >修改</el-button>
80           </el-col>
81           <el-col :span="1.5">
82             <el-button
83               type="danger"
84               plain
85               icon="el-icon-delete"
86               size="mini"
87               :disabled="multiple"
88               @click="handleDelete"
89               v-hasPermi="['main:opcuaconfig:remove']"
90             >删除</el-button>
91           </el-col>
92           <el-col :span="1.5">
93             <el-button
94               type="warning"
95               plain
96               icon="el-icon-download"
97               size="mini"
98               @click="handleExport"
99               v-hasPermi="['main:opcuaconfig:export']"
100             >导出</el-button>
101           </el-col>
102           <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
103         </el-row>
fd2207 104
054abe 105         <el-table border v-loading="loading" :data="opcuaconfigList" @selection-change="handleSelectionChange">
Y 106           <el-table-column type="selection" width="55" align="center" />
107 <!--          <el-table-column label="ID" align="center" prop="id" />-->
108           <el-table-column label="工序编码" align="center" prop="process">
109             <!--            <template slot-scope="scope">-->
110             <!--              <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.process"/>-->
111             <!--            </template>-->
112           </el-table-column>
113           <el-table-column label="工序名称" align="center" prop="processName">
114             <!--            <template slot-scope="scope">-->
115             <!--              <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.processName"/>-->
116             <!--            </template>-->
117           </el-table-column>
118           <el-table-column label="节点" align="center" prop="node">
119 <!--            <template slot-scope="scope">-->
120 <!--              <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.node"/>-->
121 <!--            </template>-->
122           </el-table-column>
123           <el-table-column label="数据类型" align="center" prop="sysTypes">
124             <template slot-scope="scope">
125               <dict-tag :options="dict.type.data_type" :value="scope.row.sysTypes"/>
126             </template>
127           </el-table-column>
128           <el-table-column label="是否订阅" align="center" prop="subscribe">
129             <template slot-scope="scope">
130               <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.subscribe"/>
131             </template>
132           </el-table-column>
133           <el-table-column label="订阅类型" align="center" prop="rFunction">
134             <template slot-scope="scope">
135               <dict-tag :options="dict.type.subscription_type" :value="scope.row.rFunction"/>
136             </template>
137           </el-table-column>
138           <el-table-column label="备注" align="center" prop="remarks">
139 <!--            <template slot-scope="scope">-->
140 <!--              <dict-tag :options="dict.type.${column.dictType}" :value="scope.row.remarks"/>-->
141 <!--            </template>-->
142           </el-table-column>
143           <el-table-column label="状态" align="center" prop="state">
144             <template slot-scope="scope">
145               <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.state"/>
146             </template>
147           </el-table-column>
148           <el-table-column fixed="right" width="200" label="操作" align="center" class-name="small-padding fixed-width">
149             <template slot-scope="scope">
150               <el-button
151                 size="mini"
152                 type="success"
153                 plain
154                 style="width: 72px"
155                 icon="el-icon-edit"
156                 @click="handleUpdate(scope.row)"
157                 v-hasPermi="['da:opcuaconfig:edit']"
158               >修改</el-button>
159               <el-button
160                 size="mini"
161                 type="danger"
162                 plain
163                 style="width: 72px"
164                 icon="el-icon-delete"
165                 @click="handleDelete(scope.row)"
166                 v-hasPermi="['main:opcuaconfig:remove']"
167               >删除</el-button>
168             </template>
169           </el-table-column>
170         </el-table>
fd2207 171     </el-card>
172
173     <pagination
174       v-show="total>0"
175       :total="total"
176       :page.sync="queryParams.pageNum"
177       :limit.sync="queryParams.pageSize"
178       @pagination="getList"
179     />
180
054abe 181     <!-- 添加或修改交互信号配置对话框 -->
fd2207 182     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body>
054abe 183       <span slot="title">
Y 184         <i class="el-icon-s-order"></i>
185         {{titleName}}
186       </span>
fd2207 187       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
188         <el-form-item label="节点" prop="node">
189           <el-input v-model="form.node" placeholder="请输入节点" />
190         </el-form-item>
054abe 191         <el-form-item label="数据类型" prop="sysTypes">
Y 192           <el-select v-model="form.sysTypes" placeholder="请选择数据类型">
193             <el-option
194               v-for="dict in dict.type.data_type"
195               :key="dict.value"
196               :label="dict.label"
197               :value="dict.value"
198             ></el-option>
fd2207 199           </el-select>
200         </el-form-item>
201         <el-form-item label="是否订阅" prop="subscribe">
202           <el-select v-model="form.subscribe" placeholder="请选择是否订阅">
054abe 203             <el-option
Y 204               v-for="dict in dict.type.sys_yes_no"
205               :key="dict.value"
206               :label="dict.label"
207               :value="parseInt(dict.value)"
208             ></el-option>
fd2207 209           </el-select>
210         </el-form-item>
054abe 211         <el-form-item label="订阅类型" prop="rFunction">
Y 212           <el-select v-model="form.rFunction" placeholder="请选择订阅类型">
213             <el-option
214               v-for="dict in dict.type.subscription_type"
215               :key="dict.value"
216               :label="dict.label"
217               :value="dict.value"
218             ></el-option>
219           </el-select>
fd2207 220         </el-form-item>
221         <el-form-item label="备注" prop="remarks">
222           <el-input v-model="form.remarks" placeholder="请输入备注" />
054abe 223         </el-form-item>
Y 224         <el-form-item label="工序编码" prop="process">
225           <el-radio-group v-model="form.process">
226 <!--            <el-radio-->
227 <!--              v-for="dict in dict.type.${dictType}"-->
228 <!--              :key="dict.value"-->
229 <!--              :label="dict.value"-->
230 <!--            >{{dict.label}}</el-radio>-->
231           </el-radio-group>
232         </el-form-item>
233         <el-form-item label="工序名称" prop="processName">
234           <el-input v-model="form.processName" placeholder="请输入工序名称" />
235         </el-form-item>
236         <el-form-item label="状态" prop="state">
237           <el-select v-model="form.state" placeholder="请选择状态">
238             <el-option
239               v-for="dict in dict.type.sys_normal_disable"
240               :key="dict.value"
241               :label="dict.label"
242               :value="parseInt(dict.value)"
243             ></el-option>
244           </el-select>
fd2207 245         </el-form-item>
246       </el-form>
247       <div slot="footer" class="dialog-footer">
248         <el-button type="primary" @click="submitForm">确 定</el-button>
249         <el-button @click="cancel">取 消</el-button>
250       </div>
251     </el-dialog>
252   </div>
253 </template>
254
255 <script>
256 import { listOpcuaconfig, getOpcuaconfig, delOpcuaconfig, addOpcuaconfig, updateOpcuaconfig } from "@/api/main/da/opcuaconfig/opcuaconfig";
257
258 export default {
259   name: "Opcuaconfig",
054abe 260   dicts: ['subscription_type', 'sys_yes_no', 'sys_normal_disable', 'data_type'],
fd2207 261   data() {
262     return {
263       // 遮罩层
264       loading: true,
054abe 265       titleName: "",
fd2207 266       // 选中数组
267       ids: [],
268       // 非单个禁用
269       single: true,
270       // 非多个禁用
271       multiple: true,
272       // 显示搜索条件
273       showSearch: true,
274       // 总条数
275       total: 0,
054abe 276       // 交互信号配置表格数据
fd2207 277       opcuaconfigList: [],
278       // 弹出层标题
279       title: "",
280       // 是否显示弹出层
281       open: false,
282       // 查询参数
283       queryParams: {
284         pageNum: 1,
285         pageSize: 10,
286         node: null,
287         sysTypes: null,
288         rFunction: null,
054abe 289         process: null,
Y 290         processName: null,
291         state: null
fd2207 292       },
293       // 表单参数
294       form: {},
295       // 表单校验
296       rules: {
297         id: [
298           { required: true, message: "ID不能为空", trigger: "blur" }
299         ],
054abe 300         node: [
Y 301           { required: true, message: "节点不能为空", trigger: "blur" }
302         ],
303         sysTypes: [
304           { required: true, message: "数据类型不能为空", trigger: "change" }
305         ],
306         subscribe: [
307           { required: true, message: "是否订阅不能为空", trigger: "change" }
308         ],
309         rFunction: [
310           { required: true, message: "订阅类型不能为空", trigger: "change" }
311         ],
fd2207 312       }
313     };
314   },
315   created() {
316     this.getList();
317   },
318   methods: {
054abe 319     /** 查询交互信号配置列表 */
fd2207 320     getList() {
321       this.loading = true;
322       listOpcuaconfig(this.queryParams).then(response => {
323         this.opcuaconfigList = response.rows;
324         this.total = response.total;
325         this.loading = false;
326       });
327     },
328     // 取消按钮
329     cancel() {
330       this.open = false;
331       this.reset();
332     },
333     // 表单重置
334     reset() {
335       this.form = {
336         id: null,
337         module: null,
338         node: null,
339         length: null,
340         sysTypes: null,
341         functionality: null,
342         subscribe: null,
343         rModule: null,
344         rFunction: null,
054abe 345         remarks: null,
Y 346         process: null,
347         processName: null,
348         state: null
fd2207 349       };
350       this.resetForm("form");
351     },
352     /** 搜索按钮操作 */
353     handleQuery() {
354       this.queryParams.pageNum = 1;
355       this.getList();
356     },
357     /** 重置按钮操作 */
358     resetQuery() {
359       this.resetForm("queryForm");
360       this.handleQuery();
361     },
362     // 多选框选中数据
363     handleSelectionChange(selection) {
364       this.ids = selection.map(item => item.id)
365       this.single = selection.length!==1
366       this.multiple = !selection.length
367     },
368     /** 新增按钮操作 */
369     handleAdd() {
370       this.reset();
371       this.open = true;
054abe 372       this.titleName = "添加交互信号配置";
fd2207 373     },
374     /** 修改按钮操作 */
375     handleUpdate(row) {
376       this.reset();
377       const id = row.id || this.ids
378       getOpcuaconfig(id).then(response => {
379         this.form = response.data;
380         this.open = true;
054abe 381         this.titleName = "修改交互信号配置";
fd2207 382       });
383     },
384     /** 提交按钮 */
385     submitForm() {
386       this.$refs["form"].validate(valid => {
387         if (valid) {
388           if (this.form.id != null) {
389             updateOpcuaconfig(this.form).then(response => {
390               this.$modal.msgSuccess("修改成功");
391               this.open = false;
392               this.getList();
393             });
394           } else {
395             addOpcuaconfig(this.form).then(response => {
396               this.$modal.msgSuccess("新增成功");
397               this.open = false;
398               this.getList();
399             });
400           }
401         }
402       });
403     },
404     /** 删除按钮操作 */
405     handleDelete(row) {
406       const ids = row.id || this.ids;
054abe 407       this.$modal.confirm('是否确认删除交互信号配置编号为"' + ids + '"的数据项?').then(function() {
fd2207 408         return delOpcuaconfig(ids);
409       }).then(() => {
410         this.getList();
411         this.$modal.msgSuccess("删除成功");
412       }).catch(() => {});
413     },
414     /** 导出按钮操作 */
415     handleExport() {
416       this.download('da/opcuaconfig/export', {
417         ...this.queryParams
418       }, `opcuaconfig_${new Date().getTime()}.xlsx`)
419     }
420   }
421 };
422 </script>