刘洋 il y a 1 an
Parent
commit
c585a0e648

+ 2 - 2
server.config.ts

@@ -3,11 +3,11 @@ import type { ServerOptions } from 'vite'
 const server: ServerOptions = {
   proxy: {
     '^/?(api|file)/': {
-      // target: 'http://192.168.10.41:8200',
+      target: 'http://192.168.10.41:8200',
       // target: 'http://192.168.10.178:8200',
       // target: 'http://192.168.10.108:8200',
       // target: 'http://cet-test.markingtool.cn',
-      target: 'http://192.168.10.136:80',
+      // target: 'http://192.168.10.136:80',
       // target: 'http://cet-dev.markingtool.cn:8200',
     },
   },

+ 57 - 3
src/components/element/BaseTable.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-table v-bind="computedProps.props" ref="tableRef" class="base-table">
+  <el-table v-bind="computedProps.props" ref="tableRef" class="base-table" @header-dragend="headerDragend">
     <template v-for="(column, i) in computedProps.columns" :key="column.columnKey || column.index || column.prop || i">
       <el-table-column v-if="column.type && ['index', 'selection'].includes(column.type)" v-bind="column" />
       <el-table-column v-else-if="column.type === 'expand'" v-bind="column" #="scope">
@@ -28,9 +28,12 @@
 </template>
 
 <script setup lang="tsx" name="EpTable">
-import { shallowRef, computed, useSlots, useAttrs } from 'vue'
+import { shallowRef, computed, useSlots, useAttrs, onMounted } from 'vue'
 import { ElTable, ElTableColumn, ElButton, ElIcon } from 'element-plus'
+import { useRoute } from 'vue-router'
 import { Refresh } from '@element-plus/icons-vue'
+import { localStorage } from '@/plugins/storage'
+import elementResizeDetectorMaker from 'element-resize-detector'
 // import CommonEmpty from '@/components/common/Empty.vue'
 import type { SetupContext, VNode, Slot } from 'vue'
 import type { EpTableProps, EpTableColumn } from 'global-type'
@@ -40,7 +43,7 @@ interface BaseEpTableProps<T = any> extends EpTableProps<T> {
   columns?: any
   showOverflowTooltip?: any
 }
-
+const route = useRoute()
 const props = defineProps<BaseEpTableProps>()
 
 const attrs = useAttrs()
@@ -48,6 +51,15 @@ const slots = useSlots()
 
 const computedProps = computed(() => {
   const { columns, ...tableProps } = props
+  if ((attrs as any)['memory-column']) {
+    columns.forEach((c: any) => {
+      if (c.prop) {
+        let w = getColumnMemoryWidthByProp(c.prop)
+        !!w && (c.width = w)
+      }
+    })
+  }
+
   return {
     columns: columns,
     props: tableProps,
@@ -96,6 +108,48 @@ function columnRender(column: EpTableColumn, index: number, inputSlots: SetupCon
     </ElTableColumn>
   )
 }
+
+const getColumnMemoryWidthByProp = (prop: string) => {
+  let memoryColumnConfig = localStorage.get('memoryColumnConfig')
+  let customWidth = memoryColumnConfig?.[route.path]?.[prop]
+  return customWidth || null
+}
+
+const setColumnMemoryWidthByProp = (prop: string, width: any) => {
+  let memoryColumnConfig = localStorage.get('memoryColumnConfig')
+  if (!memoryColumnConfig) {
+    memoryColumnConfig = {}
+  }
+  if (!memoryColumnConfig[route.path]) {
+    memoryColumnConfig[route.path] = {}
+  }
+  memoryColumnConfig[route.path][prop] = width
+  localStorage.set('memoryColumnConfig', memoryColumnConfig)
+}
+
+const headerDragend = (newWidth: any, oldWidth: any, column: any, event: any) => {
+  if ((attrs as any)['memory-column']) {
+    setColumnMemoryWidthByProp(column.property, newWidth)
+  }
+}
+
+onMounted(() => {
+  if ((attrs as any)['memory-column']) {
+    let erd = elementResizeDetectorMaker()
+    erd.listenTo(tableRef.value?.$el as any, function (element: any) {
+      let headerCellDoms = element.querySelectorAll(
+        '.el-table__header-wrapper>.el-table__header>thead>tr:first-child>.el-table__cell'
+      )
+      for (let i = 0; i < headerCellDoms.length; i++) {
+        let item = headerCellDoms[i]
+        let prop = computedProps.value.columns?.[i]?.prop
+        if (prop) {
+          setColumnMemoryWidthByProp(prop, item.offsetWidth)
+        }
+      }
+    })
+  }
+})
 </script>
 
 <style scoped lang="scss"></style>

+ 1 - 0
src/constants/storage.ts

@@ -2,6 +2,7 @@ export const LOCAL_STORAGE_KEYS = {
   /** 监控页面自动刷新频率 */
   MONITORING_REFRESH_RATE: 'monitoring_refresh_rate',
   paneSizeConfig: 'paneSizeConfig',
+  memoryColumnConfig: 'memoryColumnConfig',
 }
 
 export const SESSION_STORAGE_KEYS = {

+ 1 - 0
src/modules/analysis/marker-statistics/index.vue

@@ -115,6 +115,7 @@
                   :columns="columns"
                   highlight-current-row
                   :cell-style="{ padding: '6px 0' }"
+                  :memory-column="true"
                   @current-change="onCurrentChange"
                   @row-dblclick="onDbClick"
                 ></base-table>

+ 1 - 0
src/modules/analysis/view-marked-detail/index.vue

@@ -92,6 +92,7 @@
               :columns="columns"
               highlight-current-row
               :cell-style="{ padding: '6px 0' }"
+              :memory-column="true"
               @current-change="onCurrentChange"
               @row-dblclick="onDbClick"
             ></base-table>

+ 1 - 0
src/modules/expert/assess/index.vue

@@ -72,6 +72,7 @@
               :columns="columns"
               highlight-current-row
               :cell-style="{ padding: '6px 0' }"
+              :memory-column="true"
               @current-change="onCurrentChange"
             ></base-table>
           </div>

+ 1 - 0
src/modules/expert/expert/index.vue

@@ -71,6 +71,7 @@
               :columns="columns"
               highlight-current-row
               :cell-style="{ padding: '6px 0' }"
+              :memory-column="true"
               @current-change="onCurrentChange"
             ></base-table>
           </div>

+ 1 - 0
src/modules/expert/sample/index.vue

@@ -71,6 +71,7 @@
               :columns="columns"
               highlight-current-row
               :cell-style="{ padding: '6px 0' }"
+              :memory-column="true"
               @current-change="onCurrentChange"
               @row-dblclick="onDbClick"
             ></base-table>

+ 1 - 0
src/modules/expert/standard/index.vue

@@ -48,6 +48,7 @@
               :columns="columns"
               highlight-current-row
               :cell-style="{ padding: '6px 0' }"
+              :memory-column="true"
               @current-change="onCurrentChange"
             ></base-table>
           </div>

+ 1 - 0
src/modules/expert/training/index.vue

@@ -52,6 +52,7 @@
               :columns="columns"
               highlight-current-row
               :cell-style="{ padding: '6px 0' }"
+              :memory-column="true"
               @current-change="onCurrentChange"
             ></base-table>
           </div>

+ 1 - 0
src/modules/marking/arbitration/index.vue

@@ -61,6 +61,7 @@
               :columns="columns"
               highlight-current-row
               :cell-style="{ padding: '6px 0' }"
+              :memory-column="true"
               @current-change="onCurrentChange"
               @row-dblclick="onDbClick"
             ></base-table>

+ 1 - 0
src/modules/marking/inquiry-result/index.vue

@@ -87,6 +87,7 @@
               :data="tableData"
               :columns="columns"
               :cell-style="{ padding: '6px 0' }"
+              :memory-column="true"
               @current-change="onCurrentChange"
               @row-dblclick="onDbClick"
             ></base-table>

+ 17 - 7
src/modules/marking/mark/index.vue

@@ -74,12 +74,19 @@
           @submit="onSubmit"
         ></scoring-panel-with-confirm>
       </div>
-      <remark-box
+      <!-- <remark-box
         ref="remarkBoxRef"
         v-model="remarkModalVisible"
         @task-change="historyTaskChange"
         @back="historyBack"
         @close="historyClose"
+      ></remark-box> -->
+      <remark-box
+        v-if="remarkModalVisible"
+        ref="remarkBoxRef"
+        @task-change="historyTaskChange"
+        @back="historyBack"
+        @close="historyClose"
       ></remark-box>
     </div>
   </div>
@@ -167,7 +174,7 @@ const mainStore = useMainStore()
 const { push, replace } = useRouter()
 const imgWrap = ref()
 const { getSpentTime, resume } = useSpentTime()
-
+const remarkBoxKey = ref<any>(Date.now() + '')
 const CACHE_NUM = 2
 
 type TaskType = ExtractArrayValue<ExtractApiResponse<'getMarkingTask'>>['taskType'] | 'default' | 'remarking'
@@ -520,6 +527,7 @@ const onRemark = () => {
       if (!markHistoryRes.enableRemark) {
         ElMessage.warning('审核中,暂时无法回评')
       } else {
+        remarkBoxKey.value = new Date().getTime() + ''
         remarkModalVisible.value = true
       }
     })
@@ -616,11 +624,13 @@ watch(enableRemark, (val) => {
   mainLayoutStore.getRenderMenuList()
 })
 bus.on('mark-prev', async () => {
-  const markHistory = await useFetch('getMarkHistory').fetch()
-  if (!markHistory.markHistoryList.length) {
-    return false
-  } else {
-    historyTaskChange(markHistory.markHistoryList[0])
+  if (currentTaskType.value == 'remarking') {
+    const markHistory = await useFetch('getMarkHistory').fetch()
+    if (!markHistory.markHistoryList.length) {
+      return false
+    } else {
+      historyTaskChange(markHistory.markHistoryList[0])
+    }
   }
 })
 const showPreviewBtn = ref(false)

+ 12 - 9
src/modules/marking/mark/remark-box.vue

@@ -1,5 +1,6 @@
 <template>
-  <div class="remark-container" :class="{ 'hidden-width': !visible }">
+  <!-- <div class="remark-container" :class="{ 'hidden-width': !visible }"> -->
+  <div class="remark-container">
     <div class="p-l-base" style="height: 100%">
       <div class="flex-1 remark-box radius-base flex direction-column p-base">
         <div class="p-b-base">
@@ -63,7 +64,7 @@ const getMarkHistory = async () => {
     }
   })
 }
-const props = defineProps<{ modelValue: boolean }>()
+// const props = defineProps<{ modelValue: boolean }>()
 const emits = defineEmits<{
   (e: 'task-change', data: any): void
   (e: 'update:modeValue', visible: boolean): void
@@ -76,21 +77,21 @@ const tableColumns: any = [
   { label: '时间', prop: 'markTime' },
   // { label: '试卷类型', prop: 'taskType' },
 ]
-const visible = useVModel(props)
+// const visible = useVModel(props)
 const viewType = ref<'list' | 'preview'>('list')
 watch(viewType, () => {
   nextTick(() => {
     console.log('historyTable', historyTable.value)
-    if (task.value) {
+    if (task.value && viewType.value === 'list') {
       historyTable.value?.tableRef?.setCurrentRow(task.value)
     }
   })
 })
-watch(visible, () => {
-  if (visible.value) {
-    getMarkHistory()
-  }
-})
+// watch(visible, () => {
+//   if (visible.value) {
+//     getMarkHistory()
+//   }
+// })
 const task = ref<any>()
 
 const onConfirm = () => {
@@ -175,6 +176,7 @@ const arrowDownToNextRow = (e: any) => {
   }
 }
 onMounted(() => {
+  getMarkHistory()
   document.addEventListener('keydown', arrowDownToNextRow)
 })
 onBeforeUnmount(() => {
@@ -191,6 +193,7 @@ const getNextRow = () => {
   let curIndex = (markHistoryList.value || []).findIndex((item: any) => item.taskId == task.value?.taskId)
   if (curIndex < markHistoryList.value?.length - 1) {
     let nextTask = markHistoryList.value[curIndex + 1]
+    task.value = nextTask
     historyTable.value?.tableRef?.setCurrentRow(nextTask)
     return nextTask
   } else {

+ 1 - 0
src/modules/marking/problem/index.vue

@@ -74,6 +74,7 @@
               :columns="columns"
               highlight-current-row
               :cell-style="{ padding: '6px 0' }"
+              :memory-column="true"
               @current-change="onCurrentChange"
               @row-dblclick="onDbClick"
             ></base-table>

+ 1 - 0
src/modules/marking/repeat/index.vue

@@ -69,6 +69,7 @@
               :columns="columns"
               highlight-current-row
               :cell-style="{ padding: '6px 0' }"
+              :memory-column="true"
               @current-change="onCurrentChange"
               @row-dblclick="onDbClick"
             ></base-table>

+ 1 - 0
src/modules/marking/similar/index.vue

@@ -48,6 +48,7 @@
               :columns="columns"
               highlight-current-row
               :cell-style="{ padding: '6px 0' }"
+              :memory-column="true"
               @current-change="onCurrentChange"
               @row-dblclick="onDbClick"
             ></base-table>

+ 1 - 0
src/modules/marking/training-record/index.vue

@@ -32,6 +32,7 @@
             :columns="columns"
             highlight-current-row
             :cell-style="{ padding: '6px 0' }"
+            :memory-column="true"
             @current-change="onCurrentChange"
             @row-dblclick="onDbClick"
           ></base-table>

+ 1 - 0
src/modules/marking/view-sample/index.vue

@@ -43,6 +43,7 @@
             :columns="columns"
             highlight-current-row
             :cell-style="{ padding: '6px 0' }"
+            :memory-column="true"
             @current-change="onCurrentChange"
           ></base-table>
         </pane>

+ 1 - 0
src/modules/monitor/system-check/index.vue

@@ -91,6 +91,7 @@
               :columns="columns"
               highlight-current-row
               :cell-style="{ padding: '6px 0' }"
+              :memory-column="true"
               @current-change="onCurrentChange"
               @row-dblclick="onDbClick"
             ></base-table>

+ 1 - 0
src/modules/monitor/training-monitoring-detail/index.vue

@@ -47,6 +47,7 @@
               :columns="columns"
               highlight-current-row
               :cell-style="{ padding: '6px 0' }"
+              :memory-column="true"
               @current-change="onCurrentChange"
               @row-dblclick="onDbClick"
             ></base-table>

+ 23 - 8
src/modules/monitor/training-monitoring/hooks/useFormFilter.ts

@@ -71,30 +71,45 @@ const useFormFilter = () => {
     { deep: true }
   )
 
+  // watch(
+  //   [forceCheckGroup, model],
+  //   () => {
+  //     if (forceCheckGroup.value?.length && !model.forceGroupNumber) {
+  //       model.forceGroupNumber = forceCheckGroup.value[0].value
+  //     }
+  //   },
+  //   { deep: true, immediate: true }
+  // )
   watch(
-    [forceCheckGroup, model],
+    [forceCheckGroup],
     () => {
-      if (forceCheckGroup.value?.length && !model.forceGroupNumber) {
+      model.dispenseRound = void 0
+      if (forceCheckGroup.value?.length) {
         model.forceGroupNumber = forceCheckGroup.value[0].value
+      } else {
+        model.forceGroupNumber = void 0
       }
     },
     { deep: true, immediate: true }
   )
-
   watch(
     () => model.forceGroupNumber,
     () => {
-      getDispenseRound({
-        forceGroupNumber: model.forceGroupNumber,
-        subjectCode: model.subjectCode,
-        mainNumber: model.mainNumber,
-      })
+      model.dispenseRound = void 0
+      if (model.forceGroupNumber) {
+        getDispenseRound({
+          forceGroupNumber: model.forceGroupNumber,
+          subjectCode: model.subjectCode,
+          mainNumber: model.mainNumber,
+        })
+      }
     }
   )
 
   const rules = computed<EpFormRules>(() => {
     return {
       forceGroupNumber: model.markStage === 'FORCE' ? [{ required: true, message: '请选择强制考核组' }] : [],
+      dispenseRound: !!model.forceGroupNumber ? [{ required: true, message: '请选择考核轮次' }] : [],
     }
   })
 

+ 1 - 0
src/modules/quality/ai-check/index.vue

@@ -77,6 +77,7 @@
                   :data="tableData"
                   :columns="columns"
                   highlight-current-row
+                  :memory-column="true"
                   @current-change="onCurrentChange"
                 ></base-table>
               </div>

+ 1 - 0
src/modules/quality/self-check-detail/index.vue

@@ -69,6 +69,7 @@
               :columns="columns"
               highlight-current-row
               :cell-style="{ padding: '6px 0' }"
+              :memory-column="true"
               @current-change="onCurrentChange"
               @row-dblclick="onDbClick"
             ></base-table>

+ 1 - 0
src/modules/quality/subjective-check/index.vue

@@ -77,6 +77,7 @@
                   :data="tableData"
                   :columns="columns"
                   highlight-current-row
+                  :memory-column="true"
                   @current-change="onCurrentChange"
                 ></base-table>
               </div>