整理系统菜单及权限

This commit is contained in:
gxwebsoft
2024-05-01 16:50:27 +08:00
parent ae068890b2
commit 0bf561f544
60 changed files with 4288 additions and 2007 deletions

View File

@@ -0,0 +1,163 @@
<template>
<ele-modal
:width="750"
:visible="visible"
:maskClosable="false"
:title="title"
:body-style="{ paddingBottom: '28px' }"
@update:visible="updateVisible"
@ok="save"
>
<ele-pro-table
ref="tableRef"
row-key="id"
:datasource="datasource"
:columns="columns"
v-model:selection="selection"
:customRow="customRow"
:pagination="false"
>
<template #toolbar>
<a-input-search
allow-clear
v-model:value="searchText"
placeholder="请输入搜索关键词"
style="width: 200px"
@search="reload"
@pressEnter="reload"
/>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'image'">
<a-image
v-if="record.image"
:src="record.image"
:preview="false"
:width="45"
/>
</template>
</template>
</ele-pro-table>
</ele-modal>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import {
ColumnItem,
DatasourceFunction
} from 'ele-admin-pro/es/ele-pro-table/types';
import { pageMerchantAccount } from '@/api/shop/merchantAccount';
import { EleProTable } from 'ele-admin-pro';
import {
MerchantAccount,
MerchantAccountParam
} from '@/api/shop/merchantAccount/model';
import { getMerchantId } from '@/utils/common';
const props = defineProps<{
// 弹窗是否打开
visible: boolean;
// 标题
title?: string;
// 商户类型
shopType?: string;
// 修改回显的数据
data?: MerchantAccount | null;
}>();
const emit = defineEmits<{
(e: 'done', data: MerchantAccount[]): void;
(e: 'update:visible', visible: boolean): void;
}>();
/* 更新visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
// 搜索内容
const searchText = ref(null);
// 表格选中数据
const selection = ref<MerchantAccount[]>([]);
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
// 表格配置
const columns = ref<ColumnItem[]>([
{
title: 'ID',
dataIndex: 'userId',
key: 'userId',
align: 'center',
width: 90
},
{
title: '姓名',
dataIndex: 'realName'
},
{
title: '联系电话',
dataIndex: 'mobile'
},
{
title: '角色',
dataIndex: 'roleName'
}
]);
// 表格数据源
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
where = {};
// 搜索条件
if (searchText.value) {
where.keywords = searchText.value;
}
if (props.shopType == 'empty') {
where.emptyType = true;
} else {
where.shopType = props.shopType;
}
where.merchantId = getMerchantId();
return pageMerchantAccount({
...where,
...orders,
page,
limit
});
};
/* 搜索 */
const reload = (where?: MerchantAccountParam) => {
selection.value = [];
tableRef?.value?.reload({ page: 1, where });
};
// const onRadio = (record: MerchantAccount) => {
// updateVisible(false);
// emit('done', record);
// };
const save = () => {
updateVisible(false);
emit('done', selection.value);
};
/* 自定义行属性 */
const customRow = (record: MerchantAccount) => {
return {
// 行点击事件
// onClick: () => {
// updateVisible(false);
// emit('done', record);
// },
// 行双击事件
onDblclick: () => {
updateVisible(false);
emit('done', [record]);
}
};
};
</script>
<style lang="less"></style>

View File

@@ -0,0 +1,61 @@
<template>
<div>
<a-input-group compact>
<a-input
disabled
style="width: calc(100% - 32px)"
v-model:value="value"
:placeholder="placeholder"
/>
<a-button @click="openEdit">
<template #icon><BulbOutlined class="ele-text-warning" /></template>
</a-button>
</a-input-group>
<!-- 选择弹窗 -->
<SelectData
v-model:visible="showEdit"
:data="current"
:title="placeholder"
:customer-type="customerType"
@done="onChange"
/>
</div>
</template>
<script lang="ts" setup>
import { BulbOutlined } from '@ant-design/icons-vue';
import { ref } from 'vue';
import SelectData from './components/select-data.vue';
import { MerchantAccount } from '@/api/shop/merchantAccount/model';
withDefaults(
defineProps<{
value?: any;
customerType?: string;
placeholder?: string;
}>(),
{
placeholder: '请选择商户成员'
}
);
const emit = defineEmits<{
(e: 'done', MerchantAccount): void;
(e: 'clear'): void;
}>();
// 是否显示编辑弹窗
const showEdit = ref(false);
// 当前编辑数据
const current = ref<MerchantAccount | null>(null);
/* 打开编辑弹窗 */
const openEdit = (row?: MerchantAccount) => {
current.value = row ?? null;
showEdit.value = true;
};
const onChange = (row) => {
emit('done', row);
};
</script>