提交 67c3fbe7 编写于 作者: JunZai's avatar JunZai

update

上级 9c0ab93c
......@@ -4,7 +4,7 @@
${ctrl.render.code}
<#else>
<template v-for="(group, index) of groups">
<draggable :key="group + index" :list="group.items" group="${ctrl.name}" class="dataview-group-content" style="<#if ctrl.getGroupWidth() gt 0>width: ${ctrl.getGroupWidth()?c}px;<#else>flex-grow: 1;</#if>">
<draggable :key="group + index" :list="group.items" group="${ctrl.name}" class="dataview-group-content" style="<#if ctrl.getGroupWidth() gt 0>width: ${ctrl.getGroupWidth()?c}px;<#else>flex-grow: 1;</#if>" @change="onDragChange($event, group.name)">
<div slot="header" class="dataview-group-header">
{{ getGroupText(group.name) }}
<#if ctrl.getGroupPSUIActionGroup()??>
......@@ -34,7 +34,7 @@
<div v-for="(item, i) in group.items" :key="i" :class="{'dataview-group-item': true, 'is-select': item.isselected}" @click="handleClick(item)">
<#if ctrl.getItemPSLayoutPanel()??>
<#assign panel = ctrl.getItemPSLayoutPanel()>
<layout_${panel.getName()} name='${panel.name}' :data="item"></layout_${panel.getName()}>
<layout_${panel.getName()} name='${panel.name}' :inputData="item"></layout_${panel.getName()}>
<#elseif ctrl.itemRender??>
${ctrl.itemRender.code}
<#else>
......@@ -124,6 +124,14 @@ draggable,
*/
@Prop() public fetchAction!: string;
/**
* 部件行为--updateGroup
*
* @type {string}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
@Prop() public updateGroupAction!: string;
/**
* 是否单选
*
......@@ -510,6 +518,37 @@ draggable,
return removeData;
}
/**
* 设置分组集合
*
* @param {*}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public updateData(opt: any) {
const arg: any = { ...opt };
Object.assign(arg, this.context);
Object.assign(arg, { viewparams: this.viewparams });
const post: Promise<any> = this.service.update(this.updateGroupAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
}
return;
}
this.$emit('update');
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
});
}
/**
* 设置分组集合
*
......@@ -644,6 +683,20 @@ draggable,
</#if>
}
/**
* 拖拽变化
*
* @param {*} evt
* @param {*} name
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public onDragChange(evt: any, name: string) {
if(evt && evt.added && evt.added.element) {
evt.added.element[this.groupField] = name;
this.updateData(evt.added.element)
}
}
<#ibizinclude>
../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl
</#ibizinclude>
......
......@@ -4,6 +4,7 @@
removeAction="<#if ctrl.getRemovePSControlAction()?? && ctrl.getRemovePSControlAction().getPSAppDEMethod()??>${ctrl.getRemovePSControlAction().getPSAppDEMethod().getCodeName()}</#if>"
updateAction="<#if ctrl.getUpdatePSControlAction()?? && ctrl.getUpdatePSControlAction().getPSAppDEMethod()??>${ctrl.getUpdatePSControlAction().getPSAppDEMethod().getCodeName()}</#if>"
fetchAction="<#if ctrl.getFetchPSControlAction()?? && ctrl.getFetchPSControlAction().getPSAppDEMethod()??>${ctrl.getFetchPSControlAction().getPSAppDEMethod().getCodeName()}</#if>"
updateGroupAction="<#if ctrl.getUpdateGroupPSControlAction()?? && ctrl.getUpdateGroupPSControlAction().getPSAppDEMethod()??>${ctrl.getUpdateGroupPSControlAction().getPSAppDEMethod().getCodeName()}</#if>"
:showBusyIndicator="${ctrl.isShowBusyIndicator()?c}"
<#if view.getViewType() == 'DEDATAVIEWEXPVIEW'>
:isSelectFirstDefault="true"
......
......@@ -65,7 +65,35 @@
});
}
/**
* 更新数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof ${srfclassname('${ctrl.codeName}')}Service
*/
@Errorlog
public update(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
}else{
result =_appEntityService.update(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
<#ibizinclude>
../@MACRO/SERVICE/SERVICE_BOTTOM.ts.ftl
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册