刘洋 1 سال پیش
والد
کامیت
c4cff8571d
1فایلهای تغییر یافته به همراه45 افزوده شده و 4 حذف شده
  1. 45 4
      src/components/common/ChooseMarkers.vue

+ 45 - 4
src/components/common/ChooseMarkers.vue

@@ -4,7 +4,17 @@
       >选择评卷员{{ confirmResult?.length ? `(已选${confirmResult.length}人)` : '' }}</el-button
     >
     <base-dialog v-model="modalVisible" title="选择评卷员" :width="600" class="marker-dialog">
+      <div class="m-b-base">
+        <el-input
+          v-model.trim="filterText"
+          placeholder="输入评卷员登录名或姓名查询"
+          clearable
+          style="width: 200px; margin-right: 10px"
+        ></el-input>
+        <el-button type="primary" @click="filterSearch">查询</el-button>
+      </div>
       <vxe-table
+        :key="tableKey"
         size="small"
         show-overflow
         :max-height="tableMaxHeight"
@@ -34,16 +44,24 @@
 <script name="ChooseMarkers" lang="ts" setup>
 import { watch, ref, computed } from 'vue'
 import useFetch from '@/hooks/useFetch'
-import { ElButton } from 'element-plus'
+import { ElButton, ElInput } from 'element-plus'
 import BaseDialog from '../element/BaseDialog.vue'
 import { VxeTableEvents } from 'vxe-table'
 import ConfirmButton from '@/components/common/ConfirmButton.vue'
 import { cloneDeep } from 'lodash-es'
 
+const tableKey = ref(Date.now() + '')
 const emits = defineEmits(['user-list'])
 const tableMaxHeight = window.innerHeight - 150 + 'px'
 const modalVisible = ref(false)
 const { fetch: fetchMarkers, result } = useFetch('adminGetMarkers')
+const filterText = ref('')
+const computedFilterText = ref('')
+const filterSearch = () => {
+  computedFilterText.value = filterText.value
+  chooseResult.value = []
+  tableKey.value = Date.now() + ''
+}
 const tableData = computed(() => {
   let arr = []
   let res = result.value || []
@@ -52,12 +70,35 @@ const tableData = computed(() => {
     item.id = '_' + item.markingGroupNumber
     item.showName = `第${item.markingGroupNumber}组`
     item.parentId = null
-    arr.push({ ...item })
+    item.loginName = ''
     let children = item.markers || []
+
+    if (
+      !(
+        computedFilterText.value &&
+        !children.find((item: any) => {
+          return item.loginName.includes(computedFilterText.value) || item.name.includes(computedFilterText.value)
+        })
+      )
+    ) {
+      arr.push({ ...item })
+    }
     for (let j = 0; j < children.length; j++) {
       let child = children[j]
-      let v = { id: child.id + '', parentId: item.id, showName: child.loginName + '-' + child.name }
-      arr.push({ ...v })
+      let v = {
+        id: child.id + '',
+        parentId: item.id,
+        showName: child.loginName + '-' + child.name,
+        loginName: child.loginName,
+      }
+      if (
+        !(
+          computedFilterText.value &&
+          !(child.loginName.includes(computedFilterText.value) || child.name.includes(computedFilterText.value))
+        )
+      ) {
+        arr.push({ ...v })
+      }
     }
   }
   return arr