提交 9e47054d 编写于 作者: tony001's avatar tony001

新增表格更新默认值 --- fix2

上级 13c66f49
......@@ -395,6 +395,13 @@ import { FormItemModel } from '@/model/form-detail';
*/
public totalrow: number = 0;
/**
* 表格更新默认值项
*
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public defaultUpdateItems:Array<any> =[<#list ctrl.getPSDEGridEditItems() as editItem><#if editItem.getUpdateDV?? && editItem.getUpdateDV()??>'${editItem.getCodeName()?lower_case}'</#if><#if editItem_has_next>,</#if></#list>];
/**
* 选中行数据
*
......@@ -1604,6 +1611,13 @@ import { FormItemModel } from '@/model/form-detail';
*/
public async save(args: any[], params?: any, $event?: any, xData?: any){
let _this = this;
if(_this.items && _this.items.length >0){
for (const item of _this.items) {
if(Object.is(item.rowDataState, 'update')){
_this.updateDefault(item);
}
}
}
if(!await this.validateAll()){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.rulesException') as string) });
return [];
......@@ -1631,7 +1645,7 @@ import { FormItemModel } from '@/model/form-detail';
Object.assign(this.context,{${appde.getCodeName()?lower_case}:item.${appde.getCodeName()?lower_case}});
}
</#if>
let response = await this.service.add(this.updateAction,JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator);
let response = await this.service.update(this.updateAction,JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator);
successItems.push(JSON.parse(JSON.stringify(response.data)));
}
}
......@@ -1722,6 +1736,11 @@ import { FormItemModel } from '@/model/form-detail';
*/
public gridEditItemChange(row: any, property: string, value: any, rowIndex: number){
row.rowDataState = row.rowDataState ? row.rowDataState : "update" ;
if(Object.is(row.rowDataState,"update")){
if(!value && this.defaultUpdateItems.includes(property)){
row.hasUpdated = true;
}
}
this.validate(property,row,rowIndex);
<#if ctrl.getPSDEGridEditItems()??>
<#list ctrl.getPSDEGridEditItems() as editItem>
......@@ -1862,7 +1881,7 @@ import { FormItemModel } from '@/model/form-detail';
<#list ctrl.getPSDEGridEditItems() as editItem><#t>
<#if editItem.getUpdateDV?? && editItem.getUpdateDV()??><#t>
<#if !(editItem.getUpdateDV() == '') || editItem.getUpdateDVT() == 'CURTIME'><#t>
if (row.hasOwnProperty('${editItem.getCodeName()?lower_case}') && !row.${editItem.getCodeName()?lower_case}) {
if (row.hasOwnProperty('${editItem.getCodeName()?lower_case}') && !row.${editItem.getCodeName()?lower_case} && !row.hasUpdated) {
<#-- 网页请求 -->
<#if editItem.getUpdateDVT() == 'CONTEXT'>
row['${editItem.getCodeName()?lower_case}'] = this.viewparams['${editItem.getUpdateDV()}'];
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册