|
|
@@ -417,15 +417,7 @@ export default {
|
|
|
let data = JSON.parse(
|
|
|
window.localStorage.getItem("trainingInstitution") || "{}"
|
|
|
);
|
|
|
- if (data.specialty) {
|
|
|
- data.specialty = data.specialty.split(",");
|
|
|
- data.specialty.forEach((item, index) => {
|
|
|
- if (!this.specialtyOptions.includes(item)) {
|
|
|
- data.specialty[index] = "其他";
|
|
|
- this.extra = item;
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ data.specialty = this.setSpecialty(data.specialty);
|
|
|
this.form = data;
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -461,6 +453,20 @@ export default {
|
|
|
}, 500);
|
|
|
});
|
|
|
},
|
|
|
+ setSpecialty(specialty) {
|
|
|
+ if (specialty) {
|
|
|
+ specialty = specialty.split(",");
|
|
|
+ specialty.forEach((item, index) => {
|
|
|
+ if (!this.specialtyOptions.includes(item)) {
|
|
|
+ specialty[index] = "其他";
|
|
|
+ this.extra = item;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return specialty;
|
|
|
+ } else {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ },
|
|
|
byUscc() {
|
|
|
this.$refs.form.validate().then(() => {
|
|
|
this.$toast.loading({
|
|
|
@@ -474,13 +480,7 @@ export default {
|
|
|
`/trainingInstitution/byUscc?name=${this.form.name}&uscc=${this.form.uscc}`
|
|
|
)
|
|
|
.then(res => {
|
|
|
- res.specialty = res.specialty.split(",");
|
|
|
- res.specialty.forEach((item, index) => {
|
|
|
- if (!this.specialtyOptions.includes(item)) {
|
|
|
- res.specialty[index] = "其他";
|
|
|
- this.extra = item;
|
|
|
- }
|
|
|
- });
|
|
|
+ res.specialty = this.setSpecialty(res.specialty);
|
|
|
this.$toast.clear();
|
|
|
this.form = { ...res, ...this.form };
|
|
|
if (!this.form.engagedInTraining) {
|