Browse Source

变更单位提供参建单位选择

ellisran 1 year ago
parent
commit
779304b9f4

+ 2 - 1
app/controller/change_controller.js

@@ -617,6 +617,7 @@ module.exports = app => {
                 // 获取用户人验证手机号
                 const pa = await ctx.service.projectAccount.getDataById(ctx.session.sessionUser.accountId);
                 const auth_mobile = pa.auth_mobile;
+                const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
                 const renderData = {
                     tender,
                     change,
@@ -635,6 +636,7 @@ module.exports = app => {
                     upUnit: change.up_decimal ? change.up_decimal : ctx.tender.info.decimal.up,
                     authMobile: auth_mobile,
                     shenpiConst,
+                    unitList,
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.change.information),
                     preUrl: '/tender/' + ctx.tender.id + '/change/' + ctx.change.cid + '/information',
                     precision: ctx.tender.info.precision,
@@ -649,7 +651,6 @@ module.exports = app => {
                         columns: ['id', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group'],
                     });
                     renderData.accountList = accountList;
-                    const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });
                     renderData.accountGroup = unitList.map(item => {
                         const groupList = accountList.filter(item1 => item1.company === item.name);
                         return { groupName: item.name, groupList };

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

@@ -81,5 +81,8 @@ function selectCompanyHtml(data) {
     for (const s of data.select) {
         html.push('<option>'+ s.name +'</option>');
     }
+    for (const u of unitList) {
+        html.push('<option>'+ u.name +'</option>');
+    }
     $('#company').html(html);
 }

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

@@ -231,6 +231,9 @@
                                         <% for (const company of companyList) { %>
                                             <option <% if (company.name === change.company) { %>selected<% } %>><%- company.name %></option>
                                         <% } %>
+                                        <% for (const u of unitList) { %>
+                                            <option <% if (u.name === change.company) { %>selected<% } %>><%- u.name %></option>
+                                        <% } %>
                                     </select>
                                 </div>
                                 <div class="form-group">
@@ -481,6 +484,7 @@
     const changePosList = JSON.parse(unescape('<%- escape(JSON.stringify(changePosList)) %>'));
     const shenpi_status = <%- ctx.tender.info.shenpi.change %>;
     const shenpiConst = JSON.parse('<%- JSON.stringify(shenpiConst) %>');
+    const unitList = JSON.parse(unescape('<%- escape(JSON.stringify(unitList)) %>'));
     const changesUid = <%- change.uid %>;
 
     let back_changeInfo = {
@@ -498,7 +502,7 @@
         type: '<%- change.type %>',
         class: '<%- ctx.helper._.find(changeClass, { value: change.class }).checked ? change.class : changeClass[0].value %>',// 防止下拉不存在导致数据丢失上报问题
         quality: '<%- change.quality %>',
-        company: JSON.parse(unescape('<%- escape(JSON.stringify((change.company ? change.company : (companyList && companyList[0] ? companyList[0].name : '')))) %>')),
+        company: JSON.parse(unescape('<%- escape(JSON.stringify((change.company ? change.company : (companyList && companyList[0] ? companyList[0].name : (unitList && unitList[0] ? unitList[0].name : ''))))) %>')),
         charge: '<%- change.charge %>',
         w_code: JSON.parse(unescape('<%- escape(JSON.stringify(change.w_code ? change.w_code : '')) %>')),
     };