planManageDialog.vue 7.6 KB

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