|
@@ -585,6 +585,7 @@ module.exports = app => {
|
|
|
await this._filterPayStage(ctx, company, qi);
|
|
|
} catch (err) {
|
|
|
this.log(err);
|
|
|
+ ctx.session.postError = err.toString();
|
|
|
ctx.redirect(`/sp/${ctx.subProject.id}/dashboard`);
|
|
|
}
|
|
|
}
|
|
@@ -617,9 +618,9 @@ module.exports = app => {
|
|
|
if (!userCompany) {
|
|
|
throw '请联系管理员添加用户所在单位信息';
|
|
|
}
|
|
|
- const userOrderList = await ctx.service.financialPayStage.getUserOrderList(ctx.subProject.id, userCompany ? userCompany.id : 0);
|
|
|
- const userCompanyList = await ctx.service.financialPayStage.getUserCompanyList(ctx.subProject.id, userCompany ? userCompany.id : 0, unitList);
|
|
|
const companyInfo = company ? ctx.helper._.find(unitList, { name: company }) : null;
|
|
|
+ const userOrderList = await ctx.service.financialPayStage.getUserOrderList(ctx.subProject.id, userCompany ? userCompany.id : 0, companyInfo ? companyInfo.id : null);
|
|
|
+ const userCompanyList = await ctx.service.financialPayStage.getUserCompanyList(ctx.subProject.id, userCompany ? userCompany.id : 0, unitList, qi);
|
|
|
const payList = await ctx.service.financialPayStage.getListByStatus(ctx.subProject.id, companyInfo ? companyInfo.id : null, userCompany ? userCompany.id : 0, qi);
|
|
|
const total = await ctx.service.financialPayStage.getCountByStatus(ctx.subProject.id, companyInfo ? companyInfo.id : null, userCompany ? userCompany.id : 0, qi);
|
|
|
// 分页相关
|
|
@@ -782,7 +783,8 @@ module.exports = app => {
|
|
|
await this._filterPay(ctx, status, tid, used, from);
|
|
|
} catch (err) {
|
|
|
this.log(err);
|
|
|
- ctx.redirect(`/sp/${ctx.subProject.id}/dashboard`);
|
|
|
+ ctx.session.postError = err.toString();
|
|
|
+ ctx.redirect(`/sp/${ctx.subProject.id}/financial/pay/stage`);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -820,6 +822,7 @@ module.exports = app => {
|
|
|
filter.count[filter.status.checking] = await ctx.service.financialPay.getCountByStatus(ctx.subProject.id, payStage.id, filter.status.checking, filterTids, used);// await ctx.service.change.checkedDatas(tender.id, ctx.session.sessionUser.accountId);
|
|
|
filter.count[filter.status.checked] = await ctx.service.financialPay.getCountByStatus(ctx.subProject.id, payStage.id, filter.status.checked, filterTids, used);// await ctx.service.change.pendingDatas(tender.id, ctx.session.sessionUser.accountId);
|
|
|
const payList = await ctx.service.financialPay.getListByStatus(ctx.subProject.id, payStage.id, status, filterTids, used, 1);
|
|
|
+ const userTenderList = await ctx.service.financialPay.getUserTenderList(ctx.subProject.id, ctx.session.sessionUser.accountId, payStage.id);
|
|
|
const total = await ctx.service.financialPay.getCountByStatus(ctx.subProject.id, payStage.id, status, filterTids, used);
|
|
|
// 分页相关
|
|
|
const page = ctx.page;
|
|
@@ -834,6 +837,15 @@ module.exports = app => {
|
|
|
};
|
|
|
// 获取所有项目参与者
|
|
|
const accountList = await ctx.service.projectAccount.getAllSubProjectAccount(ctx.subProject, ['id', 'account', 'name', 'company', 'company_id', 'role', 'enable', 'is_admin', 'account_group', 'mobile']);
|
|
|
+ const user = accountList.find(item => item.id === ctx.session.sessionUser.accountId) || null;
|
|
|
+ const userCompany = user ? ctx.helper._.find(unitList, { name: user.company }) : null;
|
|
|
+ if (!userCompany) {
|
|
|
+ throw '请联系管理员添加用户所在单位信息';
|
|
|
+ }
|
|
|
+ const userCompanyList = await ctx.service.financialPayStage.getUserCompanyList(ctx.subProject.id, userCompany ? userCompany.id : 0, unitList);
|
|
|
+ if (userCompanyList.length === 0 || !ctx.helper._.includes(ctx.helper._.map(userCompanyList, 'id'), payStage.company_id)) {
|
|
|
+ throw '没有查看权限';
|
|
|
+ }
|
|
|
const payTenders = await ctx.service.financialPayTender.getAllDataByCondition({ where: { spid: ctx.subProject.id } });
|
|
|
if (tenders.length > 0) {
|
|
|
const allLastPay = await ctx.service.financialPay.getAllDataByCondition({ where: { spid: ctx.subProject.id, tid: ctx.helper._.map(tenders, 'id') }, columns: ['id', 'tid', 'code'], orders: [['id', 'desc']] });
|
|
@@ -892,6 +904,7 @@ module.exports = app => {
|
|
|
const renderData = {
|
|
|
categoryData,
|
|
|
tenders,
|
|
|
+ userTenderList,
|
|
|
financialPermission,
|
|
|
usedList: financialConst.used,
|
|
|
auditConst: auditConst.financial,
|
|
@@ -979,6 +992,7 @@ module.exports = app => {
|
|
|
await this._filterPayList(ctx, company, qi, status, tid, used);
|
|
|
} catch (err) {
|
|
|
this.log(err);
|
|
|
+ ctx.session.postError = err.toString();
|
|
|
ctx.redirect(`/sp/${ctx.subProject.id}/dashboard`);
|
|
|
}
|
|
|
}
|
|
@@ -1012,23 +1026,24 @@ module.exports = app => {
|
|
|
if (!userCompany) {
|
|
|
throw '请联系管理员添加用户所在单位信息';
|
|
|
}
|
|
|
- const userOrderList = await ctx.service.financialPayStage.getUserOrderList(ctx.subProject.id, userCompany ? userCompany.id : 0);
|
|
|
- const userCompanyList = await ctx.service.financialPayStage.getUserCompanyList(ctx.subProject.id, userCompany ? userCompany.id : 0, unitList);
|
|
|
- let fpsidList = [];
|
|
|
+ const companyInfo = company ? ctx.helper._.find(unitList, { name: company }) : null;
|
|
|
+ const userCompanyList = await ctx.service.financialPayStage.getUserCompanyList(ctx.subProject.id, userCompany ? userCompany.id : 0, unitList, qi);
|
|
|
+ const userOrderList = await ctx.service.financialPayStage.getUserOrderList(ctx.subProject.id, userCompany ? userCompany.id : 0, companyInfo ? companyInfo.id : null);
|
|
|
+ const userTenderList = await ctx.service.financialPay.getUserTenderList(ctx.subProject.id, ctx.session.sessionUser.accountId);
|
|
|
+ let fpsidList = null;
|
|
|
if (company || qi) {
|
|
|
- const companyInfo = company ? ctx.helper._.find(unitList, { name: company }) : null;
|
|
|
const fpstageList = await ctx.service.financialPayStage.getListByStatus(ctx.subProject.id, companyInfo ? companyInfo.id : null, userCompany ? userCompany.id : 0, qi, 0);
|
|
|
- fpsidList = ctx.helper._.map(fpstageList, 'id');
|
|
|
+ fpsidList = fpstageList.length > 0 ? ctx.helper._.map(fpstageList, 'id') : 0;
|
|
|
}
|
|
|
// const payList = await ctx.service.financialPayStage.getListByStatus(ctx.subProject.id, companyInfo ? companyInfo.id : null, userCompany ? userCompany.id : 0, qi);
|
|
|
const filter = JSON.parse(JSON.stringify(auditConst.financial.filter));
|
|
|
filter.count = [];
|
|
|
- filter.count[filter.status.pending] = await ctx.service.financialPay.getCountByStatus(ctx.subProject.id, fpsidList.length > 0 ? fpsidList : null, filter.status.pending, filterTids, used);
|
|
|
- filter.count[filter.status.uncheck] = await ctx.service.financialPay.getCountByStatus(ctx.subProject.id, fpsidList.length > 0 ? fpsidList : null, filter.status.uncheck, filterTids, used);
|
|
|
- filter.count[filter.status.checking] = await ctx.service.financialPay.getCountByStatus(ctx.subProject.id, fpsidList.length > 0 ? fpsidList : null, filter.status.checking, filterTids, used);
|
|
|
- filter.count[filter.status.checked] = await ctx.service.financialPay.getCountByStatus(ctx.subProject.id, fpsidList.length > 0 ? fpsidList : null, filter.status.checked, filterTids, used);
|
|
|
- const payList = await ctx.service.financialPay.getListByStatus(ctx.subProject.id, fpsidList.length > 0 ? fpsidList : null, status, filterTids, used, 1);
|
|
|
- const total = await ctx.service.financialPay.getCountByStatus(ctx.subProject.id, fpsidList.length > 0 ? fpsidList : null, status, filterTids, used);
|
|
|
+ filter.count[filter.status.pending] = await ctx.service.financialPay.getCountByStatus(ctx.subProject.id, fpsidList !== null ? fpsidList : null, filter.status.pending, filterTids, used);
|
|
|
+ filter.count[filter.status.uncheck] = await ctx.service.financialPay.getCountByStatus(ctx.subProject.id, fpsidList !== null ? fpsidList : null, filter.status.uncheck, filterTids, used);
|
|
|
+ filter.count[filter.status.checking] = await ctx.service.financialPay.getCountByStatus(ctx.subProject.id, fpsidList !== null ? fpsidList : null, filter.status.checking, filterTids, used);
|
|
|
+ filter.count[filter.status.checked] = await ctx.service.financialPay.getCountByStatus(ctx.subProject.id, fpsidList !== null ? fpsidList : null, filter.status.checked, filterTids, used);
|
|
|
+ const payList = await ctx.service.financialPay.getListByStatus(ctx.subProject.id, fpsidList !== null ? fpsidList : null, status, filterTids, used, 1);
|
|
|
+ const total = await ctx.service.financialPay.getCountByStatus(ctx.subProject.id, fpsidList !== null ? fpsidList : null, status, filterTids, used);
|
|
|
// 分页相关
|
|
|
const page = ctx.page;
|
|
|
const pageSize = ctx.pageSize;
|
|
@@ -1071,6 +1086,7 @@ module.exports = app => {
|
|
|
used,
|
|
|
company,
|
|
|
qi,
|
|
|
+ userTenderList,
|
|
|
userCompanyList,
|
|
|
userOrderList,
|
|
|
payList,
|
|
@@ -1129,6 +1145,7 @@ module.exports = app => {
|
|
|
await this._filterPayTender(ctx);
|
|
|
} catch (err) {
|
|
|
this.log(err);
|
|
|
+ ctx.session.postError = err.toString();
|
|
|
ctx.redirect(`/sp/${ctx.subProject.id}/dashboard`);
|
|
|
}
|
|
|
}
|
|
@@ -1266,7 +1283,7 @@ module.exports = app => {
|
|
|
jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.financial.payTender),
|
|
|
// pageInfo,
|
|
|
};
|
|
|
- await this.layout('financial/pay_tender.ejs', renderData);
|
|
|
+ await this.layout('financial/pay_tender.ejs', renderData, 'financial/pay_list_modal.ejs');
|
|
|
}
|
|
|
|
|
|
async payTenderSave(ctx) {
|