Browse Source

Merge branch 'master' of http://121.40.253.172:3000/pengyue/jsh_erp into dev_huangjunjie

huang 11 hours ago
parent
commit
dc271a5f2a

+ 9 - 4
jshERP-web/src/views/bill/mixins/BillModalMixin.js

@@ -478,11 +478,11 @@ export const BillModalMixin = {
     async setProPosition(barCode, depotId, event){
       const { row, column, value, target } = event
       findStockByDepotAndBarCode({ depotId: depotId, barCode: barCode }).then(res => {
-        const {position,stock} = res.data
+        const {position='',stock} = res.data
         target.setValues([
           {
             rowKey: row.id,
-            values: { position,inventory: stock },
+            values: { position:position,inventory: stock,stock: stock },
           },
         ])
         target.$forceUpdate()
@@ -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 - 72
jshERP-web/src/views/stock/components/checkModal.vue

@@ -12,8 +12,6 @@
           :total="dataSource.length || 0"
           openType="detail"
           :stockType="stockType"
-          @getForm="getForm"
-          @clear="onClearList"
         ></edit-form>
         <a-divider />
         <div>
@@ -75,14 +73,6 @@
             :loading="loading"
             @change="handleTableChange"
           >
-            <!-- <template v-for="col in colList" :slot="col" slot-scope="text, record">
-              <div :key="col">
-                <a-input v-if="editableData[record.id]" v-model="editableData[record.id][col]" style="margin: -5px 0" />
-                <template v-else>
-                  {{ col }}
-                </template>
-              </div>
-            </template> -->
             <span slot="action" v-if="openType !== 'detail'" slot-scope="text, record">
               <a type="text" @click="handleEdit(record)">编辑</a>
             </span>
@@ -98,13 +88,6 @@
         <a-button v-if="isShowBtn" @click="handleUpdate" type="primary">确定更新盘点数据</a-button>
       </template>
     </a-modal>
-    <j-select-material-modal
-      @ok="getGoods"
-      @all="findAllSelect"
-      ref="selectModal"
-      :multi="true"
-      :isStock="true"
-    ></j-select-material-modal>
     <a-modal @cancel="editVisible = false" @ok="onSubmitGoods" :visible="editVisible" title="编辑" width="50%">
       <a-form-model :model="editForm" :rules="editFormRules" ref="editFormModel">
         <a-form-model-item label="盘点任务名称" :labelCol="{ span: 4 }" :wrapperCol="{ span: 14 }" prop="name">
@@ -284,7 +267,7 @@ export default {
   methods: {
     handleEdit(data) {
       console.log('handleEdit=====',data)
-      this.editForm = { ...data }
+      this.editForm = { ...data,name:this.form.taskName }
       this.editVisible = true
       this.handleChangeNewInventory(data.inventory)
     },
@@ -294,6 +277,7 @@ export default {
           postAction(this.url.edit, this.editForm).then((res) => {
             this.$message.success('操作成功')
             this.editVisible = false
+            this.getList(this.taskId)
           })
         } else {
           return false
@@ -348,10 +332,6 @@ export default {
         })
       this.handleCancel()
     },
-    onChangeGoods() {
-      this.$refs.selectModal.queryParam.depotId = this.form.depotId
-      this.$refs.selectModal.showModal()
-    },
     getDetailList(id) {
       const url = this.url.detail + id
       const form = this.$refs['editForm'].form
@@ -395,7 +375,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
@@ -407,59 +387,10 @@ export default {
         this.getForm(form.getFieldsValue())
       })
     },
-    getGoods(rows, ids) {
-      const str = ids
-        .split(',')
-        .filter((item) => item)
-        .join(',')
-      this.getBatchData(str)
-    },
-    findAllSelect() {
-      const params = { ...this.$refs.selectModal.queryParam }
-      getAction('/material/findBatchNumbersBySelect', params).then((res) => {
-        this.$refs.selectModal.close()
-        this.getBatchData(res.data)
-      })
-    },
-    getBatchData(val) {
-      const batchStr = val
-        .split(',')
-        .filter((item) => item)
-        .join(',')
-      const params = {
-        batchNumber: batchStr,
-        organId: '',
-        mpList: '',
-        prefixNo: '',
-      }
-      getMaterialByBatchNumber(params).then((res) => {
-        this.dataSource.push(...res.data)
-        this.dataSource = this.dataSource.reduce((acc, cur) => {
-          const hasDuplicate = acc.some((item) => item.batchNumber === cur.batchNumber)
-          if (!hasDuplicate) {
-            acc.push(cur)
-          }
-          return acc
-        }, [])
-      })
-    },
     getForm(val) {
       this.form = val
       this.$refs['editForm'].model = val
     },
-    //删除
-    handleDelete(record) {
-      this.dataSource = this.dataSource.filter((item) => item.batchNumber !== record.batchNumber)
-    },
-
-    onClearList(val) {
-      this.dataSource = []
-      this.getForm(val)
-      if (val.taskType === 1) {
-        this.findAllSelect()
-      }
-    },
-
     handleChangeNewInventory(val) {
       console.log('1111111======',val)
       const inventory = this.editForm.inventory ? Number(this.editForm.inventory) : 0

+ 7 - 17
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>
@@ -71,17 +71,12 @@
           <a-input placeholder="请输入" disabled v-decorator.trim="['operTime']" />
         </a-form-item>
       </a-col>
-      <a-col v-show="true" :xl="6" :lg="8" :md="12" :sm="24" class="form-col">
+      <a-col :xl="6" :lg="8" :md="12" :sm="24" class="form-col">
         <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="盘点状态">
           <a-select placeholder="请选择" v-decorator="['taskStatus']" :options="taskStatusList" :disabled="isDisabled">
           </a-select>
         </a-form-item>
       </a-col>
-      <a-col v-show="false" :xl="6" :lg="8" :md="12" :sm="24" class="form-col">
-        <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="盘点状态">
-          <a-input v-decorator="['id']"></a-input>
-        </a-form-item>
-      </a-col>
     </a-row>
   </a-form>
 </template>
@@ -166,7 +161,7 @@ export default {
       handler(val) {
         if (!val) {
           this.form.resetFields()
-          this.exportForm()
+          this.emitForm()
         }
         if (this.openType === 'add') {
           this.model.taskStatus = 1
@@ -186,16 +181,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>

+ 33 - 13
jshERP-web/src/views/stock/components/stockModal.vue

@@ -12,11 +12,10 @@
           :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"
+          <a-button v-if="form.taskType === 2&&openType!='detail'" style="margin-bottom: 6px" type="primary" @click="onChangeGoods"
             >选择商品</a-button
           >
           <a-table
@@ -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,12 +178,16 @@ export default {
       })
     },
     onChangeGoods() {
+      if(!this.form.depotId){
+        this.$message.warning('请选择仓库!')
+        return
+      }
       // this.$refs.selectModal.queryParam.depotId = this.form.depotId
       this.$refs.selectModal.showModal()
     },
     getList(id) {
       const url = '/stocktaking/detail/' + id
-      const url2 = '/stocktaking/detailByItemList'
+      const url2 = `/stocktaking/detailByItemList?currentPage=${this.ipagination.current}&pageSize=${this.ipagination.pageSize}`
       const form = this.$refs['editForm'].form
 
       getAction(url).then((res) => {
@@ -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)
@@ -282,9 +297,10 @@ export default {
     //删除
     handleDelete(record) {
       this.dataSource = this.dataSource.filter((item) => item.batchNumber !== record.batchNumber)
+      this.ipagination.total -=1
     },
 
-    onClearList(val) {
+    handleChangeForm(val) {
       this.dataSource = []
       this.ipagination.current = 1
       this.ipagination.total = 0
@@ -301,7 +317,11 @@ export default {
       if (pagination && pagination.current) {
         this.ipagination = pagination
       }
-      this.getBatchData()
+      if(this.openType=='add'){
+        this.getBatchData()
+      }else{
+        this.getList(this.taskId)
+      }
     },
   },
 }