Browse Source

修改bug

chenrui 1 năm trước cách đây
mục cha
commit
40062a4208
1 tập tin đã thay đổi với 42 bổ sung34 xóa
  1. 42 34
      src/views/expenseManagement/expenseReimbursement/detail.vue

+ 42 - 34
src/views/expenseManagement/expenseReimbursement/detail.vue

@@ -44,7 +44,7 @@
               <a-descriptions-item label="审核时间">{{ detailData&&detailData.finishDate || '--' }}</a-descriptions-item>
               <a-descriptions-item label="关联单号" v-if="detailData&&detailData.bizNo">{{ detailData&&detailData.bizNo || '--' }}</a-descriptions-item>
               <a-descriptions-item label="主题" :span="3">{{ detailData&&detailData.title || '--' }}</a-descriptions-item>
-              
+
               <a-descriptions-item label="详细说明" :span="4">
                 {{ detailData.content.join(',')||'' }}
               </a-descriptions-item>
@@ -72,7 +72,7 @@
           :columns="columns"
           :data="loadData"
           :showPagination="false"
-          :defaultLoadData="true"
+          :defaultLoadData="false"
           bordered>
           <!-- 记账名称 -->
           <template slot="jzname" slot-scope="text,record">
@@ -101,7 +101,13 @@
       </a-card>
     </a-spin>
     <!-- 打印预览 -->
-    <commonModal modalTit="费用报销单打印预览" width="700pt" okText="立即打印" :openModal="showTipModal" @cancel="showTipModal=false" @ok="$refs.printModal.prints()">
+    <commonModal
+      modalTit="费用报销单打印预览"
+      width="700pt"
+      okText="立即打印"
+      :openModal="showTipModal"
+      @cancel="showTipModal=false"
+      @ok="$refs.printModal.prints()">
       <previewModal v-if="printType=='preview'" ref="printModal" @printOk="printOk"></previewModal>
     </commonModal>
     <!-- 快捷打印 -->
@@ -123,14 +129,27 @@ export default {
   mixins: [commonMixin],
   components: { STable, previewModal, commonModal },
   data () {
-    let _this=this
+    const _this = this
     return {
       spinning: false,
       disabled: false,
       baseData: null,
       showTipModal: false,
-      printType:'',
+      printType: '',
       count: 0,
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
+        { title: '记账类型', dataIndex: 'accountTypeDictValue', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
+        { title: '记账名称', dataIndex: 'accountName', scopedSlots: { customRender: 'jzname' }, align: 'center', width: '14%' },
+        { title: '所属区域', dataIndex: 'subareaNames', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '所属分区', dataIndex: 'subareaAreaName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '所属省份', dataIndex: 'provinceName', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
+        { title: '所属城市', dataIndex: 'cityName', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
+        { title: '记账费用', dataIndex: 'expense', align: 'right', width: '10%', customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' } },
+        { title: '费用承担方', scopedSlots: { customRender: 'fycdf' }, align: 'center', width: '15%' },
+        { title: '产品信息', scopedSlots: { customRender: 'cpxx' }, align: 'center', width: '15%' },
+        { title: '备注', dataIndex: 'remarks', align: 'center', width: '10%', customRender: function (text) { return text || '--' } }
+      ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.spinning = true
@@ -149,19 +168,6 @@ export default {
           return data
         })
       },
-      columns: [
-        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
-        { title: '记账类型', dataIndex: 'accountTypeDictValue', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
-        { title: '记账名称', dataIndex: 'accountName', scopedSlots: { customRender: 'jzname' }, align: 'center', width: '14%' },
-        { title: '所属区域', dataIndex: 'subareaNames', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '所属分区', dataIndex: 'subareaAreaName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '所属省份', dataIndex: 'provinceName', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
-        { title: '所属城市', dataIndex: 'cityName', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
-        { title: '记账费用', dataIndex: 'expense', align: 'right', width: '10%', customRender: function (text) { return (text||text==0)?_this.toThousands(text):'--' } },
-        { title: '费用承担方', scopedSlots: { customRender: 'fycdf' }, align: 'center', width: '15%' },
-        { title: '产品信息', scopedSlots: { customRender: 'cpxx' }, align: 'center', width: '15%' },
-        { title: '备注', dataIndex: 'remarks', align: 'center', width: '10%', customRender: function (text) { return text || '--' } }
-      ],
       chooseLoadData: [],
       detailData: null, //  详情数据
       total: 0
@@ -181,37 +187,37 @@ export default {
       // 审核明细,待提交状态不获取
       const spListData = this.detailData.state != 'WAIT_SUBMIT' ? await getProcessInstance({ businessType: 'EXPENSES', businessSn: this.$route.params.sn }).then(res => res.data) : null
       // 打印预览弹框
-      if(type == 'preview'){
+      if (type == 'preview') {
         this.showTipModal = true
-      } 
-      this.$nextTick(()=>{
+      }
+      this.$nextTick(() => {
         this.$refs.printModal.setData([{
           expenseInfo: this.detailData,
           fyListData,
-          spListData:spListData||[]
+          spListData: spListData || []
         }])
         // 立即打印
-        if(type == 'print'){
-          setTimeout(()=>{
+        if (type == 'print') {
+          setTimeout(() => {
             this.$refs.printModal.prints()
-          },500)
+          }, 500)
         }
         this.spinning = false
       })
     },
-    printOk(data){
-      if(data&&data.status == 200){
+    printOk (data) {
+      if (data && data.status == 200) {
         expenseAccountUpdateBatch([{
-            id: this.detailData.id,
-            printStatus:"PRINT"
-          }]).then(res => {
-          if(res.status == 200){
-             this.getDetail()
+          id: this.detailData.id,
+          printStatus: 'PRINT'
+        }]).then(res => {
+          if (res.status == 200) {
+            this.getDetail()
           }
           this.spinning = false
           this.showTipModal = false
         })
-      }else{
+      } else {
         this.spinning = false
       }
     },
@@ -224,7 +230,9 @@ export default {
           this.spinning = false
           this.detailData = res.data
           this.detailData.content = res.data.content.replace(/\n+/, '\n').split('\n')
-          this.$refs.table.refresh()
+          this.$nextTick(() => {
+            this.$refs.table.refresh()
+          })
         } else {
           this.detailData = null
         }