|
@@ -82,15 +82,15 @@ app.controller("faultConsumablesCtrl", [
|
82
|
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
|
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
|
94
|
enableFiltering: false,
|
95
|
95
|
},
|
96
|
96
|
{
|
|
@@ -111,6 +111,64 @@ app.controller("faultConsumablesCtrl", [
|
111
|
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
|
172
|
function selectItem(pmodel, childrens) {
|
115
|
173
|
if (angular.isArray(pmodel)) {
|
116
|
174
|
angular.forEach(pmodel, function (index) {
|
|
@@ -141,31 +199,56 @@ app.controller("faultConsumablesCtrl", [
|
141
|
199
|
$scope.saveData = function (selectdata) {
|
142
|
200
|
console.log(selectdata);
|
143
|
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
|
204
|
selectdata.category.selected = true;
|
147
|
205
|
$scope.deptdata = {
|
148
|
206
|
id: selectdata.id,
|
149
|
|
- content: selectdata.content,
|
|
207
|
+ consumableIds: selectdata.consumableDTOS || [],
|
150
|
208
|
category: selectdata.category
|
151
|
209
|
};
|
152
|
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
|
230
|
$scope.select_treedata = [];
|
156
|
|
- $scope.try_async_load = function (s, fn) {
|
|
231
|
+ $rootScope.bala1 = $scope.try_async_load = function (s, fn) {
|
157
|
232
|
if (s) {
|
158
|
233
|
var filterKeyword = s.filterKeyword;
|
159
|
234
|
}
|
160
|
235
|
var postData = {
|
161
|
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
|
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
|
253
|
$scope.my_data = [];
|
171
|
254
|
$scope.doing_async = true;
|
|
@@ -218,19 +301,20 @@ app.controller("faultConsumablesCtrl", [
|
218
|
301
|
$scope.savercode = function (deptdata) {
|
219
|
302
|
if (
|
220
|
303
|
deptdata &&
|
221
|
|
- deptdata.content &&
|
|
304
|
+ deptdata.consumableIds &&
|
222
|
305
|
deptdata.category
|
223
|
306
|
) {
|
224
|
307
|
var fildata = {
|
225
|
|
- incidentCategoryContent: {
|
|
308
|
+ incidentCategoryConsumable: {
|
226
|
309
|
id: deptdata.id,
|
227
|
310
|
deleteFlag: 0,
|
228
|
|
- content: deptdata.content,
|
|
311
|
+ consumableIds: deptdata.consumableIds.map(v => v.id).toString(),
|
229
|
312
|
category: deptdata.category,
|
230
|
313
|
},
|
231
|
314
|
};
|
|
315
|
+ fildata.incidentCategoryConsumable = Object.assign({}, selectdata, fildata.incidentCategoryConsumable)
|
232
|
316
|
api_user_data
|
233
|
|
- .updData("incidentCategoryContent", fildata)
|
|
317
|
+ .addData("incidentCategoryConsumable", fildata)
|
234
|
318
|
.then(function (response) {
|
235
|
319
|
if (response) {
|
236
|
320
|
if (response.status == 200) {
|
|
@@ -243,17 +327,6 @@ app.controller("faultConsumablesCtrl", [
|
243
|
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
|
330
|
} else {
|
258
|
331
|
SweetAlert.swal(
|
259
|
332
|
{
|
|
@@ -341,16 +414,32 @@ app.controller("faultConsumablesCtrl", [
|
341
|
414
|
}
|
342
|
415
|
$scope.addData = function () {
|
343
|
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
|
419
|
$scope.deptdata = {
|
347
|
|
- content: "",
|
|
420
|
+ consumableIds: [],
|
348
|
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
|
441
|
$scope.select_treedata = [];
|
353
|
|
- $scope.try_async_load = function (s, fn) {
|
|
442
|
+ $rootScope.bala1 = $scope.try_async_load = function (s, fn) {
|
354
|
443
|
if (s) {
|
355
|
444
|
var filterKeyword = s.filterKeyword;
|
356
|
445
|
}
|
|
@@ -359,11 +448,19 @@ app.controller("faultConsumablesCtrl", [
|
359
|
448
|
sum: 9999,
|
360
|
449
|
incidentcategory: {
|
361
|
450
|
selectType: "pinyin_qs",
|
|
451
|
+ "hierarchyQuery":"two",
|
|
452
|
+ "categoryConsumable":1,
|
362
|
453
|
}
|
363
|
454
|
};
|
364
|
455
|
if (filterKeyword) {
|
365
|
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
|
464
|
$scope.my_data = [];
|
368
|
465
|
$scope.doing_async = true;
|
369
|
466
|
api_bpm_data
|
|
@@ -413,10 +510,58 @@ app.controller("faultConsumablesCtrl", [
|
413
|
510
|
$scope.savercode = function (deptdata) {
|
414
|
511
|
if (
|
415
|
512
|
deptdata &&
|
416
|
|
- deptdata.content &&
|
|
513
|
+ deptdata.consumableIds &&
|
417
|
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
|
565
|
} else {
|
421
|
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
|
630
|
$scope.removeData = function () {
|
|
@@ -482,8 +633,8 @@ app.controller("faultConsumablesCtrl", [
|
482
|
633
|
templateUrl: "assets/views/incident/tpl/acceptTask.tpl.html",
|
483
|
634
|
controller: function ($scope, scope, $modalInstance, api_bpm_data) {
|
484
|
635
|
var rmvList = [];
|
485
|
|
- $scope.title = "故障现象删除";
|
486
|
|
- $scope.connect = "确定要删除此故障现象?";
|
|
636
|
+ $scope.title = "故障耗材删除";
|
|
637
|
+ $scope.connect = "确定要删除此故障耗材?";
|
487
|
638
|
rmvList.push(scope.selected.items);
|
488
|
639
|
$scope.ok = function () {
|
489
|
640
|
$modalInstance.close(rmvList);
|
|
@@ -504,48 +655,37 @@ app.controller("faultConsumablesCtrl", [
|
504
|
655
|
if (selectedItem) {
|
505
|
656
|
if (selectedItem.length > 0) {
|
506
|
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
|
724
|
var defaultFilterData = {
|
585
|
725
|
idx: 0,
|
586
|
726
|
sum: 10,
|
|
727
|
+ incidentCategoryConsumable: {},
|
587
|
728
|
};
|
588
|
729
|
|
589
|
730
|
$scope.memoryfilterData = {
|
590
|
731
|
idx: 0,
|
591
|
732
|
sum: 10,
|
|
733
|
+ incidentCategoryConsumable: {},
|
592
|
734
|
};
|
593
|
735
|
$scope.fileData = {
|
594
|
736
|
idx: 0,
|
595
|
737
|
sum: 10,
|
596
|
|
- incidentCategoryContent: {},
|
|
738
|
+ incidentCategoryConsumable: {},
|
597
|
739
|
};
|
598
|
740
|
$scope.ldloading = {};
|
599
|
741
|
$scope.refreshData = function (style, filterData) {
|
|
@@ -608,14 +750,20 @@ app.controller("faultConsumablesCtrl", [
|
608
|
750
|
if ($scope.gridApi) {
|
609
|
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
|
760
|
function (data) {
|
614
|
761
|
var myData = Restangular.stripRestangular(data);
|
615
|
762
|
$scope.gridOptions.totalItems = myData.totalNum;
|
616
|
763
|
$scope.myData = myData.list;
|
617
|
764
|
for (var i = 0; i < $scope.myData.length; i++) {
|
618
|
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
|
768
|
$scope.ldloading[style.replace("-", "_")] = false;
|
621
|
769
|
},
|
|
@@ -637,17 +785,20 @@ app.controller("faultConsumablesCtrl", [
|
637
|
785
|
$scope.gridApi.grid.selection.selectedCount = 0;
|
638
|
786
|
}
|
639
|
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
|
795
|
function (data) {
|
646
|
796
|
var myData = Restangular.stripRestangular(data);
|
647
|
797
|
$scope.gridOptions.totalItems = myData.totalNum;
|
648
|
798
|
$scope.myData = myData.list;
|
649
|
799
|
for (var i = 0; i < $scope.myData.length; i++) {
|
650
|
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
|
803
|
$scope.ldloading[style.replace("-", "_")] = false;
|
653
|
804
|
},
|
|
@@ -662,27 +813,36 @@ app.controller("faultConsumablesCtrl", [
|
662
|
813
|
};
|
663
|
814
|
// 清空
|
664
|
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
|
818
|
$scope.getCategoryData();
|
668
|
819
|
$scope.refreshData("expand-right", $scope.fileData);
|
669
|
820
|
};
|
670
|
821
|
// 获取院区下拉
|
671
|
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
|
826
|
if (s) {
|
675
|
827
|
var filterKeyword = s.filterKeyword;
|
676
|
828
|
}
|
677
|
829
|
var postData = {
|
678
|
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
|
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
|
847
|
$scope.my_data = [];
|
688
|
848
|
$scope.doing_async = true;
|
|
@@ -710,7 +870,7 @@ app.controller("faultConsumablesCtrl", [
|
710
|
870
|
objects.push(object);
|
711
|
871
|
}
|
712
|
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
|
875
|
if ($scope.my_data.length > 0) {
|
716
|
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
|
889
|
$scope.refreshData("expand-right", $scope.fileData);
|
729
|
890
|
$scope.timer = $interval(function () {
|
730
|
891
|
$scope.refreshData2("expand-right", $scope.fileData);
|