优化文件模板
This commit is contained in:
parent
4639cc193c
commit
04ddaefd0c
@ -16,7 +16,7 @@ export const columns = [
|
||||
{
|
||||
title: '模板名称',
|
||||
key: 'title',
|
||||
width: 150,
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
title: '模板编码',
|
||||
@ -53,7 +53,7 @@ export const columns = [
|
||||
{
|
||||
title: '文件路径',
|
||||
key: 'filePath',
|
||||
width: 100,
|
||||
width: 150,
|
||||
render(record) {
|
||||
return h(
|
||||
'a',
|
||||
|
@ -124,16 +124,30 @@
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
||||
title: props.emailId ? '编辑文件模板' : '添加文件模板',
|
||||
subBtuText: '确定',
|
||||
width: 600,
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义数据源
|
||||
*/
|
||||
const typeList = [
|
||||
{ label: '普通邮件', value: 1 },
|
||||
{ label: '图文邮件', value: 2 },
|
||||
{ label: '模板文件', value: 3 },
|
||||
];
|
||||
|
||||
/**
|
||||
* 定义模态
|
||||
*/
|
||||
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
||||
title: props.emailId ? '编辑文件模板' : '添加文件模板',
|
||||
subBtuText: '确定',
|
||||
width: 600,
|
||||
});
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* @param filePath 文件地址
|
||||
* @param fileName 文件名称
|
||||
*/
|
||||
const fileUpload = async (filePath: any, fileName: any) => {
|
||||
formData.filePath = filePath;
|
||||
formData.fileName = fileName;
|
||||
@ -145,6 +159,7 @@
|
||||
);
|
||||
return;
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行提交
|
||||
*/
|
||||
@ -191,7 +206,10 @@
|
||||
setFormData();
|
||||
}
|
||||
});
|
||||
//导出方法
|
||||
|
||||
/**
|
||||
* 定义函数
|
||||
*/
|
||||
defineExpose({
|
||||
openModal,
|
||||
});
|
||||
|
@ -80,7 +80,6 @@
|
||||
const editVisible = ref(false);
|
||||
const emailId = ref(0);
|
||||
const rowKeys = ref([]);
|
||||
const showModal = ref(false);
|
||||
|
||||
/**
|
||||
* 定义查询参数
|
||||
@ -176,6 +175,9 @@
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行注册
|
||||
*/
|
||||
const [register, {}] = useForm({
|
||||
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },
|
||||
labelWidth: 80,
|
||||
@ -191,6 +193,7 @@
|
||||
await nextTick();
|
||||
createModalRef.value.openModal();
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行编辑
|
||||
*/
|
||||
@ -200,6 +203,7 @@
|
||||
await nextTick();
|
||||
createModalRef.value.openModal();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行删除
|
||||
* @param id 参数
|
||||
|
@ -88,7 +88,6 @@
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { useMessage } from 'naive-ui';
|
||||
import { useModal } from '@/components/Modal';
|
||||
import UploadFile from '@/components/Upload/file.vue';
|
||||
|
||||
const emit = defineEmits(['success', 'update:visible']);
|
||||
const formRef = ref();
|
||||
@ -103,7 +102,7 @@
|
||||
code: '',
|
||||
number: '',
|
||||
content: '',
|
||||
type: undefined,
|
||||
type: '',
|
||||
});
|
||||
|
||||
/**
|
||||
@ -121,27 +120,25 @@
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
||||
title: props.messageId ? '编辑文件模板' : '添加文件模板',
|
||||
subBtuText: '确定',
|
||||
width: 600,
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义数据源
|
||||
*/
|
||||
const typeList = [
|
||||
{ label: '系统通知', value: 1 },
|
||||
{ label: '用户私信', value: 2 },
|
||||
{ label: '待办事项', value: 3 },
|
||||
];
|
||||
const fileUpload = async (filePath: any, fileName: any) => {
|
||||
formData.filePath = filePath;
|
||||
formData.fileName = fileName;
|
||||
formRef.value?.validate(
|
||||
(errors) => {},
|
||||
(rule) => {
|
||||
return rule?.key === 'filePath';
|
||||
},
|
||||
);
|
||||
return;
|
||||
};
|
||||
|
||||
/**
|
||||
* 定义模态
|
||||
*/
|
||||
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
||||
title: props.messageId ? '编辑文件模板' : '添加文件模板',
|
||||
subBtuText: '确定',
|
||||
width: 600,
|
||||
});
|
||||
|
||||
/**
|
||||
* 执行提交
|
||||
*/
|
||||
@ -190,7 +187,10 @@
|
||||
setFormData();
|
||||
}
|
||||
});
|
||||
//导出方法
|
||||
|
||||
/**
|
||||
* 定义函数
|
||||
*/
|
||||
defineExpose({
|
||||
openModal,
|
||||
});
|
||||
|
@ -27,7 +27,6 @@
|
||||
</template>
|
||||
新建
|
||||
</n-button>
|
||||
|
||||
<n-button
|
||||
type="error"
|
||||
@click="handleDelete"
|
||||
@ -67,12 +66,13 @@
|
||||
} from '@/api/file/messageTemplate';
|
||||
import { columns } from './columns';
|
||||
import { PlusOutlined, DeleteOutlined, FormOutlined } from '@vicons/antd';
|
||||
import CreateModal from './CreateModal.vue';
|
||||
import editDialog from './edit.vue';
|
||||
import { basicModal, useModal } from '@/components/Modal';
|
||||
import { schemas } from './querySchemas';
|
||||
import { renderIcon } from '@/utils';
|
||||
|
||||
/**
|
||||
* 定义常量
|
||||
*/
|
||||
const message = useMessage();
|
||||
const dialog = useDialog();
|
||||
const basicTableRef = ref();
|
||||
@ -80,14 +80,18 @@
|
||||
const editVisible = ref(false);
|
||||
const messageId = ref(0);
|
||||
const rowKeys = ref([]);
|
||||
const exportLoading = ref(false);
|
||||
|
||||
const showModal = ref(false);
|
||||
/**
|
||||
* 定义查询参数
|
||||
*/
|
||||
const formParams = reactive({
|
||||
title: '',
|
||||
type: '',
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义操作栏
|
||||
*/
|
||||
const actionColumn = reactive({
|
||||
width: 200,
|
||||
title: '操作',
|
||||
@ -117,24 +121,35 @@
|
||||
},
|
||||
});
|
||||
|
||||
function addTable() {
|
||||
showModal.value = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载数据列表
|
||||
*/
|
||||
const loadDataTable = async (res) => {
|
||||
rowKeys.value = [];
|
||||
const result = await getMessageTemplateList({ ...formParams, ...res });
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* 数据行选中事件
|
||||
* @param keys 参数
|
||||
*/
|
||||
function onCheckedRow(keys) {
|
||||
rowKeys.value = keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载数据列表
|
||||
* @param noRefresh 参数
|
||||
*/
|
||||
function reloadTable(noRefresh = '') {
|
||||
basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行提交表单
|
||||
* @param values 参数
|
||||
*/
|
||||
function handleSubmit(values: Recordable) {
|
||||
for (const key in formParams) {
|
||||
formParams[key] = '';
|
||||
@ -145,6 +160,10 @@
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行重置
|
||||
* @param values 参数
|
||||
*/
|
||||
function handleReset(values: Recordable) {
|
||||
for (const key in formParams) {
|
||||
formParams[key] = '';
|
||||
@ -155,6 +174,9 @@
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行注册
|
||||
*/
|
||||
const [register, {}] = useForm({
|
||||
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },
|
||||
labelWidth: 80,
|
||||
@ -170,6 +192,7 @@
|
||||
await nextTick();
|
||||
createModalRef.value.openModal();
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行编辑
|
||||
*/
|
||||
@ -179,6 +202,7 @@
|
||||
await nextTick();
|
||||
createModalRef.value.openModal();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行删除
|
||||
* @param id 参数
|
||||
@ -190,7 +214,9 @@
|
||||
positiveText: '确定',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
record.id ? await messageDelete(record.id) : await messageBatchDelete(rowKeys.value);
|
||||
record.id
|
||||
? await messageTemplateDelete(record.id)
|
||||
: await messageTemplateBatchDelete(rowKeys.value);
|
||||
message.success('删除成功');
|
||||
reloadTable();
|
||||
},
|
||||
|
@ -84,7 +84,6 @@
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { useMessage } from 'naive-ui';
|
||||
import { useModal } from '@/components/Modal';
|
||||
import UploadFile from '@/components/Upload/file.vue';
|
||||
|
||||
const emit = defineEmits(['success', 'update:visible']);
|
||||
const formRef = ref();
|
||||
@ -99,7 +98,7 @@
|
||||
code: '',
|
||||
number: '',
|
||||
content: '',
|
||||
type: undefined,
|
||||
type: '',
|
||||
});
|
||||
|
||||
/**
|
||||
@ -117,27 +116,25 @@
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
||||
title: props.smsId ? '编辑文件模板' : '添加文件模板',
|
||||
subBtuText: '确定',
|
||||
width: 600,
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义数据源
|
||||
*/
|
||||
const typeList = [
|
||||
{ label: '阿里云', value: 1 },
|
||||
{ label: '腾讯云', value: 2 },
|
||||
{ label: '华为云', value: 3 },
|
||||
];
|
||||
const fileUpload = async (filePath: any, fileName: any) => {
|
||||
formData.filePath = filePath;
|
||||
formData.fileName = fileName;
|
||||
formRef.value?.validate(
|
||||
(errors) => {},
|
||||
(rule) => {
|
||||
return rule?.key === 'filePath';
|
||||
},
|
||||
);
|
||||
return;
|
||||
};
|
||||
|
||||
/**
|
||||
* 定义模态
|
||||
*/
|
||||
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
||||
title: props.smsId ? '编辑文件模板' : '添加文件模板',
|
||||
subBtuText: '确定',
|
||||
width: 600,
|
||||
});
|
||||
|
||||
/**
|
||||
* 执行提交
|
||||
*/
|
||||
@ -184,7 +181,10 @@
|
||||
setFormData();
|
||||
}
|
||||
});
|
||||
//导出方法
|
||||
|
||||
/**
|
||||
* 定义函数
|
||||
*/
|
||||
defineExpose({
|
||||
openModal,
|
||||
});
|
||||
|
@ -27,7 +27,6 @@
|
||||
</template>
|
||||
新建
|
||||
</n-button>
|
||||
|
||||
<n-button
|
||||
type="error"
|
||||
@click="handleDelete"
|
||||
@ -67,9 +66,7 @@
|
||||
} from '@/api/file/smsTemplate';
|
||||
import { columns } from './columns';
|
||||
import { PlusOutlined, DeleteOutlined, FormOutlined } from '@vicons/antd';
|
||||
import CreateModal from './CreateModal.vue';
|
||||
import editDialog from './edit.vue';
|
||||
import { basicModal, useModal } from '@/components/Modal';
|
||||
import { schemas } from './querySchemas';
|
||||
import { renderIcon } from '@/utils';
|
||||
|
||||
@ -80,14 +77,19 @@
|
||||
const editVisible = ref(false);
|
||||
const smsId = ref(0);
|
||||
const rowKeys = ref([]);
|
||||
const exportLoading = ref(false);
|
||||
|
||||
const showModal = ref(false);
|
||||
|
||||
/**
|
||||
* 定义查询参数
|
||||
*/
|
||||
const formParams = reactive({
|
||||
title: '',
|
||||
type: '',
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义操作栏
|
||||
*/
|
||||
const actionColumn = reactive({
|
||||
width: 200,
|
||||
title: '操作',
|
||||
@ -117,24 +119,36 @@
|
||||
},
|
||||
});
|
||||
|
||||
function addTable() {
|
||||
showModal.value = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载数据列表
|
||||
* @param res 参数
|
||||
*/
|
||||
const loadDataTable = async (res) => {
|
||||
rowKeys.value = [];
|
||||
const result = await getSmsTemplateList({ ...formParams, ...res });
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* 数据行选中事件
|
||||
* @param keys 参数
|
||||
*/
|
||||
function onCheckedRow(keys) {
|
||||
rowKeys.value = keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新数据列表
|
||||
* @param noRefresh 参数
|
||||
*/
|
||||
function reloadTable(noRefresh = '') {
|
||||
basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行提交表单
|
||||
* @param values 参数
|
||||
*/
|
||||
function handleSubmit(values: Recordable) {
|
||||
for (const key in formParams) {
|
||||
formParams[key] = '';
|
||||
@ -145,6 +159,10 @@
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行重置
|
||||
* @param values 参数
|
||||
*/
|
||||
function handleReset(values: Recordable) {
|
||||
for (const key in formParams) {
|
||||
formParams[key] = '';
|
||||
@ -155,6 +173,9 @@
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行注册
|
||||
*/
|
||||
const [register, {}] = useForm({
|
||||
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },
|
||||
labelWidth: 80,
|
||||
@ -170,6 +191,7 @@
|
||||
await nextTick();
|
||||
createModalRef.value.openModal();
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行编辑
|
||||
*/
|
||||
@ -179,6 +201,7 @@
|
||||
await nextTick();
|
||||
createModalRef.value.openModal();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行删除
|
||||
* @param id 参数
|
||||
@ -190,7 +213,9 @@
|
||||
positiveText: '确定',
|
||||
negativeText: '取消',
|
||||
onPositiveClick: async () => {
|
||||
record.id ? await positionDelete(record.id) : await positionBatchDelete(rowKeys.value);
|
||||
record.id
|
||||
? await smsTemplateDelete(record.id)
|
||||
: await smsTemplateBatchDelete(rowKeys.value);
|
||||
message.success('删除成功');
|
||||
reloadTable();
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user