Browse Source

新建变更令增加下拉方案搜索

ellisran 10 months ago
parent
commit
1ded30e83c
3 changed files with 49 additions and 3 deletions
  1. 10 3
      app/public/js/change.js
  2. 3 0
      app/view/change/index.ejs
  3. 36 0
      app/view/change/modal.ejs

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

@@ -13,7 +13,7 @@ function getNewCode() {
         if (code !== '') {
             $('#bj-code').val(code);
             if (openChangePlan && changePlanList && _.findIndex(changePlanList, { code: code }) !== -1) {
-                $('#plan-code').val(code);
+                $('#plan-code').val(code).trigger('change');;
             }
         }
     });
@@ -515,7 +515,14 @@ $(document).ready(() => {
     $('#bj-code').change(function () {
         const code = $(this).val();
         if (openChangePlan && changePlanList && _.findIndex(changePlanList, { code: code }) !== -1) {
-            $('#plan-code').val(code);
+            $('#plan-code').val(code).trigger('change');
         }
-    })
+    });
+
+    $('#plan-code').select2({
+        language: 'zh-CN',
+        theme: 'bootstrap4',
+        selectOnClose: true,
+        // width: '150',
+    });
 });

+ 3 - 0
app/view/change/index.ejs

@@ -162,6 +162,9 @@
 </div>
 <script src="/public/js/sub_menu.js"></script>
 <script  src="/public/js/colResizable/colResizable-1.6.min.js"></script>
+<link href="/public/css/bootstrap/select2.min.css" rel="stylesheet" />
+<link rel="stylesheet" href="/public/css/bootstrap/select2-bootstrap4.min.css">
+<script src="/public/js/bootstrap/select2.min.js"></script>
 <script>
     $.subMenu({
         menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',

+ 36 - 0
app/view/change/modal.ejs

@@ -62,6 +62,42 @@
                     </div>
                 </div>
                 <% if (ctx.session.sessionProject.page_show.openChangePlan) { %>
+                    <style>
+                        .select2-container {
+                            /*display: inline-block!important;*/
+                            /*height: 27px;*/
+                            width: 100% !important;
+                        }
+                        .select2-container--bootstrap4 .select2-selection--single {
+                            height: calc(1.1em + .75rem + 2px) !important;
+                        }
+                        /*.select2-container--bootstrap4 .select2-selection {*/
+                        /*    background-color: #f8f9fa;*/
+                        /*    !*border-color: #f8f9fa;*!*/
+                        /*    border: 1px solid #f8f9fa;*/
+                        /*}*/
+                        /*.select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered:focus{*/
+                        /*    box-shadow: 0 0 0 0.2rem rgba(216,217,219,.5);*/
+                        /*}*/
+                        /*.select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered:hover {*/
+                        /*    background-color: #e2e6ea;*/
+                        /*    border-color: #dae0e5;*/
+                        /*}*/
+                        .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered {
+                            line-height: calc(1.1em + .75rem);
+                            /*color: #007bff!important;*/
+                            border-radius: 0.2rem;
+                            /*background-color: #f8f9fa;*/
+                            /*border-color: #f8f9fa;*/
+                        }
+                        .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow b {
+                            border-color: #007bff transparent transparent transparent;
+                            border-width: 4px 3.7px 0;
+                        }
+                        .select2-search--dropdown .select2-search__field {
+                            padding: 0.175rem 0.5rem;
+                        }
+                    </style>
                     <div class="form-group">
                         <label>关联变更方案</label>
                         <select class="form-control form-control-sm" id="plan-code">