소스 검색

Merge remote-tracking branch 'origin/wuguojie' into dev

wuguojie 1 년 전
부모
커밋
10d689120e

+ 18 - 0
package-lock.json

@@ -10,6 +10,7 @@
       "dependencies": {
         "@headlessui/vue": "^1.7.23",
         "@imengyu/vue3-context-menu": "^1.4.4",
+        "@vue-office/docx": "^1.6.3",
         "@vue/component-compiler-utils": "^3.3.0",
         "@vueuse/components": "^12.0.0",
         "@vueuse/core": "^12.0.0",
@@ -4919,6 +4920,23 @@
         "vscode-uri": "^3.0.8"
       }
     },
+    "node_modules/@vue-office/docx": {
+      "version": "1.6.3",
+      "resolved": "https://registry.npmmirror.com/@vue-office/docx/-/docx-1.6.3.tgz",
+      "integrity": "sha512-Cs+3CAaRBOWOiW4XAhTwwxJ0dy8cPIf6DqfNvYcD3YACiLwO4kuawLF2IAXxyijhbuOeoFsfvoVbOc16A/4bZA==",
+      "hasInstallScript": true,
+      "license": "MIT",
+      "peerDependencies": {
+        "@vue/composition-api": "^1.7.1",
+        "vue": "^2.0.0 || >=3.0.0",
+        "vue-demi": "^0.14.6"
+      },
+      "peerDependenciesMeta": {
+        "@vue/composition-api": {
+          "optional": true
+        }
+      }
+    },
     "node_modules/@vue/babel-helper-vue-transform-on": {
       "version": "1.2.5",
       "resolved": "https://registry.npmmirror.com/@vue/babel-helper-vue-transform-on/-/babel-helper-vue-transform-on-1.2.5.tgz",

+ 2 - 1
package.json

@@ -6,7 +6,7 @@
   },
   "scripts": {
     "dev": "vite",
-    "build": "vue-tsc -b && vite build",
+    "build": "vue-tsc --noEmit && vite build",
     "build:test": "vue-tsc --noEmit && vite build --mode test",
     "serve": "http-server ./dist -o",
     "serve:test": "http-server ./dist-test -o",
@@ -24,6 +24,7 @@
   "dependencies": {
     "@headlessui/vue": "^1.7.23",
     "@imengyu/vue3-context-menu": "^1.4.4",
+    "@vue-office/docx": "^1.6.3",
     "@vue/component-compiler-utils": "^3.3.0",
     "@vueuse/components": "^12.0.0",
     "@vueuse/core": "^12.0.0",

+ 2 - 2
src/api/modules/user.ts

@@ -318,7 +318,7 @@ const userApi = (axiosInstance: ApiInstance) => ({
   updateUserInfo: (data: SysRoleVo) => axiosInstance.post('/userInfo/update', data, { }),
 
   //获取是否可以资源转移信息
-  getTransferInfo: (params: { id: string }) => axiosInstance.get('/userInfo/getTransferInfo', {params}),
+  getTransferInfo: (params: { userId: string }) => axiosInstance.get('/userInfo/getTransferInfo', {params}),
 
   //资源转移
   transfer: (data: Request) => axiosInstance.post('/userInfo/transfer', data, { }),
@@ -330,7 +330,7 @@ const userApi = (axiosInstance: ApiInstance) => ({
   changeDept: (data: Request) => axiosInstance.post('/userInfo/changeDept', data, { }),
 
   //删除成员
-  userDelete: (data: {id:string[]}) => axiosInstance.post('/userInfo/delete', data, { }),
+  userDelete: (data: {ids:string[]}) => axiosInstance.post('/userInfo/delete', data, { }),
 
   //离职
   userQuitApply: (data: {userId:string}) => axiosInstance.post('/userInfo/userQuitApply', data, { }),

+ 40 - 22
src/views/contentManagement/modules/addMessage.vue

@@ -115,6 +115,7 @@ onMounted(() => {
     })
   } else {
     ruleForm.sendDeptId = localStorage.getItem('userDeptId')
+    sendDeptId.value = localStorage.getItem('userDeptId')
   }
 });
 
@@ -206,34 +207,51 @@ const resetForm = (formEl: FormInstance | undefined) => {
 const institutionList = ref([]);
 const getInstitutionList = () => {
   api.institutionApi.institutionList({}).then((res: any) => {
-    if (res.code === 200) institutionList.value = res.data;
+    if (res.code === 200) {
+      institutionList.value = res.data;
+      ruleForm.sendDeptName=getID(res.data,ruleForm.sendDeptId).name
+      console.log(123, getID(res.data,ruleForm.sendDeptId))
+    }
   });
 };
 
 function getID(json:any, id:string) {
-    var o = {}; //专门用来保存筛选后的数组
-    //定义一个函数getID(json,id),形参json用来接受传入的数组,形参id用来接受id号
-    //核心:利用arry.forEach(function(currentValue),index,arr)遍历数组
-    // json.forEach(function(item:any) {
-    //   console.log(123, item)
-    // //if用来判断外层,else if用来判断里层,调用递归函数的有2个判断条件在“有goods属性并且不为空”情况下才调用
-    //     if (item.id == id) {
-    //       o = item
-    //       return o;
-    //     } else if (item.children && item.children.length > 0) {
-    //       o = getID(item.children, id)//递归
-    //     }
-    // });
-    // return o; //全部遍历完之后返回对象o
-  for (let i=0; i<json.length-1; i++) {
-    if(json[i].id === id) {
-      o = json[i]
-      break
-    } else if(json[i].children && json[i].children.length > 0) {
-      getID(json[i].children, id)
+  // var o = {};
+  // //专门用来保存筛选后的数组
+  // //定义一个函数getID(json,id),形参json用来接受传入的数组,形参id用来接受id号
+  // //核心:利用arry.forEach(function(currentValue),index,arr)遍历数组
+  // // json.forEach(function(item:any) {
+  // //   console.log(123, item)
+  // // //if用来判断外层,else if用来判断里层,调用递归函数的有2个判断条件在“有goods属性并且不为空”情况下才调用
+  // //     if (item.id == id) {
+  // //       o = item
+  // //       return o;
+  // //     } else if (item.children && item.children.length > 0) {
+  // //       o = getID(item.children, id)//递归
+  // //     }
+  // // });
+  // // return o; //全部遍历完之后返回对象o
+  // for (let i=0; i<json.length-1; i++) {
+  //   if(json[i].id === id) {
+  //     o = json[i]
+  //     break
+  //   } else if(json[i].children && json[i].children.length > 0) {
+  //     getID(json[i].children, id)
+  //   }
+  // }
+  // return o;
+  for (let item of json) {
+    if (item.id === id) {
+      return item;
+    }
+    if (item.children && item.children.length > 0) {
+      const found = getID(item.children, id);
+      if (found) {
+        return found;
+      }
     }
   }
-  return o;
+  return null;
 }
 </script>
 <style lang="scss" scoped>

+ 33 - 8
src/views/operationManagement/modules/addOperation.vue

@@ -509,16 +509,19 @@
       title="文件预览"
       v-model="fileShow"
     >
-      <div ref="pdfViewer" class="pdf-container"></div>
+      <vue-office-docx
+        :src="fileUrl"
+        style="height: 600px; margin: 0; padding: 0"
+      ></vue-office-docx>
     </el-dialog>
   </div>
 </template>
 
 <script setup lang="ts">
-import { ref, reactive, defineEmits, onMounted } from 'vue'
+import { ref, defineEmits, onMounted } from 'vue'
 import type { AddOperation } from '@/api/modules/operation.ts'
 import type { FormRules, FormInstance } from "element-plus";
-import { Plus } from '@element-plus/icons-vue'
+import VueOfficeDocx from "@vue-office/docx";
 import api from "@/api";
 import { ElMessage } from "element-plus";
 
@@ -526,7 +529,7 @@ import image from '@/assets/images/image.png'
 import word from '@/assets/images/word.png'
 import pdf from '@/assets/images/pdf.png'
 
-const pdfViewer = ref(null)
+const fileViewer = ref(null)
 
 interface OperationFormProps extends AddOperation {
   organization: string
@@ -693,8 +696,10 @@ let dimission = ref('')
 // 图片预览地址
 let imageShow = ref(false)
 let imageUrl = ref('')
+// word
 let fileShow = ref(false)
 
+
 // 限制证件日期
 const disabledDateStart = (time: Date) => {
   return time.getTime() > new Date()
@@ -901,6 +906,13 @@ const uploadImage = async (file, type) => {
 
 // 人事档案
 let recordShow = ref(false)
+let fileUrl = ref('')
+// word预览
+const filePreview = (file) => {
+  nextTick(() => {
+    fileUrl.value = file
+  })
+}
 
 // 图片预览
 const imageView = (type) => {
@@ -924,7 +936,10 @@ const imageView = (type) => {
         if(contract.value.includes('.pdf')) {
           window.open(contract.value, '_blank')
         } else if(contract.value.includes('.doc') || contract.value.includes('.docx')) {
-
+          fileShow.value = true
+          nextTick(() => {
+            filePreview(contract.value)
+          })
         } else if(contract.value.includes('.jpg') || contract.value.includes('.jpeg') || contract.value.includes('.png')) {
           imageShow.value = true
         }
@@ -937,7 +952,8 @@ const imageView = (type) => {
         if(applicant.value.includes('.pdf')) {
           window.open(applicant.value, '_blank')
         } else if(applicant.value.includes('.doc') || applicant.value.includes('.docx')) {
-
+          fileShow.value = true
+          filePreview(applicant.value)
         } else if(applicant.value.includes('.jpg') || applicant.value.includes('.jpeg') || applicant.value.includes('.png')) {
           imageShow.value = true
         }
@@ -950,7 +966,8 @@ const imageView = (type) => {
         if(decidePay.value.includes('.pdf')) {
           window.open(decidePay.value, '_blank')
         } else if(decidePay.value.includes('.doc') || decidePay.value.includes('.docx')) {
-
+          fileShow.value = true
+          filePreview(decidePay.value)
         } else if(decidePay.value.includes('.jpg') || decidePay.value.includes('.jpeg') || decidePay.value.includes('.png')) {
           imageShow.value = true
         }
@@ -963,7 +980,8 @@ const imageView = (type) => {
         if(dimission.value.includes('.pdf')) {
           window.open(dimission.value, '_blank')
         } else if(dimission.value.includes('.doc') || dimission.value.includes('.docx')) {
-
+          fileShow.value = true
+          filePreview(dimission.value)
         } else if(dimission.value.includes('.jpg') || dimission.value.includes('.jpeg') || dimission.value.includes('.png')) {
           imageShow.value = true
         }
@@ -1432,5 +1450,12 @@ defineExpose({
 :deep(.el-input__inner[type=number]) {
   -moz-appearance: textfield;
 }
+:deep(.vue-office-docx-main){
+  height: 600px;
+  overflow-y: auto;
+}
+:deep(.docx-wrapper) {
+  background: white;
+}
 
 </style>

+ 24 - 22
src/views/personnel/institutionManage.vue

@@ -95,7 +95,7 @@
 </template>
 
 <script setup lang="ts">
-import { ref, reactive, watch, onMounted } from "vue";
+// import { ref, reactive, watch, onMounted } from "vue";
 import type { ComponentSize, FormInstance, FormRules } from "element-plus";
 import { Plus, Search } from "@element-plus/icons-vue";
 
@@ -103,7 +103,7 @@ import type Node from "element-plus/es/components/tree/src/model/node";
 // import universalTable from "../"
 import { ElMessage, ElMessageBox, ElPopconfirm, ElTree } from "element-plus";
 import api from "@/api";
-import { h } from "vue";
+// import { h } from "vue";
 import setDept from "@/components/DialogSetDeptLeader/index.vue"
 // import router from "@/router";
 import { useRouter } from "vue-router";
@@ -297,14 +297,15 @@ const editor = (item: any) => {
 };
 const del = (item: any) => {
   // ElPopconfirm('是否确认')
-  ElMessageBox.confirm("确认要删除当前数据吗?", "提示", {
+  ElMessageBox({
+    title: '提示',
+    message: '确认要删除当前数据吗?',
     confirmButtonText: "确认",
     cancelButtonText: "取消",
     type: "warning",
     center:true
-  })
-    .then(() => {
-      console.log(123);
+  }).then((action) => {
+    if(action === 'confirm') {
       api.institutionApi
         .institutionDel({
           id: item.id,
@@ -313,6 +314,7 @@ const del = (item: any) => {
           ElMessage.success("操作成功");
           getInstitutionList(); //机构列表
         });
+    }
     })
     .catch(() => {
       ElMessage.warning("用户取消操作");
@@ -403,22 +405,22 @@ const handleChange = (e: any) => {
 };
 
 //禁用机构选择
-function disabledTree(list: tableType) {
-  for (let i = 0; i < list.length; i++) {
-    const node = list[i];
-    if (isDisabledId.value) {
-      if (list[i].id != isDisabledId.value) {
-        list[i].disabled = true;
-      }
-    } else {
-      list[i].disabled = false;
-    }
-
-    if (node.children && node.children.length > 0) {
-      disabledTree(node.children);
-    }
-  }
-}
+// function disabledTree(list: tableType) {
+//   for (let i = 0; i < list.length; i++) {
+//     const node = list[i];
+//     if (isDisabledId.value) {
+//       if (list[i].id != isDisabledId.value) {
+//         list[i].disabled = true;
+//       }
+//     } else {
+//       list[i].disabled = false;
+//     }
+//
+//     if (node.children && node.children.length > 0) {
+//       disabledTree(node.children);
+//     }
+//   }
+// }
 
 //获取机构列表
 const getInstitutionList = () => {

+ 61 - 65
src/views/personnel/memberManagement.vue

@@ -232,7 +232,7 @@
 </template>
 
 <script setup lang="ts">
-import { ref, reactive, watch,onMounted ,h} from "vue";
+// import { ref, reactive, watch,onMounted ,h} from "vue";
 import {useRouter} from "vue-router"
 import type { ComponentSize, FormInstance, FormRules } from "element-plus";
 import { Plus, Search } from "@element-plus/icons-vue";
@@ -507,22 +507,24 @@ const editorInstitution = (item: any) => {
 };
 const del = (item: any) => {
   // ElPopconfirm('是否确认')
-  ElMessageBox.confirm("确认要删除当前数据吗?", "提示", {
+  ElMessageBox({
+    title: '提示',
+    message: '确认要删除当前数据吗?',
     confirmButtonText: "确认",
     cancelButtonText: "取消",
     type: "warning",
     center:true
-  })
-    .then(() => {
-
-      api.institutionApi
-        .institutionDel({
-          id: item.id,
-        })
-        .then((res) => {
-          ElMessage.success("操作成功");
-          getInstitutionList(); //机构列表
-        });
+  }).then((action) => {
+      if(action === 'confirm') {
+        api.institutionApi
+          .institutionDel({
+            id: item.id,
+          })
+          .then((res) => {
+            ElMessage.success("操作成功");
+            getInstitutionList(); //机构列表
+          });
+      }
     })
     .catch(() => {
       ElMessage.warning("用户取消操作");
@@ -631,18 +633,15 @@ function delUser(item:any) {
     .then((res: any) => {
       if (res.code === 200) {
         // transferInfo.value=res.data
-
-        ElMessageBox.confirm(
-          "账号删除后,该账号将无法使用访问本企业,请确定是否删除 ",
-          "确认要删除账号吗?",
-          {
-            confirmButtonText: "确认删除",
-            cancelButtonText: "取消",
-            type: "warning",
-            center:true
-          }
-        )
-          .then(() => {
+        ElMessageBox({
+          title: '提示',
+          message: '账号删除后,该账号将无法使用访问本企业,请确定是否删除',
+          confirmButtonText: "确认删除",
+          cancelButtonText: "取消",
+          type: "warning",
+          center:true
+        }).then((action) => {
+          if(action === 'confirm') {
             api.userApi
               .userDelete({
                 ids: [operationForm.value.id],
@@ -654,6 +653,7 @@ function delUser(item:any) {
                   getUserList()
                 }
               });
+          }
             // console.log(123);
           })
           .catch(() => {
@@ -664,29 +664,27 @@ function delUser(item:any) {
 }
 //批量删除成员
 function delsUser() {
+  ElMessageBox({
+    title: '提示',
+    message: '账号删除后,该账号将无法使用访问本企业,请确定是否删除',
+    confirmButtonText: "确认删除",
+    cancelButtonText: "取消",
+    type: "warning",
+    center:true
+  }).then((action) => {
+    if(action === 'confirm') {
+      api.userApi
+        .userDelete({
+          ids: checkTableIdList.value,
 
-    ElMessageBox.confirm(
-      "账号删除后,该账号将无法使用访问本企业,请确定是否删除 ",
-      "确认要删除账号吗?",
-      {
-        confirmButtonText: "确认删除",
-        cancelButtonText: "取消",
-        type: "warning",
-        center:true
-      }
-    )
-      .then(() => {
-        api.userApi
-          .userDelete({
-            ids: checkTableIdList.value,
-
-          })
-          .then((res: any) => {
-            if(res.code==200){
-              ElMessage.success(res.msg)
-
-            }
-          });
+        })
+        .then((res: any) => {
+          if(res.code==200){
+            ElMessage.success(res.msg)
+            getUserList()
+          }
+        });
+    }
         // console.log(123);
       })
       .catch(() => {
@@ -731,28 +729,26 @@ function resign(item:any) {
         transferInfo.value = res.data;
         if (res.data.count < 1) {
           // ElMessage.error("当前用户没有可转移的资源");
-          ElMessageBox.confirm(
-          "离职后,账号将无法访问本企业,请确定是否离职?",
-          `确定要将${operationForm.value.name}设置为离职吗?`,
-          {
+          ElMessageBox({
+            title: '提示',
+            message: `离职后,账号将无法访问本企业,确定要将${operationForm.value.name}设置为离职吗?`,
             confirmButtonText: "确认",
             cancelButtonText: "取消",
             type: "warning",
             center:true
-          }
-        )
-          .then(() => {
-            api.userApi
-              .userQuitApply({
-                userId:operationForm.value.userId,
-              })
-              .then((res: any) => {
-                if(res.code==200){
-                  ElMessage.success(res.msg)
-                  getUserList()
-                }
-              });
-            // console.log(123);
+          }).then((action) => {
+            if(action === 'confirm') {
+              api.userApi
+                .userQuitApply({
+                  userId:operationForm.value.userId,
+                })
+                .then((res: any) => {
+                  if(res.code==200){
+                    ElMessage.success(res.msg)
+                    getUserList()
+                  }
+                });
+            }
           })
           .catch(() => {
             ElMessage.warning("用户取消操作");

+ 89 - 19
src/views/personnel/modules/addOperation.vue

@@ -721,9 +721,24 @@
         >
       </div>
     </el-form>
-    <div class="image-view" v-if="imageShow" @click="imageShow = false">
+<!--    <div class="image-view" v-if="imageShow" @click="imageShow = false">
       <img :src="imageUrl" />
-    </div>
+    </div>-->
+    <el-dialog
+      title="图片预览"
+      v-model="imageShow"
+    >
+      <img class="image-view" :src="imageUrl" />
+    </el-dialog>
+    <el-dialog
+      title="文件预览"
+      v-model="fileShow"
+    >
+      <vue-office-docx
+        :src="fileUrl"
+        style="height: 600px; margin: 0; padding: 0"
+      ></vue-office-docx>
+    </el-dialog>
   </div>
 </template>
 
@@ -738,6 +753,7 @@ import { useRoute,useRouter } from "vue-router";
 import image from "@/assets/images/image.png";
 import pdf from "@/assets/images/pdf.png";
 import word from "@/assets/images/word.png";
+import VueOfficeDocx from "@vue-office/docx";
 
 interface dictType {
   value: string;
@@ -1011,6 +1027,8 @@ let leaveTable= ref("");
 // 图片预览地址
 let imageShow = ref(false);
 let imageUrl = ref("");
+// word
+let fileShow = ref(false)
 
 //机构列表
 type tableType = {
@@ -1179,30 +1197,85 @@ const deleteImage = (type) => {
 
 // 人事档案
 let recordShow = ref(false);
+let fileUrl = ref('')
+// word预览
+const filePreview = (file) => {
+  nextTick(() => {
+    fileUrl.value = file
+  })
+}
 
 const imageView = (type) => {
-  imageShow.value = true;
   switch (type) {
     case 1:
+      imageShow.value = true;
       imageUrl.value = IDCardFront.value;
       break;
     case 2:
+      imageShow.value = true;
       imageUrl.value = IDCardBack.value;
       break;
     case 3:
+      imageShow.value = true;
       imageUrl.value = bankSize.value;
       break;
     case 4:
       imageUrl.value = contract.value;
+      nextTick(() => {
+        // loadPdf(contract.value)
+        if(contract.value.includes('.pdf')) {
+          window.open(contract.value, '_blank')
+        } else if(contract.value.includes('.doc') || contract.value.includes('.docx')) {
+          fileShow.value = true
+          nextTick(() => {
+            filePreview(contract.value)
+          })
+        } else if(contract.value.includes('.jpg') || contract.value.includes('.jpeg') || contract.value.includes('.png')) {
+          imageShow.value = true
+        }
+      })
       break;
     case 5:
       imageUrl.value = applicant.value;
+      nextTick(() => {
+        // loadPdf(applicant.value)
+        if(applicant.value.includes('.pdf')) {
+          window.open(applicant.value, '_blank')
+        } else if(applicant.value.includes('.doc') || applicant.value.includes('.docx')) {
+          fileShow.value = true
+          filePreview(applicant.value)
+        } else if(applicant.value.includes('.jpg') || applicant.value.includes('.jpeg') || applicant.value.includes('.png')) {
+          imageShow.value = true
+        }
+      })
       break;
     case 6:
       imageUrl.value = decidePay.value;
+      nextTick(() => {
+        // loadPdf(decidePay.value)
+        if(decidePay.value.includes('.pdf')) {
+          window.open(decidePay.value, '_blank')
+        } else if(decidePay.value.includes('.doc') || decidePay.value.includes('.docx')) {
+          fileShow.value = true
+          filePreview(decidePay.value)
+        } else if(decidePay.value.includes('.jpg') || decidePay.value.includes('.jpeg') || decidePay.value.includes('.png')) {
+          imageShow.value = true
+        }
+      })
       break;
     case 7:
       imageUrl.value = dimission.value;
+      nextTick(() => {
+        // loadPdf(dimission.value)
+        if(dimission.value.includes('.pdf')) {
+          window.open(dimission.value, '_blank')
+        } else if(dimission.value.includes('.doc') || dimission.value.includes('.docx')) {
+          fileShow.value = true
+          filePreview(dimission.value)
+        } else if(dimission.value.includes('.jpg') || dimission.value.includes('.jpeg') || dimission.value.includes('.png')) {
+          imageShow.value = true
+        }
+      })
       break;
   }
 };
@@ -1358,21 +1431,18 @@ function getRoleList() {
     }
   }
 }
-.image-view {
-  position: absolute;
-  top: 0;
-  left: 0;
-  width: 100%;
-  height: 100%;
-  background: rgba(0, 0, 0, 0.6);
-  display: flex;
-  align-items: center;
-  justify-content: center;
-  z-index: 9999;
-  img {
-    width: 800px;
-    height: 800px;
-    border-radius: 5px;
-  }
+.image-view{
+  display: block;
+  width: 400px;
+  height: 260px;
+  border-radius: 5px;
+  margin: 0 auto;
+}
+:deep(.vue-office-docx-main){
+  height: 600px;
+  overflow-y: auto;
+}
+:deep(.docx-wrapper) {
+  background: white;
 }
 </style>