优化通知公告
This commit is contained in:
parent
3b383cdb3b
commit
bba53945cf
@ -67,9 +67,14 @@
|
||||
* 定义表单参数
|
||||
*/
|
||||
const message = useMessage();
|
||||
|
||||
/**
|
||||
* 定义表单参数
|
||||
*/
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
title: '',
|
||||
cover: '',
|
||||
status: 1,
|
||||
type: 1,
|
||||
content: '',
|
||||
@ -92,15 +97,24 @@
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义通知类型
|
||||
*/
|
||||
const typeList = [
|
||||
{ label: '通知', value: 1 },
|
||||
{ label: '公告', value: 2 },
|
||||
];
|
||||
|
||||
/**
|
||||
* 定义模态
|
||||
*/
|
||||
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
||||
title: props.noticeId ? '编辑公告' : '添加公告',
|
||||
subBtuText: '确定',
|
||||
width: document.body.clientWidth - 500,
|
||||
});
|
||||
const typeList = [
|
||||
{ label: '通知', value: 1 },
|
||||
{ label: '公告', value: 2 },
|
||||
];
|
||||
|
||||
/**
|
||||
* 执行提交
|
||||
*/
|
||||
@ -150,7 +164,10 @@
|
||||
setFormData();
|
||||
}
|
||||
});
|
||||
//导出方法
|
||||
|
||||
/**
|
||||
* 定义函数
|
||||
*/
|
||||
defineExpose({
|
||||
openModal,
|
||||
});
|
||||
|
@ -27,7 +27,6 @@
|
||||
</template>
|
||||
新建
|
||||
</n-button>
|
||||
|
||||
<n-button
|
||||
type="error"
|
||||
@click="handleDelete"
|
||||
@ -63,12 +62,13 @@
|
||||
import { getNoticeList, noticeDelete, noticeBatchDelete } from '@/api/data/notice';
|
||||
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();
|
||||
@ -76,15 +76,19 @@
|
||||
const editVisible = ref(false);
|
||||
const noticeId = ref(0);
|
||||
const rowKeys = ref([]);
|
||||
const exportLoading = ref(false);
|
||||
|
||||
const showModal = ref(false);
|
||||
/**
|
||||
* 定义查询参数
|
||||
*/
|
||||
const formParams = reactive({
|
||||
title: '',
|
||||
status: '',
|
||||
type: '',
|
||||
});
|
||||
|
||||
/**
|
||||
* 定义操作栏
|
||||
*/
|
||||
const actionColumn = reactive({
|
||||
width: 200,
|
||||
title: '操作',
|
||||
@ -114,24 +118,36 @@
|
||||
},
|
||||
});
|
||||
|
||||
function addTable() {
|
||||
showModal.value = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载数据列表
|
||||
* @param res 参数
|
||||
*/
|
||||
const loadDataTable = async (res) => {
|
||||
rowKeys.value = [];
|
||||
const result = await getNoticeList({ ...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] = '';
|
||||
@ -142,6 +158,10 @@
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行重置
|
||||
* @param values 参数
|
||||
*/
|
||||
function handleReset(values: Recordable) {
|
||||
for (const key in formParams) {
|
||||
formParams[key] = '';
|
||||
@ -152,6 +172,9 @@
|
||||
reloadTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行注册
|
||||
*/
|
||||
const [register, {}] = useForm({
|
||||
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },
|
||||
labelWidth: 80,
|
||||
@ -167,6 +190,7 @@
|
||||
await nextTick();
|
||||
createModalRef.value.openModal();
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行编辑
|
||||
*/
|
||||
@ -176,6 +200,7 @@
|
||||
await nextTick();
|
||||
createModalRef.value.openModal();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行删除
|
||||
* @param id 参数
|
||||
|
Loading…
Reference in New Issue
Block a user