| | |
| | | * @Author: lzhe lzhe@example.com |
| | | * @Date: 2024-03-26 10:28:33 |
| | | * @LastEditors: lzhe lzhe@example.com |
| | | * @LastEditTime: 2024-09-23 15:32:56 |
| | | * @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> |
| | |
| | | <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> |
| | |
| | | <el-table ref="multipleTableRef" :data="tableData" border style="width: 100%" class="multipleTableRef" |
| | | @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="phone" label="员工照片" width="150"> |
| | | <template #default="scope"> |
| | | <el-upload |
| | | :headers="authorization" |
| | | class="avatar-uploader" |
| | | action="/api/blade-resource/oss/endpoint/put-file" |
| | | :show-file-list="false" |
| | | :on-success="(file)=>handleAvatarSuccess(file,scope.$index)" |
| | | :before-upload="(file)=>beforeAvatarUpload(file,scope.$index)"> |
| | | <div v-if="scope.row.avatar" style="position: relative;"> |
| | | <img :src="scope.row.avatar" class="avatar"> |
| | | <div class="el-icon-editDom"> |
| | | <span class="el-icon-edit">编辑</span> |
| | | <span class="el-icon-del" @click.stop="avatarDel(scope.$index)">删除</span> |
| | | </div> |
| | | </div> |
| | | <el-icon v-else class="el-icon-plus avatar-uploader-icon"><Picture /></el-icon> |
| | | </el-upload> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="姓名" width="150"></el-table-column> |
| | | <el-table-column prop="jobNumber" label="工号" width="150"></el-table-column> |
| | | <el-table-column label="关联账号" width="120"> |
| | |
| | | @closed="dialog.save = false"></save-dialog> |
| | | </template> |
| | | <script> |
| | | import * as ElementPlusIconsVue from '@element-plus/icons-vue' |
| | | let icons = [] |
| | | for (const [key, component] of Object.entries(ElementPlusIconsVue)) { |
| | | icons.push(key) |
| | | } |
| | | import importTable from '@/layout/components/importTable.vue' |
| | | import saveDialog from './save' |
| | | export default { |
| | | name: "personPerson", |
| | | data() { |
| | | return { |
| | | uploadUrl: "/api/blade-cps/employee/import-employee", |
| | | exportUrl: "/api/blade-cps/employee/export-template", |
| | | postList: [], |
| | | authorization: {}, |
| | | uploadUrl: "/api/smis/employee/import-employee", |
| | | exportUrl: "/api/smis/employee/export-template", |
| | | titleList: [], |
| | | delPersonModel: false, |
| | | searchIcon: "el-icon-search", |
| | |
| | | mounted() { |
| | | this.getStatus(); |
| | | this.getOrganizationList(); //部门 |
| | | this.getPost(); //岗位 |
| | | }, |
| | | components: { |
| | | saveDialog, importTable |
| | | saveDialog, importTable,...ElementPlusIconsVue |
| | | }, |
| | | methods: { |
| | | avatarDel(index) { |
| | | var obj = this.tableData[index]; |
| | | obj.avatar = ""; |
| | | 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/smis/employee/submit`,obj).then(res=> { |
| | | this.searchPerson(); |
| | | }) |
| | | }, |
| | | beforeAvatarUpload(file,index) { |
| | | var isJPG = (file.type === 'image/jpeg' || file.type === 'image/png'); |
| | | if (!isJPG) { |
| | | this.$message.error('请上传图片!'); |
| | | } |
| | | var TOKEN = this.$TOOL.cookie.get("TOKEN") |
| | | this.authorization = {Authorization: 'Basic c2FiZXI6c2FiZXJfc2VjcmV0','Blade-Auth': TOKEN} |
| | | 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); |
| | | } |
| | |
| | | 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(); |
| | |
| | | } |
| | | 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; |
| | |
| | | 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 == "在职") { |
| | |
| | | }) |
| | | 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; //部门调整 |
| | |
| | | margin-right: 8px; |
| | | } |
| | | </style> |
| | | <style> |
| | | .avatar-uploader .el-upload { |
| | | border: 1px dashed #d9d9d9; |
| | | border-radius: 6px; |
| | | cursor: pointer; |
| | | position: relative; |
| | | overflow: hidden; |
| | | } |
| | | .avatar-uploader .el-upload:hover { |
| | | border-color: #409EFF; |
| | | } |
| | | .avatar-uploader-icon { |
| | | font-size: 28px; |
| | | color: #8c939d; |
| | | width: 80px; |
| | | height: 80px; |
| | | line-height: 80px; |
| | | text-align: center; |
| | | background-color: #c0c4cc; |
| | | } |
| | | .el-icon-editDom { |
| | | position: absolute; |
| | | left: 4px; |
| | | top: 56px; |
| | | font-weight: 700; |
| | | color: #409eff; |
| | | } |
| | | .el-icon-editDom span { |
| | | margin: 0; |
| | | padding: 0; |
| | | font-size: 12px; |
| | | line-height: 18px; |
| | | border: 1px solid #409eff; |
| | | background: #fff; |
| | | padding-left: 2px; |
| | | padding-right: 2px; |
| | | cursor: pointer; |
| | | } |
| | | .el-icon-editDom .el-icon-edit { |
| | | margin-right: 4px; |
| | | } |
| | | .el-icon-editDom .el-icon-del { |
| | | |
| | | } |
| | | .avatar { |
| | | width: 80px; |
| | | height: 80px; |
| | | display: block; |
| | | } |
| | | </style> |