|
@@ -33,6 +33,7 @@ module.exports = app => {
|
|
|
const renderData = {
|
|
|
jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.contract.index),
|
|
|
auditConst,
|
|
|
+ isTender: false,
|
|
|
};
|
|
|
// renderData.budgetStd = await ctx.service.budgetStd.getDataByProjectId(ctx.session.sessionProject.id);
|
|
|
renderData.projectList = await ctx.service.subProject.getSubProjectByContract(ctx.session.sessionProject.id, ctx.session.sessionUser.accountId, ctx.session.sessionUser.is_admin);
|
|
@@ -48,7 +49,6 @@ module.exports = app => {
|
|
|
t.income_yf_price = incomeList.reduce((total, item) => ctx.helper.add(total, item.yf_price), 0);
|
|
|
}
|
|
|
}
|
|
|
- renderData.tenderList = await ctx.service.tender.getList4Select('stage');
|
|
|
const accountList = await ctx.service.projectAccount.getAllDataByCondition({
|
|
|
where: { project_id: ctx.session.sessionProject.id, enable: 1 },
|
|
|
columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile'],
|
|
@@ -87,7 +87,15 @@ module.exports = app => {
|
|
|
const userPermission = accountInfo !== undefined && accountInfo.permission !== ''
|
|
|
? JSON.parse(accountInfo.permission) : null;
|
|
|
const tenderList = await ctx.service.tender.getContractList('', userPermission, ctx.session.sessionUser.is_admin);
|
|
|
+ const projectList = await ctx.service.subProject.getSubProjectByTender(ctx.session.sessionProject.id, tenderList);
|
|
|
for (const t of tenderList) {
|
|
|
+ const spInfo = ctx.helper._.find(projectList, { id: t.spid });
|
|
|
+ spInfo.child_order = spInfo.child_order ? spInfo.child_order : 0;
|
|
|
+ spInfo.is_folder = 1;
|
|
|
+ t.tree_pid = spInfo.id;
|
|
|
+ t.tree_level = spInfo.tree_level + 1;
|
|
|
+ t.tree_order = spInfo.child_order + 1;
|
|
|
+ spInfo.child_order++;
|
|
|
const expensessList = await ctx.service.contract.getListByUsers({ tid: t.id, contract_type: contractConst.type.expenses }, ctx.session.sessionUser);
|
|
|
t.expenses_count = expensessList.length;
|
|
|
t.expenses_total_price = expensessList.reduce((total, item) => ctx.helper.add(total, item.total_price), 0);
|
|
@@ -99,11 +107,15 @@ module.exports = app => {
|
|
|
}
|
|
|
const categoryData = await ctx.service.category.getAllCategory(ctx.session.sessionProject.id);
|
|
|
const renderData = {
|
|
|
- jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.contract.tender),
|
|
|
- tenderList,
|
|
|
+ // jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.contract.tender),
|
|
|
+ jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.contract.index),
|
|
|
+ auditConst,
|
|
|
+ // tenderList,
|
|
|
+ projectList: projectList.concat(tenderList),
|
|
|
categoryData,
|
|
|
+ isTender: true,
|
|
|
// selfCategoryLevel: accountInfo ? accountInfo.self_category_level : '',
|
|
|
- selfCategoryLevel: '',
|
|
|
+ // selfCategoryLevel: '',
|
|
|
pid: ctx.session.sessionProject.id,
|
|
|
uid: ctx.session.sessionUser.accountId,
|
|
|
};
|
|
@@ -122,7 +134,8 @@ module.exports = app => {
|
|
|
renderData.accountList = accountList;
|
|
|
renderData.accountGroup = accountGroupList;
|
|
|
}
|
|
|
- await this.layout('contract/tender.ejs', renderData, 'contract/modal.ejs');
|
|
|
+ // await this.layout('contract/tender.ejs', renderData, 'contract/modal.ejs');
|
|
|
+ await this.layout('contract/index.ejs', renderData, 'contract/modal.ejs');
|
|
|
} catch (err) {
|
|
|
ctx.log(err);
|
|
|
ctx.session.postError = err.toString();
|