浏览代码

tab自定义

seimin 1 年之前
父节点
当前提交
a4e831d27c

文件差异内容过多而无法显示
+ 557 - 559
src/app/views/hushijiandan/hushijiandan.component.html


+ 100 - 10
src/app/views/hushijiandan/hushijiandan.component.ts

@@ -34,6 +34,7 @@ import {
34 34
   endOfDay,
35 35
 } from "date-fns";
36 36
 import { SourceId } from "src/app/type/types";
37
+import cloneDeep from 'lodash-es/cloneDeep'
37 38
 // 日期禁用
38 39
 function range(start: number, end: number): number[] {
39 40
   const result: number[] = [];
@@ -127,8 +128,9 @@ export class HushijiandanComponent implements OnInit {
127 128
         this.sortableTimer = setTimeout(() => {
128 129
           let postData = {
129 130
             orders: [],
131
+            tabId: this.checkedTableType == 'other' ? undefined : this.checkedTableType,
130 132
           };
131
-          postData.orders = this.othersList.map((item, i) => {
133
+          postData.orders = this.othersList[this.checkedTableType].map((item, i) => {
132 134
             return {
133 135
               id: item.id,
134 136
               orders: i,
@@ -462,6 +464,25 @@ export class HushijiandanComponent implements OnInit {
462 464
         if (result.status == 200) {
463 465
           this.isShowBx = result.list.find(v => v.key == 'hos_itsmIncident').value == 1;
464 466
           if (this.isShowBx && (this.coopBtns.repairList || this.coopBtns.quickReportForRepair)) {
467
+            // 初始化默认显示第一个
468
+            if(this.tabPermission.length){
469
+              this.checkedTableType = (this.tabPermission[0] && this.tabPermission[0].system) ? 'other' : this.tabPermission[0].id;
470
+            }else if(this.coopBtns.suggestionBox){
471
+              this.checkedTableType = 'advice';
472
+              this.checkTable(this.checkedTableType);
473
+            }else if(this.coopBtns.inquiryOfHistoricalSpecimens){
474
+              this.checkedTableType = 'historySpecimen';
475
+              this.checkTable(this.checkedTableType);
476
+            }else if(this.coopBtns.historicalMedicineListInquiry){
477
+              this.checkedTableType = 'historyDrugsbag';
478
+              this.checkTable(this.checkedTableType);
479
+            }else if(this.coopBtns.quickReportForRepair && this.isShowBx){
480
+              this.checkedTableType = 'kjbx';
481
+              this.checkTable(this.checkedTableType);
482
+            }else if(this.coopBtns.repairList && this.isShowBx){
483
+              this.checkedTableType = 'bxlb';
484
+              this.checkTable(this.checkedTableType);
485
+            }
465 486
             this.smallTabs = [
466 487
               { id: 1, name: "综合日志" },
467 488
               { id: 2, name: "一键报修" },
@@ -748,7 +769,7 @@ export class HushijiandanComponent implements OnInit {
748 769
   nLoading = false;
749 770
   positionY = 0; //记录其他建单Y轴滚动距离
750 771
   otherClick(item) {
751
-    this.positionY = this.osComponentRef2.osInstance().scroll().position.y; //内容滚动的距离
772
+    this.osComponentRef2 && (this.positionY = this.osComponentRef2.osInstance().scroll().position.y); //内容滚动的距离
752 773
     this.selectOtherId = item.id;
753 774
     this.newShortcutOrder(item, "other");
754 775
     this.account = null;
@@ -1167,6 +1188,7 @@ export class HushijiandanComponent implements OnInit {
1167 1188
   tabFlag = true; //页面初始化获取一次患者陪检的任务类型信息
1168 1189
   allowUrgentFlag = false; //检查列表的患者陪检类型是否允许加急
1169 1190
   tabPermission:any = []; //tab自定义
1191
+  tabPermissionTpl:any = []; //tab自定义模板
1170 1192
   getDeptTaskType(search?, clear?) {
1171 1193
     let that = this;
1172 1194
     this.otherNum++;
@@ -1176,6 +1198,7 @@ export class HushijiandanComponent implements OnInit {
1176 1198
     };
1177 1199
     if (search !== undefined) {
1178 1200
       postData["taskName"] = search;
1201
+      postData["tabId"] = this.checkedTableType == 'other' ? undefined : this.checkedTableType;
1179 1202
     }
1180 1203
     that.mainService
1181 1204
       .postCustom("nurse", "getDeptTaskType", postData)
@@ -1234,13 +1257,68 @@ export class HushijiandanComponent implements OnInit {
1234 1257
           }
1235 1258
         }
1236 1259
 
1260
+        if(data.data.tabPermission && Array.isArray(data.data.tabPermission.data)){
1261
+          if (search !== undefined) {
1262
+            let tabPermission = [];
1263
+            tabPermission = this.tabPermissionTpl.map(v => {
1264
+              let obj = data.data.tabPermission.data.find(vv => vv.id == v.id);
1265
+              if(obj){
1266
+                return obj;
1267
+              }else{
1268
+                return v;
1269
+              }
1270
+            })
1271
+            this.tabPermission = tabPermission.sort((a,b) => a.orders - b.orders);
1272
+          }else{
1273
+            this.tabPermission = data.data.tabPermission.data.sort((a,b) => a.orders - b.orders);
1274
+            this.tabPermissionTpl = data.data.tabPermission.data.sort((a,b) => a.orders - b.orders).map(v => ({...v, taskTypeList: []}));
1275
+          }
1276
+        }else{
1277
+          this.tabPermission = this.tabPermissionTpl.length ? cloneDeep(this.tabPermissionTpl) : [];
1278
+        }
1279
+        if(!this.coopBtns.buildOrdersForOtherTasks){
1280
+          this.tabPermission = this.tabPermission.filter(v => !v.system);
1281
+        }
1282
+        // 初始化默认显示第一个
1283
+        if(search === undefined){
1284
+          if(this.tabPermission.length){
1285
+            this.checkedTableType = (this.tabPermission[0] && this.tabPermission[0].system) ? 'other' : this.tabPermission[0].id;
1286
+          }else if(this.coopBtns.suggestionBox){
1287
+            this.checkedTableType = 'advice';
1288
+            this.checkTable(this.checkedTableType);
1289
+          }else if(this.coopBtns.inquiryOfHistoricalSpecimens){
1290
+            this.checkedTableType = 'historySpecimen';
1291
+            this.checkTable(this.checkedTableType);
1292
+          }else if(this.coopBtns.historicalMedicineListInquiry){
1293
+            this.checkedTableType = 'historyDrugsbag';
1294
+            this.checkTable(this.checkedTableType);
1295
+          }else if(this.coopBtns.quickReportForRepair && this.isShowBx){
1296
+            this.checkedTableType = 'kjbx';
1297
+            this.checkTable(this.checkedTableType);
1298
+          }else if(this.coopBtns.repairList && this.isShowBx){
1299
+            this.checkedTableType = 'bxlb';
1300
+            this.checkTable(this.checkedTableType);
1301
+          }
1302
+        }
1303
+        this.othersList = {};
1304
+        this.tabPermission.forEach(v => {
1305
+          if(v.system){
1306
+            that.othersList['other'] = [];
1307
+          }else{
1308
+            that.othersList[v.id] = v.taskTypeList || [];
1309
+          }
1310
+        })
1311
+        
1237 1312
         if (data.data.allTaskTypes) {
1238
-          that.othersList = [];
1239 1313
           that.patientMsgList = [];
1240
-          that.tabPermission = Object.values(data.data.tabPermission.data);
1314
+          
1241 1315
           data.data.allTaskTypes.forEach((e) => {
1242 1316
             if (e.associationType.value == "other") {
1243
-              that.othersList.push(e);
1317
+              if(that.othersList['other']){
1318
+                that.othersList['other'].push(e);
1319
+              }else{
1320
+                that.othersList['other'] = [e];
1321
+              }
1244 1322
             } else if (e.associationType.value == "specimen") {
1245 1323
               that.bbMsg = e;
1246 1324
             } else if (
@@ -1262,9 +1340,9 @@ export class HushijiandanComponent implements OnInit {
1262 1340
           // }
1263 1341
           console.log(this.selectOtherId);
1264 1342
           if (!this.selectOtherId) {
1265
-            if (that.othersList.length) {
1266
-              this.selectOtherId = that.othersList[0].id;
1267
-              let obj = that.othersList.find(
1343
+            if (that.othersList[that.checkedTableType] && that.othersList[that.checkedTableType].length) {
1344
+              this.selectOtherId = that.othersList[that.checkedTableType][0].id;
1345
+              let obj = that.othersList[that.checkedTableType].find(
1268 1346
                 (item) => item.id == this.selectOtherId
1269 1347
               );
1270 1348
               obj && this.otherClick(obj);
@@ -3145,9 +3223,21 @@ export class HushijiandanComponent implements OnInit {
3145 3223
   // =======================end=================================
3146 3224
 
3147 3225
   // 页面中间部分tab切换
3148
-  checkedTableType: string = "other";
3226
+  checkedTableType: string = "";
3149 3227
   checkTable(type) {
3150
-    this.checkedTableType = type;
3228
+    if(typeof type === 'object'){
3229
+      if(type.system){
3230
+        this.checkedTableType = 'other';
3231
+      }else{
3232
+        this.checkedTableType = type.id;
3233
+      }
3234
+      this.getDeptTaskType('');
3235
+    }else{
3236
+      this.checkedTableType = type;
3237
+    }
3238
+    this.positionY = 0;
3239
+    this.selectOtherId = null;
3240
+    this.otherSearch = '';
3151 3241
     if (type === "historySpecimen") {
3152 3242
       this.getHistorySpecimen();
3153 3243
     } else if (type === "historyDrugsbag") {

+ 1 - 1
src/app/views/tab-custom/tab-custom.component.html

@@ -27,7 +27,7 @@
27 27
             <td>
28 28
               <div class="coop">
29 29
                 <span *ngIf="coopBtns.edit" (click)="edit(data)">编辑</span>
30
-                <span *ngIf="coopBtns.del && data.tabTypeList.length" (click)="del(data)">删除</span>
30
+                <span *ngIf="coopBtns.del && data.system != 1" (click)="del(data)">删除</span>
31 31
               </div>
32 32
             </td>
33 33
           </tr>

+ 1 - 1
src/app/views/tab-custom/tab-custom.component.ts

@@ -164,7 +164,7 @@ export class TabCustomComponent implements OnInit {
164 164
           tabTypeList.push({
165 165
             taskTypeId: vv.id,
166 166
             hosId: vv.hosId ? vv.hosId.id : undefined,
167
-            typeParentHosid: vv.hosId.parent ? vv.hosId.parent.id : undefined,
167
+            typeParentHosId: vv.hosId.parent ? vv.hosId.parent.id : undefined,
168 168
           })
169 169
         }
170 170
       })