浏览代码

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

Tony Kang 2 年之前
父节点
当前提交
b10a8aeacc

+ 1 - 1
app/controller/payment_controller.js

@@ -481,7 +481,7 @@ module.exports = app => {
                             throw '该审核人已存在,请勿重复添加';
                         }
                         const shenpiInfo = await ctx.service.paymentShenpiAudit.getDataByCondition({ tr_id: ctx.trInfo.id, sp_status: shenpiConst.sp_status.gdzs });
-                        const is_gdzs = shenpiInfo && ctx.trinfo.sp_status === shenpiConst.sp_status.gdzs ? 1 : 0;
+                        const is_gdzs = shenpiInfo && ctx.trInfo.sp_status === shenpiConst.sp_status.gdzs ? 1 : 0;
                         const result = await ctx.service.paymentDetailAudit.addAuditor(ctx.detail.id, auditorId, ctx.detail.times, is_gdzs);
                         if (!result) {
                             throw '添加审核人失败';

+ 4 - 1
app/controller/stage_extra_controller.js

@@ -355,8 +355,11 @@ module.exports = app => {
                     ]
                 });
                 for (const pf of bonus.proof_file) {
-                    delete pf.filepath;
                     pf.username = (await ctx.service.projectAccount.getAccountInfoById(pf.uid)).name;
+                    if (ctx.helper.canPreview(pf.fileext)){
+                        pf.viewpath = pf.filepath.substr(3, pf.filepath.length - 3);
+                    }
+                    delete pf.filepath;
                 }
                 ctx.body = {err: 0, msg: '', data: bonus.proof_file};
             } catch (error) {

+ 1 - 6
app/middleware/payment_detail_check.js

@@ -38,7 +38,6 @@ module.exports = options => {
             detail.auditors = yield this.service.paymentDetailAudit.getAuditors(detail.id, detail.times);
             detail.curAuditor = yield this.service.paymentDetailAudit.getCurAuditor(detail.id, detail.times);
             detail.rptAudits = yield this.service.paymentRptAudit.getListByDetail(detail.id);
-
             const accountId = this.session.sessionUser.accountId,
                 auditorIds = _.map(detail.auditors, 'aid'),
                 rptAuditIds = _.map(detail.rptAudits, 'uid');
@@ -60,7 +59,7 @@ module.exports = options => {
                 } else {
                     detail.curOrder = detail.curAuditor.order;
                 }
-            } else if (auditorIds.indexOf(accountId) !== -1) { // 审批人
+            } else if (auditorIds.indexOf(accountId) !== -1 || rptAuditIds.indexOf(accountId) !== -1 || this.payment.auditPermission.view_all) { // 审批人及签署人及查看所有权人
                 if (detail.status === status.uncheck) {
                     throw '您无权查看该数据';
                 }
@@ -76,10 +75,6 @@ module.exports = options => {
                 } else {
                     detail.curOrder = accountId === detail.curAuditor.aid ? detail.curAuditor.order : detail.curAuditor.order - 1;
                 }
-            } else if (rptAuditIds.indexOf(accountId) !== -1 || this.payment.auditPermission.view_all) {
-                if (detail.status === status.uncheck || detail.status === status.checkNo) {
-                    throw '您无权查看该数据';
-                }
             } else { // 其他不可见
                 throw '您无权查看该数据';
             }

+ 3 - 0
app/public/js/payment_detail.js

@@ -119,6 +119,9 @@ $(function () {
 
     let timer = null
     function checkAndUpdate(index, newVal, _self) {
+        if (tesRpttData.items[0].interact_cells[index].DataType === 'intact_type_number' && _.indexOf(tesRpttData.items[0].interact_cells[index].Value, '元') !== -1) {
+            newVal = newVal + '元';
+        }
         console.log(index, newVal);
         clearTimeout(timer);
         timer = setTimeout(() => {

+ 6 - 1
app/public/js/se_bonus.js

@@ -148,7 +148,12 @@ $(document).ready(() => {
             if (files !== null && files !== undefined) {
                 for (const [i, f] of files.entries()) {
                     html.push('<tr>');
-                    html.push('<td style="width: 200px">', f.filename + f.fileext, '</td>');
+                    if (f.viewpath) {
+                        html.push(`<td style="width: 200px"><a href="${f.viewpath}" target="_blank">${f.filename}${f.fileext}</a></td>`);
+                        //html.push(`<td style="width: 200px"><a href="download/file?b_id=${id}&index=${i}&view=1" target="_blank">${f.filename}${f.fileext}</a></td>`);
+                    } else {
+                        html.push(`<td style="width: 200px"><a href="download/file?b_id=${id}&index=${i}" title="下载">${f.filename}${f.fileext}</a></td>`);
+                    }
                     html.push('<td>', f.username, '</td>');
                     html.push('<td>', f.in_time, '</td>');
                     html.push('<td>');

+ 7 - 0
app/service/stage_bonus.js

@@ -23,11 +23,17 @@ module.exports = app => {
         }
 
         _parseData(data) {
+            const helper = this.ctx.helper;
             if (!data) return;
             const datas = data instanceof Array ? data : [data];
             for (const d of datas) {
                 if (d.proof_file) {
                     d.proof_file = JSON.parse(d.proof_file);
+                    d.proof_file.forEach(f => {
+                        if (helper.canPreview(f.fileext)){
+                            f.viewpath = f.filepath.substr(3, f.filepath.length - 3);
+                        }
+                    });
                 } else {
                     d.proof_file = [];
                 }
@@ -143,6 +149,7 @@ module.exports = app => {
             }
             if (uDatas.length > 0) {
                 await this.db.updateRows(this.tableName, uDatas);
+                this._parseData(uDatas);
                 return uDatas;
             } else {
                 return [];

+ 2 - 2
app/view/payment/detail.ejs

@@ -10,7 +10,7 @@
 <div class="panel-content">
     <div class="panel-title fluid">
         <div class="title-main  d-flex justify-content-between">
-            <div><a href="/payment/<%- ctx.tender.id %>/list/<%- trInfo.id %>"><i class="fa fa-chevron-left mr-2"></i></a><%- ctx.tender.name %> / <%- trInfo.rpt_name %> / <%- ctx.detail.code %></div>
+            <div><a class="mr-2" href="/payment/<%- ctx.tender.id %>/list/<%- trInfo.id %>"><i class="fa fa-chevron-left"></i> 返回</a><%- ctx.tender.name %> / <%- trInfo.rpt_name %> / <%- ctx.detail.code %></div>
             <div>
                 <% if ((ctx.detail.status == auditConst.status.uncheck || ctx.detail.status == auditConst.status.checkNo) && trInfo.is_change) { %>
                 <span class="text-danger pull-right">报表内容已发生变化,请删除并重新生成详情</span>
@@ -42,7 +42,7 @@
                                 <% if (item.type === 'textarea') { %>
                                     <textarea <% if (ctx.detail.readOnly) { %>readonly<% } %> class="form-control form-control-sm" data-index="<%- item.index %>"><%- item.value %></textarea>
                                 <% } else { %>
-                                    <input <% if (ctx.detail.readOnly) { %>readonly<% } %> type="<%- item.type %>" value="<%- item.value %>"  data-index="<%- item.index %>" class="form-control form-control-sm" placeholder="请输入">
+                                    <input <% if (ctx.detail.readOnly) { %>readonly<% } %> type="<%- item.type %>" value="<%- item.type === 'number' && ctx.helper._.indexOf(item.value, '元') !== -1 ? parseFloat(item.value) : item.value %>"  data-index="<%- item.index %>" class="form-control form-control-sm" placeholder="请输入">
                                 <% } %>
                             </div>
                             <% } %>

+ 1 - 1
app/view/payment/list.ejs

@@ -1,7 +1,7 @@
 <div class="panel-content">
     <div class="panel-title fluid">
         <div class="title-main  d-flex justify-content-between">
-            <div><a href="/payment"><i class="fa fa-chevron-left mr-2"></i></a><%- ctx.tender.name %></div>
+            <div><a class="mr-2" href="/payment"><i class="fa fa-chevron-left"></i> 返回</a><%- ctx.tender.name %></div>
             <div>
                 <% if (ctx.session.sessionUser.accountId === trInfo.uid && trInfo.is_del === 0 && rptMsg) { %>
                 <% if (trDetailList.length === 0 || (trDetailList.length !== 0 && trDetailList[0].status === auditConst.status.checked)) { %>

+ 1 - 1
app/view/payment/process.ejs

@@ -1,7 +1,7 @@
 <div class="panel-content">
     <div class="panel-title fluid">
         <div class="title-main  d-flex justify-content-between">
-            <div><a href="/payment"><i class="fa fa-chevron-left mr-2"></i></a><%- ctx.tender.name %> / 标段设置</div>
+            <div><a class="mr-2" href="/payment"><i class="fa fa-chevron-left"></i> 返回</a><%- ctx.tender.name %> / 标段设置</div>
         </div>
     </div>
     <div class="content-wrap">

+ 3 - 1
sql/update.sql

@@ -15,4 +15,6 @@ UPDATE `zh_sub_project` p LEFT JOIN `zh_budget` b ON p.budget_id = b.id SET p.st
 UPDATE `zh_sub_project` p LEFT JOIN `zh_budget_std` bs ON p.std_id = bs.id SET p.std_name = IFNULL(bs.name, '');
 
 -- index
-ALTER TABLE `zh_material_bills_history` ADD INDEX `idx_mbid_mid_mspread` (`mb_id`, `mid`, `m_spread`);
+ALTER TABLE `zh_material_bills_history` ADD INDEX `idx_mbid_mid_mspread` (`mb_id`, `mid`, `m_spread`);
+
+ALTER TABLE `zh_project` ADD `payment_setting` JSON NULL DEFAULT NULL COMMENT '支付审批模块设置' AFTER `fun_set`;