ソースを参照

fix:商品信息

maliang 3 週間 前
コミット
617f250e70

+ 48 - 71
jshERP-web/src/views/bill/mixins/BillModalMixin.js

@@ -477,13 +477,13 @@ export const BillModalMixin = {
       }
     },
     //根据【仓库名】带出对应的【仓位货架】
-    async setProPosition(barCode, depotId){
+    async setProPosition(barCode, depotId, event){
+      const { row, column, value, target } = event
       const res = await getMaterialBySelect({
         q: barCode,
         page: 1,
         rows: 20
       })
-      debugger
       let proDetail
       if (res && res.rows) {
         proDetail = res.rows[0]? res.rows[0] : {}
@@ -493,6 +493,15 @@ export const BillModalMixin = {
         const res2 = await getAction('/material/getPositionByDidAndMid', { mid: proDetail.mid, did: depotId })
         console.log('getPositionByDidAndMid======',res2)
         if (res2 && res2.code === 200) {
+          const msg = res2.msg
+          if(msg){
+            target.setValues([
+              {
+                rowKey: row.id,
+                values: { position: msg },
+              },
+            ])
+          }
         }
       }
     },
@@ -515,7 +524,7 @@ export const BillModalMixin = {
             // getAction('/material/getPositionByDidAndMid',{mid:row.mid,did:row.depotId}).then((res) => {
             //   console.log('res========', res)
             // })
-            this.setProPosition(row.barCode, row.depotId)
+            this.setProPosition(row.barCode, row.depotId, event)
           }
           break
         case 'batchNumber':
@@ -610,77 +619,45 @@ export const BillModalMixin = {
           getMaterialByBarCode(param).then((res) => {
             if (res && res.code === 200) {
               let mList = res.data
-
-              if (value.indexOf(',') > -1) {
-                //多个条码
-                this.$refs.materialDataTable.getValues((error, values) => {
-                  values.pop() //移除最后一行数据
-                  let mArr = values
-                  console.log('values========', values)
-                  for (let i = 0; i < mList.length; i++) {
-                    let mInfo = mList[i]
-                    if (mInfo.unitId) {
-                      mInfo.unitList = JSON.stringify(mInfo.unitList)
-                    }
-                    this.changeColumnShow(mInfo)
-                    let mObj = this.parseInfoToObj(mInfo)
-                    mObj.depotId = mInfo.depotId
-                    mObj.stock = mInfo.stock
-                    mObj.mid = mInfo.id
-                    mObj.inventory = mInfo.inventory
-                    mArr.push(mObj)
+              target.getValues((error, values) => {
+                const clickRowIndex = values.findIndex((item) => item.id === row.id) //获取当前行的索引
+                // values.pop() //移除最后一行数据
+                values.splice(clickRowIndex, 1) //移除当前行数据
+                let mArr = values // 新加的行
+                for (let i = 0; i < mList.length; i++) {
+                  let mInfo = mList[i]
+                  if (mInfo.unitId) {
+                    mInfo.unitList = JSON.stringify(mInfo.unitList)
                   }
-                  let allPriceTotal = 0
-                  let taxLastMoneyTotal = 0
-                  for (let j = 0; j < mArr.length; j++) {
-                    allPriceTotal += mArr[j].allPrice - 0
-                    taxLastMoneyTotal += mArr[j].taxLastMoney - 0
-                    //组合和拆分单据给商品类型进行重新赋值
-                    if (j === 0) {
-                      mArr[0].mType = '组合件'
-                    } else {
-                      mArr[j].mType = '普通子件'
-                    }
-                  }
-
-                  this.materialTable.dataSource = mArr
-                  if (this.prefixNo === 'LSCK' || this.prefixNo === 'LSTH') {
-                    target.statisticsColumns.allPrice = allPriceTotal
+                  this.changeColumnShow(mInfo)
+                  let mObj = this.parseInfoToObj(mInfo)
+                  mObj.depotId = mInfo.depotId
+                  mObj.stock = mInfo.stock
+                  mObj.inventory = mInfo.inventory
+                  mArr.push(mObj)
+                }
+                let allPriceTotal = 0
+                let taxLastMoneyTotal = 0
+                for (let j = 0; j < mArr.length; j++) {
+                  allPriceTotal += mArr[j].allPrice - 0
+                  taxLastMoneyTotal += mArr[j].taxLastMoney - 0
+                  //组合和拆分单据给商品类型进行重新赋值
+                  if (j === 0) {
+                    mArr[0].mType = '组合件'
                   } else {
-                    target.statisticsColumns.taxLastMoney = taxLastMoneyTotal
-                  }
-                  that.autoChangePrice(target)
-                  //强制渲染
-                  target.$forceUpdate()
-                })
-              } else {
-                //单个条码
-                let depotIdSelected = row.depotId || ''
-                findStockByDepotAndBarCode({ depotId: depotIdSelected, barCode: row.barCode }).then((res) => {
-                  if (res && res.code === 200) {
-                    let mArr = []
-                    let mInfo = mList[0]
-                    if (mInfo.unitId) {
-                      mInfo.unitList = JSON.stringify(mInfo.unitList)
-                    }
-                    this.changeColumnShow(mInfo)
-                    let mInfoEx = this.parseInfoToObj(mInfo)
-                    mInfoEx.stock = res.data.stock
-                    mInfoEx.inventory = mInfo.inventory
-                    let mObj = {
-                      rowKey: row.id,
-                      values: mInfoEx,
-                    }
-                    mArr.push(mObj)
-                    target.setValues(mArr)
-                    target.recalcAllStatisticsColumns()
-                    that.autoChangePrice(target)
-                    target.autoSelectBySpecialKey('operNumber', row.orderNum)
-                    //强制渲染
-                    target.$forceUpdate()
+                    mArr[j].mType = '普通子件'
                   }
-                })
-              }
+                }
+                this.materialTable.dataSource = mArr
+                if (this.prefixNo === 'LSCK' || this.prefixNo === 'LSTH') {
+                  target.statisticsColumns.allPrice = allPriceTotal
+                } else {
+                  target.statisticsColumns.taxLastMoney = taxLastMoneyTotal
+                }
+                that.autoChangePrice(target)
+                //强制渲染
+                target.$forceUpdate()
+              })
             }
           })
           break

+ 1 - 1
jshERP-web/src/views/bill/modules/OtherOutModal.vue

@@ -317,7 +317,7 @@ export default {
             // allowClear: false,
             // slotName: 'unit',
           },
-          { title: '销售价', key: 'feild1', width: '120px', type: FormTypes.input },
+          { title: '销售价', key: 'wholesaleDecimal', width: '120px', type: FormTypes.input },
           { title: '单位id', key: 'unitId', width: '120px', type: FormTypes.hidden },
           { title: '单位列表', key: 'unitList', width: '120px', type: FormTypes.hidden },
           { title: '序列号', key: 'snList', width: '120px', type: FormTypes.popupJsh, kind: 'sn', multi: true },

+ 8 - 8
jshERP-web/src/views/bill/modules/PurchaseInModal.vue

@@ -496,7 +496,7 @@ export default {
             // allowClear: false,
             // slotName: 'unit',
           },
-          { title: '销售价', key: 'wholesaleDecima', width: '120px', type: FormTypes.input,validateRules: [{ required: true, message: '${title}不能为空' }], },
+          { title: '销售价', key: 'wholesaleDecimal', width: '120px', type: FormTypes.input,validateRules: [{ required: true, message: '${title}不能为空' }], },
           { title: '单位id', key: 'unitId', width: '120px', type: FormTypes.hidden },
           { title: '单位列表', key: 'unitList', width: '120px', type: FormTypes.hidden },
           { title: '序列号', key: 'snList', width: '120px', type: FormTypes.popupJsh, kind: 'snAdd', multi: true },
@@ -525,13 +525,13 @@ export default {
           },
           { title: '价税合计', key: 'taxLastMoney', width: '120px', type: FormTypes.inputNumber, statistics: true },
 
-          {
-            title: '实际入库数量',
-            key: 'actualQuantityInStorage',
-            width: '120px',
-            type: FormTypes.inputNumber,
-            validateRules: [{ required: true, message: '实际入库数量不能为空' }],
-          },
+          // {
+          //   title: '实际入库数量',
+          //   key: 'actualQuantityInStorage',
+          //   width: '120px',
+          //   type: FormTypes.inputNumber,
+          //   validateRules: [{ required: true, message: '实际入库数量不能为空' }],
+          // },
           { title: '入库差异', key: 'warehousingVariance', width: '120px', type: FormTypes.input },
           { title: '入库差异原因', key: 'reasonOfDifference', width: '120px', type: FormTypes.input },
           {

+ 1 - 1
jshERP-web/src/views/bill/modules/PurchaseOrderModal.vue

@@ -453,7 +453,7 @@ export default {
             // allowClear: false,
             // slotName: 'unit',
           },
-          { title: '销售价', key: 'wholesaleDecima', width: '120px', type: FormTypes.input, validateRules: [{ required: true, message: '${title}不能为空' }], },
+          { title: '销售价', key: 'wholesaleDecimal', width: '120px', type: FormTypes.input, validateRules: [{ required: true, message: '${title}不能为空' }], },
           { title: '单位id', key: 'unitId', width: '120px', type: FormTypes.hidden },
           { title: '单位列表', key: 'unitList', width: '120px', type: FormTypes.hidden },
           { title: '多属性', key: 'sku', width: '120px', type: FormTypes.normal },

+ 18 - 76
jshERP-web/src/views/material/modules/MaterialModal.vue

@@ -343,6 +343,9 @@
                 bordered
                 @change="handleMeTableChange"
               >
+                <template slot="depotId" slot-scope="text, record">
+                  {{ formatDepotName(record.depotId) }}
+                </template>
               </a-table>
             </div>
             <a-row class="form-row" :gutter="24">
@@ -558,101 +561,48 @@ export default {
         columns: [
           {
             title: '批次号',
-            // key: 'barCode',
-            key: 'batchNumber',
-            width: '15%',
-            type: FormTypes.input,
-            disabled: true,
-            defaultValue: '',
-            placeholder: '自动生成',
-            // validateRules: [
-            //   { required: true, message: '${title}不能为空' },
-            //   { pattern: /^.{4,40}$/, message: '长度为4到40位' },
-            //   { handler: this.validateBarCode },
-            // ],
+            dataIndex: 'batchNumber',
           },
           {
             title: '单位',
-            key: 'commodityUnit',
-            width: '8%',
-            type: FormTypes.input,
-            disabled: true,
-            defaultValue: '',
-            placeholder: '请输入${title}',
+            dataIndex: 'commodityUnit',
           },
           {
             title: '采购价',
-            key: 'purchaseDecimal',
-            width: '9%',
-            type: FormTypes.inputNumber,
-            defaultValue: '',
-            placeholder: '请输入${title}',
+            dataIndex: 'purchaseDecimal',
           },
           {
             title: '零售价',
-            key: 'commodityDecimal',
-            width: '9%',
-            type: FormTypes.inputNumber,
-            defaultValue: '',
-            placeholder: '请输入${title}',
+            dataIndex: 'commodityDecimal',
           },
           {
             title: '销售价',
-            key: 'wholesaleDecimal',
-            width: '9%',
-            type: FormTypes.inputNumber,
-            defaultValue: '',
-            placeholder: '请输入${title}',
+            dataIndex: 'wholesaleDecimal',
           },
           {
             title: '最低售价',
-            key: 'lowDecimal',
-            width: '9%',
-            type: FormTypes.inputNumber,
-            defaultValue: '',
-            placeholder: '请输入${title}',
+            dataIndex: 'lowDecimal',
           },
           {
             title: '生产日期',
-            key: 'productionDate',
-            width: '12%',
-            type: FormTypes.date,
-            defaultValue: '',
-            placeholder: '请选择${title}',
+            dataIndex: 'productionDate',
           },
           {
             title: '保质期(天)',
-            key: 'expiryNum',
-            width: '9%',
-            type: FormTypes.inputNumber,
-            defaultValue: '',
-            placeholder: '请输入${title}',
+            dataIndex: 'expiryNum',
           },
           {
             title: '供应商',
-            key: 'supplierId',
-            width: '12%',
-            type: FormTypes.slot,
-            slotName: 'supplierId',
-            defaultValue: '',
-            placeholder: '请选择${title}',
+            dataIndex: 'supplierId',
           },
           {
             title: '库存(最小单位)',
-            key: 'inventory',
-            width: '9%',
-            type: FormTypes.inputNumber,
-            defaultValue: '',
-            placeholder: '请输入${title}',
+            dataIndex: 'inventory',
           },
           {
             title: '仓库名称',
-            key: 'depotId',
-            width: '10%',
-            type: FormTypes.slot,
-            slotName: 'depotId',
-            defaultValue: '',
-            placeholder: '请选择${title}',
+            dataIndex: 'depotId',
+            scopedSlots: { customRender: 'depotId' } 
           },
          
         ],
@@ -782,14 +732,9 @@ export default {
     document.getElementById(this.prefixNo).removeEventListener('keydown', this.handleOkKey)
   },
   methods: {
-    initScroll() {
-      if (this.isMobile()) {
-        this.meTable.scroll.y = ''
-      } else {
-        let basicWidth = 150
-        this.meTable.scroll.x = document.documentElement.clientWidth - basicWidth - 64
-        this.meTable.scroll.y = '100%'
-      }
+    formatDepotName(id){
+      const target = this.depotList.find(item => item.value == id)
+      return target ? target.title : ''
     },
     // 快捷键
     handleOkKey(e) {
@@ -885,9 +830,6 @@ export default {
         this.switchDisabled = false
         this.requestDepotTableData(this.url.depotWithStock, { mId: 0 }, this.depotTable)
       }
-      this.$nextTick(() => {
-        this.initScroll()
-      })
     },
     requestMeTableData(){
       const params = {