Browse Source

财务管理(发票)报告回显

lijt 1 năm trước cách đây
mục cha
commit
d1e941afa4

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 16826
package-lock.json


+ 7 - 0
src/api/cw/projectRecords/ProjectRecordsService.js

@@ -8,6 +8,13 @@ export default class ProjectRecordsService {
       params: params
     })
   }
+  list1 (params) {
+    return request({
+      url: '/cwProjectReport/list',
+      method: 'get',
+      params: params
+    })
+  }
   list2 (params) {
     return request({
       url: '/cwProjectRecords/list2',

+ 103 - 26
src/views/modules/cw/invoice/InvoiceFormTask.vue

@@ -11,6 +11,7 @@
       <el-row  :gutter="15">
         <vxe-table
           border
+          :footer-method="footerMethod2"
           show-overflow
           show-footer
           ref="baseTable"
@@ -21,6 +22,7 @@
           @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="{}">
@@ -38,6 +40,14 @@
               <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="false" 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"/>-->
@@ -55,6 +65,7 @@
           </vxe-table-column>
         </vxe-table>
       </el-row>
+
       <el-divider content-position="left"><i class="el-icon-document"></i> 发票详情</el-divider>
       <el-row  :gutter="15">
         <el-col :span="12">
@@ -242,31 +253,31 @@
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="12">
-          <el-form-item label="发票金额(元)" prop="account"
-                        :rules="[
-                        {required: true, message:'发票金额不能为空', trigger:'blur'}
-               ]">
-            <el-input
-              @input="fixedAccount"
-              placeholder="请填写发票金额"
-              maxlength="15"
-              v-model="inputForm.account"
-            >
-            </el-input>
-<!--            <el-input-number-->
-<!--              v-model="inputForm.account"-->
-<!--              controls-position="right"-->
-<!--              :controls="false"-->
-<!--              style="width:100%;"-->
-<!--              :max="999999999999999"-->
-<!--              :precision="2"-->
+<!--        <el-col :span="12">-->
+<!--          <el-form-item label="发票金额(元)" prop="account"-->
+<!--                        :rules="[-->
+<!--                        {required: true, message:'发票金额不能为空', trigger:'blur'}-->
+<!--               ]">-->
+<!--            <el-input-->
+<!--              @input="fixedAccount"-->
 <!--              placeholder="请填写发票金额"-->
-<!--              :step="0.01"-->
-<!--              clearable>-->
-<!--            </el-input-number>-->
-          </el-form-item>
-        </el-col>
+<!--              maxlength="15"-->
+<!--              v-model="inputForm.account"-->
+<!--            >-->
+<!--            </el-input>-->
+<!--&lt;!&ndash;            <el-input-number&ndash;&gt;-->
+<!--&lt;!&ndash;              v-model="inputForm.account"&ndash;&gt;-->
+<!--&lt;!&ndash;              controls-position="right"&ndash;&gt;-->
+<!--&lt;!&ndash;              :controls="false"&ndash;&gt;-->
+<!--&lt;!&ndash;              style="width:100%;"&ndash;&gt;-->
+<!--&lt;!&ndash;              :max="999999999999999"&ndash;&gt;-->
+<!--&lt;!&ndash;              :precision="2"&ndash;&gt;-->
+<!--&lt;!&ndash;              placeholder="请填写发票金额"&ndash;&gt;-->
+<!--&lt;!&ndash;              :step="0.01"&ndash;&gt;-->
+<!--&lt;!&ndash;              clearable>&ndash;&gt;-->
+<!--&lt;!&ndash;            </el-input-number>&ndash;&gt;-->
+<!--          </el-form-item>-->
+<!--        </el-col>-->
         <el-col :span="12">
           <el-form-item label="是否多张开票" prop="isMultiple"
                         :rules="[
@@ -642,6 +653,7 @@
   import SelectUserTree from '@/views/modules/utils/treeUserSelect'
   import SelectTree from '@/components/treeSelect/treeSelect.vue'
   import WorkClientBillingChooseRadio from '@/views/modules/cw/workClientInfo/WorkClientBillingChooseRadio'
+  import XEUtils from 'xe-utils'
 
   export default {
     props: {
@@ -660,11 +672,17 @@
     },
     data () {
       return {
+        tableRules: {
+          account: [
+            { required: true, message: '请填写发票金额' }
+          ]
+        },
         title: '',
         method: '',
         visible: false,
         loading: false,
         inputForm: {
+          actualPrice: '',
           id: '',
           financeInvoiceBaseDTOList: [],
           programName: '',
@@ -771,6 +789,7 @@
         this.importVisible = false
         this.method = method
         this.inputForm = {
+          actualPrice: '',
           id: '',
           financeInvoiceBaseDTOList: [],
           programName: '',
@@ -891,7 +910,8 @@
               this.inputForm.financeInvoiceDetailDTOList.push({
                 code: '',
                 number: '',
-                account: this.inputForm.account,
+                account: this.inputForm.actualPrice,
+                // account: this.inputForm.account,
                 rate: '',
                 amount: '',
                 tax: '',
@@ -953,6 +973,7 @@
           this.loading = false
           throw new Error()
         }
+        this.inputForm.account = this.inputForm.actualPrice
         if (status === 'save') {
           // 暂存
           this.loading = true
@@ -993,6 +1014,11 @@
               this.$message.error('第' + (j + 1) + '行的基本信息不能为空')
               throw new Error()
             }
+            if (this.commonJS.isEmpty(this.inputForm.financeInvoiceBaseDTOList[j].account)) {
+              this.loading = false
+              this.$message.error('第' + (j + 1) + '行的发票金额不能为空')
+              throw new Error()
+            }
           }
         }
         if (this.inputForm.status === '5') {
@@ -1323,7 +1349,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) {
@@ -1514,6 +1541,56 @@
           var result = this.inputForm.account.replace(reg, regStrs[i][1])
           this.inputForm.account = result
         }
+      },
+      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
       }
     }
   }

+ 10 - 0
src/views/modules/cw/invoice/InvoiceUpdateForm.vue

@@ -47,6 +47,16 @@
               <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"/>
+            </template>
+          </vxe-table-column>-->
+<!--          <vxe-table-column field="account" title="发票金额(元)":edit-render="{}">
+            <template v-slot:edit="scope">
+               <el-input maxlength="15" v-model="scope.row.account" @keyup.native="scope.row.account = twoDecimalPlaces(scope.row.account)" @change="countAmount(scope.row)"></el-input>
+            </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"/>-->

+ 148 - 8
src/views/modules/cw/invoice/ProgramPageForm.vue

@@ -12,8 +12,79 @@
       :visible.sync="visible">
       <div v-if="isShow">
         <el-radio v-model="checkType" label="1" size="small" style="margin-right: 20px">项目</el-radio>
-        <el-radio v-model="checkType" label="2" size="small" style="margin-right: 20px">其他</el-radio>
+        <el-radio v-if="hasPermission('cw_finance:invoice:add:report')" v-model="checkType" label="2" size="small" style="margin-right: 20px">报告</el-radio>
+        <el-radio v-model="checkType" label="3" size="small" style="margin-right: 20px">其他</el-radio>
+
       </div>
+<!--报告        -->
+      <div v-if="checkType === '2'" style="height: calc(100% - 80px);">
+        <el-form size="small" :inline="true" class="query-form" ref="searchForm" :model="searchForm" @submit.native.prevent>
+          <!-- 搜索框-->
+          <el-form-item label="项目名称" prop="projectName">
+            <el-input size="small" v-model="searchForm.projectName" placeholder="请输入项目名称" clearable></el-input>
+          </el-form-item>
+          <el-form-item label="报告编号" prop="reportNo">
+            <el-input size="small" v-model="searchForm.reportNo" placeholder="请输入报告号" clearable></el-input>
+          </el-form-item>
+          <el-form-item label="报告创建时间" prop="createDates">
+            <el-date-picker
+              placement="bottom-start"
+              format="yyyy-MM-dd HH:mm:ss"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              v-model="searchForm.createDates"
+              type="datetimerange"
+              range-separator="至"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期">
+            </el-date-picker>
+          </el-form-item>
+
+          <el-form-item>
+            <el-button type="primary" @click="list1()" size="small" icon="el-icon-search">查询</el-button>
+            <el-button @click="resetSearch1()" size="small" icon="el-icon-refresh-right">重置</el-button>
+          </el-form-item>
+        </el-form>
+
+        <vxe-table
+          border="inner"
+          auto-resize
+          resizable
+          height="400px"
+          :loading="loading"
+          size="small"
+          ref="projectTable1"
+          show-header-overflow
+          show-overflow
+          highlight-hover-row
+          :menu-config="{}"
+          :print-config="{}"
+          @sort-change=""
+          :sort-config="{remote:true}"
+          :data="dataList1"
+          :row-config="{isCurrent: true}"
+          :checkbox-config="{trigger: 'row'}"
+        >
+          <vxe-column type="seq" width="60" title="序号"></vxe-column>
+          <vxe-column type="checkbox" width="40px"></vxe-column>
+          <vxe-column min-width="230" align="center" title="项目名称" field="projectName"></vxe-column>
+          <vxe-column min-width="160" align="center" title="报告文号" field="reportNo"></vxe-column>
+          <vxe-column min-width="160" align="center" title="合同名称" field="contractName"></vxe-column>
+         <vxe-column min-width="160" align="center" title="报告创建人" field="userName"></vxe-column>
+          <vxe-column min-width="160" align="center" title="报告创建时间" field="createDate"></vxe-column>
+
+        </vxe-table>
+        <vxe-pager
+          background
+          size="small"
+          :current-page="tablePage.currentPage"
+          :page-size="tablePage.pageSize"
+          :total="tablePage.total"
+          :page-sizes="[10, 20, 100, 1000, {label: '全量数据', value: 1000000}]"
+          :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
+          @page-change="currentChangeHandle1">
+        </vxe-pager>
+      </div>
+
       <div v-if="checkType === '1'" style="height: calc(100% - 80px);">
           <el-form size="small" :inline="true" class="query-form" ref="searchForm" :model="searchForm" @submit.native.prevent>
             <!-- 搜索框-->
@@ -81,7 +152,7 @@
             @page-change="currentChangeHandle">
           </vxe-pager>
         </div>
-      <div style="height: 500px;" v-if="checkType === '2'">
+      <div style="height: 500px;" v-if="checkType === '3'">
         <el-form  label-width="80px" class="query-form" ref="searchForm" :model="searchForm" @keyup.enter.native="refreshList()" @submit.native.prevent>
           <el-row  :gutter="15">
             <el-col :span="21">
@@ -94,7 +165,7 @@
       </div>
       <span slot="footer" class="dialog-footer">
       <el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
-      <el-button size="small" type="primary" v-if="method != 'view'" @click="getProgram()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
+      <el-button size="small" type="primary" v-if="method != 'view'"  @click="getProgram()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
     </span>
     </el-dialog>
   </div>
@@ -116,6 +187,7 @@
           orders: []
         },
         dataList: [],
+        dataList1: [],
         searchForm: {
           name: '',
           no: '',
@@ -124,7 +196,8 @@
           projectNumber: '',
           projectName: '',
           createDates: [],
-          status: ''
+          status: '',
+          reportNo: ''
         },
         checkType: '',
         detail: '',
@@ -155,15 +228,21 @@
           this.checkType = '1'
         } else {
           if (isShow === false || isShow === 'false') {
-            this.isShow = false
-            this.checkType = '1'
-            this.$message({message: '第一条为项目后面新增只能选择项目', type: 'warning', customClass: 'messageZindex'})
+            if (this.checkType === '1') {
+              this.isShow = false
+              this.checkType = '1'
+              this.$message({message: '第一条为项目后面新增只能选择项目', type: 'warning', customClass: 'messageZindex'})
+            } else if (this.checkType === '2') {
+              this.isShow = false
+              this.checkType = '2'
+              this.$message({message: '第一条为报告后面新增只能选择报告', type: 'warning', customClass: 'messageZindex'})
+            }
           } else if (isShow === '1') {
             this.isShow = false
             this.checkType = '1'
           } else {
             this.isShow = false
-            this.checkType = '2'
+            this.checkType = '3'
           }
         }
         if (this.commonJS.isEmpty(num) || num === true) {
@@ -173,6 +252,7 @@
         }
         this.visible = true
         this.list()
+        this.list1()
       },
       // 表单提交
       getProgram () {
@@ -189,6 +269,18 @@
             }
           }
           rows = this.$refs.projectTable.getCheckboxRecords()
+        } else if (this.checkType === '2') {
+          if (this.commonJS.isEmpty(this.$refs.projectTable1.getCheckboxRecords())) {
+            this.$message.error('请至少选择一条数据')
+            return
+          }
+          if (this.num === false) {
+            if (this.$refs.projectTable1.getCheckboxRecords().length > 1) {
+              this.$message.error('最多选择一条数据')
+              return
+            }
+          }
+          rows = this.$refs.projectTable1.getCheckboxRecords()
         } else {
           if (this.commonJS.isEmpty(this.detail)) {
             this.$message.error('请填写开票详情')
@@ -199,6 +291,31 @@
         this.close()
         this.$emit('getProgram', rows)
       },
+      // 表单提交
+      /* getProgram1 () {
+        let rows
+        if (this.checkType === '1') {
+          if (this.commonJS.isEmpty(this.$refs.projectTable1.getCheckboxRecords())) {
+            this.$message.error('请至少选择一条数据')
+            return
+          }
+          if (this.num === false) {
+            if (this.$refs.projectTable.getCheckboxRecords().length > 1) {
+              this.$message.error('最多选择一条数据')
+              return
+            }
+          }
+          rows = this.$refs.projectTable.getCheckboxRecords()
+        } else {
+          if (this.commonJS.isEmpty(this.detail)) {
+            this.$message.error('请填写开票详情')
+            return
+          }
+          rows = [{projectName: this.detail}]
+        }
+        this.close()
+        this.$emit('getProgram', rows)
+      }, */
       list () {
         this.loading = true
         this.searchForm.status = '5'
@@ -213,6 +330,20 @@
           this.loading = false
         })
       },
+      list1 () {
+        this.loading = true
+        this.searchForm.status = '5'
+        this.projectRecordsService.list1({
+          'current': this.tablePage.currentPage,
+          'size': this.tablePage.pageSize,
+          'orders': this.tablePage.orders,
+          ...this.searchForm
+        }).then(({data}) => {
+          this.dataList1 = data.records
+          this.tablePage.total = data.total
+          this.loading = false
+        })
+      },
       // 当前页
       currentChangeHandle ({currentPage, pageSize}) {
         this.tablePage.currentPage = currentPage
@@ -223,6 +354,15 @@
         this.$refs.searchForm.resetFields()
         this.list()
       },
+      currentChangeHandle1 ({currentPage, pageSize}) {
+        this.tablePage.currentPage = currentPage
+        this.tablePage.pageSize = pageSize
+        this.list1()
+      },
+      resetSearch1 () {
+        this.$refs.searchForm.resetFields()
+        this.list1()
+      },
       close () {
         this.detail = ''
         this.visible = false