|
@@ -1,298 +1,318 @@
|
|
|
<template>
|
|
|
- <div class="table-content">
|
|
|
- <!-- 搜索框 -->
|
|
|
- <div class="search-box">
|
|
|
- <el-input
|
|
|
- v-model="searchQuery"
|
|
|
- class="search-input"
|
|
|
- placeholder="请输入内容"
|
|
|
- prefix-icon="el-icon-search"
|
|
|
- clearable
|
|
|
- @keyup.enter="onSearch"
|
|
|
+ <div class="container">
|
|
|
+ <!--搜索框-->
|
|
|
+ <van-search
|
|
|
+ v-model="queryParams.search_keyword"
|
|
|
+ class="common-search"
|
|
|
+ placeholder="请输入信息"
|
|
|
+ :left-icon="searchImg"
|
|
|
+ :right-icon="closeImg"
|
|
|
+ :clearable="false"
|
|
|
+ @search="on_search_keyword"
|
|
|
+ @click-right-icon.stop="on_search_cancel"
|
|
|
+ />
|
|
|
+ <!--三个类型选择-->
|
|
|
+ <van-dropdown-menu>
|
|
|
+ <van-dropdown-item
|
|
|
+ v-model="queryParams.info_type"
|
|
|
+ :title="!!queryParams.info_type ? '' : '类型'"
|
|
|
+ :options="opt_info_type"
|
|
|
+ @change="change_info_type"
|
|
|
/>
|
|
|
- </div>
|
|
|
- <!-- 筛选和排序区域 -->
|
|
|
- <div class="filter-sort-area">
|
|
|
- <div class="filter-item">
|
|
|
- <span>类型:</span>
|
|
|
- <span class="type-trigger" @click="showTypePicker">
|
|
|
- {{ selectedType || "请选择类型" }}
|
|
|
- <i class="el-icon-arrow-down" />
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- <!-- 类型选择抽屉 -->
|
|
|
- <el-drawer
|
|
|
- v-model="typeDrawerVisible"
|
|
|
- title="选择类型"
|
|
|
- direction="btt"
|
|
|
- size="30%"
|
|
|
- >
|
|
|
- <ul>
|
|
|
- <li v-for="type in types" :key="type" @click="selectType(type)">
|
|
|
- {{ type }}
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
- </el-drawer>
|
|
|
- <div class="filter-item">
|
|
|
- <span>时间:</span>
|
|
|
- <span class="time-label" @click="showTimePicker">
|
|
|
- {{ selectedTimeLabel || "请选择时间" }}
|
|
|
- </span>
|
|
|
- <i class="el-icon-arrow-down" />
|
|
|
- </div>
|
|
|
- <div class="filter-item">
|
|
|
- <span>排序:</span>
|
|
|
- <span class="sort-order" @click="toggleSortOrder">
|
|
|
- {{ sortOrder === "asc" ? "↑" : "↓" }}
|
|
|
- <i
|
|
|
- :class="['el-icon-arrow-up', sortOrder === 'asc' ? 'active' : '']"
|
|
|
- />
|
|
|
- <i
|
|
|
- :class="[
|
|
|
- 'el-icon-arrow-down',
|
|
|
- sortOrder === 'desc' ? 'active' : ''
|
|
|
- ]"
|
|
|
- />
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <van-dropdown-item title="时间" ref="timeRef">
|
|
|
+ <van-picker-group title='发布时间' :tabs="['开始日期', '结束日期']" @confirm="onConfirmTime" @cancel="onCancelTime">
|
|
|
+ <van-date-picker v-model="queryParams.begin_time"/>
|
|
|
+ <van-date-picker v-model="queryParams.end_time"/>
|
|
|
+ </van-picker-group>
|
|
|
+ </van-dropdown-item>
|
|
|
+ <van-dropdown-item
|
|
|
+ v-model="queryParams.info_order"
|
|
|
+ :title="!!queryParams.info_order ? '' : '时间顺序'"
|
|
|
+ :options="opt_info_order"
|
|
|
+ @change="change_info_order"
|
|
|
+ />
|
|
|
+ </van-dropdown-menu>
|
|
|
|
|
|
- <!-- 信息列表 -->
|
|
|
- <div v-for="(item, index) in sortedDataList" :key="index" class="info-box">
|
|
|
- <div class="status-icon" :class="getStatusClass(item.examine_status)" />
|
|
|
- <div class="info-content">
|
|
|
- <div class="info-header">
|
|
|
- <div class="info-title">{{ item.title }}</div>
|
|
|
- <div class="info-time">{{ item.publish_time }}</div>
|
|
|
- </div>
|
|
|
- <div class="info-description">
|
|
|
- <div>发布人:{{ item.nick_name }}</div>
|
|
|
- <div>部门:{{ item.dept_name }}</div>
|
|
|
- <div>发布渠道:{{ item.publish_channel }}</div>
|
|
|
- <div>阅读次数:{{ item.user_count }}</div>
|
|
|
- <div>审核状态:{{ item.examine_status }}</div>
|
|
|
- <div>发布状态:{{ item.publish_status }}</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <!-- 时间选择抽屉 -->
|
|
|
- <el-drawer
|
|
|
- v-model="drawerVisible"
|
|
|
- title="选择时间"
|
|
|
- direction="btt"
|
|
|
- size="30%"
|
|
|
+ <van-list
|
|
|
+ v-model:loading="loading"
|
|
|
+ v-model:error="error"
|
|
|
+ error-text="请求失败,点击重新加载"
|
|
|
+ :finished="finished"
|
|
|
+ finished-text="没有更多信息了"
|
|
|
+ class="list"
|
|
|
+ @load="getList"
|
|
|
>
|
|
|
- <el-date-picker
|
|
|
- v-model="selectedTime"
|
|
|
- type="daterange"
|
|
|
- range-separator="至"
|
|
|
- start-placeholder="开始日期"
|
|
|
- end-placeholder="结束日期"
|
|
|
- @change="handleTimeChange"
|
|
|
- />
|
|
|
- <span class="drawer-footer">
|
|
|
- <el-button @click="drawerVisible = false">取消</el-button>
|
|
|
- <el-button type="primary" @click="confirmTime">确定</el-button>
|
|
|
- </span>
|
|
|
- </el-drawer>
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in info_list"
|
|
|
+ :key="item.id"
|
|
|
+ class="event-list-item"
|
|
|
+ @click="handleInfo(item)"
|
|
|
+ >
|
|
|
+ <div class="item-title">
|
|
|
+ <div :class="['info_type', get_info_type_color(item.info_type)]">
|
|
|
+ {{ get_info_type_text(item.info_type) }}
|
|
|
+ </div>
|
|
|
+ <div class="item-title-text">
|
|
|
+ {{ item.publish_time }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="item-content">
|
|
|
+ {{ item.content || "暂无内容"}}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </van-list>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { ref, onMounted, onUnmounted, watch, computed } from "vue";
|
|
|
+import { getCurrentInstance, ref, toRefs } from "vue";
|
|
|
+import { useRouter } from "vue-router";
|
|
|
import { InformationList } from "@/api/InformationReception/InformationReception";
|
|
|
-import { parseTime } from "@/utils/ruoyi";
|
|
|
-import {
|
|
|
- ElInput,
|
|
|
- ElDrawer,
|
|
|
- ElDatePicker,
|
|
|
- ElButton,
|
|
|
- ElIconArrowDown
|
|
|
-} from "element-plus";
|
|
|
+import searchImg from "@/assets/images/search.png";
|
|
|
+import closeImg from "@/assets/images/close.png";
|
|
|
+import {parseTime} from "@/utils/ruoyi";
|
|
|
+import dayjs, { Dayjs } from "dayjs";
|
|
|
|
|
|
-const dataList = ref([]);
|
|
|
-const selectedType = ref("↓");
|
|
|
-const types = ref(["预警", "灾情", "处置", "指挥救援", "公众防范"]);
|
|
|
-const selectedTime = ref([null, null]);
|
|
|
-const sortOrder = ref("desc");
|
|
|
-const drawerVisible = ref(false); // 确保使用 ref 定义
|
|
|
-const selectedTimeLabel = ref("↓");
|
|
|
-const typeDrawerVisible = ref(false);
|
|
|
-const searchQuery = ref("");
|
|
|
+const proxy = getCurrentInstance()?.proxy;
|
|
|
+//const { mm_info_type, mm_event_level, mm_event_state } = toRefs<any>(
|
|
|
+// proxy?.useDict("mm_info_type", "mm_event_level", "mm_event_state")
|
|
|
+//);
|
|
|
|
|
|
-const sortedDataList = computed(() => {
|
|
|
- return dataList.value.slice().sort((a, b) => {
|
|
|
- if (sortOrder.value === "asc") {
|
|
|
- return new Date(a.publish_time) - new Date(b.publish_time);
|
|
|
- } else {
|
|
|
- return new Date(b.publish_time) - new Date(a.publish_time);
|
|
|
- }
|
|
|
- });
|
|
|
-});
|
|
|
+const router = useRouter();
|
|
|
|
|
|
-const showTypePicker = () => {
|
|
|
- typeDrawerVisible.value = true;
|
|
|
-};
|
|
|
+const opt_info_type = [
|
|
|
+ { text: "全部", value: "" },
|
|
|
+ { text: "预警信息", value: "0" },
|
|
|
+ { text: "灾情信息", value: "1" },
|
|
|
+ { text: "处置信息", value: "2" },
|
|
|
+ { text: "指挥救援", value: "3" },
|
|
|
+ { text: "公众防范", value: "4" }
|
|
|
+];
|
|
|
|
|
|
-const selectType = type => {
|
|
|
- selectedType.value = type;
|
|
|
- typeDrawerVisible.value = false;
|
|
|
- fetchData(); // 重新获取数据
|
|
|
-};
|
|
|
+const opt_info_order = [
|
|
|
+ { text: "升序", value: "asc" },
|
|
|
+ { text: "降序", value: "desc" }
|
|
|
+];
|
|
|
|
|
|
-const fetchData = async () => {
|
|
|
- try {
|
|
|
- const params = {
|
|
|
- publish_group: "",
|
|
|
- publish_status: "0",
|
|
|
- examine_status: "0",
|
|
|
- page: "1",
|
|
|
- page_size: "20"
|
|
|
- };
|
|
|
- const res = await InformationList(params);
|
|
|
- dataList.value = res.data.map(item => {
|
|
|
- item.publish_time = parseTime(item.publish_time);
|
|
|
- return item;
|
|
|
- });
|
|
|
- sortedDataList.value = dataList.value;
|
|
|
- } catch (error) {
|
|
|
- console.error("请求任务数据失败:", error);
|
|
|
- }
|
|
|
-};
|
|
|
+const get_info_type_text = (val) => {
|
|
|
+ return opt_info_type.find(item => item.value == val).text
|
|
|
+}
|
|
|
|
|
|
-onMounted(() => {
|
|
|
- fetchData();
|
|
|
-});
|
|
|
+const get_info_type_color = (val) => {
|
|
|
+ return "info_type_" + val
|
|
|
+}
|
|
|
|
|
|
-onUnmounted(() => {
|
|
|
- // 清除定时器等资源
|
|
|
-});
|
|
|
+const onConfirmTime = () => {
|
|
|
+ timeRef.value.toggle();
|
|
|
+ queryParams.value.page = 0;
|
|
|
+ getList();
|
|
|
+}
|
|
|
|
|
|
-const toggleSortOrder = () => {
|
|
|
- sortOrder.value = sortOrder.value === "asc" ? "desc" : "asc";
|
|
|
-};
|
|
|
+const onCancelTime = () => {
|
|
|
+ timeRef.value.toggle();
|
|
|
+}
|
|
|
|
|
|
-watch(
|
|
|
- () => [selectedType.value, selectedTime.value, sortOrder.value],
|
|
|
- () => {
|
|
|
- fetchData();
|
|
|
- }
|
|
|
-);
|
|
|
+const timeRef = ref(null);
|
|
|
+const info_list = ref([]);
|
|
|
+const total = ref(0);
|
|
|
+const loading = ref(false);
|
|
|
+const error = ref(false);
|
|
|
+const finished = ref(false);
|
|
|
+
|
|
|
+const queryParams = ref({
|
|
|
+ page: 0,
|
|
|
+ page_size: 5,
|
|
|
+ info_type: "",
|
|
|
+ begin_time: dayjs().add(-1, 'month').format('YYYY-MM-DD').split("-"),
|
|
|
+ end_time: dayjs().format('YYYY-MM-DD').split("-"),
|
|
|
+ event_level: "",
|
|
|
+ info_order: "desc",
|
|
|
+ search_keyword: ""
|
|
|
+});
|
|
|
|
|
|
-const showTimePicker = () => {
|
|
|
- drawerVisible.value = true;
|
|
|
+const on_search_keyword = val => {
|
|
|
+ queryParams.value.search_keyword = val;
|
|
|
+ queryParams.value.page = 0;
|
|
|
+ getList();
|
|
|
};
|
|
|
|
|
|
-const handleTimeChange = value => {
|
|
|
- selectedTimeLabel.value = value ? `${value[0]} 至 ${value[1]}` : "请选择时间";
|
|
|
+const on_search_cancel = () => {
|
|
|
+ queryParams.value.search_keyword = "";
|
|
|
+ queryParams.value.page = 0;
|
|
|
+ getList();
|
|
|
};
|
|
|
|
|
|
-const confirmTime = () => {
|
|
|
- drawerVisible.value = false;
|
|
|
- fetchData(); // 重新获取数据
|
|
|
+const change_info_type = () => {
|
|
|
+ queryParams.value.page = 0;
|
|
|
+ getList();
|
|
|
};
|
|
|
|
|
|
-const getStatusClass = (status: string): string => {
|
|
|
- switch (status) {
|
|
|
- case "审核中":
|
|
|
- return "warning-icon";
|
|
|
- case "待审批":
|
|
|
- return "pending-icon";
|
|
|
- case "已通过":
|
|
|
- return "success-icon";
|
|
|
- case "已拒绝":
|
|
|
- return "error-icon";
|
|
|
- default:
|
|
|
- return "";
|
|
|
- }
|
|
|
+const change_info_order = () => {
|
|
|
+ queryParams.value.page = 0;
|
|
|
+ getList();
|
|
|
};
|
|
|
|
|
|
-//搜索
|
|
|
-const onSearch = () => {
|
|
|
- // 执行搜索操作
|
|
|
- console.log("搜索内容:", searchQuery.value);
|
|
|
- // 这里可以添加搜索的逻辑,比如调用 API 或更新数据列表
|
|
|
+const handleInfo = (item) => {
|
|
|
+ router.push("/infoDetails?id=" + item.id);
|
|
|
+}
|
|
|
+
|
|
|
+const getList = () => {
|
|
|
+ queryParams.value.page++;
|
|
|
+ let params = queryParams.value;
|
|
|
+ params['begin_time_s'] = params.begin_time.join("-");
|
|
|
+ params['end_time_s'] = params.end_time.join("-");
|
|
|
+ // console.log('params:', queryParams.value, params);
|
|
|
+ InformationList(params)
|
|
|
+ .then(res => {
|
|
|
+ var items = res.data || [];
|
|
|
+ total.value = res.total;
|
|
|
+ if (queryParams.value.page == 1) {
|
|
|
+ info_list.value = [];
|
|
|
+ }
|
|
|
+ items.forEach(val => {
|
|
|
+ info_list.value.push(val);
|
|
|
+ });
|
|
|
+ if (queryParams.value.page_size * queryParams.value.page >= total.value) {
|
|
|
+ finished.value = true;
|
|
|
+ } else {
|
|
|
+ finished.value = false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ error.value = true;
|
|
|
+ finished.value = false;
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ loading.value = false;
|
|
|
+ });
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
-<style scoped>
|
|
|
-.table-content {
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
+<style lang="scss" scoped>
|
|
|
+.list {
|
|
|
+ height: calc(100vh - 102px);
|
|
|
+ overflow-y: auto;
|
|
|
}
|
|
|
-
|
|
|
-.filter-sort-area {
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- margin-bottom: 16px;
|
|
|
+.van-doc-block__title {
|
|
|
+ color: var(--van-doc-text-color-4);
|
|
|
+ margin: 0;
|
|
|
+ padding: 32px 16px 16px;
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: 400;
|
|
|
+ line-height: 16px;
|
|
|
}
|
|
|
|
|
|
-.filter-item {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- margin-right: 16px;
|
|
|
-}
|
|
|
+.event-list-item {
|
|
|
+ position: relative;
|
|
|
+ margin: 16px 16px 0;
|
|
|
+ background: #ffffff;
|
|
|
+ border-radius: 4px;
|
|
|
+ border: 0.5px solid #eaedf7;
|
|
|
+ box-shadow: 0 0 4px 0 #4554661a;
|
|
|
+ &:first-child {
|
|
|
+ margin-top: 0;
|
|
|
+ }
|
|
|
+ .item-title {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: flex-start;
|
|
|
+ min-height: 46px;
|
|
|
+ background-image: linear-gradient(180deg, #f3f7fd 0%, #ffffff 100%);
|
|
|
+ padding: 0 12px;
|
|
|
+ .item-title-text {
|
|
|
+ font-size: 14px;
|
|
|
+ color: #414f64;
|
|
|
+ }
|
|
|
|
|
|
-.info-box {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- padding: 10px;
|
|
|
- border-bottom: 1px solid #eee;
|
|
|
-}
|
|
|
+ .info_type {
|
|
|
+ font-size: 14px;
|
|
|
+ padding: 3px 10px;
|
|
|
+ color:#fff;
|
|
|
+ margin-right: 10px;
|
|
|
+ }
|
|
|
|
|
|
-.status-icon {
|
|
|
- width: 20px;
|
|
|
- height: 20px;
|
|
|
- margin-right: 10px;
|
|
|
-}
|
|
|
+ .info_type_0 {
|
|
|
+ background: #FF9518;
|
|
|
+ }
|
|
|
|
|
|
-.info-content {
|
|
|
- flex: 1;
|
|
|
-}
|
|
|
+ .info_type_1 {
|
|
|
+ background: #FF1818;
|
|
|
+ }
|
|
|
|
|
|
-.info-header {
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- align-items: center;
|
|
|
-}
|
|
|
+ .info_type_2 {
|
|
|
+ background: #2c81ff;
|
|
|
+ }
|
|
|
|
|
|
-.info-title {
|
|
|
- font-weight: bold;
|
|
|
-}
|
|
|
+ .info_type_3 {
|
|
|
+ background: #FF9F9F;
|
|
|
+ }
|
|
|
|
|
|
-.info-time {
|
|
|
- font-size: 0.8em;
|
|
|
- color: #888;
|
|
|
+ .info_type_4 {
|
|
|
+ background: #A4D3FF;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .item-content {
|
|
|
+ padding: 0 12px 12px;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #414f64;
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
-.info-description {
|
|
|
- color: #333;
|
|
|
+.van-dropdown-menu {
|
|
|
+ :deep(.van-dropdown-menu__bar) {
|
|
|
+ background: transparent;
|
|
|
+ box-shadow: none;
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
-.el-icon-arrow-down {
|
|
|
- margin-left: 8px;
|
|
|
+.common-search {
|
|
|
+ :deep(.van-field__left-icon) {
|
|
|
+ .van-icon__image {
|
|
|
+ width: 12px;
|
|
|
+ height: 12px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ :deep(.van-field__right-icon) {
|
|
|
+ width: 30px;
|
|
|
+ height: 30px;
|
|
|
+ padding: 0;
|
|
|
+ .van-icon__image {
|
|
|
+ width: 30px;
|
|
|
+ height: 30px;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
-.sort-order {
|
|
|
- cursor: pointer;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
+.icon1 {
|
|
|
+ width: 17px;
|
|
|
+ height: 16px;
|
|
|
+ background: url("@/assets/images/event/icon1.png") no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ margin-right: 7px;
|
|
|
}
|
|
|
-
|
|
|
-.el-icon-arrow-up,
|
|
|
-.el-icon-arrow-down {
|
|
|
- margin-left: 5px;
|
|
|
+.icon2 {
|
|
|
+ width: 17px;
|
|
|
+ height: 16px;
|
|
|
+ background: url("@/assets/images/event/icon2.png") no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ margin-right: 7px;
|
|
|
}
|
|
|
-
|
|
|
-.search-box {
|
|
|
- padding: 10px;
|
|
|
- background-color: #f5f5f5;
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
- align-items: center;
|
|
|
+.icon3 {
|
|
|
+ width: 17px;
|
|
|
+ height: 16px;
|
|
|
+ background: url("@/assets/images/event/icon3.png") no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ margin-right: 7px;
|
|
|
}
|
|
|
-
|
|
|
-.search-input {
|
|
|
- width: 300px;
|
|
|
+.icon4 {
|
|
|
+ width: 17px;
|
|
|
+ height: 16px;
|
|
|
+ background: url("@/assets/images/event/icon4.png") no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ margin-right: 7px;
|
|
|
+}
|
|
|
+.icon5 {
|
|
|
+ width: 16px;
|
|
|
+ height: 16px;
|
|
|
+ background: url("@/assets/images/event/icon5.png") no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ margin-right: 7px;
|
|
|
}
|
|
|
</style>
|