diff --git a/src/api/platform/common/entity/pushRingtone.ts b/src/api/platform/common/entity/pushRingtone.ts index a6b9901..a341702 100644 --- a/src/api/platform/common/entity/pushRingtone.ts +++ b/src/api/platform/common/entity/pushRingtone.ts @@ -6,7 +6,7 @@ export type PushRingtoneParams = Page & PushRingtone; export interface PushRingtone extends CommonEntity { id: string; name: string; - ringtone: string; + ringtone: string | string[]; [key:string]: any; } diff --git a/src/views/common/push/pushRingtone/RingtoneModal.vue b/src/views/common/push/pushRingtone/RingtoneModal.vue new file mode 100644 index 0000000..6ed2da5 --- /dev/null +++ b/src/views/common/push/pushRingtone/RingtoneModal.vue @@ -0,0 +1,76 @@ + + diff --git a/src/views/common/push/pushRingtone/file.data.ts b/src/views/common/push/pushRingtone/file.data.ts deleted file mode 100644 index c27e691..0000000 --- a/src/views/common/push/pushRingtone/file.data.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @program: kicc-ui - * @description: 文件模块动态渲染配置 - * @author: entfrm开发团队-王翔 - * @create: 2022/4/21 - */ - -import { BasicColumn } from '/@/components/Table'; -import { FormSchema } from '/@/components/Table'; -import { getFileSize } from '/@/utils/file/download'; - -/** 表格列配置 */ -export const columns: BasicColumn[] = [ - { - title: '源文件名称', - dataIndex: 'original' - }, - { - title: '空间名称', - dataIndex: 'bucketName' - }, - { - title: '文件名称', - dataIndex: 'fileName' - }, - { - title: '文件类型', - dataIndex: 'type' - }, - { - title: '文件大小', - dataIndex: 'fileSize', - customRender: ({ record }) => getFileSize(record.fileSize) - }, - { - title: '上传人', - dataIndex: 'createByName' - }, - { - title: '创建时间', - dataIndex: 'createTime' - } -]; - -/** 搜索表单配置 */ -export const searchFormSchema: FormSchema[] = [ - { - field: 'fileName', - label: '文件名称', - component: 'Input', - componentProps: { - placeholder: '请输入文件名称', - }, - colProps: { span: 6 } - } -]; diff --git a/src/views/common/push/pushRingtone/index.vue b/src/views/common/push/pushRingtone/index.vue index dbb2c58..b036238 100644 --- a/src/views/common/push/pushRingtone/index.vue +++ b/src/views/common/push/pushRingtone/index.vue @@ -5,44 +5,41 @@ @selection-change="handleSelectionChange" > - @@ -55,20 +52,16 @@ */ import { reactive, toRaw } from 'vue'; import { BasicTable, useTable, TableAction } from '/@/components/Table'; - import { getFile } from '/@/api/platform/system/controller/file'; - import { columns, searchFormSchema } from './file.data'; + import { listPushRingtone, delPushRingtone } from '/@/api/platform/common/controller/pushRingtone'; + import { useModal } from '/@/components/Modal'; + import RingtoneModal from './RingtoneModal.vue'; + import { columns, searchFormSchema } from './ringtone.data'; import { useMessage } from '/@/hooks/web/useMessage'; - import { commonUpload, delPushFile, listPushFile } from '/@/api/platform/common/controller/pushFile'; - import { BasicUpload } from '/@/components/Upload'; - import { useUserStore } from '/@/store/modules/user'; - const userStore = useUserStore(); - const userInfoStore = userStore.getUserInfo; /** 类型规范统一声明定义区域 */ interface TableState { single: boolean; multiple: boolean; - fileList: Recordable[]; } /** 通用变量统一声明区域 */ @@ -76,14 +69,13 @@ // 非单个禁用 single: true, // 非多个禁用 - multiple: true, - // 文件列表 - fileList: [] + multiple: true }); const { createConfirm, createMessage } = useMessage(); + const [registerModal, { openModal }] = useModal(); const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({ - title: '推送文件列表', - api: listPushFile, + title: '在线铃声列表', + api: listPushRingtone, rowKey: 'id', columns, formConfig: { @@ -104,12 +96,8 @@ width: 220, title: '操作', dataIndex: 'action', - slots: { customRender: 'action' }, fixed: false }, - searchInfo: { - createById: userInfoStore.id - }, handleSearchInfoFn: () => clearSelectedRowKeys() }); @@ -120,15 +108,15 @@ state.multiple = !rowSelection.length; } - /** 处理上传成功保存回调 */ - function handleUploadSave(fileList: string[]) { - state.fileList = []; - handleRefreshTable(); + /** 新增按钮操作,行内新增与工具栏局域新增通用 */ + function handleAdd() { + openModal(true,{ _tag: 'add' }); } - /** 处理行内文件下载 */ - function handleFileDownLoad(record?: Recordable) { - getFile(record?.bucketName, record?.fileName).then(() => createMessage.success(`${record?.fileName}文件下载成功!`)); + /** 编辑按钮操作,行内编辑 */ + function handleEdit(record?: Recordable) { + record = record || { id: getSelectRowKeys() }; + openModal(true, { _tag: 'edit', record }); } /** 删除按钮操作,行内删除 */ @@ -137,9 +125,9 @@ createConfirm({ iconType: 'warning', title: '警告', - content: `是否确认删除文件编号为${ids}文件吗?`, + content: `是否确认删除编号为${ids}的数据?`, onOk: async () => { - await delPushFile(ids); + await delPushRingtone(ids); createMessage.success('删除成功!'); handleRefreshTable(); } diff --git a/src/views/common/push/pushRingtone/ringtone.data.ts b/src/views/common/push/pushRingtone/ringtone.data.ts new file mode 100644 index 0000000..31ad939 --- /dev/null +++ b/src/views/common/push/pushRingtone/ringtone.data.ts @@ -0,0 +1,94 @@ +import { BasicColumn } from '/@/components/Table'; +import { FormSchema } from '/@/components/Table'; +import { h } from 'vue'; +import { Tag } from 'ant-design-vue'; +import { commonUpload } from '/@/api/platform/core/controller/upload'; + +/** 表格列配置 */ +export const columns: BasicColumn[] = [ + { + title: '铃声名称', + dataIndex: 'name' + }, + { + title: '铃声地址', + dataIndex: 'ringtone' + }, + { + title: '创建人', + dataIndex: 'createByName' + }, + { + title: '创建时间', + dataIndex: 'createTime', + width: 200 + }, + { + title: '备注', + dataIndex: 'remarks', + width: 200, + customRender: ({record}) => { + return record.remarks || h(Tag, { color: 'red' }, () => '暂无数据'); + } + } +]; + +/** 搜索表单配置 */ +export const searchFormSchema: FormSchema[] = [ + { + field: 'name', + label: '铃声名称', + component: 'Input', + componentProps: { + placeholder: '请输入铃声名称', + }, + colProps: { span: 6 } + } +]; + +/** 表单配置 */ +export const formSchema: FormSchema[] = [ + { + field: 'id', + label: 'ID', + component: 'Input', + show: false + }, + { + field: 'name', + label: '铃声名称', + component: 'Input', + required: true, + colProps: { + span: 12 + } + }, + { + field: 'ringtone', + label: '上传铃声', + component: 'Upload', + required: true, + componentProps: { + multiple: false, + maxSize: 20, + maxNumber: 1, + showUploadSaveBtn: true, + showPreviewNumber: true, + emptyHidePreview: true, + api: commonUpload, + accept: ['audio/*'] + } + }, + { + label: '备注', + field: 'remarks', + component: 'InputTextArea', + componentProps: { + rows: 6 + }, + colProps: { + span: 24 + } + } +]; +