Commit 8df0af8f authored by 水落(YangLei)'s avatar 水落(YangLei)

feat: 菜单管理新增组件完成

parent 527507a8
......@@ -2,5 +2,6 @@ import Table from './table/index.vue';
import WhiteCard from './white_card/index.vue';
import Upload from './upload/index.vue';
import MyFormItem from './table/my_item.vue';
import ActionButoon from './action_button/index.vue';
export { Table, WhiteCard, Upload, MyFormItem };
export { Table, WhiteCard, Upload, MyFormItem, ActionButoon };
<template>
<div>
<Drawer />
<Table>
<template #search="query">
<slot name="search" :query="query" />
</template>
<slot name="table" />
</Table>
</div>
</template>
<script>
import Table from './table.vue';
import Drawer from './drawer.vue';
export default {
components: { Table, Drawer },
};
</script>
......@@ -8,7 +8,8 @@
ref="table"
>
<template #drawer>
<Form ref="addForm" />
<AddCom v-if="addCom" />
<Form ref="addForm" v-else />
</template>
<a-table-column title="名称" data-index="menuName" />
......@@ -18,9 +19,7 @@
<a-table-column title="模块URL" data-index="menuUrl" />
<a-table-column title="操作">
<template #default="row">
<a @click="() => edit(row)">编辑</a>
<a-divider type="vertical" />
<PopconfirmDelete :url="`/api/v1/menus/${row.menuId}`" :cb="refreshTable" />
<my-ac-btn :row="row" :buttons="buttons" />
</template>
</a-table-column>
</my-table>
......@@ -28,21 +27,37 @@
<script>
import { convertListToTree } from '@/utils';
import PopconfirmDelete from '@/components/popconfirm_delete/index.vue';
import Form from './form.vue';
import AddCom from './add_com.vue';
export default {
data: vm => ({
addCom: false,
addBtn: {
text: '新建',
onOk() {
return vm.$refs['addForm']?.submit();
},
onCancel() {
vm.addCom = false;
},
},
sortOrder: 'ascend',
buttons: [
{
label: '新增组件',
click() {
vm.show();
vm.addCom = true;
},
isHidden: row => row.menuType === 'MENU',
},
{ label: '编辑', click: vm.edit },
{ type: 'confirm', url: row => `/api/v1/menus/${row.menuId}`, after: vm.refreshTable },
],
}),
components: { PopconfirmDelete, Form },
components: { Form, AddCom },
methods: {
formatData: convertListToTree,
......@@ -58,6 +73,9 @@ export default {
this.$refs['addForm'].setEdit({ ...data });
});
},
show() {
this.$refs['table'].show();
},
},
};
</script>
<template>
<h1>addCom</h1>
</template>
import VueI18nPlugin from './vueI18nPlugin';
import AuthorityPlugin from './authorityPlugin';
import TabsPagePlugin from './tabsPagePlugin';
import { Table, WhiteCard, Upload, MyFormItem } from '@/components';
import { Table, WhiteCard, Upload, MyFormItem, ActionButoon } from '@/components';
const Plugins = {
install: function(Vue) {
......@@ -12,6 +12,7 @@ const Plugins = {
Vue.component('my-card', WhiteCard);
Vue.component('my-upload', Upload);
Vue.component('my-form-item', MyFormItem);
Vue.component('my-ac-btn', ActionButoon);
},
};
export default Plugins;
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