diff --git a/src/views/system/station/index.vue b/src/views/system/station/index.vue index ed8a482..3078aa7 100644 --- a/src/views/system/station/index.vue +++ b/src/views/system/station/index.vue @@ -280,8 +280,8 @@ color: #c0c4cc; margin-top: -10px; " - v-if="form.classifyName == '请选择护理站所属机构分类'" - >{{ form.classifyName }}{{ form.classifyNameList }} {{ form.classifyName }}{{ form.classifyNameList }} diff --git a/src/views/system/station/stationjs.js b/src/views/system/station/stationjs.js index f1e9ef2..8b6ee9a 100644 --- a/src/views/system/station/stationjs.js +++ b/src/views/system/station/stationjs.js @@ -305,13 +305,14 @@ export default { morningOpenEndTime: null, //上午结束 morningOpenStartTime: null, //上午开始 nurseStationClassifyIds: [], - classifyName: '请选择护理站所属机构分类', + classifyNameList: '请选择护理站所属机构分类', }; this.resetForm("form"); }, //护理机构分类 clickinnerVisible() { this.classifylistInfo(); + // this.form.classifyNameList=this.form.classifyName this.Classifyshow = true; }, @@ -325,22 +326,32 @@ export default { this.classifylistInfo(); }, choiceclassify(e) { - if (this.form.classifyName == '请选择护理站所属机构分类') { - this.form.classifyName = e.classifyName; + console.log(e) + if (this.form.classifyNameList == '请选择护理站所属机构分类') { + this.form.classifyNameList = e.classifyName; } else { - this.form.classifyName = this.form.classifyName + e.classifyName; + this.form.classifyNameList = this.form.classifyNameList + e.classifyName; } - if ( this.form.nurseStationClassifyIds.find(el => el == e.id)) { + // 若已存在id 则为删除 + if (this.form.nurseStationClassifyIds.find(el => el == e.id)) { this.form.nurseStationClassifyIds = this.form.nurseStationClassifyIds.filter(ele => ele != e.id) } else { + // 不存在 添加进id this.form.nurseStationClassifyIds.push(e.id); } - console.log(this.form.nurseStationClassifyIds) + + // 根据id获取到所有name + console.log(this.classifylist) + this.form.classifyNameList = ""; + this.form.nurseStationClassifyIds.forEach(f => { + let classify = this.classifylist.find(d => d.id == f) + this.form.classifyNameList += classify.classifyName + }) + }, /** 查询护理机构分类信息列表 */ classifylistInfo() { - // this.loading = true; listStationClassify(this.classifyquery).then((response) => { this.classifylist = response.rows; this.classifytotal = response.total; @@ -348,8 +359,9 @@ export default { }); }, cancelClassifyshow() { + this.classifylistInfo(); this.Classifyshow = false; - // this。 + }, //护理站列表 info() { @@ -412,15 +424,14 @@ export default { this.loading = true; const id = row.id || this.ids; getStation(id).then((response) => { - if (response.data.nurseClassifyInfoList) { - response.data.nurseStationClassifyIds=[] + response.data.nurseStationClassifyIds = [] response.data.nurseClassifyInfoList.forEach(e => { response.data.nurseStationClassifyIds.push(e.id) }) - } + } this.form = response.data; - this.form.classifyName=response.data.classifyNameList; + // this.form.classifyName=response.data.classifyNameList; this.form.streetCode = this.form.streetName; this.imgone = this.form.stationIntroducePcitureUrl; this.imgtwo = this.form.stationPictureUrl; @@ -432,10 +443,7 @@ export default { }, /** 提交按钮 */ submitForm() { - // this.form.nurseStationClassifyIds.forEach((e) => { - // e.classifyNameList = e.id; - // }); - this.form.classifyNameList=this.form.classifyName + // this.form.classifyNameList=this.form.classifyName this.form.afternoonOpenStartTime = this.form.afternoonOpenStartTime + ':00' this.form.afternoonOpenStartTime = this.form.afternoonOpenStartTime.slice(0, 8) this.form.afternoonOpenEndTime = this.form.afternoonOpenEndTime + ':00'