123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- <template>
- <BasicTable @register="registerTable">
- <template #toolbar>
- <a-button type="primary" v-if="getCheckPerm('app-add')" @click="()=>{openAddModal(true)}"> 新建</a-button>
- </template>
- <template #action="{ record }">
- <TableAction
- :actions="[
- {
- label: '删除',
- icon: 'ic:outline-delete-outline',
- ifShow: getCheckPerm('app-delete'),
- onClick: handleDelete.bind(null, record),
- },
- ]"
- />
- </template>
- </BasicTable>
- <AddModal @update="reload" @register="registerAddModal" />
- </template>
- <script lang="ts">
- import { defineComponent, h } 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 { AppFileList,AppFileDelete } from '/@/api/product'
- import { useModal } from '/@/components/Modal';
- import AddModal from './AddModal.vue';
- import { usePermissionStore } from '/@/store/modules/permission';
- export default defineComponent({
- components: {
- BasicTable,
- TableAction,
- PageWrapper,
- AddModal,
- TableImg,
- [Descriptions.name]: Descriptions,
- [Descriptions.Item.name]: Descriptions.Item,
- },
- setup() {
- const { t } = useI18n();
- const permissionStore = usePermissionStore();
- const { getCheckPerm } = permissionStore;
- const { createMessage,createConfirm } = useMessage();
- const [registerAddModal, { openModal: openAddModal }] = useModal();
- const columns: BasicColumn[] = [
- {
- title: '上传服务器',
- dataIndex: 'fileServerType',
- ellipsis: false,
- width: 80,
- },
- {
- title: '代理商标识',
- dataIndex: 'agent',
- width: 80,
- },{
- title: 'APP类型',
- dataIndex: 'appType',
- ellipsis: false,
- width: 100,
- },
- {
- title: 'APP包',
- dataIndex: 'name',
- width: 150,
- },{
- title: 'MD5',
- dataIndex: 'md5',
- ellipsis: false,
- width: 250,
- },
- {
- title: '时间',
- dataIndex: 'createTime',
- width: 150,
- customRender: ({ record }) => {
- return (
- record.createTime &&
- h(Time, {
- value: record.createTime,
- mode: 'datetime',
- })
- );
- },
- },
- ];
- const searchForm: Partial<FormProps> = {
- labelWidth: 100,
- schemas: [
- {
- field: 'sceneName',
- label: '开票申请时间',
- component: 'RangePicker',
- componentProps: {
- maxLength: 100,
- },
- colProps: {
- xl: 7,
- xxl: 7,
- },
- },
- {
- field: 'sceneName',
- label: '支付时间',
- component: 'RangePicker',
- componentProps: {
- maxLength: 100,
- },
- colProps: {
- xl: 7,
- xxl: 7,
- },
- },{
- field: 'sceneName',
- label: '订单号',
- component: 'Input',
- componentProps: {
- maxLength: 100,
- },
- colProps: {
- xl: 6,
- xxl: 6,
- },
- }
- ],
- };
- const [registerTable,{reload}] = useTable({
- api: AppFileList,
- title: 'App列表',
- // titleHelpMessage: ['已启用expandRowByClick', '已启用stopButtonPropagation'],
- columns: columns,
- useSearchForm: true,
- formConfig: searchForm,
- showTableSetting: true,
- showIndexColumn:false,
- rowKey: 'id',
- fetchSetting: {
- pageField: 'pageNum',
- sizeField: 'pageSize',
- listField: 'list',
- totalField: 'total',
- },
- actionColumn: {
- width: 100,
- title: '操作',
- dataIndex: 'action',
- slots: { customRender: 'action' },
- },
- canResize: false,
- });
- function handleDelete(record: Recordable) {
- createConfirm({
- iconType: 'warning',
- title: () => h('span', '温馨提示'),
- content: () => h('span', '确定当删除当前记录?'),
- onOk: async () => {
- await AppFileDelete({ id: record.id });
- createMessage.success(t('common.optSuccess'));
- reload();
- },
- });
- }
- function handleOpen(record: Recordable) {
- console.log('点击了启用', record);
- }
- function exportExcel() {
- createConfirm({
- iconType: 'warning',
- title: () => h('span', '温馨提示'),
- content: () => h('span', '确定当前标签下的订单记录?'),
- onOk: async () => {
- await DownExport();
- },
- });
- }
- return {
- registerTable,
- handleDelete,
- handleOpen,
- registerAddModal,
- openAddModal,
- exportExcel,
- reload,
- getCheckPerm,
- };
- },
- });
- </script>
|