From a0c45be5fcba9f56edf3b4faae7f6d3dfe425cc8 Mon Sep 17 00:00:00 2001 From: zhaoxiao Date: Thu, 16 Sep 2021 18:54:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=99=AE=E9=80=9A=E9=A1=B9=E7=9B=AE=EF=BC=9B?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=BB=84=E5=8F=98=E6=9B=B4--=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=BB=B4=E6=8A=A4=E6=8E=A5=E5=8F=A3=EF=BC=9B=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E5=BC=80=E7=A5=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/incomePaymentsApi.js | 14 +- src/components/company/SelectPrincipal.vue | 1 + src/utils/util.js | 140 ++++++++------- .../ArriveAndInvoivingList.vue | 72 +++++++- .../modules/BatchIncomePaymentModule.vue | 21 +-- .../modules/BatchInvoicingModule.vue | 80 ++++++--- .../GeneralProjectManagement.vue | 2 +- .../WorkingGroupMemberUnitMaintenance.vue | 15 ++ .../WorkingGroupProjectDataMaintenance.vue | 82 ++++++--- .../WorkingGroupProjectManagement.vue | 5 +- .../modules/GeneralProjectModule.vue | 1 - .../modules/WorkGroupDistributeModule.vue | 167 +++++++++++------- .../modules/WorkGroupFileUploadModal.vue | 74 ++++---- 13 files changed, 442 insertions(+), 232 deletions(-) diff --git a/src/api/incomePaymentsApi.js b/src/api/incomePaymentsApi.js index 46e70fe..6a70e99 100644 --- a/src/api/incomePaymentsApi.js +++ b/src/api/incomePaymentsApi.js @@ -37,7 +37,8 @@ const amountReceivedList = (param) => postAction(`/paymentRecord/payPaymentRecor // 开票列表 const payBillList = (param) => postAction(`/paymentRecord/payPaymentRecord/payBillList?id=${param}`) // 新增开票阶段 -const addPayBill = (projectId, projectType, param) => postAction(`/paymentRecord/payPaymentRecord/addPayBill?projectIds=${projectId}&projectTypes=${projectType}`, param) +// const addPayBill = (projectId, projectType, invoiceAmounts, param) => postAction(`/paymentRecord/payPaymentRecord/addPayBill?projectIds=${projectId}&projectTypes=${projectType}&invoiceAmounts=${invoiceAmounts}`, param) +const addPayBill = (param) => postAction(`/paymentRecord/payPaymentRecord/addPayBill`, param) // 编辑开票阶段 const editPayBill = (param) => postAction('/paymentRecord/payPaymentRecord/editPayBill', param) // 普通项目管理-通过项目id查询其他的信息 @@ -52,6 +53,12 @@ const removePackProject = (param) => postAction('/pack/payPackCompanyProject/rem const batchRemovePackProject = (param) => postAction('/pack/payPackCompanyProject/removeBatch', param) // 企业管理审核 const aduitCompany = (param) => getAction('/company/payCompanyManagement/audit', param) +// 资料分发 +const distribute = (param) => postAction('/project/payWorkingGroupDistributionRecord/add', param) +// 资料批量分发 +const batchDistribute = (param) => postAction('/project/payWorkingGroupDistributionRecord/addBatch', param) +// 资料分发成员列表 +const distributeMemberList = (param) => getAction('/project/payWorkingGroupDistributionRecord/list', param) export { getWorkingGroupById, @@ -79,5 +86,8 @@ export { addPackProject, removePackProject, batchRemovePackProject, - aduitCompany + aduitCompany, + distribute, + batchDistribute, + distributeMemberList } diff --git a/src/components/company/SelectPrincipal.vue b/src/components/company/SelectPrincipal.vue index 81c169a..5f2d841 100644 --- a/src/components/company/SelectPrincipal.vue +++ b/src/components/company/SelectPrincipal.vue @@ -42,6 +42,7 @@ export default { }, // 下拉框的搜索 filterOption(input, option) { + console.log(option) return ( option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 ) diff --git a/src/utils/util.js b/src/utils/util.js index 8e755b5..c7c2673 100644 --- a/src/utils/util.js +++ b/src/utils/util.js @@ -11,7 +11,7 @@ export function timeFix() { export function welcome() { const arr = ['休息一会儿吧', '准备吃什么呢?', '要不要打一把 DOTA', '我猜你可能累了'] - let index = Math.floor((Math.random()*arr.length)) + let index = Math.floor((Math.random() * arr.length)) return arr[index] } @@ -35,7 +35,7 @@ export function filterObj(obj) { return } - for ( let key in obj) { + for (let key in obj) { // eslint-disable-next-line if (obj.hasOwnProperty(key) && (obj[key] == null || obj[key] == undefined || obj[key] === '')) { @@ -53,7 +53,7 @@ export function filterObj(obj) { */ export function formatDate(value, fmt) { let regPos = /^\d+(\.\d+)?$/ - if(regPos.test(value)){ + if (regPos.test(value)) { //如果是数字 let getDate = new Date(value) let o = { @@ -74,46 +74,46 @@ export function formatDate(value, fmt) { } } return fmt - }else{ + } else { //TODO value = value.trim() - return value.substr(0,fmt.length) + return value.substr(0, fmt.length) } } // 生成首页路由 export function generateIndexRouter(data) { -let indexRouter = [{ - path: '/', - name: 'dashboard', - //component: () => import('@/components/layouts/BasicLayout'), - // eslint-disable-next-line - component: resolve => require(['@/components/layouts/TabLayout'], resolve), - meta: { title: '首页' }, - redirect: '/dashboard/analysis', - children: [ - ...generateChildRouters(data) - ] - },{ - 'path': '*', 'redirect': '/404', 'hidden': true - }] + let indexRouter = [{ + path: '/', + name: 'dashboard', + //component: () => import('@/components/layouts/BasicLayout'), + // eslint-disable-next-line + component: resolve => require(['@/components/layouts/TabLayout'], resolve), + meta: { title: '首页' }, + redirect: '/dashboard/analysis', + children: [ + ...generateChildRouters(data) + ] + }, { + 'path': '*', 'redirect': '/404', 'hidden': true + }] return indexRouter } // 生成嵌套路由(子路由) -function generateChildRouters (data) { +function generateChildRouters(data) { const routers = [] for (let item of data) { let component = '' - if(item.component.indexOf('layouts')>=0){ - component = 'components/'+item.component - }else{ - component = 'views/'+item.component + if (item.component.indexOf('layouts') >= 0) { + component = 'components/' + item.component + } else { + component = 'views/' + item.component } // eslint-disable-next-line - let URL = (item.meta.url|| '').replace(/{{([^}}]+)?}}/g, (s1, s2) => eval(s2)) // URL支持{{ window.xxx }}占位符变量 + let URL = (item.meta.url || '').replace(/{{([^}}]+)?}}/g, (s1, s2) => eval(s2)) // URL支持{{ window.xxx }}占位符变量 if (isURL(URL)) { item.meta.url = URL } @@ -139,42 +139,42 @@ function generateChildRouters (data) { // componentPath = onlineCommons.OnlCgreportAutoList // }else{ // eslint-disable-next-line - componentPath = resolve => require(['@/' + component+'.vue'], resolve) + componentPath = resolve => require(['@/' + component + '.vue'], resolve) // } - let menu = { + let menu = { path: item.path, name: item.name, - redirect:item.redirect, + redirect: item.redirect, component: componentPath, //component: resolve => require(['@/' + component+'.vue'], resolve), - hidden:item.hidden, + hidden: item.hidden, //component:()=> import(`@/views/${item.component}.vue`), meta: { - title:item.meta.title , + title: item.meta.title, icon: item.meta.icon, - url:item.meta.url , - permissionList:item.meta.permissionList, - keepAlive:item.meta.keepAlive, + url: item.meta.url, + permissionList: item.meta.permissionList, + keepAlive: item.meta.keepAlive, /*update_begin author:wuxianquan date:20190908 for:赋值 */ - internalOrExternal:item.meta.internalOrExternal, + internalOrExternal: item.meta.internalOrExternal, /*update_end author:wuxianquan date:20190908 for:赋值 */ - componentName:item.meta.componentName + componentName: item.meta.componentName } } - if(item.alwaysShow){ + if (item.alwaysShow) { menu.alwaysShow = true menu.redirect = menu.path } if (item.children && item.children.length > 0) { - menu.children = [...generateChildRouters( item.children)] + menu.children = [...generateChildRouters(item.children)] } //--update-begin----author:scott---date:20190320------for:根据后台菜单配置,判断是否路由菜单字段,动态选择是否生成路由(为了支持参数URL菜单)------ //判断是否生成路由 - if(item.route && item.route === '0'){ + if (item.route && item.route === '0') { //console.log(' 不生成路由 item.route: '+item.route); //console.log(' 不生成路由 item.path: '+item.path); - }else{ + } else { routers.push(menu) } //--update-end----author:scott---date:20190320------for:根据后台菜单配置,判断是否路由菜单字段,动态选择是否生成路由(为了支持参数URL菜单)------ @@ -208,7 +208,7 @@ export function randomNumber() { } if (arguments.length === 1) { let [length] = arguments - // 生成指定长度的随机数字,首位一定不是 0 + // 生成指定长度的随机数字,首位一定不是 0 let nums = [...Array(length).keys()].map((i) => (i > 0 ? random(0, 9) : random(1, 9))) return parseInt(nums.join('')) } else if (arguments.length >= 2) { @@ -250,8 +250,8 @@ export function randomUUID() { * @param string * @returns {*} */ -export function underLine2CamelCase(string){ - return string.replace( /_([a-z])/g, function( all, letter ) { +export function underLine2CamelCase(string) { + return string.replace(/_([a-z])/g, function (all, letter) { return letter.toUpperCase() }) } @@ -261,8 +261,8 @@ export function underLine2CamelCase(string){ * @param bpmStatus * @returns {*} */ -export function showDealBtn(bpmStatus){ - if(bpmStatus!='1'&&bpmStatus!='3'&&bpmStatus!='4'){ +export function showDealBtn(bpmStatus) { + if (bpmStatus != '1' && bpmStatus != '3' && bpmStatus != '4') { return true } return false @@ -276,7 +276,7 @@ export function showDealBtn(bpmStatus){ export function cssExpand(css, id) { let style = document.createElement('style') style.type = 'text/css' - style.innerHTML = `@charset "UTF-8"; ${css}` + style.innerHTML = `@charset "UTF-8"; ${ css }` // 清除旧样式 if (id) { let $style = document.getElementById(id) @@ -307,16 +307,16 @@ export function jsExpand(options = {}) { let id = randomString(16, 'qwertyuioplkjhgfdsazxcvbnm'.toUpperCase()) // 封装按钮点击事件 let code = ` - (function (o_${id}) { + (function (o_${ id }) { try { (function (globalEvent, vm) { - ${options.jsCode} - })(o_${id}.event, o_${id}.vm) + ${ options.jsCode } + })(o_${ id }.event, o_${ id }.vm) } catch (e) { - o_${id}.error(e) + o_${ id }.error(e) } - o_${id}.done() - })(window['${windowKeyName}']['EVENT_${id}']) + o_${ id }.done() + })(window['${ windowKeyName }']['EVENT_${ id }']) ` // 创建script标签 const script = document.createElement('script') @@ -332,7 +332,7 @@ export function jsExpand(options = {}) { }, // 当js运行出错的时候调用的事件 error(e) { - console.group(`${options.errorMessage || '用户自定义JS增强代码运行出错'}(${new Date()})`) + console.group(`${ options.errorMessage || '用户自定义JS增强代码运行出错' }(${ new Date() })`) console.error(e) console.groupEnd() } @@ -555,16 +555,17 @@ export function neverNull(value, def) { */ export function removeArrayElement(array, prod, value) { let index = -1 - for(let i = 0;i=0){ + if (index >= 0) { array.splice(index, 1) } } + /** * 前端加密方法 * @param publicKey:公钥 @@ -576,13 +577,14 @@ export function encrypt(publicKey, message) { const txt = encrypt.encrypt(message) return txt } + /** * 校验数组是否有重复的元素 * */ export function isRepeat(arr) { var hash = {} - for(var i in arr) { - if(hash[arr[i]]) { + for (var i in arr) { + if (hash[arr[i]]) { return true } // 不存在该元素,则赋值为true,可以赋任意值,相应的修改if判断条件即可 @@ -590,6 +592,7 @@ export function isRepeat(arr) { } return false } + /** * 补充0 * */ @@ -613,14 +616,29 @@ export function addZero(e) { // 大于等于2 if (afterPointValue.length >= 2) { e.target.value = beforePointValue + afterPointValue - }else { + } else { // 不足2位补0 - afterPointValue = afterPointValue.padEnd(2,'0') + afterPointValue = afterPointValue.padEnd(2, '0') e.target.value = beforePointValue + afterPointValue } - }else { + } else { // 不包括小数点 - e.target.value = e.target.value + '.00' + e.target.value = e.target.value + '.00' } } } + +/** + * 数组内元素是否完全一致 + * @param array + * @returns {boolean} + */ +export function isAllEqual(array) { + if (array.length > 0) { + return !array.some(item => { + return item !== array[0] + }) + } else { + return true + } +} diff --git a/src/views/financialManagement/arriveAndInvoicing/ArriveAndInvoivingList.vue b/src/views/financialManagement/arriveAndInvoicing/ArriveAndInvoivingList.vue index 7a2bf32..3175cc6 100644 --- a/src/views/financialManagement/arriveAndInvoicing/ArriveAndInvoivingList.vue +++ b/src/views/financialManagement/arriveAndInvoicing/ArriveAndInvoivingList.vue @@ -47,6 +47,7 @@
导出 + 合并开票
@@ -87,7 +88,7 @@ 来款 - 开票 + 开票 @@ -108,6 +109,11 @@ :visible.sync="invoicingVisible" :charge-company-name="selectProjectChargeCompanyName"> + + + @@ -121,6 +127,8 @@ import ArriveStageModule from './modules/ArriveStageModule' import InvoicingStageModule from './modules/InvoicingStageModule' import SelectPrincipal from '../../../components/company/SelectPrincipal' import ProjectDetailModal from '../../../components/ProjectDetailModal' +import BatchInvoicingModule from '../../packManagement/modules/BatchInvoicingModule' +import { isAllEqual } from '../../../utils/util' export default { name: 'ArriveAndInvoivingList', @@ -131,7 +139,8 @@ export default { ArriveStageModule, InvoicingStageModule, SelectPrincipal, - ProjectDetailModal + ProjectDetailModal, + BatchInvoicingModule }, mixins: [JeroListMixin], data() { @@ -237,7 +246,9 @@ export default { selectProjectName: null, // 选中项目名称open selectProjectChargeCompanyName: null, // 选中项目来款企业 invoicingVisible: false, - arriveVisible: false + arriveVisible: false, + selectedProject: [], + batchInvoicingVisible: false } }, methods: { @@ -260,6 +271,61 @@ export default { this.selectProjectName = record.chargeProject this.selectProjectChargeCompanyName = record.chargeCompanyTemporaryName this.invoicingVisible = true + }, + /** + * 批量开票 + */ + batchInvoicing() { + this.selectedProject = [] + if (this.selectedRowKeys.length === 0) { + this.$message.warn('请选择至少一个项目') + return + } + this.getProjectListBySelectedKeys(this.selectedRowKeys, 'invoic').then(res => { + this.selectedProject = res + this.batchInvoicingVisible = true + }).catch((message) => { + this.$message.warn(message) + }).finally(() => { + this.onClearSelected() + }) + }, + /** + * 通过选中项目id获取数据,并进行相应提示 + * @param selectedKeys + * @param operateType + * @returns {Promise} + */ + getProjectListBySelectedKeys(selectedKeys, operateType) { + return new Promise((resolve, reject) => { + let arr = [] + // 获取选中的数据 + arr = this.dataSource.filter(tt => selectedKeys.indexOf(tt.id) > -1) + // 开票 + if (operateType === 'invoic') { + // 是否存在不需要发票的项目 + if (arr.some(item => item.needInvoice === 0 || Number(item.receivableAmount) === 0)){ + reject('存在不需要发票的项目!') + } + // 是否存在企业不同的项目 + let companyArr = [] + arr.forEach(item => { + companyArr.push(item.chargeCompanyTemporaryName) + }) + // 选中项目非同一企业 + if (!isAllEqual(companyArr)) { + reject('请选择来款单位为同一企业的项目合并开票') + } + } + // 来款 + if (operateType === 'incomePayment') { + // 是否存在应收金额为0的项目 + if (arr.some(item => Number(item.receivableAmount) === 0)) { + reject('存在应收金额为0的项目!') + } + } + resolve(arr) + }) } } } diff --git a/src/views/packManagement/modules/BatchIncomePaymentModule.vue b/src/views/packManagement/modules/BatchIncomePaymentModule.vue index 2f95db2..0ab6d59 100644 --- a/src/views/packManagement/modules/BatchIncomePaymentModule.vue +++ b/src/views/packManagement/modules/BatchIncomePaymentModule.vue @@ -169,7 +169,7 @@ export default { dataSource: [], inputIncomingAmount: null, // 输入的来款金额 disableMixinCreated: true, - sumAmountOwed: 0, // 总欠款金额 + sumAmountOwed: 0 // 总欠款金额 } }, methods: { @@ -203,6 +203,7 @@ export default { this.loadData() }, close() { + this.form.resetFields() this.clearThisTimeAmount() this.$emit('update:visible', false) }, @@ -218,21 +219,16 @@ export default { this.$message.warn('来款金额大于总欠款金额,请修改') return } - this.clearThisTimeAmount().then(() => { - this.calculateThisTimeAmount() - this.$forceUpdate() - }) + this.clearThisTimeAmount() + this.calculateThisTimeAmount() }, /** * 清空本次来款金额 * @returns {Promise} */ clearThisTimeAmount() { - return new Promise(resolve => { - this.dataSource.forEach(item => { - item.thisIncomingAmount = 0.00 - }) - resolve() + this.dataSource.forEach(item => { + item.thisIncomingAmount = 0.00 }) }, /** @@ -243,23 +239,22 @@ export default { this.$message.warn('请输入大于0的来款金额') return } - this.dataSource.forEach(item => { + this.dataSource.forEach((item, index) => { // 当前项目欠款是否 >0 if (Number(item.amountOwed) > 0) { // 输入的来款金额是否 >= 当前项目欠款 if (this.inputIncomingAmount >= Number(item.amountOwed)) { item.thisIncomingAmount = this.getAddZero(Number(item.amountOwed)) this.inputIncomingAmount -= Number(item.amountOwed) - // item.amountOwed = 0 } else { // 输入的来款金额小于当前项目欠款且剩余的输入来款金额大于0,则将剩余全部来款算入当前项目的此次来款 if (this.inputIncomingAmount > 0) { item.thisIncomingAmount = this.getAddZero(this.inputIncomingAmount) - // item.amountOwed = Number(item.amountOwed) - item.thisIncomingAmount this.inputIncomingAmount = 0 } } } + this.$set(this.dataSource, index, item) }) } , diff --git a/src/views/packManagement/modules/BatchInvoicingModule.vue b/src/views/packManagement/modules/BatchInvoicingModule.vue index a5e1c7a..ab5c392 100644 --- a/src/views/packManagement/modules/BatchInvoicingModule.vue +++ b/src/views/packManagement/modules/BatchInvoicingModule.vue @@ -14,7 +14,7 @@ @@ -23,7 +23,7 @@ @@ -34,7 +34,7 @@ @@ -56,9 +56,9 @@ - @@ -90,10 +103,10 @@ export default { sm: { span: 10 } }, url: { - list: '', - exportXlsUrl: '', - delete: '', - deleteBatch: '' + list: '/project/payWorkingGroupDataFile/list', + exportXlsUrl: '/project/payWorkingGroupDataFile/exportXls', + delete: '/project/payWorkingGroupDataFile/delete', + deleteBatch: '/project/payWorkingGroupDataFile/deleteBatch' }, columns: [ { @@ -108,25 +121,25 @@ export default { }, { title: '文件名称', align: 'center', - dataIndex: 'workGroup', + dataIndex: 'fileName', scopedSlots: { customRender: 'text' } }, { title: '下载次数', align: 'center', width: 160, - dataIndex: 'allMoney', + dataIndex: 'downloadCount', scopedSlots: { customRender: 'text' } }, { title: '上传时间', align: 'center', - width: 160, - dataIndex: 'comeAllMoney', + width: 220, + dataIndex: 'createTime', scopedSlots: { customRender: 'text' } }, { title: '上传人', align: 'center', width: 160, - dataIndex: 'moneyRate', + dataIndex: 'createBy', scopedSlots: { customRender: 'text' } }, { title: '操作', @@ -137,20 +150,49 @@ export default { scopedSlots: { customRender: 'action' } } ], + disableMixinCreated: true, + projectId: null, // 项目id + projectType: null, // 1--工作组;2--分标委 + distributeModalVisible: false, + isBatchDistribute: false, + dataId: '' // 资料id,传给分发 } }, + created() { + // 工作组 + if (this.$route.query.hasOwnProperty.call(this.$route.query, 'workingGroupId')) { + this.filters.projectId = this.$route.query.workingGroupId + this.projectType = 1 + this.filters.projectType = 1 + } else if (this.$route.query.hasOwnProperty.call(this.$route.query, 'id')) { + // 分标委 + this.filters.projectId = this.$route.query.id + this.projectType = 2 + this.filters.projectType = 2 + } + this.projectId = this.filters.projectId + this.loadData() + }, methods: { /** * 批量分发 */ batchDistribute() { - this.$refs.distributeModal.edit() + if (this.selectedRowKeys.length === 0) { + this.$message.warn('请至少选中一个资料') + return + } + this.dataId = this.selectedRowKeys.join(',') + this.distributeModalVisible = true + this.isBatchDistribute = true }, /** * 分发 */ - handleDistribute() { - this.$refs.distributeModal.edit() + handleDistribute(id) { + this.dataId = id + this.distributeModalVisible = true + this.isBatchDistribute = false } } } diff --git a/src/views/projectManagement/WorkingGroupProjectManagement.vue b/src/views/projectManagement/WorkingGroupProjectManagement.vue index f75cd1e..99a49f9 100644 --- a/src/views/projectManagement/WorkingGroupProjectManagement.vue +++ b/src/views/projectManagement/WorkingGroupProjectManagement.vue @@ -178,7 +178,10 @@ export default { goFilesMaintenance(record) { console.log(record) this.$router.push({ - path: '/projectManagement/WorkingGroupProjectDataMaintenance' + path: '/projectManagement/WorkingGroupProjectDataMaintenance', + query: { + workingGroupId: record.id, + } }) }, /** diff --git a/src/views/projectManagement/modules/GeneralProjectModule.vue b/src/views/projectManagement/modules/GeneralProjectModule.vue index bc30ec8..d75d5e0 100644 --- a/src/views/projectManagement/modules/GeneralProjectModule.vue +++ b/src/views/projectManagement/modules/GeneralProjectModule.vue @@ -154,7 +154,6 @@ - - - - - - - - + @@ -33,34 +23,52 @@ - - - - - - - - \ No newline at end of file diff --git a/src/views/projectManagement/modules/WorkGroupFileUploadModal.vue b/src/views/projectManagement/modules/WorkGroupFileUploadModal.vue index 18d96a4..4d4caf9 100644 --- a/src/views/projectManagement/modules/WorkGroupFileUploadModal.vue +++ b/src/views/projectManagement/modules/WorkGroupFileUploadModal.vue @@ -18,7 +18,7 @@ :multiple="true" :number="10" :return-id="true" - v-decorator="['dataId', validatorRules.dataId]" + v-decorator="['fileIds', validatorRules.fileIds]" :trigger-change="true"> @@ -30,12 +30,26 @@