瀏覽代碼

故障耗材

seimin 11 月之前
父節點
當前提交
2e5fe370a1

+ 303 - 142
assets/js/controllers/businessConfiguration/faultConsumablesCtrl.js

@@ -82,15 +82,15 @@ app.controller("faultConsumablesCtrl", [
82
         enableFiltering: false,
82
         enableFiltering: false,
83
       },
83
       },
84
       {
84
       {
85
-        name: "content",
86
-        displayName: "别名",
87
-        width: "30%",
85
+        name: "category.mutiCategory",
86
+        displayName: "故障现象",
87
+        width: "20%",
88
         enableFiltering: false,
88
         enableFiltering: false,
89
       },
89
       },
90
       {
90
       {
91
-        name: "category.category",
92
-        displayName: "故障现象",
93
-        width: "30%",
91
+        name: "consumableDTOSName",
92
+        displayName: "耗材信息",
93
+        width: "40%",
94
         enableFiltering: false,
94
         enableFiltering: false,
95
       },
95
       },
96
       {
96
       {
@@ -111,6 +111,64 @@ app.controller("faultConsumablesCtrl", [
111
         return "无";
111
         return "无";
112
       }
112
       }
113
     };
113
     };
114
+    //树形图
115
+    // 将故障现象搜索结果返回的数据整理成children模式
116
+    function transform(nodes) {
117
+      var treeConverter = {
118
+          result: null, //转化后的结果,是根节点,所有节点都是从根节点长出来的
119
+          attributeName: 'id', //节点唯一标识符
120
+          needFind: true, //是否查询节点在result中已经存在,为了优化效率
121
+          transform: function (node) { //转化递归函数,参数:一个待插入节点
122
+
123
+              if (node.parent != null) { //该节点有父节点
124
+                  var newNode = this.transform(node.parent); //递归进入,返回值为一个节点,用作父节点,该父节点必然存在于result中,这点由下面的算法可以控制
125
+                  if (this.needFind) {
126
+                      for (var i = 0; i < newNode.children.length; i++) { //查找要插入的node子节点是否在newNode这个父节点中存在
127
+                          if (newNode.children[i][this.attributeName] === node[this.attributeName]) {
128
+                              return newNode.children[i]; //存在的话直接返回newNode父节点内的该子节点,该子节点必然存在于result中,作为返回值它将被用作上级递归的newNode,因此newNode必然存在于result中
129
+                          }
130
+                      }
131
+                  }
132
+                  this.needFind = false; //不存在的话,关闭之后递归的循环判断,因为待插入node节点不存在于result中,故而它的子节点一定不存在于result中,不用再循环判断
133
+                  //   delete node.parent; //删除该节点的parent属性,如果有的话
134
+                  node.children = []; //因为确定是要新插入的节点,没有children:[]属性,故给该节点增加children:[]属性
135
+
136
+                  newNode.children.push(node); //将该node节点push进newNode的子节点数组中
137
+                  return node; //return该新插入节点,作为递归返回值给上层,用作newNode父节点,node存在于result中故newNode存在于result中
138
+              } else if (node.parent == null) { //该叶节点没有父节点,即为根节点
139
+                  //   delete node.parent; //删除该节点的parent属性,如果有的话
140
+                  if (this.result == null) { //根节点不存在
141
+                      node.children = []; //给该节点增加children:[]属性
142
+                      return this.result = node; //该节点赋给result,并return根节点,作为返回值它将被用作上级递归的newNode,因此newNode必然存在于result中
143
+                  } else {
144
+                      node.children = [];
145
+                      // 顶级去重
146
+                      for (var i = 0; i < this.result.children.length; i++) {
147
+                          if (this.result.children[i][this.attributeName] === node[this.attributeName]) {
148
+                              return this.result.children[i];
149
+                          }
150
+                      }
151
+                      this.result.children.push(node)
152
+                      return node // 直接return根节点,作为返回值它将被用作上级递归的newNode,因此newNode必然存在于result中
153
+                  }
154
+              }
155
+          },
156
+          getWhole: function (nodes, attributeName) { //传入整个叶子节点数组,attributeName作为节点唯一标识符属性,返回整个转化结果
157
+              var _node = {};
158
+              _node.children = [];
159
+              this.result = _node; //重置根节点
160
+              this.attributeName = attributeName == null ? 'id' : attributeName; //唯一标识符默认为“id”
161
+              nodes = JSON.parse(JSON.stringify(nodes)); //复制出一个新的节点对象作为参数,保证不改变原有数据
162
+              nodes.forEach(item => { //循环调用转化方法
163
+                  this.needFind = true; //重置开启节点是否已存在判断,保证不插入重复节点
164
+                  this.transform(item);
165
+              })
166
+              return this.result; //返回根节点
167
+          }
168
+      }
169
+      var result = treeConverter.getWhole(nodes); //调用
170
+      return result;
171
+  }
114
     function selectItem(pmodel, childrens) {
172
     function selectItem(pmodel, childrens) {
115
       if (angular.isArray(pmodel)) {
173
       if (angular.isArray(pmodel)) {
116
         angular.forEach(pmodel, function (index) {
174
         angular.forEach(pmodel, function (index) {
@@ -141,31 +199,56 @@ app.controller("faultConsumablesCtrl", [
141
     $scope.saveData = function (selectdata) {
199
     $scope.saveData = function (selectdata) {
142
       console.log(selectdata);
200
       console.log(selectdata);
143
       var modalInstance = $modal.open({
201
       var modalInstance = $modal.open({
144
-        templateUrl: "assets/views/system/tpl/commonFaultSymptomschange.html",
145
-        controller: function ($scope, scope, $modalInstance, api_user_data,api_bpm_data) {
202
+        templateUrl: "assets/views/system/tpl/faultConsumableschange.html",
203
+        controller: function ($rootScope, $scope, scope, $modalInstance, api_user_data,api_bpm_data) {
146
           selectdata.category.selected = true;
204
           selectdata.category.selected = true;
147
           $scope.deptdata = {
205
           $scope.deptdata = {
148
             id: selectdata.id,
206
             id: selectdata.id,
149
-            content: selectdata.content,
207
+            consumableIds: selectdata.consumableDTOS || [],
150
             category: selectdata.category
208
             category: selectdata.category
151
           };
209
           };
152
           $scope.categoryList = [];
210
           $scope.categoryList = [];
153
-          $scope.title = "常用故障现象修改";
211
+          $scope.title = "故障耗材修改";
212
+
213
+          // 耗材列表模糊搜索
214
+          $scope.searchConsumable = function (key = "") {
215
+            var deptData = {
216
+              idx: 0,
217
+              sum: 10,
218
+              consumable: {
219
+                keyWord: key,
220
+              },
221
+            };
222
+            api_user_data
223
+              .fetchDataList("consumable", deptData)
224
+              .then(function (data) {
225
+                var ids = $scope.deptdata.consumableIds.map(v=>v.id);
226
+                $scope.consumableList = data.list.filter(v=>!ids.includes(v.id));
227
+              });
228
+          };
154
           // --------------------
229
           // --------------------
155
           $scope.select_treedata = [];
230
           $scope.select_treedata = [];
156
-          $scope.try_async_load = function (s, fn) {
231
+          $rootScope.bala1 = $scope.try_async_load = function (s, fn) {
157
             if (s) {
232
             if (s) {
158
               var filterKeyword = s.filterKeyword;
233
               var filterKeyword = s.filterKeyword;
159
             }
234
             }
160
             var postData = {
235
             var postData = {
161
               idx: 0,
236
               idx: 0,
162
-              sum: 1000,
237
+              sum: 9999,
238
+              incidentcategory: {
239
+                selectType: "pinyin_qs",
240
+                "hierarchyQuery":"two",
241
+                "categoryConsumable":1,
242
+              }
163
             };
243
             };
164
             if (filterKeyword) {
244
             if (filterKeyword) {
165
-              postData.incidentcategory = {
166
-                selectType: "pinyin_qs",
167
-                category: filterKeyword,
168
-              };
245
+              postData.incidentcategory.category = filterKeyword;
246
+            }
247
+            // 当前所属院区或责任科室
248
+            if($rootScope.user.duty){
249
+              postData.incidentcategory.duty = $rootScope.user.duty.id;
250
+            }else if($rootScope.user.branch){
251
+                postData.incidentcategory.branch = $rootScope.user.branch.id;
169
             }
252
             }
170
             $scope.my_data = [];
253
             $scope.my_data = [];
171
             $scope.doing_async = true;
254
             $scope.doing_async = true;
@@ -218,19 +301,20 @@ app.controller("faultConsumablesCtrl", [
218
           $scope.savercode = function (deptdata) {
301
           $scope.savercode = function (deptdata) {
219
             if (
302
             if (
220
               deptdata &&
303
               deptdata &&
221
-              deptdata.content &&
304
+              deptdata.consumableIds &&
222
               deptdata.category
305
               deptdata.category
223
             ) {
306
             ) {
224
               var fildata = {
307
               var fildata = {
225
-                incidentCategoryContent: {
308
+                incidentCategoryConsumable: {
226
                   id: deptdata.id,
309
                   id: deptdata.id,
227
                   deleteFlag: 0,
310
                   deleteFlag: 0,
228
-                  content: deptdata.content,
311
+                  consumableIds: deptdata.consumableIds.map(v => v.id).toString(),
229
                   category: deptdata.category,
312
                   category: deptdata.category,
230
                 },
313
                 },
231
               };
314
               };
315
+              fildata.incidentCategoryConsumable = Object.assign({}, selectdata, fildata.incidentCategoryConsumable)
232
               api_user_data
316
               api_user_data
233
-                .updData("incidentCategoryContent", fildata)
317
+                .addData("incidentCategoryConsumable", fildata)
234
                 .then(function (response) {
318
                 .then(function (response) {
235
                   if (response) {
319
                   if (response) {
236
                     if (response.status == 200) {
320
                     if (response.status == 200) {
@@ -243,17 +327,6 @@ app.controller("faultConsumablesCtrl", [
243
                           scope.refreshData("expand-right", scope.fileData);
327
                           scope.refreshData("expand-right", scope.fileData);
244
                         }
328
                         }
245
                       );
329
                       );
246
-                    } else if (response.status == 500) {
247
-                      SweetAlert.swal(
248
-                        {
249
-                          title: "修改失败!",
250
-                          text: "该故障现象已存在",
251
-                          type: "error",
252
-                        },
253
-                        function () {
254
-                          scope.refreshData("expand-right", scope.fileData);
255
-                        }
256
-                      );
257
                     } else {
330
                     } else {
258
                       SweetAlert.swal(
331
                       SweetAlert.swal(
259
                         {
332
                         {
@@ -341,16 +414,32 @@ app.controller("faultConsumablesCtrl", [
341
     }
414
     }
342
     $scope.addData = function () {
415
     $scope.addData = function () {
343
       var modalInstance = $modal.open({
416
       var modalInstance = $modal.open({
344
-        templateUrl: "assets/views/system/tpl/commonFaultSymptomschange.html",
345
-        controller: function ($scope, $modalInstance, api_user_data,api_bpm_data) {
417
+        templateUrl: "assets/views/system/tpl/faultConsumableschange.html",
418
+        controller: function ($rootScope, $scope, $modalInstance, api_user_data,api_bpm_data) {
346
           $scope.deptdata = {
419
           $scope.deptdata = {
347
-            content: "",
420
+            consumableIds: [],
348
             category: "",
421
             category: "",
349
           };
422
           };
350
-          $scope.title = "常用故障现象新增";
423
+          $scope.title = "故障耗材新增";
424
+          // 耗材列表模糊搜索
425
+          $scope.searchConsumable = function (key = "") {
426
+            var deptData = {
427
+              idx: 0,
428
+              sum: 10,
429
+              consumable: {
430
+                keyWord: key,
431
+              },
432
+            };
433
+            api_user_data
434
+              .fetchDataList("consumable", deptData)
435
+              .then(function (data) {
436
+                var ids = $scope.deptdata.consumableIds.map(v=>v.id);
437
+                $scope.consumableList = data.list.filter(v=>!ids.includes(v.id));
438
+              });
439
+          };
351
           // --------------------
440
           // --------------------
352
           $scope.select_treedata = [];
441
           $scope.select_treedata = [];
353
-          $scope.try_async_load = function (s, fn) {
442
+          $rootScope.bala1 = $scope.try_async_load = function (s, fn) {
354
             if (s) {
443
             if (s) {
355
               var filterKeyword = s.filterKeyword;
444
               var filterKeyword = s.filterKeyword;
356
             }
445
             }
@@ -359,11 +448,19 @@ app.controller("faultConsumablesCtrl", [
359
               sum: 9999,
448
               sum: 9999,
360
               incidentcategory: {
449
               incidentcategory: {
361
                 selectType: "pinyin_qs",
450
                 selectType: "pinyin_qs",
451
+                "hierarchyQuery":"two",
452
+                "categoryConsumable":1,
362
               }
453
               }
363
             };
454
             };
364
             if (filterKeyword) {
455
             if (filterKeyword) {
365
               postData.incidentcategory.category = filterKeyword;
456
               postData.incidentcategory.category = filterKeyword;
366
             }
457
             }
458
+            // 当前所属院区或责任科室
459
+            if($rootScope.user.duty){
460
+              postData.incidentcategory.duty = $rootScope.user.duty.id;
461
+            }else if($rootScope.user.branch){
462
+                postData.incidentcategory.branch = $rootScope.user.branch.id;
463
+            }
367
             $scope.my_data = [];
464
             $scope.my_data = [];
368
             $scope.doing_async = true;
465
             $scope.doing_async = true;
369
             api_bpm_data
466
             api_bpm_data
@@ -413,10 +510,58 @@ app.controller("faultConsumablesCtrl", [
413
           $scope.savercode = function (deptdata) {
510
           $scope.savercode = function (deptdata) {
414
             if (
511
             if (
415
               deptdata &&
512
               deptdata &&
416
-              deptdata.content &&
513
+              deptdata.consumableIds &&
417
               deptdata.category
514
               deptdata.category
418
             ) {
515
             ) {
419
-              $modalInstance.close(deptdata);
516
+              var selectedItem = deptdata;
517
+              if (selectedItem.consumableIds && selectedItem.category) {
518
+                var fildata = {
519
+                  incidentCategoryConsumable: {
520
+                    consumableIds: selectedItem.consumableIds.map(v => v.id).toString(),
521
+                    category: selectedItem.category,
522
+                  },
523
+                };
524
+                // 当前所属院区或责任科室
525
+                if($rootScope.user.duty){
526
+                  fildata.incidentCategoryConsumable.duty = $rootScope.user.duty.id;
527
+                }else if($rootScope.user.branch){
528
+                  fildata.incidentCategoryConsumable.branch = $rootScope.user.branch.id;
529
+                }
530
+                api_user_data
531
+                  .addData("incidentCategoryConsumable", fildata)
532
+                  .then(function (response) {
533
+                    if (response) {
534
+                      if (response.status == 200) {
535
+                        $modalInstance.close();
536
+                        SweetAlert.swal(
537
+                          {
538
+                            title: "新增成功!",
539
+                            type: "success",
540
+                          },
541
+                          function () {
542
+                            $scope.refreshData("expand-right", $scope.fileData);
543
+                          }
544
+                        );
545
+                      } else {
546
+                        SweetAlert.swal({
547
+                          title: "新增失败!",
548
+                          text: response.msg,
549
+                          type: "error",
550
+                        });
551
+                      }
552
+                    }
553
+                  });
554
+              } else {
555
+                SweetAlert.swal(
556
+                  {
557
+                    title: "新增失败!",
558
+                    text: "请填写必填项!",
559
+                    type: "error",
560
+                    confirmButtonColor: "#DD6B55",
561
+                  },
562
+                  function () {}
563
+                );
564
+              }
420
             } else {
565
             } else {
421
               SweetAlert.swal(
566
               SweetAlert.swal(
422
                 {
567
                 {
@@ -431,49 +576,55 @@ app.controller("faultConsumablesCtrl", [
431
           };
576
           };
432
         },
577
         },
433
       });
578
       });
434
-      modalInstance.result.then(function (selectedItem) {
435
-        if (selectedItem.content && selectedItem.category) {
436
-          var fildata = {
437
-            incidentCategoryContent: {
438
-              content: selectedItem.content,
439
-              category: selectedItem.category,
440
-            },
441
-          };
442
-          api_user_data
443
-            .addData("incidentCategoryContent", fildata)
444
-            .then(function (response) {
445
-              if (response) {
446
-                if (response.status == 200) {
447
-                  SweetAlert.swal(
448
-                    {
449
-                      title: "新增成功!",
450
-                      type: "success",
451
-                    },
452
-                    function () {
453
-                      $scope.refreshData("expand-right", $scope.fileData);
454
-                    }
455
-                  );
456
-                } else {
457
-                  SweetAlert.swal({
458
-                    title: "新增失败!",
459
-                    text: response.msg,
460
-                    type: "error",
461
-                  });
462
-                }
463
-              }
464
-            });
465
-        } else {
466
-          SweetAlert.swal(
467
-            {
468
-              title: "新增失败!",
469
-              text: "请填写必填项!",
470
-              type: "error",
471
-              confirmButtonColor: "#DD6B55",
472
-            },
473
-            function () {}
474
-          );
475
-        }
476
-      });
579
+      // modalInstance.result.then(function (selectedItem) {
580
+      //   if (selectedItem.consumableIds && selectedItem.category) {
581
+      //     var fildata = {
582
+      //       incidentCategoryConsumable: {
583
+      //         consumableIds: selectedItem.consumableIds.map(v => v.id).toString(),
584
+      //         category: selectedItem.category,
585
+      //       },
586
+      //     };
587
+      //     // 当前所属院区或责任科室
588
+      //     if($rootScope.user.duty){
589
+      //       fildata.incidentCategoryConsumable.duty = $rootScope.user.duty.id;
590
+      //     }else if($rootScope.user.branch){
591
+      //       fildata.incidentCategoryConsumable.branch = $rootScope.user.branch.id;
592
+      //     }
593
+      //     api_user_data
594
+      //       .addData("incidentCategoryConsumable", fildata)
595
+      //       .then(function (response) {
596
+      //         if (response) {
597
+      //           if (response.status == 200) {
598
+      //             SweetAlert.swal(
599
+      //               {
600
+      //                 title: "新增成功!",
601
+      //                 type: "success",
602
+      //               },
603
+      //               function () {
604
+      //                 $scope.refreshData("expand-right", $scope.fileData);
605
+      //               }
606
+      //             );
607
+      //           } else {
608
+      //             SweetAlert.swal({
609
+      //               title: "新增失败!",
610
+      //               text: response.msg,
611
+      //               type: "error",
612
+      //             });
613
+      //           }
614
+      //         }
615
+      //       });
616
+      //   } else {
617
+      //     SweetAlert.swal(
618
+      //       {
619
+      //         title: "新增失败!",
620
+      //         text: "请填写必填项!",
621
+      //         type: "error",
622
+      //         confirmButtonColor: "#DD6B55",
623
+      //       },
624
+      //       function () {}
625
+      //     );
626
+      //   }
627
+      // });
477
     };
628
     };
478
 
629
 
479
     $scope.removeData = function () {
630
     $scope.removeData = function () {
@@ -482,8 +633,8 @@ app.controller("faultConsumablesCtrl", [
482
         templateUrl: "assets/views/incident/tpl/acceptTask.tpl.html",
633
         templateUrl: "assets/views/incident/tpl/acceptTask.tpl.html",
483
         controller: function ($scope, scope, $modalInstance, api_bpm_data) {
634
         controller: function ($scope, scope, $modalInstance, api_bpm_data) {
484
           var rmvList = [];
635
           var rmvList = [];
485
-          $scope.title = "故障现象删除";
486
-          $scope.connect = "确定要删除此故障现象?";
636
+          $scope.title = "故障耗材删除";
637
+          $scope.connect = "确定要删除此故障耗材?";
487
           rmvList.push(scope.selected.items);
638
           rmvList.push(scope.selected.items);
488
           $scope.ok = function () {
639
           $scope.ok = function () {
489
             $modalInstance.close(rmvList);
640
             $modalInstance.close(rmvList);
@@ -504,48 +655,37 @@ app.controller("faultConsumablesCtrl", [
504
         if (selectedItem) {
655
         if (selectedItem) {
505
           if (selectedItem.length > 0) {
656
           if (selectedItem.length > 0) {
506
             console.log(selectedItem);
657
             console.log(selectedItem);
507
-            if (
508
-              selectedItem[0].children &&
509
-              selectedItem[0].children.length > 0
510
-            ) {
511
-              SweetAlert.swal({
512
-                title: "该部门存在子类部门",
513
-                text: "请先删除该部门子类部门!",
514
-                type: "error",
658
+            api_user_data
659
+              .rmvData("incidentCategoryConsumable", [selectedItem[0].id])
660
+              .then(function (response) {
661
+                if (response.status == 200) {
662
+                  SweetAlert.swal(
663
+                    {
664
+                      title: "删除成功!",
665
+                      type: "success",
666
+                      confirmButtonColor: "#007AFF",
667
+                    },
668
+                    function () {
669
+                      $scope.myData = _.reject($scope.myData, function (o) {
670
+                        return _.includes(selectedItem, o.id);
671
+                      });
672
+                      $scope.selected = {
673
+                        items: [],
674
+                      };
675
+                      $scope.gridOptions.totalItems =
676
+                        $scope.gridOptions.totalItems - selectedItem.length;
677
+                      $scope.gridApi.grid.selection.selectedCount = 0;
678
+                      $scope.refreshData("expand-right", $scope.fileData);
679
+                    }
680
+                  );
681
+                } else {
682
+                  SweetAlert.swal({
683
+                    title: "操作异常!",
684
+                    text: "系统异常,请稍后重试,或者联系管理员!",
685
+                    type: "error",
686
+                  });
687
+                }
515
               });
688
               });
516
-            } else {
517
-              api_user_data
518
-                .rmvData("incidentCategoryContent", [selectedItem[0].id])
519
-                .then(function (response) {
520
-                  if (response.status == 200) {
521
-                    SweetAlert.swal(
522
-                      {
523
-                        title: "删除成功!",
524
-                        type: "success",
525
-                        confirmButtonColor: "#007AFF",
526
-                      },
527
-                      function () {
528
-                        $scope.myData = _.reject($scope.myData, function (o) {
529
-                          return _.includes(selectedItem, o.id);
530
-                        });
531
-                        $scope.selected = {
532
-                          items: [],
533
-                        };
534
-                        $scope.gridOptions.totalItems =
535
-                          $scope.gridOptions.totalItems - selectedItem.length;
536
-                        $scope.gridApi.grid.selection.selectedCount = 0;
537
-                        $scope.refreshData("expand-right", $scope.fileData);
538
-                      }
539
-                    );
540
-                  } else {
541
-                    SweetAlert.swal({
542
-                      title: "操作异常!",
543
-                      text: "系统异常,请稍后重试,或者联系管理员!",
544
-                      type: "error",
545
-                    });
546
-                  }
547
-                });
548
-            }
549
           }
689
           }
550
         }
690
         }
551
       });
691
       });
@@ -584,16 +724,18 @@ app.controller("faultConsumablesCtrl", [
584
     var defaultFilterData = {
724
     var defaultFilterData = {
585
       idx: 0,
725
       idx: 0,
586
       sum: 10,
726
       sum: 10,
727
+      incidentCategoryConsumable: {},
587
     };
728
     };
588
 
729
 
589
     $scope.memoryfilterData = {
730
     $scope.memoryfilterData = {
590
       idx: 0,
731
       idx: 0,
591
       sum: 10,
732
       sum: 10,
733
+      incidentCategoryConsumable: {},
592
     };
734
     };
593
     $scope.fileData = {
735
     $scope.fileData = {
594
       idx: 0,
736
       idx: 0,
595
       sum: 10,
737
       sum: 10,
596
-      incidentCategoryContent: {},
738
+      incidentCategoryConsumable: {},
597
     };
739
     };
598
     $scope.ldloading = {};
740
     $scope.ldloading = {};
599
     $scope.refreshData = function (style, filterData) {
741
     $scope.refreshData = function (style, filterData) {
@@ -608,14 +750,20 @@ app.controller("faultConsumablesCtrl", [
608
       if ($scope.gridApi) {
750
       if ($scope.gridApi) {
609
         $scope.gridApi.grid.selection.selectedCount = 0;
751
         $scope.gridApi.grid.selection.selectedCount = 0;
610
       }
752
       }
611
-      filterData = angular.copy(filterData);
612
-      api_user_data.fetchDataList("incidentCategoryContent", filterData).then(
753
+      // 当前所属院区或责任科室
754
+      if($rootScope.user.duty){
755
+        filterData.incidentCategoryConsumable.duty = $rootScope.user.duty.id;
756
+      }else if($rootScope.user.branch){
757
+        filterData.incidentCategoryConsumable.branch = $rootScope.user.branch.id;
758
+      }
759
+      api_user_data.fetchDataList("incidentCategoryConsumable", filterData).then(
613
         function (data) {
760
         function (data) {
614
           var myData = Restangular.stripRestangular(data);
761
           var myData = Restangular.stripRestangular(data);
615
           $scope.gridOptions.totalItems = myData.totalNum;
762
           $scope.gridOptions.totalItems = myData.totalNum;
616
           $scope.myData = myData.list;
763
           $scope.myData = myData.list;
617
           for (var i = 0; i < $scope.myData.length; i++) {
764
           for (var i = 0; i < $scope.myData.length; i++) {
618
             $scope.myData[i]["item"] = i + 1 + filterData.idx * filterData.sum;
765
             $scope.myData[i]["item"] = i + 1 + filterData.idx * filterData.sum;
766
+            $scope.myData[i]["consumableDTOSName"] = $scope.myData[i]["consumableDTOS"].map(v => v.name).join(',');
619
           }
767
           }
620
           $scope.ldloading[style.replace("-", "_")] = false;
768
           $scope.ldloading[style.replace("-", "_")] = false;
621
         },
769
         },
@@ -637,17 +785,20 @@ app.controller("faultConsumablesCtrl", [
637
         $scope.gridApi.grid.selection.selectedCount = 0;
785
         $scope.gridApi.grid.selection.selectedCount = 0;
638
       }
786
       }
639
       filterData = angular.copy(filterData);
787
       filterData = angular.copy(filterData);
640
-      if (filterData.incidentCategoryContent.category) {
641
-        filterData.incidentCategoryContent.category =
642
-          filterData.incidentCategoryContent.category.id;
788
+      // 当前所属院区或责任科室
789
+      if($rootScope.user.duty){
790
+        filterData.incidentCategoryConsumable.duty = $rootScope.user.duty.id;
791
+      }else if($rootScope.user.branch){
792
+        filterData.incidentCategoryConsumable.branch = $rootScope.user.branch.id;
643
       }
793
       }
644
-      api_user_data.fetchDataList("incidentCategoryContent", filterData).then(
794
+      api_user_data.fetchDataList("incidentCategoryConsumable", filterData).then(
645
         function (data) {
795
         function (data) {
646
           var myData = Restangular.stripRestangular(data);
796
           var myData = Restangular.stripRestangular(data);
647
           $scope.gridOptions.totalItems = myData.totalNum;
797
           $scope.gridOptions.totalItems = myData.totalNum;
648
           $scope.myData = myData.list;
798
           $scope.myData = myData.list;
649
           for (var i = 0; i < $scope.myData.length; i++) {
799
           for (var i = 0; i < $scope.myData.length; i++) {
650
             $scope.myData[i]["item"] = i + 1 + filterData.idx * filterData.sum;
800
             $scope.myData[i]["item"] = i + 1 + filterData.idx * filterData.sum;
801
+            $scope.myData[i]["consumableDTOSName"] = $scope.myData[i]["consumableDTOS"].map(v => v.name).join(',');
651
           }
802
           }
652
           $scope.ldloading[style.replace("-", "_")] = false;
803
           $scope.ldloading[style.replace("-", "_")] = false;
653
         },
804
         },
@@ -662,27 +813,36 @@ app.controller("faultConsumablesCtrl", [
662
     };
813
     };
663
     // 清空
814
     // 清空
664
     $scope.clean = function () {
815
     $scope.clean = function () {
665
-      delete $scope.fileData.incidentCategoryContent.content;
666
-      delete $scope.fileData.incidentCategoryContent.category;
816
+      delete $scope.fileData.incidentCategoryConsumable.consumableIds;
817
+      delete $scope.fileData.incidentCategoryConsumable.category;
667
       $scope.getCategoryData();
818
       $scope.getCategoryData();
668
       $scope.refreshData("expand-right", $scope.fileData);
819
       $scope.refreshData("expand-right", $scope.fileData);
669
     };
820
     };
670
     // 获取院区下拉
821
     // 获取院区下拉
671
     $scope.model = {};
822
     $scope.model = {};
672
-    $scope.categoryData = [];
673
-    $scope.getCategoryData = function (s, fn) {
823
+    // --------------------
824
+    $scope.select_treedata = [];
825
+    $rootScope.bala1 = $scope.try_async_load = function (s, fn) {
674
       if (s) {
826
       if (s) {
675
         var filterKeyword = s.filterKeyword;
827
         var filterKeyword = s.filterKeyword;
676
       }
828
       }
677
       var postData = {
829
       var postData = {
678
         idx: 0,
830
         idx: 0,
679
-        sum: 1000,
831
+        sum: 9999,
832
+        incidentcategory: {
833
+          selectType: "pinyin_qs",
834
+          "hierarchyQuery":"two",
835
+          "categoryConsumable":1,
836
+        }
680
       };
837
       };
681
       if (filterKeyword) {
838
       if (filterKeyword) {
682
-        postData.incidentcategory = {
683
-          selectType: "pinyin_qs",
684
-          category: filterKeyword,
685
-        };
839
+        postData.incidentcategory.category = filterKeyword;
840
+      }
841
+      // 当前所属院区或责任科室
842
+      if($rootScope.user.duty){
843
+        postData.incidentcategory.duty = $rootScope.user.duty.id;
844
+      }else if($rootScope.user.branch){
845
+          postData.incidentcategory.branch = $rootScope.user.branch.id;
686
       }
846
       }
687
       $scope.my_data = [];
847
       $scope.my_data = [];
688
       $scope.doing_async = true;
848
       $scope.doing_async = true;
@@ -710,7 +870,7 @@ app.controller("faultConsumablesCtrl", [
710
                 objects.push(object);
870
                 objects.push(object);
711
               }
871
               }
712
               $scope.my_data = convertParentToChildList(objects);
872
               $scope.my_data = convertParentToChildList(objects);
713
-              $scope.categoryData = angular.copy($scope.my_data);
873
+              $scope.select_treedata = angular.copy($scope.my_data);
714
             }
874
             }
715
             if ($scope.my_data.length > 0) {
875
             if ($scope.my_data.length > 0) {
716
               $scope.doing_async = false;
876
               $scope.doing_async = false;
@@ -724,7 +884,8 @@ app.controller("faultConsumablesCtrl", [
724
           }
884
           }
725
         });
885
         });
726
     };
886
     };
727
-    $scope.getCategoryData();
887
+    // $scope.try_async_load();
888
+    // --------------------
728
     $scope.refreshData("expand-right", $scope.fileData);
889
     $scope.refreshData("expand-right", $scope.fileData);
729
     $scope.timer = $interval(function () {
890
     $scope.timer = $interval(function () {
730
       $scope.refreshData2("expand-right", $scope.fileData);
891
       $scope.refreshData2("expand-right", $scope.fileData);

+ 6 - 7
assets/views/businessConfiguration/faultConsumables.html

@@ -48,7 +48,7 @@
48
     <div class="row" style="padding-right: 0px !important">
48
     <div class="row" style="padding-right: 0px !important">
49
       <form class="col-xs-12 form-inline">
49
       <form class="col-xs-12 form-inline">
50
         <div class="col-xs-10">
50
         <div class="col-xs-10">
51
-          <div class="form-group incidentsearch">
51
+          <!-- <div class="form-group incidentsearch">
52
             <div>
52
             <div>
53
               <div class="control-label pull-left" style="padding-top: 4px">
53
               <div class="control-label pull-left" style="padding-top: 4px">
54
                 别名:
54
                 别名:
@@ -68,25 +68,24 @@
68
               data-default-label="请选择故障现象"
68
               data-default-label="请选择故障现象"
69
               class="pull-right iptSize muti-com"
69
               class="pull-right iptSize muti-com"
70
               ng-model="cifilter_classic"
70
               ng-model="cifilter_classic"
71
-              data-input-model="categoryData"
71
+              data-input-model="select_treedata"
72
               data-output-model="fileData.incidentCategoryContent.category"
72
               data-output-model="fileData.incidentCategoryContent.category"
73
               theme="bootstrap"
73
               theme="bootstrap"
74
-              data-select-only-leafs="true"
74
+              data-select-only-leafs="false"
75
               multi-select="false"
75
               multi-select="false"
76
               data-callback="onFilterCallback(item)"
76
               data-callback="onFilterCallback(item)"
77
-              data-select-only-leafs="false"
78
               reset-search-input="false"
77
               reset-search-input="false"
79
               data-trans-label="category"
78
               data-trans-label="category"
80
               data-switch-view="false"
79
               data-switch-view="false"
81
             >
80
             >
82
             </multi-select-tree>
81
             </multi-select-tree>
83
-          </div>
82
+          </div> -->
84
         </div>
83
         </div>
85
         <div class="col-xs-2 searchBtnBox">
84
         <div class="col-xs-2 searchBtnBox">
86
-          <div type="button" class="btn btn_search" ng-click="searchData()">
85
+          <!-- <div type="button" class="btn btn_search" ng-click="searchData()">
87
             搜索
86
             搜索
88
           </div>
87
           </div>
89
-          <div class="btn btn_clean" ng-click="clean()">重置</div>
88
+          <div class="btn btn_clean" ng-click="clean()">重置</div> -->
90
           <div
89
           <div
91
             type="button"
90
             type="button"
92
             class="btn btn_search"
91
             class="btn btn_search"

+ 21 - 8
assets/views/system/tpl/faultConsumableschange.html

@@ -14,14 +14,28 @@
14
         <div
14
         <div
15
           class="pull-left openaddlable control-label fontcolor-two fontsizes-14"
15
           class="pull-left openaddlable control-label fontcolor-two fontsizes-14"
16
         >
16
         >
17
-          别名<span class="red">*</span>:
17
+          耗材信息<span class="red">*</span>:
18
         </div>
18
         </div>
19
         <div class="pull-right openaddinput">
19
         <div class="pull-right openaddinput">
20
-          <input
21
-            class="form-control"
22
-            ng-model="deptdata.content"
23
-            placeholder="别名"
24
-          />
20
+          <ui-select
21
+            multiple
22
+            class="c_item_value"
23
+            style="height: auto;text-align:left;"
24
+            ng-model="deptdata.consumableIds"
25
+            theme="bootstrap"
26
+            ng-required="true"
27
+            reset-search-input="false"
28
+          >
29
+            <ui-select-match placeholder="请选择耗材信息">
30
+              <span ng-bind="$item.name"></span>
31
+            </ui-select-match>
32
+            <ui-select-choices
33
+              repeat="item in consumableList"
34
+              refresh="searchConsumable($select.search)"
35
+            >
36
+              <div ng-bind-html="item.name + '(' + item.brandModel + ')' + '(' + item.unit + ')' | highlight: $select.search"></div>
37
+            </ui-select-choices>
38
+          </ui-select>
25
         </div>
39
         </div>
26
       </div>
40
       </div>
27
       <div class="margin-bottom-15 anline">
41
       <div class="margin-bottom-15 anline">
@@ -37,8 +51,7 @@
37
             ng-model="cifilter_classic"
51
             ng-model="cifilter_classic"
38
             data-input-model="select_treedata"
52
             data-input-model="select_treedata"
39
             data-output-model="deptdata.category"
53
             data-output-model="deptdata.category"
40
-            theme="bootstrap" 
41
-            data-select-only-leafs="true"
54
+            theme="bootstrap"
42
             multi-select="false"
55
             multi-select="false"
43
             data-callback="onFilterCallback(item)"
56
             data-callback="onFilterCallback(item)"
44
             data-select-only-leafs="false"
57
             data-select-only-leafs="false"

+ 2 - 2
bower_components/angular-ui-grid/ui-grid.css

@@ -1,6 +1,6 @@
1
 /*!
1
 /*!
2
  * ui-grid - v3.0.6 - 2015-09-08
2
  * ui-grid - v3.0.6 - 2015-09-08
3
- * Copyright (c) 2015 ; License: MIT 
3
+ * Copyright (c) 2015 ; License: MIT
4
  */
4
  */
5
 
5
 
6
 #ui-grid-twbs #ui-grid-twbs .form-horizontal .form-group:before,
6
 #ui-grid-twbs #ui-grid-twbs .form-horizontal .form-group:before,
@@ -941,7 +941,7 @@ fieldset[disabled] .ui-grid-menu .ui-grid-menu-inner .ui-grid-menu-close-button.
941
     line-height: .9em;
941
     line-height: .9em;
942
     /* border: 1px solid #bbbbbb; */
942
     /* border: 1px solid #bbbbbb; */
943
     border-radius: 2px;
943
     border-radius: 2px;
944
-    font-size: 60%;
944
+    /* font-size: 60%; */
945
 }
945
 }
946
 
946
 
947
 .ui-grid-icon-blank::before {
947
 .ui-grid-icon-blank::before {