|
@@ -59,7 +59,7 @@ module.exports = app => {
|
|
|
async addTender(projectId, uid, folderId, name) {
|
|
|
const transaction = await this.db.beginTransaction();
|
|
|
try {
|
|
|
- const folderInfo = await this.ctx.service.paymentFolder.getDataById(folderId);
|
|
|
+ const folderInfo = await this.ctx.service.paymentFolder.getDataByCondition({ spid: this.ctx.subProject.id, folder_id: parseInt(folderId) });
|
|
|
if (!folderInfo || folderInfo.is_leaf === 0) {
|
|
|
throw '文件夹不存在或存在子目录不能新建标段';
|
|
|
}
|
|
@@ -110,12 +110,12 @@ module.exports = app => {
|
|
|
if (had_detail) {
|
|
|
throw '请先删除所有报表表单详情';
|
|
|
}
|
|
|
- const folderInfo = await this.ctx.service.paymentFolder.getDataById(tenderInfo.folder_id);
|
|
|
+ const folderInfo = await this.ctx.service.paymentFolder.getDataByCondition({ spid: this.ctx.subProject.id, folder_id: tenderInfo.folder_id });
|
|
|
if (!folderInfo) {
|
|
|
throw '文件夹不存在';
|
|
|
}
|
|
|
// 判断folderInfo下是否还存在tender,不存在则把had_tender为0,并判断父节点是否需要也为0
|
|
|
- const leafTenderCount = await transaction.count(this.tableName, { folder_id: folderInfo.id });
|
|
|
+ const leafTenderCount = await transaction.count(this.tableName, { spid: this.ctx.subProject.id, folder_id: folderInfo.folder_id });
|
|
|
if (leafTenderCount === 1) {
|
|
|
const updateDatas = [{
|
|
|
id: folderInfo.id,
|