approvalList.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <div class="container">
  3. <!--搜索框-->
  4. <van-search
  5. v-model="queryParams.search_keyword"
  6. class="common-search"
  7. placeholder="请输入信息"
  8. :left-icon="searchImg"
  9. :right-icon="closeImg"
  10. :clearable="false"
  11. @search="on_search_keyword"
  12. @click-right-icon.stop="on_search_cancel"
  13. />
  14. <!--三个类型选择-->
  15. <van-dropdown-menu>
  16. <van-dropdown-item
  17. v-model="queryParams.info_type"
  18. :title="!!queryParams.info_type ? '' : '审批类型'"
  19. :options="opt_info_type"
  20. @change="change_info_type"
  21. />
  22. <van-dropdown-item
  23. v-model="queryParams.time_type"
  24. :title="!!queryParams.time_type ? '' : '时间'"
  25. :options="opt_time_type"
  26. @change="change_time_type"
  27. </van-dropdown-item>
  28. <van-dropdown-item
  29. v-model="queryParams.info_order"
  30. :title="!!queryParams.info_order ? '' : '时间顺序'"
  31. :options="opt_info_order"
  32. @change="change_info_order"
  33. />
  34. </van-dropdown-menu>
  35. <van-list
  36. v-model:loading="loading"
  37. v-model:error="error"
  38. error-text="请求失败,点击重新加载"
  39. :finished="finished"
  40. finished-text="没有更多信息了"
  41. class="list"
  42. @load="getList"
  43. >
  44. <div
  45. v-for="(item, index) in info_list"
  46. :key="item.id"
  47. class="event-list-item"
  48. @click="handleInfo(item)"
  49. >
  50. <div class="item-title">
  51. <div class="item-title-text">
  52. {{ item.publish_group }}
  53. </div>
  54. <div :class="['info_type', get_info_type_color(item.info_type)]">
  55. {{ get_info_type_text(item.info_type) }}
  56. </div>
  57. </div>
  58. <div class="item-content" style="display: flex; align-items: center; justify-content:space-between;">
  59. <div>申请时间:{{ item.add_time }} </div>
  60. <div>申请人:{{ item.nick_name }}</div>
  61. </div>
  62. <div class="item-content">
  63. 信息摘要:{{ item.content || "暂无信息摘要"}}
  64. </div>
  65. </div>
  66. </van-list>
  67. </div>
  68. </template>
  69. <script lang="ts" setup>
  70. import { getCurrentInstance, onMounted, ref, toRefs } from "vue";
  71. import { useRouter } from "vue-router";
  72. import { WorkApprovalList } from "@/api/InformationReception/InformationReception";
  73. import searchImg from "@/assets/images/search.png";
  74. import closeImg from "@/assets/images/close.png";
  75. interface Props {
  76. status: number;
  77. }
  78. const props = withDefaults(defineProps<Props>(), {
  79. status: 0
  80. });
  81. const router = useRouter();
  82. const opt_info_type = [
  83. { text: "全部", value: "" },
  84. { text: "预警信息", value: "0" },
  85. { text: "灾害事件", value: "1" },
  86. { text: "灾情信息", value: "2" },
  87. { text: "灾害资讯", value: "3" },
  88. { text: "应急救援总结报告", value: "4" }
  89. ];
  90. const opt_time_type = [
  91. { text: "全部", value: "" },
  92. { text: "一周内", value: "0" },
  93. { text: "一个月内", value: "1" },
  94. { text: "六个月内", value: "2" }
  95. ];
  96. const opt_info_order = [
  97. { text: "升序", value: "asc" },
  98. { text: "降序", value: "desc" }
  99. ];
  100. const get_info_type_text = (val) => {
  101. return opt_info_type.find(item => item.value == val).text
  102. }
  103. const get_info_type_color = (val) => {
  104. return "info_type_" + val
  105. }
  106. const info_list = ref([]);
  107. const total = ref(0);
  108. const loading = ref(false);
  109. const error = ref(false);
  110. const finished = ref(false);
  111. const queryParams = ref({
  112. page: 0,
  113. page_size: 5,
  114. status: 0,
  115. info_type: "",
  116. time_type: "",
  117. event_level: "",
  118. info_order: "desc",
  119. search_keyword: ""
  120. });
  121. const on_search_keyword = val => {
  122. queryParams.value.search_keyword = val;
  123. queryParams.value.page = 0;
  124. getList();
  125. };
  126. const on_search_cancel = () => {
  127. queryParams.value.search_keyword = "";
  128. queryParams.value.page = 0;
  129. getList();
  130. };
  131. const change_info_type = () => {
  132. queryParams.value.page = 0;
  133. getList();
  134. };
  135. const change_time_type = () => {
  136. queryParams.value.page = 0;
  137. getList();
  138. };
  139. const change_info_order = () => {
  140. queryParams.value.page = 0;
  141. getList();
  142. };
  143. const handleInfo = (item) => {
  144. router.push("/workApproval/detail?id=" + item.id);
  145. }
  146. const getList = () => {
  147. queryParams.value.status = props.status;
  148. queryParams.value.page++;
  149. let params = queryParams.value;
  150. WorkApprovalList(params)
  151. .then(res => {
  152. var items = res.data || [];
  153. total.value = res.total;
  154. if (queryParams.value.page == 1) {
  155. info_list.value = [];
  156. }
  157. items.forEach(val => {
  158. info_list.value.push(val);
  159. });
  160. if (queryParams.value.page_size * queryParams.value.page >= total.value) {
  161. finished.value = true;
  162. } else {
  163. finished.value = false;
  164. }
  165. })
  166. .catch(() => {
  167. error.value = true;
  168. finished.value = false;
  169. })
  170. .finally(() => {
  171. loading.value = false;
  172. });
  173. };
  174. </script>
  175. <style lang="scss" scoped>
  176. .list {
  177. height: calc(100vh - 102px);
  178. overflow-y: auto;
  179. }
  180. .van-doc-block__title {
  181. color: var(--van-doc-text-color-4);
  182. margin: 0;
  183. padding: 32px 16px 16px;
  184. font-size: 14px;
  185. font-weight: 400;
  186. line-height: 16px;
  187. }
  188. .event-list-item {
  189. position: relative;
  190. margin: 16px 16px 0;
  191. background: #ffffff;
  192. border-radius: 4px;
  193. border: 0.5px solid #eaedf7;
  194. box-shadow: 0 0 4px 0 #4554661a;
  195. &:first-child {
  196. margin-top: 0;
  197. }
  198. .item-title {
  199. display: flex;
  200. align-items: center;
  201. justify-content:space-between;
  202. min-height: 46px;
  203. background-image: linear-gradient(180deg, #f3f7fd 0%, #ffffff 100%);
  204. padding: 0 12px;
  205. .item-title-text {
  206. font-size: 14px;
  207. color: #414f64;
  208. font-weight: 600;
  209. max-width: 200px;
  210. overflow: hidden;
  211. white-space: nowrap;
  212. text-overflow: ellipsis;
  213. }
  214. .info_type {
  215. font-size: 14px;
  216. padding: 3px 10px;
  217. color:#fff;
  218. margin-right: 5px;
  219. white-space: nowrap;
  220. }
  221. .info_type_0 {
  222. background: #FFAF00;
  223. }
  224. .info_type_1 {
  225. background: #FF1818;
  226. }
  227. .info_type_2 {
  228. background: #2c81ff;
  229. }
  230. .info_type_3 {
  231. background: #FF9F9F;
  232. }
  233. .info_type_4 {
  234. background: #A4D3FF;
  235. }
  236. }
  237. .item-content {
  238. padding: 0 12px 12px;
  239. font-size: 14px;
  240. color: #414f64;
  241. }
  242. }
  243. .van-dropdown-menu {
  244. :deep(.van-dropdown-menu__bar) {
  245. background: transparent;
  246. box-shadow: none;
  247. }
  248. }
  249. .common-search {
  250. :deep(.van-field__left-icon) {
  251. .van-icon__image {
  252. width: 12px;
  253. height: 12px;
  254. }
  255. }
  256. :deep(.van-field__right-icon) {
  257. width: 30px;
  258. height: 30px;
  259. padding: 0;
  260. .van-icon__image {
  261. width: 30px;
  262. height: 30px;
  263. }
  264. }
  265. }
  266. .icon1 {
  267. width: 17px;
  268. height: 16px;
  269. background: url("@/assets/images/event/icon1.png") no-repeat;
  270. background-size: 100% 100%;
  271. margin-right: 7px;
  272. }
  273. .icon2 {
  274. width: 17px;
  275. height: 16px;
  276. background: url("@/assets/images/event/icon2.png") no-repeat;
  277. background-size: 100% 100%;
  278. margin-right: 7px;
  279. }
  280. .icon3 {
  281. width: 17px;
  282. height: 16px;
  283. background: url("@/assets/images/event/icon3.png") no-repeat;
  284. background-size: 100% 100%;
  285. margin-right: 7px;
  286. }
  287. .icon4 {
  288. width: 17px;
  289. height: 16px;
  290. background: url("@/assets/images/event/icon4.png") no-repeat;
  291. background-size: 100% 100%;
  292. margin-right: 7px;
  293. }
  294. .icon5 {
  295. width: 16px;
  296. height: 16px;
  297. background: url("@/assets/images/event/icon5.png") no-repeat;
  298. background-size: 100% 100%;
  299. margin-right: 7px;
  300. }
  301. </style>