|
|
@@ -185,7 +185,7 @@
|
|
185
|
185
|
</el-form-item>
|
|
186
|
186
|
<el-form-item prop="consultModesList" :rules="formRules.consultModesList">
|
|
187
|
187
|
<template slot="label">{{ dtT("formConsultModes") }}</template>
|
|
188
|
|
- <el-checkbox-group v-model="form.consultModesList">
|
|
|
188
|
+ <el-checkbox-group v-model="form.consultModesList" @change="validateFormField('consultModesList')">
|
|
189
|
189
|
<el-checkbox v-for="item in consultModeOptions" :key="item.value" :label="item.value">{{ item.label }}</el-checkbox>
|
|
190
|
190
|
</el-checkbox-group>
|
|
191
|
191
|
</el-form-item>
|
|
|
@@ -207,6 +207,7 @@
|
|
207
|
207
|
:placeholder="dtT('formServiceStart')"
|
|
208
|
208
|
:picker-options="timePickerOptions"
|
|
209
|
209
|
style="width: 160px"
|
|
|
210
|
+ @change="validateFormField('serviceStartTime')"
|
|
210
|
211
|
/>
|
|
211
|
212
|
<span class="time-sep">{{ dtCommon("timeSeparator") }}</span>
|
|
212
|
213
|
<el-time-select
|
|
|
@@ -214,11 +215,12 @@
|
|
214
|
215
|
:placeholder="dtT('formServiceEnd')"
|
|
215
|
216
|
:picker-options="timePickerOptionsEnd"
|
|
216
|
217
|
style="width: 160px"
|
|
|
218
|
+ @change="validateFormField('serviceStartTime')"
|
|
217
|
219
|
/>
|
|
218
|
220
|
</el-form-item>
|
|
219
|
221
|
<el-form-item prop="serviceWeekdaysList" :rules="formRules.serviceWeekdaysList">
|
|
220
|
222
|
<template slot="label">{{ dtT("formServiceWeekdays") }}</template>
|
|
221
|
|
- <el-checkbox-group v-model="form.serviceWeekdaysList">
|
|
|
223
|
+ <el-checkbox-group v-model="form.serviceWeekdaysList" @change="validateFormField('serviceWeekdaysList')">
|
|
222
|
224
|
<el-checkbox v-for="item in weekdayOptions" :key="item.value" :label="item.value">{{ item.label }}</el-checkbox>
|
|
223
|
225
|
</el-checkbox-group>
|
|
224
|
226
|
</el-form-item>
|
|
|
@@ -280,6 +282,7 @@
|
|
280
|
282
|
:placeholder="dtT('formServiceStart')"
|
|
281
|
283
|
:picker-options="timePickerOptions"
|
|
282
|
284
|
style="width: 160px"
|
|
|
285
|
+ @change="validateFormField('serviceStartTime')"
|
|
283
|
286
|
/>
|
|
284
|
287
|
<span class="time-sep">{{ dtCommon("timeSeparator") }}</span>
|
|
285
|
288
|
<el-time-select
|
|
|
@@ -287,11 +290,12 @@
|
|
287
|
290
|
:placeholder="dtT('formServiceEnd')"
|
|
288
|
291
|
:picker-options="timePickerOptionsEnd"
|
|
289
|
292
|
style="width: 160px"
|
|
|
293
|
+ @change="validateFormField('serviceStartTime')"
|
|
290
|
294
|
/>
|
|
291
|
295
|
</el-form-item>
|
|
292
|
296
|
<el-form-item prop="serviceWeekdaysList" :rules="formRules.serviceWeekdaysList">
|
|
293
|
297
|
<template slot="label">{{ dtT("formServiceWeekdays") }}</template>
|
|
294
|
|
- <el-checkbox-group v-model="form.serviceWeekdaysList">
|
|
|
298
|
+ <el-checkbox-group v-model="form.serviceWeekdaysList" @change="validateFormField('serviceWeekdaysList')">
|
|
295
|
299
|
<el-checkbox v-for="item in weekdayOptions" :key="item.value" :label="item.value">{{ item.label }}</el-checkbox>
|
|
296
|
300
|
</el-checkbox-group>
|
|
297
|
301
|
</el-form-item>
|
|
|
@@ -531,7 +535,6 @@ export default {
|
|
531
|
535
|
}
|
|
532
|
536
|
},
|
|
533
|
537
|
formRules() {
|
|
534
|
|
- const phoneRuleRequired = [{ required: true, message: this.dtT("ruleContactPhone"), trigger: "blur" }, { validator: this.validatePhone, trigger: "blur" }]
|
|
535
|
538
|
const phoneRuleOptional = [{ validator: this.validatePhoneOptional, trigger: "blur" }]
|
|
536
|
539
|
const rules = {
|
|
537
|
540
|
resourceType: [{ required: true, message: this.dtT("ruleResourceType"), trigger: "change" }],
|
|
|
@@ -547,14 +550,14 @@ export default {
|
|
547
|
550
|
rules.contactPhone = phoneRuleOptional
|
|
548
|
551
|
rules.affiliatedUnit = [{ max: 20, message: this.dtCommon("ruleLen120"), trigger: "blur" }]
|
|
549
|
552
|
rules.detailAddress = [{ max: 100, message: this.dtCommon("ruleLen1100"), trigger: "blur" }]
|
|
550
|
|
- rules.consultModesList = [{ validator: this.validateConsultModes, trigger: "change" }]
|
|
551
|
|
- rules.serviceArea = [
|
|
552
|
|
- { required: true, message: this.dtT("ruleServiceArea"), trigger: "blur" },
|
|
553
|
|
- { min: 1, max: 100, message: this.dtCommon("ruleLen1100"), trigger: "blur" }
|
|
554
|
|
- ]
|
|
555
|
|
- rules.feeStandard = [{ required: true, message: this.dtT("ruleFeeStandard"), trigger: "change" }]
|
|
556
|
|
- rules.serviceStartTime = [{ validator: this.validateServiceTime, trigger: "change" }]
|
|
557
|
|
- rules.serviceWeekdaysList = [{ validator: this.validateWeekdays, trigger: "change" }]
|
|
|
553
|
+ rules.consultModesList = []
|
|
|
554
|
+ rules.serviceArea = [{ max: 100, message: this.dtCommon("ruleLen1100"), trigger: "blur" }]
|
|
|
555
|
+ rules.feeStandard = []
|
|
|
556
|
+ rules.serviceStartTime = [{ validator: this.validateServiceTimeOptional, trigger: "change" }]
|
|
|
557
|
+ rules.serviceWeekdaysList = []
|
|
|
558
|
+ } else if (this.isOrgType(t) || this.isTeamType(t) || this.isEquipmentType(t)) {
|
|
|
559
|
+ rules.photoFilePath = []
|
|
|
560
|
+ rules.introduction = [{ max: 500, message: this.dtCommon("ruleLen1500"), trigger: "blur" }]
|
|
558
|
561
|
} else {
|
|
559
|
562
|
rules.photoFilePath = [{ required: true, message: this.dtT("rulePhoto"), trigger: "change" }]
|
|
560
|
563
|
rules.introduction = [
|
|
|
@@ -563,40 +566,22 @@ export default {
|
|
563
|
566
|
]
|
|
564
|
567
|
}
|
|
565
|
568
|
if (this.isTeamType(t)) {
|
|
566
|
|
- rules.contactPhone = phoneRuleRequired
|
|
567
|
|
- rules.affiliatedUnit = [
|
|
568
|
|
- { required: true, message: this.dtT("ruleAffiliatedUnit"), trigger: "blur" },
|
|
569
|
|
- { min: 1, max: 20, message: this.dtCommon("ruleLen120"), trigger: "blur" }
|
|
570
|
|
- ]
|
|
571
|
|
- rules.establishDate = [{ required: true, message: this.dtT("ruleEstablishDate"), trigger: "change" }]
|
|
572
|
|
- rules.teamSize = [{ required: true, message: this.dtT("ruleTeamSize"), trigger: "change" }]
|
|
573
|
|
- rules.personInCharge = [
|
|
574
|
|
- { required: true, message: this.dtT("rulePersonInCharge"), trigger: "blur" },
|
|
575
|
|
- { min: 1, max: 10, message: this.dtCommon("ruleLen110"), trigger: "blur" }
|
|
576
|
|
- ]
|
|
|
569
|
+ rules.contactPhone = phoneRuleOptional
|
|
|
570
|
+ rules.affiliatedUnit = [{ max: 20, message: this.dtCommon("ruleLen120"), trigger: "blur" }]
|
|
|
571
|
+ rules.establishDate = []
|
|
|
572
|
+ rules.teamSize = []
|
|
|
573
|
+ rules.personInCharge = [{ max: 10, message: this.dtCommon("ruleLen110"), trigger: "blur" }]
|
|
577
|
574
|
} else if (this.isOrgType(t)) {
|
|
578
|
575
|
rules.orgLevel = [{ required: true, message: this.dtT("ruleOrgLevel"), trigger: "change" }]
|
|
579
|
|
- rules.detailAddress = [
|
|
580
|
|
- { required: true, message: this.dtT("ruleDetailAddress"), trigger: "blur" },
|
|
581
|
|
- { min: 1, max: 100, message: this.dtCommon("ruleLen1100"), trigger: "blur" }
|
|
582
|
|
- ]
|
|
583
|
|
- rules.personInCharge = [
|
|
584
|
|
- { required: true, message: this.dtT("rulePersonInCharge"), trigger: "blur" },
|
|
585
|
|
- { min: 1, max: 10, message: this.dtCommon("ruleLen110"), trigger: "blur" }
|
|
586
|
|
- ]
|
|
587
|
|
- rules.contactPhone = phoneRuleRequired
|
|
588
|
|
- rules.serviceStartTime = [{ validator: this.validateServiceTime, trigger: "change" }]
|
|
589
|
|
- rules.serviceWeekdaysList = [{ validator: this.validateWeekdays, trigger: "change" }]
|
|
590
|
|
- rules.maxDailyAppointments = [{ required: true, message: this.dtT("ruleMaxDaily"), trigger: "change" }]
|
|
|
576
|
+ rules.detailAddress = [{ max: 100, message: this.dtCommon("ruleLen1100"), trigger: "blur" }]
|
|
|
577
|
+ rules.personInCharge = [{ max: 10, message: this.dtCommon("ruleLen110"), trigger: "blur" }]
|
|
|
578
|
+ rules.contactPhone = phoneRuleOptional
|
|
|
579
|
+ rules.serviceStartTime = [{ validator: this.validateServiceTimeOptional, trigger: "change" }]
|
|
|
580
|
+ rules.serviceWeekdaysList = []
|
|
|
581
|
+ rules.maxDailyAppointments = []
|
|
591
|
582
|
} else if (this.isEquipmentType(t)) {
|
|
592
|
|
- rules.equipmentModel = [
|
|
593
|
|
- { required: true, message: this.dtT("ruleEquipmentModel"), trigger: "blur" },
|
|
594
|
|
- { min: 1, max: 10, message: this.dtCommon("ruleLen110"), trigger: "blur" }
|
|
595
|
|
- ]
|
|
596
|
|
- rules.affiliatedUnit = [
|
|
597
|
|
- { required: true, message: this.dtT("ruleAffiliatedUnit"), trigger: "blur" },
|
|
598
|
|
- { min: 1, max: 20, message: this.dtCommon("ruleLen120"), trigger: "blur" }
|
|
599
|
|
- ]
|
|
|
583
|
+ rules.equipmentModel = [{ max: 10, message: this.dtCommon("ruleLen110"), trigger: "blur" }]
|
|
|
584
|
+ rules.affiliatedUnit = [{ max: 20, message: this.dtCommon("ruleLen120"), trigger: "blur" }]
|
|
600
|
585
|
}
|
|
601
|
586
|
return rules
|
|
602
|
587
|
}
|
|
|
@@ -687,6 +672,11 @@ export default {
|
|
687
|
672
|
.filter(Boolean)
|
|
688
|
673
|
.join("、")
|
|
689
|
674
|
},
|
|
|
675
|
+ validateFormField(field) {
|
|
|
676
|
+ this.$nextTick(() => {
|
|
|
677
|
+ this.$refs.form && this.$refs.form.validateField(field)
|
|
|
678
|
+ })
|
|
|
679
|
+ },
|
|
690
|
680
|
validatePhone(rule, value, callback) {
|
|
691
|
681
|
if (!value || !PHONE_REG.test(String(value).trim())) {
|
|
692
|
682
|
callback(new Error(this.dtCommon("rulePhone")))
|
|
|
@@ -732,6 +722,23 @@ export default {
|
|
732
|
722
|
}
|
|
733
|
723
|
callback()
|
|
734
|
724
|
},
|
|
|
725
|
+ validateServiceTimeOptional(rule, value, callback) {
|
|
|
726
|
+ const start = this.form.serviceStartTime
|
|
|
727
|
+ const end = this.form.serviceEndTime
|
|
|
728
|
+ if (!start && !end) {
|
|
|
729
|
+ callback()
|
|
|
730
|
+ return
|
|
|
731
|
+ }
|
|
|
732
|
+ if (!start || !end) {
|
|
|
733
|
+ callback(new Error(this.dtT("ruleServiceTime")))
|
|
|
734
|
+ return
|
|
|
735
|
+ }
|
|
|
736
|
+ if (start > end) {
|
|
|
737
|
+ callback(new Error(this.dtCommon("ruleServiceEnd")))
|
|
|
738
|
+ return
|
|
|
739
|
+ }
|
|
|
740
|
+ callback()
|
|
|
741
|
+ },
|
|
735
|
742
|
handleTabClick() {
|
|
736
|
743
|
this.queryParams.resourceType = TAB_TYPE_MAP[this.activeTab]
|
|
737
|
744
|
this.queryParams.pageNum = 1
|
|
|
@@ -821,10 +828,14 @@ export default {
|
|
821
|
828
|
this.resetForm("queryForm")
|
|
822
|
829
|
this.handleQuery()
|
|
823
|
830
|
},
|
|
|
831
|
+ allConsultModeValues() {
|
|
|
832
|
+ return this.consultModeOptions.map((item) => item.value)
|
|
|
833
|
+ },
|
|
824
|
834
|
resetFormModel() {
|
|
|
835
|
+ const resourceType = TAB_TYPE_MAP[this.activeTab]
|
|
825
|
836
|
this.form = {
|
|
826
|
837
|
id: undefined,
|
|
827
|
|
- resourceType: TAB_TYPE_MAP[this.activeTab],
|
|
|
838
|
+ resourceType,
|
|
828
|
839
|
resourceName: undefined,
|
|
829
|
840
|
photoFileUrl: undefined,
|
|
830
|
841
|
photoFilePath: undefined,
|
|
|
@@ -832,13 +843,13 @@ export default {
|
|
832
|
843
|
contactPhone: undefined,
|
|
833
|
844
|
affiliatedUnit: undefined,
|
|
834
|
845
|
detailAddress: undefined,
|
|
835
|
|
- consultModesList: [],
|
|
|
846
|
+ consultModesList: this.isVetType(resourceType) ? this.allConsultModeValues() : [],
|
|
836
|
847
|
serviceArea: undefined,
|
|
837
|
848
|
feeStandard: undefined,
|
|
838
|
849
|
serviceStartTime: undefined,
|
|
839
|
850
|
serviceEndTime: undefined,
|
|
840
|
851
|
serviceWeekdaysList: [],
|
|
841
|
|
- maxDailyAppointments: undefined,
|
|
|
852
|
+ maxDailyAppointments: this.isOrgType(resourceType) ? 30 : undefined,
|
|
842
|
853
|
establishDate: undefined,
|
|
843
|
854
|
teamSize: undefined,
|
|
844
|
855
|
teamMembers: undefined,
|
|
|
@@ -954,7 +965,9 @@ export default {
|
|
954
|
965
|
},
|
|
955
|
966
|
handleFormTypeChange() {
|
|
956
|
967
|
const t = this.normalizeResourceType(this.form.resourceType)
|
|
957
|
|
- if (!this.isVetType(t)) {
|
|
|
968
|
+ if (this.isVetType(t)) {
|
|
|
969
|
+ this.form.consultModesList = this.allConsultModeValues()
|
|
|
970
|
+ } else {
|
|
958
|
971
|
this.form.detailAddress = undefined
|
|
959
|
972
|
this.form.consultModesList = []
|
|
960
|
973
|
this.form.serviceArea = undefined
|
|
|
@@ -968,6 +981,8 @@ export default {
|
|
968
|
981
|
if (!this.isOrgType(t)) {
|
|
969
|
982
|
this.form.orgLevel = undefined
|
|
970
|
983
|
this.form.maxDailyAppointments = undefined
|
|
|
984
|
+ } else {
|
|
|
985
|
+ this.form.maxDailyAppointments = 30
|
|
971
|
986
|
}
|
|
972
|
987
|
if (!this.isVetType(t) && !this.isOrgType(t)) {
|
|
973
|
988
|
this.form.serviceStartTime = undefined
|