Commit abb327f5 authored by 陈浩玮's avatar 陈浩玮

Merge branch 'feature/chw' into 'master'

角色

See merge request product/kim3-web-vue/starter-web-vue!12
parents 754ac5e9 141d7b38
import { delReq, getReq, postReq } from '@/utils';
import { delReq, getReq, postReq, putReq } from '@/utils';
export function delMenuApi(id) {
return delReq(`/api/v1/menus/${id}`);
......@@ -15,3 +15,6 @@ export function addMenuApi(data) {
export function addRoleApi(data) {
return postReq('/api/v1/roles', data);
}
export function updateRoleApi(data) {
return putReq('/api/v1/roles', data);
}
......@@ -27,7 +27,7 @@ export default {
}
},
setData(data, type) {
this.form = data;
this.form = { ...data };
this.type = type;
},
},
......
......@@ -3,9 +3,9 @@
<template #drawer>
<Form ref="form" />
</template>
<a-table-column title="名称" data-index="roleName" />
<a-table-column title="说明" data-index="remark" />
<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="操作">
<template #default="row">
<a @click="() => view(row, 2)">查看</a>
......@@ -36,7 +36,7 @@ export default {
view(data, type) {
this.$refs['table']?.show({ type });
this.$nextTick(() => {
this.$refs['form'].setData(data, type);
this.$refs['form'].setData({ ...data }, type);
});
},
},
......
<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-input v-model="form.roleName" :disabled="isView" />
</a-form-model-item>
......@@ -18,33 +18,28 @@
<script>
import MenuTree from '@/components/menu_tree/index.vue';
import { addRoleApi } from '@/api';
import FormMixin from '@/components/FormMixin';
import { addRoleApi, updateRoleApi } from '@/api';
export default {
mixins: [FormMixin],
components: { MenuTree },
data() {
return {
type: 0,
form: {},
rules: {},
checkedKeys: [],
};
},
computed: {
isEdit() {
return this.type === 1;
},
isView() {
return this.type === 2;
},
},
computed: {},
methods: {
submit() {
add() {
console.log(1);
return addRoleApi({ ...this.form, authorityList: this.$refs['menuTree'].get() });
},
setData(data, type) {
this.form = data;
this.type = type;
edit() {
console.log(1);
return updateRoleApi({ ...this.form, authorityList: this.$refs['menuTree'].get() });
},
},
};
......
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