|
|
@@ -0,0 +1,185 @@
|
|
|
+<template>
|
|
|
+ <PageWrapper contentClass="testPageWrapper">
|
|
|
+ <BasicTable @register="registerTable">
|
|
|
+ <template #action="{ record }">
|
|
|
+ <TableAction
|
|
|
+ :actions="[
|
|
|
+ {
|
|
|
+ label: '差分账号授权',
|
|
|
+ ifShow: getCheckPerm('difference-Add'),
|
|
|
+ onClick: handleAuthorize.bind(null, record),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '授权记录',
|
|
|
+ ifShow: getCheckPerm('difference-loglist'),
|
|
|
+ onClick: handleLogList.bind(null, record, 'edit'),
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </BasicTable>
|
|
|
+ <AddModal @register="register" @update="reload" />
|
|
|
+ <logListModal @register="registerlogLis" @update="reload" />
|
|
|
+ </PageWrapper>
|
|
|
+</template>
|
|
|
+<script lang="ts">
|
|
|
+ import { defineComponent, h, ref } from 'vue';
|
|
|
+ import { BasicTable, useTable, FormProps, TableAction } from '/@/components/Table';
|
|
|
+ import { PageWrapper } from '/@/components/Page';
|
|
|
+ import { rtkDeviceList, rtkDevicedel, rtkAccountdel } from '/@/api/rtk';
|
|
|
+ import { useModal } from '/@/components/Modal';
|
|
|
+ import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
+ import { copyTextToClipboard } from '/@/hooks/web/useCopyToClipboard';
|
|
|
+ import AddModal from './modal/difference/AddModal.vue';
|
|
|
+ import logListModal from './modal/difference/logListModal.vue';
|
|
|
+ import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
+ import { usePermissionStore } from '/@/store/modules/permission';
|
|
|
+ import { rtkdeviceColumns } from './data';
|
|
|
+ export default defineComponent({
|
|
|
+ components: {
|
|
|
+ BasicTable,
|
|
|
+ AddModal,
|
|
|
+ logListModal,
|
|
|
+ PageWrapper,
|
|
|
+ TableAction,
|
|
|
+ },
|
|
|
+ setup() {
|
|
|
+ const { t } = useI18n();
|
|
|
+ const activeKey = ref(0);
|
|
|
+ const { createMessage, createConfirm } = useMessage();
|
|
|
+ const permissionStore = usePermissionStore();
|
|
|
+ const { getCheckPerm } = permissionStore;
|
|
|
+ const [register, { openModal }] = useModal();
|
|
|
+ const [registerlogLis, { openModal: openlogLisModal }] = useModal();
|
|
|
+
|
|
|
+ const searchForm: Partial<FormProps> = {
|
|
|
+ labelWidth: 100,
|
|
|
+ autoSubmitOnEnter: true,
|
|
|
+ schemas: [
|
|
|
+ {
|
|
|
+ field: 'cameraSn',
|
|
|
+ label: '相机Sn',
|
|
|
+ component: 'Input',
|
|
|
+ colProps: {
|
|
|
+ xl: 8,
|
|
|
+ xxl: 8,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'rtkSnCode',
|
|
|
+ label: '板卡SN号',
|
|
|
+ component: 'Input',
|
|
|
+ colProps: {
|
|
|
+ xl: 8,
|
|
|
+ xxl: 8,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'sgRtkSn',
|
|
|
+ label: '深光rtk插件SN号',
|
|
|
+ labelWidth: 140,
|
|
|
+ component: 'Input',
|
|
|
+ colProps: {
|
|
|
+ xl: 8,
|
|
|
+ xxl: 8,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ const [registerTable, { reload }] = useTable({
|
|
|
+ api: rtkDeviceList,
|
|
|
+ title: 'RTK设备列表',
|
|
|
+ columns: rtkdeviceColumns,
|
|
|
+ useSearchForm: true,
|
|
|
+ showIndexColumn: false,
|
|
|
+ formConfig: searchForm,
|
|
|
+ showTableSetting: true,
|
|
|
+ searchInfo: {
|
|
|
+ accountType: 2,
|
|
|
+ },
|
|
|
+ fetchSetting: {
|
|
|
+ pageField: 'pageNum',
|
|
|
+ sizeField: 'pageSize',
|
|
|
+ listField: 'list',
|
|
|
+ totalField: 'total',
|
|
|
+ },
|
|
|
+ actionColumn: {
|
|
|
+ width: 180,
|
|
|
+ title: '操作',
|
|
|
+ dataIndex: 'action',
|
|
|
+ slots: { customRender: 'action' },
|
|
|
+ },
|
|
|
+ rowKey: 'id',
|
|
|
+ canResize: false,
|
|
|
+ });
|
|
|
+ async function handleDelete(record) {
|
|
|
+ createConfirm({
|
|
|
+ iconType: 'warning',
|
|
|
+ title: () => h('span', '温馨提示'),
|
|
|
+ content: () => h('span', '确定要删除吗?'),
|
|
|
+ onOk: async () => {
|
|
|
+ let apiUrl = activeKey.value == 0 ? rtkDevicedel : rtkAccountdel;
|
|
|
+ await apiUrl({ id: record.id });
|
|
|
+ reload();
|
|
|
+ createMessage.success(t('common.optSuccess'));
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ function handleCopy(str: string) {
|
|
|
+ copyTextToClipboard(str);
|
|
|
+ createMessage.success('复制成功');
|
|
|
+ }
|
|
|
+ function changeTable(val: number) {
|
|
|
+ activeKey.value = val;
|
|
|
+ // reload();
|
|
|
+ }
|
|
|
+ function handleActive(record) {
|
|
|
+ createConfirm({
|
|
|
+ iconType: 'warning',
|
|
|
+ title: () => h('span', '温馨提示'),
|
|
|
+ content: () => h('span', `确定要${record.status ? '禁用' : '激活'}吗?`),
|
|
|
+ onOk: async () => {
|
|
|
+ await activation({ id: record.id, status: record.status ? 0 : 1 });
|
|
|
+ reload();
|
|
|
+ createMessage.success(t('common.optSuccess'));
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ function handleAuthorize(record) {
|
|
|
+ openModal(true, record);
|
|
|
+ }
|
|
|
+ function handleLogList(record) {
|
|
|
+ openlogLisModal(true, record);
|
|
|
+ }
|
|
|
+ function handleEdit(record = {}) {
|
|
|
+ openModal(true, {
|
|
|
+ ...record,
|
|
|
+ accountType: record.rtkType == 0 ? 0 : record.accountType,
|
|
|
+ authorizeTime: `${record.authorizeTime || '10'}_${record.authorizeTimeUnit || '1'}`,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ function handleuserEdit(record = {}) {
|
|
|
+ openModal1(true, {
|
|
|
+ ...record,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ activeKey,
|
|
|
+ registerTable,
|
|
|
+ openlogLisModal,
|
|
|
+ handleAuthorize,
|
|
|
+ handleLogList,
|
|
|
+ handleCopy,
|
|
|
+ handleDelete,
|
|
|
+ reload,
|
|
|
+ register,
|
|
|
+ registerlogLis,
|
|
|
+ handleActive,
|
|
|
+ getCheckPerm,
|
|
|
+ handleEdit,
|
|
|
+ handleuserEdit,
|
|
|
+ changeTable,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ });
|
|
|
+</script>
|