|
|
|
// subpages/addResi/com/expandForm.js
|
|
|
|
|
|
|
|
Component({
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 组件的属性列表
|
|
|
|
*/
|
|
|
|
properties: {
|
|
|
|
"formList": {
|
|
|
|
"type": Array,
|
|
|
|
"value": []
|
|
|
|
},
|
|
|
|
"popupTitle":{
|
|
|
|
"type": String,
|
|
|
|
"value": ""
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 组件的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
|
|
|
formType:null
|
|
|
|
},
|
|
|
|
// onReady(){
|
|
|
|
// },
|
|
|
|
ready: async function () {
|
|
|
|
if(this.data.formList && this.data.formList.length >0){
|
|
|
|
this.setData({
|
|
|
|
formType:this.data.formList[0].formNameP
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 组件的方法列表
|
|
|
|
*/
|
|
|
|
methods: {
|
|
|
|
bindPicker(e){
|
|
|
|
const selectedIndex = e.detail.value;
|
|
|
|
let opction = e.currentTarget.dataset.opction;
|
|
|
|
let formName = e.currentTarget.dataset.formname;
|
|
|
|
let formValue = opction[selectedIndex];
|
|
|
|
let formNameP = e.currentTarget.dataset.formnamep;
|
|
|
|
let {label,value} = formValue;
|
|
|
|
this.triggerEvent('changExpandForm',{formName,formNameP,formValue:value})
|
|
|
|
this.setData({
|
|
|
|
'formList': this.data.formList.map(item => {
|
|
|
|
if (item.formName === formName) {
|
|
|
|
return { ...item, selectLabel: label };
|
|
|
|
} else {
|
|
|
|
return item;
|
|
|
|
}})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
radioChange(e){
|
|
|
|
console.log(e);
|
|
|
|
const selectedIndex =Number( e.detail.value);
|
|
|
|
let formName = e.currentTarget.dataset.formname;
|
|
|
|
let formValue = Number(e.detail.value);
|
|
|
|
let formNameP = e.currentTarget.dataset.formnamep;
|
|
|
|
this.triggerEvent('changExpandForm',{formName,formNameP,formValue})
|
|
|
|
this.setData({
|
|
|
|
'formList': this.data.formList.map(item => {
|
|
|
|
if (item.formName === formName) {
|
|
|
|
return { ...item, selectLabel: selectedIndex };
|
|
|
|
} else {
|
|
|
|
return item;
|
|
|
|
}})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
bindinput(e){
|
|
|
|
let formName = e.currentTarget.dataset.formname;
|
|
|
|
let formValue = e.detail.value;
|
|
|
|
let formNameP = e.currentTarget.dataset.formnamep;
|
|
|
|
this.triggerEvent('changExpandForm',{formNameP,formName,formValue})
|
|
|
|
},
|
|
|
|
bindCheckbox(e){
|
|
|
|
let formName = e.currentTarget.dataset.formname;
|
|
|
|
let formValue = e.detail.value;
|
|
|
|
let formNameP = e.currentTarget.dataset.formnamep;
|
|
|
|
this.triggerEvent('changExpandForm',{formNameP,formName,formValue})
|
|
|
|
},
|
|
|
|
bindDateChange(e){
|
|
|
|
let formName = e.currentTarget.dataset.formname;
|
|
|
|
let formNameP = e.currentTarget.dataset.formnamep;
|
|
|
|
|
|
|
|
this.triggerEvent('changExpandForm',{formName,formNameP,formValue: e.detail.value})
|
|
|
|
this.setData({
|
|
|
|
'formList': this.data.formList.map(item => {
|
|
|
|
if (item.formName === formName) {
|
|
|
|
return { ...item, selectLabel: e.detail.value };
|
|
|
|
} else {
|
|
|
|
return item;
|
|
|
|
}})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
hideForm(){
|
|
|
|
this.triggerEvent('hideExpandForm',{formType:this.data.formType})
|
|
|
|
},
|
|
|
|
confirm(){
|
|
|
|
console.log(this.data.formList);
|
|
|
|
this.triggerEvent('confirmExpandForm',{formList:this.data.formList,formType:this.data.formType})
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|