|
@@ -84,6 +84,15 @@ export class Scope {
|
|
this.onLoad()
|
|
this.onLoad()
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ showMainWindow() {
|
|
|
|
+ const handle = (window as any).mainWindow?._handle
|
|
|
|
+ if (handle) {
|
|
|
|
+ handle.setStyle({'z-index': 1})
|
|
|
|
+ Ext.Viewport.getLayout().setAnimation({type: 'slide', direction: 'right', duration: 300})
|
|
|
|
+ Ext.Viewport.setActiveItem(handle)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 渲染模块到全屏
|
|
* 渲染模块到全屏
|
|
* allowBack 是否允许后退(退出)
|
|
* allowBack 是否允许后退(退出)
|
|
@@ -95,85 +104,108 @@ export class Scope {
|
|
vjsonOption: {},
|
|
vjsonOption: {},
|
|
dataOption: {}
|
|
dataOption: {}
|
|
}) {
|
|
}) {
|
|
- _.defaults(option, {
|
|
|
|
- allowBack: true,
|
|
|
|
- vjsonOption: {},
|
|
|
|
- dataOption: {}
|
|
|
|
- })
|
|
|
|
- const {
|
|
|
|
- allowBack,
|
|
|
|
- vjsonOption,
|
|
|
|
- dataOption
|
|
|
|
- } = option
|
|
|
|
-
|
|
|
|
const that = this
|
|
const that = this
|
|
- this._vjsonOption = vjsonOption;
|
|
|
|
- this._dataOption = dataOption;
|
|
|
|
- const vmodel = _.defaultsDeep({
|
|
|
|
- data: {}
|
|
|
|
- }, that.model, dataOption)
|
|
|
|
-
|
|
|
|
- //this.viewModel = new Ext.app.ViewModel(vmodel);
|
|
|
|
- //this.viewModel.yvanScope = this
|
|
|
|
-
|
|
|
|
- let config = _.defaultsDeep({
|
|
|
|
- // viewModel: this.viewModel,
|
|
|
|
- viewModel: vmodel,
|
|
|
|
- yvanScope: this,
|
|
|
|
- referenceHolder: true,
|
|
|
|
- },
|
|
|
|
- vjsonOption,
|
|
|
|
- that.vjson,
|
|
|
|
- {
|
|
|
|
- xtype: 'panel',
|
|
|
|
- // showAnimation: 'slide',
|
|
|
|
- // hideAnimation: 'slideOut',
|
|
|
|
|
|
+ let has = false;
|
|
|
|
+ (Ext.Viewport.getItems().items as []).forEach((item, idx) => {
|
|
|
|
+ if (!has && item === that._handle) {
|
|
|
|
+ has = true
|
|
}
|
|
}
|
|
- )
|
|
|
|
-
|
|
|
|
- if (allowBack) {
|
|
|
|
- config = _.defaultsDeep({
|
|
|
|
- iconCls: 'x-fa fa-angle-left',
|
|
|
|
- cls: 'navbar',
|
|
|
|
- tools: [
|
|
|
|
- {iconCls: 'x-fa fa-home'},
|
|
|
|
- ],
|
|
|
|
- }, config)
|
|
|
|
- }
|
|
|
|
- that._handle = Ext.create(config)
|
|
|
|
-
|
|
|
|
- this.viewModel = that._handle.getViewModel()
|
|
|
|
- this.viewModel.yvanScope = this
|
|
|
|
- that._handle.on({
|
|
|
|
- renderedchange(sender, item, rendered, opts) {
|
|
|
|
- // 记录句柄
|
|
|
|
- if (rendered) {
|
|
|
|
- that._handle = this
|
|
|
|
- window['cp'] = that
|
|
|
|
-
|
|
|
|
- // 调用onLoad回调
|
|
|
|
- try {
|
|
|
|
- that._onLoad()
|
|
|
|
- } catch (e) {
|
|
|
|
- console.error('errorAt onLoad', e)
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- const $back = $(sender.el.dom)
|
|
|
|
- .find('.navbar>.x-panelheader')
|
|
|
|
- .find('.x-body-el>.fa-angle-left')
|
|
|
|
- $back.on('click', () => {
|
|
|
|
- Ext.Viewport.getLayout().setAnimation({type: 'slide', direction: 'right', duration: 300})
|
|
|
|
- that._handle.close()
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- destroy() {
|
|
|
|
- // 卸载
|
|
|
|
- window['cp'] = Ext.Viewport.items.getAt(Ext.Viewport.items.items.length - 2).getViewModel().yvanScope
|
|
|
|
- that._onDestroy()
|
|
|
|
- },
|
|
|
|
})
|
|
})
|
|
- Ext.Viewport.add(that._handle)
|
|
|
|
|
|
+ if(!has) {
|
|
|
|
+ _.defaults(option, {
|
|
|
|
+ allowBack: true,
|
|
|
|
+ vjsonOption: {},
|
|
|
|
+ dataOption: {}
|
|
|
|
+ })
|
|
|
|
+ const {
|
|
|
|
+ allowBack,
|
|
|
|
+ vjsonOption,
|
|
|
|
+ dataOption
|
|
|
|
+ } = option
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ this._vjsonOption = vjsonOption;
|
|
|
|
+ this._dataOption = dataOption;
|
|
|
|
+ const vmodel = _.defaultsDeep({
|
|
|
|
+ data: {}
|
|
|
|
+ }, that.model, dataOption)
|
|
|
|
+
|
|
|
|
+ //this.viewModel = new Ext.app.ViewModel(vmodel);
|
|
|
|
+ //this.viewModel.yvanScope = this
|
|
|
|
+
|
|
|
|
+ let config = _.defaultsDeep({
|
|
|
|
+ // viewModel: this.viewModel,
|
|
|
|
+ viewModel: vmodel,
|
|
|
|
+ yvanScope: this,
|
|
|
|
+ referenceHolder: true,
|
|
|
|
+ },
|
|
|
|
+ vjsonOption,
|
|
|
|
+ that.vjson,
|
|
|
|
+ {
|
|
|
|
+ xtype: 'panel',
|
|
|
|
+ // showAnimation: 'slide',
|
|
|
|
+ // hideAnimation: 'slideOut',
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ if (allowBack) {
|
|
|
|
+ config = _.defaultsDeep({
|
|
|
|
+ iconCls: 'x-fa fa-angle-left',
|
|
|
|
+ cls: 'navbar',
|
|
|
|
+ tools: [
|
|
|
|
+ {
|
|
|
|
+ iconCls: 'x-fa fa-home',
|
|
|
|
+ handler: function () {
|
|
|
|
+ that.showMainWindow()
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ }, config)
|
|
|
|
+ }
|
|
|
|
+ that._handle = Ext.create(config)
|
|
|
|
+
|
|
|
|
+ this.viewModel = that._handle.getViewModel()
|
|
|
|
+ this.viewModel.yvanScope = this
|
|
|
|
+ that._handle.on({
|
|
|
|
+ renderedchange(sender, item, rendered, opts) {
|
|
|
|
+ // 记录句柄
|
|
|
|
+ if (rendered) {
|
|
|
|
+ that._handle = this
|
|
|
|
+ window['cp'] = that
|
|
|
|
+
|
|
|
|
+ // 调用onLoad回调
|
|
|
|
+ try {
|
|
|
|
+ that._onLoad()
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.error('errorAt onLoad', e)
|
|
|
|
+ }
|
|
|
|
+ const $back = $(sender.el.dom)
|
|
|
|
+ .find('.navbar>.x-panelheader')
|
|
|
|
+ .find('.x-body-el>.fa-angle-left')
|
|
|
|
+ $back.on('click', () => {
|
|
|
|
+ that._handle.setStyle({'z-index': 0})
|
|
|
|
+ Ext.Viewport.getLayout().setAnimation({type: 'slide', direction: 'right', duration: 300})
|
|
|
|
+ Ext.Viewport.remove(that._handle)
|
|
|
|
+ that._handle.close()
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ destroy() {
|
|
|
|
+ // 卸载
|
|
|
|
+ window['cp'] = Ext.Viewport.items?.getAt(Ext.Viewport.items.items.length - 2)?.getViewModel()?.yvanScope
|
|
|
|
+ that._onDestroy()
|
|
|
|
+ },
|
|
|
|
+ })
|
|
|
|
+ Ext.Viewport.add(that._handle)
|
|
|
|
+ } else {
|
|
|
|
+ window['cp'] = that
|
|
|
|
+ // 调用onLoad回调
|
|
|
|
+ try {
|
|
|
|
+ that._onLoad()
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.error('errorAt onLoad', e)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
that._handle.setStyle({'z-index': 1})
|
|
that._handle.setStyle({'z-index': 1})
|
|
let actived = false;
|
|
let actived = false;
|
|
(Ext.Viewport.getItems().items as []).forEach((item, idx) => {
|
|
(Ext.Viewport.getItems().items as []).forEach((item, idx) => {
|