增加了人才画像显示暂无数据的功能
parent
6adb649eca
commit
f98adc4bba
|
@ -50,7 +50,7 @@ export function modifyJobDetail(data) {
|
|||
|
||||
export function queryDepartmentJob() {
|
||||
return request({
|
||||
url: '/ahp/department-job-copy/query',
|
||||
url: '/ahp/department-job/query',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
export function getList(params) {
|
||||
return request({
|
||||
url: '/vue-admin-template/table/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
|
@ -84,17 +84,16 @@ service.interceptors.response.use(
|
|||
response => {
|
||||
const res = response.data
|
||||
// 状态码
|
||||
return res
|
||||
// if (res.code !== 0) {
|
||||
// Message({
|
||||
// message: `${res.code}: ${res.msg}` || 'Error check your token or method',
|
||||
// type: 'error',
|
||||
// duration: 2 * 1000
|
||||
// })
|
||||
// return Promise.reject(new Error(res.msg || 'Error'))
|
||||
// } else {
|
||||
// return res
|
||||
// }
|
||||
if (res.code !== 0) {
|
||||
Message({
|
||||
message: `${res.code}: ${res.msg}` || 'Error check your token or method',
|
||||
type: 'error',
|
||||
duration: 2 * 1000
|
||||
})
|
||||
return Promise.reject(new Error(res.msg || 'Error'))
|
||||
} else {
|
||||
return res
|
||||
}
|
||||
},
|
||||
error => {
|
||||
Message({
|
||||
|
|
|
@ -0,0 +1,891 @@
|
|||
<template>
|
||||
<el-container class="main-body">
|
||||
<el-container class="body-left">
|
||||
<el-header height="10%" class="left-header">
|
||||
<el-row type="flex" justify="space-around" style="width: 90%">
|
||||
<el-col :span="3"
|
||||
><el-button @click="shotScreen" size="medium"
|
||||
>下载图片</el-button
|
||||
></el-col
|
||||
>
|
||||
<el-col :span="5">
|
||||
<el-select
|
||||
v-model="level"
|
||||
placeholder="展开节点"
|
||||
size="medium"
|
||||
@change="expand_to_level"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in nodeOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-select
|
||||
v-model="theme"
|
||||
placeholder="选择主题"
|
||||
@change="set_theme"
|
||||
size="medium"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in themeOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button @click="clickModify" size="medium"
|
||||
>修改</el-button
|
||||
></el-col
|
||||
>
|
||||
<el-col :span="2">
|
||||
<el-button
|
||||
@click="clickSaveTree"
|
||||
size="medium"
|
||||
v-bind:disabled="!allowSave"
|
||||
>保存</el-button
|
||||
></el-col
|
||||
>
|
||||
</el-row>
|
||||
</el-header>
|
||||
<div
|
||||
style="height: 90%; width: 100%"
|
||||
id="jsmind_container"
|
||||
v-on:click="clickNode"
|
||||
@dblclick="editNode"
|
||||
></div>
|
||||
</el-container>
|
||||
<el-container class="body-right">
|
||||
<el-header height="10%" class="right-header">
|
||||
<el-row type="flex" justify="space-around" style="width: 90%">
|
||||
<el-col :span="2"
|
||||
><el-button plain @click="clickHello()" size="medium"
|
||||
>你好世界</el-button
|
||||
></el-col
|
||||
>
|
||||
<el-col :span="2"
|
||||
><el-button plain size="medium" @click="clickTest1"
|
||||
>Test1</el-button
|
||||
></el-col
|
||||
>
|
||||
<el-col :span="2"
|
||||
><el-button plain size="medium" @click="clickTest2"
|
||||
>Test2</el-button
|
||||
></el-col
|
||||
>
|
||||
<el-col :span="2"
|
||||
><el-button plain size="medium" @click="clickSaveDoc"
|
||||
>保存</el-button
|
||||
></el-col
|
||||
>
|
||||
</el-row>
|
||||
</el-header>
|
||||
<!-- <job-description :data="jobData" ref="jobDescription"></job-description> -->
|
||||
<component
|
||||
:is="comName"
|
||||
:data="comData"
|
||||
:key="comKey"
|
||||
:comTitleEdit="comTitleEdit"
|
||||
></component>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import "@/assets/css/jsmind.css";
|
||||
import jsMind from "jsmind/js/jsmind.js";
|
||||
window.jsMind = jsMind;
|
||||
|
||||
// const { init } = require("@/assets/js/jsmind.menu.js");
|
||||
// require("jsmind/js/jsmind.draggable.js");
|
||||
require("jsmind/js/jsmind.screenshot.js");
|
||||
// init(jsMind);
|
||||
|
||||
import JobDescription from "./components/JobDescription.vue";
|
||||
import DepDescription from "./components/DepDescription.vue";
|
||||
import NoData from "./components/NoData.vue";
|
||||
|
||||
import * as jobApi from "@/api/job";
|
||||
import { verifyJobPriority } from "@/api/priotity";
|
||||
|
||||
import { MessageBox, Message } from "element-ui";
|
||||
|
||||
export default {
|
||||
name: "job",
|
||||
data() {
|
||||
return {
|
||||
jm: null,
|
||||
mindData: null,
|
||||
level: 1,
|
||||
nodeOptions: [
|
||||
{ value: 1, label: "展开到一级节点" },
|
||||
{ value: 2, label: "展开到二级节点" },
|
||||
{ value: 3, label: "展开到三级节点" },
|
||||
{ value: 4, label: "展开到四级节点" },
|
||||
{ value: 0, label: "展开全部节点" },
|
||||
{ value: -1, label: "隐藏全部节点" },
|
||||
],
|
||||
themeOptions: [
|
||||
{ value: "default", label: "纯白" },
|
||||
{ value: "clouds", label: "云朵白" },
|
||||
{ value: "wisteria", label: "紫" },
|
||||
{ value: "belizehole", label: "天空蓝" },
|
||||
{ value: "primary", label: "深蓝" },
|
||||
{ value: "info", label: "青" },
|
||||
{ value: "nephrite", label: "青绿" },
|
||||
{ value: "success", label: "浅绿 " },
|
||||
{ value: "greensea", label: "绿" },
|
||||
{ value: "orange", label: "橘黄" },
|
||||
{ value: "warning", label: "浅黄" },
|
||||
{ value: "pumpkin", label: "南瓜黄" },
|
||||
{ value: "danger", label: "红" },
|
||||
{ value: "pomegranate", label: "石榴红" },
|
||||
{ value: "asbestos", label: "灰" },
|
||||
{ value: "asphalt", label: "沥青黑" },
|
||||
],
|
||||
theme: "belizehole",
|
||||
allowSave: false,
|
||||
jobData: null,
|
||||
depData: null,
|
||||
comName: "NoData",
|
||||
comData: null,
|
||||
comKey: 0,
|
||||
preSelectNodeId: null,
|
||||
curDep: null,
|
||||
curJob: null,
|
||||
curNewNode: null,
|
||||
intervalId: null,
|
||||
comTitleEdit: null,
|
||||
writePriority: null,
|
||||
};
|
||||
},
|
||||
created() {},
|
||||
mounted() {
|
||||
// 请求组织架构
|
||||
jobApi.getFramework().then(
|
||||
(res) => {
|
||||
let originalMindData = res.data;
|
||||
// 添加 id 和 expanded
|
||||
// let i = 1;
|
||||
originalMindData["expanded"] = true;
|
||||
let addId = function (data) {
|
||||
// if (!data.hasOwnProperty("id")) {
|
||||
// data["id"] = i;
|
||||
// i += 1;
|
||||
// }
|
||||
if (!data.hasOwnProperty("expanded")) {
|
||||
data["expanded"] = false;
|
||||
}
|
||||
if (data.hasOwnProperty("children")) {
|
||||
for (let j = 0; j < data["children"].length; j++) {
|
||||
addId(data["children"][j]);
|
||||
}
|
||||
}
|
||||
};
|
||||
addId(originalMindData);
|
||||
|
||||
// 修改方向
|
||||
for (let j = 0; j < originalMindData["children"].length; j++) {
|
||||
if (j % 2 == 0) {
|
||||
originalMindData["children"][j]["direction"] = "right";
|
||||
} else {
|
||||
originalMindData["children"][j]["direction"] = "left";
|
||||
}
|
||||
}
|
||||
this.mindData = originalMindData;
|
||||
|
||||
// 展示思维导图
|
||||
this.showChart();
|
||||
},
|
||||
(err) => {
|
||||
console.log("err: ", err);
|
||||
}
|
||||
);
|
||||
|
||||
// admin
|
||||
if (this.$store.state.user.is_admin) {
|
||||
this.writePriority = true;
|
||||
}
|
||||
// this.intervalId = setInterval(() => {
|
||||
// if (this.jm) {
|
||||
// // 绑定全局键盘输入事件
|
||||
// let that = this;
|
||||
// document.onkeydown = function (e) {
|
||||
// // jsmind输入事件
|
||||
// if (
|
||||
// e.code == "Enter" &&
|
||||
// document.activeElement.className == "jsmind-inner"
|
||||
// ) {
|
||||
// // 在编辑节点时输入Enter不会捕获到这里
|
||||
// let node = that.jm.get_selected_node();
|
||||
// if (node) {
|
||||
// if (node.topic == "新节点") {
|
||||
// that.curNewNode = node;
|
||||
// that.addNewDoc();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
// clearInterval(this.intervalId);
|
||||
// } else {
|
||||
// }
|
||||
// }, 1000);
|
||||
},
|
||||
methods: {
|
||||
showChart() {
|
||||
var mind = {
|
||||
/* 元数据,定义思维导图的名称、作者、版本等信息 */
|
||||
meta: {
|
||||
name: "jsMind-demo-tree",
|
||||
author: "iec",
|
||||
version: "1.0",
|
||||
},
|
||||
/* 数据格式声明 */
|
||||
format: "node_tree",
|
||||
/* 数据内容 */
|
||||
data: this.mindData,
|
||||
};
|
||||
var options = {
|
||||
// options 将在下一章中详细介绍
|
||||
container: "jsmind_container", // [必选] 容器的ID,或者为容器的对象
|
||||
editable: false, // [可选] 是否启用编辑
|
||||
theme: "belizehole", // [可选] 主题
|
||||
mode: "full",
|
||||
support_html: false,
|
||||
view: {
|
||||
engine: "canvas", // 思维导图各节点之间线条的绘制引擎
|
||||
hmargin: 50, // 思维导图距容器外框的最小水平距离
|
||||
vmargin: 50, // 思维导图距容器外框的最小垂直距离
|
||||
line_width: 1, // 思维导图线条的粗细
|
||||
line_color: "#555", // 思维导图线条的颜色
|
||||
draggable: true, // 当容器不能完全容纳思维导图时,是否允许拖动画布代替鼠标滚动
|
||||
hide_scrollbars_when_draggable: false, // 当设置 draggable = true 时,是否隐藏滚动条
|
||||
},
|
||||
layout: {
|
||||
hspace: 30, // 节点之间的水平间距
|
||||
vspace: 20, // 节点之间的垂直间距
|
||||
pspace: 13, // 节点与连接线之间的水平间距(用于容纳节点收缩/展开控制器)
|
||||
},
|
||||
shortcut: {
|
||||
enable: true, // 是否启用快捷键
|
||||
handles: {
|
||||
myAddChild: function (jm, e) {
|
||||
let node = jm.get_selected_node();
|
||||
if (node) {
|
||||
if (jm.options.editable) {
|
||||
let childId = jm.options.maxIndex;
|
||||
jm.options.maxIndex += 1;
|
||||
jm.add_node(node, childId, "新节点", "");
|
||||
jm.select_node(jm.get_node(childId));
|
||||
// jm.begin_edit(childId);
|
||||
}
|
||||
}
|
||||
},
|
||||
myAddBrother: function (jm, e) {
|
||||
let node = jm.get_selected_node();
|
||||
if (node) {
|
||||
if (jm.options.editable && !node.isroot) {
|
||||
let broId = jm.options.maxIndex;
|
||||
jm.options.maxIndex += 1;
|
||||
jm.insert_node_after(node, broId, "新节点", "");
|
||||
jm.select_node(jm.get_node(broId));
|
||||
// jm.begin_edit(broId);
|
||||
}
|
||||
}
|
||||
},
|
||||
}, // 命名的快捷键事件处理器
|
||||
mapping: {
|
||||
// 快捷键映射
|
||||
myAddChild: 9, // <Tab>
|
||||
myAddBrother: 13, // <Enter>
|
||||
editnode: 113, // <F2>
|
||||
delnode: 46, // <Delete>
|
||||
toggle: 32, // <Space>
|
||||
left: 37, // <Left>
|
||||
up: 38, // <Up>
|
||||
right: 39, // <Right>
|
||||
down: 40, // <Down>
|
||||
},
|
||||
},
|
||||
// 新增节点id十万起步,保证容错
|
||||
maxIndex: 100000,
|
||||
};
|
||||
this.jm = new jsMind(options);
|
||||
this.jm.show(mind);
|
||||
console.log(this.mindData);
|
||||
},
|
||||
isDepartment(jmNode) {
|
||||
// 二级节点一定是部门
|
||||
let level = 1;
|
||||
let tempNode = jmNode;
|
||||
while (!tempNode.isroot) {
|
||||
level += 1;
|
||||
tempNode = tempNode.parent;
|
||||
}
|
||||
if (level == 2) {
|
||||
return true;
|
||||
}
|
||||
if (level == 3 && jmNode.topic.endsWith("区域")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
renderComponent() {
|
||||
this.comKey = (this.comKey + 1) % 100;
|
||||
},
|
||||
clickNode() {
|
||||
let node = this.jm.get_selected_node();
|
||||
if (node) {
|
||||
// 新节点 添加文档
|
||||
if (node.topic == "新节点") {
|
||||
// this.curNewNode = node;
|
||||
// this.addNewDoc();
|
||||
return;
|
||||
}
|
||||
|
||||
// 重复点击不变
|
||||
if (node.id === this.preSelectNodeId) {
|
||||
return;
|
||||
} else {
|
||||
this.preSelectNodeId = node.id;
|
||||
}
|
||||
|
||||
// 根节点无动作
|
||||
if (node.isroot) {
|
||||
return;
|
||||
}
|
||||
if (this.isDepartment(node)) {
|
||||
// 请求部门详细数据
|
||||
jobApi.getDepartmentDetail({ department: node.topic }).then(
|
||||
(res) => {
|
||||
if (res.code === 0) {
|
||||
// 切换右边页面
|
||||
this.depData = res.data;
|
||||
this.comName = "DepDescription";
|
||||
this.comData = this.depData;
|
||||
this.comTitleEdit = false;
|
||||
this.renderComponent();
|
||||
this.curDep = node.topic;
|
||||
} else {
|
||||
this.comName = "NoData";
|
||||
this.comData = null;
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
console.log("err: ", err);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
// 请求岗位详细数据
|
||||
let jobDep = node.parent.topic;
|
||||
jobApi.getJobDetail({ department: jobDep, job: node.topic }).then(
|
||||
(res) => {
|
||||
if (res.code === 0) {
|
||||
// 数据存在
|
||||
this.jobData = res.data;
|
||||
this.comName = "JobDescription";
|
||||
this.comData = this.jobData;
|
||||
this.comTitleEdit = false;
|
||||
this.renderComponent();
|
||||
this.curDep = jobDep;
|
||||
this.curJob = node.topic;
|
||||
} else {
|
||||
this.comName = "NoData";
|
||||
this.comData = null;
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
console.log("err: ", err);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
editNode() {
|
||||
let node = this.jm.get_selected_node();
|
||||
if (node) {
|
||||
if (node.topic == "新节点") {
|
||||
this.curNewNode = node;
|
||||
this.addNewDoc();
|
||||
}
|
||||
}
|
||||
},
|
||||
addNewDoc() {
|
||||
this.$confirm("新建部门还是岗位?", "提示", {
|
||||
confirmButtonText: "部门",
|
||||
confirmButtonClass: "confirm-button",
|
||||
cancelButtonText: "岗位",
|
||||
cancelButtonClass: "confirm-button",
|
||||
type: "success",
|
||||
})
|
||||
.then(() => {
|
||||
this.depData = {
|
||||
部门名称: "<<部门名称>>",
|
||||
所属上级组织机构: "<<湖北中烟工业有限责任公司恩施卷烟厂>>",
|
||||
部门属性: "<<职能部门>>",
|
||||
是否为虚拟部门: true,
|
||||
};
|
||||
this.comName = "DepDescription";
|
||||
this.comData = this.depData;
|
||||
this.comTitleEdit = true;
|
||||
this.renderComponent();
|
||||
|
||||
this.curDep = null;
|
||||
})
|
||||
.catch(() => {
|
||||
this.curDep = this.curNewNode.parent.topic;
|
||||
this.curJob = null;
|
||||
// 切换页面
|
||||
this.jobData = {
|
||||
岗位名称: "<<岗位名称>>",
|
||||
岗位概况: {
|
||||
岗位名称: "<<科长>>",
|
||||
岗位级别: "<<10>>",
|
||||
定编人数: "<<1>>",
|
||||
所属部门: this.curDep,
|
||||
岗位类别: "<<专业管理类>>",
|
||||
辖员人数: "<<9>>",
|
||||
直接上级: "<<分管领导>>",
|
||||
直接下级: "<<副科长>>",
|
||||
},
|
||||
工作内容: {
|
||||
工作概况: "依据《会计法》及相关财经法规,……",
|
||||
工作说明: {
|
||||
党风廉政建设: ["抓好全面从严治党和党风廉政建设,……"],
|
||||
工作职责: [
|
||||
"组织制定企业内部财务管理制度、会计控制规范及会计核算规程,……",
|
||||
],
|
||||
部门管理: ["根据企业管理规范,……"],
|
||||
业务管理: ["协助分管财务厂长完善全厂的财务管理体系,……"],
|
||||
属员管理: ["开展本部门员工的绩效管理工作,……"],
|
||||
安全职责: [
|
||||
"保证国家安全生产法规和厂安全生产规章制度在本部门的贯彻执行,……",
|
||||
],
|
||||
临时代理工作: ["完成上级领导临时交办的其他工作任务,……"],
|
||||
},
|
||||
职权范围: {
|
||||
所受监督: "企业资金安全、……",
|
||||
所施监督: "会计核算、……",
|
||||
工作权限: [
|
||||
"对企业财务预算的分解落实、资金及费用的支付有建议权和执行权……",
|
||||
],
|
||||
沟通关系企业内部: [
|
||||
"与企业领导就预算执行情况、财务分析、资金使用情况等……",
|
||||
],
|
||||
沟通关系企业外部: [
|
||||
"与中烟公司财务部领导就本企业财务预算及资金使用情况等……",
|
||||
],
|
||||
},
|
||||
工作环境与条件: {
|
||||
工作时间: "办公班,实际工作时间8小时",
|
||||
工作强度脑力劳动: "高",
|
||||
工作强度体力劳动: "高",
|
||||
出差频度: "驻外工作",
|
||||
主要工作场所: "室内",
|
||||
工作环境的舒适性: "舒适",
|
||||
工作环境的特殊性: ["无", "噪音"],
|
||||
},
|
||||
},
|
||||
任职资格: {
|
||||
学历: "<<大专及以上>>",
|
||||
专业: "<<财会>>",
|
||||
技术职称: "<<会计师及以上职称>>",
|
||||
所需知识: "熟悉会计及税务法规,……",
|
||||
所需技能或能力: ["具备较强的独立工作能力,……"],
|
||||
所需经历或经验: "行业工作经验5年以上,……",
|
||||
所需体能: "身体健康,……",
|
||||
所需职业风格: "作风严谨,……",
|
||||
},
|
||||
备注: "无",
|
||||
};
|
||||
this.comName = "JobDescription";
|
||||
this.comData = this.jobData;
|
||||
this.comTitleEdit = true;
|
||||
this.renderComponent();
|
||||
});
|
||||
},
|
||||
shotScreen() {
|
||||
this.jm.screenshot.shootDownload();
|
||||
},
|
||||
expand_to_level(num) {
|
||||
switch (num) {
|
||||
case -1:
|
||||
this.jm.collapse_all();
|
||||
break;
|
||||
case 0:
|
||||
this.jm.expand_all();
|
||||
break;
|
||||
default:
|
||||
this.jm.expand_to_depth(num);
|
||||
break;
|
||||
}
|
||||
},
|
||||
set_theme(theme_name) {
|
||||
this.jm.set_theme(theme_name);
|
||||
},
|
||||
verifyWritePriority() {
|
||||
if (this.writePriority === null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
verifyJobPriority({
|
||||
id_card: this.$store.state.user.id_card,
|
||||
priority_type: "job_write",
|
||||
}).then(
|
||||
(res) => {
|
||||
this.writePriority = res.data.result;
|
||||
resolve();
|
||||
},
|
||||
(err) => {
|
||||
this.writePriority = 0;
|
||||
console.log("err:", err);
|
||||
reject();
|
||||
}
|
||||
);
|
||||
});
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
async clickModify() {
|
||||
await this.verifyWritePriority();
|
||||
if (this.writePriority) {
|
||||
this.allowSave = true;
|
||||
this.jm.enable_edit();
|
||||
} else {
|
||||
// 没有权限
|
||||
this.$message({
|
||||
message: "没有修改权限",
|
||||
type: "error",
|
||||
duration: 2000,
|
||||
});
|
||||
}
|
||||
// 判断是否有修改权限
|
||||
// verifyJobPriority({
|
||||
// id_card: this.$store.state.user.id_card,
|
||||
// priority_type: "job_write",
|
||||
// }).then(
|
||||
// (res) => {
|
||||
// if (!res.data.result) {
|
||||
// // 没有权限
|
||||
// this.$message({
|
||||
// message: "没有修改权限",
|
||||
// type: "warning",
|
||||
// duration: 2000,
|
||||
// });
|
||||
// } else {
|
||||
// this.allowSave = true;
|
||||
// this.jm.enable_edit();
|
||||
// }
|
||||
// },
|
||||
// (err) => {
|
||||
// console.log("err:", err);
|
||||
// }
|
||||
// );
|
||||
},
|
||||
cleanTreeData() {
|
||||
// 深复制对象
|
||||
// let deepClone = function (obj, newObj) {
|
||||
// var newObj = newObj || {};
|
||||
// for (let key in obj) {
|
||||
// if (typeof obj[key] == "object") {
|
||||
// newObj[key] = obj[key].constructor === Array ? [] : {};
|
||||
// deepClone(obj[key], newObj[key]);
|
||||
// } else {
|
||||
// newObj[key] = obj[key];
|
||||
// }
|
||||
// }
|
||||
// return newObj;
|
||||
// };
|
||||
// let resData = deepClone(this.jm.get_data("node_tree")["data"]);
|
||||
let resData = this.jm.get_data("node_tree")["data"];
|
||||
// 去除id, expanded, direction
|
||||
let removeInvalidAttribution = function (data) {
|
||||
// if (data.hasOwnProperty("id")) {
|
||||
// delete data.id;
|
||||
// }
|
||||
if (data.hasOwnProperty("expanded")) {
|
||||
delete data.expanded;
|
||||
}
|
||||
if (data.hasOwnProperty("direction")) {
|
||||
delete data.direction;
|
||||
}
|
||||
if (data.hasOwnProperty("children")) {
|
||||
for (let i = 0; i < data.children.length; i++) {
|
||||
if (data.children[i].topic == "新节点") {
|
||||
data.children.splice(i, 1);
|
||||
i -= 1;
|
||||
} else {
|
||||
removeInvalidAttribution(data.children[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
removeInvalidAttribution(resData);
|
||||
return resData;
|
||||
},
|
||||
clickSaveTree() {
|
||||
let resData = this.cleanTreeData();
|
||||
// 发送请求
|
||||
jobApi.modifyFramework({ data: resData }).then(
|
||||
(res) => {
|
||||
if (res.code === 0) {
|
||||
Message({
|
||||
message: "保存成功",
|
||||
type: "success",
|
||||
duration: 1 * 1000,
|
||||
});
|
||||
}
|
||||
console.log(resData);
|
||||
},
|
||||
(err) => {
|
||||
console.log("err: ", err);
|
||||
}
|
||||
);
|
||||
},
|
||||
clickHello() {
|
||||
// 发起请求
|
||||
// this.req({
|
||||
// url: "/job/framework",
|
||||
// data: {},
|
||||
// methods: "get",
|
||||
// }).then(
|
||||
// (res) => {
|
||||
// console.log("res", res);
|
||||
// },
|
||||
// (err) => {
|
||||
// console.log("err", err);
|
||||
// }
|
||||
// );
|
||||
// jobApi.getFramework().then(res => {
|
||||
// console.log(res);
|
||||
// }, err => {
|
||||
// console.log('err :', err);
|
||||
// })
|
||||
console.log("Hello");
|
||||
},
|
||||
clickTest1() {
|
||||
console.log(this.depData);
|
||||
},
|
||||
clickTest2() {
|
||||
this.comName = "DepDescription";
|
||||
this.comData = "Hello";
|
||||
},
|
||||
checkNewNodeValid(nodeName) {
|
||||
if (nodeName.indexOf("<") != -1 || nodeName.indexOf(">") != -1) {
|
||||
return "名称不能包含'<' 或 '>'";
|
||||
}
|
||||
|
||||
// 不能有重复的兄弟
|
||||
let brotherArr = this.curNewNode.parent.children;
|
||||
for (let brother of brotherArr) {
|
||||
if (brother.id != this.curNewNode.id) {
|
||||
if (brother.topic == nodeName) {
|
||||
return "名称与不能与兄弟节点重名";
|
||||
}
|
||||
}
|
||||
}
|
||||
return "合法名称";
|
||||
},
|
||||
async clickSaveDoc() {
|
||||
// 判断权限
|
||||
await this.verifyWritePriority();
|
||||
|
||||
if (!this.writePriority) {
|
||||
// 没有权限
|
||||
this.$message({
|
||||
message: "没有修改权限",
|
||||
type: "error",
|
||||
duration: 2000,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 增加节点,判断是否可添加
|
||||
if (this.curNewNode) {
|
||||
if (this.comName == "DepDescription") {
|
||||
this.curDep = this.depData.部门名称;
|
||||
} else {
|
||||
this.curJob = this.jobData.岗位概况.岗位名称;
|
||||
}
|
||||
let nodeName =
|
||||
this.comName == "DepDescription" ? this.curDep : this.curJob;
|
||||
let msg = this.checkNewNodeValid(nodeName);
|
||||
if (msg == "合法名称") {
|
||||
// 保存修改到架构图
|
||||
this.jm.update_node(this.curNewNode.id, nodeName);
|
||||
// 发送保存架构图请求
|
||||
let resData = this.cleanTreeData();
|
||||
// 发送请求
|
||||
jobApi.modifyFramework({ data: resData }).then(
|
||||
(res) => {
|
||||
if (res.code == 0) {
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
console.log("err: ", err);
|
||||
}
|
||||
);
|
||||
// 还原curNewNode状态
|
||||
this.curNewNode = null;
|
||||
} else {
|
||||
Message({
|
||||
message: msg,
|
||||
type: "error",
|
||||
duration: 1 * 1000,
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 修改节点
|
||||
if (this.comName === "DepDescription") {
|
||||
// 整理数据
|
||||
// 去除两端空字符
|
||||
for (let i of Object.keys(this.depData)) {
|
||||
if (i == "是否为虚拟部门") {
|
||||
continue;
|
||||
}
|
||||
this.depData[i] = this.depData[i].trim();
|
||||
}
|
||||
// 部门保存
|
||||
jobApi
|
||||
.modifyDepartmentDetail({
|
||||
data: this.depData,
|
||||
department: this.curDep,
|
||||
})
|
||||
.then(
|
||||
(res) => {
|
||||
if (res.code === 0) {
|
||||
Message({
|
||||
message: "保存成功",
|
||||
type: "success",
|
||||
duration: 1 * 1000,
|
||||
});
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
console.log("err:", err);
|
||||
}
|
||||
);
|
||||
} else if (this.comName === "JobDescription") {
|
||||
// 整理数据
|
||||
let tinyData = function (data) {
|
||||
for (let name in data) {
|
||||
if (typeof data[name] == "string") {
|
||||
data[name] = data[name].trim();
|
||||
} else if (data[name] instanceof Array) {
|
||||
// 去除 "双击添加"
|
||||
let arr = data[name];
|
||||
while (arr[arr.length - 1] == "双击添加") {
|
||||
arr.pop();
|
||||
}
|
||||
// 去除 空字符串""
|
||||
// for (let i = 0; i < arr.length; i++) {
|
||||
// if (arr[i].trim() == "") {
|
||||
// arr.splice(i, 1);
|
||||
// i -= 1;
|
||||
// }
|
||||
// }
|
||||
|
||||
// 去除空数组
|
||||
let deleteArr = [
|
||||
"党风廉政建设",
|
||||
"工作职责",
|
||||
"部门管理",
|
||||
"业务管理",
|
||||
"属员管理",
|
||||
"安全职责",
|
||||
"临时代理工作",
|
||||
];
|
||||
if (!arr.length && deleteArr.includes(name)) {
|
||||
delete data[name];
|
||||
}
|
||||
} else if (data[name] instanceof Object) {
|
||||
tinyData(data[name]);
|
||||
} else {
|
||||
// console.log(data[name]);
|
||||
}
|
||||
}
|
||||
};
|
||||
tinyData(this.jobData);
|
||||
// 岗位保存
|
||||
jobApi
|
||||
.modifyJobDetail({
|
||||
data: this.jobData,
|
||||
department: this.curDep,
|
||||
job: this.curJob,
|
||||
})
|
||||
.then(
|
||||
(res) => {
|
||||
if (res.code) {
|
||||
Message({
|
||||
message: "保存成功",
|
||||
type: "success",
|
||||
duration: 1 * 1000,
|
||||
});
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
console.log("err:", err);
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
},
|
||||
components: {
|
||||
JobDescription,
|
||||
DepDescription,
|
||||
NoData,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.main-body {
|
||||
width: 100%;
|
||||
height: calc(100vh - 50px);
|
||||
}
|
||||
|
||||
.body-left {
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.left-header {
|
||||
position: relative;
|
||||
background-color: #f8f9fa;
|
||||
box-shadow: 0 0 4px #b8b8b8;
|
||||
/* box-shadow: 0px -8px 5px -5px #b8b8b8; */
|
||||
}
|
||||
|
||||
.left-header > div {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.body-right {
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.right-header {
|
||||
position: relative;
|
||||
background-color: #f8f9fa;
|
||||
box-shadow: 0 0 4px #b8b8b8;
|
||||
}
|
||||
|
||||
.right-header > div {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
</style>
|
|
@ -555,18 +555,19 @@ export default {
|
|||
}
|
||||
},
|
||||
async clickModify() {
|
||||
await this.verifyWritePriority();
|
||||
if (this.writePriority) {
|
||||
this.allowSave = true;
|
||||
this.jm.enable_edit();
|
||||
} else {
|
||||
// 没有权限
|
||||
this.$message({
|
||||
message: "没有修改权限",
|
||||
type: "error",
|
||||
duration: 2000,
|
||||
});
|
||||
}
|
||||
// await this.verifyWritePriority();
|
||||
// if (this.writePriority) {
|
||||
// this.allowSave = true;
|
||||
// this.jm.enable_edit();
|
||||
// } else {
|
||||
// // 没有权限
|
||||
// this.$message({
|
||||
// message: "没有修改权限",
|
||||
// type: "error",
|
||||
// duration: 2000,
|
||||
// });
|
||||
// }
|
||||
|
||||
// 判断是否有修改权限
|
||||
// verifyJobPriority({
|
||||
// id_card: this.$store.state.user.id_card,
|
||||
|
@ -632,23 +633,23 @@ export default {
|
|||
return resData;
|
||||
},
|
||||
clickSaveTree() {
|
||||
let resData = this.cleanTreeData();
|
||||
// 发送请求
|
||||
jobApi.modifyFramework({ data: resData }).then(
|
||||
(res) => {
|
||||
if (res.code === 0) {
|
||||
Message({
|
||||
message: "保存成功",
|
||||
type: "success",
|
||||
duration: 1 * 1000,
|
||||
});
|
||||
}
|
||||
console.log(resData);
|
||||
},
|
||||
(err) => {
|
||||
console.log("err: ", err);
|
||||
}
|
||||
);
|
||||
// let resData = this.cleanTreeData();
|
||||
// // 发送请求
|
||||
// jobApi.modifyFramework({ data: resData }).then(
|
||||
// (res) => {
|
||||
// if (res.code === 0) {
|
||||
// Message({
|
||||
// message: "保存成功",
|
||||
// type: "success",
|
||||
// duration: 1 * 1000,
|
||||
// });
|
||||
// }
|
||||
// console.log(resData);
|
||||
// },
|
||||
// (err) => {
|
||||
// console.log("err: ", err);
|
||||
// }
|
||||
// );
|
||||
},
|
||||
clickHello() {
|
||||
// 发起请求
|
||||
|
@ -695,149 +696,149 @@ export default {
|
|||
return "合法名称";
|
||||
},
|
||||
async clickSaveDoc() {
|
||||
// 判断权限
|
||||
await this.verifyWritePriority();
|
||||
// // 判断权限
|
||||
// await this.verifyWritePriority();
|
||||
|
||||
if (!this.writePriority) {
|
||||
// 没有权限
|
||||
this.$message({
|
||||
message: "没有修改权限",
|
||||
type: "error",
|
||||
duration: 2000,
|
||||
});
|
||||
return;
|
||||
}
|
||||
// if (!this.writePriority) {
|
||||
// // 没有权限
|
||||
// this.$message({
|
||||
// message: "没有修改权限",
|
||||
// type: "error",
|
||||
// duration: 2000,
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
|
||||
// 增加节点,判断是否可添加
|
||||
if (this.curNewNode) {
|
||||
if (this.comName == "DepDescription") {
|
||||
this.curDep = this.depData.部门名称;
|
||||
} else {
|
||||
this.curJob = this.jobData.岗位概况.岗位名称;
|
||||
}
|
||||
let nodeName =
|
||||
this.comName == "DepDescription" ? this.curDep : this.curJob;
|
||||
let msg = this.checkNewNodeValid(nodeName);
|
||||
if (msg == "合法名称") {
|
||||
// 保存修改到架构图
|
||||
this.jm.update_node(this.curNewNode.id, nodeName);
|
||||
// 发送保存架构图请求
|
||||
let resData = this.cleanTreeData();
|
||||
// 发送请求
|
||||
jobApi.modifyFramework({ data: resData }).then(
|
||||
(res) => {
|
||||
if (res.code == 0) {
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
console.log("err: ", err);
|
||||
}
|
||||
);
|
||||
// 还原curNewNode状态
|
||||
this.curNewNode = null;
|
||||
} else {
|
||||
Message({
|
||||
message: msg,
|
||||
type: "error",
|
||||
duration: 1 * 1000,
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
// // 增加节点,判断是否可添加
|
||||
// if (this.curNewNode) {
|
||||
// if (this.comName == "DepDescription") {
|
||||
// this.curDep = this.depData.部门名称;
|
||||
// } else {
|
||||
// this.curJob = this.jobData.岗位概况.岗位名称;
|
||||
// }
|
||||
// let nodeName =
|
||||
// this.comName == "DepDescription" ? this.curDep : this.curJob;
|
||||
// let msg = this.checkNewNodeValid(nodeName);
|
||||
// if (msg == "合法名称") {
|
||||
// // 保存修改到架构图
|
||||
// this.jm.update_node(this.curNewNode.id, nodeName);
|
||||
// // 发送保存架构图请求
|
||||
// let resData = this.cleanTreeData();
|
||||
// // 发送请求
|
||||
// jobApi.modifyFramework({ data: resData }).then(
|
||||
// (res) => {
|
||||
// if (res.code == 0) {
|
||||
// }
|
||||
// },
|
||||
// (err) => {
|
||||
// console.log("err: ", err);
|
||||
// }
|
||||
// );
|
||||
// // 还原curNewNode状态
|
||||
// this.curNewNode = null;
|
||||
// } else {
|
||||
// Message({
|
||||
// message: msg,
|
||||
// type: "error",
|
||||
// duration: 1 * 1000,
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
// 修改节点
|
||||
if (this.comName === "DepDescription") {
|
||||
// 整理数据
|
||||
// 去除两端空字符
|
||||
for (let i of Object.keys(this.depData)) {
|
||||
if (i == "是否为虚拟部门") {
|
||||
continue;
|
||||
}
|
||||
this.depData[i] = this.depData[i].trim();
|
||||
}
|
||||
// 部门保存
|
||||
jobApi
|
||||
.modifyDepartmentDetail({
|
||||
data: this.depData,
|
||||
department: this.curDep,
|
||||
})
|
||||
.then(
|
||||
(res) => {
|
||||
if (res.code === 0) {
|
||||
Message({
|
||||
message: "保存成功",
|
||||
type: "success",
|
||||
duration: 1 * 1000,
|
||||
});
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
console.log("err:", err);
|
||||
}
|
||||
);
|
||||
} else if (this.comName === "JobDescription") {
|
||||
// 整理数据
|
||||
let tinyData = function (data) {
|
||||
for (let name in data) {
|
||||
if (typeof data[name] == "string") {
|
||||
data[name] = data[name].trim();
|
||||
} else if (data[name] instanceof Array) {
|
||||
// 去除 "双击添加"
|
||||
let arr = data[name];
|
||||
while (arr[arr.length - 1] == "双击添加") {
|
||||
arr.pop();
|
||||
}
|
||||
// 去除 空字符串""
|
||||
// for (let i = 0; i < arr.length; i++) {
|
||||
// if (arr[i].trim() == "") {
|
||||
// arr.splice(i, 1);
|
||||
// i -= 1;
|
||||
// }
|
||||
// }
|
||||
// // 修改节点
|
||||
// if (this.comName === "DepDescription") {
|
||||
// // 整理数据
|
||||
// // 去除两端空字符
|
||||
// for (let i of Object.keys(this.depData)) {
|
||||
// if (i == "是否为虚拟部门") {
|
||||
// continue;
|
||||
// }
|
||||
// this.depData[i] = this.depData[i].trim();
|
||||
// }
|
||||
// // 部门保存
|
||||
// jobApi
|
||||
// .modifyDepartmentDetail({
|
||||
// data: this.depData,
|
||||
// department: this.curDep,
|
||||
// })
|
||||
// .then(
|
||||
// (res) => {
|
||||
// if (res.code === 0) {
|
||||
// Message({
|
||||
// message: "保存成功",
|
||||
// type: "success",
|
||||
// duration: 1 * 1000,
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
// (err) => {
|
||||
// console.log("err:", err);
|
||||
// }
|
||||
// );
|
||||
// } else if (this.comName === "JobDescription") {
|
||||
// // 整理数据
|
||||
// let tinyData = function (data) {
|
||||
// for (let name in data) {
|
||||
// if (typeof data[name] == "string") {
|
||||
// data[name] = data[name].trim();
|
||||
// } else if (data[name] instanceof Array) {
|
||||
// // 去除 "双击添加"
|
||||
// let arr = data[name];
|
||||
// while (arr[arr.length - 1] == "双击添加") {
|
||||
// arr.pop();
|
||||
// }
|
||||
// // 去除 空字符串""
|
||||
// // for (let i = 0; i < arr.length; i++) {
|
||||
// // if (arr[i].trim() == "") {
|
||||
// // arr.splice(i, 1);
|
||||
// // i -= 1;
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// 去除空数组
|
||||
let deleteArr = [
|
||||
"党风廉政建设",
|
||||
"工作职责",
|
||||
"部门管理",
|
||||
"业务管理",
|
||||
"属员管理",
|
||||
"安全职责",
|
||||
"临时代理工作",
|
||||
];
|
||||
if (!arr.length && deleteArr.includes(name)) {
|
||||
delete data[name];
|
||||
}
|
||||
} else if (data[name] instanceof Object) {
|
||||
tinyData(data[name]);
|
||||
} else {
|
||||
// console.log(data[name]);
|
||||
}
|
||||
}
|
||||
};
|
||||
tinyData(this.jobData);
|
||||
// 岗位保存
|
||||
jobApi
|
||||
.modifyJobDetail({
|
||||
data: this.jobData,
|
||||
department: this.curDep,
|
||||
job: this.curJob,
|
||||
})
|
||||
.then(
|
||||
(res) => {
|
||||
if (res.code) {
|
||||
Message({
|
||||
message: "保存成功",
|
||||
type: "success",
|
||||
duration: 1 * 1000,
|
||||
});
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
console.log("err:", err);
|
||||
}
|
||||
);
|
||||
}
|
||||
// // 去除空数组
|
||||
// let deleteArr = [
|
||||
// "党风廉政建设",
|
||||
// "工作职责",
|
||||
// "部门管理",
|
||||
// "业务管理",
|
||||
// "属员管理",
|
||||
// "安全职责",
|
||||
// "临时代理工作",
|
||||
// ];
|
||||
// if (!arr.length && deleteArr.includes(name)) {
|
||||
// delete data[name];
|
||||
// }
|
||||
// } else if (data[name] instanceof Object) {
|
||||
// tinyData(data[name]);
|
||||
// } else {
|
||||
// // console.log(data[name]);
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
// tinyData(this.jobData);
|
||||
// // 岗位保存
|
||||
// jobApi
|
||||
// .modifyJobDetail({
|
||||
// data: this.jobData,
|
||||
// department: this.curDep,
|
||||
// job: this.curJob,
|
||||
// })
|
||||
// .then(
|
||||
// (res) => {
|
||||
// if (res.code) {
|
||||
// Message({
|
||||
// message: "保存成功",
|
||||
// type: "success",
|
||||
// duration: 1 * 1000,
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
// (err) => {
|
||||
// console.log("err:", err);
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
},
|
||||
},
|
||||
components: {
|
||||
|
|
|
@ -133,6 +133,7 @@
|
|||
<svg-icon icon-class="优秀党员" />
|
||||
<el-tag>{{ value }}</el-tag>
|
||||
</div>
|
||||
<div v-if="partyData.length == 0">暂无数据。</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -149,6 +150,7 @@
|
|||
<svg-icon :icon-class="getHonorIconName(value)" />
|
||||
<el-tag :type="getHonorTagType(value)">{{ value }}</el-tag>
|
||||
</div>
|
||||
<div v-if="honorData.length==0">暂无数据。</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pp-block2-right">
|
||||
|
@ -162,6 +164,7 @@
|
|||
<svg-icon icon-class="先进" />
|
||||
<el-tag>{{ value }}</el-tag>
|
||||
</div>
|
||||
<div v-if="advanceData.length==0">暂无数据。</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue