ZaiZai 6 months ago
parent
commit
5f391c6676
2 changed files with 23 additions and 12 deletions
  1. 1 1
      src/views/desk/test-collect.vue
  2. 22 11
      src/views/desk/test-collect/partitioning.vue

+ 1 - 1
src/views/desk/test-collect.vue

@@ -29,7 +29,7 @@
             </template>
         </hc-dialog>
         <!-- 配置划分 -->
-        <HcPartitioning v-model="isPartitioningShow" :data="partitioningData" @close="partitioningClose" />
+        <HcPartitioning v-model="isPartitioningShow" :data="partitioningData" @close="partitioningClose" @finish="getTableData" />
     </hc-card>
 </template>
 

+ 22 - 11
src/views/desk/test-collect/partitioning.vue

@@ -8,10 +8,10 @@
                 </el-select>
             </el-form-item>
             <el-form-item label="树搜索关键词:">
-                <hc-search-input v-model="filterText" placeholder="输入关键字搜索" @search="treeFilterClick" />
+                <hc-search-input v-model="filterText" placeholder="输入关键字搜索" />
             </el-form-item>
-            <el-form-item label="树数据:" prop="tree">
-                <hc-data-tree ref="treeRef" :h-props="treeProps" show-checkbox :datas="treeData">
+            <el-form-item label="树数据:">
+                <hc-data-tree ref="treeRef" :h-props="treeProps" show-checkbox :datas="treeData" :search-val="filterText">
                     <template #name="{ data }">
                         <span class="text-16px font-400">{{ data.title }}</span>
                     </template>
@@ -39,7 +39,7 @@ const props = defineProps({
 })
 
 //事件
-const emit = defineEmits(['close'])
+const emit = defineEmits(['close', 'finish'])
 
 //双向绑定
 // eslint-disable-next-line no-undef
@@ -83,12 +83,6 @@ const formRules = {
     pid: { required: true, trigger: 'blur', message: '请选择项目' },
 }
 
-//搜索筛选
-const filterText = ref('')
-const treeFilterClick = () => {
-
-}
-
 //获取树数据
 const treeData = ref([])
 const getTreeData = async (id, pid) => {
@@ -98,6 +92,7 @@ const getTreeData = async (id, pid) => {
 
 //树配置
 const treeRef = ref(null)
+const filterText = ref('')
 const treeProps = {
     label: 'title',
     children: 'children',
@@ -117,7 +112,23 @@ const treeProps = {
 //提交表单
 const submitLoading = ref(false)
 const dialogSubmit = async () => {
-
+    const isForm = await formValidate(formRef.value)
+    if (!isForm) return
+    const checkIds = treeRef.value?.treeRef?.getCheckedKeys()
+    if (checkIds.length <= 0) {
+        window.$message.warning('请先勾选关联的树节点')
+        return
+    }
+    submitLoading.value = true
+    const { isRes } = await mainApi.matching({
+        classId: dataInfo.value.id,
+        ids: checkIds,
+    })
+    submitLoading.value = false
+    if (!isRes) return
+    window.$message.success('操作成功')
+    dialogClose()
+    emit('finish')
 }
 
 //关闭弹窗