chenrui před 4 roky
rodič
revize
3a39044b27

+ 2 - 1
src/views/allocationManagement/chainTransferIn/edit.vue

@@ -49,6 +49,7 @@
                   @change="changeProductType"
                   change-on-select
                   v-model="productType"
+				  expand-trigger="hover"
                   :options="productTypeList"
                   :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
                   id="chainTransferInEdit-productType"
@@ -78,6 +79,7 @@
           <a-cascader
             @change="e => changeWarehouseCascade(e, record, index)"
             v-model="record.warehouseCascade"
+			expand-trigger="hover"
             :options="warehouseCascadeData"
             :fieldNames="{ label: 'name', value: 'id', children: 'warehouseLocationList' }"
             id="chainTransferInEdit-warehouseCascade"
@@ -121,7 +123,6 @@ export default {
       productTypeList: [], //  产品分类  下拉数据
       productType: [],
       warehouseCascadeData: [], //  仓库仓位
-      warehouseCascade: [], //  仓库仓位
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },

+ 1 - 0
src/views/allocationManagement/chainTransferOut/edit.vue

@@ -56,6 +56,7 @@
                         @change="changeProductType"
                         change-on-select
                         v-model="productType"
+						expand-trigger="hover"
                         :options="productTypeList"
                         :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
                         id="chainTransferOutEdit-productType"

+ 1 - 0
src/views/allocationManagement/storeTransferOut/edit.vue

@@ -44,6 +44,7 @@
                         @change="changeProductType"
                         change-on-select
                         v-model="productType"
+						expand-trigger="hover"
                         :options="productTypeList"
                         :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
                         id="storeTransferOutEdit-productType"

+ 1 - 0
src/views/allocationManagement/warehouseAllocation/edit.vue

@@ -57,6 +57,7 @@
                         @change="changeProductType"
                         change-on-select
                         v-model="productType"
+						expand-trigger="hover"
                         :options="productTypeList"
                         :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
                         id="warehouseAllocationEdit-productType"

+ 93 - 143
src/views/bulkManagement/bulkWarehousingOrder/edit.vue

@@ -67,6 +67,7 @@
                         @change="changeProductType"
                         change-on-select
                         v-model="productType"
+                        expand-trigger="hover"
                         :options="productTypeList"
                         :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
                         id="productInfoList-productType"
@@ -115,22 +116,17 @@
                   placeholder="请输入"
                   style="width: 100%;" />
               </template>
-              <!-- 仓库 -->
-              <template slot="warehouseSn" slot-scope="text, record, index">
-                <a-select
-                  id="bulkWarehousingOrderEdit-warehouseSn"
-                  placeholder="请选择"
-                  @change="warehouseChange(record, index)"
-                  v-model="record.warehouseSn"
-                  style="width: 100%;">
-                  <a-select-option v-for="item in warehouseList" :key="item.warehouseSn" :value="item.warehouseSn">{{ item.name }}</a-select-option>
-                </a-select>
-              </template>
-              <!-- 仓位 -->
-              <template slot="warehouseLocationSn" slot-scope="text, record, index">
-                <a-select id="bulkWarehousingOrderEdit-warehouseLocationSn" placeholder="请选择" v-model="record.warehouseLocationSn" style="width: 100%;">
-                  <a-select-option v-for="item in warehouseLocList[index]" :key="item.warehouseLocationSn" :value="item.warehouseLocationSn">{{ item.name }}</a-select-option>
-                </a-select>
+              <!-- 仓库仓位 -->
+              <template slot="warehouse" slot-scope="text, record, index">
+                <a-cascader
+                  @change="e => changeWarehouseCascade(e, record, index, 'dealerProduct')"
+                  v-model="record.warehouseCascade"
+                  expand-trigger="hover"
+                  :options="warehouseCascadeData"
+                  :fieldNames="{ label: 'name', value: 'id', children: 'warehouseLocationList' }"
+                  id="bulkWarehousingOrderEdit-warehouseCascade"
+                  placeholder="请选择仓库仓位"
+                  style="width: 100%;" />
               </template>
               <!-- 操作 -->
               <template slot="action" slot-scope="text, record">
@@ -190,22 +186,17 @@
                   @blur="e => putQtyBlur(e.target.value, record)"
                   style="width: 100%;" />
               </template>
-              <!-- 仓库 -->
-              <template slot="warehouseSn" slot-scope="text, record, index">
-                <a-select
-                  id="bulkWarehousingOrderEdit-choose-warehouseSn"
-                  placeholder="请选择"
-                  @change="chooseWarehouseChange(record, index)"
-                  v-model="record.warehouseSn"
-                  style="width: 100%;">
-                  <a-select-option v-for="item in chooseWarehouseList" :key="item.warehouseSn" :value="item.warehouseSn">{{ item.name }}</a-select-option>
-                </a-select>
-              </template>
-              <!-- 仓位 -->
-              <template slot="warehouseLocationSn" slot-scope="text, record, index">
-                <a-select id="bulkWarehousingOrderEdit-choose-warehouseLocationSn" placeholder="请选择" @change="chooseWarehouseLocChange(record)" v-model="record.warehouseLocationSn" style="width: 100%;">
-                  <a-select-option v-for="item in chooseWarehouseLocList[index]" :key="item.warehouseLocationSn" :value="item.warehouseLocationSn">{{ item.name }}</a-select-option>
-                </a-select>
+              <!-- 仓库仓位 -->
+              <template slot="warehouse" slot-scope="text, record, index">
+                <a-cascader
+                  @change="e => changeWarehouseCascade(e, record, index, 'sparePartsPurDetail')"
+                  v-model="record.warehouseCascade"
+                  expand-trigger="hover"
+                  :options="warehouseCascadeData"
+                  :fieldNames="{ label: 'name', value: 'id', children: 'warehouseLocationList' }"
+                  id="bulkWarehousingOrderEdit-choose-warehouseCascade"
+                  placeholder="请选择仓库仓位"
+                  style="width: 100%;" />
               </template>
               <!-- 操作 -->
               <template slot="action" slot-scope="text, record">
@@ -240,7 +231,7 @@ import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
 import { dealerProductTypeList } from '@/api/dealerProductType'
 import { sparePartsPurDetail, sparePartsPurDetailList, sparePartsPurDetailCount, sparePartsPurDetailSave, sparePartsPurDetailDel, sparePartsPurSubmit } from '@/api/sparePartsPur'
 import { dealerProductList } from '@/api/dealerProduct'
-import { warehouseAllList, warehouseLocAllList } from '@/api/warehouse'
+import { warehouseCascadeList } from '@/api/warehouse'
 export default {
   components: { STable, VSelect, basicInfoModal },
   data () {
@@ -255,6 +246,7 @@ export default {
       productBrandList: [], //  产品品牌  下拉数据
       productTypeList: [], //  产品分类  下拉数据
       productType: [],
+      warehouseCascadeData: [], //  仓库仓位
       disabled: false, //  查询、重置按钮是否可操作
       // 表头
       columns: [
@@ -266,8 +258,7 @@ export default {
         { title: '单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '成本价', scopedSlots: { customRender: 'putCost' }, width: 150, align: 'center' },
         { title: '数量', scopedSlots: { customRender: 'putQty' }, width: 150, align: 'center' },
-        { title: '仓库', scopedSlots: { customRender: 'warehouseSn' }, width: 200, align: 'center' },
-        { title: '仓位', scopedSlots: { customRender: 'warehouseLocationSn' }, width: 200, align: 'center' },
+        { title: '仓库仓位', scopedSlots: { customRender: 'warehouse' }, width: 200, align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
       ],
       loadData: [],
@@ -291,8 +282,7 @@ export default {
         { title: '成本价', scopedSlots: { customRender: 'putCost' }, width: 150, align: 'center' },
         { title: '数量', scopedSlots: { customRender: 'putQty' }, width: 150, align: 'center' },
         { title: '成本小计', dataIndex: 'costSubtotal', width: 100, align: 'center' },
-        { title: '仓库', scopedSlots: { customRender: 'warehouseSn' }, width: 200, align: 'center' },
-        { title: '仓位', scopedSlots: { customRender: 'warehouseLocationSn' }, width: 200, align: 'center' },
+        { title: '仓库仓位', scopedSlots: { customRender: 'warehouse' }, width: 200, align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
       ],
       chooseLoadData: [],
@@ -308,6 +298,7 @@ export default {
       openModal: false, // 选择基本信息弹框是否显示
       warehouseList: [], //  仓库  下拉数据
       warehouseLocList: {}, //  仓位  下拉数据
+      defaultWarehouseCascade: [], //  默认仓库仓位
       chooseWarehouseList: [], //  已选产品 仓库  下拉数据
       chooseWarehouseLocList: {}, //  已选产品 仓位  下拉数据
       basicInfoData: null, //  基本信息
@@ -461,111 +452,42 @@ export default {
     handleBack () {
       this.$router.push({ path: '/bulkManagement/bulkWarehousingOrder/list' })
     },
-    // 仓库下拉数据
-    getWarehouseList (type) {
-      warehouseAllList({}).then(res => {
-        if (res.status == 200) {
-          if (type == 'dealerProduct') { //  全部产品
-            this.warehouseList = res.data
-            const defaultFlagInd = this.warehouseList.findIndex(item => (item.defaultFlag == 1 && item.wasteFlag == 0))
-            this.loadData.map((item, index) => {
-              // 全部产品中,仓库默认值为默认仓库,则仓位必然也为默认仓位,因此可批量设置默认仓位的值 all
-              // 解决更改后不实时渲染问题
-              this.$set(item, 'warehouseSn', this.warehouseList[defaultFlagInd].warehouseSn)
-              this.$set(item, 'nowWarehouseSn', this.warehouseList[defaultFlagInd].warehouseSn) // 所选仓库sn(为记录上一所选仓库sn)
-              // 每个仓库对应仓位应是独立的
-              this.getWarehouseLocList(this.warehouseList[defaultFlagInd].warehouseSn, index, type, 'all')
-            })
-          } else if (type == 'sparePartsPurDetail') { //  已选产品
-            this.chooseWarehouseList = res.data
-            this.chooseLoadData.map((item, index) => {
-              // 每个仓库对应仓位应是独立的
-              this.getWarehouseLocList(item.warehouseSn, index, type)
-            })
-          }
-        } else {
-          this.warehouseList = []
-          this.chooseWarehouseList = []
-          this.loadData.map(item => {
-            this.$set(item, 'warehouseSn', undefined)
-            this.$set(item, 'nowWarehouseSn', undefined)
-            this.$set(item, 'warehouseLocationSn', undefined)
-          })
-        }
-      })
-    },
-    // 仓位下拉数据
-    getWarehouseLocList (warehouseSn, ind, type, isAll, isChange) {
-      // warehouseSn仓库sn、ind当前数据下标、type为全部产品或已选产品、isAll为是否设置全部产品内全部仓位的值为默认仓位、isChange为仓库是否change
-      warehouseLocAllList({ warehouseSn: warehouseSn }).then(res => {
+    // 合计
+    getDetailCount (params) {
+      sparePartsPurDetailCount(params).then(res => {
         if (res.status == 200) {
-          //  处理 全部产品和已选产品以及是否有默认仓位下的不同情况
-          this.defaultLocationSet(ind, type, res.data, isAll, isChange)
+          this.productTotal = res.data
         } else {
-          this.$set(this.warehouseLocList, ind, [])
-          this.$set(this.chooseWarehouseLocList, ind, [])
-          this.loadData.map(item => {
-            this.$set(item, 'warehouseLocationSn', undefined)
-          })
-          this.chooseLoadData.map(item => {
-            this.$set(item, 'warehouseLocationSn', undefined)
-          })
+          this.productTotal = null
         }
       })
     },
-    defaultLocationSet (ind, type, data, isAll, isChange) {
-      let warehouseLocList
+    changeWarehouseCascade (val, opt, ind, type) {
       let loadData
       if (type == 'dealerProduct') { //  全部产品
-        warehouseLocList = this.warehouseLocList
-        loadData = this.loadData
+        loadData = this.loadData[ind]
       } else if (type == 'sparePartsPurDetail') { //  已选产品
-        warehouseLocList = this.chooseWarehouseLocList
-        loadData = this.chooseLoadData
+        loadData = this.chooseLoadData[ind]
       }
-      this.$set(warehouseLocList, ind, data)
-      const defaultFlagInd = warehouseLocList[ind].findIndex(item => (item.defaultFlag == 1 && item.wasteFlag == 0))
-      //  有默认仓位则默认选择默认仓位,无默认仓位则默认选择第一个仓位
-      if (defaultFlagInd > -1) { //  有默认仓位
-        if (isAll == 'all') { //  批量设置默认仓位的值为默认仓位
-          loadData.map(item => {
-            this.$set(item, 'warehouseLocationSn', warehouseLocList[ind][defaultFlagInd].warehouseLocationSn)
-          })
+      if (val.length < 2) {
+        this.$message.warning('当前仓库无仓位,请选择其他仓库')
+        const warehouseSnBackups = loadData.warehouseSnBackups || undefined
+        const warehouseLocationSnBackups = loadData.warehouseLocationSnBackups || undefined
+        loadData.warehouseSn = warehouseSnBackups
+        loadData.warehouseLocationSn = warehouseLocationSnBackups
+        if (warehouseSnBackups || warehouseLocationSnBackups) {
+          loadData.warehouseCascade = [warehouseSnBackups, warehouseLocationSnBackups]
         } else {
-          this.$set(loadData[ind], 'warehouseLocationSn', warehouseLocList[ind][defaultFlagInd].warehouseLocationSn)
+          loadData.warehouseCascade = undefined
         }
-        loadData[ind].nowWarehouseSn = loadData[ind].warehouseSn
-      } else { //  无默认仓位
-        if (warehouseLocList[ind].length > 0) {
-          loadData[ind].warehouseLocationSn = warehouseLocList[ind][0].warehouseLocationSn
-          loadData[ind].nowWarehouseSn = loadData[ind].warehouseSn
-        } else {
-          this.$message.warning('当前仓库无仓位,请选择其他仓库')
-          if (loadData[ind].warehouseSn != loadData[ind].nowWarehouseSn) { //  避免默认仓库下没有默认仓位导致死循环问题
-            loadData[ind].warehouseSn = loadData[ind].nowWarehouseSn
-            this.getWarehouseLocList(loadData[ind].warehouseSn, ind, type)
-          }
+      } else {
+        loadData.warehouseSn = val[0] ? val[0] : ''
+        loadData.warehouseLocationSn = val[1] ? val[1] : ''
+        if (type == 'sparePartsPurDetail') { //  已选产品
+          loadData = this.chooseLoadData[ind]
+          this.handleAdd(loadData, 'edit')
         }
       }
-      //  仓库更改时,应与仓位一齐变更
-      if (isChange == 'change' && type == 'sparePartsPurDetail' && warehouseLocList[ind].length > 0) { // 设置已选产品仓库变更时更新数据
-        this.handleAdd(loadData[ind], 'edit')
-      }
-    },
-    // 合计
-    getDetailCount (params) {
-      sparePartsPurDetailCount(params).then(res => {
-        if (res.status == 200) {
-          this.productTotal = res.data
-        } else {
-          this.productTotal = null
-        }
-      })
-    },
-    // 仓库change
-    warehouseChange (record, index) {
-      this.loadData[index].warehouseLocationSn = undefined
-      this.getWarehouseLocList(this.loadData[index].warehouseSn, index, 'dealerProduct')
     },
     // 已选产品 成本价  blur
     putCostBlur (val, record) {
@@ -580,16 +502,6 @@ export default {
         this.handleAdd(record, 'edit')
       }
     },
-    // 已选产品 仓库  change
-    chooseWarehouseChange (record, index) {
-      this.chooseLoadData[index].warehouseLocationSn = undefined
-      //  仓库仓位为联动更改,因此应在设置仓位后再进行更改
-      this.getWarehouseLocList(this.chooseLoadData[index].warehouseSn, index, 'sparePartsPurDetail', undefined, 'change')
-    },
-    // 已选产品 仓位  change
-    chooseWarehouseLocChange (record) {
-      this.handleAdd(record, 'edit')
-    },
     //  产品分类  change
     changeProductType (val, opt) {
       this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
@@ -610,9 +522,15 @@ export default {
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
+            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.loadData = data.list
-          this.getWarehouseList('dealerProduct')
           this.disabled = false
         } else {
           this.paginationProps.total = 0
@@ -639,11 +557,19 @@ export default {
             data.list[i].no = no + i + 1
             data.list[i].putCostBackups = data.list[i].putCost
             data.list[i].putQtyBackups = data.list[i].putQty
+            const warehouseSn = data.list[i].warehouseSn || undefined
+            const warehouseLocationSn = data.list[i].warehouseLocationSn || undefined
+            if (warehouseSn || warehouseLocationSn) {
+              data.list[i].warehouseSnBackups = warehouseSn
+              data.list[i].warehouseLocationSnBackups = warehouseLocationSn
+              data.list[i].warehouseCascade = [warehouseSn, warehouseLocationSn]
+            } else {
+              data.list[i].warehouseCascade = undefined
+            }
             // 成本小计  由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
             data.list[i].costSubtotal = getOperationalPrecision(data.list[i].putCost, data.list[i].putQty)
           }
           this.chooseLoadData = data.list
-          this.getWarehouseList('sparePartsPurDetail')
         } else {
           this.choosePaginationProps.total = 0
           this.choosePaginationProps.current = 1
@@ -651,6 +577,31 @@ export default {
         }
       })
     },
+    //  仓库仓位  级联  列表
+    getWarehouseCascade () {
+      const _this = this
+      warehouseCascadeList({}).then(res => {
+        if (res.status == 200) {
+          this.warehouseCascadeData = res.data
+          res.data.filter(item => {
+            // 过滤默认仓库
+            if (item.defaultFlag == 1 && item.wasteFlag == 0) { //  defaultFlag为1,且不是废品仓
+              _this.defaultWarehouseCascade[0] = item.id
+              // 过滤默认仓位
+              item.warehouseLocationList.filter(subItem => {
+                if (subItem.defaultFlag == 1 && subItem.wasteFlag == 0) {
+                  _this.defaultWarehouseCascade[1] = subItem.id
+                  _this.getDealerProductList(1)
+                  _this.getChooseDealerProductList(1)
+                }
+              })
+            }
+          })
+        } else {
+          this.warehouseCascadeData = []
+        }
+      })
+    },
     //  产品品牌  列表
     getProductBrand () {
       // sysFlag传0,表示只查自建产品
@@ -681,9 +632,8 @@ export default {
   beforeRouteEnter (to, from, next) {
     next(vm => {
       vm.openModal = false
+      vm.getWarehouseCascade()
       vm.getDetail()
-      vm.getDealerProductList()
-      vm.getChooseDealerProductList()
       vm.getProductBrand()
       vm.getProductType()
     })

+ 1 - 0
src/views/common/productType.js

@@ -5,6 +5,7 @@ const ProductType = {
         @change="handleChange"
         change-on-select
         :value="value"
+		expand-trigger="hover"
         :options="productTypeList"
         :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
         :id="id"

+ 1 - 0
src/views/financialManagement/expenseManagement/edit.vue

@@ -22,6 +22,7 @@
             @change="changeCostType"
             change-on-select
             v-model="form.costType"
+			expand-trigger="hover"
             :options="costTypeList"
             :fieldNames="{ label: 'name', value: 'costTypeSn', children: 'children' }"
             id="productInfoList-costType"

+ 1 - 0
src/views/financialManagement/expenseManagement/list.vue

@@ -20,6 +20,7 @@
                 @change="changeCostType"
                 change-on-select
                 v-model="costType"
+				expand-trigger="hover"
                 :options="costTypeList"
                 :fieldNames="{ label: 'name', value: 'costTypeSn', children: 'children' }"
                 id="productInfoList-costType"

+ 1 - 1
src/views/inventoryManagement/inventoryChecking/selfDisk.vue

@@ -37,7 +37,7 @@
                     </a-form-item>
                   </a-col>
                   <a-col :md="6" :sm="24">
-                    <a-form-item label="产品类">
+                    <a-form-item label="产品类">
                       <a-cascader :options="typeData" id="selfDisk-state" placeholder="请选择产品类别" allowClear v-model="queryParam.brand" />
                     </a-form-item>
                   </a-col>

+ 1 - 0
src/views/inventoryManagement/inventoryQuery/list.vue

@@ -38,6 +38,7 @@
               <a-form-item label="产品分类">
                 <a-cascader
                   :options="typeData"
+				  expand-trigger="hover"
                   :field-names="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
                   placeholder="请选择产品分类"
                   allowClear

+ 1 - 0
src/views/productManagement/productInfo/edit.vue

@@ -73,6 +73,7 @@
           <a-cascader
             :disabled="!!$route.params.id"
             @change="changeProductType"
+			expand-trigger="hover"
             :options="productTypeList"
             :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
             id="productInfoEdit-productType"

+ 1 - 0
src/views/productManagement/productInfo/list.vue

@@ -40,6 +40,7 @@
                   @change="changeProductType"
                   change-on-select
                   v-model="productType"
+				  expand-trigger="hover"
                   :options="productTypeList"
                   :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
                   id="productInfoList-productType"

+ 1 - 0
src/views/productManagement/productInfoJg/list.vue

@@ -40,6 +40,7 @@
                   @change="changeProductType"
                   change-on-select
                   v-model="productType"
+				  expand-trigger="hover"
                   :options="productTypeList"
                   :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
                   id="productInfoList-productType"