提交 4e36da80 编写于 作者: RedPig97's avatar RedPig97

update:内存优化

上级 18bf0753
...@@ -61,7 +61,7 @@ export default class Breadcrumb extends Vue { ...@@ -61,7 +61,7 @@ export default class Breadcrumb extends Vue {
* *
* @memberof Breadcrumb * @memberof Breadcrumb
*/ */
private navDataService = NavDataService.getInstance(this.$store); private navDataService = NavDataService.getInstance();
/** /**
* 默认视图标识 * 默认视图标识
......
...@@ -19,7 +19,7 @@ export default class AppCheckBox extends Vue { ...@@ -19,7 +19,7 @@ export default class AppCheckBox extends Vue {
* @type {CodeListService} * @type {CodeListService}
* @memberof AppCheckBox * @memberof AppCheckBox
*/ */
public codeListService:CodeListService = new CodeListService({ $store: this.$store }); public codeListService:CodeListService = new CodeListService();
/** /**
* 代码表标识 * 代码表标识
......
...@@ -80,7 +80,7 @@ export default class AppDataUploadView extends Vue { ...@@ -80,7 +80,7 @@ export default class AppDataUploadView extends Vue {
* @type {CodeListService} * @type {CodeListService}
* @memberof AppDataUploadView * @memberof AppDataUploadView
*/ */
public codeListService:CodeListService = new CodeListService({ $store: this.$store }); public codeListService:CodeListService = new CodeListService();
/** /**
* 实体服务对象 * 实体服务对象
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
class="editor" class="editor"
:style="slotstyle" :style="slotstyle"
> >
<form-item :prop="name" :error="error" :rules="rules"> <form-item :prop="name" :error="error" :rules="itemRules">
<slot></slot> <slot></slot>
</form-item> </form-item>
</div> </div>
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
class="editor" class="editor"
:style="slotstyle" :style="slotstyle"
> >
<form-item :prop="name" :error="error" :rules="rules"> <form-item :prop="name" :error="error" :rules="itemRules">
<slot></slot> <slot></slot>
</form-item> </form-item>
</div> </div>
...@@ -154,14 +154,6 @@ export default class AppFormItem extends Vue { ...@@ -154,14 +154,6 @@ export default class AppFormItem extends Vue {
*/ */
public isShowTip:boolean = false; public isShowTip:boolean = false;
/**
* 值规则数组
*
* @type {any[]}
* @memberof AppFormItem
*/
public rules: any[] = [];
/** /**
* 是否必填 * 是否必填
* *
...@@ -181,10 +173,7 @@ export default class AppFormItem extends Vue { ...@@ -181,10 +173,7 @@ export default class AppFormItem extends Vue {
onItemRulesChange(newVal: any, oldVal: any) { onItemRulesChange(newVal: any, oldVal: any) {
if (newVal) { if (newVal) {
try { try {
this.rules = []; this.itemRules.some((rule: any) => {
const _rules: any[] = newVal;
this.rules = [..._rules];
this.rules.some((rule: any) => {
if (rule.hasOwnProperty("required")) { if (rule.hasOwnProperty("required")) {
this.required = rule.required; this.required = rule.required;
return true; return true;
...@@ -273,9 +262,7 @@ export default class AppFormItem extends Vue { ...@@ -273,9 +262,7 @@ export default class AppFormItem extends Vue {
public mounted() { public mounted() {
if (this.itemRules) { if (this.itemRules) {
try { try {
const _rules: any[] = this.itemRules; this.itemRules.some((rule: any) => {
this.rules = [..._rules];
this.rules.some((rule: any) => {
if (rule.hasOwnProperty("required")) { if (rule.hasOwnProperty("required")) {
this.required = rule.required; this.required = rule.required;
return true; return true;
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<script lang = 'ts'> <script lang = 'ts'>
import { Component, Vue, Prop, Model, Watch } from 'vue-property-decorator'; import { Component, Vue, Prop, Model, Watch } from 'vue-property-decorator';
import { Subject } from 'rxjs'; import { Subject, Subscription } from 'rxjs';
import { AppModal } from '@/utils'; import { AppModal } from '@/utils';
@Component({ @Component({
...@@ -278,6 +278,14 @@ export default class AppPicker extends Vue { ...@@ -278,6 +278,14 @@ export default class AppPicker extends Vue {
*/ */
public dropdownDom:any = {}; public dropdownDom:any = {};
/**
* 订阅对象
*
* @type {*}
* @memberof AppPicker
*/
containerEvent: Subscription | null = null;
/** /**
* 获取关联数据项值 * 获取关联数据项值
* *
...@@ -345,6 +353,9 @@ export default class AppPicker extends Vue { ...@@ -345,6 +353,9 @@ export default class AppPicker extends Vue {
* @memberof AppPicker * @memberof AppPicker
*/ */
public destroyed(): void { public destroyed(): void {
if (this.containerEvent) {
this.containerEvent.unsubscribe();
}
} }
/** /**
...@@ -532,7 +543,7 @@ export default class AppPicker extends Vue { ...@@ -532,7 +543,7 @@ export default class AppPicker extends Vue {
*/ */
private openPopupModal(view: any, context: any, param: any): void { private openPopupModal(view: any, context: any, param: any): void {
let container: Subject<any> = this.$appmodal.openModal(view, context, param); let container: Subject<any> = this.$appmodal.openModal(view, context, param);
container.subscribe((result: any) => { this.containerEvent = container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) { if (!result || !Object.is(result.ret, 'OK')) {
return; return;
} }
...@@ -550,7 +561,7 @@ export default class AppPicker extends Vue { ...@@ -550,7 +561,7 @@ export default class AppPicker extends Vue {
*/ */
private openDrawer(view: any, context: any, param: any): void { private openDrawer(view: any, context: any, param: any): void {
let container: Subject<any> = this.$appdrawer.openDrawer(view, context, param); let container: Subject<any> = this.$appdrawer.openDrawer(view, context, param);
container.subscribe((result: any) => { this.containerEvent = container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) { if (!result || !Object.is(result.ret, 'OK')) {
return; return;
} }
...@@ -569,7 +580,7 @@ export default class AppPicker extends Vue { ...@@ -569,7 +580,7 @@ export default class AppPicker extends Vue {
*/ */
private openPopOver($event: any, view: any, context: any, param: any): void { private openPopOver($event: any, view: any, context: any, param: any): void {
let container: Subject<any> = this.$apppopover.openPop($event, view, context, param); let container: Subject<any> = this.$apppopover.openPop($event, view, context, param);
container.subscribe((result: any) => { this.containerEvent = container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) { if (!result || !Object.is(result.ret, 'OK')) {
return; return;
} }
......
...@@ -17,7 +17,7 @@ export default class AppRadioGroup extends Vue { ...@@ -17,7 +17,7 @@ export default class AppRadioGroup extends Vue {
* @type {CodeListService} * @type {CodeListService}
* @memberof AppRadioGroup * @memberof AppRadioGroup
*/ */
public codeListService:CodeListService = new CodeListService({ $store: this.$store }); public codeListService:CodeListService = new CodeListService();
/** /**
* 双向绑定值 * 双向绑定值
......
...@@ -37,7 +37,7 @@ export default class AppRate extends Vue { ...@@ -37,7 +37,7 @@ export default class AppRate extends Vue {
* @type {CodeListService} * @type {CodeListService}
* @memberof AppRate * @memberof AppRate
*/ */
public codeListService: CodeListService = new CodeListService({ $store: this.$store }); public codeListService: CodeListService = new CodeListService();
/** /**
* 传递最大值 * 传递最大值
......
...@@ -29,7 +29,7 @@ export default class CodeList extends Vue { ...@@ -29,7 +29,7 @@ export default class CodeList extends Vue {
* @type {CodeListService} * @type {CodeListService}
* @memberof CodeList * @memberof CodeList
*/ */
public codeListService:CodeListService = new CodeListService({ $store: this.$store }); public codeListService:CodeListService = new CodeListService();
/** /**
* 代码表标识 * 代码表标识
...@@ -195,16 +195,14 @@ export default class CodeList extends Vue { ...@@ -195,16 +195,14 @@ export default class CodeList extends Vue {
let _context = data.context; let _context = data.context;
let _param = data.param; let _param = data.param;
this.codeListService.getItems(this.tag,_context,_param).then((res:any) => { this.codeListService.getItems(this.tag,_context,_param).then((res:any) => {
let items = res; _this.setItems(res, _this);
_this.setItems(items, _this);
}).catch((error: any) => { }).catch((error: any) => {
console.log(`----${_this.tag}----${(this.$t('app.commonWords.codeNotExist') as string)}`); console.log(`----${_this.tag}----${(this.$t('app.commonWords.codeNotExist') as string)}`);
}); });
// 静态处理 // 静态处理
} else if(Object.is(this.codelistType, "STATIC")){ } else if(Object.is(this.codelistType, "STATIC")){
this.isUseLangres = true; this.isUseLangres = true;
let items = this.$store.getters.getCodeListItems(this.tag); _this.setItems(this.$store.getters.getCodeListItems(this.tag), _this);
_this.setItems(items, _this);
} }
} }
......
...@@ -25,7 +25,7 @@ export default class DropDownListDynamic extends Vue { ...@@ -25,7 +25,7 @@ export default class DropDownListDynamic extends Vue {
* @type {CodeListService} * @type {CodeListService}
* @memberof DropDownListDynamic * @memberof DropDownListDynamic
*/ */
public codeListService:CodeListService = new CodeListService({ $store: this.$store }); public codeListService:CodeListService = new CodeListService();
/** /**
* 额外参数 * 额外参数
......
...@@ -30,7 +30,7 @@ export default class DropDownList extends Vue { ...@@ -30,7 +30,7 @@ export default class DropDownList extends Vue {
* @type {CodeListService} * @type {CodeListService}
* @memberof DropDownList * @memberof DropDownList
*/ */
public codeListService:CodeListService = new CodeListService({ $store: this.$store }); public codeListService:CodeListService = new CodeListService();
/** /**
* 额外参数 * 额外参数
......
...@@ -35,7 +35,7 @@ export default class DropDownListMpicker extends Vue { ...@@ -35,7 +35,7 @@ export default class DropDownListMpicker extends Vue {
* @type {CodeListService} * @type {CodeListService}
* @memberof DropDownListMpicker * @memberof DropDownListMpicker
*/ */
public codeListService:CodeListService = new CodeListService({ $store: this.$store }); public codeListService:CodeListService = new CodeListService();
/** /**
* 是否有子集 * 是否有子集
......
...@@ -30,7 +30,7 @@ export default class DropDownList extends Vue { ...@@ -30,7 +30,7 @@ export default class DropDownList extends Vue {
* @type {CodeListService} * @type {CodeListService}
* @memberof DropDownList * @memberof DropDownList
*/ */
public codeListService:CodeListService = new CodeListService({ $store: this.$store }); public codeListService:CodeListService = new CodeListService();
/** /**
* 额外参数 * 额外参数
......
import { Store } from 'vuex'; import { Store } from 'vuex';
import EntityService from '@/service/entity-service'; import EntityService from '@/api/service/entity-service';
import store from '@/store';
/** /**
...@@ -71,7 +72,7 @@ export default class CounterService { ...@@ -71,7 +72,7 @@ export default class CounterService {
* @memberof CounterService * @memberof CounterService
*/ */
constructor(opts: any = {}) { constructor(opts: any = {}) {
this.$store = opts.$store; this.$store = store;
this.context = opts.context?opts.context:{}; this.context = opts.context?opts.context:{};
this.viewparams = opts.viewparams?opts.viewparams:{}; this.viewparams = opts.viewparams?opts.viewparams:{};
} }
......
...@@ -26,7 +26,14 @@ export class LoaddingService { ...@@ -26,7 +26,14 @@ export class LoaddingService {
* @type {(Subscription | undefined)} * @type {(Subscription | undefined)}
* @memberof LoaddingService * @memberof LoaddingService
*/ */
public loaddingStateEvent: Subscription | undefined; public loaddingStateEvent: Subscription | null = null;
/**
* @description dom映射对象
* @type {Map<string, any>}
* @memberof LoaddingService
*/
public domMap: Map<string, any> = new Map();
/** /**
* 获取 LoaddingService 单例对象 * 获取 LoaddingService 单例对象
...@@ -56,6 +63,9 @@ export class LoaddingService { ...@@ -56,6 +63,9 @@ export class LoaddingService {
if(el.getElementsByTagName('i') && el.getElementsByTagName('i').length >0){ if(el.getElementsByTagName('i') && el.getElementsByTagName('i').length >0){
let iconElement:any = el.getElementsByTagName('i')[0]; let iconElement:any = el.getElementsByTagName('i')[0];
iconElement.setAttribute('ownclassname',iconElement.className); iconElement.setAttribute('ownclassname',iconElement.className);
const uuid: string = String(el.__vue__._uid);
el.setAttribute('uuid',uuid);
this.domMap.set(uuid, iconElement);
} }
} }
} }
...@@ -69,16 +79,17 @@ export class LoaddingService { ...@@ -69,16 +79,17 @@ export class LoaddingService {
* @memberof LoaddingService * @memberof LoaddingService
*/ */
public setLoadState(el:any, binding:any){ public setLoadState(el:any, binding:any){
if (!this.loaddingStateEvent) {
this.loaddingStateEvent = Http.getInstance().getNotifyObject().subscribe((result:any) =>{ this.loaddingStateEvent = Http.getInstance().getNotifyObject().subscribe((result:any) =>{
if(result && result.action && Object.is(result.action,'setloadstate')){ if(result && result.action && Object.is(result.action,'setloadstate')){
if(result && result.state){ if(result && result.state){
this.addLoadState(el,binding); this.addLoadState();
}else{ }else{
this.removeLoadState(el,binding); this.removeLoadState();
} }
} }
}) })
}
} }
/** /**
...@@ -88,17 +99,10 @@ export class LoaddingService { ...@@ -88,17 +99,10 @@ export class LoaddingService {
* @param {any} binding 指令附加参数 * @param {any} binding 指令附加参数
* @memberof LoaddingService * @memberof LoaddingService
*/ */
public addLoadState(el:any, binding:any){ public addLoadState(){
if(binding && binding.arg){ this.domMap.forEach((dom: any, key: string) => {
el.style.pointerEvents = 'none'; dom.className = "el-icon-loading";
// 工具栏按钮 })
if(Object.is(binding.arg,'i-button')){
if(el.getElementsByTagName('i') && el.getElementsByTagName('i').length >0){
let iconElement:any = el.getElementsByTagName('i')[0];
iconElement.className = "el-icon-loading";
}
}
}
} }
/** /**
...@@ -108,17 +112,10 @@ export class LoaddingService { ...@@ -108,17 +112,10 @@ export class LoaddingService {
* @param {any} binding 指令附加参数 * @param {any} binding 指令附加参数
* @memberof LoaddingService * @memberof LoaddingService
*/ */
public removeLoadState(el:any, binding:any){ public removeLoadState(){
if(binding && binding.arg){ this.domMap.forEach((dom: any, key: string) => {
el.style.pointerEvents = ''; dom.className = dom.getAttribute('ownclassname');
// 工具栏按钮 })
if(Object.is(binding.arg,'i-button')){
if(el.getElementsByTagName('i') && el.getElementsByTagName('i').length >0){
let iconElement:any = el.getElementsByTagName('i')[0];
iconElement.className = iconElement.getAttribute('ownclassname');
}
}
}
} }
/** /**
...@@ -129,8 +126,13 @@ export class LoaddingService { ...@@ -129,8 +126,13 @@ export class LoaddingService {
* @memberof LoaddingService * @memberof LoaddingService
*/ */
public clearResource(el:any, binding:any){ public clearResource(el:any, binding:any){
if(this.loaddingStateEvent){ if(this.loaddingStateEvent && this.domMap.size == 0){
this.loaddingStateEvent.unsubscribe(); this.loaddingStateEvent.unsubscribe();
this.loaddingStateEvent = null;
}
const uuid: string = el.getAttribute('uuid');
if (uuid && this.domMap.has(uuid)) {
this.domMap.delete(uuid);
} }
} }
......
...@@ -98,5 +98,13 @@ export default class CalendarExpViewEngine extends ViewEngine { ...@@ -98,5 +98,13 @@ export default class CalendarExpViewEngine extends ViewEngine {
return this.calendarExpBar; return this.calendarExpBar;
} }
/**
* @description 销毁
* @memberof CalendarExpViewEngine
*/
public destroy() {
super.destroy();
this.calendarExpBar = null;
}
} }
\ No newline at end of file
...@@ -99,4 +99,13 @@ export default class ChartViewEngine extends SearchViewEngine { ...@@ -99,4 +99,13 @@ export default class ChartViewEngine extends SearchViewEngine {
public getChart(): any { public getChart(): any {
return this.chart; return this.chart;
} }
/**
* @description 销毁
* @memberof ChartViewEngine
*/
public destroy() {
super.destroy();
this.chart = null;
}
} }
\ No newline at end of file
...@@ -138,4 +138,13 @@ export default class DataViewEngine extends MDViewEngine { ...@@ -138,4 +138,13 @@ export default class DataViewEngine extends MDViewEngine {
} }
} }
/**
* @description 销毁
* @memberof DataViewEngine
*/
public destroy() {
super.destroy();
this.dataView = null;
}
} }
\ No newline at end of file
...@@ -98,5 +98,14 @@ export default class DataViewExpViewEngine extends ViewEngine { ...@@ -98,5 +98,14 @@ export default class DataViewExpViewEngine extends ViewEngine {
return this.dataviewExpBar; return this.dataviewExpBar;
} }
/**
* @description 销毁
* @memberof DataViewExpViewEngine
*/
public destroy() {
super.destroy();
this.dataviewExpBar = null;
}
} }
\ No newline at end of file
...@@ -222,4 +222,13 @@ export default class EditViewEngine extends ViewEngine { ...@@ -222,4 +222,13 @@ export default class EditViewEngine extends ViewEngine {
return this.getForm().transformData(arg); return this.getForm().transformData(arg);
} }
/**
* @description 销毁
* @memberof EditViewEngine
*/
public destroy() {
super.destroy();
this.form = null;
}
} }
\ No newline at end of file
...@@ -120,4 +120,13 @@ export default class EditView2Engine extends EditViewEngine { ...@@ -120,4 +120,13 @@ export default class EditView2Engine extends EditViewEngine {
public getDRBar(): any { public getDRBar(): any {
return this.drBar; return this.drBar;
} }
/**
* @description 销毁
* @memberof EditView2Engine
*/
public destroy() {
super.destroy();
this.drBar = null;
}
} }
\ No newline at end of file
...@@ -118,4 +118,13 @@ export default class EditView3Engine extends EditViewEngine { ...@@ -118,4 +118,13 @@ export default class EditView3Engine extends EditViewEngine {
public getDrTab(): any { public getDrTab(): any {
return this.drTab; return this.drTab;
} }
/**
* @description 销毁
* @memberof EditView3Engine
*/
public destroy() {
super.destroy();
this.drTab = null;
}
} }
\ No newline at end of file
...@@ -118,4 +118,13 @@ export default class EditView4Engine extends EditViewEngine { ...@@ -118,4 +118,13 @@ export default class EditView4Engine extends EditViewEngine {
public getDrTab(): any { public getDrTab(): any {
return this.drTab; return this.drTab;
} }
/**
* @description 销毁
* @memberof EditView4Engine
*/
public destroy() {
super.destroy();
this.drTab = null;
}
} }
\ No newline at end of file
...@@ -62,4 +62,13 @@ export default class FormPickupDataViewEngine extends MDViewEngine { ...@@ -62,4 +62,13 @@ export default class FormPickupDataViewEngine extends MDViewEngine {
return this.dataview; return this.dataview;
} }
/**
* @description 销毁
* @memberof FormPickupDataViewEngine
*/
public destroy() {
super.destroy();
this.dataview = null;
}
} }
\ No newline at end of file
...@@ -98,5 +98,14 @@ export default class GridExpViewEngine extends ViewEngine { ...@@ -98,5 +98,14 @@ export default class GridExpViewEngine extends ViewEngine {
return this.gridExpBar; return this.gridExpBar;
} }
/**
* @description 销毁
* @memberof GridExpViewEngine
*/
public destroy() {
super.destroy();
this.gridExpBar = null;
}
} }
\ No newline at end of file
...@@ -111,4 +111,13 @@ export default class GridViewEngine extends MDViewEngine { ...@@ -111,4 +111,13 @@ export default class GridViewEngine extends MDViewEngine {
public gridRowAllowActive(mode: number): boolean { public gridRowAllowActive(mode: number): boolean {
return this.view.gridRowActiveMode === mode ? true : false; return this.view.gridRowActiveMode === mode ? true : false;
} }
/**
* @description 销毁
* @memberof GridViewEngine
*/
public destroy() {
super.destroy();
this.grid = null;
}
} }
\ No newline at end of file
...@@ -51,7 +51,6 @@ export default class GridView8Engine extends GridViewEngine { ...@@ -51,7 +51,6 @@ export default class GridView8Engine extends GridViewEngine {
* @memberof GridView8Engine * @memberof GridView8Engine
*/ */
public init(options: any = {}): void { public init(options: any = {}): void {
this.grid = options.grid;
this.totalgrid = options.totalgrid; this.totalgrid = options.totalgrid;
super.init(options); super.init(options);
} }
...@@ -277,4 +276,13 @@ export default class GridView8Engine extends GridViewEngine { ...@@ -277,4 +276,13 @@ export default class GridView8Engine extends GridViewEngine {
this.removeData(items); this.removeData(items);
} }
} }
/**
* @description 销毁
* @memberof GridView8Engine
*/
public destroy() {
super.destroy();
this.totalgrid = null;
}
} }
...@@ -55,4 +55,13 @@ export default class KanBanViewEngine extends DataViewEngine { ...@@ -55,4 +55,13 @@ export default class KanBanViewEngine extends DataViewEngine {
public getMDCtrl(): any { public getMDCtrl(): any {
return this.kanban; return this.kanban;
} }
/**
* @description 销毁
* @memberof KanBanViewEngine
*/
public destroy() {
super.destroy();
this.kanban = null;
}
} }
\ No newline at end of file
...@@ -98,5 +98,12 @@ export default class ListExpViewEngine extends ViewEngine { ...@@ -98,5 +98,12 @@ export default class ListExpViewEngine extends ViewEngine {
return this.listExpBar; return this.listExpBar;
} }
/**
* @description 销毁
* @memberof ListExpViewEngine
*/
public destroy() {
super.destroy();
this.listExpBar = null;
}
} }
\ No newline at end of file
...@@ -147,4 +147,13 @@ export default class ListViewEngine extends MDViewEngine { ...@@ -147,4 +147,13 @@ export default class ListViewEngine extends MDViewEngine {
} }
} }
/**
* @description 销毁
* @memberof ListViewEngine
*/
public destroy() {
super.destroy();
this.list = null;
}
} }
\ No newline at end of file
...@@ -64,5 +64,12 @@ export default class MapViewEngine extends MDViewEngine { ...@@ -64,5 +64,12 @@ export default class MapViewEngine extends MDViewEngine {
return this.map; return this.map;
} }
/**
* @description 销毁
* @memberof MapViewEngine
*/
public destroy() {
super.destroy();
this.map = null;
}
} }
\ No newline at end of file
...@@ -466,4 +466,15 @@ export default class MDViewEngine extends ViewEngine { ...@@ -466,4 +466,15 @@ export default class MDViewEngine extends ViewEngine {
public MDCtrlRemove(arg: any = {}): void { public MDCtrlRemove(arg: any = {}): void {
this.view.$emit('drdatasremove', arg); this.view.$emit('drdatasremove', arg);
} }
/**
* @description 销毁
* @memberof MDViewEngine
*/
public destroy() {
super.destroy();
this.searchForm = null;
this.propertypanel = null;
this.md = null;
}
} }
\ No newline at end of file
...@@ -120,4 +120,13 @@ export default class MPickupViewEngine extends ViewEngine { ...@@ -120,4 +120,13 @@ export default class MPickupViewEngine extends ViewEngine {
public getPickupViewPanel(): any { public getPickupViewPanel(): any {
return this.pickupViewPanel; return this.pickupViewPanel;
} }
/**
* @description 销毁
* @memberof MPickupViewEngine
*/
public destroy() {
super.destroy();
this.pickupViewPanel = null;
}
} }
\ No newline at end of file
...@@ -62,4 +62,13 @@ export default class PickupDataViewEngine extends MDViewEngine { ...@@ -62,4 +62,13 @@ export default class PickupDataViewEngine extends MDViewEngine {
return this.dataview; return this.dataview;
} }
/**
* @description 销毁
* @memberof PickupDataViewEngine
*/
public destroy() {
super.destroy();
this.dataview = null;
}
} }
\ No newline at end of file
...@@ -96,4 +96,13 @@ export default class PickupViewEngine extends ViewEngine { ...@@ -96,4 +96,13 @@ export default class PickupViewEngine extends ViewEngine {
public getPickupViewPanel(): any { public getPickupViewPanel(): any {
return this.pickupViewPanel; return this.pickupViewPanel;
} }
/**
* @description 销毁
* @memberof PickupViewEngine
*/
public destroy() {
super.destroy();
this.pickupViewPanel = null;
}
} }
\ No newline at end of file
...@@ -92,4 +92,13 @@ export default class PortalViewEngine extends ViewEngine { ...@@ -92,4 +92,13 @@ export default class PortalViewEngine extends ViewEngine {
return this.dashboard; return this.dashboard;
} }
/**
* @description 销毁
* @memberof PortalViewEngine
*/
public destroy() {
super.destroy();
this.dashboard = null;
}
} }
\ No newline at end of file
...@@ -118,4 +118,13 @@ export class SearchViewEngine extends ViewEngine { ...@@ -118,4 +118,13 @@ export class SearchViewEngine extends ViewEngine {
public getSearchForm(): any { public getSearchForm(): any {
return this.searchForm; return this.searchForm;
} }
/**
* @description 销毁
* @memberof SearchViewEngine
*/
public destroy() {
super.destroy();
this.searchForm = null;
}
} }
\ No newline at end of file
...@@ -99,5 +99,14 @@ export default class TreeExpView extends ViewEngine { ...@@ -99,5 +99,14 @@ export default class TreeExpView extends ViewEngine {
return this.treeExpBar; return this.treeExpBar;
} }
/**
* @description 销毁
* @memberof TreeExpView
*/
public destroy() {
super.destroy();
this.treeExpBar = null;
}
} }
\ No newline at end of file
...@@ -111,4 +111,13 @@ export default class TreeGridExViewEngine extends MDViewEngine { ...@@ -111,4 +111,13 @@ export default class TreeGridExViewEngine extends MDViewEngine {
public gridRowAllowActive(mode: number): boolean { public gridRowAllowActive(mode: number): boolean {
return this.view.gridRowActiveMode === mode ? true : false; return this.view.gridRowActiveMode === mode ? true : false;
} }
/**
* @description 销毁
* @memberof TreeGridExViewEngine
*/
public destroy() {
super.destroy();
this.treegridex = null;
}
} }
\ No newline at end of file
...@@ -98,5 +98,14 @@ export default class TreeViewEngine extends ViewEngine { ...@@ -98,5 +98,14 @@ export default class TreeViewEngine extends ViewEngine {
return this.tree; return this.tree;
} }
/**
* @description 销毁
* @memberof TreeViewEngine
*/
public destroy() {
super.destroy();
this.tree = null;
}
} }
\ No newline at end of file
...@@ -227,6 +227,16 @@ export default class ViewEngine { ...@@ -227,6 +227,16 @@ export default class ViewEngine {
} }
} }
} }
} }
/**
* @description 销毁
* @memberof ViewEngine
*/
public destroy() {
this.view = null;
this.opt = {};
this.methods = {};
}
} }
\ No newline at end of file
...@@ -94,4 +94,13 @@ export default class WizardViewEngine extends ViewEngine { ...@@ -94,4 +94,13 @@ export default class WizardViewEngine extends ViewEngine {
public getWizardPanel(): any { public getWizardPanel(): any {
return this.wizardpanel; return this.wizardpanel;
} }
/**
* @description 销毁
* @memberof WizardViewEngine
*/
public destroy() {
super.destroy();
this.wizardpanel = null;
}
} }
\ No newline at end of file
...@@ -33,15 +33,6 @@ export interface Message { ...@@ -33,15 +33,6 @@ export interface Message {
*/ */
export default class AppCenterService { export default class AppCenterService {
/**
* Vue 状态管理器
*
* @private
* @type {*}
* @memberof AppCenterService
*/
private static store: any;
/** /**
* 应用数据状态管理对象 * 应用数据状态管理对象
* *
...@@ -75,11 +66,10 @@ export default class AppCenterService { ...@@ -75,11 +66,10 @@ export default class AppCenterService {
* @returns {AppCenterService} * @returns {AppCenterService}
* @memberof AppCenterService * @memberof AppCenterService
*/ */
public static getInstance(store: any): AppCenterService { public static getInstance(): AppCenterService {
if (!AppCenterService.appCenterService) { if (!AppCenterService.appCenterService) {
AppCenterService.appCenterService = new AppCenterService(); AppCenterService.appCenterService = new AppCenterService();
} }
this.store = store;
return this.appCenterService; return this.appCenterService;
} }
......
...@@ -84,6 +84,7 @@ export interface ServiceState { ...@@ -84,6 +84,7 @@ export interface ServiceState {
} }
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import store from '@/store/index'
/** /**
* 导航数据服务 * 导航数据服务
...@@ -150,7 +151,7 @@ export default class NavDataService { ...@@ -150,7 +151,7 @@ export default class NavDataService {
* @returns {NavDataService} * @returns {NavDataService}
* @memberof NavDataService * @memberof NavDataService
*/ */
public static getInstance(store: any): NavDataService { public static getInstance(): NavDataService {
if (!NavDataService.navDataService) { if (!NavDataService.navDataService) {
NavDataService.navDataService = new NavDataService(); NavDataService.navDataService = new NavDataService();
} }
......
import { Store } from 'vuex'; import { Store } from 'vuex';
import AuthService from '@/authservice/auth-service'; import AuthService from '@/api/authservice/auth-service';
import store from '@/store';
/** /**
* 界面服务基类 * 界面服务基类
...@@ -32,7 +33,7 @@ export default class UIService { ...@@ -32,7 +33,7 @@ export default class UIService {
* @memberof UIService * @memberof UIService
*/ */
constructor(opts: any = {}) { constructor(opts: any = {}) {
this.$store = opts.$store; this.$store = store;
} }
/** /**
......
import Vue from 'vue'; import Vue from 'vue';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import store from '../../store'; import store from '../../store';
import i18n from '@/locale'; import i18n from '@/common/locale';
import { ViewTool } from '../view-tool/view-tool'; import { ViewTool } from '../view-tool/view-tool';
import AppModalCompponent from "./app-modal.vue"; import AppModalCompponent from "./app-modal.vue";
import './app-modal.less'; import './app-modal.less';
...@@ -15,16 +15,7 @@ export class AppModal { ...@@ -15,16 +15,7 @@ export class AppModal {
* @static * @static
* @memberof AppModal * @memberof AppModal
*/ */
private static modal = new AppModal(); private static modal: AppModal;
/**
* vue 实例
*
* @private
* @type {Vue}
* @memberof AppModal
*/
private vueExample!: Vue;
/** /**
* Creates an instance of AppModal. * Creates an instance of AppModal.
...@@ -32,11 +23,16 @@ export class AppModal { ...@@ -32,11 +23,16 @@ export class AppModal {
* @memberof AppModal * @memberof AppModal
*/ */
private constructor() { private constructor() {
if (AppModal.modal) {
return AppModal.modal;
}
} }
/**
* @description 临时vue对象
* @private
* @type {(Vue | null)}
* @memberof AppModal
*/
private VueExample: Vue | null = null;
/** /**
* 获取单例对象 * 获取单例对象
* *
...@@ -65,17 +61,15 @@ export class AppModal { ...@@ -65,17 +61,15 @@ export class AppModal {
private createVueExample(view: { viewname: string, title: string, width?: number, height?: number,isfullscreen?:boolean }, context: any = {},viewparams:any ={}, uuid: string): Subject<any> { private createVueExample(view: { viewname: string, title: string, width?: number, height?: number,isfullscreen?:boolean }, context: any = {},viewparams:any ={}, uuid: string): Subject<any> {
try { try {
let props = { view: view, viewdata: context,viewparams:viewparams,uuid: uuid }; let props = { view: view, viewdata: context,viewparams:viewparams,uuid: uuid };
let component = AppModalCompponent; this.VueExample = new Vue({
const vm = new Vue({
store: store, store: store,
i18n: i18n, i18n: i18n,
render(h) { render(h) {
return h(component, { props }); return h(AppModalCompponent, { props });
} }
}).$mount(); }).$mount();
this.vueExample = vm; document.body.appendChild(this.VueExample.$el);
document.body.appendChild(vm.$el); const comp: any = this.VueExample.$children[0];
const comp: any = vm.$children[0];
return comp.getSubject(); return comp.getSubject();
} catch (error) { } catch (error) {
console.error(error); console.error(error);
...@@ -122,4 +116,15 @@ export class AppModal { ...@@ -122,4 +116,15 @@ export class AppModal {
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
} }
/**
* @description 销毁临时vue对象
* @memberof AppModal
*/
destroyVueExample() {
if (this.VueExample) {
this.VueExample.$destroy();
this.VueExample = null;
}
}
} }
\ No newline at end of file
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
<script lang="ts"> <script lang="ts">
import { Vue, Component, Prop, Provide, Emit, Watch } from "vue-property-decorator"; import { Vue, Component, Prop, Provide, Emit, Watch } from "vue-property-decorator";
import { Subject } from "rxjs"; import { Subject } from "rxjs";
import {AppModal} from './app-modal';
@Component({ @Component({
components: {} components: {}
}) })
...@@ -279,6 +280,7 @@ export default class AppModalCompponent extends Vue { ...@@ -279,6 +280,7 @@ export default class AppModalCompponent extends Vue {
setTimeout(() => { setTimeout(() => {
document.body.removeChild(this.$el); document.body.removeChild(this.$el);
this.$destroy(); this.$destroy();
AppModal.getInstance().destroyVueExample();
this.subject = null; this.subject = null;
}, 500) }, 500)
} }
......
import { Store } from 'vuex'; import { Store } from 'vuex';
import { Util } from '@/utils/util/util'; import { Util } from '@/utils/util/util';
import CodeListService from "@/codelist/codelist-service"; import CodeListService from "@/codelist/codelist-service";
import store from '@/store';
/** /**
* 部件服务基类 * 部件服务基类
...@@ -50,9 +51,9 @@ export default class ControlService { ...@@ -50,9 +51,9 @@ export default class ControlService {
* @memberof ControlService * @memberof ControlService
*/ */
constructor(opts: any = {}) { constructor(opts: any = {}) {
this.$store = opts.$store; this.$store = store;
this.setTempMode(); this.setTempMode();
this.codeListService = new CodeListService({ $store:opts.$store }); this.codeListService = new CodeListService();
} }
/** /**
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册