提交 | 用户 | 时间
|
850106
|
1 |
<template> |
H |
2 |
<el-dialog |
|
3 |
title="详情" |
|
4 |
:close-on-click-modal="false" |
|
5 |
:width="dialogWidth" |
|
6 |
:visible.sync="visible"> |
|
7 |
<el-form :model="dataForm" ref="dataForm" label-width="100px"> |
|
8 |
<el-divider content-position="left">基本信息</el-divider> |
|
9 |
<el-row :gutter="20"> |
|
10 |
<el-col :span="6"> |
|
11 |
<el-form-item label="煤矿" prop="mkbm"> |
|
12 |
<dict-select-tag v-model="dataForm.mkbm" placeholder="煤矿" dictCode="mkbm" @change="changeMkbm"/> |
|
13 |
</el-form-item> |
|
14 |
</el-col> |
|
15 |
<el-col :span="6"> |
|
16 |
<el-form-item label="生产系统" prop="xtbm"> |
|
17 |
<dict-select-tag v-model="dataForm.xtbm" placeholder="生产安全系统" dictCode="scxtbm" @change="changeScxt" /> |
|
18 |
</el-form-item> |
|
19 |
</el-col> |
|
20 |
<el-col :span="6"> |
|
21 |
<el-form-item label="监控系统" prop="jkbm"> |
|
22 |
<el-select v-model="dataForm.jkbm" placeholder="请选择" @change="changeJkxt"> |
|
23 |
<el-option |
|
24 |
v-for="item in jkxtOptions" |
|
25 |
:key="item.jkxtbm" |
|
26 |
:label="item.jkxtmc" |
|
27 |
:value="item.jkxtbm"> |
|
28 |
</el-option> |
|
29 |
</el-select> |
|
30 |
</el-form-item> |
|
31 |
</el-col> |
|
32 |
<el-col :span="6"> |
|
33 |
<el-form-item label="设备" prop="sbbm"> |
|
34 |
<el-select v-model="dataForm.sbbm" placeholder="请选择" @change="changeDevice"> |
|
35 |
<el-option |
|
36 |
v-for="item in deviceOptions" |
|
37 |
:key="item.sbbm" |
|
38 |
:label="item.sbmc" |
|
39 |
:value="item.sbbm"> |
|
40 |
</el-option> |
|
41 |
</el-select> |
|
42 |
</el-form-item> |
|
43 |
</el-col> |
|
44 |
</el-row> |
|
45 |
<el-row :gutter="10"> |
|
46 |
<el-col :span="12"> |
|
47 |
<el-form-item label="测点编码" prop="lsh"> |
|
48 |
<el-input v-model="dataForm.lsh" placeholder="4位流水码(自动生成)" maxlength="4" readonly> |
|
49 |
<template slot="prepend">{{dataForm.sbbm}}</template> |
|
50 |
</el-input> |
|
51 |
</el-form-item> |
|
52 |
</el-col> |
|
53 |
<el-col :span="12"> |
|
54 |
<el-form-item label="测点名称" prop="cdmc"> |
|
55 |
<el-input v-model="dataForm.cdmc" placeholder="测点名称" maxlength="40" clearable></el-input> |
|
56 |
</el-form-item> |
|
57 |
</el-col> |
|
58 |
</el-row> |
|
59 |
<el-row :gutter="20"> |
|
60 |
<el-col :span="24"> |
|
61 |
<el-form-item label="测点描述" prop="cdxxms"> |
|
62 |
<el-input v-model="dataForm.cdxxms" placeholder="测点信息描述" maxlength="100"></el-input> |
|
63 |
</el-form-item> |
|
64 |
</el-col> |
|
65 |
</el-row> |
|
66 |
<el-row :gutter="20"> |
|
67 |
<el-col :span="6"> |
|
68 |
<el-form-item label="测点类型" prop="cdlx"> |
|
69 |
<dict-select-tag v-model="dataForm.cdlx" placeholder="测点类型" dictCode="cdlx" /> |
|
70 |
</el-form-item> |
|
71 |
</el-col> |
|
72 |
<el-col :span="6"> |
|
73 |
<el-form-item label="读写标记" prop="dxbj"> |
|
74 |
<dict-select-tag v-model="dataForm.dxbj" placeholder="读写标记" dictCode="dxbj" /> |
|
75 |
</el-form-item> |
|
76 |
</el-col> |
|
77 |
<el-col :span="6"> |
|
78 |
<el-form-item label="量程下限" prop="lcxx"> |
|
79 |
<el-input v-model="dataForm.lcxx" placeholder="量程下限" maxlength="50" clearable></el-input> |
|
80 |
</el-form-item> |
|
81 |
</el-col> |
|
82 |
<el-col :span="6"> |
|
83 |
<el-form-item label="量程上限" prop="lcsx"> |
|
84 |
<el-input v-model="dataForm.lcsx" placeholder="量程上限" maxlength="50" clearable></el-input> |
|
85 |
</el-form-item> |
|
86 |
</el-col> |
|
87 |
</el-row> |
|
88 |
<el-row :gutter="20"> |
|
89 |
<el-col :span="6"> |
|
90 |
<el-form-item label="默认值" prop="mrz"> |
|
91 |
<el-input v-model="dataForm.mrz" placeholder="默认值" maxlength="50" clearable></el-input> |
|
92 |
</el-form-item> |
|
93 |
</el-col> |
|
94 |
<el-col :span="6"> |
|
95 |
<el-form-item label="数据长度" prop="sjcd"> |
|
96 |
<el-input v-model="dataForm.sjcd" placeholder="数据长度" maxlength="50" clearable></el-input> |
|
97 |
</el-form-item> |
|
98 |
</el-col> |
|
99 |
<el-col :span="6"> |
|
100 |
<el-form-item label="寄存器长度" prop="jcqcd"> |
|
101 |
<el-input v-model="dataForm.jcqcd" placeholder="寄存器长度" maxlength="50" clearable></el-input> |
|
102 |
</el-form-item> |
|
103 |
</el-col> |
|
104 |
<el-col :span="6"> |
|
105 |
<el-form-item label="大小端" prop="dxd"> |
|
106 |
<el-input v-model="dataForm.dxd" placeholder="大小端" maxlength="50" clearable></el-input> |
|
107 |
</el-form-item> |
|
108 |
</el-col> |
|
109 |
</el-row> |
|
110 |
<el-row :gutter="20"> |
|
111 |
<el-col :span="6"> |
|
112 |
<el-form-item label="掩码" prop="ym"> |
|
113 |
<el-input v-model="dataForm.ym" placeholder="掩码" maxlength="50" clearable></el-input> |
|
114 |
</el-form-item> |
|
115 |
</el-col> |
|
116 |
<el-col :span="6"> |
|
117 |
<el-form-item label="移动" prop="yd"> |
|
118 |
<dict-select-tag v-model="dataForm.yd" placeholder="移动" dictCode="yd" /> |
|
119 |
</el-form-item> |
|
120 |
</el-col> |
|
121 |
<el-col :span="6"> |
|
122 |
<el-form-item label="系数" prop="xs"> |
|
123 |
<el-input v-model="dataForm.xs" placeholder="系数" maxlength="50" clearable></el-input> |
|
124 |
</el-form-item> |
|
125 |
</el-col> |
|
126 |
<el-col :span="6"> |
|
127 |
<el-form-item label="偏移" prop="py"> |
|
128 |
<el-input v-model="dataForm.py" placeholder="偏移" maxlength="50" clearable></el-input> |
|
129 |
</el-form-item> |
|
130 |
</el-col> |
|
131 |
</el-row> |
|
132 |
<el-row :gutter="20"> |
|
133 |
<el-col :span="6"> |
|
134 |
<el-form-item label="基准" prop="jz"> |
|
135 |
<el-input v-model="dataForm.jz" placeholder="基准" maxlength="50" clearable></el-input> |
|
136 |
</el-form-item> |
|
137 |
</el-col> |
|
138 |
<el-col :span="6"> |
|
139 |
<el-form-item label="断言" prop="dy"> |
|
140 |
<el-input v-model="dataForm.dy" placeholder="断言" maxlength="50" clearable></el-input> |
|
141 |
</el-form-item> |
|
142 |
</el-col> |
|
143 |
<el-col :span="6"> |
|
144 |
<el-form-item label="有无符号" prop="ywfh"> |
|
145 |
<dict-select-tag v-model="dataForm.ywfh" placeholder="有无符号" dictCode="ywfh" /> |
|
146 |
</el-form-item> |
|
147 |
</el-col> |
|
148 |
<el-col :span="6"> |
|
149 |
<el-form-item label="小数位数" prop="xsws"> |
|
150 |
<el-input v-model="dataForm.xsws" placeholder="小数位数" maxlength="50" clearable></el-input> |
|
151 |
</el-form-item> |
|
152 |
</el-col> |
|
153 |
</el-row> |
|
154 |
<el-row :gutter="20"> |
|
155 |
<el-col :span="6"> |
|
156 |
<el-form-item label="结果类型" prop="cljglx"> |
|
157 |
<el-input v-model="dataForm.cljglx" placeholder="测量结果类型" maxlength="50" clearable></el-input> |
|
158 |
</el-form-item> |
|
159 |
</el-col> |
|
160 |
<el-col :span="6"> |
|
161 |
<el-form-item label="累积量" prop="ljl"> |
|
162 |
<dict-select-tag v-model="dataForm.ljl" placeholder="累积量" dictCode="ljl" /> |
|
163 |
</el-form-item> |
|
164 |
</el-col> |
|
165 |
<el-col :span="6"> |
|
166 |
<el-form-item label="计量单位" prop="jldw"> |
|
167 |
<el-input v-model="dataForm.jldw" placeholder="计量单位" maxlength="50" clearable></el-input> |
|
168 |
</el-form-item> |
|
169 |
</el-col> |
|
170 |
<el-col :span="6"> |
|
171 |
<el-form-item label="源变量" prop="ybl"> |
|
172 |
<el-input v-model="dataForm.ybl" placeholder="源变量" maxlength="50" clearable></el-input> |
|
173 |
</el-form-item> |
|
174 |
</el-col> |
|
175 |
</el-row> |
|
176 |
<el-row :gutter="20"> |
|
177 |
<el-col :span="6"> |
|
178 |
<el-form-item label="控制器ID" prop="kzqId"> |
|
179 |
<el-input v-model="dataForm.kzqId" placeholder="控制器ID" maxlength="50" clearable></el-input> |
|
180 |
</el-form-item> |
|
181 |
</el-col> |
|
182 |
<el-col :span="6"> |
|
183 |
<el-form-item label="逻辑测点" prop="ljcd"> |
|
184 |
<dict-select-tag v-model="dataForm.ljcd" placeholder="逻辑测点" dictCode="ljcd" /> |
|
185 |
</el-form-item> |
|
186 |
</el-col> |
|
187 |
<el-col :span="6"> |
|
188 |
<el-form-item label="报警下限" prop="bjxx"> |
|
189 |
<el-input v-model="dataForm.bjxx" placeholder="报警下限" maxlength="50" clearable></el-input> |
|
190 |
</el-form-item> |
|
191 |
</el-col> |
|
192 |
<el-col :span="6"> |
|
193 |
<el-form-item label="报警上限" prop="bjsx"> |
|
194 |
<el-input v-model="dataForm.bjsx" placeholder="报警上限" maxlength="50" clearable></el-input> |
|
195 |
</el-form-item> |
|
196 |
</el-col> |
|
197 |
</el-row> |
|
198 |
<el-divider content-position="left">采集配置</el-divider> |
|
199 |
<el-row :gutter="20"> |
|
200 |
<el-col :span="12"> |
|
201 |
<el-form-item label="点类型" prop="pointTypeId"> |
|
202 |
<el-radio-group v-model="dataForm.pointTypeId" size="mini" disabled> |
|
203 |
<el-radio label="7d9fe1db-d7a1-407a-a267-ef2edab5cb6b" size="mini" @change="changePointtype">计量点</el-radio> |
|
204 |
<el-radio label="bc4f32dc-66d5-4aa6-8b84-9f166255282e" size="mini" @change="changePointtype">计算点</el-radio> |
|
205 |
<el-radio label="4dfe3d96-341a-47a4-91a2-3bed1bdcf3e2" size="mini" @change="changePointtype">常量点</el-radio> |
|
206 |
</el-radio-group> |
|
207 |
</el-form-item> |
|
208 |
</el-col> |
|
209 |
<!-- <el-col :span="6">--> |
|
210 |
<!-- <el-form-item label="存储表" prop="storeTypeId">--> |
|
211 |
<!-- <el-select v-model="dataForm.storeTypeId" placeholder="存储表" maxlength="36" clearable>--> |
|
212 |
<!-- <el-option--> |
|
213 |
<!-- v-for="item in storetypeList"--> |
|
214 |
<!-- :key="item.id"--> |
|
215 |
<!-- :label="item.storetypename"--> |
|
216 |
<!-- :value="item.id">--> |
|
217 |
<!-- </el-option>--> |
|
218 |
<!-- </el-select>--> |
|
219 |
<!-- </el-form-item>--> |
|
220 |
<!-- </el-col>--> |
|
221 |
<el-col :span="6"> |
|
222 |
<el-form-item label="启用状态" prop="enable"> |
|
223 |
<dict-select-tag v-model="dataForm.enable" placeholder="启用" dictCode="enable" /> |
|
224 |
</el-form-item> |
|
225 |
</el-col> |
|
226 |
</el-row> |
|
227 |
<el-row :gutter="20" v-if="dataForm.pointtypename === 'MEASURE'"> |
|
228 |
<el-col :span="12"> |
|
229 |
<el-form-item label="TAG编号" prop="measurePoint.tagno"> |
|
230 |
<el-input v-model="dataForm.measurePoint.tagno" placeholder="TAG编号" maxlength="50" clearable></el-input> |
|
231 |
</el-form-item> |
|
232 |
</el-col> |
|
233 |
<el-col :span="6"> |
|
234 |
<el-form-item label="数据类型" prop="measurePoint.datatypeid"> |
|
235 |
<el-select v-model="dataForm.measurePoint.datatypeid" placeholder="数据类型" maxlength="36" clearable> |
|
236 |
<el-option |
|
237 |
v-for="item in datatypeList" |
|
238 |
:key="item.id" |
|
239 |
:label="item.descp" |
|
240 |
:value="item.id"> |
|
241 |
</el-option> |
|
242 |
</el-select> |
|
243 |
</el-form-item> |
|
244 |
</el-col> |
|
245 |
<el-col :span="6"> |
|
246 |
<el-form-item label="采样范围" prop="dimension"> |
|
247 |
<el-input v-model="dataForm.dimension" placeholder="采样范围" maxlength="2" clearable> |
|
248 |
<template slot="append">min</template> |
|
249 |
</el-input> |
|
250 |
</el-form-item> |
|
251 |
</el-col> |
|
252 |
</el-row> |
|
253 |
<el-row :gutter="20" v-if="dataForm.pointtypename === 'MEASURE'"> |
|
254 |
<el-col :span="12"> |
|
255 |
<el-form-item label="数据源" prop="measurePoint.sourceid"> |
|
256 |
<el-select v-model="dataForm.measurePoint.sourceid" placeholder="数据源" maxlength="36"> |
|
257 |
<el-option |
|
258 |
v-for="item in sourceList" |
|
259 |
:key="item.id" |
|
260 |
:label="item.sourcename" |
|
261 |
:value="item.id"> |
|
262 |
</el-option> |
|
263 |
</el-select> |
|
264 |
</el-form-item> |
|
265 |
</el-col> |
|
266 |
</el-row> |
|
267 |
<el-row :gutter="20" v-if="dataForm.pointtypename === 'CALCULATE'"> |
|
268 |
<el-col :span="24"> |
|
269 |
<el-form-item label="表达式"> |
|
270 |
<el-table |
|
271 |
:data="expressionList" |
|
272 |
border |
|
273 |
style="width: 100%"> |
|
274 |
<el-table-column |
|
275 |
type="index" |
|
276 |
align="center" |
|
277 |
width="50" |
|
278 |
label="序号"> |
|
279 |
</el-table-column> |
|
280 |
<el-table-column |
|
281 |
prop="parenthesesLeft" |
|
282 |
label="左括号" |
|
283 |
width="90" |
|
284 |
align="center"> |
|
285 |
</el-table-column> |
|
286 |
<el-table-column |
|
287 |
prop="pointName" |
|
288 |
label="采集点" |
|
289 |
align="center"> |
|
290 |
</el-table-column> |
|
291 |
<el-table-column |
|
292 |
prop="point" |
|
293 |
label="运算值" |
|
294 |
align="center"> |
|
295 |
</el-table-column> |
|
296 |
<el-table-column |
|
297 |
prop="parenthesesRight" |
|
298 |
label="右括号" |
|
299 |
width="90" |
|
300 |
align="center"> |
|
301 |
</el-table-column> |
|
302 |
<el-table-column |
|
303 |
prop="operator" |
|
304 |
label="运算符" |
|
305 |
width="90" |
|
306 |
align="center"> |
|
307 |
</el-table-column> |
|
308 |
</el-table> |
|
309 |
</el-form-item> |
|
310 |
</el-col> |
|
311 |
</el-row> |
|
312 |
</el-form> |
|
313 |
<span slot="footer" class="dialog-footer"> |
|
314 |
<el-button :loading="loading" @click="visible = false">取消</el-button> |
|
315 |
</span> |
|
316 |
</el-dialog> |
|
317 |
</template> |
|
318 |
|
|
319 |
<script> |
|
320 |
import DictSelectTag from '@/components/dict/dict-select-tag' |
|
321 |
import {isPositiveInteger} from '@/utils/validate' |
|
322 |
export default { |
|
323 |
components: { |
|
324 |
DictSelectTag |
|
325 |
}, |
|
326 |
data () { |
|
327 |
let validIsPositiveInteger = (rule, value, callback) => { |
|
328 |
if (value && !isPositiveInteger(value)) { |
|
329 |
callback(new Error('应该为正整数')) |
|
330 |
} else { |
|
331 |
callback() |
|
332 |
} |
|
333 |
} |
|
334 |
return { |
|
335 |
loading: true, |
|
336 |
dialogWidth: 0, |
|
337 |
pointtypeList: [], |
|
338 |
pointtypeMap: {}, |
|
339 |
minfreqList: [], |
|
340 |
storetypeList: [], |
|
341 |
datatypeList: [], |
|
342 |
sourceList: [], |
|
343 |
expressionList: [], |
|
344 |
pointList: [], |
|
345 |
pointMap: {}, |
|
346 |
pointCodeMap: {}, |
|
347 |
operatorList: ['+', '-', '*', '/'], |
|
348 |
visible: false, |
|
349 |
roleList: [], |
|
350 |
jkxtOptions: [], |
|
351 |
deviceOptions: [], |
|
352 |
deviceMap: {}, |
|
353 |
allDictItems: JSON.parse(window.localStorage.getItem('DICT_ITEM_MAP')), |
|
354 |
dataForm: { |
|
355 |
id: '', |
|
356 |
mkbm: '', |
|
357 |
xtbm: '', |
|
358 |
jkbm: '', |
|
359 |
sbbm: '', |
|
360 |
cdbm: '', |
|
361 |
lsh: '', |
|
362 |
cdmc: '', |
|
363 |
cdmcSx: '', |
|
364 |
cdxxms: '', |
|
365 |
cdlx: 'double', |
|
366 |
dxbj: 1, |
|
367 |
lcxx: 0, |
|
368 |
lcsx: 1000, |
|
369 |
mrz: '', |
|
370 |
sjcd: '', |
|
371 |
jcqcd: '', |
|
372 |
dxd: '', |
|
373 |
ym: '', |
|
374 |
yd: 0, |
|
375 |
xs: '', |
|
376 |
py: '', |
|
377 |
jz: '', |
|
378 |
dy: '', |
|
379 |
ywfh: 0, |
|
380 |
xsws: '2', |
|
381 |
cljglx: '', |
|
382 |
ljl: 0, |
|
383 |
jldw: '', |
|
384 |
ybl: '', |
|
385 |
kzqId: '', |
|
386 |
bjxx: '', |
|
387 |
bjsx: '', |
|
388 |
ljcd: 0, |
|
389 |
scsj: '', |
|
390 |
sjybm: '', |
|
391 |
dimension: 1, |
|
392 |
pointTypeId: '7d9fe1db-d7a1-407a-a267-ef2edab5cb6b', |
|
393 |
storeTypeId: '', |
|
394 |
enable: 1, |
|
395 |
pointtypename: 'MEASURE', |
|
396 |
mathPoint: { |
|
397 |
id: '', |
|
398 |
pointid: '', |
|
399 |
expression: '' |
|
400 |
}, |
|
401 |
measurePoint: { |
|
402 |
id: '', |
|
403 |
pointid: '', |
|
404 |
tagno: '', |
|
405 |
datatypeid: '', |
|
406 |
sourceid: '', |
|
407 |
defaultvalue: '', |
|
408 |
maxvalue: '', |
|
409 |
minvalue: '' |
|
410 |
} |
|
411 |
}, |
|
412 |
dataRule: { |
|
413 |
'mkbm': [ |
|
414 |
{ required: true, message: '煤矿不能为空', trigger: 'blur' } |
|
415 |
], |
|
416 |
'xtbm': [ |
|
417 |
{ required: true, message: '生产安全系统不能为空', trigger: 'blur' } |
|
418 |
], |
|
419 |
'jkbm': [ |
|
420 |
{ required: true, message: '监控系统不能为空', trigger: 'blur' } |
|
421 |
], |
|
422 |
'sbbm': [ |
|
423 |
{ required: true, message: ' 设备(系统)不能为空', trigger: 'blur' } |
|
424 |
], |
|
425 |
'cdbm': [ |
|
426 |
{ required: true, message: '名称不能为空', trigger: 'blur' } |
|
427 |
], |
|
428 |
'cdmc': [ |
|
429 |
{ required: true, message: '点类型不能为空', trigger: 'blur' } |
|
430 |
], |
|
431 |
'cdxxms': [ |
|
432 |
{ required: true, message: '测点信息描述不能为空', trigger: 'blur' } |
|
433 |
], |
|
434 |
'cdlx': [ |
|
435 |
{ required: true, message: '测点类型不能为空', trigger: 'blur' } |
|
436 |
], |
|
437 |
'dxbj': [ |
|
438 |
{ required: true, message: '读写标记不能为空', trigger: 'blur' } |
|
439 |
], |
|
440 |
'lcxx': [ |
|
441 |
{ required: true, message: '量程下限不能为空', trigger: 'blur' } |
|
442 |
], |
|
443 |
'lcsx': [ |
|
444 |
{ required: true, message: '量程上限不能为空', trigger: 'blur' } |
|
445 |
], |
|
446 |
'ywfh': [ |
|
447 |
{ required: true, message: '有无符号不能为空', trigger: 'blur' } |
|
448 |
], |
|
449 |
'xsws': [ |
|
450 |
{ required: true, message: '小数位数不能为空', trigger: 'blur' } |
|
451 |
], |
|
452 |
'ljl': [ |
|
453 |
{ required: true, message: '累积量不能为空', trigger: 'blur' } |
|
454 |
], |
|
455 |
'ljcd': [ |
|
456 |
{ required: true, message: '逻辑测点不能为空', trigger: 'blur' } |
|
457 |
], |
|
458 |
'enable': [ |
|
459 |
{ required: true, message: '启用状态不能为空', trigger: 'blur' } |
|
460 |
], |
|
461 |
'pointTypeId': [ |
|
462 |
{ required: true, message: '点类型不能为空', trigger: 'blur' } |
|
463 |
], |
|
464 |
'storeTypeId': [ |
|
465 |
{ required: true, message: '存储类型不能为空', trigger: 'blur' } |
|
466 |
], |
|
467 |
'mrz': [ |
|
468 |
{ required: false, message: '存储类型不能为空', trigger: 'blur' } |
|
469 |
], |
|
470 |
'dimension': [ |
|
471 |
{ required: true, message: '采样范围不能为空', trigger: 'blur' }, |
|
472 |
{ validator: validIsPositiveInteger, trigger: 'blur' } |
|
473 |
], |
|
474 |
'measurePoint.tagno': [ |
|
475 |
{ required: true, message: '名称不能为空', trigger: 'blur' } |
|
476 |
], |
|
477 |
'measurePoint.datatypeid': [ |
|
478 |
{ required: true, message: '点类型不能为空', trigger: 'blur' } |
|
479 |
], |
|
480 |
'measurePoint.sourceid': [ |
|
481 |
{ required: true, message: '采集频率不能为空', trigger: 'blur' } |
|
482 |
] |
|
483 |
} |
|
484 |
} |
|
485 |
}, |
|
486 |
created () { |
|
487 |
this.setDialogWidth() |
|
488 |
}, |
|
489 |
mounted () { |
|
490 |
window.onresize = () => { |
|
491 |
return (() => { |
|
492 |
this.setDialogWidth() |
|
493 |
})() |
|
494 |
} |
|
495 |
}, |
|
496 |
methods: { |
|
497 |
setCdbm () { |
|
498 |
this.formData.cdbm = '' + this.formData.mkbm + this.formData.xtbm + this.formData.jkbm + this.formData.sbbm + this.formData.lsh |
|
499 |
}, |
|
500 |
setDialogWidth () { |
|
501 |
let val = document.body.clientWidth |
|
502 |
const def = 1300 // 默认宽度 |
|
503 |
if (val < def) { |
|
504 |
this.dialogWidth = '80%' |
|
505 |
} else { |
|
506 |
this.dialogWidth = '60%' |
|
507 |
} |
|
508 |
}, |
|
509 |
init (id) { |
|
510 |
this.getPointtypeList(id) |
|
511 |
this.getStoretypeList() |
|
512 |
this.getDatatypeList() |
|
513 |
this.getSourceList() |
|
514 |
this.getPointList() |
|
515 |
this.dataForm.id = id || 0 |
|
516 |
this.loading = true |
|
517 |
this.visible = true |
|
518 |
this.$nextTick(() => { |
|
519 |
this.$refs['dataForm'].resetFields() |
|
520 |
this.expressionList = [{ |
|
521 |
parenthesesLeft: '', |
|
522 |
point: '', |
|
523 |
parenthesesRight: '', |
|
524 |
operator: '' |
|
525 |
}] |
|
526 |
this.dataForm.measurePoint.tagno = '' |
|
527 |
this.dataForm.measurePoint.datatypeid = '' |
|
528 |
this.dataForm.measurePoint.sourceid = '' |
|
529 |
this.dataForm.pointTypeId = '7d9fe1db-d7a1-407a-a267-ef2edab5cb6b' |
|
530 |
this.dataForm.pointtypename = 'MEASURE' |
|
531 |
}) |
|
532 |
if (id) { |
|
533 |
this.$http({ |
|
534 |
url: `/data/data/point/info/${this.dataForm.id}`, |
|
535 |
method: 'get', |
|
536 |
params: this.$http.adornParams() |
|
537 |
}).then(({data}) => { |
|
538 |
this.expressionList = [] |
|
539 |
if (data && data.code === 0) { |
|
540 |
this.dataForm = data.data |
|
541 |
this.getJkxt(this.dataForm.xtbm) |
|
542 |
this.getDevice(this.dataForm.jkbm) |
|
543 |
if (this.dataForm.pointtypename && |
|
544 |
this.dataForm.pointtypename === 'CALCULATE' && |
|
545 |
this.dataForm.mathPoint.expression) { |
|
546 |
let expression = this.dataForm.mathPoint.expression |
|
547 |
do { |
|
548 |
let indexArray = [expression.indexOf('+'), expression.indexOf('-'), expression.indexOf('*'), expression.indexOf('/')].sort(this.numAscSort) |
|
549 |
if (indexArray[indexArray.length - 1] !== -1) { |
|
550 |
let endIndex = 0 |
|
551 |
for (let key in indexArray) { |
|
552 |
if (indexArray[key] > -1) { |
|
553 |
endIndex = indexArray[key] |
|
554 |
break |
|
555 |
} |
|
556 |
} |
|
557 |
let pointStr = expression.substring(0, endIndex) |
|
558 |
let operator = expression.substr(endIndex, 1) |
|
559 |
let indexOfParenthesesLeft = pointStr.indexOf('(') |
|
560 |
let lastIndexOfParenthesesLeft = pointStr.lastIndexOf('(') |
|
561 |
let parenthesesLeft = '' |
|
562 |
if (indexOfParenthesesLeft !== -1 && lastIndexOfParenthesesLeft !== -1) { |
|
563 |
parenthesesLeft = pointStr.substring(indexOfParenthesesLeft, lastIndexOfParenthesesLeft + 1) |
|
564 |
pointStr = pointStr.substring(lastIndexOfParenthesesLeft + 1) |
|
565 |
} |
|
566 |
|
|
567 |
let indexOfParenthesesRight = pointStr.indexOf(')') |
|
568 |
let lastIndexOfParenthesesRight = pointStr.lastIndexOf(')') |
|
569 |
let parenthesesRight = '' |
|
570 |
if (indexOfParenthesesRight !== -1 && lastIndexOfParenthesesRight !== -1) { |
|
571 |
parenthesesRight = pointStr.substring(indexOfParenthesesRight, lastIndexOfParenthesesRight + 1) |
|
572 |
pointStr = pointStr.substring(0, indexOfParenthesesRight) |
|
573 |
} |
|
574 |
this.expressionList.push({ |
|
575 |
parenthesesLeft: parenthesesLeft, |
|
576 |
pointName: this.pointCodeMap[pointStr] || pointStr, |
|
577 |
point: pointStr, |
|
578 |
parenthesesRight: parenthesesRight, |
|
579 |
operator: operator |
|
580 |
}) |
|
581 |
expression = expression.substring(endIndex + 1) |
|
582 |
} else { |
|
583 |
let pointStr = expression |
|
584 |
let indexOfParenthesesLeft = pointStr.indexOf('(') |
|
585 |
let lastIndexOfParenthesesLeft = pointStr.lastIndexOf('(') |
|
586 |
let parenthesesLeft = '' |
|
587 |
if (indexOfParenthesesLeft !== -1 && lastIndexOfParenthesesLeft !== -1) { |
|
588 |
parenthesesLeft = pointStr.substring(indexOfParenthesesLeft, lastIndexOfParenthesesLeft + 1) |
|
589 |
pointStr = pointStr.substring(lastIndexOfParenthesesLeft + 1) |
|
590 |
} |
|
591 |
let indexOfParenthesesRight = pointStr.indexOf(')') |
|
592 |
let lastIndexOfParenthesesRight = pointStr.lastIndexOf(')') |
|
593 |
let parenthesesRight = '' |
|
594 |
if (indexOfParenthesesRight !== -1 && lastIndexOfParenthesesRight !== -1) { |
|
595 |
parenthesesRight = pointStr.substring(indexOfParenthesesRight, lastIndexOfParenthesesRight + 1) |
|
596 |
pointStr = pointStr.substring(0, indexOfParenthesesRight) |
|
597 |
} |
|
598 |
this.expressionList.push({ |
|
599 |
parenthesesLeft: parenthesesLeft, |
|
600 |
pointName: this.pointCodeMap[pointStr] || pointStr, |
|
601 |
point: pointStr, |
|
602 |
parenthesesRight: parenthesesRight, |
|
603 |
operator: '' |
|
604 |
}) |
|
605 |
expression = '' |
|
606 |
} |
|
607 |
} while (expression && expression.length > 0) |
|
608 |
this.dataForm.expressionList = this.expressionList |
|
609 |
} |
|
610 |
this.loading = false |
|
611 |
} |
|
612 |
}) |
|
613 |
} else { |
|
614 |
this.loading = false |
|
615 |
} |
|
616 |
}, |
|
617 |
|
|
618 |
changeMkbm () { |
|
619 |
this.dataForm.xtbm = '' |
|
620 |
this.dataForm.jkbm = '' |
|
621 |
this.dataForm.sbbm = '' |
|
622 |
}, |
|
623 |
|
|
624 |
changeScxt () { |
|
625 |
this.dataForm.jkbm = '' |
|
626 |
this.dataForm.sbbm = '' |
|
627 |
if (this.dataForm.xtbm) { |
|
628 |
this.jkxtOptions = [] |
|
629 |
this.getJkxt(this.dataForm.xtbm) |
|
630 |
} |
|
631 |
}, |
|
632 |
|
|
633 |
getJkxt (scxtbm) { |
|
634 |
this.$http({ |
|
635 |
url: `/data/data/jkxt/all-list`, |
|
636 |
method: 'get', |
|
637 |
params: this.$http.adornParams({ |
|
638 |
'scxtbm': scxtbm |
|
639 |
}) |
|
640 |
}).then(({data}) => { |
|
641 |
if (data && data.code === 0) { |
|
642 |
this.jkxtOptions = data.data |
|
643 |
} |
|
644 |
}) |
|
645 |
}, |
|
646 |
|
|
647 |
changeDevice () { |
|
648 |
this.dataForm.cdmc = '' |
|
649 |
if (this.allDictItems['mkbm']) { |
|
650 |
let mkList = this.allDictItems['mkbm'] |
|
651 |
let mkMap = {} |
|
652 |
mkList.forEach(function (item) { |
|
653 |
mkMap[item.itemValue] = item.itemText |
|
654 |
}) |
|
655 |
this.dataForm.cdmc = mkMap[this.dataForm.mkbm] + '+' + this.deviceMap[this.dataForm.sbbm] + '+' |
|
656 |
} |
|
657 |
}, |
|
658 |
|
|
659 |
changeJkxt () { |
|
660 |
this.dataForm.sbbm = '' |
|
661 |
if (this.dataForm.jkbm) { |
|
662 |
this.deviceOptions = [] |
|
663 |
this.getDevice(this.dataForm.jkbm) |
|
664 |
} |
|
665 |
}, |
|
666 |
|
|
667 |
getDevice (jkbm) { |
|
668 |
this.$http({ |
|
669 |
url: `/data/data/device/all-list`, |
|
670 |
method: 'get', |
|
671 |
params: this.$http.adornParams({ |
|
672 |
'jkxtbm': jkbm |
|
673 |
}) |
|
674 |
}).then(({data}) => { |
|
675 |
if (data && data.code === 0) { |
|
676 |
this.deviceOptions = data.data |
|
677 |
if (this.deviceOptions) { |
|
678 |
this.deviceOptions.forEach(function (item) { |
|
679 |
this.deviceMap[item.sbbm] = item.sbmc |
|
680 |
}, this) |
|
681 |
} |
|
682 |
} |
|
683 |
}) |
|
684 |
}, |
|
685 |
|
|
686 |
addParenthesesLeft (index, row) { |
|
687 |
if (row.parenthesesLeft) { |
|
688 |
row.parenthesesLeft = row.parenthesesLeft + '(' |
|
689 |
} else { |
|
690 |
row.parenthesesLeft = '(' |
|
691 |
} |
|
692 |
}, |
|
693 |
|
|
694 |
removeParenthesesLeft (index, row) { |
|
695 |
if (row.parenthesesLeft) { |
|
696 |
row.parenthesesLeft = row.parenthesesLeft.substring(0, row.parenthesesLeft.length - 1) |
|
697 |
} else { |
|
698 |
row.parenthesesLeft = '' |
|
699 |
} |
|
700 |
}, |
|
701 |
addParenthesesRight (index, row) { |
|
702 |
if (row.parenthesesRight) { |
|
703 |
row.parenthesesRight = row.parenthesesRight + ')' |
|
704 |
} else { |
|
705 |
row.parenthesesRight = ')' |
|
706 |
} |
|
707 |
}, |
|
708 |
removeParenthesesRight (index, row) { |
|
709 |
if (row.parenthesesRight) { |
|
710 |
row.parenthesesRight = row.parenthesesRight.substring(0, row.parenthesesRight.length - 1) |
|
711 |
} else { |
|
712 |
row.parenthesesRight = '' |
|
713 |
} |
|
714 |
}, |
|
715 |
numAscSort (a, b) { |
|
716 |
return a - b |
|
717 |
}, |
|
718 |
resetFields (obj) { |
|
719 |
for (let key in obj) { |
|
720 |
if (key === 'pointtypename') { |
|
721 |
continue |
|
722 |
} |
|
723 |
if (obj[key] instanceof Array) { |
|
724 |
obj[key] = [] |
|
725 |
} else if (obj[key] instanceof Object) { |
|
726 |
this.resetFields(obj[key]) |
|
727 |
} else { |
|
728 |
obj[key] = '' |
|
729 |
} |
|
730 |
} |
|
731 |
}, |
|
732 |
setDefaultFields (id, pointtypename) { |
|
733 |
this.dataForm.id = id || 0 |
|
734 |
this.dataForm.pointtypename = pointtypename || '' |
|
735 |
this.dataForm.point.dimension = 1 |
|
736 |
this.expressionList = [{ |
|
737 |
parenthesesLeft: '', |
|
738 |
point: '', |
|
739 |
parenthesesRight: '', |
|
740 |
operator: '' |
|
741 |
}] |
|
742 |
}, |
|
743 |
// 获取预测项类型列表 |
|
744 |
getPointtypeList (id) { |
|
745 |
this.$http({ |
|
746 |
url: '/data/data/point-type/list', |
|
747 |
method: 'get', |
|
748 |
params: this.$http.adornParams({ |
|
749 |
'page': 1, |
|
750 |
'limit': 100 |
|
751 |
}) |
|
752 |
}).then(({data}) => { |
|
753 |
if (data && data.code === 0) { |
|
754 |
this.pointtypeList = data.page.list |
|
755 |
this.pointtypeList.forEach(function (value) { |
|
756 |
this.pointtypeMap[value.id] = value.pointtypename |
|
757 |
}, this) |
|
758 |
} else { |
|
759 |
this.pointtypeList = [] |
|
760 |
} |
|
761 |
}) |
|
762 |
}, |
|
763 |
getStoretypeList () { |
|
764 |
this.$http({ |
|
765 |
url: '/data/data/store-type/list', |
|
766 |
method: 'get', |
|
767 |
params: this.$http.adornParams({ |
|
768 |
'page': 1, |
|
769 |
'limit': 100 |
|
770 |
}) |
|
771 |
}).then(({data}) => { |
|
772 |
if (data && data.code === 0) { |
|
773 |
this.storetypeList = data.page.list |
|
774 |
} else { |
|
775 |
this.storetypeList = [] |
|
776 |
} |
|
777 |
}) |
|
778 |
}, |
|
779 |
getDatatypeList () { |
|
780 |
this.$http({ |
|
781 |
url: '/data/data/data-type/list', |
|
782 |
method: 'get', |
|
783 |
params: this.$http.adornParams({ |
|
784 |
'page': 1, |
|
785 |
'limit': 100 |
|
786 |
}) |
|
787 |
}).then(({data}) => { |
|
788 |
if (data && data.code === 0) { |
|
789 |
this.datatypeList = data.page.list |
|
790 |
} else { |
|
791 |
this.datatypeList = [] |
|
792 |
} |
|
793 |
}) |
|
794 |
}, |
|
795 |
getSourceList () { |
|
796 |
this.$http({ |
|
797 |
url: '/data/data/data-source/list', |
|
798 |
method: 'get', |
|
799 |
params: this.$http.adornParams({ |
|
800 |
'page': 1, |
|
801 |
'limit': 100 |
|
802 |
}) |
|
803 |
}).then(({data}) => { |
|
804 |
if (data && data.code === 0) { |
|
805 |
this.sourceList = data.page.list |
|
806 |
} else { |
|
807 |
this.sourceList = [] |
|
808 |
} |
|
809 |
}) |
|
810 |
}, |
|
811 |
getPointList () { |
|
812 |
this.$http({ |
|
813 |
url: '/data/data/point/list/all', |
|
814 |
method: 'get', |
|
815 |
params: { |
|
816 |
'pointtypename': 'MEASURE' |
|
817 |
} |
|
818 |
}).then(({data}) => { |
|
819 |
if (data && data.code === 0) { |
|
820 |
this.pointList = data.data |
|
821 |
this.pointList.forEach(function (value) { |
|
822 |
this.pointMap[value.id] = value.cdmc |
|
823 |
this.pointCodeMap[value.cdbm] = value.cdmc |
|
824 |
}, this) |
|
825 |
} else { |
|
826 |
this.pointList = [] |
|
827 |
} |
|
828 |
}) |
|
829 |
}, |
|
830 |
changePointtype (value) { |
|
831 |
this.dataForm.pointtypename = this.pointtypeMap[value] |
|
832 |
if (this.dataForm.pointtypename === 'CONSTANT') { |
|
833 |
this.dataRule['mrz'][0].required = true |
|
834 |
} else { |
|
835 |
this.dataRule['mrz'][0].required = false |
|
836 |
} |
|
837 |
}, |
|
838 |
deleteExpressionRow (index, rows) { |
|
839 |
if (!rows || rows.length === 1) { |
|
840 |
this.$message({ |
|
841 |
message: '不能全部删除!', |
|
842 |
type: 'error', |
|
843 |
duration: 1500 |
|
844 |
}) |
|
845 |
return |
|
846 |
} |
|
847 |
rows.splice(index, 1) |
|
848 |
}, |
|
849 |
addExpressionRow (index, rows) { |
|
850 |
let row = JSON.parse(JSON.stringify(rows[index])) |
|
851 |
rows.splice(index, 0, row) |
|
852 |
} |
|
853 |
} |
|
854 |
} |
|
855 |
</script> |
|
856 |
<style> |
|
857 |
.el-select { |
|
858 |
width:100% |
|
859 |
} |
|
860 |
.el-input-group__append { |
|
861 |
padding: 0 5px 0 5px |
|
862 |
} |
|
863 |
.el-input-group__prepend { |
|
864 |
padding: 0 5px 0 5px |
|
865 |
} |
|
866 |
.el-radio+.el-radio { |
|
867 |
margin-left: 10px !important; |
|
868 |
} |
|
869 |
</style> |
|
870 |
|