chenrui 2 rokov pred
rodič
commit
e5d1a12743

+ 118 - 47
src/views/allocationManagement/storeTransferOut/detail.vue

@@ -1,34 +1,48 @@
 <template>
   <div class="storeTransferOutDetail-wrap">
     <a-spin :spinning="spinning" tip="Loading...">
-      <a-page-header :ghost="false" :backIcon="false" class="storeTransferOutDetail-back" :style="{ padding: !outBizSn ? '16px 24px' : '0px 24px' }" >
+      <a-page-header :ghost="false" :backIcon="false" class="storeTransferOutDetail-back" :style="{ padding: !outBizSn ? '16px 24px' : '0px 24px' }">
         <!-- 自定义的二级文字标题 -->
         <template slot="subTitle" v-if="!outBizSn">
-          <a id="storeTransferOutDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+          <a id="storeTransferOutDetail-back-btn" href="javascript:;" @click="handleBack">
+            <a-icon type="left" />
+            返回列表
+          </a>
           <a-button
-            v-if="isEdit&&$hasPermissions('B_storeCallOutEdit')"
+            v-if="isEdit && $hasPermissions('B_storeCallOutEdit')"
             type="primary"
             size="small"
             style="background-color: #1890ff;margin-left: 20px;border: #1890ff;"
             id="storeTransferOutDetail-edit-btn"
-            @click.stop="handleEdit">编辑</a-button>
+            @click.stop="handleEdit"
+          >
+            编辑
+          </a-button>
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <template slot="extra" v-if="outBizSn ? $hasPermissions('B_outboundOrderDetail') : $hasPermissions('B_storeCallOutPrint')">
           <a-checkbox key="4" v-if="$hasPermissions('M_ShowAllCost')" v-model="printCostChecked">打印成本</a-checkbox>
-          <Print :disabled="localDataSource.length==0" :showExport="false" @handlePrint="handlePrint"></Print>
+          <Print :disabled="localDataSource.length == 0" :showExport="false" @handlePrint="handlePrint"></Print>
         </template>
       </a-page-header>
       <a-card size="small" :bordered="false" class="storeTransferOutDetail-cont" v-if="basicInfoData">
         <a-collapse :activeKey="['1']">
           <a-collapse-panel key="1" header="基础信息">
             <a-descriptions :column="3">
-              <a-descriptions-item label="调往对象名称">{{ (basicInfoData.putPersonType=='EMPLOYEE'?basicInfoData.putPersonName:(basicInfoData.customerNameCurrent==basicInfoData.putPersonName?basicInfoData.customerNameCurrent:basicInfoData.customerNameCurrent+'('+basicInfoData.putPersonName+')')) || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="店内调出单号">{{ (basicInfoData.storeCallOutNo) || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="业务状态">{{ (basicInfoData.stateDictValue) || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="财务状态">{{ (basicInfoData.settleStateDictValue) || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="调拨类型">{{ (basicInfoData.callOutTypeName) || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="备注">{{ (basicInfoData.remark) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="调往对象名称">
+                {{
+                  (basicInfoData.putPersonType == 'EMPLOYEE'
+                    ? basicInfoData.putPersonName
+                    : basicInfoData.customerNameCurrent == basicInfoData.putPersonName
+                      ? basicInfoData.customerNameCurrent
+                      : basicInfoData.customerNameCurrent + '(' + basicInfoData.putPersonName + ')') || '--'
+                }}
+              </a-descriptions-item>
+              <a-descriptions-item label="店内调出单号">{{ basicInfoData.storeCallOutNo || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="业务状态">{{ basicInfoData.stateDictValue || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="财务状态">{{ basicInfoData.settleStateDictValue || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="调拨类型">{{ basicInfoData.callOutTypeName || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="备注">{{ basicInfoData.remark || '--' }}</a-descriptions-item>
             </a-descriptions>
           </a-collapse-panel>
         </a-collapse>
@@ -37,10 +51,13 @@
         <!-- 总计 -->
         <a-alert type="info" style="margin-bottom:10px">
           <div slot="message">
-            总款数 <strong>{{ (productTotal&&(productTotal.productTotalCategory || productTotal.productTotalCategory==0)) ? productTotal.productTotalCategory : '--' }}</strong> ,
-            总数量 <strong>{{ (productTotal&&(productTotal.productTotalQty || productTotal.productTotalQty==0)) ? productTotal.productTotalQty : '--' }}</strong>
+            总款数
+            <strong>{{ productTotal && (productTotal.productTotalCategory || productTotal.productTotalCategory == 0) ? productTotal.productTotalCategory : '--' }}</strong>
+            , 总数量
+            <strong>{{ productTotal && (productTotal.productTotalQty || productTotal.productTotalQty == 0) ? productTotal.productTotalQty : '--' }}</strong>
             <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">
-              ,总成本 <strong>{{ (productTotal&&(productTotal.productTotalCost || productTotal.productTotalCost==0)) ? toThousands(productTotal.productTotalCost, 2) : '--' }}</strong>
+              ,总成本
+              <strong>{{ productTotal && (productTotal.productTotalCost || productTotal.productTotalCost == 0) ? toThousands(productTotal.productTotalCost, 2) : '--' }}</strong>
             </div>
           </div>
         </a-alert>
@@ -49,7 +66,7 @@
           class="sTable"
           ref="table"
           size="small"
-          :rowKey="(record) => record.id"
+          :rowKey="record => record.id"
           :columns="columns"
           :data="loadData"
           :defaultLoadData="false"
@@ -59,7 +76,8 @@
               <template slot="title">
                 系统中不同批次的产品,成本价可能不同,此值是按照实际出库批次的成本计算得到。
               </template>
-              <span style="margin-right: 5px;">实际总成本</span> <a-icon type="question-circle" />
+              <span style="margin-right: 5px;">实际总成本</span>
+              <a-icon type="question-circle" />
             </a-tooltip>
           </div>
           <!-- 操作 -->
@@ -68,7 +86,7 @@
           </template>
         </s-table>
         <!-- 出入库明细 -->
-        <outInDetialModal ref="outInDetialModal" outBizType="SHOP_CALL_OUT" :openModal="showOutInModal" @close="showOutInModal=false"></outInDetialModal>
+        <outInDetialModal ref="outInDetialModal" outBizType="SHOP_CALL_OUT" :openModal="showOutInModal" @close="showOutInModal = false"></outInDetialModal>
       </a-card>
     </a-spin>
   </div>
@@ -87,7 +105,8 @@ export default {
   components: { STable, VSelect, Print, outInDetialModal },
   mixins: [commonMixin],
   props: {
-    outBizSn: { //  有值则为弹框,无值则为页面
+    outBizSn: {
+      //  有值则为弹框,无值则为页面
       type: [Number, String],
       default: ''
     }
@@ -123,24 +142,84 @@ export default {
   },
   computed: {
     isEdit () {
-      return ((this.basicInfoData && this.basicInfoData.state == 'WAIT_SUBMIT') || (this.basicInfoData && this.basicInfoData.state == 'WAIT_AUDIT')) && this.$hasPermissions('B_storeCallOutEdit')
+      return (
+        ((this.basicInfoData && this.basicInfoData.state == 'WAIT_SUBMIT') || (this.basicInfoData && this.basicInfoData.state == 'WAIT_AUDIT')) &&
+        this.$hasPermissions('B_storeCallOutEdit')
+      )
     },
     columns () {
       const _this = this
       const arr = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', width: '22%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', width: '22%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '单位', dataIndex: 'productUnit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        {
+          title: '产品编码',
+          dataIndex: 'productCode',
+          width: '22%',
+          align: 'center',
+          customRender: function (text) {
+            return text || '--'
+          }
+        },
+        {
+          title: '产品名称',
+          dataIndex: 'productName',
+          width: '22%',
+          align: 'left',
+          customRender: function (text) {
+            return text || '--'
+          },
+          ellipsis: true
+        },
+        {
+          title: '单位',
+          dataIndex: 'productUnit',
+          width: '6%',
+          align: 'center',
+          customRender: function (text) {
+            return text || '--'
+          }
+        },
         // { title: '成本价(¥)', dataIndex: 'outCost', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '调出仓库', dataIndex: 'warehouseName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '调出仓位', dataIndex: 'warehouseLocationName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '调出数量', dataIndex: 'outQty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        {
+          title: '调出仓库',
+          dataIndex: 'warehouseName',
+          width: '12%',
+          align: 'center',
+          customRender: function (text) {
+            return text || '--'
+          }
+        },
+        {
+          title: '调出仓位',
+          dataIndex: 'warehouseLocationName',
+          width: '12%',
+          align: 'center',
+          customRender: function (text) {
+            return text || '--'
+          }
+        },
+        {
+          title: '调出数量',
+          dataIndex: 'outQty',
+          width: '10%',
+          align: 'center',
+          customRender: function (text) {
+            return text || text == 0 ? text : '--'
+          }
+        },
         // { slots: { title: 'costTitle' }, dataIndex: 'totalOutCost', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
       ]
       if (this.$hasPermissions('M_ShowAllCost')) {
-        arr.splice(6, 0, { slots: { title: 'costTitle' }, dataIndex: 'totalOutCost', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
+        arr.splice(6, 0, {
+          slots: { title: 'costTitle' },
+          dataIndex: 'totalOutCost',
+          width: '8%',
+          align: 'right',
+          customRender: function (text) {
+            return text || text == 0 ? _this.toThousands(text, 2) : '--'
+          }
+        })
       }
       return arr
     }
@@ -175,6 +254,7 @@ export default {
       storeCallOutDetailSn({ sn: this.outBizSn || this.$route.params.sn }).then(res => {
         if (res.status == 200) {
           this.basicInfoData = res.data
+          this.getDetailCount()
         } else {
           this.basicInfoData = null
         }
@@ -185,7 +265,9 @@ export default {
       storeCallOutDetailCount({ storeCallOutSn: this.outBizSn || this.$route.params.sn }).then(res => {
         if (res.status == 200) {
           this.productTotal = res.data
-          this.$refs.table.refresh(true)
+          this.$nextTick(() => {
+            this.$refs.table.refresh(true)
+          })
         } else {
           this.productTotal = null
         }
@@ -196,20 +278,9 @@ export default {
       this.$router.push({ path: `/allocationManagement/storeTransferOut/edit/${this.basicInfoData.id}/${this.basicInfoData.storeCallOutSn}` })
     }
   },
-  mounted () {
-    if (!this.$store.state.app.isNewTab || this.outBizSn) { // 页签刷新 或 为弹框时调用
-      this.printCostChecked = true
-      this.getDetail()
-      this.getDetailCount()
-    }
-  },
   activated () {
-    // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
-    if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
-      this.printCostChecked = true
-      this.getDetail()
-      this.getDetailCount()
-    }
+    this.printCostChecked = true
+    this.getDetail()
   },
   beforeRouteEnter (to, from, next) {
     next(vm => {})
@@ -218,12 +289,12 @@ export default {
 </script>
 
 <style lang="less">
-  .storeTransferOutDetail-wrap{
-    .storeTransferOutDetail-back{
-      margin-bottom: 10px;
-    }
-    .storeTransferOutDetail-cont{
-      margin-bottom: 10px;
-    }
+.storeTransferOutDetail-wrap {
+  .storeTransferOutDetail-back {
+    margin-bottom: 10px;
+  }
+  .storeTransferOutDetail-cont {
+    margin-bottom: 10px;
   }
+}
 </style>