Prechádzať zdrojové kódy

完成灾害预警联调

chauncey 11 mesiacov pred
rodič
commit
dac0a1a154

+ 64 - 23
src/api/disaster-warning/index.ts

@@ -5,18 +5,77 @@ import type {
   WarningInfoDetailResponse,
   DefenseNoticeDetailResponse,
   DefenseNoticeListQuery,
+  WarningInfoListQuery,
 } from '@/types/disaster-warning';
-import type { DefenseNoticeRuleForm } from '@/views/disaster/disaster-warning/src/type';
-import type { QueryPageRequest, QueryPageResponse } from '@/api/disaster';
+import type { WarningInfoRuleForm, DefenseNoticeRuleForm } from '@/views/disaster/disaster-warning/src/type';
+import type { QueryPageRequest, QueryPageResponse } from '@/types/disaster';
 /**
  * 获取预警信息列表
  */
-export function getWarningInfoList() {
-  return http.request<WarningInfoListResponse[]>({
+export function getWarningInfoList(query: QueryPageRequest<WarningInfoListQuery>) {
+  return http.request<QueryPageResponse<WarningInfoListResponse>>({
     url: '/disasterWarn/queryDisasterWarnInfoPage',
     method: 'post',
+    data: query,
+  });
+}
+
+/**
+ * 创建预警信息项
+ */
+export const createWarningInfoItem = (data: Omit<WarningInfoRuleForm, 'createUser'>) => {
+  return http.request({
+    url: '/disasterWarn/saveDisasterWarnInfo',
+    method: 'post',
+    data,
+  });
+};
+
+/**
+ * 查看预警信息详情
+ */
+export function getWarningInfoDetail(disasterWarnInfoId: number) {
+  return http.request<WarningInfoDetailResponse>({
+    url: 'disasterWarn/queryDisasterWarnInfo',
+    method: 'get',
+    params: {
+      disasterWarnInfoId,
+    },
   });
 }
+
+/**
+ * 编辑预警信息
+ */
+export const editWarningInfoItem = (data: Omit<WarningInfoRuleForm, 'createUser'>) => {
+  return http.request({
+    url: '/disasterWarn/updateDisasterWarnInfo',
+    method: 'post',
+    data,
+  });
+};
+
+/**
+ *  发布、撤消防御通知
+ */
+export const publishWarningInfoItem = (editParam: { id: number; effectState: number }) => {
+  return http.request({
+    url: '/disasterWarn/updateWarnEffectState',
+    method: 'post',
+    data: editParam,
+  });
+};
+
+/**
+ * 删除预警信息
+ */
+export const deleteWarningInfoItem = (disasterWarnInfoIds: number) => {
+  return http.request({
+    url: '/disasterWarn/deleteDisasterWarnInfos?disasterWarnInfoIds=' + disasterWarnInfoIds,
+    method: 'post',
+  });
+};
+
 /**
  * 获取防御通知列表
  */
@@ -28,24 +87,6 @@ export function getDefenseNoticeList(query: QueryPageRequest<DefenseNoticeListQu
   });
 }
 
-/**
- * 获取预警信息详情
- */
-export function getWarningInfoDetail(id: number) {
-  return http.request<WarningInfoDetailResponse>(
-    {
-      url: 'admin/warning/getWarningInfoDetail',
-      method: 'get',
-      params: {
-        id,
-      },
-    },
-    {
-      ignoreTargetTenantId: true,
-    },
-  );
-}
-
 /**
  * 创建防御通知项
  */
@@ -84,7 +125,7 @@ export const getDefenseNoticeDetail = (defenseNoticeInfoId: number) => {
 /**
  *  发布、撤消防御通知
  */
-export const publishDefenseNoticeItem = (editParam: { id: number; isPush: number }) => {
+export const publishDefenseNoticeItem = (editParam: { id: number; effectState: number }) => {
   return http.request({
     url: '/defenseNotice/updateDefenseNoticeInfo',
     method: 'post',

+ 10 - 7
src/types/disaster-warning/index.ts

@@ -8,14 +8,18 @@ interface BasicResponse {
   isPush: number;
 }
 export interface WarningInfoListResponse extends BasicResponse {
-  warningIcon: string;
-  warningTime: string;
-  warningContent: string;
+  warnTime: string;
+  content: string;
 }
 
-export interface DefenseNoticeListQuery {
+interface BasicListQuery {
   disasterType?: string;
   disasterLevel?: string;
+}
+
+export interface WarningInfoListQuery extends BasicListQuery {}
+
+export interface DefenseNoticeListQuery extends BasicListQuery {
   effectState?: string;
 }
 
@@ -26,19 +30,18 @@ export interface DefenseNoticeListResponse extends BasicResponse {
 interface BasicDetailResponse {
   userGroupList?: number[];
   createUser: string;
+  realname: string;
 }
 
 export interface WarningInfoDetailResponse
   extends BasicDetailResponse,
-    Omit<WarningInfoListResponse, 'activeStatus' | 'pushStatus' | 'publishTime' | 'warningIcon'> {
+    Omit<WarningInfoListResponse, 'effectState' | 'isPush' | 'pushTime'> {
   source: string;
 }
 
-
 export interface DefenseNoticeDetailResponse
   extends BasicDetailResponse,
     Omit<DefenseNoticeListResponse, 'effectState'> {
   content: string;
   attachmentListRes: FileItem[];
-  realname: string;
 }

src/api/disaster/index.ts → src/types/disaster/index.ts


+ 8 - 8
src/views/disaster/disaster-warning/PageDefenseNotice.vue

@@ -58,7 +58,7 @@
                 title: '确定要发布?',
               }"
               v-if="scope.row.effectState === ACTIVE_STATUS.NOT_EFFECTIVE"
-              @confirm="handlePublishDefenseNotice(scope.row.id, scope.row.isPush)"
+              @confirm="handlePublishDefenseNotice(scope.row.id, scope.row.effectState)"
             />
             <ActionButton
               text="撤回"
@@ -66,7 +66,7 @@
                 title: '确定要撤回?',
               }"
               v-else-if="scope.row.effectState === ACTIVE_STATUS.ACTIVE"
-              @confirm="handlePublishDefenseNotice(scope.row.id, scope.row.isPush)"
+              @confirm="handlePublishDefenseNotice(scope.row.id, scope.row.effectState)"
             />
             <ActionButton
               text="删除"
@@ -91,7 +91,7 @@
   import useTableConfig from '@/hooks/useTableConfigHook';
   import { getDefenseNoticeList, deleteDefenseNoticeItem } from '@/api/disaster-warning';
   import type { DefenseNoticeListResponse, DefenseNoticeListQuery } from '@/types/disaster-warning';
-  import type { QueryPageRequest } from '@/api/disaster';
+  import type { QueryPageRequest } from '@/types/disaster';
   import { ACTIVE_STATUS, ACTIVE_STATUS_COLOR, ACTIVE_STATUS_MAP } from '@/views/disaster/constant';
   import { PUSH_STATUS_MAP, PUSH_STATUS } from './src/constant';
   import { DEFENSE_NOTICE_SEARCH_CONFIG, TABLE_OPTIONS, DEFENSE_NOTICE_TABLE_COLUMNS } from './src/config';
@@ -123,12 +123,12 @@
       query: { id },
     });
   };
-  const handlePublishDefenseNotice = async (id: number, isPush: number) => {
-    const message = isPush === PUSH_STATUS.PUSHED ? '确定要发布吗?' : '确定要撤回吗?';
-    const pushStatus = isPush === PUSH_STATUS.PUSHED ? PUSH_STATUS.NOT_PUSH : PUSH_STATUS.PUSHED;
-    await publishDefenseNoticeItem({ id, isPush: pushStatus });
+  const handlePublishDefenseNotice = async (id: number, effectState: number) => {
+    const message = effectState === ACTIVE_STATUS.ACTIVE ? '撤回成功' : '发布成功';
+    const effectStateStatus = effectState === ACTIVE_STATUS.ACTIVE ? ACTIVE_STATUS.NOT_EFFECTIVE : ACTIVE_STATUS.ACTIVE;
+    await publishDefenseNoticeItem({ id, effectState: effectStateStatus });
     await getTableData();
-    ElMessage.success('发布成功');
+    ElMessage.success(message);
   };
   const handleDeleteDefenseNotice = async (id: number) => {
     await deleteDefenseNoticeItem(id);

+ 15 - 16
src/views/disaster/disaster-warning/PageDefenseNoticeItem.vue

@@ -101,23 +101,22 @@
   const submit = async () => {
     if (!dynamicComponentRef.value) return;
     const res = await dynamicComponentRef.value.handleValidate();
-    if (res) {
-      formLoading.value = true;
-      const formData = dynamicComponentRef.value.getFormData();
-      let message;
-      try {
-        if (operate === 'create') {
-          await createDefenseNoticeItemFunc(formData);
-          message = '创建成功';
-        } else if (operate === 'edit') {
-          await editDefenseNoticeItemFunc(formData);
-          message = '编辑成功';
-        }
-        ElMessage.success(message);
-        router.back();
-      } finally {
-        formLoading.value = false;
+    if (!res) return;
+    formLoading.value = true;
+    const formData = dynamicComponentRef.value.getFormData();
+    let message;
+    try {
+      if (operate === 'create') {
+        await createDefenseNoticeItemFunc(formData);
+        message = '创建成功';
+      } else if (operate === 'edit') {
+        await editDefenseNoticeItemFunc(formData);
+        message = '编辑成功';
       }
+      ElMessage.success(message);
+      router.back();
+    } finally {
+      formLoading.value = false;
     }
   };
 </script>

+ 55 - 16
src/views/disaster/disaster-warning/PageWarningInfo.vue

@@ -29,45 +29,54 @@
           <template #warningIcon="scope">
             <img :src="getWarningIcon(scope.row.disasterType)" alt="预警图标" class="weather-warning-icon" />
           </template>
-          <template #activeStatus="scope">
+          <template #disasterType="scope">
+            <span>{{ formatDisasterType(scope.row.disasterType) }}</span>
+          </template>
+          <template #disasterLevel="scope">
+            <span>{{ formatDisasterLevel(scope.row.disasterLevel) }}</span>
+          </template>
+          <template #effectState="scope">
             <div class="active-status--div">
               <div
                 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>
           </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>
           </template>
           <template #action="scope">
             <ActionButton
               text="编辑"
               @click="handleEditWarningInfo(scope.row.id)"
-              v-if="scope.row.activeStatus === ACTIVE_STATUS.NOT_EFFECTIVE"
+              v-if="scope.row.effectState === ACTIVE_STATUS.NOT_EFFECTIVE"
             />
             <ActionButton
               text="发布"
               :popconfirm="{
                 title: '确定要发布?',
               }"
-              v-if="scope.row.activeStatus === ACTIVE_STATUS.NOT_EFFECTIVE"
+              v-if="scope.row.effectState === ACTIVE_STATUS.NOT_EFFECTIVE"
+              @confirm="handlePublishWarningInfo(scope.row.id, scope.row.effectState)"
             />
             <ActionButton
               text="撤回"
               :popconfirm="{
                 title: '确定要撤回?',
               }"
-              v-else-if="scope.row.activeStatus === ACTIVE_STATUS.ACTIVE"
+              v-else-if="scope.row.effectState === ACTIVE_STATUS.ACTIVE"
+              @confirm="handlePublishWarningInfo(scope.row.id, scope.row.effectState)"
             />
             <ActionButton
               text="删除"
               :popconfirm="{
                 title: '确定要删除?',
               }"
+              @confirm="handleDeleteWarningInfo(scope.row.id)"
             />
           </template>
         </BasicTable>
@@ -90,15 +99,18 @@
   import { PUSH_STATUS_MAP, PUSH_STATUS, WEATHER_DISASTER_ALERT_TYPE } from './src/constant';
   import { WARNING_INFO_SEARCH_CONFIG, TABLE_OPTIONS, WARNING_INFO_TABLE_COLUMNS } from './src/config';
   import { useRouter } from 'vue-router';
+  import type { QueryPageRequest } from '@/types/disaster';
+  import type { WarningInfoListQuery } from '@/types/disaster-warning';
+  import { formatDisasterLevel } from '@/views/disaster/utils/formatTable';
+  import { formatDisasterType } from './src/util';
+  import { deleteWarningInfoItem, publishWarningInfoItem } from '@/api/disaster-warning';
+  import { ElMessage } from 'element-plus';
+
   const router = useRouter();
   const searchData = reactive({
     disasterType: '',
     disasterLevel: '',
   });
-  const handleSearch = (data: any) => {
-    console.log(data);
-    getTableData();
-  };
   const getWarningIcon = (disasterType: string) => {
     const icon = WEATHER_DISASTER_ALERT_TYPE.find((item) => item.label === disasterType)?.icon;
     return icon ?? PlaceHolderWeather;
@@ -121,8 +133,35 @@
       },
     });
   };
+  const handlePublishWarningInfo = async (id: number, effectState: number) => {
+    const message = effectState === ACTIVE_STATUS.ACTIVE ? '撤回成功' : '发布成功';
+    const effectStateStatus = effectState === ACTIVE_STATUS.ACTIVE ? ACTIVE_STATUS.NOT_EFFECTIVE : ACTIVE_STATUS.ACTIVE;
+    await publishWarningInfoItem({ id, effectState: effectStateStatus });
+    await getTableData();
+    ElMessage.success(message);
+  };
+  const handleDeleteWarningInfo = async (id: number) => {
+    await deleteWarningInfoItem(id);
+    getTableData();
+    ElMessage.success('删除成功');
+  };
   const tableData = ref<WarningInfoListResponse[]>([]);
   const { tableConfig, pagination } = useTableConfig(WARNING_INFO_TABLE_COLUMNS, TABLE_OPTIONS);
+  let wanrningInfoListQuery: QueryPageRequest<WarningInfoListQuery> = {
+    pageNumber: pagination.pageNumber,
+    pageSize: pagination.pageSize,
+    queryParam: {},
+  };
+  const handleSearch = () => {
+    wanrningInfoListQuery.queryParam = {};
+    if (searchData.disasterLevel !== '') {
+      wanrningInfoListQuery.queryParam.disasterLevel = searchData.disasterLevel;
+    }
+    if (searchData.disasterType !== '') {
+      wanrningInfoListQuery.queryParam.disasterType = searchData.disasterType;
+    }
+    getTableData();
+  };
   const handleSizeChange = (value: number) => {
     pagination.pageSize = value;
     getTableData();
@@ -133,9 +172,9 @@
   };
   const getTableData = async () => {
     tableConfig.loading = true;
-    const res = await getWarningInfoList();
-    tableData.value = res;
-    pagination.total = tableData.value.length;
+    const res = await getWarningInfoList(wanrningInfoListQuery);
+    tableData.value = res.records;
+    pagination.total = res.totalRow;
     tableConfig.loading = false;
   };
   onMounted(() => {

+ 45 - 6
src/views/disaster/disaster-warning/PageWarningInfoItem.vue

@@ -11,6 +11,7 @@
       <el-button @click="router.back()">取消</el-button>
       <el-button type="primary" @click="submit">提交</el-button>
     </footer>
+    <UploadLoading :form-loading="formLoading" v-if="formLoading" />
   </div>
 </template>
 
@@ -19,6 +20,11 @@
   import { useRoute, useRouter } from 'vue-router';
   import BackIcon from 'assets/svg/back.svg';
   import { ElMessage } from 'element-plus';
+  import { WarningInfoRuleForm } from './src/type';
+  import { createWarningInfoItem, editWarningInfoItem } from '@/api/disaster-warning/index';
+  import UploadLoading from '@/components/UploadLoading.vue';
+
+  const formLoading = ref(false);
   const router = useRouter();
   const route = useRoute();
   const operate = route.query.operate;
@@ -42,16 +48,49 @@
     }
   });
   const dynamicComponentRef = ref();
+  const createWarningInfoItemFunc = async (formData: WarningInfoRuleForm) => {
+    const createParam = {
+      disasterType: formData.disasterType,
+      disasterLevel: formData.disasterLevel,
+      warnTime: formData.warnTime,
+      source: formData.source,
+      content: formData.content,
+      isPush: formData.isPush,
+      userGroupList: formData.isPush ? formData.userGroupList : [],
+    };
+    await createWarningInfoItem(createParam);
+  };
+  const editWarningInfoItemFunc = async (formData: WarningInfoRuleForm) => {
+    const editParam = {
+      id: Number(id),
+      disasterType: formData.disasterType,
+      disasterLevel: formData.disasterLevel,
+      warnTime: formData.warnTime,
+      source: formData.source,
+      content: formData.content,
+      isPush: formData.isPush,
+      userGroupList: formData.isPush ? formData.userGroupList : [],
+    };
+    await editWarningInfoItem(editParam);
+  };
   const submit = async () => {
     if (!dynamicComponentRef.value) return;
     const res = await dynamicComponentRef.value.handleValidate();
-    if (res) {
-      const formData = dynamicComponentRef.value.getFormData();
-      console.log(formData);
-      ElMessage.success('提交成功');
+    if (!res) return;
+    const formData = dynamicComponentRef.value.getFormData();
+    let message;
+    try {
+      if (operate === 'create') {
+        await createWarningInfoItemFunc(formData);
+        message = '创建成功';
+      } else if (operate === 'edit') {
+        await editWarningInfoItemFunc(formData);
+        message = '编辑成功';
+      }
+      ElMessage.success(message);
       router.back();
-    } else {
-      console.log('不提交');
+    } finally {
+      formLoading.value = false;
     }
   };
 </script>

+ 2 - 5
src/views/disaster/disaster-warning/src/components/CreateDefenseNoticeItem.vue

@@ -30,11 +30,9 @@
   import { DefenseNoticeRuleForm } from '../type';
   import SelectGroup from '@/views/disaster/components/SelectGroup.vue';
   import type { FileItem } from '@/views/disaster/types';
-  import { useUserStore } from '@/store/modules/user';
-  import { storeToRefs } from 'pinia';
+  import { useUserInfoHook } from '@/views/disaster/hooks/userInfo';
 
-  const userStore = useUserStore();
-  const { getUserInfo } = storeToRefs(userStore);
+  const { realname } = useUserInfoHook();
 
   const basicFormRef = ref<InstanceType<typeof BasicForm>>();
   const selectGroupRef = ref<InstanceType<typeof SelectGroup>>();
@@ -77,7 +75,6 @@
     getFormData,
   });
   onMounted(() => {
-    const realname = getUserInfo.value.realname;
     ruleFormData.createUser = realname;
     cloneRuleFormData();
     beforeRouteLeave();

+ 7 - 3
src/views/disaster/disaster-warning/src/components/CreateWarningInfoItem.vue

@@ -3,8 +3,8 @@
     <BasicForm ref="basicFormRef" :formData="ruleFormData" :formRules="formRules" :formConfig="ruleFormConfig">
       <template #isPush>
         <el-radio-group v-model="ruleFormData.isPush">
-          <el-radio :value="true">是</el-radio>
-          <el-radio :value="false">否</el-radio>
+          <el-radio :value="IS_PUSH.PUSH">是</el-radio>
+          <el-radio :value="IS_PUSH.NOT_PUSH">否</el-radio>
         </el-radio-group>
         <SelectGroup
           v-if="ruleFormData.isPush"
@@ -24,6 +24,10 @@
   import { onMounted, ref } from 'vue';
   import { WarningInfoRuleForm } from '../type';
   import SelectGroup from '@/views/disaster/components/SelectGroup.vue';
+  import { useUserInfoHook } from '@/views/disaster/hooks/userInfo';
+  import { IS_PUSH } from '@/views/disaster/constant';
+
+  const { realname } = useUserInfoHook();
   const basicFormRef = ref<InstanceType<typeof BasicForm>>();
   const selectGroupRef = ref<InstanceType<typeof SelectGroup>>();
 
@@ -56,7 +60,7 @@
   });
 
   onMounted(() => {
-    ruleFormData.createUser = 'XXX';
+    ruleFormData.createUser = realname;
     cloneRuleFormData();
     beforeRouteLeave();
   });

+ 6 - 2
src/views/disaster/disaster-warning/src/components/EditWarningInfoItem.vue

@@ -3,8 +3,8 @@
     <BasicForm ref="basicFormRef" :formData="ruleFormData" :formRules="formRules" :formConfig="ruleFormConfig">
       <template #isPush>
         <el-radio-group v-model="ruleFormData.isPush">
-          <el-radio :value="true">是</el-radio>
-          <el-radio :value="false">否</el-radio>
+          <el-radio :value="IS_PUSH.PUSH">是</el-radio>
+          <el-radio :value="IS_PUSH.NOT_PUSH">否</el-radio>
         </el-radio-group>
         <SelectGroup
           v-if="ruleFormData.isPush"
@@ -24,6 +24,7 @@
   import { useFormConfigHook } from '@/hooks/useFormConfigHook';
   import { WARNING_INFO_FROM_CONFIG, WARNING_INFO_FROM_DATA, WARNING_INFO_FROM_RULES } from '../config';
   import { WarningInfoRuleForm } from '../type';
+  import { IS_PUSH } from '@/views/disaster/constant';
   import { getWarningInfoDetail } from '@/api/disaster-warning';
 
   const props = defineProps<{
@@ -42,9 +43,12 @@
 
   const getWarningInfoDetailData = async () => {
     const res = await getWarningInfoDetail(props.id);
+    console.log(res);
     for (const key in res) {
       if (key in ruleFormData) {
         ruleFormData[key] = res[key as keyof typeof res];
+        ruleFormData.createUser = res.realname;
+        ruleFormData.userGroupList = JSON.parse(res.userGroupList as unknown as string);
       }
     }
     cloneRuleFormData();

+ 1 - 1
src/views/disaster/disaster-warning/src/components/ViewDefenseNoticeItem.vue

@@ -13,7 +13,7 @@
       <span class="publish-info">
         <p class="info-item">
           发布人:<span class="info-content">
-            {{ defenseNoticeDetail?.realname }}
+            {{ defenseNoticeDetail?.realname }} {{ defenseNoticeDetail?.pushTime }}
           </span>
         </p>
       </span>

+ 9 - 9
src/views/disaster/disaster-warning/src/config/form.ts

@@ -48,7 +48,7 @@ export const WARNING_INFO_FROM_CONFIG: FormConfig[] = [
   BASIC_FROM_CONFIG.DISASTER_LEVEL,
   {
     label: '预警时间',
-    prop: 'warningTime',
+    prop: 'warnTime',
     component: 'ElDatePicker',
     componentProps: {
       placeholder: '请选择预警时间',
@@ -56,6 +56,7 @@ export const WARNING_INFO_FROM_CONFIG: FormConfig[] = [
       format: 'YYYY-MM-DD HH:mm',
       dateFormat: 'MMM DD, YYYY',
       timeFormat: 'HH:mm',
+      valueFormat: 'YYYY-MM-DD HH:mm'
     },
   },
   {
@@ -63,18 +64,18 @@ export const WARNING_INFO_FROM_CONFIG: FormConfig[] = [
     prop: 'source',
     component: 'ElInput',
     componentProps: {
-      placeholder: '国家预警信息发布中心',
+      placeholder: '请输入信息来源',
     },
   },
   {
     label: '发布内容',
-    prop: 'warningContent',
+    prop: 'content',
     component: 'ElInput',
     componentProps: {
       placeholder: '请输入发布内容',
       type: 'textarea',
       rows: 5,
-      maxlength: 1000,
+      maxlength: 500,
       showWordLimit: true,
     },
   },
@@ -131,27 +132,26 @@ export const DEFENSE_NOTICE_FROM_CONFIG: FormConfig[] = [
 const BASIC_FROM_DATA = {
   disasterType: '',
   disasterLevel: '',
+  content: '',
   userGroupList: [],
   isPush: null,
   createUser: '',
+  realname: '',
 };
 
 // 预警信息表单数据
 export const WARNING_INFO_FROM_DATA = {
   ...BASIC_FROM_DATA,
-  warningTime: '',
+  warnTime: '',
   source: '',
-  warningContent: '',
 };
 
 // 防御通知表单数据
 export const DEFENSE_NOTICE_FROM_DATA = {
   ...BASIC_FROM_DATA,
   title: '',
-  content: '',
   attachmentListRes: [],
   pushTime: '',
-  realname: '',
 };
 
 // 通用表单规则
@@ -171,7 +171,7 @@ const BASIC_FROM_RULES = {
 // 预警信息表单规则
 export const WARNING_INFO_FROM_RULES = {
   ...BASIC_FROM_RULES,
-  warningTime: [{ required: true, message: '请选择预警时间', trigger: 'change' }],
+  warnTime: [{ required: true, message: '请选择预警时间', trigger: 'change' }],
   source: [{ required: true, message: '请输入信息来源', trigger: 'blur' }],
 };
 

+ 2 - 2
src/views/disaster/disaster-warning/src/config/table.ts

@@ -64,13 +64,13 @@ export const WARNING_INFO_TABLE_COLUMNS: TableColumnProps[] = [
   BASIC_TABLE_COLUMNS.DISASTER_TYPE,
   BASIC_TABLE_COLUMNS.DISASTER_LEVEL,
   {
-    prop: 'warningTime',
+    prop: 'warnTime',
     label: '预警时间',
     align: 'center',
     width: '200cpx',
   },
   {
-    prop: 'warningContent',
+    prop: 'content',
     label: '发布内容',
     align: 'center',
     width: '200cpx',

+ 11 - 0
src/views/disaster/disaster-warning/src/util.ts

@@ -0,0 +1,11 @@
+import { WEATHER_DISASTER_ALERT_TYPE } from './constant';
+/**
+ * 格式化灾害类型
+ */
+export const formatDisasterType = (disasterType: string) => {
+  const alertType = WEATHER_DISASTER_ALERT_TYPE.find((item) => item.value === disasterType);
+  if (alertType) {
+    return alertType.label;
+  }
+  return '未知灾害类型';
+};

+ 15 - 0
src/views/disaster/hooks/userInfo.ts

@@ -0,0 +1,15 @@
+import { useUserStore } from '@/store/modules/user';
+import { storeToRefs } from 'pinia';
+
+const userStore = useUserStore();
+const { getUserInfo } = storeToRefs(userStore);
+/**
+ * 获取登录账户信息
+ */
+export const useUserInfoHook = () => {
+  const userInfo = getUserInfo.value;
+  const realname = userInfo.realname;
+  return {
+    realname,
+  };
+};