瀏覽代碼

tab自定义增删改查

seimin 1 年之前
父節點
當前提交
22131dd428
共有 3 個文件被更改,包括 38 次插入18 次删除
  1. 1 1
      proxy.conf.json
  2. 3 3
      src/app/views/tab-custom/tab-custom.component.html
  3. 34 14
      src/app/views/tab-custom/tab-custom.component.ts

+ 1 - 1
proxy.conf.json

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "/service": {
3
-    "target": "http://192.168.3.108",
3
+    "target": "http://192.168.4.241",
4 4
     "logLevel": "debug",
5 5
     "changeOrigin": true,
6 6
     "pathRewrite": {

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

@@ -22,12 +22,12 @@
22 22
         <tbody>
23 23
           <tr *ngFor="let data of listOfData;let index=index;">
24 24
             <td>{{ data.title || '-' }}</td>
25
-            <td>{{ data.orders || '-' }}</td>
26
-            <td>{{data.taskTypeList.length ? data.taskTypeList : '-'}}</td>
25
+            <td>{{ data.orders }}</td>
26
+            <td>{{ data.taskNames }}</td>
27 27
             <td>
28 28
               <div class="coop">
29 29
                 <span *ngIf="coopBtns.edit" (click)="edit(data)">编辑</span>
30
-                <span *ngIf="coopBtns.del" (click)="del(data)">删除</span>
30
+                <span *ngIf="coopBtns.del && data.taskTypeList.length" (click)="del(data)">删除</span>
31 31
               </div>
32 32
             </td>
33 33
           </tr>

+ 34 - 14
src/app/views/tab-custom/tab-custom.component.ts

@@ -95,6 +95,10 @@ export class TabCustomComponent implements OnInit {
95 95
       .getFetchDataList("simple/data", "tabPermission", data)
96 96
       .subscribe((data) => {
97 97
         this.loading1 = false;
98
+        data.list = data.list || [];
99
+        data.list.forEach(v => {
100
+          v.taskNames = v.taskTypeList.map(v=>v.taskTypeDTO.taskName).toString()
101
+        })
98 102
         this.listOfData = data.list;
99 103
         this.listLength = data.totalNum;
100 104
       });
@@ -105,7 +109,7 @@ export class TabCustomComponent implements OnInit {
105 109
     let hid = this.tool.getCurrentHospital().id;
106 110
     let postData = {
107 111
       taskType: {
108
-        hosIds: hid,
112
+        cascadeHosId: hid,
109 113
         taskName: keywords,
110 114
         simpleQuery: true,
111 115
         associationType: {
@@ -114,7 +118,7 @@ export class TabCustomComponent implements OnInit {
114 118
         }
115 119
       },
116 120
       idx: 0,
117
-      sum: 10,
121
+      sum: 9999,
118 122
     };
119 123
     this.isLoading = true;
120 124
     this.mainService.getFetchDataList("configuration", "taskType", postData).subscribe((res) => {
@@ -153,22 +157,31 @@ export class TabCustomComponent implements OnInit {
153 157
     }
154 158
     if (this.validateForm.invalid) return;
155 159
     this.btnLoading = true;
160
+    let taskTypeList = [];
161
+    this.validateForm.value.taskTypeList.forEach(v => {
162
+      this.otherTasktypeList.forEach(vv => {
163
+        if(v == vv.id){
164
+          taskTypeList.push({
165
+            taskTypeId: vv.id,
166
+            hosId: vv.hosId ? vv.hosId.id : undefined,
167
+            typeParentHosid: vv.hosId.parent ? vv.hosId.parent.id : undefined,
168
+          })
169
+        }
170
+      })
171
+    })
156 172
     let data = {
157
-      tabPermission: {
158
-        title: this.validateForm.value.title,
159
-        orders: this.validateForm.value.orders,
160
-        hosId: this.hosId,
161
-        deleteFlag: 0,
162
-        // taskTypeList: this.validateForm.value.taskTypeList
163
-      },
173
+      title: this.validateForm.value.title,
174
+      orders: this.validateForm.value.orders,
175
+      hosId: this.hosId,
176
+      deleteFlag: 0,
177
+      taskTypeList
164 178
     };
165 179
     if (!this.add) {
166
-      data.tabPermission["id"] = this.coopId;
180
+      data = {...this.coopData, ...data};
167 181
     }
168 182
     console.log(data);
169
-    return;
170 183
     this.mainService
171
-      .coopData("addData", "tabPermission", data)
184
+      .simplePost("addData", "tabPermission", data)
172 185
       .subscribe((data) => {
173 186
         this.btnLoading = false;
174 187
         this.hideModal();
@@ -183,12 +196,16 @@ export class TabCustomComponent implements OnInit {
183 196
 
184 197
   // 编辑
185 198
   maskFlag: any = false;
199
+  coopData = {};
186 200
   edit(data) {
187 201
     this.validateForm.controls.title.setValue(data.title);
188 202
     this.validateForm.controls.orders.setValue(data.orders);
203
+    this.validateForm.controls.taskTypeList.setValue(Array.isArray(data.taskTypeList) ? data.taskTypeList.map(v => +v.taskTypeId) : []);
189 204
     this.modal = true;
190 205
     this.add = false;
191 206
     this.coopId = data.id;
207
+    this.coopData = data;
208
+    this.getOtherTasktype();
192 209
   }
193 210
 
194 211
   // 删除
@@ -199,10 +216,13 @@ export class TabCustomComponent implements OnInit {
199 216
   }
200 217
   // 确认删除
201 218
   confirmDel() {
202
-    return;
203 219
     this.btnLoading = true;
204 220
     this.mainService
205
-      .rmvDataAndWeChatNum([this.coopId], true)
221
+      .simplePost(
222
+        "rmvData",
223
+        "tabPermission",
224
+        [this.coopId]
225
+      )
206 226
       .subscribe((data) => {
207 227
         this.btnLoading = false;
208 228
         this.hideDelModal();