|
@@ -0,0 +1,258 @@
|
|
|
+<template>
|
|
|
+ <BasicTable @register="registerTable">
|
|
|
+ <template #toolbar>
|
|
|
+ <!-- <a-button type="primary" @click="exportExcel"> 导出1</a-button> -->
|
|
|
+ </template>
|
|
|
+ <template #action="{ record }">
|
|
|
+ <TableAction
|
|
|
+ stopButtonPropagation
|
|
|
+ :actions="[
|
|
|
+ {
|
|
|
+ label: '同屏',
|
|
|
+ icon: 'akar-icons:double-check',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '删除',
|
|
|
+ icon: 'ic:outline-delete-outline',
|
|
|
+ color: 'error',
|
|
|
+ popConfirm: {
|
|
|
+ title: '是否删除?',
|
|
|
+ confirm: handleDelete.bind(null, record),
|
|
|
+ placement: 'topLeft',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </BasicTable>
|
|
|
+</template>
|
|
|
+<script lang="ts">
|
|
|
+ import { defineComponent, h, reactive, toRefs } from 'vue';
|
|
|
+ import {
|
|
|
+ BasicTable,
|
|
|
+ useTable,
|
|
|
+ TableAction,
|
|
|
+ BasicColumn,
|
|
|
+ TableImg,
|
|
|
+ FormProps,
|
|
|
+ } from '/@/components/Table';
|
|
|
+ import { PageWrapper } from '/@/components/Page';
|
|
|
+ import { Time } from '/@/components/Time';
|
|
|
+ import { Descriptions } from 'ant-design-vue';
|
|
|
+ import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
+ import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
+ import { Switch } from 'ant-design-vue';
|
|
|
+ import {
|
|
|
+ operateSceneList,
|
|
|
+ sceneMove,
|
|
|
+ sceneDelete,
|
|
|
+ sceneReset,
|
|
|
+ sceneDownload,
|
|
|
+ sceneCopy,
|
|
|
+ } from '/@/api/operate';
|
|
|
+ import { message } from 'ant-design-vue';
|
|
|
+ export default defineComponent({
|
|
|
+ components: {
|
|
|
+ BasicTable,
|
|
|
+ TableAction,
|
|
|
+ PageWrapper,
|
|
|
+ TableImg,
|
|
|
+ [Descriptions.name]: Descriptions,
|
|
|
+ [Descriptions.Item.name]: Descriptions.Item,
|
|
|
+ },
|
|
|
+ setup() {
|
|
|
+ const { t } = useI18n();
|
|
|
+ const { createMessage, createConfirm } = useMessage();
|
|
|
+
|
|
|
+ const columns: BasicColumn[] = [
|
|
|
+ {
|
|
|
+ title: '场景标题',
|
|
|
+ dataIndex: 'sceneName',
|
|
|
+ width: 150,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '场景码',
|
|
|
+ dataIndex: 'num',
|
|
|
+ ellipsis: false,
|
|
|
+ width: 80,
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ title: 'sn码',
|
|
|
+ dataIndex: 'snCode',
|
|
|
+ width: 180,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '方案标题',
|
|
|
+ dataIndex: 'sceneSize',
|
|
|
+ width: 80,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '发布状态',
|
|
|
+ dataIndex: 'sceneSize',
|
|
|
+ width: 80,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '是否精品',
|
|
|
+ dataIndex: 'isCopy',
|
|
|
+ width: 80,
|
|
|
+ customRender: ({ record }) => {
|
|
|
+ return record.isCopy ? '是' : '否';
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '创建时间',
|
|
|
+ dataIndex: 'copyTime',
|
|
|
+ width: 180,
|
|
|
+ customRender: ({ record }) => {
|
|
|
+ return record.copyTime
|
|
|
+ ? h(Time, {
|
|
|
+ value: record.copyTime,
|
|
|
+ mode: 'datetime',
|
|
|
+ })
|
|
|
+ : '-';
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '最新编辑时间',
|
|
|
+ dataIndex: 'copyTime',
|
|
|
+ width: 180,
|
|
|
+ customRender: ({ record }) => {
|
|
|
+ return record.copyTime
|
|
|
+ ? h(Time, {
|
|
|
+ value: record.copyTime,
|
|
|
+ mode: 'datetime',
|
|
|
+ })
|
|
|
+ : '-';
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '用户账号',
|
|
|
+ dataIndex: 'userName',
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ dataIndex: 'action',
|
|
|
+ slots: { customRender: 'action' },
|
|
|
+ ifShow: true,
|
|
|
+ fixed: 'right',
|
|
|
+ width: 110,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ const searchForm: Partial<FormProps> = {
|
|
|
+ labelWidth: 100,
|
|
|
+ schemas: [
|
|
|
+ {
|
|
|
+ field: 'sceneName',
|
|
|
+ label: '场景标题',
|
|
|
+ component: 'Input',
|
|
|
+ componentProps: {
|
|
|
+ maxLength: 100,
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ xl: 7,
|
|
|
+ xxl: 7,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'snCode',
|
|
|
+ label: '方案名称',
|
|
|
+ component: 'Input',
|
|
|
+ componentProps: {
|
|
|
+ maxLength: 100,
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ xl: 7,
|
|
|
+ xxl: 7,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'userName',
|
|
|
+ label: '用户账号',
|
|
|
+ component: 'Input',
|
|
|
+ componentProps: {
|
|
|
+ maxLength: 100,
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ xl: 6,
|
|
|
+ xxl: 6,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ const [registerTable, { reload }] = useTable({
|
|
|
+ api: operateSceneList,
|
|
|
+ title: '四维深时场景列表',
|
|
|
+ // titleHelpMessage: ['已启用expandRowByClick', '已启用stopButtonPropagation'],
|
|
|
+ columns: columns,
|
|
|
+ searchInfo: { type: 1 },
|
|
|
+ useSearchForm: true,
|
|
|
+ formConfig: searchForm,
|
|
|
+ showTableSetting: true,
|
|
|
+ rowKey: 'num',
|
|
|
+ fetchSetting: {
|
|
|
+ pageField: 'pageNum',
|
|
|
+ sizeField: 'pageSize',
|
|
|
+ listField: 'list',
|
|
|
+ totalField: 'total',
|
|
|
+ },
|
|
|
+ canResize: false,
|
|
|
+ });
|
|
|
+ async function handleDelete(record: Recordable) {
|
|
|
+ console.log('handleDelete', record);
|
|
|
+
|
|
|
+ sceneDelete({ num: record.num })
|
|
|
+ .then(() => {
|
|
|
+ message.success({
|
|
|
+ content: '删除成功',
|
|
|
+ });
|
|
|
+
|
|
|
+ reload();
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ message.success({
|
|
|
+ content: '删除失败',
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ async function handleMove(record: Recordable) {
|
|
|
+ sceneMove({ snCode: record.snCode, num: record.num })
|
|
|
+ .then(() => {
|
|
|
+ message.success({
|
|
|
+ content: '迁移成功',
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ message.success({
|
|
|
+ content: '迁移失败',
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ function handleDownload(record: Recordable) {
|
|
|
+ console.log('handleDownload', record);
|
|
|
+ }
|
|
|
+ function handleReset(record: Recordable) {
|
|
|
+ console.log('handleReset', record);
|
|
|
+ }
|
|
|
+ // function exportExcel() {
|
|
|
+ // createConfirm({
|
|
|
+ // iconType: 'warning',
|
|
|
+ // title: () => h('span', '温馨提示'),
|
|
|
+ // content: () => h('span', '确定当前标签下的订单记录?'),
|
|
|
+ // onOk: async () => {
|
|
|
+ // // await DownExport();
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ return {
|
|
|
+ registerTable,
|
|
|
+ handleDelete,
|
|
|
+ handleMove,
|
|
|
+ handleDownload,
|
|
|
+ handleReset,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ });
|
|
|
+</script>
|