Commit 9faecc9a authored by levante's avatar levante

标签选项动态添加

parent a04a98be
......@@ -98,7 +98,7 @@
</a-form-item>
<a-form-item>
<a-select style="width: 180px" placeholder='请选择业务属性' v-decorator="['key-' + index66 +'-' + index,{initialValue: item.key, validateTrigger:'blur',rules: [{required: true, message: '请至少选择一项!'}]}]">
<a-select @change="item.val = ''" style="width: 180px" placeholder='请选择业务属性' v-decorator="['key-' + index66 +'-' + index,{initialValue: item.key, validateTrigger:'blur',rules: [{required: true, message: '请至少选择一项!'}]}]">
<a-select-option v-for="(item1) in cnonvertObj(availableKeyList, infoSettingForm.getFieldValue('tableName-' + index66 +'-' + index))" :key='item1.id' :value='item1.tblKey'>{{item1.tblKeyName}}</a-select-option>
</a-select>
</a-form-item>
......@@ -117,15 +117,26 @@
</a-form-item>
<!-- 可以是输入框或者选择框 -->
<a-form-item>
<!-- {{availableKeyList}}
{{infoSettingForm.getFieldValue('tableName-' + index66 +'-' + index)}}
{{infoSettingForm.getFieldValue('key-' + index66 +'-' + index)}} -->
<a-form-item v-if="checkIfSelectOptionAppears(availableKeyList, infoSettingForm.getFieldValue('tableName-' + index66 +'-' + index), infoSettingForm.getFieldValue('key-' + index66 +'-' + index))">
<!-- {{checkIfSelectOptionAppears(availableKeyList, infoSettingForm.getFieldValue('tableName-' + index66 +'-' + index), infoSettingForm.getFieldValue('key-' + index66 +'-' + index))}} -->
<!-- {{availableKeyList.find(item=>item.tblKey == 'stKind')}} -->
<!-- {{availableKeyList.find(item=>item.tblKey == "stKind").selVals}} -->
<a-select style="width: 100px" placeholder='请选择' v-decorator="['inputOne-' + index66 +'-' + index,{initialValue: item.val, validateTrigger:'blur',rules: [{required: true, message: '请至少选择一项!'}]}]">
<a-select-option v-for="(item1) in cnonvertObjSecond()" :key='item1.id' :value='item1.tblKey'>{{item1.tblKeyName}}</a-select-option>
<a-select-option v-for="(item1, index) in JSON.parse(availableKeyList.find(item=>item.tblKey == infoSettingForm.getFieldValue('key-' + index66 +'-' + index)).selVals)" :key='item1' :value="item1">{{index}}</a-select-option>
<!-- <a-select-option v-for="(item1) in
JSON.parse((availableKeyList.find(item=>item.tblKey == infoSettingForm.getFieldValue('val-' + index66 +'-' + index))).selVals)
" :key='item1' :value="item1.value">{{item1.name}}</a-select-option> -->
</a-select>
</a-form-item>
<!-- <a-form-item>
<a-form-item v-else>
<a-input style="width: 100px" placeholder='请输入' v-decorator="['inputOne-' + index66 +'-' + index,{initialValue: getInitialValueOne(item.val), validateTrigger:'blur',rules: [],}]"></a-input>
</a-form-item> -->
</a-form-item>
<a-form-item v-if="infoSettingForm.getFieldValue('codition-'+index66 +'-' + index) == 'btw'">
<a-input style="width: 100px" placeholder='请输入' v-decorator="['inputTwo-' + index66 +'-' + index,{initialValue: getInitialValueTwo(item.val), validateTrigger:'blur',rules: []}]"></a-input>
......@@ -398,8 +409,9 @@ export default {
},
},
methods: {
getValueOptions(availbleOptions, neededKey) {
clearForm(formToClear) {
console.log(formToClear);
this.infoSettingForm.resetFields(formToClear)
},
getSelectedProperty(val) {
console.log(val);
......@@ -443,6 +455,51 @@ export default {
return optionsPush
},
/**
* options => 所有可选择项目
* formValue => 业务属性
* key => 业务属性二级可选值
*/
checkIfSelectOptionAppears(options, formValue, key) {
// console.log(options, formValue, key);
let findKey = options.find(item => (item.tblKey == key))
if (!findKey || !findKey.selVals) return false
return true
let resultList = []
let obj = JSON.parse(findKey.selVals)
for (const key in obj) {
resultList.push({
name: key,
value: obj[key]
})
}
console.log(resultList)
return resultList
// for(let i = 0; i < options.length; i++) {
// if(options[i].tblKey == key) {
// if(options[i].tblKey == null) {
// console.log(JSON.parse(options[i].selVals));
// let resultList = []
// let obj = JSON.parse(options[i].selVals)
// for (const key in obj) {
// resultList.push({
// name: key,
// value: obj[key]
// })
// }
// return resultList
// // return JSON.parse(options[i].selVals)
// } else {
// return null
// }
// }
// }
},
cnonvertObjSecond() {},
handleResultOk() {
this.resultModalVisible = !this.resultModalVisible
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment