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

Mosher 发布系统代码 [后台服务,演示应用]

上级 331fba47
......@@ -514,7 +514,7 @@ export default class CtrlAmountBase extends Vue implements ControlInterface {
* @param {*} [arg={}]
* @memberof CtrlAmountBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'AppPortalView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -533,17 +533,27 @@ export default class CtrlAmountBase extends Vue implements ControlInterface {
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -577,12 +587,16 @@ export default class CtrlAmountBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]);
}
}
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -657,21 +671,28 @@ export default class CtrlAmountBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizappctrl: keys.join(';') }),Object.assign({ ibizappctrl: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizappctrl: keys.join(';') }),Object.assign({ ibizappctrl: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -684,8 +705,11 @@ export default class CtrlAmountBase extends Vue implements ControlInterface {
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -695,8 +719,7 @@ export default class CtrlAmountBase extends Vue implements ControlInterface {
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -723,6 +746,9 @@ export default class CtrlAmountBase extends Vue implements ControlInterface {
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -753,8 +779,14 @@ export default class CtrlAmountBase extends Vue implements ControlInterface {
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -809,6 +841,10 @@ export default class CtrlAmountBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -816,6 +852,7 @@ export default class CtrlAmountBase extends Vue implements ControlInterface {
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -576,7 +576,7 @@ export default class CtrlListBase extends Vue implements ControlInterface {
* @param {*} [arg={}]
* @memberof CtrlListBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPCTRLListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -595,17 +595,27 @@ export default class CtrlListBase extends Vue implements ControlInterface {
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -639,12 +649,16 @@ export default class CtrlListBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]);
}
}
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -719,21 +733,28 @@ export default class CtrlListBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizappctrl: keys.join(';') }),Object.assign({ ibizappctrl: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizappctrl: keys.join(';') }),Object.assign({ ibizappctrl: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -746,8 +767,11 @@ export default class CtrlListBase extends Vue implements ControlInterface {
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -757,8 +781,7 @@ export default class CtrlListBase extends Vue implements ControlInterface {
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -785,6 +808,9 @@ export default class CtrlListBase extends Vue implements ControlInterface {
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -815,8 +841,14 @@ export default class CtrlListBase extends Vue implements ControlInterface {
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -871,6 +903,10 @@ export default class CtrlListBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -878,6 +914,7 @@ export default class CtrlListBase extends Vue implements ControlInterface {
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -514,7 +514,7 @@ export default class EditorAmountBase extends Vue implements ControlInterface {
* @param {*} [arg={}]
* @memberof EditorAmountBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'AppPortalView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -533,17 +533,27 @@ export default class EditorAmountBase extends Vue implements ControlInterface {
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -577,12 +587,16 @@ export default class EditorAmountBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]);
}
}
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -657,21 +671,28 @@ export default class EditorAmountBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizappeditor: keys.join(';') }),Object.assign({ ibizappeditor: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizappeditor: keys.join(';') }),Object.assign({ ibizappeditor: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -684,8 +705,11 @@ export default class EditorAmountBase extends Vue implements ControlInterface {
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -695,8 +719,7 @@ export default class EditorAmountBase extends Vue implements ControlInterface {
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -723,6 +746,9 @@ export default class EditorAmountBase extends Vue implements ControlInterface {
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -753,8 +779,14 @@ export default class EditorAmountBase extends Vue implements ControlInterface {
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -809,6 +841,10 @@ export default class EditorAmountBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -816,6 +852,7 @@ export default class EditorAmountBase extends Vue implements ControlInterface {
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -576,7 +576,7 @@ export default class EditorListBase extends Vue implements ControlInterface {
* @param {*} [arg={}]
* @memberof EditorListBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEDITORListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -595,17 +595,27 @@ export default class EditorListBase extends Vue implements ControlInterface {
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -639,12 +649,16 @@ export default class EditorListBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]);
}
}
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -719,21 +733,28 @@ export default class EditorListBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizappeditor: keys.join(';') }),Object.assign({ ibizappeditor: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizappeditor: keys.join(';') }),Object.assign({ ibizappeditor: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -746,8 +767,11 @@ export default class EditorListBase extends Vue implements ControlInterface {
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -757,8 +781,7 @@ export default class EditorListBase extends Vue implements ControlInterface {
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -785,6 +808,9 @@ export default class EditorListBase extends Vue implements ControlInterface {
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -815,8 +841,14 @@ export default class EditorListBase extends Vue implements ControlInterface {
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -871,6 +903,10 @@ export default class EditorListBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -878,6 +914,7 @@ export default class EditorListBase extends Vue implements ControlInterface {
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -514,7 +514,7 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf
* @param {*} [arg={}]
* @memberof ExtendEditorAmountBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'AppPortalView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -533,17 +533,27 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -577,12 +587,16 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf
this.handleClick(this.items[0]);
}
}
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -657,21 +671,28 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizappextendeditor: keys.join(';') }),Object.assign({ ibizappextendeditor: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizappextendeditor: keys.join(';') }),Object.assign({ ibizappextendeditor: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -684,8 +705,11 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -695,8 +719,7 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -723,6 +746,9 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -753,8 +779,14 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -809,6 +841,10 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -816,6 +852,7 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -576,7 +576,7 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac
* @param {*} [arg={}]
* @memberof ExtendEditorListBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEXTENDEDITORListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -595,17 +595,27 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -639,12 +649,16 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac
this.handleClick(this.items[0]);
}
}
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -719,21 +733,28 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizappextendeditor: keys.join(';') }),Object.assign({ ibizappextendeditor: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizappextendeditor: keys.join(';') }),Object.assign({ ibizappextendeditor: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -746,8 +767,11 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -757,8 +781,7 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -785,6 +808,9 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -815,8 +841,14 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -871,6 +903,10 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -878,6 +914,7 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -514,7 +514,7 @@ export default class ViewAmountBase extends Vue implements ControlInterface {
* @param {*} [arg={}]
* @memberof ViewAmountBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'AppPortalView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -533,17 +533,27 @@ export default class ViewAmountBase extends Vue implements ControlInterface {
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -577,12 +587,16 @@ export default class ViewAmountBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]);
}
}
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -657,21 +671,28 @@ export default class ViewAmountBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizappview: keys.join(';') }),Object.assign({ ibizappview: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizappview: keys.join(';') }),Object.assign({ ibizappview: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -684,8 +705,11 @@ export default class ViewAmountBase extends Vue implements ControlInterface {
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -695,8 +719,7 @@ export default class ViewAmountBase extends Vue implements ControlInterface {
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -723,6 +746,9 @@ export default class ViewAmountBase extends Vue implements ControlInterface {
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -753,8 +779,14 @@ export default class ViewAmountBase extends Vue implements ControlInterface {
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -809,6 +841,10 @@ export default class ViewAmountBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -816,6 +852,7 @@ export default class ViewAmountBase extends Vue implements ControlInterface {
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -604,7 +604,7 @@ export default class ViewListBase extends Vue implements ControlInterface {
* @param {*} [arg={}]
* @memberof ViewListBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPVIEWListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -623,17 +623,27 @@ export default class ViewListBase extends Vue implements ControlInterface {
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -667,12 +677,16 @@ export default class ViewListBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]);
}
}
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -747,21 +761,28 @@ export default class ViewListBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizappview: keys.join(';') }),Object.assign({ ibizappview: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizappview: keys.join(';') }),Object.assign({ ibizappview: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -774,8 +795,11 @@ export default class ViewListBase extends Vue implements ControlInterface {
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -785,8 +809,7 @@ export default class ViewListBase extends Vue implements ControlInterface {
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -813,6 +836,9 @@ export default class ViewListBase extends Vue implements ControlInterface {
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -843,8 +869,14 @@ export default class ViewListBase extends Vue implements ControlInterface {
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -899,6 +931,10 @@ export default class ViewListBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -906,6 +942,7 @@ export default class ViewListBase extends Vue implements ControlInterface {
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -739,7 +739,7 @@ export default class AutoGroupListBase extends Vue implements ControlInterface {
* @param {*} [arg={}]
* @memberof AutoGroupListBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKAutoGroupListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -758,17 +758,27 @@ export default class AutoGroupListBase extends Vue implements ControlInterface {
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -803,12 +813,16 @@ export default class AutoGroupListBase extends Vue implements ControlInterface {
}
}
this.group();
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -883,21 +897,28 @@ export default class AutoGroupListBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizbook: keys.join(';') }),Object.assign({ ibizbook: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizbook: keys.join(';') }),Object.assign({ ibizbook: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -911,8 +932,11 @@ export default class AutoGroupListBase extends Vue implements ControlInterface {
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -922,8 +946,7 @@ export default class AutoGroupListBase extends Vue implements ControlInterface {
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -950,6 +973,9 @@ export default class AutoGroupListBase extends Vue implements ControlInterface {
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -980,8 +1006,14 @@ export default class AutoGroupListBase extends Vue implements ControlInterface {
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -1036,6 +1068,10 @@ export default class AutoGroupListBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -1043,6 +1079,7 @@ export default class AutoGroupListBase extends Vue implements ControlInterface {
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -534,7 +534,7 @@ export default class BooklistBase extends Vue implements ControlInterface {
* @param {*} [arg={}]
* @memberof BooklistBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKDashboardView_layout' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -553,17 +553,27 @@ export default class BooklistBase extends Vue implements ControlInterface {
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -597,12 +607,16 @@ export default class BooklistBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]);
}
}
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -677,21 +691,28 @@ export default class BooklistBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizbook: keys.join(';') }),Object.assign({ ibizbook: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizbook: keys.join(';') }),Object.assign({ ibizbook: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -704,8 +725,11 @@ export default class BooklistBase extends Vue implements ControlInterface {
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -715,8 +739,7 @@ export default class BooklistBase extends Vue implements ControlInterface {
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -743,6 +766,9 @@ export default class BooklistBase extends Vue implements ControlInterface {
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -773,8 +799,14 @@ export default class BooklistBase extends Vue implements ControlInterface {
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -829,6 +861,10 @@ export default class BooklistBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -836,6 +872,7 @@ export default class BooklistBase extends Vue implements ControlInterface {
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -670,7 +670,7 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter
* @param {*} [arg={}]
* @memberof GroupByCodelistListBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKGroupByCodelistListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -689,17 +689,27 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -734,12 +744,16 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter
}
}
this.group();
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -814,21 +828,28 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizbook: keys.join(';') }),Object.assign({ ibizbook: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizbook: keys.join(';') }),Object.assign({ ibizbook: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -842,8 +863,11 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -853,8 +877,7 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -881,6 +904,9 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -911,8 +937,14 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -967,6 +999,10 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -974,6 +1010,7 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -528,7 +528,7 @@ export default class HasPanelListBase extends Vue implements ControlInterface {
* @param {*} [arg={}]
* @memberof HasPanelListBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKHasPanelListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -547,17 +547,27 @@ export default class HasPanelListBase extends Vue implements ControlInterface {
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -591,12 +601,16 @@ export default class HasPanelListBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]);
}
}
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -671,21 +685,28 @@ export default class HasPanelListBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizbook: keys.join(';') }),Object.assign({ ibizbook: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizbook: keys.join(';') }),Object.assign({ ibizbook: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -698,8 +719,11 @@ export default class HasPanelListBase extends Vue implements ControlInterface {
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -709,8 +733,7 @@ export default class HasPanelListBase extends Vue implements ControlInterface {
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -737,6 +760,9 @@ export default class HasPanelListBase extends Vue implements ControlInterface {
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -767,8 +793,14 @@ export default class HasPanelListBase extends Vue implements ControlInterface {
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -823,6 +855,10 @@ export default class HasPanelListBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -830,6 +866,7 @@ export default class HasPanelListBase extends Vue implements ControlInterface {
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -528,7 +528,7 @@ export default class ListpanelBase extends Vue implements ControlInterface {
* @param {*} [arg={}]
* @memberof ListpanelBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr5ListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -547,17 +547,27 @@ export default class ListpanelBase extends Vue implements ControlInterface {
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -591,12 +601,16 @@ export default class ListpanelBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]);
}
}
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -671,21 +685,28 @@ export default class ListpanelBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizbook: keys.join(';') }),Object.assign({ ibizbook: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizbook: keys.join(';') }),Object.assign({ ibizbook: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -698,8 +719,11 @@ export default class ListpanelBase extends Vue implements ControlInterface {
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -709,8 +733,7 @@ export default class ListpanelBase extends Vue implements ControlInterface {
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -737,6 +760,9 @@ export default class ListpanelBase extends Vue implements ControlInterface {
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -767,8 +793,14 @@ export default class ListpanelBase extends Vue implements ControlInterface {
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -823,6 +855,10 @@ export default class ListpanelBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -830,6 +866,7 @@ export default class ListpanelBase extends Vue implements ControlInterface {
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -15,18 +15,18 @@ export default class ListpanelModel {
public getDataItems(): any[] {
return [
{
name: 'author',
prop: 'author',
name: 'subtext',
prop: 'subtext',
dataType: 'TEXT',
},
{
name: 'ibizbookid',
prop: 'ibizbookid',
dataType: 'GUID',
name: 'price',
prop: 'price',
dataType: 'FLOAT',
},
{
name: 'subtext',
prop: 'subtext',
name: 'press',
prop: 'press',
dataType: 'TEXT',
},
{
......@@ -35,19 +35,14 @@ export default class ListpanelModel {
dataType: 'INT',
},
{
name: 'ibizbookname',
prop: 'ibizbookname',
name: 'author',
prop: 'author',
dataType: 'TEXT',
},
{
name: 'icon',
prop: 'icon',
dataType: 'LONGTEXT',
},
{
name: 'press',
prop: 'press',
dataType: 'TEXT',
name: 'ibizbookid',
prop: 'ibizbookid',
dataType: 'GUID',
},
{
name: 'type',
......@@ -56,9 +51,14 @@ export default class ListpanelModel {
codelist:{tag:'BookType',codelistType:'STATIC'},
},
{
name: 'price',
prop: 'price',
dataType: 'FLOAT',
name: 'icon',
prop: 'icon',
dataType: 'LONGTEXT',
},
{
name: 'ibizbookname',
prop: 'ibizbookname',
dataType: 'TEXT',
},
{
name: 'srfkey',
......
......@@ -341,11 +341,11 @@ export default class ListpanelBase extends Vue implements ControlInterface {
static_label4:{ name: 'static_label4', type: 'ITEMLAYOUT', caption: '标签', isShowCaption: true, sysCss: '', itemType: 'RAWITEM', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'', layoutPos:'', layoutHeight:0, heightMode:'', layoutWidth:80, widthMode:'PX', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:-1, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container8', panel: this , viewType: 'DELISTVIEW', predefinedType: 'STATIC_LABEL', contentType: 'RAW', contentStyle: '', rawContent: '书籍描述:', htmlContent: '', renderMode: 'PARAGRAPH', wrapMode:'', vAlign:'', hAlign:'', },
field_text_dynamic4:{ name: 'field_text_dynamic4', type: 'ITEMLAYOUT', caption: '文本(动态)', isShowCaption: false, sysCss: '', itemType: 'FIELD', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'', layoutPos:'', layoutHeight:0, heightMode:'', layoutWidth:0, widthMode:'', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:-1, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container8', panel: this , required: false, fieldState: '0', predefinedType: 'FIELD_TEXT_DYNAMIC', renderMode: 'TEXT_DYNAMIC', dataItemName:'subtext', wrapMode:'', vAlign:'', hAlign:'', },
container8:{ name: 'container8', type: 'ITEMLAYOUT', caption: '容器', titleBarCloseMode: 0, isShowCaption: false, sysCss: '', itemType: 'CONTAINER', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'FLEX', layoutPos:'', layoutHeight:0, heightMode:'', layoutWidth:0, widthMode:'', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:-1, flexParams:{align:'',dir:'row',vAlign:''}, parentName: 'container1', panel: this , details:['static_label4','field_text_dynamic4'] , dataRegionType: 'INHERIT' },
field_text_dynamic5:{ name: 'field_text_dynamic5', type: 'ITEMLAYOUT', caption: '文本(动态)', isShowCaption: false, sysCss: '', itemType: 'FIELD', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'', layoutPos:'', layoutHeight:0, heightMode:'', layoutWidth:100, widthMode:'PX', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:-1, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container6', panel: this , required: false, fieldState: '0', predefinedType: 'FIELD_TEXT_DYNAMIC', renderMode: 'TEXT_DYNAMIC', dataItemName:'type', wrapMode:'', vAlign:'', hAlign:'', },
field_text_dynamic3:{ name: 'field_text_dynamic3', type: 'ITEMLAYOUT', caption: '文本(动态)', isShowCaption: false, sysCss: '', itemType: 'FIELD', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'', layoutPos:'', layoutHeight:0, heightMode:'', layoutWidth:100, widthMode:'PX', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:-1, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container6', panel: this , required: false, fieldState: '0', predefinedType: 'FIELD_TEXT_DYNAMIC', renderMode: 'TEXT_DYNAMIC', dataItemName:'press', wrapMode:'', vAlign:'', hAlign:'', },
field_text_dynamic6:{ name: 'field_text_dynamic6', type: 'ITEMLAYOUT', caption: '文本(动态)', isShowCaption: false, sysCss: '', itemType: 'FIELD', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'', layoutPos:'', layoutHeight:0, heightMode:'', layoutWidth:100, widthMode:'PX', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:-1, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container6', panel: this , required: false, fieldState: '0', predefinedType: 'FIELD_TEXT_DYNAMIC', renderMode: 'TEXT_DYNAMIC', dataItemName:'price', wrapMode:'', vAlign:'', hAlign:'', },
field_text_dynamic5:{ name: 'field_text_dynamic5', type: 'ITEMLAYOUT', caption: '文本(动态)', isShowCaption: false, sysCss: '', itemType: 'FIELD', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'', layoutPos:'', layoutHeight:0, heightMode:'', layoutWidth:40, widthMode:'PX', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:-1, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container6', panel: this , required: false, fieldState: '0', predefinedType: 'FIELD_TEXT_DYNAMIC', renderMode: 'TEXT_DYNAMIC', dataItemName:'type', wrapMode:'', vAlign:'', hAlign:'', },
field_text_dynamic3:{ name: 'field_text_dynamic3', type: 'ITEMLAYOUT', caption: '文本(动态)', isShowCaption: false, sysCss: '', itemType: 'FIELD', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'', layoutPos:'', layoutHeight:0, heightMode:'', layoutWidth:150, widthMode:'PX', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:-1, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container6', panel: this , required: false, fieldState: '0', predefinedType: 'FIELD_TEXT_DYNAMIC', renderMode: 'TEXT_DYNAMIC', dataItemName:'press', wrapMode:'', vAlign:'', hAlign:'', },
field_text_dynamic6:{ name: 'field_text_dynamic6', type: 'ITEMLAYOUT', caption: '文本(动态)', isShowCaption: false, sysCss: '', itemType: 'FIELD', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'', layoutPos:'', layoutHeight:0, heightMode:'', layoutWidth:50, widthMode:'PX', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:-1, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container6', panel: this , required: false, fieldState: '0', predefinedType: 'FIELD_TEXT_DYNAMIC', renderMode: 'TEXT_DYNAMIC', dataItemName:'price', wrapMode:'', vAlign:'', hAlign:'', },
button_calluilogic1:{ name: 'button_calluilogic1', type: 'ITEMLAYOUT', caption: '无处理按钮', isShowCaption: true, sysCss: '', itemType: 'BUTTON', itemStyle: 'INFO', visible: true, disabled: false, layout:'', layoutPos:'', layoutHeight:0, heightMode:'', layoutWidth:100, widthMode:'PX', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:-1, flexParams:{align:'',dir:'',vAlign:''}, parentName: 'container6', panel: this , xDataControlName: 'list', buttonStyle: 'INFO', borderStyle: '', iconAlign: '', renderMode: '', },
container6:{ name: 'container6', type: 'ITEMLAYOUT', caption: '容器', titleBarCloseMode: 0, isShowCaption: false, sysCss: '', itemType: 'CONTAINER', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'FLEX', layoutPos:'', layoutHeight:0, heightMode:'', layoutWidth:0, widthMode:'', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:-1, flexParams:{align:'center',dir:'row',vAlign:''}, parentName: 'container1', panel: this , details:['field_text_dynamic5','field_text_dynamic3','field_text_dynamic6','button_calluilogic1'] , dataRegionType: 'INHERIT' },
container6:{ name: 'container6', type: 'ITEMLAYOUT', caption: '容器', titleBarCloseMode: 0, isShowCaption: false, sysCss: '', itemType: 'CONTAINER', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'FLEX', layoutPos:'', layoutHeight:0, heightMode:'', layoutWidth:0, widthMode:'', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:-1, flexParams:{align:'',dir:'row',vAlign:''}, parentName: 'container1', panel: this , details:['field_text_dynamic5','field_text_dynamic3','field_text_dynamic6','button_calluilogic1'] , dataRegionType: 'INHERIT' },
container1:{ name: 'container1', type: 'ITEMLAYOUT', caption: '容器', titleBarCloseMode: 0, isShowCaption: false, sysCss: '', itemType: 'CONTAINER', itemStyle: 'DEFAULT', visible: true, disabled: false, layout:'FLEX', layoutPos:'', layoutHeight:0, heightMode:'', layoutWidth:0, widthMode:'', spacingBottom:'', spacingLeft:'', spacingRight:'', spacingTop:'', hAlignSelf:'', vAlignSelf:'', flexGrow:0, flexParams:{align:'',dir:'column',vAlign:''}, panel: this , details:['container4','container2','container7','container8','container6'] , dataRegionType: 'INHERIT' }
}
......
......@@ -838,7 +838,7 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac
* @param {*} [arg={}]
* @memberof LnternalFuncListBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr4ListView_layout' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -857,17 +857,27 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -901,12 +911,16 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac
this.handleClick(this.items[0]);
}
}
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -981,21 +995,28 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizbook: keys.join(';') }),Object.assign({ ibizbook: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizbook: keys.join(';') }),Object.assign({ ibizbook: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -1008,8 +1029,11 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -1019,8 +1043,7 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -1047,6 +1070,9 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -1077,8 +1103,14 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -1133,6 +1165,10 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -1140,6 +1176,7 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -604,7 +604,7 @@ export default class MajorStateListBase extends Vue implements ControlInterface
* @param {*} [arg={}]
* @memberof MajorStateListBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr3ListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -623,17 +623,27 @@ export default class MajorStateListBase extends Vue implements ControlInterface
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -667,12 +677,16 @@ export default class MajorStateListBase extends Vue implements ControlInterface
this.handleClick(this.items[0]);
}
}
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -747,21 +761,28 @@ export default class MajorStateListBase extends Vue implements ControlInterface
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizbook: keys.join(';') }),Object.assign({ ibizbook: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizbook: keys.join(';') }),Object.assign({ ibizbook: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -774,8 +795,11 @@ export default class MajorStateListBase extends Vue implements ControlInterface
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -785,8 +809,7 @@ export default class MajorStateListBase extends Vue implements ControlInterface
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -813,6 +836,9 @@ export default class MajorStateListBase extends Vue implements ControlInterface
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -843,8 +869,14 @@ export default class MajorStateListBase extends Vue implements ControlInterface
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -899,6 +931,10 @@ export default class MajorStateListBase extends Vue implements ControlInterface
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -906,6 +942,7 @@ export default class MajorStateListBase extends Vue implements ControlInterface
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -549,9 +549,14 @@ export default class TreeMajorStateBase extends Vue implements ControlInterface
// 处理多选数据
if(!this.isSingleSelect){
let leafNodes = checkedState.checkedNodes.filter((item:any) => item.leaf);
this.selectedNodes = JSON.parse(JSON.stringify(leafNodes));
const selectedNodes = JSON.parse(JSON.stringify(leafNodes));
this.handleCtrlEvents('onselectionchange', { action: 'SelectionChange', data: selectedNodes }).then((res: boolean) => {
if (res) {
this.selectedNodes = selectedNodes;
this.$emit('selectionchange', this.selectedNodes);
}
})
}
}
/**
......@@ -569,7 +574,11 @@ export default class TreeMajorStateBase extends Vue implements ControlInterface
return;
}
// 只处理最底层子节点
if(this.isBranchAvailable || data.leaf){
if(this.isBranchAvailable || data.leaf) {
this.handleCtrlEvents('onselectionchange', { action: 'SelectionChange', data: data }).then((res: boolean) => {
if (!res) {
return;
}
this.currentselectedNode = JSON.parse(JSON.stringify(data));
// 单选直接替换
if(this.isSingleSelect){
......@@ -577,6 +586,7 @@ export default class TreeMajorStateBase extends Vue implements ControlInterface
this.$emit('selectionchange', this.selectedNodes);
}
// 多选用check方法
});
}
}
......@@ -757,12 +767,26 @@ export default class TreeMajorStateBase extends Vue implements ControlInterface
Object.assign(tempContext,{srfparentkey:curNode.data.srfparentkey});
Object.assign(tempViewParams,{srfparentkey:curNode.data.srfparentkey});
}
Object.assign(params,{viewparams:tempViewParams});
Object.assign(params,{ viewparams: tempViewParams });
this.handleCtrlEvents('onbeforeload', { data: node.data }).then((beforeLoadResult: boolean) => {
if (!beforeLoadResult) {
return;
}
this.service.getNodes(tempContext,params).then((response: any) => {
if (!response || response.status !== 200) {
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadErrorResult: boolean) => {
if (!loadErrorResult) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
resolve([]);
return;
})
}
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadSuccessResult: boolean) => {
if (!loadSuccessResult) {
resolve([]);
return;
}
const _items = response.data;
this.formatExpanded(_items);
......@@ -771,13 +795,20 @@ export default class TreeMajorStateBase extends Vue implements ControlInterface
let isSelectedAll = node.checked;
this.setDefaultSelection(_items, isRoot, isSelectedAll);
this.$emit("load", _items);
});
}).catch((response: any) => {
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadErrorResult: boolean) => {
if (!loadErrorResult) {
return;
}
resolve([]);
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
});
});
})
}
/**
......@@ -817,14 +848,27 @@ export default class TreeMajorStateBase extends Vue implements ControlInterface
*/
public refresh_node(curContext:any,arg: any = {}, parentnode: boolean): void {
const { srfnodeid: id } = arg;
Object.assign(arg,{viewparams:this.viewparams});
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)),arg);
Object.assign(arg, { viewparams: this.viewparams });
this.handleCtrlEvents('onbeforerefreshnode', { data: arg }).then((beforeRefreshRes: boolean) => {
if (!beforeRefreshRes) {
return;
}
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)), arg);
get.then((response: any) => {
if (!response || response.status !== 200) {
this.handleCtrlEvents('onrefreshnodeerror', { data: response && response.data ? response.data : {} }).then((errorRes: boolean) => {
if (!errorRes) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
return;
})
}
const _items = [...response.data];
this.handleCtrlEvents('onrefreshnodesuccess', { data: _items }).then((successRes: boolean) => {
if (!successRes) {
return;
}
this.formatExpanded(_items);
const tree: any = this.$refs.tree;
tree.updateKeyChildren(id, _items);
......@@ -833,12 +877,19 @@ export default class TreeMajorStateBase extends Vue implements ControlInterface
}
this.$forceUpdate();
this.setDefaultSelection(_items);
})
}).catch((response: any) => {
this.handleCtrlEvents('onrefreshnodeerror', { data: response && response.data ? response.data : {} }).then((errorRes: boolean) => {
if (!errorRes) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
})
});
})
}
/**
......
......@@ -440,9 +440,14 @@ export default class TreeBase extends Vue implements ControlInterface {
// 处理多选数据
if(!this.isSingleSelect){
let leafNodes = checkedState.checkedNodes.filter((item:any) => item.leaf);
this.selectedNodes = JSON.parse(JSON.stringify(leafNodes));
const selectedNodes = JSON.parse(JSON.stringify(leafNodes));
this.handleCtrlEvents('onselectionchange', { action: 'SelectionChange', data: selectedNodes }).then((res: boolean) => {
if (res) {
this.selectedNodes = selectedNodes;
this.$emit('selectionchange', this.selectedNodes);
}
})
}
}
/**
......@@ -460,7 +465,11 @@ export default class TreeBase extends Vue implements ControlInterface {
return;
}
// 只处理最底层子节点
if(this.isBranchAvailable || data.leaf){
if(this.isBranchAvailable || data.leaf) {
this.handleCtrlEvents('onselectionchange', { action: 'SelectionChange', data: data }).then((res: boolean) => {
if (!res) {
return;
}
this.currentselectedNode = JSON.parse(JSON.stringify(data));
// 单选直接替换
if(this.isSingleSelect){
......@@ -468,6 +477,7 @@ export default class TreeBase extends Vue implements ControlInterface {
this.$emit('selectionchange', this.selectedNodes);
}
// 多选用check方法
});
}
}
......@@ -648,12 +658,26 @@ export default class TreeBase extends Vue implements ControlInterface {
Object.assign(tempContext,{srfparentkey:curNode.data.srfparentkey});
Object.assign(tempViewParams,{srfparentkey:curNode.data.srfparentkey});
}
Object.assign(params,{viewparams:tempViewParams});
Object.assign(params,{ viewparams: tempViewParams });
this.handleCtrlEvents('onbeforeload', { data: node.data }).then((beforeLoadResult: boolean) => {
if (!beforeLoadResult) {
return;
}
this.service.getNodes(tempContext,params).then((response: any) => {
if (!response || response.status !== 200) {
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadErrorResult: boolean) => {
if (!loadErrorResult) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
resolve([]);
return;
})
}
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadSuccessResult: boolean) => {
if (!loadSuccessResult) {
resolve([]);
return;
}
const _items = response.data;
this.formatExpanded(_items);
......@@ -662,13 +686,20 @@ export default class TreeBase extends Vue implements ControlInterface {
let isSelectedAll = node.checked;
this.setDefaultSelection(_items, isRoot, isSelectedAll);
this.$emit("load", _items);
});
}).catch((response: any) => {
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadErrorResult: boolean) => {
if (!loadErrorResult) {
return;
}
resolve([]);
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
});
});
})
}
/**
......@@ -708,14 +739,27 @@ export default class TreeBase extends Vue implements ControlInterface {
*/
public refresh_node(curContext:any,arg: any = {}, parentnode: boolean): void {
const { srfnodeid: id } = arg;
Object.assign(arg,{viewparams:this.viewparams});
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)),arg);
Object.assign(arg, { viewparams: this.viewparams });
this.handleCtrlEvents('onbeforerefreshnode', { data: arg }).then((beforeRefreshRes: boolean) => {
if (!beforeRefreshRes) {
return;
}
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)), arg);
get.then((response: any) => {
if (!response || response.status !== 200) {
this.handleCtrlEvents('onrefreshnodeerror', { data: response && response.data ? response.data : {} }).then((errorRes: boolean) => {
if (!errorRes) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
return;
})
}
const _items = [...response.data];
this.handleCtrlEvents('onrefreshnodesuccess', { data: _items }).then((successRes: boolean) => {
if (!successRes) {
return;
}
this.formatExpanded(_items);
const tree: any = this.$refs.tree;
tree.updateKeyChildren(id, _items);
......@@ -724,12 +768,19 @@ export default class TreeBase extends Vue implements ControlInterface {
}
this.$forceUpdate();
this.setDefaultSelection(_items);
})
}).catch((response: any) => {
this.handleCtrlEvents('onrefreshnodeerror', { data: response && response.data ? response.data : {} }).then((errorRes: boolean) => {
if (!errorRes) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
})
});
})
}
/**
......
......@@ -627,7 +627,7 @@ export default class UsrBase extends Vue implements ControlInterface {
* @param {*} [arg={}]
* @memberof UsrBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr2ListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -646,17 +646,27 @@ export default class UsrBase extends Vue implements ControlInterface {
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -690,12 +700,16 @@ export default class UsrBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]);
}
}
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -770,21 +784,28 @@ export default class UsrBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizbook: keys.join(';') }),Object.assign({ ibizbook: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizbook: keys.join(';') }),Object.assign({ ibizbook: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -797,8 +818,11 @@ export default class UsrBase extends Vue implements ControlInterface {
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -808,8 +832,7 @@ export default class UsrBase extends Vue implements ControlInterface {
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -836,6 +859,9 @@ export default class UsrBase extends Vue implements ControlInterface {
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -866,8 +892,14 @@ export default class UsrBase extends Vue implements ControlInterface {
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -922,6 +954,10 @@ export default class UsrBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -929,6 +965,7 @@ export default class UsrBase extends Vue implements ControlInterface {
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -440,9 +440,14 @@ export default class UsrBase extends Vue implements ControlInterface {
// 处理多选数据
if(!this.isSingleSelect){
let leafNodes = checkedState.checkedNodes.filter((item:any) => item.leaf);
this.selectedNodes = JSON.parse(JSON.stringify(leafNodes));
const selectedNodes = JSON.parse(JSON.stringify(leafNodes));
this.handleCtrlEvents('onselectionchange', { action: 'SelectionChange', data: selectedNodes }).then((res: boolean) => {
if (res) {
this.selectedNodes = selectedNodes;
this.$emit('selectionchange', this.selectedNodes);
}
})
}
}
/**
......@@ -460,7 +465,11 @@ export default class UsrBase extends Vue implements ControlInterface {
return;
}
// 只处理最底层子节点
if(this.isBranchAvailable || data.leaf){
if(this.isBranchAvailable || data.leaf) {
this.handleCtrlEvents('onselectionchange', { action: 'SelectionChange', data: data }).then((res: boolean) => {
if (!res) {
return;
}
this.currentselectedNode = JSON.parse(JSON.stringify(data));
// 单选直接替换
if(this.isSingleSelect){
......@@ -468,6 +477,7 @@ export default class UsrBase extends Vue implements ControlInterface {
this.$emit('selectionchange', this.selectedNodes);
}
// 多选用check方法
});
}
}
......@@ -648,12 +658,26 @@ export default class UsrBase extends Vue implements ControlInterface {
Object.assign(tempContext,{srfparentkey:curNode.data.srfparentkey});
Object.assign(tempViewParams,{srfparentkey:curNode.data.srfparentkey});
}
Object.assign(params,{viewparams:tempViewParams});
Object.assign(params,{ viewparams: tempViewParams });
this.handleCtrlEvents('onbeforeload', { data: node.data }).then((beforeLoadResult: boolean) => {
if (!beforeLoadResult) {
return;
}
this.service.getNodes(tempContext,params).then((response: any) => {
if (!response || response.status !== 200) {
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadErrorResult: boolean) => {
if (!loadErrorResult) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
resolve([]);
return;
})
}
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadSuccessResult: boolean) => {
if (!loadSuccessResult) {
resolve([]);
return;
}
const _items = response.data;
this.formatExpanded(_items);
......@@ -662,13 +686,20 @@ export default class UsrBase extends Vue implements ControlInterface {
let isSelectedAll = node.checked;
this.setDefaultSelection(_items, isRoot, isSelectedAll);
this.$emit("load", _items);
});
}).catch((response: any) => {
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadErrorResult: boolean) => {
if (!loadErrorResult) {
return;
}
resolve([]);
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
});
});
})
}
/**
......@@ -708,14 +739,27 @@ export default class UsrBase extends Vue implements ControlInterface {
*/
public refresh_node(curContext:any,arg: any = {}, parentnode: boolean): void {
const { srfnodeid: id } = arg;
Object.assign(arg,{viewparams:this.viewparams});
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)),arg);
Object.assign(arg, { viewparams: this.viewparams });
this.handleCtrlEvents('onbeforerefreshnode', { data: arg }).then((beforeRefreshRes: boolean) => {
if (!beforeRefreshRes) {
return;
}
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)), arg);
get.then((response: any) => {
if (!response || response.status !== 200) {
this.handleCtrlEvents('onrefreshnodeerror', { data: response && response.data ? response.data : {} }).then((errorRes: boolean) => {
if (!errorRes) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
return;
})
}
const _items = [...response.data];
this.handleCtrlEvents('onrefreshnodesuccess', { data: _items }).then((successRes: boolean) => {
if (!successRes) {
return;
}
this.formatExpanded(_items);
const tree: any = this.$refs.tree;
tree.updateKeyChildren(id, _items);
......@@ -724,12 +768,19 @@ export default class UsrBase extends Vue implements ControlInterface {
}
this.$forceUpdate();
this.setDefaultSelection(_items);
})
}).catch((response: any) => {
this.handleCtrlEvents('onrefreshnodeerror', { data: response && response.data ? response.data : {} }).then((errorRes: boolean) => {
if (!errorRes) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
})
});
})
}
/**
......
......@@ -548,7 +548,7 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac
* @param {*} [arg={}]
* @memberof OrderDetailsListBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDetailListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -567,17 +567,27 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -611,12 +621,16 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac
this.handleClick(this.items[0]);
}
}
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -691,21 +705,28 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizorderdetail: keys.join(';') }),Object.assign({ ibizorderdetail: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizorderdetail: keys.join(';') }),Object.assign({ ibizorderdetail: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -718,8 +739,11 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -729,8 +753,7 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -757,6 +780,9 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -787,8 +813,14 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -843,6 +875,10 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -850,6 +886,7 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -507,7 +507,7 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa
* @param {*} [arg={}]
* @memberof OrderDetailsMoneyBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDashboardView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -526,17 +526,27 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -570,12 +580,16 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa
this.handleClick(this.items[0]);
}
}
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -650,21 +664,28 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizorderdetail: keys.join(';') }),Object.assign({ ibizorderdetail: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizorderdetail: keys.join(';') }),Object.assign({ ibizorderdetail: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -677,8 +698,11 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -688,8 +712,7 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -716,6 +739,9 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -746,8 +772,14 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -802,6 +834,10 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -809,6 +845,7 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -507,7 +507,7 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa
* @param {*} [arg={}]
* @memberof OrderDetailsTotalBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDashboardView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -526,17 +526,27 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -570,12 +580,16 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa
this.handleClick(this.items[0]);
}
}
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -650,21 +664,28 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizorderdetail: keys.join(';') }),Object.assign({ ibizorderdetail: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizorderdetail: keys.join(';') }),Object.assign({ ibizorderdetail: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -677,8 +698,11 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -688,8 +712,7 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -716,6 +739,9 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -746,8 +772,14 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -802,6 +834,10 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -809,6 +845,7 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -508,7 +508,7 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac
* @param {*} [arg={}]
* @memberof OrderDetailsTypeBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDashboardView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -527,17 +527,27 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -571,12 +581,16 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac
this.handleClick(this.items[0]);
}
}
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -651,21 +665,28 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizorderdetail: keys.join(';') }),Object.assign({ ibizorderdetail: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizorderdetail: keys.join(';') }),Object.assign({ ibizorderdetail: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -678,8 +699,11 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -689,8 +713,7 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -717,6 +740,9 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -747,8 +773,14 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -803,6 +835,10 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -810,6 +846,7 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -715,7 +715,7 @@ export default class CardNavigationBase extends Vue implements ControlInterface
*/
public load(opt: any = {}, isReset: boolean = false): void {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDataViewExpView' + (this.$t('app.list.notConfig.fetchAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDataViewExpView_layout' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
}
const arg: any = {...opt};
......@@ -794,7 +794,7 @@ export default class CardNavigationBase extends Vue implements ControlInterface
*/
public async remove(datas: any[]): Promise<any> {
if(!this.removeAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDataViewExpView' + (this.$t('app.gridpage.notConfig.removeAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDataViewExpView_layout' + (this.$t('app.gridpage.notConfig.removeAction') as string) });
return;
}
let _datas:any[] = [];
......@@ -903,7 +903,7 @@ export default class CardNavigationBase extends Vue implements ControlInterface
try {
if(Object.is(item.rowDataState, 'create')){
if(!this.createAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDataViewExpView' + (this.$t('app.list.notConfig.createAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDataViewExpView_layout' + (this.$t('app.list.notConfig.createAction') as string) });
}else{
Object.assign(item,{viewparams:this.viewparams});
let response = await this.service.add(this.createAction, JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator);
......@@ -911,7 +911,7 @@ export default class CardNavigationBase extends Vue implements ControlInterface
}
}else if(Object.is(item.rowDataState, 'update')){
if(!this.updateAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDataViewExpView' + (this.$t('app.list.notConfig.updateAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDataViewExpView_layout' + (this.$t('app.list.notConfig.updateAction') as string) });
}else{
Object.assign(item,{viewparams:this.viewparams});
if(item.ibizorder){
......
......@@ -578,7 +578,7 @@ export default class ListExpBase extends Vue implements ControlInterface {
* @param {*} [arg={}]
* @memberof ListExpBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderListExpView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -597,17 +597,27 @@ export default class ListExpBase extends Vue implements ControlInterface {
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -641,12 +651,16 @@ export default class ListExpBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]);
}
}
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -721,21 +735,28 @@ export default class ListExpBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizorder: keys.join(';') }),Object.assign({ ibizorder: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizorder: keys.join(';') }),Object.assign({ ibizorder: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -748,8 +769,11 @@ export default class ListExpBase extends Vue implements ControlInterface {
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -759,8 +783,7 @@ export default class ListExpBase extends Vue implements ControlInterface {
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -787,6 +810,9 @@ export default class ListExpBase extends Vue implements ControlInterface {
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -817,8 +843,14 @@ export default class ListExpBase extends Vue implements ControlInterface {
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -873,6 +905,10 @@ export default class ListExpBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -880,6 +916,7 @@ export default class ListExpBase extends Vue implements ControlInterface {
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -299,7 +299,7 @@ export default class MainBase extends Vue implements ControlInterface {
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBIZOrderPickupGridViewBase
* @memberof IBIZOrderSF1GridViewBase
*/
public Edit(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
if (args.length === 0) {
......@@ -441,6 +441,20 @@ export default class MainBase extends Vue implements ControlInterface {
return this.selections[0];
}
/**
* 打开新建数据视图
*
* @type {any}
* @memberof MainBase
*/
@Prop() public newdata: any;
/**
* 打开编辑数据视图
*
* @type {any}
* @memberof MainBase
*/
@Prop() public opendata: any;
/**
* 是否嵌入关系界面
......@@ -975,7 +989,7 @@ export default class MainBase extends Vue implements ControlInterface {
if (!this.fetchAction) {
this.$Notice.error({
title: this.$t("app.commonWords.wrong") as string,
desc: "IBIZOrderPickupGridView" + (this.$t("app.gridpage.notConfig.fetchAction") as string),
desc: "IBIZOrderSF1GridView" + (this.$t("app.gridpage.notConfig.fetchAction") as string),
});
return;
}
......@@ -1104,7 +1118,7 @@ export default class MainBase extends Vue implements ControlInterface {
if (!this.removeAction) {
this.$Notice.error({
title: (this.$t('app.commonWords.wrong') as string),
desc: 'IBIZOrderPickupGridView' + (this.$t('app.gridpage.notConfig.removeAction') as string)
desc: 'IBIZOrderSF1GridView' + (this.$t('app.gridpage.notConfig.removeAction') as string)
});
return;
}
......@@ -1218,7 +1232,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public addBatch(arg: any = {}): void {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderPickupGridView'+(this.$t('app.gridpage.notConfig.fetchAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderSF1GridView'+(this.$t('app.gridpage.notConfig.fetchAction') as string) });
return;
}
if(!arg){
......@@ -2149,7 +2163,7 @@ export default class MainBase extends Vue implements ControlInterface {
try {
if (Object.is(item.rowDataState, 'create')) {
if (!this.createAction) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderPickupGridView'+(this.$t('app.gridpage.notConfig.createAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderSF1GridView'+(this.$t('app.gridpage.notConfig.createAction') as string) });
} else {
Object.assign(item, { viewparams: this.viewparams });
const tempContext = Util.deepCopy(this.context);
......@@ -2158,7 +2172,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
}else if (Object.is(item.rowDataState, 'update')){
if (!this.updateAction) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderPickupGridView'+(this.$t('app.gridpage.notConfig.updateAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderSF1GridView'+(this.$t('app.gridpage.notConfig.updateAction') as string) });
} else {
Object.assign(item, { viewparams: this.viewparams });
const tempContext = Util.deepCopy(this.context);
......@@ -2234,7 +2248,7 @@ export default class MainBase extends Vue implements ControlInterface {
if(!this.loaddraftAction){
this.$Notice.error({
title: (this.$t('app.commonWords.wrong') as string),
desc: 'IBIZOrderPickupGridView' + (this.$t('app.gridpage.notConfig.loaddraftAction') as string)
desc: 'IBIZOrderSF1GridView' + (this.$t('app.gridpage.notConfig.loaddraftAction') as string)
});
return;
}
......
......@@ -104,6 +104,21 @@ export default class MainModel {
prop: 'n_ibizordername_like',
dataType: 'QUERYPARAM'
},
{
name: 'n_orderstate_eq',
prop: 'n_orderstate_eq',
dataType: 'QUERYPARAM'
},
{
name: 'n_ordertime_gt',
prop: 'n_ordertime_gt',
dataType: 'QUERYPARAM'
},
{
name: 'n_ordertime_lt',
prop: 'n_ordertime_lt',
dataType: 'QUERYPARAM'
},
{
name:'size',
......
......@@ -470,9 +470,14 @@ export default class TreeExpBase extends Vue implements ControlInterface {
// 处理多选数据
if(!this.isSingleSelect){
let leafNodes = checkedState.checkedNodes.filter((item:any) => item.leaf);
this.selectedNodes = JSON.parse(JSON.stringify(leafNodes));
const selectedNodes = JSON.parse(JSON.stringify(leafNodes));
this.handleCtrlEvents('onselectionchange', { action: 'SelectionChange', data: selectedNodes }).then((res: boolean) => {
if (res) {
this.selectedNodes = selectedNodes;
this.$emit('selectionchange', this.selectedNodes);
}
})
}
}
/**
......@@ -490,7 +495,11 @@ export default class TreeExpBase extends Vue implements ControlInterface {
return;
}
// 只处理最底层子节点
if(this.isBranchAvailable || data.leaf){
if(this.isBranchAvailable || data.leaf) {
this.handleCtrlEvents('onselectionchange', { action: 'SelectionChange', data: data }).then((res: boolean) => {
if (!res) {
return;
}
this.currentselectedNode = JSON.parse(JSON.stringify(data));
// 单选直接替换
if(this.isSingleSelect){
......@@ -498,6 +507,7 @@ export default class TreeExpBase extends Vue implements ControlInterface {
this.$emit('selectionchange', this.selectedNodes);
}
// 多选用check方法
});
}
}
......@@ -678,12 +688,26 @@ export default class TreeExpBase extends Vue implements ControlInterface {
Object.assign(tempContext,{srfparentkey:curNode.data.srfparentkey});
Object.assign(tempViewParams,{srfparentkey:curNode.data.srfparentkey});
}
Object.assign(params,{viewparams:tempViewParams});
Object.assign(params,{ viewparams: tempViewParams });
this.handleCtrlEvents('onbeforeload', { data: node.data }).then((beforeLoadResult: boolean) => {
if (!beforeLoadResult) {
return;
}
this.service.getNodes(tempContext,params).then((response: any) => {
if (!response || response.status !== 200) {
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadErrorResult: boolean) => {
if (!loadErrorResult) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
resolve([]);
return;
})
}
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadSuccessResult: boolean) => {
if (!loadSuccessResult) {
resolve([]);
return;
}
const _items = response.data;
this.formatExpanded(_items);
......@@ -692,13 +716,20 @@ export default class TreeExpBase extends Vue implements ControlInterface {
let isSelectedAll = node.checked;
this.setDefaultSelection(_items, isRoot, isSelectedAll);
this.$emit("load", _items);
});
}).catch((response: any) => {
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadErrorResult: boolean) => {
if (!loadErrorResult) {
return;
}
resolve([]);
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
});
});
})
}
/**
......@@ -738,14 +769,27 @@ export default class TreeExpBase extends Vue implements ControlInterface {
*/
public refresh_node(curContext:any,arg: any = {}, parentnode: boolean): void {
const { srfnodeid: id } = arg;
Object.assign(arg,{viewparams:this.viewparams});
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)),arg);
Object.assign(arg, { viewparams: this.viewparams });
this.handleCtrlEvents('onbeforerefreshnode', { data: arg }).then((beforeRefreshRes: boolean) => {
if (!beforeRefreshRes) {
return;
}
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)), arg);
get.then((response: any) => {
if (!response || response.status !== 200) {
this.handleCtrlEvents('onrefreshnodeerror', { data: response && response.data ? response.data : {} }).then((errorRes: boolean) => {
if (!errorRes) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
return;
})
}
const _items = [...response.data];
this.handleCtrlEvents('onrefreshnodesuccess', { data: _items }).then((successRes: boolean) => {
if (!successRes) {
return;
}
this.formatExpanded(_items);
const tree: any = this.$refs.treeexpbar_tree;
tree.updateKeyChildren(id, _items);
......@@ -754,12 +798,19 @@ export default class TreeExpBase extends Vue implements ControlInterface {
}
this.$forceUpdate();
this.setDefaultSelection(_items);
})
}).catch((response: any) => {
this.handleCtrlEvents('onrefreshnodeerror', { data: response && response.data ? response.data : {} }).then((errorRes: boolean) => {
if (!errorRes) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
})
});
})
}
/**
......
......@@ -534,7 +534,7 @@ export default class UsrBase extends Vue implements ControlInterface {
* @param {*} [arg={}]
* @memberof UsrBase
*/
public load(opt: any = {}): void {
public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'AppPortletContainerView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
......@@ -553,17 +553,27 @@ export default class UsrBase extends Vue implements ControlInterface {
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
}
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction, this.context?JSON.parse(JSON.stringify(this.context)):{}, arg, this.showBusyIndicator);
post.then((response: any) => {
Object.assign(arg, { viewparams: tempViewParams });
const tempContext: any = Util.deepCopy(this.context);
if (!(await this.handleCtrlEvents('onbeforeload', { data: arg }))) {
return false;
}
try {
const response: any = await this.service.search(this.fetchAction, tempContext, arg, this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
}
return response;
}
if (!(await this.handleCtrlEvents('onloadsuccess', { data: response.data }))) {
return;
}
const data: any = response.data;
......@@ -597,12 +607,16 @@ export default class UsrBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]);
}
}
}, (response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" });
});
}
}
/**
......@@ -677,21 +691,28 @@ export default class UsrBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
}
const removeData = () => {
const removeData = async () => {
let keys: any[] = [];
datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizorder: keys.join(';') }),Object.assign({ ibizorder: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return;
}
try {
const response: any = await this.service.delete(_removeAction,Object.assign(context,{ ibizorder: keys.join(';') }),Object.assign({ ibizorder: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
if (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
} else {
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return;
}
//删除items中已删除的项
datas.forEach((data: any) => {
......@@ -704,8 +725,11 @@ export default class UsrBase extends Vue implements ControlInterface {
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
......@@ -715,8 +739,7 @@ export default class UsrBase extends Vue implements ControlInterface {
return;
}
reject(response);
});
});
}
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
......@@ -743,6 +766,9 @@ export default class UsrBase extends Vue implements ControlInterface {
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
......@@ -773,8 +799,14 @@ export default class UsrBase extends Vue implements ControlInterface {
this.$emit('save', successItems);
this.refresh();
if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
} else {
if (!(await this.handleCtrlEvents('onsaveerror', { data: successItems }))) {
return;
}
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+ (this.$t('app.commonWords.saveFailed') as string) + '!' });
console.error(errorMessage[index]);
......@@ -829,6 +861,10 @@ export default class UsrBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
......@@ -836,6 +872,7 @@ export default class UsrBase extends Vue implements ControlInterface {
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -470,9 +470,14 @@ export default class Tree01Base extends Vue implements ControlInterface {
// 处理多选数据
if(!this.isSingleSelect){
let leafNodes = checkedState.checkedNodes.filter((item:any) => item.leaf);
this.selectedNodes = JSON.parse(JSON.stringify(leafNodes));
const selectedNodes = JSON.parse(JSON.stringify(leafNodes));
this.handleCtrlEvents('onselectionchange', { action: 'SelectionChange', data: selectedNodes }).then((res: boolean) => {
if (res) {
this.selectedNodes = selectedNodes;
this.$emit('selectionchange', this.selectedNodes);
}
})
}
}
/**
......@@ -490,7 +495,11 @@ export default class Tree01Base extends Vue implements ControlInterface {
return;
}
// 只处理最底层子节点
if(this.isBranchAvailable || data.leaf){
if(this.isBranchAvailable || data.leaf) {
this.handleCtrlEvents('onselectionchange', { action: 'SelectionChange', data: data }).then((res: boolean) => {
if (!res) {
return;
}
this.currentselectedNode = JSON.parse(JSON.stringify(data));
// 单选直接替换
if(this.isSingleSelect){
......@@ -498,6 +507,7 @@ export default class Tree01Base extends Vue implements ControlInterface {
this.$emit('selectionchange', this.selectedNodes);
}
// 多选用check方法
});
}
}
......@@ -678,12 +688,26 @@ export default class Tree01Base extends Vue implements ControlInterface {
Object.assign(tempContext,{srfparentkey:curNode.data.srfparentkey});
Object.assign(tempViewParams,{srfparentkey:curNode.data.srfparentkey});
}
Object.assign(params,{viewparams:tempViewParams});
Object.assign(params,{ viewparams: tempViewParams });
this.handleCtrlEvents('onbeforeload', { data: node.data }).then((beforeLoadResult: boolean) => {
if (!beforeLoadResult) {
return;
}
this.service.getNodes(tempContext,params).then((response: any) => {
if (!response || response.status !== 200) {
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadErrorResult: boolean) => {
if (!loadErrorResult) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
resolve([]);
return;
})
}
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadSuccessResult: boolean) => {
if (!loadSuccessResult) {
resolve([]);
return;
}
const _items = response.data;
this.formatExpanded(_items);
......@@ -692,13 +716,20 @@ export default class Tree01Base extends Vue implements ControlInterface {
let isSelectedAll = node.checked;
this.setDefaultSelection(_items, isRoot, isSelectedAll);
this.$emit("load", _items);
});
}).catch((response: any) => {
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadErrorResult: boolean) => {
if (!loadErrorResult) {
return;
}
resolve([]);
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
});
});
})
}
/**
......@@ -738,14 +769,27 @@ export default class Tree01Base extends Vue implements ControlInterface {
*/
public refresh_node(curContext:any,arg: any = {}, parentnode: boolean): void {
const { srfnodeid: id } = arg;
Object.assign(arg,{viewparams:this.viewparams});
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)),arg);
Object.assign(arg, { viewparams: this.viewparams });
this.handleCtrlEvents('onbeforerefreshnode', { data: arg }).then((beforeRefreshRes: boolean) => {
if (!beforeRefreshRes) {
return;
}
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)), arg);
get.then((response: any) => {
if (!response || response.status !== 200) {
this.handleCtrlEvents('onrefreshnodeerror', { data: response && response.data ? response.data : {} }).then((errorRes: boolean) => {
if (!errorRes) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
return;
})
}
const _items = [...response.data];
this.handleCtrlEvents('onrefreshnodesuccess', { data: _items }).then((successRes: boolean) => {
if (!successRes) {
return;
}
this.formatExpanded(_items);
const tree: any = this.$refs.treeexpbar_tree;
tree.updateKeyChildren(id, _items);
......@@ -754,12 +798,19 @@ export default class Tree01Base extends Vue implements ControlInterface {
}
this.$forceUpdate();
this.setDefaultSelection(_items);
})
}).catch((response: any) => {
this.handleCtrlEvents('onrefreshnodeerror', { data: response && response.data ? response.data : {} }).then((errorRes: boolean) => {
if (!errorRes) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
})
});
})
}
/**
......
......@@ -470,9 +470,14 @@ export default class Tree02Base extends Vue implements ControlInterface {
// 处理多选数据
if(!this.isSingleSelect){
let leafNodes = checkedState.checkedNodes.filter((item:any) => item.leaf);
this.selectedNodes = JSON.parse(JSON.stringify(leafNodes));
const selectedNodes = JSON.parse(JSON.stringify(leafNodes));
this.handleCtrlEvents('onselectionchange', { action: 'SelectionChange', data: selectedNodes }).then((res: boolean) => {
if (res) {
this.selectedNodes = selectedNodes;
this.$emit('selectionchange', this.selectedNodes);
}
})
}
}
/**
......@@ -490,7 +495,11 @@ export default class Tree02Base extends Vue implements ControlInterface {
return;
}
// 只处理最底层子节点
if(this.isBranchAvailable || data.leaf){
if(this.isBranchAvailable || data.leaf) {
this.handleCtrlEvents('onselectionchange', { action: 'SelectionChange', data: data }).then((res: boolean) => {
if (!res) {
return;
}
this.currentselectedNode = JSON.parse(JSON.stringify(data));
// 单选直接替换
if(this.isSingleSelect){
......@@ -498,6 +507,7 @@ export default class Tree02Base extends Vue implements ControlInterface {
this.$emit('selectionchange', this.selectedNodes);
}
// 多选用check方法
});
}
}
......@@ -678,12 +688,26 @@ export default class Tree02Base extends Vue implements ControlInterface {
Object.assign(tempContext,{srfparentkey:curNode.data.srfparentkey});
Object.assign(tempViewParams,{srfparentkey:curNode.data.srfparentkey});
}
Object.assign(params,{viewparams:tempViewParams});
Object.assign(params,{ viewparams: tempViewParams });
this.handleCtrlEvents('onbeforeload', { data: node.data }).then((beforeLoadResult: boolean) => {
if (!beforeLoadResult) {
return;
}
this.service.getNodes(tempContext,params).then((response: any) => {
if (!response || response.status !== 200) {
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadErrorResult: boolean) => {
if (!loadErrorResult) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
resolve([]);
return;
})
}
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadSuccessResult: boolean) => {
if (!loadSuccessResult) {
resolve([]);
return;
}
const _items = response.data;
this.formatExpanded(_items);
......@@ -692,13 +716,20 @@ export default class Tree02Base extends Vue implements ControlInterface {
let isSelectedAll = node.checked;
this.setDefaultSelection(_items, isRoot, isSelectedAll);
this.$emit("load", _items);
});
}).catch((response: any) => {
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadErrorResult: boolean) => {
if (!loadErrorResult) {
return;
}
resolve([]);
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
});
});
})
}
/**
......@@ -738,14 +769,27 @@ export default class Tree02Base extends Vue implements ControlInterface {
*/
public refresh_node(curContext:any,arg: any = {}, parentnode: boolean): void {
const { srfnodeid: id } = arg;
Object.assign(arg,{viewparams:this.viewparams});
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)),arg);
Object.assign(arg, { viewparams: this.viewparams });
this.handleCtrlEvents('onbeforerefreshnode', { data: arg }).then((beforeRefreshRes: boolean) => {
if (!beforeRefreshRes) {
return;
}
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)), arg);
get.then((response: any) => {
if (!response || response.status !== 200) {
this.handleCtrlEvents('onrefreshnodeerror', { data: response && response.data ? response.data : {} }).then((errorRes: boolean) => {
if (!errorRes) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
return;
})
}
const _items = [...response.data];
this.handleCtrlEvents('onrefreshnodesuccess', { data: _items }).then((successRes: boolean) => {
if (!successRes) {
return;
}
this.formatExpanded(_items);
const tree: any = this.$refs.treeexpbar_tree;
tree.updateKeyChildren(id, _items);
......@@ -754,12 +798,19 @@ export default class Tree02Base extends Vue implements ControlInterface {
}
this.$forceUpdate();
this.setDefaultSelection(_items);
})
}).catch((response: any) => {
this.handleCtrlEvents('onrefreshnodeerror', { data: response && response.data ? response.data : {} }).then((errorRes: boolean) => {
if (!errorRes) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
})
});
})
}
/**
......
......@@ -470,9 +470,14 @@ export default class Tree03Base extends Vue implements ControlInterface {
// 处理多选数据
if(!this.isSingleSelect){
let leafNodes = checkedState.checkedNodes.filter((item:any) => item.leaf);
this.selectedNodes = JSON.parse(JSON.stringify(leafNodes));
const selectedNodes = JSON.parse(JSON.stringify(leafNodes));
this.handleCtrlEvents('onselectionchange', { action: 'SelectionChange', data: selectedNodes }).then((res: boolean) => {
if (res) {
this.selectedNodes = selectedNodes;
this.$emit('selectionchange', this.selectedNodes);
}
})
}
}
/**
......@@ -490,7 +495,11 @@ export default class Tree03Base extends Vue implements ControlInterface {
return;
}
// 只处理最底层子节点
if(this.isBranchAvailable || data.leaf){
if(this.isBranchAvailable || data.leaf) {
this.handleCtrlEvents('onselectionchange', { action: 'SelectionChange', data: data }).then((res: boolean) => {
if (!res) {
return;
}
this.currentselectedNode = JSON.parse(JSON.stringify(data));
// 单选直接替换
if(this.isSingleSelect){
......@@ -498,6 +507,7 @@ export default class Tree03Base extends Vue implements ControlInterface {
this.$emit('selectionchange', this.selectedNodes);
}
// 多选用check方法
});
}
}
......@@ -678,12 +688,26 @@ export default class Tree03Base extends Vue implements ControlInterface {
Object.assign(tempContext,{srfparentkey:curNode.data.srfparentkey});
Object.assign(tempViewParams,{srfparentkey:curNode.data.srfparentkey});
}
Object.assign(params,{viewparams:tempViewParams});
Object.assign(params,{ viewparams: tempViewParams });
this.handleCtrlEvents('onbeforeload', { data: node.data }).then((beforeLoadResult: boolean) => {
if (!beforeLoadResult) {
return;
}
this.service.getNodes(tempContext,params).then((response: any) => {
if (!response || response.status !== 200) {
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadErrorResult: boolean) => {
if (!loadErrorResult) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
resolve([]);
return;
})
}
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadSuccessResult: boolean) => {
if (!loadSuccessResult) {
resolve([]);
return;
}
const _items = response.data;
this.formatExpanded(_items);
......@@ -692,13 +716,20 @@ export default class Tree03Base extends Vue implements ControlInterface {
let isSelectedAll = node.checked;
this.setDefaultSelection(_items, isRoot, isSelectedAll);
this.$emit("load", _items);
});
}).catch((response: any) => {
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadErrorResult: boolean) => {
if (!loadErrorResult) {
return;
}
resolve([]);
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
});
});
})
}
/**
......@@ -738,14 +769,27 @@ export default class Tree03Base extends Vue implements ControlInterface {
*/
public refresh_node(curContext:any,arg: any = {}, parentnode: boolean): void {
const { srfnodeid: id } = arg;
Object.assign(arg,{viewparams:this.viewparams});
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)),arg);
Object.assign(arg, { viewparams: this.viewparams });
this.handleCtrlEvents('onbeforerefreshnode', { data: arg }).then((beforeRefreshRes: boolean) => {
if (!beforeRefreshRes) {
return;
}
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)), arg);
get.then((response: any) => {
if (!response || response.status !== 200) {
this.handleCtrlEvents('onrefreshnodeerror', { data: response && response.data ? response.data : {} }).then((errorRes: boolean) => {
if (!errorRes) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
return;
})
}
const _items = [...response.data];
this.handleCtrlEvents('onrefreshnodesuccess', { data: _items }).then((successRes: boolean) => {
if (!successRes) {
return;
}
this.formatExpanded(_items);
const tree: any = this.$refs.treeexpbar_tree;
tree.updateKeyChildren(id, _items);
......@@ -754,12 +798,19 @@ export default class Tree03Base extends Vue implements ControlInterface {
}
this.$forceUpdate();
this.setDefaultSelection(_items);
})
}).catch((response: any) => {
this.handleCtrlEvents('onrefreshnodeerror', { data: response && response.data ? response.data : {} }).then((errorRes: boolean) => {
if (!errorRes) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
})
});
})
}
/**
......
......@@ -537,9 +537,14 @@ export default class Tree04Base extends Vue implements ControlInterface {
// 处理多选数据
if(!this.isSingleSelect){
let leafNodes = checkedState.checkedNodes.filter((item:any) => item.leaf);
this.selectedNodes = JSON.parse(JSON.stringify(leafNodes));
const selectedNodes = JSON.parse(JSON.stringify(leafNodes));
this.handleCtrlEvents('onselectionchange', { action: 'SelectionChange', data: selectedNodes }).then((res: boolean) => {
if (res) {
this.selectedNodes = selectedNodes;
this.$emit('selectionchange', this.selectedNodes);
}
})
}
}
/**
......@@ -557,7 +562,11 @@ export default class Tree04Base extends Vue implements ControlInterface {
return;
}
// 只处理最底层子节点
if(this.isBranchAvailable || data.leaf){
if(this.isBranchAvailable || data.leaf) {
this.handleCtrlEvents('onselectionchange', { action: 'SelectionChange', data: data }).then((res: boolean) => {
if (!res) {
return;
}
this.currentselectedNode = JSON.parse(JSON.stringify(data));
// 单选直接替换
if(this.isSingleSelect){
......@@ -565,6 +574,7 @@ export default class Tree04Base extends Vue implements ControlInterface {
this.$emit('selectionchange', this.selectedNodes);
}
// 多选用check方法
});
}
}
......@@ -745,12 +755,26 @@ export default class Tree04Base extends Vue implements ControlInterface {
Object.assign(tempContext,{srfparentkey:curNode.data.srfparentkey});
Object.assign(tempViewParams,{srfparentkey:curNode.data.srfparentkey});
}
Object.assign(params,{viewparams:tempViewParams});
Object.assign(params,{ viewparams: tempViewParams });
this.handleCtrlEvents('onbeforeload', { data: node.data }).then((beforeLoadResult: boolean) => {
if (!beforeLoadResult) {
return;
}
this.service.getNodes(tempContext,params).then((response: any) => {
if (!response || response.status !== 200) {
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadErrorResult: boolean) => {
if (!loadErrorResult) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
resolve([]);
return;
})
}
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadSuccessResult: boolean) => {
if (!loadSuccessResult) {
resolve([]);
return;
}
const _items = response.data;
this.formatExpanded(_items);
......@@ -759,13 +783,20 @@ export default class Tree04Base extends Vue implements ControlInterface {
let isSelectedAll = node.checked;
this.setDefaultSelection(_items, isRoot, isSelectedAll);
this.$emit("load", _items);
});
}).catch((response: any) => {
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadErrorResult: boolean) => {
if (!loadErrorResult) {
return;
}
resolve([]);
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
});
});
})
}
/**
......@@ -805,14 +836,27 @@ export default class Tree04Base extends Vue implements ControlInterface {
*/
public refresh_node(curContext:any,arg: any = {}, parentnode: boolean): void {
const { srfnodeid: id } = arg;
Object.assign(arg,{viewparams:this.viewparams});
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)),arg);
Object.assign(arg, { viewparams: this.viewparams });
this.handleCtrlEvents('onbeforerefreshnode', { data: arg }).then((beforeRefreshRes: boolean) => {
if (!beforeRefreshRes) {
return;
}
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)), arg);
get.then((response: any) => {
if (!response || response.status !== 200) {
this.handleCtrlEvents('onrefreshnodeerror', { data: response && response.data ? response.data : {} }).then((errorRes: boolean) => {
if (!errorRes) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
return;
})
}
const _items = [...response.data];
this.handleCtrlEvents('onrefreshnodesuccess', { data: _items }).then((successRes: boolean) => {
if (!successRes) {
return;
}
this.formatExpanded(_items);
const tree: any = this.$refs.treeexpbar_tree;
tree.updateKeyChildren(id, _items);
......@@ -821,12 +865,19 @@ export default class Tree04Base extends Vue implements ControlInterface {
}
this.$forceUpdate();
this.setDefaultSelection(_items);
})
}).catch((response: any) => {
this.handleCtrlEvents('onrefreshnodeerror', { data: response && response.data ? response.data : {} }).then((errorRes: boolean) => {
if (!errorRes) {
return;
}
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
})
});
})
}
/**
......
......@@ -11,51 +11,51 @@
"path" : "PSSYSAPPS/Web/PSAPPDATAENTITIES/IBIZBOOK.json"
},
"getPSDETreeColumns" : [ {
"caption" : "归还日期",
"codeName" : "returntime",
"caption" : "作者",
"codeName" : "author",
"columnType" : "DEFGRIDCOLUMN",
"dataItemName" : "returntime",
"name" : "returntime",
"dataItemName" : "author",
"name" : "author",
"width" : 200,
"widthUnit" : "px",
"enableExpand" : false,
"enableSort" : false
}, {
"caption" : "出版社",
"codeName" : "press",
"caption" : "图书名称",
"codeName" : "ibizbookname",
"columnType" : "DEFGRIDCOLUMN",
"dataItemName" : "press",
"name" : "press",
"dataItemName" : "ibizbookname",
"name" : "ibizbookname",
"width" : 200,
"widthUnit" : "px",
"enableExpand" : false,
"enableSort" : false
}, {
"caption" : "借出日期",
"codeName" : "lendouttime",
"caption" : "归还日期",
"codeName" : "returntime",
"columnType" : "DEFGRIDCOLUMN",
"dataItemName" : "lendouttime",
"name" : "lendouttime",
"dataItemName" : "returntime",
"name" : "returntime",
"width" : 200,
"widthUnit" : "px",
"enableExpand" : false,
"enableSort" : false
}, {
"caption" : "作者",
"codeName" : "author",
"caption" : "出版社",
"codeName" : "press",
"columnType" : "DEFGRIDCOLUMN",
"dataItemName" : "author",
"name" : "author",
"dataItemName" : "press",
"name" : "press",
"width" : 200,
"widthUnit" : "px",
"enableExpand" : false,
"enableSort" : false
}, {
"caption" : "图书名称",
"codeName" : "ibizbookname",
"caption" : "借出日期",
"codeName" : "lendouttime",
"columnType" : "DEFGRIDCOLUMN",
"dataItemName" : "ibizbookname",
"name" : "ibizbookname",
"dataItemName" : "lendouttime",
"name" : "lendouttime",
"width" : 200,
"widthUnit" : "px",
"enableExpand" : false,
......
......@@ -312,7 +312,6 @@
"itemType" : "CONTAINER",
"name" : "container6",
"getPSLayout" : {
"align" : "center",
"dir" : "row",
"layout" : "FLEX"
},
......@@ -322,13 +321,13 @@
},
"getPSPanelItems" : [ {
"caption" : "文本(动态)",
"contentWidth" : 100.0,
"contentWidth" : 40.0,
"itemStyle" : "DEFAULT",
"itemType" : "FIELD",
"name" : "field_text_dynamic5",
"getPSEditor" : {
"editorType" : "SPAN",
"editorWidth" : 100.0,
"editorWidth" : 40.0,
"name" : "field_text_dynamic5",
"predefinedType" : "FIELD_TEXT_DYNAMIC",
"renderMode" : "TEXT_DYNAMIC",
......@@ -337,22 +336,22 @@
"getPSLayoutPos" : {
"grow" : -1,
"layout" : "FLEX",
"width" : 100,
"width" : 40,
"widthMode" : "PX"
},
"viewFieldName" : "type",
"width" : 100.0,
"width" : 40.0,
"hidden" : false,
"showCaption" : false
}, {
"caption" : "文本(动态)",
"contentWidth" : 100.0,
"contentWidth" : 150.0,
"itemStyle" : "DEFAULT",
"itemType" : "FIELD",
"name" : "field_text_dynamic3",
"getPSEditor" : {
"editorType" : "SPAN",
"editorWidth" : 100.0,
"editorWidth" : 150.0,
"name" : "field_text_dynamic3",
"predefinedType" : "FIELD_TEXT_DYNAMIC",
"renderMode" : "TEXT_DYNAMIC",
......@@ -361,22 +360,22 @@
"getPSLayoutPos" : {
"grow" : -1,
"layout" : "FLEX",
"width" : 100,
"width" : 150,
"widthMode" : "PX"
},
"viewFieldName" : "press",
"width" : 100.0,
"width" : 150.0,
"hidden" : false,
"showCaption" : false
}, {
"caption" : "文本(动态)",
"contentWidth" : 100.0,
"contentWidth" : 50.0,
"itemStyle" : "DEFAULT",
"itemType" : "FIELD",
"name" : "field_text_dynamic6",
"getPSEditor" : {
"editorType" : "SPAN",
"editorWidth" : 100.0,
"editorWidth" : 50.0,
"name" : "field_text_dynamic6",
"predefinedType" : "FIELD_TEXT_DYNAMIC",
"renderMode" : "TEXT_DYNAMIC",
......@@ -385,11 +384,11 @@
"getPSLayoutPos" : {
"grow" : -1,
"layout" : "FLEX",
"width" : 100,
"width" : 50,
"widthMode" : "PX"
},
"viewFieldName" : "price",
"width" : 100.0,
"width" : 50.0,
"hidden" : false,
"showCaption" : false
}, {
......@@ -438,24 +437,24 @@
},
"getPSDEListDataItems" : [ {
"dataType" : 25,
"name" : "author",
"name" : "subtext",
"getPSAppDEField" : {
"name" : "AUTHOR",
"codeName" : "Author"
"name" : "SUBTEXT",
"codeName" : "Subtext"
}
}, {
"dataType" : 25,
"name" : "ibizbookid",
"dataType" : 7,
"name" : "price",
"getPSAppDEField" : {
"name" : "IBIZBOOKID",
"codeName" : "IBIZBOOKId"
"name" : "PRICE",
"codeName" : "Price"
}
}, {
"dataType" : 25,
"name" : "subtext",
"name" : "press",
"getPSAppDEField" : {
"name" : "SUBTEXT",
"codeName" : "Subtext"
"name" : "PRESS",
"codeName" : "Press"
}
}, {
"dataType" : 9,
......@@ -466,24 +465,17 @@
}
}, {
"dataType" : 25,
"name" : "ibizbookname",
"getPSAppDEField" : {
"name" : "IBIZBOOKNAME",
"codeName" : "IBIZBOOKName"
}
}, {
"dataType" : 21,
"name" : "icon",
"name" : "author",
"getPSAppDEField" : {
"name" : "ICON",
"codeName" : "Icon"
"name" : "AUTHOR",
"codeName" : "Author"
}
}, {
"dataType" : 25,
"name" : "press",
"name" : "ibizbookid",
"getPSAppDEField" : {
"name" : "PRESS",
"codeName" : "Press"
"name" : "IBIZBOOKID",
"codeName" : "IBIZBOOKId"
}
}, {
"dataType" : 25,
......@@ -497,11 +489,18 @@
"codeName" : "Type"
}
}, {
"dataType" : 7,
"name" : "price",
"dataType" : 21,
"name" : "icon",
"getPSAppDEField" : {
"name" : "PRICE",
"codeName" : "Price"
"name" : "ICON",
"codeName" : "Icon"
}
}, {
"dataType" : 25,
"name" : "ibizbookname",
"getPSAppDEField" : {
"name" : "IBIZBOOKNAME",
"codeName" : "IBIZBOOKName"
}
}, {
"dataType" : 25,
......
......@@ -293,7 +293,6 @@
"itemType" : "CONTAINER",
"name" : "container6",
"getPSLayout" : {
"align" : "center",
"dir" : "row",
"layout" : "FLEX"
},
......@@ -303,13 +302,13 @@
},
"getPSPanelItems" : [ {
"caption" : "文本(动态)",
"contentWidth" : 100.0,
"contentWidth" : 40.0,
"itemStyle" : "DEFAULT",
"itemType" : "FIELD",
"name" : "field_text_dynamic5",
"getPSEditor" : {
"editorType" : "SPAN",
"editorWidth" : 100.0,
"editorWidth" : 40.0,
"name" : "field_text_dynamic5",
"predefinedType" : "FIELD_TEXT_DYNAMIC",
"renderMode" : "TEXT_DYNAMIC",
......@@ -318,22 +317,22 @@
"getPSLayoutPos" : {
"grow" : -1,
"layout" : "FLEX",
"width" : 100,
"width" : 40,
"widthMode" : "PX"
},
"viewFieldName" : "type",
"width" : 100.0,
"width" : 40.0,
"hidden" : false,
"showCaption" : false
}, {
"caption" : "文本(动态)",
"contentWidth" : 100.0,
"contentWidth" : 150.0,
"itemStyle" : "DEFAULT",
"itemType" : "FIELD",
"name" : "field_text_dynamic3",
"getPSEditor" : {
"editorType" : "SPAN",
"editorWidth" : 100.0,
"editorWidth" : 150.0,
"name" : "field_text_dynamic3",
"predefinedType" : "FIELD_TEXT_DYNAMIC",
"renderMode" : "TEXT_DYNAMIC",
......@@ -342,22 +341,22 @@
"getPSLayoutPos" : {
"grow" : -1,
"layout" : "FLEX",
"width" : 100,
"width" : 150,
"widthMode" : "PX"
},
"viewFieldName" : "press",
"width" : 100.0,
"width" : 150.0,
"hidden" : false,
"showCaption" : false
}, {
"caption" : "文本(动态)",
"contentWidth" : 100.0,
"contentWidth" : 50.0,
"itemStyle" : "DEFAULT",
"itemType" : "FIELD",
"name" : "field_text_dynamic6",
"getPSEditor" : {
"editorType" : "SPAN",
"editorWidth" : 100.0,
"editorWidth" : 50.0,
"name" : "field_text_dynamic6",
"predefinedType" : "FIELD_TEXT_DYNAMIC",
"renderMode" : "TEXT_DYNAMIC",
......@@ -366,11 +365,11 @@
"getPSLayoutPos" : {
"grow" : -1,
"layout" : "FLEX",
"width" : 100,
"width" : 50,
"widthMode" : "PX"
},
"viewFieldName" : "price",
"width" : 100.0,
"width" : 50.0,
"hidden" : false,
"showCaption" : false
}, {
......
......@@ -172,7 +172,7 @@
<!--输出实体[IBIZBOOK]数据结构 -->
<changeSet author="a_LAB01_df847bdfd" id="tab-ibizbook-738-7">
<changeSet author="a_LAB01_df847bdfd" id="tab-ibizbook-741-7">
<createTable tableName="T_IBIZBOOK">
<column name="CREATEMAN" remarks="" type="VARCHAR(60)">
</column>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册