qukaidi 2 vuotta sitten
vanhempi
commit
ea4ee44da3
1 muutettua tiedostoa jossa 28 lisäystä ja 10 poistoa
  1. 28 10
      src/views/monitor/monitorList/index.vue

+ 28 - 10
src/views/monitor/monitorList/index.vue

@@ -72,7 +72,7 @@
           </el-form-item>
           <el-form-item label="库区" prop="libraryPositionId">
             <el-select v-model="form.libraryPositionId" clearable filterable style="width: 100%" placeholder="请选择库区"
-              size="small" @change="libraryPositionChange">
+              size="small" @change="libraryPositionChange" multiple>
               <el-option v-for="(item, index) in positionList" :key="index.fId" :label="item.fName" :value="item.fId">
               </el-option>
             </el-select>
@@ -124,8 +124,8 @@ export default {
       title: '添加',
       iframeSrc: '',
       form: {
-        libraryPositionId:null,
-        libraryPosition:null
+        libraryPositionId: null,
+        libraryPosition: null
       },
       tableOption: tableOption,
       dialogVideo: false,
@@ -251,12 +251,18 @@ export default {
       }
     },
     libraryPositionChange(row) {
+      console.log(row)
       if (row) {
-        this.positionList.forEach(item => {
-          if (row == item.fId) {
-            this.form.libraryPosition = item.fName
-          }
+        let arr = []
+        row.forEach(e => {
+          this.positionList.forEach(item => {
+            if (e == item.fId) {
+              arr.push(item.fName)
+
+            }
+          })
         })
+        this.form.libraryPosition = arr.join(',')
       } else {
         this.form.libraryPosition = null
       }
@@ -265,12 +271,18 @@ export default {
       this.$refs.queryForm.validate((valid) => {
         if (valid) {
           if (status == '添加') {
+            if (this.form.libraryPositionId) {
+              this.form.libraryPositionId =this.form.libraryPositionId.join(',')
+            }
             addRow(this.form).then(response => {
               this.$message.success('添加成功');
               this.dialogVisible = false;
               this.handleQuery();
             });
           } else {
+            if (this.form.libraryPositionId) {
+              this.form.libraryPositionId =this.form.libraryPositionId.join(',')
+            }
             editRow(this.form).then(response => {
               this.$message.success('添加成功');
               this.dialogVisible = false;
@@ -311,10 +323,16 @@ export default {
       this.title = '修改'
       this.dialogVisible = true
       this.form = row
-      this.positionList=[]
-      listDept({ parentId: row.fWarehouseId}).then(res => {
-          this.positionList = res.data
+      if (this.form.libraryPositionId) {
+        this.form.libraryPositionId = this.form.libraryPositionId.split(',')
+        this.form.libraryPositionId.forEach((e,index)=>{
+          this.form.libraryPositionId[index]=Number(this.form.libraryPositionId[index])
         })
+      }
+      this.positionList = []
+      listDept({ parentId: row.fWarehouseId }).then(res => {
+        this.positionList = res.data
+      })
     },
     handleClose() {
       this.form = this.$options.data().form;