|
@@ -121,11 +121,24 @@ export default {
|
|
watch: {
|
|
watch: {
|
|
templates(newValue) {
|
|
templates(newValue) {
|
|
this.__init()
|
|
this.__init()
|
|
|
|
+ },
|
|
|
|
+ 'model.conditionExpression'(newValue) {
|
|
|
|
+ // 反显数据
|
|
|
|
+ let conditionExpression = this.model.conditionExpression
|
|
|
|
+ conditionExpression = conditionExpression ? JSON.parse(conditionExpression) : null
|
|
|
|
+ if (conditionExpression) {
|
|
|
|
+ this.conditionList = conditionExpression
|
|
|
|
+ } else {
|
|
|
|
+ this.conditionList = [{
|
|
|
|
+ key: null,
|
|
|
|
+ sign: null,
|
|
|
|
+ value: null
|
|
|
|
+ }]
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
async mounted() {
|
|
async mounted() {
|
|
this.__init()
|
|
this.__init()
|
|
- console.log(this.model.conditionExpression)
|
|
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
onChangeCondition() {
|
|
onChangeCondition() {
|
|
@@ -141,13 +154,14 @@ export default {
|
|
this.formatTemplateData(values)
|
|
this.formatTemplateData(values)
|
|
// 反显数据
|
|
// 反显数据
|
|
let conditionExpression = this.model.conditionExpression
|
|
let conditionExpression = this.model.conditionExpression
|
|
- conditionExpression = JSON.parse(conditionExpression)
|
|
|
|
|
|
+ conditionExpression = conditionExpression ? JSON.parse(conditionExpression) : null
|
|
if (conditionExpression) {
|
|
if (conditionExpression) {
|
|
this.conditionList = conditionExpression
|
|
this.conditionList = conditionExpression
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
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)
|
|
@@ -157,6 +171,7 @@ export default {
|
|
})
|
|
})
|
|
},
|
|
},
|
|
formatTemplateData(template) {
|
|
formatTemplateData(template) {
|
|
|
|
+ this.fieldList = []
|
|
const templates = template || []
|
|
const templates = template || []
|
|
const optionList = []
|
|
const optionList = []
|
|
templates.forEach(template => {
|
|
templates.forEach(template => {
|