优化文件模板
This commit is contained in:
parent
769f016ad0
commit
4639cc193c
@ -27,7 +27,6 @@
|
|||||||
</template>
|
</template>
|
||||||
新建
|
新建
|
||||||
</n-button>
|
</n-button>
|
||||||
|
|
||||||
<n-button
|
<n-button
|
||||||
type="error"
|
type="error"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
@ -67,12 +66,13 @@
|
|||||||
} from '@/api/file/emailTemplate';
|
} from '@/api/file/emailTemplate';
|
||||||
import { columns } from './columns';
|
import { columns } from './columns';
|
||||||
import { PlusOutlined, DeleteOutlined, FormOutlined } from '@vicons/antd';
|
import { PlusOutlined, DeleteOutlined, FormOutlined } from '@vicons/antd';
|
||||||
import CreateModal from './CreateModal.vue';
|
|
||||||
import editDialog from './edit.vue';
|
import editDialog from './edit.vue';
|
||||||
import { basicModal, useModal } from '@/components/Modal';
|
|
||||||
import { schemas } from './querySchemas';
|
import { schemas } from './querySchemas';
|
||||||
import { renderIcon } from '@/utils';
|
import { renderIcon } from '@/utils';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义常量
|
||||||
|
*/
|
||||||
const message = useMessage();
|
const message = useMessage();
|
||||||
const dialog = useDialog();
|
const dialog = useDialog();
|
||||||
const basicTableRef = ref();
|
const basicTableRef = ref();
|
||||||
@ -80,14 +80,19 @@
|
|||||||
const editVisible = ref(false);
|
const editVisible = ref(false);
|
||||||
const emailId = ref(0);
|
const emailId = ref(0);
|
||||||
const rowKeys = ref([]);
|
const rowKeys = ref([]);
|
||||||
const exportLoading = ref(false);
|
|
||||||
|
|
||||||
const showModal = ref(false);
|
const showModal = ref(false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义查询参数
|
||||||
|
*/
|
||||||
const formParams = reactive({
|
const formParams = reactive({
|
||||||
title: '',
|
title: '',
|
||||||
type: '',
|
type: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义操作栏
|
||||||
|
*/
|
||||||
const actionColumn = reactive({
|
const actionColumn = reactive({
|
||||||
width: 200,
|
width: 200,
|
||||||
title: '操作',
|
title: '操作',
|
||||||
@ -117,24 +122,36 @@
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function addTable() {
|
/**
|
||||||
showModal.value = true;
|
* 加载数据列表
|
||||||
}
|
* @param res 参数
|
||||||
|
*/
|
||||||
const loadDataTable = async (res) => {
|
const loadDataTable = async (res) => {
|
||||||
rowKeys.value = [];
|
rowKeys.value = [];
|
||||||
const result = await getEmailTemplateList({ ...formParams, ...res });
|
const result = await getEmailTemplateList({ ...formParams, ...res });
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*数据行选中事件
|
||||||
|
* @param keys 参数
|
||||||
|
*/
|
||||||
function onCheckedRow(keys) {
|
function onCheckedRow(keys) {
|
||||||
rowKeys.value = keys;
|
rowKeys.value = keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新数据列表
|
||||||
|
* @param noRefresh 参数
|
||||||
|
*/
|
||||||
function reloadTable(noRefresh = '') {
|
function reloadTable(noRefresh = '') {
|
||||||
basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行提交表单
|
||||||
|
* @param values 参数
|
||||||
|
*/
|
||||||
function handleSubmit(values: Recordable) {
|
function handleSubmit(values: Recordable) {
|
||||||
for (const key in formParams) {
|
for (const key in formParams) {
|
||||||
formParams[key] = '';
|
formParams[key] = '';
|
||||||
@ -145,6 +162,10 @@
|
|||||||
reloadTable();
|
reloadTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行重置
|
||||||
|
* @param values 参数
|
||||||
|
*/
|
||||||
function handleReset(values: Recordable) {
|
function handleReset(values: Recordable) {
|
||||||
for (const key in formParams) {
|
for (const key in formParams) {
|
||||||
formParams[key] = '';
|
formParams[key] = '';
|
||||||
|
@ -99,12 +99,21 @@
|
|||||||
default: 0,
|
default: 0,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义模态
|
||||||
|
*/
|
||||||
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
||||||
title: props.fileId ? '编辑文件模板' : '添加文件模板',
|
title: props.fileId ? '编辑文件模板' : '添加文件模板',
|
||||||
subBtuText: '确定',
|
subBtuText: '确定',
|
||||||
width: 600,
|
width: 600,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
*上传文件
|
||||||
|
* @param filePath 文件路径
|
||||||
|
* @param fileName 文件名称
|
||||||
|
*/
|
||||||
const fileUpload = async (filePath: any, fileName: any) => {
|
const fileUpload = async (filePath: any, fileName: any) => {
|
||||||
formData.filePath = filePath;
|
formData.filePath = filePath;
|
||||||
formData.fileName = fileName;
|
formData.fileName = fileName;
|
||||||
@ -116,6 +125,7 @@
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行提交
|
* 执行提交
|
||||||
*/
|
*/
|
||||||
@ -162,7 +172,10 @@
|
|||||||
setFormData();
|
setFormData();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//导出方法
|
|
||||||
|
/**
|
||||||
|
* 定义函数
|
||||||
|
*/
|
||||||
defineExpose({
|
defineExpose({
|
||||||
openModal,
|
openModal,
|
||||||
});
|
});
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
</template>
|
</template>
|
||||||
新建
|
新建
|
||||||
</n-button>
|
</n-button>
|
||||||
|
|
||||||
<n-button
|
<n-button
|
||||||
type="error"
|
type="error"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
@ -67,12 +66,13 @@
|
|||||||
} from '@/api/file/fileTemplate';
|
} from '@/api/file/fileTemplate';
|
||||||
import { columns } from './columns';
|
import { columns } from './columns';
|
||||||
import { PlusOutlined, DeleteOutlined, FormOutlined } from '@vicons/antd';
|
import { PlusOutlined, DeleteOutlined, FormOutlined } from '@vicons/antd';
|
||||||
import CreateModal from './CreateModal.vue';
|
|
||||||
import editDialog from './edit.vue';
|
import editDialog from './edit.vue';
|
||||||
import { basicModal, useModal } from '@/components/Modal';
|
|
||||||
import { schemas } from './querySchemas';
|
import { schemas } from './querySchemas';
|
||||||
import { renderIcon } from '@/utils';
|
import { renderIcon } from '@/utils';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义常量
|
||||||
|
*/
|
||||||
const message = useMessage();
|
const message = useMessage();
|
||||||
const dialog = useDialog();
|
const dialog = useDialog();
|
||||||
const basicTableRef = ref();
|
const basicTableRef = ref();
|
||||||
@ -80,13 +80,17 @@
|
|||||||
const editVisible = ref(false);
|
const editVisible = ref(false);
|
||||||
const fileId = ref(0);
|
const fileId = ref(0);
|
||||||
const rowKeys = ref([]);
|
const rowKeys = ref([]);
|
||||||
const exportLoading = ref(false);
|
|
||||||
|
|
||||||
const showModal = ref(false);
|
/**
|
||||||
|
* 定义查询参数
|
||||||
|
*/
|
||||||
const formParams = reactive({
|
const formParams = reactive({
|
||||||
name: '',
|
name: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义操作栏
|
||||||
|
*/
|
||||||
const actionColumn = reactive({
|
const actionColumn = reactive({
|
||||||
width: 200,
|
width: 200,
|
||||||
title: '操作',
|
title: '操作',
|
||||||
@ -116,24 +120,36 @@
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function addTable() {
|
/**
|
||||||
showModal.value = true;
|
* 加载数据列表
|
||||||
}
|
* @param res 参数
|
||||||
|
*/
|
||||||
const loadDataTable = async (res) => {
|
const loadDataTable = async (res) => {
|
||||||
rowKeys.value = [];
|
rowKeys.value = [];
|
||||||
const result = await getFileTemplateList({ ...formParams, ...res });
|
const result = await getFileTemplateList({ ...formParams, ...res });
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据行选中事件
|
||||||
|
* @param keys 参数
|
||||||
|
*/
|
||||||
function onCheckedRow(keys) {
|
function onCheckedRow(keys) {
|
||||||
rowKeys.value = keys;
|
rowKeys.value = keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新数据表
|
||||||
|
* @param noRefresh 参数
|
||||||
|
*/
|
||||||
function reloadTable(noRefresh = '') {
|
function reloadTable(noRefresh = '') {
|
||||||
basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行提交表单
|
||||||
|
* @param values 参数
|
||||||
|
*/
|
||||||
function handleSubmit(values: Recordable) {
|
function handleSubmit(values: Recordable) {
|
||||||
for (const key in formParams) {
|
for (const key in formParams) {
|
||||||
formParams[key] = '';
|
formParams[key] = '';
|
||||||
@ -144,6 +160,10 @@
|
|||||||
reloadTable();
|
reloadTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行重置
|
||||||
|
* @param values 参数
|
||||||
|
*/
|
||||||
function handleReset(values: Recordable) {
|
function handleReset(values: Recordable) {
|
||||||
for (const key in formParams) {
|
for (const key in formParams) {
|
||||||
formParams[key] = '';
|
formParams[key] = '';
|
||||||
@ -154,6 +174,9 @@
|
|||||||
reloadTable();
|
reloadTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行注册
|
||||||
|
*/
|
||||||
const [register, {}] = useForm({
|
const [register, {}] = useForm({
|
||||||
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },
|
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },
|
||||||
labelWidth: 80,
|
labelWidth: 80,
|
||||||
@ -169,6 +192,7 @@
|
|||||||
await nextTick();
|
await nextTick();
|
||||||
createModalRef.value.openModal();
|
createModalRef.value.openModal();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行编辑
|
* 执行编辑
|
||||||
*/
|
*/
|
||||||
@ -178,6 +202,7 @@
|
|||||||
await nextTick();
|
await nextTick();
|
||||||
createModalRef.value.openModal();
|
createModalRef.value.openModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行删除
|
* 执行删除
|
||||||
* @param id 参数
|
* @param id 参数
|
||||||
@ -189,7 +214,9 @@
|
|||||||
positiveText: '确定',
|
positiveText: '确定',
|
||||||
negativeText: '取消',
|
negativeText: '取消',
|
||||||
onPositiveClick: async () => {
|
onPositiveClick: async () => {
|
||||||
record.id ? await positionDelete(record.id) : await positionBatchDelete(rowKeys.value);
|
record.id
|
||||||
|
? await fileTemplateDelete(record.id)
|
||||||
|
: await fileTemplateBatchDelete(rowKeys.value);
|
||||||
message.success('删除成功');
|
message.success('删除成功');
|
||||||
reloadTable();
|
reloadTable();
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user