Ver código fonte

修复部分bug

laiguoran 4 anos atrás
pai
commit
01ef143682

+ 7 - 1
app/controller/change_controller.js

@@ -822,10 +822,16 @@ module.exports = app => {
                     const lastUidList = ctx.helper._.map(lastUserList, 'uid');
                     // 判断上一次审批是否为非原报为审批人
                     const nowUidList = ctx.helper._.map(ctx.change.auditors, 'uid');
-                    // 上一次审批人列表包含原报且不止只有原报并且新的审批人只有原报审批时
+                    // 判断条件修订可上报条件
+                    // 1.有原报,有其他人   可以添加原报作为审核人,但是不能只原报上报
+                    // 2.有原报,无其他人   可以添加原报作为审核人,可以只原报上报
+                    // 3.无原报,有其他人   不可以添加原报
                     if (!ctx.helper._.isEqual(lastUidList, nowUidList) && ctx.helper._.includes(ctx.helper._.tail(lastUidList), lastUidList[0]) && nowUidList.length === 2 && nowUidList[0] === nowUidList[1]) {
                         throw '该变更令不能指定原报人为单独审批人';
                     }
+                    if (!ctx.helper._.includes(ctx.helper._.tail(lastUidList), lastUidList[0]) && ctx.helper._.includes(ctx.helper._.tail(nowUidList), nowUidList[0])) {
+                        throw '该变更令不能指定原报为审批人,请移除';
+                    }
                 }
                 await ctx.service.changeAudit.start(ctx.change.cid, ctx.change.times);
                 ctx.redirect(ctx.request.header.referer);

+ 2 - 2
app/public/js/change_information_set.js

@@ -151,7 +151,7 @@ $(document).ready(() => {
                 return !readOnly && data.lid != 0;
             },
             isEdit2: function (data) {
-                return !readOnly && (data.lid != 0 || (data.lid == 0 && _.find(changeUsedData, { id: data.id })));
+                return !readOnly && (data.lid != 0 || (data.lid == 0 && _.findIndex(changeUsedData, { id: data.id }) !== -1));
             },
         },
     };
@@ -570,7 +570,7 @@ $(document).ready(() => {
                     name: '删除',
                     icon: 'fa-remove',
                     callback: function (key, opt) {
-                        // changeSpreadObj.del(changeSpreadSheet);
+                        changeSpreadObj.del(changeSpreadSheet);
                     },
                     disabled: function (key, opt) {
                         const select = SpreadJsObj.getSelectObject(changeSpreadSheet);

+ 4 - 1
app/service/change_audit_list.js

@@ -230,7 +230,10 @@ module.exports = app => {
                 // 更新stage_change和stage_change_final的cbid
                 if (usedList.length > 0) {
                     const updateList = [];
-                    const newList = await transaction.select(this.tableName, { where: { cid: this.ctx.change.cid } });
+                    const sql2 = 'SELECT * FROM ?? WHERE `cid` = ? AND `lid` != 0';
+                    const sqlParam2 = [this.tableName, this.ctx.change.cid];
+                    const newList = await transaction.query(sql2, sqlParam2);
+                    // const newList = await transaction.select(this.tableName, { where: { cid: this.ctx.change.cid } });
                     for (const used of usedList) {
                         const newone = this._.find(newList, { code: used.code, lid: used.lid, gcl_id: used.gcl_id, bwmx: used.bwmx });
                         if (newone) {