Browse Source

feat: 预付款金额未填写弹窗提示逻辑变更

lanjianrong 4 years ago
parent
commit
70d99a889a
4 changed files with 18 additions and 11 deletions
  1. 4 4
      app/const/advance.js
  2. 10 3
      app/public/js/advance.js
  3. 2 2
      app/router.js
  4. 2 2
      app/view/advance/modal.ejs

+ 4 - 4
app/const/advance.js

@@ -12,15 +12,15 @@
 const typeCol = [
     { key: 'start', type: 0, name: '开工预付款' },
     { key: 'material', type: 1, name: '材料预付款' },
-    { key: 'safe', type: 2, name: '安全生产预付款' },
-    { key: 'dust', type: 3, name: '扬尘污染预付款' },
+    { key: 'safe', type: 2, name: '安全生产预付款' },
+    { key: 'dust', type: 3, name: '扬尘污染预付款' },
 ];
 
 const typeColMap = {
     0: { text: '开工预付款', value: 'start' },
     1: { text: '材料预付款', value: 'material' },
-    2: { text: '安全生产预付款', value: 'safe' },
-    3: { text: '扬尘污染预付款', value: 'dust' },
+    2: { text: '安全生产预付款', value: 'safe' },
+    3: { text: '扬尘污染预付款', value: 'dust' },
 };
 
 

+ 10 - 3
app/public/js/advance.js

@@ -10,9 +10,9 @@
 
 $(document).ready(function () {
 
-    if (!advancePayTotal) {
-        $('#erro').modal('show');
-    }
+    // if (!advancePayTotal) {
+    //     $('#erro').modal('show');
+    // }
 
     // $('#advance_add').click(function() {
     //     postData(`${window.location.pathname}/${type}/create`, {}, res => {
@@ -33,6 +33,13 @@ $(document).ready(function () {
     //     return false
     // })
 
+    $('.ml-auto').submit(function () {
+        if (!advancePayTotal) {
+            $('#erro').modal('show');
+            return false;
+        }
+        return true;
+    })
     $('#advanceList').on('click', `a[href="#file"]`, function() {
         const { fileList = [] } = advanceList.find(item => item.id === parseInt($(this).data('id')))
         $('#file-content').empty()

+ 2 - 2
app/router.js

@@ -137,8 +137,8 @@ module.exports = app => {
     // 预付款
     app.get('/tender/:id/advance/:type', sessionAuth, tenderCheck, 'advanceController.index');
     // app.get('/tender/:id/advance/material', sessionAuth, tenderCheck, 'advanceController.materialList');
-    app.post('/tender/:id/advance/create', sessionAuth, tenderCheck, 'advanceController.create');
-    app.post('/tender/:id/advance/delete', sessionAuth, tenderCheck, 'advanceController.delete');
+    app.post('/tender/:id/advance/:type/create', sessionAuth, tenderCheck, 'advanceController.create');
+    app.post('/tender/:id/advance/:type/delete', sessionAuth, tenderCheck, 'advanceController.delete');
     app.get('/tender/:id/advance/:order/detail', sessionAuth, tenderCheck, advanceCheck, 'advanceController.detail');
     app.post('/tender/:id/advance/:type/create', sessionAuth, tenderCheck, 'advanceController.create');
     app.post('/tender/:id/advance/:order/audit/add', sessionAuth, tenderCheck, advanceCheck, 'advanceController.addAudit');

+ 2 - 2
app/view/advance/modal.ejs

@@ -6,8 +6,8 @@
                 <h5 class="modal-title">提示</h5>
             </div>
             <div class="modal-body">
-                <p>预付款金额未填写,无法使用「预付款」,请先填写预付款金额;</p>
-                <p>进入「标段概况」打开「合同参数」填写预付款金额。</p>
+                <p><%- typeColMap[type].text %>金额未填写,无法使用「<%- typeColMap[type].text %> 」,请先填写<%- typeColMap[type].text %>金额;</p>
+                <p>进入「标段概况」打开「合同参数」填写<%- typeColMap[type].text %>金额。</p>
             </div>
             <div class="modal-footer">
               <a href="/tender/<%- ctx.tender.id %>" class="btn btn-sm btn-primary">标段概况</a>