Browse Source

完成最小化及恢复

master
Poised_flw 4 years ago
parent
commit
c373d8e1e9
  1. 2
      src/tis_app_template_kt/src/components/Dialog/DialogPc.vue
  2. 4
      src/tis_app_template_kt/src/components/Dialog/dialogMixins.js
  3. 22
      src/tis_app_template_kt/src/tis/bus.js

2
src/tis_app_template_kt/src/components/Dialog/DialogPc.vue

@ -30,6 +30,7 @@
//import VueDragResize from "../vueDragResize/vue-drag-resize.vue"; //import VueDragResize from "../vueDragResize/vue-drag-resize.vue";
import VueDragResize from 'vue-drag-resize' import VueDragResize from 'vue-drag-resize'
import {dialogMixins} from './dialogMixins' import {dialogMixins} from './dialogMixins'
import bus from '../../tis/bus'
export default { export default {
name: "DialogPc", name: "DialogPc",
@ -101,6 +102,7 @@ import VueDragResize from 'vue-drag-resize'
}, },
minisize() { minisize() {
this.centerDialogVisible = false; this.centerDialogVisible = false;
this.$tis.minimizeComponent(this.actives)
}, },
onClose() { onClose() {
this.centerDialogVisible = false; this.centerDialogVisible = false;

4
src/tis_app_template_kt/src/components/Dialog/dialogMixins.js

@ -25,9 +25,13 @@ export const dialogMixins = {
actives() { actives() {
//保证打开的是激活组件 //保证打开的是激活组件
const d = this.$tis.getActivesByType("PopupWidget").pop(); const d = this.$tis.getActivesByType("PopupWidget").pop();
console.log('recalc d')
if(d && d.component){ if(d && d.component){
this.centerDialogVisible = true; this.centerDialogVisible = true;
} }
if (d.status === 'normal') {
this.centerDialogVisible = true
}
return d && d.component; return d && d.component;
}, },
}, },

22
src/tis_app_template_kt/src/tis/bus.js

@ -25,11 +25,11 @@ const bus = new Vue({
// 传递当前所处组件的上下文环境 // 传递当前所处组件的上下文环境
menuStatusUpdate(){ menuStatusUpdate(){
const onActives = this.getTemplateLayouts().filter(l => !l.lazy).map(c=>c.component.name || c.component);
const onActives = this.getTemplateLayouts().filter(l => !l.lazy).map(c => ({component: c.component.name || c.component, status: c.status}));
const appId = '' const appId = ''
console.log('============>', appId)
console.log('============>', appId, onActives)
// TODO 这里通过event-bus来实现吧,Vue实例获取不到 // TODO 这里通过event-bus来实现吧,Vue实例获取不到
this.$emit('TIS_TEMPLATE_MENU_ACTIVE', {appId, onActives: onActives,system:true})
window.esapp.tis.$emit('TIS_TEMPLATE_MENU_ACTIVE', {appId, onActives: onActives,system:true})
}, },
async loadComponent(component) { async loadComponent(component) {
@ -103,6 +103,7 @@ const bus = new Vue({
const hit = components.includes(component); const hit = components.includes(component);
if (hit) { if (hit) {
c.lazy = !hit; c.lazy = !hit;
c.status = c.status === 'minimize' ? 'normal' : c.status
return c; return c;
} }
}).forEach(c => { }).forEach(c => {
@ -129,10 +130,24 @@ const bus = new Vue({
}); });
//有 加入 无 删除? //有 加入 无 删除?
// 强制触发更新
this.actives = [...this.actives]
console.log('layouts变化状态', this.layouts); console.log('layouts变化状态', this.layouts);
console.log('actives变化状态', this.actives); console.log('actives变化状态', this.actives);
this.menuStatusUpdate(); this.menuStatusUpdate();
}, },
// 最小化激活的弹窗
minimizeComponent(component) {
this.actives.forEach(c => {
const comp = c.component.name || c.component
if (comp === component) {
c.status = 'minimize'
}
})
this.menuStatusUpdate()
},
// 关闭组件 // 关闭组件
closeComponent(components) { closeComponent(components) {
//修改layout中的状态 //修改layout中的状态
@ -166,7 +181,6 @@ const bus = new Vue({
//获取组件 //获取组件
getWidgetsByType(type) { getWidgetsByType(type) {
//以type 或 position 命中widget,背景板默认lazy=false //以type 或 position 命中widget,背景板默认lazy=false
console.log(type, this.layouts)
return this.layouts.filter(f => (f.type === type || f.position === type) && !f.lazy).map(f => { return this.layouts.filter(f => (f.type === type || f.position === type) && !f.lazy).map(f => {
//string类型,来自配置文件,需要下载资源才能使用,懒加载组件不加载但是需要加入到数组中、、 //string类型,来自配置文件,需要下载资源才能使用,懒加载组件不加载但是需要加入到数组中、、

Loading…
Cancel
Save