Files
cmanager/src/views/tenant/main/talents/certain/index.vue

1057 lines
31 KiB
Vue
Raw Normal View History

2024-03-28 05:51:17 +08:00
<template>
<el-row>
<el-col :span="5">
<basic-container>
<!-- <el-collapse v-model="activeNames">
<el-collapse-item name="1" disabled="true">
<template slot="title">-->
<!-- <p>全部{{ personTotal }}</p> -->
<p>人群分组管理</p>
<!-- </template> -->
<div class="box" :style="{ height: leftHeight }">
<el-scrollbar style="height: 100%">
<el-tree ref="tree" node-key="id" highlight-current :expand-on-click-node="false" @node-click="nodeClick"
2024-04-17 16:59:33 +08:00
:data="treeData" :props="props">
2024-03-28 05:51:17 +08:00
<span class="custom-tree-node" slot-scope="{ node, data }" style="width: 80%">
<!-- <el-tooltip class="item" effect="dark" :content="node.label" placement="top"> -->
2024-04-09 15:32:21 +08:00
<TextTooltip :content="`${node.label}(${data.sumNum}人)`" length="13" tip-width="10"></TextTooltip>
2024-03-28 05:51:17 +08:00
<!-- </el-tooltip> -->
<span v-show="data.id && data.id !== '0'" style="flex-basis: 20%">
2024-03-28 14:25:43 +08:00
<el-button type="text" icon="el-icon-edit" size="mini"
v-if="vaildData(permission.tenant_main_talents_certain_index_groupedit, false)"
@click="() => updateGroups('edit', data)">
2024-03-28 05:51:17 +08:00
</el-button>
2024-03-28 14:25:43 +08:00
<el-button icon="el-icon-delete" type="text" size="mini"
v-if="vaildData(permission.tenant_main_talents_certain_index_groupdelete, false)"
@click="() => removeGroups(data)">
2024-03-28 05:51:17 +08:00
</el-button>
</span>
</span>
</el-tree>
<!-- v-show="vaildData(permission.tenant_wage_payroll_view, false)" -->
<div class="footer" style="padding-left: 6px">
2024-03-28 14:25:43 +08:00
<el-button type="text" icon="el-icon-plus"
v-if="vaildData(permission.tenant_main_talents_certain_index_groupadd, false)"
2024-04-17 16:59:33 +08:00
@click="updateGroups('add')">新建分组
</el-button>
2024-03-28 05:51:17 +08:00
</div>
</el-scrollbar>
</div>
<!-- </el-collapse-item>
</el-collapse>-->
</basic-container>
<!-- <div>
<el-button type="text" icon="el-icon-setting" @click="drawer = true">分组管理</el-button>
</div>-->
</el-col>
<el-col :span="19">
<basic-container>
<!--/-->
<avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" v-model="obj"
2024-04-17 16:59:33 +08:00
:permission="permissionList" :before-open="beforeOpen" @row-del="rowDel" @row-update="rowUpdate"
@row-save="rowSave" @search-change="searchChange" @search-reset="searchReset"
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
@refresh-change="refreshChange" class="customPage">
2024-03-28 05:51:17 +08:00
<!--自定义列-->
<template slot="labelsBase" slot-scope="{ row }">
<el-tooltip effect="dark" placement="top">
<div slot="content" v-for="(item,index) in row.labelsBaseArr" :key="index">{{ item }}<br/></div>
<div>{{ row.labelsBase | ellipsis }}</div>
</el-tooltip>
</template>
<template slot="resume" slot-scope="{ row }">
<div>
<el-button type="text" size="mini" @click="$refs.resume.openDialog(row)"
2024-04-17 16:59:33 +08:00
v-if="row.userId && row.userId !== '0'">查看简历
</el-button>
2024-03-28 05:51:17 +08:00
<div v-else>暂无简历</div>
</div>
</template>
<!--/-->
<template slot="labelsBaseForm">
<tag-select v-model="selectedWorkTypes" :prop="{ label: 'name', value: 'name' }" :data="arr">
</tag-select>
</template>
<!--自定义按钮-->
<template slot="menuLeft">
<el-button type="success" size="small" plain icon="el-icon-plus" @click="handleImport"
2024-04-17 16:59:33 +08:00
v-show="vaildData(permission.tenant_main_talents_certain_index_add, false)">批量导入
</el-button>
2024-03-28 05:51:17 +08:00
<el-button type="warning" size="small" plain :disabled="!selectionList.length" icon="el-icon-sort"
2024-04-17 16:59:33 +08:00
@click="handleTransfer"
v-show="vaildData(permission.tenant_main_talents_certain_index_transfergroup, false)">转移推送
</el-button>
2024-03-28 05:51:17 +08:00
<el-button type="danger" size="small" icon="el-icon-delete" @click="handleDelete"
2024-04-17 16:59:33 +08:00
:disabled="!selectionList.length" plain
v-show="vaildData(permission.tenant_main_talents_certain_index_transfergroup, false)">
删除
</el-button>
2024-03-28 05:51:17 +08:00
</template>
<template slot="name" slot-scope="{row}">
<span>{{ row.name }}</span>
<!-- <span v-if="row.status == 1">{{ row.name }}</span>
<span v-else>{{ row.name }}<span style="color: red;">未实名</span></span> -->
</template>
<!--/-->
2024-05-05 17:29:22 +08:00
<template slot="menuRight">
<el-button
type="primary"
size="small"
:disabled="downloadButton"
@click="handleExport"
>导出
</el-button
>
</template>
2024-03-28 05:51:17 +08:00
</avue-crud>
<!--批量导入-->
<el-dialog title="导入" append-to-body :visible.sync="excelBox" :close-on-click-modal="false" width="555px">
<avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter"
2024-04-17 16:59:33 +08:00
:upload-before="beforeAvatarUpload" :upload-error="uploadError">
2024-03-28 05:51:17 +08:00
<template slot="excelTemplate">
<el-button type="primary" @click="handleTemplate()" :loading="templateLoading">
点击下载
<i class="el-icon-download el-icon--right"></i>
</el-button>
</template>
</avue-form>
</el-dialog>
<!--/-->
<!--新建 编辑分组dialog-->
<add-groups ref="addGroups" @refresh="refresh" :treeData="treeData"></add-groups>
<!--转移分组dialog-->
<transfer-groups ref="transferGroups" @refresh="refresh" :ids="ids"></transfer-groups>
<!--/dialog-->
<resume ref="resume" v-show="false"></resume>
</basic-container>
<ied ref="ied"></ied>
</el-col>
</el-row>
</template>
<script>
import {
getList,
remove,
update,
add,
detail,
getDept,
removeDept,
2024-04-17 16:59:33 +08:00
upload, getDeptMyTree,
2024-03-28 05:51:17 +08:00
} from "@/api/tenant/talents";
2024-04-17 16:59:33 +08:00
import {getWorkTypes, getLabelList} from "@/api/tenant/common";
import {mapGetters} from "vuex";
2024-03-28 05:51:17 +08:00
import addGroups from "./Dialog/addGroups";
import transferGroups from "./Dialog/transferGroups";
import Resume from "@/components/resume/index";
2024-04-17 16:59:33 +08:00
import {check18IdCardNo, isvalidatemobile, isExcel} from "@/util/validate";
2024-05-05 17:29:22 +08:00
import {getTemplate, getTemplateRecommendExportList} from "@/api/resource/template";
2024-03-28 05:51:17 +08:00
import ied from "@/views/util/import-error-dialog";
2024-04-17 16:59:33 +08:00
import {excelAccept} from "@/common/accept";
2024-04-09 15:32:21 +08:00
import TextTooltip from '@/components/text-tooltip'
2024-04-17 16:59:33 +08:00
2024-03-28 05:51:17 +08:00
export default {
filters: {
ellipsis(value) {
if (!value) return "";
if (value.length > 15) {
return value.slice(0, 14) + "...";
}
return value;
},
},
name: "tenant_talents",
data() {
return {
2024-05-05 17:29:22 +08:00
downloadButton: false,
2024-03-28 05:51:17 +08:00
activeNames: "1",
isIndeterminate: false,
checkAll: false,
checked: false,
selectionList: [],
loading: true,
templateLoading: false,
query: {},
props: {
label: "groupName",
id: "id",
},
personTotal: 0,
treeData: [],
tenantId: "",
page: {
pageSize: 10,
currentPage: 1,
total: 0,
},
tempWorkType: [],
worktypeDic: {},
arr: [],//////
2024-04-17 16:59:33 +08:00
deptId: '',
2024-03-28 05:51:17 +08:00
excelBox: false,
data: [],
obj: {},
2024-04-17 16:59:33 +08:00
depTree: [],
excelForm: {isCovered: 1},
2024-03-28 05:51:17 +08:00
};
},
2024-04-17 16:59:33 +08:00
components: {addGroups, transferGroups, Resume, ied, TextTooltip},
2024-03-28 05:51:17 +08:00
watch: {},
computed: {
...mapGetters(["permission"]),
permissionList() {
return {
2024-03-28 14:25:43 +08:00
addBtn: this.vaildData(this.permission.tenant_main_talents_certain_index_add, false),
2024-03-28 05:51:17 +08:00
viewBtn: true,
2024-04-17 16:59:33 +08:00
delBtn: this.vaildData(this.permission.tenant_main_talents_certain_index_delete, false),
editBtn: this.vaildData(this.permission.tenant_main_talents_certain_index_edit, false)
};
2024-03-28 05:51:17 +08:00
},
ids() {
let ids = [];
this.selectionList.forEach((ele) => {
ids.push(ele.id);
});
return ids.join(",");
},
leftHeight: function () {
//获取高度值
if (document.getElementsByClassName("avue-crud__pagination")[0]) {
let pageHeight = document.getElementsByClassName(
"avue-crud__pagination"
)[0].offsetTop;
return pageHeight - 105 + "px";
} else {
return 725 + "px";
}
},
option() {
const self = this;
const IdCardNo = (rule, value, callback) => {
// if (check18IdCardNo(value)) {
callback();
// } else {
// callback(new Error("身份证格式不正确"));
// }
};
const validateTel = (rule, value, callback) => {
if (isvalidatemobile(value)[0]) {
callback(new Error(isvalidatemobile(value)[1]));
} else {
callback();
}
};
return {
height: "auto",
dialogWidth: "50%",
calcHeight: 180,
align: "center",
menuAlign: "center",
tip: false,
columnBtn: false,
searchBtn: true,
searchShow: true,
viewBtn: true,
searchMenuSpan: 6,
border: true,
index: false,
indexLabel: "序号",
selection: true,
dialogType: "drawer",
dialogClickModal: false,
column: [
2024-05-08 10:27:01 +08:00
{
label: "所属机构",
2024-05-08 20:45:31 +08:00
prop: "createDept",
2024-05-08 10:27:01 +08:00
type: "tree",
multiple: false,
dicData: this.depTree,
props: {
label: "title",
},
checkStrictly: true,
span: 24,
search: true,
change: this.deptChange
},
2024-03-28 05:51:17 +08:00
{
label: "姓名",
prop: "name",
// search: true,
span: 24,
rules: [
{
required: true,
whitespace: true,
message: "请输入姓名",
trigger: "blur",
},
],
2024-05-08 10:27:01 +08:00
search: true,
2024-03-28 05:51:17 +08:00
slot: true
},
2024-04-30 10:30:46 +08:00
{
label: "姓别",
2024-05-08 23:20:10 +08:00
prop: "aac004",
type: 'select',
dicUrl: "/api/jobslink-api/system/dict-biz/tadict?code=AAC004",
props: {
label: "dictValue",
2024-05-09 23:45:21 +08:00
value: "dictKey",
2024-05-08 23:20:10 +08:00
},
2024-04-30 10:30:46 +08:00
rules: [
{
required: true,
message: "请输入性别",
trigger: "blur",
},
],
2024-05-08 23:20:10 +08:00
span: 24,
2024-04-30 10:30:46 +08:00
},
2024-03-28 05:51:17 +08:00
{
label: "身份证",
prop: "idNumber",
// hide: true,
span: 24,
rules: [
2024-04-17 16:59:33 +08:00
{required: true, message: "请输入身份证号", trigger: "blur"},
{trigger: "blur", validator: IdCardNo},
2024-03-28 05:51:17 +08:00
],
2024-05-08 10:27:01 +08:00
search: true,
2024-03-28 05:51:17 +08:00
},
{
label: "手机号",
prop: "telphone",
span: 24,
hide: false,
rules: [
{
required: true,
validator: validateTel,
trigger: "blur",
},
],
},
2024-04-30 10:30:46 +08:00
{
label: "民族",
2024-04-30 11:16:22 +08:00
prop: "aac005",
2024-05-07 22:55:32 +08:00
type: 'select',
dicUrl: "/api/jobslink-api/system/dict-biz/tadict?code=AAC005",
2024-05-08 23:20:10 +08:00
props: {
label: "dictValue",
value: "dictKey",
},
2024-04-30 10:30:46 +08:00
rules: [
2024-05-07 22:55:32 +08:00
{
required: true,
message: "请输入民族",
trigger: "blur",
},
2024-04-30 10:30:46 +08:00
],
2024-05-07 22:55:32 +08:00
span: 24,
2024-04-30 10:30:46 +08:00
},
{
label: "户口性质",
2024-04-30 11:16:22 +08:00
prop: "aac009",
2024-05-07 22:55:32 +08:00
type: 'select',
dicUrl: "/api/jobslink-api/system/dict-biz/tadict?code=AAC009",
props: {
label: "dictValue",
2024-05-09 23:45:21 +08:00
value: "dictKey",
2024-05-07 22:55:32 +08:00
},
2024-04-30 10:30:46 +08:00
rules: [
2024-05-07 22:55:32 +08:00
{
required: true,
message: "请输入户口性质",
trigger: "blur",
},
2024-04-30 10:30:46 +08:00
],
2024-05-07 22:55:32 +08:00
span: 24,
2024-04-30 10:30:46 +08:00
},
{
label: "户口所在地",
2024-04-30 11:16:22 +08:00
prop: "aac010",
2024-04-30 10:30:46 +08:00
// hide: true,
span: 24,
rules: [
{required: true, message: "请输入口所在地", trigger: "blur"},
],
},
{
label: "文化程度",
2024-04-30 11:16:22 +08:00
prop: "aac011",
2024-05-07 22:55:32 +08:00
type: 'select',
dicUrl: "/api/jobslink-api/system/dict-biz/tadict?code=AAC011",
props: {
label: "dictValue",
2024-05-09 23:45:21 +08:00
value: "dictKey",
2024-05-07 22:55:32 +08:00
},
2024-04-30 10:30:46 +08:00
rules: [
2024-05-07 22:55:32 +08:00
{
required: true,
message: "请输入文化程度",
trigger: "blur",
},
2024-04-30 10:30:46 +08:00
],
2024-05-07 22:55:32 +08:00
span: 24,
2024-04-30 10:30:46 +08:00
},
{
label: "经办时间",
2024-04-30 11:16:22 +08:00
prop: "aae036",
2024-05-07 22:55:32 +08:00
display: false,
2024-04-30 10:30:46 +08:00
span: 24,
rules: [
{required: true, message: "请输入经办时间", trigger: "blur"},
],
},
2024-03-28 05:51:17 +08:00
{
label: "分组",
prop: "groupId",
type: "tree",
span: 24,
display: true,
dicData: self.treeData,
props: {
label: "groupName",
value: "id",
},
rules: [
{
required: true,
message: "请选择分组",
trigger: "change",
},
],
placeholder: "请选择 分组",
},
{
label: "标签名称",
prop: "labelsBase",
rules: [
{
required: true,
message: "请选择标签名称",
trigger: ["blur"],
},
],
slot: true,
formslot: true,
span: 24,
},
{
label: "备注",
prop: "remarks",
type: "textarea",
slot: true,
hide: true,
span: 24,
maxlength: 100,
showWordLimit: true,
},
],
};
},
excelOption() {
2024-04-17 16:59:33 +08:00
const baseUrl = upload() + `&deptId=${this.deptId}`
const url = this.tenantId ? `${baseUrl}&id=${this.tenantId}` : baseUrl
2024-03-28 05:51:17 +08:00
return {
submitBtn: false,
emptyBtn: false,
column: [
2024-04-17 16:59:33 +08:00
{
label: "所属机构",
prop: "deptId",
type: "tree",
multiple: false,
dicData: this.depTree,
props: {
label: "title",
},
checkStrictly: true,
slot: true,
span: 20,
change: this.deptChange
},
2024-03-28 05:51:17 +08:00
{
label: "文件上传",
prop: "excelFile",
type: "upload",
drag: true,
loadText: "文件上传中,请稍等",
span: 24,
propsHttp: {
res: "data",
},
tip: "请上传 .xls,.xlsx 标准格式文件",
accept: excelAccept,
showFileList: false,
action: url,
},
{
label: "模板下载",
prop: "excelTemplate",
formslot: true,
span: 24,
},
],
}
},
selectedWorkTypes: {
get() {
if (!this.obj.labelsBase) {
return [];
}
const result = [];
const wt = this.obj.labelsBase.split(",");
wt.forEach((item) => {
2024-04-17 16:59:33 +08:00
result.push({name: item});
2024-03-28 05:51:17 +08:00
});
return result;
},
set(val) {
const arr = [];
val.forEach((item) => {
arr.push(item.name);
});
this.obj.labelsBase = arr.join(",");
},
},
worktypeData() {
let rel = [];
for (let j = 0; j < this.arr.length; j++) {
const key = this.arr[j];
if (this.worktypeDic.hasOwnProperty(key)) {
2024-04-17 16:59:33 +08:00
rel.push({name: key})
2024-03-28 05:51:17 +08:00
}
}
/* for (const key in this.worktypeDic) {
if (this.worktypeDic.hasOwnProperty(key)) {
rel.push({ name: key });
}
}*/
for (let i = 0; i < this.tempWorkType.length; i++) {
const key = this.tempWorkType[i];
if (key && !this.worktypeDic.hasOwnProperty(key)) {
2024-04-17 16:59:33 +08:00
rel.push({name: key});
2024-03-28 05:51:17 +08:00
}
}
return rel;
},
},
created() {
this.initDept();
// this.getWorkTypes();
this.getLabelList();
2024-04-17 16:59:33 +08:00
this.getDept()
2024-03-28 05:51:17 +08:00
},
methods: {
2024-05-05 17:29:22 +08:00
handleExport() {
this.downloadButton = true
// 0 潜在 1 已认定
getTemplateRecommendExportList({
groupType: 1,
...this.query
}).then((response) => {
const blob = window.URL.createObjectURL(new Blob([response.data], {type: response.headers['content-type']}));
let fileName = decodeURI(response.headers['content-disposition'].split(';')[1].split('filename=')[1])
let a = document.createElement('a')
let event = new MouseEvent('click')
a.download = fileName || Date.now() + '.xlsx'
a.href = blob
a.dispatchEvent(event)
this.downloadButton = false
})
},
2024-04-17 16:59:33 +08:00
deptChange({value, column}) {
this.deptId = value
console.log(value)
},
async getDept() {
let params = {
tenantId: '000000'
}
let resData = await getDeptMyTree(params)
if (resData.data.code === 200) {
this.depTree = resData.data.data
console.log(this.depTree)
}
},
2024-03-28 05:51:17 +08:00
getWorkTypes() {
getWorkTypes().then((res) => {
for (let i = 0; i < res.data.data.length; i++) {
const element = res.data.data[i];
this.worktypeDic[element.name] = 1;
this.arr.push(element.name)
}
});
},
getLabelList() {
getLabelList().then(async (res) => {
const arr = res.data.data.flatMap(obj => obj.child.map(item => item.concatName));
this.arr = arr.map(concatName => {
2024-04-17 16:59:33 +08:00
return {name: concatName};
2024-03-28 05:51:17 +08:00
});
});
},
/*加载分组*/
initDept(groupId) {
2024-03-28 14:25:43 +08:00
getDept({groupType: 1}).then((res) => {
2024-03-28 05:51:17 +08:00
const data = res.data.data.list;
this.treeData = data;
let treeDataOne = {
companyId: "",
createTime: "",
groupName: "全部",
id: "",
remarks: "",
sort: '',
sumNum: res.data.data.sum,
type: '',
};
this.treeData.unshift(treeDataOne);
const column = this.findObject(this.option.column, "groupId");
column.dicData = this.treeData;
if (groupId) {
this.$nextTick(function () {
this.$refs.tree.setCurrentKey(groupId);
}); //默认高亮
2024-04-17 16:59:33 +08:00
this.nodeClick({id: groupId});
2024-03-28 05:51:17 +08:00
} else {
if (this.treeData.length) {
this.$nextTick(function () {
this.$refs.tree.setCurrentKey(this.treeData[0].id);
}); //默认高亮第一个
2024-04-17 16:59:33 +08:00
this.nodeClick({id: this.treeData[0].id});
2024-03-28 05:51:17 +08:00
}
}
this.personTotal = res.data.data.sum;
// this.onLoad();
//this.treeData.push(treeDataOne);
this.loading = false;
});
},
/*新建 编辑分组*/
updateGroups(type, data) {
this.$refs.addGroups.openDialog(type, data);
},
/*删除分组*/
removeGroups(data) {
//检验该分组是否存在人员,存在提示无法删除,不存在泽提示确定要删除此分组吗
const h = this.$createElement;
this.$confirm(
h("div", null, [
2024-04-17 16:59:33 +08:00
h("p", {style: "font-size: 16px"}, "您确定要删除此分组吗? "),
h("p", {style: "color: red"}, "一旦删除则无法找回"),
2024-03-28 05:51:17 +08:00
]),
{
type: "warning",
showClose: false,
showCancelButton: true,
confirmButtonText: "确定",
cancelButtonText: "取消",
beforeClose: (action, instance, done) => {
if (action === "confirm") {
instance.confirmButtonLoading = true;
instance.cancelButtonLoading = true;
instance.closeOnPressEscape = false;
instance.closeOnClickModal = false;
setTimeout(() => {
done();
setTimeout(() => {
instance.confirmButtonLoading = false;
instance.cancelButtonLoading = false;
}, 300);
}, 1000);
} else {
done();
}
},
}
)
.then(() => {
removeDept(data.id).then(
() => {
this.$message({
type: "success",
message: "操作成功!",
});
this.refresh("del");
},
(error) => {
window.console.log(error);
}
);
})
.catch(() => {
// this.$message({
// type: 'info',
// message: '已取消'
// });
});
},
/*批量转移分组 */
handleTransfer() {
if (this.selectionList.length === 0) {
this.$message.warning("请选择至少一条数据");
return;
}
this.$refs.transferGroups.openDialog();
},
/*点击分组加载相应人才列表*/
nodeClick(data) {
this.tenantId = data.id ? data.id : "";
this.page.currentPage = 1;
this.onLoad(this.page, this.query);
// if (this.tenantId !== data.id) {
// } else {
// return;
// }
},
/*新增 编辑 转移 删除分组 更新人才后*/
refresh(type) {
this.page.currentPage = 1;
this.query = {};
if (type === "del") {
//删除分组后重新选中分组为未分组
this.initDept();
this.onLoad(this.page, this.query);
} else {
this.initDept(this.tenantId);
this.onLoad(this.page, this.query);
}
},
/*获取人才详情 */
beforeOpen(done, type) {
if (["edit", "view", "add"].includes(type)) {
if (type === "edit" || type === "view") {
setTimeout(() => {
detail(this.obj.id).then(
(res) => {
this.obj = res.data.data;
this.tempWorkType = this.obj.labelsBase.split(",");
done();
},
(error) => {
window.console.log(error);
}
);
}, 0);
} else {
this.tempWorkType = [];
done();
}
}
},
/*新增人才*/
rowSave(row, done) {
2024-05-08 20:45:31 +08:00
let obj = {}
for (const rowKey in row) {
if (row[rowKey]) {
obj[rowKey] = row[rowKey]
}
}
2024-03-28 05:51:17 +08:00
add({
2024-05-08 20:45:31 +08:00
...obj,
2024-03-28 05:51:17 +08:00
groupId: row.groupId,
name: row.name,
idNumber: row.idNumber,
telphone: row.telphone,
labelsBase: row.labelsBase,
remarks: row.remarks,
2024-04-17 16:59:33 +08:00
groupType: 1,
2024-03-28 05:51:17 +08:00
}).then(
() => {
this.$message({
type: "success",
message: "操作成功!",
});
done();
this.refresh();
},
(error) => {
window.console.log(error);
done();
}
);
},
/*编辑人才*/
rowUpdate(row, index, done) {
update({
2024-05-08 20:45:31 +08:00
...row,
2024-03-28 05:51:17 +08:00
id: row.id,
groupId: row.groupId,
name: row.name,
idNumber: row.idNumber,
telphone: row.telphone,
labelsBase: row.labelsBase,
remarks: row.remarks,
}).then(
() => {
done();
this.$message({
type: "success",
message: "操作成功!",
});
this.refresh();
},
(error) => {
window.console.log(error);
done();
}
);
},
/*删除人才 */
rowDel(row) {
const h = this.$createElement;
this.$confirm(
h("div", null, [
2024-04-17 16:59:33 +08:00
h("p", {style: "font-size: 16px"}, "您确定要删除此人才吗? "),
h("p", {style: "color: red"}, "一旦删除则无法找回"),
2024-03-28 05:51:17 +08:00
]),
{
type: "warning",
showClose: false,
showCancelButton: true,
confirmButtonText: "确定",
cancelButtonText: "取消",
beforeClose: (action, instance, done) => {
if (action === "confirm") {
instance.confirmButtonLoading = true;
instance.cancelButtonLoading = true;
instance.closeOnPressEscape = false;
instance.closeOnClickModal = false;
setTimeout(() => {
done();
setTimeout(() => {
instance.confirmButtonLoading = false;
instance.cancelButtonLoading = false;
}, 300);
}, 1000);
} else {
done();
}
},
}
)
.then(() => {
remove(row.id).then(
() => {
this.$message({
type: "success",
message: "操作成功!",
});
this.refresh();
},
(error) => {
window.console.log(error);
}
);
})
.catch(() => {
// this.$message({
// type: 'info',
// message: '已取消'
// });
});
},
/*批量删除人才*/
handleDelete() {
if (this.selectionList.length === 0) {
this.$message.warning("请选择至少一条数据");
return;
}
const h = this.$createElement;
this.$confirm(
h("div", null, [
2024-04-17 16:59:33 +08:00
h("p", {style: "font-size: 16px"}, "您确定要批量删除选中人才吗? "),
2024-03-28 05:51:17 +08:00
]),
{
type: "warning",
showClose: false,
showCancelButton: true,
confirmButtonText: "确定",
cancelButtonText: "取消",
beforeClose: (action, instance, done) => {
if (action === "confirm") {
instance.confirmButtonLoading = true;
instance.cancelButtonLoading = true;
instance.closeOnPressEscape = false;
instance.closeOnClickModal = false;
setTimeout(() => {
done();
setTimeout(() => {
instance.confirmButtonLoading = false;
instance.cancelButtonLoading = false;
}, 300);
}, 1000);
} else {
done();
}
},
}
)
.then(() => {
remove(this.ids).then(
() => {
this.$message({
type: "success",
message: "操作成功!",
});
this.onLoad(this.page);
this.$refs.crud.toggleSelection();
},
(error) => {
window.console.log(error);
}
);
})
.catch(() => {
// this.$message({
// type: 'info',
// message: '已取消'
// });
});
},
/*导入人才库*/
beforeAvatarUpload(file, done, loading) {
console.log(file)
if (!isExcel(file)) {
loading();
this.$message.error("上传人才库信息只能是 .xls,.xlsx 标准格式文件!");
} else {
done();
}
},
uploadAfter(res, done) {
if (!(res instanceof Error) && !res.data) {
this.excelBox = false;
} else if (res.data && res.data.code === 900) {
const arr = [];
const data = res.data.data;
data.error &&
2024-04-17 16:59:33 +08:00
data.error.errorList.forEach((item) => {
arr.push(`${item.name} ${item.remarks}`);
});
2024-03-28 05:51:17 +08:00
data.auth &&
2024-04-17 16:59:33 +08:00
data.auth.authList.forEach((item) => {
arr.push(`${item.name} ${item.remarks}`);
});
2024-03-28 05:51:17 +08:00
this.$refs.ied.show(arr);
}
this.refreshChange();
this.initDept(this.tenantId);
done();
},
uploadError(error) {
if (error) {
this.$message.error(error);
}
},
handleImport() {
this.excelBox = true;
},
/*下载人才库模板 */
handleTemplate() {
this.templateLoading = true;
getTemplate("rqkdr")
.then((rep) => {
this.templateLoading = false;
window.open(rep.data.data);
})
.catch(() => {
this.templateLoading = false;
});
},
/*人才列表切换页码 */
currentChange(currentPage) {
this.page.currentPage = currentPage;
this.refreshChange();
},
sizeChange(pageSize) {
this.page.pageSize = pageSize;
this.refreshChange();
},
refreshChange() {
this.onLoad(this.page, this.query);
},
/*搜索 */
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
/*人才列表多选 */
selectionChange(list) {
this.selectionList = list;
},
selectionClear() {
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
/*加载人才列表 */
onLoad(page, params = {}) {
2024-03-28 14:25:43 +08:00
const paramsd = {
...params,
...this.query,
2024-04-10 16:03:14 +08:00
groupType: 1
2024-03-28 14:25:43 +08:00
}
2024-03-28 05:51:17 +08:00
this.loading = true;
getList(
page.currentPage,
page.pageSize,
2024-03-28 14:25:43 +08:00
paramsd,
2024-03-28 05:51:17 +08:00
this.tenantId
).then((res) => {
res.data.data.records.forEach(item => {
item.labelsBaseArr = item.labelsBase.split(',');
})
const data = res.data.data;
this.page.total = data.total;
this.data = data.records;
this.loading = false;
this.selectionClear();
});
},
},
};
</script>
<style scoped>
.el-tree {
font-size: 14px;
}
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding-right: 8px;
}
.el-form-item {
margin-bottom: 18px;
padding: 0 10px;
}
.searchBtn {
display: inline-block;
margin-bottom: 18px;
}
</style>