Bladeren bron

拉取代码

maotao 9 maanden geleden
bovenliggende
commit
b15877f37c

+ 7 - 1
src/app/services/main.service.ts

@@ -845,5 +845,11 @@ export class MainService {
845 845
 	    headers: this.headers,
846 846
 	  });
847 847
 	}
848
-
848
+	//删除附件图片
849
+	removeAttachment(token) {
850
+	  return this.http.post(host.host + `/common/common/removeAttachment/${token}`,{}, {
851
+	    headers: this.headers,
852
+	  });
853
+	}
854
+	
849 855
 }

+ 7 - 5
src/app/share/wang-editor/wang-editor.component.ts

@@ -1,4 +1,4 @@
1
-import { Component, ElementRef, Output, OnInit, EventEmitter } from '@angular/core';
1
+import { Component, ElementRef, Output, Input, OnInit, EventEmitter } from '@angular/core';
2 2
 import WangEditor from 'wangeditor';
3 3
 @Component({
4 4
   selector: 'app-wang-editor',
@@ -7,6 +7,7 @@ import WangEditor from 'wangeditor';
7 7
 })
8 8
 export class wangEditorComponent implements OnInit {
9 9
 	@Output() changeContent = new EventEmitter();
10
+	@Input() content: string;
10 11
 	editor: any;
11 12
 	constructor(
12 13
 
@@ -16,6 +17,8 @@ export class wangEditorComponent implements OnInit {
16 17
 		this.editor = new WangEditor('#editorMenu', '#editor');
17 18
 		this.setEditorConfig()
18 19
 		this.editor.create();
20
+		// 设置内容
21
+		this.setContent()
19 22
   }
20 23
 	
21 24
 	// 编辑器相关配置设置
@@ -136,14 +139,13 @@ export class wangEditorComponent implements OnInit {
136 139
 	
137 140
 	  // 编辑器失去焦点触发事件
138 141
 	  editorOnBlur = (html) => {
139
-	    // console.log(html);
140 142
 			this.changeContent.emit(html)
141 143
 	  }
142 144
 	
143 145
 	  // 设置编辑器显示内容
144
-	//   setContent() {
145
-	//     this.editor.txt.html(this.textareaValue);
146
-	//   }
146
+	  setContent() {
147
+	    this.editor.txt.html(this.content);
148
+	  }
147 149
 	
148 150
 	//   // 获取编辑器内容,带html
149 151
 	//   getContent() {

+ 0 - 3
src/app/views/main/main-routing.module.ts

@@ -563,13 +563,11 @@ const routes: Routes = [
563 563
         path: "inspectionExecute",
564 564
         loadChildren: () => import("../inspection-execute/inspection-execute.module").then((m) => m.InspectionExecuteModule),
565 565
       },
566
-<<<<<<< HEAD
567 566
 			// 故障管理-知识库管理
568 567
 			{
569 568
 			  path: "repositoryManage",
570 569
 			  loadChildren: () => import("../repository-manage/repository-manage.module").then((m) => m.RepositoryManageModule),
571 570
 			},
572
-=======
573 571
       // 三方公司
574 572
       {
575 573
         path: "tripartiteCompany",
@@ -585,7 +583,6 @@ const routes: Routes = [
585 583
         path: "assetsProductManagement",
586 584
         loadChildren: () => import("../assets-product-management/assets-product-management.module").then((m) => m.AssetsProductManagementModule),
587 585
       },
588
->>>>>>> ce9c995986db1c27e0fa1c88d63814fae0b91dcd
589 586
     ],
590 587
   },
591 588
 ];

+ 20 - 15
src/app/views/repository-manage-add/repository-manage-add.component.html

@@ -1,6 +1,6 @@
1 1
 <div class="detail-box">
2 2
   <div class="modalBody">
3
-    <!-- <overlay-scrollbars #osComponentRef1 class="content"> -->
3
+    <overlay-scrollbars #osComponentRef1 class="content">
4 4
      <form nz-form [formGroup]="validateForm" class="addForm">
5 5
 <!--     	<nz-form-item class="form-item">
6 6
      	  <nz-form-label nzRequired nzFor="code">编号</nz-form-label>
@@ -14,11 +14,12 @@
14 14
 					<input nz-input formControlName="version"  placeholder="请输入版本号" nzSize="default" />
15 15
 			  </nz-form-control>
16 16
 			</nz-form-item> -->
17
-<!-- 			<nz-form-item class="form-title-box">
18
-			  <div class="form-title">知识库编号:9998</div>
19
-			  <div class="form-title">版本号:V1</div>
20
-			</nz-form-item> -->
21 17
 			<div class="left-form-box">
18
+				<nz-form-item class="form-title-box" *ngIf="!add">
19
+					<div class="form-title">知识库编号:{{solutionNumber}}</div>
20
+					<div class="form-title">版本号:V{{versionNumber}}</div>
21
+				</nz-form-item>
22
+				
22 23
 				<nz-form-item class="form-item">
23 24
 				  <nz-form-label nzRequired nzFor="title" [nzSm]="4" [nzXs]="24">标题</nz-form-label>
24 25
 				  <nz-form-control nzErrorTip="请输入标题!" [nzSm]="20" [nzXs]="24">
@@ -27,7 +28,8 @@
27 28
 				</nz-form-item>
28 29
 				<nz-form-item class="form-item">
29 30
 				  <nz-form-label nzFor="content" [nzSm]="4" [nzXs]="24">内容</nz-form-label>
30
-					<app-wang-editor (changeContent)="changeContent($event)"></app-wang-editor>
31
+					<app-wang-editor *ngIf="add || detailContent==''" (changeContent)="changeContent($event)"></app-wang-editor>
32
+					<app-wang-editor *ngIf="!add && detailContent" (changeContent)="changeContent($event)" [content]="detailContent"></app-wang-editor>
31 33
 				</nz-form-item>
32 34
 			</div>
33 35
 			
@@ -71,12 +73,10 @@
71 73
 				  <nz-form-label nzRequired nzFor="malfunction" [nzSm]="6" [nzXs]="24">关联故障现象</nz-form-label>
72 74
 				  <nz-form-control nzErrorTip="请选择关联故障现象!" [nzSm]="16" [nzXs]="24">
73 75
 				    <nz-input-group>
74
-							<nz-tree-select
75
-							  [nzNodes]="malfunctionData"
76
-								nzShowSearch 
77
-								nzPlaceHolder="请选择关联故障现象" 
78
-								formControlName="malfunction">
79
-							</nz-tree-select>
76
+							<nz-cascader [nzOptions]="malfunctionData" 
77
+								formControlName="malfunction" 
78
+								nzPlaceHolder="请选择关联故障现象">
79
+							</nz-cascader>
80 80
 						</nz-input-group>
81 81
 				  </nz-form-control>
82 82
 				</nz-form-item>
@@ -106,6 +106,7 @@
106 106
 							[nzCustomRequest]="customReq"
107 107
 						  nzName="file"
108 108
 							[(nzFileList)]="fileData"
109
+							[(nzRemove)]="removeFile"
109 110
 						  [nzBeforeUpload]="beforeUpload"
110 111
 						  (nzChange)="handleChange($event)"
111 112
 						>
@@ -117,14 +118,18 @@
117 118
 			</div>
118 119
 			
119 120
      </form>
120
-    <!-- </overlay-scrollbars> -->
121
+    </overlay-scrollbars>
121 122
  
122 123
   </div>
123 124
 	<div class="display_flex justify-content_flex-center form-btn">
124
-	  <button class="btn" nz-button nzType="primary" (click)="submitForm(1)" [nzLoading]="btnLoading1">保存</button>
125
-		<button class="btn" nz-button nzType="primary" (click)="submitForm(2)" [nzLoading]="btnLoading2">暂存</button>
125
+	  <button *ngIf="optType!='upgrade'" class="btn" nz-button nzType="primary" (click)="submitForm(1)" [nzLoading]="btnLoading1">保存</button>
126
+		<button *ngIf="optType!='upgrade'" class="btn" nz-button nzType="primary" (click)="submitForm(2)" [nzLoading]="btnLoading2">暂存</button>
127
+		<button *ngIf="optType=='upgrade'" class="btn" nz-button nzType="primary" (click)="submitForm(3)" [nzLoading]="btnLoading2">升级知识</button>
126 128
 		<button class="btn cancel" nz-button nzType="default" (click)="back()">取消</button>
127 129
 	</div>
130
+	<div class="mask-style" *ngIf="isSpinning">
131
+		<nz-spin nzSimple class="spin-style"></nz-spin>
132
+	</div>
128 133
 </div>
129 134
 <!-- 操作成功/失败提示框 -->
130 135
 <app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"

+ 36 - 0
src/app/views/repository-manage-add/repository-manage-add.component.less

@@ -83,6 +83,7 @@ h3{
83 83
 		}
84 84
 		.form-title-box{
85 85
 			display: flex;
86
+			margin-left: 94px;
86 87
 			.form-title{
87 88
 				color: #000;
88 89
 				margin-right: 40px;
@@ -103,6 +104,9 @@ h3{
103 104
 		.ant-select{
104 105
 			width: 100%;
105 106
 		}
107
+		.ant-cascader{
108
+			width: 100%;
109
+		}
106 110
 	}
107 111
 	
108 112
 	.form-btn{
@@ -114,4 +118,36 @@ h3{
114 118
 		  }
115 119
 		}
116 120
 	}
121
+	/deep/ .cdk-overlay-pane{
122
+		top: 160px !important;
123
+	}
124
+	
125
+	.mask-style{
126
+		width: 100%;
127
+		height: 100%;
128
+		position: fixed;
129
+		top: 0;
130
+		left: 0;
131
+		z-index: 999;
132
+		display: flex;
133
+		background: rgba(0,0,0,0.2);
134
+		align-items: center;
135
+		justify-content: center;
136
+	}
137
+	.spin-style{
138
+		z-index:9999;
139
+	}
140
+	.sign{
141
+		width: 8px;
142
+		height: 8px;
143
+		border-radius: 50%;
144
+		background: red;
145
+		display: inline-block;
146
+	}
147
+	.red{
148
+		color: red;
149
+	}
150
+	.green{
151
+		color: #34b349;
152
+	}
117 153
 }

+ 174 - 200
src/app/views/repository-manage-add/repository-manage-add.component.ts

@@ -20,6 +20,7 @@ import { HttpEventType, HttpEvent, HttpRequest, HttpResponse, HttpClient } from
20 20
   styleUrls: ["./repository-manage-add.component.less"],
21 21
 })
22 22
 export class RepositoryManageAddComponent implements OnInit {
23
+	currentHospital; //当前院区
23 24
   @ViewChild("osComponentRef1", {
24 25
     read: OverlayScrollbarsComponent,
25 26
     static: false,
@@ -41,16 +42,23 @@ export class RepositoryManageAddComponent implements OnInit {
41 42
 			this.getProduct(e[0]);
42 43
     });
43 44
 		this.detailId = this.route.snapshot.params.id;
45
+		this.optType = this.route.snapshot.queryParams.type  //upgrade:升级
44 46
 		if(this.detailId==0){
45
-			this.add = true
47
+			this.add = true //新增
46 48
 		}else{
47
-			this.add = false
49
+			this.add = false //编辑
48 50
 		}
51
+		this.getDicData()
49 52
 		this.hosId = this.tool.getCurrentHospital().id;
50 53
     this.coopBtns = this.tool.initCoopBtns(this.route);
54
+		this.currentHospital = this.tool.getCurrentHospital();
51 55
 		this.initForm();
52 56
     this.getAllHospital();
53 57
   }
58
+	detailData:any;
59
+	solutionNumber;
60
+	versionNumber;
61
+	optType:null;
54 62
 	classItem:null;
55 63
 	detailId:null; //列表数据
56 64
 	deptId:null; //选中的科室id
@@ -79,6 +87,7 @@ export class RepositoryManageAddComponent implements OnInit {
79 87
   btnLoading1: boolean = false; //确认按钮loading状态
80 88
 	btnLoading2: boolean = false; //确认按钮loading状态
81 89
   printLoading: boolean = false; //批量打印按钮loading状态
90
+	isSpinning: boolean = false; //页面loading状态
82 91
   deptPhones: any = []; //新添加的科室电话列表
83 92
   isAddDeptsPhone = true; //添加新的科室电话是否禁用
84 93
   deptsPhoneId = 1; //科室电话自增id
@@ -96,148 +105,73 @@ export class RepositoryManageAddComponent implements OnInit {
96 105
   // 初始化增删改按钮
97 106
   coopBtns: any = {};
98 107
 	deptName:null;
108
+	detailContent:null;
99 109
   //搜索父级科室
100 110
 	isDeptLoading = false;
101
-	isSpinning = false;
102 111
 	delGrantModal = false;
103 112
 	showInsp = false;
104 113
   changeInp(e, type) {
105 114
     this.searchParentDeptSubject.next([e, type]);
106 115
   }
107 116
 
108
-  // 表格数据
109
-  loading1 = false;
110
-  getList() {
111
-    var that = this;
112
-    let data = {
113
-    	idx: 0,
114
-    	sum: 9999,
115
-    	drugsConfigure: {
116
-    	  hosId: this.hosId,
117
-				deptId :this.deptId?this.deptId:null,
118
-    	  batchId: this.detailId
119
-    	}
120
-    };
121
-    this.loading1 = true;
122
-    that.mainService
123
-      .getFetchDataList("data", "drugsConfigure", data)
124
-      .subscribe((data) => {
125
-        this.loading1 = false;
126
-        that.listOfData = data.list;
127
-      });
128
-  }
129
-	
130
-	// 发药科室列表
131
-	getDispensingDept(e,type){
117
+	// 获取详情
118
+	getDetail(){
119
+		this.isSpinning = true
132 120
 		var that = this;
133
-		let data = {
134
-			idx: 0,
135
-			sum: 9999,
136
-			drugsConfigure: {
137
-			  hosId: this.hosId,
138
-				deptId :e,
139
-				batchId:''
121
+		let query = {
122
+			idx: that.pageIndex - 1,
123
+			sum: that.pageSize,
124
+			solution: {
125
+				hosId: this.hosId,
126
+				id:this.detailId,
127
+				operationType:'lookOver',
140 128
 			}
141 129
 		};
142
-		if(type=='dept'){
143
-			data.drugsConfigure.batchId = this.detailId
144
-		}else{
145
-			delete data.drugsConfigure.batchId
146
-		}
147
-		let deptData = this.hospitals1.find(i=>i.id==e)
130
+	
148 131
 		that.mainService
149
-		  .getFetchDataList("data", "drugsConfigure", data)
150
-		  .subscribe((res) => {
151
-				if(res.list.length==0){
152
-					this.message.error(`您选择的科室“	${deptData.dept}”时间段内没有消耗药品无法添加发药单。`)
153
-				}else{
154
-					this.getDeptData(e,'all','load')
132
+			.getFetchDataList("data", "solution", query)
133
+			.subscribe((res) => {
134
+				this.getFile()
135
+				let data = res.list[0]
136
+				this.detailData = data
137
+				this.solutionNumber = data.solutionNumber
138
+				this.versionNumber = data.versionNumber
139
+				this.detailContent = data.content || ''
140
+				let item = this.dicData.find(i=>i.id == this.detailData.type.id)
141
+				if(item){
142
+					this.classItem = item.value
155 143
 				}
156
-		  });
157
-	}
158
-	
159
-	// 科室点击
160
-	deptClick(e,item,index){
161
-		e.stopPropagation();
162
-		this.deptId = item.applyDeptDTO.id
163
-		this.deptName = item.applyDeptDTO.dept
164
-		this.deptIndex = index
165
-		this.getList()
166
-	}
167
-	
168
-	// 科室删除
169
-	deptDel(e,item,index){
170
-		e.stopPropagation();
171
-		this.delModal = true;
172
-		this.coopId = item.applyDept;
173
-	}
174
-	
175
-	hideDelModal() {
176
-	  this.delModal = false;
177
-	}
178
-	
179
-	// 选择楼栋
180
-	buildingChange(e){
181
-		this.deptId = null
182
-		this.deptName = null
183
-		this.deptIndex = null
184
-		this.listOfData=[]
185
-		this.showInsp = true
186
-		this.getDeptData(e,'','')
187
-	}
188
-	
189
-	// 根据楼栋查询科室
190
-	getDeptData(e,type,initial){
191
-		var that = this;
192
-		let data = {
193
-		  idx: 0,
194
-		  sum: 99999,
195
-		  drugsList: {
196
-				hosId: this.hosId,
197
-				buildingId:e,
198
-				batch:{
199
-					id:this.detailId
144
+				this.validateForm.controls.title.setValue(data.title || '');
145
+				this.validateForm.controls.content.setValue(data.content || '');
146
+				this.validateForm.controls.repairVisible.setValue(data.repairVisible+'' || '');
147
+				this.validateForm.controls.knowledgeClass.setValue(data.type.id || '');
148
+				if(data.inspectionForm){
149
+					this.validateForm.controls.polling.setValue(data.inspectionForm.id || '');
200 150
 				}
201
-		  },
202
-		};
203
-		if(type=='all'){
204
-			delete data.drugsList.buildingId
205
-		}else{
206
-			data.drugsList.buildingId = e
207
-		}
208
-		if(this.showInsp){
209
-			this.isSpinning = true
210
-		}
211
-		that.mainService
212
-		  .getFetchDataList("data", "drugsList", data)
213
-		  .subscribe((res) => {
151
+				this.validateForm.controls.assetProductId.setValue(data.assetProductId || '');
214 152
 				this.isSpinning = false
215
-		    that.deptList = res.list;
216
-				if(initial=='load'){
217
-					if(res.list.length>0){
218
-						this.deptId = res.list[0].applyDeptDTO.id
219
-						this.deptName = res.list[0].applyDeptDTO.dept
220
-						this.deptIndex = 0
221
-					}
222
-					this.getList()
153
+			});
154
+	}
155
+	fileAllData=null;
156
+	getFile(){
157
+		this.mainService
158
+			.getPreviewImage('solution', this.detailId)
159
+			.subscribe((res:any)=> {
160
+				if(res.data.length>0){
161
+					this.fileAllData = res.data
162
+					this.fileData = res.data.map(i=>{
163
+						return{
164
+							uid:i.id,
165
+							name:i.name,
166
+							token:i.token
167
+						}
168
+					})
223 169
 				}
224
-		  });
170
+			});
225 171
 	}
226 172
 	
227
-	// 选择科室
228
-	addDeptId=''
229
-	deptChange(e){
230
-		this.addDeptId = e
231
-		
232
-	}
233
-	// 添加科室
234
-	addDept(){
235
-		if(this.addDeptId){
236
-			this.showInsp = true
237
-			this.getDispensingDept(this.addDeptId,'dept')
238
-		}else{
239
-			this.message.error('请先选择发药科室')
240
-		}
173
+	hideDelModal() {
174
+	  this.delModal = false;
241 175
 	}
242 176
 	
243 177
 	// 获取产品
@@ -258,40 +192,34 @@ export class RepositoryManageAddComponent implements OnInit {
258 192
 		  });
259 193
 	}
260 194
 	
261
-	// 获取所有科室
262
-  getDeparts() {
263
-    let data = {
264
-      batchId:this.detailId
265
-    };
266
-    this.mainService
267
-      .getConsumeDept(data)
268
-      .subscribe((res) => {
269
-				this.hospitals1 = res.data
270
-      });
271
-  }
272
-	
273 195
   // 获取所有院区
274 196
   getAllHospital() {
275 197
 		this.getPolling()
276 198
 		this.getProduct('')
277 199
 		this.getMalfunction()
278
-		this.getDicData()
279 200
   }
280 201
 	
281 202
 	// 获取故障现象数据
282 203
 	getMalfunction(){
204
+		if(!this.currentHospital.type || (this.currentHospital.type && this.currentHospital.type.value !== '6')){
205
+		  this.malfunctionData = [];
206
+		  return;
207
+		};
283 208
 		let postData = {
284
-		  building: {
285
-		    cascadeHosId: this.hosId,
209
+		  category: {
210
+		    dutyIds: this.currentHospital.type.value === '6' ? this.currentHospital.id.toString()  : undefined,
286 211
 		  },
287
-		  idx: 0,
288
-		  sum: 20,
289 212
 		};
290
-		this.mainService
291
-		  .getFetchDataList("data", "building", postData)
292
-		  .subscribe((result) => {
293
-				this.malfunctionData = result.data
294
-		  });
213
+		this.mainService.incidentPost("listIncidentCategory", postData).subscribe(res => {
214
+		  let incidentCategoryList = res.data || [];
215
+		  incidentCategoryList = incidentCategoryList.map(v => ({...v, parentId: v.parent ? v.parent.id : undefined, label: v.category, value: v.id}));
216
+		  this.malfunctionData = this.tool.tranListToTreeDataLeaf(incidentCategoryList, undefined, "parentId");
217
+			
218
+			if(this.detailData && this.detailData.categoryId){
219
+				let malfunctionId = this.tool.tranListToTreeDataFindIdsLeaf(this.malfunctionData,this.detailData.categoryId);
220
+				this.validateForm.controls.malfunction.setValue(malfunctionId);
221
+			}
222
+		})
295 223
 	}
296 224
 	
297 225
 	// 获取巡检列表
@@ -318,6 +246,12 @@ export class RepositoryManageAddComponent implements OnInit {
318 246
 	getDicData(){
319 247
 		this.mainService.getDictionary("list", "solution_type").subscribe((res) => {
320 248
 			this.dicData = res
249
+			if(!this.add){
250
+				this.getDetail()
251
+			}
252
+			if(this.optType=='upgrade'){
253
+				this.getDetail()
254
+			}
321 255
 		});
322 256
 		this.mainService.getDictionary("list", "solution_status").subscribe((res) => {
323 257
 			this.typeDic = res
@@ -327,29 +261,15 @@ export class RepositoryManageAddComponent implements OnInit {
327 261
 	// 选择知识库分类
328 262
 	radioChnage(e){
329 263
 		let item = this.dicData.find(i=>i.id == this.validateForm.value.knowledgeClass)
330
-		this.classItem = item.value
264
+		if(item){
265
+			this.classItem = item.value
266
+		}
331 267
 	}
332 268
 	
333
-	
334
-	
335 269
 	hideGrantModal(){
336 270
 		this.delGrantModal = false;
337 271
 	}
338 272
 	
339
-	// 增加/减少
340
-	rowData = null;
341
-	itemClick(e, data, type){
342
-		e.stopPropagation();
343
-		this.rowId = data.id
344
-		this.rowData = data
345
-		if(type=='add'){
346
-			this.add = true
347
-		}else{
348
-			this.add = false
349
-		}
350
-		this.modal = true
351
-		this.initForm();
352
-	}
353 273
 	
354 274
 	// 富文本内容
355 275
 	editOrData=null;
@@ -365,19 +285,51 @@ export class RepositoryManageAddComponent implements OnInit {
365 285
 		  that.validateForm.controls[i].updateValueAndValidity();
366 286
 		}
367 287
 		if (that.validateForm.invalid) return;
288
+
289
+		if(this.classItem==1){
290
+			if(!this.validateForm.value.malfunction){
291
+				this.message.error(`请选择关联故障现象`)
292
+				return
293
+			}
294
+		}else if(this.classItem==2){
295
+			if(!this.validateForm.value.polling){
296
+				this.message.error(`请选择关联巡检表`)
297
+				return
298
+			}
299
+		}
300
+		let operationType = null
301
+		if(this.optType=='edit'){
302
+			operationType = 'edit'
303
+		}else if(this.optType=='upgrade'){
304
+			operationType = 'upgrade'
305
+		}
368 306
 	  let data = {
369
-			...this.validateForm.value,
307
+			title:this.validateForm.value.title,
308
+			repairVisible:this.validateForm.value.repairVisible,
370 309
 			content:this.editOrData,
371 310
 			id:'',
372 311
 			hosId:this.hosId,
373 312
 			inspectionForm:{
374
-				id:this.validateForm.value.polling
313
+				id:'' //巡检
375 314
 			},
376 315
 			type:{
377 316
 				id:this.validateForm.value.knowledgeClass
378 317
 			},
379
-			buttonType:type==1?'confirm':'ts'
318
+			assetProductId:this.validateForm.value.assetProductId,
319
+			categoryId:'', //故障
320
+			buttonType:type==1?'confirm':'ts',
321
+			operationType: operationType
380 322
 	  };
323
+		if(this.classItem==1){
324
+			data.categoryId = this.validateForm.value.malfunction[2]
325
+			delete data.inspectionForm
326
+		}else if(this.classItem==2){
327
+			data.inspectionForm.id = this.validateForm.value.polling
328
+			delete data.categoryId
329
+		}else{
330
+			delete data.inspectionForm
331
+			delete data.categoryId
332
+		}
381 333
 		if(this.add){
382 334
 			delete data.id
383 335
 		}else{
@@ -385,31 +337,35 @@ export class RepositoryManageAddComponent implements OnInit {
385 337
 		}
386 338
 		if(type==1){
387 339
 			that.btnLoading1 = true;
340
+		}else if(type==2){
341
+			that.btnLoading2 = true;
388 342
 		}else{
389 343
 			that.btnLoading2 = true;
390 344
 		}
391 345
 		
392 346
 	  that.mainService
393
-	    .simplePost("addData", "solution", data)
347
+	    .simplePost(this.add?"addData":"updData", "solution", data)
394 348
 	    .subscribe((res) => {
395 349
 				if(type==1){
396 350
 					that.btnLoading1 = false;
351
+				}else if(type==2){
352
+					that.btnLoading2 = false;
397 353
 				}else{
398 354
 					that.btnLoading2 = false;
399 355
 				}
400 356
 				if(this.fileData.length>0){
401
-					this.uploadFile(res.data.id)
402 357
 					if (res.status == 200) {
403
-					  that.showPromptModal(that.add ? "增加" : "减少", true, "");
358
+						this.uploadFile(res.data.id)
359
+					  that.showPromptModal("操作", true, "");
404 360
 					} else {
405
-					  that.showPromptModal(that.add ? "增加" : "减少", false, res.msg);
361
+					  that.showPromptModal("操作", false, res.msg);
406 362
 					}
407 363
 					that.hideModal();
408 364
 				}else{
409 365
 					if (res.status == 200) {
410
-					  that.showPromptModal(that.add ? "增加" : "减少", true, "");
366
+					  that.showPromptModal("操作", true, "");
411 367
 					} else {
412
-					  that.showPromptModal(that.add ? "增加" : "减少", false, res.msg);
368
+					  that.showPromptModal("操作", false, res.msg);
413 369
 					}
414 370
 					that.hideModal();
415 371
 				}
@@ -418,21 +374,27 @@ export class RepositoryManageAddComponent implements OnInit {
418 374
 	
419 375
 	// 上传图片
420 376
 	uploadFile(id){
421
-		console.log(555,this.fileData)
422 377
 		let url = `/service/common/common/uploadAttachment/solution/${id}/${id}`
423
-		
424
-		for(let i of this.fileData){
425
-			console.log(54545,i)
426
-			const formData = new FormData();
427
-			formData.append('file', i.originFileObj);
428
-			formData.append('filename', i.originFileObj.name);
429
-			const req = new HttpRequest('POST', url, formData, {
430
-				reportProgress: true,
431
-				withCredentials: true
432
-			});
433
-			this.http.request(req).subscribe((res) => {
434
-			    
435
-			});
378
+		for(let i of this.fileData){//新上传的附件
379
+			let item = this.fileAllData.find(t=>t.id == i.uid) //之前的附件
380
+			if(!item){
381
+				const formData = new FormData();
382
+				if(i.originFileObj){
383
+					formData.append('file', i.originFileObj);
384
+					formData.append('filename', i.originFileObj.name);
385
+				}else{
386
+					formData.append('file', i);
387
+					formData.append('filename', i.name);
388
+				}
389
+				
390
+				const req = new HttpRequest('POST', url, formData, {
391
+					reportProgress: true,
392
+					withCredentials: true
393
+				});
394
+				this.http.request(req).subscribe((res) => {
395
+				    
396
+				});
397
+			}
436 398
 		}
437 399
 	}
438 400
 	
@@ -448,7 +410,6 @@ export class RepositoryManageAddComponent implements OnInit {
448 410
 	}
449 411
 	
450 412
   hideModal() {
451
-		this.initForm();
452 413
     this.modal = false;
453 414
   }
454 415
   // 初始化新增form表单
@@ -459,10 +420,10 @@ export class RepositoryManageAddComponent implements OnInit {
459 420
 			version: [null, []],
460 421
 			content: [null, []],
461 422
 			assetProductId: [null,[]],
462
-			repairVisible: [null, [Validators.required]],
423
+			repairVisible: ['1', [Validators.required]],
463 424
 			knowledgeClass: [null, [Validators.required]],
464
-			polling: [null, [Validators.required]],
465
-			
425
+			polling: [null,],
426
+			malfunction:[null,],
466 427
 		});
467 428
   }
468 429
 	
@@ -470,9 +431,9 @@ export class RepositoryManageAddComponent implements OnInit {
470 431
 	avatarUrl: string;
471 432
 	avatarUrl1: string;
472 433
 	beforeUpload = (file: File) => {
434
+		console.log(888,file)
473 435
 	  return new Observable((observer: Observer<boolean>) => {
474 436
 			let type = file.name.split('.')
475
-			console.log(888,type[1])
476 437
 	    const isPic = (type[1] === 'xlsx' || type[1] === 'pdf' || 
477 438
 			type[1] === 'xls' || type[1] === 'ppt' || type[1] === 'txt');
478 439
 	    if (!isPic) {
@@ -493,7 +454,7 @@ export class RepositoryManageAddComponent implements OnInit {
493 454
 	
494 455
 	// 附件上传
495 456
 	handleChange(info: { file: UploadFile }): void {
496
-		// console.log(999,this.fileData)
457
+
497 458
 	}
498 459
 	
499 460
 	private getBase64(img: File, callback: (img: string) => void): void {
@@ -503,17 +464,29 @@ export class RepositoryManageAddComponent implements OnInit {
503 464
 	}
504 465
 	
505 466
 	// 删除附件
506
-	removeFile = (file: File) =>  {
467
+	removeFile = (file) =>  {
468
+		console.log(111,file)
469
+		let item = this.fileAllData.find(i=>i.id == file.uid)
470
+		let index = this.fileData.findIndex(i=>i.uid == file.uid)
471
+		if(item){ //附件在数据库
472
+			this.mainService
473
+				.removeAttachment(file.token)
474
+				.subscribe((res:any=[]) => {
475
+					if (res.status == 200) {
476
+						this.getFile()
477
+					} 
478
+				});
479
+		}else{//附件不在数据库
480
+			console.log(555, index)
481
+			if(index!=-1){
482
+				this.fileData.splice(index, 1)
483
+			}
484
+		}
507 485
 		
508
-		// let index = this.fileData.findIndex(i=>i.uid==e.uid)
509
-		// this.fileData.splice(index, 1)
510 486
 	}
511 487
 	
512 488
 	// 自定义上传
513 489
 	customReq = (item: UploadXHRArgs) => {
514
-		// this.fileData.push(item.file)
515
-		// console.log(2222,this.fileData);
516
-	  // Create a FormData here to store files and other parameters.
517 490
 	  const formData = new FormData();
518 491
 	  // tslint:disable-next-line:no-any
519 492
 	  formData.append('file', item.file as any);
@@ -543,6 +516,7 @@ export class RepositoryManageAddComponent implements OnInit {
543 516
 	};
544 517
 	
545 518
 	closeModel(){
519
+		this.initForm();
546 520
 		this.back()
547 521
 	}
548 522
 	

+ 89 - 44
src/app/views/repository-manage/repository-manage.component.html

@@ -47,7 +47,7 @@
47 47
 						<td>{{ data.status ? data.status.name : '-' }}</td>
48 48
             <td>
49 49
               <div class="coop">
50
-								<span *ngIf="coopBtns.edit && (data.status.name=='暂存' || data.status.name=='待改')" (click)="edit($event,data)">编辑</span>
50
+								<span *ngIf="coopBtns.edit && (data.status.name=='暂存' || data.status.name=='待改')" (click)="edit($event,data)">编辑</span>
51 51
 								<span *ngIf="coopBtns.look" (click)="look($event,data)">查看</span>
52 52
 								<span *ngIf="coopBtns.upgrade && data.status.name=='已发布'" (click)="upgrade($event,data)">升级</span>
53 53
 								<span *ngIf="coopBtns.audit && data.status.name=='待审核'" (click)="audit($event,data)">审核</span>
@@ -70,49 +70,79 @@
70 70
   <!-- 新增/编辑模态框 -->
71 71
   <div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="modal">
72 72
     <div class="modalBody">
73
-      <div class="title">发药批次-{{add ? '新增' : '编辑'}}<i class="icon_transport transport-guanbi" (click)="hideModal()"></i>
74
-      </div>
75
-      <overlay-scrollbars #osComponentRef1 class="content">
76
-       <form nz-form [formGroup]="validateForm" class="addForm" (ngSubmit)="submitForm()">
77
-       	<nz-form-item>
78
-       	  <nz-form-label nzRequired nzFor="dispensingTime">发药时间区间</nz-form-label>
79
-       	  <nz-form-control nzErrorTip="请选择发药时间区间!">
80
-       	    <nz-input-group>
81
-       				<nz-range-picker formControlName="dispensingTime" 
82
-							[nzShowTime]="{ nzFormat: 'yyyy-MM-dd HH:mm:ss' }" nzFormat="yyyy-MM-dd HH:mm:ss"
83
-							(ngModelChange)="formChangeDate($event)"></nz-range-picker>
84
-       			</nz-input-group>
85
-       	  </nz-form-control>
86
-       	</nz-form-item>
87
-       	<nz-form-item>
88
-       	  <nz-form-label nzRequired nzFor="department">取药科室</nz-form-label>
89
-       	  <nz-form-control nzErrorTip="请选择取药科室!">
90
-       	    <nz-input-group>
91
-       				<nz-select class="formItem" [nzDropdownMatchSelectWidth]="false" (nzOnSearch)="changeInp($event)" nzServerSearch nzShowSearch nzPlaceHolder="请选择申请科室" formControlName="department">
92
-       				  <ng-container *ngFor="let option of hospitals1">
93
-       				    <nz-option *ngIf="!isDeptLoading" [nzLabel]="option.dept" [nzValue]="option.id"></nz-option>
94
-       				  </ng-container>
95
-       				  <nz-option *ngIf="isDeptLoading" nzDisabled nzCustomContent>
96
-       				    <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
97
-       				  </nz-option>
98
-       				</nz-select>
99
-       			</nz-input-group>
100
-       	  </nz-form-control>
101
-       	</nz-form-item>
102
-				<nz-form-item>
103
-				  <nz-form-label>加载所有消耗科室</nz-form-label>
104
-					<nz-form-control>
105
-						<label nz-checkbox formControlName="loadAllConsumeDept">
106
-							<span>是否开启</span>
107
-						</label>
108
-					</nz-form-control>
109
-				</nz-form-item>
110
-       </form>
111
-      </overlay-scrollbars>
73
+      <div class="title">{{optType=='audit'?'审核':'查看'}}</div>
74
+      <!-- <overlay-scrollbars #osComponentRef1 class="content"> -->
75
+       <div class="view-box">
76
+				 <div class="view-item left-box">
77
+					 <div class="item-left-list" 
78
+					 [ngClass]="{'activeClass': index == vIndex}"
79
+					 *ngFor="let item of detailData let index=index;" (click)="versionsClick(item, index)">V{{item.versionNumber}}</div>
80
+				 </div>
81
+				 <div class="view-item center-box" *ngIf="lookData&&lookData.title">
82
+					 <div class="title">{{lookData.title}}</div>
83
+					 <div class="title-sign">
84
+						 <div class="width-180">知识分类:{{lookData.type.name}}</div>
85
+						 <div>报修可见:{{lookData.repairVisible=='1'?'是':'否'}}</div>
86
+						 <div>版本号:V{{lookData.versionNumber || ''}}</div>
87
+					 </div>
88
+					 <div class="title-sign">
89
+						 <div class="width-180" *ngIf="lookData.type.name=='故障现象'">关联故障:{{lookData.incidentCategory?lookData.incidentCategory.mutiCategory: ''}}</div>
90
+						 <div class="width-180" *ngIf="lookData.type.name=='日常巡检'">关联巡检:{{lookData.inspectionForm?lookData.inspectionForm.name: ''}}</div>
91
+						 <div>关联产品:{{lookData.assetProduct?lookData.assetProduct.name:''}}</div>
92
+					 </div>
93
+					 <div class="content-class" [innerHTML]="richText"></div>
94
+					 <div class="file-box" *ngIf="fileData.length>0">
95
+						 <div>附件列表:</div>
96
+						 <div>
97
+							 <div class="file-class" *ngFor="let item of fileData" (click)="fileClick(item)">
98
+								 {{item.name}}
99
+								<span nz-icon nzType="download" nzTheme="outline" class="download-icon"></span>
100
+							 </div>
101
+						 </div>
102
+					 </div>
103
+				 </div>
104
+				 <div class="view-item right-box" *ngIf="lookData&&lookData.title"> 
105
+					 <nz-steps [nzCurrent]="stepLength" nzDirection="vertical" nzSize="small">
106
+						<ng-container *ngFor="let item of lookData.solutionLogs; let index = index">
107
+						    <nz-step
108
+						      [nzDescription]="tpl"
109
+						    >
110
+						    </nz-step>
111
+						    <ng-template #tpl>
112
+									<div *ngIf="index==lookData.solutionLogs.length-1" class="step-size">
113
+										<div>
114
+											<span style="color: #49B856;">{{item.operationStatus.name}}</span>
115
+											&nbsp;&nbsp;&nbsp;
116
+											<span style="color:#333;">{{item.operationUser.name}}</span>
117
+										</div>
118
+										<div style="color:#333;">{{ item.time }}</div>
119
+										<div class="back-class" nz-tooltip [nzTooltipTitle]="item.rejectedReason" *ngIf="item.operationStatus.name=='审核驳回'">(驳回原因)</div>
120
+									</div>
121
+									<div *ngIf="index!=lookData.solutionLogs.length-1" class="step-size">
122
+										<div>
123
+											<span>{{item.operationStatus.name}}</span>
124
+											&nbsp;&nbsp;&nbsp;
125
+											<span>{{item.operationUser.name}}</span>
126
+										</div>
127
+										<div>{{ item.time }}</div>
128
+										<div class="back-class" nz-tooltip [nzTooltipTitle]="item.rejectedReason" *ngIf="item.operationStatus.name=='审核驳回'">(驳回原因)</div>
129
+									</div>
130
+						    </ng-template>
131
+						  </ng-container>
132
+					 </nz-steps>
133
+				 </div>
134
+			 </div>
135
+      <!-- </overlay-scrollbars> -->
112 136
       <div class="display_flex justify-content_flex-center">
113
-        <button class="btn" nz-button nzType="primary" (click)="submitForm()" [nzLoading]="btnLoading">{{add ? '保存并配置' : '保存'}}</button>
114
-				<button class="btn cancel" nz-button nzType="default" (click)="hideModal()">取消</button>
115
-      </div>
137
+        <button class="btn" *ngIf="optType=='audit' && vIndex==0" nz-button nzType="primary" (click)="submitForm(1)" [nzLoading]="btnLoading1">通过</button>
138
+				<button class="btn" *ngIf="optType=='audit' && vIndex==0" nz-button nzType="primary" (click)="submitForm(2)" [nzLoading]="btnLoading2">驳回</button>
139
+				<button class="btn cancel" *ngIf="optType=='audit'" nz-button nzType="default" (click)="hideModal()">取消</button>
140
+				<button class="btn" *ngIf="optType=='look'" nz-button nzType="primary" (click)="hideModal()">知道了</button>
141
+				
142
+			</div>
143
+			<div class="mask-style" *ngIf="isSpinning">
144
+				<nz-spin nzSimple class="spin-style"></nz-spin>
145
+			</div>
116 146
     </div>
117 147
   </div>
118 148
   <!-- 删除模态框 -->
@@ -126,6 +156,21 @@
126 156
 	<!-- 恢复模态框 -->
127 157
 	<app-dialog-delete [delModal]="renewModal" (hideDelModalEvent)="hideDelModal3()" [btnLoading]="btnLoading"
128 158
 		(confirmDelEvent)="confirmDel3()" content="您确认要恢复此知识库吗?"></app-dialog-delete>
159
+		
160
+	<!-- 审核通过模态框 -->
161
+	<app-dialog-delete [delModal]="auditModal" (hideDelModalEvent)="hideDelModal4()" [btnLoading]="btnLoading"
162
+		(confirmDelEvent)="confirmDel4()" content="您确认通过此知识库的审核吗?"></app-dialog-delete>
163
+	
164
+	<!-- 审核驳回模态框 -->
165
+	<nz-modal [(nzVisible)]="rejectModal" nzTitle="您确认驳回此知识库吗?" (nzOnCancel)="rejectCancel()" (nzOnOk)="rejectOk()">
166
+		<textarea
167
+			nz-input
168
+			[(ngModel)]="rejectData"
169
+			placeholder="请输入整改意见"
170
+			[nzAutosize]="{ minRows: 2, maxRows: 6 }"
171
+			
172
+		></textarea>
173
+	</nz-modal>
129 174
 			
130 175
   <!-- 编辑模态框 -->
131 176
   <app-dialog-delete [delModal]="editModal" (hideDelModalEvent)="hideDelModal1()" [btnLoading]="saveLoading"
@@ -134,5 +179,5 @@
134 179
 </div>
135 180
 <!-- 操作成功/失败提示框 -->
136 181
 <app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
137
-  [info]="promptInfo"></app-prompt-modal>
182
+  [info]="promptInfo" (closeModel)="closeModel()"></app-prompt-modal>
138 183
 

+ 93 - 12
src/app/views/repository-manage/repository-manage.component.less

@@ -34,7 +34,7 @@
34 34
   z-index: 99;
35 35
 
36 36
   .modalBody {
37
-    width: 350px;
37
+    width: 70%;
38 38
     background: #fff;
39 39
     border-radius: 5px;
40 40
     padding: 10px 20px;
@@ -45,7 +45,7 @@
45 45
       text-align: center;
46 46
       font-size: 18px;
47 47
       position: relative;
48
-
48
+			margin-bottom: 10px;
49 49
       i {
50 50
         position: absolute;
51 51
         right: 0;
@@ -56,7 +56,6 @@
56 56
         padding: 0 5px;
57 57
       }
58 58
     }
59
-
60 59
     .content {
61 60
       width: 100%;
62 61
       height: 117px;
@@ -108,12 +107,96 @@
108 107
     }
109 108
   }
110 109
 
111
-  // 新增
110
+  // 查看/审核
112 111
   &.add {
113 112
     .modalBody {
114
-      width: 420px;
113
+      width: 70%;
115 114
       height: auto;
116
-
115
+				.mask-style{
116
+					width: 100%;
117
+					height: 100%;
118
+					position: fixed;
119
+					top: 0;
120
+					left: 0;
121
+					z-index: 999;
122
+					display: flex;
123
+					background: rgba(0,0,0,0.2);
124
+					align-items: center;
125
+					justify-content: center;
126
+				}
127
+				.spin-style{
128
+					z-index:9999;
129
+				}
130
+			.view-box{
131
+				height: 400px;
132
+				display: flex;
133
+				border: 1px solid #eee;
134
+				.left-box{
135
+					flex: 1;
136
+					font-size: 14px;
137
+					border-right: 1px solid #E9E9E9;
138
+					.item-left-list{
139
+						display: flex;
140
+						align-items: center;
141
+						height: 35px;
142
+						padding-left: 10px;
143
+						cursor: pointer;
144
+					}
145
+				}
146
+				.center-box{
147
+					flex: 6;
148
+					padding: 0 20px 20px 20px;
149
+					border-right: 1px solid #E9E9E9;
150
+					height: auto;
151
+					overflow-y: auto;
152
+					.title{
153
+						margin: 10px 0 10px 0;
154
+						font-weight: bold;
155
+						font-size: 20px;
156
+						color: #000000;
157
+						font-style: normal;
158
+						text-transform: none;
159
+					}
160
+					.title-sign{
161
+						display: flex;
162
+						font-weight: 400;
163
+						font-size: 12px;
164
+						color: #555555;
165
+						margin-bottom: 5px;
166
+						.width-180{
167
+							width: 160px;
168
+						}
169
+						div{
170
+							margin-right: 60px;
171
+						}
172
+					}
173
+					.content-class{
174
+						margin-top: 20px;
175
+					}
176
+					.file-box{
177
+						margin-top: 30px;
178
+						font-size: 14px;
179
+						.file-class{
180
+							color: #1890FF;
181
+							text-decoration: underline;
182
+							margin-left: 10px;
183
+							cursor: pointer;
184
+						}
185
+						.download-icon{
186
+							margin-left: 8px;
187
+						}
188
+					}
189
+				}
190
+				.right-box{
191
+					flex: 1.6;
192
+					padding: 10px;
193
+					font-size: 14px;
194
+					.back-class{
195
+						color: red;
196
+						cursor: pointer;
197
+					}
198
+				}
199
+			}
117 200
       .content {
118 201
         width: 100%;
119 202
         height: auto;
@@ -227,16 +310,14 @@
227 310
           }
228 311
         }
229 312
       }
230
-
231
-      button {
232
-        &:nth-child(1) {
233
-          margin-right: 20px;
234
-        }
235
-      }
236 313
     }
237 314
   }
238 315
 }
239 316
 
317
+.activeClass{
318
+	background: #F0F6ED;
319
+}
320
+
240 321
 .monad{
241 322
 	margin-top: 20px;
242 323
 	.monad-list{

+ 212 - 171
src/app/views/repository-manage/repository-manage.component.ts

@@ -1,5 +1,6 @@
1 1
 import { Component, OnInit, ViewChild } from "@angular/core";
2 2
 import { ActivatedRoute, Router } from "@angular/router";
3
+import { DomSanitizer } from '@angular/platform-browser';
3 4
 import {
4 5
   FormBuilder,
5 6
   Validators,
@@ -36,20 +37,17 @@ export class RepositoryManageComponent implements OnInit {
36 37
     private mainService: MainService,
37 38
     private tool: ToolService,
38 39
     private http: HttpClient,
40
+		private sanitizer: DomSanitizer
39 41
   ) {}
40
-
41 42
   ngOnInit() {
42 43
     this.searchParentDeptSubject.pipe(debounceTime(500)).subscribe((e) => {
43
-			this.isDeptLoading = true;
44
-			this.getDeparts(e);
44
+			
45 45
     });
46 46
 		this.hosId = this.tool.getCurrentHospital().id;
47 47
     this.coopBtns = this.tool.initCoopBtns(this.route);
48
-    this.initForm();
49 48
 		this.getList();
50
-    // this.getAllHospital();
51
-    // this.getDeptHandoverType();
52 49
   }
50
+	richText:any;
53 51
   listOfData: any[] = []; //表格数据
54 52
   promptContent: string; //操作提示框提示信息
55 53
   ifSuccess: boolean; //操作成功/失败
@@ -68,10 +66,14 @@ export class RepositoryManageComponent implements OnInit {
68 66
   deptalias; //别名
69 67
   type; //类型
70 68
   deptHandoverType; //类型
69
+	vIndex:number = 0;//版本号下标
70
+	stepLength: number = 0; //步骤条
71 71
   pageIndex: number = 1; //页码
72 72
   listLength: number = 10; //总条数
73 73
   pageSize: number = 10; //每页条数
74 74
   btnLoading: boolean = false; //确认按钮loading状态
75
+	btnLoading1: boolean = false; //审核通过按钮loading状态
76
+	btnLoading2: boolean = false; //审核驳回按钮loading状态
75 77
   printLoading: boolean = false; //批量打印按钮loading状态
76 78
   deptPhones: any = []; //新添加的科室电话列表
77 79
   isAddDeptsPhone = true; //添加新的科室电话是否禁用
@@ -80,12 +82,19 @@ export class RepositoryManageComponent implements OnInit {
80 82
   hospitals1: any = []; //科室列表(搜索)
81 83
 	rowData: object = {}; //打印选择列表
82 84
 	editModal:boolean = false; //编辑时弹框
85
+	isSpinning: boolean = false; //页面loading状态
86
+	detailData:any;
87
+	lookData:any;
88
+	versionsData: any = []; //审核版本数据
89
+	fileData: any = []; //上传的附件数据
83 90
   searchParentDeptSubject = new Subject();
84 91
   // 初始化增删改按钮
85 92
   coopBtns: any = {};
86 93
 	saveLoading:boolean = false;
87 94
 	taskTypeData:{id:''};
88
-	
95
+	rejectModal:boolean = false;
96
+	rejectData:null;
97
+	optType:string = '';
89 98
   // 导入---end
90 99
   //搜索父级科室
91 100
 	isDeptLoading = false;
@@ -126,7 +135,6 @@ export class RepositoryManageComponent implements OnInit {
126 135
 		  .subscribe((data) => {
127 136
 		    that.saveLoading = false;
128 137
 		    that.hideModal();
129
-		    that.initForm();
130 138
 		    if (data.status == 200) {
131 139
 					this.editModal = false;
132 140
 		      that.showPromptModal("编辑", true, "");
@@ -172,146 +180,105 @@ export class RepositoryManageComponent implements OnInit {
172 180
       });
173 181
   }
174 182
 	
175
-	// 获取所有科室
176
-  getDeparts(dept) {
177
-    var that = this;
178
-    let data = {
179
-      department: {
180
-        dept,
181
-        hospital: {
182
-          id: this.hosId
183
-        },
184
-				type:{
185
-					id:''
186
-				}
187
-      },
188
-      idx: 0,
189
-      sum: 20,
190
-    };
191
-		that.mainService.getDictionary("list", "dept_type").subscribe((res) => {
192
-		  let typeData = res.find(i=>i.value=='pharmacyRoom');
193
-			if(typeData){
194
-				data.department.type.id = typeData.id
195
-			}
196
-			that.mainService
197
-			  .getFetchDataList("data", "department", data)
198
-			  .subscribe((data) => {
199
-					setTimeout(_=>{
200
-						this.hospitals1 = data.list
201
-						that.isDeptLoading = false;
202
-					},500)
203
-			  });
204
-		});
205
-  }
183
+	// 版本号点击
184
+	versionsClick(data, index){
185
+		this.vIndex = index
186
+		this.lookData = data
187
+		this.stepLength = this.lookData.solutionLogs.length
188
+		this.richText = this.sanitizer.bypassSecurityTrustHtml(data.content);
189
+	}
206 190
 	
207
-  // 获取所有院区
208
-  getAllHospital() {
209
-		this.getDeparts('')
210
-    this.getList();
211
-  }
191
+	// 点击附件
192
+	fileClick(data){
193
+		console.log(222,data)
194
+		let a: any = document.createElement('a') // 创建一个元素
195
+		a.style = 'display: none' // 不能在页面中被看到,把他隐藏起来
196
+		a.style.height = '0px' // 给个0高度,避免影响页面布局
197
+		a.download = data.name; 
198
+		a.href = data.url // 文件url地址
199
+		document.body.appendChild(a)  //  将其绑定在body上才能发挥作用
200
+		a.click() // 触发a标签的click事件
201
+		document.body.removeChild(a) // 删除该元素
202
+	}
212 203
 
213
-  // 获取科室汇总交接类型
214
-  deptHandoverTypes: Array<any> = [];
215
-  getDeptHandoverType() {
216
-    var that = this;
217
-    that.mainService.getDictionary("list", "dept_handover_type").subscribe((data) => {
218
-      console.log(data);
219
-      that.deptHandoverTypes = data;
220
-    });
204
+  hideModal() {
205
+    this.modal = false;
221 206
   }
222 207
 	
223
-	// 获取任务id
224
-	getTaskTypesId() {
225
-		this.mainService.getDictionary("list", "ordinary_field").subscribe((data) => {
226
-			this.taskTypeData = data.find(i=>i.value=='infusionSolutions')
227
-			this.getConfig();
228
-		});
208
+	// 审核通过
209
+	confirmDel4() {
210
+		let data: any = {
211
+			id:this.rowId,
212
+			operationType: 'approve'
213
+		};
214
+		this.btnLoading1 = true;
215
+		this.mainService
216
+			.simplePost("updData", "solution", data)
217
+			.subscribe((data) => {
218
+				this.btnLoading1 = false;
219
+				this.hideDelModal4()
220
+				if (data.status == 200) {
221
+					this.showPromptModal("审核", true, "");
222
+				} else {
223
+					this.showPromptModal("审核", false, data.msg);
224
+				}
225
+			});
229 226
 	}
230 227
 	
231
-	// 获取配置
232
-	getConfig() {
233
-	  let postData = {
234
-	    idx: 0,
235
-	    sum: 10,
236
-	    taskTypeConfig: {
237
-				hosId:this.hosId,
238
-				taskType:this.taskTypeData.id
239
-	    }
240
-	  };
241
-	  this.mainService
242
-		.getFetchDataList("simple/data", "taskTypeConfig", postData)
243
-		.subscribe((result) => {
244
-			if (result.status == 200) {
245
-				let data = result.list[0] || {};
246
-				this.validateForm.controls.department.setValue(data.pharmacyDept || '');
247
-				this.add = true;
248
-				this.modal = true;
249
-				this.isAddDeptsPhone = true;
250
-			}
251
-		});
228
+	hideDelModal4() {
229
+	  this.auditModal = false;
230
+	}
231
+	
232
+	// 审核驳回
233
+	rejectCancel(){
234
+		this.rejectModal = false
235
+	}
236
+	
237
+	// 审核驳回
238
+	rejectOk(){
239
+		if(this.rejectData==null){
240
+			this.message.error('请输入整改意见')
241
+			return
242
+		}
243
+		let data: any = {
244
+			id:this.rowId,
245
+			operationType: 'approve',
246
+			rejectReason:this.rejectData
247
+		};
248
+		this.btnLoading2 = true;
249
+		this.mainService
250
+			.simplePost("updData", "solution", data)
251
+			.subscribe((data) => {
252
+				this.btnLoading2 = false;
253
+				this.rejectCancel()
254
+				if (data.status == 200) {
255
+					this.showPromptModal("驳回", true, "");
256
+				} else {
257
+					this.showPromptModal("驳回", false, data.msg);
258
+				}
259
+			});
260
+	}
261
+	
262
+	closeModel(){
263
+		this.hideModal()
252 264
 	}
253 265
 	
254
-  // 新增弹框
255
-  showModal() {
256
-    this.initForm();
257
-		this.getTaskTypesId()
258
-  }
259
-  hideModal() {
260
-    this.modal = false;
261
-    this.initForm();
262
-  }
263
-  // 初始化新增form表单
264
-	loadStartTime = '';
265
-	loadEndTime = '';
266
-  initForm() {
267
-    this.validateForm = this.fb.group({
268
-      dispensingTime: [null, [Validators.required]],
269
-      department: [null, [Validators.required]],
270
-			loadAllConsumeDept: [true,[]]
271
-    });
272
-		let date = new Date();
273
-		this.loadStartTime = format(subDays(date, 1), "yyyy-MM-dd") +' '+'08:00:00'
274
-		this.loadEndTime = format(date, "yyyy-MM-dd") +' '+'08:00:00'
275
-		this.validateForm.controls.dispensingTime.setValue([this.loadStartTime, this.loadEndTime]);
276
-  }
277
-
278 266
   // 表单提交
279
-  submitForm(): void {
267
+	auditModal = false;
268
+  submitForm(type): void {
280 269
     var that = this;
281
-		for (const i in that.validateForm.controls) {
282
-		  that.validateForm.controls[i].markAsDirty();
283
-		  that.validateForm.controls[i].updateValueAndValidity();
284
-		}
285
-		if (that.validateForm.invalid) return;
286
-    let data: any = {
287
-			hosId:this.hosId,
288
-			pharmacy:this.validateForm.value.department,
289
-			loadAllConsumeDept:this.validateForm.value.loadAllConsumeDept?1:0
290
-    };
291
-  
292
-    if (!that.add) {
293
-			this.editModal = true
294
-    }else{
295
-			that.btnLoading = true;
296
-			that.mainService
297
-			  .simplePost("addData", "drugsBatch", data)
298
-			  .subscribe((data) => {
299
-			    that.btnLoading = false;
300
-			    that.hideModal();
301
-			    that.initForm();
302
-			    if (data.status == 200) {
303
-			      that.showPromptModal(that.add ? "新增" : "编辑", true, "");
304
-			    } else {
305
-			      that.showPromptModal(that.add ? "新增" : "编辑", false, data.msg);
306
-			    }
307
-			  });
270
+		if(type==1){
271
+			this.auditModal = true
272
+		}else{
273
+			this.rejectData = null
274
+			this.rejectModal = true
308 275
 		}
309 276
   }
310 277
 	
311 278
 	// 升级
312 279
 	upgrade(e, data){
313 280
 		e.stopPropagation();
314
-		this.router.navigateByUrl(`/dispensingDetail/${data.id}`);
281
+		this.router.navigateByUrl(`/repositoryManageAdd/${data.id}?type=upgrade`);
315 282
 	}
316 283
 	
317 284
 	// 新增
@@ -322,13 +289,94 @@ export class RepositoryManageComponent implements OnInit {
322 289
 	// 查看
323 290
 	look(e, data){
324 291
 		e.stopPropagation();
292
+		this.optType = 'look'
293
+		this.rowId = data.id
294
+		this.vIndex = 0
295
+		this.modal = true
296
+		var that = this;
297
+		let query = {
298
+			idx: that.pageIndex - 1,
299
+			sum: that.pageSize,
300
+			solution: {
301
+				hosId: this.hosId,
302
+				operationType:'lookOver',
303
+				solutionNumber:data.solutionNumber
304
+			}
305
+		};
306
+		this.isSpinning = true
307
+		that.mainService
308
+			.getFetchDataList("data", "solution", query)
309
+			.subscribe((res) => {
310
+				this.getFile()
311
+				let data = res.list
312
+				this.detailData = data
313
+				this.richText = this.sanitizer.bypassSecurityTrustHtml(data[0].content);
314
+				for(let i of data){
315
+					if(i.solutionLogs.length>0){
316
+						for(let t of i.solutionLogs){
317
+							t.time = format(t.operationTime, 'yyyy-MM-dd HH:mm')
318
+						}
319
+					}
320
+				}
321
+				this.lookData = data[0]
322
+				this.stepLength = this.lookData.solutionLogs.length
323
+				this.isSpinning = false
324
+			});
325
+	}
326
+	
327
+	getFile(){
328
+		this.mainService
329
+			.getPreviewImage('solution', this.rowId)
330
+			.subscribe((res:any)=> {
331
+				this.fileData = res.data.map((v) =>{
332
+					return{
333
+						name: v.name,
334
+						url: location.origin + '/file' + v.relativeFilePath
335
+					}
336
+				});
337
+			});
338
+	}
339
+	
340
+	// 审核
341
+	rowId=null;
342
+	audit(e, data){
343
+		e.stopPropagation();
344
+		this.rowId = data.id
345
+		this.vIndex = 0
346
+		this.optType = 'audit'
325 347
 		this.modal = true
348
+		var that = this;
349
+		let query = {
350
+			idx: that.pageIndex - 1,
351
+			sum: that.pageSize,
352
+			solution: {
353
+				hosId: this.hosId,
354
+				operationType:'lookOver',
355
+				solutionNumber:data.solutionNumber
356
+			}
357
+		};
358
+		this.isSpinning = true
359
+		that.mainService
360
+			.getFetchDataList("data", "solution", query)
361
+			.subscribe((res) => {
362
+				this.getFile()
363
+				let data = res.list
364
+				this.detailData = data
365
+				this.richText = this.sanitizer.bypassSecurityTrustHtml(data[0].content);
366
+				for(let i of data[0].solutionLogs){
367
+					i.time = format(i.operationTime, 'yyyy-MM-dd HH:mm') 
368
+				}
369
+				this.lookData = data[0]
370
+				this.stepLength = this.lookData.solutionLogs.length
371
+				this.isSpinning = false
372
+			});
373
+	
326 374
 	}
327 375
 	
328 376
 	// 编辑
329 377
 	edit(e, data) {
330 378
 	  e.stopPropagation();
331
-	  this.router.navigateByUrl(`/repositoryManageAdd/${data.id}`);
379
+	  this.router.navigateByUrl(`/repositoryManageAdd/${data.id}?type=edit`);
332 380
 	}
333 381
 	
334 382
 	// 停用
@@ -343,21 +391,21 @@ export class RepositoryManageComponent implements OnInit {
343 391
 	confirmDel2() {
344 392
 	  var that = this;
345 393
 	  that.btnLoading = true;
346
-	  that.mainService
347
-	    .coopTypeConfig(
348
-	      "rmvData",
349
-	      "drugsBatch",
350
-	       [that.coopId]
351
-	    )
352
-	    .subscribe((data) => {
353
-	      that.btnLoading = false;
354
-	      that.pauseModal = false;
355
-	      if (data.status==200) {
356
-	        that.showPromptModal("停用", true, "");
357
-	      } else {
358
-	        that.showPromptModal("停用", false, data.data[0].msg);
359
-	      }
360
-	    });
394
+		let data: any = {
395
+			id:this.coopId,
396
+			operationType: 'deactivate'
397
+		};
398
+		this.mainService
399
+			.simplePost("updData", "solution", data)
400
+			.subscribe((data) => {
401
+				that.btnLoading = false;
402
+				that.pauseModal = false;
403
+				if (data.status == 200) {
404
+					this.showPromptModal("停用", true, "");
405
+				} else {
406
+					this.showPromptModal("停用", false, data.msg);
407
+				}
408
+			});
361 409
 	}
362 410
 	
363 411
 	hideDelModal2() {
@@ -376,35 +424,28 @@ export class RepositoryManageComponent implements OnInit {
376 424
 	// 确认恢复
377 425
 	confirmDel3() {
378 426
 	  var that = this;
379
-	  that.btnLoading = true;
380
-	  that.mainService
381
-	    .coopTypeConfig(
382
-	      "rmvData",
383
-	      "drugsBatch",
384
-	       [that.coopId]
385
-	    )
386
-	    .subscribe((data) => {
387
-	      that.btnLoading = false;
388
-	      that.renewModal = false;
389
-	      if (data.status==200) {
390
-	        that.showPromptModal("恢复", true, "");
391
-	      } else {
392
-	        that.showPromptModal("停用", false, data.data[0].msg);
393
-	      }
394
-	    });
427
+		that.btnLoading = true;
428
+		let data: any = {
429
+			id:this.coopId,
430
+			operationType: 'recover'
431
+		};
432
+		this.mainService
433
+			.simplePost("updData", "solution", data)
434
+			.subscribe((data) => {
435
+				that.btnLoading = false;
436
+				that.renewModal = false;
437
+				if (data.status == 200) {
438
+					this.showPromptModal("恢复", true, "");
439
+				} else {
440
+					this.showPromptModal("恢复", false, data.msg);
441
+				}
442
+			});
395 443
 	}
396 444
 	
397 445
 	hideDelModal3() {
398 446
 	  this.renewModal = false;
399 447
 	}
400 448
 	
401
-	// 审核
402
-	audit(e, data){
403
-		e.stopPropagation();
404
-		this.modal = true
405
-		// this.router.navigateByUrl(`/dispensingDetail/${data.id}`);
406
-	}
407
-	
408 449
 
409 450
   // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
410 451
   showPromptModal(con, success, promptInfo?) {