123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <template>
- <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 #createTime="{ record }">
- <Time :value="record.createTime" mode="datetime" />
- </template>
- <template #action="{ record }">
- <TableAction
- :actions="[
- {
- icon: 'mdi:information-outline',
- label: t('common.details'),
- onClick: () => {
- go(`/order/list/detail/${record.orderNo}`);
- },
- },
- {
- icon: 'mdi:printer-outline',
- label: t('common.print'),
- color: 'error',
- onClick: () => {
- createMessage.info(t('common.notConnect'));
- },
- },
- ]"
- />
- </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';
- import { Time } from '/@/components/Time';
- // appid: null
- // companyId: 1107
- // companyName: "南山居"
- // createTime: 1644801035000
- // createUser: "11111111111"
- // fdkkPassword: null
- // fdkkUser: null
- // head: null
- // id: 20356
- // memoName: "顶顶顶顶"
- // message: null
- // nickName: "用户13822221234"
- // phone: "13822221234"
- // roleIdList: null
- // roleList: null
- // roleName: "公司员工"
- // state: null
- // token: null
- // type: 1
- // updateTime: 1644801035000
- // updateUser: "11111111111"
- // userName: "13822221234"
- // userPassword: "2a22bac40f44af4d3b5fdc20ea706fc5"
- export default defineComponent({
- components: { BasicTable, TableAction, Time },
- setup() {
- const { createMessage } = useMessage();
- const go = useGo();
- const { t } = useI18n();
- const columns: BasicColumn[] = [
- {
- title: 'ID',
- dataIndex: 'id',
- fixed: 'left',
- width: 60,
- },
- {
- title: t('routes.staff.deptName'),
- dataIndex: 'companyName',
- width: 100,
- },
- {
- title: t('routes.staff.userName'),
- dataIndex: 'userName',
- width: 200,
- },
- {
- title: t('routes.staff.nickName'),
- dataIndex: 'nickName',
- width: 200,
- },
- {
- title: t('common.roleName'),
- dataIndex: 'roleName',
- // slots: { customRender: 'role' },
- sorter: true,
- width: 80,
- },
- // {
- // title: t('common.state'),
- // dataIndex: 'status',
- // slots: { customRender: 'status' },
- // sorter: true,
- // width: 80,
- // },
- {
- title: t('routes.staff.createTime'),
- dataIndex: 'createTime',
- slots: { customRender: 'createTime' },
- width: 130,
- },
- // {
- // title: '操作',
- // dataIndex: '',
- // slots: { customRender: 'action' },
- // fixed: 'right',
- // width: 140,
- // },
- ];
- const searchForm: Partial<FormProps> = {
- labelWidth: 100,
- schemas: [
- {
- field: 'phoneNum',
- label: t('routes.mobile.phone'),
- component: 'Input',
- colProps: {
- xl: 5,
- xxl: 5,
- },
- },
- ],
- };
- const [registerTable] = useTable({
- title: t('routes.staff.staffList'),
- api: ListApi,
- columns: columns,
- useSearchForm: true,
- formConfig: searchForm,
- showTableSetting: true,
- tableSetting: { fullScreen: true },
- showIndexColumn: false,
- rowKey: 'id',
- pagination: { pageSize: 20 },
- ellipsis: false,
- bordered: true,
- });
- function renderRoleType(type: number): string {
- switch (type) {
- case 0:
- return t('routes.staff.roleType.0');
- case 1:
- return t('routes.staff.roleType.1');
- default:
- return '';
- }
- }
- function renderStatus(type: number): string {
- switch (type) {
- case 1:
- return t('common.normal');
- case 0:
- return t('common.unNormal');
- default:
- return '';
- }
- }
- return {
- registerTable,
- createMessage,
- t,
- go,
- renderRoleType,
- renderStatus,
- uploadApi: uploadApi as any,
- };
- },
- });
- </script>
|