| | |
| | | </template>
|
| | |
|
| | | <script setup name="Notice">
|
| | | import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice";
|
| | | import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice"
|
| | |
|
| | | const { proxy } = getCurrentInstance();
|
| | | const { sys_notice_status, sys_notice_type } = proxy.useDict("sys_notice_status", "sys_notice_type");
|
| | | const { proxy } = getCurrentInstance()
|
| | | const { sys_notice_status, sys_notice_type } = proxy.useDict("sys_notice_status", "sys_notice_type")
|
| | |
|
| | | const noticeList = ref([]);
|
| | | const open = ref(false);
|
| | | const loading = ref(true);
|
| | | const showSearch = ref(true);
|
| | | const ids = ref([]);
|
| | | const single = ref(true);
|
| | | const multiple = ref(true);
|
| | | const total = ref(0);
|
| | | const title = ref("");
|
| | | const noticeList = ref([])
|
| | | const open = ref(false)
|
| | | const loading = ref(true)
|
| | | const showSearch = ref(true)
|
| | | const ids = ref([])
|
| | | const single = ref(true)
|
| | | const multiple = ref(true)
|
| | | const total = ref(0)
|
| | | const title = ref("")
|
| | |
|
| | | const data = reactive({
|
| | | form: {},
|
| | |
| | | noticeTitle: [{ required: true, message: "公告标题不能为空", trigger: "blur" }],
|
| | | noticeType: [{ required: true, message: "公告类型不能为空", trigger: "change" }]
|
| | | },
|
| | | });
|
| | | })
|
| | |
|
| | | const { queryParams, form, rules } = toRefs(data);
|
| | | const { queryParams, form, rules } = toRefs(data)
|
| | |
|
| | | /** 查询公告列表 */
|
| | | function getList() {
|
| | | loading.value = true;
|
| | | loading.value = true
|
| | | listNotice(queryParams.value).then(response => {
|
| | | noticeList.value = response.rows;
|
| | | total.value = response.total;
|
| | | loading.value = false;
|
| | | });
|
| | | noticeList.value = response.rows
|
| | | total.value = response.total
|
| | | loading.value = false
|
| | | })
|
| | | }
|
| | |
|
| | | /** 取消按钮 */
|
| | | function cancel() {
|
| | | open.value = false;
|
| | | reset();
|
| | | open.value = false
|
| | | reset()
|
| | | }
|
| | |
|
| | | /** 表单重置 */
|
| | |
| | | noticeType: undefined,
|
| | | noticeContent: undefined,
|
| | | status: "0"
|
| | | };
|
| | | proxy.resetForm("noticeRef");
|
| | | }
|
| | | proxy.resetForm("noticeRef")
|
| | | }
|
| | |
|
| | | /** 搜索按钮操作 */
|
| | | function handleQuery() {
|
| | | queryParams.value.pageNum = 1;
|
| | | getList();
|
| | | queryParams.value.pageNum = 1
|
| | | getList()
|
| | | }
|
| | |
|
| | | /** 重置按钮操作 */
|
| | | function resetQuery() {
|
| | | proxy.resetForm("queryRef");
|
| | | handleQuery();
|
| | | proxy.resetForm("queryRef")
|
| | | handleQuery()
|
| | | }
|
| | |
|
| | | /** 多选框选中数据 */
|
| | | function handleSelectionChange(selection) {
|
| | | ids.value = selection.map(item => item.noticeId);
|
| | | single.value = selection.length != 1;
|
| | | multiple.value = !selection.length;
|
| | | ids.value = selection.map(item => item.noticeId)
|
| | | single.value = selection.length != 1
|
| | | multiple.value = !selection.length
|
| | | }
|
| | |
|
| | | /** 新增按钮操作 */
|
| | | function handleAdd() {
|
| | | reset();
|
| | | open.value = true;
|
| | | title.value = "添加公告";
|
| | | reset()
|
| | | open.value = true
|
| | | title.value = "添加公告"
|
| | | }
|
| | |
|
| | | /**修改按钮操作 */
|
| | | function handleUpdate(row) {
|
| | | reset();
|
| | | const noticeId = row.noticeId || ids.value;
|
| | | reset()
|
| | | const noticeId = row.noticeId || ids.value
|
| | | getNotice(noticeId).then(response => {
|
| | | form.value = response.data;
|
| | | open.value = true;
|
| | | title.value = "修改公告";
|
| | | });
|
| | | form.value = response.data
|
| | | open.value = true
|
| | | title.value = "修改公告"
|
| | | })
|
| | | }
|
| | |
|
| | | /** 提交按钮 */
|
| | |
| | | if (valid) {
|
| | | if (form.value.noticeId != undefined) {
|
| | | updateNotice(form.value).then(response => {
|
| | | proxy.$modal.msgSuccess("修改成功");
|
| | | open.value = false;
|
| | | getList();
|
| | | });
|
| | | proxy.$modal.msgSuccess("修改成功")
|
| | | open.value = false
|
| | | getList()
|
| | | })
|
| | | } else {
|
| | | addNotice(form.value).then(response => {
|
| | | proxy.$modal.msgSuccess("新增成功");
|
| | | open.value = false;
|
| | | getList();
|
| | | });
|
| | | proxy.$modal.msgSuccess("新增成功")
|
| | | open.value = false
|
| | | getList()
|
| | | })
|
| | | }
|
| | | }
|
| | | });
|
| | | })
|
| | | }
|
| | |
|
| | | /** 删除按钮操作 */
|
| | | function handleDelete(row) {
|
| | | const noticeIds = row.noticeId || ids.value
|
| | | proxy.$modal.confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?').then(function() {
|
| | | return delNotice(noticeIds);
|
| | | return delNotice(noticeIds)
|
| | | }).then(() => {
|
| | | getList();
|
| | | proxy.$modal.msgSuccess("删除成功");
|
| | | }).catch(() => {});
|
| | | getList()
|
| | | proxy.$modal.msgSuccess("删除成功")
|
| | | }).catch(() => {})
|
| | | }
|
| | |
|
| | | getList();
|
| | | getList()
|
| | | </script>
|