Browse Source

feat: 培训监控自定义查询bug修复

chenhao 2 years ago
parent
commit
ae14b1cd55

+ 12 - 3
src/modules/marking/inquiry/index.vue

@@ -9,9 +9,10 @@
         </template>
         <template #form-item-short>
           <base-select
-            v-model="shortQueryConfig"
+            v-model="shortQueryConfigIndex"
             clearable
-            :options="customQueryConfigList?.map((v) => ({ label: v.name, value: v.params }))"
+            value-key="secretNumber"
+            :options="customQueryConfigList?.map((v, i) => ({ label: v.name, value: i }))"
           ></base-select>
         </template>
       </base-form>
@@ -46,7 +47,7 @@ import type { ExtractApiParams } from '@/api/api'
 
 const { push } = useRouter()
 
-const shortQueryConfig = ref<ExtractApiParams<'setCustomQueryConfig'>['params']>()
+const shortQueryConfigIndex = ref<number>()
 
 const { subjectList, mainQuestionList, groupListWithAll, dataModel, changeModelValue } = useOptions([
   'subject',
@@ -101,6 +102,13 @@ watch(
 
 getCustomQueryConfigList()
 
+const shortQueryConfig = computed<ExtractApiParams<'setCustomQueryConfig'>['params'] | void>(() => {
+  if (shortQueryConfigIndex.value === undefined) {
+    return void 0
+  }
+  return customQueryConfigList?.value?.[shortQueryConfigIndex.value]?.params
+})
+
 watch(shortQueryConfig, () => {
   if (!shortQueryConfig.value) {
     elFormRef?.value?.resetFields()
@@ -275,6 +283,7 @@ const onSetCustomQueryConfig = async () => {
     })
     toggleVisible(false)
     elFormRef?.value?.resetFields()
+    shortQueryConfigIndex.value = void 0
     getCustomQueryConfigList()
   } catch (error) {
     console.error(error)

+ 4 - 6
src/modules/monitor/training-monitoring/index.vue

@@ -64,15 +64,14 @@ const { hasSelected, selectedList, onSectionChange } = useSection<TableDataType>
 const columns = computed<EpTableColumn<TableDataType>[]>(() => {
   const standardScores = trainingMonitor?.value?.data?.[0]?.scoreList
   const cols: EpTableColumn<TableDataType>[] =
-    trainingMonitor?.value?.header?.map((h) => ({
+    trainingMonitor?.value?.header?.map((h, i) => ({
       label: `${h}`,
-      width: 52,
       formatter(row) {
         if (!row.markerId) {
-          return `${row.scoreList[h - 1]}`
+          return `${row.scoreList[i]}`
         }
-        const score = row.scoreList[h - 1]
-        const standardScore = standardScores[h - 1]
+        const score = row.scoreList[i]
+        const standardScore = standardScores[i]
         return (
           <span style={{ color: minus(score, standardScore) ? '#f00' : 'inherit' }}>
             {diffShow.value ? minus(score, standardScore) : score}
@@ -83,7 +82,6 @@ const columns = computed<EpTableColumn<TableDataType>[]>(() => {
   return [
     {
       type: 'selection',
-      slotName: 'xxx',
       selectable(row) {
         return !!row.markerId
       },