Browse Source

bug修复

chenrui 3 years ago
parent
commit
3bf829e80d
1 changed files with 39 additions and 12 deletions
  1. 39 12
      src/views/purchasingManagement/purchaseOrder/warehousing.vue

+ 39 - 12
src/views/purchasingManagement/purchaseOrder/warehousing.vue

@@ -26,7 +26,7 @@
           :data="loadData"
           :tableId="item.receivingBillSn"
           :index="bindex"
-          :scroll="{ x: 1630 }"
+          :scroll="{ x: 1280 }"
           bordered>
           <!-- 采购数量 -->
           <template slot="origqty" slot-scope="text, record, index">
@@ -36,6 +36,7 @@
           <!-- 仓库仓位 -->
           <template slot="warehousePosition" slot-scope="text, record, index">
             <a-cascader
+              size="small"
               @change="e => changeWarehouseCascade(e, record, index, bindex)"
               v-model="record.warehouseCascade"
               :disabled="!(item.auditState=='WAIT_PUT_WAREHOUSE' || item.auditState == 'PUT_WAREHOUSE_AUDIT_REJECT')"
@@ -86,19 +87,20 @@ export default {
       },
       disabled: false, //  查询、重置按钮是否可操作
       warehouseCascadeData: [], //  仓库仓位
+      defaultWarehouseCascade: [], //  默认仓库仓位
       // 表头
       columns: [
-        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
+        { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '采购单价', dataIndex: 'discountedPrice', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '采购数量', dataIndex: 'qty', width: 100, align: 'center', scopedSlots: { customRender: 'origqty' } },
-        { title: '本次发货数量', dataIndex: 'shippedQty', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '本次发货金额', dataIndex: 'discountedAmount', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') }, fixed: 'right' },
-        { title: '本次入库数量', dataIndex: 'putQty', width: 120, align: 'center', customRender: function (text) { return text || '--' }, fixed: 'right' },
-        { title: '仓库仓位', scopedSlots: { customRender: 'warehousePosition' }, width: 250, align: 'center', fixed: 'right' }
+        { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '采购单价', dataIndex: 'discountedPrice', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '采购数量', dataIndex: 'qty', width: 80, align: 'center', scopedSlots: { customRender: 'origqty' } },
+        { title: '本次发货数量', dataIndex: 'shippedQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '本次发货金额', dataIndex: 'discountedAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') }, fixed: 'right' },
+        { title: '本次入库数量', dataIndex: 'putQty', width: 100, align: 'center', customRender: function (text) { return text || '--' }, fixed: 'right' },
+        { title: '仓库仓位', scopedSlots: { customRender: 'warehousePosition' }, width: 150, align: 'center', fixed: 'right' }
       ],
       chooseLoadData: [],
       // 加载数据方法 必须为 Promise 对象
@@ -118,7 +120,14 @@ export default {
               data.list[i].warehouseLocationSnBackups = warehouseLocationSn
               data.list[i].warehouseCascade = [warehouseSn, warehouseLocationSn]
             } else {
-              data.list[i].warehouseCascade = undefined
+              //  设置默认仓库
+              if (this.defaultWarehouseCascade.length > 0) {
+                data.list[i].warehouseCascade = this.defaultWarehouseCascade
+                data.list[i].warehouseSn = this.defaultWarehouseCascade[0]
+                data.list[i].warehouseLocationSn = this.defaultWarehouseCascade[1]
+              } else {
+                data.list[i].warehouseCascade = undefined
+              }
             }
           }
           this.disabled = false
@@ -191,8 +200,26 @@ export default {
     },
     //  仓库仓位  级联  列表
     getWarehouseCascade () {
+      const _this = this
       warehouseCascadeList({}).then(res => {
         if (res.status == 200) {
+          res.data.filter(item => {
+            // 过滤默认仓库
+            if (item.defaultFlag == 1 && item.wasteFlag == 0) { //  defaultFlag为1,且不是废品仓
+              _this.defaultWarehouseCascade[0] = item.warehouseSn
+              // 过滤默认仓位
+              item.warehouseLocationList.filter(subItem => {
+                if (subItem.defaultFlag == 1 && subItem.wasteFlag == 0) {
+                  _this.defaultWarehouseCascade[1] = subItem.warehouseLocationSn
+                  if (_this.detail && _this.detail.length > 0) {
+                    _this.detail.map((k, i) => {
+                      _this.$refs['table-' + i][0].refresh(true)
+                    })
+                  }
+                }
+              })
+            }
+          })
           res.data.map(item => {
             item.sn = item.warehouseSn
             if (item.warehouseLocationList) {