seimin 2 gadi atpakaļ
vecāks
revīzija
9260dd0e8f
2 mainītis faili ar 97 papildinājumiem un 37 dzēšanām
  1. 35 36
      index.html
  2. 62 1
      js/index.js

+ 35 - 36
index.html

@@ -239,14 +239,15 @@
239 239
       </div>
240 240
     </div>
241 241
     {{else}}
242
-    <!-- 区域地点 -->
242
+    <!-- 校区区域地点 -->
243 243
     <div class="formItem">
244
-      <div class="label"><span class="required">*</span>区域地点:</div>
244
+      <div class="label"><span class="required">*</span>校区区域地点:</div>
245 245
       <div>
246 246
         <div class="areaplace">
247 247
           <div class="areaBox clearfix">
248
-            <select class="fl" id="area_list" style="font-size: 12px"></select>
249
-            <select class="fr" id="place_list" style="font-size: 12px"></select>
248
+            <select class="fl" id="branch_list" style="font-size: 12px;width: 115px;margin-right: 8px;"></select>
249
+            <select class="fl" id="area_list" style="font-size: 12px;width: 115px;margin-right: 8px;"></select>
250
+            <select class="fr" id="place_list" style="font-size: 12px;width: 115px;"></select>
250 251
           </div>
251 252
         </div>
252 253
       </div>
@@ -417,6 +418,12 @@
417 418
       </div>
418 419
     </div>
419 420
   </script>
421
+  <!-- 校区 -->
422
+  <script id="branch_list_temp" type="text/html">
423
+    {{each list}}
424
+    <option value="{{$value.id}}">{{$value.hosName}}</option>
425
+    {{/each}}
426
+  </script>
420 427
   <!-- 区域 -->
421 428
   <script id="area_list_temp" type="text/html">
422 429
     {{each list}}
@@ -700,10 +707,9 @@
700 707
           </li>
701 708
           <li class="pop1-hd__itemList">
702 709
             <strong>报修地址:</strong>
703
-            <span
704
-              >{{incident.place ? incident.place.area.area +
705
-              incident.place.place : ''}}{{address}}</span
706
-            >
710
+            <span>
711
+              {{branch?branch.hosName:''}} {{place ? place.area.area + ' ' + place.place : ''}} {{address}}
712
+            </span>
707 713
           </li>
708 714
           {{if wxIncidentWithCmdb == 1}}
709 715
           <li class="pop1-hd__itemList">
@@ -812,10 +818,9 @@
812 818
           </li>
813 819
           <li class="pop1-hd__itemList">
814 820
             <strong>报修地址:</strong>
815
-            <span
816
-              >{{incident.place ? incident.place.area.area +
817
-              incident.place.place : ''}}{{address}}</span
818
-            >
821
+            <span>
822
+              {{branch?branch.hosName:''}} {{place ? place.area.area + ' ' + place.place : ''}} {{address}}
823
+            </span>
819 824
           </li>
820 825
           {{if wxIncidentWithCmdb == 1}}
821 826
           <li class="pop1-hd__itemList">
@@ -930,10 +935,9 @@
930 935
           </li>
931 936
           <li class="pop1-hd__itemList">
932 937
             <strong>报修地址:</strong>
933
-            <span
934
-              >{{incident.place ? incident.place.area.area +
935
-              incident.place.place : ''}}{{address}}</span
936
-            >
938
+            <span>
939
+              {{branch?branch.hosName:''}} {{place ? place.area.area + ' ' + place.place : ''}} {{address}}
940
+            </span>
937 941
           </li>
938 942
           {{if wxIncidentWithCmdb == 1}}
939 943
           <li class="pop1-hd__itemList">
@@ -1054,10 +1058,9 @@
1054 1058
           </li>
1055 1059
           <li class="pop1-hd__itemList">
1056 1060
             <strong>报修地址:</strong>
1057
-            <span
1058
-              >{{incident.place ? incident.place.area.area +
1059
-              incident.place.place : ''}}{{address}}</span
1060
-            >
1061
+            <span>
1062
+              {{branch?branch.hosName:''}} {{place ? place.area.area + ' ' + place.place : ''}} {{address}}
1063
+            </span>
1061 1064
           </li>
1062 1065
           {{if wxIncidentWithCmdb == 1}}
1063 1066
           <li class="pop1-hd__itemList">
@@ -1184,10 +1187,9 @@
1184 1187
           </li>
1185 1188
           <li class="pop1-hd__itemList">
1186 1189
             <strong>报修地址:</strong>
1187
-            <span
1188
-              >{{incident.place ? incident.place.area.area +
1189
-              incident.place.place : ''}}{{address}}</span
1190
-            >
1190
+            <span>
1191
+              {{branch?branch.hosName:''}} {{place ? place.area.area + ' ' + place.place : ''}} {{address}}
1192
+            </span>
1191 1193
           </li>
1192 1194
           {{if wxIncidentWithCmdb == 1}}
1193 1195
           <li class="pop1-hd__itemList">
@@ -1312,10 +1314,9 @@
1312 1314
           </li>
1313 1315
           <li class="pop1-hd__itemList">
1314 1316
             <strong>报修地址:</strong>
1315
-            <span
1316
-              >{{incident.place ? incident.place.area.area +
1317
-              incident.place.place : ''}}{{address}}</span
1318
-            >
1317
+            <span>
1318
+              {{branch?branch.hosName:''}} {{place ? place.area.area + ' ' + place.place : ''}} {{address}}
1319
+            </span>
1319 1320
           </li>
1320 1321
           {{if wxIncidentWithCmdb == 1}}
1321 1322
           <li class="pop1-hd__itemList">
@@ -1440,10 +1441,9 @@
1440 1441
           </li>
1441 1442
           <li class="pop1-hd__itemList">
1442 1443
             <strong>报修地址:</strong>
1443
-            <span
1444
-              >{{incident.place ? incident.place.area.area +
1445
-              incident.place.place : ''}}{{address}}</span
1446
-            >
1444
+            <span>
1445
+              {{branch?branch.hosName:''}} {{place ? place.area.area + ' ' + place.place : ''}} {{address}}
1446
+            </span>
1447 1447
           </li>
1448 1448
           {{if wxIncidentWithCmdb == 1}}
1449 1449
           <li class="pop1-hd__itemList">
@@ -1642,10 +1642,9 @@
1642 1642
           </li>
1643 1643
           <li class="pop1-hd__itemList">
1644 1644
             <strong>报修地址:</strong>
1645
-            <span
1646
-              >{{incident.place ? incident.place.area.area +
1647
-              incident.place.place : ''}}{{address}}</span
1648
-            >
1645
+            <span>
1646
+              {{branch?branch.hosName:''}} {{place ? place.area.area + ' ' + place.place : ''}} {{address}}
1647
+            </span>
1649 1648
           </li>
1650 1649
           {{if wxIncidentWithCmdb == 1}}
1651 1650
           <li class="pop1-hd__itemList">

+ 62 - 1
js/index.js

@@ -19,6 +19,7 @@ $(function () {
19 19
   );
20 20
   $("#areaPlaceRoom").html(template("areaPlaceRoom_temp", { ifRoom: ifRoom }));
21 21
   // repairMain.valueconfig = '2';
22
+  var areaList = []; //获取到的区域列表
22 23
   var placeList = []; //获取到的地点列表
23 24
   var roomList = []; //获取到的房间号列表
24 25
   var wxId = ""; //微信报修ID
@@ -86,6 +87,8 @@ $(function () {
86 87
     sum: 10,
87 88
     solution: { title: "", status: { id: 72 }, solutionRange: 1 },
88 89
   });
90
+  // 获取校区列表
91
+  getBranchList({ idx: 0, sum: 1000 });
89 92
   // 获取区域列表
90 93
   getAreaList({ idx: 0, sum: 1000, area: { wechatArea: true } });
91 94
   // 获取地点列表
@@ -489,7 +492,34 @@ $(function () {
489 492
       solution: { title: val, status: { id: 72 } },
490 493
     });
491 494
   }
492
-
495
+  //选择框联动-选校区
496
+  $("#branch_list").on("change", function () {
497
+    //获取id
498
+    var id = $(this).val();
499
+    // 过滤数据
500
+    var resFilter = { list: [] };
501
+    for (var i = 0; i < areaList.length; i++) {
502
+      if (areaList[i]["branch"] == id) {
503
+        resFilter.list.push(areaList[i]);
504
+      }
505
+    }
506
+    //填充数据
507
+    var html = template("area_list_temp", resFilter);
508
+    $("#area_list").html(html);
509
+    // 过滤数据
510
+    var resFilter1 = { list: [] };
511
+    for (var i = 0; i < placeList.length; i++) {
512
+      if (placeList[i]["area"]["id"] == resFilter.list[0].id) {
513
+        resFilter1.list.push(placeList[i]);
514
+      }
515
+    }
516
+    //填充数据
517
+    var html = template("place_list_temp", resFilter1);
518
+    $("#place_list").html(html);
519
+    if (resFilter1.list.length) {
520
+      $("#bx_address").val(resFilter1.list[0].place);
521
+    }
522
+  });
493 523
   //选择框联动-选区域
494 524
   $("#area_list").on("change", function () {
495 525
     //获取id
@@ -577,6 +607,13 @@ $(function () {
577 607
         $("#bx_name").val("");
578 608
       }
579 609
     }
610
+    if ($("#branch_list").val() < 1) {
611
+      alert("校区不能为空");
612
+      //按钮禁止取消
613
+      $(this).removeProp("disabled");
614
+      $(this).removeClass("f-submit--disable");
615
+      return;
616
+    }
580 617
     if ($("#area_list").val() < 1) {
581 618
       alert("区域不能为空");
582 619
       //按钮禁止取消
@@ -625,6 +662,7 @@ $(function () {
625 662
     var data = { verification: "true" };
626 663
     data.incident = {
627 664
       address: $.trim($("#bx_address").val()),
665
+      branch: {id: $.trim($("#branch_list").val())},
628 666
       areaId: $.trim($("#area_list").val()),
629 667
       bxcode: wxId,
630 668
       contacts: $.trim($("#bx_name").val()),
@@ -1030,6 +1068,25 @@ $(function () {
1030 1068
       },
1031 1069
     });
1032 1070
   }
1071
+  //获取校区列表
1072
+  function getBranchList(data) {
1073
+    $.ajax({
1074
+      type: "POST",
1075
+      contentType: "application/json;charset=UTF-8",
1076
+      url: baseUrl + "user/data/fetchDataList/branch",
1077
+      data: JSON.stringify(data),
1078
+      success: function (res) {
1079
+        if (res.status == 200) {
1080
+          var html = template("branch_list_temp", res);
1081
+          $("#branch_list").html(html);
1082
+          $("#branch_list").val(loginUser.branch.id);
1083
+        }
1084
+      },
1085
+      error: function (err) {
1086
+        console.log(err);
1087
+      },
1088
+    });
1089
+  }
1033 1090
   //获取区域列表
1034 1091
   function getAreaList(data) {
1035 1092
     $.ajax({
@@ -1039,6 +1096,10 @@ $(function () {
1039 1096
       data: JSON.stringify(data),
1040 1097
       success: function (res) {
1041 1098
         if (res.status == 200) {
1099
+          areaList = JSON.parse(JSON.stringify(res.list));
1100
+          res.list = res.list.filter((v) => {
1101
+            return v.branch == loginUser.branch.id;
1102
+          });
1042 1103
           var html = template("area_list_temp", res);
1043 1104
           $("#area_list").html(html);
1044 1105
           $("#area_list").val(loginUser.place.area.id);