Bläddra i källkod

修改赛事管理

zs 8 månader sedan
förälder
incheckning
a023f572e2

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

@@ -226,6 +226,7 @@ export default {
     brief: '常见问题',
     status: '审核状态',
     match_status: '赛事状态',
+    process: '赛事流程',
     is_use: '是否启用',
     is_show: '是否在首页显示',
     order_num: '显示顺序',

+ 1 - 1
src/layout/parts/Sidebar.vue

@@ -77,7 +77,7 @@ watch(
     padding: 5px 0;
 
     .logo-image {
-      width: 135px;
+      width: 160px;
       height: 40px;
     }
 

+ 75 - 5
src/views/information/parts/platform/match.vue

@@ -99,6 +99,40 @@
             <template #brief>
               <WangEditor v-model="form.brief" />
             </template>
+            <template #process>
+              <el-col :span="24" class="tables">
+                <el-col :span="24" class="tables_1">
+                  <el-button type="primary" @click="addProcess()">添加</el-button>
+                </el-col>
+                <el-col :span="24">
+                  <el-table :data="processList" border>
+                    <el-table-column type="index" label="序号" width="80" align="center"> </el-table-column>
+                    <el-table-column prop="name" label="流程名称" align="center">
+                      <template #default="scope">
+                        <el-input v-model="scope.row.name" placeholder="请输入流程名称" />
+                      </template>
+                    </el-table-column>
+                    <el-table-column prop="order_num" label="排序" align="center">
+                      <template #default="scope">
+                        <el-input v-model="scope.row.order_num" type="number" placeholder="请输入排序" />
+                      </template>
+                    </el-table-column>
+                    <el-table-column prop="is_use" label="是否启用" align="center">
+                      <template #default="scope">
+                        <el-select v-model="scope.row.is_use" placeholder="请选择是否启用">
+                          <el-option v-for="item in isUseList" :key="item.value" :label="item.label" :value="item.value" />
+                        </el-select>
+                      </template>
+                    </el-table-column>
+                    <el-table-column label="操作" align="center" width="100">
+                      <template #default="scope">
+                        <el-button type="danger" @click="delProcess(scope.row)">删除</el-button>
+                      </template>
+                    </el-table-column>
+                  </el-table>
+                </el-col>
+              </el-col>
+            </template>
           </custom-form>
         </el-col>
         <el-col :span="24" v-if="dialog.type == '2'">
@@ -108,15 +142,14 @@
             </template>
           </custom-form>
         </el-col>
-        <el-col :span="24" v-if="dialog.type === '3'">
-          报名
-        </el-col>
+        <el-col :span="24" v-if="dialog.type === '3'"> 报名 </el-col>
       </el-row>
     </el-dialog>
   </div>
 </template>
 
 <script setup>
+import moment from 'moment'
 // API 引用
 import { cloneDeep, get } from 'lodash-es'
 const $checkRes = inject('$checkRes')
@@ -125,6 +158,7 @@ const { t } = useI18n()
 const router = useRouter()
 // 接口
 import { MatchStore } from '@/store/api/platform/match'
+import { ProcessStore } from '@/store/api/platform/process'
 import { DictDataStore } from '@/store/api/system/dictData'
 import { TagsStore } from '@/store/api/system/tags'
 import { SectorStore } from '@/store/api/system/sector'
@@ -132,6 +166,7 @@ const store = MatchStore()
 const dictDataStore = DictDataStore()
 const tagsStore = TagsStore()
 const sectorStore = SectorStore()
+const processStore = ProcessStore()
 const data = ref([])
 const searchForm = ref({})
 const fields = [
@@ -146,7 +181,6 @@ const fields = [
 ]
 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' },
   {
     label: t('common.update'),
@@ -178,6 +212,8 @@ const tagsList = ref([])
 const sectorList = ref([])
 const matchTypeList = ref([])
 const scaleList = ref([])
+// 流程列表
+const processList = ref([])
 // 多选列表
 const selectList = ref([])
 // 加载中
@@ -201,6 +237,7 @@ const formFields = ref([
   { label: t('pages.match.rules'), model: 'rules', custom: true },
   { label: t('pages.match.brief'), model: 'brief', custom: true },
   { label: t('pages.match.video'), model: 'video', custom: true },
+  { label: t('pages.match.process'), model: 'process', custom: true },
   { label: t('pages.match.match_status'), model: 'match_status', type: 'select' }
 ])
 const rules = reactive({
@@ -277,6 +314,11 @@ const search = async (query = { skip, limit }) => {
     total.value = res.total
   }
 }
+const searchProcess = async () => {
+  const info = { match: form.value.id }
+  const res = await processStore.query(info)
+  if (res.errcode == '0') processList.value = res.data
+}
 // 字典数据转换
 const getDict = (data, model) => {
   if (data) {
@@ -313,11 +355,12 @@ const toAdd = () => {
   dialog.value = { type: '1', show: true, title: t('pages.match.addDialogTitle') }
 }
 // 修改
-const toEdit = (data) => {
+const toEdit = async (data) => {
   data.time = [data.start_time, data.end_time]
   if (!data.file) data.file = []
   if (!data.video) data.video = []
   form.value = data
+  await searchProcess()
   dialog.value = { type: '1', show: true, title: t('pages.match.upDialogTitle') }
 }
 // 报名管理
@@ -350,6 +393,7 @@ const toSave = async () => {
   if (get(data, 'id')) res = await store.update({ ...data, ...other })
   else res = await store.create({ ...data, ...other })
   if ($checkRes(res, true)) {
+    toProcessSave()
     search({ skip, limit })
     toClose()
   }
@@ -383,6 +427,27 @@ const toUse = async (data, is_use) => {
     })
     .catch(() => {})
 }
+// 流程添加
+const toProcessSave = async () => {
+  for (const val of processList.value) {
+    const data = cloneDeep(val)
+    delete data.sid
+    if (get(data, 'id')) await processStore.update(data)
+    await processStore.create({ ...data, match: form.value.id })
+  }
+}
+// 流程添加
+const addProcess = () => {
+  let list = processList.value || []
+  list.push({ sid: moment().valueOf(), name: '', time: '', is_use: '' })
+  processList.value = list
+}
+// 流程删除
+const delProcess = async (e) => {
+  let list = processList.value.filter((i) => i.sid != e.sid)
+  processList.value = list
+  if (e.id) await processStore.del(e.id)
+}
 // 重置
 const toReset = async () => {
   searchForm.value = {}
@@ -411,4 +476,9 @@ const onUpload = (e) => {
     margin-left: 0 !important;
   }
 }
+.tables {
+  .tables_1 {
+    margin: 0 0 10px 0;
+  }
+}
 </style>