Bläddra i källkod

xzt-320,325,调拨订单明细行不能为空

黄梓星 2 år sedan
förälder
incheckning
50b0317dac

+ 8 - 0
src/api/purchase/deliveryAddress.js

@@ -45,4 +45,12 @@ export function toNc(data) {
     method: 'post',
     data: data
   })
+}
+// 收货地址档案启用停用
+export function enable(data) {
+  return request({
+    url: `/pu/delivery/address/enable`,
+    method: 'post',
+    data: data
+  })
 }

+ 25 - 5
src/views/purchase/MaterialClassDivision/index.vue

@@ -184,7 +184,7 @@
         <div class="btn_grooup">
           <el-button type="primary" size="mini" @click="addDivision">新增</el-button>
 
-          <el-dropdown size="mini" @command="handleCommand">
+          <!-- <el-dropdown size="mini" @command="handleCommand">
             <el-button size="mini" type="primary" style="margin-left: 10px;">
               导入<i class="el-icon-arrow-down el-icon--right"></i>
             </el-button>
@@ -202,9 +202,9 @@
               <el-dropdown-item command="Excel导出">Excel导出</el-dropdown-item>
               <el-dropdown-item command="导出明细">导出明细</el-dropdown-item>
             </el-dropdown-menu>
-          </el-dropdown>
+          </el-dropdown> -->
 
-          <el-button type="primary" size="mini">删除</el-button>
+          <el-button type="primary" size="mini" @click="deletes">删除</el-button>
         </div>
         <el-table 
           :data="tableList" 
@@ -335,7 +335,8 @@ export default {
       tableList: [],
       total: 0,
       rowDetail: {},
-      disable: false
+      disable: false,
+      allSelection: []
     }
   },
   created() {
@@ -374,7 +375,26 @@ export default {
       }
       this.getList(this.queryParams)
     },
-    handleSelectionChange() {},
+    deletes() {
+      if (this.allSelection.length == 0) {
+        this.$modal.msgWarning("请至少选择一条数据!");
+      } else {
+        let param = this.allSelection.map(item => item.id)
+        let rows = param.join()
+        this.$modal.confirm('确认删除选择数据?').then(() => {
+          delDivision(rows).then(res => {
+            if (res.code === 200) {
+              this.$modal.msgSuccess("删除成功");
+              this.getList(this.queryParams)
+            }
+          })
+        }).catch(() => { })
+      }
+    },
+    handleSelectionChange(selection) {
+      console.log('选中', selection)
+      this.allSelection = selection
+    },
     handleCommand(command) {
       alert(command)
     },

+ 51 - 7
src/views/purchase/deliveryAddress/index.vue

@@ -142,7 +142,7 @@
         <div class="btn_grooup">
           <el-button type="primary" size="mini" @click="addAddress">新增</el-button>
 
-          <el-dropdown size="mini" @command="handleCommand">
+          <!-- <el-dropdown size="mini" @command="handleCommand">
             <el-button size="mini" type="primary" style="margin-left: 10px;">
               导入<i class="el-icon-arrow-down el-icon--right"></i>
             </el-button>
@@ -160,12 +160,12 @@
               <el-dropdown-item command="Excel导出">Excel导出</el-dropdown-item>
               <el-dropdown-item command="导出明细">导出明细</el-dropdown-item>
             </el-dropdown-menu>
-          </el-dropdown>
+          </el-dropdown> -->
 
-          <el-button type="primary" size="mini">启用</el-button>
-          <el-button type="primary" size="mini">停用</el-button>
+          <el-button type="primary" size="mini" @click="startUse">启用</el-button>
+          <el-button type="primary" size="mini" @click="stopUse">停用</el-button>
           <el-button type="primary" size="mini" @click="toNC">同步NC</el-button>
-          <el-button type="primary" size="mini">删除</el-button>
+          <el-button type="primary" size="mini" @click="deletes">删除</el-button>
         </div>
         <el-table 
           :data="tableList" 
@@ -236,7 +236,7 @@
 <script>
 import Add from './add.vue'
 import CollapseTransition from '@/components/MyCollapse/collapse.vue'
-import {getAddressList, delAddress, toNc } from '@/api/purchase/deliveryAddress.js'
+import {getAddressList, delAddress, toNc, enable } from '@/api/purchase/deliveryAddress.js'
 import Refers from '@/components/Refers/refers.vue'
 import TreeRefers from '@/components/Refers/treeRefer.vue'
 export default {
@@ -350,6 +350,50 @@ export default {
         })
       }
     },
+    startUse() {
+      if (this.allSelection.length == 0 || this.allSelection.length > 1) {
+        this.$modal.msgWarning("启用停用只能进行单条操作!");
+      } else {
+        console.log('参数', this.allSelection)
+        let param = {id: this.allSelection[0].id, status: 'Y' }
+        enable(param).then(res => {
+          if (res.code === 200) {
+            this.$modal.msgSuccess("操作成功!");
+            this.getList(this.queryParams)
+          }
+        })
+      }
+    },
+    stopUse() {
+      if (this.allSelection.length == 0 || this.allSelection.length > 1) {
+        this.$modal.msgWarning("启用停用只能进行单条操作!");
+      } else {
+        console.log('参数', this.allSelection)
+        let param = { id: this.allSelection[0].id, status: 'N' }
+        enable(param).then(res => {
+          if (res.code === 200) {
+            this.$modal.msgSuccess("操作成功!");
+            this.getList(this.queryParams)
+          }
+        })
+      }
+    },
+    deletes() {
+      if (this.allSelection.length == 0) {
+        this.$modal.msgWarning("请至少选择一条数据!");
+      } else {
+        let param = this.allSelection.map(item => item.id)
+        let rows = param.join()
+        this.$modal.confirm('确认删除选择数据?').then(() => {
+          delAddress(rows).then(res => {
+            if (res.code === 200) {
+              this.$modal.msgSuccess("删除成功");
+              this.getList(this.queryParams)
+            }
+          })
+        }).catch(() => { })
+      }
+    },
     handleSelectionChange(selection) {
       console.log('选中', selection)
       this.allSelection = selection
@@ -376,7 +420,7 @@ export default {
     },
     deleteids(row) {
       console.log('row', row)
-      this.$modal.confirm('确认信息').then(() => {
+      this.$modal.confirm('确认删除选择数据').then(() => {
         delAddress(row.id).then(res => {
           if (res.code === 200) {
             this.$modal.msgSuccess("删除成功");

+ 30 - 26
src/views/purchase/transferOrder/add.vue

@@ -817,33 +817,37 @@ export default {
       })
     },
     save() {
-      if(this.pageStu == 'add') {
-        this.basicForm.stAllotMaterialList = this.materialInfo
-        this.basicForm.stAllotReceiveDeliverList = this.receiveInfo
-        this.basicForm.stAllotReceiveExecuteList = this.priceList
-        this.basicForm.stAllotReceiveExpenseList = this.resultList
-        addOrder(this.basicForm).then(res => {
-          if (res.code === 200) {
-            this.$modal.msgSuccess("保存成功");
-            this.$emit('jugislist', true)
-            let queryParams = {
-              pageNum: 1,
-              pageSize: 5
+      if(this.materialInfo.length !== 0) {
+        if(this.pageStu == 'add') {
+          this.basicForm.stAllotMaterialList = this.materialInfo
+          this.basicForm.stAllotReceiveDeliverList = this.receiveInfo
+          this.basicForm.stAllotReceiveExecuteList = this.priceList
+          this.basicForm.stAllotReceiveExpenseList = this.resultList
+          addOrder(this.basicForm).then(res => {
+            if (res.code === 200) {
+              this.$modal.msgSuccess("保存成功");
+              this.$emit('jugislist', true)
+              let queryParams = {
+                pageNum: 1,
+                pageSize: 5
+              }
+              this.$emit('refresh', queryParams)
             }
-            this.$emit('refresh', queryParams)
-          }
-        })
-      } else if (this.pageStu == 'edit') {
-        this.basicForm.stAllotMaterialList = this.materialInfo
-        this.basicForm.stAllotReceiveDeliverList = this.receiveInfo
-        this.basicForm.stAllotReceiveExecuteList = this.priceList
-        this.basicForm.stAllotReceiveExpenseList = this.resultList
-        editOrder(this.basicForm).then(res => {
-          if (res.code === 200) {
-            this.$modal.msgSuccess("编辑成功");
-            this.back()
-          }
-        })
+          })
+        } else if (this.pageStu == 'edit') {
+          this.basicForm.stAllotMaterialList = this.materialInfo
+          this.basicForm.stAllotReceiveDeliverList = this.receiveInfo
+          this.basicForm.stAllotReceiveExecuteList = this.priceList
+          this.basicForm.stAllotReceiveExpenseList = this.resultList
+          editOrder(this.basicForm).then(res => {
+            if (res.code === 200) {
+              this.$modal.msgSuccess("编辑成功");
+              this.back()
+            }
+          })
+        }
+      } else {
+        this.$modal.msgWarning("明细行不能为空");
       }
     },
     back() {