2 Commits 69576ebbab ... d6d5d5a0a0

Autor SHA1 Mensaje Fecha
  lijt d6d5d5a0a0 作废流程添加开票金额列 hace 1 año
  lijt 589335071f 解决项目、报告类型切换,对应数据量错误 hace 1 año

+ 71 - 3
src/views/modules/cw/invoice/InvoiceFormTaskInvalid.vue

@@ -11,6 +11,7 @@
       <el-row  :gutter="15">
         <vxe-table
           border
+          :footer-method="footerMethod2"
           show-overflow
           show-footer
           ref="baseTable"
@@ -20,9 +21,10 @@
           @cell-click=""
           @edit-closed=""
           highlight-current-row
+          :edit-rules="tableRules"
           :edit-config="{trigger: 'click', mode: 'cell', showStatus: true, autoClear: true, icon: '-'}"
         >
-          <vxe-table-column field="programName" align="center" title="项目名称" :edit-render="{}">
+          <vxe-table-column field="programName" align="center" title="项目名称555" :edit-render="{}">
             <template v-slot:edit="scope">
               <el-input @focus="openProgramPageForm(scope.$rowIndex)" placeholder="请填写项目名称" :readonly="true" v-model="scope.row.programName"/>
             </template>
@@ -37,6 +39,11 @@
               <el-input :readonly="true" placeholder="请填写项目编号" v-model="scope.row.programNo"/>
             </template>
           </vxe-table-column>
+          <vxe-table-column field="account" align="center" title="发票金额(元)" :edit-render="{}">
+            <template v-slot:edit="scope">
+              <el-input :readonly="true" placeholder="请填写发票金额" v-model="scope.row.account" @blur="scope.row.account = twoDecimalPlaces(scope.row.account)" maxlength="15"/>
+            </template>
+          </vxe-table-column>
           <!--          <vxe-table-column field="clientName" title="委托方" :edit-render="{}">-->
           <!--            <template v-slot:edit="scope">-->
           <!--              <el-input :readonly="true" placeholder="请填写委托方" v-model="scope.row.clientName"/>-->
@@ -566,6 +573,7 @@
   import WorkClientForm from '../workClientInfo/WorkClientChooseRadio'
   import SelectUserTree from '@/views/modules/utils/treeUserSelect'
   import SelectTree from '@/components/treeSelect/treeSelect.vue'
+  import XEUtils from 'xe-utils'
   export default {
     props: {
       businessId: {
@@ -583,11 +591,17 @@
     },
     data () {
       return {
+        tableRules: {
+          account: [
+            { required: true, message: '请填写发票金额' }
+          ]
+        },
         title: '',
         method: '',
         visible: false,
         loading: false,
         inputForm: {
+          actualPrice: '',
           id: '',
           financeInvoiceBaseDTOList: [],
           programName: '',
@@ -688,6 +702,7 @@
       init (method, id) {
         this.method = method
         this.inputForm = {
+          actualPrice: '',
           id: '',
           financeInvoiceBaseDTOList: [],
           programName: '',
@@ -779,7 +794,8 @@
               this.inputForm.financeInvoiceDetailDTOList.push({
                 code: '',
                 number: '',
-                account: this.inputForm.account,
+                account: this.inputForm.actualPrice,
+                // account: this.inputForm.account,
                 rate: '',
                 amount: '',
                 tax: '',
@@ -837,6 +853,7 @@
           this.loading = false
           throw new Error()
         }
+        this.inputForm.account = this.inputForm.actualPrice
         if (status === 'save') {
           // 暂存
           // this.inputForm.status = '1'
@@ -1183,7 +1200,8 @@
       // 获取发票金额,放到开票明细中第一条数据
       getTotalAccount () {
         if (!this.commonJS.isEmpty(this.inputForm.account)) {
-          this.financeInvoiceDetailDTOList.push({account: this.inputForm.account})
+          this.financeInvoiceDetailDTOList.push({account: this.inputForm.actualPrice})
+          // this.financeInvoiceDetailDTOList.push({account: this.inputForm.account})
         }
       },
       async updateStatusById (type, callback) {
@@ -1239,7 +1257,57 @@
             })
           }
         }
+      },
+    footerMethod2 ({ columns, data }) {
+      const footerData = [
+        columns.map((column, columnIndex) => {
+          if (columnIndex === 0) {
+            return '发票金额汇总(元)'
+          }
+          if (['account'].includes(column.property)) {
+            // eslint-disable-next-line no-undef
+            this.inputForm.actualPrice = XEUtils.sum(data, column.property)
+            return XEUtils.sum(data, column.property)
+          }
+          if (['actualPrice'].includes(column.property)) {
+            // eslint-disable-next-line no-undef
+            this.inputForm.actualPrice = XEUtils.sum(data, column.property)
+            return XEUtils.sum(data, column.property)
+          }
+          return null
+        })
+      ]
+      console.log('actualPrice', this.inputForm.actualPrice)
+      return footerData
+    },
+    twoDecimalPlaces (num) {
+      let str = num.toString()
+      var len1 = str.substr(0, 1)
+      var len2 = str.substr(1, 1)
+      // eslint-disable-next-line eqeqeq
+      if (str.length > 1 && len1 == 0 && len2 != '.') {
+        str = str.substr(1, 1)
       }
+      // eslint-disable-next-line eqeqeq
+      if (len1 == '.') {
+        str = ''
+      }
+      // eslint-disable-next-line eqeqeq
+      if (str.indexOf('.') != -1) {
+        var str_ = str.substr(str.indexOf('.') + 1)
+        // eslint-disable-next-line eqeqeq
+        if (str_.indexOf('.') != -1) {
+          str = str.substr(0, str.indexOf('.') + str_.indexOf('.') + 1)
+        }
+        if (str_.length > 2) {
+          this.$message.warning(`金额小数点后只能输入两位,请正确输入!`)
+          return (str = '')
+        }
+      }
+      // eslint-disable-next-line no-useless-escape
+      str = str.replace(/[^\d^\.]+/g, '') // 保留数字和小数点
+      return str
+    }
     }
   }
 </script>

+ 15 - 9
src/views/modules/cw/invoice/ProgramPageForm.vue

@@ -77,9 +77,9 @@
         <vxe-pager
           background
           size="small"
-          :current-page="tablePage.currentPage"
-          :page-size="tablePage.pageSize"
-          :total="tablePage.total"
+          :current-page="tablePage1.currentPage"
+          :page-size="tablePage1.pageSize"
+          :total="tablePage1.total"
           :page-sizes="[10, 20, 100, 1000, {label: '全量数据', value: 1000000}]"
           :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
           @page-change="currentChangeHandle1">
@@ -191,6 +191,12 @@ export default {
         pageSize: 10,
         orders: []
       },
+      tablePage1: {
+        total: 0,
+        currentPage: 1,
+        pageSize: 10,
+        orders: []
+      },
       dataList: [],
       dataList1: [],
       searchForm: {
@@ -362,13 +368,13 @@ export default {
       this.loading = true
       this.searchForm.status = '5'
       this.projectRecordsService.list1({
-        'current': this.tablePage.currentPage,
-        'size': this.tablePage.pageSize,
-        'orders': this.tablePage.orders,
+        'current': this.tablePage1.currentPage,
+        'size': this.tablePage1.pageSize,
+        'orders': this.tablePage1.orders,
         ...this.searchForm
       }).then(({data}) => {
         this.dataList1 = data.records
-        this.tablePage.total = data.total
+        this.tablePage1.total = data.total
         this.loading = false
       })
     },
@@ -383,8 +389,8 @@ export default {
       this.list()
     },
     currentChangeHandle1 ({currentPage, pageSize}) {
-      this.tablePage.currentPage = currentPage
-      this.tablePage.pageSize = pageSize
+      this.tablePage1.currentPage = currentPage
+      this.tablePage1.pageSize = pageSize
       this.list1()
     },
     resetSearch1 () {