index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <custom-layout v-loading="loading" :is_menu="false">
  3. <div class="main w_1300">
  4. <div class="info">
  5. <el-descriptions title="赛事介绍" size="large" :column="3" border>
  6. <el-descriptions-item label="赛事名称">
  7. {{ info.name }}
  8. </el-descriptions-item>
  9. <el-descriptions-item label="赛事类别">
  10. {{ getDict(info.form, 'form') || '暂无赛事类别' }}
  11. </el-descriptions-item>
  12. <el-descriptions-item label="赛事状态">
  13. {{ getDict(info.match_status, 'status') || '暂无赛事状态' }}
  14. </el-descriptions-item>
  15. <el-descriptions-item label="赛事流程状态">
  16. {{ getDict(info.ext_status, 'ext_status') || '暂无赛事状态' }}
  17. </el-descriptions-item>
  18. <el-descriptions-item label="组织单位">
  19. {{ info.work || '暂无组织单位' }}
  20. </el-descriptions-item>
  21. </el-descriptions>
  22. </div>
  23. <div class="user" v-if="user && user.id">
  24. <div class="status">
  25. <el-steps :active="parseInt(info.ext_status)" align-center finish-status="success">
  26. <el-step v-for="(item, index) in extList" :key="index" :title="item.label" />
  27. </el-steps>
  28. </div>
  29. <div class="content">
  30. <one v-if="info.ext_status == '0'" :info="info" @toExamtion="toExamtion" @toExport="toExport"></one>
  31. <two v-if="info.ext_status == '1' || info.ext_status == '2' || info.ext_status == '3' || info.ext_status == '4'" :info="info" @toStep2="toStep2" @stepFill="stepFill" @toStep3="toStep3" @toStep4="toStep4" @toExport="toExport" @step4Score="step4Score" @toStep5="toStep5" @toFinals="toFinals"></two>
  32. <thr v-if="info.ext_status == '5' || info.ext_status == '6' || info.ext_status == '7' || info.ext_status == '8'" :info="info" @toExport="toExport" @step5Time="step5Time" @step5Order="step5Order" @toMessage="toMessage" @toStep6="toStep6" @toPerson="toPerson" @toStep7="toStep7" @toStep8="toStep8"></thr>
  33. </div>
  34. </div>
  35. </div>
  36. </custom-layout>
  37. </template>
  38. <script setup>
  39. import { get } from 'lodash-es'
  40. const $checkRes = inject('$checkRes')
  41. import { UserStore } from '@/store/user'
  42. const userStore = UserStore()
  43. const user = computed(() => userStore.user)
  44. // 接口
  45. import { DictDataStore } from '@/store/api/system/dictData'
  46. import { MatchStore } from '@/store/api/platform/match'
  47. import { MatchExtStore } from '@/store/api/platform/matchExt'
  48. import { MatchRegStore } from '@/store/api/platform/matchReg'
  49. const matchRegStore = MatchRegStore()
  50. const matchExtStore = MatchExtStore()
  51. const dictDataStore = DictDataStore()
  52. const store = MatchStore()
  53. // 组件
  54. import one from '../match/one.vue'
  55. import two from '../match/two.vue'
  56. import thr from '../match/thr.vue'
  57. // 加载中
  58. const loading = ref(false)
  59. // 路由
  60. const route = useRoute()
  61. // 赛事详情
  62. const info = ref({})
  63. // 字典表
  64. const statusList = ref([])
  65. const formList = ref([])
  66. const extList = ref([])
  67. const isUseList = ref([])
  68. // 请求
  69. onMounted(async () => {
  70. loading.value = true
  71. await searchOther()
  72. await search()
  73. loading.value = false
  74. })
  75. const searchOther = async () => {
  76. let result
  77. // 赛事状态
  78. result = await dictDataStore.query({ code: 'matchStatus', is_use: '0' })
  79. if ($checkRes(result)) statusList.value = result.data
  80. // 赛事状态
  81. result = await dictDataStore.query({ code: 'matchForm', is_use: '0' })
  82. if ($checkRes(result)) formList.value = result.data
  83. // 流程状态
  84. result = await dictDataStore.query({ code: 'extStatus', is_use: '0' })
  85. if ($checkRes(result)) extList.value = result.data
  86. // 是否使用
  87. result = await dictDataStore.query({ code: 'isUse', is_use: '0' })
  88. if ($checkRes(result)) isUseList.value = result.data
  89. }
  90. const search = async () => {
  91. let id = route.query.id
  92. if (id) {
  93. let res = await store.fetch(id)
  94. if (res.errcode == '0') {
  95. info.value = res.data
  96. }
  97. }
  98. }
  99. // 字典数据转换
  100. const getDict = (data, model) => {
  101. if (data) {
  102. let res
  103. if (model == 'form') res = formList.value.find((f) => f.value == data)
  104. else if (model == 'status') res = statusList.value.find((f) => f.value == data)
  105. else if (model == 'ext_status') res = extList.value.find((f) => f.value == data)
  106. return get(res, 'label')
  107. }
  108. }
  109. // 结束报名
  110. const toExamtion = () => {
  111. ElMessageBox.confirm('是否确定结束该赛事的报名?', '报名信息', {
  112. confirmButtonText: '确认',
  113. cancelButtonText: '取消',
  114. type: 'warning'
  115. })
  116. .then(async () => {
  117. const res = await matchExtStore.step1({ match_id: route.query.id })
  118. if ($checkRes(res, true)) {
  119. search()
  120. }
  121. })
  122. .catch(() => {})
  123. }
  124. // 组织初审
  125. const toStep2 = () => {
  126. ElMessageBox.confirm('是否确定进入组织初审阶段?', '组织初审', {
  127. confirmButtonText: '确认',
  128. cancelButtonText: '取消',
  129. type: 'warning'
  130. })
  131. .then(async () => {
  132. const res = await matchExtStore.step2({ match_id: route.query.id })
  133. if ($checkRes(res, true)) {
  134. search()
  135. }
  136. })
  137. .catch(() => {})
  138. }
  139. // 补充初审时间
  140. const stepFill = (data) => {
  141. ElMessageBox.confirm('是否确定补充选择用户的初审时间?', '组织初审', {
  142. confirmButtonText: '确认',
  143. cancelButtonText: '取消',
  144. type: 'warning'
  145. })
  146. .then(async () => {
  147. const res = await matchExtStore.stepFill(data)
  148. if ($checkRes(res, true)) {
  149. search()
  150. }
  151. })
  152. .catch(() => {})
  153. }
  154. // 公示名单
  155. const toStep3 = () => {
  156. ElMessageBox.confirm('是否确定进入初审阶段公示名单?', '公示名单', {
  157. confirmButtonText: '确认',
  158. cancelButtonText: '取消',
  159. type: 'warning'
  160. })
  161. .then(async () => {
  162. const res = await matchExtStore.step3({ match_id: route.query.id })
  163. if ($checkRes(res, true)) {
  164. search()
  165. }
  166. })
  167. .catch(() => {})
  168. }
  169. // 初审阶段-赛事进行
  170. const toStep4 = () => {
  171. ElMessageBox.confirm('是否确定进入初审阶段赛事进行?', '赛事进行', {
  172. confirmButtonText: '确认',
  173. cancelButtonText: '取消',
  174. type: 'warning'
  175. })
  176. .then(async () => {
  177. const res = await matchExtStore.step4({ match_id: route.query.id })
  178. if ($checkRes(res, true)) {
  179. search()
  180. }
  181. })
  182. .catch(() => {})
  183. }
  184. // 导出
  185. const toExport = async () => {
  186. const res = await matchRegStore.exportReg(route.query.id)
  187. if ($checkRes(res, true)) {
  188. window.open(res.data)
  189. }
  190. }
  191. // 上传初审分数
  192. const step4Score = async (data) => {
  193. const res = await matchExtStore.step4Score(data)
  194. if ($checkRes(res, true)) {
  195. search()
  196. }
  197. }
  198. // 进入决赛的名单
  199. const toFinals = async (data) => {
  200. ElMessageBox.confirm('是否确定选择改报名信息进入决赛名单?', '决赛名单', {
  201. confirmButtonText: '确认',
  202. cancelButtonText: '取消',
  203. type: 'warning'
  204. })
  205. .then(async () => {
  206. const res = await matchExtStore.step4To5(data)
  207. if ($checkRes(res, true)) {
  208. search()
  209. }
  210. })
  211. .catch(() => {})
  212. }
  213. // 决赛组织阶段
  214. const toStep5 = async () => {
  215. ElMessageBox.confirm('是否确定进入决赛组织阶段?', '赛事进行', {
  216. confirmButtonText: '确认',
  217. cancelButtonText: '取消',
  218. type: 'warning'
  219. })
  220. .then(async () => {
  221. const res = await matchExtStore.step5({ match_id: route.query.id })
  222. if ($checkRes(res, true)) {
  223. search()
  224. }
  225. })
  226. .catch(() => {})
  227. }
  228. // 补充决赛时间
  229. const step5Time = (data) => {
  230. ElMessageBox.confirm('是否确定补充选择用户的决赛时间?', '决赛时间', {
  231. confirmButtonText: '确认',
  232. cancelButtonText: '取消',
  233. type: 'warning'
  234. })
  235. .then(async () => {
  236. const res = await matchExtStore.step5Time(data)
  237. if ($checkRes(res, true)) {
  238. search()
  239. }
  240. })
  241. .catch(() => {})
  242. }
  243. // 发送消息提示
  244. const toMessage = () => {
  245. ElMessageBox.confirm('是否确定对已经设置决赛时间的报名用户发送消息提示?', '发送消息提示', {
  246. confirmButtonText: '确认',
  247. cancelButtonText: '取消',
  248. type: 'warning'
  249. })
  250. .then(async () => {
  251. let id = route.query.id
  252. const res = await matchExtStore.step5Sms(id)
  253. if ($checkRes(res, true)) {
  254. search()
  255. }
  256. })
  257. .catch(() => {})
  258. }
  259. // 排序
  260. const step5Order = async (data) => {
  261. const res = await matchExtStore.step5Order(data)
  262. if ($checkRes(res, true)) {
  263. search()
  264. }
  265. }
  266. // 进入决赛名单公示阶段
  267. const toStep6 = () => {
  268. ElMessageBox.confirm('是否确定进入决赛名单公示阶段?', '赛事进行', {
  269. confirmButtonText: '确认',
  270. cancelButtonText: '取消',
  271. type: 'warning'
  272. })
  273. .then(async () => {
  274. const res = await matchExtStore.step6({ match_id: route.query.id })
  275. if ($checkRes(res, true)) {
  276. search()
  277. }
  278. })
  279. .catch(() => {})
  280. }
  281. // 补充决赛人员
  282. const toPerson = (data) => {
  283. ElMessageBox.confirm('是否确定补充该人员参加决赛?', '赛事进行', {
  284. confirmButtonText: '确认',
  285. cancelButtonText: '取消',
  286. type: 'warning'
  287. })
  288. .then(async () => {
  289. const res = await matchExtStore.step5Sup({ id: route.query.id, user_id: data.user_id })
  290. if ($checkRes(res, true)) {
  291. search()
  292. }
  293. })
  294. .catch(() => {})
  295. }
  296. // 进入决赛赛事进行阶段
  297. const toStep7 = () => {
  298. ElMessageBox.confirm('是否确定进入决赛赛事进行阶段?', '赛事进行', {
  299. confirmButtonText: '确认',
  300. cancelButtonText: '取消',
  301. type: 'warning'
  302. })
  303. .then(async () => {
  304. const res = await matchExtStore.step7({ match_id: route.query.id })
  305. if ($checkRes(res, true)) {
  306. search()
  307. }
  308. })
  309. .catch(() => {})
  310. }
  311. // 进入决赛赛事结束阶段
  312. const toStep8 = () => {
  313. ElMessageBox.confirm('是否确定进入决赛赛事结束阶段?', '赛事进行', {
  314. confirmButtonText: '确认',
  315. cancelButtonText: '取消',
  316. type: 'warning'
  317. })
  318. .then(async () => {
  319. const res = await matchExtStore.step8({ match_id: route.query.id })
  320. if ($checkRes(res, true)) {
  321. search()
  322. }
  323. })
  324. .catch(() => {})
  325. }
  326. provide('extList', extList)
  327. provide('isUseList', isUseList)
  328. </script>
  329. <style scoped lang="scss">
  330. .main {
  331. margin: 10px auto;
  332. .info {
  333. margin: 20px 0;
  334. }
  335. .user {
  336. .status {
  337. margin: 50px 0;
  338. }
  339. .content {
  340. }
  341. }
  342. }
  343. </style>