提交 | 用户 | 时间
|
7462da
|
1 |
<template> |
32396c
|
2 |
<Dialog v-model="dialogVisible" :title="dialogTitle" width="60%"> |
7462da
|
3 |
<el-form |
L |
4 |
ref="formRef" |
|
5 |
v-loading="formLoading" |
cd9f11
|
6 |
:model="dataForm" |
7462da
|
7 |
:rules="formRules" |
be4298
|
8 |
label-width="100px" |
7462da
|
9 |
> |
cd9f11
|
10 |
<el-divider content-position="left">基本信息</el-divider> |
7462da
|
11 |
<el-row> |
L |
12 |
<el-col :span="12"> |
d3ee81
|
13 |
<el-form-item label="预测项名" prop="mmPredictItem.itemname"> |
潘 |
14 |
<el-input v-model="dataForm.mmPredictItem.itemname" placeholder="预测项名" |
|
15 |
maxlength="50"/> |
7462da
|
16 |
</el-form-item> |
L |
17 |
</el-col> |
e1ff2d
|
18 |
<el-col :span="12"> |
d3ee81
|
19 |
<el-form-item label="编号" prop="mmPredictItem.itemno"> |
61c379
|
20 |
<el-input v-model="dataForm.mmPredictItem.itemno" placeholder="编号" maxlength="50" |
潘 |
21 |
readonly/> |
7462da
|
22 |
</el-form-item> |
L |
23 |
</el-col> |
|
24 |
</el-row> |
|
25 |
<el-row> |
|
26 |
<el-col :span="12"> |
d3ee81
|
27 |
<el-form-item label="类型" prop="mmPredictItem.itemtypeid"> |
2caade
|
28 |
<el-select |
L |
29 |
v-model="dataForm.mmPredictItem.itemtypeid" @change="changeItemtype" |
|
30 |
placeholder="请选择"> |
cd9f11
|
31 |
<el-option |
L |
32 |
v-for="item in itemTypeList" |
|
33 |
:key="item.id" |
|
34 |
:label="item.itemtypename" |
|
35 |
:value="item.id"/> |
|
36 |
</el-select> |
7462da
|
37 |
</el-form-item> |
L |
38 |
</el-col> |
|
39 |
<el-col :span="12"> |
e1ff2d
|
40 |
<el-form-item label="粒度" prop="mmPredictItem.granularity"> |
d3ee81
|
41 |
<el-select v-model="dataForm.mmPredictItem.granularity" placeholder="请选择"> |
潘 |
42 |
<el-option |
4c7918
|
43 |
v-for="dict in getIntDictOptions(DICT_TYPE.PRED_GRANULARITY)" |
d3ee81
|
44 |
:key="dict.value" |
潘 |
45 |
:label="dict.label" |
|
46 |
:value="dict.value" |
|
47 |
/> |
|
48 |
</el-select> |
7462da
|
49 |
</el-form-item> |
L |
50 |
</el-col> |
|
51 |
</el-row> |
|
52 |
<el-row> |
|
53 |
<el-col :span="12"> |
e1ff2d
|
54 |
<el-form-item label="是否检查" prop="mmPredictItem.workchecked"> |
cd9f11
|
55 |
<el-select v-model="dataForm.mmPredictItem.workchecked" placeholder="请选择"> |
L |
56 |
<el-option |
d3ee81
|
57 |
v-for="dict in getIntDictOptions(DICT_TYPE.COM_IS_INT)" |
潘 |
58 |
:key="dict.value" |
|
59 |
:label="dict.label" |
|
60 |
:value="dict.value" |
|
61 |
/> |
cd9f11
|
62 |
</el-select> |
7462da
|
63 |
</el-form-item> |
L |
64 |
</el-col> |
|
65 |
<el-col :span="12"> |
e1ff2d
|
66 |
<el-form-item label="是否启用" prop="mmPredictItem.status"> |
d3ee81
|
67 |
<el-select v-model="dataForm.mmPredictItem.status" placeholder="请选择"> |
cd9f11
|
68 |
<el-option |
d3ee81
|
69 |
v-for="dict in getIntDictOptions(DICT_TYPE.COM_IS_INT)" |
潘 |
70 |
:key="dict.value" |
|
71 |
:label="dict.label" |
|
72 |
:value="dict.value" |
|
73 |
/> |
cd9f11
|
74 |
</el-select> |
7462da
|
75 |
</el-form-item> |
L |
76 |
</el-col> |
|
77 |
</el-row> |
|
78 |
<el-row> |
|
79 |
<el-col :span="12"> |
e1ff2d
|
80 |
<el-form-item label="管网" prop="dmModuleItem.moduleid"> |
cd9f11
|
81 |
<el-select v-model="dataForm.dmModuleItem.moduleid" placeholder="请选择"> |
L |
82 |
<el-option |
|
83 |
v-for="item in moduleList" |
|
84 |
:key="item.id" |
|
85 |
:label="item.modulename" |
|
86 |
:value="item.id"/> |
|
87 |
</el-select> |
7462da
|
88 |
</el-form-item> |
L |
89 |
</el-col> |
|
90 |
<el-col :span="12"> |
2caade
|
91 |
<el-form-item label="类别"> |
83f63a
|
92 |
<el-input v-model="dataForm.dmModuleItem.categoryid" placeholder="类别" maxlength="64"/> |
7462da
|
93 |
</el-form-item> |
L |
94 |
</el-col> |
|
95 |
</el-row> |
|
96 |
<el-row> |
|
97 |
<el-col :span="12"> |
e1ff2d
|
98 |
<el-form-item label="排序" prop="dmModuleItem.itemorder"> |
d3ee81
|
99 |
<el-input-number v-model="dataForm.dmModuleItem.itemorder" :min="1" clearable |
潘 |
100 |
controls-position="right"/> |
7462da
|
101 |
</el-form-item> |
L |
102 |
</el-col> |
|
103 |
</el-row> |
cd9f11
|
104 |
<el-row v-if="dataForm.itemtypename === 'MergeItem'"> |
7462da
|
105 |
<el-col :span="12"> |
2caade
|
106 |
<el-form-item label="预测长度"> |
L |
107 |
<el-input |
|
108 |
v-model="dataForm.mmPredictItem.predictlength" placeholder="预测长度" |
|
109 |
maxlength="5"/> |
7462da
|
110 |
</el-form-item> |
L |
111 |
</el-col> |
|
112 |
</el-row> |
cd9f11
|
113 |
<el-divider content-position="left" v-if="dataForm.itemtypename === 'NormalItem'">模型信息 |
L |
114 |
</el-divider> |
d3ee81
|
115 |
<el-row :gutter="8" v-if="dataForm.itemtypename === 'NormalItem'"> |
潘 |
116 |
<el-col :span="12"> |
2caade
|
117 |
<el-form-item label="模型名称"> |
L |
118 |
<el-input |
|
119 |
v-model="dataForm.mmPredictModel.modelname" placeholder="模型名称" |
|
120 |
maxlength="50"/> |
cd9f11
|
121 |
</el-form-item> |
L |
122 |
</el-col> |
7462da
|
123 |
<el-col :span="12"> |
d3ee81
|
124 |
<el-upload |
潘 |
125 |
class="upload-demo" |
|
126 |
:limit="1" |
|
127 |
:file-list="fileList" |
|
128 |
:before-upload="beforeUpload" |
|
129 |
:on-success="uploadModelSuccess" |
|
130 |
:on-error="uploadModelError" |
|
131 |
:action="uploadUrl" |
4c7918
|
132 |
:show-file-list="false" |
d3ee81
|
133 |
:http-request="httpRequest"> |
潘 |
134 |
<el-button type="primary" @click="setReplaceModelOnly(false)"> |
|
135 |
<Icon icon="ep:upload"/> |
|
136 |
上传模型 |
|
137 |
</el-button> |
|
138 |
<el-button |
|
139 |
size="small" type="primary" @click="setReplaceModelOnly(true)" |
e1ff2d
|
140 |
v-if="formType.value === 'update'"> |
d3ee81
|
141 |
<Icon icon="ep:upload"/> |
潘 |
142 |
更新模型 |
|
143 |
</el-button> |
|
144 |
</el-upload> |
7462da
|
145 |
</el-col> |
L |
146 |
</el-row> |
be4298
|
147 |
<el-row v-if="dataForm.itemtypename === 'NormalItem'"> |
d8e4be
|
148 |
<el-col :span="12"> |
afc4d5
|
149 |
<el-form-item label="关联项目"> |
be4298
|
150 |
<el-select v-model="dataForm.mmPredictModel.mpkprojectid" placeholder="请选择"> |
D |
151 |
<el-option |
|
152 |
v-for="item in mpkProjectList" |
|
153 |
:key="item.id" |
|
154 |
:label="item.projectName" |
|
155 |
:value="item.id"/> |
|
156 |
</el-select> |
|
157 |
</el-form-item> |
|
158 |
</el-col> |
d8e4be
|
159 |
<el-col :span="12"> |
e1ff2d
|
160 |
<el-form-item label="编号"> |
d3ee81
|
161 |
<el-input |
e1ff2d
|
162 |
v-model="dataForm.mmPredictModel.modelno" placeholder="编号" maxlength="30" readonly |
d3ee81
|
163 |
disabled/> |
潘 |
164 |
</el-form-item> |
|
165 |
</el-col> |
cd9f11
|
166 |
</el-row> |
d3ee81
|
167 |
<el-row :gutter="8" v-if="dataForm.itemtypename === 'NormalItem'"> |
cd9f11
|
168 |
<el-col :span="24"> |
2caade
|
169 |
<el-form-item label="路径"> |
L |
170 |
<el-input |
|
171 |
v-model="dataForm.mmPredictModel.modelpath" placeholder="路径" maxlength="32" |
|
172 |
disabled/> |
cd9f11
|
173 |
</el-form-item> |
L |
174 |
</el-col> |
|
175 |
</el-row> |
d3ee81
|
176 |
<el-row :gutter="8" v-if="dataForm.itemtypename === 'NormalItem'"> |
cd9f11
|
177 |
<el-col :span="24"> |
2caade
|
178 |
<el-form-item label="类名"> |
L |
179 |
<el-input |
|
180 |
v-model="dataForm.mmPredictModel.classname" placeholder="类名" maxlength="32" |
|
181 |
disabled/> |
cd9f11
|
182 |
</el-form-item> |
L |
183 |
</el-col> |
|
184 |
</el-row> |
d3ee81
|
185 |
<el-row :gutter="8" v-if="dataForm.itemtypename === 'NormalItem'"> |
cd9f11
|
186 |
<el-col :span="12"> |
2caade
|
187 |
<el-form-item label="方法名"> |
L |
188 |
<el-input |
|
189 |
v-model="dataForm.mmPredictModel.methodname" placeholder="方法名" |
|
190 |
maxlength="32" disabled/> |
cd9f11
|
191 |
</el-form-item> |
L |
192 |
</el-col> |
|
193 |
<el-col :span="12"> |
2caade
|
194 |
<el-form-item label="参数"> |
L |
195 |
<el-input |
|
196 |
v-model="dataForm.mmPredictModel.modelparamstructure" placeholder="参数" |
|
197 |
maxlength="32" disabled/> |
cd9f11
|
198 |
</el-form-item> |
L |
199 |
</el-col> |
|
200 |
</el-row> |
d8e4be
|
201 |
<el-divider content-position="left" v-if="dataForm.itemtypename === 'NormalItem'">模型输出 |
D |
202 |
</el-divider> |
|
203 |
<el-button |
|
204 |
@click="addItemOutput(dataForm.mmItemOutputList)" |
|
205 |
type="primary" |
|
206 |
size="small"> |
|
207 |
添加 |
|
208 |
</el-button> |
|
209 |
<el-table |
|
210 |
v-if="dataForm.itemtypename === 'NormalItem'" |
|
211 |
:data="dataForm.mmItemOutputList" |
|
212 |
border |
|
213 |
style="width: 100%; margin-top: 5px;"> |
61c379
|
214 |
<el-table-column prop="outputorder" label="排序" align="center" width="80px"/> |
32396c
|
215 |
<el-table-column label="结果KEY" align="center" width="150px"> |
d8e4be
|
216 |
<template #default="scope"> |
D |
217 |
<el-input v-model="scope.row.resultstr" placeholder="请输入"/> |
|
218 |
</template> |
|
219 |
</el-table-column> |
32396c
|
220 |
<el-table-column label="结果类型" align="center" width="150px"> |
d8e4be
|
221 |
<template #default="scope"> |
D |
222 |
<el-select |
|
223 |
v-model="scope.row.resultType" |
|
224 |
@change="(value) => resultTypeChange(value,scope.row)" |
|
225 |
filterable |
|
226 |
placeholder="请选择"> |
|
227 |
<el-option |
|
228 |
v-for="dict in getIntDictOptions(DICT_TYPE.MODEL_RESULT_TYPE)" |
|
229 |
:key="dict.value" |
|
230 |
:label="dict.label" |
|
231 |
:value="dict.value"/> |
|
232 |
</el-select> |
|
233 |
</template> |
|
234 |
</el-table-column> |
32396c
|
235 |
<el-table-column label="索引" align="center" width="100px"> |
d8e4be
|
236 |
<template #default="scope"> |
61c379
|
237 |
<el-input-number style="width:100%;hight:100%" :disabled="scope.row.resultType !== 2" |
潘 |
238 |
v-model="scope.row.resultIndex" :min="0" step-strictly |
|
239 |
controls-position="right"/> |
32396c
|
240 |
</template> |
潘 |
241 |
</el-table-column> |
|
242 |
<el-table-column label="结果名称" align="center" width="150px"> |
|
243 |
<template #default="scope"> |
|
244 |
<el-input v-model="scope.row.resultName" placeholder="请输入"/> |
d8e4be
|
245 |
</template> |
D |
246 |
</el-table-column> |
|
247 |
<el-table-column label="数据点" align="center"> |
|
248 |
<template #default="scope"> |
|
249 |
<el-select |
|
250 |
v-model="scope.row.pointid" |
|
251 |
filterable |
|
252 |
@change="(value) => changeOutputPoint(value,scope.row)" |
|
253 |
placeholder="请选择"> |
|
254 |
<el-option |
|
255 |
v-for="item in pointList" |
|
256 |
:key="item.id" |
|
257 |
:label="item.pointName" |
|
258 |
:value="item.id"/> |
|
259 |
</el-select> |
|
260 |
</template> |
|
261 |
</el-table-column> |
|
262 |
<el-table-column prop="" label="操作" width="80" align="center"> |
|
263 |
<template #default="scope"> |
|
264 |
<el-button |
|
265 |
@click="deleteItemOutput(scope.$index, dataForm.mmItemOutputList)" |
|
266 |
type="text" |
|
267 |
size="small"> |
|
268 |
删除 |
|
269 |
</el-button> |
|
270 |
</template> |
|
271 |
</el-table-column> |
|
272 |
</el-table> |
|
273 |
<el-divider content-position="left" v-if="dataForm.itemtypename === 'NormalItem'">模型设置参数 |
|
274 |
</el-divider> |
cd9f11
|
275 |
<el-table |
L |
276 |
v-if="dataForm.itemtypename === 'NormalItem'" |
|
277 |
:data="dataForm.mmModelArithSettingsList" |
|
278 |
border |
|
279 |
style="width: 100%; margin-top: 5px;"> |
7b1ce6
|
280 |
<el-table-column prop="key" label="键" align="center" min-width="150"/> |
潘 |
281 |
<el-table-column prop="name" label="名称" align="center" min-width="150"/> |
|
282 |
<el-table-column prop="valuetype" label="类型" align="center" min-width="150"/> |
32396c
|
283 |
<el-table-column prop="" label="值" align="center" min-width="200"> |
cd9f11
|
284 |
<template #default="scope"> |
d3ee81
|
285 |
<el-input size="mini" v-model="scope.row.value" maxlength="256" |
潘 |
286 |
style="width:100%;height:100%"/> |
cd9f11
|
287 |
</template> |
L |
288 |
</el-table-column> |
|
289 |
</el-table> |
d8e4be
|
290 |
<el-divider content-position="left" v-if="dataForm.itemtypename === 'NormalItem'">模型输入参数 |
cd9f11
|
291 |
</el-divider> |
L |
292 |
<el-table |
2caade
|
293 |
v-if="dataForm.itemtypename === 'NormalItem'" |
cd9f11
|
294 |
:data="dataForm.mmModelParamList" |
L |
295 |
border |
|
296 |
style="width: 100%; margin-top: 5px;"> |
|
297 |
<el-table-column prop="modelparamportorder" label="端口" width="60" align="center"/> |
|
298 |
<el-table-column prop="modelparamorder" label="序号" width="60" align="center"/> |
|
299 |
<el-table-column prop="" label="类型" width="200" align="center"> |
|
300 |
<template #default="scope"> |
61c379
|
301 |
<el-select v-model="scope.row.modelparamtype" |
潘 |
302 |
@change="changeModelparamtype(scope.row)" |
|
303 |
placeholder="请选择"> |
cd9f11
|
304 |
<el-option |
d3ee81
|
305 |
v-for="dict in getStrDictOptions(DICT_TYPE.MODEL_PARAM_TYPE)" |
潘 |
306 |
:key="dict.value" |
|
307 |
:label="dict.label" |
|
308 |
:value="dict.value" |
|
309 |
/> |
cd9f11
|
310 |
</el-select> |
L |
311 |
</template> |
|
312 |
</el-table-column> |
|
313 |
<el-table-column prop="" label="参数名称" align="center"> |
|
314 |
<template #default="scope"> |
|
315 |
<el-select |
|
316 |
v-model="scope.row.modelparamid" |
|
317 |
filterable |
|
318 |
@change="changeModelparam(scope.row)" |
|
319 |
placeholder="请选择"> |
|
320 |
<el-option |
|
321 |
v-for="(item, index) in modelparamListMap[scope.row.modelparamtype]" |
|
322 |
:key="index" |
|
323 |
:label="item.name" |
|
324 |
:value="item.id"/> |
|
325 |
</el-select> |
|
326 |
</template> |
|
327 |
</el-table-column> |
|
328 |
<el-table-column prop="" label="参数长度" width="120" align="center"> |
|
329 |
<template #default="scope"> |
e1ff2d
|
330 |
<el-input-number v-model="scope.row.datalength" :min="0" clearable |
潘 |
331 |
controls-position="right" |
|
332 |
style="width:100%;hight:100%"/> |
cd9f11
|
333 |
</template> |
L |
334 |
</el-table-column> |
7b1ce6
|
335 |
<el-table-column prop="" label="操作" width="120" align="center"> |
cd9f11
|
336 |
<template #default="scope"> |
L |
337 |
<el-button |
|
338 |
@click="addRow(scope.$index, dataForm.mmModelParamList)" |
|
339 |
type="text" |
7b1ce6
|
340 |
size="mini"> |
cd9f11
|
341 |
添加 |
L |
342 |
</el-button> |
|
343 |
<el-button |
|
344 |
@click="deleteRow(scope.$index, dataForm.mmModelParamList)" |
|
345 |
type="text" |
7b1ce6
|
346 |
size="mini"> |
cd9f11
|
347 |
删除 |
L |
348 |
</el-button> |
|
349 |
</template> |
|
350 |
</el-table-column> |
|
351 |
</el-table> |
|
352 |
<el-divider content-position="left" v-if="dataForm.itemtypename === 'MergeItem'">表达式 |
|
353 |
</el-divider> |
|
354 |
<el-table |
2caade
|
355 |
v-if="dataForm.itemtypename === 'MergeItem'" |
cd9f11
|
356 |
:data="expressionList" |
L |
357 |
border |
|
358 |
style="width: 100%; margin-top: 5px;"> |
|
359 |
<el-table-column |
|
360 |
prop="" |
|
361 |
label="预测项" |
|
362 |
align="center"> |
|
363 |
<template #default="scope"> |
|
364 |
<el-select |
|
365 |
v-model="scope.row.point" |
|
366 |
filterable |
|
367 |
placeholder="请选择"> |
|
368 |
<el-option |
|
369 |
v-for="(item, index) in predictItemList" |
|
370 |
:key="index" |
7b1ce6
|
371 |
:label="item.itemname" |
潘 |
372 |
:value="item.itemno"/> |
cd9f11
|
373 |
</el-select> |
L |
374 |
</template> |
|
375 |
</el-table-column> |
|
376 |
<el-table-column |
|
377 |
prop="point" |
|
378 |
label="编号" |
|
379 |
align="center"/> |
|
380 |
<el-table-column |
|
381 |
prop="" |
|
382 |
label="运算符" |
|
383 |
align="center"> |
|
384 |
<template #default="scope"> |
7b1ce6
|
385 |
<el-select v-model="scope.row.operator" placeholder="请选择" clearable> |
cd9f11
|
386 |
<el-option |
L |
387 |
v-for="item in operatorList" |
|
388 |
:key="item" |
|
389 |
:label="item" |
|
390 |
:value="item"/> |
|
391 |
</el-select> |
|
392 |
</template> |
|
393 |
</el-table-column> |
|
394 |
<el-table-column |
|
395 |
prop="" |
|
396 |
label="操作" |
2caade
|
397 |
width="140" |
cd9f11
|
398 |
align="center"> |
L |
399 |
<template #default="scope"> |
|
400 |
<el-button |
|
401 |
@click="addExpressionRow(scope.$index, expressionList)" |
|
402 |
type="text" |
|
403 |
size="small"> |
|
404 |
添加 |
|
405 |
</el-button> |
|
406 |
<el-button |
|
407 |
@click="deleteExpressionRow(scope.$index, expressionList)" |
|
408 |
type="text" |
|
409 |
size="small"> |
|
410 |
删除 |
|
411 |
</el-button> |
|
412 |
</template> |
|
413 |
</el-table-column> |
|
414 |
</el-table> |
7462da
|
415 |
</el-form> |
L |
416 |
<template #footer> |
|
417 |
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button> |
|
418 |
<el-button @click="dialogVisible = false">取 消</el-button> |
|
419 |
</template> |
|
420 |
</Dialog> |
|
421 |
</template> |
|
422 |
<script lang="ts" setup> |
d3ee81
|
423 |
import {DICT_TYPE, getIntDictOptions, getStrDictOptions} from '@/utils/dict' |
7b1ce6
|
424 |
import * as MmPredictItem from '@/api/model/pre/item' |
潘 |
425 |
import * as MmItemType from '@/api/model/pre/type' |
cd9f11
|
426 |
import * as DmModule from '@/api/model/pre/dm' |
be4298
|
427 |
import * as ProjectApi from '@/api/model/mpk/project' |
cd9f11
|
428 |
import * as DaPoint from '@/api/data/da/point' |
7b1ce6
|
429 |
import {useUpload} from '@/api/model/pre/item' |
e1ff2d
|
430 |
import * as ScheduleModelApi from '@/api/model/sche/model' |
d3ee81
|
431 |
|
潘 |
432 |
const {uploadUrl, httpRequest} = useUpload() |
7462da
|
433 |
|
L |
434 |
defineOptions({name: 'DataMmPredictItemForm'}) |
|
435 |
|
|
436 |
const {t} = useI18n() // 国际化 |
|
437 |
const message = useMessage() // 消息弹窗 |
|
438 |
const dialogVisible = ref(false) // 弹窗的是否展示 |
|
439 |
const dialogTitle = ref('') // 弹窗的标题 |
|
440 |
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
|
441 |
const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
cd9f11
|
442 |
const itemTypeList = ref([]) |
L |
443 |
const itemTypeMap = ref({}) |
|
444 |
const moduleList = ref([]) |
be4298
|
445 |
const mpkProjectList = ref([]) |
2caade
|
446 |
const pointNoList = ref([]) |
cd9f11
|
447 |
const pointList = ref([]) |
L |
448 |
const pointMap = ref({}) |
|
449 |
const predictItemList = ref([]) |
d3ee81
|
450 |
const modelparamListMap = ref({}) |
cd9f11
|
451 |
const modelparamMap = ref({}) |
L |
452 |
const expressionList = ref([]) |
|
453 |
const fileList = ref([]) |
|
454 |
const operatorList = ['+', '-'] |
d3ee81
|
455 |
const replaceModelOnly = ref(false) |
cd9f11
|
456 |
const queryParams = reactive({ |
L |
457 |
pageNo: 1, |
|
458 |
pageSize: 10, |
|
459 |
pointNo: undefined, |
|
460 |
pointName: undefined, |
|
461 |
}) |
|
462 |
const dataForm = ref({ |
2caade
|
463 |
id: undefined, |
e1ff2d
|
464 |
itemtypename: 'NormalItem', |
cd9f11
|
465 |
mmPredictItem: { |
2caade
|
466 |
id: undefined, |
L |
467 |
itemno: undefined, |
|
468 |
itemname: undefined, |
|
469 |
caltypeid: undefined, |
|
470 |
itemtypeid: undefined, |
|
471 |
predictlength: undefined, |
d3ee81
|
472 |
granularity: 60, |
2caade
|
473 |
status: undefined, |
L |
474 |
isfuse: undefined, |
|
475 |
predictphase: undefined, |
d3ee81
|
476 |
workchecked: 0, |
2caade
|
477 |
unittransfactor: undefined, |
L |
478 |
saveindex: undefined |
cd9f11
|
479 |
}, |
L |
480 |
dmModuleItem: { |
2caade
|
481 |
id: undefined, |
L |
482 |
moduleid: undefined, |
|
483 |
itemid: undefined, |
d3ee81
|
484 |
itemorder: 1, |
2caade
|
485 |
status: undefined, |
L |
486 |
categoryid: undefined |
cd9f11
|
487 |
}, |
d8e4be
|
488 |
mmItemOutputList: [], |
cd9f11
|
489 |
mmPredictModel: { |
2caade
|
490 |
id: undefined, |
L |
491 |
modelno: undefined, |
|
492 |
modelname: undefined, |
|
493 |
itemid: undefined, |
|
494 |
arithid: undefined, |
|
495 |
trainsamplength: undefined, |
|
496 |
predictsamplength: undefined, |
|
497 |
isonlinetrain: undefined, |
|
498 |
modelpath: undefined, |
|
499 |
isnormal: undefined, |
|
500 |
normalmax: undefined, |
|
501 |
normalmin: undefined, |
|
502 |
status: undefined, |
|
503 |
classname: undefined, |
|
504 |
methodname: undefined, |
|
505 |
modelparamstructure: undefined, |
|
506 |
resultstrid: undefined, |
be4298
|
507 |
settingmap: undefined, |
D |
508 |
mpkprojectid: undefined |
cd9f11
|
509 |
}, |
L |
510 |
mmPredictMergeItem: { |
2caade
|
511 |
id: undefined, |
L |
512 |
itemid: undefined, |
|
513 |
expression: undefined, |
|
514 |
num: undefined |
cd9f11
|
515 |
}, |
L |
516 |
mmModelArithSettingsList: [], |
|
517 |
mmModelParamList: [] |
7462da
|
518 |
}) |
L |
519 |
const formRules = reactive({ |
d3ee81
|
520 |
'mmPredictItem.itemname': [{required: true, message: '预测项名不能为空', trigger: 'blur'}], |
潘 |
521 |
'mmPredictItem.itemtypeid': [{required: true, message: '类型不能为空', trigger: 'blur'}], |
e1ff2d
|
522 |
'mmPredictItem.granularity': [{ |
d3ee81
|
523 |
required: true, |
潘 |
524 |
message: '粒度不能为空', |
|
525 |
trigger: 'blur' |
|
526 |
}], |
e1ff2d
|
527 |
'mmPredictItem.workchecked': [{ |
d3ee81
|
528 |
required: true, |
潘 |
529 |
message: '是否检查不能为空', |
|
530 |
trigger: 'blur' |
|
531 |
}], |
e1ff2d
|
532 |
'mmPredictItem.status': [{required: true, message: '是否启用不能为空', trigger: 'blur'}], |
潘 |
533 |
'dmModuleItem.moduleid': [{required: true, message: '管网不能为空', trigger: 'blur'}], |
|
534 |
'dmModuleItem.itemorder': [{required: true, message: '排序不能为空', trigger: 'blur'}], |
d3ee81
|
535 |
|
7462da
|
536 |
}) |
L |
537 |
const formRef = ref() // 表单 Ref |
|
538 |
|
|
539 |
/** 打开弹窗 */ |
2caade
|
540 |
const open = async (type: string, id?: number, itemtypename?: string) => { |
e1ff2d
|
541 |
formType.value = type |
7462da
|
542 |
dialogVisible.value = true |
L |
543 |
dialogTitle.value = t('action.' + type) |
2caade
|
544 |
dataForm.value.itemtypename = itemtypename || 'NormalItem' |
e1ff2d
|
545 |
resetForm() |
2caade
|
546 |
resetFields(dataForm.value) |
83f63a
|
547 |
setDefaultFields() |
e1ff2d
|
548 |
|
潘 |
549 |
// 加载参数列表 |
|
550 |
modelparamListMap.value = await ScheduleModelApi.getModelParamList() |
|
551 |
|
|
552 |
// 获取预测项类型列表 |
|
553 |
itemTypeList.value = await MmItemType.getItemTypeList() |
|
554 |
itemTypeList.value.forEach(function (value) { |
|
555 |
itemTypeMap[value.id] = value.itemtypename |
|
556 |
}) |
|
557 |
if (!dataForm.value.id) { |
|
558 |
dataForm.value.mmPredictItem.itemtypeid = itemTypeList.value[0].id |
|
559 |
} |
|
560 |
|
|
561 |
// 获取管网列表 |
|
562 |
moduleList.value = await DmModule.getModuleList() |
|
563 |
|
be4298
|
564 |
// 获取mpk项目列表 |
D |
565 |
mpkProjectList.value = await ProjectApi.list() |
|
566 |
|
7b1ce6
|
567 |
// 获取normal列表 |
潘 |
568 |
predictItemList.value = await MmPredictItem.getMmPredictItemList({ |
|
569 |
itemtypename: 'NormalItem' |
|
570 |
}) |
|
571 |
|
e1ff2d
|
572 |
// 获取数据点列表 |
潘 |
573 |
pointNoList.value = await DaPoint.getPointList(queryParams) |
|
574 |
if (pointNoList.value.length > 0) { |
d8e4be
|
575 |
pointList.value = [] |
e1ff2d
|
576 |
pointNoList.value.forEach(function (value) { |
潘 |
577 |
pointList.value.push(value) |
d8e4be
|
578 |
pointMap[value.id] = value.pointName |
e1ff2d
|
579 |
}) |
潘 |
580 |
} |
|
581 |
|
7b1ce6
|
582 |
// 修改时,设置数据 |
潘 |
583 |
if (id) { |
|
584 |
formLoading.value = true |
|
585 |
try { |
|
586 |
getInfo(id) |
|
587 |
} finally { |
d8e4be
|
588 |
formLoading.value = false |
7b1ce6
|
589 |
} |
潘 |
590 |
} |
e1ff2d
|
591 |
formLoading.value = false |
7462da
|
592 |
} |
L |
593 |
defineExpose({open}) // 提供 open 方法,用于打开弹窗 |
|
594 |
|
|
595 |
/** 提交表单 */ |
|
596 |
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |
|
597 |
const submitForm = async () => { |
|
598 |
// 校验表单 |
|
599 |
if (!formRef) return |
|
600 |
const valid = await formRef.value.validate() |
|
601 |
if (!valid) return |
d8e4be
|
602 |
|
D |
603 |
//校验模型输出 |
|
604 |
if (dataForm.value.mmItemOutputList == undefined || dataForm.value.mmItemOutputList.length <= 0) { |
|
605 |
message.error("模型输出不为空") |
|
606 |
return |
|
607 |
} |
|
608 |
|
|
609 |
let flag = false |
|
610 |
dataForm.value.mmItemOutputList.forEach(e => { |
|
611 |
if (e.resultstr == undefined || e.resultstr === '' || e.resultType == undefined || e.resultType === '' || e.pointid == undefined || e.pointid === '' || (e.resultType === 2 && (e.resultIndex == undefined || e.resultIndex === ''))) { |
|
612 |
message.error("模型输出数据异常") |
|
613 |
flag = true |
|
614 |
} |
|
615 |
}) |
|
616 |
if (flag) return |
|
617 |
|
7462da
|
618 |
// 提交请求 |
L |
619 |
formLoading.value = true |
|
620 |
try { |
cd9f11
|
621 |
const data = dataForm.value as unknown as MmPredictItem.MmPredictItemVO |
b39d0b
|
622 |
if (expressionList.value && expressionList.value.length > 0) { |
L |
623 |
let expression = '' |
|
624 |
for (let i = 0; i < expressionList.value.length; i++) { |
|
625 |
let value = expressionList.value[i] |
|
626 |
expression = expression + value.point + (i === (expressionList.value.length - 1) ? '' : value.operator) |
|
627 |
} |
|
628 |
dataForm.value.mmPredictMergeItem.expression = expression |
|
629 |
} else { |
|
630 |
dataForm.value.mmPredictMergeItem.expression = '' |
|
631 |
} |
|
632 |
if (dataForm.value.mmModelArithSettingsList) { |
|
633 |
for (let item of dataForm.value.mmModelArithSettingsList) { |
9b24e4
|
634 |
if (item.key === 'predictLength') { |
b39d0b
|
635 |
dataForm.value.mmPredictItem.predictlength = item.value |
L |
636 |
} |
|
637 |
} |
|
638 |
} |
7462da
|
639 |
if (formType.value === 'create') { |
L |
640 |
await MmPredictItem.createMmPredictItem(data) |
|
641 |
message.success(t('common.createSuccess')) |
|
642 |
} else { |
|
643 |
await MmPredictItem.updateMmPredictItem(data) |
|
644 |
message.success(t('common.updateSuccess')) |
|
645 |
} |
|
646 |
dialogVisible.value = false |
|
647 |
// 发送操作成功的事件 |
|
648 |
emit('success') |
|
649 |
} finally { |
|
650 |
formLoading.value = false |
|
651 |
} |
|
652 |
} |
83f63a
|
653 |
|
2caade
|
654 |
const resetFields = (obj) => { |
L |
655 |
for (let key in obj) { |
|
656 |
if (key === 'itemtypename') { |
|
657 |
continue |
|
658 |
} |
|
659 |
if (obj[key] instanceof Array) { |
|
660 |
obj[key] = [] |
|
661 |
} else if (obj[key] instanceof Object) { |
|
662 |
resetFields(obj[key]) |
|
663 |
} else { |
|
664 |
obj[key] = '' |
|
665 |
} |
|
666 |
} |
|
667 |
} |
|
668 |
|
|
669 |
const getInfo = async (id) => { |
|
670 |
dataForm.value = await MmPredictItem.getMmPredictItem(id) |
7b1ce6
|
671 |
dataForm.value.itemtypename = itemTypeMap[dataForm.value.mmPredictItem.itemtypeid] |
83f63a
|
672 |
expressionList.value = [] |
2caade
|
673 |
if (dataForm.value.mmPredictMergeItem && dataForm.value.mmPredictMergeItem.expression) { |
L |
674 |
let expression = dataForm.value.mmPredictMergeItem.expression |
83f63a
|
675 |
do { |
L |
676 |
let indexPlus = expression.indexOf('+') |
|
677 |
let indexSub = expression.indexOf('-') |
|
678 |
if (indexPlus !== -1 || indexSub !== -1) { |
|
679 |
let endIndex = (indexSub == -1 || (indexPlus < indexSub && indexPlus !== -1)) ? indexPlus : indexSub |
|
680 |
expressionList.value.push({ |
|
681 |
point: expression.substring(0, endIndex), |
2caade
|
682 |
operator: expression.substring(endIndex, 1) |
83f63a
|
683 |
}) |
L |
684 |
expression = expression.substring(endIndex + 1) |
|
685 |
} else { |
|
686 |
expressionList.value.push({ |
|
687 |
point: expression, |
|
688 |
operator: '' |
|
689 |
}) |
|
690 |
expression = '' |
|
691 |
} |
|
692 |
} while (expression && expression.length > 0) |
|
693 |
} |
|
694 |
} |
|
695 |
|
|
696 |
function setReplaceModelOnly(value) { |
cd9f11
|
697 |
replaceModelOnly.value = value |
L |
698 |
} |
83f63a
|
699 |
|
L |
700 |
function beforeUpload(file) { |
cd9f11
|
701 |
let fileName = file.name |
L |
702 |
let first = fileName.lastIndexOf('.') |
|
703 |
let nameLength = fileName.length |
|
704 |
let fileSuffix = fileName.substring(first + 1, nameLength) |
|
705 |
if (fileSuffix !== 'miail') { |
|
706 |
message.error('只能上传miail类型文件') |
|
707 |
return |
|
708 |
} |
|
709 |
} |
83f63a
|
710 |
|
L |
711 |
function uploadModelSuccess(response, file, fileList) { |
cd9f11
|
712 |
if (response.code === 0) { |
L |
713 |
message.success(t('上传成功')) |
|
714 |
dataForm.value.mmModelArithSettingsList = [] |
d3ee81
|
715 |
if (!replaceModelOnly.value) { |
cd9f11
|
716 |
dataForm.value.mmModelParamList = [] |
L |
717 |
} |
|
718 |
dataForm.value.mmPredictModel.modelpath = '' |
|
719 |
dataForm.value.mmPredictModel.modelparamstructure = '' |
|
720 |
if (response.data.loadFieldSetList && response.data.loadFieldSetList[0].propertyList) { |
83f63a
|
721 |
response.data.loadFieldSetList[0].propertyList.forEach(function (value) { |
cd9f11
|
722 |
if (value.key !== 'data1') { |
L |
723 |
dataForm.value.mmModelArithSettingsList.push({ |
|
724 |
key: value.key, |
|
725 |
name: value.name, |
|
726 |
valuetype: value.valueType, |
|
727 |
value: value.value |
|
728 |
}) |
|
729 |
} |
2caade
|
730 |
}) |
cd9f11
|
731 |
} |
d3ee81
|
732 |
dataForm.value.mmPredictModel.modelname = response.data.originalFilename |
cd9f11
|
733 |
dataForm.value.mmPredictModel.classname = response.data.className |
L |
734 |
dataForm.value.mmPredictModel.methodname = response.data.methodName |
|
735 |
if (response.data.paramPathList) { |
|
736 |
dataForm.value.mmPredictModel.modelpath = response.data.paramPathList[0] |
|
737 |
} |
|
738 |
if (response.data.paramsArray) { |
|
739 |
dataForm.value.mmPredictModel.modelparamstructure = response.data.paramsArray.join(',') |
|
740 |
} |
d3ee81
|
741 |
if (response.data.paramsCount && !replaceModelOnly.value) { |
cd9f11
|
742 |
for (let i = 0; i < response.data.paramsCount; i++) { |
L |
743 |
dataForm.value.mmModelParamList.push({ |
|
744 |
modelparamportorder: (i + 1), |
|
745 |
modelparamorder: (i + 1), |
|
746 |
modelparamtype: '', |
|
747 |
modelparamid: '', |
|
748 |
modelparamname: '', |
|
749 |
datalength: 0 |
|
750 |
}) |
|
751 |
} |
|
752 |
} |
|
753 |
if (response.data.settingConfigMap && response.data.settingConfigMap.settingMap) { |
|
754 |
dataForm.value.mmPredictModel.settingmap = JSON.stringify(response.data.settingConfigMap.settingMap) |
|
755 |
} |
|
756 |
} else { |
|
757 |
message.error('上传失败!' + response.msg) |
|
758 |
return |
|
759 |
} |
|
760 |
fileList = [] |
|
761 |
} |
83f63a
|
762 |
|
L |
763 |
function uploadModelError(file, err, fileList) { |
cd9f11
|
764 |
} |
83f63a
|
765 |
|
L |
766 |
function changeModelparam(row) { |
cd9f11
|
767 |
row.modelparamname = modelparamMap[row.modelparamid] |
L |
768 |
} |
83f63a
|
769 |
|
L |
770 |
function changeItemtype(value) { |
cd9f11
|
771 |
dataForm.value.itemtypename = itemTypeMap[value] |
L |
772 |
} |
83f63a
|
773 |
|
61c379
|
774 |
function changeModelparamtype(row) { |
cd9f11
|
775 |
row.modelparamid = '' |
L |
776 |
} |
83f63a
|
777 |
|
61c379
|
778 |
function changeOutputPoint(value, row) { |
d8e4be
|
779 |
row.tagname = pointMap[value] |
cd9f11
|
780 |
} |
83f63a
|
781 |
|
L |
782 |
function deleteExpressionRow(index, rows) { |
cd9f11
|
783 |
rows.splice(index, 1) |
L |
784 |
} |
83f63a
|
785 |
|
L |
786 |
function addExpressionRow(index, rows) { |
cd9f11
|
787 |
let row = JSON.parse(JSON.stringify(rows[index])) |
L |
788 |
rows.splice(index, 0, row) |
|
789 |
} |
83f63a
|
790 |
|
L |
791 |
function deleteRow(index: string, rows) { |
cd9f11
|
792 |
if (!rows || rows.length === 1) { |
L |
793 |
message.error('不能全部删除!') |
|
794 |
return |
|
795 |
} |
|
796 |
rows.splice(index, 1) |
|
797 |
orderRow(rows) |
|
798 |
} |
83f63a
|
799 |
|
L |
800 |
function addRow(index: string, rows) { |
cd9f11
|
801 |
let row = JSON.parse(JSON.stringify(rows[index])) |
L |
802 |
rows.splice(index, 0, row) |
|
803 |
orderRow(rows) |
d8e4be
|
804 |
} |
61c379
|
805 |
|
d8e4be
|
806 |
function addItemOutput(list) { |
D |
807 |
list.push({}) |
|
808 |
orderItemOutput(list) |
|
809 |
} |
61c379
|
810 |
|
d8e4be
|
811 |
function deleteItemOutput(index: string, rows) { |
D |
812 |
if (!rows || rows.length === 1) { |
|
813 |
message.error('不能全部删除!') |
|
814 |
return |
|
815 |
} |
|
816 |
rows.splice(index, 1) |
|
817 |
orderItemOutput(rows) |
|
818 |
} |
61c379
|
819 |
|
d8e4be
|
820 |
function orderItemOutput(list) { |
D |
821 |
list.sort((a, b) => a.outputorder - b.outputorder); |
|
822 |
let outputorder = 1 |
|
823 |
list.forEach(function (value) { |
|
824 |
value.outputorder = outputorder |
|
825 |
outputorder++ |
|
826 |
}) |
|
827 |
} |
|
828 |
|
|
829 |
function resultTypeChange(value, row) { |
|
830 |
if (value === 1) { |
|
831 |
row.resultIndex = undefined |
61c379
|
832 |
} else if (value === 2) { |
d8e4be
|
833 |
row.resultIndex = 0 |
D |
834 |
} |
cd9f11
|
835 |
} |
7462da
|
836 |
|
83f63a
|
837 |
function orderRow(rows) { |
cd9f11
|
838 |
let modelparamorder = 0 |
L |
839 |
let modelparamportorder = 0 |
|
840 |
rows.forEach(function (value) { |
|
841 |
if (value.modelparamportorder !== modelparamportorder) { |
|
842 |
modelparamportorder = value.modelparamportorder |
|
843 |
modelparamorder = 1 |
|
844 |
} |
|
845 |
value.modelparamorder = modelparamorder |
|
846 |
modelparamorder++ |
|
847 |
}) |
|
848 |
} |
83f63a
|
849 |
|
2caade
|
850 |
const setDefaultFields = () => { |
83f63a
|
851 |
dataForm.value.mmPredictItem.workchecked = 0 |
L |
852 |
dataForm.value.mmPredictItem.status = 1 |
|
853 |
dataForm.value.mmPredictItem.isfuse = 0 |
|
854 |
dataForm.value.mmPredictItem.predictphase = 0 |
|
855 |
dataForm.value.mmPredictItem.unittransfactor = 1 |
|
856 |
dataForm.value.mmPredictItem.saveindex = '2' |
|
857 |
dataForm.value.dmModuleItem.status = 1 |
|
858 |
dataForm.value.mmPredictModel.trainsamplength = 60 |
|
859 |
dataForm.value.mmPredictModel.isonlinetrain = 0 |
|
860 |
dataForm.value.mmPredictModel.status = 1 |
d8e4be
|
861 |
dataForm.value.mmItemOutputList = [] |
83f63a
|
862 |
expressionList.value = [{ |
L |
863 |
point: '', |
|
864 |
operator: '' |
|
865 |
}] |
|
866 |
fileList.value = [] |
|
867 |
} |
|
868 |
|
7462da
|
869 |
/** 重置表单 */ |
d3ee81
|
870 |
const resetForm = () => { |
cd9f11
|
871 |
dataForm.value = { |
L |
872 |
mmModelArithSettingsList: [], |
|
873 |
mmModelParamList: [], |
|
874 |
id: '', |
e1ff2d
|
875 |
itemtypename: 'NormalItem', |
cd9f11
|
876 |
mmPredictItem: { |
L |
877 |
id: '', |
|
878 |
itemno: '', |
|
879 |
itemname: '', |
|
880 |
caltypeid: '', |
|
881 |
itemtypeid: '', |
|
882 |
predictlength: '', |
d3ee81
|
883 |
granularity: 60, |
cd9f11
|
884 |
status: '', |
L |
885 |
isfuse: '', |
|
886 |
predictphase: '', |
d3ee81
|
887 |
workchecked: 0, |
cd9f11
|
888 |
unittransfactor: '', |
L |
889 |
saveindex: '' |
|
890 |
}, |
|
891 |
dmModuleItem: { |
|
892 |
id: '', |
|
893 |
moduleid: '', |
|
894 |
itemid: '', |
d3ee81
|
895 |
itemorder: 1, |
cd9f11
|
896 |
status: 1, |
L |
897 |
categoryid: '' |
|
898 |
}, |
d8e4be
|
899 |
mmItemOutputList: [], |
cd9f11
|
900 |
mmPredictModel: { |
L |
901 |
id: '', |
|
902 |
modelno: '', |
|
903 |
modelname: '', |
|
904 |
itemid: '', |
|
905 |
arithid: '', |
|
906 |
trainsamplength: '', |
|
907 |
predictsamplength: '', |
|
908 |
isonlinetrain: '', |
|
909 |
modelpath: '', |
|
910 |
isnormal: '', |
|
911 |
normalmax: '', |
|
912 |
normalmin: '', |
|
913 |
status: 1, |
|
914 |
classname: '', |
|
915 |
methodname: '', |
|
916 |
modelparamstructure: '', |
|
917 |
resultstrid: '', |
|
918 |
settingmap: '' |
|
919 |
}, |
|
920 |
mmPredictMergeItem: { |
|
921 |
id: '', |
|
922 |
itemid: '', |
|
923 |
expression: '', |
|
924 |
num: '' |
|
925 |
} |
7462da
|
926 |
} |
L |
927 |
formRef.value?.resetFields() |
d3ee81
|
928 |
} |
cd9f11
|
929 |
|
L |
930 |
onMounted(() => { |
|
931 |
init() |
|
932 |
}) |
|
933 |
|
83f63a
|
934 |
function init() { |
cd9f11
|
935 |
} |
7462da
|
936 |
</script> |