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

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

上级 331fba47
...@@ -514,7 +514,7 @@ export default class CtrlAmountBase extends Vue implements ControlInterface { ...@@ -514,7 +514,7 @@ export default class CtrlAmountBase extends Vue implements ControlInterface {
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof CtrlAmountBase * @memberof CtrlAmountBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'AppPortalView' + (this.$t('app.list.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'AppPortalView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -533,17 +533,27 @@ export default class CtrlAmountBase extends Vue implements ControlInterface { ...@@ -533,17 +533,27 @@ export default class CtrlAmountBase extends Vue implements ControlInterface {
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -577,12 +587,16 @@ export default class CtrlAmountBase extends Vue implements ControlInterface { ...@@ -577,12 +587,16 @@ export default class CtrlAmountBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 { ...@@ -657,46 +671,55 @@ export default class CtrlAmountBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return true; 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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -723,6 +746,9 @@ export default class CtrlAmountBase extends Vue implements ControlInterface { ...@@ -723,6 +746,9 @@ export default class CtrlAmountBase extends Vue implements ControlInterface {
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -753,8 +779,14 @@ export default class CtrlAmountBase extends Vue implements ControlInterface { ...@@ -753,8 +779,14 @@ export default class CtrlAmountBase extends Vue implements ControlInterface {
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -809,13 +841,18 @@ export default class CtrlAmountBase extends Vue implements ControlInterface { ...@@ -809,13 +841,18 @@ export default class CtrlAmountBase extends Vue implements ControlInterface {
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 { ...@@ -576,7 +576,7 @@ export default class CtrlListBase extends Vue implements ControlInterface {
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof CtrlListBase * @memberof CtrlListBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPCTRLListView' + (this.$t('app.list.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPCTRLListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -595,17 +595,27 @@ export default class CtrlListBase extends Vue implements ControlInterface { ...@@ -595,17 +595,27 @@ export default class CtrlListBase extends Vue implements ControlInterface {
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -639,12 +649,16 @@ export default class CtrlListBase extends Vue implements ControlInterface { ...@@ -639,12 +649,16 @@ export default class CtrlListBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 { ...@@ -719,46 +733,55 @@ export default class CtrlListBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return true; 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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -785,6 +808,9 @@ export default class CtrlListBase extends Vue implements ControlInterface { ...@@ -785,6 +808,9 @@ export default class CtrlListBase extends Vue implements ControlInterface {
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -815,8 +841,14 @@ export default class CtrlListBase extends Vue implements ControlInterface { ...@@ -815,8 +841,14 @@ export default class CtrlListBase extends Vue implements ControlInterface {
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -871,13 +903,18 @@ export default class CtrlListBase extends Vue implements ControlInterface { ...@@ -871,13 +903,18 @@ export default class CtrlListBase extends Vue implements ControlInterface {
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 { ...@@ -514,7 +514,7 @@ export default class EditorAmountBase extends Vue implements ControlInterface {
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof EditorAmountBase * @memberof EditorAmountBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'AppPortalView' + (this.$t('app.list.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'AppPortalView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -533,17 +533,27 @@ export default class EditorAmountBase extends Vue implements ControlInterface { ...@@ -533,17 +533,27 @@ export default class EditorAmountBase extends Vue implements ControlInterface {
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -577,12 +587,16 @@ export default class EditorAmountBase extends Vue implements ControlInterface { ...@@ -577,12 +587,16 @@ export default class EditorAmountBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 { ...@@ -657,46 +671,55 @@ export default class EditorAmountBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return true; 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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -723,6 +746,9 @@ export default class EditorAmountBase extends Vue implements ControlInterface { ...@@ -723,6 +746,9 @@ export default class EditorAmountBase extends Vue implements ControlInterface {
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -753,8 +779,14 @@ export default class EditorAmountBase extends Vue implements ControlInterface { ...@@ -753,8 +779,14 @@ export default class EditorAmountBase extends Vue implements ControlInterface {
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -809,13 +841,18 @@ export default class EditorAmountBase extends Vue implements ControlInterface { ...@@ -809,13 +841,18 @@ export default class EditorAmountBase extends Vue implements ControlInterface {
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 { ...@@ -576,7 +576,7 @@ export default class EditorListBase extends Vue implements ControlInterface {
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof EditorListBase * @memberof EditorListBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEDITORListView' + (this.$t('app.list.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEDITORListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -595,17 +595,27 @@ export default class EditorListBase extends Vue implements ControlInterface { ...@@ -595,17 +595,27 @@ export default class EditorListBase extends Vue implements ControlInterface {
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -639,12 +649,16 @@ export default class EditorListBase extends Vue implements ControlInterface { ...@@ -639,12 +649,16 @@ export default class EditorListBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 { ...@@ -719,46 +733,55 @@ export default class EditorListBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return true; 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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -785,6 +808,9 @@ export default class EditorListBase extends Vue implements ControlInterface { ...@@ -785,6 +808,9 @@ export default class EditorListBase extends Vue implements ControlInterface {
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -815,8 +841,14 @@ export default class EditorListBase extends Vue implements ControlInterface { ...@@ -815,8 +841,14 @@ export default class EditorListBase extends Vue implements ControlInterface {
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -871,13 +903,18 @@ export default class EditorListBase extends Vue implements ControlInterface { ...@@ -871,13 +903,18 @@ export default class EditorListBase extends Vue implements ControlInterface {
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 ...@@ -514,7 +514,7 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof ExtendEditorAmountBase * @memberof ExtendEditorAmountBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'AppPortalView' + (this.$t('app.list.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'AppPortalView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -533,17 +533,27 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf ...@@ -533,17 +533,27 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -577,12 +587,16 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf ...@@ -577,12 +587,16 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf
this.handleClick(this.items[0]); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 ...@@ -657,46 +671,55 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return true; 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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -723,6 +746,9 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf ...@@ -723,6 +746,9 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -753,8 +779,14 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf ...@@ -753,8 +779,14 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -809,13 +841,18 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf ...@@ -809,13 +841,18 @@ export default class ExtendEditorAmountBase extends Vue implements ControlInterf
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 ...@@ -576,7 +576,7 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof ExtendEditorListBase * @memberof ExtendEditorListBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEXTENDEDITORListView' + (this.$t('app.list.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEXTENDEDITORListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -595,17 +595,27 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac ...@@ -595,17 +595,27 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -639,12 +649,16 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac ...@@ -639,12 +649,16 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac
this.handleClick(this.items[0]); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 ...@@ -719,46 +733,55 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return true; 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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -785,6 +808,9 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac ...@@ -785,6 +808,9 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -815,8 +841,14 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac ...@@ -815,8 +841,14 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -871,13 +903,18 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac ...@@ -871,13 +903,18 @@ export default class ExtendEditorListBase extends Vue implements ControlInterfac
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 { ...@@ -514,7 +514,7 @@ export default class ViewAmountBase extends Vue implements ControlInterface {
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof ViewAmountBase * @memberof ViewAmountBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'AppPortalView' + (this.$t('app.list.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'AppPortalView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -533,17 +533,27 @@ export default class ViewAmountBase extends Vue implements ControlInterface { ...@@ -533,17 +533,27 @@ export default class ViewAmountBase extends Vue implements ControlInterface {
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -577,12 +587,16 @@ export default class ViewAmountBase extends Vue implements ControlInterface { ...@@ -577,12 +587,16 @@ export default class ViewAmountBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 { ...@@ -657,46 +671,55 @@ export default class ViewAmountBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return true; 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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -723,6 +746,9 @@ export default class ViewAmountBase extends Vue implements ControlInterface { ...@@ -723,6 +746,9 @@ export default class ViewAmountBase extends Vue implements ControlInterface {
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -753,8 +779,14 @@ export default class ViewAmountBase extends Vue implements ControlInterface { ...@@ -753,8 +779,14 @@ export default class ViewAmountBase extends Vue implements ControlInterface {
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -809,13 +841,18 @@ export default class ViewAmountBase extends Vue implements ControlInterface { ...@@ -809,13 +841,18 @@ export default class ViewAmountBase extends Vue implements ControlInterface {
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 { ...@@ -604,7 +604,7 @@ export default class ViewListBase extends Vue implements ControlInterface {
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof ViewListBase * @memberof ViewListBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPVIEWListView' + (this.$t('app.list.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPVIEWListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -623,17 +623,27 @@ export default class ViewListBase extends Vue implements ControlInterface { ...@@ -623,17 +623,27 @@ export default class ViewListBase extends Vue implements ControlInterface {
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -667,12 +677,16 @@ export default class ViewListBase extends Vue implements ControlInterface { ...@@ -667,12 +677,16 @@ export default class ViewListBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 { ...@@ -747,46 +761,55 @@ export default class ViewListBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return true; 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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -813,6 +836,9 @@ export default class ViewListBase extends Vue implements ControlInterface { ...@@ -813,6 +836,9 @@ export default class ViewListBase extends Vue implements ControlInterface {
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -843,8 +869,14 @@ export default class ViewListBase extends Vue implements ControlInterface { ...@@ -843,8 +869,14 @@ export default class ViewListBase extends Vue implements ControlInterface {
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -899,13 +931,18 @@ export default class ViewListBase extends Vue implements ControlInterface { ...@@ -899,13 +931,18 @@ export default class ViewListBase extends Vue implements ControlInterface {
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 { ...@@ -739,7 +739,7 @@ export default class AutoGroupListBase extends Vue implements ControlInterface {
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof AutoGroupListBase * @memberof AutoGroupListBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKAutoGroupListView' + (this.$t('app.list.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKAutoGroupListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -758,17 +758,27 @@ export default class AutoGroupListBase extends Vue implements ControlInterface { ...@@ -758,17 +758,27 @@ export default class AutoGroupListBase extends Vue implements ControlInterface {
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -803,12 +813,16 @@ export default class AutoGroupListBase extends Vue implements ControlInterface { ...@@ -803,12 +813,16 @@ export default class AutoGroupListBase extends Vue implements ControlInterface {
} }
} }
this.group(); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 { ...@@ -883,47 +897,56 @@ export default class AutoGroupListBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
this.group(); return;
return true; }
} //删除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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -950,6 +973,9 @@ export default class AutoGroupListBase extends Vue implements ControlInterface { ...@@ -950,6 +973,9 @@ export default class AutoGroupListBase extends Vue implements ControlInterface {
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -980,8 +1006,14 @@ export default class AutoGroupListBase extends Vue implements ControlInterface { ...@@ -980,8 +1006,14 @@ export default class AutoGroupListBase extends Vue implements ControlInterface {
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -1036,13 +1068,18 @@ export default class AutoGroupListBase extends Vue implements ControlInterface { ...@@ -1036,13 +1068,18 @@ export default class AutoGroupListBase extends Vue implements ControlInterface {
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 { ...@@ -534,7 +534,7 @@ export default class BooklistBase extends Vue implements ControlInterface {
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof BooklistBase * @memberof BooklistBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ 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) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKDashboardView_layout' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -553,17 +553,27 @@ export default class BooklistBase extends Vue implements ControlInterface { ...@@ -553,17 +553,27 @@ export default class BooklistBase extends Vue implements ControlInterface {
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -597,12 +607,16 @@ export default class BooklistBase extends Vue implements ControlInterface { ...@@ -597,12 +607,16 @@ export default class BooklistBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 { ...@@ -677,46 +691,55 @@ export default class BooklistBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return true; 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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -743,6 +766,9 @@ export default class BooklistBase extends Vue implements ControlInterface { ...@@ -743,6 +766,9 @@ export default class BooklistBase extends Vue implements ControlInterface {
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -773,8 +799,14 @@ export default class BooklistBase extends Vue implements ControlInterface { ...@@ -773,8 +799,14 @@ export default class BooklistBase extends Vue implements ControlInterface {
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -829,13 +861,18 @@ export default class BooklistBase extends Vue implements ControlInterface { ...@@ -829,13 +861,18 @@ export default class BooklistBase extends Vue implements ControlInterface {
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 ...@@ -670,7 +670,7 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof GroupByCodelistListBase * @memberof GroupByCodelistListBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKGroupByCodelistListView' + (this.$t('app.list.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKGroupByCodelistListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -689,17 +689,27 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter ...@@ -689,17 +689,27 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -734,12 +744,16 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter ...@@ -734,12 +744,16 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter
} }
} }
this.group(); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 ...@@ -814,47 +828,56 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
this.group(); return;
return true; }
} //删除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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -881,6 +904,9 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter ...@@ -881,6 +904,9 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -911,8 +937,14 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter ...@@ -911,8 +937,14 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -967,13 +999,18 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter ...@@ -967,13 +999,18 @@ export default class GroupByCodelistListBase extends Vue implements ControlInter
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 { ...@@ -528,7 +528,7 @@ export default class HasPanelListBase extends Vue implements ControlInterface {
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof HasPanelListBase * @memberof HasPanelListBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKHasPanelListView' + (this.$t('app.list.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKHasPanelListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -547,17 +547,27 @@ export default class HasPanelListBase extends Vue implements ControlInterface { ...@@ -547,17 +547,27 @@ export default class HasPanelListBase extends Vue implements ControlInterface {
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -591,12 +601,16 @@ export default class HasPanelListBase extends Vue implements ControlInterface { ...@@ -591,12 +601,16 @@ export default class HasPanelListBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 { ...@@ -671,46 +685,55 @@ export default class HasPanelListBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return true; 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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -737,6 +760,9 @@ export default class HasPanelListBase extends Vue implements ControlInterface { ...@@ -737,6 +760,9 @@ export default class HasPanelListBase extends Vue implements ControlInterface {
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -767,8 +793,14 @@ export default class HasPanelListBase extends Vue implements ControlInterface { ...@@ -767,8 +793,14 @@ export default class HasPanelListBase extends Vue implements ControlInterface {
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -823,13 +855,18 @@ export default class HasPanelListBase extends Vue implements ControlInterface { ...@@ -823,13 +855,18 @@ export default class HasPanelListBase extends Vue implements ControlInterface {
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 { ...@@ -528,7 +528,7 @@ export default class ListpanelBase extends Vue implements ControlInterface {
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof ListpanelBase * @memberof ListpanelBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr5ListView' + (this.$t('app.list.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr5ListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -547,17 +547,27 @@ export default class ListpanelBase extends Vue implements ControlInterface { ...@@ -547,17 +547,27 @@ export default class ListpanelBase extends Vue implements ControlInterface {
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -591,12 +601,16 @@ export default class ListpanelBase extends Vue implements ControlInterface { ...@@ -591,12 +601,16 @@ export default class ListpanelBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 { ...@@ -671,46 +685,55 @@ export default class ListpanelBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return true; 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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -737,6 +760,9 @@ export default class ListpanelBase extends Vue implements ControlInterface { ...@@ -737,6 +760,9 @@ export default class ListpanelBase extends Vue implements ControlInterface {
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -767,8 +793,14 @@ export default class ListpanelBase extends Vue implements ControlInterface { ...@@ -767,8 +793,14 @@ export default class ListpanelBase extends Vue implements ControlInterface {
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -823,13 +855,18 @@ export default class ListpanelBase extends Vue implements ControlInterface { ...@@ -823,13 +855,18 @@ export default class ListpanelBase extends Vue implements ControlInterface {
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 { ...@@ -15,18 +15,18 @@ export default class ListpanelModel {
public getDataItems(): any[] { public getDataItems(): any[] {
return [ return [
{ {
name: 'author', name: 'subtext',
prop: 'author', prop: 'subtext',
dataType: 'TEXT', dataType: 'TEXT',
}, },
{ {
name: 'ibizbookid', name: 'price',
prop: 'ibizbookid', prop: 'price',
dataType: 'GUID', dataType: 'FLOAT',
}, },
{ {
name: 'subtext', name: 'press',
prop: 'subtext', prop: 'press',
dataType: 'TEXT', dataType: 'TEXT',
}, },
{ {
...@@ -35,19 +35,14 @@ export default class ListpanelModel { ...@@ -35,19 +35,14 @@ export default class ListpanelModel {
dataType: 'INT', dataType: 'INT',
}, },
{ {
name: 'ibizbookname', name: 'author',
prop: 'ibizbookname', prop: 'author',
dataType: 'TEXT', dataType: 'TEXT',
}, },
{ {
name: 'icon', name: 'ibizbookid',
prop: 'icon', prop: 'ibizbookid',
dataType: 'LONGTEXT', dataType: 'GUID',
},
{
name: 'press',
prop: 'press',
dataType: 'TEXT',
}, },
{ {
name: 'type', name: 'type',
...@@ -56,9 +51,14 @@ export default class ListpanelModel { ...@@ -56,9 +51,14 @@ export default class ListpanelModel {
codelist:{tag:'BookType',codelistType:'STATIC'}, codelist:{tag:'BookType',codelistType:'STATIC'},
}, },
{ {
name: 'price', name: 'icon',
prop: 'price', prop: 'icon',
dataType: 'FLOAT', dataType: 'LONGTEXT',
},
{
name: 'ibizbookname',
prop: 'ibizbookname',
dataType: 'TEXT',
}, },
{ {
name: 'srfkey', name: 'srfkey',
......
...@@ -341,11 +341,11 @@ export default class ListpanelBase extends Vue implements ControlInterface { ...@@ -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:'', }, 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:'', }, 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' }, 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_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: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_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: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_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: '', }, 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' } 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 ...@@ -838,7 +838,7 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof LnternalFuncListBase * @memberof LnternalFuncListBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ 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) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr4ListView_layout' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -857,17 +857,27 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac ...@@ -857,17 +857,27 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -901,12 +911,16 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac ...@@ -901,12 +911,16 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac
this.handleClick(this.items[0]); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 ...@@ -981,46 +995,55 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return true; 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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -1047,6 +1070,9 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac ...@@ -1047,6 +1070,9 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -1077,8 +1103,14 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac ...@@ -1077,8 +1103,14 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -1133,13 +1165,18 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac ...@@ -1133,13 +1165,18 @@ export default class LnternalFuncListBase extends Vue implements ControlInterfac
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 ...@@ -604,7 +604,7 @@ export default class MajorStateListBase extends Vue implements ControlInterface
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof MajorStateListBase * @memberof MajorStateListBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr3ListView' + (this.$t('app.list.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr3ListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -623,17 +623,27 @@ export default class MajorStateListBase extends Vue implements ControlInterface ...@@ -623,17 +623,27 @@ export default class MajorStateListBase extends Vue implements ControlInterface
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -667,12 +677,16 @@ export default class MajorStateListBase extends Vue implements ControlInterface ...@@ -667,12 +677,16 @@ export default class MajorStateListBase extends Vue implements ControlInterface
this.handleClick(this.items[0]); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 ...@@ -747,46 +761,55 @@ export default class MajorStateListBase extends Vue implements ControlInterface
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return true; 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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -813,6 +836,9 @@ export default class MajorStateListBase extends Vue implements ControlInterface ...@@ -813,6 +836,9 @@ export default class MajorStateListBase extends Vue implements ControlInterface
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -843,8 +869,14 @@ export default class MajorStateListBase extends Vue implements ControlInterface ...@@ -843,8 +869,14 @@ export default class MajorStateListBase extends Vue implements ControlInterface
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -899,13 +931,18 @@ export default class MajorStateListBase extends Vue implements ControlInterface ...@@ -899,13 +931,18 @@ export default class MajorStateListBase extends Vue implements ControlInterface
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 ...@@ -549,8 +549,13 @@ export default class TreeMajorStateBase extends Vue implements ControlInterface
// 处理多选数据 // 处理多选数据
if(!this.isSingleSelect){ if(!this.isSingleSelect){
let leafNodes = checkedState.checkedNodes.filter((item:any) => item.leaf); let leafNodes = checkedState.checkedNodes.filter((item:any) => item.leaf);
this.selectedNodes = JSON.parse(JSON.stringify(leafNodes)); const selectedNodes = JSON.parse(JSON.stringify(leafNodes));
this.$emit('selectionchange', this.selectedNodes); 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 ...@@ -569,14 +574,19 @@ export default class TreeMajorStateBase extends Vue implements ControlInterface
return; return;
} }
// 只处理最底层子节点 // 只处理最底层子节点
if(this.isBranchAvailable || data.leaf){ if(this.isBranchAvailable || data.leaf) {
this.currentselectedNode = JSON.parse(JSON.stringify(data)); this.handleCtrlEvents('onselectionchange', { action: 'SelectionChange', data: data }).then((res: boolean) => {
// 单选直接替换 if (!res) {
if(this.isSingleSelect){ return;
this.selectedNodes = [this.currentselectedNode]; }
this.$emit('selectionchange', this.selectedNodes); this.currentselectedNode = JSON.parse(JSON.stringify(data));
} // 单选直接替换
// 多选用check方法 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 ...@@ -757,27 +767,48 @@ export default class TreeMajorStateBase extends Vue implements ControlInterface
Object.assign(tempContext,{srfparentkey:curNode.data.srfparentkey}); Object.assign(tempContext,{srfparentkey:curNode.data.srfparentkey});
Object.assign(tempViewParams,{srfparentkey:curNode.data.srfparentkey}); Object.assign(tempViewParams,{srfparentkey:curNode.data.srfparentkey});
} }
Object.assign(params,{viewparams:tempViewParams}); Object.assign(params,{ viewparams: tempViewParams });
this.service.getNodes(tempContext,params).then((response: any) => { this.handleCtrlEvents('onbeforeload', { data: node.data }).then((beforeLoadResult: boolean) => {
if (!response || response.status !== 200) { if (!beforeLoadResult) {
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) {
return; 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 ...@@ -817,28 +848,48 @@ export default class TreeMajorStateBase extends Vue implements ControlInterface
*/ */
public refresh_node(curContext:any,arg: any = {}, parentnode: boolean): void { public refresh_node(curContext:any,arg: any = {}, parentnode: boolean): void {
const { srfnodeid: id } = arg; const { srfnodeid: id } = arg;
Object.assign(arg,{viewparams:this.viewparams}); Object.assign(arg, { viewparams: this.viewparams });
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)),arg); this.handleCtrlEvents('onbeforerefreshnode', { data: arg }).then((beforeRefreshRes: boolean) => {
get.then((response: any) => { if (!beforeRefreshRes) {
if (!response || response.status !== 200) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
return; return;
} }
const _items = [...response.data]; const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)), arg);
this.formatExpanded(_items); get.then((response: any) => {
const tree: any = this.$refs.tree; if (!response || response.status !== 200) {
tree.updateKeyChildren(id, _items); this.handleCtrlEvents('onrefreshnodeerror', { data: response && response.data ? response.data : {} }).then((errorRes: boolean) => {
if (parentnode) { if (!errorRes) {
this.currentselectedNode = {}; return;
} }
this.$forceUpdate(); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
this.setDefaultSelection(_items); return;
}).catch((response: any) => { })
if (response && response.status === 401) { }
return; const _items = [...response.data];
} this.handleCtrlEvents('onrefreshnodesuccess', { data: _items }).then((successRes: boolean) => {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info }); 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 { ...@@ -440,8 +440,13 @@ export default class TreeBase extends Vue implements ControlInterface {
// 处理多选数据 // 处理多选数据
if(!this.isSingleSelect){ if(!this.isSingleSelect){
let leafNodes = checkedState.checkedNodes.filter((item:any) => item.leaf); let leafNodes = checkedState.checkedNodes.filter((item:any) => item.leaf);
this.selectedNodes = JSON.parse(JSON.stringify(leafNodes)); const selectedNodes = JSON.parse(JSON.stringify(leafNodes));
this.$emit('selectionchange', this.selectedNodes); 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 { ...@@ -460,14 +465,19 @@ export default class TreeBase extends Vue implements ControlInterface {
return; return;
} }
// 只处理最底层子节点 // 只处理最底层子节点
if(this.isBranchAvailable || data.leaf){ if(this.isBranchAvailable || data.leaf) {
this.currentselectedNode = JSON.parse(JSON.stringify(data)); this.handleCtrlEvents('onselectionchange', { action: 'SelectionChange', data: data }).then((res: boolean) => {
// 单选直接替换 if (!res) {
if(this.isSingleSelect){ return;
this.selectedNodes = [this.currentselectedNode]; }
this.$emit('selectionchange', this.selectedNodes); this.currentselectedNode = JSON.parse(JSON.stringify(data));
} // 单选直接替换
// 多选用check方法 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 { ...@@ -648,27 +658,48 @@ export default class TreeBase extends Vue implements ControlInterface {
Object.assign(tempContext,{srfparentkey:curNode.data.srfparentkey}); Object.assign(tempContext,{srfparentkey:curNode.data.srfparentkey});
Object.assign(tempViewParams,{srfparentkey:curNode.data.srfparentkey}); Object.assign(tempViewParams,{srfparentkey:curNode.data.srfparentkey});
} }
Object.assign(params,{viewparams:tempViewParams}); Object.assign(params,{ viewparams: tempViewParams });
this.service.getNodes(tempContext,params).then((response: any) => { this.handleCtrlEvents('onbeforeload', { data: node.data }).then((beforeLoadResult: boolean) => {
if (!response || response.status !== 200) { if (!beforeLoadResult) {
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) {
return; 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 { ...@@ -708,28 +739,48 @@ export default class TreeBase extends Vue implements ControlInterface {
*/ */
public refresh_node(curContext:any,arg: any = {}, parentnode: boolean): void { public refresh_node(curContext:any,arg: any = {}, parentnode: boolean): void {
const { srfnodeid: id } = arg; const { srfnodeid: id } = arg;
Object.assign(arg,{viewparams:this.viewparams}); Object.assign(arg, { viewparams: this.viewparams });
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)),arg); this.handleCtrlEvents('onbeforerefreshnode', { data: arg }).then((beforeRefreshRes: boolean) => {
get.then((response: any) => { if (!beforeRefreshRes) {
if (!response || response.status !== 200) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
return; return;
} }
const _items = [...response.data]; const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)), arg);
this.formatExpanded(_items); get.then((response: any) => {
const tree: any = this.$refs.tree; if (!response || response.status !== 200) {
tree.updateKeyChildren(id, _items); this.handleCtrlEvents('onrefreshnodeerror', { data: response && response.data ? response.data : {} }).then((errorRes: boolean) => {
if (parentnode) { if (!errorRes) {
this.currentselectedNode = {}; return;
} }
this.$forceUpdate(); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
this.setDefaultSelection(_items); return;
}).catch((response: any) => { })
if (response && response.status === 401) { }
return; const _items = [...response.data];
} this.handleCtrlEvents('onrefreshnodesuccess', { data: _items }).then((successRes: boolean) => {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info }); 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 { ...@@ -627,7 +627,7 @@ export default class UsrBase extends Vue implements ControlInterface {
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof UsrBase * @memberof UsrBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr2ListView' + (this.$t('app.list.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr2ListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -646,17 +646,27 @@ export default class UsrBase extends Vue implements ControlInterface { ...@@ -646,17 +646,27 @@ export default class UsrBase extends Vue implements ControlInterface {
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -690,12 +700,16 @@ export default class UsrBase extends Vue implements ControlInterface { ...@@ -690,12 +700,16 @@ export default class UsrBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 { ...@@ -770,46 +784,55 @@ export default class UsrBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return true; 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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -836,6 +859,9 @@ export default class UsrBase extends Vue implements ControlInterface { ...@@ -836,6 +859,9 @@ export default class UsrBase extends Vue implements ControlInterface {
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -866,8 +892,14 @@ export default class UsrBase extends Vue implements ControlInterface { ...@@ -866,8 +892,14 @@ export default class UsrBase extends Vue implements ControlInterface {
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -922,13 +954,18 @@ export default class UsrBase extends Vue implements ControlInterface { ...@@ -922,13 +954,18 @@ export default class UsrBase extends Vue implements ControlInterface {
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 { ...@@ -440,8 +440,13 @@ export default class UsrBase extends Vue implements ControlInterface {
// 处理多选数据 // 处理多选数据
if(!this.isSingleSelect){ if(!this.isSingleSelect){
let leafNodes = checkedState.checkedNodes.filter((item:any) => item.leaf); let leafNodes = checkedState.checkedNodes.filter((item:any) => item.leaf);
this.selectedNodes = JSON.parse(JSON.stringify(leafNodes)); const selectedNodes = JSON.parse(JSON.stringify(leafNodes));
this.$emit('selectionchange', this.selectedNodes); 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 { ...@@ -460,14 +465,19 @@ export default class UsrBase extends Vue implements ControlInterface {
return; return;
} }
// 只处理最底层子节点 // 只处理最底层子节点
if(this.isBranchAvailable || data.leaf){ if(this.isBranchAvailable || data.leaf) {
this.currentselectedNode = JSON.parse(JSON.stringify(data)); this.handleCtrlEvents('onselectionchange', { action: 'SelectionChange', data: data }).then((res: boolean) => {
// 单选直接替换 if (!res) {
if(this.isSingleSelect){ return;
this.selectedNodes = [this.currentselectedNode]; }
this.$emit('selectionchange', this.selectedNodes); this.currentselectedNode = JSON.parse(JSON.stringify(data));
} // 单选直接替换
// 多选用check方法 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 { ...@@ -648,27 +658,48 @@ export default class UsrBase extends Vue implements ControlInterface {
Object.assign(tempContext,{srfparentkey:curNode.data.srfparentkey}); Object.assign(tempContext,{srfparentkey:curNode.data.srfparentkey});
Object.assign(tempViewParams,{srfparentkey:curNode.data.srfparentkey}); Object.assign(tempViewParams,{srfparentkey:curNode.data.srfparentkey});
} }
Object.assign(params,{viewparams:tempViewParams}); Object.assign(params,{ viewparams: tempViewParams });
this.service.getNodes(tempContext,params).then((response: any) => { this.handleCtrlEvents('onbeforeload', { data: node.data }).then((beforeLoadResult: boolean) => {
if (!response || response.status !== 200) { if (!beforeLoadResult) {
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) {
return; 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 { ...@@ -708,28 +739,48 @@ export default class UsrBase extends Vue implements ControlInterface {
*/ */
public refresh_node(curContext:any,arg: any = {}, parentnode: boolean): void { public refresh_node(curContext:any,arg: any = {}, parentnode: boolean): void {
const { srfnodeid: id } = arg; const { srfnodeid: id } = arg;
Object.assign(arg,{viewparams:this.viewparams}); Object.assign(arg, { viewparams: this.viewparams });
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)),arg); this.handleCtrlEvents('onbeforerefreshnode', { data: arg }).then((beforeRefreshRes: boolean) => {
get.then((response: any) => { if (!beforeRefreshRes) {
if (!response || response.status !== 200) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
return; return;
} }
const _items = [...response.data]; const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)), arg);
this.formatExpanded(_items); get.then((response: any) => {
const tree: any = this.$refs.tree; if (!response || response.status !== 200) {
tree.updateKeyChildren(id, _items); this.handleCtrlEvents('onrefreshnodeerror', { data: response && response.data ? response.data : {} }).then((errorRes: boolean) => {
if (parentnode) { if (!errorRes) {
this.currentselectedNode = {}; return;
} }
this.$forceUpdate(); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
this.setDefaultSelection(_items); return;
}).catch((response: any) => { })
if (response && response.status === 401) { }
return; const _items = [...response.data];
} this.handleCtrlEvents('onrefreshnodesuccess', { data: _items }).then((successRes: boolean) => {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info }); 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 ...@@ -548,7 +548,7 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof OrderDetailsListBase * @memberof OrderDetailsListBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDetailListView' + (this.$t('app.list.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDetailListView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -567,17 +567,27 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac ...@@ -567,17 +567,27 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -611,12 +621,16 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac ...@@ -611,12 +621,16 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac
this.handleClick(this.items[0]); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 ...@@ -691,46 +705,55 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return true; 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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -757,6 +780,9 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac ...@@ -757,6 +780,9 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -787,8 +813,14 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac ...@@ -787,8 +813,14 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -843,13 +875,18 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac ...@@ -843,13 +875,18 @@ export default class OrderDetailsListBase extends Vue implements ControlInterfac
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 ...@@ -507,7 +507,7 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof OrderDetailsMoneyBase * @memberof OrderDetailsMoneyBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDashboardView' + (this.$t('app.list.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDashboardView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -526,17 +526,27 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa ...@@ -526,17 +526,27 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -570,12 +580,16 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa ...@@ -570,12 +580,16 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa
this.handleClick(this.items[0]); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 ...@@ -650,46 +664,55 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return true; 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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -716,6 +739,9 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa ...@@ -716,6 +739,9 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -746,8 +772,14 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa ...@@ -746,8 +772,14 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -802,13 +834,18 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa ...@@ -802,13 +834,18 @@ export default class OrderDetailsMoneyBase extends Vue implements ControlInterfa
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 ...@@ -507,7 +507,7 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof OrderDetailsTotalBase * @memberof OrderDetailsTotalBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDashboardView' + (this.$t('app.list.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDashboardView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -526,17 +526,27 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa ...@@ -526,17 +526,27 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -570,12 +580,16 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa ...@@ -570,12 +580,16 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa
this.handleClick(this.items[0]); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 ...@@ -650,46 +664,55 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return true; 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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -716,6 +739,9 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa ...@@ -716,6 +739,9 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -746,8 +772,14 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa ...@@ -746,8 +772,14 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -802,13 +834,18 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa ...@@ -802,13 +834,18 @@ export default class OrderDetailsTotalBase extends Vue implements ControlInterfa
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 ...@@ -508,7 +508,7 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof OrderDetailsTypeBase * @memberof OrderDetailsTypeBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDashboardView' + (this.$t('app.list.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDashboardView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -527,17 +527,27 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac ...@@ -527,17 +527,27 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -571,12 +581,16 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac ...@@ -571,12 +581,16 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac
this.handleClick(this.items[0]); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 ...@@ -651,46 +665,55 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return true; 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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -717,6 +740,9 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac ...@@ -717,6 +740,9 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -747,8 +773,14 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac ...@@ -747,8 +773,14 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -803,13 +835,18 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac ...@@ -803,13 +835,18 @@ export default class OrderDetailsTypeBase extends Vue implements ControlInterfac
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 ...@@ -715,7 +715,7 @@ export default class CardNavigationBase extends Vue implements ControlInterface
*/ */
public load(opt: any = {}, isReset: boolean = false): void { public load(opt: any = {}, isReset: boolean = false): void {
if(!this.fetchAction){ 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; return;
} }
const arg: any = {...opt}; const arg: any = {...opt};
...@@ -794,7 +794,7 @@ export default class CardNavigationBase extends Vue implements ControlInterface ...@@ -794,7 +794,7 @@ export default class CardNavigationBase extends Vue implements ControlInterface
*/ */
public async remove(datas: any[]): Promise<any> { public async remove(datas: any[]): Promise<any> {
if(!this.removeAction){ 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; return;
} }
let _datas:any[] = []; let _datas:any[] = [];
...@@ -903,7 +903,7 @@ export default class CardNavigationBase extends Vue implements ControlInterface ...@@ -903,7 +903,7 @@ export default class CardNavigationBase extends Vue implements ControlInterface
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
if(!this.createAction){ 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{ }else{
Object.assign(item,{viewparams:this.viewparams}); Object.assign(item,{viewparams:this.viewparams});
let response = await this.service.add(this.createAction, JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator); 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 ...@@ -911,7 +911,7 @@ export default class CardNavigationBase extends Vue implements ControlInterface
} }
}else if(Object.is(item.rowDataState, 'update')){ }else if(Object.is(item.rowDataState, 'update')){
if(!this.updateAction){ 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{ }else{
Object.assign(item,{viewparams:this.viewparams}); Object.assign(item,{viewparams:this.viewparams});
if(item.ibizorder){ if(item.ibizorder){
......
...@@ -578,7 +578,7 @@ export default class ListExpBase extends Vue implements ControlInterface { ...@@ -578,7 +578,7 @@ export default class ListExpBase extends Vue implements ControlInterface {
* @param {*} [arg={}] * @param {*} [arg={}]
* @memberof ListExpBase * @memberof ListExpBase
*/ */
public load(opt: any = {}): void { public async load(opt: any = {}): Promise<any> {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderListExpView' + (this.$t('app.list.notConfig.fetchAction') as string) }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderListExpView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return; return;
...@@ -597,17 +597,27 @@ export default class ListExpBase extends Vue implements ControlInterface { ...@@ -597,17 +597,27 @@ export default class ListExpBase extends Vue implements ControlInterface {
const parentdata: any = {}; const parentdata: any = {};
this.$emit('beforeload', parentdata); this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata); Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{}; let tempViewParams:any = parentdata.viewparams ? parentdata.viewparams : {};
if(this.viewparams){ if(this.viewparams){
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams))); Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
} }
Object.assign(arg,{viewparams:tempViewParams}); 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); const tempContext: any = Util.deepCopy(this.context);
post.then((response: any) => { 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 (!response || response.status !== 200) {
if (!(await this.handleCtrlEvents('onloaderror', { data: response && response.data ? response.data : arg }))) {
return;
}
if (response.data && response.data.message) { if (response.data && response.data.message) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 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; return;
} }
const data: any = response.data; const data: any = response.data;
...@@ -641,12 +651,16 @@ export default class ListExpBase extends Vue implements ControlInterface { ...@@ -641,12 +651,16 @@ export default class ListExpBase extends Vue implements ControlInterface {
this.handleClick(this.items[0]); 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) { if (response && response.status === 401) {
return; return;
} }
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data && response.data.message ? response.data.message : "" }); 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 { ...@@ -721,46 +735,55 @@ export default class ListExpBase extends Vue implements ControlInterface {
dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据'; dataInfo = dataInfo + '...' + ' 共' + datas.length + '条数据';
} }
const removeData = () => { const removeData = async () => {
let keys: any[] = []; let keys: any[] = [];
datas.forEach((data: any) => { datas.forEach((data: any) => {
keys.push(data.srfkey); keys.push(data.srfkey);
}); });
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ; let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
const context:any = JSON.parse(JSON.stringify(this.context)); 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); if (!(await this.handleCtrlEvents('onbeforeremove', { data: this.items }))) {
return new Promise((resolve: any, reject: any) => { return;
post.then((response: any) => { }
if (!response || response.status !== 200) { try {
this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info }); 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; return;
} else {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
} }
//删除items中已删除的项 this.$Notice.error({ title: '', desc: (this.$t('app.commonWords.delDataFail') as string) + ',' + response.info });
datas.forEach((data: any) => { return;
this.items.some((item:any,index:number)=>{ }
if(Object.is(item.srfkey,data.srfkey)){ this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.deleteSuccess') as string) });
this.items.splice(index,1); if (!(await this.handleCtrlEvents('onremovesuccess', { data: response.data }))) {
return true; 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, ''); dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '').replace(/[ ]/g, '');
...@@ -787,6 +810,9 @@ export default class ListExpBase extends Vue implements ControlInterface { ...@@ -787,6 +810,9 @@ export default class ListExpBase extends Vue implements ControlInterface {
let successItems:any = []; let successItems:any = [];
let errorItems:any = []; let errorItems:any = [];
let errorMessage:any = []; let errorMessage:any = [];
if (!(await this.handleCtrlEvents('onbeforesave'))) {
return;
}
for (const item of _this.items) { for (const item of _this.items) {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
...@@ -817,8 +843,14 @@ export default class ListExpBase extends Vue implements ControlInterface { ...@@ -817,8 +843,14 @@ export default class ListExpBase extends Vue implements ControlInterface {
this.$emit('save', successItems); this.$emit('save', successItems);
this.refresh(); this.refresh();
if(errorItems.length === 0){ if(errorItems.length === 0){
if (!(await this.handleCtrlEvents('onsavesuccess', { data: successItems }))) {
return;
}
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); 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)=>{ 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) + '!' }); 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]); console.error(errorMessage[index]);
...@@ -873,13 +905,18 @@ export default class ListExpBase extends Vue implements ControlInterface { ...@@ -873,13 +905,18 @@ export default class ListExpBase extends Vue implements ControlInterface {
* *
*/ */
public selectchange() { public selectchange() {
this.selections = []; this.handleCtrlEvents('onselectionchange').then((res: boolean) => {
this.items.map((item: any) => { if (!res) {
if (item.isselected) { return;
this.selections.push(item);
} }
}); this.selections = [];
this.$emit('selectionchange', 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 { ...@@ -299,7 +299,7 @@ export default class MainBase extends Vue implements ControlInterface {
* @param {*} [$event] 事件源 * @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件 * @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文 * @param {*} [actionContext] 执行行为上下文
* @memberof IBIZOrderPickupGridViewBase * @memberof IBIZOrderSF1GridViewBase
*/ */
public Edit(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) { public Edit(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
if (args.length === 0) { if (args.length === 0) {
...@@ -441,6 +441,20 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -441,6 +441,20 @@ export default class MainBase extends Vue implements ControlInterface {
return this.selections[0]; 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 { ...@@ -975,7 +989,7 @@ export default class MainBase extends Vue implements ControlInterface {
if (!this.fetchAction) { if (!this.fetchAction) {
this.$Notice.error({ this.$Notice.error({
title: this.$t("app.commonWords.wrong") as string, 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; return;
} }
...@@ -1104,7 +1118,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1104,7 +1118,7 @@ export default class MainBase extends Vue implements ControlInterface {
if (!this.removeAction) { if (!this.removeAction) {
this.$Notice.error({ this.$Notice.error({
title: (this.$t('app.commonWords.wrong') as string), 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; return;
} }
...@@ -1218,7 +1232,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1218,7 +1232,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/ */
public addBatch(arg: any = {}): void { public addBatch(arg: any = {}): void {
if(!this.fetchAction){ 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; return;
} }
if(!arg){ if(!arg){
...@@ -2149,7 +2163,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -2149,7 +2163,7 @@ export default class MainBase extends Vue implements ControlInterface {
try { try {
if (Object.is(item.rowDataState, 'create')) { if (Object.is(item.rowDataState, 'create')) {
if (!this.createAction) { 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 { } else {
Object.assign(item, { viewparams: this.viewparams }); Object.assign(item, { viewparams: this.viewparams });
const tempContext = Util.deepCopy(this.context); const tempContext = Util.deepCopy(this.context);
...@@ -2158,7 +2172,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -2158,7 +2172,7 @@ export default class MainBase extends Vue implements ControlInterface {
} }
}else if (Object.is(item.rowDataState, 'update')){ }else if (Object.is(item.rowDataState, 'update')){
if (!this.updateAction) { 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 { } else {
Object.assign(item, { viewparams: this.viewparams }); Object.assign(item, { viewparams: this.viewparams });
const tempContext = Util.deepCopy(this.context); const tempContext = Util.deepCopy(this.context);
...@@ -2234,7 +2248,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -2234,7 +2248,7 @@ export default class MainBase extends Vue implements ControlInterface {
if(!this.loaddraftAction){ if(!this.loaddraftAction){
this.$Notice.error({ this.$Notice.error({
title: (this.$t('app.commonWords.wrong') as string), 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; return;
} }
......
...@@ -104,6 +104,21 @@ export default class MainModel { ...@@ -104,6 +104,21 @@ export default class MainModel {
prop: 'n_ibizordername_like', prop: 'n_ibizordername_like',
dataType: 'QUERYPARAM' 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', name:'size',
......
...@@ -470,8 +470,13 @@ export default class TreeExpBase extends Vue implements ControlInterface { ...@@ -470,8 +470,13 @@ export default class TreeExpBase extends Vue implements ControlInterface {
// 处理多选数据 // 处理多选数据
if(!this.isSingleSelect){ if(!this.isSingleSelect){
let leafNodes = checkedState.checkedNodes.filter((item:any) => item.leaf); let leafNodes = checkedState.checkedNodes.filter((item:any) => item.leaf);
this.selectedNodes = JSON.parse(JSON.stringify(leafNodes)); const selectedNodes = JSON.parse(JSON.stringify(leafNodes));
this.$emit('selectionchange', this.selectedNodes); 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 { ...@@ -490,14 +495,19 @@ export default class TreeExpBase extends Vue implements ControlInterface {
return; return;
} }
// 只处理最底层子节点 // 只处理最底层子节点
if(this.isBranchAvailable || data.leaf){ if(this.isBranchAvailable || data.leaf) {
this.currentselectedNode = JSON.parse(JSON.stringify(data)); this.handleCtrlEvents('onselectionchange', { action: 'SelectionChange', data: data }).then((res: boolean) => {
// 单选直接替换 if (!res) {
if(this.isSingleSelect){ return;
this.selectedNodes = [this.currentselectedNode]; }
this.$emit('selectionchange', this.selectedNodes); this.currentselectedNode = JSON.parse(JSON.stringify(data));
} // 单选直接替换
// 多选用check方法 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 { ...@@ -678,27 +688,48 @@ export default class TreeExpBase extends Vue implements ControlInterface {
Object.assign(tempContext,{srfparentkey:curNode.data.srfparentkey}); Object.assign(tempContext,{srfparentkey:curNode.data.srfparentkey});
Object.assign(tempViewParams,{srfparentkey:curNode.data.srfparentkey}); Object.assign(tempViewParams,{srfparentkey:curNode.data.srfparentkey});
} }
Object.assign(params,{viewparams:tempViewParams}); Object.assign(params,{ viewparams: tempViewParams });
this.service.getNodes(tempContext,params).then((response: any) => { this.handleCtrlEvents('onbeforeload', { data: node.data }).then((beforeLoadResult: boolean) => {
if (!response || response.status !== 200) { if (!beforeLoadResult) {
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) {
return; 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 { ...@@ -738,28 +769,48 @@ export default class TreeExpBase extends Vue implements ControlInterface {
*/ */
public refresh_node(curContext:any,arg: any = {}, parentnode: boolean): void { public refresh_node(curContext:any,arg: any = {}, parentnode: boolean): void {
const { srfnodeid: id } = arg; const { srfnodeid: id } = arg;
Object.assign(arg,{viewparams:this.viewparams}); Object.assign(arg, { viewparams: this.viewparams });
const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)),arg); this.handleCtrlEvents('onbeforerefreshnode', { data: arg }).then((beforeRefreshRes: boolean) => {
get.then((response: any) => { if (!beforeRefreshRes) {
if (!response || response.status !== 200) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
return; return;
} }
const _items = [...response.data]; const get: Promise<any> = this.service.getNodes(JSON.parse(JSON.stringify(curContext)), arg);
this.formatExpanded(_items); get.then((response: any) => {
const tree: any = this.$refs.treeexpbar_tree; if (!response || response.status !== 200) {
tree.updateKeyChildren(id, _items); this.handleCtrlEvents('onrefreshnodeerror', { data: response && response.data ? response.data : {} }).then((errorRes: boolean) => {
if (parentnode) { if (!errorRes) {
this.currentselectedNode = {}; return;
} }
this.$forceUpdate(); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
this.setDefaultSelection(_items); return;
}).catch((response: any) => { })
if (response && response.status === 401) { }
return; const _items = [...response.data];
} this.handleCtrlEvents('onrefreshnodesuccess', { data: _items }).then((successRes: boolean) => {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info }); 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 @@ ...@@ -11,51 +11,51 @@
"path" : "PSSYSAPPS/Web/PSAPPDATAENTITIES/IBIZBOOK.json" "path" : "PSSYSAPPS/Web/PSAPPDATAENTITIES/IBIZBOOK.json"
}, },
"getPSDETreeColumns" : [ { "getPSDETreeColumns" : [ {
"caption" : "归还日期", "caption" : "作者",
"codeName" : "returntime", "codeName" : "author",
"columnType" : "DEFGRIDCOLUMN", "columnType" : "DEFGRIDCOLUMN",
"dataItemName" : "returntime", "dataItemName" : "author",
"name" : "returntime", "name" : "author",
"width" : 200, "width" : 200,
"widthUnit" : "px", "widthUnit" : "px",
"enableExpand" : false, "enableExpand" : false,
"enableSort" : false "enableSort" : false
}, { }, {
"caption" : "出版社", "caption" : "图书名称",
"codeName" : "press", "codeName" : "ibizbookname",
"columnType" : "DEFGRIDCOLUMN", "columnType" : "DEFGRIDCOLUMN",
"dataItemName" : "press", "dataItemName" : "ibizbookname",
"name" : "press", "name" : "ibizbookname",
"width" : 200, "width" : 200,
"widthUnit" : "px", "widthUnit" : "px",
"enableExpand" : false, "enableExpand" : false,
"enableSort" : false "enableSort" : false
}, { }, {
"caption" : "借出日期", "caption" : "归还日期",
"codeName" : "lendouttime", "codeName" : "returntime",
"columnType" : "DEFGRIDCOLUMN", "columnType" : "DEFGRIDCOLUMN",
"dataItemName" : "lendouttime", "dataItemName" : "returntime",
"name" : "lendouttime", "name" : "returntime",
"width" : 200, "width" : 200,
"widthUnit" : "px", "widthUnit" : "px",
"enableExpand" : false, "enableExpand" : false,
"enableSort" : false "enableSort" : false
}, { }, {
"caption" : "作者", "caption" : "出版社",
"codeName" : "author", "codeName" : "press",
"columnType" : "DEFGRIDCOLUMN", "columnType" : "DEFGRIDCOLUMN",
"dataItemName" : "author", "dataItemName" : "press",
"name" : "author", "name" : "press",
"width" : 200, "width" : 200,
"widthUnit" : "px", "widthUnit" : "px",
"enableExpand" : false, "enableExpand" : false,
"enableSort" : false "enableSort" : false
}, { }, {
"caption" : "图书名称", "caption" : "借出日期",
"codeName" : "ibizbookname", "codeName" : "lendouttime",
"columnType" : "DEFGRIDCOLUMN", "columnType" : "DEFGRIDCOLUMN",
"dataItemName" : "ibizbookname", "dataItemName" : "lendouttime",
"name" : "ibizbookname", "name" : "lendouttime",
"width" : 200, "width" : 200,
"widthUnit" : "px", "widthUnit" : "px",
"enableExpand" : false, "enableExpand" : false,
......
...@@ -172,7 +172,7 @@ ...@@ -172,7 +172,7 @@
<!--输出实体[IBIZBOOK]数据结构 --> <!--输出实体[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"> <createTable tableName="T_IBIZBOOK">
<column name="CREATEMAN" remarks="" type="VARCHAR(60)"> <column name="CREATEMAN" remarks="" type="VARCHAR(60)">
</column> </column>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册