123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- <template>
- <BasicTable @register="registerTable">
- <template #toolbar>
- <!-- <a-button type="primary" @click="exportExcel"> 导出1</a-button> -->
- </template>
- <template #href="{ record }">
- <a v-if="record.name" target="_blank" :href="record.share">{{record.name}}</a>
- <span v-else>-</span>
- </template>
- <template #action="{ record }">
- <TableAction
- stopButtonPropagation
- :actions="[
- {
- label: '删除',
- color: 'error',
- ifShow:getCheckPerm('projects-delete'),
- 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 { overallList, overallDelete } from '/@/api/operate';
- import { message } from 'ant-design-vue';
- import { usePermissionStore } from '/@/store/modules/permission';
- 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 permissionStore = usePermissionStore();
- const { getCheckPerm } = permissionStore;
- const columns: BasicColumn[] = [
- {
- title: '作品标题',
- dataIndex: 'name',
- slots: { customRender: 'href' },
- width: 150,
- // customRender: ({ record }) => {
- // return record.name ? h('span', record.name) : '-';
- // },
- },
- {
- title: '作品码',
- dataIndex: 'sceneCodes',
- ellipsis: true,
- width: 180,
- },
- {
- title: '用户账号',
- dataIndex: 'userId',
- width: 100,
- },
- {
- title: '创建时间',
- dataIndex: 'createTime',
- width: 180,
- customRender: ({ record }) => {
- return record.createTime
- ? h(Time, {
- value: record.createTime,
- mode: 'datetime',
- })
- : '-';
- },
- },
- {
- title: '最新编辑时间',
- dataIndex: 'updateTime',
- width: 180,
- customRender: ({ record }) => {
- return record.updateTime
- ? h(Time, {
- value: record.updateTime,
- mode: 'datetime',
- })
- : '-';
- },
- },
- {
- title: '是否加密',
- dataIndex: 'status',
- width: 80,
- customRender: ({ record }) => {
- return record.isCopy ? '是' : '否';
- },
- },
- {
- title: '浏览量',
- dataIndex: 'visit',
- width: 80,
- },
- {
- title: '操作',
- dataIndex: 'action',
- slots: { customRender: 'action' },
- ifShow: true,
- fixed: 'right',
- flag: 'ACTION',
- width: 50,
- },
- ];
- const searchForm: Partial<FormProps> = {
- labelWidth: 100,
- schemas: [
- {
- field: 'sceneName',
- 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: overallList,
- 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);
- overallDelete({ id: record.id })
- .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,
- getCheckPerm,
- };
- },
- });
- </script>
|