index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <div class="main" v-loading="loading">
  3. <el-col :span="24" class="one">
  4. <div class="one_left" @click="toExport">导出</div>
  5. </el-col>
  6. <el-col :span="24" class="two">
  7. <el-table :data="list" style="width: 100%" size="large" :header-cell-style="{ backgroundColor: '#edf3ff' }" @selection-change="handleSelectionChange">
  8. <template #empty>
  9. <el-empty description="暂无数据" />
  10. </template>
  11. <el-table-column type="selection" :selectable="handleRowSelectable" width="55"> </el-table-column>
  12. <el-table-column prop="no" align="center" label="编号" width="100"> </el-table-column>
  13. <el-table-column prop="user_name" align="center" label="用户"> </el-table-column>
  14. <el-table-column prop="time" align="center" label="报名时间" />
  15. <el-table-column prop="status" align="center" label="状态" width="100">
  16. <template #default="scope">
  17. <el-tag v-if="scope.row.status == '0'" type="primary">待审核</el-tag>
  18. <el-tag v-else-if="scope.row.status == '1'" type="success">已通过</el-tag>
  19. <el-tag v-else type="info">已退回</el-tag>
  20. </template>
  21. </el-table-column>
  22. <el-table-column align="center" label="操作" width="180">
  23. <template #default="{ row }">
  24. <el-link :underline="false" type="primary" size="mini" @click="toView(row, true)" style="margin-right: 10px">查看</el-link>
  25. <el-link v-if="row.status == '0'" :underline="false" type="warning" size="mini" @click="toView(row, false)" style="margin-right: 10px">报名审核</el-link>
  26. </template>
  27. </el-table-column>
  28. </el-table>
  29. </el-col>
  30. <el-col :span="24" class="thr">
  31. <el-pagination background layout="prev, pager, next" :total="total" :page-size="limit" v-model:current-page="currentPage" @current-change="changePage" @size-change="sizeChange" />
  32. </el-col>
  33. <el-dialog v-model="dialog.show" :title="dialog.title" :destroy-on-close="false" @close="toClose">
  34. <el-descriptions title="" :column="1" border>
  35. <template #extra v-if="!is_look">
  36. <el-button type="primary" @click="toExam('1')">通过申请</el-button>
  37. <el-button type="danger" @click="toExam('2')">退回申请</el-button>
  38. </template>
  39. <el-descriptions-item v-for="(item, index) in info" :key="index" :label="item.problem">
  40. <div class="type" v-if="item.type == '0' || item.type == '2' || item.type == '3' || item.type == '4' || item.type == '5'">{{ item.reply || '暂无内容' }}</div>
  41. <div class="type" v-if="item.type == '1' && item.reply">{{ item.reply.join(',') }}</div>
  42. <div class="type" v-if="item.type == '6'">
  43. <div v-for="(as, img) in item.reply" :key="img">
  44. <el-link :href="getUrl(as)" target="_blank">{{ as.name }}</el-link>
  45. </div>
  46. </div>
  47. <div class="type" v-if="item.type == '7'">
  48. <div class="list">
  49. <div v-for="(aa, ina) in item.answer" :key="ina" class="name">{{ aa.text }}</div>
  50. </div>
  51. <div class="list" v-for="(gg, inx) in item.reply" :key="inx">
  52. <div v-for="(aa, ina) in item.answer" :key="ina" class="input">
  53. {{ gg[aa.text] }}
  54. </div>
  55. </div>
  56. </div>
  57. <div class="type" v-if="item.type == '8'">
  58. <div v-for="(as, img) in item.answer" :key="img">
  59. <el-link :href="getUrl(as)" target="_blank">{{ as.name }}</el-link>
  60. </div>
  61. </div>
  62. </el-descriptions-item>
  63. </el-descriptions>
  64. </el-dialog>
  65. </div>
  66. </template>
  67. <script setup>
  68. import { get } from 'lodash-es'
  69. const $checkRes = inject('$checkRes')
  70. // 加载中
  71. const loading = ref(false)
  72. const id = ref('')
  73. const props = defineProps({
  74. matchInfo: { type: Object }
  75. })
  76. const match = computed({
  77. get() {
  78. return props.matchInfo
  79. }
  80. })
  81. // 接口
  82. import { MatchRegStore } from '@/store/api/platform/matchReg'
  83. const store = MatchRegStore()
  84. // 列表
  85. const list = ref([])
  86. let skip = 0
  87. let limit = inject('limit')
  88. const total = ref(0)
  89. const currentPage = ref(1)
  90. const info = ref([])
  91. const form = ref({})
  92. const dialog = ref({ type: '1', show: false, title: '报名信息' })
  93. // 批量导出
  94. const selectionList = ref([])
  95. const is_look = ref(false)
  96. const search = async (query = { skip, limit }) => {
  97. skip = query.skip
  98. limit = query.limit
  99. const info = {
  100. skip: query.skip,
  101. limit: query.limit,
  102. match_id: id.value
  103. }
  104. const res = await store.query(info)
  105. if (res.errcode == '0') {
  106. list.value = res.data
  107. total.value = res.total
  108. }
  109. }
  110. const handleSelectionChange = (val) => {
  111. selectionList.value = val
  112. }
  113. // 审核
  114. const toView = (data, is_no) => {
  115. is_look.value = is_no
  116. form.value = data
  117. info.value = data.info
  118. dialog.value = { type: '1', show: true, title: '报名信息' }
  119. }
  120. // 图片处理
  121. const getUrl = (e) => {
  122. if (e) return `${import.meta.env.VITE_APP_HOST}${get(e, 'uri')}`
  123. }
  124. // 审核
  125. const toExam = (status) => {
  126. let title
  127. if (status == '1') title = '确定将该通过该申请的报名信息?'
  128. else title = '确定将退回该申请的报名信息?'
  129. ElMessageBox.confirm(title, '审核信息', {
  130. confirmButtonText: '确认',
  131. cancelButtonText: '取消',
  132. type: 'warning'
  133. })
  134. .then(async () => {
  135. const data = form.value
  136. const res = await store.update({ id: data.id, status })
  137. if ($checkRes(res, true)) {
  138. toClose()
  139. }
  140. })
  141. .catch(() => {})
  142. }
  143. // 分页
  144. const changePage = (page = currentPage.value) => {
  145. search({ skip: (page - 1) * limit, limit: limit })
  146. }
  147. const sizeChange = (limits) => {
  148. limit = limits
  149. currentPage.value = 1
  150. search({ skip: 0, limit: limit })
  151. }
  152. // 根据数据项中的canSelect字段判断是否可选
  153. const handleRowSelectable = (row) => {
  154. return row.status == '0'
  155. }
  156. // 导出
  157. const toExport = () => {
  158. if (selectionList.value && selectionList.value.length > 0) {
  159. console.log('导出')
  160. } else {
  161. ElMessage({
  162. message: '请选择要导出的数据!',
  163. type: 'warning'
  164. })
  165. }
  166. }
  167. const toClose = async () => {
  168. is_look.value = false
  169. form.value = {}
  170. dialog.value = { show: false }
  171. await search({ skip, limit })
  172. }
  173. watch(
  174. match,
  175. async (item) => {
  176. id.value = item.id
  177. loading.value = true
  178. await search({ skip, limit })
  179. loading.value = false
  180. },
  181. {
  182. immediate: true //初始化立即执行
  183. }
  184. )
  185. </script>
  186. <style scoped lang="scss">
  187. .main {
  188. .one {
  189. height: 50px;
  190. display: flex;
  191. justify-content: space-between;
  192. align-items: center;
  193. margin: 0 0 10px 0;
  194. .one_left {
  195. background: #1875df;
  196. padding: 0 10px;
  197. height: 30px;
  198. color: #fff;
  199. line-height: 30px;
  200. text-align: center;
  201. font-size: 16px;
  202. cursor: default;
  203. }
  204. }
  205. .thr {
  206. display: flex;
  207. justify-content: center;
  208. margin: 20px 0 0 0;
  209. }
  210. .type {
  211. .image {
  212. width: 100%;
  213. }
  214. }
  215. .list {
  216. display: flex;
  217. align-items: center;
  218. justify-content: center;
  219. margin: 10px 0;
  220. .name {
  221. width: 50%;
  222. text-align: center;
  223. }
  224. .input {
  225. width: 50%;
  226. margin: 0 5px 0 0;
  227. border: 1px solid #e5e5e5;
  228. border-radius: 5px;
  229. text-align: center;
  230. .name {
  231. width: 50%;
  232. text-align: center;
  233. margin: 0 0 10px 0;
  234. }
  235. }
  236. }
  237. :deep(.el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell) {
  238. text-align: center;
  239. width: 10px !important; /* 设置你想要的宽度 */
  240. }
  241. }
  242. </style>