Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz-Vue-R7
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
22
议题
22
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7前端标准模板
iBiz-Vue-R7
提交
1e1562b4
提交
1e1562b4
编写于
11月 10, 2022
作者:
Mosher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update:调整
上级
b1068c8f
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
188 行增加
和
100 行删除
+188
-100
CONTROL-BASE.vue.ftl
@CONTROL/列表/CONTROL-BASE.vue.ftl
+84
-47
CONTROL-BASE.vue.ftl
@CONTROL/树视图/CONTROL-BASE.vue.ftl
+104
-53
未找到文件。
@CONTROL/列表/CONTROL-BASE.vue.ftl
浏览文件 @
1e1562b4
...
@@ -644,7 +644,7 @@ import CodeListService from "@/codelist/codelist-service";
...
@@ -644,7 +644,7 @@ import CodeListService from "@/codelist/codelist-service";
* @param {*} [arg={}]
* @param {*} [arg={}]
* @memberof ${srfclassname('${ctrl.codeName}')}Base
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
*/
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: '${view.getName()}' + (this.$t('app.list.notConfig.fetchAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: '${view.getName()}' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
return;
...
@@ -663,17 +663,27 @@ import CodeListService from "@/codelist/codelist-service";
...
@@ -663,17 +663,27 @@ import CodeListService from "@/codelist/codelist-service";
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;
...
@@ -710,12 +720,16 @@ import CodeListService from "@/codelist/codelist-service";
...
@@ -710,12 +720,16 @@ import CodeListService from "@/codelist/codelist-service";
<#if ctrl.isEnableGroup?? && ctrl.isEnableGroup()>
<#if ctrl.isEnableGroup?? && ctrl.isEnableGroup()>
this.group();
this.group();
</#if>
</#if>
}, (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 : "" });
}
);
}
}
}
/**
/**
...
@@ -790,49 +804,58 @@ import CodeListService from "@/codelist/codelist-service";
...
@@ -790,49 +804,58 @@ import CodeListService from "@/codelist/codelist-service";
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,{ ${ctrl.getPSAppDataEntity().codeName?lower_case}: keys.join(';') }),Object.assign({ ${ctrl.getPSAppDataEntity().codeName?lower_case}: 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,{ ${ctrl.getPSAppDataEntity().codeName?lower_case}: keys.join(';') }),Object.assign({ ${ctrl.getPSAppDataEntity().codeName?lower_case}: 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 }))) {
<#if ctrl.isEnableGroup?? && ctrl.isEnableGroup()>
return;
this.group();
}
</#if>
//删除items中已删除的项
return true;
datas.forEach((data: any) => {
}
this.items.some((item:any,index:number)=>{
});
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
<#if ctrl.isEnableGroup?? && ctrl.isEnableGroup()>
this.group();
</#if>
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, '');
...
@@ -859,6 +882,9 @@ import CodeListService from "@/codelist/codelist-service";
...
@@ -859,6 +882,9 @@ import CodeListService from "@/codelist/codelist-service";
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')){
...
@@ -891,8 +917,14 @@ import CodeListService from "@/codelist/codelist-service";
...
@@ -891,8 +917,14 @@ import CodeListService from "@/codelist/codelist-service";
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]);
...
@@ -947,13 +979,18 @@ import CodeListService from "@/codelist/codelist-service";
...
@@ -947,13 +979,18 @@ import CodeListService from "@/codelist/codelist-service";
*
*
*/
*/
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);
})
}
}
/**
/**
...
...
@CONTROL/树视图/CONTROL-BASE.vue.ftl
浏览文件 @
1e1562b4
...
@@ -303,8 +303,13 @@ import UIService from '@/uiservice/ui-service';
...
@@ -303,8 +303,13 @@ import UIService from '@/uiservice/ui-service';
// 处理多选数据
// 处理多选数据
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);
}
})
}
}
}
}
...
@@ -323,14 +328,19 @@ import UIService from '@/uiservice/ui-service';
...
@@ -323,14 +328,19 @@ import UIService from '@/uiservice/ui-service';
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方法
});
}
}
}
}
...
@@ -514,31 +524,52 @@ import UIService from '@/uiservice/ui-service';
...
@@ -514,31 +524,52 @@ import UIService from '@/uiservice/ui-service';
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;
return;
}
}
const _items = response.data;
this.service.getNodes(tempContext,params).then((response: any) => {
this.formatExpanded(_items);
if (!response || response.status !== 200) {
<#-- if (!node.level || node.level === 0) {
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadErrorResult: boolean) => {
this.nodes = [..._items];
if (!loadErrorResult) {
}
return;
this.nodes = response.data; -->
}
resolve([..._items]);
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
let isRoot = Object.is(node.level,0);
resolve([]);
let isSelectedAll = node.checked;
return;
this.setDefaultSelection(_items, isRoot, isSelectedAll);
})
this.$emit("load", _items);
}
}).catch((response: any) => {
this.handleCtrlEvents('onloaderror', { data: node.data }).then((loadSuccessResult: boolean) => {
resolve([]);
if (!loadSuccessResult) {
if (response && response.status === 401) {
resolve([]);
return;
return;
}
}
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.info });
const _items = response.data;
});
this.formatExpanded(_items);
<#-- if (!node.level || node.level === 0) {
this.nodes = [..._items];
}
this.nodes = response.data; -->
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 });
});
});
})
}
}
/**
/**
...
@@ -597,28 +628,48 @@ import UIService from '@/uiservice/ui-service';
...
@@ -597,28 +628,48 @@ import UIService from '@/uiservice/ui-service';
*/
*/
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.${ctrl.name};
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.${ctrl.name};
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 });
})
});
})
}
}
/**
/**
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录