houzhongjian
2024-07-23 8501060c4f921d1e744c477e4dc08eb47b52693c
提交 | 用户 | 时间
850106 1 <template>
H 2   <el-dialog :visible.sync="visible" title="指标评价体系权重分配" :close-on-click-modal="false"
3              :close-on-press-escape="false" width="30%">
4         <el-form label-position="left" label-width="80px" :model="dataForm">
5         <el-form-item label="数量">
6             <el-input-number v-model="dataForm.number"></el-input-number>&nbsp;&nbsp;&nbsp;%
7             <el-slider v-model="dataForm.number"></el-slider>
8         </el-form-item>
9         <el-form-item label="质量">
10             <el-input-number v-model="dataForm.quality"></el-input-number>&nbsp;&nbsp;&nbsp;%
11             <el-slider v-model="dataForm.quality"></el-slider>
12         </el-form-item>
13         <el-form-item label="生产消耗">
14             <el-input-number v-model="dataForm.consume"></el-input-number>&nbsp;&nbsp;&nbsp;%
15             <el-slider v-model="dataForm.consume"></el-slider>
16         </el-form-item>
17             <el-form-item label="过程控制">
18             <el-input-number v-model="dataForm.process"></el-input-number>&nbsp;&nbsp;&nbsp;%
19             <el-slider v-model="dataForm.process"></el-slider>
20         </el-form-item>
21             <el-form-item label="管理">
22             <el-input-number v-model="dataForm.manage"></el-input-number>&nbsp;&nbsp;&nbsp;%
23             <el-slider v-model="dataForm.manage"></el-slider>
24         </el-form-item>
25         </el-form>
26             <span slot="footer" class="dialog-footer">
27       <el-button @click="visible = false">取消</el-button>
28       <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
29     </span>
30     </el-dialog>
31 </template>
32 <script>
33 export default {
34   data() {
35     return {
36       visible: false,
37       pid:0,
38       dataForm: {
39         number: "",
40         quality: "",
41         consume: "",
42         process:"",
43         manage:""
44       },
45     };
46   },
47   
48   methods: {
49     init() {
50       this.visible = true;
51       this.$nextTick(() => {
52         this.getDataList()
53       });
54     },
55     getDataList() {
56       this.$http.get(`/iailab-ntt-model/index/evaluate/systemWeightList`)
57         .then(({ data }) => {
58            if (data && data.code === 0) {
59             this.dataForm.number=Number(data.data.SYS0001);
60             this.dataForm.quality=Number(data.data.SYS0002);
61             this.dataForm.consume=Number(data.data.SYS0003);
62             this.dataForm.process=Number(data.data.SYS0004);
63             this.dataForm.manage=Number(data.data.SYS0005);
64             }
65         })
66         .catch((error) => {
67           console.error(error);
68         });
69     },
70     // 表单提交
71     dataFormSubmit() {
72       this.loading = true
73       if(this.dataForm.number+this.dataForm.quality+this.dataForm.consume+this.dataForm.process+this.dataForm.manage==100){
74         this.$http.post('/iailab-ntt-model/index/evaluate/updataSystemWeight', this.dataForm).then(({ data: res }) => {
75           this.loading = false
76            if (res.code !== 0) {
77               return this.$message.error(res.msg)
78             }
79             this.$message({
80               message: this.$t('prompt.success'),
81               type: 'success',
82               duration: 500,
83               onClose: () => {
84                 this.visible = false
85                 this.$emit('refreshDataList')
86               }
87             })
88         }).catch(() => {})
89       }else{
90          this.$alert('各权重之和必须为100%', {
91           confirmButtonText: '确定',
92         });
93         }
94     },
95     beforeCloseHandle(done) {
96       this.dataList = [];
97       done();
98     },
99   },
100   props: {
101     row: Object,
102   },
103 };
104 </script>