提交 | 用户 | 时间
|
850106
|
1 |
<template> |
H |
2 |
<el-dialog |
|
3 |
:title="!dataForm.id ? '新增' : '修改'" |
|
4 |
:close-on-click-modal="false" |
|
5 |
:visible.sync="visible"> |
|
6 |
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px"> |
|
7 |
<el-form-item label="预测项" prop="predictitemid"> |
|
8 |
<el-input v-model="dataForm.predictitemid" placeholder="预测项" maxlength="64" clearable></el-input> |
|
9 |
</el-form-item> |
|
10 |
<el-form-item label="调度模型" prop="schedulemodelid"> |
|
11 |
<el-input v-model="dataForm.schedulemodelid" placeholder="调度模型" maxlength="64" clearable></el-input> |
|
12 |
</el-form-item> |
|
13 |
<el-form-item label="最大值" prop="maxvaluekey"> |
|
14 |
<el-input v-model="dataForm.maxvaluekey" placeholder="最大值" maxlength="64" clearable></el-input> |
|
15 |
</el-form-item> |
|
16 |
<el-form-item label="最小值" prop="minvaluekey"> |
|
17 |
<el-input v-model="dataForm.minvaluekey" placeholder="最小值" maxlength="64" clearable></el-input> |
|
18 |
</el-form-item> |
|
19 |
</el-form> |
|
20 |
<span slot="footer" class="dialog-footer"> |
|
21 |
<el-button @click="visible = false">取消</el-button> |
|
22 |
<el-button type="primary" @click="dataFormSubmit()">确定</el-button> |
|
23 |
</span> |
|
24 |
</el-dialog> |
|
25 |
</template> |
|
26 |
|
|
27 |
<script> |
|
28 |
export default { |
|
29 |
data () { |
|
30 |
return { |
|
31 |
|
|
32 |
visible: false, |
|
33 |
noDisabled: false, |
|
34 |
roleList: [], |
|
35 |
dataForm: { |
|
36 |
id: 0, |
|
37 |
predictitemid: '', |
|
38 |
schedulemodelid: '', |
|
39 |
maxvaluekey: '', |
|
40 |
minvaluekey: '' |
|
41 |
}, |
|
42 |
dataRule: { |
|
43 |
predictitemid: [ |
|
44 |
{ required: true, message: '预测项不能为空', trigger: 'blur' } |
|
45 |
], |
|
46 |
schedulemodelid: [ |
|
47 |
{ required: true, message: '调度模型不能为空', trigger: 'blur' } |
|
48 |
], |
|
49 |
maxvaluekey: [ |
|
50 |
{ required: true, message: '最大值不能为空', trigger: 'blur' } |
|
51 |
], |
|
52 |
minvaluekey: [ |
|
53 |
{ required: true, message: '最小值不能为空', trigger: 'blur' } |
|
54 |
] |
|
55 |
} |
|
56 |
} |
|
57 |
}, |
|
58 |
methods: { |
|
59 |
init (id) { |
|
60 |
this.dataForm.id = id || 0 |
|
61 |
this.visible = true |
|
62 |
this.$nextTick(() => { |
|
63 |
this.$refs['dataForm'].resetFields() |
|
64 |
}) |
|
65 |
if (id) { |
|
66 |
this.$http({ |
|
67 |
url: `/iailab-ntt-model/mcs/schedule-predict-item/info/${this.dataForm.id}`, |
|
68 |
method: 'get', |
|
69 |
params: this.$http.adornParams() |
|
70 |
}).then(({data}) => { |
|
71 |
if (data && data.code === 0) { |
|
72 |
this.dataForm.predictitemid = data.stSchedulePredictItem.predictitemid |
|
73 |
this.dataForm.schedulemodelid = data.stSchedulePredictItem.schedulemodelid |
|
74 |
this.dataForm.maxvaluekey = data.stSchedulePredictItem.maxvaluekey |
|
75 |
this.dataForm.minvaluekey = data.stSchedulePredictItem.minvaluekey |
|
76 |
} |
|
77 |
}) |
|
78 |
} |
|
79 |
}, |
|
80 |
// 表单提交 |
|
81 |
dataFormSubmit () { |
|
82 |
this.$refs['dataForm'].validate((valid) => { |
|
83 |
if (valid) { |
|
84 |
this.$http({ |
|
85 |
url: `/iailab-ntt-model/mcs/schedule-predict-item/${!this.dataForm.id ? 'save' : 'update'}`, |
|
86 |
method: 'post', |
|
87 |
data: this.$http.adornData({ |
|
88 |
'id': this.dataForm.id || undefined, |
|
89 |
'predictitemid': this.dataForm.predictitemid, |
|
90 |
'schedulemodelid': this.dataForm.schedulemodelid, |
|
91 |
'maxvaluekey': this.dataForm.maxvaluekey, |
|
92 |
'minvaluekey': this.dataForm.minvaluekey |
|
93 |
}) |
|
94 |
}).then(({data}) => { |
|
95 |
if (data && data.code === 0) { |
|
96 |
this.$message({ |
|
97 |
message: '操作成功', |
|
98 |
type: 'success', |
|
99 |
duration: 1500, |
|
100 |
onClose: () => { |
|
101 |
this.visible = false |
|
102 |
this.$emit('refreshDataList') |
|
103 |
} |
|
104 |
}) |
|
105 |
} else { |
|
106 |
this.$message.error(data.msg) |
|
107 |
} |
|
108 |
}) |
|
109 |
} |
|
110 |
}) |
|
111 |
} |
|
112 |
} |
|
113 |
} |
|
114 |
</script> |