Browse Source

'完善单项'

shaun-sheep 5 years ago
parent
commit
fa6e68ee4d

+ 18 - 35
src/components/dialogs/list/batchDialog.vue

@@ -223,7 +223,8 @@
                     name: '王小虎',
                     address: '上海市普陀区金沙江路 1518 弄'
                 }],
-                multipleSelection: []
+                multipleSelection: [],
+                filterList: [],//过滤单项选择的值
 
             }
         },
@@ -232,8 +233,7 @@
                 this.firm.map((item, index) => {
                     if (item.num === this.firmName.num) {
                         item.rname = this.firmName.name
-                        item = {...item, info: this.firmName}
-                        debugger
+                        item.info = this.firmName
                     }
                     return item
                 })
@@ -245,35 +245,21 @@
                 // if (this.active++ > 1) this.active = 0
                 // 如果单项全选
                 if (this.checkAll) {
-                    let arr = this.firm.filter(item => item.info)
-                    console.log(arr, 'arr')
+                    let deviceList = this.firm.filter(item => item.info)
+                    if (deviceList.length < 4) {
+                        this.$message({
+                            message: '存在着未填写项',
+                            type: 'warning'
+                        });
+                    } else {
+                        this.$emit('deviceList', deviceList)
+
+                    }
+                } else {
+                    if (this.filterList.length) {
+                        this.$emit('deviceList', this.filterList)
+                    }
                 }
-                // if (this.checkAll) {
-                //     console.log(this.maintenanceList, 'maintenanceList')
-                //     let all = ['supplier', 'firm', 'insurer', 'maintainer']
-                //     let sw = false
-                //     for (let i = 0; i < all.length; i++) {
-                //         let element = all[i]
-                //         if (!JSON.stringify(this.maintenanceList) || !this.maintenanceList.hasOwnProperty(element)) {
-                //             this.$message({
-                //                 message: '存在着未填写项',
-                //                 type: 'warning'
-                //             });
-                //             sw = false
-                //             break;
-                //         } else {
-                //             sw = true
-                //         }
-                //     }
-                //     if (sw) {
-                //         // 把参数传给父组件
-                //         this.$emit('deviceList', this.maintenanceList)
-                //     }
-                //
-                // } else { //单项部分选择
-                //     console.log(this.checkedCities)
-                //     // this.$emit('deviceList', this.maintenanceList)
-                // }
             },
             handleCheckChange(val) { //全选
                 this.checkedCities = val ? this.firm : []
@@ -281,15 +267,12 @@
 
             },
             handleCheckedCitiesChange(value) { //维护单项触发
-                //value instanceof Array
-                console.log(value, '选择的项')
+                this.filterList = value.filter(item => item.info)
                 let checkCount = value.length
                 this.checkAll = checkCount === this.firm.length
                 this.isIndeterminate = checkCount > 0 && checkCount < this.firm.length
             },
             handleCheckedFileChange(value,) { //维护多项触发
-                console.log(this.checkAll, 'checkAll')
-                console.log(value, '----')
             },
             fourVendors(code) {
                 this.$emit('code', code.code)

+ 1 - 1
src/components/ledger/handsontables/device.vue

@@ -715,7 +715,7 @@ export default {
             }
         },
         deviceList(data) {
-            console.log(data,'我是单项传来的对象')
+            console.log(data,'我是单项传来的单项值')
         },
         //获取到了正确的信息
         getInfors(infos, row, el) {