feat: 模型权限配置所有人均可发起选项

saber
ssc 3 years ago
parent 3c7e971f61
commit 2e66cd657c
  1. 15
      src/views/plugin/workflow/design/model.vue
  2. 12
      src/views/plugin/workflow/process/components/user-option.vue

@ -108,6 +108,7 @@
<user-option ref="userOption" <user-option ref="userOption"
:user-option="userOption" :user-option="userOption"
all
@submit="handleScopeSubmit"></user-option> @submit="handleScopeSubmit"></user-option>
</basic-container> </basic-container>
</template> </template>
@ -264,13 +265,13 @@ export default {
this.categoryId = id this.categoryId = id
this.searchChange(this.query) this.searchChange(this.query)
}, },
handleScopeSubmit(list) { handleScopeSubmit(list, all) {
list.forEach(l => l.val = l.value) list.forEach(l => l.val = l.value)
const { id, modelKey } = this.row const { id, modelKey } = this.row
const param = { const param = {
modelId: id, modelKey, modelId: id, modelKey,
scopeList: list scopeList: all? list.concat([{type: 'WF_ALL', val: 'WF_ALL'}]): list
} }
scopeSubmit(param).then(() => { scopeSubmit(param).then(() => {
this.$message.success('操作成功') this.$message.success('操作成功')
@ -278,7 +279,15 @@ export default {
}, },
handleScope(row) { handleScope(row) {
scopeList({ modelId: row.id }).then(res => { scopeList({ modelId: row.id }).then(res => {
this.$set(this.userOption, 'data', res.data.data.map(d => { const data = res.data.data
const index = data.findIndex(d => d.type == 'WF_ALL')
if (index != -1) {
this.$refs.userOption.switchAll = true
data.splice(index, 1)
}
else this.$refs.userOption.switchAll = false
this.$set(this.userOption, 'data', data.map(d => {
return { return {
value: d.val, value: d.val,
text: d.text, text: d.text,

@ -6,6 +6,7 @@
width="60%" width="60%"
:before-close="handleClose" :before-close="handleClose"
append-to-body> append-to-body>
<p v-if="all" style="padding: 0 20px;">不限制权限,所有人均可发起:<el-switch v-model="switchAll"></el-switch>平台需单独配置</p>
<el-table v-if="visible" <el-table v-if="visible"
class="avue-crud" class="avue-crud"
:data="data" :data="data"
@ -42,7 +43,7 @@
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
:disabled="Boolean(data.find(d => d.type == item.value))"></el-option> :disabled="Boolean(data.find(d => d.type == item.value)) || (switchAll && !['platform'].includes(item.value))"></el-option>
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
@ -137,7 +138,11 @@ import UserSelect from './user-select.vue'
export default { export default {
props: { props: {
userOption: Object userOption: Object,
all: {
type: Boolean,
default: false
}
}, },
components: { components: {
UserSelect, UserSelect,
@ -184,6 +189,7 @@ export default {
}, },
data() { data() {
return { return {
switchAll: false,
init: false, init: false,
visible: false, visible: false,
data: [], data: [],
@ -272,7 +278,7 @@ export default {
}) })
}, },
handleSubmit() { handleSubmit() {
this.$emit('submit', this.data.filter(d => d.type && d.value)) this.$emit('submit', this.data.filter(d => d.type && d.value), this.switchAll)
this.visible = false this.visible = false
}, },
handleClose(done) { handleClose(done) {

Loading…
Cancel
Save