瀏覽代碼

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

Tony Kang 1 年之前
父節點
當前提交
e54dcd28da

+ 5 - 0
app/controller/change_controller.js

@@ -640,6 +640,9 @@ module.exports = app => {
                         const result = await ctx.service.change.saveOrderBy(data.updateData, data.newLedgerList);
                         responseData.data = result;
                         break;
+                    case 'order_site':
+                        await ctx.service.change.defaultUpdate({ order_site: data.listid }, { where: { cid: ctx.change.cid } });
+                        break;
                     case 'changeOrder':
                         await ctx.service.changeAuditList.changeOrder(data.postData);
                         break;
@@ -1557,6 +1560,7 @@ module.exports = app => {
                     edit = false;
                     revising = true;
                 }
+                change.order_site_msg = change.order_site ? await ctx.service.changeAuditList.getDataById(change.order_site) : null;
                 const renderData = await this._getDefaultReviseInfoData(ctx, change, !edit);
                 // 获取原报dsk数据
                 const accountInfo = await ctx.service.projectAccount.getDataById(change.uid);
@@ -1609,6 +1613,7 @@ module.exports = app => {
                     edit = false;
                     changing = true;
                 }
+                change.order_site_msg = change.order_site ? await ctx.service.changeAuditList.getDataById(change.order_site) : null;
                 const renderData = {
                     change,
                     tpUnit: change.tp_decimal ? change.tp_decimal : ctx.tender.info.decimal.tp,

+ 5 - 1
app/public/js/change_information_add_list.js

@@ -285,6 +285,11 @@ $(document).ready(() => {
                         });
                     } else {
                         const cInfo = select.deal_id ? _.find(changeList, { lid: select.deal_id }) : _.find(changeList, { gcl_id: select.gcl_id, mx_id: select.mx_id });
+                        if (changeOrder && _.findIndex(oldChangeList, { id: cInfo.id }) !== -1) {
+                            toastr.warning('插入台账清单功能下无法从这移除已勾选清单');
+                            info.sheet.setValue(info.row, info.col, 1);
+                            return
+                        }
                         if (_.find(changeUsedData, {cbid: cInfo.id})) {
                             toastr.warning('该清单已被使用,无法取消变更');
                             info.sheet.setValue(info.row, info.col, 1);
@@ -297,7 +302,6 @@ $(document).ready(() => {
                             postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {
                                 type: 'del-change-list',
                                 ids: [cInfo.id],
-                                postData: null
                             }, function (result) {
                                 changeList = result.changeList;
                                 select.is_change = 0;

+ 9 - 0
app/public/js/change_information_set.js

@@ -2016,6 +2016,15 @@ $(document).ready(() => {
             });
         }
     });
+
+    $('#set-site-btn').click(function () {
+        if (changeOrder) {
+            const select = SpreadJsObj.getSelectObject(changeSpreadSheet);
+            postDataAsync(window.location.pathname + '/save', { type:'order_site', listid: select ? select.id : null }, function (result) {
+            });
+        }
+        window.location.href = window.location.pathname + '/revise';
+    });
 });
 function checkSelectAll() {
     let check = $('#code-list tr').length > 0 ? true : false;

+ 12 - 2
app/public/js/change_revise.js

@@ -656,6 +656,11 @@ $(document).ready(() => {
                         });
                         console.log(data);
                     } else {
+                        if (changeOrder && _.findIndex(oldChangeList, { gcl_id: select.id }) !== -1) {
+                            toastr.warning('插入台账清单功能下无法从这移除已勾选清单');
+                            info.sheet.setValue(info.row, info.col, 1);
+                            return
+                        }
                         const cInfo = _.find(changeList, { gcl_id: select.id });
                         if (_.find(changeUsedData, { cbid: cInfo.id })) {
                             toastr.warning('该清单计量单元已被使用,无法取消勾选');
@@ -666,7 +671,7 @@ $(document).ready(() => {
                             info.sheet.setValue(info.row, info.col, 1);
                             return
                         } else {
-                            postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {type: 'del-change-list', ids: [cInfo.id], postData: null }, function (result) {
+                            postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {type: 'del-change-list', ids: [cInfo.id] }, function (result) {
                                 changeList = result.changeList;
                                 select.is_change = 0;
                             }, function () {
@@ -1810,6 +1815,11 @@ $(document).ready(() => {
                             info.sheet.setValue(info.row, info.col, 0);
                         });
                     } else {
+                        if (changeOrder && _.findIndex(oldChangeList, { gcl_id: select.lid, mx_id: select.id }) !== -1) {
+                            toastr.warning('插入台账清单功能下无法从这移除已勾选清单');
+                            info.sheet.setValue(info.row, info.col, 1);
+                            return
+                        }
                         const cInfo = _.find(changeList, { gcl_id: select.lid, mx_id: select.id });
                         if (_.find(changeUsedData, { cbid: cInfo.id })) {
                             toastr.warning('该计量单元已被使用,无法取消变更');
@@ -1820,7 +1830,7 @@ $(document).ready(() => {
                             info.sheet.setValue(info.row, info.col, 1);
                             return
                         } else {
-                            postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {type: 'del-change-list', ids: [cInfo.id], postData: null }, function (result) {
+                            postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {type: 'del-change-list', ids: [cInfo.id] }, function (result) {
                                 changeList = result.changeList;
                                 select.is_change = 0;
                                 // 判断是否只剩一个,并同步去勾

+ 5 - 3
app/service/change_audit_list.js

@@ -128,7 +128,7 @@ module.exports = app => {
          * 添加台账清单(从新增部位页新增)
          * @return {void}
          */
-        async adds(datas, data = null) {
+        async adds(datas) {
             if (!this.ctx.tender || !this.ctx.change) {
                 throw '数据错误';
             }
@@ -136,8 +136,9 @@ module.exports = app => {
             try {
                 let order = null;
                 if (this.ctx.change.order_by) {
+                    const data = this.ctx.change.order_site ? await this.getDataById(this.ctx.change.order_site) : null;
                     if (data) {
-                        order = parseInt(data) + 1;
+                        order = parseInt(data.order) + 1;
                         // order以下的清单+1
                         await this._syncOrder(transaction, this.ctx.change.cid, order, '+');
                     } else {
@@ -286,7 +287,8 @@ module.exports = app => {
                 await transaction.delete(this.tableName, { id: data.ids });
                 // // order以下的清单-1
                 if (this.ctx.change.order_by) {
-                    await this._syncOrder(transaction, this.ctx.change.cid, data.postData, '-', data.ids.length);
+                    const postData = this.ctx.change.order_site ? await this.getDataById(this.ctx.change.order_site) : null;
+                    await this._syncOrder(transaction, this.ctx.change.cid, (postData ? postData.order : null), '-', data.ids.length);
                 }
                 // 重新算变更令总额
                 await this.calcCamountSum(transaction);

+ 8 - 0
app/view/change/addlist.ejs

@@ -3,6 +3,13 @@
     <div class="panel-title">
         <div class="title-main  d-flex">
             <% include ./sub_mini_menu.ejs %>
+            <div>
+                <% if (change.order_by && change.order_site && change.order_site_msg) { %>
+                    <div class="d-inline-block">
+                        插入到:变更清单<%- change.order_site_msg.code %> 之后
+                    </div>
+                <% } %>
+            </div>
             <% if (ctx.session.sessionProject.page_show.openChangeRevise) { %>
             <div class="ml-auto">
                 <a class="btn btn-sm btn-primary mr-1" id="add-all-revise" href="javascript: void(0);">添加当前新增部位/清单</a>
@@ -63,6 +70,7 @@
     </div>
 </div>
 <script>
+    const changeOrder = parseInt('<%- change.order_by %>');
     const readOnly = <%- readOnly %>;
     const isYb = <%- isYb %>;
     const totalPriceUnit = '<%- tpUnit %>';

+ 1 - 1
app/view/change/information.ejs

@@ -393,7 +393,7 @@
                             <% if (!change.readOnly) { %>
                                 <div class="d-inline-block ml-1">
 <!--                                    <a href="#addlist" data-toggle="modal" class="btn btn-sm btn-light text-primary" id="open-list-modal" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="添加清单"><i class="fa fa-plus" aria-hidden="true"></i> <span class="order_text"><% if (change.order_by === 0) { %>添加<% } else { %>插入<% } %></span>台账清单</a>-->
-                                    <a href="/tender/<%- ctx.tender.id %>/change/<%- change.cid %>/information/revise" class="btn btn-sm btn-light text-primary" data-placement="bottom" title="" data-original-title="添加清单"><i class="fa fa-plus" aria-hidden="true"></i> <span class="order_text"><% if (change.order_by === 0) { %>添加<% } else { %>插入<% } %></span>台账清单</a>
+                                    <a href="javascript:void(0);" id="set-site-btn" class="btn btn-sm btn-light text-primary" data-placement="bottom" title="" data-original-title="添加清单"><i class="fa fa-plus" aria-hidden="true"></i> <span class="order_text"><% if (change.order_by === 0) { %>添加<% } else { %>插入<% } %></span>台账清单</a>
                                 </div>
                                 <% if (ctx.session.sessionProject.page_show.openChangeWhiteList) { %>
                                     <div class="d-inline-block mr-1">

+ 6 - 0
app/view/change/revise.ejs

@@ -5,6 +5,11 @@
             <% include ./sub_mini_menu.ejs %>
             <!--工具-->
             <div>
+                <% if (change.order_by && change.order_site && change.order_site_msg) { %>
+                <div class="d-inline-block">
+                    插入到:变更清单<%- change.order_site_msg.code %> 之后
+                </div>
+                <% } %>
                 <div class="d-inline-block">
                     <div class="dropdown">
                         <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@@ -173,6 +178,7 @@
     </div>
 </div>
 <script>
+    const changeOrder = parseInt('<%- change.order_by %>');
     const stdChapters = JSON.parse(unescape('<%- escape(JSON.stringify(stdChapters)) %>'));
     const stdBills = JSON.parse(unescape('<%- escape(JSON.stringify(stdBills)) %>'));
     const readOnly = <%- readOnly %>;

+ 1 - 1
app/view/change/sub_menu.ejs

@@ -1,5 +1,5 @@
 <div class="panel-sidebar" id="sub-menu">
-    <div class="sidebar-title" data-toggle="tooltip" data-placement="right" data-original-title="添加台账清单">添加台账清单</div>
+    <div class="sidebar-title" data-toggle="tooltip" data-placement="right" data-original-title="<%- ctx.change.order_by ? '插入' : '添加' %>台账清单"><%- ctx.change.order_by ? '插入' : '添加' %>台账清单</div>
     <div class="scrollbar-auto">
         <% include ./sub_menu_list.ejs %>
         <div class="side-show"></div>

+ 3 - 0
sql/update.sql

@@ -402,3 +402,6 @@ ALTER TABLE `zh_revise_bills_98`
 ADD COLUMN `features` varchar(1000) NOT NULL DEFAULT '' COMMENT '项目特征' AFTER `memo`;
 ALTER TABLE `zh_revise_bills_99`
 ADD COLUMN `features` varchar(1000) NOT NULL DEFAULT '' COMMENT '项目特征' AFTER `memo`;
+
+ALTER TABLE zh_change`
+ADD COLUMN `order_site` int(11) NULL DEFAULT NULL COMMENT 'order_by为自定义时插入到清单id值' AFTER `order_by`;