|
@@ -33,7 +33,7 @@
|
|
style="width:90%; font-size:12px"
|
|
style="width:90%; font-size:12px"
|
|
placeholder="请选择关联字段"
|
|
placeholder="请选择关联字段"
|
|
clearable
|
|
clearable
|
|
- @change="onChangeCondition"
|
|
|
|
|
|
+ @change="onChangeSelectCondition"
|
|
>
|
|
>
|
|
<el-option-group
|
|
<el-option-group
|
|
v-for="group in fieldList"
|
|
v-for="group in fieldList"
|
|
@@ -63,7 +63,18 @@
|
|
<el-option label="不等于" value="!=" />
|
|
<el-option label="不等于" value="!=" />
|
|
<el-option label="等于" value="==" />
|
|
<el-option label="等于" value="==" />
|
|
</el-select>
|
|
</el-select>
|
|
|
|
+ <el-select
|
|
|
|
+ v-if="fieldType[index].type == 'select'"
|
|
|
|
+ v-model="item.value"
|
|
|
|
+ style="width:90%; font-size:12px"
|
|
|
|
+ placeholder="请选择"
|
|
|
|
+ clearable
|
|
|
|
+ @change="onChangeCondition"
|
|
|
|
+ >
|
|
|
|
+ <el-option v-for="type in fieldType[index].options" :key="type.value" :label="type.value" :value="type.value" />
|
|
|
|
+ </el-select>
|
|
<el-input
|
|
<el-input
|
|
|
|
+ v-else
|
|
v-model="item.value"
|
|
v-model="item.value"
|
|
style="width:90%; font-size:12px"
|
|
style="width:90%; font-size:12px"
|
|
clearable
|
|
clearable
|
|
@@ -114,6 +125,10 @@ export default {
|
|
sign: null,
|
|
sign: null,
|
|
value: null
|
|
value: null
|
|
}],
|
|
}],
|
|
|
|
+ fieldType: [{
|
|
|
|
+ type: null,
|
|
|
|
+ options: []
|
|
|
|
+ }],
|
|
fieldList: []
|
|
fieldList: []
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -127,6 +142,8 @@ export default {
|
|
conditionExpression = conditionExpression ? JSON.parse(conditionExpression) : null
|
|
conditionExpression = conditionExpression ? JSON.parse(conditionExpression) : null
|
|
if (conditionExpression) {
|
|
if (conditionExpression) {
|
|
this.conditionList = conditionExpression
|
|
this.conditionList = conditionExpression
|
|
|
|
+ this.onFormatField()
|
|
|
|
+ this.$forceUpdate()
|
|
} else {
|
|
} else {
|
|
this.conditionList = [{
|
|
this.conditionList = [{
|
|
key: null,
|
|
key: null,
|
|
@@ -140,6 +157,30 @@ export default {
|
|
this.__init()
|
|
this.__init()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ onChangeSelectCondition() {
|
|
|
|
+ this.onFormatField()
|
|
|
|
+ this.$forceUpdate()
|
|
|
|
+ this.onChange('conditionExpression', JSON.stringify(this.conditionList))
|
|
|
|
+ },
|
|
|
|
+ onFormatField() {
|
|
|
|
+ this.conditionList.forEach((con, index) => {
|
|
|
|
+ this.fieldType[index] = this.onFormatType(con.key)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ onFormatType(value) {
|
|
|
|
+ const temp = {}
|
|
|
|
+ this.fieldList.forEach(list => {
|
|
|
|
+ if (list.options && list.options.length) {
|
|
|
|
+ list.options.forEach(item => {
|
|
|
|
+ if (item.value == value) {
|
|
|
|
+ temp.type = item.type
|
|
|
|
+ temp.options = item.options
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ return temp
|
|
|
|
+ },
|
|
onChangeCondition() {
|
|
onChangeCondition() {
|
|
this.onChange('conditionExpression', JSON.stringify(this.conditionList))
|
|
this.onChange('conditionExpression', JSON.stringify(this.conditionList))
|
|
},
|
|
},
|
|
@@ -156,11 +197,12 @@ export default {
|
|
conditionExpression = conditionExpression ? JSON.parse(conditionExpression) : null
|
|
conditionExpression = conditionExpression ? JSON.parse(conditionExpression) : null
|
|
if (conditionExpression) {
|
|
if (conditionExpression) {
|
|
this.conditionList = conditionExpression
|
|
this.conditionList = conditionExpression
|
|
|
|
+ this.onFormatField()
|
|
|
|
+ this.$forceUpdate()
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
async getFieldList(id) {
|
|
async getFieldList(id) {
|
|
- console.log(id)
|
|
|
|
return new Promise(async(resolve, reject) => {
|
|
return new Promise(async(resolve, reject) => {
|
|
await templateDetails({ template_id: id }).then(res => {
|
|
await templateDetails({ template_id: id }).then(res => {
|
|
resolve(res.data)
|
|
resolve(res.data)
|
|
@@ -183,7 +225,9 @@ export default {
|
|
if (item.type != 'subform') {
|
|
if (item.type != 'subform') {
|
|
options.options.push({
|
|
options.options.push({
|
|
label: item.name,
|
|
label: item.name,
|
|
- value: item.model
|
|
|
|
|
|
+ type: item.type,
|
|
|
|
+ value: item.model,
|
|
|
|
+ options: item.options.options || []
|
|
})
|
|
})
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -199,6 +243,10 @@ export default {
|
|
sign: null,
|
|
sign: null,
|
|
value: null
|
|
value: null
|
|
})
|
|
})
|
|
|
|
+ this.fieldType.push({
|
|
|
|
+ type: null,
|
|
|
|
+ options: []
|
|
|
|
+ })
|
|
},
|
|
},
|
|
delDisplayCondition(index) {
|
|
delDisplayCondition(index) {
|
|
this.$confirm('是否删除条件表达式?', {
|
|
this.$confirm('是否删除条件表达式?', {
|
|
@@ -207,6 +255,7 @@ export default {
|
|
type: 'warning'
|
|
type: 'warning'
|
|
}).then(() => {
|
|
}).then(() => {
|
|
this.conditionList.splice(index, 1)
|
|
this.conditionList.splice(index, 1)
|
|
|
|
+ this.fieldType.splice(index, 1)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|