fix: 模型权限配置错误的问题

master
ssc 3 years ago
parent 4cbb5a686d
commit 593e453a23
  1. 26
      src/views/plugin/workflow/process/components/user-option.vue

@ -68,7 +68,6 @@
<avue-input-tree :ref="`role_${$index}`"
v-model="row.value"
size="mini"
dataType="string"
multiple
clearable
placeholder="角色"
@ -92,7 +91,6 @@
<avue-input-tree :ref="`post_${$index}`"
v-model="row.value"
size="mini"
dataType="string"
multiple
clearable
placeholder="职位"
@ -105,7 +103,6 @@
<avue-input-tree :ref="`platform_${$index}`"
v-model="row.value"
size="mini"
dataType="string"
multiple
clearable
placeholder="平台"
@ -190,7 +187,15 @@ export default {
this.getPostList()
this.init = true
}
if (val && this.userOption && this.userOption.data) this.$set(this, 'data', JSON.parse(JSON.stringify(this.userOption.data)))
if (val && this.userOption && this.userOption.data) {
const data = JSON.parse(JSON.stringify(this.userOption.data))
for (let item of data) {
if (['role', 'post', 'platform'].includes(item.type) && typeof item.value == 'string') item.value = item.value.split(',') || []
}
this.$set(this, 'data', data)
}
},
},
data() {
@ -258,8 +263,10 @@ export default {
this.$set(this.data[this.selectIndex], 'text', name)
},
handleTypeChange(index) {
const type = this.data[index].type
this.$set(this.data, index, {
type: this.data[index].type
type,
value: ['role', 'post', 'platform'].includes(type) ? [] : ''
})
},
handleChange(index, ref) {
@ -284,7 +291,14 @@ export default {
})
},
handleSubmit() {
this.$emit('submit', this.data.filter(d => d.type && d.value), this.switchAll)
const list = this.data.filter(d => d.type && d.value).map(d => {
return {
type: d.type,
value: d.value.join(','),
text: d.text
}
})
this.$emit('submit', list, this.switchAll)
this.visible = false
},
handleClose(done) {

Loading…
Cancel
Save