Explorar o código

Merge branch 'master' of http://192.168.1.41:3000/maixinrong/Calculation

TonyKang %!s(int64=5) %!d(string=hai) anos
pai
achega
077050f9ce

+ 6 - 6
app/service/change.js

@@ -327,7 +327,7 @@ module.exports = app => {
                         // 添加短信通知-需要审批提醒功能
                         if (change_status && index === 0) {
                             const smsUser = await this.ctx.service.projectAccount.getDataById(auditInfo[0]);
-                            if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
+                            if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
                                 const smsType = JSON.parse(smsUser.sms_type);
                                 if (smsType[smsTypeConst.const.BG] !== undefined && smsType[smsTypeConst.const.BG].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
                                     const sms = new SMS(this.ctx);
@@ -469,7 +469,7 @@ module.exports = app => {
                     const auditList = await this.ctx.service.changeAudit.getListGroupByTimes(changeData.cid, changeData.times);
                     for (const user of auditList) {
                         const smsUser = await this.ctx.service.projectAccount.getDataById(user.uid);
-                        if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
+                        if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
                             const smsType = JSON.parse(smsUser.sms_type);
                             if (smsType[smsTypeConst.const.BG] !== undefined && smsType[smsTypeConst.const.BG].indexOf(smsTypeConst.judge.result.toString()) !== -1) {
                                 mobile_array.push(smsUser.auth_mobile);
@@ -492,7 +492,7 @@ module.exports = app => {
                     // 添加短信通知-需要审批提醒功能
                     const nextAuditData = await this.ctx.service.changeAudit.getDataById(postData.audit_next_id);
                     const smsUser = await this.ctx.service.projectAccount.getDataById(nextAuditData.uid);
-                    if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
+                    if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
                         const smsType = JSON.parse(smsUser.sms_type);
                         if (smsType[smsTypeConst.const.BG] !== undefined && smsType[smsTypeConst.const.BG].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
                             const sms = new SMS(this.ctx);
@@ -628,7 +628,7 @@ module.exports = app => {
                 const mobile_array = [];
                 for (const user of insert_audit_array) {
                     const smsUser = await this.ctx.service.projectAccount.getDataById(user.uid);
-                    if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
+                    if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
                         const smsType = JSON.parse(smsUser.sms_type);
                         if (smsType[smsTypeConst.const.BG] !== undefined && smsType[smsTypeConst.const.BG].indexOf(smsTypeConst.judge.result.toString()) !== -1) {
                             mobile_array.push(smsUser.auth_mobile);
@@ -752,7 +752,7 @@ module.exports = app => {
 
                 // 添加短信通知-需要审批提醒功能
                 const smsUser = await this.ctx.service.projectAccount.getDataById(lastauditInfo.uid);
-                if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
+                if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
                     const smsType = JSON.parse(smsUser.sms_type);
                     if (smsType[smsTypeConst.const.BG] !== undefined && smsType[smsTypeConst.const.BG].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
                         const sms = new SMS(this.ctx);
@@ -970,7 +970,7 @@ module.exports = app => {
 
                 // 添加短信通知-需要审批提醒功能
                 const smsUser = await this.ctx.service.projectAccount.getDataById(auditInfo.uid);
-                if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
+                if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
                     const smsType = JSON.parse(smsUser.sms_type);
                     if (smsType[smsTypeConst.const.BG] !== undefined && smsType[smsTypeConst.const.BG].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
                         const sms = new SMS(this.ctx);

+ 6 - 6
app/service/ledger_audit.js

@@ -192,7 +192,7 @@ module.exports = app => {
 
                 // 添加短信通知-需要审批提醒功能
                 const smsUser = await this.ctx.service.projectAccount.getDataById(audit.audit_id);
-                if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
+                if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
                     const smsType = JSON.parse(smsUser.sms_type);
                     if (smsType[smsTypeConst.const.TZ] !== undefined && smsType[smsTypeConst.const.TZ].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
                         const tenderInfo = await this.ctx.service.tender.getDataById(tenderId);
@@ -241,7 +241,7 @@ module.exports = app => {
 
                         // 添加短信通知-需要审批提醒功能
                         const smsUser = await this.ctx.service.projectAccount.getDataById(nextAudit.audit_id);
-                        if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
+                        if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
                             const smsType = JSON.parse(smsUser.sms_type);
                             if (smsType[smsTypeConst.const.TZ] !== undefined && smsType[smsTypeConst.const.TZ].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
                                 const tenderInfo = await this.ctx.service.tender.getDataById(tenderId);
@@ -259,7 +259,7 @@ module.exports = app => {
                         const mobile_array = [];
                         const tenderInfo = await this.ctx.service.tender.getDataById(tenderId);
                         const smsUser1 = await this.ctx.service.projectAccount.getDataById(tenderInfo.user_id);
-                        if (smsUser1.auth_mobile !== '' && smsUser1.auth_mobile !== undefined && smsUser1.sms_type !== '') {
+                        if (smsUser1.auth_mobile !== '' && smsUser1.auth_mobile !== undefined && smsUser1.sms_type !== '' && smsUser1.sms_type !== null) {
                             const smsType = JSON.parse(smsUser1.sms_type);
                             if (smsType[smsTypeConst.const.TZ] !== undefined && smsType[smsTypeConst.const.TZ].indexOf(smsTypeConst.judge.result.toString()) !== -1) {
                                 mobile_array.push(smsUser1.auth_mobile);
@@ -268,7 +268,7 @@ module.exports = app => {
                         const auditList = await this.getAuditors(tenderId, times);
                         for (const user of auditList) {
                             const smsUser = await this.ctx.service.projectAccount.getDataById(user.audit_id);
-                            if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
+                            if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
                                 const smsType = JSON.parse(smsUser.sms_type);
                                 if (mobile_array.indexOf(smsUser.auth_mobile) === -1 && smsType[smsTypeConst.const.TZ] !== undefined && smsType[smsTypeConst.const.TZ].indexOf(smsTypeConst.judge.result.toString()) !== -1) {
                                     mobile_array.push(smsUser.auth_mobile);
@@ -300,7 +300,7 @@ module.exports = app => {
                     const mobile_array = [];
                     const tenderInfo = await this.ctx.service.tender.getDataById(tenderId);
                     const smsUser1 = await this.ctx.service.projectAccount.getDataById(tenderInfo.user_id);
-                    if (smsUser1.auth_mobile !== '' && smsUser1.auth_mobile !== undefined && smsUser1.sms_type !== '') {
+                    if (smsUser1.auth_mobile !== '' && smsUser1.auth_mobile !== undefined && smsUser1.sms_type !== '' && smsUser1.sms_type !== null) {
                         const smsType = JSON.parse(smsUser1.sms_type);
                         if (smsType[smsTypeConst.const.TZ] !== undefined && smsType[smsTypeConst.const.TZ].indexOf(smsTypeConst.judge.result.toString()) !== -1) {
                             mobile_array.push(smsUser1.auth_mobile);
@@ -308,7 +308,7 @@ module.exports = app => {
                     }
                     for (const user of auditors) {
                         const smsUser = await this.ctx.service.projectAccount.getDataById(user.audit_id);
-                        if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
+                        if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
                             const smsType = JSON.parse(smsUser.sms_type);
                             if (mobile_array.indexOf(smsUser.auth_mobile) === -1 && smsType[smsTypeConst.const.TZ] !== undefined && smsType[smsTypeConst.const.TZ].indexOf(smsTypeConst.judge.result.toString()) !== -1) {
                                 mobile_array.push(smsUser.auth_mobile);

+ 7 - 7
app/service/stage_audit.js

@@ -198,7 +198,7 @@ module.exports = app => {
 
                 // 添加短信通知-需要审批提醒功能
                 const smsUser = await this.ctx.service.projectAccount.getDataById(audit.aid);
-                if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
+                if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
                     const smsType = JSON.parse(smsUser.sms_type);
                     if (smsType[smsTypeConst.const.JL] !== undefined && smsType[smsTypeConst.const.JL].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
                         const tenderInfo = await this.ctx.service.tender.getDataById(audit.tid);
@@ -250,7 +250,7 @@ module.exports = app => {
 
                     // 添加短信通知-需要审批提醒功能
                     const smsUser = await this.ctx.service.projectAccount.getDataById(nextAudit.aid);
-                    if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
+                    if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
                         const smsType = JSON.parse(smsUser.sms_type);
                         if (smsType[smsTypeConst.const.JL] !== undefined && smsType[smsTypeConst.const.JL].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
                             const tenderInfo = await this.ctx.service.tender.getDataById(nextAudit.tid);
@@ -281,7 +281,7 @@ module.exports = app => {
                     const stageInfo = await this.ctx.service.stage.getDataById(stageId);
                     const auditList = await this.getAuditors(stageId, stageInfo.times);
                     const smsUser1 = await this.ctx.service.projectAccount.getDataById(stageInfo.user_id);
-                    if (smsUser1.auth_mobile !== undefined && smsUser1.sms_type !== '') {
+                    if (smsUser1.auth_mobile !== undefined && smsUser1.sms_type !== '' && smsUser1.sms_type !== null) {
                         const smsType = JSON.parse(smsUser1.sms_type);
                         if (smsType[smsTypeConst.const.JL] !== undefined && smsType[smsTypeConst.const.JL].indexOf(smsTypeConst.judge.result.toString()) !== -1) {
                             mobile_array.push(smsUser1.auth_mobile);
@@ -352,7 +352,7 @@ module.exports = app => {
                 const stageInfo = await this.ctx.service.stage.getDataById(stageId);
                 const auditList = await this.getAuditors(stageId, stageInfo.times);
                 const smsUser1 = await this.ctx.service.projectAccount.getDataById(stageInfo.user_id);
-                if (smsUser1.auth_mobile !== '' && smsUser1.auth_mobile !== undefined && smsUser1.sms_type !== '') {
+                if (smsUser1.auth_mobile !== '' && smsUser1.auth_mobile !== undefined && smsUser1.sms_type !== '' && smsUser1.sms_type !== null) {
                     const smsType = JSON.parse(smsUser1.sms_type);
                     if (smsType[smsTypeConst.const.JL] !== undefined && smsType[smsTypeConst.const.JL].indexOf(smsTypeConst.judge.result.toString()) !== -1) {
                         mobile_array.push(smsUser1.auth_mobile);
@@ -360,7 +360,7 @@ module.exports = app => {
                 }
                 for (const user of auditList) {
                     const smsUser = await this.ctx.service.projectAccount.getDataById(user.aid);
-                    if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
+                    if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
                         const smsType = JSON.parse(smsUser.sms_type);
                         if (mobile_array.indexOf(smsUser.auth_mobile) === -1 && smsType[smsTypeConst.const.JL] !== undefined && smsType[smsTypeConst.const.JL].indexOf(smsTypeConst.judge.result.toString()) !== -1) {
                             mobile_array.push(smsUser.auth_mobile);
@@ -426,7 +426,7 @@ module.exports = app => {
 
                 // 添加短信通知-需要审批提醒功能
                 const smsUser = await this.ctx.service.projectAccount.getDataById(preAuditor.aid);
-                if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
+                if (smsUser.auth_mobile !== '' && smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
                     const smsType = JSON.parse(smsUser.sms_type);
                     if (smsType[smsTypeConst.const.JL] !== undefined && smsType[smsTypeConst.const.JL].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
                         const tenderInfo = await this.ctx.service.tender.getDataById(audit.tid);
@@ -635,7 +635,7 @@ module.exports = app => {
 
                 // 添加短信通知-需要审批提醒功能
                 const smsUser = await this.ctx.service.projectAccount.getDataById(audit.aid);
-                if (smsUser.auth_mobile !== undefined && smsUser.sms_type !== '') {
+                if (smsUser.auth_mobile !== undefined && smsUser.sms_type !== '' && smsUser.sms_type !== null) {
                     const smsType = JSON.parse(smsUser.sms_type);
                     if (smsType[smsTypeConst.const.JL] !== undefined && smsType[smsTypeConst.const.JL].indexOf(smsTypeConst.judge.approval.toString()) !== -1) {
                         const tenderInfo = await this.ctx.service.tender.getDataById(audit.tid);

+ 3 - 1
app/service/tender.js

@@ -271,7 +271,9 @@ module.exports = app => {
                 const attList = await this.ctx.service.changeAtt.getAllDataByCondition({ where: { tid: id } });
                 if (attList.length !== 0) {
                     for (const att of attList) {
-                        await fs.unlinkSync(path.join(this.app.baseDir, att.filepath));
+                        if (fs.existsSync(path.join(this.app.baseDir, att.filepath))) {
+                            await fs.unlinkSync(path.join(this.app.baseDir, att.filepath));
+                        }
                     }
                 }
                 await transaction.delete(this.ctx.service.changeAtt.tableName, {tid: id});

+ 1 - 1
app/view/layout/layout.ejs

@@ -33,7 +33,7 @@
         <%- content %>
     </div>
 </div>
-<div class="toast" style="position: absolute; z-index: 9;">
+<div class="toast" style="position: absolute; z-index: 10000;text-align: center">
     <i class="icon fa"></i>
     <span class="message"></span>
 </div>