BUG 28482

This commit is contained in:
aixianling
2022-03-22 22:32:04 +08:00
parent e686914023
commit fff005a6a1
2 changed files with 19 additions and 8 deletions

View File

@@ -114,7 +114,8 @@
</div> </div>
</ai-dialog> </ai-dialog>
<ai-dialog :visible.sync="authDialog" title="授权" @onConfirm="handleAuth" @closed="form={}" width="500px"> <ai-dialog :visible.sync="authDialog" title="授权" @onConfirm="handleAuth" @closed="form={}" width="500px">
<ai-user-picker :instance="instance" v-model="form.operators" multiple action="/user/page" label="name"/> <ai-user-picker :instance="instance" v-model="form.operators" multiple action="/user/page" label="name"
@list="v=>operators=v"/>
</ai-dialog> </ai-dialog>
</section> </section>
</template> </template>
@@ -216,7 +217,8 @@ export default {
}, },
peopleAjaxUrl: "/admin/user/page", peopleAjaxUrl: "/admin/user/page",
authDialog: false, authDialog: false,
form: {} form: {},
operators: []
}; };
}, },
@@ -268,15 +270,17 @@ export default {
statusChage(row) { statusChage(row) {
this.authDialog = true this.authDialog = true
this.form = JSON.parse(JSON.stringify(row)) let store = JSON.parse(JSON.stringify(row))
this.form = {...store, operators: store.operators?.map(e => e.id)}
}, },
handleAuth() { handleAuth() {
let {operators} = this.form let form = JSON.parse(JSON.stringify(this.form))
this.form.operators = operators.map(id => ({id})) form.operators = this.operators.map(({id, name}) => ({id, name}))
this.instance.post(`/app/appvillagerintegralshop/addOrUpdate`, this.form).then((res) => { this.instance.post(`/app/appvillagerintegralshop/addOrUpdate`, form).then((res) => {
if (res?.code == 0) { if (res?.code == 0) {
this.$message.success("授权成功!") this.$message.success("授权成功!")
this.authDialog = false this.authDialog = false
this.getList()
} }
}) })
}, },

View File

@@ -1,6 +1,6 @@
<template> <template>
<section class="AiUserPicker"> <section class="AiUserPicker">
<el-select size="small" :value="value" placeholder="选择人员" clearable @change="v=>$emit('select',v)" v-bind="$attrs" <el-select size="small" :value="value" placeholder="选择人员" clearable @change="handleSelect" v-bind="$attrs"
filterable> filterable>
<el-option v-for="row in list" :key="row.id" :value="row.id" :label="row[label]"/> <el-option v-for="row in list" :key="row.id" :value="row.id" :label="row[label]"/>
</el-select> </el-select>
@@ -19,7 +19,8 @@ export default {
instance: Function, instance: Function,
action: {default: "/appportaluser/list"}, action: {default: "/appportaluser/list"},
params: {default: () => ({})}, params: {default: () => ({})},
label: {default: "phone"} label: {default: "phone"},
name: {default: ""}
}, },
data() { data() {
return { return {
@@ -34,6 +35,12 @@ export default {
this.list = res.data.records this.list = res.data.records
} }
}) })
},
handleSelect(v) {
let list = this.list.filter(e => [v].flat().includes(e.id))
this.$emit('select', v)
this.$emit("update:name", list?.map(e => e[this.label])?.toString() || "")
this.$emit("list", list)
} }
}, },
created() { created() {