瀏覽代碼

合同管理数据调整

MaiXinRong 2 年之前
父節點
當前提交
ae80983aca

+ 1 - 2
app/controller/tender_controller.js

@@ -1464,11 +1464,10 @@ module.exports = app => {
                         case 'pm_deal':
                             if (accountPermission.PermissionCheck.viewPmData(this.ctx.session.sessionUser.permission)) {
                                 const selects = await this.ctx.service.project.getPmDealCache(this.ctx.session.sessionProject.id);
-                                // todo 接入项目管理系统
                                 const pm = require('../lib/pm');
                                 const tenders = await pm.dealCatagory(ctx, this.ctx.session.sessionProject.code);
                                 tenders.forEach(x => {
-                                    x.selected = selects.indexOf(x.id + '') >= 0;
+                                    x.selected = selects.indexOf(x.bidsectionId + '') >= 0;
                                 });
                                 responseData.data[f] = tenders;
                             } else {

+ 3 - 5
app/lib/pm.js

@@ -11,14 +11,12 @@
 // 加密类
 const jwt = require('jsonwebtoken');
 const privateKey = 'jl2pm3850key888sc';
-// todo 修改请求链接
 const dealCatagoryApi = '/api/external/jlbb/folder';
-const dealDataApi = '/api/external/jlbb/folder';
+const dealDataApi = '/api/external/jlbb/contract';
 
 const pmUtils = {
     getJwt() {
-        // todo jwt加密
-        return jwt.sign({}, privateKey, {expiresIn: '5s', algorithm: 'HS256'});
+        return jwt.sign({}, privateKey, {expiresIn: '10m', algorithm: 'HS256'});
     },
     async postData(ctx, url, data) {
         const res = await ctx.curl(url, {
@@ -63,7 +61,7 @@ module.exports = {
 
         const url = ctx.app.config.managementProxyPath + dealDataApi;
         try {
-            const data = { code: pCode, token: pmUtils.getJwt(), key: ['contracts'], bidsection_id: selects };
+            const data = { code: pCode, token: pmUtils.getJwt(), key: ['contracts'], bidsectionid: selects };
             return await pmUtils.postData(ctx, url, data);
         } catch (err) {
             ctx.log(err);

+ 6 - 5
app/public/report/js/rpt_other_stage.js

@@ -1,12 +1,12 @@
 const rptOtherStage = (function (){
     const info = {
-        advance: { title: '请选择预付款', colHeader: ['类型', '期', '审批状态'], colValue: ['typeStr', 'orderStr', 'statusStr'] },
-        pm_deal: { title: '请选择合同管理', colHeader: ['名称'], colValue: ['name'], active: true },
+        advance: { title: '请选择预付款', colHeader: ['类型', '期', '审批状态'], colValue: ['typeStr', 'orderStr', 'statusStr'], key: 'id' },
+        pm_deal: { title: '请选择合同管理', colHeader: ['名称'], colValue: ['name'], active: true, key: 'bidsectionId' },
     };
     const data = {};
     let curType = '';
     const initList = function () {
-        const header = info[curType].colHeader, value = info[curType].colValue;
+        const header = info[curType].colHeader, value = info[curType].colValue, key = info[curType].key;
         const headerHtml = [];
         headerHtml.push('<tr class="text-center"><th>选择</th>');
         for (const h of header) {
@@ -18,7 +18,7 @@ const rptOtherStage = (function (){
         for (const a of arr) {
             const aHtml = [];
             const checked = a.selected ? 'checked' : '';
-            aHtml.push(`<tr class="text-center"><td><input type="checkbox" name="sos-check" ${checked} value="${a.id}"></td>`);
+            aHtml.push(`<tr class="text-center"><td><input type="checkbox" name="sos-check" ${checked} value="${a[key]}"></td>`);
             for (const v of value) {
                 aHtml.push(`<td>${a[v]}</td>`);
             }
@@ -42,10 +42,11 @@ const rptOtherStage = (function (){
         })
     };
     const updateOtherStage = async function () {
+        const key = info[curType].key;
         const updateData = {};
         updateData[curType] = [];
         $('[name=sos-check]').each((i, c) => {
-            const ci = data[curType].find(x => { return x.id == c.value });
+            const ci = data[curType].find(x => { return x[key] == c.value });
             const checked = c.checked ? 1 : 0;
             if (ci && ci.selected !== checked) {
                 updateData[curType].push({id: c.value, selected: c.checked})

+ 1 - 1
app/service/report.js

@@ -292,7 +292,7 @@ module.exports = app => {
                             runnableRst.push(params.budget_id ? budgetSource.budgetFinal(params.budget_id) : budgetSource.tenderFinal(params.tender_id));
                             runnableKey.push(filter);
                             break;
-                        case 'mem_pm_deal':
+                        case 'mem_pm_deal_pay':
                             runnableRst.push(service.reportMemory.getPmDeal());
                             runnableKey.push(filter);
                             break;

+ 3 - 3
app/service/report_memory.js

@@ -1360,13 +1360,13 @@ module.exports = app => {
             const pm = require('../lib/pm');
             this.pmDeal = await pm.dealData(this.ctx, this.ctx.session.sessionProject.code, selects);
 
-            result = this.pmDeal.contracts ? this.pmDeal.contracts.filter(x => { return x.contracts_type === 2 }) : [];
+            result = this.pmDeal.contracts ? this.pmDeal.contracts.filter(x => { return x.ContractsType === 2 }) : [];
             // 排序:标段-合同类别-创建时间
             result.sort((x, y) => {
-                const bidSort = selects.indexOf(x.bidsection_id + '') - selects.indexOf(y.bidsection_id + '');
+                const bidSort = selects.indexOf(x.BidsectionId + '') - selects.indexOf(y.BidsectionId + '');
                 if (bidSort) return bidSort;
 
-                const typeSort = x.contracts_type - y.contracts_type;
+                const typeSort = x.ContractsType - y.ContractsType;
                 if (typeSort) return typeSort;
 
                 return x.create_time - y.create_time;