Просмотр исходного кода

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

MaiXinRong 1 год назад
Родитель
Сommit
2563a160bd

+ 4 - 3
app/public/js/change_information_set.js

@@ -947,7 +947,7 @@ $(document).ready(() => {
 
             if (hadcid !== 0) gclGatherData[ggd].cid = 1;
         }
-        console.log(gclGatherData);
+        // console.log(gclGatherData);
         // 数组去重
         const dealBillList = result.dealBills;
         for (const db of gclGatherData) {
@@ -959,7 +959,7 @@ $(document).ready(() => {
             }
         }
         changeListData = gclGatherData.concat(dealBillList).sort(sortByCode);
-        // console.log(changeListData);
+        console.log(changeListData);
         // 先加载台账数据
         let listHtml = '';
         let list_index = 1;
@@ -2026,6 +2026,7 @@ function checkChangeFrom() {
     }
     // 判断非空白变更清单是否有重复值(gcl_id及mx_id),如果存在完全相同则需要提示并删除,上报失败,这功能主要是因为清单数据过多服务器处理不过来偶然出现
     const doubleList = findDuplicates(_.filter(changeList, item => item.lid != 0));
+    console.log(doubleList);
     if (doubleList.length > 0) {
         for (const double of doubleList) {
             const msgIndex = [];
@@ -2056,7 +2057,7 @@ function checkAuditorFrom () {
     return true;
 }
 // 找出数组中相同的清单
-function findDuplicates(arr, keys = ['gcl_id', 'mx_id']) {
+function findDuplicates(arr, keys = ['lid', 'gcl_id', 'mx_id']) {
     const groupedData = _.groupBy(arr, item => JSON.stringify(_.pick(item, keys)));
     const duplicates = _.filter(groupedData, group => group.length > 1);
     return _.values(duplicates);

+ 2 - 2
app/service/change_apply_audit.js

@@ -389,9 +389,9 @@ module.exports = app => {
             const sql = 'SELECT ma.`aid`, ma.`times`, ma.`order`, ma.`begin_time`, ma.`end_time`, ma.`tid`, ma.`caid`,' +
                 '    m.`status` As `mstatus`, m.`code` As `mcode`,' +
                 '    t.`name`, t.`project_id`, t.`type`, t.`user_id` ' +
-                '  FROM ?? AS ma, ?? AS m, ?? As t ' +
+                '  FROM ?? AS ma LEFT JOIN ?? AS m ON  ma.`caid` = m.`id` LEFT JOIN ?? As t ON ma.`tid` = t.`id`' +
                 '  WHERE ((ma.`aid` = ? and ma.`status` = ?) OR (m.`uid` = ? and ma.`status` = ? and m.`status` = ? and ma.`times` = (m.`times`-1)))' +
-                '    and ma.`caid` = m.`id` and ma.`tid` = t.`id` ORDER BY ma.`begin_time` DESC';
+                '  ORDER BY ma.`begin_time` DESC';
             const sqlParam = [this.tableName, this.ctx.service.changeApply.tableName, this.ctx.service.tender.tableName, auditorId, auditConst.status.checking, auditorId, auditConst.status.checkNo, auditConst.status.checkNo];
             const result = await this.db.query(sql, sqlParam);
             // 过滤result中存在重复sid的值, 保留最新的一条

+ 9 - 2
app/service/change_audit.js

@@ -218,12 +218,19 @@ module.exports = app => {
          * @return {Promise<void>}
          */
         async getAuditChange(uid) {
+            // const sql = 'SELECT ca.`uid`, ca.`times`, ca.`usite`, ca.`usort`, ca.`tid`, ca.`cid`, ca.`begin_time`, ca.`end_time`, ca.`sin_time`, ca.`name` As `caname`, ' +
+            //     '    c.`code` As `ccode`, c.`name` As `cname`, c.`status` As `cstatus`, c.`cin_time`, ' +
+            //     '    t.`name`, t.`type`, t.`user_id` ' +
+            //     '  FROM ?? AS ca, ?? AS c, ?? As t ' +
+            //     '  WHERE ca.`uid` = ? and ca.`status` = ? and c.`status` != ?' +
+            //     '    and ca.`cid` = c.`cid` and ca.`tid` = t.`id` ORDER BY ca.`sin_time` DESC';
             const sql = 'SELECT ca.`uid`, ca.`times`, ca.`usite`, ca.`usort`, ca.`tid`, ca.`cid`, ca.`begin_time`, ca.`end_time`, ca.`sin_time`, ca.`name` As `caname`, ' +
                 '    c.`code` As `ccode`, c.`name` As `cname`, c.`status` As `cstatus`, c.`cin_time`, ' +
                 '    t.`name`, t.`type`, t.`user_id` ' +
-                '  FROM ?? AS ca, ?? AS c, ?? As t ' +
+                '  FROM ?? AS ca LEFT JOIN ?? AS c ON ca.`cid` = c.`cid` ' +
+                '    LEFT JOIN ?? As t ON ca.`tid` = t.`id` ' +
                 '  WHERE ca.`uid` = ? and ca.`status` = ? and c.`status` != ?' +
-                '    and ca.`cid` = c.`cid` and ca.`tid` = t.`id` ORDER BY ca.`sin_time` DESC';
+                '  ORDER BY ca.`sin_time` DESC';
             const sqlParam = [this.tableName, this.ctx.service.change.tableName, this.ctx.service.tender.tableName, uid, auditConst.status.checking, auditConst.status.uncheck];
             const changes = await this.db.query(sql, sqlParam);
             for (const c of changes) {

+ 2 - 2
app/service/change_plan_audit.js

@@ -392,9 +392,9 @@ module.exports = app => {
             const sql = 'SELECT ma.`aid`, ma.`times`, ma.`order`, ma.`begin_time`, ma.`end_time`, ma.`tid`, ma.`cpid`,' +
                 '    m.`status` As `mstatus`, m.`code` As `mcode`,' +
                 '    t.`name`, t.`project_id`, t.`type`, t.`user_id` ' +
-                '  FROM ?? AS ma, ?? AS m, ?? As t ' +
+                '  FROM ?? AS ma LEFT JOIN ?? AS m ON  ma.`cpid` = m.`id` LEFT JOIN ?? As t ON ma.`tid` = t.`id`' +
                 '  WHERE ((ma.`aid` = ? and ma.`status` = ?) OR (m.`uid` = ? and ma.`status` = ? and m.`status` = ? and ma.`times` = (m.`times`-1)))' +
-                '    and ma.`cpid` = m.`id` and ma.`tid` = t.`id` ORDER BY ma.`begin_time` DESC';
+                '  ORDER BY ma.`begin_time` DESC';
             const sqlParam = [this.tableName, this.ctx.service.changePlan.tableName, this.ctx.service.tender.tableName, auditorId, auditConst.status.checking, auditorId, auditConst.status.checkNo, auditConst.status.checkNo];
             const result = await this.db.query(sql, sqlParam);
             // 过滤result中存在重复sid的值, 保留最新的一条

+ 2 - 2
app/service/change_project_audit.js

@@ -397,9 +397,9 @@ module.exports = app => {
             const sql = 'SELECT ma.`aid`, ma.`times`, ma.`order`, ma.`begin_time`, ma.`end_time`, ma.`tid`, ma.`cpid`,' +
                 '    m.`status` As `mstatus`, m.`code` As `mcode`,' +
                 '    t.`name`, t.`project_id`, t.`type`, t.`user_id` ' +
-                '  FROM ?? AS ma, ?? AS m, ?? As t ' +
+                '  FROM ?? AS ma LEFT JOIN ?? AS m ON  ma.`cpid` = m.`id` LEFT JOIN ?? As t ON ma.`tid` = t.`id`' +
                 '  WHERE ((ma.`aid` = ? and ma.`status` = ?) OR (m.`uid` = ? and ma.`status` = ? and m.`status` = ? and ma.`times` = (m.`times`-1)))' +
-                '    and ma.`cpid` = m.`id` and ma.`tid` = t.`id` ORDER BY ma.`begin_time` DESC';
+                '  ORDER BY ma.`begin_time` DESC';
             const sqlParam = [this.tableName, this.ctx.service.changeProject.tableName, this.ctx.service.tender.tableName, auditorId, auditConst.status.checking, auditorId, auditConst.status.back, auditConst.status.back];
             const result = await this.db.query(sql, sqlParam);
             // 过滤result中存在重复cpid的值, 保留最新的一条