|
@@ -25,18 +25,21 @@
|
|
|
@update:pageSize="handleSizeChange"
|
|
@update:pageSize="handleSizeChange"
|
|
|
@update:pageNumber="handleCurrentChange"
|
|
@update:pageNumber="handleCurrentChange"
|
|
|
>
|
|
>
|
|
|
- <template #activeStatus="scope">
|
|
|
|
|
|
|
+ <template #disasterLevel="scope">
|
|
|
|
|
+ <span>{{ formatDisasterLevel(scope.row.disasterLevel) }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #effectState="scope">
|
|
|
<div class="active-status--div">
|
|
<div class="active-status--div">
|
|
|
<div
|
|
<div
|
|
|
class="dot"
|
|
class="dot"
|
|
|
- :style="{ backgroundColor: ACTIVE_STATUS_COLOR[scope.row.activeStatus as ACTIVE_STATUS] }"
|
|
|
|
|
|
|
+ :style="{ backgroundColor: ACTIVE_STATUS_COLOR[scope.row.effectState as ACTIVE_STATUS] }"
|
|
|
/>
|
|
/>
|
|
|
- <span>{{ ACTIVE_STATUS_MAP[scope.row.activeStatus] }}</span>
|
|
|
|
|
|
|
+ <span>{{ ACTIVE_STATUS_MAP[scope.row.effectState] }}</span>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
- <template #pushStatus="scope">
|
|
|
|
|
- <span :style="{ color: scope.row.pushStatus === PUSH_STATUS.PUSHED ? '' : '#ff4d4f' }">
|
|
|
|
|
- {{ PUSH_STATUS_MAP[scope.row.pushStatus as PUSH_STATUS] }}
|
|
|
|
|
|
|
+ <template #isPush="scope">
|
|
|
|
|
+ <span :style="{ color: scope.row.isPush === PUSH_STATUS.PUSHED ? '' : '#ff4d4f' }">
|
|
|
|
|
+ {{ PUSH_STATUS_MAP[scope.row.isPush as PUSH_STATUS] }}
|
|
|
</span>
|
|
</span>
|
|
|
</template>
|
|
</template>
|
|
|
<template #action="scope">
|
|
<template #action="scope">
|
|
@@ -65,6 +68,7 @@
|
|
|
:popconfirm="{
|
|
:popconfirm="{
|
|
|
title: '确定要删除?',
|
|
title: '确定要删除?',
|
|
|
}"
|
|
}"
|
|
|
|
|
+ @confirm="handleDeleteDefenseNotice(scope.row.id)"
|
|
|
/>
|
|
/>
|
|
|
</template>
|
|
</template>
|
|
|
</BasicTable>
|
|
</BasicTable>
|
|
@@ -80,12 +84,15 @@
|
|
|
import BasicTable from '@/components/BasicTable.vue';
|
|
import BasicTable from '@/components/BasicTable.vue';
|
|
|
import ActionButton from '@/components/ActionButton.vue';
|
|
import ActionButton from '@/components/ActionButton.vue';
|
|
|
import useTableConfig from '@/hooks/useTableConfigHook';
|
|
import useTableConfig from '@/hooks/useTableConfigHook';
|
|
|
- import { getDefenseNoticeList } from '@/api/disaster-warning';
|
|
|
|
|
- import type { DefenseNoticeListResponse } from '@/types/disaster-warning';
|
|
|
|
|
|
|
+ import { getDefenseNoticeList, deleteDefenseNoticeItem } from '@/api/disaster-warning';
|
|
|
|
|
+ import type { DefenseNoticeListResponse, DefenseNoticeListQuery } from '@/types/disaster-warning';
|
|
|
|
|
+ import type { QueryPageRequest } from '@/api/disaster';
|
|
|
import { ACTIVE_STATUS, ACTIVE_STATUS_COLOR, ACTIVE_STATUS_MAP } from '@/views/disaster/constant';
|
|
import { ACTIVE_STATUS, ACTIVE_STATUS_COLOR, ACTIVE_STATUS_MAP } from '@/views/disaster/constant';
|
|
|
import { PUSH_STATUS_MAP, PUSH_STATUS } from './src/constant';
|
|
import { PUSH_STATUS_MAP, PUSH_STATUS } from './src/constant';
|
|
|
import { DEFENSE_NOTICE_SEARCH_CONFIG, TABLE_OPTIONS, DEFENSE_NOTICE_TABLE_COLUMNS } from './src/config';
|
|
import { DEFENSE_NOTICE_SEARCH_CONFIG, TABLE_OPTIONS, DEFENSE_NOTICE_TABLE_COLUMNS } from './src/config';
|
|
|
|
|
+ import { formatDisasterLevel } from '@/views/disaster/utils/formatTable';
|
|
|
import { useRouter } from 'vue-router';
|
|
import { useRouter } from 'vue-router';
|
|
|
|
|
+ import { ElMessage } from 'element-plus';
|
|
|
const tableData = ref<DefenseNoticeListResponse[]>([]);
|
|
const tableData = ref<DefenseNoticeListResponse[]>([]);
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
|
const defaultPath = '/disaster-prevention/disaster-warning/defense-notice-item';
|
|
const defaultPath = '/disaster-prevention/disaster-warning/defense-notice-item';
|
|
@@ -109,16 +116,36 @@
|
|
|
query: { id },
|
|
query: { id },
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
+ const handleDeleteDefenseNotice = async (id: number) => {
|
|
|
|
|
+ await deleteDefenseNoticeItem(id);
|
|
|
|
|
+ ElMessage.success('删除成功');
|
|
|
|
|
+ getTableData();
|
|
|
|
|
+ };
|
|
|
const searchData = reactive({
|
|
const searchData = reactive({
|
|
|
disasterType: '',
|
|
disasterType: '',
|
|
|
disasterLevel: '',
|
|
disasterLevel: '',
|
|
|
- activeStatus: '',
|
|
|
|
|
|
|
+ effectState: '',
|
|
|
});
|
|
});
|
|
|
- const handleSearch = (data: any) => {
|
|
|
|
|
- console.log(data);
|
|
|
|
|
|
|
+ const { tableConfig, pagination } = useTableConfig(DEFENSE_NOTICE_TABLE_COLUMNS, TABLE_OPTIONS);
|
|
|
|
|
+ let defenseNoticeListQuery: QueryPageRequest<DefenseNoticeListQuery> = {
|
|
|
|
|
+ pageNumber: pagination.pageNumber,
|
|
|
|
|
+ pageSize: pagination.pageSize,
|
|
|
|
|
+ queryParam: {},
|
|
|
|
|
+ };
|
|
|
|
|
+ const handleSearch = () => {
|
|
|
|
|
+ defenseNoticeListQuery.queryParam = {};
|
|
|
|
|
+ if (searchData.disasterLevel !== '') {
|
|
|
|
|
+ defenseNoticeListQuery.queryParam.disasterLevel = searchData.disasterLevel;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (searchData.effectState !== '') {
|
|
|
|
|
+ defenseNoticeListQuery.queryParam.effectState = searchData.effectState;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (searchData.disasterType !== '') {
|
|
|
|
|
+ defenseNoticeListQuery.queryParam.disasterType = searchData.disasterType;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
getTableData();
|
|
getTableData();
|
|
|
};
|
|
};
|
|
|
- const { tableConfig, pagination } = useTableConfig(DEFENSE_NOTICE_TABLE_COLUMNS, TABLE_OPTIONS);
|
|
|
|
|
const handleSizeChange = (value: number) => {
|
|
const handleSizeChange = (value: number) => {
|
|
|
pagination.pageSize = value;
|
|
pagination.pageSize = value;
|
|
|
getTableData();
|
|
getTableData();
|
|
@@ -129,9 +156,9 @@
|
|
|
};
|
|
};
|
|
|
const getTableData = async () => {
|
|
const getTableData = async () => {
|
|
|
tableConfig.loading = true;
|
|
tableConfig.loading = true;
|
|
|
- const res = await getDefenseNoticeList();
|
|
|
|
|
- tableData.value = res;
|
|
|
|
|
- pagination.total = tableData.value.length;
|
|
|
|
|
|
|
+ const res = await getDefenseNoticeList(defenseNoticeListQuery);
|
|
|
|
|
+ tableData.value = res.records;
|
|
|
|
|
+ pagination.total = res.totalRow;
|
|
|
tableConfig.loading = false;
|
|
tableConfig.loading = false;
|
|
|
};
|
|
};
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|