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