Browse Source

添加部分成本页面逻辑

yuanrf 1 year ago
parent
commit
89b21f0c00
1 changed files with 91 additions and 1 deletions
  1. 91 1
      src/components/Finance/Cost.vue

+ 91 - 1
src/components/Finance/Cost.vue

@@ -238,7 +238,7 @@
             <el-checkbox-group class="form-ss" v-model="CheckBoxListSelect.filter(item => item.cbType == 'Top')[0].cbValues"
                 @change="TopChange">
                 <el-checkbox v-for="(  item, index  ) in    checkOptions  " :key="index" :title="item.tips"
-                    :label="item.label"></el-checkbox>
+                    :label="item.label" @change="(val) => { topcheckboxChange(val, item.label) }"></el-checkbox>
             </el-checkbox-group>
             <el-table :summary-method="getSummaries" show-summary :data="tableData" :border="true" size="small"
                 row-class-name="row" cell-class-name="column" :highlight-current-row="true" :fit="true"
@@ -3469,8 +3469,98 @@ export default {
                     this.$refs[forFormList[i]].resetFields();
                 }
             })
+        },
+        topcheckboxChange(val, label) {
+            console.log(val, label, 'topcheckboxChangeval');
+            var that = this;
+            if (!val) {
+                this.$confirm('此操作将清空整列数据, 是否继续?', '提示', {
+                    confirmButtonText: '确定',
+                    cancelButtonText: '取消',
+                    type: 'warning'
+                }).then(() => {
+
+                    console.log('确定清空数据');
+                    var fliterList = this.sumTopPrice.filter(x => x.label == label);
+                    if (fliterList.length != 0) {
+                        fliterList[0].Aprice = 0;
+                        fliterList[0].Bprice = 0;
+                    }
+
+                    fliterList = that.tableLabel.filter(x => x.label == label);
+                    if (fliterList.length != 0) {
+                        var obj = {
+                            "diid": that.diid,
+                            "day": "-",
+                            "date": "",
+                            "itin": "",
+                            "carType": "",
+                            "carCost": 0,
+                            "carNumber": 0,
+                            "carTiming": 0,
+                            "tgs": 0,
+                            "tgwh": 0,
+                            "tgn": 0,
+                            "tgof": 0,
+                            "tgm": 0,
+                            "tga": 0,
+                            "tgtf": 0,
+                            "tgef": 0,
+                            "cfs": 0,
+                            "cfm": 0,
+                            "cfof": 0,
+                            "b": 0,
+                            "l": 0,
+                            "d": 0,
+                            "tbr": 0,
+                            "sgr": 0,
+                            "jS_ES": 0,
+                            "suite": 0,
+                            "accon": "",
+                            "tv": 0,
+                            "iL": 0,
+                            "if": 0,
+                            "ef": 0,
+                            "b_R_F": 0,
+                            "te": 0,
+                            "tgTips": 0,
+                            "drvTips": 0,
+                            "pc": 0,
+                            "tlf": 0,
+                            "ect": 0,
+                            "id": 1,
+                        };
+                        var prop = fliterList[0].prop;
+                        var initval = obj[prop];
+
+                        for (var i = 0; i < that.tableData.length; i++) {
+                            that.tableData[i][prop] = initval;
+                        }
+                        console.log(that.tableData, 'that.tableData数据');
+                    }
+
+                    this.$message({
+                        message: '已清除!',
+                        type: 'success',
+                        offset: 50
+                    });
+
+                }).catch(() => {
+                    this.$message({
+                        type: 'info',
+                        message: '已取消操作'
+                    });
+
+                    if (!that.CheckBoxListSelect.filter(item => item.cbType == 'Top')[0].cbValues.includes(label)) {
+                        that.CheckBoxListSelect.filter(item => item.cbType == 'Top')[0].cbValues.push(label);
+                    }
+
+                });
+            }
+
         }
 
+
     },
     mounted() {
         this.token = JSON.parse(localStorage.getItem('userinif')).token;