|
@@ -66,6 +66,7 @@ export default {
|
|
|
cObj: {},
|
|
|
estateObj: {},
|
|
|
schoolObj: {},
|
|
|
+ facilityObj: {},
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -73,6 +74,7 @@ export default {
|
|
|
if (val) {
|
|
|
this.estateObj = {}
|
|
|
this.schoolObj = {}
|
|
|
+ this.facilityObj = {}
|
|
|
this.cObj = JSON.parse(JSON.stringify(this.curObj))
|
|
|
this.getDef()
|
|
|
}
|
|
@@ -96,31 +98,55 @@ export default {
|
|
|
}
|
|
|
let remoteSchoolOptions = []
|
|
|
if (params.schoolObj) {
|
|
|
- const schoolObj = JSON.parse(params.schoolObj)
|
|
|
+ let schoolObj = {}
|
|
|
+ if (typeof(params.schoolObj) === 'object') {
|
|
|
+ schoolObj = params.schoolObj
|
|
|
+ } else {
|
|
|
+ schoolObj = JSON.parse(params.schoolObj)
|
|
|
+ }
|
|
|
if (schoolObj.id) {
|
|
|
params.school_id = schoolObj.id
|
|
|
remoteSchoolOptions = [{ keyRO: schoolObj.school_name, valRO: schoolObj.id }]
|
|
|
}
|
|
|
}
|
|
|
+ let remoteFacilityOptions = []
|
|
|
+ if (params.facilityObj) {
|
|
|
+ const facilityObj = JSON.parse(params.facilityObj)
|
|
|
+ if (facilityObj.id) {
|
|
|
+ params.facility_id = facilityObj.id
|
|
|
+ remoteFacilityOptions = [{ keyRO: facilityObj.facility_name, valRO: facilityObj.id }]
|
|
|
+ }
|
|
|
+ }
|
|
|
if (str === 'color') {
|
|
|
const oldform = this.$refs.ruleForm.baseForm
|
|
|
params = {...oldform}
|
|
|
params.fillColor = this.fillColor
|
|
|
params.strokeColor = this.strokeColor
|
|
|
}
|
|
|
+ if (str === 'facility') {
|
|
|
+ const oldform = this.$refs.ruleForm.baseForm
|
|
|
+ params = {...oldform}
|
|
|
+ params.text = this.facilityObj.facility_name
|
|
|
+ remoteFacilityOptions = [{ keyRO: this.facilityObj.facility_name, valRO: this.facilityObj.id }]
|
|
|
+ params.school_id = ''
|
|
|
+ params.estate_id = ''
|
|
|
+ }
|
|
|
if (str === 'estate') {
|
|
|
const oldform = this.$refs.ruleForm.baseForm
|
|
|
params = {...oldform}
|
|
|
params.text = this.estateObj.estate_name
|
|
|
remoteEstateOptions = [{ keyRO: this.estateObj.estate_name, valRO: this.estateObj.id }]
|
|
|
params.school_id = ''
|
|
|
+ params.facility_id = ''
|
|
|
}
|
|
|
+
|
|
|
if (str === 'school') {
|
|
|
const oldform = this.$refs.ruleForm.baseForm
|
|
|
params = {...oldform}
|
|
|
params.text = this.schoolObj.school_name
|
|
|
remoteSchoolOptions = [{ keyRO: this.schoolObj.school_name, valRO: this.schoolObj.id }]
|
|
|
params.estate_id = ''
|
|
|
+ params.facility_id = ''
|
|
|
}
|
|
|
if (!params.text) params.text = '标题示例'
|
|
|
if (!params.strokeStyle) params.strokeStyle = 'solid'
|
|
@@ -131,6 +157,10 @@ export default {
|
|
|
params.strokeColor = this.strokeColor
|
|
|
}
|
|
|
this.formData = [
|
|
|
+ { label: '关联配套', key: 'facility_id', type: 'selectRemote', changeHandle: this.facilityChange,
|
|
|
+ remoteParams: { skey: 'name', api: `facility.admfacilitylist`, opKey: 'name', opVal: 'id' },
|
|
|
+ remoteOptions: remoteFacilityOptions
|
|
|
+ },
|
|
|
{ label: '关联楼盘', key: 'estate_id', type: 'selectRemote', changeHandle: this.estateChange,
|
|
|
remoteParams: { skey: 'estate_name', api: `house.admestatelist`, opKey: 'estate_name', opVal: 'id' },
|
|
|
remoteOptions: remoteEstateOptions
|
|
@@ -156,6 +186,15 @@ export default {
|
|
|
}
|
|
|
this.setDefaultValue(params)
|
|
|
},
|
|
|
+ facilityChange (val, op, valObj) {
|
|
|
+ this.facilityObj = {
|
|
|
+ id: valObj.id,
|
|
|
+ facility_name: valObj.name,
|
|
|
+ pri_image: valObj.pri_image,
|
|
|
+ remarked: valObj.remarked,
|
|
|
+ }
|
|
|
+ this.getDef('facility')
|
|
|
+ },
|
|
|
estateChange (val, op, valObj) {
|
|
|
this.estateObj = {
|
|
|
id: valObj.id,
|
|
@@ -200,6 +239,10 @@ export default {
|
|
|
if (this.schoolObj && this.schoolObj.id) {
|
|
|
newForm.schoolObj = JSON.stringify(this.schoolObj)
|
|
|
}
|
|
|
+ if (this.facilityObj && this.facilityObj.id) {
|
|
|
+ newForm.facilityObj = JSON.stringify(this.facilityObj)
|
|
|
+ }
|
|
|
+
|
|
|
if (this.curObj.obj) {
|
|
|
this.$emit('close', newForm, 'edit')
|
|
|
} else {
|