Browse Source

变更权限设置更新及生成更新

laiguoran 3 years ago
parent
commit
6a375c9f01
4 changed files with 50 additions and 16 deletions
  1. 22 0
      app/public/js/change_plan.js
  2. 1 0
      app/view/change/plan.ejs
  3. 21 12
      app/view/change/plan_modal.ejs
  4. 6 4
      app/view/setting/fun.ejs

+ 22 - 0
app/public/js/change_plan.js

@@ -187,6 +187,28 @@ $(document).ready(() => {
     // 新增变更令 确认
     $('#addOk').click(function () {
         $(this).attr('disabled', true);
+        if (!openChangeApply && $('#bj-name').val().length === 0) {
+            $('#bj-name').addClass('is-invalid');
+            $('#name_error_msg').show();
+            $('#name_error_msg').text('变更工程名称不能为空。');
+            $(this).attr('disabled', false);
+            setTimeout(function () {
+                $('#bj-name').removeClass('is-invalid');
+                $('#name_error_msg').hide();
+            }, 2000);
+            return;
+        }
+        if (!openChangeApply && $('#bj-name').val().length > 100) {
+            $('#bj-name').addClass('is-invalid');
+            $('#name_error_msg').show();
+            $('#name_error_msg').text('名称超过100个字,请缩减名称。');
+            $(this).attr('disabled', false);
+            setTimeout(function () {
+                $('#bj-name').removeClass('is-invalid');
+                $('#name_error_msg').hide();
+            }, 2000);
+            return;
+        }
         const data = {
             code: $('#bj-code').val(),
             apply_code: $('#apply-code').val(),

+ 1 - 0
app/view/change/plan.ejs

@@ -119,6 +119,7 @@
     let connectorRule = '<%- c_connector %>';
     const cRuleFirst = parseInt('<%- c_rule_first %>');
     const ruleType = parseInt('<%- ruleType %>');
+    const openChangeApply = parseInt('<%- ctx.session.sessionProject.page_show.openChangeApply %>');
     const rulesType = '<%- rule_type %>';
     const changeApplyList = JSON.parse(unescape('<%- escape(JSON.stringify(changeApplyList)) %>'));
 </script>

+ 21 - 12
app/view/change/plan_modal.ejs

@@ -37,18 +37,27 @@
                         <div class="invalid-feedback" style="display: none" id="bjHint">您输入的编号已存在。</div>
                     </div>
                 </div>
-                <div class="form-group">
-                    <label>关联变更申请</label>
-                    <select class="form-control form-control-sm" id="apply-code">
-                        <option></option>
-                        <% for (const cp of changeApplyList) { %>
-                        <% if (ctx.helper._.indexOf(acLists, cp.code) === -1) { %>
-                        <option><%- cp.code %></option>
-                        <% } %>
-                        <% } %>
-                    </select>
-                </div>
-                <input value="" type="hidden" id="bj-name">
+                <% if (ctx.session.sessionProject.page_show.openChangeApply) { %>
+                    <div class="form-group">
+                        <label>关联变更申请</label>
+                        <select class="form-control form-control-sm" id="apply-code">
+                            <option></option>
+                            <% for (const cp of changeApplyList) { %>
+                                <% if (ctx.helper._.indexOf(acLists, cp.code) === -1) { %>
+                                    <option><%- cp.code %></option>
+                                <% } %>
+                            <% } %>
+                        </select>
+                    </div>
+                    <input value="" type="hidden" id="bj-name">
+                <% } else { %>
+                    <div class="form-group">
+                        <label>变更工程名称<b class="text-danger">*</b></label>
+                        <input class="form-control form-control-sm" value="" type="text" id="bj-name">
+                        <div class="invalid-feedback" style="display: none" id="name_error_msg">名称超过100个字,请缩减名称。</div>
+                    </div>
+                    <input type="hidden" value="" id="apply-code">
+                <% } %>
             </div>
             <div class="modal-footer">
                 <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal" id="addCancel">关闭</button>

+ 6 - 4
app/view/setting/fun.ejs

@@ -121,14 +121,16 @@
     const updateSetting = function (tab = false) {
         if (!$('#openChangeApply')[0].checked && $('#openChangeProject')[0].checked && tab === 1) {
             $('#openChangeApply').prop('checked', true);
+            $('#openChangePlan').prop('checked', true);
         } else if (!$('#openChangeApply')[0].checked && $('#openChangeProject')[0].checked && tab === 2) {
             $('#openChangeProject').prop('checked', false);
         }
-        if ($('#openChangePlan')[0].checked && !$('#openChangeApply')[0].checked && tab === 2) {
-            $('#openChangePlan').prop('checked', false);
-        } else if ($('#openChangePlan')[0].checked && !$('#openChangeApply')[0].checked && tab === 3) {
-            $('#openChangeApply').prop('checked', true);
+        if (!$('#openChangePlan')[0].checked && $('#openChangeApply')[0].checked && tab === 2) {
+            $('#openChangePlan').prop('checked', true);
         }
+        // else if ($('#openChangePlan')[0].checked && !$('#openChangeApply')[0].checked && tab === 3) {
+        //     $('#openChangeApply').prop('checked', true);
+        // }
         postData('/setting/fun/update', {
             imType: parseInt($('[name=im_type]:checked').val()),
             banOver: $('[name=ban_over]')[0].checked,