普通项目;工作组变更--文件维护接口;批量开票

This commit is contained in:
zhaoxiao
2021-09-16 18:54:38 +08:00
parent ac559d9be7
commit a0c45be5fc
13 changed files with 442 additions and 232 deletions
+12 -2
View File
@@ -37,7 +37,8 @@ const amountReceivedList = (param) => postAction(`/paymentRecord/payPaymentRecor
// 开票列表 // 开票列表
const payBillList = (param) => postAction(`/paymentRecord/payPaymentRecord/payBillList?id=${param}`) 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) const editPayBill = (param) => postAction('/paymentRecord/payPaymentRecord/editPayBill', param)
// 普通项目管理-通过项目id查询其他的信息 // 普通项目管理-通过项目id查询其他的信息
@@ -52,6 +53,12 @@ const removePackProject = (param) => postAction('/pack/payPackCompanyProject/rem
const batchRemovePackProject = (param) => postAction('/pack/payPackCompanyProject/removeBatch', param) const batchRemovePackProject = (param) => postAction('/pack/payPackCompanyProject/removeBatch', param)
// 企业管理审核 // 企业管理审核
const aduitCompany = (param) => getAction('/company/payCompanyManagement/audit', 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 { export {
getWorkingGroupById, getWorkingGroupById,
@@ -79,5 +86,8 @@ export {
addPackProject, addPackProject,
removePackProject, removePackProject,
batchRemovePackProject, batchRemovePackProject,
aduitCompany aduitCompany,
distribute,
batchDistribute,
distributeMemberList
} }
@@ -42,6 +42,7 @@ export default {
}, },
// 下拉框的搜索 // 下拉框的搜索
filterOption(input, option) { filterOption(input, option) {
console.log(option)
return ( return (
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
) )
+79 -61
View File
@@ -11,7 +11,7 @@ export function timeFix() {
export function welcome() { export function welcome() {
const arr = ['休息一会儿吧', '准备吃什么呢?', '要不要打一把 DOTA', '我猜你可能累了'] const arr = ['休息一会儿吧', '准备吃什么呢?', '要不要打一把 DOTA', '我猜你可能累了']
let index = Math.floor((Math.random()*arr.length)) let index = Math.floor((Math.random() * arr.length))
return arr[index] return arr[index]
} }
@@ -35,7 +35,7 @@ export function filterObj(obj) {
return return
} }
for ( let key in obj) { for (let key in obj) {
// eslint-disable-next-line // eslint-disable-next-line
if (obj.hasOwnProperty(key) if (obj.hasOwnProperty(key)
&& (obj[key] == null || obj[key] == undefined || obj[key] === '')) { && (obj[key] == null || obj[key] == undefined || obj[key] === '')) {
@@ -53,7 +53,7 @@ export function filterObj(obj) {
*/ */
export function formatDate(value, fmt) { export function formatDate(value, fmt) {
let regPos = /^\d+(\.\d+)?$/ let regPos = /^\d+(\.\d+)?$/
if(regPos.test(value)){ if (regPos.test(value)) {
//如果是数字 //如果是数字
let getDate = new Date(value) let getDate = new Date(value)
let o = { let o = {
@@ -74,46 +74,46 @@ export function formatDate(value, fmt) {
} }
} }
return fmt return fmt
}else{ } else {
//TODO //TODO
value = value.trim() value = value.trim()
return value.substr(0,fmt.length) return value.substr(0, fmt.length)
} }
} }
// 生成首页路由 // 生成首页路由
export function generateIndexRouter(data) { export function generateIndexRouter(data) {
let indexRouter = [{ let indexRouter = [{
path: '/', path: '/',
name: 'dashboard', name: 'dashboard',
//component: () => import('@/components/layouts/BasicLayout'), //component: () => import('@/components/layouts/BasicLayout'),
// eslint-disable-next-line // eslint-disable-next-line
component: resolve => require(['@/components/layouts/TabLayout'], resolve), component: resolve => require(['@/components/layouts/TabLayout'], resolve),
meta: { title: '首页' }, meta: { title: '首页' },
redirect: '/dashboard/analysis', redirect: '/dashboard/analysis',
children: [ children: [
...generateChildRouters(data) ...generateChildRouters(data)
] ]
},{ }, {
'path': '*', 'redirect': '/404', 'hidden': true 'path': '*', 'redirect': '/404', 'hidden': true
}] }]
return indexRouter return indexRouter
} }
// 生成嵌套路由(子路由) // 生成嵌套路由(子路由)
function generateChildRouters (data) { function generateChildRouters(data) {
const routers = [] const routers = []
for (let item of data) { for (let item of data) {
let component = '' let component = ''
if(item.component.indexOf('layouts')>=0){ if (item.component.indexOf('layouts') >= 0) {
component = 'components/'+item.component component = 'components/' + item.component
}else{ } else {
component = 'views/'+item.component component = 'views/' + item.component
} }
// eslint-disable-next-line // 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)) { if (isURL(URL)) {
item.meta.url = URL item.meta.url = URL
} }
@@ -139,42 +139,42 @@ function generateChildRouters (data) {
// componentPath = onlineCommons.OnlCgreportAutoList // componentPath = onlineCommons.OnlCgreportAutoList
// }else{ // }else{
// eslint-disable-next-line // eslint-disable-next-line
componentPath = resolve => require(['@/' + component+'.vue'], resolve) componentPath = resolve => require(['@/' + component + '.vue'], resolve)
// } // }
let menu = { let menu = {
path: item.path, path: item.path,
name: item.name, name: item.name,
redirect:item.redirect, redirect: item.redirect,
component: componentPath, component: componentPath,
//component: resolve => require(['@/' + component+'.vue'], resolve), //component: resolve => require(['@/' + component+'.vue'], resolve),
hidden:item.hidden, hidden: item.hidden,
//component:()=> import(`@/views/${item.component}.vue`), //component:()=> import(`@/views/${item.component}.vue`),
meta: { meta: {
title:item.meta.title , title: item.meta.title,
icon: item.meta.icon, icon: item.meta.icon,
url:item.meta.url , url: item.meta.url,
permissionList:item.meta.permissionList, permissionList: item.meta.permissionList,
keepAlive:item.meta.keepAlive, keepAlive: item.meta.keepAlive,
/*update_begin author:wuxianquan date:20190908 for:赋值 */ /*update_begin author:wuxianquan date:20190908 for:赋值 */
internalOrExternal:item.meta.internalOrExternal, internalOrExternal: item.meta.internalOrExternal,
/*update_end author:wuxianquan date:20190908 for:赋值 */ /*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.alwaysShow = true
menu.redirect = menu.path menu.redirect = menu.path
} }
if (item.children && item.children.length > 0) { 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菜单)------ //--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.route '+item.route);
//console.log(' 不生成路由 item.path '+item.path); //console.log(' 不生成路由 item.path '+item.path);
}else{ } else {
routers.push(menu) routers.push(menu)
} }
//--update-end----author:scott---date:20190320------for:根据后台菜单配置,判断是否路由菜单字段,动态选择是否生成路由(为了支持参数URL菜单)------ //--update-end----author:scott---date:20190320------for:根据后台菜单配置,判断是否路由菜单字段,动态选择是否生成路由(为了支持参数URL菜单)------
@@ -208,7 +208,7 @@ export function randomNumber() {
} }
if (arguments.length === 1) { if (arguments.length === 1) {
let [length] = arguments let [length] = arguments
// 生成指定长度的随机数字,首位一定不是 0 // 生成指定长度的随机数字,首位一定不是 0
let nums = [...Array(length).keys()].map((i) => (i > 0 ? random(0, 9) : random(1, 9))) let nums = [...Array(length).keys()].map((i) => (i > 0 ? random(0, 9) : random(1, 9)))
return parseInt(nums.join('')) return parseInt(nums.join(''))
} else if (arguments.length >= 2) { } else if (arguments.length >= 2) {
@@ -250,8 +250,8 @@ export function randomUUID() {
* @param string * @param string
* @returns {*} * @returns {*}
*/ */
export function underLine2CamelCase(string){ export function underLine2CamelCase(string) {
return string.replace( /_([a-z])/g, function( all, letter ) { return string.replace(/_([a-z])/g, function (all, letter) {
return letter.toUpperCase() return letter.toUpperCase()
}) })
} }
@@ -261,8 +261,8 @@ export function underLine2CamelCase(string){
* @param bpmStatus * @param bpmStatus
* @returns {*} * @returns {*}
*/ */
export function showDealBtn(bpmStatus){ export function showDealBtn(bpmStatus) {
if(bpmStatus!='1'&&bpmStatus!='3'&&bpmStatus!='4'){ if (bpmStatus != '1' && bpmStatus != '3' && bpmStatus != '4') {
return true return true
} }
return false return false
@@ -276,7 +276,7 @@ export function showDealBtn(bpmStatus){
export function cssExpand(css, id) { export function cssExpand(css, id) {
let style = document.createElement('style') let style = document.createElement('style')
style.type = 'text/css' style.type = 'text/css'
style.innerHTML = `@charset "UTF-8"; ${css}` style.innerHTML = `@charset "UTF-8"; ${ css }`
// 清除旧样式 // 清除旧样式
if (id) { if (id) {
let $style = document.getElementById(id) let $style = document.getElementById(id)
@@ -307,16 +307,16 @@ export function jsExpand(options = {}) {
let id = randomString(16, 'qwertyuioplkjhgfdsazxcvbnm'.toUpperCase()) let id = randomString(16, 'qwertyuioplkjhgfdsazxcvbnm'.toUpperCase())
// 封装按钮点击事件 // 封装按钮点击事件
let code = ` let code = `
(function (o_${id}) { (function (o_${ id }) {
try { try {
(function (globalEvent, vm) { (function (globalEvent, vm) {
${options.jsCode} ${ options.jsCode }
})(o_${id}.event, o_${id}.vm) })(o_${ id }.event, o_${ id }.vm)
} catch (e) { } catch (e) {
o_${id}.error(e) o_${ id }.error(e)
} }
o_${id}.done() o_${ id }.done()
})(window['${windowKeyName}']['EVENT_${id}']) })(window['${ windowKeyName }']['EVENT_${ id }'])
` `
// 创建script标签 // 创建script标签
const script = document.createElement('script') const script = document.createElement('script')
@@ -332,7 +332,7 @@ export function jsExpand(options = {}) {
}, },
// 当js运行出错的时候调用的事件 // 当js运行出错的时候调用的事件
error(e) { error(e) {
console.group(`${options.errorMessage || '用户自定义JS增强代码运行出错'}${new Date()}`) console.group(`${ options.errorMessage || '用户自定义JS增强代码运行出错' }${ new Date() }`)
console.error(e) console.error(e)
console.groupEnd() console.groupEnd()
} }
@@ -555,16 +555,17 @@ export function neverNull(value, def) {
*/ */
export function removeArrayElement(array, prod, value) { export function removeArrayElement(array, prod, value) {
let index = -1 let index = -1
for(let i = 0;i<array.length;i++){ for (let i = 0; i < array.length; i++) {
if(array[i][prod] == value){ if (array[i][prod] == value) {
index = i index = i
break break
} }
} }
if(index>=0){ if (index >= 0) {
array.splice(index, 1) array.splice(index, 1)
} }
} }
/** /**
* 前端加密方法 * 前端加密方法
* @param publicKey:公钥 * @param publicKey:公钥
@@ -576,13 +577,14 @@ export function encrypt(publicKey, message) {
const txt = encrypt.encrypt(message) const txt = encrypt.encrypt(message)
return txt return txt
} }
/** /**
* 校验数组是否有重复的元素 * 校验数组是否有重复的元素
* */ * */
export function isRepeat(arr) { export function isRepeat(arr) {
var hash = {} var hash = {}
for(var i in arr) { for (var i in arr) {
if(hash[arr[i]]) { if (hash[arr[i]]) {
return true return true
} }
// 不存在该元素,则赋值为true,可以赋任意值,相应的修改if判断条件即可 // 不存在该元素,则赋值为true,可以赋任意值,相应的修改if判断条件即可
@@ -590,6 +592,7 @@ export function isRepeat(arr) {
} }
return false return false
} }
/** /**
* 补充0 * 补充0
* */ * */
@@ -613,14 +616,29 @@ export function addZero(e) {
// 大于等于2 // 大于等于2
if (afterPointValue.length >= 2) { if (afterPointValue.length >= 2) {
e.target.value = beforePointValue + afterPointValue e.target.value = beforePointValue + afterPointValue
}else { } else {
// 不足2位补0 // 不足2位补0
afterPointValue = afterPointValue.padEnd(2,'0') afterPointValue = afterPointValue.padEnd(2, '0')
e.target.value = beforePointValue + afterPointValue 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
}
}
@@ -47,6 +47,7 @@
<!-- 操作按钮区域--> <!-- 操作按钮区域-->
<div class="table-operator"> <div class="table-operator">
<a-button type="primary" icon="export" @click="handleExportXls('到账开票')">导出</a-button> <a-button type="primary" icon="export" @click="handleExportXls('到账开票')">导出</a-button>
<a-button type="primary" icon="file-text" @click="batchInvoicing">合并开票</a-button>
</div> </div>
<!-- 操作按钮区域-end--> <!-- 操作按钮区域-end-->
@@ -87,7 +88,7 @@
<span slot="action" class="action-span-cell" slot-scope="text, record"> <span slot="action" class="action-span-cell" slot-scope="text, record">
<a @click="incomePayment(record.id)">来款</a> <a @click="incomePayment(record.id)">来款</a>
<a @click="invoicing(record)">开票</a> <a @click="invoicing(record)" :disabled="record.needInvoice === 0">开票</a>
</span> </span>
</a-table> </a-table>
</div> </div>
@@ -108,6 +109,11 @@
:visible.sync="invoicingVisible" :visible.sync="invoicingVisible"
:charge-company-name="selectProjectChargeCompanyName"></invoicing-stage-module> :charge-company-name="selectProjectChargeCompanyName"></invoicing-stage-module>
<project-detail-modal ref="projectDetail"></project-detail-modal> <project-detail-modal ref="projectDetail"></project-detail-modal>
<!-- 批量开票-->
<batch-invoicing-module
:selected-data="selectedProject"
:visible.sync="batchInvoicingVisible">
</batch-invoicing-module>
</div> </div>
</template> </template>
@@ -121,6 +127,8 @@ import ArriveStageModule from './modules/ArriveStageModule'
import InvoicingStageModule from './modules/InvoicingStageModule' import InvoicingStageModule from './modules/InvoicingStageModule'
import SelectPrincipal from '../../../components/company/SelectPrincipal' import SelectPrincipal from '../../../components/company/SelectPrincipal'
import ProjectDetailModal from '../../../components/ProjectDetailModal' import ProjectDetailModal from '../../../components/ProjectDetailModal'
import BatchInvoicingModule from '../../packManagement/modules/BatchInvoicingModule'
import { isAllEqual } from '../../../utils/util'
export default { export default {
name: 'ArriveAndInvoivingList', name: 'ArriveAndInvoivingList',
@@ -131,7 +139,8 @@ export default {
ArriveStageModule, ArriveStageModule,
InvoicingStageModule, InvoicingStageModule,
SelectPrincipal, SelectPrincipal,
ProjectDetailModal ProjectDetailModal,
BatchInvoicingModule
}, },
mixins: [JeroListMixin], mixins: [JeroListMixin],
data() { data() {
@@ -237,7 +246,9 @@ export default {
selectProjectName: null, // 选中项目名称open selectProjectName: null, // 选中项目名称open
selectProjectChargeCompanyName: null, // 选中项目来款企业 selectProjectChargeCompanyName: null, // 选中项目来款企业
invoicingVisible: false, invoicingVisible: false,
arriveVisible: false arriveVisible: false,
selectedProject: [],
batchInvoicingVisible: false
} }
}, },
methods: { methods: {
@@ -260,6 +271,61 @@ export default {
this.selectProjectName = record.chargeProject this.selectProjectName = record.chargeProject
this.selectProjectChargeCompanyName = record.chargeCompanyTemporaryName this.selectProjectChargeCompanyName = record.chargeCompanyTemporaryName
this.invoicingVisible = true 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<unknown>}
*/
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)
})
} }
} }
} }
@@ -169,7 +169,7 @@ export default {
dataSource: [], dataSource: [],
inputIncomingAmount: null, // 输入的来款金额 inputIncomingAmount: null, // 输入的来款金额
disableMixinCreated: true, disableMixinCreated: true,
sumAmountOwed: 0, // 总欠款金额 sumAmountOwed: 0 // 总欠款金额
} }
}, },
methods: { methods: {
@@ -203,6 +203,7 @@ export default {
this.loadData() this.loadData()
}, },
close() { close() {
this.form.resetFields()
this.clearThisTimeAmount() this.clearThisTimeAmount()
this.$emit('update:visible', false) this.$emit('update:visible', false)
}, },
@@ -218,21 +219,16 @@ export default {
this.$message.warn('来款金额大于总欠款金额,请修改') this.$message.warn('来款金额大于总欠款金额,请修改')
return return
} }
this.clearThisTimeAmount().then(() => { this.clearThisTimeAmount()
this.calculateThisTimeAmount() this.calculateThisTimeAmount()
this.$forceUpdate()
})
}, },
/** /**
* 清空本次来款金额 * 清空本次来款金额
* @returns {Promise<unknown>} * @returns {Promise<unknown>}
*/ */
clearThisTimeAmount() { clearThisTimeAmount() {
return new Promise(resolve => { this.dataSource.forEach(item => {
this.dataSource.forEach(item => { item.thisIncomingAmount = 0.00
item.thisIncomingAmount = 0.00
})
resolve()
}) })
}, },
/** /**
@@ -243,23 +239,22 @@ export default {
this.$message.warn('请输入大于0的来款金额') this.$message.warn('请输入大于0的来款金额')
return return
} }
this.dataSource.forEach(item => { this.dataSource.forEach((item, index) => {
// 当前项目欠款是否 >0 // 当前项目欠款是否 >0
if (Number(item.amountOwed) > 0) { if (Number(item.amountOwed) > 0) {
// 输入的来款金额是否 >= 当前项目欠款 // 输入的来款金额是否 >= 当前项目欠款
if (this.inputIncomingAmount >= Number(item.amountOwed)) { if (this.inputIncomingAmount >= Number(item.amountOwed)) {
item.thisIncomingAmount = this.getAddZero(Number(item.amountOwed)) item.thisIncomingAmount = this.getAddZero(Number(item.amountOwed))
this.inputIncomingAmount -= Number(item.amountOwed) this.inputIncomingAmount -= Number(item.amountOwed)
// item.amountOwed = 0
} else { } else {
// 输入的来款金额小于当前项目欠款且剩余的输入来款金额大于0,则将剩余全部来款算入当前项目的此次来款 // 输入的来款金额小于当前项目欠款且剩余的输入来款金额大于0,则将剩余全部来款算入当前项目的此次来款
if (this.inputIncomingAmount > 0) { if (this.inputIncomingAmount > 0) {
item.thisIncomingAmount = this.getAddZero(this.inputIncomingAmount) item.thisIncomingAmount = this.getAddZero(this.inputIncomingAmount)
// item.amountOwed = Number(item.amountOwed) - item.thisIncomingAmount
this.inputIncomingAmount = 0 this.inputIncomingAmount = 0
} }
} }
} }
this.$set(this.dataSource, index, item)
}) })
} }
, ,
@@ -14,7 +14,7 @@
<a-col :xl="12" :sm="24"> <a-col :xl="12" :sm="24">
<a-form-item label="开票金额" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="开票金额" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入开票金额" <a-input placeholder="请输入开票金额"
v-decorator="['invoicingAmount',validatorRules.invoicingAmount]" v-decorator="['invoiceAmount',validatorRules.invoiceAmount]"
:maxLength='50' :maxLength='50'
@blur="invoicingAmountBlur" @blur="invoicingAmountBlur"
@change="(e) => {e.target.value = (e.target.value.replace(/[^0-9.]/g,'')).trim()}"></a-input> @change="(e) => {e.target.value = (e.target.value.replace(/[^0-9.]/g,'')).trim()}"></a-input>
@@ -23,7 +23,7 @@
<a-col :xl="12" :sm="24"> <a-col :xl="12" :sm="24">
<a-form-item label="开票号" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="开票号" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入开票号" <a-input placeholder="请输入开票号"
v-decorator="['invoicingNum', validatorRules.invoicingNum]" v-decorator="['billNo', validatorRules.billNo]"
:maxLength='50' :maxLength='50'
@change="e => {e.target.value = (e.target.value + '').trim()}"></a-input> @change="e => {e.target.value = (e.target.value + '').trim()}"></a-input>
</a-form-item> </a-form-item>
@@ -34,7 +34,7 @@
<a-form-item label="开票时间" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="开票时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-date placeholder="请选择开票时间" <j-date placeholder="请选择开票时间"
style="width: 100%;" style="width: 100%;"
v-decorator="['invoicingTime', validatorRules.invoicingTime]" v-decorator="['billDate', validatorRules.billDate]"
:trigger-change="true" :trigger-change="true"
v-bind="$attrs" v-bind="$attrs"
date-format="YYYY-MM-DD"/> date-format="YYYY-MM-DD"/>
@@ -56,9 +56,9 @@
</template> </template>
<!-- 输入--> <!-- 输入-->
<template slot="input-text"> <template slot="input-text" slot-scope="text, record">
<a-input placeholder="请输入备注" <a-input placeholder="请输入备注"
v-decorator="['remark']" v-model="record.remark"
:maxLength='50' :maxLength='50'
@change="e => {e.target.value = (e.target.value + '').trim()}"></a-input> @change="e => {e.target.value = (e.target.value + '').trim()}"></a-input>
</template> </template>
@@ -77,6 +77,7 @@
import JDate from '../../../components/tools/JDate' import JDate from '../../../components/tools/JDate'
import { money } from '../../../utils/validate' import { money } from '../../../utils/validate'
import { addZero } from '../../../utils/util' import { addZero } from '../../../utils/util'
import { addPayBill } from '../../../api/incomePaymentsApi'
export default { export default {
name: 'BatchInvoicingModule', name: 'BatchInvoicingModule',
@@ -148,7 +149,7 @@ export default {
title: '已开票金额', title: '已开票金额',
align: 'center', align: 'center',
width: 100, width: 100,
dataIndex: 'paidAmount' dataIndex: 'invoiceAmount'
}, { }, {
title: '本次开票金额', title: '本次开票金额',
align: 'center', align: 'center',
@@ -164,7 +165,7 @@ export default {
], ],
dataSource: [], dataSource: [],
validatorRules: { validatorRules: {
invoicingAmount: { invoiceAmount: {
rules: [{ required: true, validator: this.checkMoney }], rules: [{ required: true, validator: this.checkMoney }],
validateTrigger: 'blur' validateTrigger: 'blur'
}, },
@@ -172,7 +173,7 @@ export default {
rules: [{ required: true, message: '请输入开票号' }], rules: [{ required: true, message: '请输入开票号' }],
validateTrigger: 'blur' validateTrigger: 'blur'
}, },
invoicingTime: { billDate: {
rules: [{ required: true, message: '请选择开票时间' }], rules: [{ required: true, message: '请选择开票时间' }],
validateTrigger: 'blur' validateTrigger: 'blur'
} }
@@ -198,10 +199,11 @@ export default {
return e.target.value return e.target.value
}, },
loadData() { loadData() {
// 计算项目欠款信息 // 计算项目未开票金额信息
this.dataSource.forEach(item => { this.dataSource.forEach(item => {
let amountOwed = Number(item.receivableAmount) - Number(item.paidAmount) let amountOwed = Number(item.receivableAmount) - Number(item.invoiceAmount)
item.amountOwed = this.getAddZero(amountOwed) item.amountOwed = this.getAddZero(amountOwed)
item.thisInvoicingAmount = 0
this.sumAmountOwed += Number(item.amountOwed) this.sumAmountOwed += Number(item.amountOwed)
}) })
this.$forceUpdate() this.$forceUpdate()
@@ -217,52 +219,72 @@ export default {
this.$message.warn('开票金额大于总未开票金额,请修改') this.$message.warn('开票金额大于总未开票金额,请修改')
return return
} }
this.clearThisTimeAmount().then(() => { this.clearThisTimeAmount()
this.calculateThisTimeAmount() this.calculateThisTimeAmount()
this.$forceUpdate()
})
}, },
/** /**
* 清空本次来款金额 * 清空本次开票金额
* @returns {Promise<unknown>} * @returns {Promise<unknown>}
*/ */
clearThisTimeAmount() { clearThisTimeAmount() {
return new Promise(resolve => { this.dataSource.forEach(item => {
this.dataSource.forEach(item => { item.thisInvoicingAmount = 0
item.thisInvoicingAmount = null
})
resolve()
}) })
}, },
/** /**
* 计算此次来款信息 * 计算此次开票信息
*/ */
calculateThisTimeAmount() { calculateThisTimeAmount() {
if (this.inputInvoicingAmount <= 0) { if (this.inputInvoicingAmount <= 0) {
this.$message.warn('请输入大于0的来款金额') this.$message.warn('请输入大于0的开票金额')
return return
} }
this.dataSource.forEach(item => { this.dataSource.forEach((item, index) => {
// 当前项目欠款是否 >0 // 当前项目欠款是否 >0
if (Number(item.amountOwed) > 0) { if (Number(item.amountOwed) > 0) {
// 输入的来款金额是否 >= 当前项目欠款 // 输入的开票金额是否 >= 当前项目欠款
if (this.inputInvoicingAmount >= Number(item.amountOwed)) { if (this.inputInvoicingAmount >= Number(item.amountOwed)) {
item.thisInvoicingAmount = this.getAddZero(Number(item.amountOwed)) item.thisInvoicingAmount = this.getAddZero(Number(item.amountOwed))
this.inputInvoicingAmount -= Number(item.amountOwed) this.inputInvoicingAmount -= Number(item.amountOwed)
// item.amountOwed = 0
} else { } else {
// 输入的来款金额小于当前项目欠款且剩余的输入来款金额大于0,则将剩余全部来款算入当前项目的此次来款 // 输入的开票金额小于当前项目欠款且剩余的输入开票金额大于0,则将剩余全部开票算入当前项目的此次开票
if (this.inputInvoicingAmount > 0) { if (this.inputInvoicingAmount > 0) {
item.thisInvoicingAmount = this.getAddZero(this.inputInvoicingAmount) item.thisInvoicingAmount = this.getAddZero(this.inputInvoicingAmount)
// item.amountOwed = Number(item.amountOwed) - item.thisIncomingAmount
this.inputInvoicingAmount = 0 this.inputInvoicingAmount = 0
} }
} }
} }
this.$set(this.dataSource, index, item)
}) })
}, },
handleOk() { handleOk() {
this.form.validateFields((err, values) => {
if (!err) {
let bmpList = []
let data = this.dataSource.filter(tt => tt.thisInvoicingAmount !== 0 && tt.thisInvoicingAmount)
data.forEach(item => {
let obj = {
invoiceAmount: item.thisInvoicingAmount,
projectId: item.id,
projectType: item.projectType,
remark: item.remark
}
bmpList.push(obj)
})
let param = values
param.bmpList = bmpList
console.log(param)
addPayBill(param).then(res => {
if (res.success) {
this.$message.success(res.message)
this.close()
this.$emit('ok')
} else {
this.$message.warn(res.message)
}
})
}
})
}, },
handleCancel() { handleCancel() {
this.close() this.close()
@@ -272,6 +294,8 @@ export default {
this.loadData() this.loadData()
}, },
close() { close() {
this.form.resetFields()
this.clearThisTimeAmount()
this.$emit('update:visible', false) this.$emit('update:visible', false)
}, },
/** /**
@@ -23,7 +23,7 @@
</a-col> </a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="来款用途" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="来款用途" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag v-model="queryParam.chargeUse" placeholder="请选择来款用途" dictCode="payment_charge_use"/> <j-dict-select-tag v-model="queryParam.chargeUse" placeholder="请选择来款用途" dictCode="payment_charge_use" show-search/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-col :xl="6" :lg="7" :md="8" :sm="24">
@@ -44,6 +44,11 @@
<a-input placeholder="请输入成员单位" v-model="queryParam.chargeCompanyTemporaryName"></a-input> <a-input placeholder="请输入成员单位" v-model="queryParam.chargeCompanyTemporaryName"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="来款状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag v-model="queryParam.chargeStatus " placeholder="请选择来款状态" dictCode="work_group_charge_status"/>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="来款年份" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="来款年份" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-year-date style="width:100%" placeholder="请选择年份" v-model="queryParam.paymentDate"></j-year-date> <j-year-date style="width:100%" placeholder="请选择年份" v-model="queryParam.paymentDate"></j-year-date>
@@ -71,6 +76,7 @@
<a-button type="primary" icon="download" @click="downTemplate('工作组成员导入模板')">下载模板</a-button> <a-button type="primary" icon="download" @click="downTemplate('工作组成员导入模板')">下载模板</a-button>
<a-button type="danger" icon="delete" @click="batchDel">批量删除</a-button> <a-button type="danger" icon="delete" @click="batchDel">批量删除</a-button>
<a-button type="primary" @click="setChargeNotic">设置收费通知</a-button> <a-button type="primary" @click="setChargeNotic">设置收费通知</a-button>
<a-button type="primary" @click="setDunningReminder">催款提醒</a-button>
</div> </div>
<!-- /操作按钮区域-end--> <!-- /操作按钮区域-end-->
@@ -388,6 +394,15 @@ export default {
} }
}) })
}, },
/**
* 催款提醒
*/
setDunningReminder() {
if (this.selectedRowKeys.length === 0) {
this.$message.warn('请先选择成员')
return
}
},
/** /**
* 文件预览 * 文件预览
* @param file * @param file
@@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<page-header-title level-two-title="工作组资料维护" :is-level-one="false"></page-header-title> <page-header-title level-two-title="资料维护" :is-level-one="false"></page-header-title>
<a-card :bordered="false"> <a-card :bordered="false">
<!-- 查询区域-start --> <!-- 查询区域-start -->
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
@@ -26,7 +26,7 @@
<a-button type="primary" icon="plus" @click="handleAdd">上传</a-button> <a-button type="primary" icon="plus" @click="handleAdd">上传</a-button>
<a-button type="danger" icon="delete" @click="batchDel">批量删除</a-button> <a-button type="danger" icon="delete" @click="batchDel">批量删除</a-button>
<a-button type="primary" @click="batchDistribute">批量分发</a-button> <a-button type="primary" @click="batchDistribute">批量分发</a-button>
<a-button type="primary" icon="export" @click="handleExportXls('工作组来款统计')">导出</a-button> <a-button type="primary" icon="export" @click="handleExportXls('资料维护列表')">导出</a-button>
</div> </div>
<!-- 操作按钮区域-end--> <!-- 操作按钮区域-end-->
@@ -41,8 +41,9 @@
:dataSource="dataSource" :dataSource="dataSource"
:pagination="ipagination" :pagination="ipagination"
:loading="loading" :loading="loading"
:scroll="{x: 1100}" :scroll="{x: 1200}"
@change="handleTableChange" @change="handleTableChange"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap main-table"> class="j-table-force-nowrap main-table">
<!-- 项目名称--> <!-- 项目名称-->
@@ -52,20 +53,32 @@
</template> </template>
<template slot="text" slot-scope="text"> <template slot="text" slot-scope="text">
<j-ellipsis :value="text" :length="18"></j-ellipsis> <j-ellipsis :value="text" :length="20"></j-ellipsis>
</template> </template>
<span slot="action" class="action-span-cell" slot-scope="text, record"> <span slot="action" class="action-span-cell" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a> <a @click="handleDistribute(record.id)">分发</a>
<a @click="handleDistribute(record)">分发</a>
<a @click="handleDelete(record.id)">删除</a> <a @click="handleDelete(record.id)">删除</a>
</span> </span>
</a-table> </a-table>
</div> </div>
</a-card> </a-card>
<work-group-file-upload-modal ref="modalForm" @ok="modalFormOk"></work-group-file-upload-modal> <!-- 上传-->
<work-group-distribute-module ref="distributeModal" @ok="modalFormOk"></work-group-distribute-module> <work-group-file-upload-modal
ref="modalForm"
@ok="modalFormOk"
:project-id="projectId"
:project-type="projectType"></work-group-file-upload-modal>
<!-- 分发-->
<work-group-distribute-module
ref="distributeModal"
:visible.sync="distributeModalVisible"
:project-id="projectId"
:project-type="projectType"
:is-batch="isBatchDistribute"
:record-id="dataId"
@ok="modalFormOk"></work-group-distribute-module>
</div> </div>
</template> </template>
@@ -90,10 +103,10 @@ export default {
sm: { span: 10 } sm: { span: 10 }
}, },
url: { url: {
list: '', list: '/project/payWorkingGroupDataFile/list',
exportXlsUrl: '', exportXlsUrl: '/project/payWorkingGroupDataFile/exportXls',
delete: '', delete: '/project/payWorkingGroupDataFile/delete',
deleteBatch: '' deleteBatch: '/project/payWorkingGroupDataFile/deleteBatch'
}, },
columns: [ columns: [
{ {
@@ -108,25 +121,25 @@ export default {
}, { }, {
title: '文件名称', title: '文件名称',
align: 'center', align: 'center',
dataIndex: 'workGroup', dataIndex: 'fileName',
scopedSlots: { customRender: 'text' } scopedSlots: { customRender: 'text' }
}, { }, {
title: '下载次数', title: '下载次数',
align: 'center', align: 'center',
width: 160, width: 160,
dataIndex: 'allMoney', dataIndex: 'downloadCount',
scopedSlots: { customRender: 'text' } scopedSlots: { customRender: 'text' }
}, { }, {
title: '上传时间', title: '上传时间',
align: 'center', align: 'center',
width: 160, width: 220,
dataIndex: 'comeAllMoney', dataIndex: 'createTime',
scopedSlots: { customRender: 'text' } scopedSlots: { customRender: 'text' }
}, { }, {
title: '上传人', title: '上传人',
align: 'center', align: 'center',
width: 160, width: 160,
dataIndex: 'moneyRate', dataIndex: 'createBy',
scopedSlots: { customRender: 'text' } scopedSlots: { customRender: 'text' }
}, { }, {
title: '操作', title: '操作',
@@ -137,20 +150,49 @@ export default {
scopedSlots: { customRender: 'action' } 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: { methods: {
/** /**
* 批量分发 * 批量分发
*/ */
batchDistribute() { 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() { handleDistribute(id) {
this.$refs.distributeModal.edit() this.dataId = id
this.distributeModalVisible = true
this.isBatchDistribute = false
} }
} }
} }
@@ -178,7 +178,10 @@ export default {
goFilesMaintenance(record) { goFilesMaintenance(record) {
console.log(record) console.log(record)
this.$router.push({ this.$router.push({
path: '/projectManagement/WorkingGroupProjectDataMaintenance' path: '/projectManagement/WorkingGroupProjectDataMaintenance',
query: {
workingGroupId: record.id,
}
}) })
}, },
/** /**
@@ -154,7 +154,6 @@
<a-form-item label="资料" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="资料" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-upload file-type="pdf" <j-upload file-type="pdf"
file-type-error-message="请pdf文件" file-type-error-message="请pdf文件"
:multiple="false"
:return-id="true" :return-id="true"
bizPath="payment" bizPath="payment"
v-decorator="['files', validatorRules.files]" v-decorator="['files', validatorRules.files]"
@@ -9,17 +9,7 @@
@cancel="handleCancel" @cancel="handleCancel"
cancelText="关闭"> cancelText="关闭">
<a-spin :spinning="confirmLoading"> <a-spin :spinning="confirmLoading">
<a-form :form="form"> <a-form>
<a-row>
<a-col>
<a-form-item label="文件" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-upload :return-id="true"
class="no-upload"
v-decorator="['dataId', validatorRules.dataId]"
:trigger-change="true"></j-upload>
</a-form-item>
</a-col>
</a-row>
<a-row> <a-row>
<a-col :span="2"></a-col> <a-col :span="2"></a-col>
<a-col :span="20"> <a-col :span="20">
@@ -33,34 +23,52 @@
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row>
<a-col :span="4"></a-col>
<a-col :span="20">
<a-form-item class="choose-member">
<a-input v-decorator="['memberName', validatorRules.memberName]"></a-input>
</a-form-item>
</a-col>
</a-row>
</a-form> </a-form>
</a-spin> </a-spin>
</j-modal> </j-modal>
</template> </template>
<script> <script>
import pick from 'lodash.pick' import { distribute, batchDistribute, distributeMemberList } from '../../../api/incomePaymentsApi'
import { getAction } from '@api/manage'
import JUpload from '@comp/jero/JUpload'
export default { export default {
name: 'WorkGroupDistributeModule', name: 'WorkGroupDistributeModule',
components: { JUpload }, props: {
// 项目id
projectId: {
type: String,
required: false,
default: ''
},
// 项目类型:1--工作组;2--分标委
projectType: {
type: Number,
required: false,
default: null
},
// 分发资料id
recordId: {
type: String,
required: false,
default: null
},
// 是否批量分发
isBatch: {
type: Boolean,
required: false,
default: false
},
visible: {
type: Boolean,
required: false,
default: false
}
},
data() { data() {
return { return {
title: '分发', title: '分发',
width: 500, width: 500,
visible: false,
confirmLoading: false, confirmLoading: false,
form: this.$form.createForm(this),
model: {},
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 5 } sm: { span: 5 }
@@ -71,10 +79,9 @@ export default {
}, },
memberList: [], // 成员树 memberList: [], // 成员树
checkedKeys: [], // 已选中的成员数组 checkedKeys: [], // 已选中的成员数组
businessSelectedRowKeys: [],
replaceFields: { replaceFields: {
children: 'children', children: 'children',
title: 'contactsName', title: 'name',
value: 'id', value: 'id',
key: 'id' key: 'id'
}, },
@@ -95,46 +102,79 @@ export default {
} }
} }
}, },
created() {
this.initData()
},
methods: { methods: {
select(value) { /**
// 群组value===id去获取成员数据 * 获取成员列表
if (value) { */
getAction(this.url.memberList, { id: value }).then(res=>{ getMemberList() {
if (res.success) { let param = {
let tempArr = JSON.parse(JSON.stringify(res.result)) projectId: this.projectId,
this.memberList = [ { contactsName: '全选', children: [...tempArr] }] projectType: this.projectType
}
})
} }
distributeMemberList(param).then(res => {
if (res.success) {
this.memberList = res.result
} else {
console.log(res.message)
}
})
}, },
onCheck(checkedKeys) { onCheck(checkedKeys) {
this.checkedKeys = checkedKeys this.checkedKeys = checkedKeys
}, },
edit(record) { /**
this.form.resetFields() * 初始化数据
console.log(record) */
this.model = Object.assign({}, record) initData() {
this.visible = true this.checkedKeys = []
this.$nextTick(() => { this.getMemberList()
this.form.setFieldsValue(pick(this.model, 'dataId' ))
})
}, },
close() { close() {
this.$emit('update:visible', false)
this.$emit('close') this.$emit('close')
this.visible = false
this.memberList = [] this.memberList = []
}, },
handleOk() { handleOk() {
let arr = JSON.parse(JSON.stringify(this.checkedKeys)) if (this.isBatch) {
this.model = Object.assign(this.model, {memberName: arr.toString()}) // 批量分发
this.form.setFieldsValue({memberName: arr.toString()}) const formData = {
// 触发表单验证 contactsIds: this.checkedKeys.join(','),
this.form.validateFields((err, values) => { dataIds: this.recordId,
if (!err) { projectId: this.projectId,
console.log(values) projectType: this.projectType
// 请求分发,或者批量分发接口
} }
}) batchDistribute(formData).then(res => {
console.log(res)
if (res.success) {
this.$message.success(res.message)
this.close()
this.$emit('ok')
} else {
this.$message.warn(res.message)
}
})
} else {
// 单个分发
const formData = {
contactsId: this.checkedKeys.join(','),
dataId: this.recordId,
projectId: this.projectId,
projectType: this.projectType
}
distribute(formData).then(res => {
console.log(res)
if (res.success) {
this.$message.success(res.message)
this.close()
this.$emit('ok')
} else {
this.$message.warn(res.message)
}
})
}
}, },
handleCancel() { handleCancel() {
this.close() this.close()
@@ -144,20 +184,23 @@ export default {
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.no-upload{ .no-upload {
/deep/.ant-upload-select-text{ /deep/ .ant-upload-select-text {
display: none; display: none;
} }
} }
/deep/.ant-form-explain{
/deep/ .ant-form-explain {
margin-top: 10px; margin-top: 10px;
} }
/deep/.ant-checkbox-group{
/deep/ .ant-checkbox-group {
width: 100%; width: 100%;
} }
.choose-member{
/deep/#memberName{ .choose-member {
display:none; /deep/ #memberName {
display: none;
} }
} }
</style> </style>
@@ -18,7 +18,7 @@
:multiple="true" :multiple="true"
:number="10" :number="10"
:return-id="true" :return-id="true"
v-decorator="['dataId', validatorRules.dataId]" v-decorator="['fileIds', validatorRules.fileIds]"
:trigger-change="true"></j-upload> :trigger-change="true"></j-upload>
</a-form-item> </a-form-item>
</a-col> </a-col>
@@ -30,12 +30,26 @@
<script> <script>
import pick from 'lodash.pick' import pick from 'lodash.pick'
import { getAction } from '@api/manage' import { postAction } from '../../../api/manage'
import JUpload from '@comp/jero/JUpload' import JUpload from '@comp/jero/JUpload'
export default { export default {
name: 'WorkGroupFileUploadModal', name: 'WorkGroupFileUploadModal',
components: { JUpload }, components: { JUpload },
props: {
// 项目id
projectId: {
type: String,
required: false,
default: ''
},
// 项目类型:1--工作组;2--分标委
projectType: {
type: Number,
require: false,
default: null
}
},
data() { data() {
return { return {
title: '编辑', title: '编辑',
@@ -54,19 +68,16 @@ export default {
sm: { span: 17 } sm: { span: 17 }
}, },
validatorRules: { validatorRules: {
dataId: { fileIds: {
rules: [{ required: true, message: '请上传文件' }], rules: [{ required: true, message: '请上传文件' }],
validateTrigger: 'change' validateTrigger: 'change'
} }
}, },
url: { url: {
add: '', // 资料和会议的添加 post add: '/project/payWorkingGroupDataFile/add', // 资料上传
edit: '', // 资料和会议的编辑 post edit: '' // 资料和会议的编辑 post
} }
} }
},
created(){
}, },
methods: { methods: {
add(data) { add(data) {
@@ -78,7 +89,7 @@ export default {
this.model = Object.assign({}, record) this.model = Object.assign({}, record)
this.visible = true this.visible = true
this.$nextTick(() => { this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'dataId' )) this.form.setFieldsValue(pick(this.model, 'dataId'))
}) })
}, },
close() { close() {
@@ -86,41 +97,24 @@ export default {
this.visible = false this.visible = false
}, },
handleOk() { handleOk() {
const that = this
// 触发表单验证 // 触发表单验证
this.form.validateFields((err, values) => { this.form.validateFields((err, values) => {
if (!err) { if (!err) {
console.log(values) console.log(values)
let httpurl = '' let params = values
let params = {} params.projectId = this.projectId
if (!this.model.keyId) { params.projectType = this.projectType
httpurl += this.url.add postAction(this.url.add, params).then((res) => {
params = { if (res.success) {
dataId: values.fileId, // 目录id this.$message.success(res.message)
dataType: this.dataType, // 上传类型 this.$emit('ok')
fileIds: values.dataId // 资料id this.close()
} } else {
} else { this.$message.warning(res.message)
httpurl += this.url.edit }
params = { }).finally(() => {
dataId: values.fileId, // 目录id this.confirmLoading = false
dataType: this.dataType, // 上传类型 })
fileIds: values.dataId, // 资料id
keyId: this.record.keyId, // 主键id
oldFileId: this.record.dataId // 旧文件id
}
}
getAction(httpurl, params).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
that.close()
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
})
} }
}) })
}, },