Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
iBiz4jVue
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
iBiz4jVue
提交
ae5b0ddb
提交
ae5b0ddb
编写于
10月 14, 2020
作者:
tony001
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
适配表格数据对象方式新建、更新默认值
上级
8b046a7f
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
88 行增加
和
14 行删除
+88
-14
CONTROL-BASE.vue.ftl
@CONTROL/表格/CONTROL-BASE.vue.ftl
+36
-11
SERVICE.ts.ftl
@CONTROL/表格/SERVICE.ts.ftl
+52
-3
未找到文件。
@CONTROL/表格/CONTROL-BASE.vue.ftl
浏览文件 @
ae5b0ddb
...
@@ -2163,9 +2163,9 @@ import { Environment } from '@/environments/environment';
...
@@ -2163,9 +2163,9 @@ import { Environment } from '@/environments/environment';
*/
*/
public createDefault(row: any){
public createDefault(row: any){
<#list ctrl.getPSDEGridEditItems() as editItem><#t>
<#list ctrl.getPSDEGridEditItems() as editItem><#t>
<#if editItem.getCreateDV?? && editItem.getCreateDV()??><#t>
<#if editItem.getCreateDV?? && editItem.getCreateDV()?? && editItem.getCreateDV() !=""><#t>
<#if !(editItem.getCreateDV() == '') || editItem.getCreateDVT() == 'CURTIME'><#t>
if (row.hasOwnProperty('${editItem.getCodeName()?lower_case}')) {
if (row.hasOwnProperty('${editItem.getCodeName()?lower_case}')) {
<#if !(editItem.getCreateDV() == '')><#t>
<#-- 网页请求 -->
<#-- 网页请求 -->
<#if editItem.getCreateDVT() == 'CONTEXT'>
<#if editItem.getCreateDVT() == 'CONTEXT'>
row['${editItem.getCodeName()?lower_case}'] = this.viewparams['${editItem.getCreateDV()}'];
row['${editItem.getCodeName()?lower_case}'] = this.viewparams['${editItem.getCreateDV()}'];
...
@@ -2184,13 +2184,16 @@ import { Environment } from '@/environments/environment';
...
@@ -2184,13 +2184,16 @@ import { Environment } from '@/environments/environment';
<#-- 当前时间 -->
<#-- 当前时间 -->
<#elseif editItem.getCreateDVT() == 'CURTIME'>
<#elseif editItem.getCreateDVT() == 'CURTIME'>
row['${editItem.getCodeName()?lower_case}'] = this.$util.dateFormat(new Date());
row['${editItem.getCodeName()?lower_case}'] = this.$util.dateFormat(new Date());
<#else>
<#-- 数据对象属性 -->
<#elseif editItem.getCreateDVT() == 'PARAM'>
row['${editItem.getCodeName()?lower_case}'] = this.computeDefaultValueWithParam("CREATE","${editItem.getCreateDV()}");
</#if>
<#else>
<#-- 默认值 -->
<#-- 默认值 -->
<#assign datatype=srfjavatype(editItem.getPSAppDEField().getStdDataType())>
<#assign datatype=srfjavatype(editItem.getPSAppDEField().getStdDataType())>
row['${editItem.getCodeName()?lower_case}'] = <#if datatype=='BigInteger' || datatype=='Integer' || datatype=='Double' || datatype=='Decimal' || datatype=='Float' || datatype=='BigDecimal'>${editItem.getCreateDV()}<#else>'${editItem.getCreateDV()}'</#if>;
row['${editItem.getCodeName()?lower_case}'] = <#if datatype=='BigInteger' || datatype=='Integer' || datatype=='Double' || datatype=='Decimal' || datatype=='Float' || datatype=='BigDecimal'>${editItem.getCreateDV()}<#else>'${editItem.getCreateDV()}'</#if>;
</#if>
}
</#if>
</#if>
}
</#if>
</#if>
</#list>
</#list>
}
}
...
@@ -2202,9 +2205,9 @@ import { Environment } from '@/environments/environment';
...
@@ -2202,9 +2205,9 @@ import { Environment } from '@/environments/environment';
*/
*/
public updateDefault(row: any){
public updateDefault(row: any){
<#list ctrl.getPSDEGridEditItems() as editItem><#t>
<#list ctrl.getPSDEGridEditItems() as editItem><#t>
<#if editItem.getUpdateDV?? && editItem.getUpdateDV()??><#t>
<#if editItem.getUpdateDV?? && editItem.getUpdateDV()?? && editItem.getUpdateDV() !=""><#t>
<#if !(editItem.getUpdateDV() == '') || editItem.getUpdateDVT() == 'CURTIME'><#t>
if (row.hasOwnProperty('${editItem.getCodeName()?lower_case}') && !row.${editItem.getCodeName()?lower_case} && !row.hasUpdated) {
if (row.hasOwnProperty('${editItem.getCodeName()?lower_case}') && !row.${editItem.getCodeName()?lower_case} && !row.hasUpdated) {
<#if !(editItem.getUpdateDV() == '')><#t>
<#-- 网页请求 -->
<#-- 网页请求 -->
<#if editItem.getUpdateDVT() == 'CONTEXT'>
<#if editItem.getUpdateDVT() == 'CONTEXT'>
row['${editItem.getCodeName()?lower_case}'] = this.viewparams['${editItem.getUpdateDV()}'];
row['${editItem.getCodeName()?lower_case}'] = this.viewparams['${editItem.getUpdateDV()}'];
...
@@ -2223,17 +2226,39 @@ import { Environment } from '@/environments/environment';
...
@@ -2223,17 +2226,39 @@ import { Environment } from '@/environments/environment';
<#-- 当前时间 -->
<#-- 当前时间 -->
<#elseif editItem.getUpdateDVT() == 'CURTIME'>
<#elseif editItem.getUpdateDVT() == 'CURTIME'>
row['${editItem.getCodeName()?lower_case}'] = this.$util.dateFormat(new Date());
row['${editItem.getCodeName()?lower_case}'] = this.$util.dateFormat(new Date());
<#else>
<#-- 数据对象属性 -->
<#-- 默认值 -->
<#elseif editItem.getUpdateDVT() == 'PARAM'>
row['${editItem.getCodeName()?lower_case}'] = this.computeDefaultValueWithParam("UPDATE","${editItem.getUpdateDV()}");
</#if>
<#else>
<#-- 默认值 -->
<#assign datatype=srfjavatype(editItem.getPSAppDEField().getStdDataType())>
<#assign datatype=srfjavatype(editItem.getPSAppDEField().getStdDataType())>
row['${editItem.getCodeName()?lower_case}'] = <#if datatype=='BigInteger' || datatype=='Integer' || datatype=='Double' || datatype=='Decimal' || datatype=='Float' || datatype=='BigDecimal'>${editItem.getUpdateDV()}<#else>'${editItem.getUpdateDV()}'</#if>;
row['${editItem.getCodeName()?lower_case}'] = <#if datatype=='BigInteger' || datatype=='Integer' || datatype=='Double' || datatype=='Decimal' || datatype=='Float' || datatype=='BigDecimal'>${editItem.getUpdateDV()}<#else>'${editItem.getUpdateDV()}'</#if>;
</#if>
}
</#if>
</#if>
}
</#if>
</#if>
</#list>
</#list>
}
}
/**
* 计算数据对象类型的默认值
* @param {string} action 行为
* @param {string} param 参数
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public computeDefaultValueWithParam(action:string,param:string){
if(Object.is(action,"UPDATE")){
const nativeData:any = this.service.getCopynativeData();
if(nativeData && (nativeData instanceof Array) && nativeData.length >0){
}else{
return null;
}
}else{
return this.service.getRemoteCopyData().test?this.service.getRemoteCopyData().test:null;
}
}
/**
/**
* 校验属性值规则
* 校验属性值规则
*
*
...
...
@CONTROL/表格/SERVICE.ts.ftl
浏览文件 @
ae5b0ddb
...
@@ -24,7 +24,15 @@ import ${srfclassname('${aggAppDataEntity.getCodeName()}')}Service from '@/servi
...
@@ -24,7 +24,15 @@ import ${srfclassname('${aggAppDataEntity.getCodeName()}')}Service from '@/servi
* @type {*}
* @type {*}
* @memberof ${srfclassname('${ctrl.codeName}')}Service
* @memberof ${srfclassname('${ctrl.codeName}')}Service
*/
*/
public copynativeData:any;
private copynativeData:any;
/**
* 远端数据
*
* @type {*}
* @memberof ${srfclassname('${ctrl.codeName}')}Service
*/
private remoteCopyData:any = {};
<#list ctrl.getPSDEGridEditItems() as deItem>
<#list ctrl.getPSDEGridEditItems() as deItem>
<#if deItem.getPSEditor()?? && deItem.getPSEditor().getPSAppDataEntity?? && deItem.getPSEditor().getPSAppDataEntity()??>
<#if deItem.getPSEditor()?? && deItem.getPSEditor().getPSAppDataEntity?? && deItem.getPSEditor().getPSAppDataEntity()??>
...
@@ -259,7 +267,7 @@ import ${srfclassname('${aggAppDataEntity.getCodeName()}')}Service from '@/servi
...
@@ -259,7 +267,7 @@ import ${srfclassname('${aggAppDataEntity.getCodeName()}')}Service from '@/servi
result =_appEntityService.FetchDefault(Context,Data, isloading);
result =_appEntityService.FetchDefault(Context,Data, isloading);
}
}
result.then((response) => {
result.then((response) => {
this.
copynativeData = Util.deepCopy
(response.data);
this.
setCopynativeData
(response.data);
this.handleResponse(action, response);
this.handleResponse(action, response);
resolve(response);
resolve(response);
}).catch(response => {
}).catch(response => {
...
@@ -343,6 +351,7 @@ import ${srfclassname('${aggAppDataEntity.getCodeName()}')}Service from '@/servi
...
@@ -343,6 +351,7 @@ import ${srfclassname('${aggAppDataEntity.getCodeName()}')}Service from '@/servi
response.data.${appde.getKeyPSAppDEField().getCodeName()?lower_case} = Util.createUUID();
response.data.${appde.getKeyPSAppDEField().getCodeName()?lower_case} = Util.createUUID();
</#if>
</#if>
}
}
this.setRemoteCopyData(response);
this.handleResponse(action, response, true);
this.handleResponse(action, response, true);
resolve(response);
resolve(response);
}).catch(response => {
}).catch(response => {
...
@@ -540,7 +549,46 @@ import ${srfclassname('${aggAppDataEntity.getCodeName()}')}Service from '@/servi
...
@@ -540,7 +549,46 @@ import ${srfclassname('${aggAppDataEntity.getCodeName()}')}Service from '@/servi
});
});
});
});
}
}
/**
* 设置远端数据
*
* @param result 远端请求结果
* @memberof ${srfclassname('${ctrl.codeName}')}Service
*/
public setRemoteCopyData(result:any){
if (result && result.status === 200) {
this.remoteCopyData = Util.deepCopy(result.data);
}
}
/**
* 获取远端数据
*
* @memberof ${srfclassname('${ctrl.codeName}')}Service
*/
public getRemoteCopyData(){
return this.remoteCopyData;
}
/**
* 设置备份原生数据
*
* @param data 远端请求结果
* @memberof ${srfclassname('${ctrl.codeName}')}Service
*/
public setCopynativeData(data:any){
this.copynativeData = Util.deepCopy(data);
}
/**
* 获取备份原生数据
*
* @memberof ${srfclassname('${ctrl.codeName}')}Service
*/
public getCopynativeData(){
return this.copynativeData;
}
<#ibizinclude>
<#ibizinclude>
../@MACRO/SERVICE/SERVICE_BOTTOM.ts.ftl
../@MACRO/SERVICE/SERVICE_BOTTOM.ts.ftl
</#ibizinclude>
</#ibizinclude>
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录