planManageDialog.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <Dialog v-model="localValue" custom-show type="xl" title="预案管理列表" hide-footer @close="handleClose">
  3. <transition name="fade">
  4. <div v-if="isFormVisible" class="mb-[20px]">
  5. <el-form ref="queryFormRef" :model="planForm" :inline="true">
  6. <el-row :gutter="20">
  7. <!-- 预案类型 -->
  8. <el-col :span="6">
  9. <el-form-item label="预案类型" prop="planType" label-width="200px">
  10. <el-select
  11. v-model="planForm.planType"
  12. placeholder="全部"
  13. class="custom-select"
  14. :teleported="false"
  15. size="large"
  16. popper-class="custom-select-popper"
  17. clearable
  18. >
  19. <el-option label="全部" value=""></el-option>
  20. <el-option v-for="item in plan_type" :key="item.value" :label="item.label" :value="item.value"></el-option>
  21. </el-select>
  22. </el-form-item>
  23. </el-col>
  24. <!-- 发布日期 -->
  25. <el-col :span="6">
  26. <el-form-item label="发布日期" prop="publish_date" label-width="200px">
  27. <el-date-picker
  28. v-model="dateRange"
  29. type="date"
  30. range-separator="-"
  31. placeholder="选择发布日期"
  32. start-placeholder="开始日期"
  33. end-placeholder="结束日期"
  34. value-format="YYYY-MM-DD"
  35. class="common-date-picker"
  36. popper-class="common-date-popper"
  37. :teleported="false"
  38. style="width: 100%"
  39. ></el-date-picker>
  40. </el-form-item>
  41. </el-col>
  42. <!-- 关键词搜索 -->
  43. <el-col :span="6">
  44. <el-form-item label="关键词" label-width="200px">
  45. <el-input
  46. v-model="planForm.keywords"
  47. class="custom-input2"
  48. placeholder="请输入预案名称/编制单位"
  49. clearable
  50. style="width: 600px"
  51. @keyup.enter="handleQuery"
  52. />
  53. </el-form-item>
  54. </el-col>
  55. <!-- 操作按钮 -->
  56. <el-col :span="6">
  57. <div class="flex" style="align-items: flex-start">
  58. <div class="common-btn-primary" style="margin-top: -32px" @click="handleQuery">搜索</div>
  59. <div class="common-btn" style="margin-left: 10px" @click="resetQuery">重置</div>
  60. </div>
  61. </el-col>
  62. </el-row>
  63. </el-form>
  64. </div>
  65. </transition>
  66. <!-- 表格组件 -->
  67. <div class="common-table">
  68. <div class="table-header">
  69. <div class="td">预案编号</div>
  70. <div class="td">预案名称</div>
  71. <div class="td">预案类型</div>
  72. <div class="td">发文字号</div>
  73. <div class="td">编制单位</div>
  74. <div class="td">发布日期</div>
  75. <div class="td">操作</div>
  76. </div>
  77. <div v-for="(item, index) in demoList" :key="index" class="tr">
  78. <div class="td">{{ item.planId }}</div>
  79. <div class="td">{{ item.planName }}</div>
  80. <!-- <div class="td">{{ item.planType }}</div>-->
  81. <div v-if="item.planType === '1' || item.planType === '2' || item.planType === '3'" class="flex">
  82. <template v-if="item.planType === '1'">
  83. <div>总体应急预案</div>
  84. </template>
  85. <template v-if="item.planType === '2'">
  86. <div>专项应急预案</div>
  87. </template>
  88. <template v-if="item.planType === '3'">
  89. <div>部门应急预案</div>
  90. </template>
  91. </div>
  92. <div class="td">{{ item.document }}</div>
  93. <div class="td">{{ item.organizingUnit }}</div>
  94. <div class="td">{{ item.publishDate }}</div>
  95. <div class="td">
  96. <div class="common-btn2" @click="showDetail(item)">查看</div>
  97. </div>
  98. </div>
  99. </div>
  100. <!-- 底部分页 -->
  101. <div class="footer">
  102. <pagination
  103. v-show="total > 0"
  104. v-model:page="planForm.pageNum"
  105. v-model:limit="planForm.pageSize"
  106. :total="total"
  107. layout="total, prev, pager, next"
  108. @pagination="getList"
  109. />
  110. </div>
  111. </Dialog>
  112. </template>
  113. <script setup lang="ts">
  114. import { ref, reactive, onMounted, defineProps, defineEmits, toRefs } from 'vue';
  115. import { useRouter } from 'vue-router';
  116. import { parseTime } from '@/utils/ruoyi';
  117. import { getEmergencyPlanList } from '@/api/routineCommandMap';
  118. // 定义props和emit
  119. const props = defineProps({
  120. modelValue: {
  121. type: Boolean,
  122. default: false
  123. }
  124. });
  125. const emit = defineEmits(['update:modelValue']);
  126. // 内部局部状态来控制弹窗显示
  127. const localValue = ref(props.modelValue);
  128. // 监听外部的 modelValue 变化,并同步到本地的 localValue
  129. watch(
  130. () => props.modelValue,
  131. (newVal) => {
  132. localValue.value = newVal;
  133. }
  134. );
  135. // 在关闭弹窗时,发出事件通知父组件更新 modelValue
  136. const handleClose = () => {
  137. emit('update:modelValue', false);
  138. };
  139. // 数据管理
  140. const demoList = ref<any[]>([]);
  141. const loading = ref(false);
  142. const total = ref(0);
  143. const dateRange = ref<[string, string]>(['', '']);
  144. const planForm = reactive({
  145. pageNum: 1,
  146. pageSize: 10,
  147. planType: '',
  148. keywords: '',
  149. sortBy: 'publish_date',
  150. sortOrder: 'desc'
  151. });
  152. const isFormVisible = ref(true);
  153. const router = useRouter();
  154. onMounted(() => {
  155. getList();
  156. });
  157. const proxy = getCurrentInstance()?.proxy;
  158. const { plan_type } = toRefs<any>(proxy?.useDict('plan_type'));
  159. // 获取列表
  160. const getList = () => {
  161. loading.value = true;
  162. const params = {
  163. ...planForm,
  164. startDate: dateRange.value[0],
  165. endDate: dateRange.value[1]
  166. };
  167. // 获取预案列表
  168. getEmergencyPlanList(params).then((res) => {
  169. demoList.value = res.data;
  170. total.value = res.total;
  171. loading.value = false;
  172. });
  173. };
  174. // 查询
  175. const handleQuery = () => {
  176. planForm.pageNum = 1;
  177. getList();
  178. };
  179. const resetQuery = () => {
  180. planForm.pageNum = 1;
  181. planForm.planType = '';
  182. planForm.keywords = '';
  183. dateRange.value = ['', ''];
  184. getList();
  185. };
  186. // 显示预案详情
  187. const handleView = (row: PlanVO) => {
  188. router.push({
  189. path: '/riskPrevention/planManage/planList',
  190. query: { planId: row.planId }
  191. });
  192. };
  193. </script>
  194. <style lang="scss" scoped>
  195. .dialog-wrap {
  196. position: fixed;
  197. top: 0;
  198. right: 0;
  199. left: 0;
  200. bottom: 0;
  201. z-index: 2000;
  202. width: 100%;
  203. height: 100%;
  204. display: flex;
  205. align-items: center;
  206. justify-content: center;
  207. .overlay {
  208. background-color: rgba(0, 0, 0, 0.5);
  209. position: absolute;
  210. top: 0;
  211. left: 0;
  212. width: 100%;
  213. height: 100%;
  214. z-index: -1;
  215. cursor: pointer;
  216. }
  217. .dialog {
  218. width: 5000px;
  219. height: 2000px;
  220. margin: 0 auto;
  221. background-color: #fff;
  222. border-radius: 20px;
  223. }
  224. }
  225. .dialog {
  226. padding: 0 50px;
  227. .dialog-header {
  228. width: 100%;
  229. height: 150px;
  230. display: flex;
  231. justify-content: space-between;
  232. align-items: center;
  233. .icon-close {
  234. cursor: pointer;
  235. }
  236. }
  237. }
  238. .footer {
  239. height: 64px;
  240. display: flex;
  241. justify-content: flex-end;
  242. margin-bottom: 30px;
  243. .pagination-container {
  244. height: 64px;
  245. margin: 0;
  246. }
  247. :deep(.el-pagination__total) {
  248. color: #a7ccdf;
  249. font-size: 32px;
  250. }
  251. :deep(.el-pagination) {
  252. .btn-next,
  253. .btn-prev {
  254. background-color: transparent;
  255. border: none;
  256. .el-icon {
  257. font-size: 22px;
  258. color: #a7ccdf;
  259. }
  260. }
  261. .btn-prev:disabled,
  262. .btn-next:disabled {
  263. background-color: transparent;
  264. border: none;
  265. }
  266. .el-pager li {
  267. width: 64px;
  268. height: 64px;
  269. line-height: 64px;
  270. text-align: center;
  271. font-size: 32px;
  272. color: #a7ccdf;
  273. background-color: #0e3064;
  274. border: 1px solid #0c57a7;
  275. margin: 0 6px;
  276. &:hover {
  277. background-color: #038dff;
  278. border: 1px solid #038dff;
  279. }
  280. }
  281. .el-pager li.is-active {
  282. background-color: #038dff;
  283. border: 1px solid #038dff;
  284. }
  285. }
  286. }
  287. .flex {
  288. display: flex;
  289. align-items: flex-start;
  290. }
  291. </style>