Просмотр исходного кода

合同支付增加用途选项

ellisran 7 часов назад
Родитель
Сommit
036ae819ee

+ 10 - 0
app/const/contract.js

@@ -73,6 +73,16 @@ const defaultColSet = {
     ],
 };
 
+const defaultAttribute = [
+    { name: '税率(%)', field: 'type', fixed: ['alias'], type: 'int' },
+    { name: '数值', field: 'num_val', fixed: [], type: 'int' },
+    { name: '丙方', field: 'third', fixed: [], type: 'text' },
+    { name: '丁方', field: 'fourth', fixed: [], type: 'text' },
+    { name: '文本', field: 'text', fixed: [], type: 'text' },
+    { name: '合同内容', field: 'contract_content', fixed: [], type: 'long_text', tip: '独占一行,上限1000' },
+    { name: '支付条件', field: 'pay_condition', fixed: [], type: 'long_text', tip: '独占一行,上限1000' },
+];
+
 module.exports = {
     type,
     typeMap,

+ 14 - 1
app/controller/contract_controller.js

@@ -209,7 +209,14 @@ module.exports = app => {
                         responseData.data = commonJson && commonJson[(data.is_tender ? 'tender_' : '') + 'contract_type'] ? commonJson[(data.is_tender ? 'tender_' : '') + 'contract_type'] : [];
                         break;
                     case 'set-contract-type':
-                        result = await ctx.service.subProject.saveCommonJsons(ctx.subProject.id, ['contract_type', 'tender_contract_type'], data.contract_type);
+                        result = await ctx.service.subProject.saveCommonJsons(ctx.subProject.id, ['contract_', 'tender_contract_type'], data.contract_type);
+                        break;
+                    case 'get-contract-used':
+                        const commonJson2 = ctx.subProject.common_json ? JSON.parse(ctx.subProject.common_json) : null;
+                        responseData.data = commonJson2 && commonJson2[(data.is_tender ? 'tender_' : '') + 'contract_used'] ? commonJson2[(data.is_tender ? 'tender_' : '') + 'contract_used'] : [];
+                        break;
+                    case 'set-contract-used':
+                        result = await ctx.service.subProject.saveCommonJsons(ctx.subProject.id, ['contract_used', 'tender_contract_used'], data.contract_used);
                         break;
                     default: throw '参数有误';
                 }
@@ -278,6 +285,7 @@ module.exports = app => {
                     ctx.contract.valuation, ctx.contract.measure_type) : await ctx.service.budgetStd.getStdList(ctx.subProject.std_id, 'yu');
                 const commonJson = ctx.subProject.common_json ? JSON.parse(ctx.subProject.common_json) : null;
                 const types = commonJson && commonJson[(ctx.contract_tender ? 'tender_' : '') + 'contract_type'] ? commonJson[(ctx.contract_tender ? 'tender_' : '') + 'contract_type'] : [];
+                const used = commonJson && commonJson[(ctx.contract_tender ? 'tender_' : '') + 'contract_used'] ? commonJson[(ctx.contract_tender ? 'tender_' : '') + 'contract_used'] : [];
                 const shenpi_status = ctx.contract_tender ? ctx.subProject.page_show.openContractTenderShenpi : ctx.subProject.page_show.openContractSubProjectShenpi;
                 const pay_shenpi_status = ctx.contract_tender ? ctx.subProject.page_show.openContractPayTenderShenpi : ctx.subProject.page_show.openContractPaySubProjectShenpi;
                 const renderData = {
@@ -289,6 +297,7 @@ module.exports = app => {
                     contractConst,
                     whiteList,
                     types,
+                    used,
                     thisUrl: `/sp/${ctx.subProject.id}` + (ctx.contract_tender ? `/contract/tender/${ctx.contract.id}/detail` : '/contract/detail'),
                     stdChapters,
                     is_setting: false,
@@ -846,10 +855,14 @@ module.exports = app => {
                 const commonJson = ctx.subProject.common_json ? JSON.parse(ctx.subProject.common_json) : null;
                 const types = commonJson && commonJson.contract_type ? commonJson.contract_type : [];
                 const tender_types = commonJson && commonJson.tender_contract_type ? commonJson.tender_contract_type : [];
+                const used = commonJson && commonJson.contract_used ? commonJson.contract_used : [];
+                const tender_used = commonJson && commonJson.tender_contract_used ? commonJson.tender_contract_used : [];
                 const renderData = {
                     types_from,
                     types,
                     tender_types,
+                    used,
+                    tender_used,
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.contract.setting),
                     thisUrl: `/sp/${ctx.subProject.id}/contract${types_from === 'tender' ? '/tender' : ''}/setting`,
                     is_setting: true,

+ 4 - 0
app/public/js/contract_detail.js

@@ -521,6 +521,7 @@ $(document).ready(function() {
                 paysHtml += `<tr class="text-center" data-cpid="${pay.id}">
                                         <td style="position: relative">${idx + 1}${ pay.fpcid ? '<a href="javascript:void(0);" style="position: absolute;right: 2px;top:50%;transform: translate(-50%, -50%);"><i class="fa fa-cny"></i></a>' : ''}</td>
                                         <td>${moment(pay.pay_time).format('YYYY-MM-DD')}</td>
+                                        <td>${pay.used}</td>
                                         <td>${pay.pay_price}</td>
                                         <td>${pay.debit_price}</td>
                                         <td>${pay.yf_price}</td>
@@ -1807,6 +1808,7 @@ $(document).ready(function() {
     function setPayModalInfo(cpInfo = null) {
         $('#cons-addpay input[name="pay_time"]').val(cpInfo ? moment(cpInfo.pay_time).format('YYYY-MM-DD') : '');
         payTime.selectDate(cpInfo ? new Date(cpInfo.pay_time) : '');
+        $('#cons-addpay select[name="used"]').val(cpInfo ? cpInfo.used : '合同');
         $('#cons-addpay input[name="pay_price"]').val(cpInfo ? cpInfo.pay_price : '');
         $('#cons-addpay input[name="debit_price"]').val(cpInfo ? cpInfo.debit_price : '');
         $('#cons-addpay input[name="yf_price"]').val(cpInfo ? cpInfo.yf_price : '');
@@ -2366,6 +2368,7 @@ $(document).ready(function() {
         }
         const data = {
             pay_time: $('#cons-addpay input[name="pay_time"]').val(),
+            used: $('#cons-addpay select[name="used"]').val(),
             pay_price: $('#cons-addpay input[name="pay_price"]').val() || 0,
             debit_price: $('#cons-addpay input[name="debit_price"]').val() || 0,
             yf_price: $('#cons-addpay input[name="yf_price"]').val() || 0,
@@ -2415,6 +2418,7 @@ $(document).ready(function() {
         const data = {
             id: cpInfo.id,
             pay_time: $('#cons-addpay input[name="pay_time"]').val(),
+            used: $('#cons-addpay select[name="used"]').val(),
             pay_price: $('#cons-addpay input[name="pay_price"]').val() || 0,
             debit_price: $('#cons-addpay input[name="debit_price"]').val() || 0,
             yf_price: $('#cons-addpay input[name="yf_price"]').val() || 0,

+ 94 - 64
app/public/js/contract_setting.js

@@ -7,66 +7,109 @@
  * @date 2019/3/19
  * @version
  */
-function setTypeTable(types, type) {
-    $('#'+ type + '-type-table').empty();
+function setTypeTable(types, type, fun = 'type') {
+    $('#'+ type + '-'+ fun +'-table').empty();
+    if (fun === 'used') {
+        $('#' + type + '-' + fun + '-table').append(`<tr>
+                                                <td>合同</td>
+                                                <td></td>
+                                            </tr>`);
+    }
     types.forEach(t => {
         const typeRow = `<tr>
                                     <td><input class="form-control form-control-sm" name="value" placeholder="请输入值" value="${t}"></td>
                                     <td>
-                                        <a href="javascript:void(0);" class="btn btn-sm text-danger remove-type-btn"><i class="fa fa-remove"></i></a>
+                                        <a href="javascript:void(0);" class="btn btn-sm text-danger remove-${fun}-btn"><i class="fa fa-remove"></i></a>
                                     </td>
                                 </tr>`;
-        $('#'+ type + '-type-table').append(typeRow);
+        $('#'+ type + '-'+ fun +'-table').append(typeRow);
     });
 }
 $(document).ready(() => {
     autoFlashHeight();
-    // setTypeTable(types_from === 'subProject' ? subProject_types : tender_types);
-    // $('#bd-set-1').on('show.bs.modal', function () {
-    //     $('#type-table').empty();
-    //     // 看url上是否带有tender
-    //     const is_tender = window.location.pathname.includes('tender') ? 1 : 0;
-    //     console.log(window.location, is_tender);
-    //     postData(`/sp/${spid}/contract/audit/save`, { type: 'get-contract-type', is_tender }, function (types) {
-    //         setTypeTable(types);
-    //     });
-    // });
-    $('#addType').click(function(){
-        const type = $('#types-tabs a.active').attr('type');
-        const newType = `<tr>
+    const funs = ['type', 'used'];
+    for (const fun of funs) {
+        $('#add-' + fun + '-btn').click(function(){
+            const type = $('#' + fun + '-tabs a.active').attr('type');
+            const newType = `<tr>
                                 <td><input class="form-control form-control-sm" name="value" placeholder="请输入值" value=""></td>
                                 <td>
-                                    <a href="javascript:void(0);" class="btn btn-sm text-danger remove-type-btn"><i class="fa fa-remove"></i></a>
+                                    <a href="javascript:void(0);" class="btn btn-sm text-danger remove-${fun}-btn"><i class="fa fa-remove"></i></a>
                                 </td>
                             </tr>`;
-        $('#'+ type + '-type-table').append(newType);
-    });
+            $('#'+ type + '-' + fun + '-table').append(newType);
+        });
 
-    $('body').on('click', '.remove-type-btn', function() {
-        const input = $(this).parents('td').siblings('td').eq(0).children('input');
-        input.attr('disabled', true);
-        // 文字加删除线并移除foucs
-        if (input.val() === '') {
-            input.removeAttr('placeholder');
-        }
-        input.css('text-decoration', 'line-through');
-        input.blur();
-        $(this).remove();
-        checkAndShowTypesBtn();
-    });
+        $('body').on('click', '.remove-' + fun + '-btn', function() {
+            const input = $(this).parents('td').siblings('td').eq(0).children('input');
+            input.attr('disabled', true);
+            // 文字加删除线并移除foucs
+            if (input.val() === '') {
+                input.removeAttr('placeholder');
+            }
+            input.css('text-decoration', 'line-through');
+            input.blur();
+            $(this).remove();
+            checkAndShowTypesBtn(fun);
+        });
 
-    $('body').on('blur', '#contract-types-set input[name="value"]', function() {
-        checkAndShowTypesBtn();
-    });
+        $('body').on('blur', '#contract-' + fun + '-set input[name="value"]', function() {
+            checkAndShowTypesBtn(fun);
+        });
 
-    function checkAndShowTypesBtn(return_type = false) {
+        $('#set-' + fun + '-btn').click(function() {
+            const { new_subProject_types, new_tender_types } = checkAndShowTypesBtn(fun, true);
+            const data = {
+                type: 'set-contract-' + fun,
+            }
+            if (fun === 'type') {
+                data.contract_type = {
+                    contract_type: new_subProject_types,
+                    tender_contract_type: new_tender_types
+                };
+            } else if (fun === 'used') {
+                data.contract_used = {
+                    contract_used: new_subProject_types,
+                    tender_contract_used: new_tender_types
+                }
+            }
+            postData(`/sp/${spid}/contract/audit/save`, data, function (res) {
+                toastr.success('设置成功');
+                if (fun === 'type') {
+                    tender_type = new_tender_types;
+                    subProject_type = new_subProject_types;
+                } else if (fun === 'used') {
+                    tender_used = new_tender_types;
+                    subProject_used = new_subProject_types;
+                }
+                setTypeTable(new_tender_types, 'tender', fun);
+                setTypeTable(new_subProject_types, 'subProject', fun);
+                checkAndShowTypesBtn(fun);
+            });
+        });
+
+        $('#cancel-' + fun + '-btn').click(function() {
+            toastr.warning('已取消改动');
+            if (fun === 'type') {
+                setTypeTable(tender_type, 'tender', fun);
+                setTypeTable(subProject_type, 'subProject', fun);
+            } else if (fun === 'used') {
+                setTypeTable(tender_used, 'tender', fun);
+                setTypeTable(subProject_used, 'subProject', fun);
+            }
+            checkAndShowTypesBtn(fun);
+        });
+    }
+
+    function checkAndShowTypesBtn(fun, return_type = false) {
         const new_subProject_types = [];
         const new_tender_types = [];
         const type = ['subProject', 'tender'];
         for (const t of type) {
-            $('#'+ t + '-type-table tr').each(function () {
+            $('#'+ t + '-' + fun + '-table tr').each(function () {
                 const input = $(this).find('input[name="value"]');
-                if (!input.prop('disabled')) {
+                console.log(input.val());
+                if (input && input.val() !== undefined && !input.prop('disabled')) {
                     const value = input.val().trim();
                     if (value) {
                         if (t === 'subProject') {
@@ -78,12 +121,19 @@ $(document).ready(() => {
                 }
             });
         }
-        console.log(new_tender_types, tender_types, new_subProject_types, subProject_types);
-        // 用lodash对比数组内容是否相同
-        if (_.isEqual(new_tender_types.sort(), tender_types.sort()) && _.isEqual(new_subProject_types.sort(), subProject_types.sort())) {
-            $('#show-type-btn').hide();
-        } else {
-            $('#show-type-btn').show();
+        if (fun === 'type') {
+            // 判断数组是否相同,但别改变原数组顺序
+            if (_.isEqual(_.sortBy(new_tender_types), _.sortBy(tender_type)) && _.isEqual(_.sortBy(new_subProject_types), _.sortBy(subProject_type))) {
+                $('#show-'+ fun +'-btn').hide();
+            } else {
+                $('#show-' + fun + '-btn').show();
+            }
+        } else if (fun === 'used') {
+            if (_.isEqual(_.sortBy(new_tender_types), _.sortBy(tender_used)) && _.isEqual(_.sortBy(new_subProject_types), _.sortBy(subProject_used))) {
+                $('#show-'+ fun +'-btn').hide();
+            } else {
+                $('#show-' + fun + '-btn').show();
+            }
         }
         if (return_type) {
             return {
@@ -93,26 +143,6 @@ $(document).ready(() => {
         }
     }
 
-    $('#set-type-btn').click(function() {
-        const { new_subProject_types, new_tender_types } = checkAndShowTypesBtn(true);
-        postData(`/sp/${spid}/contract/audit/save`, { type: 'set-contract-type', contract_type: { contract_type: new_subProject_types, tender_contract_type: new_tender_types } }, function (res) {
-            toastr.success('设置成功');
-            tender_types = new_tender_types;
-            subProject_types = new_subProject_types;
-            setTypeTable(tender_types, 'tender');
-            setTypeTable(subProject_types, 'subProject');
-            checkAndShowTypesBtn();
-        });
-    });
-
-    $('#cancel-type-btn').click(function() {
-        toastr.warning('已取消改动');
-        // const is_tender = $('#types-tabs a.active').attr('type') === 'subPorjct' ? 0 : 1;
-        setTypeTable(tender_types, 'tender');
-        setTypeTable(subProject_types, 'subProject');
-        checkAndShowTypesBtn();
-    });
-
     $('#contract-shenpi-set input[type="checkbox"]').change(function() {
         postData(`/sp/${spid}/contract/setting/update`, { type: 'page_show',
             openContractSubProjectShenpi: $('#openContractSubProjectShenpi')[0].checked,

+ 16 - 0
app/service/contract_pay.js

@@ -70,6 +70,7 @@ module.exports = app => {
                     cid,
                     uid: this.ctx.session.sessionUser.accountId,
                     pay_time: data.pay_time,
+                    used: data.used || '合同',
                     pay_price: data.pay_price,
                     debit_price: data.debit_price,
                     yf_price: data.yf_price,
@@ -181,6 +182,7 @@ module.exports = app => {
                         fpid,
                         fpcid: p.id,
                         pay_time: times,
+                        used: p.used || '合同',
                         pay_price: p.pay_price || 0,
                         debit_price: 0,
                         yf_price: p.pay_price || 0,
@@ -196,6 +198,20 @@ module.exports = app => {
                 for (const c of contracts) {
                     await this.calcContract(transaction, c);
                 }
+                const commonJson = this.ctx.subProject.common_json ? JSON.parse(this.ctx.subProject.common_json) : {};
+                const used = commonJson && commonJson.tender_contract_used ? commonJson.tender_contract_used : [];
+                const addUsed = this._.uniq(this._.map(pays, 'used'));
+                // 还要判断里面有叫"合同"的值,如果有则去除
+                const index = addUsed.indexOf('合同');
+                if (index > -1) {
+                    addUsed.splice(index, 1);
+                }
+                // 判断addUsed和used对比是否有新增的值,如果有则更新分项目的common_json
+                if (this._.difference(addUsed, used).length > 0) {
+                    const newUsed = this._.uniq([...used, ...addUsed]);
+                    commonJson.tender_contract_used = newUsed;
+                    await transaction.update(this.ctx.service.subProject.tableName, { id: this.ctx.subProject.id, common_json: JSON.stringify(commonJson) });
+                }
             }
         }
 

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

@@ -176,13 +176,13 @@
                                     <thead>
                                     <tr class="text-center">
                                         <% if (ctx.contract_type === contractConst.type.income) { %>
-                                            <th width="4%">序号</th><th width="5%">回款日期</th><th width="8%">回款金额</th><th width="8%">扣款金额</th><th width="8%">应回金额</th><th width="8%">实回金额</th><th width="5%">回款方式</th><th width="5%">创建人</th><th width="9%">创建时间</th><th width="10%">备注</th><th width="5%">附件</th>
+                                            <th width="4%">序号</th><th width="5%">回款日期</th><th width="5%">用途</th><th width="7%">回款金额</th><th width="7%">扣款金额</th><th width="7%">应回金额</th><th width="7%">实回金额</th><th width="5%">回款方式</th><th width="5%">创建人</th><th width="9%">创建时间</th><th width="10%">备注</th><th width="4%">附件</th>
                                             <% if (pay_shenpi_status) { %>
                                             <th width="15%">审批进度</th>
                                             <% } %>
                                             <th width="10%">操作</th>
                                         <% } else if (ctx.contract_type === contractConst.type.expenses) { %>
-                                            <th width="4%">序号</th><th width="5%">支付日期</th><th width="8%">付款金额</th><th width="8%">扣款金额</th><th width="8%">应付金额</th><th width="8%">实付金额</th><th width="5%">支付方式</th><th width="5%">创建人</th><th width="9%">创建时间</th><th width="10%">备注</th><th width="5%">附件</th>
+                                            <th width="4%">序号</th><th width="5%">支付日期</th><th width="5%">用途</th><th width="7%">付款金额</th><th width="7%">扣款金额</th><th width="7%">应付金额</th><th width="7%">实付金额</th><th width="5%">支付方式</th><th width="5%">创建人</th><th width="9%">创建时间</th><th width="10%">备注</th><th width="4%">附件</th>
                                             <% if (pay_shenpi_status) { %>
                                             <th width="15%">审批进度</th>
                                             <% } %>

+ 9 - 0
app/view/contract/detail_modal.ejs

@@ -161,6 +161,15 @@
                     <input class="datepicker-here form-control form-control-sm" name="pay_time" placeholder="点击选择时间" data-date-format="yyyy-MM-dd" data-language="zh" type="text" autocomplete="off">
                 </div>
                 <div class="form-group">
+                    <label>用途</label>
+                    <select class="form-control form-control-sm" name="used">
+                        <option>合同</option>
+                        <% for (u of used) { %>
+                        <option><%= u %></option>
+                        <% } %>
+                    </select>
+                </div>
+                <div class="form-group">
                     <label><% if (ctx.contract_type === contractConst.type.expenses) { %>付<% } else if (ctx.contract_type === contractConst.type.income) { %>回<% } %>款金额<b class="text-danger">*</b></label>
                     <input class="form-control form-control-sm" name="pay_price" placeholder="请输入<% if (ctx.contract_type === contractConst.type.expenses) { %>付<% } else if (ctx.contract_type === contractConst.type.income) { %>回<% } %>款金额" type="number">
                 </div>

+ 165 - 10
app/view/contract/setting.ejs

@@ -9,7 +9,7 @@
         <div class="c-body">
             <div class="sjs-height-0">
                 <div class="row m-0 mt-3">
-                    <div class="col-8">
+                    <div class="col-6">
                         <div class="card mb-3">
                             <div class="card-header">
                                 <div class="float-left">合同类型</div>
@@ -18,16 +18,16 @@
                                     <button id="set-type-btn" class="btn btn-sm btn-success">保存</button>
                                 </div>
                             </div>
-                            <div class="card-body" id="contract-types-set">
-                                <nav class="nav nav-tabs" id="types-tabs">
-                                    <a class="nav-link nav-item <% if (types_from === 'subProject') { %>active<% } %>" data-toggle="tab" data-tab="subProject-types-tab" href="#subProject-types-tab" role="tab" type="subProject">项目</a>
-                                    <a class="nav-link nav-item <% if (types_from !== 'subProject') { %>active<% } %>" data-toggle="tab" data-tab="tender-types-tab" href="#tender-types-tab" role="tab" type="tender">标段</a>
+                            <div class="card-body" id="contract-type-set">
+                                <nav class="nav nav-tabs" id="type-tabs">
+                                    <a class="nav-link nav-item <% if (types_from === 'subProject') { %>active<% } %>" data-toggle="tab" data-tab="subProject-type-tab" href="#subProject-type-tab" role="tab" type="subProject">项目</a>
+                                    <a class="nav-link nav-item <% if (types_from !== 'subProject') { %>active<% } %>" data-toggle="tab" data-tab="tender-type-tab" href="#tender-type-tab" role="tab" type="tender">标段</a>
                                     <div class="ml-auto">
-                                        <a href="javascript:void(0);" style="vertical-align: sub;" id="addType">新增类型</a>
+                                        <a href="javascript:void(0);" style="vertical-align: sub;" id="add-type-btn">新增类型</a>
                                     </div>
                                 </nav>
                                 <div class="tab-content my-2">
-                                    <div class="tab-pane <% if (types_from === 'subProject') { %>active<% } %>" id="subProject-types-tab" style="max-height: 400px;overflow: auto;">
+                                    <div class="tab-pane <% if (types_from === 'subProject') { %>active<% } %>" id="subProject-type-tab" style="max-height: 400px;overflow: auto;">
                                         <table class="table table-bordered">
                                             <thead><tr class="text-center">
                                                 <th width="60%">名称</th>
@@ -46,7 +46,7 @@
                                             </tbody>
                                         </table>
                                     </div>
-                                    <div class="tab-pane <% if (types_from !== 'subProject') { %>active<% } %>" id="tender-types-tab" style="max-height: 400px;overflow: auto;">
+                                    <div class="tab-pane <% if (types_from !== 'subProject') { %>active<% } %>" id="tender-type-tab" style="max-height: 400px;overflow: auto;">
                                         <table class="table table-bordered">
                                             <thead><tr class="text-center">
                                                 <th width="60%">名称</th>
@@ -68,6 +68,159 @@
                                 </div>
                             </div>
                         </div>
+                    </div>
+                    <div class="col-6">
+                        <div class="card mb-3">
+                            <div class="card-header">
+                                <div class="float-left">资金用途</div>
+                                <div class="float-right" id="show-used-btn" style="display: none">
+                                    <button id="cancel-used-btn" class="btn btn-sm btn-secondary">取消</button>
+                                    <button id="set-used-btn" class="btn btn-sm btn-success">保存</button>
+                                </div>
+                            </div>
+                            <div class="card-body" id="contract-used-set">
+                                <nav class="nav nav-tabs" id="used-tabs">
+                                    <a class="nav-link nav-item <% if (types_from === 'subProject') { %>active<% } %>" data-toggle="tab" data-tab="subProject-used-tab" href="#subProject-used-tab" role="tab" type="subProject">项目</a>
+                                    <a class="nav-link nav-item <% if (types_from !== 'subProject') { %>active<% } %>" data-toggle="tab" data-tab="tender-used-tab" href="#tender-used-tab" role="tab" type="tender">标段</a>
+                                    <div class="ml-auto">
+                                        <a href="javascript:void(0);" style="vertical-align: sub;" id="add-used-btn">新增用途</a>
+                                    </div>
+                                </nav>
+                                <div class="tab-content my-2">
+                                    <div class="tab-pane <% if (types_from === 'subProject') { %>active<% } %>" id="subProject-used-tab" style="max-height: 400px;overflow: auto;">
+                                        <table class="table table-bordered">
+                                            <thead><tr class="text-center">
+                                                <th width="60%">名称</th>
+                                                <th>操作</th>
+                                            </tr>
+                                            </thead>
+                                            <tbody class="text-center" id="subProject-used-table">
+                                            <tr>
+                                                <td>合同</td>
+                                                <td></td>
+                                            </tr>
+                                            <% for (const type of used) { %>
+                                                <tr>
+                                                    <td><input class="form-control form-control-sm" name="value" placeholder="请输入值" value="<%- type %>"></td>
+                                                    <td>
+                                                        <a href="javascript:void(0);" class="btn btn-sm text-danger remove-used-btn"><i class="fa fa-remove"></i></a>
+                                                    </td>
+                                                </tr>
+                                            <% } %>
+                                            </tbody>
+                                        </table>
+                                    </div>
+                                    <div class="tab-pane <% if (types_from !== 'subProject') { %>active<% } %>" id="tender-used-tab" style="max-height: 400px;overflow: auto;">
+                                        <table class="table table-bordered">
+                                            <thead><tr class="text-center">
+                                                <th width="60%">名称</th>
+                                                <th>操作</th>
+                                            </tr>
+                                            </thead>
+                                            <tbody class="text-center" id="tender-used-table">
+                                            <tr>
+                                                <td>合同</td>
+                                                <td></td>
+                                            </tr>
+                                            <% for (const type of tender_used) { %>
+                                                <tr>
+                                                    <td><input class="form-control form-control-sm" name="value" placeholder="请输入值" value="<%- type %>"></td>
+                                                    <td>
+                                                        <a href="javascript:void(0);" class="btn btn-sm text-danger remove-used-btn"><i class="fa fa-remove"></i></a>
+                                                    </td>
+                                                </tr>
+                                            <% } %>
+                                            </tbody>
+                                        </table>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="col-8">
+                        <div class="card mb-3">
+                            <div class="card-header d-flex justify-content-between">
+                                <div class="card-title mb-0">合同附加属性(未开发完,勿点!)</div>
+                                <span class="pull-right">项目/标段合同同步生效</span>
+                            </div>
+                            <div class="card-body">
+                                <table class="table">
+                                    <tr class="text-center">
+                                        <th width="15%">名称</th>
+                                        <th width="15%">类型</th>
+                                        <th width="15%">别名</th>
+                                        <th width="10%">显示</th>
+                                        <th width="">说明</th>
+                                        <th width="15%">操作</th>
+                                    </tr>
+                                    <tbody class="text-center">
+                                    <tr>
+                                        <td>税率(%)</td><td>数字</td><td>-</td>
+                                        <td><input type="checkbox" class=""></td>
+                                        <td></td>
+                                        <td>
+                                            <a href="#" class="mx-2 text-muted"><i class="fa fa-arrow-up"></i></a>
+                                            <a href="#" class="mx-2"><i class="fa fa-arrow-down"></i></a>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td>数值</td><td>数字</td><td><input type="text" class="form-control form-control-sm"></td>
+                                        <td><input type="checkbox" class=""></td>
+                                        <td></td>
+                                        <td>
+                                            <a href="#" class="mx-2"><i class="fa fa-arrow-up"></i></a>
+                                            <a href="#" class="mx-2"><i class="fa fa-arrow-down"></i></a>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td>丙方</td><td>文本</td><td><input type="text" class="form-control form-control-sm"></td>
+                                        <td><input type="checkbox" class=""></td>
+                                        <td></td>
+                                        <td>
+                                            <a href="#" class="mx-2"><i class="fa fa-arrow-up"></i></a>
+                                            <a href="#" class="mx-2"><i class="fa fa-arrow-down"></i></a>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td>丁方</td><td>文本</td><td><input type="text" class="form-control form-control-sm"></td>
+                                        <td><input type="checkbox" class=""></td>
+                                        <td></td>
+                                        <td>
+                                            <a href="#" class="mx-2"><i class="fa fa-arrow-up"></i></a>
+                                            <a href="#" class="mx-2"><i class="fa fa-arrow-down"></i></a>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td>文本</td><td>文本</td><td><input type="text" class="form-control form-control-sm"></td>
+                                        <td><input type="checkbox" class=""></td>
+                                        <td></td>
+                                        <td>
+                                            <a href="#" class="mx-2"><i class="fa fa-arrow-up"></i></a>
+                                            <a href="#" class="mx-2"><i class="fa fa-arrow-down"></i></a>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td>合同内容</td><td>长文本</td><td><input type="text" class="form-control form-control-sm"></td>
+                                        <td><input type="checkbox" class=""></td>
+                                        <td>独占一行,上限1000</td>
+                                        <td>
+                                            <a href="#" class="mx-2"><i class="fa fa-arrow-up"></i></a>
+                                            <a href="#" class="mx-2"><i class="fa fa-arrow-down"></i></a>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td>支付条件</td><td>长文本</td><td><input type="text" class="form-control form-control-sm"></td>
+                                        <td><input type="checkbox" class=""></td>
+                                        <td>独占一行,上限1000</td>
+                                        <td>
+                                            <a href="#" class="mx-2"><i class="fa fa-arrow-up"></i></a>
+                                            <a href="#" class="mx-2 text-muted"><i class="fa fa-arrow-down"></i></a>
+                                        </td>
+                                    </tr>
+                                    </tbody>
+                                </table>
+                            </div>
+                        </div>
                         <div class="card mb-3">
                             <div class="card-header">
                                 <div class="float-left">审批设置</div>
@@ -105,6 +258,8 @@
 </div>
 <script>
     const types_from = JSON.parse(unescape('<%- escape(JSON.stringify(types_from)) %>'));
-    let subProject_types = JSON.parse(unescape('<%- escape(JSON.stringify(types)) %>'));
-    let tender_types = JSON.parse(unescape('<%- escape(JSON.stringify(tender_types)) %>'));
+    let subProject_type = JSON.parse(unescape('<%- escape(JSON.stringify(types)) %>'));
+    let tender_type = JSON.parse(unescape('<%- escape(JSON.stringify(tender_types)) %>'));
+    let subProject_used = JSON.parse(unescape('<%- escape(JSON.stringify(used)) %>'));
+    let tender_used = JSON.parse(unescape('<%- escape(JSON.stringify(tender_used)) %>'));
 </script>

+ 1 - 0
sql/update.sql

@@ -25,6 +25,7 @@ ADD COLUMN `need_shenpi` tinyint(1) NULL COMMENT '是否需要审批' AFTER `fpc
 ADD COLUMN `status` tinyint(2) NULL DEFAULT 1 COMMENT '审批状态' AFTER `need_shenpi`,
 ADD COLUMN `times` tinyint(3) NULL DEFAULT 1 COMMENT '审批次数' AFTER `status`,
 ADD COLUMN `sp_group` int(11) NULL DEFAULT 0 COMMENT '固定审批组id' AFTER `times`,
+ADD COLUMN `used` varchar(255) NULL DEFAULT '合同' COMMENT '资金用途' AFTER `pay_time`,
 ADD COLUMN `final_auditor_str` varchar(50) NOT NULL DEFAULT '' COMMENT '终审人相关(cache)' AFTER `sp_group`,
 ADD COLUMN `sf_json` text NULL COMMENT '实付json数据' AFTER `sf_price`;