Pārlūkot izejas kodu

人员树选人

liuQiang 1 gadu atpakaļ
vecāks
revīzija
e581afed87

+ 1 - 0
package.json

@@ -18,6 +18,7 @@
     "@ckeditor/ckeditor5-build-classic": "^39.0.2",
     "@ckeditor/ckeditor5-vue": "^5.1.0",
     "@element-plus/icons-vue": "2.0.10",
+    "@layui/layui-vue": "^2.16.1",
     "@vueup/vue-quill": "1.1.0",
     "@vueuse/core": "9.5.0",
     "axios": "0.27.2",

+ 3 - 0
src/main.js

@@ -5,6 +5,8 @@ import {
 import Cookies from 'js-cookie'
 
 import ElementPlus from 'element-plus'
+import Layui from '@layui/layui-vue'
+import '@layui/layui-vue/lib/index.css'
 import locale from 'element-plus/lib/locale/lang/zh-cn' // 中文语言
 
 import '@/assets/styles/index.scss' // global css
@@ -89,6 +91,7 @@ app.use(store)
 // app.use(VueDND)
 app.use(plugins)
 app.use(elementIcons)
+app.use(Layui)
 app.component('svg-icon', SvgIcon)
 
 directive(app)

+ 1 - 1
src/views/department/MyFile.vue

@@ -469,7 +469,7 @@
     <ScanFile v-if="openScan" :openScan="openScan" :scannerFiles="scannerFiles" @saveScanFile="saveScanFile" @closeOpen="closeOpen"></ScanFile>
     <!-- 可用扫描仪信息 -->
      <div>
-        <el-dialog v-model="checkScanner" title="扫描仪" width="30%">
+        <el-dialog :close-on-click-modal="false" v-model="checkScanner" title="扫描仪" width="30%">
             <div v-for="item in scannerList" :key="item.scannerId" @click="checkScanFn(item)" id="Onescan" :class="{'checkScan':item.scannerId ==checkScanId }">
                <img src="@/assets/images/scanImg.png" alt="">
                 {{item.scannerName}}

+ 35 - 5
src/views/department/components/createTasnsfer.vue

@@ -46,6 +46,7 @@ const lastPeople = ref(false);
 const openTree = ref([]);
 const backScreen = ref(props.checkUser);
 const thisFoler = ref(props.upFolderData);
+const allCheck = ref(true);
 const allTreeProps = {
   label: "label",
   children: "children",
@@ -116,11 +117,30 @@ function antherClose(tag) {
   })
   treeRef.value.setCheckedKeys(result);
 }
-function allTreeChange(e) {
-  // console.log('e',e);
+function allTreeChange(e,node,noOne) {
+  // console.log('e',e.disabled);
+  // console.log('e',e.id);
+  if(!noOne){
+    allCheck.value = true
+  }
+  let checkedKeysArr
+  let hasThis
+  if(node){
+   checkedKeysArr = JSON.parse(JSON.stringify(node));
+  // console.log("chooseTagData", checkedKeysArr.checkedKeys?.find(item => item == e.id));
+  if(e.disabled && checkedKeysArr.checkedKeys?.find(item => item == e.id)){ // 判断是全选还是全不选
+    allCheck.value = true
+  }else if(e.disabled && !checkedKeysArr.checkedKeys?.find(item => item == e.id)){
+    allCheck.value = false
+  }
+  // 判断当前是勾选还是取消勾选
+  if(checkedKeysArr.checkedKeys.find(item => item == e.id)){
+    hasThis = true
+  }
+  }
   if(e.children){
     e.children.forEach(par=>{
-      allTreeChange(par)
+      allTreeChange(par,null,true)
     })
   }
   const id = e.id;
@@ -130,16 +150,26 @@ function allTreeChange(e) {
   const existingIndex = chooseTagData.value.findIndex(
     (item) => item.userId === id
   );
+    console.log('allCheck.value',allCheck.value);
   if (existingIndex !== -1) {
     // 如果已存在,删除该项
     chooseTagData.value.splice(existingIndex, 1);
-  } else {
+  } 
+  if(allCheck.value){
     // 选择操作,将数据添加到 needTagData 中
     chooseTagData.value.push({
       userId: id,
       userName: label,
       disabled: disabled,
     });
+    if(!noOne && !hasThis){
+      const existingIndex = chooseTagData.value.findIndex(
+          (item) => item.userId === id
+        );
+        if (existingIndex !== -1) {
+          chooseTagData.value.splice(existingIndex, 1);
+        } 
+    }
   }
   if (chooseTagData.value.length === 1) {
     lastPeople.value = true;
@@ -148,7 +178,7 @@ function allTreeChange(e) {
   }
   chooseTagData.value = chooseTagData.value.filter((item) => !item.disabled);
   emit("setUsers", toRaw(chooseTagData.value));
-  console.log("chooseTagData", chooseTagData.value);
+  // console.log("chooseTagData", chooseTagData.value);
 }
 // 获取用户树
 function getAllUser() {

+ 1 - 0
src/views/myfile/MyFile.vue

@@ -1491,6 +1491,7 @@ export default {
                        addFileTab(newFileData, 1,0); 
                     }
             newAdd.value = data
+            getFileTree()
             console.log('cli', clickFileData.value)
             let obj = {
                 pageNum: 1,

+ 1 - 1
src/views/publicment/MyFile.vue

@@ -462,7 +462,7 @@
     <ScanFile v-if="openScan" :openScan="openScan" :scannerFiles="scannerFiles" @saveScanFile="saveScanFile" @closeOpen="closeOpen"></ScanFile>
     <!-- 可用扫描仪信息 -->
      <div>
-        <el-dialog v-model="checkScanner" title="扫描仪" width="30%">
+        <el-dialog v-model="checkScanner" :close-on-click-modal="false" title="扫描仪" width="30%">
             <div v-for="item in scannerList" :key="item.scannerId" id="Onescan" @click="checkScanFn(item)" :class="{'checkScan':item.scannerId ==checkScanId }">
                <img src="@/assets/images/scanImg.png" alt="">
                 {{item.scannerName}}

+ 35 - 4
src/views/publicment/components/createTasnsfer.vue

@@ -46,6 +46,7 @@ const lastPeople = ref(false);
 const openTree = ref([]);
 const backScreen = ref(props.checkUser);
 const thisFoler = ref(props.upFolderData);
+const allCheck = ref(true);
 const allTreeProps = {
   label: "label",
   children: "children",
@@ -114,10 +115,30 @@ function antherClose(tag) {
   })
   treeRef.value.setCheckedKeys(result);
 }
-function allTreeChange(e) {
+function allTreeChange(e,node,noOne) {
+  // console.log('e',e.disabled);
+  // console.log('e',e.id);
+  if(!noOne){
+    allCheck.value = true
+  }
+  let checkedKeysArr
+  let hasThis
+  if(node){
+   checkedKeysArr = JSON.parse(JSON.stringify(node));
+  // console.log("chooseTagData", checkedKeysArr.checkedKeys?.find(item => item == e.id));
+  if(e.disabled && checkedKeysArr.checkedKeys?.find(item => item == e.id)){ // 判断是全选还是全不选
+    allCheck.value = true
+  }else if(e.disabled && !checkedKeysArr.checkedKeys?.find(item => item == e.id)){
+    allCheck.value = false
+  }
+  // 判断当前是勾选还是取消勾选
+  if(checkedKeysArr.checkedKeys.find(item => item == e.id)){
+    hasThis = true
+  }
+  }
   if(e.children){
     e.children.forEach(par=>{
-      allTreeChange(par)
+      allTreeChange(par,null,true)
     })
   }
   const id = e.id;
@@ -127,16 +148,26 @@ function allTreeChange(e) {
   const existingIndex = chooseTagData.value.findIndex(
     (item) => item.userId === id
   );
+    console.log('allCheck.value',allCheck.value);
   if (existingIndex !== -1) {
     // 如果已存在,删除该项
     chooseTagData.value.splice(existingIndex, 1);
-  } else {
+  } 
+  if(allCheck.value){
     // 选择操作,将数据添加到 needTagData 中
     chooseTagData.value.push({
       userId: id,
       userName: label,
       disabled: disabled,
     });
+    if(!noOne && !hasThis){
+      const existingIndex = chooseTagData.value.findIndex(
+          (item) => item.userId === id
+        );
+        if (existingIndex !== -1) {
+          chooseTagData.value.splice(existingIndex, 1);
+        } 
+    }
   }
   if (chooseTagData.value.length === 1) {
     lastPeople.value = true;
@@ -145,7 +176,7 @@ function allTreeChange(e) {
   }
   chooseTagData.value = chooseTagData.value.filter((item) => !item.disabled);
   emit("setUsers", toRaw(chooseTagData.value));
-  console.log("chooseTagData", chooseTagData.value);
+  // console.log("chooseTagData", chooseTagData.value);
 }
 // 获取用户树
 function getAllUser() {