Bladeren bron

bug修复

zhangdan 3 jaren geleden
bovenliggende
commit
cb16a29e71
1 gewijzigde bestanden met toevoegingen van 26 en 18 verwijderingen
  1. 26 18
      src/views/numsGoodsShelves/recallManagement/list.vue

+ 26 - 18
src/views/numsGoodsShelves/recallManagement/list.vue

@@ -23,17 +23,17 @@
             <template v-if="advanced">
               <a-col :md="6" :sm="24">
                 <a-form-item label="产品编码">
-                  <a-input allowClear placeholder="请输入产品编码" v-model.tirm="queryParam.code"/>
+                  <a-input allowClear placeholder="请输入产品编码" v-model.tirm="queryParam.productCode"/>
                 </a-form-item>
               </a-col>
               <a-col :md="6" :sm="24">
                 <a-form-item label="产品名称">
-                  <a-input allowClear placeholder="请输入产品名称" v-model.tirm="queryParam.name"/>
+                  <a-input allowClear placeholder="请输入产品名称" v-model.tirm="queryParam.productName"/>
                 </a-form-item>
               </a-col>
             </template>
             <a-col :md="6" :sm="24">
-              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="outboundOrderList-refresh" >查询</a-button>
+              <a-button type="primary" @click="getSumByType" :disabled="disabled" id="outboundOrderList-refresh" >查询</a-button>
               <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="outboundOrderList-reset">重置</a-button>
               <a @click="advanced=!advanced" style="margin-left: 5px" v-if="activeKey==0">
                 {{ advanced ? '收起' : '展开' }}
@@ -43,7 +43,7 @@
           </a-row>
         </a-form>
       </div>
-      <a-tabs type="card" v-model="queryParam.billState" @change="tabChange" class="replenishmentManagementList-tabs ">
+      <a-tabs type="card" v-model="queryParam.billState" @change="tabChange" class="replenishmentManagementList-tabs">
         <a-tab-pane v-for="item in tabsList" :key="item.code">
           <p slot="tab">{{ item.name }}<span v-if="item.countNum&&item.code=='WAIT_CONFIRM'" style="color:red">({{ item.countNum }})</span></p>
         </a-tab-pane>
@@ -57,10 +57,10 @@
         :columns="columns"
         :data="loadData"
         :scroll="{ y:tableHeight }"
-        @expand="expand"
-        :defaultLoadData="true"
+        :expandedRowKeys="expandedRowKeys"
+        @expand="expandFun"
         :expandRowByClick="true"
-        :defaultExpandAllRows="true"
+        :defaultLoadData="false"
         bordered>
         <template slot="action" slot-scope="text, record">
           <a-button
@@ -82,7 +82,7 @@
           class="inner-table"
           slot-scope="record,index"
           slot="expandedRowRender"
-          :rowKey="(rec) => rec.id"
+          :rowKey="(record) => record.id"
           :columns="innerColumns"
           :data-source="innerData[index].innerData"
           :pagination="false"
@@ -117,6 +117,7 @@ export default {
       currentData: null,
       activeKey: 0, // 默认的tab
       tabsList: [],
+      expandedRowKeys: [],
       time: [
         getDate.getCurrMonthDays().starttime,
         getDate.getCurrMonthDays().endtime
@@ -151,10 +152,9 @@ export default {
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
+        this.expandedRowKeys = []
         const params = this.queryParam
-        if (params.billState == 'ALL') {
-          params.billState = ''
-        }
+        params.billState = this.queryParam.billState == 'ALL' ? '' : this.queryParam.billState
         return shelfRecallList(Object.assign(parameter, params)).then(res => {
           let data
           if (res.status == 200) {
@@ -190,13 +190,17 @@ export default {
     // 切换tab
     tabChange (key) {
       console.log(key)
-      this.activeKey = key
-      this.queryParam.billState = key
-      this.$refs.table.refresh(true)
+      this.expandedRowKeys = []
+      setTimeout(() => {
+        this.queryParam.billState = key
+        this.$refs.table.refresh(true)
+      }, 100)
     },
     // 获取各类型下的数量
     getSumByType () {
-      shelfRecallStateCount({}).then(res => {
+      const params = JSON.parse(JSON.stringify(this.queryParam))
+      params.billState = this.queryParam.billState == 'ALL' ? '' : this.queryParam.billState
+      shelfRecallStateCount(params).then(res => {
         if (res.status == 200) {
           this.tabsList = [
             { code: 'ALL', name: '全部', countNum: 0 }, { code: 'WAIT_CONFIRM', name: '待退库', countNum: 0 }, { code: 'FINISH', name: '已完成', countNum: 0 }, { code: 'CANCEL', name: '已取消', countNum: 0 }
@@ -205,14 +209,18 @@ export default {
           this.tabsList[1].countNum = res.data.WAIT_CONFIRM || 0
           this.tabsList[2].countNum = res.data.FINISH || 0
           this.tabsList[3].countNum = res.data.CANCEL || 0
-          this.$refs.table.refresh()
+          this.$refs.table.refresh(true)
         }
       })
     },
     // 点击行或图标触发接口
-    expand (expanded, record) {
+    expandFun (expanded, record) {
       if (expanded) {
+        this.expandedRowKeys.push(record.id)
         this.getinnerData(record) // 获取表格内部数据
+      } else {
+        const i = this.expandedRowKeys.findIndex(item => item == record.id)
+        this.expandedRowKeys.splice(i, 1)
       }
     },
     // 获取子表格数据
@@ -244,7 +252,7 @@ export default {
         billState: 'ALL'
       }
       this.$refs.shelfList.resetForm()
-      this.$refs.table.refresh(true)
+      this.getSumByType()
     },
     // 退库
     handleRecall (row) {