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

chitanda 发布系统代码

上级 ae3a8aa7
import ViewEngine from '../view/view-engine'; import ViewEngine from '../view/view-engine';
import { events } from '@/studio-core/global/events'; import { events, ctrl } from '@/studio-core/global';
/** /**
* 快速摘要栏引擎 * 快速摘要栏引擎
...@@ -69,6 +69,11 @@ export default class DataPanelEngine extends ViewEngine { ...@@ -69,6 +69,11 @@ export default class DataPanelEngine extends ViewEngine {
this.setData(); this.setData();
}); });
} }
if (this.form) {
this.form.$on(events.ctrl.LOAD, () => {
this.setData();
});
}
} }
/** /**
...@@ -78,10 +83,18 @@ export default class DataPanelEngine extends ViewEngine { ...@@ -78,10 +83,18 @@ export default class DataPanelEngine extends ViewEngine {
*/ */
public setData(): void { public setData(): void {
const data = this.view.$appService.contextStore.getContextData(this.context, this.view.appDeName); const data = this.view.$appService.contextStore.getContextData(this.context, this.view.appDeName);
if (this.dataPanel && Object.is(this.dataPanel.controlType, 'FORM')) { if (this.dataPanel) {
if (data && data.data) { if (Object.is(this.dataPanel.controlType, ctrl.type.Form)) {
this.dataPanel.fillForm(data.data); if (data && data.data) {
this.dataPanel.fillForm(data.data);
}
} else if (Object.is(this.dataPanel.controlType, ctrl.type.Panel)) {
if (data && data.data) {
this.dataPanel.data = data.data;
this.dataPanel.$forceUpdate();
}
} }
} }
} }
......
...@@ -400,8 +400,30 @@ export default { ...@@ -400,8 +400,30 @@ export default {
uiactions: { uiactions: {
}, },
}, },
edit_introduction_form: {
details: {
group1: "客户基本信息",
formpage1: "基本信息",
srfupdatedate: "更新时间",
srforikey: "",
srfkey: "客户",
srfmajortext: "客户名称",
srftempmode: "",
srfuf: "",
srfdeid: "",
srfsourcekey: "",
industrycode: "行业",
sic: "行业编码",
ownershipcode: "所有权",
description: "说明",
accountid: "客户",
},
uiactions: {
},
},
datapanel_form: { datapanel_form: {
details: { details: {
button1: "编辑",
group1: "客户基本信息", group1: "客户基本信息",
formpage1: "基本信息", formpage1: "基本信息",
srfupdatedate: "更新时间", srfupdatedate: "更新时间",
...@@ -421,6 +443,7 @@ export default { ...@@ -421,6 +443,7 @@ export default {
accountid: "客户", accountid: "客户",
}, },
uiactions: { uiactions: {
account_edit_introduction: "编辑",
}, },
}, },
main_form: { main_form: {
...@@ -520,27 +543,6 @@ export default { ...@@ -520,27 +543,6 @@ export default {
uiactions: { uiactions: {
}, },
}, },
edit_introduction_form: {
details: {
group1: "客户基本信息",
formpage1: "基本信息",
srfupdatedate: "更新时间",
srforikey: "",
srfkey: "客户",
srfmajortext: "客户名称",
srftempmode: "",
srfuf: "",
srfdeid: "",
srfsourcekey: "",
industrycode: "行业",
sic: "行业编码",
ownershipcode: "所有权",
description: "说明",
accountid: "客户",
},
uiactions: {
},
},
info_address_form: { info_address_form: {
details: { details: {
group1: "客户基本信息", group1: "客户基本信息",
......
...@@ -399,8 +399,30 @@ export default { ...@@ -399,8 +399,30 @@ export default {
uiactions: { uiactions: {
}, },
}, },
edit_introduction_form: {
details: {
group1: "客户基本信息",
formpage1: "基本信息",
srfupdatedate: "更新时间",
srforikey: "",
srfkey: "客户",
srfmajortext: "客户名称",
srftempmode: "",
srfuf: "",
srfdeid: "",
srfsourcekey: "",
industrycode: "行业",
sic: "行业编码",
ownershipcode: "所有权",
description: "说明",
accountid: "客户",
},
uiactions: {
},
},
datapanel_form: { datapanel_form: {
details: { details: {
button1: "编辑",
group1: "客户基本信息", group1: "客户基本信息",
formpage1: "基本信息", formpage1: "基本信息",
srfupdatedate: "更新时间", srfupdatedate: "更新时间",
...@@ -420,6 +442,7 @@ export default { ...@@ -420,6 +442,7 @@ export default {
accountid: "客户", accountid: "客户",
}, },
uiactions: { uiactions: {
account_edit_introduction: "编辑",
}, },
}, },
main_form: { main_form: {
...@@ -519,27 +542,6 @@ export default { ...@@ -519,27 +542,6 @@ export default {
uiactions: { uiactions: {
}, },
}, },
edit_introduction_form: {
details: {
group1: "客户基本信息",
formpage1: "基本信息",
srfupdatedate: "更新时间",
srforikey: "",
srfkey: "客户",
srfmajortext: "客户名称",
srftempmode: "",
srfuf: "",
srfdeid: "",
srfsourcekey: "",
industrycode: "行业",
sic: "行业编码",
ownershipcode: "所有权",
description: "说明",
accountid: "客户",
},
uiactions: {
},
},
info_address_form: { info_address_form: {
details: { details: {
group1: "客户基本信息", group1: "客户基本信息",
......
...@@ -5899,6 +5899,20 @@ const router = new Router({ ...@@ -5899,6 +5899,20 @@ const router = new Router({
}, },
component: () => import('@pages/base/uom-pickup-view/uom-pickup-view.vue'), component: () => import('@pages/base/uom-pickup-view/uom-pickup-view.vue'),
}, },
{
path: 'accounts/:account?/edit_introduction/:edit_introduction?',
meta: {
caption: 'entities.account.views.edit_introduction.title',
info:'',
parameters: [
{ pathName: 'central', parameterName: 'central' },
{ pathName: 'accounts', parameterName: 'account' },
{ pathName: 'edit_introduction', parameterName: 'edit_introduction' },
],
requireAuth: true,
},
component: () => import('@pages/base/account-edit-introduction/account-edit-introduction.vue'),
},
{ {
path: 'accounts/:account?/contacts/:contact?/summaryview/:summaryview?', path: 'accounts/:account?/contacts/:contact?/summaryview/:summaryview?',
meta: { meta: {
......
...@@ -489,6 +489,7 @@ export const viewstate: any = { ...@@ -489,6 +489,7 @@ export const viewstate: any = {
'5f8f689d5dccc3db6d2b74a24a8b24ef', '5f8f689d5dccc3db6d2b74a24a8b24ef',
'7b8b062c86b8e62d907ccbd467bb7ac6', '7b8b062c86b8e62d907ccbd467bb7ac6',
'bae77557d2f7a7852b634dc5d5a93435', 'bae77557d2f7a7852b634dc5d5a93435',
'90cb61421b72cbc76f75360deffde218',
'016e75bb460270519a0ee9dda57b2c90', '016e75bb460270519a0ee9dda57b2c90',
], ],
}, },
......
/**
* 视图事件
*/
const viewEvent = {
// 模型加载
MODEL_LOADED: 'ModelLoaded'
};
/**
* 部件事件
*/
const ctrlEvent = {
// 部件加载
LOAD: 'load'
};
/**
* 导出事件
*/
export const events = { view: viewEvent, ctrl: ctrlEvent };
/**
* 部件类型
*/
const ctrlType = {
//上下文菜单
ContextMenu: 'CONTEXTMENU',
//分页导航面板
TabExpPanel: 'TABEXPPANEL',
// 列表
List: 'LIST',
// 列表视图导航栏
ListExpBar: 'LISTEXPBAR',
// 单视图面板
ViewPanel: '列表视图导航栏',
// 卡片视图导航栏
DataViewExpBar: 'DATAVIEWEXPBAR',
// 向导面板
WizardPanel: 'WIZARDPANEL',
// 图表视图导航栏
ChartExpBar: 'CHARTEXPBAR',
// 地图视图导航栏
MapExpBar: 'MAPEXPBAR',
// 地图部件
Map: 'MAP',
// 多编辑视图面板
MultiEditViewPanel: 'MULTIEDITVIEWPANEL',
// 导航栏
ExpBar: '导航栏',
// 工具栏
Toolbar: 'TOOLBAR',
// 应用菜单
AppMenu: 'APPMENU',
// 报表面板
RePortPanel: 'REPORTPANEL',
// 搜索栏
SearchBar: 'SEARCHBAR',
// 搜索表单
SearchForm: 'SEARCHFORM',
// 数据关系分页部件
DrTab: 'DRTAB',
// 数据关系栏
DrBar: 'DRBAR',
// 数据图表
Chart: 'CHART',
// 数据看板
Dashboard: 'DASHBOARD',
// 数据表格
Grid: 'GRID',
// 数据视图
DataView: 'DATAVIEW',
// 日历视图导航栏
CalendarExpBar: 'CALENDAREXPBAR',
// 日历部件
Calendar: 'CALENDAR',
// 更新面板
UpdatePanel: 'UPDATEPANEL',
// 标题栏
TitleBar: 'TITLEBAR',
// 树表格
TreeGrid: 'TREEGRID',
// 树表格(增强)
TreeGridEx: 'TREEGRIDEX',
// 树视图
TreeView: 'TREEVIEW',
// 树视图导航栏
TreeExpBar: 'TREEEXPBAR',
// 流程导航栏
WfExpBar: 'WFEXPBAR',
// 状态向导面板
StateWizardPanel: 'STATEWIZARDPANEL',
// 甘特视图导航栏
GanttExpBar: 'GANTTEXPBAR',
// 甘特部件
Gantt: 'GANTT',
// 看板
KanBan: 'KANBAN',
// 自定义部件
Custom: 'CUSTOM',
// 表单
Form: 'FORM',
// 表格视图导航栏
GridExpBar: 'GRIDEXPBAR',
// 视图布局面板
ViewLayoutPanel: 'VIEWLAYOUTPANEL',
// 选择视图面板
PickupViewPanel: 'PICKUPVIEWPANEL',
// 门户部件
Portlet: 'PORTLET',
// 面板
Panel: 'PANEL'
};
/**
* 部件类型
*/
export const ctrl = { type: ctrlType };
\ No newline at end of file
...@@ -54,6 +54,7 @@ export { GridControllerBase } from './widgets/GridControllerBase'; ...@@ -54,6 +54,7 @@ export { GridControllerBase } from './widgets/GridControllerBase';
export { ListControllerBase } from './widgets/ListControllerBase'; export { ListControllerBase } from './widgets/ListControllerBase';
export { EditFormControlBase } from './widgets/EditFormControlBase'; export { EditFormControlBase } from './widgets/EditFormControlBase';
export { MDControlBase } from './widgets/MDControlBase'; export { MDControlBase } from './widgets/MDControlBase';
export { PanelControlBase } from './widgets/PanelControlBase';
export { SearchFormControlBase } from './widgets/SearchFormControlBase'; export { SearchFormControlBase } from './widgets/SearchFormControlBase';
export { TabExpPanelControlBase } from './widgets/TabExpPanelControlBase'; export { TabExpPanelControlBase } from './widgets/TabExpPanelControlBase';
// 组件 Start // 组件 Start
......
import { ViewBase } from './ViewBase'; import { ViewBase } from './ViewBase';
import { events } from '../global/events'; import { events } from '../global';
/** /**
* 导航视图基类 * 导航视图基类
......
import { Prop } from 'vue-property-decorator'; import { Prop } from 'vue-property-decorator';
import { Subject, Subscription } from 'rxjs'; import { Subject } from 'rxjs';
import { FormButtonModel, FormPageModel, FormItemModel, FormDRUIPartModel, FormPartModel, FormGroupPanelModel, FormIFrameModel, FormRowItemModel, FormTabPageModel, FormTabPanelModel, FormUserControlModel } from '@/model/form-detail'; import { FormItemModel } from '@/model/form-detail';
import { MainControlBase } from './MainControlBase'; import { MainControlBase } from './MainControlBase';
import { events } from '../global';
/** /**
* 表单部件基类 * 表单部件基类
...@@ -453,7 +454,7 @@ export class FormControlBase extends MainControlBase { ...@@ -453,7 +454,7 @@ export class FormControlBase extends MainControlBase {
if (response && response.status === 200) { if (response && response.status === 200) {
const data = response.data; const data = response.data;
this.onFormLoad(data, 'load'); this.onFormLoad(data, 'load');
this.$emit('load', data); this.$emit(events.ctrl.LOAD, data);
this.$nextTick(() => { this.$nextTick(() => {
this.formState.next({ type: 'load', data: data }); this.formState.next({ type: 'load', data: data });
}); });
......
import { Prop } from 'vue-property-decorator';
import { Watch } from '../decorators/VueLifeCycleProcessing';
import { ControlBase } from './ControlBase';
import CodeListService from '@/service/app/codelist-service';
/**
* 面板部件基类
*
* @export
* @class PanelControlBase
* @extends {ControlBase}
*/
export class PanelControlBase extends ControlBase {
/**
* 代码表服务对象
*
* @type {CodeListService}
* @memberof PanelControlBase
*/
public codeListService: CodeListService = new CodeListService({ $store: this.$store });
/**
* 数据
*
* @type {*}
* @memberof PanelControlBase
*/
public data: any = {};
/**
* 面板数据
*
* @type {*}
* @memberof PanelControlBase
*/
public panelData: any = null;
/**
* 详情模型集合
*
* @type {*}
* @memberof PanelControlBase
*/
public detailsModel: any = {};
/**
* 数据模型
*
* @type {*}
* @memberof PanelControlBase
*/
public dataModel: any = null;
/**
*
*
* @returns {any[]}
* @memberof PanelControlBase
*/
public getDatas(): any[] {
if (!this.panelData) {
return [];
}
return [this.panelData];
}
/**
*
*
* @returns
* @memberof PanelControlBase
*/
public getData() {
return this.data;
}
/**
* 父级部件引用
*
* @type {*}
* @memberof PanelControlBase
*/
@Prop()
public parentRef?: any;
/**
* 面板数据对象
*
* @type {*}
* @memberof PanelControlBase
*/
@Prop()
public inputData?: any;
/**
* 监听数据对象
*
* @param {*} newVal
* @param {*} oldVal
* @memberof PanelControlBase
*/
@Watch('inputData', { immediate: true })
async onInputDataChange(newVal: any, oldVal: any) {
if (newVal) {
await this.computedUIData(newVal);
this.panelLogic({ name: '', newVal: null, oldVal: null });
this.$forceUpdate();
}
}
/**
* 面板逻辑
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof PanelControlBase
*/
public panelLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void { }
/**
* 计算UI展示数据
*
* @param {*} newVal
* @memberof PanelControlBase
*/
public async computedUIData(newVal: any) {
let codelistArray: Array<any> = [];
if ((this.dataModel.getDataItems instanceof Function) && this.dataModel.getDataItems().length > 0) {
this.dataModel.getDataItems().forEach((item: any) => {
if (item.codelist) {
codelistArray.push(item.codelist);
}
})
if (codelistArray.length > 0) {
let res: any = await this.getAllCodeList(codelistArray);
this.dataModel.getDataItems().forEach((item: any) => {
if (item.codelist) {
this.data[item.name] = res.get(item.codelist.tag).get(newVal[item.prop]);
} else {
this.data[item.name] = newVal[item.prop];
}
})
} else {
this.dataModel.getDataItems().forEach((item: any) => {
this.data[item.name] = newVal[item.prop];
})
}
}
}
/**
* 计算面板数据
*
* @memberof PanelControlBase
*/
public async computePanelData() {
let codelistArray: Array<any> = [];
let panelData: any = {};
if ((this.dataModel.getDataItems instanceof Function) && this.dataModel.getDataItems().length > 0) {
this.dataModel.getDataItems().forEach((item: any) => {
if (item.codelist) {
codelistArray.push(item.codelist);
}
})
if (codelistArray.length > 0) {
let res: any = await this.getAllCodeList(codelistArray, true);
this.dataModel.getDataItems().forEach((item: any) => {
if (item.codelist) {
panelData[item.prop] = res.get(item.codelist.tag).get(this.data[item.name]);
} else {
panelData[item.prop] = this.data[item.name];
}
})
} else {
this.dataModel.getDataItems().forEach((item: any) => {
panelData[item.prop] = this.data[item.name];
})
}
}
this.panelData = Object.assign(JSON.parse(JSON.stringify(this.inputData)), panelData);
}
/**
* 获取所有代码表
*
* @param {Array<any>} codelistArray 代码表模型数组
* @param {boolean} [reverse=false]
* @returns {Promise<any>}
* @memberof PanelControlBase
*/
public getAllCodeList(codelistArray: Array<any>, reverse: boolean = false): Promise<any> {
return new Promise((resolve: any, reject: any) => {
let codeListMap: Map<string, any> = new Map();
let promiseArray: Array<any> = [];
codelistArray.forEach((item: any) => {
if (!codeListMap.get(item.tag)) {
promiseArray.push(this.getCodeList(item));
Promise.all(promiseArray).then((result: any) => {
if (result && result.length > 0) {
result.forEach((codeList: any) => {
let tempCodeListMap: Map<number, any> = new Map();
if (codeList.length > 0) {
codeList.forEach((codeListItem: any) => {
if (reverse) {
tempCodeListMap.set(codeListItem.text, codeListItem.value);
} else {
tempCodeListMap.set(codeListItem.value, codeListItem.text);
}
})
}
codeListMap.set(item.tag, tempCodeListMap);
})
resolve(codeListMap);
}
})
}
})
})
}
/**
* 获取代码表
*
* @param codeListObject 传入代码表对象
* @memberof PanelControlBase
*/
public getCodeList(codeListObject: any): Promise<any> {
return new Promise((resolve: any, reject: any) => {
if (codeListObject.tag && Object.is(codeListObject.codelistType, "STATIC")) {
const codelist = this.$store.getters.getCodeList(codeListObject.tag);
if (codelist) {
resolve([...JSON.parse(JSON.stringify(codelist.items))]);
} else {
resolve([]);
}
} else if (codeListObject.tag && Object.is(codeListObject.codelistType, "DYNAMIC")) {
this.codeListService.getItems(codeListObject.tag).then((res: any) => {
resolve(res);
}).catch((error: any) => {
resolve([]);
});
}
})
}
/**
* 打开编辑数据视图
*
* @type {any}
* @memberof PanelControlBase
*/
public opendata(args: any[], fullargs?: any[], params?: any, $event?: any, xData?: any) {
if (this.parentRef.opendata && this.parentRef.opendata instanceof Function) {
this.parentRef.opendata(args, fullargs, params, $event, xData);
}
}
/**
* 打开新建数据视图
*
* @type {any}
* @memberof PanelControlBase
*/
public newdata(args: any[], fullargs?: any[], params?: any, $event?: any, xData?: any) {
if (this.parentRef.newdata && this.parentRef.newdata instanceof Function) {
this.parentRef.newdata(args, fullargs, params, $event, xData);
}
}
/**
* 删除
*
* @param {any[]} datas
* @returns {Promise<any>}
* @memberof PanelControlBase
*/
public async remove(datas: any[]): Promise<any> {
if (this.parentRef.remove && this.parentRef.remove instanceof Function) {
return this.parentRef.remove(datas);
}
}
/**
* 刷新
*
* @param {*} [opt={}]
* @memberof PanelControlBase
*/
public refresh(opt: any = {}) {
if (this.parentRef.refresh && this.parentRef.refresh instanceof Function) {
this.parentRef.refresh(opt);
}
}
/**
* 设置面板编辑项值变更
*
* @param data 面板数据
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof PanelControlBase
*/
public onPanelItemValueChange(data: any, $event: { name: string, value: any }): void {
if (!$event) {
return;
}
if (!$event.name || Object.is($event.name, '') || !data.hasOwnProperty($event.name)) {
return;
}
data[$event.name] = $event.value;
this.panelEditItemChange(data, $event.name, $event.value);
}
/**
* 面板编辑项值变化
*
* @public
* @param data 面板数据
* @param property 编辑项名
* @param value 编辑项值
* @returns {void}
* @memberof PanelControlBase
*/
public panelEditItemChange(data: any, property: string, value: any) {
// 面板数据变化事件
if ((this.dataModel.getDataItems instanceof Function) && this.dataModel.getDataItems().length > 0) {
let modelitem = this.dataModel.getDataItems().find((item: any) => {
return item.name === property;
})
if (modelitem) {
this.$emit('panelDataChange', { [modelitem.prop]: value });
}
}
}
}
\ No newline at end of file
...@@ -560,6 +560,72 @@ export default class AccountUIServiceBase extends UIService { ...@@ -560,6 +560,72 @@ export default class AccountUIServiceBase extends UIService {
backend(); backend();
} }
/**
* 编辑
*
* @param {any[]} args 当前数据
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
* @returns {Promise<any>}
*/
public async Account_Edit_Introduction(args: any[], context:any = {} ,params: any={}, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
let data: any = {};
let parentContext:any = {};
let parentViewParam:any = {};
const _this: any = actionContext;
const _args: any[] = Util.deepCopy(args);
const actionTarget: string | null = 'SINGLEKEY';
Object.assign(context, { account: '%account%' });
Object.assign(params, { accountid: '%account%' });
Object.assign(params, { accountname: '%accountname%' });
if(_this.context){
parentContext = _this.context;
}
if(_this.viewparams){
parentViewParam = _this.viewparams;
}
context = UIActionTool.handleContextParam(actionTarget,_args,parentContext,parentViewParam,context);
data = UIActionTool.handleActionParam(actionTarget,_args,parentContext,parentViewParam,params);
context = Object.assign({},actionContext.context,context);
let parentObj:any = {srfparentdename:srfParentDeName?srfParentDeName:null,srfparentkey:srfParentDeName?context[srfParentDeName.toLowerCase()]:null};
Object.assign(data,parentObj);
Object.assign(context,parentObj);
let deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'accounts', parameterName: 'account' },
];
const openDrawer = (view: any, data: any) => {
let container: Subject<any> = actionContext.$appdrawer.openDrawer(view, context,data);
container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
const _this: any = actionContext;
if (xData && xData.refresh && xData.refresh instanceof Function) {
xData.refresh(args);
}
if(window.opener){
window.opener.postMessage({status:'OK',identification:'WF'},Environment.uniteAddress);
window.close();
}
return result.datas;
});
}
const view: any = {
viewname: 'account-edit-introduction',
height: 0,
width: 450,
title: actionContext.$t('entities.account.views.edit_introduction.title'),
placement: 'DRAWER_RIGHT',
};
openDrawer(view, data);
}
/** /**
* 获取指定数据的重定向页面 * 获取指定数据的重定向页面
......
...@@ -3,6 +3,7 @@ import { Subject, Subscription } from 'rxjs'; ...@@ -3,6 +3,7 @@ import { Subject, Subscription } from 'rxjs';
import { Watch, EditFormControlBase } from '@/studio-core'; import { Watch, EditFormControlBase } from '@/studio-core';
import AccountService from '@/service/account/account-service'; import AccountService from '@/service/account/account-service';
import DataPanelService from './data-panel-form-service'; import DataPanelService from './data-panel-form-service';
import AccountUIService from '@/uiservice/account/account-ui-service';
import { FormButtonModel, FormPageModel, FormItemModel, FormDRUIPartModel, FormPartModel, FormGroupPanelModel, FormIFrameModel, FormRowItemModel, FormTabPageModel, FormTabPanelModel, FormUserControlModel } from '@/model/form-detail'; import { FormButtonModel, FormPageModel, FormItemModel, FormDRUIPartModel, FormPartModel, FormGroupPanelModel, FormIFrameModel, FormRowItemModel, FormTabPageModel, FormTabPanelModel, FormUserControlModel } from '@/model/form-detail';
...@@ -49,6 +50,34 @@ export class DataPanelEditFormBase extends EditFormControlBase { ...@@ -49,6 +50,34 @@ export class DataPanelEditFormBase extends EditFormControlBase {
*/ */
protected appDeName: string = 'account'; protected appDeName: string = 'account';
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public datapanel_button1_click(params: any = {}, tag?: any, $event?: any) {
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this;
if (_this.getDatas && _this.getDatas instanceof Function) {
datas = [..._this.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
const curUIService:AccountUIService = new AccountUIService();
curUIService.Account_Edit_Introduction(datas,contextJO, paramJO, $event, xData,this,"Account");
}
/** /**
* 表单数据对象 * 表单数据对象
* *
...@@ -90,6 +119,8 @@ export class DataPanelEditFormBase extends EditFormControlBase { ...@@ -90,6 +119,8 @@ export class DataPanelEditFormBase extends EditFormControlBase {
* @memberof DataPanelEditFormBase * @memberof DataPanelEditFormBase
*/ */
public detailsModel: any = { public detailsModel: any = {
button1: new FormButtonModel({ caption: '编辑', detailType: 'BUTTON', name: 'button1', visible: true, isShowCaption: false, form: this, uiaction: { type: 'DEUIACTION', tag: 'Edit_Introduction', actiontarget: 'SINGLEKEY' } }),
group1: new FormGroupPanelModel({ caption: '客户基本信息', detailType: 'GROUPPANEL', name: 'group1', visible: true, isShowCaption: false, form: this, uiActionGroup: { caption: '', langbase: 'entities.account.datapanel_form', extractMode: 'ITEM', details: [] } }), group1: new FormGroupPanelModel({ caption: '客户基本信息', detailType: 'GROUPPANEL', name: 'group1', visible: true, isShowCaption: false, form: this, uiActionGroup: { caption: '', langbase: 'entities.account.datapanel_form', extractMode: 'ITEM', details: [] } }),
formpage1: new FormPageModel({ caption: '基本信息', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this }), formpage1: new FormPageModel({ caption: '基本信息', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this }),
...@@ -125,4 +156,14 @@ export class DataPanelEditFormBase extends EditFormControlBase { ...@@ -125,4 +156,14 @@ export class DataPanelEditFormBase extends EditFormControlBase {
accountid: new FormItemModel({ caption: '客户', detailType: 'FORMITEM', name: 'accountid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 }), accountid: new FormItemModel({ caption: '客户', detailType: 'FORMITEM', name: 'accountid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 }),
}; };
/**
* 表单 编辑 事件
*
* @memberof @memberof DataPanelEditFormBase
*/
public button1_click($event: any): void {
this.datapanel_button1_click(null, null, $event);
}
} }
\ No newline at end of file
...@@ -46,6 +46,14 @@ ...@@ -46,6 +46,14 @@
<app-span name='owneridyominame' :value="data.owneridyominame" :data="data" :context="context" :viewparams="viewparams" :localContext ='{ }' :localParam ='{ }' style=""></app-span> <app-span name='owneridyominame' :value="data.owneridyominame" :data="data" :context="context" :viewparams="viewparams" :localContext ='{ }' :localParam ='{ }' style=""></app-span>
</app-form-item> </app-form-item>
</div>
<div v-show="detailsModel.button1.visible" :style="{}">
<i-button type="primary" @click="button1_click($event)"
style="">
<i class="fa fa-angle-down" style="margin-right: 2px;"></i>
</i-button>
</div> </div>
</div> </div>
......
import { Prop, Provide, Emit, Model } from 'vue-property-decorator'; import { Prop, Provide, Emit, Model } from 'vue-property-decorator';
import { Subject, Subscription } from 'rxjs'; import { Subject, Subscription } from 'rxjs';
import { Watch, MainControlBase } from '@/studio-core'; import { Watch, PanelControlBase } from '@/studio-core';
import ActivityPointerService from '@/service/activity-pointer/activity-pointer-service'; import ActivityPointerService from '@/service/activity-pointer/activity-pointer-service';
import ByRegardingObjectIdService from './by-regarding-object-id-panel-service'; import ByRegardingObjectIdService from './by-regarding-object-id-panel-service';
import { FormItemModel } from '@/model/form-detail'; import { FormItemModel } from '@/model/form-detail';
...@@ -12,10 +12,10 @@ import CodeListService from "@service/app/codelist-service"; ...@@ -12,10 +12,10 @@ import CodeListService from "@service/app/codelist-service";
* dashboard_sysportlet2_list_itempanel部件基类 * dashboard_sysportlet2_list_itempanel部件基类
* *
* @export * @export
* @class MainControlBase * @class PanelControlBase
* @extends {ByRegardingObjectIdPanelBase} * @extends {ByRegardingObjectIdPanelBase}
*/ */
export class ByRegardingObjectIdPanelBase extends MainControlBase { export class ByRegardingObjectIdPanelBase extends PanelControlBase {
/** /**
* 获取部件类型 * 获取部件类型
...@@ -51,53 +51,6 @@ export class ByRegardingObjectIdPanelBase extends MainControlBase { ...@@ -51,53 +51,6 @@ export class ByRegardingObjectIdPanelBase extends MainControlBase {
*/ */
protected appDeName: string = 'activitypointer'; protected appDeName: string = 'activitypointer';
/**
* 接口实现
*
* @returns {any[]}
* @memberof ByRegardingObjectId
*/
getDatas(): any[] {
if (!this.panelData) {
return [];
}
return [this.panelData];
}
/**
* 接口实现
*
* @returns {*}
* @memberof ByRegardingObjectId
*/
getData() {
return this.data;
}
/**
* 父级部件引用
*
* @type {*}
* @memberof ByRegardingObjectId
*/
@Prop() public parentRef?: any;
/**
* 面板数据对象
*
* @type {*}
* @memberof ByRegardingObjectId
*/
@Prop() public inputData?: any;
/**
* 代码表服务对象
*
* @type {CodeListService}
* @memberof ByRegardingObjectId
*/
public codeListService:CodeListService = new CodeListService({ $store:this.$store });
/** /**
* 详情模型集合 * 详情模型集合
* *
...@@ -130,162 +83,7 @@ export class ByRegardingObjectIdPanelBase extends MainControlBase { ...@@ -130,162 +83,7 @@ export class ByRegardingObjectIdPanelBase extends MainControlBase {
* @type {ByRegardingObjectIdModel} * @type {ByRegardingObjectIdModel}
* @memberof ByRegardingObjectId * @memberof ByRegardingObjectId
*/ */
public dataModel:ByRegardingObjectIdModel = new ByRegardingObjectIdModel(); public dataModel: ByRegardingObjectIdModel = new ByRegardingObjectIdModel();
/**
* UI数据对象
*
* @type {*}
* @memberof ByRegardingObjectId
*/
public data:any = {};
/**
* 面板数据对象
*
* @type {*}
* @memberof Mob
*/
public panelData:any = null;
/**
* 监听数据对象
*
* @memberof ByRegardingObjectId
*/
@Watch('inputData',{immediate:true})
async onInputDataChange(newVal: any, oldVal: any){
if(newVal){
await this.computedUIData(newVal);
this.panelLogic({ name: '', newVal: null, oldVal: null });
this.$forceUpdate();
}
}
/**
* 计算UI展示数据
*
* @param codelistArray 代码表模型数组
* @memberof ByRegardingObjectId
*/
public async computedUIData(newVal:any){
let codelistArray:Array<any> = [];
if((this.dataModel.getDataItems instanceof Function) && this.dataModel.getDataItems().length >0){
this.dataModel.getDataItems().forEach((item:any) =>{
if(item.codelist){
codelistArray.push(item.codelist);
}
})
if(codelistArray.length >0){
let res:any = await this.getAllCodeList(codelistArray);
this.dataModel.getDataItems().forEach((item:any) =>{
if(item.codelist){
this.data[item.name] = res.get(item.codelist.tag).get(newVal[item.prop]);
}else{
this.data[item.name] = newVal[item.prop];
}
})
}else{
this.dataModel.getDataItems().forEach((item:any) =>{
this.data[item.name] = newVal[item.prop];
})
}
}
}
/**
* 计算面板数据
*
* @param codelistArray 代码表模型数组
* @memberof Mob
*/
public async computePanelData(){
let codelistArray:Array<any> = [];
let panelData:any = {};
if((this.dataModel.getDataItems instanceof Function) && this.dataModel.getDataItems().length >0){
this.dataModel.getDataItems().forEach((item:any) =>{
if(item.codelist){
codelistArray.push(item.codelist);
}
})
if(codelistArray.length >0){
let res:any = await this.getAllCodeList(codelistArray,true);
this.dataModel.getDataItems().forEach((item:any) =>{
if(item.codelist){
panelData[item.prop] = res.get(item.codelist.tag).get(this.data[item.name]);
}else{
panelData[item.prop] = this.data[item.name];
}
})
}else{
this.dataModel.getDataItems().forEach((item:any) =>{
panelData[item.prop] = this.data[item.name];
})
}
}
this.panelData = Object.assign(JSON.parse(JSON.stringify(this.inputData)),panelData);
}
/**
* 获取所有代码表
*
* @param codelistArray 代码表模型数组
* @memberof ByRegardingObjectId
*/
public getAllCodeList(codelistArray:Array<any>,reverse:boolean = false):Promise<any>{
return new Promise((resolve:any,reject:any) =>{
let codeListMap:Map<string,any> = new Map();
let promiseArray:Array<any> = [];
codelistArray.forEach((item:any) =>{
if(!codeListMap.get(item.tag)){
promiseArray.push(this.getCodeList(item));
Promise.all(promiseArray).then((result:any) =>{
if(result && result.length >0){
result.forEach((codeList:any) =>{
let tempCodeListMap:Map<number,any> = new Map();
if(codeList.length >0){
codeList.forEach((codeListItem:any) =>{
if(reverse){
tempCodeListMap.set(codeListItem.text,codeListItem.value);
}else{
tempCodeListMap.set(codeListItem.value,codeListItem.text);
}
})
}
codeListMap.set(item.tag,tempCodeListMap);
})
resolve(codeListMap);
}
})
}
})
})
}
/**
* 获取代码表
*
* @param codeListObject 传入代码表对象
* @memberof ByRegardingObjectId
*/
public getCodeList(codeListObject:any):Promise<any>{
return new Promise((resolve:any,reject:any) =>{
if(codeListObject.tag && Object.is(codeListObject.codelistType,"STATIC")){
const codelist = this.$store.getters.getCodeList(codeListObject.tag);
if (codelist) {
resolve([...JSON.parse(JSON.stringify(codelist.items))]);
} else {
resolve([]);
}
}else if(codeListObject.tag && Object.is(codeListObject.codelistType,"DYNAMIC")){
this.codeListService.getItems(codeListObject.tag).then((res:any) => {
resolve(res);
}).catch((error:any) => {
resolve([]);
});
}
})
}
/** /**
* 界面行为 * 界面行为
...@@ -298,95 +96,4 @@ export class ByRegardingObjectIdPanelBase extends MainControlBase { ...@@ -298,95 +96,4 @@ export class ByRegardingObjectIdPanelBase extends MainControlBase {
public async uiAction(row: any, tag: any, $event: any) { public async uiAction(row: any, tag: any, $event: any) {
await this.computePanelData(); await this.computePanelData();
} }
/**
* 打开编辑数据视图
*
* @type {any}
* @memberof ByRegardingObjectId
*/
public opendata(args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any){
if (this.parentRef.opendata && this.parentRef.opendata instanceof Function) {
this.parentRef.opendata(args,fullargs,params, $event, xData);
}
}
/**
* 打开新建数据视图
*
* @type {any}
* @memberof ByRegardingObjectId
*/
public newdata(args: any[],fullargs?:any[], params?: any, $event?: any, xData?: any) {
if (this.parentRef.newdata && this.parentRef.newdata instanceof Function) {
this.parentRef.newdata(args,fullargs,params, $event, xData);
}
}
/**
* 删除
*
* @param {any[]} datas
* @returns {Promise<any>}
* @memberof ByRegardingObjectId
*/
public async remove(datas: any[]): Promise<any> {
if (this.parentRef.remove && this.parentRef.remove instanceof Function) {
return this.parentRef.remove(datas);
}
}
/**
* 刷新
*
* @param {*} [opt={}]
* @memberof Main
*/
public refresh(opt: any = {}) {
if (this.parentRef.refresh && this.parentRef.refresh instanceof Function) {
this.parentRef.refresh(opt);
}
}
/**
* 设置面板编辑项值变更
*
* @param data 面板数据
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof ByRegardingObjectId
*/
public onPanelItemValueChange(data: any,$event: { name: string, value: any }): void {
if (!$event) {
return;
}
if (!$event.name || Object.is($event.name, '') || !data.hasOwnProperty($event.name)) {
return;
}
data[$event.name] = $event.value;
this.panelEditItemChange(data, $event.name, $event.value);
}
/**
* 面板编辑项值变化
*
* @public
* @param data 面板数据
* @param property 编辑项名
* @param value 编辑项值
* @returns {void}
* @memberof ByRegardingObjectId
*/
public panelEditItemChange(data: any, property: string, value: any){
// 面板数据变化事件
if((this.dataModel.getDataItems instanceof Function) && this.dataModel.getDataItems().length >0){
let modelitem =this.dataModel.getDataItems().find((item:any) =>{
return item.name === property;
})
if(modelitem){
this.$emit('panelDataChange',{[modelitem.prop]: value});
}
}
}
} }
\ No newline at end of file
import { Prop, Provide, Emit, Model } from 'vue-property-decorator'; import { Prop, Provide, Emit, Model } from 'vue-property-decorator';
import { Subject, Subscription } from 'rxjs'; import { Subject, Subscription } from 'rxjs';
import { Watch, MainControlBase } from '@/studio-core'; import { Watch, PanelControlBase } from '@/studio-core';
import ContactService from '@/service/contact/contact-service'; import ContactService from '@/service/contact/contact-service';
import DataPanelService from './data-panel-panel-service'; import DataPanelService from './data-panel-panel-service';
import { FormItemModel } from '@/model/form-detail'; import { FormItemModel } from '@/model/form-detail';
...@@ -12,10 +12,10 @@ import CodeListService from "@service/app/codelist-service"; ...@@ -12,10 +12,10 @@ import CodeListService from "@service/app/codelist-service";
* datapanel部件基类 * datapanel部件基类
* *
* @export * @export
* @class MainControlBase * @class PanelControlBase
* @extends {DataPanelPanelBase} * @extends {DataPanelPanelBase}
*/ */
export class DataPanelPanelBase extends MainControlBase { export class DataPanelPanelBase extends PanelControlBase {
/** /**
* 获取部件类型 * 获取部件类型
...@@ -51,53 +51,6 @@ export class DataPanelPanelBase extends MainControlBase { ...@@ -51,53 +51,6 @@ export class DataPanelPanelBase extends MainControlBase {
*/ */
protected appDeName: string = 'contact'; protected appDeName: string = 'contact';
/**
* 接口实现
*
* @returns {any[]}
* @memberof DataPanel
*/
getDatas(): any[] {
if (!this.panelData) {
return [];
}
return [this.panelData];
}
/**
* 接口实现
*
* @returns {*}
* @memberof DataPanel
*/
getData() {
return this.data;
}
/**
* 父级部件引用
*
* @type {*}
* @memberof DataPanel
*/
@Prop() public parentRef?: any;
/**
* 面板数据对象
*
* @type {*}
* @memberof DataPanel
*/
@Prop() public inputData?: any;
/**
* 代码表服务对象
*
* @type {CodeListService}
* @memberof DataPanel
*/
public codeListService:CodeListService = new CodeListService({ $store:this.$store });
/** /**
* 详情模型集合 * 详情模型集合
* *
...@@ -132,162 +85,7 @@ export class DataPanelPanelBase extends MainControlBase { ...@@ -132,162 +85,7 @@ export class DataPanelPanelBase extends MainControlBase {
* @type {DataPanelModel} * @type {DataPanelModel}
* @memberof DataPanel * @memberof DataPanel
*/ */
public dataModel:DataPanelModel = new DataPanelModel(); public dataModel: DataPanelModel = new DataPanelModel();
/**
* UI数据对象
*
* @type {*}
* @memberof DataPanel
*/
public data:any = {};
/**
* 面板数据对象
*
* @type {*}
* @memberof Mob
*/
public panelData:any = null;
/**
* 监听数据对象
*
* @memberof DataPanel
*/
@Watch('inputData',{immediate:true})
async onInputDataChange(newVal: any, oldVal: any){
if(newVal){
await this.computedUIData(newVal);
this.panelLogic({ name: '', newVal: null, oldVal: null });
this.$forceUpdate();
}
}
/**
* 计算UI展示数据
*
* @param codelistArray 代码表模型数组
* @memberof DataPanel
*/
public async computedUIData(newVal:any){
let codelistArray:Array<any> = [];
if((this.dataModel.getDataItems instanceof Function) && this.dataModel.getDataItems().length >0){
this.dataModel.getDataItems().forEach((item:any) =>{
if(item.codelist){
codelistArray.push(item.codelist);
}
})
if(codelistArray.length >0){
let res:any = await this.getAllCodeList(codelistArray);
this.dataModel.getDataItems().forEach((item:any) =>{
if(item.codelist){
this.data[item.name] = res.get(item.codelist.tag).get(newVal[item.prop]);
}else{
this.data[item.name] = newVal[item.prop];
}
})
}else{
this.dataModel.getDataItems().forEach((item:any) =>{
this.data[item.name] = newVal[item.prop];
})
}
}
}
/**
* 计算面板数据
*
* @param codelistArray 代码表模型数组
* @memberof Mob
*/
public async computePanelData(){
let codelistArray:Array<any> = [];
let panelData:any = {};
if((this.dataModel.getDataItems instanceof Function) && this.dataModel.getDataItems().length >0){
this.dataModel.getDataItems().forEach((item:any) =>{
if(item.codelist){
codelistArray.push(item.codelist);
}
})
if(codelistArray.length >0){
let res:any = await this.getAllCodeList(codelistArray,true);
this.dataModel.getDataItems().forEach((item:any) =>{
if(item.codelist){
panelData[item.prop] = res.get(item.codelist.tag).get(this.data[item.name]);
}else{
panelData[item.prop] = this.data[item.name];
}
})
}else{
this.dataModel.getDataItems().forEach((item:any) =>{
panelData[item.prop] = this.data[item.name];
})
}
}
this.panelData = Object.assign(JSON.parse(JSON.stringify(this.inputData)),panelData);
}
/**
* 获取所有代码表
*
* @param codelistArray 代码表模型数组
* @memberof DataPanel
*/
public getAllCodeList(codelistArray:Array<any>,reverse:boolean = false):Promise<any>{
return new Promise((resolve:any,reject:any) =>{
let codeListMap:Map<string,any> = new Map();
let promiseArray:Array<any> = [];
codelistArray.forEach((item:any) =>{
if(!codeListMap.get(item.tag)){
promiseArray.push(this.getCodeList(item));
Promise.all(promiseArray).then((result:any) =>{
if(result && result.length >0){
result.forEach((codeList:any) =>{
let tempCodeListMap:Map<number,any> = new Map();
if(codeList.length >0){
codeList.forEach((codeListItem:any) =>{
if(reverse){
tempCodeListMap.set(codeListItem.text,codeListItem.value);
}else{
tempCodeListMap.set(codeListItem.value,codeListItem.text);
}
})
}
codeListMap.set(item.tag,tempCodeListMap);
})
resolve(codeListMap);
}
})
}
})
})
}
/**
* 获取代码表
*
* @param codeListObject 传入代码表对象
* @memberof DataPanel
*/
public getCodeList(codeListObject:any):Promise<any>{
return new Promise((resolve:any,reject:any) =>{
if(codeListObject.tag && Object.is(codeListObject.codelistType,"STATIC")){
const codelist = this.$store.getters.getCodeList(codeListObject.tag);
if (codelist) {
resolve([...JSON.parse(JSON.stringify(codelist.items))]);
} else {
resolve([]);
}
}else if(codeListObject.tag && Object.is(codeListObject.codelistType,"DYNAMIC")){
this.codeListService.getItems(codeListObject.tag).then((res:any) => {
resolve(res);
}).catch((error:any) => {
resolve([]);
});
}
})
}
/** /**
* 界面行为 * 界面行为
...@@ -300,95 +98,4 @@ export class DataPanelPanelBase extends MainControlBase { ...@@ -300,95 +98,4 @@ export class DataPanelPanelBase extends MainControlBase {
public async uiAction(row: any, tag: any, $event: any) { public async uiAction(row: any, tag: any, $event: any) {
await this.computePanelData(); await this.computePanelData();
} }
/**
* 打开编辑数据视图
*
* @type {any}
* @memberof DataPanel
*/
public opendata(args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any){
if (this.parentRef.opendata && this.parentRef.opendata instanceof Function) {
this.parentRef.opendata(args,fullargs,params, $event, xData);
}
}
/**
* 打开新建数据视图
*
* @type {any}
* @memberof DataPanel
*/
public newdata(args: any[],fullargs?:any[], params?: any, $event?: any, xData?: any) {
if (this.parentRef.newdata && this.parentRef.newdata instanceof Function) {
this.parentRef.newdata(args,fullargs,params, $event, xData);
}
}
/**
* 删除
*
* @param {any[]} datas
* @returns {Promise<any>}
* @memberof DataPanel
*/
public async remove(datas: any[]): Promise<any> {
if (this.parentRef.remove && this.parentRef.remove instanceof Function) {
return this.parentRef.remove(datas);
}
}
/**
* 刷新
*
* @param {*} [opt={}]
* @memberof Main
*/
public refresh(opt: any = {}) {
if (this.parentRef.refresh && this.parentRef.refresh instanceof Function) {
this.parentRef.refresh(opt);
}
}
/**
* 设置面板编辑项值变更
*
* @param data 面板数据
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof DataPanel
*/
public onPanelItemValueChange(data: any,$event: { name: string, value: any }): void {
if (!$event) {
return;
}
if (!$event.name || Object.is($event.name, '') || !data.hasOwnProperty($event.name)) {
return;
}
data[$event.name] = $event.value;
this.panelEditItemChange(data, $event.name, $event.value);
}
/**
* 面板编辑项值变化
*
* @public
* @param data 面板数据
* @param property 编辑项名
* @param value 编辑项值
* @returns {void}
* @memberof DataPanel
*/
public panelEditItemChange(data: any, property: string, value: any){
// 面板数据变化事件
if((this.dataModel.getDataItems instanceof Function) && this.dataModel.getDataItems().length >0){
let modelitem =this.dataModel.getDataItems().find((item:any) =>{
return item.name === property;
})
if(modelitem){
this.$emit('panelDataChange',{[modelitem.prop]: value});
}
}
}
} }
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册