duanxiaoduan 2 years ago
parent
commit
0f08060ac8
2 changed files with 105 additions and 11 deletions
  1. BIN
      dist.zip
  2. 105 11
      src/views/formulationPlan/materialIssuancePlan/index.vue

BIN
dist.zip


+ 105 - 11
src/views/formulationPlan/materialIssuancePlan/index.vue

@@ -388,6 +388,38 @@
         <el-button class="save" :disabled="isokDisable" @click="tmrNumberData()">是</el-button>
       </div>
     </el-dialog>
+
+    <!-- 清空已分配的栏舍 -->
+    <el-dialog :title="textMap[allEmpty.dialogStatus]" :destroy-on-close="true" :visible.sync="allEmpty.dialogFormVisible" :close-on-click-modal="false" width="50%">
+      <div class="allEmptyData">
+        <el-table
+          id="table"
+          :key="allEmpty.table.tableKey"
+          ref="allEmptyTable"
+          v-loading="allEmpty.table.listLoading"
+          element-loading-text="给我一点时间"
+          :data="allEmpty.table.list"
+          border
+          highlight-current-row
+          style="width: 100%;"
+          :height="height"
+          :row-style="rowStyle"
+          :cell-style="cellStyle"
+          class="elTable"
+          row-key="id"
+          @selection-change="handleAllEmptySelect"
+          height="300"
+        >
+          <el-table-column type="selection" width="50" />
+          <el-table-column label="序号" width="50px" align="center" type="index" />
+          <el-table-column label="栏舍名称" min-width="110px" align="center" prop="bname"/>
+        </el-table>
+      </div>
+      <div slot="footer" class="dialog-footer" style="bottom: 10px;">
+        <el-button class="cancelClose" @click="allEmpty.dialogFormVisible = false;getList()">关闭</el-button>
+        <el-button class="save" :disabled="isokDisable" @click="allEmptyData()">确认</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -457,7 +489,8 @@ export default {
         create: '新增',
         update: '编辑',
         check: '提示',
-        tmrNumber:''
+        tmrNumber:'',
+        allEmpty:'清空已分配的栏舍'
       },
       check: {
         dialogFormVisible: false,
@@ -496,7 +529,30 @@ export default {
         dialogStatus: '',
         temp:{},
         radio:'0'
-      }
+      },
+      allEmpty:{
+        dialogFormVisible: false,
+        dialogStatus: '',
+        table: {
+          getdataListParm: {
+            name:'getBarList',
+            page: 1,
+            offset: 1,
+            pagecount: '',
+            returntype: 'Map',
+            parammaps: {
+              pastureid: Cookies.get('pastureid'),
+              times: 1,
+              refresh: 1
+            }
+          },
+          tableKey: 0,
+          list: [],
+          total: 0,
+          listLoading: false,
+        }
+      },
+      allEmptySelect:[]
     }
   },
   created() {
@@ -1544,15 +1600,54 @@ export default {
       })
     },
     handleAllEmpty(){
-      MessageBox.confirm('执行该操作会将现有车次已分配的撒料栏舍全部清空,是否要执行该操作?', {
-        confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
-      }).then(() => {
+      this.allEmpty.dialogStatus = 'allEmpty'
+      this.allEmpty.dialogFormVisible = true
+
+      // MessageBox.confirm('执行该操作会将现有车次已分配的撒料栏舍全部清空,是否要执行该操作?', {
+      //   confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
+      // }).then(() => {
+      //
+      // })
+      this.getAllEmptyList()
+    },
+    getAllEmptyList() {
+      this.allEmpty.table.listLoading = true
+      const url = 'authdata/GetDataByName'
+      const data = this.allEmpty.table.getdataListParm
+      postJson(url, data).then(response => {
+        if (response.data.list !== undefined) {
+          if (response.data.list !== null) {
+            this.allEmpty.table.list = response.data.list
+            this.allEmpty.table.total = response.data.list.length
+            setTimeout(() => {
+              this.$refs.allEmptyTable.doLayout()
+            }, 100)
+          } else {
+            this.allEmpty.table.list = []
+          }
+        }
+        this.allEmpty.table.listLoading = false
+      })
+    },
+    handleAllEmptySelect(val){
+      this.allEmptySelect = []
+      val.forEach((ele)=> {
+        this.allEmptySelect.push(ele.id)
+      });
+    },
+    allEmptyData(){
+      // console.log(this.allEmptySelect)
+      // console.log(this.allEmptySelect.toString())
+      if(this.allEmptySelect.length == 0){
+        this.allEmpty.dialogFormVisible = false;
+        this.getList()
+      }else{
         this.requestParam = {}
         this.requestParam.common = { 'returnmap': '0' }
         this.requestParam.data = []
-        this.requestParam.data[0] = { 'name': 'deleteLpplandtl1All', 'type': 'e', 'parammaps': { pastureid:  Cookies.get('pastureid') ,times:this.table.getdataListParm.parammaps.times}},
-        this.requestParam.data[1] = { 'name': 'deletefpdetailAll', 'type': 'e', 'parammaps': { pastureid:  Cookies.get('pastureid') ,times:this.table.getdataListParm.parammaps.times}},
-        this.requestParam.data[1] = { 'name': 'deletefpdetailAll', 'type': 'e', 'parammaps': { pastureid:  Cookies.get('pastureid') ,times:this.table.getdataListParm.parammaps.times}},
+        this.requestParam.data[0] = { 'name': 'deleteLpplandtl1All', 'type': 'e', 'parammaps': { pastureid:  Cookies.get('pastureid') ,times:this.table.getdataListParm.parammaps.times,barid:this.allEmptySelect.toString()}},
+        this.requestParam.data[1] = { 'name': 'deletefpdetailAll', 'type': 'e', 'parammaps': { pastureid:  Cookies.get('pastureid') ,times:this.table.getdataListParm.parammaps.times,barid:this.allEmptySelect.toString()}},
+        this.requestParam.data[1] = { 'name': 'deletefpdetailAll', 'type': 'e', 'parammaps': { pastureid:  Cookies.get('pastureid') ,times:this.table.getdataListParm.parammaps.times,barid:this.allEmptySelect.toString()}},
         ExecDataByConfig(this.requestParam).then(response => {
           console.log('清空已分配栏舍', this.requestParam)
           if (response.msg === 'fail') {
@@ -1566,16 +1661,15 @@ export default {
             postJson(url, data).then(response => {
               if (response.msg !== 'fail') {
                 this.$notify({ title: '清空成功', message: '清空成功', type: 'success', duration: 2000 })
+                this.allEmpty.dialogFormVisible = false;
                 this.getList()
               } else {
                 this.$notify({ title: '清空失败', message: response.data, type: 'warning', duration: 2000 })
               }
             })
-            this.$notify({ title: '清空成功', message: '清空成功', type: 'success', duration: 2000 })
-            this.getList()
           }
         })
-      })
+      }
     }
   }
 }