|
@@ -74,6 +74,11 @@ export class HushijiandanComponent implements OnInit {
|
74
|
74
|
static: false,
|
75
|
75
|
})
|
76
|
76
|
osComponentRef4: OverlayScrollbarsComponent;
|
|
77
|
+ @ViewChild("osComponentRef5", {
|
|
78
|
+ read: OverlayScrollbarsComponent,
|
|
79
|
+ static: false,
|
|
80
|
+ })
|
|
81
|
+ osComponentRef5: OverlayScrollbarsComponent;
|
77
|
82
|
@ViewChild("osComponentRef6", {
|
78
|
83
|
read: OverlayScrollbarsComponent,
|
79
|
84
|
static: false,
|
|
@@ -1086,15 +1091,107 @@ export class HushijiandanComponent implements OnInit {
|
1086
|
1091
|
}
|
1087
|
1092
|
);
|
1088
|
1093
|
}
|
|
1094
|
+ // 初始化新增form表单
|
|
1095
|
+ initBxForm(content) {
|
|
1096
|
+ this.validateBxForm = this.fb.group({
|
|
1097
|
+ description: [content || null, [Validators.required]],
|
|
1098
|
+ building: [null, [Validators.required]],
|
|
1099
|
+ floor: [null, [Validators.required]],
|
|
1100
|
+ officeAddress: [null, [Validators.required]],
|
|
1101
|
+ contacts: [this.loginUser.name, [Validators.required]],
|
|
1102
|
+ contactsInformation: [this.loginUser.phone, [Validators.required]],
|
|
1103
|
+ });
|
|
1104
|
+ this.getDeptByCode(this.currentDept.pcode);
|
|
1105
|
+ }
|
|
1106
|
+ // 根据科室Code获取详情
|
|
1107
|
+ deptDto:any = {};
|
|
1108
|
+ getDeptByCode(code){
|
|
1109
|
+ this.mainService
|
|
1110
|
+ .fetchListBx("department", {
|
|
1111
|
+ idx: 0,
|
|
1112
|
+ sum: 1,
|
|
1113
|
+ department: {
|
|
1114
|
+ eqCode: code,
|
|
1115
|
+ }
|
|
1116
|
+ })
|
|
1117
|
+ .subscribe((data:any) => {
|
|
1118
|
+ let list = data.list || [];
|
|
1119
|
+ this.deptDto = list.length > 0 ? list[0] : {};
|
|
1120
|
+ console.log(this.deptDto);
|
|
1121
|
+ this.changeHosp();
|
|
1122
|
+ // 回显楼栋
|
|
1123
|
+ if(this.deptDto.place){
|
|
1124
|
+ this.validateBxForm.controls.building.setValue(this.deptDto.place.area.id);
|
|
1125
|
+ }
|
|
1126
|
+
|
|
1127
|
+ // 回显楼层
|
|
1128
|
+ if(this.deptDto.place){
|
|
1129
|
+ this.validateBxForm.controls.floor.setValue(this.deptDto.place.id);
|
|
1130
|
+ }
|
|
1131
|
+ });
|
|
1132
|
+ }
|
|
1133
|
+ // 切换院区选项
|
|
1134
|
+ buildings: any = []; //楼栋
|
|
1135
|
+ changeHosp() {
|
|
1136
|
+ this.validateBxForm.controls.building.setValue(null);
|
|
1137
|
+ this.buildings = [];
|
|
1138
|
+ let data = {
|
|
1139
|
+ idx: 0,
|
|
1140
|
+ sum: 9999,
|
|
1141
|
+ area: {
|
|
1142
|
+ branch: this.deptDto.branch,
|
|
1143
|
+ }
|
|
1144
|
+ };
|
|
1145
|
+ this.mainService
|
|
1146
|
+ .fetchListBx("area", data)
|
|
1147
|
+ .subscribe((data:any) => {
|
|
1148
|
+ this.buildings = data.list || [];
|
|
1149
|
+ this.floors = [];
|
|
1150
|
+ this.message.remove(this.maskFlag);
|
|
1151
|
+ this.maskFlag = false;
|
|
1152
|
+ });
|
|
1153
|
+ }
|
|
1154
|
+
|
|
1155
|
+ // 切换楼栋信息
|
|
1156
|
+ floors: Array<any> = []; //楼层
|
|
1157
|
+ floorLoading: boolean = false;
|
|
1158
|
+ changeBuilding(buildingId) {
|
|
1159
|
+ if(!buildingId){
|
|
1160
|
+ return;
|
|
1161
|
+ }
|
|
1162
|
+ this.validateBxForm.controls.floor.setValue(null);
|
|
1163
|
+ this.validateBxForm.controls.officeAddress.setValue(null);
|
|
1164
|
+ this.floors = [];
|
|
1165
|
+
|
|
1166
|
+ let data = {
|
|
1167
|
+ idx: 0,
|
|
1168
|
+ sum: 9999,
|
|
1169
|
+ place: {
|
|
1170
|
+ area: { id: buildingId },
|
|
1171
|
+ }
|
|
1172
|
+ };
|
|
1173
|
+ this.floorLoading = true;
|
|
1174
|
+ this.mainService
|
|
1175
|
+ .fetchListBx("place", data)
|
|
1176
|
+ .subscribe((data:any) => {
|
|
1177
|
+ this.floorLoading = false;
|
|
1178
|
+ this.message.remove(this.maskFlag);
|
|
1179
|
+ this.maskFlag = false;
|
|
1180
|
+ this.floors = data.list || [];
|
|
1181
|
+ });
|
|
1182
|
+ }
|
1089
|
1183
|
// 是否确定报修模态框
|
1090
|
1184
|
bxModal: boolean = false; //模态框
|
1091
|
1185
|
loading6 = false;
|
1092
|
|
- tipsMsg2: string; //提示框信息
|
1093
|
1186
|
coopBx: any; //当前操作列
|
1094
|
|
- showBxModal(data: any, tipsMsg2: string) {
|
|
1187
|
+ validateBxForm: FormGroup; //新增/编辑表单
|
|
1188
|
+ showBxModal(data: any) {
|
|
1189
|
+ this.maskFlag = this.message.loading("正在加载中..", {
|
|
1190
|
+ nzDuration: 0,
|
|
1191
|
+ }).messageId;
|
1095
|
1192
|
this.bxModal = true;
|
1096
|
|
- this.coopBx = data;
|
1097
|
|
- this.tipsMsg2 = tipsMsg2;
|
|
1193
|
+ this.coopBx = data || {};
|
|
1194
|
+ this.initBxForm(this.coopBx.content);
|
1098
|
1195
|
}
|
1099
|
1196
|
// 隐藏模态框
|
1100
|
1197
|
hideBxModal() {
|
|
@@ -1102,46 +1199,110 @@ export class HushijiandanComponent implements OnInit {
|
1102
|
1199
|
}
|
1103
|
1200
|
// 确认
|
1104
|
1201
|
confirmBx() {
|
1105
|
|
- this.loading6 = true;
|
1106
|
|
- this.mainService.wxbx({}).subscribe((result) => {
|
1107
|
|
- if ((result as any).status == 200) {
|
1108
|
|
- let bxcode = (result as any).data; //生成微信报修号
|
1109
|
|
- let postData: any = {
|
1110
|
|
- verification: "true",
|
1111
|
|
- incident: {
|
1112
|
|
- branch:this.loginUser.currentHospital.id,
|
1113
|
|
- deptId:this.loginUser.dept.id,
|
1114
|
|
- // contacts: this.loginUser.name,
|
1115
|
|
- // contactsInformation: this.loginUser.phone,
|
1116
|
|
- description: this.coopBx.content,
|
1117
|
|
- requester: { account: this.loginUser.account },
|
1118
|
|
- sourceType: "wechatUserIncident",
|
1119
|
|
- fileUrl: "url",
|
1120
|
|
- bxcode,
|
1121
|
|
- },
|
1122
|
|
- loginUser: {
|
1123
|
|
- account: this.loginUser.account,
|
1124
|
|
- id: this.loginUser.id,
|
1125
|
|
- },
|
1126
|
|
- };
|
1127
|
|
- if (this.coopBx.category) {
|
1128
|
|
- postData.incident.categoryId = this.coopBx.category.id;
|
1129
|
|
- }
|
1130
|
|
- this.mainService.addWxIncident(postData).subscribe((res) => {
|
1131
|
|
- this.loading6 = false;
|
1132
|
|
- this.bxModal = false;
|
1133
|
|
- if ((res as any).state == 200) {
|
1134
|
|
- this.showPromptModal("提交", true, "");
|
1135
|
|
- this.checkTable("bxlb");
|
1136
|
|
- } else {
|
1137
|
|
- this.showPromptModal("提交", false, (res as any).msg);
|
1138
|
|
- }
|
1139
|
|
- });
|
1140
|
|
- } else {
|
1141
|
|
- this.loading6 = false;
|
1142
|
|
- this.showPromptModal("提交", false, "");
|
|
1202
|
+ for (const i in this.validateBxForm.controls) {
|
|
1203
|
+ this.validateBxForm.controls[i].markAsDirty();
|
|
1204
|
+ this.validateBxForm.controls[i].updateValueAndValidity();
|
|
1205
|
+ }
|
|
1206
|
+ if (this.validateBxForm.invalid){
|
|
1207
|
+ this.message.error('请填写必填字段!');
|
|
1208
|
+ return;
|
|
1209
|
+ };
|
|
1210
|
+ this.showReqModal();
|
|
1211
|
+ }
|
|
1212
|
+
|
|
1213
|
+ // 报修
|
|
1214
|
+ // type, 1是,0否
|
|
1215
|
+ async confirmBxNext(type){
|
|
1216
|
+ this.maskFlag = this.message.loading("正在加载中..", {
|
|
1217
|
+ nzDuration: 0,
|
|
1218
|
+ }).messageId;
|
|
1219
|
+ if(type == 1){
|
|
1220
|
+ this.btnLoading = true;
|
|
1221
|
+ let loginUser:any = {
|
|
1222
|
+ account: this.loginUser.account,
|
|
1223
|
+ };
|
|
1224
|
+ if(this.deptDto.branch){
|
|
1225
|
+ loginUser.branch = { id: this.deptDto.branch };
|
1143
|
1226
|
}
|
1144
|
|
- });
|
|
1227
|
+ if(this.deptDto){
|
|
1228
|
+ loginUser.dept = {id: this.deptDto.id};
|
|
1229
|
+ }
|
|
1230
|
+ if(this.validateBxForm.value.contacts){
|
|
1231
|
+ loginUser.name = this.validateBxForm.value.contacts;
|
|
1232
|
+ }
|
|
1233
|
+ if(this.validateBxForm.value.floor){
|
|
1234
|
+ loginUser.place = {id: this.validateBxForm.value.floor, area: { id: this.validateBxForm.value.building }};
|
|
1235
|
+ }
|
|
1236
|
+ if(this.validateBxForm.value.officeAddress){
|
|
1237
|
+ loginUser.houseNumber = this.validateBxForm.value.officeAddress;
|
|
1238
|
+ }
|
|
1239
|
+ if(this.validateBxForm.value.contactsInformation){
|
|
1240
|
+ loginUser.phone = this.validateBxForm.value.contactsInformation;
|
|
1241
|
+ }
|
|
1242
|
+ let result:any = await this.mainService.saveUser({loginUser}).toPromise();
|
|
1243
|
+ console.log(result);
|
|
1244
|
+ if(result.state != 200){
|
|
1245
|
+ this.hideReqModal();
|
|
1246
|
+ this.btnLoading = false;
|
|
1247
|
+ this.message.remove(this.maskFlag);
|
|
1248
|
+ this.maskFlag = false;
|
|
1249
|
+ this.message.error(result.msg);
|
|
1250
|
+ return;
|
|
1251
|
+ }
|
|
1252
|
+ }else{
|
|
1253
|
+ this.cancenlLoading = true;
|
|
1254
|
+ }
|
|
1255
|
+ this.mainService.getDictionaryByITSM({key: "incident_source", type: "list"}).subscribe((source:any) => {
|
|
1256
|
+ let incidentSourceList = source.data || [];
|
|
1257
|
+ let im = incidentSourceList.find(v => v.value === 'im');
|
|
1258
|
+ this.mainService.wxbx({}).subscribe((result) => {
|
|
1259
|
+ if ((result as any).status == 200) {
|
|
1260
|
+ let bxcode = (result as any).data; //生成微信报修号
|
|
1261
|
+ let postData: any = {
|
|
1262
|
+ incident: {
|
|
1263
|
+ "incidentsign": bxcode,
|
|
1264
|
+ "deleteFlag": 0,
|
|
1265
|
+ "department": { id: this.deptDto.id },
|
|
1266
|
+ "contactsInformation": this.validateBxForm.value.contactsInformation,
|
|
1267
|
+ "contacts": this.validateBxForm.value.contacts,
|
|
1268
|
+ "branch": this.deptDto.branch,
|
|
1269
|
+ "area": { id: this.validateBxForm.value.building },
|
|
1270
|
+ "place": { id: this.validateBxForm.value.floor },
|
|
1271
|
+ "houseNumber": this.validateBxForm.value.officeAddress,
|
|
1272
|
+ "source": im,
|
|
1273
|
+ "description": this.validateBxForm.value.description,
|
|
1274
|
+ "repairType": 2,
|
|
1275
|
+ "requester": this.loginUser,
|
|
1276
|
+ "acceptUser": this.loginUser,
|
|
1277
|
+ },
|
|
1278
|
+ loginUser: {
|
|
1279
|
+ account: this.loginUser.account,
|
|
1280
|
+ id: this.loginUser.id,
|
|
1281
|
+ }
|
|
1282
|
+ };
|
|
1283
|
+ if (this.coopBx.category) {
|
|
1284
|
+ postData.incident.category = this.coopBx.category;
|
|
1285
|
+ }
|
|
1286
|
+ this.mainService.addWxIncident(postData).subscribe((res) => {
|
|
1287
|
+ this.btnLoading = false;
|
|
1288
|
+ this.cancenlLoading = false;
|
|
1289
|
+ this.message.remove(this.maskFlag);
|
|
1290
|
+ this.maskFlag = false;
|
|
1291
|
+ this.bxModal = false;
|
|
1292
|
+ this.hideReqModal();
|
|
1293
|
+ if ((res as any).state == 200) {
|
|
1294
|
+ this.showPromptModal("提交", true, "");
|
|
1295
|
+ this.checkTable("bxlb");
|
|
1296
|
+ } else {
|
|
1297
|
+ this.showPromptModal("提交", false, (res as any).msg);
|
|
1298
|
+ }
|
|
1299
|
+ });
|
|
1300
|
+ } else {
|
|
1301
|
+ this.btnLoading = false;
|
|
1302
|
+ this.showPromptModal("提交", false, "");
|
|
1303
|
+ }
|
|
1304
|
+ });
|
|
1305
|
+ })
|
1145
|
1306
|
}
|
1146
|
1307
|
|
1147
|
1308
|
// 获取星级
|
|
@@ -3825,6 +3986,20 @@ export class HushijiandanComponent implements OnInit {
|
3825
|
3986
|
hideDelAdviceModal() {
|
3826
|
3987
|
this.delAdviceModal = false;
|
3827
|
3988
|
}
|
|
3989
|
+ // 报修提示框
|
|
3990
|
+ reqModal: boolean = false;
|
|
3991
|
+ showReqModal() {
|
|
3992
|
+ this.reqModal = true;
|
|
3993
|
+ }
|
|
3994
|
+ confirmReq() {
|
|
3995
|
+ this.confirmBxNext(1);
|
|
3996
|
+ }
|
|
3997
|
+ cancelReq() {
|
|
3998
|
+ this.confirmBxNext(0);
|
|
3999
|
+ }
|
|
4000
|
+ hideReqModal() {
|
|
4001
|
+ this.reqModal = false;
|
|
4002
|
+ }
|
3828
|
4003
|
// 工单列表下拉筛选
|
3829
|
4004
|
selectedType: null;
|
3830
|
4005
|
changeOrderSel(e) {
|