maliang 1 viikko sitten
vanhempi
commit
5e839a7f55

+ 7 - 2
jshERP-web/src/views/bill/mixins/BillModalMixin.js

@@ -596,7 +596,7 @@ export const BillModalMixin = {
             if (res && res.code === 200) {
               let mList = res.data
               console.log('mList======',mList)
-              target.getValues((error, values) => {
+              target.getValues(async (error, values) => {
                 const clickRowIndex = values.findIndex((item) => item.id === row.id) //获取当前行的索引
                 // values.pop() //移除最后一行数据
                 values.splice(clickRowIndex, 1) //移除当前行数据
@@ -609,7 +609,12 @@ export const BillModalMixin = {
                   this.changeColumnShow(mInfo)
                   let mObj = this.parseInfoToObj(mInfo)
                   mObj.depotId = mInfo.depotId
-                  mObj.stock = mInfo.stock
+                  const res = await findStockByDepotAndBarCode({ depotId: mInfo.depotId, barCode: mObj.barCode })
+                  const {position,stock} = res.data
+                  mObj.stock = stock
+                  console.log('stock===',stock)
+                  console.log('position===',position)
+                  mObj.position = position
                   mObj.inventory = mInfo.inventory
                   const unitPrice = (mObj.unitPrice||0)- 0
                   mObj.allPrice = (unitPrice * mObj.operNumber).toFixed(2)

+ 3 - 4
jshERP-web/src/views/stock/components/checkModal.vue

@@ -12,8 +12,7 @@
           :total="dataSource.length || 0"
           openType="detail"
           :stockType="stockType"
-          @getForm="getForm"
-          @clear="onClearList"
+          @changeForm="handleChangeForm"
         ></edit-form>
         <a-divider />
         <div>
@@ -395,7 +394,7 @@ export default {
       const form = this.$refs['editForm'].form
 
       const params = { ...this.queryParam, taskStocktakingId: id || this.taskId }
-      const url = url2 + '?pageNum=' + this.ipagination.current + '&pageSize=' + this.ipagination.pageSize
+      const url = url2 + '?currentPage=' + this.ipagination.current + '&pageSize=' + this.ipagination.pageSize
       postAction(url, params).then((res) => {
         this.dataSource = res.data
         this.ipagination.total = this.dataSource.length
@@ -452,7 +451,7 @@ export default {
       this.dataSource = this.dataSource.filter((item) => item.batchNumber !== record.batchNumber)
     },
 
-    onClearList(val) {
+    handleChangeForm(val) {
       this.dataSource = []
       this.getForm(val)
       if (val.taskType === 1) {

+ 6 - 11
jshERP-web/src/views/stock/components/editForm.vue

@@ -10,7 +10,7 @@
         <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="盘点类型">
           <a-select
             placeholder="请选择"
-            @change="handleTaskType"
+            @change="emitForm"
             v-decorator="['taskType', rules.taskType]"
             :options="taskTypeList"
             :disabled="isDisabled"
@@ -30,7 +30,7 @@
             v-decorator="['depotId', rules.depotId]"
             :options="depotList"
             :disabled="isDisabled"
-            @change="exportForm"
+            @change="emitForm"
           >
           </a-select>
         </a-form-item>
@@ -166,7 +166,7 @@ export default {
       handler(val) {
         if (!val) {
           this.form.resetFields()
-          this.exportForm()
+          this.emitForm()
         }
         if (this.openType === 'add') {
           this.model.taskStatus = 1
@@ -186,16 +186,11 @@ export default {
     },
   },
   methods: {
-    exportForm() {
+    emitForm(val){
       this.$nextTick(() => {
-        this.$emit('getForm', this.form.getFieldsValue())
+        this.$emit('changeForm', this.form.getFieldsValue())
       })
-    },
-    handleTaskType() {
-      this.$nextTick(() => {
-        this.$emit('clear', this.form.getFieldsValue())
-      })
-    },
+    }
   },
 }
 </script>

+ 30 - 11
jshERP-web/src/views/stock/components/stockModal.vue

@@ -12,8 +12,7 @@
           :total="ipagination.total"
           :openType="openType"
           :stockType="stockType"
-          @getForm="getForm"
-          @clear="onClearList"
+          @changeForm="handleChangeForm"
         ></edit-form>
         <div>
           <a-button v-if="form.taskType === 2" style="margin-bottom: 6px" type="primary" @click="onChangeGoods"
@@ -25,17 +24,17 @@
             size="middle"
             bordered
             rowKey="id"
+            :scroll="{ x: 'max-content'}"
             :columns="columns"
             :dataSource="dataSource"
             :loading="loading"
-            :scroll="{ y: 500 }"
             :pagination="ipagination"
             @change="handleTableChange"
           >
             <span v-if="isShowBtn" slot="action" slot-scope="text, record">
               <!-- <a-divider type="vertical" /> -->
               <a-popconfirm @confirm="handleDelete(record)" title="确定删除吗?">
-                <a>删除</a>
+                <a v-if="form.taskType!=1">删除</a>
               </a-popconfirm>
             </span>
             <template slot="inventory" slot-scope="value, record">
@@ -179,6 +178,10 @@ export default {
       })
     },
     onChangeGoods() {
+      if(!this.form.depotId){
+        this.$message.warning('请选择仓库!')
+        return
+      }
       // this.$refs.selectModal.queryParam.depotId = this.form.depotId
       this.$refs.selectModal.showModal()
     },
@@ -224,6 +227,8 @@ export default {
             materialExtendIdList,
           })
           this.getForm(form.getFieldsValue())
+          console.log('this.dataSource',this.dataSource)
+          console.log('this.columns',this.columns)
         })
       })
     },
@@ -232,11 +237,13 @@ export default {
         .split(',')
         .filter((item) => item)
         .join(',')
-        console.log('rows', rows)
-        console.log('ids', ids)
-        console.log('str===', str)
+      if(!this.form.depotId){
+        this.$message.warning('请选择仓库!')
+        return
+      }
       getAction('/materialBatch/findBatchNumbersByBarCode',{
         barCodes: str,
+        depotId:this.form.depotId
       }).then((res) => {
         const batchStr = res.data.split(',')
         .filter((item) => item)
@@ -246,8 +253,13 @@ export default {
       })
     },
     findAllSelect() {
-      // const params = { ...this.$refs.selectModal.queryParam }
-      getAction('/materialBatch/findBatchNumbersByBarCode').then((res) => {
+      if(!this.form.depotId){
+        this.$message.warning('请选择仓库!')
+        return
+      }
+      getAction('/materialBatch/findBatchNumbersByBarCode',{
+        depotId:this.form.depotId
+      }).then((res) => {
         this.$refs.selectModal.close()
         const batchStr = res.data.split(',')
         .filter((item) => item)
@@ -265,6 +277,9 @@ export default {
       }
       getAction(`/material/getMaterialByBatchNumber?currentPage=${this.ipagination.current}&pageSize=${this.ipagination.pageSize}`, params).then((res) => {
         this.dataSource = res.data.rows
+        if(this.dataSource.length===0){
+          this.$message.warning('暂无数据!')
+        }
         this.ipagination.total = Number(res.data.total)
         this.dataSource = this.dataSource.reduce((acc, cur) => {
           const hasDuplicate = acc.some((item) => item.batchNumber === cur.batchNumber)
@@ -284,7 +299,7 @@ export default {
       this.dataSource = this.dataSource.filter((item) => item.batchNumber !== record.batchNumber)
     },
 
-    onClearList(val) {
+    handleChangeForm(val) {
       this.dataSource = []
       this.ipagination.current = 1
       this.ipagination.total = 0
@@ -301,7 +316,11 @@ export default {
       if (pagination && pagination.current) {
         this.ipagination = pagination
       }
-      this.getBatchData()
+      if(this.openType=='add'){
+        this.getBatchData()
+      }else{
+        this.getList(this.taskId)
+      }
     },
   },
 }