|
|
@@ -312,7 +312,6 @@ module.exports = app => {
|
|
|
const templates = template instanceof Array ? template : [template];
|
|
|
templates.forEach(x => { x.used = []; x.used_count = 0; });
|
|
|
const tender = await this.ctx.service.tender.getAllDataByCondition({ columns: ['id'], where: { project_id: templates[0].pid }});
|
|
|
- console.log(tender.length);
|
|
|
for (const t of tender) {
|
|
|
const used = await this.ctx.service.ledgerExtra.getUsedCalcTemplate(t.id);
|
|
|
templates.forEach(x => {
|
|
|
@@ -364,7 +363,9 @@ module.exports = app => {
|
|
|
if (!template) throw '编辑的模板不存在';
|
|
|
if (template.pid !== this.ctx.session.sessionProject.id) throw '模板不属于当前项目,请刷新后重试';
|
|
|
if (template.create_user_id !== this.ctx.session.sessionUser.accountId) throw '非您创建的模板';
|
|
|
- if (template.is_locked) throw '模板已被锁定,不可修改';
|
|
|
+ if (template.is_locked) throw '模板已被锁定';
|
|
|
+ await this.checkTemplateUsed(template, template.type);
|
|
|
+ if (template.used.length > 0) throw '模板已被使用';
|
|
|
return template;
|
|
|
}
|
|
|
_getCalcLeaf(cur, cols, parentField) {
|