|
@@ -1,5 +1,165 @@
|
|
|
<template>
|
|
|
- <div> 员工管理 </div>
|
|
|
+ <div class="p-4">
|
|
|
+ <BasicTable @register="registerTable">
|
|
|
+ <template #toolbar> </template>
|
|
|
+ <template #role="{ record }">
|
|
|
+ {{ renderRoleType(record.role) }}
|
|
|
+ </template>
|
|
|
+ <template #status="{ record }">
|
|
|
+ {{ renderStatus(record.status) }}
|
|
|
+ </template>
|
|
|
+ <template #action="{ record }">
|
|
|
+ <TableAction
|
|
|
+ :actions="[
|
|
|
+ {
|
|
|
+ icon: 'mdi:information-outline',
|
|
|
+ label: '详情',
|
|
|
+ onClick: () => {
|
|
|
+ go(`/order/list/detail/${record.orderNo}`);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ icon: 'mdi:printer-outline',
|
|
|
+ label: '打印',
|
|
|
+ color: 'error',
|
|
|
+ onClick: () => {
|
|
|
+ createMessage.info(`暂未接入`);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </BasicTable>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
+<script lang="ts">
|
|
|
+ import { defineComponent } from 'vue';
|
|
|
+ import { BasicTable, useTable, BasicColumn, FormProps, TableAction } from '/@/components/Table';
|
|
|
+ import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
+ import { uploadApi } from '/@/api/sys/upload';
|
|
|
+ // import { Switch } from 'ant-design-vue';
|
|
|
+ // import { h } from 'vue';
|
|
|
+ import { ListApi } from '/@/api/staff/list';
|
|
|
+ import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
+ // import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
|
|
|
+ import { useGo } from '/@/hooks/web/usePage';
|
|
|
|
|
|
-<script lang="ts" setup></script>
|
|
|
+ export default defineComponent({
|
|
|
+ components: { BasicTable, TableAction },
|
|
|
+ setup() {
|
|
|
+ const { createMessage } = useMessage();
|
|
|
+ const go = useGo();
|
|
|
+ const { t } = useI18n();
|
|
|
+ const columns: BasicColumn[] = [
|
|
|
+ {
|
|
|
+ title: 'ID',
|
|
|
+ dataIndex: 'id',
|
|
|
+ fixed: 'left',
|
|
|
+ width: 60,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '所属公司',
|
|
|
+ dataIndex: 'company',
|
|
|
+ width: 160,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '员工名称',
|
|
|
+ dataIndex: 'name',
|
|
|
+ width: 80,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '手机',
|
|
|
+ dataIndex: 'phone',
|
|
|
+ width: 80,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '角色',
|
|
|
+ dataIndex: 'role',
|
|
|
+ slots: { customRender: 'role' },
|
|
|
+ sorter: true,
|
|
|
+ width: 80,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '状态',
|
|
|
+ dataIndex: 'status',
|
|
|
+ slots: { customRender: 'status' },
|
|
|
+ sorter: true,
|
|
|
+ width: 80,
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ title: '创建时间',
|
|
|
+ dataIndex: 'createTime',
|
|
|
+ width: 130,
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // title: '操作',
|
|
|
+ // dataIndex: '',
|
|
|
+ // slots: { customRender: 'action' },
|
|
|
+ // fixed: 'right',
|
|
|
+ // width: 140,
|
|
|
+ // },
|
|
|
+ ];
|
|
|
+
|
|
|
+ const searchForm: Partial<FormProps> = {
|
|
|
+ labelWidth: 100,
|
|
|
+ schemas: [
|
|
|
+ {
|
|
|
+ field: 'phone',
|
|
|
+ label: '手机号',
|
|
|
+ component: 'Input',
|
|
|
+ colProps: {
|
|
|
+ xl: 5,
|
|
|
+ xxl: 5,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+
|
|
|
+ const [registerTable] = useTable({
|
|
|
+ title: '员工列表',
|
|
|
+ api: ListApi,
|
|
|
+ columns: columns,
|
|
|
+ useSearchForm: true,
|
|
|
+ formConfig: searchForm,
|
|
|
+ showTableSetting: true,
|
|
|
+ tableSetting: { fullScreen: true },
|
|
|
+ showIndexColumn: false,
|
|
|
+ rowKey: 'id',
|
|
|
+ pagination: { pageSize: 20 },
|
|
|
+ bordered: true,
|
|
|
+ });
|
|
|
+
|
|
|
+ function renderRoleType(type: number): string {
|
|
|
+ switch (type) {
|
|
|
+ case 0:
|
|
|
+ return '公司管理员';
|
|
|
+ case 1:
|
|
|
+ return '公司员工';
|
|
|
+ default:
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function renderStatus(type: number): string {
|
|
|
+ switch (type) {
|
|
|
+ case 0:
|
|
|
+ return '正常';
|
|
|
+ case 1:
|
|
|
+ return '非正常';
|
|
|
+ default:
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ registerTable,
|
|
|
+ createMessage,
|
|
|
+ t,
|
|
|
+ go,
|
|
|
+ renderRoleType,
|
|
|
+ renderStatus,
|
|
|
+ uploadApi: uploadApi as any,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ });
|
|
|
+</script>
|