Commit a5b6726e authored by 水落(YangLei)'s avatar 水落(YangLei)

Merge branch 'master' into feature/shuiluo

parents 30a50196 abb327f5
...@@ -27,7 +27,7 @@ export default { ...@@ -27,7 +27,7 @@ export default {
} }
}, },
setData(data, type) { setData(data, type) {
this.form = data; this.form = { ...data };
this.type = type; this.type = type;
}, },
}, },
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
<template #drawer> <template #drawer>
<Form ref="form" /> <Form ref="form" />
</template> </template>
<a-table-column title="角色名称" data-index="roleName" />
<a-table-column title="名称" data-index="roleName" /> <a-table-column title="角色编码" data-index="roleCode" />
<a-table-column title="说明" data-index="remark" /> <a-table-column title="角色说明" data-index="remark" />
<a-table-column title="操作"> <a-table-column title="操作">
<template #default="row"> <template #default="row">
<a @click="() => view(row, 2)">查看</a> <a @click="() => view(row, 2)">查看</a>
...@@ -36,7 +36,7 @@ export default { ...@@ -36,7 +36,7 @@ export default {
view(data, type) { view(data, type) {
this.$refs['table']?.show({ type }); this.$refs['table']?.show({ type });
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['form'].setData(data, type); this.$refs['form'].setData({ ...data }, type);
}); });
}, },
}, },
......
<template> <template>
<a-form-model layout="vertical" :model="form" :rules="rules"> <a-form-model layout="vertical" :model="form" :rules="rules" ref="DrawerForm">
<a-form-model-item label="角色名称"> <a-form-model-item label="角色名称">
<a-input v-model="form.roleName" :disabled="isView" /> <a-input v-model="form.roleName" :disabled="isView" />
</a-form-model-item> </a-form-model-item>
...@@ -25,30 +25,23 @@ ...@@ -25,30 +25,23 @@
<script> <script>
import MenuTree from '@/components/menu_tree/index.vue'; import MenuTree from '@/components/menu_tree/index.vue';
import { addRoleApi, getRoleApi, updateRoleApi } from '@/api'; import { addRoleApi, getRoleApi, updateRoleApi } from '@/api';
import FormMixin from '@/components/FormMixin';
export default { export default {
mixins: [FormMixin],
components: { MenuTree }, components: { MenuTree },
data() { data() {
return { return {
type: 0,
form: {}, form: {},
rules: {}, rules: {},
checkedKeys: [], checkedKeys: [],
defaultCheckedKeys: [], defaultCheckedKeys: [],
}; };
}, },
computed: { computed: {},
isEdit() {
return this.type === 1;
},
isView() {
return this.type === 2;
},
},
methods: { methods: {
submit() { submit() {
const query = { ...this.form, authorityList: this.$refs['menuTree'].get() }; const query = { ...this.form, authorityList: this.$refs['menuTree'].get() };
console.log(query);
return this.isEdit ? updateRoleApi(query) : addRoleApi(query); return this.isEdit ? updateRoleApi(query) : addRoleApi(query);
}, },
setData(data, type) { setData(data, type) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment