maotao 8 ヶ月 前
コミット
ec39080e99

+ 50 - 2
package-lock.json

@@ -41,6 +41,7 @@
41 41
         "tslib": "^1.9.0",
42 42
         "uuid": "^10.0.0",
43 43
         "viewerjs": "^0.10.0",
44
+        "wangeditor": "^4.7.15",
44 45
         "zone.js": "^0.9.1"
45 46
       },
46 47
       "devDependencies": {
@@ -614,6 +615,23 @@
614 615
         "node": ">=6.9.0"
615 616
       }
616 617
     },
618
+    "node_modules/@babel/runtime-corejs3": {
619
+      "version": "7.25.0",
620
+      "resolved": "https://registry.npmmirror.com/@babel/runtime-corejs3/-/runtime-corejs3-7.25.0.tgz",
621
+      "integrity": "sha512-BOehWE7MgQ8W8Qn0CQnMtg2tHPHPulcS/5AVpFvs2KCK1ET+0WqZqPvnpRpFN81gYoFopdIEJX9Sgjw3ZBccPg==",
622
+      "dependencies": {
623
+        "core-js-pure": "^3.30.2",
624
+        "regenerator-runtime": "^0.14.0"
625
+      },
626
+      "engines": {
627
+        "node": ">=6.9.0"
628
+      }
629
+    },
630
+    "node_modules/@babel/runtime-corejs3/node_modules/regenerator-runtime": {
631
+      "version": "0.14.1",
632
+      "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
633
+      "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="
634
+    },
617 635
     "node_modules/@babel/runtime/node_modules/regenerator-runtime": {
618 636
       "version": "0.14.1",
619 637
       "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
@@ -3117,6 +3135,16 @@
3117 3135
       "integrity": "sha512-IgdsbxNyMskrTFxa9lWHyMwAJU5gXOPP+1yO+K59d50VLVAIDAbs7gIv705KzALModfK3ZrSZTPNpC0PQgIZuw==",
3118 3136
       "hasInstallScript": true
3119 3137
     },
3138
+    "node_modules/core-js-pure": {
3139
+      "version": "3.37.1",
3140
+      "resolved": "https://registry.npmmirror.com/core-js-pure/-/core-js-pure-3.37.1.tgz",
3141
+      "integrity": "sha512-J/r5JTHSmzTxbiYYrzXg9w1VpqrYt+gexenBE9pugeyhwPZTAEJddyiReJWsLO6uNQ8xJZFbod6XC7KKwatCiA==",
3142
+      "hasInstallScript": true,
3143
+      "funding": {
3144
+        "type": "opencollective",
3145
+        "url": "https://opencollective.com/core-js"
3146
+      }
3147
+    },
3120 3148
     "node_modules/core-util-is": {
3121 3149
       "version": "1.0.3",
3122 3150
       "resolved": "https://registry.npmmirror.com/core-util-is/-/core-util-is-1.0.3.tgz",
@@ -10136,6 +10164,7 @@
10136 10164
     },
10137 10165
     "node_modules/npm/node_modules/lodash._baseindexof": {
10138 10166
       "version": "3.1.0",
10167
+      "extraneous": true,
10139 10168
       "inBundle": true,
10140 10169
       "license": "MIT"
10141 10170
     },
@@ -10150,16 +10179,19 @@
10150 10179
     },
10151 10180
     "node_modules/npm/node_modules/lodash._bindcallback": {
10152 10181
       "version": "3.0.1",
10182
+      "extraneous": true,
10153 10183
       "inBundle": true,
10154 10184
       "license": "MIT"
10155 10185
     },
10156 10186
     "node_modules/npm/node_modules/lodash._cacheindexof": {
10157 10187
       "version": "3.0.2",
10188
+      "extraneous": true,
10158 10189
       "inBundle": true,
10159 10190
       "license": "MIT"
10160 10191
     },
10161 10192
     "node_modules/npm/node_modules/lodash._createcache": {
10162 10193
       "version": "3.1.2",
10194
+      "extraneous": true,
10163 10195
       "inBundle": true,
10164 10196
       "license": "MIT",
10165 10197
       "dependencies": {
@@ -10173,6 +10205,7 @@
10173 10205
     },
10174 10206
     "node_modules/npm/node_modules/lodash._getnative": {
10175 10207
       "version": "3.9.1",
10208
+      "extraneous": true,
10176 10209
       "inBundle": true,
10177 10210
       "license": "MIT"
10178 10211
     },
@@ -10188,6 +10221,7 @@
10188 10221
     },
10189 10222
     "node_modules/npm/node_modules/lodash.restparam": {
10190 10223
       "version": "3.6.1",
10224
+      "extraneous": true,
10191 10225
       "inBundle": true,
10192 10226
       "license": "MIT"
10193 10227
     },
@@ -16279,6 +16313,21 @@
16279 16313
         "node": ">=0.10.0"
16280 16314
       }
16281 16315
     },
16316
+    "node_modules/wangeditor": {
16317
+      "version": "4.7.15",
16318
+      "resolved": "https://registry.npmmirror.com/wangeditor/-/wangeditor-4.7.15.tgz",
16319
+      "integrity": "sha512-aPTdREd8BxXVyJ5MI+LU83FQ7u1EPd341iXIorRNYSOvoimNoZ4nPg+yn3FGbB93/owEa6buLw8wdhYnMCJQLg==",
16320
+      "dependencies": {
16321
+        "@babel/runtime": "^7.11.2",
16322
+        "@babel/runtime-corejs3": "^7.11.2",
16323
+        "tslib": "^2.1.0"
16324
+      }
16325
+    },
16326
+    "node_modules/wangeditor/node_modules/tslib": {
16327
+      "version": "2.6.3",
16328
+      "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.6.3.tgz",
16329
+      "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ=="
16330
+    },
16282 16331
     "node_modules/watchpack": {
16283 16332
       "version": "1.7.5",
16284 16333
       "resolved": "https://registry.npmmirror.com/watchpack/-/watchpack-1.7.5.tgz",
@@ -17367,8 +17416,7 @@
17367 17416
     "node_modules/zone.js": {
17368 17417
       "version": "0.9.1",
17369 17418
       "resolved": "https://registry.npmmirror.com/zone.js/-/zone.js-0.9.1.tgz",
17370
-      "integrity": "sha512-GkPiJL8jifSrKReKaTZ5jkhrMEgXbXYC+IPo1iquBjayRa0q86w3Dipjn8b415jpitMExe9lV8iTsv8tk3DGag==",
17371
-      "dev": true
17419
+      "integrity": "sha512-GkPiJL8jifSrKReKaTZ5jkhrMEgXbXYC+IPo1iquBjayRa0q86w3Dipjn8b415jpitMExe9lV8iTsv8tk3DGag=="
17372 17420
     },
17373 17421
     "node_modules/zrender": {
17374 17422
       "version": "4.3.2",

+ 1 - 0
package.json

@@ -49,6 +49,7 @@
49 49
     "tslib": "^1.9.0",
50 50
     "uuid": "^10.0.0",
51 51
     "viewerjs": "^0.10.0",
52
+    "wangeditor": "^4.7.15",
52 53
     "zone.js": "^0.9.1"
53 54
   },
54 55
   "devDependencies": {

+ 5 - 0
src/app/app-routing.module.ts

@@ -93,6 +93,11 @@ const routes: Routes = [
93 93
     path: 'inspectionPlanConfig/:id',
94 94
     loadChildren: () => import('./views/inspection-plan-config/inspection-plan-config.module').then(m => m.InspectionPlanConfigModule),
95 95
   },
96
+	{
97
+	  // 故障管理-知识库-新增/编辑
98
+	  path: 'repositoryManageAdd/:id',
99
+	  loadChildren: () => import('./views/repository-manage-add/repository-manage-add.module').then(m => m.RepositoryManageAddModule),
100
+	},
96 101
   // 管理端首页
97 102
   {
98 103
     path: '**',

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

@@ -840,5 +840,4 @@ export class MainService {
840 840
 	    headers: this.headers,
841 841
 	  });
842 842
 	}
843
-	
844 843
 }

+ 12 - 0
src/app/services/tool.service.ts

@@ -176,6 +176,18 @@ export class ToolService {
176 176
         case "reset":
177 177
           coopBtns.reset = true; //重置
178 178
           break;
179
+				case "pause":
180
+				  coopBtns.pause = true; //停用
181
+				  break;
182
+				case "renew":
183
+				  coopBtns.renew = true; //恢复
184
+				  break;
185
+				case "audit":
186
+				  coopBtns.audit = true; //审核
187
+				  break;
188
+				case "upgrade":
189
+				  coopBtns.upgrade = true; //升级
190
+				  break;
179 191
       }
180 192
     });
181 193
     console.log(coopBtns);

+ 0 - 1
src/app/share/prompt-modal/prompt-modal.component.ts

@@ -16,7 +16,6 @@ export class PromptModalComponent implements OnInit {
16 16
   @Input() loading: Boolean = false;
17 17
 
18 18
   @Output() closeModel = new EventEmitter<any>(); //1.组件暴露一个 EventEmitter 属性,当事件发生时,子组件利用该属性 emits(向上弹射)事件
19
-
20 19
   constructor() {}
21 20
 
22 21
   ngOnInit() {

+ 3 - 1
src/app/share/share.module.ts

@@ -52,7 +52,7 @@ import { MedicalWasteHistoryPromptModalComponent } from './medical-waste-history
52 52
 import { MedicalWasteLogPromptModalComponent } from './medical-waste-log-prompt-modal/medical-waste-log-prompt-modal.component';
53 53
 import { OutgoingRecordDetailComponent } from './outgoing-record-detail/outgoing-record-detail.component';
54 54
 import { InspectionExecuteDetailComponent } from './inspection-execute-detail/inspection-execute-detail.component';
55
-
55
+import { wangEditorComponent } from './wang-editor/wang-editor.component';
56 56
 @NgModule({
57 57
   declarations: [
58 58
     DetailSampleComponent,
@@ -80,6 +80,7 @@ import { InspectionExecuteDetailComponent } from './inspection-execute-detail/in
80 80
     OrderDetailComponent,
81 81
     OutgoingRecordDetailComponent,
82 82
     InspectionExecuteDetailComponent,
83
+		wangEditorComponent,
83 84
     DateTransformPipe,
84 85
     DataToNamePipe,
85 86
     DialogDeleteComponent,
@@ -141,6 +142,7 @@ import { InspectionExecuteDetailComponent } from './inspection-execute-detail/in
141 142
     OrderDetailComponent,
142 143
     OutgoingRecordDetailComponent,
143 144
     InspectionExecuteDetailComponent,
145
+		wangEditorComponent,
144 146
     CommonModule,
145 147
     NgZorroAntdModule,
146 148
     FormsModule,

+ 4 - 0
src/app/share/wang-editor/wang-editor.component.html

@@ -0,0 +1,4 @@
1
+<div class="wangeditor-box">
2
+	<div id="editorMenu" class="editor-class"></div>
3
+	<div id="editor"></div>
4
+</div>

+ 18 - 0
src/app/share/wang-editor/wang-editor.component.less

@@ -0,0 +1,18 @@
1
+.wangeditor-box {
2
+  overflow: auto;
3
+  height: 100%;
4
+
5
+  #editor{
6
+    height: 300px;
7
+    width: auto;
8
+    border:1px solid #ccc;
9
+		border-top: none;
10
+  }
11
+	.editor-class{
12
+		/deep/ .w-e-toolbar{
13
+		  background-color: #f1f1f1 !important;
14
+		  border: 1px solid #ccc !important;
15
+		}
16
+	}
17
+
18
+}

+ 158 - 0
src/app/share/wang-editor/wang-editor.component.ts

@@ -0,0 +1,158 @@
1
+import { Component, ElementRef, Output, OnInit, EventEmitter } from '@angular/core';
2
+import WangEditor from 'wangeditor';
3
+@Component({
4
+  selector: 'app-wang-editor',
5
+  templateUrl: './wang-editor.component.html',
6
+  styleUrls: ['./wang-editor.component.less']
7
+})
8
+export class wangEditorComponent implements OnInit {
9
+	@Output() changeContent = new EventEmitter();
10
+	editor: any;
11
+	constructor(
12
+
13
+	) { }
14
+	
15
+  ngOnInit() {
16
+		this.editor = new WangEditor('#editorMenu', '#editor');
17
+		this.setEditorConfig()
18
+		this.editor.create();
19
+  }
20
+	
21
+	// 编辑器相关配置设置
22
+	setEditorConfig () {
23
+		// 使用 base64 保存图片
24
+		this.editor.config.uploadImgShowBase64 = true;
25
+		// 菜单展示项配置
26
+		// this.editor.config.menus = this.getMenuConfig();
27
+		// 自定义配置颜色(字体颜色、背景色)
28
+		this.editor.config.colors = this.getColorConfig();
29
+		// 表情面板可以有多个 tab ,因此要配置成一个数组。数组每个元素代表一个 tab 的配置
30
+		this.editor.config.emotions = this.getEmotionsConfig();
31
+		// 自定义字体
32
+		this.editor.config.fontNames = this.getFontFamilyConfig();
33
+		// 编辑区域的z-index默认为10000
34
+		// this.editor.config.zIndex = 100;
35
+		// 配置编辑器内容改变触发方法
36
+		this.editor.config.onchange = this.editorContentChange;
37
+		// 编辑器获取到焦点触发方法
38
+		this.editor.config.onfocus = this.editorOnFocus;
39
+		// 编辑器失去焦点触发方法
40
+		this.editor.config.onblur = this.editorOnBlur;
41
+	}
42
+	
43
+	  // 获取显示菜单项
44
+	  getMenuConfig (): string[] {
45
+	    return [
46
+	      'bold',  // 粗体
47
+	      'italic',  // 斜体
48
+	      'underline',  // 下划线
49
+	      'head',  // 标题
50
+	      'fontName',  // 字体
51
+	      'fontSize',  // 字号
52
+	      'strikeThrough',  // 删除线
53
+	      'foreColor',  // 文字颜色
54
+	      'backColor',  // 背景颜色
55
+	      'link',  // 插入链接
56
+	      'list',  // 列表
57
+	      'justify',  // 对齐方式
58
+	      'quote',  // 引用
59
+	      'emoticon',  // 表情
60
+	      'table',  // 表格
61
+	      'image',  // 插入图片
62
+	      'video',  // 插入视频
63
+	      'code',  // 插入代码
64
+	      'undo',  // 撤销
65
+	      'redo'  // 重复
66
+	    ];
67
+	  }
68
+	
69
+	  // 获取字体、背景颜色列表配置
70
+	  getColorConfig(): string[] {
71
+	    return [
72
+	      '#000000',
73
+	      '#eeece0',
74
+	      '#1c487f',
75
+	      '#4d80bf',
76
+	      '#c24f4a',
77
+	      '#8baa4a',
78
+	      '#7b5ba1',
79
+	      '#46acc8',
80
+	      '#f9963b',
81
+	      '#ffffff'
82
+	    ];
83
+	  }
84
+	
85
+	  // 获取表情配置
86
+	  getEmotionsConfig() {
87
+	    return [
88
+	      {
89
+	        // tab 的标题
90
+	        title: '默认',
91
+	        // type -> 'emoji' / 'image'
92
+	        type: 'image',
93
+	        // content -> 数组
94
+	        content: [
95
+	          {
96
+	            alt: '[坏笑]',
97
+	            src: 'http://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/50/pcmoren_huaixiao_org.png'
98
+	          },
99
+	          {
100
+	            alt: '[舔屏]',
101
+	            src: 'http://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/40/pcmoren_tian_org.png'
102
+	          }
103
+	        ]
104
+	      },
105
+	      {
106
+	        // tab 的标题
107
+	        title: 'emoji',
108
+	        // type -> 'emoji' / 'image'
109
+	        type: 'emoji',
110
+	        // content -> 数组
111
+	        content: ['?', '?', '?', '?', '?']
112
+	      }
113
+	    ];
114
+	  }
115
+	
116
+	  // 获取字体列表配置
117
+	  getFontFamilyConfig(): string[] {
118
+	    return [
119
+	      '宋体',
120
+	      '微软雅黑',
121
+	      'Arial',
122
+	      'Tahoma',
123
+	      'Verdana'
124
+	    ];
125
+	  }
126
+	
127
+	  // 富文本编辑器内容变化触发方法
128
+	  editorContentChange = (html) => {
129
+	    console.log(html);
130
+	  }
131
+	
132
+	  // 编辑器获取到焦点触发事件
133
+	  editorOnFocus = () => {
134
+	    console.log('on focus');
135
+	  }
136
+	
137
+	  // 编辑器失去焦点触发事件
138
+	  editorOnBlur = (html) => {
139
+	    // console.log(html);
140
+			this.changeContent.emit(html)
141
+	  }
142
+	
143
+	  // 设置编辑器显示内容
144
+	//   setContent() {
145
+	//     this.editor.txt.html(this.textareaValue);
146
+	//   }
147
+	
148
+	//   // 获取编辑器内容,带html
149
+	//   getContent() {
150
+	//     this.showMessage = this.editor.txt.html();
151
+	//   }
152
+	
153
+	//   // 获取编辑器文字内容
154
+	//   getContentText() {
155
+	//     this.showMessage = this.editor.txt.text();
156
+	//   }
157
+}
158
+

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

@@ -563,6 +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
+			// 故障管理-知识库管理
567
+			{
568
+			  path: "repositoryManage",
569
+			  loadChildren: () => import("../repository-manage/repository-manage.module").then((m) => m.RepositoryManageModule),
570
+			},
566 571
     ],
567 572
   },
568 573
 ];

+ 17 - 0
src/app/views/repository-manage-add/repository-manage-add-routing.module.ts

@@ -0,0 +1,17 @@
1
+import { NgModule } from '@angular/core';
2
+import { Routes, RouterModule } from '@angular/router';
3
+import { RepositoryManageAddComponent } from './repository-manage-add.component';
4
+
5
+
6
+const routes: Routes = [
7
+  {
8
+    path: '',
9
+    component: RepositoryManageAddComponent
10
+  }
11
+];
12
+
13
+@NgModule({
14
+  imports: [RouterModule.forChild(routes)],
15
+  exports: [RouterModule]
16
+})
17
+export class RepositoryManageAddRoutingModule { }

+ 140 - 0
src/app/views/repository-manage-add/repository-manage-add.component.html

@@ -0,0 +1,140 @@
1
+<div class="detail-box">
2
+  <div class="modalBody">
3
+    <!-- <overlay-scrollbars #osComponentRef1 class="content"> -->
4
+     <form nz-form [formGroup]="validateForm" class="addForm">
5
+<!--     	<nz-form-item class="form-item">
6
+     	  <nz-form-label nzRequired nzFor="code">编号</nz-form-label>
7
+     	  <nz-form-control nzErrorTip="请输入编号!">
8
+     			<input nz-input formControlName="code"  placeholder="请输入编号" nzSize="default" />
9
+     	  </nz-form-control>
10
+     	</nz-form-item>
11
+			<nz-form-item class="form-item">
12
+			  <nz-form-label nzRequired nzFor="version">版本号</nz-form-label>
13
+			  <nz-form-control nzErrorTip="请输入版本号!">
14
+					<input nz-input formControlName="version"  placeholder="请输入版本号" nzSize="default" />
15
+			  </nz-form-control>
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
+			<div class="left-form-box">
22
+				<nz-form-item class="form-item">
23
+				  <nz-form-label nzRequired nzFor="title" [nzSm]="4" [nzXs]="24">标题</nz-form-label>
24
+				  <nz-form-control nzErrorTip="请输入标题!" [nzSm]="20" [nzXs]="24">
25
+						<input nz-input formControlName="title"  placeholder="请输入标题" nzSize="default" />
26
+				  </nz-form-control>
27
+				</nz-form-item>
28
+				<nz-form-item class="form-item">
29
+				  <nz-form-label nzFor="content" [nzSm]="4" [nzXs]="24">内容</nz-form-label>
30
+					<app-wang-editor (changeContent)="changeContent($event)"></app-wang-editor>
31
+				</nz-form-item>
32
+			</div>
33
+			
34
+			<div class="right-form-box">
35
+				<nz-form-item class="form-item">
36
+				  <nz-form-label nzRequired nzFor="repairVisible" [nzSm]="6" [nzXs]="24">报修可见</nz-form-label>
37
+					<nz-form-control nzErrorTip="请选择!" [nzSm]="16" [nzXs]="24">
38
+						<nz-radio-group formControlName="repairVisible">
39
+						  <label nz-radio nzValue="1">是</label>
40
+						  <label nz-radio nzValue="0">否</label>
41
+						</nz-radio-group>
42
+					</nz-form-control>
43
+				</nz-form-item>
44
+				
45
+				<nz-form-item class="form-item">
46
+				  <nz-form-label nzRequired nzFor="knowledgeClass" [nzSm]="6" [nzXs]="24">知识分类</nz-form-label>
47
+					<nz-form-control nzErrorTip="请选择!" [nzSm]="16" [nzXs]="24">
48
+						<nz-radio-group formControlName="knowledgeClass" (ngModelChange)="radioChnage($event)">
49
+						  <label nz-radio [nzValue]="item.id" *ngFor="let item of dicData">{{item.name}}</label>
50
+						</nz-radio-group>
51
+					</nz-form-control>
52
+				</nz-form-item>
53
+				
54
+				<nz-form-item class="form-item" *ngIf="classItem==2">
55
+				  <nz-form-label nzRequired nzFor="polling" [nzSm]="6" [nzXs]="24">关联巡检表</nz-form-label>
56
+				  <nz-form-control nzErrorTip="请选择关联巡检表!" [nzSm]="16" [nzXs]="24">
57
+				    <nz-input-group>
58
+							<nz-select nzSearch nzShowSearch nzPlaceHolder="请选择关联巡检表" formControlName="polling">
59
+							  <ng-container *ngFor="let option of pollingData">
60
+							    <nz-option *ngIf="!isDeptLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
61
+							  </ng-container>
62
+							  <nz-option *ngIf="isDeptLoading" nzDisabled nzCustomContent>
63
+							    <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
64
+							  </nz-option>
65
+							</nz-select>
66
+						</nz-input-group>
67
+				  </nz-form-control>
68
+				</nz-form-item>
69
+				
70
+				<nz-form-item class="form-item" *ngIf="classItem==1">
71
+				  <nz-form-label nzRequired nzFor="malfunction" [nzSm]="6" [nzXs]="24">关联故障现象</nz-form-label>
72
+				  <nz-form-control nzErrorTip="请选择关联故障现象!" [nzSm]="16" [nzXs]="24">
73
+				    <nz-input-group>
74
+							<nz-tree-select
75
+							  [nzNodes]="malfunctionData"
76
+								nzShowSearch 
77
+								nzPlaceHolder="请选择关联故障现象" 
78
+								formControlName="malfunction">
79
+							</nz-tree-select>
80
+						</nz-input-group>
81
+				  </nz-form-control>
82
+				</nz-form-item>
83
+				
84
+				<nz-form-item class="form-item">
85
+				  <nz-form-label nzFor="assetProductId" [nzSm]="6" [nzXs]="24">关联产品</nz-form-label>
86
+				  <nz-form-control nzErrorTip="请选择关联产品!" [nzSm]="16" [nzXs]="24">
87
+				    <nz-input-group>
88
+							<nz-select (nzOnSearch)="changeInp($event)" nzServerSearch nzShowSearch nzPlaceHolder="请选择关联产品" formControlName="assetProductId">
89
+							  <ng-container *ngFor="let option of productData">
90
+							    <nz-option *ngIf="!isDeptLoading" [nzLabel]="option.name" [nzValue]="option.id"></nz-option>
91
+							  </ng-container>
92
+							  <nz-option *ngIf="isDeptLoading" nzDisabled nzCustomContent>
93
+							    <i nz-icon nzType="loading" class="loading-icon"></i> 搜索中...
94
+							  </nz-option>
95
+							</nz-select>
96
+						</nz-input-group>
97
+				  </nz-form-control>
98
+				</nz-form-item>
99
+				
100
+				<nz-form-item class="form-item">
101
+				  <nz-form-label nzFor="file" [nzSm]="6" [nzXs]="24">文件上传</nz-form-label>
102
+				  <nz-form-control [nzSm]="16" [nzXs]="24">
103
+						<nz-upload nzFor="file"
104
+						  class="avatar-uploader"
105
+						  nzAction="https://jsonplaceholder.typicode.com/posts/"
106
+							[nzCustomRequest]="customReq"
107
+						  nzName="file"
108
+							[(nzFileList)]="fileData"
109
+						  [nzBeforeUpload]="beforeUpload"
110
+						  (nzChange)="handleChange($event)"
111
+						>
112
+						  <button nz-button><i nz-icon nzType="upload"></i><span>点击上传</span></button>
113
+							<div class="upload-sign">支持扩展名:PDF、word、ppt、excel、txt...</div>
114
+						</nz-upload>
115
+					</nz-form-control>
116
+				</nz-form-item>
117
+			</div>
118
+			
119
+     </form>
120
+    <!-- </overlay-scrollbars> -->
121
+ 
122
+  </div>
123
+	<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>
126
+		<button class="btn cancel" nz-button nzType="default" (click)="back()">取消</button>
127
+	</div>
128
+</div>
129
+<!-- 操作成功/失败提示框 -->
130
+<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
131
+  [info]="promptInfo" (closeModel)="closeModel()"></app-prompt-modal>
132
+	
133
+<!-- 删除模态框 -->
134
+  <app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
135
+    (confirmDelEvent)="confirmDel()" content="您确认要删除发药科室吗?"></app-dialog-delete>
136
+
137
+<!-- 单发/箱发 -->
138
+  <app-dialog-delete [delModal]="delGrantModal" (hideDelModalEvent)="hideGrantModal()" [btnLoading]="btnLoading"
139
+    (confirmDelEvent)="confirmGrantDel()" [content]="content"></app-dialog-delete>
140
+

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

@@ -0,0 +1,117 @@
1
+@import "../../../../src/theme.less";
2
+:host {
3
+	width: 100%;
4
+	height: 100%;
5
+  .add-button {
6
+    margin: 0 auto 16px !important;
7
+  }
8
+  .targetDept {
9
+    overflow: hidden;
10
+    // width: 90px;
11
+    text-overflow: ellipsis;
12
+    white-space: nowrap;
13
+  }
14
+  .dynamic {
15
+    margin-bottom: 16px;
16
+    display: flex;
17
+    align-items: center;
18
+    input {
19
+      width: 90%;
20
+    }
21
+    i {
22
+      margin-left: 8px;
23
+      cursor: pointer;
24
+      font-size: 18px;
25
+    }
26
+  }
27
+}
28
+
29
+h3{
30
+	margin: 0 !important;
31
+}
32
+/* 修改垂直滚动条 */
33
+::-webkit-scrollbar {
34
+  width: 4px; /* 修改宽度 */
35
+}
36
+ 
37
+/* 修改滚动条轨道背景色 */
38
+::-webkit-scrollbar-track {
39
+  background-color: #f1f1f1;
40
+}
41
+ 
42
+/* 修改滚动条滑块颜色 */
43
+::-webkit-scrollbar-thumb {
44
+  background-color: #888;
45
+}
46
+ 
47
+/* 修改滚动条滑块悬停时的颜色 */
48
+::-webkit-scrollbar-thumb:hover {
49
+  background-color: #555;
50
+}
51
+
52
+[nz-form]{
53
+	// width: 600px;
54
+}
55
+.detail-box{
56
+	display: flex;
57
+	justify-content: center;
58
+	padding: 20px;
59
+	position: relative;
60
+	.modalBody{
61
+		height: 100%;
62
+		position: relative;
63
+	}
64
+	.list-template__content{
65
+		flex:3;
66
+		padding: 0 10px 10px 10px;
67
+		border-radius: 5px;
68
+		border: 1px solid #e5e5e5;
69
+		.list-template__bottom{
70
+			height: calc(100vh - 70px);
71
+			overflow-y: auto;
72
+		}
73
+	}
74
+	
75
+	.addForm {
76
+		display: flex;
77
+		.left-form-box{
78
+			flex: 1.5;
79
+			margin-right: 30px;
80
+		}
81
+		.right-form-box{
82
+			flex: 1;
83
+		}
84
+		.form-title-box{
85
+			display: flex;
86
+			.form-title{
87
+				color: #000;
88
+				margin-right: 40px;
89
+			}
90
+		}
91
+	  .ant-form-item {
92
+	    margin-bottom: 14px;
93
+	    .ant-form-item-label {
94
+	      text-align: right;
95
+	    }
96
+			.ant-form-item-control-wrapper{
97
+				.ant-form-item-control{
98
+					width: 400px;
99
+				}
100
+			}
101
+	
102
+	  }
103
+		.ant-select{
104
+			width: 100%;
105
+		}
106
+	}
107
+	
108
+	.form-btn{
109
+		position: fixed;
110
+		bottom: 20px;
111
+		button {
112
+		  &.btn {
113
+		    margin-left: 10px;
114
+		  }
115
+		}
116
+	}
117
+}

+ 564 - 0
src/app/views/repository-manage-add/repository-manage-add.component.ts

@@ -0,0 +1,564 @@
1
+import { Component, OnInit, ViewChild } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import {
4
+  FormBuilder,
5
+  Validators,
6
+  FormGroup,
7
+  FormControl,
8
+} from "@angular/forms";
9
+
10
+import { MainService } from "../../services/main.service";
11
+import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
12
+import { ToolService } from "../../services/tool.service";
13
+import { NzMessageService, UploadFile, UploadXHRArgs } from "ng-zorro-antd";
14
+import { Observable, Observer, Subject } from "rxjs";
15
+import { debounceTime, filter } from "rxjs/operators";
16
+import { HttpEventType, HttpEvent, HttpRequest, HttpResponse, HttpClient } from '@angular/common/http';
17
+@Component({
18
+  selector: "app-repository-manage-add",
19
+  templateUrl: "./repository-manage-add.component.html",
20
+  styleUrls: ["./repository-manage-add.component.less"],
21
+})
22
+export class RepositoryManageAddComponent implements OnInit {
23
+  @ViewChild("osComponentRef1", {
24
+    read: OverlayScrollbarsComponent,
25
+    static: false,
26
+  })
27
+  osComponentRef1: OverlayScrollbarsComponent;
28
+  constructor(
29
+    private message: NzMessageService,
30
+    private fb: FormBuilder,
31
+    private route: ActivatedRoute,
32
+    private router: Router,
33
+    private mainService: MainService,
34
+    private tool: ToolService,
35
+    private http: HttpClient,
36
+  ) {}
37
+
38
+  ngOnInit() {
39
+    this.searchParentDeptSubject.pipe(debounceTime(500)).subscribe((e) => {
40
+			this.isDeptLoading = true;
41
+			this.getProduct(e[0]);
42
+    });
43
+		this.detailId = this.route.snapshot.params.id;
44
+		if(this.detailId==0){
45
+			this.add = true
46
+		}else{
47
+			this.add = false
48
+		}
49
+		this.hosId = this.tool.getCurrentHospital().id;
50
+    this.coopBtns = this.tool.initCoopBtns(this.route);
51
+		this.initForm();
52
+    this.getAllHospital();
53
+  }
54
+	classItem:null;
55
+	detailId:null; //列表数据
56
+	deptId:null; //选中的科室id
57
+  listOfData: any[] = []; //表格数据
58
+  promptContent: string; //操作提示框提示信息
59
+  ifSuccess: boolean; //操作成功/失败
60
+  promptInfo: string; //操作结果提示信息
61
+  promptModalShow: boolean; //操作提示框是否展示
62
+  modal: boolean = false; //新增/编辑模态框
63
+  add: boolean; //true:新增;false:编辑
64
+  validateForm: FormGroup; //新增/编辑表单
65
+  coopId: number; //表格中执行操作的id
66
+  department: number; //所属科室
67
+	drug: number; //药品名称
68
+	hosId: number; 
69
+	rowId:number; //清单id
70
+	dateRange;//时间
71
+  batchNumber; //批次号
72
+  num; //编码
73
+  deptalias; //别名
74
+  type; //类型
75
+  deptHandoverType; //类型
76
+  pageIndex: number = 1; //页码
77
+  listLength: number = 10; //总条数
78
+  pageSize: number = 10; //每页条数
79
+  btnLoading1: boolean = false; //确认按钮loading状态
80
+	btnLoading2: boolean = false; //确认按钮loading状态
81
+  printLoading: boolean = false; //批量打印按钮loading状态
82
+  deptPhones: any = []; //新添加的科室电话列表
83
+  isAddDeptsPhone = true; //添加新的科室电话是否禁用
84
+  deptsPhoneId = 1; //科室电话自增id
85
+  allParentdepart: any = []; //所有的父级科室列表
86
+  hospitals1: any = []; //科室列表
87
+	buildingList: any = []; //楼栋列表
88
+	deptList: any = []; //楼栋科室
89
+	malfunctionData: any = []; //故障现象数据
90
+	productData: any = []; //产品数据
91
+	typeDic:any = []; //知识库状态字典
92
+	fileData:any[] = []; //附件数据
93
+	building:''; //楼栋
94
+	deptIndex:number; //选中index
95
+  searchParentDeptSubject = new Subject();
96
+  // 初始化增删改按钮
97
+  coopBtns: any = {};
98
+	deptName:null;
99
+  //搜索父级科室
100
+	isDeptLoading = false;
101
+	isSpinning = false;
102
+	delGrantModal = false;
103
+	showInsp = false;
104
+  changeInp(e, type) {
105
+    this.searchParentDeptSubject.next([e, type]);
106
+  }
107
+
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){
132
+		var that = this;
133
+		let data = {
134
+			idx: 0,
135
+			sum: 9999,
136
+			drugsConfigure: {
137
+			  hosId: this.hosId,
138
+				deptId :e,
139
+				batchId:''
140
+			}
141
+		};
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)
148
+		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')
155
+				}
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
200
+				}
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) => {
214
+				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()
223
+				}
224
+		  });
225
+	}
226
+	
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
+		}
241
+	}
242
+	
243
+	// 获取产品
244
+	getProduct(name){
245
+		let postData = {
246
+		  assetProduct: {
247
+		    hosId: this.hosId,
248
+				name:name
249
+		  },
250
+		  idx: 0,
251
+		  sum: 20,
252
+		};
253
+		this.mainService
254
+		  .getFetchDataList("data", "assetProduct", postData)
255
+		  .subscribe((result) => {
256
+				this.isDeptLoading = false
257
+				this.productData = result.list;
258
+		  });
259
+	}
260
+	
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
+  // 获取所有院区
274
+  getAllHospital() {
275
+		this.getPolling()
276
+		this.getProduct('')
277
+		this.getMalfunction()
278
+		this.getDicData()
279
+  }
280
+	
281
+	// 获取故障现象数据
282
+	getMalfunction(){
283
+		let postData = {
284
+		  building: {
285
+		    cascadeHosId: this.hosId,
286
+		  },
287
+		  idx: 0,
288
+		  sum: 20,
289
+		};
290
+		this.mainService
291
+		  .getFetchDataList("data", "building", postData)
292
+		  .subscribe((result) => {
293
+				this.malfunctionData = result.data
294
+		  });
295
+	}
296
+	
297
+	// 获取巡检列表
298
+	pollingData = [];
299
+	getPolling(){
300
+		let data = {
301
+		  idx: 0,
302
+		  sum: 9999,
303
+		  inspection: {
304
+		    hosId: this.hosId
305
+		  },
306
+		};
307
+		this.mainService
308
+		  .getFetchDataList("simple/data", "inspectionForm", data)
309
+		  .subscribe((data) => {
310
+		    if (data.status == 200) {
311
+		      this.pollingData = data.list.filter(i=>i.status.name=='已发布');
312
+		    }
313
+		  });
314
+	}
315
+	
316
+	// 获取知识分类字典
317
+	dicData = [];
318
+	getDicData(){
319
+		this.mainService.getDictionary("list", "solution_type").subscribe((res) => {
320
+			this.dicData = res
321
+		});
322
+		this.mainService.getDictionary("list", "solution_status").subscribe((res) => {
323
+			this.typeDic = res
324
+		});
325
+	}
326
+	
327
+	// 选择知识库分类
328
+	radioChnage(e){
329
+		let item = this.dicData.find(i=>i.id == this.validateForm.value.knowledgeClass)
330
+		this.classItem = item.value
331
+	}
332
+	
333
+	
334
+	
335
+	hideGrantModal(){
336
+		this.delGrantModal = false;
337
+	}
338
+	
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
+	
354
+	// 富文本内容
355
+	editOrData=null;
356
+	changeContent(data){
357
+		this.editOrData = data
358
+	}
359
+	
360
+	// 表单提交
361
+	submitForm(type): void {
362
+	  var that = this;
363
+		for (const i in that.validateForm.controls) {
364
+		  that.validateForm.controls[i].markAsDirty();
365
+		  that.validateForm.controls[i].updateValueAndValidity();
366
+		}
367
+		if (that.validateForm.invalid) return;
368
+	  let data = {
369
+			...this.validateForm.value,
370
+			content:this.editOrData,
371
+			id:'',
372
+			hosId:this.hosId,
373
+			inspectionForm:{
374
+				id:this.validateForm.value.polling
375
+			},
376
+			type:{
377
+				id:this.validateForm.value.knowledgeClass
378
+			},
379
+			buttonType:type==1?'confirm':'ts'
380
+	  };
381
+		if(this.add){
382
+			delete data.id
383
+		}else{
384
+			data.id = this.detailId
385
+		}
386
+		if(type==1){
387
+			that.btnLoading1 = true;
388
+		}else{
389
+			that.btnLoading2 = true;
390
+		}
391
+		
392
+	  that.mainService
393
+	    .simplePost("addData", "solution", data)
394
+	    .subscribe((res) => {
395
+				if(type==1){
396
+					that.btnLoading1 = false;
397
+				}else{
398
+					that.btnLoading2 = false;
399
+				}
400
+				if(this.fileData.length>0){
401
+					this.uploadFile(res.data.id)
402
+					if (res.status == 200) {
403
+					  that.showPromptModal(that.add ? "增加" : "减少", true, "");
404
+					} else {
405
+					  that.showPromptModal(that.add ? "增加" : "减少", false, res.msg);
406
+					}
407
+					that.hideModal();
408
+				}else{
409
+					if (res.status == 200) {
410
+					  that.showPromptModal(that.add ? "增加" : "减少", true, "");
411
+					} else {
412
+					  that.showPromptModal(that.add ? "增加" : "减少", false, res.msg);
413
+					}
414
+					that.hideModal();
415
+				}
416
+	    });
417
+	}
418
+	
419
+	// 上传图片
420
+	uploadFile(id){
421
+		console.log(555,this.fileData)
422
+		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
+			});
436
+		}
437
+	}
438
+	
439
+  // 新增弹框
440
+  showModal() {
441
+    this.add = true;
442
+    this.isAddDeptsPhone = true;
443
+    this.deptPhones = [];
444
+  }
445
+	// 返回
446
+	back(){
447
+		this.router.navigateByUrl(`/main/repositoryManage`);
448
+	}
449
+	
450
+  hideModal() {
451
+		this.initForm();
452
+    this.modal = false;
453
+  }
454
+  // 初始化新增form表单
455
+  initForm() {
456
+		this.validateForm = this.fb.group({
457
+		  title: [null, [Validators.required]],
458
+			code: [null, []],
459
+			version: [null, []],
460
+			content: [null, []],
461
+			assetProductId: [null,[]],
462
+			repairVisible: [null, [Validators.required]],
463
+			knowledgeClass: [null, [Validators.required]],
464
+			polling: [null, [Validators.required]],
465
+			
466
+		});
467
+  }
468
+	
469
+	avatarLoading = false;
470
+	avatarUrl: string;
471
+	avatarUrl1: string;
472
+	beforeUpload = (file: File) => {
473
+	  return new Observable((observer: Observer<boolean>) => {
474
+			let type = file.name.split('.')
475
+			console.log(888,type[1])
476
+	    const isPic = (type[1] === 'xlsx' || type[1] === 'pdf' || 
477
+			type[1] === 'xls' || type[1] === 'ppt' || type[1] === 'txt');
478
+	    if (!isPic) {
479
+	      this.message.error('只能上传PDF、word、ppt、excel、txt等文件类型格式!');
480
+	      observer.complete();
481
+	      return;
482
+	    }
483
+	    const isLt4M = file.size / 1024 / 1024 < 10;
484
+	    if (!isLt4M) {
485
+	      this.message.error('图片大小不能大于10MB!');
486
+	      observer.complete();
487
+	      return;
488
+	    }
489
+	    observer.next(isPic && isLt4M);
490
+	    observer.complete();
491
+	  });
492
+	};
493
+	
494
+	// 附件上传
495
+	handleChange(info: { file: UploadFile }): void {
496
+		// console.log(999,this.fileData)
497
+	}
498
+	
499
+	private getBase64(img: File, callback: (img: string) => void): void {
500
+	  const reader = new FileReader();
501
+	  reader.addEventListener('load', () => callback(reader.result!.toString()));
502
+	  reader.readAsDataURL(img);
503
+	}
504
+	
505
+	// 删除附件
506
+	removeFile = (file: File) =>  {
507
+		
508
+		// let index = this.fileData.findIndex(i=>i.uid==e.uid)
509
+		// this.fileData.splice(index, 1)
510
+	}
511
+	
512
+	// 自定义上传
513
+	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
+	  const formData = new FormData();
518
+	  // tslint:disable-next-line:no-any
519
+	  formData.append('file', item.file as any);
520
+	  formData.append('filename', item.file.name);
521
+	  const req = new HttpRequest('POST', item.action!, formData, {
522
+	    reportProgress: true,
523
+	    withCredentials: true
524
+	  });
525
+	  // Always returns a `Subscription` object. nz-upload would automatically unsubscribe it at correct time.
526
+	  return this.http.request(req).subscribe(
527
+	    // tslint:disable-next-line no-any
528
+	    (event: HttpEvent<any>) => {
529
+	      if (event.type === HttpEventType.UploadProgress) {
530
+	        if (event.total! > 0) {
531
+	          // tslint:disable-next-line:no-any
532
+	          (event as any).percent = (event.loaded / event.total!) * 100;
533
+	        }
534
+	        item.onProgress!(event, item.file!);
535
+	      } else if (event instanceof HttpResponse) {
536
+	        item.onSuccess!(event.body, item.file!, event);
537
+	      }
538
+	    },
539
+	    err => {
540
+	      item.onError!(err, item.file!);
541
+	    }
542
+	  );
543
+	};
544
+	
545
+	closeModel(){
546
+		this.back()
547
+	}
548
+	
549
+  // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
550
+  showPromptModal(con, success, promptInfo?) {
551
+    this.promptModalShow = false;
552
+    this.promptContent = con;
553
+    this.ifSuccess = success;
554
+    this.promptInfo = promptInfo;
555
+    setTimeout(() => {
556
+      this.promptModalShow = true;
557
+    }, 100);
558
+  }
559
+
560
+  delModal: boolean = false; //删除模态框
561
+  coopIds: any;
562
+  coopFlag: any = false;
563
+
564
+}

+ 19 - 0
src/app/views/repository-manage-add/repository-manage-add.module.ts

@@ -0,0 +1,19 @@
1
+import { NgModule } from '@angular/core';
2
+import { CommonModule } from '@angular/common';
3
+
4
+import { RepositoryManageAddRoutingModule } from './repository-manage-add-routing.module';
5
+import { RepositoryManageAddComponent } from './repository-manage-add.component';
6
+import { ShareModule } from 'src/app/share/share.module';
7
+
8
+
9
+@NgModule({
10
+  declarations: [
11
+    RepositoryManageAddComponent,
12
+  ],
13
+  imports: [
14
+    CommonModule,
15
+    RepositoryManageAddRoutingModule,
16
+    ShareModule
17
+  ]
18
+})
19
+export class RepositoryManageAddModule { }

+ 16 - 0
src/app/views/repository-manage/repository-manage-routing.module.ts

@@ -0,0 +1,16 @@
1
+import { NgModule } from '@angular/core';
2
+import { Routes, RouterModule } from '@angular/router';
3
+import { RepositoryManageComponent } from './repository-manage.component';
4
+
5
+const routes: Routes = [
6
+  {
7
+    path: '',
8
+    component: RepositoryManageComponent,
9
+  }
10
+];
11
+
12
+@NgModule({
13
+  imports: [RouterModule.forChild(routes)],
14
+  exports: [RouterModule]
15
+})
16
+export class RepositoryManageRoutingModule { }

+ 138 - 0
src/app/views/repository-manage/repository-manage.component.html

@@ -0,0 +1,138 @@
1
+<div class="list-template">
2
+  <div class="list-template__content">
3
+    <div class="list-template__top" nz-row>
4
+      <div nz-col nzLg='18' class="list-template__searchBox">
5
+        <div class="list-template__searchItem">
6
+          <span class="label">标题:</span>
7
+          <input nz-input class="formItem" [(ngModel)]="title" placeholder="请输入标题" nzSize="default" />
8
+        </div>
9
+        <div class="list-template__searchItem">
10
+          <span class="label">编号:</span>
11
+          <input nz-input class="formItem" [(ngModel)]="solutionNumber" placeholder="请输入编号" nzSize="default" />
12
+        </div>
13
+      </div>
14
+      <div nz-col nzLg="6" class="list-template__btns">
15
+        <button class="btn default" (click)='search()'>搜索</button>
16
+        <button class="btn default ml8" (click)='reset()'>重置</button>
17
+				<button *ngIf="coopBtns.add" class="btn default ml8" (click)='addForm()'>新增</button>
18
+      </div>
19
+    </div>
20
+    <div class="list-template__bottom">
21
+      <nz-table class="list-template__nzTable" [nzData]="listOfData" nzSize="middle" [nzShowPagination]="false"
22
+        [nzLoading]="loading1">
23
+        <thead>
24
+          <tr class="thead">
25
+            <th nzWidth="5%">序号</th>
26
+						<th nzWidth="10%">知识库编号</th>
27
+            <th nzWidth="25%">标题</th>
28
+            <th nzWidth="15%">版本号 | 分类</th>
29
+            <th nzWidth="15%">创建人 | 日期</th>
30
+						<th nzWidth="10%">状态</th>
31
+            <th nzWidth="20%">操作</th>
32
+          </tr>
33
+        </thead>
34
+        <tbody>
35
+          <tr *ngFor="let data of listOfData let index=index;" (click)="selectedListData(data.id)">
36
+            <td>{{index+(pageIndex-1) * pageSize + 1}}</td>
37
+						<td>{{ data.solutionNumber }}</td>
38
+						<td>{{ data.title }}</td>
39
+						<td>
40
+							<div>V{{ data.versionNumber }}</div>
41
+							<div>{{ data.type ? data.type.name : '-' }}</div>
42
+						</td>	
43
+						<td>
44
+							<div>{{ data.createUser.name }}</div>
45
+							<div>{{ data.createTime|date:'yyyy-MM-dd HH:mm' }}</div>
46
+						</td>	
47
+						<td>{{ data.status ? data.status.name : '-' }}</td>
48
+            <td>
49
+              <div class="coop">
50
+								<span *ngIf="coopBtns.edit && (data.status.name=='暂存' || data.status.name=='待修改')" (click)="edit($event,data)">编辑</span>
51
+								<span *ngIf="coopBtns.look" (click)="look($event,data)">查看</span>
52
+								<span *ngIf="coopBtns.upgrade && data.status.name=='已发布'" (click)="upgrade($event,data)">升级</span>
53
+								<span *ngIf="coopBtns.audit && data.status.name=='待审核'" (click)="audit($event,data)">审核</span>
54
+								<span *ngIf="coopBtns.pause && data.status.name=='已发布'" (click)="pause($event,data)">停用</span>
55
+								<span *ngIf="coopBtns.renew && data.status.name=='已停用'" (click)="renew($event,data)">恢复</span>
56
+								<span *ngIf="coopBtns.del" (click)="showDelModal($event,data.id)">删除</span>
57
+              </div>
58
+            </td>
59
+          </tr>
60
+        </tbody>
61
+      </nz-table>
62
+      <div class="list-template__pagination">
63
+        <nz-pagination [(nzPageIndex)]="pageIndex" [(nzTotal)]="listLength" nzShowSizeChanger [(nzPageSize)]="pageSize"
64
+          (nzPageIndexChange)="getList()" (nzPageSizeChange)="getList()">
65
+        </nz-pagination>
66
+      </div>
67
+    </div>
68
+  </div>
69
+
70
+  <!-- 新增/编辑模态框 -->
71
+  <div class="save add display_flex align-items_center justify-content_flex-center" *ngIf="modal">
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>
112
+      <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>
116
+    </div>
117
+  </div>
118
+  <!-- 删除模态框 -->
119
+  <app-dialog-delete [delModal]="delModal" (hideDelModalEvent)="hideDelModal()" [btnLoading]="btnLoading"
120
+    (confirmDelEvent)="confirmDel()" content="您确认要删除此知识库吗?"></app-dialog-delete>
121
+	
122
+	<!-- 停用模态框 -->
123
+	<app-dialog-delete [delModal]="pauseModal" (hideDelModalEvent)="hideDelModal2()" [btnLoading]="btnLoading"
124
+	  (confirmDelEvent)="confirmDel2()" content="您确认要停用此知识库吗?"></app-dialog-delete>
125
+		
126
+	<!-- 恢复模态框 -->
127
+	<app-dialog-delete [delModal]="renewModal" (hideDelModalEvent)="hideDelModal3()" [btnLoading]="btnLoading"
128
+		(confirmDelEvent)="confirmDel3()" content="您确认要恢复此知识库吗?"></app-dialog-delete>
129
+			
130
+  <!-- 编辑模态框 -->
131
+  <app-dialog-delete [delModal]="editModal" (hideDelModalEvent)="hideDelModal1()" [btnLoading]="saveLoading"
132
+    (confirmDelEvent)="confirmDel1()" [content]="'保存后会重置您的发药科室的药品信息,您确认吗?'"></app-dialog-delete>
133
+
134
+</div>
135
+<!-- 操作成功/失败提示框 -->
136
+<app-prompt-modal *ngIf="promptModalShow" [content]="promptContent" [success]="ifSuccess" [show]="promptModalShow"
137
+  [info]="promptInfo"></app-prompt-modal>
138
+

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

@@ -0,0 +1,260 @@
1
+@import "../../../../src/theme.less";
2
+:host {
3
+  .add-button {
4
+    margin: 0 auto 16px !important;
5
+  }
6
+  .targetDept {
7
+    overflow: hidden;
8
+    // width: 90px;
9
+    text-overflow: ellipsis;
10
+    white-space: nowrap;
11
+  }
12
+  .dynamic {
13
+    margin-bottom: 16px;
14
+    display: flex;
15
+    align-items: center;
16
+    input {
17
+      width: 90%;
18
+    }
19
+    i {
20
+      margin-left: 8px;
21
+      cursor: pointer;
22
+      font-size: 18px;
23
+    }
24
+  }
25
+}
26
+
27
+.save {
28
+  position: fixed;
29
+  left: 0;
30
+  top: 0;
31
+  width: 100%;
32
+  height: 100%;
33
+  background: rgba(0, 0, 0, 0.4);
34
+  z-index: 99;
35
+
36
+  .modalBody {
37
+    width: 350px;
38
+    background: #fff;
39
+    border-radius: 5px;
40
+    padding: 10px 20px;
41
+    color: #333;
42
+
43
+    .title {
44
+      width: 100%;
45
+      text-align: center;
46
+      font-size: 18px;
47
+      position: relative;
48
+
49
+      i {
50
+        position: absolute;
51
+        right: 0;
52
+        top: 0;
53
+        font-size: 20px;
54
+        color: #666;
55
+        cursor: pointer;
56
+        padding: 0 5px;
57
+      }
58
+    }
59
+
60
+    .content {
61
+      width: 100%;
62
+      height: 117px;
63
+      background: #f9fafb;
64
+      border: 1px solid #e5e9ed;
65
+      border-radius: 5px;
66
+      overflow: hidden;
67
+      margin-top: 12px;
68
+
69
+      div {
70
+        text-align: center;
71
+        margin: 0;
72
+
73
+        &.icon {
74
+          margin-top: 17px;
75
+
76
+          i {
77
+            color: #34b349;
78
+            font-size: 30px !important;
79
+
80
+            &.transport-wenhao {
81
+              color: #f5a523;
82
+            }
83
+
84
+            &.transport-shibai {
85
+              color: #ff3a52;
86
+            }
87
+          }
88
+        }
89
+
90
+        &.defeat {
91
+          color: #333;
92
+          font-size: 18px;
93
+        }
94
+
95
+        &:nth-child(3) {
96
+          font-size: 14px;
97
+          color: #666;
98
+        }
99
+      }
100
+    }
101
+
102
+    button {
103
+      margin-top: 10px;
104
+
105
+      &.btn {
106
+        margin-left: 8px;
107
+      }
108
+    }
109
+  }
110
+
111
+  // 新增
112
+  &.add {
113
+    .modalBody {
114
+      width: 420px;
115
+      height: auto;
116
+
117
+      .content {
118
+        width: 100%;
119
+        height: auto;
120
+        padding: 19px 14px 0 14px;
121
+        max-height: 500px;
122
+        overflow-y: auto;
123
+				
124
+				.ant-select{
125
+					width: 100%;
126
+				}
127
+				.ant-calendar-picker{
128
+					width: 100% !important;
129
+				}
130
+				.list-template__bottom {
131
+				  background: #f9fafb;
132
+				  border: 1px solid #e5e9ed;
133
+				  border-radius: 8px;
134
+				  padding-bottom: 56px;
135
+				  position: relative;
136
+				  .list-template__nzTable {
137
+				    padding: 16px 16px 0;
138
+				
139
+				    .thead {
140
+				      background-image: linear-gradient(to right, @bg-start, @bg-end);
141
+				
142
+				      th {
143
+				        background: transparent;
144
+				        color: #fff;
145
+				        text-align: center;
146
+				      }
147
+				    }
148
+				
149
+				    .ant-table-body {
150
+				      border-bottom: 1px solid #e5e9ed;
151
+				    }
152
+				
153
+				    .ant-table-tbody {
154
+				      tr {
155
+				        text-align: center;
156
+				        color: #333;
157
+				
158
+				        td {
159
+				          border: none;
160
+				
161
+				          &.tab_hover:hover{
162
+				            text-decoration: underline;
163
+				            cursor: pointer;
164
+				          }
165
+				
166
+				          .coop {
167
+				            button{
168
+				              color: #333;
169
+				            }
170
+				            span,button {
171
+				              display: inline-block;
172
+				              padding: 0 8px;
173
+				              cursor: pointer;
174
+				              position: relative;
175
+				
176
+				              &::after {
177
+				                content: "|";
178
+				                position: absolute;
179
+				                top: 0;
180
+				                right: 0;
181
+				              }
182
+				
183
+				              &:hover,
184
+				              &:active {
185
+				                color: @primary-color;
186
+				              }
187
+				
188
+				              &:nth-last-child(1) {
189
+				                &::after {
190
+				                  content: "";
191
+				                }
192
+				              }
193
+				            }
194
+				          }
195
+				        }
196
+				      }
197
+				    }
198
+				  }
199
+				  .list-template__pagination {
200
+				    height: 56px;
201
+				    display: flex;
202
+				    align-items: center;
203
+				    position: absolute;
204
+				    right: 8px;
205
+				  }
206
+				}
207
+				
208
+        .addForm {
209
+          .ant-form-item {
210
+            margin-bottom: 14px;
211
+
212
+            .ant-form-item-label {
213
+              line-height: 14px;
214
+              text-align: left;
215
+            }
216
+          }
217
+        }
218
+
219
+        .editForm {
220
+          .ant-form-item {
221
+            margin-bottom: 14px;
222
+
223
+            .ant-form-item-label {
224
+              line-height: 0;
225
+              text-align: left;
226
+            }
227
+          }
228
+        }
229
+      }
230
+
231
+      button {
232
+        &:nth-child(1) {
233
+          margin-right: 20px;
234
+        }
235
+      }
236
+    }
237
+  }
238
+}
239
+
240
+.monad{
241
+	margin-top: 20px;
242
+	.monad-list{
243
+		border: 1px solid #e7e7e7;
244
+		border-radius: 5px;
245
+		margin-bottom: 40px;
246
+		padding: 20px;
247
+	}
248
+	.monad-title{
249
+		text-align: center;
250
+		font-weight: 700;
251
+		font-size: 16px;
252
+	}
253
+	.monad-sign{
254
+		display: flex;
255
+		line-height: 30px;
256
+		div{
257
+			margin-right: 15px;
258
+		}
259
+	}
260
+}

+ 463 - 0
src/app/views/repository-manage/repository-manage.component.ts

@@ -0,0 +1,463 @@
1
+import { Component, OnInit, ViewChild } from "@angular/core";
2
+import { ActivatedRoute, Router } from "@angular/router";
3
+import {
4
+  FormBuilder,
5
+  Validators,
6
+  FormGroup,
7
+  FormControl,
8
+} from "@angular/forms";
9
+
10
+import { MainService } from "../../services/main.service";
11
+import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
12
+import { ToolService } from "../../services/tool.service";
13
+import { format, startOfDay, endOfDay, subDays} from "date-fns";
14
+import { NzMessageService } from "ng-zorro-antd";
15
+import { Subject } from "rxjs";
16
+import { debounceTime, filter } from "rxjs/operators";
17
+import host from "../../../assets/js/http";
18
+import { HttpRequest, HttpResponse, HttpClient } from '@angular/common/http';
19
+
20
+@Component({
21
+  selector: "app-repository-manage",
22
+  templateUrl: "./repository-manage.component.html",
23
+  styleUrls: ["./repository-manage.component.less"],
24
+})
25
+export class RepositoryManageComponent implements OnInit {
26
+  @ViewChild("osComponentRef1", {
27
+    read: OverlayScrollbarsComponent,
28
+    static: false,
29
+  })
30
+  osComponentRef1: OverlayScrollbarsComponent;
31
+  constructor(
32
+    private message: NzMessageService,
33
+    private fb: FormBuilder,
34
+    private route: ActivatedRoute,
35
+    private router: Router,
36
+    private mainService: MainService,
37
+    private tool: ToolService,
38
+    private http: HttpClient,
39
+  ) {}
40
+
41
+  ngOnInit() {
42
+    this.searchParentDeptSubject.pipe(debounceTime(500)).subscribe((e) => {
43
+			this.isDeptLoading = true;
44
+			this.getDeparts(e);
45
+    });
46
+		this.hosId = this.tool.getCurrentHospital().id;
47
+    this.coopBtns = this.tool.initCoopBtns(this.route);
48
+    this.initForm();
49
+		this.getList();
50
+    // this.getAllHospital();
51
+    // this.getDeptHandoverType();
52
+  }
53
+  listOfData: any[] = []; //表格数据
54
+  promptContent: string; //操作提示框提示信息
55
+  ifSuccess: boolean; //操作成功/失败
56
+  promptInfo: string; //操作结果提示信息
57
+  promptModalShow: boolean; //操作提示框是否展示
58
+  modal: boolean = false; //新增/编辑模态框
59
+  add: boolean; //true:新增;false:编辑
60
+  validateForm: FormGroup; //新增/编辑表单
61
+  coopId: number; //表格中执行操作的id
62
+  department: number; //所属科室
63
+	hosId: number; 
64
+	loadAllConsumeDept: boolean = true;//是否加载所有消耗科室
65
+  solutionNumber; //编号
66
+	title; //标题
67
+  num; //编码
68
+  deptalias; //别名
69
+  type; //类型
70
+  deptHandoverType; //类型
71
+  pageIndex: number = 1; //页码
72
+  listLength: number = 10; //总条数
73
+  pageSize: number = 10; //每页条数
74
+  btnLoading: boolean = false; //确认按钮loading状态
75
+  printLoading: boolean = false; //批量打印按钮loading状态
76
+  deptPhones: any = []; //新添加的科室电话列表
77
+  isAddDeptsPhone = true; //添加新的科室电话是否禁用
78
+  deptsPhoneId = 1; //科室电话自增id
79
+  allParentdepart: any = []; //所有的父级科室列表
80
+  hospitals1: any = []; //科室列表(搜索)
81
+	rowData: object = {}; //打印选择列表
82
+	editModal:boolean = false; //编辑时弹框
83
+  searchParentDeptSubject = new Subject();
84
+  // 初始化增删改按钮
85
+  coopBtns: any = {};
86
+	saveLoading:boolean = false;
87
+	taskTypeData:{id:''};
88
+	
89
+  // 导入---end
90
+  //搜索父级科室
91
+	isDeptLoading = false;
92
+  changeInp(e) {
93
+    this.searchParentDeptSubject.next(e);
94
+  }
95
+  // 配送建单
96
+  coopData:any = {};
97
+  addDateModal(data) {
98
+    this.coopData = data;
99
+    this.showDelModal1();
100
+  }
101
+
102
+  showDelModal1() {
103
+    this.editModal = true;
104
+  }
105
+  hideDelModal1() {
106
+    this.editModal = false;
107
+  }
108
+	
109
+  // 编辑保存
110
+  confirmDel1() {
111
+    var that = this;
112
+		for (const i in that.validateForm.controls) {
113
+		  that.validateForm.controls[i].markAsDirty();
114
+		  that.validateForm.controls[i].updateValueAndValidity();
115
+		}
116
+		if (that.validateForm.invalid) return;
117
+    let data: any = {
118
+			hosId:this.hosId,
119
+			pharmacy:this.validateForm.value.department,
120
+			id:that.coopId,
121
+			loadAllConsumeDept:this.validateForm.value.loadAllConsumeDept?1:0
122
+    };
123
+		that.saveLoading = true;
124
+		that.mainService
125
+		  .simplePost("addData", "drugsBatch", data)
126
+		  .subscribe((data) => {
127
+		    that.saveLoading = false;
128
+		    that.hideModal();
129
+		    that.initForm();
130
+		    if (data.status == 200) {
131
+					this.editModal = false;
132
+		      that.showPromptModal("编辑", true, "");
133
+		    } else {
134
+		      that.showPromptModal("编辑", false, data.msg);
135
+		    }
136
+		  });
137
+  }
138
+
139
+  // 搜索
140
+  search() {
141
+    this.pageIndex = 1;
142
+    this.getList();
143
+  }
144
+  // 重置
145
+  reset() {
146
+    this.pageIndex = 1;
147
+		this.solutionNumber = null;
148
+		this.title = null;
149
+    this.getList();
150
+  }
151
+  // 表格数据
152
+  loading1 = false;
153
+  getList() {
154
+    var that = this;
155
+    let data = {
156
+      idx: that.pageIndex - 1,
157
+      sum: that.pageSize,
158
+      solution: {
159
+    		title:this.title,
160
+				solutionNumber:this.solutionNumber,
161
+    		hosId: this.hosId
162
+      },
163
+    };
164
+
165
+    this.loading1 = true;
166
+    that.mainService
167
+      .getFetchDataList("data", "solution", data)
168
+      .subscribe((data) => {
169
+        this.loading1 = false;
170
+        that.listOfData = data.list;
171
+        that.listLength = data.totalNum;
172
+      });
173
+  }
174
+	
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
+  }
206
+	
207
+  // 获取所有院区
208
+  getAllHospital() {
209
+		this.getDeparts('')
210
+    this.getList();
211
+  }
212
+
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
+    });
221
+  }
222
+	
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
+		});
229
+	}
230
+	
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
+		});
252
+	}
253
+	
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
+  // 表单提交
279
+  submitForm(): void {
280
+    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
+			  });
308
+		}
309
+  }
310
+	
311
+	// 升级
312
+	upgrade(e, data){
313
+		e.stopPropagation();
314
+		this.router.navigateByUrl(`/dispensingDetail/${data.id}`);
315
+	}
316
+	
317
+	// 新增
318
+	addForm(){
319
+		this.router.navigateByUrl(`/repositoryManageAdd/0`);
320
+	}
321
+	
322
+	// 查看
323
+	look(e, data){
324
+		e.stopPropagation();
325
+		this.modal = true
326
+	}
327
+	
328
+	// 编辑
329
+	edit(e, data) {
330
+	  e.stopPropagation();
331
+	  this.router.navigateByUrl(`/repositoryManageAdd/${data.id}`);
332
+	}
333
+	
334
+	// 停用
335
+	pauseModal = false;
336
+	pause(e, data){
337
+		e.stopPropagation();
338
+		this.pauseModal = true;
339
+		this.coopId = data.id;
340
+	}
341
+	
342
+	// 确认停用
343
+	confirmDel2() {
344
+	  var that = this;
345
+	  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
+	    });
361
+	}
362
+	
363
+	hideDelModal2() {
364
+	  this.pauseModal = false;
365
+	}
366
+	
367
+	
368
+	// 恢复
369
+	renewModal = false;
370
+	renew(e, data){
371
+		e.stopPropagation();
372
+		this.renewModal = true;
373
+		this.coopId = data.id;
374
+	}
375
+	
376
+	// 确认恢复
377
+	confirmDel3() {
378
+	  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
+	    });
395
+	}
396
+	
397
+	hideDelModal3() {
398
+	  this.renewModal = false;
399
+	}
400
+	
401
+	// 审核
402
+	audit(e, data){
403
+		e.stopPropagation();
404
+		this.modal = true
405
+		// this.router.navigateByUrl(`/dispensingDetail/${data.id}`);
406
+	}
407
+	
408
+
409
+  // 展示信息提示框(con:提示信息,success:操作是否成功,promptInfo:操作结果提示信息)
410
+  showPromptModal(con, success, promptInfo?) {
411
+    this.promptModalShow = false;
412
+    this.promptContent = con;
413
+    this.ifSuccess = success;
414
+    this.promptInfo = promptInfo;
415
+    setTimeout(() => {
416
+      this.promptModalShow = true;
417
+    }, 100);
418
+    this.getList();
419
+  }
420
+
421
+  delModal: boolean = false; //删除模态框
422
+  coopIds: any;
423
+  coopFlag: any = false;
424
+  /**
425
+   *
426
+   * @param e 事件对象
427
+   * @param id
428
+   */
429
+  showDelModal(e, id) {
430
+    e.stopPropagation();
431
+    this.delModal = true;
432
+    this.coopId = id;
433
+  }
434
+  hideDelModal() {
435
+    this.delModal = false;
436
+  }
437
+  // 确认删除
438
+  confirmDel() {
439
+    var that = this;
440
+    that.btnLoading = true;
441
+    that.mainService
442
+      .coopTypeConfig(
443
+        "rmvData",
444
+        "solution",
445
+         [that.coopId]
446
+      )
447
+      .subscribe((data) => {
448
+        that.btnLoading = false;
449
+        that.delModal = false;
450
+        if (data.status==200) {
451
+          that.showPromptModal("删除", true, "");
452
+        } else {
453
+          that.showPromptModal("删除", false, data.data[0].msg);
454
+        }
455
+      });
456
+  }
457
+
458
+  detail(e, data) {
459
+    e.stopPropagation();
460
+		this.router.navigateByUrl(`/dispensingDetail/${data.id}`);
461
+  }
462
+
463
+}

+ 19 - 0
src/app/views/repository-manage/repository-manage.module.ts

@@ -0,0 +1,19 @@
1
+import { NgModule } from '@angular/core';
2
+import { CommonModule } from '@angular/common';
3
+
4
+import { RepositoryManageRoutingModule } from './repository-manage-routing.module';
5
+import { RepositoryManageComponent } from './repository-manage.component';
6
+import { ShareModule } from 'src/app/share/share.module';
7
+
8
+
9
+@NgModule({
10
+  declarations: [
11
+    RepositoryManageComponent,
12
+  ],
13
+  imports: [
14
+    CommonModule,
15
+    RepositoryManageRoutingModule,
16
+    ShareModule
17
+  ]
18
+})
19
+export class RepositoryManageModule { }

+ 2 - 0
tsconfig.json

@@ -1,6 +1,8 @@
1 1
 {
2 2
   "compileOnSave": false,
3 3
   "compilerOptions": {
4
+		"skipLibCheck": true,
5
+		"allowJs":true,
4 6
     "baseUrl": "./",
5 7
     "outDir": "./dist/out-tsc",
6 8
     "sourceMap": true,