ellisran преди 2 месеца
родител
ревизия
99fd318f31
променени са 2 файла, в които са добавени 6 реда и са изтрити 3 реда
  1. 1 0
      app/public/js/payment_index.js
  2. 5 3
      app/service/payment_tender.js

+ 1 - 0
app/public/js/payment_index.js

@@ -77,6 +77,7 @@ $(function () {
             if (node.uid === uid || is_admin) {
                 html.push('<a class="dropdown-item edit_name_btn" data-type="'+ (node.parent_id === undefined ? 'tender' : 'folder') +'" data-id="'+ node.id +'" href="javascript:void(0);"><i class="fa fa-edit mr-2"></i>重命名</a>\n');
             }
+            console.log(node);
             if (!node.had_tender && (node.uid === uid || is_admin)) {
                 if (node.have_detail) {
                     html.push('<a class="dropdown-item" style="cursor:not-allowed" href="javascript:void(0);" data-toggle="tooltip" data-placement="bottom" title="请先删除所有审批期数据"><i class="fa fa-remove mr-2"></i>删除</a>\n');

+ 5 - 3
app/service/payment_tender.js

@@ -79,8 +79,9 @@ module.exports = app => {
                 if (folderInfo.parent_path) {
                     const parentFolderIds = folderInfo.parent_path.split('-');
                     for (const pf of parentFolderIds) {
+                        const pfInfo = await this.ctx.service.paymentFolder.getDataByCondition({ spid: this.ctx.subProject.id, folder_id: parseInt(pf) });
                         updateData.push({
-                            id: parseInt(pf),
+                            id: pfInfo.id,
                             had_tender: 1,
                         });
                     }
@@ -124,10 +125,11 @@ module.exports = app => {
                         const parentFolderIds = folderInfo.parent_path.split('-').reverse();
                         for (const pfid of parentFolderIds) {
                             const parentFolderId = parseInt(pfid);
-                            const leafFolderCount = await transaction.count(this.ctx.service.paymentFolder.tableName, { parent_id: parentFolderId, had_tender: 1 });
+                            const leafFolderCount = await transaction.count(this.ctx.service.paymentFolder.tableName, { spid: this.ctx.subProject.id, parent_id: parentFolderId, had_tender: 1 });
                             if (leafFolderCount === 1) {
+                                const pfInfo = await this.ctx.service.paymentFolder.getDataByCondition({ spid: this.ctx.subProject.id, folder_id: parseInt(parentFolderId) });
                                 updateDatas.push({
-                                    id: parentFolderId,
+                                    id: pfInfo.id,
                                     had_tender: 0,
                                 });
                             } else {