|
|
@@ -271,7 +271,7 @@
|
|
271
|
271
|
:placeholder="tsT('formServiceStart')"
|
|
272
|
272
|
:picker-options="timePickerOptions"
|
|
273
|
273
|
style="width: 160px"
|
|
274
|
|
- @change="validateFormField('serviceStartTime')"
|
|
|
274
|
+ @change="handleServiceStartTimeChange"
|
|
275
|
275
|
/>
|
|
276
|
276
|
<span class="time-sep">{{ tsCommon("timeSeparator") }}</span>
|
|
277
|
277
|
<el-time-select
|
|
|
@@ -279,7 +279,7 @@
|
|
279
|
279
|
:placeholder="tsT('formServiceEnd')"
|
|
280
|
280
|
:picker-options="timePickerOptionsEnd"
|
|
281
|
281
|
style="width: 160px"
|
|
282
|
|
- @change="validateFormField('serviceStartTime')"
|
|
|
282
|
+ @change="handleServiceEndTimeChange"
|
|
283
|
283
|
/>
|
|
284
|
284
|
</el-form-item>
|
|
285
|
285
|
<el-form-item prop="serviceWeekdaysList" :rules="formRules.serviceWeekdaysList">
|
|
|
@@ -329,6 +329,7 @@
|
|
329
|
329
|
:placeholder="tsT('formServiceStart')"
|
|
330
|
330
|
:picker-options="timePickerOptions"
|
|
331
|
331
|
style="width: 160px"
|
|
|
332
|
+ @change="handleServiceStartTimeChange"
|
|
332
|
333
|
/>
|
|
333
|
334
|
<span class="time-sep">{{ tsCommon("timeSeparator") }}</span>
|
|
334
|
335
|
<el-time-select
|
|
|
@@ -336,11 +337,12 @@
|
|
336
|
337
|
:placeholder="tsT('formServiceEnd')"
|
|
337
|
338
|
:picker-options="timePickerOptionsEnd"
|
|
338
|
339
|
style="width: 160px"
|
|
|
340
|
+ @change="handleServiceEndTimeChange"
|
|
339
|
341
|
/>
|
|
340
|
342
|
</el-form-item>
|
|
341
|
343
|
<el-form-item prop="serviceWeekdaysList" :rules="formRules.serviceWeekdaysList">
|
|
342
|
344
|
<template slot="label">{{ tsT("formServiceWeekdays") }}</template>
|
|
343
|
|
- <el-checkbox-group v-model="form.serviceWeekdaysList">
|
|
|
345
|
+ <el-checkbox-group v-model="form.serviceWeekdaysList" @change="validateFormField('serviceWeekdaysList')">
|
|
344
|
346
|
<el-checkbox v-for="item in weekdayOptions" :key="item.value" :label="item.value">{{ item.label }}</el-checkbox>
|
|
345
|
347
|
</el-checkbox-group>
|
|
346
|
348
|
</el-form-item>
|
|
|
@@ -598,12 +600,11 @@ export default {
|
|
598
|
600
|
return !!(this.form.coverFilePath || this.form.coverFileUrl)
|
|
599
|
601
|
},
|
|
600
|
602
|
timePickerOptionsEnd() {
|
|
601
|
|
- const start = this.form.serviceStartTime
|
|
602
|
603
|
return {
|
|
603
|
|
- start: start || "00:00",
|
|
|
604
|
+ start: "00:00",
|
|
604
|
605
|
step: "00:15",
|
|
605
|
606
|
end: "23:45",
|
|
606
|
|
- minTime: start
|
|
|
607
|
+ minTime: this.form.serviceStartTime || "00:00"
|
|
607
|
608
|
}
|
|
608
|
609
|
},
|
|
609
|
610
|
formRules() {
|
|
|
@@ -871,9 +872,11 @@ export default {
|
|
871
|
872
|
this.handleQuery()
|
|
872
|
873
|
},
|
|
873
|
874
|
resetFormModel() {
|
|
|
875
|
+ const resourceType = TAB_TYPE_MAP[this.activeTab]
|
|
|
876
|
+ const hasServiceSchedule = this.hasServiceScheduleType(resourceType)
|
|
874
|
877
|
this.form = {
|
|
875
|
878
|
id: undefined,
|
|
876
|
|
- resourceType: TAB_TYPE_MAP[this.activeTab],
|
|
|
879
|
+ resourceType,
|
|
877
|
880
|
resourceName: undefined,
|
|
878
|
881
|
photoFileUrl: undefined,
|
|
879
|
882
|
photoFilePath: undefined,
|
|
|
@@ -893,9 +896,9 @@ export default {
|
|
893
|
896
|
serviceArea: undefined,
|
|
894
|
897
|
feeStandard: undefined,
|
|
895
|
898
|
borrowFee: undefined,
|
|
896
|
|
- serviceStartTime: undefined,
|
|
897
|
|
- serviceEndTime: undefined,
|
|
898
|
|
- serviceWeekdaysList: [],
|
|
|
899
|
+ serviceStartTime: hasServiceSchedule ? this.defaultServiceStartTime() : undefined,
|
|
|
900
|
+ serviceEndTime: hasServiceSchedule ? this.defaultServiceEndTime() : undefined,
|
|
|
901
|
+ serviceWeekdaysList: hasServiceSchedule ? this.defaultServiceWeekdaysList() : [],
|
|
899
|
902
|
instrumentModel: undefined,
|
|
900
|
903
|
storageLocation: undefined,
|
|
901
|
904
|
reservationProcess: undefined,
|
|
|
@@ -909,7 +912,14 @@ export default {
|
|
909
|
912
|
this.resetFormModel()
|
|
910
|
913
|
this.dialogEdit = false
|
|
911
|
914
|
this.open = true
|
|
912
|
|
- this.$nextTick(() => this.resetForm("form"))
|
|
|
915
|
+ this.$nextTick(() => {
|
|
|
916
|
+ if (this.hasServiceScheduleType(this.form.resourceType)) {
|
|
|
917
|
+ this.form.serviceEndTime = this.defaultServiceEndTime()
|
|
|
918
|
+ }
|
|
|
919
|
+ if (this.$refs.form) {
|
|
|
920
|
+ this.$refs.form.clearValidate()
|
|
|
921
|
+ }
|
|
|
922
|
+ })
|
|
913
|
923
|
},
|
|
914
|
924
|
fillFormFromApi(data) {
|
|
915
|
925
|
this.form = {
|
|
|
@@ -1022,12 +1032,58 @@ export default {
|
|
1022
|
1032
|
.catch(() => {})
|
|
1023
|
1033
|
},
|
|
1024
|
1034
|
handleFormTypeChange() {
|
|
|
1035
|
+ const t = this.normalizeResourceType(this.form.resourceType)
|
|
|
1036
|
+ if (this.hasServiceScheduleType(t)) {
|
|
|
1037
|
+ this.applyDefaultServiceSchedule(t)
|
|
|
1038
|
+ } else {
|
|
|
1039
|
+ this.form.serviceStartTime = undefined
|
|
|
1040
|
+ this.form.serviceEndTime = undefined
|
|
|
1041
|
+ this.form.serviceWeekdaysList = []
|
|
|
1042
|
+ }
|
|
1025
|
1043
|
this.$nextTick(() => {
|
|
1026
|
1044
|
if (this.$refs.form) {
|
|
1027
|
1045
|
this.$refs.form.clearValidate()
|
|
1028
|
1046
|
}
|
|
1029
|
1047
|
})
|
|
1030
|
1048
|
},
|
|
|
1049
|
+ hasServiceScheduleType(resourceType) {
|
|
|
1050
|
+ const t = this.normalizeResourceType(resourceType)
|
|
|
1051
|
+ return this.isExpertType(t) || this.isInstrumentType(t)
|
|
|
1052
|
+ },
|
|
|
1053
|
+ defaultServiceStartTime() {
|
|
|
1054
|
+ return "08:00"
|
|
|
1055
|
+ },
|
|
|
1056
|
+ defaultServiceEndTime() {
|
|
|
1057
|
+ return "18:00"
|
|
|
1058
|
+ },
|
|
|
1059
|
+ defaultServiceWeekdaysList() {
|
|
|
1060
|
+ return [1, 2, 3, 4, 5]
|
|
|
1061
|
+ },
|
|
|
1062
|
+ applyDefaultServiceSchedule(resourceType) {
|
|
|
1063
|
+ if (!this.hasServiceScheduleType(resourceType)) {
|
|
|
1064
|
+ return
|
|
|
1065
|
+ }
|
|
|
1066
|
+ this.form.serviceStartTime = this.defaultServiceStartTime()
|
|
|
1067
|
+ this.form.serviceWeekdaysList = this.defaultServiceWeekdaysList()
|
|
|
1068
|
+ this.$nextTick(() => {
|
|
|
1069
|
+ this.form.serviceEndTime = this.defaultServiceEndTime()
|
|
|
1070
|
+ })
|
|
|
1071
|
+ },
|
|
|
1072
|
+ handleServiceStartTimeChange() {
|
|
|
1073
|
+ const start = this.form.serviceStartTime
|
|
|
1074
|
+ const end = this.form.serviceEndTime
|
|
|
1075
|
+ if (start && (!end || end <= start)) {
|
|
|
1076
|
+ this.$nextTick(() => {
|
|
|
1077
|
+ this.form.serviceEndTime = this.defaultServiceEndTime()
|
|
|
1078
|
+ this.validateFormField("serviceStartTime")
|
|
|
1079
|
+ })
|
|
|
1080
|
+ return
|
|
|
1081
|
+ }
|
|
|
1082
|
+ this.validateFormField("serviceStartTime")
|
|
|
1083
|
+ },
|
|
|
1084
|
+ handleServiceEndTimeChange() {
|
|
|
1085
|
+ this.validateFormField("serviceStartTime")
|
|
|
1086
|
+ },
|
|
1031
|
1087
|
extOf(fileName) {
|
|
1032
|
1088
|
if (!fileName || fileName.lastIndexOf(".") < 0) {
|
|
1033
|
1089
|
return ""
|