zhouhao 2 anos atrás
pai
commit
5f0a227089

+ 5 - 1
src/components/SalesDialog/SalesDialog.vue

@@ -3,7 +3,7 @@
     <el-dialog
       title="添加产品"
       :visible.sync="dialogVisible"
-      :before-close="$parent.dialogVisible = false"
+      :before-close="onClose"
       width="75%"
     >
       <template-page
@@ -102,6 +102,10 @@ export default {
     detailsWarehouse() {
       this.pageType = 3
     },
+    onClose(){
+      this.$parent.dialogVisible = false
+
+    },
     operation() {
       return (h, { row, index, column }) => {
         return (

+ 24 - 42
src/views/sales_control/adjust_warehouse.vue

@@ -12,9 +12,9 @@
       :optionsEvensGroup="optionsEvensGroup"
     >
     </template-page>
-    <warehouse-form v-else-if="pageType===1" />
-    <warehouse-examine v-else-if="pageType===2" :detailsId="detailsId" />
-    <warehouse-details v-else="pageType===3" :detailsId="detailsId" />
+    <warehouse-form v-else-if="pageType==1" />
+    <warehouse-examine v-else-if="pageType==2" :detailsId="detailsId" />
+    <warehouse-details v-else :detailsId="detailsId" />
   </div>
 </template>
 
@@ -23,39 +23,22 @@ import TemplatePage from '@/components/template/template-page-1.vue'
 import import_mixin from '@/components/template/import_mixin.js'
 
 import { getFrontListCustomerAcc, exportCustomerStockOrderBean, deleteCustomerStockOrder } from '@/api/stock'
-import WarehouseForm from '@/views/stock_control/components/WarehouseForm'
-import WarehouseExamine from '@/views/stock_control/components/WarehouseExamine'
-import WarehouseDetails from '@/views/stock_control/components/WarehouseDetails'
+import WarehouseForm from '@/views/sales_control/components/WarehouseForm'
+import WarehouseExamine from '@/views/sales_control/components/WarehouseExamine'
+import WarehouseDetails from '@/views/sales_control/components/WarehouseDetails'
 
 export default {
   components: { TemplatePage, WarehouseForm, WarehouseExamine, WarehouseDetails },
   mixins: [import_mixin],
   data() {
     return {
-      pageType: 0,
       // 事件组合
       optionsEvensGroup: [
         [
-          // [
-          //   {
-          //     name: '批量删除',
-          //     click: this.dels,
-          //     // isRole: this.$checkBtnRole('del', this.$route.meta.roles)
-          //   }
-          // ],
-          [
-            {
-              name: '审核',
-              click: this.examineWarehouse
-            }
-          ]
-        ],
-        [
           [
             {
               name: '库存调整',
               click: this.addWarehouse
-              // isRole: this.$checkBtnRole('add', this.$route.meta.roles)
             }
           ]
         ]
@@ -70,7 +53,8 @@ export default {
         'selection-change': this.selectionChange
       },
       recordSelected: [],
-      detailsId: ''
+      detailsId: '',
+      pageType: 0
     }
   },
   methods: {
@@ -91,12 +75,7 @@ export default {
     },
     addWarehouse() {
       this.pageType = 1
-    },
-    examineWarehouse() {
-      this.pageType = 2
-    },
-    detailsWarehouse() {
-      this.pageType = 3
+      console.log(this.pageType, '333')
     },
     operation() {
       return (h, { row, index, column }) => {
@@ -112,21 +91,24 @@ export default {
             >
               查看
             </el-button>
-            <el-button
-              size="mini"
-              type="text" onClick={() => {
-              this.detailsId = row.id
-              this.pageType = 2
-            }}
-            >
-              审批
-            </el-button>
+            {row.examineStatus != 'OK' ? (
+              <el-button
+                size="mini"
+                type="text" onClick={() => {
+                this.detailsId = row.id
+                this.pageType = 2
+              }}
+              >
+                审批 
+              </el-button>
+            ) : null}
             <el-popconfirm
-              onOnConfirm = {()=>{
+              onOnConfirm={() => {
                 deleteCustomerStockOrder({ id: row.id }).then(res => {
                   this.$successMsg('删除成功')
-                  this.$refs.pageRef.refreshList();
-                })              }}
+                  this.$refs.pageRef.refreshList()
+                })
+              }}
               title="删除吗?"
             >
               <el-button slot="reference" size="mini" type="text">删除</el-button>

+ 1 - 1
src/views/sales_control/components/WarehouseExamine.vue

@@ -122,7 +122,7 @@ export default {
         approvalRemark:this.screenForm.approvalRemark
       } ).then(res=>{
         this.$successMsg(type==='OK'?'审核成功':'驳回成功')
-        $parent.pageType=0
+        this.$parent.pageType=0
       })
     }
   }

+ 39 - 22
src/views/sales_control/components/WarehouseForm.vue

@@ -1,6 +1,8 @@
 <template>
   <div>
-    <el-page-header @back="$parent.pageType=0" :content="$parent.pageType=0?'新增':'编辑'" style=" padding: 20px 20px 0 20px;"></el-page-header>
+    <el-page-header @back="$parent.pageType=0" content="新增"
+                    style=" padding: 20px 20px 0 20px;"
+    ></el-page-header>
     <warehousing-header ref="header" />
     <sales-table :dataList="dataList" :column="column" isOperation isSelection @handleSelection="handleSelection">
       <template #bts>
@@ -12,7 +14,7 @@
       <template #events>
         <div>
           <el-button type="primary" size="mini" @click="handelSubmit">提交</el-button>
-          <el-button size="mini">重置</el-button>
+          <el-button size="mini" @click="onReset">重置</el-button>
         </div>
       </template>
       <template v-slot:custom="{item:{row,$index}}">
@@ -29,9 +31,9 @@
         </el-popconfirm>
       </template>
     </sales-table>
-
-
-    <sales-dialog :dialogVisible="dialogVisible" :customerNumber="customerNumber" :func="getDialogList" @confirm="confirm" />
+    <sales-dialog :dialogVisible="dialogVisible" :customerNumber="customerNumber" :func="getDialogList"
+                  @confirm="confirm"
+    />
   </div>
 </template>
 
@@ -39,7 +41,10 @@
 import SalesDialog from '@/components/SalesDialog/SalesDialog'
 import WarehousingHeader from '@/components/WarehousingHeader/WarehousingHeader'
 import SalesTable from '@/components/SalesTable/SalesTable'
-import { getcustomerFrontList, addFrontOrder } from '@/api/stock'
+import { getcustomerFrontList,addCustomerStockOrder } from '@/api/stock'
+import {
+  addFrontOrder
+} from '@/api/sales'
 
 export default {
   name: 'WarehouseForm',
@@ -51,10 +56,10 @@ export default {
   data() {
     return {
       dialogVisible: false,
-      customerNumber:'',
+      customerNumber: '',
       dataList: [],
       selection: [],
-      flag:1,
+      flag: 1,
       column: [
         {
           prop: 'materialName',
@@ -100,6 +105,11 @@ export default {
     }
   },
   methods: {
+    onReset() {
+      Object.assign(this.$data, this.$options.data())
+      Object.assign(this.$refs.header.$data, this.$refs.header.$options.data())
+
+    },
     getDialogList(p) {
       return getcustomerFrontList(...p)
     },
@@ -115,34 +125,41 @@ export default {
     handleDel(item, index) {
       this.dataList.splice(index, 1)
     },
+    //去掉相同数据
+    resArr(arr1, arr2) {
+      return arr1.filter(v => arr2.every(val => val.id != v.id))
+    },
     delChange() {
-      this.dataList.forEach((k, i) => {
-        this.selection.forEach((l, e) => {
-          if (k.id === l.id) {
-            this.dataList.splice(i, 1)
-            this.selection.splice(e, 1)
-          }
-        })
-      })
+      if (this.dataList.length){
+        this.dataList =  this.resArr(this.dataList,this.selection)
+        if (!this.dataList.length){
+          this.customerNumber = ''
+        }
+      }
     },
     handleSelection(data) {
       this.selection = data
     },
     handelSubmit() {
-      this.dataList.forEach(k => {
-        k.id = ''
-        k.directFlag = k.flag
-      })
+
+      for (let i = 0; i < this.dataList.length; i++) {
+        this.dataList[i].id = ''
+        this.dataList[i].directFlag = this.dataList[i].flag
+        if (Number(this.dataList[i].stockChangeQty) < 0 || !this.dataList[i].stockChangeQty) {
+          this.$errorMsg(`第${i + 1}产品数量有误`)
+          return
+        }
+      }
       const params = {
         ...this.$refs.header.screenForm,
         orders: this.dataList
       }
-      addFrontOrder(params).then(res => {
+      addCustomerStockOrder(params).then(res => {
         this.$successMsg('新增成功')
         this.$parent.pageType = 0
         this.$forceUpdate()
       })
-    },
+    }
 
   }
 }

+ 20 - 39
src/views/stock_control/adjust_warehouse.vue

@@ -12,9 +12,9 @@
       :optionsEvensGroup="optionsEvensGroup"
     >
     </template-page>
-    <warehouse-form v-else-if="pageType===1" />
-    <warehouse-examine v-else-if="pageType===2" :detailsId="detailsId" />
-    <warehouse-details v-else="pageType===3" :detailsId="detailsId" />
+    <warehouse-form v-else-if="pageType==1" />
+    <warehouse-examine v-else-if="pageType==2" :detailsId="detailsId" />
+    <warehouse-details v-else :detailsId="detailsId" />
   </div>
 </template>
 
@@ -32,33 +32,16 @@ export default {
   mixins: [import_mixin],
   data() {
     return {
-      pageType: 0,
       // 事件组合
       optionsEvensGroup: [
         [
-          // [
-          //   {
-          //     name: '批量删除',
-          //     click: this.dels,
-          //     // isRole: this.$checkBtnRole('del', this.$route.meta.roles)
-          //   }
-          // ],
           [
             {
-              name: '审核',
-              click: this.examineWarehouse
+              name: '库存调整2',
+              click:this.addWarehouse
             }
           ]
         ],
-        [
-          [
-            {
-              name: '库存调整',
-              click: this.addWarehouse
-              // isRole: this.$checkBtnRole('add', this.$route.meta.roles)
-            }
-          ]
-        ]
       ],
       // 表格属性
       tableAttributes: {
@@ -70,7 +53,8 @@ export default {
         'selection-change': this.selectionChange
       },
       recordSelected: [],
-      detailsId: ''
+      detailsId: '',
+      pageType: 0,
     }
   },
   methods: {
@@ -91,12 +75,7 @@ export default {
     },
     addWarehouse() {
       this.pageType = 1
-    },
-    examineWarehouse() {
-      this.pageType = 2
-    },
-    detailsWarehouse() {
-      this.pageType = 3
+      console.log(this.pageType,'333')
     },
     operation() {
       return (h, { row, index, column }) => {
@@ -112,15 +91,17 @@ export default {
             >
               查看
             </el-button>
-            <el-button
-              size="mini"
-              type="text" onClick={() => {
-              this.detailsId = row.id
-              this.pageType = 2
-            }}
-            >
-              审批
-            </el-button>
+            {row.examineStatus != 'OK' || row.examineStatus != 'CLOSE' ? (
+              <el-button
+                size="mini"
+                type="text" onClick={() => {
+                this.detailsId = row.id
+                this.pageType = 2
+              }}
+              >
+                审批
+              </el-button>
+            ) : null}
             <el-popconfirm
               onOnConfirm = {()=>{
                 deleteCustomerStockOrder({ id: row.id }).then(res => {
@@ -129,7 +110,7 @@ export default {
                 })              }}
               title="删除吗?"
             >
-              <el-button slot="reference" type="text">删除</el-button>
+              <el-button slot="reference" size="mini" type="text">删除</el-button>
             </el-popconfirm>
           </div>
         )

+ 1 - 3
src/views/stock_control/components/WarehouseForm.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <el-page-header @back="$parent.pageType=0" :content="$parent.pageType=0?'新增':'编辑'" style=" padding: 20px 20px 0 20px;"></el-page-header>
+    <el-page-header @back="$parent.pageType=0" content="新增" style=" padding: 20px 20px 0 20px;"></el-page-header>
     <warehousing-header ref="header" />
     <sales-table :dataList="dataList" :column="column" isOperation isSelection @handleSelection="handleSelection">
       <template #bts>
@@ -29,8 +29,6 @@
         </el-popconfirm>
       </template>
     </sales-table>
-
-
     <sales-dialog :dialogVisible="dialogVisible" :customerNumber="customerNumber" :func="getDialogList" @confirm="confirm" />
   </div>
 </template>