Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
iBiz企业中心
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz企业套件
iBiz企业中心
提交
02583f0a
提交
02583f0a
编写于
7月 08, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chitanda 发布系统代码
上级
ae3a8aa7
变更
15
隐藏空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
657 行增加
和
644 行删除
+657
-644
data-panel-engine.ts
app_CRM/src/engine/ctrl/data-panel-engine.ts
+17
-4
account_en_US.ts
app_CRM/src/locale/lanres/entities/account/account_en_US.ts
+23
-21
account_zh_CN.ts
app_CRM/src/locale/lanres/entities/account/account_zh_CN.ts
+23
-21
router.ts
app_CRM/src/pages/ungroup/central/router.ts
+14
-0
state.ts
app_CRM/src/store/modules/view-action/state.ts
+1
-0
index.ts
app_CRM/src/studio-core/global/index.ts
+113
-0
index.ts
app_CRM/src/studio-core/index.ts
+1
-0
ExpViewBase.tsx
app_CRM/src/studio-core/view/ExpViewBase.tsx
+1
-1
FormControlBase.tsx
app_CRM/src/studio-core/widgets/FormControlBase.tsx
+4
-3
PanelControlBase.tsx
app_CRM/src/studio-core/widgets/PanelControlBase.tsx
+337
-0
account-ui-service-base.ts
app_CRM/src/uiservice/account/account-ui-service-base.ts
+66
-0
data-panel-form-base.tsx
.../widgets/account/data-panel-form/data-panel-form-base.tsx
+41
-0
data-panel-form.html
.../src/widgets/account/data-panel-form/data-panel-form.html
+8
-0
by-regarding-object-id-panel-base.tsx
...ing-object-id-panel/by-regarding-object-id-panel-base.tsx
+4
-297
data-panel-panel-base.tsx
...idgets/contact/data-panel-panel/data-panel-panel-base.tsx
+4
-297
未找到文件。
app_CRM/src/engine/ctrl/data-panel-engine.ts
浏览文件 @
02583f0a
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
();
}
}
}
}
}
}
}
...
...
app_CRM/src/locale/lanres/entities/account/account_en_US.ts
浏览文件 @
02583f0a
...
@@ -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
:
"客户基本信息"
,
...
...
app_CRM/src/locale/lanres/entities/account/account_zh_CN.ts
浏览文件 @
02583f0a
...
@@ -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
:
"客户基本信息"
,
...
...
app_CRM/src/pages/ungroup/central/router.ts
浏览文件 @
02583f0a
...
@@ -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
:
{
...
...
app_CRM/src/store/modules/view-action/state.ts
浏览文件 @
02583f0a
...
@@ -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'
,
],
],
},
},
...
...
app_CRM/src/studio-core/global/index.ts
0 → 100644
浏览文件 @
02583f0a
/**
* 视图事件
*/
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
app_CRM/src/studio-core/index.ts
浏览文件 @
02583f0a
...
@@ -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
...
...
app_CRM/src/studio-core/view/ExpViewBase.tsx
浏览文件 @
02583f0a
import
{
ViewBase
}
from
'./ViewBase'
;
import
{
ViewBase
}
from
'./ViewBase'
;
import
{
events
}
from
'../global
/events
'
;
import
{
events
}
from
'../global'
;
/**
/**
* 导航视图基类
* 导航视图基类
...
...
app_CRM/src/studio-core/widgets/FormControlBase.tsx
浏览文件 @
02583f0a
import
{
Prop
}
from
'vue-property-decorator'
;
import
{
Prop
}
from
'vue-property-decorator'
;
import
{
Subject
,
Subscription
}
from
'rxjs'
;
import
{
Subject
}
from
'rxjs'
;
import
{
Form
ButtonModel
,
FormPageModel
,
FormItemModel
,
FormDRUIPartModel
,
FormPartModel
,
FormGroupPanelModel
,
FormIFrameModel
,
FormRowItemModel
,
FormTabPageModel
,
FormTabPanelModel
,
FormUserControl
Model
}
from
'@/model/form-detail'
;
import
{
Form
Item
Model
}
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
});
});
});
...
...
app_CRM/src/studio-core/widgets/PanelControlBase.tsx
0 → 100644
浏览文件 @
02583f0a
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
app_CRM/src/uiservice/account/account-ui-service-base.ts
浏览文件 @
02583f0a
...
@@ -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
);
}
/**
/**
* 获取指定数据的重定向页面
* 获取指定数据的重定向页面
...
...
app_CRM/src/widgets/account/data-panel-form/data-panel-form-base.tsx
浏览文件 @
02583f0a
...
@@ -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
app_CRM/src/widgets/account/data-panel-form/data-panel-form.html
浏览文件 @
02583f0a
...
@@ -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>
...
...
app_CRM/src/widgets/activity-pointer/by-regarding-object-id-panel/by-regarding-object-id-panel-base.tsx
浏览文件 @
02583f0a
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
,
Main
ControlBase
}
from
'@/studio-core'
;
import
{
Watch
,
Panel
ControlBase
}
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
Main
ControlBase
* @class
Panel
ControlBase
* @extends {ByRegardingObjectIdPanelBase}
* @extends {ByRegardingObjectIdPanelBase}
*/
*/
export
class
ByRegardingObjectIdPanelBase
extends
Main
ControlBase
{
export
class
ByRegardingObjectIdPanelBase
extends
Panel
ControlBase
{
/**
/**
* 获取部件类型
* 获取部件类型
...
@@ -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
app_CRM/src/widgets/contact/data-panel-panel/data-panel-panel-base.tsx
浏览文件 @
02583f0a
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
,
Main
ControlBase
}
from
'@/studio-core'
;
import
{
Watch
,
Panel
ControlBase
}
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
Main
ControlBase
* @class
Panel
ControlBase
* @extends {DataPanelPanelBase}
* @extends {DataPanelPanelBase}
*/
*/
export
class
DataPanelPanelBase
extends
Main
ControlBase
{
export
class
DataPanelPanelBase
extends
Panel
ControlBase
{
/**
/**
* 获取部件类型
* 获取部件类型
...
@@ -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
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录