gaoshp
2024-11-05 e2fdfe540eaf160dc7d063c60667041edcc64e86
src/views/master/person/main/personPerson.vue
@@ -2,17 +2,17 @@
 * @Author: lzhe lzhe@example.com
 * @Date: 2024-03-26 10:28:33
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-09-24 15:47:04
 * @LastEditTime: 2024-11-04 11:02:26
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/master/person/main/personPerson.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
   <div class="person-person">
      <div class="person-person-left">
         <div class="person-left-title">
         <!-- <div class="person-left-title">
            <div :class="{ 'person-left-active': leftActive }" @click="changeTab(1)">部门</div>
            <div :class="{ 'person-left-active': !leftActive }" @click="changeTab(2)">岗位</div>
         </div>
         </div> -->
         <div class="person-left-search">
            <el-input v-model="input" placeholder="请输入内容" size="small"></el-input>
         </div>
@@ -29,7 +29,10 @@
         <div class="right-top">
            <div class="right-title"><span v-if="leftActive">部门:千文科技</span></div>
            <div>
               <el-select v-model="searchData.status" placeholder="状态" class="searchStatus">
               <el-select v-model="searchData.postId" clearable placeholder="岗位" class="searchStatus" @change="searchDataChange">
                  <el-option v-for="item in postList" :key="item.id" :label="item.postName" :value="item.id" size="small" />
               </el-select>
               <el-select v-model="searchData.status" placeholder="状态" class="searchStatus" @change="searchDataChange">
                  <el-option v-for="item in statusList" :key="item.dictKey" :label="item.dictValue"
                     :value="item.dictKey" size="small" />
               </el-select>
@@ -166,9 +169,10 @@
   name: "personPerson",
   data() {
      return {
         postList: [],
         authorization: {},
         uploadUrl: "/api/blade-cps/employee/import-employee",
         exportUrl: "/api/blade-cps/employee/export-template",
         uploadUrl: "/api/smis/employee/import-employee",
         exportUrl: "/api/smis/employee/export-template",
         titleList: [],
         delPersonModel: false,
         searchIcon: "el-icon-search",
@@ -211,6 +215,7 @@
   mounted() {
      this.getStatus();
      this.getOrganizationList();  //部门
      this.getPost();  //岗位
   },
   components: {
      saveDialog, importTable,...ElementPlusIconsVue
@@ -219,14 +224,14 @@
      avatarDel(index) {
         var obj = this.tableData[index];
         obj.avatar = "";
         this.$HTTP.post(`/api/blade-cps/employee/submit`,obj).then(res=> {
         this.$HTTP.post(`/api/smis/employee/submit`,obj).then(res=> {
            this.searchPerson();
         })
      },
      handleAvatarSuccess(file,index) {
         var obj = this.tableData[index];
         obj.avatar = file.data.link;
         this.$HTTP.post(`/api/blade-cps/employee/submit`,obj).then(res=> {
         this.$HTTP.post(`/api/smis/employee/submit`,obj).then(res=> {
            this.searchPerson();
         })
      },
@@ -240,7 +245,7 @@
         return isJPG;
      },
      getExport() {
         this.$HTTP.get(`/api/blade-cps/employee/export-employee?` + this.$TOOL.qsStringify(this.searchData)).then(res => {
         this.$HTTP.get(`/api/smis/employee/export-employee?` + this.$TOOL.qsStringify(this.searchData)).then(res => {
            if (res.code == 200) {
               window.open(res.data.link);
            }
@@ -255,23 +260,24 @@
         this.searchPerson();
      },
      selectbtn(index) {
         this.titleList.forEach(item => {
            item.active = false;
         })
         this.titleList[index].active = true;
         if (this.leftActive) { //部门
            this.searchData.organizationCode = this.titleList[index].code;
            this.searchData.postId = "";
         } else {  //岗位
            this.searchData.organizationCode = "";
            this.searchData.postId = this.titleList[index].id;
         }
         // this.titleList.forEach(item => {
         //    item.active = false;
         // })
         // this.titleList[index].active = true;
         // if (this.leftActive) { //部门
         //    this.searchData.organizationCode = this.titleList[index].code;
         //    this.searchData.postId = "";
         // } else {  //岗位
         //    this.searchData.organizationCode = "";
         //    this.searchData.postId = this.titleList[index].id;
         // }
         this.searchPerson();
      },
      getOrganizationList() {  //部门
         this.$HTTP.get(`/api/blade-cps/organization/tree?groupType=group_organization&groupCategory=1`).then(res => {
         this.$HTTP.get(`/api/smis/organization/tree?groupType=group_organization&groupCategory=1`).then(res => {
            if (res.code == 200) {
               this.titleList = res.data;
               console.log(this.titleList,111);
               this.titleList[0].active = true;
               this.searchData.organizationCode = res.data[0].code;
               this.searchPerson();
@@ -285,15 +291,16 @@
         }
         this.$HTTP.get(`/api/blade-system/post/page?` + this.$TOOL.qsStringify(obj)).then(res => {
            if (res.code == 200) {
               this.titleList = res.data.records;
               this.titleList[0].active = true;
               this.searchData.postId = res.data.records[0].id;
               this.postList = res.data.records;
               this.searchPerson();
            }
         })
      },
      searchDataChange() {
         this.searchPerson();
      },
      delData(type) {
         this.$HTTP.post(`/api/blade-cps/employee/remove?ids=${this.selectId}&type=${type}`).then(res => {
         this.$HTTP.post(`/api/smis/employee/remove?ids=${this.selectId}&type=${type}`).then(res => {
            if (res.code == 200) {
               this.$message.success("操作成功");
               this.delPersonModel = false;
@@ -311,7 +318,7 @@
         this.searchPerson();
      },
      searchPerson() {
         this.$HTTP.get(`/api/blade-cps/employee/list?` + this.$TOOL.qsStringify(this.searchData)).then(res => {
         this.$HTTP.get(`/api/smis/employee/list?` + this.$TOOL.qsStringify(this.searchData)).then(res => {
            if (res.code == 200) {
               res.data.records.forEach(item => {
                  if (item.dictValue == "在职") {
@@ -337,7 +344,7 @@
         })
         this.$refs.dialogForm.validate(async (valid) => {
            if (valid) {
               this.$HTTP.put(`/api/blade-cps/employee/change-organization?organizationId=${this.departmentFrom.parentId}&employeeIds=${employeeIds.join(",")}`).then(res => {
               this.$HTTP.put(`/api/smis/employee/change-organization?organizationId=${this.departmentFrom.parentId}&employeeIds=${employeeIds.join(",")}`).then(res => {
                  if (res.code == 200) {
                     this.searchPerson();
                     this.departmentVisible = false;  //部门调整