提交 01ca5b58 编写于 作者: ibizdev's avatar ibizdev

chitanda 发布系统代码

上级 a9606446
import { Prop } from 'vue-property-decorator';
import { PickupViewBase } from './PickupViewBase'; import { PickupViewBase } from './PickupViewBase';
/** /**
...@@ -9,6 +10,14 @@ import { PickupViewBase } from './PickupViewBase'; ...@@ -9,6 +10,14 @@ import { PickupViewBase } from './PickupViewBase';
*/ */
export class MPickupViewBase extends PickupViewBase { export class MPickupViewBase extends PickupViewBase {
/**
* 是否初始化已选中项
*
* @type {boolean}
* @memberof MPickupViewBase
*/
public isInitSelected: boolean = false;
/** /**
* 是否单选 * 是否单选
* *
...@@ -16,4 +25,118 @@ export class MPickupViewBase extends PickupViewBase { ...@@ -16,4 +25,118 @@ export class MPickupViewBase extends PickupViewBase {
* @memberof MPickupViewBase * @memberof MPickupViewBase
*/ */
public isSingleSelect: boolean = false; public isSingleSelect: boolean = false;
/**
* 视图参数变更
*
* @protected
* @param {*} newVal
* @param {*} oldVal
* @memberof MPickupViewBase
*/
protected viewParamChange(newVal: any, oldVal: any): void {
if (this.viewparams.selectedData) {
this.selectedData = JSON.stringify(this.viewparams.selectedData);
}
}
/**
* 视图组件挂载完毕
*
* @protected
* @memberof MPickupViewBase
*/
protected viewMounted(): void {
if (this.viewparams.selectedData) {
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', this.viewparams.selectedData);
this.onCLickRight();
}
}
/**
* 选中数据单击
*
* @param {*} item
* @memberof MPickupViewBase
*/
public selectionsClick(item: any): void {
item._select = !item._select;
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
}
/**
* 选中树双击
*
* @param {*} item
* @memberof MPickupViewBase
*/
public selectionsDBLClick(item: any): void {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(selection.srfkey, item.srfkey));
if (index !== -1) {
this.viewSelections.splice(index, 1);
}
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 删除右侧全部选中数据
*
* @memberof MPickupViewBase
*/
public onCLickLeft(): void {
const _selectiions = [...JSON.parse(JSON.stringify(this.viewSelections))];
_selectiions.forEach((item: any) => {
if (!item._select) {
return;
}
const index = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index !== -1) {
this.viewSelections.splice(index, 1);
}
});
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 添加左侧选中数据
*
* @memberof MPickupViewBase
*/
public onCLickRight(): void {
Object.values(this.containerModel).forEach((model: any) => {
if (!Object.is(model.type, 'PICKUPVIEWPANEL')) {
return;
}
let newSelections: any[] = [];
model.selections.forEach((item: any) => {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index === -1) {
let _item: any = { ...JSON.parse(JSON.stringify(item)) };
Object.assign(_item, { _select: false })
newSelections.push(_item);
} else {
newSelections.push(this.viewSelections[index]);
}
});
this.viewSelections = newSelections;
});
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 选中数据全部删除
*
* @memberof MPickupViewBase
*/
public onCLickAllLeft(): void {
this.viewSelections = [];
this.containerModel.view_leftbtn.disabled = true;
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', []);
this.selectedData = JSON.stringify(this.viewSelections);
}
} }
\ No newline at end of file
import { Prop } from 'vue-property-decorator';
import { ViewBase } from './ViewBase'; import { ViewBase } from './ViewBase';
/** /**
...@@ -11,12 +10,12 @@ import { ViewBase } from './ViewBase'; ...@@ -11,12 +10,12 @@ import { ViewBase } from './ViewBase';
export class PickupViewBase extends ViewBase { export class PickupViewBase extends ViewBase {
/** /**
* 视图选中数据 * 是否单选
* *
* @type {any[]} * @type {boolean}
* @memberof PickupViewBase * @memberof PickupViewBase
*/ */
public viewSelections: any[] = []; public isSingleSelect: boolean = true;
/** /**
* 是否显示按钮 * 是否显示按钮
...@@ -36,134 +35,12 @@ export class PickupViewBase extends ViewBase { ...@@ -36,134 +35,12 @@ export class PickupViewBase extends ViewBase {
public selectedData: string = ''; public selectedData: string = '';
/** /**
* 是否初始化已选中项 * 视图选中数据
*
* @type {boolean}
* @memberof PickupViewBase
*/
public isInitSelected: boolean = false;
/**
* 是否单选
*
* @type {boolean}
* @memberof PickupViewBase
*/
public isSingleSelect: boolean = true;
/**
* 视图参数变更
*
* @protected
* @param {*} newVal
* @param {*} oldVal
* @memberof PickupViewBase
*/
protected viewParamChange(newVal: any, oldVal: any): void {
if (this.viewparams.selectedData) {
this.selectedData = JSON.stringify(this.viewparams.selectedData);
}
}
/**
* 视图组件挂载完毕
*
* @protected
* @memberof PickupViewBase
*/
protected viewMounted(): void {
if (this.viewparams.selectedData) {
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', this.viewparams.selectedData);
this.onCLickRight();
}
}
/**
* 选中数据单击
*
* @param {*} item
* @memberof PickupViewBase
*/
public selectionsClick(item: any): void {
item._select = !item._select;
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
}
/**
* 选中树双击
*
* @param {*} item
* @memberof PickupViewBase
*/
public selectionsDBLClick(item: any): void {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(selection.srfkey, item.srfkey));
if (index !== -1) {
this.viewSelections.splice(index, 1);
}
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 删除右侧全部选中数据
*
* @memberof PickupViewBase
*/
public onCLickLeft(): void {
const _selectiions = [...JSON.parse(JSON.stringify(this.viewSelections))];
_selectiions.forEach((item: any) => {
if (!item._select) {
return;
}
const index = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index !== -1) {
this.viewSelections.splice(index, 1);
}
});
const removeSelect: boolean = this.viewSelections.some((selection: any) => selection._select);
this.containerModel.view_leftbtn.disabled = !removeSelect;
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 添加左侧选中数据
*
* @memberof PickupViewBase
*/
public onCLickRight(): void {
Object.values(this.containerModel).forEach((model: any) => {
if (!Object.is(model.type, 'PICKUPVIEWPANEL')) {
return;
}
let newSelections: any[] = [];
model.selections.forEach((item: any) => {
const index: number = this.viewSelections.findIndex((selection: any) => Object.is(item.srfkey, selection.srfkey));
if (index === -1) {
let _item: any = { ...JSON.parse(JSON.stringify(item)) };
Object.assign(_item, { _select: false })
newSelections.push(_item);
} else {
newSelections.push(this.viewSelections[index]);
}
});
this.viewSelections = newSelections;
});
this.selectedData = JSON.stringify(this.viewSelections);
}
/**
* 选中数据全部删除
* *
* @type {any[]}
* @memberof PickupViewBase * @memberof PickupViewBase
*/ */
public onCLickAllLeft(): void { public viewSelections: any[] = [];
this.viewSelections = [];
this.containerModel.view_leftbtn.disabled = true;
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', []);
this.selectedData = JSON.stringify(this.viewSelections);
}
/** /**
* 确定 * 确定
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册