提交 | 用户 | 时间
|
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(); |
|
310 |
}, |
|
311 |
methods: { |
28cd73
|
312 |
handleSelectChange(selectedOption) { |
Y |
313 |
this.ProcessesqueryParams.process = selectedOption; |
|
314 |
listProcesses(this.ProcessesqueryParams).then(response => { |
|
315 |
this.form.processName = response.rows[0].processesName; |
|
316 |
}); |
|
317 |
}, |
054abe
|
318 |
/** 查询交互信号配置列表 */ |
fd2207
|
319 |
getList() { |
懒 |
320 |
this.loading = true; |
|
321 |
listOpcuaconfig(this.queryParams).then(response => { |
|
322 |
this.opcuaconfigList = response.rows; |
|
323 |
this.total = response.total; |
|
324 |
this.loading = false; |
|
325 |
}); |
|
326 |
}, |
|
327 |
// 取消按钮 |
|
328 |
cancel() { |
|
329 |
this.open = false; |
|
330 |
this.reset(); |
|
331 |
}, |
|
332 |
// 表单重置 |
|
333 |
reset() { |
|
334 |
this.form = { |
|
335 |
id: null, |
|
336 |
node: null, |
|
337 |
sysTypes: null, |
|
338 |
subscribe: null, |
|
339 |
rFunction: null, |
054abe
|
340 |
remarks: null, |
Y |
341 |
processName: null, |
28cd73
|
342 |
process: null, |
054abe
|
343 |
state: null |
fd2207
|
344 |
}; |
懒 |
345 |
this.resetForm("form"); |
|
346 |
}, |
|
347 |
/** 搜索按钮操作 */ |
|
348 |
handleQuery() { |
|
349 |
this.queryParams.pageNum = 1; |
|
350 |
this.getList(); |
|
351 |
}, |
|
352 |
/** 重置按钮操作 */ |
|
353 |
resetQuery() { |
|
354 |
this.resetForm("queryForm"); |
|
355 |
this.handleQuery(); |
|
356 |
}, |
|
357 |
// 多选框选中数据 |
|
358 |
handleSelectionChange(selection) { |
|
359 |
this.ids = selection.map(item => item.id) |
|
360 |
this.single = selection.length!==1 |
|
361 |
this.multiple = !selection.length |
|
362 |
}, |
|
363 |
/** 新增按钮操作 */ |
|
364 |
handleAdd() { |
|
365 |
this.reset(); |
|
366 |
this.open = true; |
054abe
|
367 |
this.titleName = "添加交互信号配置"; |
fd2207
|
368 |
}, |
懒 |
369 |
/** 修改按钮操作 */ |
|
370 |
handleUpdate(row) { |
|
371 |
this.reset(); |
|
372 |
const id = row.id || this.ids |
|
373 |
getOpcuaconfig(id).then(response => { |
|
374 |
this.form = response.data; |
|
375 |
this.open = true; |
054abe
|
376 |
this.titleName = "修改交互信号配置"; |
fd2207
|
377 |
}); |
懒 |
378 |
}, |
|
379 |
/** 提交按钮 */ |
|
380 |
submitForm() { |
|
381 |
this.$refs["form"].validate(valid => { |
|
382 |
if (valid) { |
|
383 |
if (this.form.id != null) { |
|
384 |
updateOpcuaconfig(this.form).then(response => { |
|
385 |
this.$modal.msgSuccess("修改成功"); |
|
386 |
this.open = false; |
|
387 |
this.getList(); |
|
388 |
}); |
|
389 |
} else { |
|
390 |
addOpcuaconfig(this.form).then(response => { |
|
391 |
this.$modal.msgSuccess("新增成功"); |
|
392 |
this.open = false; |
|
393 |
this.getList(); |
|
394 |
}); |
|
395 |
} |
|
396 |
} |
|
397 |
}); |
|
398 |
}, |
|
399 |
/** 删除按钮操作 */ |
|
400 |
handleDelete(row) { |
|
401 |
const ids = row.id || this.ids; |
054abe
|
402 |
this.$modal.confirm('是否确认删除交互信号配置编号为"' + ids + '"的数据项?').then(function() { |
fd2207
|
403 |
return delOpcuaconfig(ids); |
懒 |
404 |
}).then(() => { |
|
405 |
this.getList(); |
|
406 |
this.$modal.msgSuccess("删除成功"); |
|
407 |
}).catch(() => {}); |
|
408 |
}, |
|
409 |
/** 导出按钮操作 */ |
|
410 |
handleExport() { |
|
411 |
this.download('da/opcuaconfig/export', { |
|
412 |
...this.queryParams |
|
413 |
}, `opcuaconfig_${new Date().getTime()}.xlsx`) |
|
414 |
} |
|
415 |
} |
|
416 |
}; |
|
417 |
</script> |