informationList.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <template>
  2. <div class="app-container">
  3. <div v-show="!informationDetailState.show && !informationViewState.show && !informationApprovalState.show">
  4. <transition name="fade">
  5. <div v-show="showSearch">
  6. <el-form ref="queryFormRef" :model="queryParams" label-width="auto">
  7. <el-row :gutter="20">
  8. <el-col :span="8">
  9. <div style="margin-bottom:10px;">
  10. <el-segmented v-model="queryParams.dispose_status" :options="disposeStatusOptions" size="large" block @change="handleDisposeStatus" />
  11. </div>
  12. </el-col>
  13. </el-row>
  14. <el-row :gutter="24">
  15. <el-col :span="6">
  16. <el-form-item label="发布单位:">
  17. <el-input v-model="queryParams.publish_group" placeholder="请输入内容" clearable></el-input>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :span="6">
  21. <el-form-item label="发布状态:">
  22. <el-select v-model="queryParams.publish_status" placeholder="请选择">
  23. <el-option v-for="item in publishStatusOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
  24. </el-select>
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="6">
  28. <el-form-item label="审批状态:">
  29. <el-select v-model="queryParams.examine_status" placeholder="请选择">
  30. <el-option v-for="item in approvalStatusOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
  31. </el-select>
  32. </el-form-item>
  33. </el-col>
  34. <el-col :span="5">
  35. <el-button type="primary" @click="handleSearch">查询</el-button>
  36. <el-button @click="resetSearch">重置</el-button>
  37. </el-col>
  38. </el-row>
  39. </el-form>
  40. </div>
  41. </transition>
  42. <!-- 表格组件 -->
  43. <el-table ref="multipleTable" v-loading="loading" :data="tableData" @selection-change="handleSelectionChange">
  44. <el-table-column label="序号" align="center" width="60">
  45. <template #default="scope">
  46. {{ (queryParams.page - 1) * queryParams.page_size + (scope.$index + 1) }}
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="发布单位" align="center" prop="publish_group" />
  50. <el-table-column label="信息内容" align="left" prop="content" width="400"/>
  51. <el-table-column label="发布时间" align="center" prop="publish_time" />
  52. <el-table-column label="发布渠道" align="center" prop="publish_channel" />
  53. <el-table-column label="发布申请人" align="center" prop="nick_name" />
  54. <el-table-column label="待处理人" align="center" prop="examine_user" />
  55. <el-table-column label="发布状态" align="center" prop="publish_status">
  56. <template #default="scope">
  57. <div class="common-flex">
  58. <i :class="getStatusClass(scope.row.publish_status)"></i>
  59. <dict-tag :options="publishStatusOptions" :value="scope.row.publish_status" />
  60. </div>
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="审批状态" align="center" prop="examine_status">
  64. <template #default="scope">
  65. <div class="common-flex">
  66. <i :class="getStatusClass2(scope.row.examine_status)"></i>
  67. <dict-tag :options="approvalStatusOptions" :value="scope.row.examine_status" />
  68. </div>
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="发布统计" align="center" prop="statistics">
  72. <template #default="scope">
  73. <div class="statistics-container">
  74. <p>选择人数: {{ scope.row.user_count }}</p>
  75. <p>成功: {{ scope.row.user_ok_count }}</p>
  76. <p>失败: {{ scope.row.user_err_count }}</p>
  77. <p>发送中: {{ scope.row.user_sending_count }}</p>
  78. </div>
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  82. <template #default="scope">
  83. <el-text class="common-btn-text-primary" @click="handleView(scope.row)">查看</el-text>
  84. <el-text v-if="scope.row && scope.row.is_my_edit" class="common-btn-text-primary" @click="handleUpdate(scope.row)">编辑</el-text>
  85. <el-text v-if="scope.row && scope.row.is_my_examine" class="common-btn-text-primary" @click="handleApproval(scope.row)">审批</el-text>
  86. </template>
  87. </el-table-column>
  88. </el-table>
  89. <pagination v-show="total > 0" v-model:page="queryParams.page" v-model:limit="queryParams.page_size" :total="total" @pagination="tableData" />
  90. </div>
  91. <InformationDetail v-if="informationDetailState.show" :event-id="informationDetailState.eventId" @close="handleCancel" />
  92. <InformationView v-if="informationViewState.show" :event-id="informationViewState.eventId" @close="handleCancel" />
  93. <InformationApproval v-if="informationApprovalState.show" :event-id="informationApprovalState.eventId" @close="handleCancel" />
  94. </div>
  95. </template>
  96. <script setup lang="ts">
  97. import { ref, reactive, toRefs, onMounted } from 'vue';
  98. import { getInformation } from '@/api/informationissue/informationissue';
  99. import InformationDetail from './informationDetail.vue';
  100. import InformationView from './informationView.vue';
  101. import InformationApproval from './informationApproval.vue';
  102. const showSearch = ref(true);
  103. const queryFormRef = ref();
  104. const tableData = ref([]);
  105. const loading = ref(true);
  106. const ids = ref([]);
  107. const selectedRow = ref(null);
  108. const initFormData = reactive({
  109. publish_group: '',
  110. publish_status: '',
  111. examine_status: '',
  112. dispose_status: '',
  113. content: '',
  114. publish_time: '',
  115. publish_channel: '',
  116. nick_name: '',
  117. examine_user: '',
  118. user_count: '',
  119. user_ok_count: '',
  120. user_err_count: '',
  121. user_sending_count: '',
  122. info_type: '',
  123. id: ''
  124. });
  125. // 表单数据
  126. const data = reactive({
  127. form: { ...initFormData },
  128. queryParams: {
  129. page: 1,
  130. page_size: 10,
  131. publish_group: '',
  132. publish_status: '',
  133. examine_status: '',
  134. dispose_status: '0'
  135. }
  136. });
  137. const { queryParams } = toRefs(data);
  138. const total = ref(0);
  139. const publishStatusOptions = reactive([
  140. { value: '0', label: '全部' },
  141. { value: '1', label: '草稿' },
  142. { value: '2', label: '审批中' },
  143. { value: '3', label: '发布中' },
  144. { value: '4', label: '已发布' },
  145. { value: '9', label: '取消发布' }
  146. ]);
  147. const approvalStatusOptions = reactive([
  148. { value: '0', label: '全部' },
  149. { value: '1', label: '待审批' },
  150. { value: '2', label: '审批中' },
  151. { value: '3', label: '审批通过' },
  152. { value: '9', label: '审批不通过' }
  153. ]);
  154. const disposeStatusOptions = reactive([
  155. { value: '0', label: '全部' },
  156. { value: '1', label: '待处理' },
  157. { value: '2', label: '已处理' }
  158. ]);
  159. const getStatusClass = (value) => {
  160. if (['发布中', '已发布'].includes(value)) {
  161. return 'dot-green';
  162. } else if (value === '未提交') {
  163. return 'dot-orange';
  164. } else if (value === '审批中') {
  165. return 'dot-red';
  166. }
  167. };
  168. const getStatusClass2 = (value) => {
  169. if (['审批通过'].includes(value)) {
  170. return 'dot-green';
  171. } else if (value === '待审批') {
  172. return 'dot-blue';
  173. } else if (['审批中'].includes(value)) {
  174. return 'dot-red';
  175. } else if (['未提交'].includes(value)) {
  176. return 'dot-grey';
  177. }
  178. };
  179. const handleDisposeStatus = (val: any) => {
  180. queryParams.value.dispose_status = val;
  181. handleSearch();
  182. };
  183. const handleSearch = () => {
  184. queryParams.value.page = 1;
  185. getList();
  186. };
  187. const resetSearch = () => {
  188. queryParams.value = { page: 1, page_size: 10, publish_group: '', publish_status: '', examine_status: '', dispose_status: '0' };
  189. handleSearch();
  190. };
  191. const handleSelectionChange = (selection) => {
  192. ids.value = selection.map((item) => item.eventId);
  193. selectedRow.value = selection.length === 1 ? selection[0] : null;
  194. };
  195. // 查看详情对话框
  196. let informationDetailState = reactive({
  197. show: false,
  198. eventId: ''
  199. });
  200. // 编辑对话框
  201. let informationViewState = reactive({
  202. show: false,
  203. eventId: ''
  204. });
  205. // 审批对话框
  206. let informationApprovalState = reactive({
  207. show: false,
  208. eventId: ''
  209. });
  210. const handleView = (row) => {
  211. if (row) {
  212. informationViewState.eventId = row.id + ''; // 假设eventId是id字段
  213. informationViewState.show = true;
  214. }
  215. };
  216. const handleUpdate = (row) => {
  217. if (row) {
  218. informationDetailState.eventId = row.id; // 假设eventId是id字段
  219. informationDetailState.show = true;
  220. }
  221. };
  222. const handleApproval = (row) => {
  223. if (row) {
  224. informationApprovalState.eventId = row.id + ''; // 假设eventId是id字段
  225. informationApprovalState.show = true;
  226. }
  227. };
  228. const handleCancel = () => {
  229. informationDetailState.show = false;
  230. informationViewState.show = false;
  231. informationApprovalState.show = false;
  232. };
  233. const getList = () => {
  234. loading.value = true;
  235. getInformation(queryParams.value) // 假设 getInformation 已经定义好
  236. .then((res) => {
  237. if (res.code === 200) {
  238. // 映射返回的数据到 tableData
  239. tableData.value = res.data.map((item) => ({
  240. id: item.id,
  241. info_type: item.info_type,
  242. publish_group: item.publish_group || '未知',
  243. content: item.content || '未知',
  244. publish_time: item.publish_time || '未知',
  245. publish_channel: item.publish_channel || '未知',
  246. nick_name: item.nick_name || '未知',
  247. examine_user: item.examine_user || '未知',
  248. publish_status: item.publish_status,
  249. examine_status: item.examine_status,
  250. user_count: item.user_count || 0,
  251. user_ok_count: item.user_ok_count || 0,
  252. user_err_count: item.user_err_count || 0,
  253. user_sending_count: item.user_sending_count || 0,
  254. is_my_examine: item.is_my_examine || false,
  255. is_my_edit: item.is_my_edit || false
  256. }));
  257. total.value = res.total;
  258. } else {
  259. console.error(res.msg);
  260. }
  261. })
  262. .catch((error) => {
  263. console.error('请求错误:', error);
  264. })
  265. .finally(() => {
  266. loading.value = false;
  267. });
  268. };
  269. onMounted(() => {
  270. getList();
  271. });
  272. </script>
  273. <style scoped></style>