浏览代码

添加赛事字段

zs 1 年之前
父节点
当前提交
90df8ee7ed
共有 2 个文件被更改,包括 99 次插入15 次删除
  1. 1 0
      src/lang/package/zh-cn/pages.js
  2. 98 15
      src/views/match/info/index.vue

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

@@ -119,6 +119,7 @@ export default {
     examDialogTitle: '审核赛事',
     name: '赛事名称',
     type: '赛事类型',
+    form: '类别',
     file: '封面',
     time: '有效期',
     money: '奖金(万元)',

+ 98 - 15
src/views/match/info/index.vue

@@ -1,26 +1,61 @@
 <template>
   <div class="main animate__animated animate__backInRight" v-loading="loading">
-    <custom-search-bar :fields="fields.filter((f) => f.isSearch)" v-model="searchForm" @search="search" @reset="toReset">
+    <custom-search-bar
+      :fields="fields.filter((f) => f.isSearch)"
+      v-model="searchForm"
+      @search="search"
+      @reset="toReset"
+    >
       <template #type>
         <el-option v-for="i in typeList" :key="i._id" :label="i.label" :value="i.value"></el-option>
       </template>
     </custom-search-bar>
     <custom-button-bar :fields="buttonFields" @add="toAdd"></custom-button-bar>
-    <custom-table :data="data" :fields="fields" @query="search" :total="total" :opera="opera" @sign="toSign" @exam="toExam" @edit="toEdit" @delete="toDelete">
+    <custom-table
+      :data="data"
+      :fields="fields"
+      @query="search"
+      :total="total"
+      :opera="opera"
+      @sign="toSign"
+      @exam="toExam"
+      @edit="toEdit"
+      @delete="toDelete"
+    >
       <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>
       </template>
     </custom-table>
-    <el-dialog v-model="dialog.show" :title="dialog.title" :destroy-on-close="false" @close="toClose">
+    <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 #is_use>
-              <el-radio v-for="i in isUseList" :key="i._id" :label="i.value">{{ i.label }}</el-radio>
+              <el-radio v-for="i in isUseList" :key="i._id" :label="i.value">{{
+                i.label
+              }}</el-radio>
             </template>
             <template #type>
-              <el-option v-for="i in typeList" :key="i._id" :label="i.label" :value="i.value"></el-option>
+              <el-option
+                v-for="i in typeList"
+                :key="i._id"
+                :label="i.label"
+                :value="i.value"
+              ></el-option>
+            </template>
+            <template #form>
+              <el-option
+                v-for="i in formList"
+                :key="i._id"
+                :label="i.label"
+                :value="i.value"
+              ></el-option>
             </template>
             <template #rules>
               <div class="rules">
@@ -37,9 +72,19 @@
           </custom-form>
         </el-col>
         <el-col :span="24" v-if="dialog.type == '2'">
-          <custom-form v-model="examForm" :fields="examFormFields" :rules="examRules" @save="toExamSave">
+          <custom-form
+            v-model="examForm"
+            :fields="examFormFields"
+            :rules="examRules"
+            @save="toExamSave"
+          >
             <template #status>
-              <el-option v-for="i in statusList" :key="i._id" :label="i.label" :value="i.value"></el-option>
+              <el-option
+                v-for="i in statusList"
+                :key="i._id"
+                :label="i.label"
+                :value="i.value"
+              ></el-option>
             </template>
           </custom-form>
         </el-col>
@@ -64,17 +109,42 @@ const data = ref([])
 const searchForm = ref({})
 const fields = [
   { label: t('pages.match.name'), model: 'name', isSearch: true },
-  { label: t('pages.match.type'), model: 'type', isSearch: true, type: 'select', format: (i) => getDict(i, 'type') },
+  {
+    label: t('pages.match.type'),
+    model: 'type',
+    isSearch: true,
+    type: 'select',
+    format: (i) => getDict(i, 'type')
+  },
   { label: t('pages.match.money'), model: 'money' },
-  { label: t('pages.match.is_use'), model: 'is_use', custom: true, format: (i) => getDict(i, 'is_use') },
-  { label: t('pages.match.match_status'), model: 'match_status', format: (i) => getDict(i, 'match') },
+  {
+    label: t('pages.match.is_use'),
+    model: 'is_use',
+    custom: true,
+    format: (i) => getDict(i, 'is_use')
+  },
+  {
+    label: t('pages.match.match_status'),
+    model: 'match_status',
+    format: (i) => getDict(i, 'match')
+  },
   { label: t('pages.match.status'), model: 'status', format: (i) => getDict(i, 'status') }
 ]
 const opera = [
   { label: t('common.sign'), method: 'sign' },
-  { label: t('common.update'), method: 'edit', display: (i) => i.is_use === '1' && i.match_status === '0' },
+  {
+    label: t('common.update'),
+    method: 'edit',
+    display: (i) => i.is_use === '1' && i.match_status === '0'
+  },
   { label: t('common.exam'), method: 'exam', type: 'warning', display: (i) => i.status === '0' },
-  { label: t('common.delete'), method: 'delete', confirm: true, type: 'danger', display: (i) => i.is_use === '1' && i.match_status === '0' }
+  {
+    label: t('common.delete'),
+    method: 'delete',
+    confirm: true,
+    type: 'danger',
+    display: (i) => i.is_use === '1' && i.match_status === '0'
+  }
 ]
 const buttonFields = [{ label: t('common.add'), method: 'add' }]
 let skip = 0
@@ -85,23 +155,29 @@ const isUseList = ref([])
 const statusList = ref([])
 const typeList = ref([])
 const matchList = ref([])
+const formList = ref([])
 // 加载中
 const loading = ref(false)
 const formFields = ref([
   { label: t('pages.match.name'), model: 'name' },
   { label: t('pages.match.type'), model: 'type', type: 'select' },
+  { label: t('pages.match.form'), model: 'form', type: 'select' },
   { label: t('pages.match.money'), model: 'money' },
   { label: t('pages.match.time'), model: 'time', type: 'daterange' },
   { label: t('pages.match.is_use'), model: 'is_use', type: 'radio' },
   { label: t('pages.match.rules'), model: 'rules', custom: true },
   { label: t('pages.match.brief'), model: 'brief', custom: true }
 ])
-const rules = reactive({ name: [{ required: true, message: t('pages.match.titleMessage'), trigger: 'blur' }] })
+const rules = reactive({
+  name: [{ required: true, message: t('pages.match.titleMessage'), trigger: 'blur' }]
+})
 const dialog = ref({ type: '1', show: false, title: t('pages.match.addDialogTitle') })
 const form = ref({ rules: {} })
 // 审核
 const examFormFields = [{ label: t('pages.match.status'), model: 'status', type: 'select' }]
-const examRules = reactive({ status: [{ required: true, message: t('common.statusMessage'), trigger: 'blur' }] })
+const examRules = reactive({
+  status: [{ required: true, message: t('common.statusMessage'), trigger: 'blur' }]
+})
 const examForm = ref({})
 // 赛事规则
 const rulesFields = ref([
@@ -133,6 +209,9 @@ const searchOther = async () => {
   // 类型
   result = await dictDataStore.query({ code: 'matchType', is_use: '0' })
   if ($checkRes(result)) typeList.value = result.data
+  // 类别
+  result = await dictDataStore.query({ code: 'matchForm', is_use: '0' })
+  if ($checkRes(result)) formList.value = result.data
   // 状态
   result = await dictDataStore.query({ code: 'examStatus', is_use: '0' })
   if ($checkRes(result)) statusList.value = result.data
@@ -204,7 +283,11 @@ const toExamSave = async () => {
 }
 // 开启或禁用
 const toUse = async (data, is_use) => {
-  ElMessageBox.confirm(`确定修改【${data.name}】数据?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
+  ElMessageBox.confirm(`确定修改【${data.name}】数据?`, '提示', {
+    confirmButtonText: '确定',
+    cancelButtonText: '取消',
+    type: 'warning'
+  })
     .then(async () => {
       let res = await store.update({ _id: get(data, '_id'), is_use })
       if ($checkRes(res, true)) {