提交 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,46 +671,55 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +841,18 @@ export default class CtrlAmountBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
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,46 +733,55 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +903,18 @@ export default class CtrlListBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
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,46 +671,55 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +841,18 @@ export default class EditorAmountBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
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,46 +733,55 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +903,18 @@ export default class EditorListBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
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,46 +671,55 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +841,18 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
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,46 +733,55 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +903,18 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
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,46 +671,55 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +841,18 @@ export default class ViewAmountBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
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,46 +761,55 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +931,18 @@ export default class ViewListBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
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,47 +897,56 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
this.group();
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
this.group();
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +1068,18 @@ export default class AutoGroupListBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
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,46 +691,55 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +861,18 @@ export default class BooklistBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
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,47 +828,56 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
this.group();
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
this.group();
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +999,18 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
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,46 +685,55 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +855,18 @@ export default class HasPanelListBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
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,46 +685,55 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +855,18 @@ export default class ListpanelBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
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,46 +995,55 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +1165,18 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
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,46 +761,55 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +931,18 @@ export default class MajorStateListBase extends Vue implements ControlInterface
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -549,8 +549,13 @@ 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));
this.$emit('selectionchange', this.selectedNodes);
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,14 +574,19 @@ export default class TreeMajorStateBase extends Vue implements ControlInterface
return;
}
// 只处理最底层子节点
if(this.isBranchAvailable || data.leaf){
this.currentselectedNode = JSON.parse(JSON.stringify(data));
// 单选直接替换
if(this.isSingleSelect){
this.selectedNodes = [this.currentselectedNode];
this.$emit('selectionchange', this.selectedNodes);
}
// 多选用check方法
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){
this.selectedNodes = [this.currentselectedNode];
this.$emit('selectionchange', this.selectedNodes);
}
// 多选用check方法
});
}
}
......@@ -757,27 +767,48 @@ 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});
this.service.getNodes(tempContext,params).then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
resolve([]);
return;
}
const _items = response.data;
this.formatExpanded(_items);
resolve([..._items]);
let isRoot = Object.is(node.level,0);
let isSelectedAll = node.checked;
this.setDefaultSelection(_items, isRoot, isSelectedAll);
this.$emit("load", _items);
}).catch((response: any) => {
resolve([]);
if (response && response.status === 401) {
Object.assign(params,{ viewparams: tempViewParams });
this.handleCtrlEvents('onbeforeload', { data: node.data }).then((beforeLoadResult: boolean) => {
if (!beforeLoadResult) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
});
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);
resolve([..._items]);
let isRoot = Object.is(node.level,0);
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,28 +848,48 @@ 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);
get.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
Object.assign(arg, { viewparams: this.viewparams });
this.handleCtrlEvents('onbeforerefreshnode', { data: arg }).then((beforeRefreshRes: boolean) => {
if (!beforeRefreshRes) {
return;
}
const _items = [...response.data];
this.formatExpanded(_items);
const tree: any = this.$refs.tree;
tree.updateKeyChildren(id, _items);
if (parentnode) {
this.currentselectedNode = {};
}
this.$forceUpdate();
this.setDefaultSelection(_items);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
});
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);
if (parentnode) {
this.currentselectedNode = {};
}
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,8 +440,13 @@ 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));
this.$emit('selectionchange', this.selectedNodes);
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,14 +465,19 @@ export default class TreeBase extends Vue implements ControlInterface {
return;
}
// 只处理最底层子节点
if(this.isBranchAvailable || data.leaf){
this.currentselectedNode = JSON.parse(JSON.stringify(data));
// 单选直接替换
if(this.isSingleSelect){
this.selectedNodes = [this.currentselectedNode];
this.$emit('selectionchange', this.selectedNodes);
}
// 多选用check方法
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){
this.selectedNodes = [this.currentselectedNode];
this.$emit('selectionchange', this.selectedNodes);
}
// 多选用check方法
});
}
}
......@@ -648,27 +658,48 @@ 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});
this.service.getNodes(tempContext,params).then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
resolve([]);
return;
}
const _items = response.data;
this.formatExpanded(_items);
resolve([..._items]);
let isRoot = Object.is(node.level,0);
let isSelectedAll = node.checked;
this.setDefaultSelection(_items, isRoot, isSelectedAll);
this.$emit("load", _items);
}).catch((response: any) => {
resolve([]);
if (response && response.status === 401) {
Object.assign(params,{ viewparams: tempViewParams });
this.handleCtrlEvents('onbeforeload', { data: node.data }).then((beforeLoadResult: boolean) => {
if (!beforeLoadResult) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
});
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);
resolve([..._items]);
let isRoot = Object.is(node.level,0);
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,28 +739,48 @@ 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);
get.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
Object.assign(arg, { viewparams: this.viewparams });
this.handleCtrlEvents('onbeforerefreshnode', { data: arg }).then((beforeRefreshRes: boolean) => {
if (!beforeRefreshRes) {
return;
}
const _items = [...response.data];
this.formatExpanded(_items);
const tree: any = this.$refs.tree;
tree.updateKeyChildren(id, _items);
if (parentnode) {
this.currentselectedNode = {};
}
this.$forceUpdate();
this.setDefaultSelection(_items);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
});
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);
if (parentnode) {
this.currentselectedNode = {};
}
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,46 +784,55 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +954,18 @@ export default class UsrBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
this.$emit('selectionchange', this.selections);
})
}
/**
......
......@@ -440,8 +440,13 @@ 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));
this.$emit('selectionchange', this.selectedNodes);
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,14 +465,19 @@ export default class UsrBase extends Vue implements ControlInterface {
return;
}
// 只处理最底层子节点
if(this.isBranchAvailable || data.leaf){
this.currentselectedNode = JSON.parse(JSON.stringify(data));
// 单选直接替换
if(this.isSingleSelect){
this.selectedNodes = [this.currentselectedNode];
this.$emit('selectionchange', this.selectedNodes);
}
// 多选用check方法
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){
this.selectedNodes = [this.currentselectedNode];
this.$emit('selectionchange', this.selectedNodes);
}
// 多选用check方法
});
}
}
......@@ -648,27 +658,48 @@ 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});
this.service.getNodes(tempContext,params).then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
resolve([]);
return;
}
const _items = response.data;
this.formatExpanded(_items);
resolve([..._items]);
let isRoot = Object.is(node.level,0);
let isSelectedAll = node.checked;
this.setDefaultSelection(_items, isRoot, isSelectedAll);
this.$emit("load", _items);
}).catch((response: any) => {
resolve([]);
if (response && response.status === 401) {
Object.assign(params,{ viewparams: tempViewParams });
this.handleCtrlEvents('onbeforeload', { data: node.data }).then((beforeLoadResult: boolean) => {
if (!beforeLoadResult) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
});
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);
resolve([..._items]);
let isRoot = Object.is(node.level,0);
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,28 +739,48 @@ 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);
get.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
Object.assign(arg, { viewparams: this.viewparams });
this.handleCtrlEvents('onbeforerefreshnode', { data: arg }).then((beforeRefreshRes: boolean) => {
if (!beforeRefreshRes) {
return;
}
const _items = [...response.data];
this.formatExpanded(_items);
const tree: any = this.$refs.tree;
tree.updateKeyChildren(id, _items);
if (parentnode) {
this.currentselectedNode = {};
}
this.$forceUpdate();
this.setDefaultSelection(_items);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
});
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);
if (parentnode) {
this.currentselectedNode = {};
}
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,46 +705,55 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +875,18 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
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,46 +664,55 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +834,18 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
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,46 +664,55 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +834,18 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
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,46 +665,55 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +835,18 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
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,46 +735,55 @@ 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 (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
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;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
}
//删除items中已删除的项
datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
return;
}
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) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
});
this.$emit('remove', null);
this.selections = [];
return response;
} catch (response: any) {
if (!(await this.handleCtrlEvents('onremoveerror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
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,13 +905,18 @@ export default class ListExpBase extends Vue implements ControlInterface {
*
*/
public selectchange() {
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
if (!res) {
return;
}
});
this.$emit('selectionchange', this.selections);
this.selections = [];
this.items.map((item: any) => {
if (item.isselected) {
this.selections.push(item);
}
});
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,8 +470,13 @@ 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));
this.$emit('selectionchange', this.selectedNodes);
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,14 +495,19 @@ export default class TreeExpBase extends Vue implements ControlInterface {
return;
}
// 只处理最底层子节点
if(this.isBranchAvailable || data.leaf){
this.currentselectedNode = JSON.parse(JSON.stringify(data));
// 单选直接替换
if(this.isSingleSelect){
this.selectedNodes = [this.currentselectedNode];
this.$emit('selectionchange', this.selectedNodes);
}
// 多选用check方法
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){
this.selectedNodes = [this.currentselectedNode];
this.$emit('selectionchange', this.selectedNodes);
}
// 多选用check方法
});
}
}
......@@ -678,27 +688,48 @@ 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});
this.service.getNodes(tempContext,params).then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
resolve([]);
return;
}
const _items = response.data;
this.formatExpanded(_items);
resolve([..._items]);
let isRoot = Object.is(node.level,0);
let isSelectedAll = node.checked;
this.setDefaultSelection(_items, isRoot, isSelectedAll);
this.$emit("load", _items);
}).catch((response: any) => {
resolve([]);
if (response && response.status === 401) {
Object.assign(params,{ viewparams: tempViewParams });
this.handleCtrlEvents('onbeforeload', { data: node.data }).then((beforeLoadResult: boolean) => {
if (!beforeLoadResult) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
});
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);
resolve([..._items]);
let isRoot = Object.is(node.level,0);
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,28 +769,48 @@ 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);
get.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
Object.assign(arg, { viewparams: this.viewparams });
this.handleCtrlEvents('onbeforerefreshnode', { data: arg }).then((beforeRefreshRes: boolean) => {
if (!beforeRefreshRes) {
return;
}
const _items = [...response.data];
this.formatExpanded(_items);
const tree: any = this.$refs.treeexpbar_tree;
tree.updateKeyChildren(id, _items);
if (parentnode) {
this.currentselectedNode = {};
}
this.$forceUpdate();
this.setDefaultSelection(_items);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
});
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);
if (parentnode) {
this.currentselectedNode = {};
}
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,
......
......@@ -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 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册