123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- <template>
- <div>
- <BasicTable @register="registerTable">
- <template #toolbar>
- <a-button type="primary" @click="handleEdit" v-if="getCheckPerm('dealer-export')"
- >授权</a-button
- >
- </template>
- <template #action="{ record }">
- <TableAction
- :actions="[
- {
- label: '编辑',
- //ifShow: getCheckPerm('account-equityEdit'),
- onClick: handleEdit.bind(null, record),
- },
- {
- label: '删除',
- color: 'error',
- //ifShow: getCheckPerm('account-equityDelete'),
- onClick: handleDelete.bind(null, record),
- },
- ]"
- />
- </template>
- </BasicTable>
- <AddModal @register="register" @update="reload" />
- </div>
- </template>
- <script lang="ts">
- import { defineComponent, h } from 'vue';
- import {
- BasicTable,
- useTable,
- TableAction,
- BasicColumn,
- FormProps,
- } from '/@/components/Table';
- import {
- authorizeInstallList,
- authorizeInstalldelete,
- } from '/@/api/authorizeModeling';
- import { useModal } from '/@/components/Modal';
- import { useI18n } from '/@/hooks/web/useI18n';
- import AddModal from './AddInstallModal.vue';
- import { useMessage } from '/@/hooks/web/useMessage';
- import { usePermissionStore } from '/@/store/modules/permission';
- import { incrementUseTypeList } from '/@/api/account';
- export default defineComponent({
- components: {
- BasicTable,
- AddModal,
- TableAction,
- },
- setup() {
- const { t } = useI18n();
- const { createMessage, createConfirm } = useMessage();
- const permissionStore = usePermissionStore();
- const { getCheckPerm } = permissionStore;
- const [register, { openModal }] = useModal();
- const columns: BasicColumn[] = [
- {
- title: '客户名称',
- dataIndex: 'customerName',
- ellipsis: true,
- width: 250,
- },
- {
- title: '客户类别',
- dataIndex: 'customerType',
- ellipsis: true,
- width: 80,
- customRender: ({ record }) => {
- return record.customerType == 1 ? '经销' : '直销';
- },
- },
- {
- title: '终端客户',
- ellipsis: true,
- dataIndex: 'endCustomer',
- width: 120,
- },
- {
- title: '使用类型',
- ellipsis: true,
- dataIndex: 'useTypeStr',
- width: 120,
- },
- {
- title: '项目号',
- ellipsis: true,
- dataIndex: 'projectNum',
- width: 120,
- },
- {
- title: '设备UUID',
- ellipsis: true,
- dataIndex: 'machineUuid',
- width: 120,
- },
- {
- title: '设备名称',
- ellipsis: true,
- dataIndex: 'machineName',
- width: 120,
- },
- {
- title: '安装Key',
- ellipsis: true,
- dataIndex: 'authorizeKey',
- width: 120,
- },
- {
- title: '备注',
- ellipsis: true,
- dataIndex: 'authorizeTime',
- width: 120,
- },
- {
- title: '创建人',
- ellipsis: true,
- dataIndex: 'sysUserName',
- width: 120,
- },
- {
- title: '创建时间',
- ellipsis: true,
- dataIndex: 'createTime',
- width: 160,
- },
- ];
- const searchForm: Partial<FormProps> = {
- labelWidth: 100,
- autoSubmitOnEnter: true,
- schemas: [
- {
- field: 'customerName',
- label: '客户名称',
- component: 'Input',
- colProps: {
- xl: 8,
- xxl: 8,
- },
- },
- {
- field: 'customerType',
- label: '客户类别',
- component: 'Select',
- componentProps: {
- options: [
- {
- label: '直销',
- value: 0,
- key: '0',
- },
- {
- label: '经销',
- value: 1,
- key: '1',
- },
- ],
- },
- colProps: {
- xl: 8,
- xxl: 8,
- },
- },
- {
- field: 'useType',
- label: '使用类型',
- component: 'ApiSelect',
- componentProps: {
- api: incrementUseTypeList,
- labelField: 'name',
- valueField: 'id',
- immediate: true,
- },
- colProps: {
- xl: 8,
- xxl: 8,
- },
- },
- {
- field: 'machineUuid',
- label: '设备UUID',
- component: 'Input',
- colProps: {
- xl: 8,
- xxl: 8,
- },
- },
- {
- field: 'machineCode',
- label: '安装授权Key',
- component: 'Input',
- colProps: {
- xl: 8,
- xxl: 8,
- },
- },
- ],
- };
- const [registerTable, { reload }] = useTable({
- api: authorizeInstallList,
- title: '本地版安装授权',
- columns: columns,
- useSearchForm: true,
- formConfig: searchForm,
- showTableSetting: true,
- showIndexColumn: false,
- fetchSetting: {
- pageField: 'pageNum',
- sizeField: 'pageSize',
- listField: 'list',
- totalField: 'total',
- },
- actionColumn: {
- width: 100,
- title: '操作',
- dataIndex: 'action',
- slots: { customRender: 'action' },
- },
- rowKey: 'id',
- canResize: true,
- });
- async function handleDelete(record) {
- createConfirm({
- iconType: 'warning',
- title: () => h('span', '温馨提示'),
- content: () => h('span', '确定要删除授权吗?'),
- onOk: async () => {
- await authorizeInstalldelete({ id: record.id });
- reload();
- createMessage.success(t('common.optSuccess'));
- },
- });
- }
- function handleEdit(record = {}) {
- openModal(true, record);
- }
- return {
- registerTable,
- handleDelete,
- reload,
- register,
- getCheckPerm,
- handleEdit,
- };
- },
- });
- </script>
|