Commit 297d0503 authored by 罗超's avatar 罗超

完成OKR对齐视图

parent 7f010e17
...@@ -48,7 +48,7 @@ module.exports = function (ctx) { ...@@ -48,7 +48,7 @@ module.exports = function (ctx) {
build: { build: {
vueRouterMode: 'hash', // available values: 'hash', 'history' vueRouterMode: 'hash', // available values: 'hash', 'history'
env: ctx.dev ? { env: ctx.dev ? {
API: 'http://192.168.1.27:8300/api' API: 'http://192.168.1.13:8085/api'
} : { } : {
API: 'http://eduapi.oytour.com/api' API: 'http://eduapi.oytour.com/api'
}, },
......
...@@ -175,7 +175,9 @@ body, ...@@ -175,7 +175,9 @@ body,
.micfont { .micfont {
font-family: perfectFont !important; font-family: perfectFont !important;
} }
.fixed-right, .absolute-right{
overflow: unset;
}
.dialog-out-close { .dialog-out-close {
background: var(--q-color-primary); background: var(--q-color-primary);
position: absolute !important; position: absolute !important;
......
...@@ -281,4 +281,11 @@ export function queryUserOKRNextAlignView(data){ ...@@ -281,4 +281,11 @@ export function queryUserOKRNextAlignView(data){
method: 'post', method: 'post',
data data
}) })
}
export function queryOtherSignObjective(data){
return request({
url: '/OKRPeriod/GetOKROthersObjectiveInfo',
method: 'post',
data
})
} }
\ No newline at end of file
...@@ -197,23 +197,7 @@ ...@@ -197,23 +197,7 @@
</q-item-section> </q-item-section>
<q-item-section>提交审核</q-item-section> <q-item-section>提交审核</q-item-section>
</q-item> </q-item>
<q-item
class="items-center"
clickable
v-ripple
v-if="newObjective.Status == 3 || newObjective.Status == 4"
@click="setObjectiveStatus"
>
<q-item-section avatar>
<inline-svg
class="svg-icon svg-icon-g-p"
src="icons/svg/General/Shield-check.svg"
width="20px"
height="20px"
></inline-svg>
</q-item-section>
<q-item-section>提交审核</q-item-section>
</q-item>
<q-item <q-item
class="items-center" class="items-center"
clickable clickable
......
<template> <template>
<div class="absolute flex row " style="width:500px;z-index:999;" :style="{'left':direction=='up'?'15px':'15px','top':direction=='up'?'-16px':'11px'}"> <div
class="absolute flex row "
style="width:500px;z-index:999;"
:style="{
left: direction == 'up' ? '15px' : '15px',
top: direction == 'up' ? '-16px' : 'unset',
bottom: direction == 'up' ? 'unset' : '13px'
}"
>
<svg <svg
width="24px" width="24px"
height="24px" height="24px"
style="margin-right:8px" style="margin-right:8px"
:style="{'transform':direction=='up'?'rotate(0deg)':'rotateX(180deg)','margin-top':direction=='up'?'7px':'4px'}" :style="{
transform: direction == 'up' ? 'rotate(0deg)' : 'rotateX(180deg)',
'margin-top': direction == 'up' ? '7px' : '4px'
}"
viewBox="0 0 24 24" viewBox="0 0 24 24"
version="1.1" version="1.1"
v-if="!showOnly || (showOnly && obj.ParentList.length>0 && direction=='up')||(showOnly && obj.ChildList.length>0 && direction=='down')" v-if="
!showOnly ||
(showOnly && obj.ParentList.length > 0 && direction == 'up') ||
(showOnly && obj.ChildList.length > 0 && direction == 'down')
"
> >
<g <g
id="shangduiqi" id="shangduiqi"
...@@ -27,8 +42,8 @@ ...@@ -27,8 +42,8 @@
<template v-for="(x, i) in obj.ParentList"> <template v-for="(x, i) in obj.ParentList">
<div <div
class="hover-primary remark-font cursor-pointer q-mr-xs" class="hover-primary remark-font cursor-pointer q-mr-xs"
:style="{'margin-top':direction=='up'?'0px':'20px'}" :style="{ 'margin-top': direction == 'up' ? '0px' : '20px' }"
v-if="x.AlignList.length > 0 && direction=='up'" v-if="x.AlignList.length > 0 && direction == 'up'"
:key="i" :key="i"
> >
<span>{{ x.AccountName }}</span <span>{{ x.AccountName }}</span
...@@ -46,11 +61,11 @@ ...@@ -46,11 +61,11 @@
</q-popup-proxy> </q-popup-proxy>
</div> </div>
</template> </template>
<template v-for="(x, i) in obj.ChildList"> <template v-for="(x, i) in obj.ChildList">
<div <div
class="hover-primary remark-font cursor-pointer q-mr-xs" class="hover-primary remark-font cursor-pointer q-mr-xs"
:style="{'margin-top':direction=='up'?'0px':'18px'}" :style="{ 'margin-top': direction == 'up' ? '0px' : '18px' }"
v-if="x.AlignList.length > 0 && direction=='down'" v-if="x.AlignList.length > 0 && direction == 'down'"
:key="i" :key="i"
> >
<span>{{ x.AccountName }}</span <span>{{ x.AccountName }}</span
...@@ -67,7 +82,10 @@ ...@@ -67,7 +82,10 @@
</q-popup-proxy> </q-popup-proxy>
</div> </div>
</template> </template>
<div class="hover-primary remark-font cursor-pointer" v-if="direction=='up' && !showOnly"> <div
class="hover-primary remark-font cursor-pointer"
v-if="direction == 'up' && !showOnly"
>
<q-icon <q-icon
name="iconfont icon-add" name="iconfont icon-add"
class="cursor-pointer" class="cursor-pointer"
...@@ -75,7 +93,11 @@ ...@@ -75,7 +93,11 @@
></q-icon> ></q-icon>
<span>添加对齐</span> <span>添加对齐</span>
<q-popup-proxy style="z-index: 9999;"> <q-popup-proxy style="z-index: 9999;">
<search-okr :period-id="periodId" :source-id="obj.Id" @add="addNewAlign"></search-okr> <search-okr
:period-id="periodId"
:source-id="obj.Id"
@add="addNewAlign"
></search-okr>
</q-popup-proxy> </q-popup-proxy>
</div> </div>
</div> </div>
...@@ -85,7 +107,7 @@ ...@@ -85,7 +107,7 @@
import searchOkr from "./search-okr"; import searchOkr from "./search-okr";
import alignInfo from "./align-info"; import alignInfo from "./align-info";
export default { export default {
props: ["obj", "periodId",'direction','showOnly'], props: ["obj", "periodId", "direction", "showOnly"],
components: { components: {
searchOkr, searchOkr,
alignInfo alignInfo
......
<template>
<q-card
style="margin-top:61px;width:600px;overflow:unset;"
class="no-border-radius"
v-if="node"
>
<q-card-section class="row items-center">
<q-avatar
size="40px"
font-size="18px"
rounded
color="blue-2"
text-color="blue-13"
>
<img :src="node.EmPhoto" v-if="node.EmPhoto" />
<span v-else-if="node.EmName">{{ node.EmName.substring(0, 1) }}</span>
</q-avatar>
<div class="text-h6 col q-mx-md">{{ node.EmName }}</div>
<div class="text-primary cursor-pointer" @click="openObjective(node)">
查看详情
</div>
</q-card-section>
<q-card-section v-if="newObjective">
<okr-add
:objective="newObjective"
:show-only="true"
class="q-mb-lg"
:audit-mode="false"
:user-id="0"
></okr-add>
</q-card-section>
<div
class="dialog-out-close"
v-close-popup
style="height:40px !important;border-top-left-radius: 4px !important;border-bottom-left-radius: 4px !important;"
>
<q-icon name="iconfont icon-jujue1" size="26px" />
</div>
</q-card>
</template>
<script>
import okrAdd from "./okr-query";
import { queryOtherSignObjective, querySignObject } from "../../api/okr/work";
import { mapGetters } from "vuex";
export default {
props: ["obj", "proid"],
components: {
okrAdd
},
data() {
return {
node: {},
newObjective: null
};
},
computed: {
...mapGetters(["userInfo"])
},
watch: {
obj: {
handler(newValue, oldValue) {
this.node = newValue;
this.newObjective=null
this.updatedObjective();
},
immediate: true,
isDeep: true
}
},
methods: {
openObjective(x) {
let obj = {
Id: x.UserId,
EmployeeName: x.EmName,
UserIcon: x.EmPhoto
};
this.$root.$emit("openUserObj", obj);
},
updatedObjective() {
if (this.userInfo.Id == this.node.UserId) {
querySignObject({ ObjectiveId: this.node.Id }).then(r => {
this.newObjective = r.Data;
this.$forceUpdate();
});
} else {
queryOtherSignObjective({
ObjectiveId: this.node.Id,
PeriodId: this.proid,
UserId: this.node.UserId
}).then(r => {
this.newObjective = r.Data;
this.$forceUpdate();
});
}
}
}
};
</script>
<style></style>
...@@ -2,15 +2,17 @@ ...@@ -2,15 +2,17 @@
<q-card class="q-py-md no-shadow q-mr-md okr-add"> <q-card class="q-py-md no-shadow q-mr-md okr-add">
<q-input <q-input
v-model="newObjective.Title" v-model="newObjective.Title"
type="textare"
autogrow autogrow
ref="obj_content" ref="obj_content"
:outlined="newBoxState" :outlined="newBoxState"
:placeholder="newObjective.placeHolder" :placeholder="newObjective.placeHolder"
:style="{ 'margin-left': newBoxState ? '-12px' : '15px' }" :style="{ 'margin-left': newBoxState ? '-12px' : '15px'}"
:input-style="{'padding-bottom':(newObjective.ChildList && newObjective.ChildList.length > 0 )?'20px':''}"
readonly readonly
> >
<template v-slot:before> <template v-slot:before>
<div class="relative-position" v-if="!newBoxState"> <div class="relative-position" style="height:100%;margin-top:30px;" v-if="!newBoxState">
<inline-svg <inline-svg
class="svg-icon" class="svg-icon"
:class="{ :class="{
...@@ -304,7 +306,7 @@ ...@@ -304,7 +306,7 @@
</div> </div>
</div> </div>
<q-card flat class="q-mt-md"> <q-card flat class="q-mt-md">
<q-card-section> <q-card-section v-if="newObjective.AuditUserName && newObjective.AuditUserName!=''">
<div class="flex row items-center"> <div class="flex row items-center">
<q-avatar <q-avatar
size="40px" size="40px"
......
...@@ -492,7 +492,8 @@ var SeeksGraphMath = { ...@@ -492,7 +492,8 @@ var SeeksGraphMath = {
} }
}, },
conductStrengthToParents(node) { conductStrengthToParents(node) {
if (node.lot.parent) { console.log("寻找parent:",node.id,node.lot.parent)
if (node.lot.parent && !node.nodeParent) {
node.lot.parent.lot.strengthWithChilds += 1 node.lot.parent.lot.strengthWithChilds += 1
this.conductStrengthToParents(node.lot.parent) this.conductStrengthToParents(node.lot.parent)
} }
......
...@@ -98,7 +98,11 @@ SeeksRGUtils.json2Node = function(originData) { ...@@ -98,7 +98,11 @@ SeeksRGUtils.json2Node = function(originData) {
disableDrag: originData.disableDrag !== undefined ? originData.disableDrag : false, disableDrag: originData.disableDrag !== undefined ? originData.disableDrag : false,
data: originData.data !== undefined ? originData.data : {}, data: originData.data !== undefined ? originData.data : {},
childNum:originData.childNum !==undefined?originData.childNum:0, childNum:originData.childNum !==undefined?originData.childNum:0,
nodeParent:originData.nodeParent!==undefined?originData.nodeParent:false nodeParent:originData.nodeParent!==undefined?originData.nodeParent:false,
rightNode:originData.rightNode!==undefined?originData.rightNode:false,
rootId:originData.rootId!==undefined?originData.rootId:'',
rightRootId:originData.rightRootId!==undefined?originData.rightRootId:'',
sourceData:originData.sourceData!==undefined?originData.sourceData:{}
} }
if(jsonData.lot === undefined) jsonData.lot = { childs: [], parent: undefined, eached: false, strength: 0 } if(jsonData.lot === undefined) jsonData.lot = { childs: [], parent: undefined, eached: false, strength: 0 }
if(jsonData.lot.childs === undefined) jsonData.lot.childs = [] if(jsonData.lot.childs === undefined) jsonData.lot.childs = []
......
...@@ -9,9 +9,13 @@ ...@@ -9,9 +9,13 @@
:options="graphOptions" :options="graphOptions"
:on-node-expand="onNodeExpand" :on-node-expand="onNodeExpand"
:on-node-collapse="onNodeCollapse" :on-node-collapse="onNodeCollapse"
:on-node-click="onNodeClick"
> >
</SeeksRelationGraph> </SeeksRelationGraph>
</div> </div>
<q-dialog v-model="showOkrInfo" maximized full-height seamless position="right">
<okr-detail-info :obj="chosenObj" :proid="proid"></okr-detail-info>
</q-dialog>
</div> </div>
</template> </template>
...@@ -21,8 +25,9 @@ import { ...@@ -21,8 +25,9 @@ import {
queryUserOKRNextAlignView queryUserOKRNextAlignView
} from "../../api/okr/work"; } from "../../api/okr/work";
import SeeksRelationGraph from "../../components/relation/index"; import SeeksRelationGraph from "../../components/relation/index";
import okrDetailInfo from '../../components/okr/okr-details-info'
export default { export default {
components: { SeeksRelationGraph }, components: { SeeksRelationGraph,okrDetailInfo },
data() { data() {
return { return {
g_loading: true, g_loading: true,
...@@ -46,11 +51,11 @@ export default { ...@@ -46,11 +51,11 @@ export default {
} }
], ],
defaultLineMarker: { defaultLineMarker: {
'markerWidth': 12, markerWidth: 12,
'markerHeight': 12, markerHeight: 12,
'refX': 6, refX: 6,
'refY': 6, refY: 6,
'data': 'M2,2 L10,6 L2,10 L6,6 L2,2' data: "M2,2 L10,6 L2,10 L6,6 L2,2"
}, },
defaultExpandHolderPosition: "right", defaultExpandHolderPosition: "right",
defaultNodeShape: 1, defaultNodeShape: 1,
...@@ -60,15 +65,17 @@ export default { ...@@ -60,15 +65,17 @@ export default {
defaultNodeBorderWidth: 0, defaultNodeBorderWidth: 0,
defaultLineColor: "#cecece", defaultLineColor: "#cecece",
defaultNodeColor: "rgba(255,255,255,1)", defaultNodeColor: "rgba(255,255,255,1)",
defaultNodeFontColor: "rgba(0,0,0,1)" defaultNodeFontColor: "rgba(0,0,0,1)",
}, },
proid: 51, proid: 53,
rootObjList: [], rootObjList: [],
graph_json_data: { graph_json_data: {
rootId: "0", rootId: "0",
nodes: [], nodes: [],
links: [] links: []
} },
showOkrInfo:false,
chosenObj:null
}; };
}, },
created() {}, created() {},
...@@ -84,6 +91,10 @@ export default { ...@@ -84,6 +91,10 @@ export default {
this.genernalNodes(); this.genernalNodes();
}); });
}, },
onNodeClick(nodeObject, $event) {
this.chosenObj=nodeObject.sourceData
this.showOkrInfo=true
},
genernalNodes() { genernalNodes() {
let node = { let node = {
id: "0", id: "0",
...@@ -91,22 +102,32 @@ export default { ...@@ -91,22 +102,32 @@ export default {
text: "111" text: "111"
}; };
this.graph_json_data.nodes.push(node); this.graph_json_data.nodes.push(node);
this.rootObjList.forEach((x,i) => { this.rootObjList.forEach((x, i) => {
let q=`main-${this.randomString()}` let q = `main-${this.randomString()}`;
this.graph_json_data.nodes.push(this.formatNode(x, q)); // if(x.ChildList&&x.ChildList.length>0){
// let tempChild=JSON.parse(JSON.stringify(x.ChildList[0]))
// x.ChildList.push(tempChild)
// x.ChildList.push(tempChild)
// x.ChildList.push(tempChild)
// x.ChildList.push(tempChild)
// }
this.graph_json_data.nodes.push(this.formatNode(x, q, false));
this.graph_json_data.links.push( this.graph_json_data.links.push(
this.formatLink("0", `${q}_${x.Id}`, true) this.formatLink("0", `${q}_${x.Id}`, true)
); );
x.ChildList.forEach(y => { x.ChildList.forEach(y => {
let qy=`child-${this.randomString()}` let qy = `child-${this.randomString()}`;
this.graph_json_data.nodes.push(this.formatNode(y, qy)); let newNode=this.formatNode(y, qy, false)
// newNode.rightRootId=`${q}_${x.Id}`
this.graph_json_data.nodes.push(newNode);
this.graph_json_data.links.push( this.graph_json_data.links.push(
this.formatLink(`${q}_${x.Id}`, `${qy}_${y.Id}`, false) this.formatLink(`${q}_${x.Id}`, `${qy}_${y.Id}`, false)
); );
}); });
x.ParentList.forEach(z => { x.ParentList.forEach(z => {
let zy=`parent-${this.randomString()}` let zy = `parent-${this.randomString()}`;
this.graph_json_data.nodes.push(this.formatNode(z, zy,true)); this.graph_json_data.nodes.push(this.formatNode(z, zy, true));
this.graph_json_data.links.push( this.graph_json_data.links.push(
this.formatLink(`${zy}_${z.Id}`, `${q}_${x.Id}`, false) this.formatLink(`${zy}_${z.Id}`, `${q}_${x.Id}`, false)
); );
...@@ -120,14 +141,18 @@ export default { ...@@ -120,14 +141,18 @@ export default {
this.graph_json_data.rootId this.graph_json_data.rootId
).lot.childs; ).lot.childs;
level_1_nodes.forEach(thisLevel1Node => { level_1_nodes.forEach(thisLevel1Node => {
if(!thisLevel1Node.nodeParent){
thisLevel1Node.parentExpanded=false
}
this.applyCollapseStyle2Node(thisLevel1Node); this.applyCollapseStyle2Node(thisLevel1Node);
}); });
this.$refs.seeksRelationGraph.refresh(); this.$refs.seeksRelationGraph.refresh();
} }
); );
}, },
randomString() { randomString() {
let length=6 let length = 6;
var str = var str =
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var result = ""; var result = "";
...@@ -142,7 +167,7 @@ export default { ...@@ -142,7 +167,7 @@ export default {
} }
let node = { let node = {
id, id,
disableDrag: false, disableDrag: true,
html: this.formatHtml( html: this.formatHtml(
obj.EmName, obj.EmName,
obj.ProgressState, obj.ProgressState,
...@@ -156,13 +181,13 @@ export default { ...@@ -156,13 +181,13 @@ export default {
? obj.ChildNum ? obj.ChildNum
: 0 : 0
}; };
if (prev.indexOf('child') != -1) { if (prev.indexOf("child") != -1) {
node.childNum = obj.ChildList node.childNum = obj.ChildList
? obj.ChildList.length ? obj.ChildList.length
: obj.ChildNum : obj.ChildNum
? obj.ChildNum ? obj.ChildNum
: 0; : 0;
} else if (prev.indexOf('parent') != -1) { } else if (prev.indexOf("parent") != -1) {
node.childNum = obj.ParentList node.childNum = obj.ParentList
? obj.ParentList.length ? obj.ParentList.length
: obj.ParentNum : obj.ParentNum
...@@ -183,10 +208,14 @@ export default { ...@@ -183,10 +208,14 @@ export default {
}; };
node.expandHolderPosition = "left"; node.expandHolderPosition = "left";
node.expanded = false; node.expanded = false;
if (isParent) {
node.nodeParent=true console.log("接收到父级:", obj, node);
} }
if (isParent) {
node.nodeParent = true;
node.rootId=node.id
} }
node.sourceData=obj
return node; return node;
}, },
formatLink(from, to, isHide) { formatLink(from, to, isHide) {
...@@ -198,10 +227,16 @@ export default { ...@@ -198,10 +227,16 @@ export default {
}; };
}, },
formatHtml(name, status, progress, statusName, title) { formatHtml(name, status, progress, statusName, title) {
let html = `<div class="parent-card"><div class="o-card flex row"><div class="col-auto q-mr-xs"><div style="width:20px;height:20px;font-size:14px;" class="bg-green-2 text-green vertical-middle rounded-borders text-center">${name.substring( let color='primary'
if(status==2){
color="warning"
}else if(status==3){
color="negative"
}
let html = `<div class="parent-card"><div class="o-card flex row" style="border-left:3px solid var(--q-color-${color})"><div class="col-auto q-mr-xs"><div style="width:20px;height:20px;font-size:14px;" class="bg-green-2 text-green vertical-middle rounded-borders text-center">${name.substring(
0, 0,
1 1
)}</div></div><div class="col q-ml-xs"><div class="flex row q-mb-xs"><div class="text-grey col f12">${name}</div><div class="text-negative text-weight-bold f12">${statusName} ${progress}%</div></div><div class="q-mt-xs ellipsis-2-lines" title="${title}">${title}</div></div></div></div>`; )}</div></div><div class="col q-ml-xs"><div class="flex row q-mb-xs"><div class="text-grey col f12">${name}</div><div class="text-${color} text-weight-bold f12">${statusName} ${progress}%</div></div><div class="q-mt-xs ellipsis-2-lines" title="${title}">${title}</div></div></div></div>`;
return html; return html;
}, },
onSizeOptionChanged() { onSizeOptionChanged() {
...@@ -217,8 +252,9 @@ export default { ...@@ -217,8 +252,9 @@ export default {
// _node的子节点将被隐藏,同时让_node右侧显示一个加号,点击后可以展开子节点 // _node的子节点将被隐藏,同时让_node右侧显示一个加号,点击后可以展开子节点
if (_node.lot.childs.length > 0) { if (_node.lot.childs.length > 0) {
_node.lot.childs.forEach(thisChildNode => { _node.lot.childs.forEach(thisChildNode => {
thisChildNode.isShow = false;
this.applyCollapseStyle2Node(thisChildNode); thisChildNode.isShow = false;
this.applyCollapseStyle2Node(thisChildNode);
}); });
_node.expanded = false; _node.expanded = false;
_node.expandHolderPosition = "right"; _node.expandHolderPosition = "right";
...@@ -251,9 +287,9 @@ export default { ...@@ -251,9 +287,9 @@ export default {
}); });
}, },
loadChildNodesFromRemoteServer(node, callback) { loadChildNodesFromRemoteServer(node, callback) {
let Type=2 let Type = 2;
if(node.id.indexOf('parent')!=-1){ if (node.id.indexOf("parent") != -1) {
Type=1 Type = 1;
} }
queryUserOKRNextAlignView({ queryUserOKRNextAlignView({
PeriodId: this.proid, PeriodId: this.proid,
...@@ -265,16 +301,29 @@ export default { ...@@ -265,16 +301,29 @@ export default {
nodes: [], nodes: [],
links: [] links: []
}; };
let zy=`child-${this.randomString()}` let zy = `child-${this.randomString()}`;
if(node.id.indexOf('parent')!=-1){ // if (node.id.indexOf("parent") != -1) {
zy=`parent-${this.randomString()}` // zy = `parent-${this.randomString()}`;
} // }
r.Data.forEach(x => { r.Data.forEach(x => {
_new_json_data.nodes.push(this.formatNode(x, zy)); //_new_json_data.nodes.push(this.formatNode(x, zy));
if(zy.indexOf('child')!=-1){ let newNode=this.formatNode(x, zy)
_new_json_data.links.push(this.formatLink(node.id, `${zy}_${x.Id}`, false)); if(node.nodeParent||node.rightNode){
}else{ newNode.rightNode=newNode
_new_json_data.links.push(this.formatLink(`${zy}_${x.Id}`,node.id, false)); newNode.rootId=node.rootId
}else if(node.rightRootId){
newNode.rightRootId=node.rightRootId
}
_new_json_data.nodes.push(newNode);
if (zy.indexOf("child") != -1) {
_new_json_data.links.push(
this.formatLink(node.id, `${zy}_${x.Id}`, false)
);
} else {
_new_json_data.links.push(
this.formatLink(`${zy}_${x.Id}`, node.id, false)
);
} }
}); });
callback(_new_json_data); callback(_new_json_data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment