Bladeren bron

修改分数跟流程

zs 9 maanden geleden
bovenliggende
commit
b72513f06f

+ 1 - 0
src/lang/package/zh-cn/common.js

@@ -10,6 +10,7 @@ export default {
   exam: '审核',
   dict: '字典数据',
   sign: '报名',
+  score: '分数',
   process: '流程',
   journal: '期刊',
   directory: '目录',

+ 1 - 0
src/lang/package/zh-cn/menus.js

@@ -31,6 +31,7 @@ export default {
   match_info: '赛事信息管理',
   match_sign: '报名管理',
   match_process: '流程管理',
+  match_score: '打分管理',
   achievement: '成果管理',
   project: '项目管理',
   footplate: '平台管理',

+ 11 - 0
src/lang/package/zh-cn/pages.js

@@ -386,6 +386,17 @@ export default {
     is_use: '是否启用',
     nameMessage: '请输入流程名称'
   },
+  score: {
+    addDialogTitle: '新增分数',
+    upDialogTitle: '修改分数',
+    match: '赛事',
+    matchPath: '流程',
+    sign: '选手',
+    time: '时间',
+    score: '分数',
+    signMessage: '请选择选手',
+    scoreMessage: '请填写分数'
+  },
   dept: {
     dialogTitle: '部门信息',
     rDialogTitle: '部门资源',

+ 54 - 0
src/store/api/platform/score.js

@@ -0,0 +1,54 @@
+import { defineStore } from 'pinia'
+import { AxiosWrapper } from '@/utils/axios-wrapper'
+import { get } from 'lodash-es'
+const url = '/score'
+const axios = new AxiosWrapper()
+
+export const ScoreStore = defineStore('score', () => {
+  const query = async ({ skip = 0, limit = undefined, ...info } = {}) => {
+    let cond = {}
+    if (skip) cond.skip = skip
+    if (limit) cond.limit = limit
+    cond = { ...cond, ...info }
+    const res = await axios.$get(`${url}`, cond)
+    return res
+  }
+  const list = async ({ skip = 0, limit = undefined, ...info } = {}) => {
+    let cond = {}
+    if (skip) cond.skip = skip
+    if (limit) cond.limit = limit
+    cond = { ...cond, ...info }
+    const res = await axios.$get(`${url}/list`, cond)
+    return res
+  }
+  const fetch = async (payload) => {
+    const res = await axios.$get(`${url}/${payload}`)
+    return res
+  }
+  const detail = async (payload) => {
+    const res = await axios.$get(`${url}/detail/${payload}`)
+    return res
+  }
+  const create = async (payload) => {
+    const res = await axios.$post(`${url}`, payload)
+    return res
+  }
+  const update = async (payload) => {
+    const id = get(payload, 'id', get(payload, '_id'))
+    const res = await axios.$post(`${url}/${id}`, payload)
+    return res
+  }
+  const del = async (payload) => {
+    const res = await axios.$delete(`${url}/${payload}`)
+    return res
+  }
+  return {
+    query,
+    list,
+    fetch,
+    detail,
+    create,
+    update,
+    del
+  }
+})

+ 6 - 1
src/views/match/info/index.vue

@@ -9,7 +9,7 @@
       </template>
     </custom-search-bar>
     <custom-button-bar :fields="buttonFields" @add="toAdd" @select="toMoreDelect"></custom-button-bar>
-    <custom-table :data="data" :fields="fields" @query="search" :total="total" :opera="opera" @process="toProcess" @sign="toSign" @exam="toExam" @edit="toEdit" @delete="toDelete" @toSelect="toSelect" :select="true">
+    <custom-table :data="data" :fields="fields" @query="search" :total="total" :opera="opera" @score="toScore" @process="toProcess" @sign="toSign" @exam="toExam" @edit="toEdit" @delete="toDelete" @toSelect="toSelect" :select="true">
       <template #is_use="{ row }">
         <el-tag v-if="row.is_use == '0'" type="success" @click="toUse(row, '1')">启用</el-tag>
         <el-tag v-else type="info" @click="toUse(row, '0')">禁用</el-tag>
@@ -142,6 +142,7 @@ const fields = [
   { label: t('pages.match.status'), model: 'status', format: (i) => getDict(i, 'status') }
 ]
 const opera = [
+  { label: t('common.score'), method: 'score', display: (i) => i.match_status == '2' },
   { label: t('common.process'), method: 'process', display: (i) => i.scale === '0' },
   { label: t('common.sign'), method: 'sign', type: 'warning' },
   {
@@ -324,6 +325,10 @@ const toSign = (data) => {
 const toProcess = (data) => {
   router.push({ path: '/match/process', query: { id: data.id } })
 }
+// 分数管理
+const toScore = (data) => {
+  router.push({ path: '/match/score', query: { id: data.id } })
+}
 // 删除
 const toDelete = async (data) => {
   const res = await store.del(data.id)

+ 151 - 0
src/views/match/score/index.vue

@@ -0,0 +1,151 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+        <el-button type="primary" @click="toBack()">返回</el-button>
+        <el-col :span="24" class="one">
+          <custom-button-bar :fields="buttonFields" @add="toAdd"></custom-button-bar>
+        </el-col>
+        <el-col :span="24" class="two">
+          <custom-search-bar :fields="fields.filter((f) => f.isSearch)" v-model="searchForm" @search="search" @reset="toReset"></custom-search-bar>
+          <custom-table :data="data" :fields="fields" @query="search" :total="total" :opera="opera" @edit="toEdit" @delete="toDelete"> </custom-table>
+        </el-col>
+      </el-col>
+    </el-row>
+    <el-dialog v-model="dialog.show" :title="dialog.title" :destroy-on-close="false" @close="toClose">
+      <el-row>
+        <el-col :span="24" v-if="dialog.type == '1'">
+          <custom-form v-model="form" :fields="formFields" :rules="rules" @save="toSave">
+            <template #matchPath>
+              <el-option v-for="i in matchPathList" :key="i.id" :label="i.name" :value="i.id"></el-option>
+            </template>
+            <template #sign>
+              <el-option v-for="i in signList" :key="i.id" :label="i.name" :value="i.id"></el-option>
+            </template>
+          </custom-form>
+        </el-col>
+      </el-row>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import moment from 'moment'
+import { cloneDeep, get } from 'lodash-es'
+const $checkRes = inject('$checkRes')
+const { t } = useI18n()
+// 接口
+import { ScoreStore } from '@/store/api/platform/score'
+import { SignStore } from '@/store/api/platform/sign'
+import { ProcessStore } from '@/store/api/platform/process'
+const store = ScoreStore()
+const processStore = ProcessStore()
+const signStore = SignStore()
+// 路由
+const route = useRoute()
+const data = ref([])
+const searchForm = ref({})
+const fields = [
+  { label: t('pages.score.matchPath'), model: 'matchPath_name', isSearch: true },
+  { label: t('pages.score.sign'), model: 'sign_name', isSearch: true },
+  { label: t('pages.score.score'), model: 'score' },
+  { label: t('pages.score.time'), model: 'time' }
+]
+const opera = [
+  { label: t('common.update'), method: 'edit' },
+  {
+    label: t('common.delete'),
+    method: 'delete',
+    confirm: true,
+    type: 'danger'
+  }
+]
+let skip = 0
+let limit = inject('limit')
+const total = ref(0)
+const formFields = ref([
+  { label: t('pages.score.matchPath'), model: 'matchPath', type: 'select' },
+  { label: t('pages.score.sign'), model: 'sign', type: 'select' },
+  { label: t('pages.score.score'), model: 'score', type: 'number' }
+])
+const rules = reactive({
+  sign: [{ required: true, message: t('pages.score.signMessage'), trigger: 'blur' }],
+  score: [{ required: true, message: t('pages.score.scoreMessage'), trigger: 'blur' }]
+})
+const dialog = ref({ type: '1', show: false, title: t('pages.score.DialogTitle') })
+const buttonFields = [{ label: t('common.create'), method: 'add' }]
+const form = ref({})
+// 字典表
+const matchPathList = ref([])
+const signList = ref([])
+// 加载中
+const loading = ref(false)
+// 请求
+onMounted(async () => {
+  loading.value = true
+  await searchOther()
+  await search({ skip, limit })
+  loading.value = false
+})
+const searchOther = async () => {
+  let result
+  // 流程
+  result = await processStore.query({ match: route.query.id, is_use: '0' })
+  if ($checkRes(result)) matchPathList.value = result.data
+  // 选手
+  result = await signStore.query({ match: route.query.id, status: '1' })
+  if ($checkRes(result)) signList.value = result.data
+}
+const search = async (query = { skip, limit }) => {
+  skip = query.skip
+  limit = query.limit
+  const info = { skip: query.skip, limit: query.limit, ...searchForm.value, match: route.query.id }
+  const res = await store.list(info)
+  if (res.errcode == '0') {
+    data.value = res.data
+    total.value = res.total
+  }
+}
+// 添加
+const toAdd = () => {
+  dialog.value = { type: '1', show: true, title: t('pages.score.addDialogTitle') }
+}
+// 修改
+const toEdit = (data) => {
+  form.value = data
+  dialog.value = { type: '1', show: true, title: t('pages.score.upDialogTitle') }
+}
+// 删除
+const toDelete = async (data) => {
+  const res = await store.del(data.id)
+  if ($checkRes(res, true)) {
+    search({ skip, limit })
+  }
+}
+const toSave = async () => {
+  const data = cloneDeep(form.value)
+  const other = { time: moment().format('YYYY-MM-DD'), match: route.query.id }
+  let res
+  if (get(data, 'id')) res = await store.update({ ...data, ...other })
+  else res = await store.create({ ...data, ...other })
+  if ($checkRes(res, true)) {
+    search({ skip, limit })
+    toClose()
+  }
+}
+const toClose = () => {
+  form.value = {}
+  dialog.value = { show: false }
+}
+// 返回上一页
+const toBack = () => {
+  window.history.go(-1)
+}
+</script>
+<style scoped lang="scss">
+.main {
+  .one {
+    text-align: right;
+  }
+}
+</style>

+ 6 - 0
src/views/user/user/index.vue

@@ -161,6 +161,8 @@ const IndustryList = ref([])
 const cardTypeList = ref([])
 const contributionList = ref([])
 const sectorList = ref([])
+const modeList = ref([])
+
 const searchOther = async () => {
   let result
   // 状态
@@ -205,6 +207,9 @@ const searchOther = async () => {
   // 行业
   result = await sectorStore.query({ is_use: '0' })
   if ($checkRes(result)) sectorList.value = result.data
+  // 盈利模式
+  result = await dictDataStore.query({ code: 'modeType', is_use: '0' })
+  if ($checkRes(result)) modeList.value = result.data
 }
 
 const toDelete = async (data) => {
@@ -325,6 +330,7 @@ provide('scaleList', scaleList)
 provide('IndustryList', IndustryList)
 provide('cardTypeList', cardTypeList)
 provide('contributionList', contributionList)
+provide('modeList', modeList)
 // 方法
 provide('getRole', getRole)
 </script>

+ 8 - 0
src/views/user/user/parts/competition.vue

@@ -27,6 +27,13 @@
           </el-form-item>
         </el-col>
       </el-row>
+      <el-col :span="24">
+        <el-form-item label="盈利模式" prop="mode">
+          <el-radio-group size="large" v-model="form.mode">
+            <el-radio v-for="i in modeList" :key="i._id" :label="i.value">{{ i.label }}</el-radio>
+          </el-radio-group>
+        </el-form-item>
+      </el-col>
       <el-col :span="24">
         <el-form-item label="地址" prop="address">
           <el-input v-model="form.address" :autosize="{ minRows: 2, maxRows: 4 }" type="textarea" placeholder="请输入地址" />
@@ -58,6 +65,7 @@ const form = inject('form')
 // 字典表
 const isUseList = inject('isUseList')
 const statusList = inject('statusList')
+const modeList = inject('modeList')
 const onSubmit = inject('onSubmit')
 </script>
 <style scoped lang="scss"></style>