Commit 7bcde15b authored by renjintao's avatar renjintao

plan

parent 6df819dd
<template> <template>
<transition name="contextmenu-submenu-fade" v-if="show"> <transition name="contextmenu-submenu-fade">
<div ref="menu" :class="[commonClass.menu, 'menu', customClass]" :style="{left: style.left + 'px', top: style.top + 'px', minWidth: style.minWidth + 'px', zIndex: style.zIndex}" v-if="visible" @contextmenu="(e)=>e.preventDefault()"> <div ref="menu" :class="[commonClass.menu, 'menu', customClass]" :style="{left: style.left + 'px', top: style.top + 'px', minWidth: style.minWidth + 'px', zIndex: style.zIndex}" v-if="visible" @contextmenu="(e)=>e.preventDefault()">
<div class="menu_body"> <div class="menu_body">
<template v-for="(item,index) of items"> <template v-for="(item,index) of items">
...@@ -54,6 +54,9 @@ import { ...@@ -54,6 +54,9 @@ import {
SUBMENU_OPEN_TREND_RIGHT, SUBMENU_OPEN_TREND_RIGHT,
COMPONENT_NAME COMPONENT_NAME
} from "../constant"; } from "../constant";
import {
getElementsByClassName
} from "../util";
export default { export default {
name: "Submenu", name: "Submenu",
data() { data() {
...@@ -78,13 +81,15 @@ export default { ...@@ -78,13 +81,15 @@ export default {
style: { style: {
left: 0, left: 0,
top: 0, top: 0,
zIndex: 2, zIndex: 3,
minWidth: 150 minWidth: 150
}, },
customClass: null, customClass: null,
visible: false, visible: false,
hasIcon: false, hasIcon: false,
openTrend: SUBMENU_OPEN_TREND_RIGHT openTrend: SUBMENU_OPEN_TREND_RIGHT,
mouseListening: false,
mainMenuInstance: null,
}; };
}, },
props: { props: {
...@@ -104,8 +109,12 @@ export default { ...@@ -104,8 +109,12 @@ export default {
mounted() { mounted() {
if (this.data != []) { if (this.data != []) {
this.load(this.data) this.load(this.data)
this.addListener();
} }
}, },
destroyed() {
this.removeListener();
},
methods: { methods: {
load(v) { load(v) {
this.visible = true; this.visible = true;
...@@ -194,13 +203,14 @@ export default { ...@@ -194,13 +203,14 @@ export default {
}; };
this.activeSubmenu.instance.style.minWidth = this.activeSubmenu.instance.style.minWidth =
typeof item.minWidth === "number" ? item.minWidth : this.style.minWidth; typeof item.minWidth === "number" ? item.minWidth : this.style.minWidth;
this.activeSubmenu.instance.style.zIndex = this.style.zIndex; this.activeSubmenu.instance.style.zIndex = '9999';
this.activeSubmenu.instance.customClass = this.activeSubmenu.instance.customClass =
typeof item.customClass === "string" ? typeof item.customClass === "string" ?
item.customClass : item.customClass :
this.customClass; this.customClass;
this.activeSubmenu.instance.$mount(); this.activeSubmenu.instance.$mount();
document.body.appendChild(this.activeSubmenu.instance.$el); document.body.appendChild(this.activeSubmenu.instance.$el);
}, },
itemClick(item) { itemClick(item) {
if (!this.visible) { if (!this.visible) {
...@@ -220,9 +230,34 @@ export default { ...@@ -220,9 +230,34 @@ export default {
if (this.activeSubmenu.instance) { if (this.activeSubmenu.instance) {
this.activeSubmenu.instance.close(); this.activeSubmenu.instance.close();
} }
this.$nextTick(() => { this.$nextTick(() => {});
this.$destroy(); },
}); showBm() {
this.visible = true;
},
leaveBm() {
this.visible = false;
},
mouseClickListener(e) { //左键点击
this.close();
},
addListener() {
if (!this.mouseListening) {
document.addEventListener("click", this.mouseClickListener);
//document.addEventListener("mousedown", this.mouseDownListener);
//document.addEventListener("mousewheel", this.mousewheelListener);
this.mouseListening = true;
}
},
removeListener() {
if (this.mouseListening) {
document.removeEventListener("click", this.mouseClickListener);
//document.removeEventListener("mousedown", this.mouseDownListener);
//document.removeEventListener("mousewheel", this.mousewheelListener);
this.mouseListening = false;
}
} }
}, },
watch: { watch: {
...@@ -232,6 +267,9 @@ export default { ...@@ -232,6 +267,9 @@ export default {
this.load(this.data) this.load(this.data)
} }
}, },
show(v) {
this.visible = v
}
}, },
}; };
</script> </script>
......
...@@ -1824,6 +1824,7 @@ export default { ...@@ -1824,6 +1824,7 @@ export default {
type: '类型', type: '类型',
attachment: '附件', attachment: '附件',
executor: '执行人', executor: '执行人',
upTitle:'上级名称'
}, },
project_main: { project_main: {
creationTime: '创建时间', creationTime: '创建时间',
......
...@@ -133,6 +133,10 @@ henq.toTree = (list, rootId, format, parentFiledName) => { ...@@ -133,6 +133,10 @@ henq.toTree = (list, rootId, format, parentFiledName) => {
function toTree(data, parentId, level) { function toTree(data, parentId, level) {
let parents = data.filter(u => { let parents = data.filter(u => {
if(u[upId]=='')
{
u[upId]=null
}
return u[upId] == parentId return u[upId] == parentId
}) })
......
...@@ -4938,7 +4938,7 @@ ...@@ -4938,7 +4938,7 @@
"dependencies": { "dependencies": {
"commander": { "commander": {
"version": "2.14.1", "version": "2.14.1",
"resolved": "http://r.cnpmjs.org/commander/download/commander-2.14.1.tgz", "resolved": "https://registry.npm.taobao.org/commander/download/commander-2.14.1.tgz?cache=0&sync_timestamp=1595168224685&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcommander%2Fdownload%2Fcommander-2.14.1.tgz",
"integrity": "sha1-IjUSPjevjKPGXfRbAm29NXsBuao=" "integrity": "sha1-IjUSPjevjKPGXfRbAm29NXsBuao="
} }
} }
...@@ -5472,7 +5472,7 @@ ...@@ -5472,7 +5472,7 @@
}, },
"crc-32": { "crc-32": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "http://r.cnpmjs.org/crc-32/download/crc-32-1.2.0.tgz", "resolved": "https://registry.npm.taobao.org/crc-32/download/crc-32-1.2.0.tgz",
"integrity": "sha1-yy224puIUI4y2d0OwWk+e0Ghggg=", "integrity": "sha1-yy224puIUI4y2d0OwWk+e0Ghggg=",
"requires": { "requires": {
"exit-on-epipe": "~1.0.1", "exit-on-epipe": "~1.0.1",
...@@ -7369,7 +7369,7 @@ ...@@ -7369,7 +7369,7 @@
}, },
"exit-on-epipe": { "exit-on-epipe": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "http://r.cnpmjs.org/exit-on-epipe/download/exit-on-epipe-1.0.1.tgz", "resolved": "https://registry.npm.taobao.org/exit-on-epipe/download/exit-on-epipe-1.0.1.tgz",
"integrity": "sha1-C92S6H1ShdJn2qgXHQ6wYVlolpI=" "integrity": "sha1-C92S6H1ShdJn2qgXHQ6wYVlolpI="
}, },
"expand-brackets": { "expand-brackets": {
...@@ -8020,7 +8020,7 @@ ...@@ -8020,7 +8020,7 @@
}, },
"frac": { "frac": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "http://r.cnpmjs.org/frac/download/frac-1.1.2.tgz", "resolved": "https://registry.npm.taobao.org/frac/download/frac-1.1.2.tgz",
"integrity": "sha1-PXT39keMiKG1AgMG10fcYxPHTQs=" "integrity": "sha1-PXT39keMiKG1AgMG10fcYxPHTQs="
}, },
"fragment-cache": { "fragment-cache": {
...@@ -15092,7 +15092,7 @@ ...@@ -15092,7 +15092,7 @@
}, },
"printj": { "printj": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "http://r.cnpmjs.org/printj/download/printj-1.1.2.tgz", "resolved": "https://registry.npm.taobao.org/printj/download/printj-1.1.2.tgz",
"integrity": "sha1-2Q3rKXWoufYA+zoclOP0xTx4oiI=" "integrity": "sha1-2Q3rKXWoufYA+zoclOP0xTx4oiI="
}, },
"private": { "private": {
...@@ -20545,7 +20545,7 @@ ...@@ -20545,7 +20545,7 @@
}, },
"script-loader": { "script-loader": {
"version": "0.7.2", "version": "0.7.2",
"resolved": "http://r.cnpmjs.org/script-loader/download/script-loader-0.7.2.tgz", "resolved": "https://registry.npm.taobao.org/script-loader/download/script-loader-0.7.2.tgz",
"integrity": "sha1-IBbbb4byX1z1baOJFdgzeLsWa6c=", "integrity": "sha1-IBbbb4byX1z1baOJFdgzeLsWa6c=",
"dev": true, "dev": true,
"requires": { "requires": {
...@@ -21133,7 +21133,7 @@ ...@@ -21133,7 +21133,7 @@
}, },
"ssf": { "ssf": {
"version": "0.10.3", "version": "0.10.3",
"resolved": "http://r.cnpmjs.org/ssf/download/ssf-0.10.3.tgz", "resolved": "https://registry.npm.taobao.org/ssf/download/ssf-0.10.3.tgz",
"integrity": "sha1-jq4fwpyQpVLnkhII+BiS1vd6yys=", "integrity": "sha1-jq4fwpyQpVLnkhII+BiS1vd6yys=",
"requires": { "requires": {
"frac": "~1.1.2" "frac": "~1.1.2"
...@@ -23788,7 +23788,7 @@ ...@@ -23788,7 +23788,7 @@
}, },
"wmf": { "wmf": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "http://r.cnpmjs.org/wmf/download/wmf-1.0.2.tgz", "resolved": "https://registry.npm.taobao.org/wmf/download/wmf-1.0.2.tgz",
"integrity": "sha1-fRnWIQcaCMK9xrfmiKnENSmMwto=" "integrity": "sha1-fRnWIQcaCMK9xrfmiKnENSmMwto="
}, },
"word-wrap": { "word-wrap": {
...@@ -23943,7 +23943,7 @@ ...@@ -23943,7 +23943,7 @@
}, },
"xlsx": { "xlsx": {
"version": "0.15.6", "version": "0.15.6",
"resolved": "http://r.cnpmjs.org/xlsx/download/xlsx-0.15.6.tgz", "resolved": "https://registry.npm.taobao.org/xlsx/download/xlsx-0.15.6.tgz?cache=0&sync_timestamp=1597272342311&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fxlsx%2Fdownload%2Fxlsx-0.15.6.tgz",
"integrity": "sha1-Rh+EHW2eoag3XizSRr8jrs4IodU=", "integrity": "sha1-Rh+EHW2eoag3XizSRr8jrs4IodU=",
"requires": { "requires": {
"adler-32": "~1.2.0", "adler-32": "~1.2.0",
...@@ -23958,7 +23958,7 @@ ...@@ -23958,7 +23958,7 @@
"dependencies": { "dependencies": {
"commander": { "commander": {
"version": "2.17.1", "version": "2.17.1",
"resolved": "http://r.cnpmjs.org/commander/download/commander-2.17.1.tgz", "resolved": "https://registry.npm.taobao.org/commander/download/commander-2.17.1.tgz?cache=0&sync_timestamp=1595168224685&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcommander%2Fdownload%2Fcommander-2.17.1.tgz",
"integrity": "sha1-vXerfebelCBc6sxy8XFtKfIKd78=" "integrity": "sha1-vXerfebelCBc6sxy8XFtKfIKd78="
} }
} }
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
</template> --> </template> -->
<template slot="buttons"> <template slot="buttons">
<Button type="primary" @click="add(null)">新增</Button> <Button type="primary" @click="add(null)">新增</Button>
<Dropdown @on-click="show"> <Button @mouseenter.native="showBm" ref="showBtn" shape="circle" icon="md-settings"></Button>
<Dropdown @on-click="show" v-if="false">
<Button shape="circle" icon="md-settings"></Button> <Button shape="circle" icon="md-settings"></Button>
<DropdownMenu slot="list"> <DropdownMenu slot="list">
<DropdownItem name="saveTemplate">存为模版</DropdownItem> <DropdownItem name="saveTemplate">存为模版</DropdownItem>
...@@ -31,6 +32,7 @@ ...@@ -31,6 +32,7 @@
</template> </template>
</EditGrid> </EditGrid>
</Card> </Card>
<Submenus :show="showStatu" :data="tempItems" :params="params"></Submenus>
<Modal v-model="modal" :title="title" width="1200" footer-hide> <Modal v-model="modal" :title="title" width="1200" footer-hide>
<component :is="detail" :eid="curId" :v="row" @on-close="cancel" @on-ok="ok" /> <component :is="detail" :eid="curId" :v="row" @on-close="cancel" @on-ok="ok" />
</Modal> </Modal>
...@@ -93,6 +95,12 @@ export default { ...@@ -93,6 +95,12 @@ export default {
type: "selection", type: "selection",
align: 'center' align: 'center'
}, },
{
key: "upTitle",
title: this.l("upTitle"),
hide: true,
export: true,
},
{ {
key: "title", key: "title",
title: this.l("title"), title: this.l("title"),
...@@ -238,6 +246,10 @@ export default { ...@@ -238,6 +246,10 @@ export default {
}, },
}, },
], ],
//setButon
showStatu: false, //控件是否显示
tempItems: [], //控件数据
params: {}, //控件坐标位置
//导出导入 //导出导入
exportTl: '项目目录', exportTl: '项目目录',
ModalIm: false, ModalIm: false,
...@@ -391,6 +403,66 @@ export default { ...@@ -391,6 +403,66 @@ export default {
m[name] && m[name](name); m[name] && m[name](name);
}, },
saveTemplate() {
var that = this;
that.curId = that.eid;
that.row = that.data;
that.title = "保存模版";
that.detail = () => import("./saveTemplate");
that.modal = true;
},
useTemplate() {
var that = this;
that.curId = that.eid;
that.row = that.data;
that.title = "导入模版";
that.detail = () => import("./importTemplate");
that.modal = true;
},
down() {
this.exportTl = '项目目录-' + this.data.title;
this.$refs.grid.export2Excel()
},
importExcel() {
this.openModalIm()
},
showBm(event) {
let obj = event.target
let objSet = obj.getBoundingClientRect()
this.showStatu = true;
this.params = {
x: objSet.x,
y: objSet.bottom
};
console.log(event)
this.tempItems = [{
label: "存为模版",
onClick: () => {
this.saveTemplate()
},
}, {
label: "导入模版",
divided: true,
onClick: () => {
this.useTemplate()
},
},
{
label: "导出Excel",
icon: "md-cloud-download",
onClick: () => {
this.down()
},
},
{
label: "导入Excel",
icon: "md-cloud-upload",
onClick: () => {
this.importExcel()
},
}
];
},
//批量导入start //批量导入start
//导入功能 //导入功能
openModalIm() { openModalIm() {
......
...@@ -9,6 +9,14 @@ ...@@ -9,6 +9,14 @@
<h2>Bmenu</h2> <h2>Bmenu</h2>
<div @contextmenu="onCon" class="tc" style="width:120px;height:40px;line-height:40px;background:#f5f5f5;border:#ccc solid 1px; border-radius: 5px;">{{message}}</div> <div @contextmenu="onCon" class="tc" style="width:120px;height:40px;line-height:40px;background:#f5f5f5;border:#ccc solid 1px; border-radius: 5px;">{{message}}</div>
</div> </div>
<div class="mt50 pl10">
<h2>mouseenter</h2>
<p>
<Button @mouseenter.native="showBm" ref="showBtn" shape="circle" icon="ios-settings"></Button>
<div @mouseover="showBm" v-if="false" ref="showB" class="tc" style="width:120px;height:40px;line-height:40px;background:#f5f5f5;border:#ccc solid 1px; border-radius: 5px;">mouseenter打开菜单</div>
</p>
</div>
</div> </div>
</template> </template>
...@@ -43,13 +51,13 @@ export default { ...@@ -43,13 +51,13 @@ export default {
this.tempItems = [{ this.tempItems = [{
label: "返回(B)", label: "返回(B)",
onClick: () => { onClick: () => {
this.showStatu = false; alert("tttt")
}, },
}, { }, {
label: "前进(F)", label: "前进(F)",
disabled: true, disabled: true,
onClick: () => { onClick: () => {
this.showStatu = false; alert("11")
}, },
}, },
{ {
...@@ -57,13 +65,13 @@ export default { ...@@ -57,13 +65,13 @@ export default {
divided: true, divided: true,
icon: "el-icon-refresh", icon: "el-icon-refresh",
onClick: () => { onClick: () => {
this.showStatu = false; alert("222")
}, },
}, },
{ {
label: "另存为(A)...", label: "另存为(A)...",
onClick: () => { onClick: () => {
this.showStatu = false; alert("333")
}, },
}, },
{ {
...@@ -223,6 +231,79 @@ export default { ...@@ -223,6 +231,79 @@ export default {
}); });
event.preventDefault(); event.preventDefault();
}, },
showBm(event) {
let obj = event.target
let objSet = obj.getBoundingClientRect()
this.showStatu = true;
this.params = {
x: objSet.x,
y: objSet.bottom
};
console.log(event)
this.tempItems = [{
label: "返回(B)",
onClick: () => {
alert("11")
},
}, {
label: "前进(F)",
disabled: true,
onClick: () => {
alert("222")
},
},
{
label: "重新加载(R)",
divided: true,
icon: "el-icon-refresh",
onClick: () => {
alert("33")
},
},
{
label: "另存为(A)...",
onClick: () => {
alert("44")
},
},
{
label: "打印(P)...",
icon: "el-icon-printer",
onClick: () => {
alert("55")
},
},
{
label: "投射(C)...",
divided: true,
onClick: () => {
alert("66")
},
},
{
label: "使用网页翻译(T)",
divided: true,
minWidth: 0,
children: [{
label: "翻译成简体中文",
onClick: () => {
alert("77")
},
},
{
label: "翻译成繁体中文",
onClick: () => {
alert("88")
},
},
],
},
];
event.preventDefault();
},
leaveBm(event) {
this.showStatu = false;
}
}, },
}; };
</script> </script>
......
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