Преглед на файлове

fix:添加设置管理人过滤

wuguojie преди 1 година
родител
ревизия
29f140fadf

+ 7 - 1
src/views/operationManagement/modules/addOperation.vue

@@ -802,7 +802,7 @@ const onSubmit = async (OperationFormRef: FormInstance, type: number) => {
     return
   }
   if(type) {
-    await OperationFormRef.validate((valid) => {
+    await OperationFormRef.validate((valid, error) => {
       if(valid) {
         let formData = {...operationForm.value}
         // formData.organization = operationForm.value.organization[operationForm.value.organization.length - 1]
@@ -876,6 +876,12 @@ const onSubmit = async (OperationFormRef: FormInstance, type: number) => {
           })
         }
       } else {
+        Object.keys(error).forEach((key,i)=>{
+          if(i==0){
+            const firstFiled = error[key][0].field
+            OperationFormRef.scrollToField(firstFiled)
+          }
+        })
         ElMessage({
           message: '请正确填写相关信息!',
           type: 'warning'

+ 24 - 3
src/views/operationManagement/modules/allocation.vue

@@ -2,22 +2,24 @@
   <div class="allocation">
     <el-input v-model="searchValue" style="width: 240px" placeholder="输入姓名、手机号、工号查找" clearable>
       <template #prefix>
-        <el-icon class="el-input__icon" @click="handleSearch"><Search /></el-icon>
+        <el-icon class="el-input__icon"><Search /></el-icon>
       </template>
     </el-input>
     <el-row :gutter="20" class="allocation-content">
       <el-col :span="12" style="padding: 10px; box-sizing: border-box;">
         <el-tree
+          ref="treeRef"
           :data="options"
           :props="cascaderProps"
           node-key="id"
           :default-expanded-keys="expandedKeys"
           :default-checked-keys="checkedKeys"
           @node-click="handleNodeClick"
+          :filter-node-method="filterNode"
         />
       </el-col>
       <el-col :span="12" style="padding: 10px; box-sizing: border-box;border-left: 1px solid #ccc;">
-        <el-radio-group v-model="radioValue" class="allocation-radio">
+        <el-radio-group v-if="userList?.length>0" v-model="radioValue" class="allocation-radio">
           <el-radio v-for="item in userList" :value="item.id" size="large">
             <template #default>
               <div>{{ item.name }}</div>
@@ -25,6 +27,7 @@
             </template>
           </el-radio>
         </el-radio-group>
+        <el-empty v-else description="暂无数据" />
       </el-col>
     </el-row>
     <div style="display: flex; justify-content: flex-end">
@@ -71,10 +74,16 @@ const initCheckedKeys = (id, type, ids) => {
   initUser(id)
 }
 
+// 搜索过滤
 let searchValue = ref('')
+const treeRef = ref(null)
+watch(searchValue, (val) => {
+  treeRef.value!.filter(val);
+});
 const handleSearch = () => {
-
+  filterNode(searchValue.value, options.value)
 }
+
 // 机构数据
 let options = ref([])
 // 默认展开
@@ -101,12 +110,24 @@ const institutionList = () => {
 }
 const handleNodeClick = (data) => {
   console.log(data)
+  initUser(data.id)
+}
+const filterNode = (value: string, data: any) => {
+  if (!value) return true
+  return data.name.includes(value)
 }
 
 let radioValue = ref('')
 
 const onSubmit = (type) => {
   if(type == '确定') {
+    if(!radioValue.value) {
+      ElMessage({
+        message: '请选择管理人',
+        type: 'warning'
+      })
+      return
+    }
     api.operationApi.setLeader({
       ids: selectedIds.value,
       leaderId: radioValue.value,

+ 8 - 1
src/views/operationManagement/operationDetail.vue

@@ -153,7 +153,7 @@
       title="分配管理人"
       width="800"
     >
-      <allocation></allocation>
+      <allocation ref="AllocationRef" @closeDialog="closeAllocation"></allocation>
     </el-dialog>
   </div>
 </template>
@@ -172,6 +172,7 @@ import {OperationIsEnable} from "@/api/modules/operation.ts";
 import router from "@/router";
 
 let AddOperationRef = ref(null)
+const AllocationRef = ref(null)
 
 let myRouter = useRouter()
 const myRoute = useRoute()
@@ -240,11 +241,17 @@ const handleCommand = (e) => {
       break;
     case '分配管理人':
       allocationShow.value = true
+      nextTick(() => {
+        AllocationRef.value.initCheckedKeys(dataDetail.value.deptId, 'cur', [dataDetail.value.id])
+      })
       break;
   }
 }
 // 分配管理人
 let allocationShow = ref(false)
+const closeAllocation = (type: boolean) => {
+  allocationShow.value = type
+}
 
 // 银行卡列表数据
 // let tableData = ref([])