提交 78ff5afb 编写于 作者: ibizdev's avatar ibizdev

xignzi006 发布系统代码

上级 9f6726c6
{ {
"ibizserviceeditview": {
"title": "服务编辑视图",
"caption": "服务",
"viewtype": "DEEDITVIEW",
"viewmodule": "Service",
"viewname": "IBizServiceEditView",
"viewfilename": "ibiz-service-edit-view",
"viewtag": "0027cf632b1ee99cb364d2b6aa2b6511",
"memo": "系统自动添加"
},
"contacteditabstract": { "contacteditabstract": {
"title": "联系人选项操作视图", "title": "联系人选项操作视图",
"caption": "摘要信息", "caption": "摘要信息",
...@@ -309,6 +319,16 @@ ...@@ -309,6 +319,16 @@
"viewtag": "3124753ba4abff3aaf49355a5197c4ab", "viewtag": "3124753ba4abff3aaf49355a5197c4ab",
"memo": "系统自动添加" "memo": "系统自动添加"
}, },
"accountinfo_all": {
"title": "客户编辑视图",
"caption": "客户",
"viewtype": "DEEDITVIEW",
"viewmodule": "Base",
"viewname": "AccountInfo_All",
"viewfilename": "account-info-all",
"viewtag": "31f2ad06ced735d250dfa5f309b5aea4",
"memo": ""
},
"incidentgridview": { "incidentgridview": {
"title": "案例表格视图", "title": "案例表格视图",
"caption": "案例", "caption": "案例",
...@@ -579,6 +599,16 @@ ...@@ -579,6 +599,16 @@
"viewtag": "7877d7e7e55fe21f48e8382e07579f33", "viewtag": "7877d7e7e55fe21f48e8382e07579f33",
"memo": "系统自动添加" "memo": "系统自动添加"
}, },
"ibizservicegridview": {
"title": "服务表格视图",
"caption": "服务",
"viewtype": "DEGRIDVIEW",
"viewmodule": "Service",
"viewname": "IBizServiceGridView",
"viewfilename": "ibiz-service-grid-view",
"viewtag": "7b487e231caf16a33620396ad7c90634",
"memo": "系统自动添加"
},
"campaignresponsequickcreate": { "campaignresponsequickcreate": {
"title": "快速新建", "title": "快速新建",
"caption": "快速新建", "caption": "快速新建",
......
/**
* 服务
*
* @export
* @interface IBizService
*/
export interface IBizService {
/**
* 建立时间
*
* @returns {*}
* @memberof IBizService
*/
createdate?: any;
/**
* Time Zone Rule Version Number
*
* @returns {*}
* @memberof IBizService
*/
timezoneruleversionnumber?: any;
/**
* Record Created On
*
* @returns {*}
* @memberof IBizService
*/
overriddencreatedon?: any;
/**
* 定位偏差
*
* @returns {*}
* @memberof IBizService
*/
anchoroffset?: any;
/**
* 初始状态描述
*
* @returns {*}
* @memberof IBizService
*/
initialstatuscode?: any;
/**
* 粒度
*
* @returns {*}
* @memberof IBizService
*/
granularity?: any;
/**
* 更新人
*
* @returns {*}
* @memberof IBizService
*/
updateman?: any;
/**
* 说明
*
* @returns {*}
* @memberof IBizService
*/
description?: any;
/**
* 显示资源
*
* @returns {*}
* @memberof IBizService
*/
showresources?: any;
/**
* service名称
*
* @returns {*}
* @memberof IBizService
*/
servicename?: any;
/**
* Import Sequence Number
*
* @returns {*}
* @memberof IBizService
*/
importsequencenumber?: any;
/**
* 可公开
*
* @returns {*}
* @memberof IBizService
*/
visible?: any;
/**
* 日历
*
* @returns {*}
* @memberof IBizService
*/
calendarid?: any;
/**
* 建立人
*
* @returns {*}
* @memberof IBizService
*/
createman?: any;
/**
* 状态
*
* @returns {*}
* @memberof IBizService
*/
schedulable?: any;
/**
* 策略
*
* @returns {*}
* @memberof IBizService
*/
strategyid?: any;
/**
* Version Number
*
* @returns {*}
* @memberof IBizService
*/
versionnumber?: any;
/**
* 服务
*
* @returns {*}
* @memberof IBizService
*/
serviceid?: any;
/**
* 持续时间
*
* @returns {*}
* @memberof IBizService
*/
duration?: any;
/**
* 更新时间
*
* @returns {*}
* @memberof IBizService
*/
updatedate?: any;
/**
* UTC Conversion Time Zone Code
*
* @returns {*}
* @memberof IBizService
*/
utcconversiontimezonecode?: any;
/**
* 所需资源
*
* @returns {*}
* @memberof IBizService
*/
resourcespecid?: any;
}
\ No newline at end of file
...@@ -11,6 +11,7 @@ import invoice_en_US from '@locale/lanres/entities/invoice/invoice_en_US'; ...@@ -11,6 +11,7 @@ import invoice_en_US from '@locale/lanres/entities/invoice/invoice_en_US';
import campaign_en_US from '@locale/lanres/entities/campaign/campaign_en_US'; import campaign_en_US from '@locale/lanres/entities/campaign/campaign_en_US';
import lead_en_US from '@locale/lanres/entities/lead/lead_en_US'; import lead_en_US from '@locale/lanres/entities/lead/lead_en_US';
import incident_en_US from '@locale/lanres/entities/incident/incident_en_US'; import incident_en_US from '@locale/lanres/entities/incident/incident_en_US';
import ibizservice_en_US from '@locale/lanres/entities/ibiz-service/ibiz-service_en_US';
import ibizlist_en_US from '@locale/lanres/entities/ibiz-list/ibiz-list_en_US'; import ibizlist_en_US from '@locale/lanres/entities/ibiz-list/ibiz-list_en_US';
import campaignresponse_en_US from '@locale/lanres/entities/campaign-response/campaign-response_en_US'; import campaignresponse_en_US from '@locale/lanres/entities/campaign-response/campaign-response_en_US';
import phonecall_en_US from '@locale/lanres/entities/phone-call/phone-call_en_US'; import phonecall_en_US from '@locale/lanres/entities/phone-call/phone-call_en_US';
...@@ -147,6 +148,7 @@ export default { ...@@ -147,6 +148,7 @@ export default {
campaign: campaign_en_US, campaign: campaign_en_US,
lead: lead_en_US, lead: lead_en_US,
incident: incident_en_US, incident: incident_en_US,
ibizservice: ibizservice_en_US,
ibizlist: ibizlist_en_US, ibizlist: ibizlist_en_US,
campaignresponse: campaignresponse_en_US, campaignresponse: campaignresponse_en_US,
phonecall: phonecall_en_US, phonecall: phonecall_en_US,
......
...@@ -11,6 +11,7 @@ import invoice_zh_CN from '@locale/lanres/entities/invoice/invoice_zh_CN'; ...@@ -11,6 +11,7 @@ import invoice_zh_CN from '@locale/lanres/entities/invoice/invoice_zh_CN';
import campaign_zh_CN from '@locale/lanres/entities/campaign/campaign_zh_CN'; import campaign_zh_CN from '@locale/lanres/entities/campaign/campaign_zh_CN';
import lead_zh_CN from '@locale/lanres/entities/lead/lead_zh_CN'; import lead_zh_CN from '@locale/lanres/entities/lead/lead_zh_CN';
import incident_zh_CN from '@locale/lanres/entities/incident/incident_zh_CN'; import incident_zh_CN from '@locale/lanres/entities/incident/incident_zh_CN';
import ibizservice_zh_CN from '@locale/lanres/entities/ibiz-service/ibiz-service_zh_CN';
import ibizlist_zh_CN from '@locale/lanres/entities/ibiz-list/ibiz-list_zh_CN'; import ibizlist_zh_CN from '@locale/lanres/entities/ibiz-list/ibiz-list_zh_CN';
import campaignresponse_zh_CN from '@locale/lanres/entities/campaign-response/campaign-response_zh_CN'; import campaignresponse_zh_CN from '@locale/lanres/entities/campaign-response/campaign-response_zh_CN';
import phonecall_zh_CN from '@locale/lanres/entities/phone-call/phone-call_zh_CN'; import phonecall_zh_CN from '@locale/lanres/entities/phone-call/phone-call_zh_CN';
...@@ -147,6 +148,7 @@ export default { ...@@ -147,6 +148,7 @@ export default {
campaign: campaign_zh_CN, campaign: campaign_zh_CN,
lead: lead_zh_CN, lead: lead_zh_CN,
incident: incident_zh_CN, incident: incident_zh_CN,
ibizservice: ibizservice_zh_CN,
ibizlist: ibizlist_zh_CN, ibizlist: ibizlist_zh_CN,
campaignresponse: campaignresponse_zh_CN, campaignresponse: campaignresponse_zh_CN,
phonecall: phonecall_zh_CN, phonecall: phonecall_zh_CN,
......
...@@ -184,6 +184,10 @@ export default { ...@@ -184,6 +184,10 @@ export default {
info: { info: {
caption: "客户信息", caption: "客户信息",
title: '客户信息', title: '客户信息',
},
info_all: {
caption: "客户",
title: '客户编辑视图',
}, },
gridview: { gridview: {
caption: "客户信息", caption: "客户信息",
...@@ -263,6 +267,26 @@ export default { ...@@ -263,6 +267,26 @@ export default {
uiactions: { uiactions: {
}, },
}, },
info_majorcontact_form: {
details: {
druipart1: "",
group1: "主联系人",
formpage1: "基本信息",
srfupdatedate: "更新时间",
srforikey: "",
srfkey: "客户",
srfmajortext: "客户名称",
srftempmode: "",
srfuf: "",
srfdeid: "",
srfsourcekey: "",
primarycontactname: "主要联系人",
emailaddress1: "电子邮件",
accountid: "客户",
},
uiactions: {
},
},
edit_accountinfo_form: { edit_accountinfo_form: {
details: { details: {
group1: "客户基本信息", group1: "客户基本信息",
...@@ -290,7 +314,7 @@ export default { ...@@ -290,7 +314,7 @@ export default {
uiactions: { uiactions: {
}, },
}, },
info_address_form: { edit_introduction_form: {
details: { details: {
group1: "客户基本信息", group1: "客户基本信息",
formpage1: "基本信息", formpage1: "基本信息",
...@@ -302,21 +326,21 @@ export default { ...@@ -302,21 +326,21 @@ export default {
srfuf: "", srfuf: "",
srfdeid: "", srfdeid: "",
srfsourcekey: "", srfsourcekey: "",
address1_addressid: "地址 1: ID", industrycode: "行业",
address1_name: "地址 1: 名称", sic: "行业编码",
address1_addresstypecode: "地址 1: 地址类型", ownershipcode: "所有权",
address1_country: "地址 1: 国家/地区", description: "说明",
address1_stateorprovince: "地址 1: 省/市/自治区",
address1_city: "地址 1: 市/县",
address1_county: "地址 1: 县",
accountid: "客户", accountid: "客户",
}, },
uiactions: { uiactions: {
}, },
}, },
edit_address_form: { info_all_form: {
details: { details: {
group1: "客户基本信息", group1: "账户信息",
grouppanel3: "简介",
grouppanel1: "地址信息",
grouppanel2: "联系人首选项",
formpage1: "基本信息", formpage1: "基本信息",
srfupdatedate: "更新时间", srfupdatedate: "更新时间",
srforikey: "", srforikey: "",
...@@ -326,6 +350,18 @@ export default { ...@@ -326,6 +350,18 @@ export default {
srfuf: "", srfuf: "",
srfdeid: "", srfdeid: "",
srfsourcekey: "", srfsourcekey: "",
accountname: "客户名称",
telephone1: "主要电话",
fax: "传真",
websiteurl: "网站",
parentaccountname: "上级单位",
tickersymbol: "股票代号",
customertypecode: "关系类型",
defaultpricelevelname: "价目表",
industrycode: "行业",
sic: "行业编码",
ownershipcode: "所有权",
description: "说明",
address1_addressid: "地址 1: ID", address1_addressid: "地址 1: ID",
address1_name: "地址 1: 名称", address1_name: "地址 1: 名称",
address1_addresstypecode: "地址 1: 地址类型", address1_addresstypecode: "地址 1: 地址类型",
...@@ -333,12 +369,26 @@ export default { ...@@ -333,12 +369,26 @@ export default {
address1_stateorprovince: "地址 1: 省/市/自治区", address1_stateorprovince: "地址 1: 省/市/自治区",
address1_city: "地址 1: 市/县", address1_city: "地址 1: 市/县",
address1_county: "地址 1: 县", address1_county: "地址 1: 县",
address1_line1: "地址 1: 街道 1",
address1_fax: "地址 1: 传真",
address1_freighttermscode: "地址 1: 货运条款",
address1_postalcode: "地址 1: 邮政编码",
preferredcontactmethodcode: "首选联系方式",
donotemail: "不允许使用电子邮件",
donotbulkemail: "不允许使用批量电子邮件",
donotphone: "不允许电话联络",
donotfax: "不允许使用传真",
donotpostalmail: "不允许使用邮件",
defaultpricelevelid: "价目表",
parentaccountid: "上级单位",
accountid: "客户", accountid: "客户",
}, },
uiactions: { uiactions: {
edit_accountinfo: "编辑",
edit_introduction: "编辑",
}, },
}, },
introduction_form: { quickcreate_form: {
details: { details: {
group1: "客户基本信息", group1: "客户基本信息",
formpage1: "基本信息", formpage1: "基本信息",
...@@ -350,18 +400,27 @@ export default { ...@@ -350,18 +400,27 @@ export default {
srfuf: "", srfuf: "",
srfdeid: "", srfdeid: "",
srfsourcekey: "", srfsourcekey: "",
industrycode: "行业", accountname: "客户名称",
sic: "行业编码", telephone1: "主要电话",
ownershipcode: "所有权", fax: "传真",
description: "说明", websiteurl: "网站",
parentaccountname: "上级单位",
tickersymbol: "股票代号",
customertypecode: "关系类型",
defaultpricelevelname: "价目表",
defaultpricelevelid: "价目表",
parentaccountid: "上级单位",
accountid: "客户", accountid: "客户",
}, },
uiactions: { uiactions: {
}, },
}, },
edit_introduction_form: { main_form: {
details: { details: {
group1: "客户基本信息", group1: "账户信息",
grouppanel3: "简介",
grouppanel1: "地址信息",
grouppanel2: "联系人首选项",
formpage1: "基本信息", formpage1: "基本信息",
srfupdatedate: "更新时间", srfupdatedate: "更新时间",
srforikey: "", srforikey: "",
...@@ -371,16 +430,43 @@ export default { ...@@ -371,16 +430,43 @@ export default {
srfuf: "", srfuf: "",
srfdeid: "", srfdeid: "",
srfsourcekey: "", srfsourcekey: "",
accountname: "客户名称",
telephone1: "主要电话",
fax: "传真",
websiteurl: "网站",
parentaccountname: "上级单位",
tickersymbol: "股票代号",
customertypecode: "关系类型",
defaultpricelevelname: "价目表",
industrycode: "行业", industrycode: "行业",
sic: "行业编码", sic: "行业编码",
ownershipcode: "所有权", ownershipcode: "所有权",
description: "说明", description: "说明",
address1_addressid: "地址 1: ID",
address1_name: "地址 1: 名称",
address1_addresstypecode: "地址 1: 地址类型",
address1_country: "地址 1: 国家/地区",
address1_stateorprovince: "地址 1: 省/市/自治区",
address1_city: "地址 1: 市/县",
address1_county: "地址 1: 县",
address1_line1: "地址 1: 街道 1",
address1_fax: "地址 1: 传真",
address1_freighttermscode: "地址 1: 货运条款",
address1_postalcode: "地址 1: 邮政编码",
preferredcontactmethodcode: "首选联系方式",
donotemail: "不允许使用电子邮件",
donotbulkemail: "不允许使用批量电子邮件",
donotphone: "不允许电话联络",
donotfax: "不允许使用传真",
donotpostalmail: "不允许使用邮件",
defaultpricelevelid: "价目表",
parentaccountid: "上级单位",
accountid: "客户", accountid: "客户",
}, },
uiactions: { uiactions: {
}, },
}, },
info_contactsetting_form: { introduction_form: {
details: { details: {
group1: "客户基本信息", group1: "客户基本信息",
formpage1: "基本信息", formpage1: "基本信息",
...@@ -392,18 +478,16 @@ export default { ...@@ -392,18 +478,16 @@ export default {
srfuf: "", srfuf: "",
srfdeid: "", srfdeid: "",
srfsourcekey: "", srfsourcekey: "",
preferredcontactmethodcode: "首选联系方式", industrycode: "行业",
donotemail: "不允许使用电子邮件", sic: "行业编码",
donotbulkemail: "不允许使用批量电子邮件", ownershipcode: "所有权",
donotphone: "不允许电话联络", description: "说明",
donotfax: "不允许使用传真",
donotpostalmail: "不允许使用邮件",
accountid: "客户", accountid: "客户",
}, },
uiactions: { uiactions: {
}, },
}, },
info_distribution_form: { info_address_form: {
details: { details: {
group1: "客户基本信息", group1: "客户基本信息",
formpage1: "基本信息", formpage1: "基本信息",
...@@ -415,19 +499,21 @@ export default { ...@@ -415,19 +499,21 @@ export default {
srfuf: "", srfuf: "",
srfdeid: "", srfdeid: "",
srfsourcekey: "", srfsourcekey: "",
address1_shippingmethodcode: "地址 1: 送货方式", address1_addressid: "地址 1: ID",
address1_freighttermscode: "地址 1: 货运条款", address1_name: "地址 1: 名称",
address1_addresstypecode: "地址 1: 地址类型",
address1_country: "地址 1: 国家/地区",
address1_stateorprovince: "地址 1: 省/市/自治区",
address1_city: "地址 1: 市/县",
address1_county: "地址 1: 县",
accountid: "客户", accountid: "客户",
}, },
uiactions: { uiactions: {
}, },
}, },
main_form: { info_distribution_form: {
details: { details: {
group1: "账户信息", group1: "客户基本信息",
grouppanel3: "简介",
grouppanel1: "地址信息",
grouppanel2: "联系人首选项",
formpage1: "基本信息", formpage1: "基本信息",
srfupdatedate: "更新时间", srfupdatedate: "更新时间",
srforikey: "", srforikey: "",
...@@ -437,46 +523,16 @@ export default { ...@@ -437,46 +523,16 @@ export default {
srfuf: "", srfuf: "",
srfdeid: "", srfdeid: "",
srfsourcekey: "", srfsourcekey: "",
accountname: "客户名称", address1_shippingmethodcode: "地址 1: 送货方式",
telephone1: "主要电话",
fax: "传真",
websiteurl: "网站",
parentaccountname: "上级单位",
tickersymbol: "股票代号",
customertypecode: "关系类型",
defaultpricelevelname: "价目表",
industrycode: "行业",
sic: "行业编码",
ownershipcode: "所有权",
description: "说明",
address1_addressid: "地址 1: ID",
address1_name: "地址 1: 名称",
address1_addresstypecode: "地址 1: 地址类型",
address1_country: "地址 1: 国家/地区",
address1_stateorprovince: "地址 1: 省/市/自治区",
address1_city: "地址 1: 市/县",
address1_county: "地址 1: 县",
address1_line1: "地址 1: 街道 1",
address1_fax: "地址 1: 传真",
address1_freighttermscode: "地址 1: 货运条款", address1_freighttermscode: "地址 1: 货运条款",
address1_postalcode: "地址 1: 邮政编码",
preferredcontactmethodcode: "首选联系方式",
donotemail: "不允许使用电子邮件",
donotbulkemail: "不允许使用批量电子邮件",
donotphone: "不允许电话联络",
donotfax: "不允许使用传真",
donotpostalmail: "不允许使用邮件",
defaultpricelevelid: "价目表",
parentaccountid: "上级单位",
accountid: "客户", accountid: "客户",
}, },
uiactions: { uiactions: {
}, },
}, },
info_majorcontact_form: { info_contactsetting_form: {
details: { details: {
druipart1: "", group1: "客户基本信息",
group1: "主联系人",
formpage1: "基本信息", formpage1: "基本信息",
srfupdatedate: "更新时间", srfupdatedate: "更新时间",
srforikey: "", srforikey: "",
...@@ -486,14 +542,18 @@ export default { ...@@ -486,14 +542,18 @@ export default {
srfuf: "", srfuf: "",
srfdeid: "", srfdeid: "",
srfsourcekey: "", srfsourcekey: "",
primarycontactname: "主要联系人", preferredcontactmethodcode: "首选联系方式",
emailaddress1: "电子邮件", donotemail: "不允许使用电子邮件",
donotbulkemail: "不允许使用批量电子邮件",
donotphone: "不允许电话联络",
donotfax: "不允许使用传真",
donotpostalmail: "不允许使用邮件",
accountid: "客户", accountid: "客户",
}, },
uiactions: { uiactions: {
}, },
}, },
quickcreate_form: { edit_address_form: {
details: { details: {
group1: "客户基本信息", group1: "客户基本信息",
formpage1: "基本信息", formpage1: "基本信息",
...@@ -505,35 +565,32 @@ export default { ...@@ -505,35 +565,32 @@ export default {
srfuf: "", srfuf: "",
srfdeid: "", srfdeid: "",
srfsourcekey: "", srfsourcekey: "",
accountname: "客户名称", address1_addressid: "地址 1: ID",
telephone1: "主要电话", address1_name: "地址 1: 名称",
fax: "传真", address1_addresstypecode: "地址 1: 地址类型",
websiteurl: "网站", address1_country: "地址 1: 国家/地区",
parentaccountname: "上级单位", address1_stateorprovince: "地址 1: 省/市/自治区",
tickersymbol: "股票代号", address1_city: "地址 1: 市/县",
customertypecode: "关系类型", address1_county: "地址 1: 县",
defaultpricelevelname: "价目表",
defaultpricelevelid: "价目表",
parentaccountid: "上级单位",
accountid: "客户", accountid: "客户",
}, },
uiactions: { uiactions: {
}, },
}, },
main_grid: { innerpickip_grid: {
columns: { columns: {
accountname: "客户名称", accountname: "客户名称",
telephone1: "主要电话",
address1_city: "地址 1: 市/县",
primarycontactname: "主要联系人",
emailaddress1: "电子邮件", emailaddress1: "电子邮件",
}, },
uiactions: { uiactions: {
}, },
}, },
innerpickip_grid: { main_grid: {
columns: { columns: {
accountname: "客户名称", accountname: "客户名称",
telephone1: "主要电话",
address1_city: "地址 1: 市/县",
primarycontactname: "主要联系人",
emailaddress1: "电子邮件", emailaddress1: "电子邮件",
}, },
uiactions: { uiactions: {
......
...@@ -183,6 +183,10 @@ export default { ...@@ -183,6 +183,10 @@ export default {
info: { info: {
caption: '客户信息', caption: '客户信息',
title: '客户信息', title: '客户信息',
},
info_all: {
caption: '客户',
title: '客户编辑视图',
}, },
gridview: { gridview: {
caption: '客户信息', caption: '客户信息',
...@@ -262,6 +266,26 @@ export default { ...@@ -262,6 +266,26 @@ export default {
uiactions: { uiactions: {
}, },
}, },
info_majorcontact_form: {
details: {
druipart1: '',
group1: '主联系人',
formpage1: '基本信息',
srfupdatedate: '更新时间',
srforikey: '',
srfkey: '客户',
srfmajortext: '客户名称',
srftempmode: '',
srfuf: '',
srfdeid: '',
srfsourcekey: '',
primarycontactname: '主要联系人',
emailaddress1: '电子邮件',
accountid: '客户',
},
uiactions: {
},
},
edit_accountinfo_form: { edit_accountinfo_form: {
details: { details: {
group1: '客户基本信息', group1: '客户基本信息',
...@@ -289,7 +313,7 @@ export default { ...@@ -289,7 +313,7 @@ export default {
uiactions: { uiactions: {
}, },
}, },
info_address_form: { edit_introduction_form: {
details: { details: {
group1: '客户基本信息', group1: '客户基本信息',
formpage1: '基本信息', formpage1: '基本信息',
...@@ -301,21 +325,21 @@ export default { ...@@ -301,21 +325,21 @@ export default {
srfuf: '', srfuf: '',
srfdeid: '', srfdeid: '',
srfsourcekey: '', srfsourcekey: '',
address1_addressid: '地址 1: ID', industrycode: '行业',
address1_name: '地址 1: 名称', sic: '行业编码',
address1_addresstypecode: '地址 1: 地址类型', ownershipcode: '所有权',
address1_country: '地址 1: 国家/地区', description: '说明',
address1_stateorprovince: '地址 1: 省/市/自治区',
address1_city: '地址 1: 市/县',
address1_county: '地址 1: 县',
accountid: '客户', accountid: '客户',
}, },
uiactions: { uiactions: {
}, },
}, },
edit_address_form: { info_all_form: {
details: { details: {
group1: '客户基本信息', group1: '账户信息',
grouppanel3: '简介',
grouppanel1: '地址信息',
grouppanel2: '联系人首选项',
formpage1: '基本信息', formpage1: '基本信息',
srfupdatedate: '更新时间', srfupdatedate: '更新时间',
srforikey: '', srforikey: '',
...@@ -325,6 +349,18 @@ export default { ...@@ -325,6 +349,18 @@ export default {
srfuf: '', srfuf: '',
srfdeid: '', srfdeid: '',
srfsourcekey: '', srfsourcekey: '',
accountname: '客户名称',
telephone1: '主要电话',
fax: '传真',
websiteurl: '网站',
parentaccountname: '上级单位',
tickersymbol: '股票代号',
customertypecode: '关系类型',
defaultpricelevelname: '价目表',
industrycode: '行业',
sic: '行业编码',
ownershipcode: '所有权',
description: '说明',
address1_addressid: '地址 1: ID', address1_addressid: '地址 1: ID',
address1_name: '地址 1: 名称', address1_name: '地址 1: 名称',
address1_addresstypecode: '地址 1: 地址类型', address1_addresstypecode: '地址 1: 地址类型',
...@@ -332,12 +368,26 @@ export default { ...@@ -332,12 +368,26 @@ export default {
address1_stateorprovince: '地址 1: 省/市/自治区', address1_stateorprovince: '地址 1: 省/市/自治区',
address1_city: '地址 1: 市/县', address1_city: '地址 1: 市/县',
address1_county: '地址 1: 县', address1_county: '地址 1: 县',
address1_line1: '地址 1: 街道 1',
address1_fax: '地址 1: 传真',
address1_freighttermscode: '地址 1: 货运条款',
address1_postalcode: '地址 1: 邮政编码',
preferredcontactmethodcode: '首选联系方式',
donotemail: '不允许使用电子邮件',
donotbulkemail: '不允许使用批量电子邮件',
donotphone: '不允许电话联络',
donotfax: '不允许使用传真',
donotpostalmail: '不允许使用邮件',
defaultpricelevelid: '价目表',
parentaccountid: '上级单位',
accountid: '客户', accountid: '客户',
}, },
uiactions: { uiactions: {
edit_accountinfo: '编辑',
edit_introduction: '编辑',
}, },
}, },
introduction_form: { quickcreate_form: {
details: { details: {
group1: '客户基本信息', group1: '客户基本信息',
formpage1: '基本信息', formpage1: '基本信息',
...@@ -349,18 +399,27 @@ export default { ...@@ -349,18 +399,27 @@ export default {
srfuf: '', srfuf: '',
srfdeid: '', srfdeid: '',
srfsourcekey: '', srfsourcekey: '',
industrycode: '行业', accountname: '客户名称',
sic: '行业编码', telephone1: '主要电话',
ownershipcode: '所有权', fax: '传真',
description: '说明', websiteurl: '网站',
parentaccountname: '上级单位',
tickersymbol: '股票代号',
customertypecode: '关系类型',
defaultpricelevelname: '价目表',
defaultpricelevelid: '价目表',
parentaccountid: '上级单位',
accountid: '客户', accountid: '客户',
}, },
uiactions: { uiactions: {
}, },
}, },
edit_introduction_form: { main_form: {
details: { details: {
group1: '客户基本信息', group1: '账户信息',
grouppanel3: '简介',
grouppanel1: '地址信息',
grouppanel2: '联系人首选项',
formpage1: '基本信息', formpage1: '基本信息',
srfupdatedate: '更新时间', srfupdatedate: '更新时间',
srforikey: '', srforikey: '',
...@@ -370,16 +429,43 @@ export default { ...@@ -370,16 +429,43 @@ export default {
srfuf: '', srfuf: '',
srfdeid: '', srfdeid: '',
srfsourcekey: '', srfsourcekey: '',
accountname: '客户名称',
telephone1: '主要电话',
fax: '传真',
websiteurl: '网站',
parentaccountname: '上级单位',
tickersymbol: '股票代号',
customertypecode: '关系类型',
defaultpricelevelname: '价目表',
industrycode: '行业', industrycode: '行业',
sic: '行业编码', sic: '行业编码',
ownershipcode: '所有权', ownershipcode: '所有权',
description: '说明', description: '说明',
address1_addressid: '地址 1: ID',
address1_name: '地址 1: 名称',
address1_addresstypecode: '地址 1: 地址类型',
address1_country: '地址 1: 国家/地区',
address1_stateorprovince: '地址 1: 省/市/自治区',
address1_city: '地址 1: 市/县',
address1_county: '地址 1: 县',
address1_line1: '地址 1: 街道 1',
address1_fax: '地址 1: 传真',
address1_freighttermscode: '地址 1: 货运条款',
address1_postalcode: '地址 1: 邮政编码',
preferredcontactmethodcode: '首选联系方式',
donotemail: '不允许使用电子邮件',
donotbulkemail: '不允许使用批量电子邮件',
donotphone: '不允许电话联络',
donotfax: '不允许使用传真',
donotpostalmail: '不允许使用邮件',
defaultpricelevelid: '价目表',
parentaccountid: '上级单位',
accountid: '客户', accountid: '客户',
}, },
uiactions: { uiactions: {
}, },
}, },
info_contactsetting_form: { introduction_form: {
details: { details: {
group1: '客户基本信息', group1: '客户基本信息',
formpage1: '基本信息', formpage1: '基本信息',
...@@ -391,18 +477,16 @@ export default { ...@@ -391,18 +477,16 @@ export default {
srfuf: '', srfuf: '',
srfdeid: '', srfdeid: '',
srfsourcekey: '', srfsourcekey: '',
preferredcontactmethodcode: '首选联系方式', industrycode: '行业',
donotemail: '不允许使用电子邮件', sic: '行业编码',
donotbulkemail: '不允许使用批量电子邮件', ownershipcode: '所有权',
donotphone: '不允许电话联络', description: '说明',
donotfax: '不允许使用传真',
donotpostalmail: '不允许使用邮件',
accountid: '客户', accountid: '客户',
}, },
uiactions: { uiactions: {
}, },
}, },
info_distribution_form: { info_address_form: {
details: { details: {
group1: '客户基本信息', group1: '客户基本信息',
formpage1: '基本信息', formpage1: '基本信息',
...@@ -414,19 +498,21 @@ export default { ...@@ -414,19 +498,21 @@ export default {
srfuf: '', srfuf: '',
srfdeid: '', srfdeid: '',
srfsourcekey: '', srfsourcekey: '',
address1_shippingmethodcode: '地址 1: 送货方式', address1_addressid: '地址 1: ID',
address1_freighttermscode: '地址 1: 货运条款', address1_name: '地址 1: 名称',
address1_addresstypecode: '地址 1: 地址类型',
address1_country: '地址 1: 国家/地区',
address1_stateorprovince: '地址 1: 省/市/自治区',
address1_city: '地址 1: 市/县',
address1_county: '地址 1: 县',
accountid: '客户', accountid: '客户',
}, },
uiactions: { uiactions: {
}, },
}, },
main_form: { info_distribution_form: {
details: { details: {
group1: '账户信息', group1: '客户基本信息',
grouppanel3: '简介',
grouppanel1: '地址信息',
grouppanel2: '联系人首选项',
formpage1: '基本信息', formpage1: '基本信息',
srfupdatedate: '更新时间', srfupdatedate: '更新时间',
srforikey: '', srforikey: '',
...@@ -436,46 +522,16 @@ export default { ...@@ -436,46 +522,16 @@ export default {
srfuf: '', srfuf: '',
srfdeid: '', srfdeid: '',
srfsourcekey: '', srfsourcekey: '',
accountname: '客户名称', address1_shippingmethodcode: '地址 1: 送货方式',
telephone1: '主要电话',
fax: '传真',
websiteurl: '网站',
parentaccountname: '上级单位',
tickersymbol: '股票代号',
customertypecode: '关系类型',
defaultpricelevelname: '价目表',
industrycode: '行业',
sic: '行业编码',
ownershipcode: '所有权',
description: '说明',
address1_addressid: '地址 1: ID',
address1_name: '地址 1: 名称',
address1_addresstypecode: '地址 1: 地址类型',
address1_country: '地址 1: 国家/地区',
address1_stateorprovince: '地址 1: 省/市/自治区',
address1_city: '地址 1: 市/县',
address1_county: '地址 1: 县',
address1_line1: '地址 1: 街道 1',
address1_fax: '地址 1: 传真',
address1_freighttermscode: '地址 1: 货运条款', address1_freighttermscode: '地址 1: 货运条款',
address1_postalcode: '地址 1: 邮政编码',
preferredcontactmethodcode: '首选联系方式',
donotemail: '不允许使用电子邮件',
donotbulkemail: '不允许使用批量电子邮件',
donotphone: '不允许电话联络',
donotfax: '不允许使用传真',
donotpostalmail: '不允许使用邮件',
defaultpricelevelid: '价目表',
parentaccountid: '上级单位',
accountid: '客户', accountid: '客户',
}, },
uiactions: { uiactions: {
}, },
}, },
info_majorcontact_form: { info_contactsetting_form: {
details: { details: {
druipart1: '', group1: '客户基本信息',
group1: '主联系人',
formpage1: '基本信息', formpage1: '基本信息',
srfupdatedate: '更新时间', srfupdatedate: '更新时间',
srforikey: '', srforikey: '',
...@@ -485,14 +541,18 @@ export default { ...@@ -485,14 +541,18 @@ export default {
srfuf: '', srfuf: '',
srfdeid: '', srfdeid: '',
srfsourcekey: '', srfsourcekey: '',
primarycontactname: '主要联系人', preferredcontactmethodcode: '首选联系方式',
emailaddress1: '电子邮件', donotemail: '不允许使用电子邮件',
donotbulkemail: '不允许使用批量电子邮件',
donotphone: '不允许电话联络',
donotfax: '不允许使用传真',
donotpostalmail: '不允许使用邮件',
accountid: '客户', accountid: '客户',
}, },
uiactions: { uiactions: {
}, },
}, },
quickcreate_form: { edit_address_form: {
details: { details: {
group1: '客户基本信息', group1: '客户基本信息',
formpage1: '基本信息', formpage1: '基本信息',
...@@ -504,35 +564,32 @@ export default { ...@@ -504,35 +564,32 @@ export default {
srfuf: '', srfuf: '',
srfdeid: '', srfdeid: '',
srfsourcekey: '', srfsourcekey: '',
accountname: '客户名称', address1_addressid: '地址 1: ID',
telephone1: '主要电话', address1_name: '地址 1: 名称',
fax: '传真', address1_addresstypecode: '地址 1: 地址类型',
websiteurl: '网站', address1_country: '地址 1: 国家/地区',
parentaccountname: '上级单位', address1_stateorprovince: '地址 1: 省/市/自治区',
tickersymbol: '股票代号', address1_city: '地址 1: 市/县',
customertypecode: '关系类型', address1_county: '地址 1: 县',
defaultpricelevelname: '价目表',
defaultpricelevelid: '价目表',
parentaccountid: '上级单位',
accountid: '客户', accountid: '客户',
}, },
uiactions: { uiactions: {
}, },
}, },
main_grid: { innerpickip_grid: {
columns: { columns: {
accountname: '客户名称', accountname: '客户名称',
telephone1: '主要电话',
address1_city: '地址 1: 市/县',
primarycontactname: '主要联系人',
emailaddress1: '电子邮件', emailaddress1: '电子邮件',
}, },
uiactions: { uiactions: {
}, },
}, },
innerpickip_grid: { main_grid: {
columns: { columns: {
accountname: '客户名称', accountname: '客户名称',
telephone1: '主要电话',
address1_city: '地址 1: 市/县',
primarycontactname: '主要联系人',
emailaddress1: '电子邮件', emailaddress1: '电子邮件',
}, },
uiactions: { uiactions: {
......
export default {
fields: {
createdate: '建立时间',
timezoneruleversionnumber: 'Time Zone Rule Version Number',
overriddencreatedon: 'Record Created On',
anchoroffset: '定位偏差',
initialstatuscode: '初始状态描述',
granularity: '粒度',
updateman: '更新人',
description: '说明',
showresources: '显示资源',
servicename: 'service名称',
importsequencenumber: 'Import Sequence Number',
visible: '可公开',
calendarid: '日历',
createman: '建立人',
schedulable: '状态',
strategyid: '策略',
versionnumber: 'Version Number',
serviceid: '服务',
duration: '持续时间',
updatedate: '更新时间',
utcconversiontimezonecode: 'UTC Conversion Time Zone Code',
resourcespecid: '所需资源',
},
views: {
editview: {
caption: "服务",
title: '服务编辑视图',
},
gridview: {
caption: "服务",
title: '服务表格视图',
},
},
main_form: {
details: {
group1: "service基本信息",
formpage1: "基本信息",
group2: "操作信息",
formpage2: "其它",
srfupdatedate: "更新时间",
srforikey: "",
srfkey: "服务",
srfmajortext: "service名称",
srftempmode: "",
srfuf: "",
srfdeid: "",
srfsourcekey: "",
servicename: "service名称",
createman: "建立人",
createdate: "建立时间",
updateman: "更新人",
updatedate: "更新时间",
serviceid: "服务",
},
uiactions: {
},
},
main_grid: {
columns: {
servicename: "service名称",
updateman: "更新人",
updatedate: "更新时间",
},
uiactions: {
},
},
default_searchform: {
details: {
formpage1: "常规条件",
},
uiactions: {
},
},
editviewtoolbar_toolbar: {
tbitem3: {
caption: "Save",
tip: "Save",
},
tbitem4: {
caption: "Save And New",
tip: "Save And New",
},
tbitem5: {
caption: "Save And Close",
tip: "Save And Close Window",
},
tbitem6: {
caption: "-",
tip: "",
},
tbitem7: {
caption: "Remove And Close",
tip: "Remove And Close Window",
},
tbitem8: {
caption: "-",
tip: "",
},
tbitem12: {
caption: "New",
tip: "New",
},
tbitem13: {
caption: "-",
tip: "",
},
tbitem14: {
caption: "Copy",
tip: "Copy {0}",
},
},
gridviewtoolbar_toolbar: {
tbitem3: {
caption: "New",
tip: "New",
},
tbitem4: {
caption: "Edit",
tip: "Edit {0}",
},
tbitem6: {
caption: "Copy",
tip: "Copy {0}",
},
tbitem7: {
caption: "-",
tip: "",
},
tbitem8: {
caption: "Remove",
tip: "Remove {0}",
},
tbitem9: {
caption: "-",
tip: "",
},
tbitem13: {
caption: "Export",
tip: "Export {0} Data To Excel",
},
tbitem10: {
caption: "-",
tip: "",
},
tbitem19: {
caption: "Filter",
tip: "Filter",
},
},
};
\ No newline at end of file
export default {
fields: {
createdate: '建立时间',
timezoneruleversionnumber: 'Time Zone Rule Version Number',
overriddencreatedon: 'Record Created On',
anchoroffset: '定位偏差',
initialstatuscode: '初始状态描述',
granularity: '粒度',
updateman: '更新人',
description: '说明',
showresources: '显示资源',
servicename: 'service名称',
importsequencenumber: 'Import Sequence Number',
visible: '可公开',
calendarid: '日历',
createman: '建立人',
schedulable: '状态',
strategyid: '策略',
versionnumber: 'Version Number',
serviceid: '服务',
duration: '持续时间',
updatedate: '更新时间',
utcconversiontimezonecode: 'UTC Conversion Time Zone Code',
resourcespecid: '所需资源',
},
views: {
editview: {
caption: '服务',
title: '服务编辑视图',
},
gridview: {
caption: '服务',
title: '服务表格视图',
},
},
main_form: {
details: {
group1: 'service基本信息',
formpage1: '基本信息',
group2: '操作信息',
formpage2: '其它',
srfupdatedate: '更新时间',
srforikey: '',
srfkey: '服务',
srfmajortext: 'service名称',
srftempmode: '',
srfuf: '',
srfdeid: '',
srfsourcekey: '',
servicename: 'service名称',
createman: '建立人',
createdate: '建立时间',
updateman: '更新人',
updatedate: '更新时间',
serviceid: '服务',
},
uiactions: {
},
},
main_grid: {
columns: {
servicename: 'service名称',
updateman: '更新人',
updatedate: '更新时间',
},
uiactions: {
},
},
default_searchform: {
details: {
formpage1: '常规条件',
},
uiactions: {
},
},
editviewtoolbar_toolbar: {
tbitem3: {
caption: '保存',
tip: '保存',
},
tbitem4: {
caption: '保存并新建',
tip: '保存并新建',
},
tbitem5: {
caption: '保存并关闭',
tip: '保存并关闭',
},
tbitem6: {
caption: '-',
tip: '',
},
tbitem7: {
caption: '删除并关闭',
tip: '删除并关闭',
},
tbitem8: {
caption: '-',
tip: '',
},
tbitem12: {
caption: '新建',
tip: '新建',
},
tbitem13: {
caption: '-',
tip: '',
},
tbitem14: {
caption: '拷贝',
tip: '拷贝',
},
},
gridviewtoolbar_toolbar: {
tbitem3: {
caption: '新建',
tip: '新建',
},
tbitem4: {
caption: '编辑',
tip: '编辑',
},
tbitem6: {
caption: '拷贝',
tip: '拷贝',
},
tbitem7: {
caption: '-',
tip: '',
},
tbitem8: {
caption: '删除',
tip: '删除',
},
tbitem9: {
caption: '-',
tip: '',
},
tbitem13: {
caption: '导出',
tip: '导出',
},
tbitem10: {
caption: '-',
tip: '',
},
tbitem19: {
caption: '过滤',
tip: '过滤',
},
},
};
\ No newline at end of file
import qs from 'qs';
import { MockAdapter } from '@/mock/mock-adapter';
const mock = MockAdapter.getInstance();
// 模拟数据
const mockDatas: Array<any> = [
];
//getwflink
mock.onGet(new RegExp(/^\/wfcore\/ibizbusinesscentral-app-businesscentral\/ibizservices\/[a-zA-Z0-9\-\;]+\/usertasks\/[a-zA-Z0-9\-\;]+\/ways$/)).reply((config: any) => {
console.groupCollapsed("实体:ibizservice 方法: getwflink");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
}
return [status,[
{"sequenceFlowId":"dfdsfdsfdsfdsfds","sequenceFlowName":"同意",
"taskId":"aaaaddddccccddddd","processDefinitionKey":"support-workorders-approve-v1",
"processInstanceId":"ddlfldldfldsfds","refViewKey":""},
{"sequenceFlowId":"ddssdfdfdfdfsfdf","sequenceFlowName":"不同意",
"taskId":"aaaaddddccccddddd","processDefinitionKey":"support-workorders-approve-v1",
"processInstanceId":"ddfdsldlfdlldsf","refViewKey":"workorder_ltform_editview"}
]];
});
// getwfstep
mock.onGet(new RegExp(/^\/wfcore\/ibizbusinesscentral-app-businesscentral\/ibizservices\/process-definitions-nodes$/)).reply((config: any) => {
console.groupCollapsed("实体:ibizservice 方法: getwfstep");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
}
return [status, [
{"userTaskId":"sddfddfd-dfdf-fdfd-fdf-dfdfd",
"userTaskName":"待审",
"cnt":0,
"processDefinitionKey":"support-workorders-approve-v1",
"processDefinitionName":"工单审批流程v1"
},
{"userTaskId":"sddfddfd-dfdf-fdfd-fdf-87927",
"userTaskName":"待分配",
"cnt":3,
"processDefinitionKey":"support-workorders-approve-v1",
"processDefinitionName":"工单审批流程v1"}
]];
});
// createBatch
mock.onPost(new RegExp(/^\/ibizservices\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:ibizservice 方法: createBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
}
return [status, {}];
});
// updateBatch
mock.onPut(new RegExp(/^\/ibizservices\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:ibizservice 方法: updateBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
}
return [status, {}];
});
// removeBatch
mock.onDelete(new RegExp(/^\/ibizservices\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:ibizservice 方法: removeBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
}
return [status, {}];
});
// Select
mock.onGet(new RegExp(/^\/ibizservices\/([a-zA-Z0-9\-\;]{1,35})\/select$/)).reply((config: any) => {
console.groupCollapsed("实体:ibizservice 方法: Select");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['serviceid'];
const matchArray:any = new RegExp(/^\/ibizservices\/([a-zA-Z0-9\-\;]{1,35})\/select$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
let items = mockDatas ? mockDatas : [];
let _items = items.find((item: any) => Object.is(item.serviceid, tempValue.serviceid));
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(_items);
console.groupEnd();
console.groupEnd();
return [status, _items];
});
// GetDraft
mock.onGet(new RegExp(/^\/ibizservices\/getdraft$/)).reply((config: any) => {
console.groupCollapsed("实体:ibizservice 方法: GetDraft");
console.table({url:config.url, method: config.method, data:config.data});
// GetDraft
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// CheckKey
mock.onPost(new RegExp(/^\/ibizservices\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey$/)).reply((config: any) => {
console.groupCollapsed("实体:ibizservice 方法: CheckKey");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['serviceid'];
const matchArray:any = new RegExp(/^\/ibizservices\/([a-zA-Z0-9\-\;]{1,35})\/checkkey$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.serviceid, tempValue.serviceid));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['serviceid'] == tempValue['serviceid'] ){
for(let value in data){
if(item.hasOwnProperty(value)){
item[value] = data[value];
}
}
}
})
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(data);
console.groupEnd();
console.groupEnd();
return [status, data];
});
// Save
mock.onPost(new RegExp(/^\/ibizservices\/?([a-zA-Z0-9\-\;]{0,35})\/save$/)).reply((config: any) => {
console.groupCollapsed("实体:ibizservice 方法: Save");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['serviceid'];
const matchArray:any = new RegExp(/^\/ibizservices\/([a-zA-Z0-9\-\;]{1,35})\/save$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.serviceid, tempValue.serviceid));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['serviceid'] == tempValue['serviceid'] ){
for(let value in data){
if(item.hasOwnProperty(value)){
item[value] = data[value];
}
}
}
})
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(data);
console.groupEnd();
console.groupEnd();
return [status, data];
});
// Update
mock.onPut(new RegExp(/^\/ibizservices\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:ibizservice 方法: Update");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['serviceid'];
const matchArray:any = new RegExp(/^\/ibizservices\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.serviceid, tempValue.serviceid));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['serviceid'] == tempValue['serviceid'] ){
for(let value in data){
if(item.hasOwnProperty(value)){
item[value] = data[value];
}
}
}
})
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(data);
console.groupEnd();
console.groupEnd();
return [status, data];
});
// Create
mock.onPost(new RegExp(/^\/ibizservices\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:ibizservice 方法: Create");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['serviceid'];
const matchArray:any = new RegExp(/^\/ibizservices\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(mockDatas[0]);
console.groupEnd();
console.groupEnd();
return [status, mockDatas[0]];
});
// FetchDefault
mock.onGet(new RegExp(/^\/ibizservices\/fetchdefault$/)).reply((config: any) => {
console.groupCollapsed("实体:ibizservice 方法: FetchDefault");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(mockDatas);
console.groupEnd();
console.groupEnd();
return [status, mockDatas ? mockDatas : []];
});
// FetchDefault
mock.onGet(new RegExp(/^\/ibizservices\/fetchdefault(\?[\w-./?%&=,]*)*$/)).reply((config: any) => {
console.groupCollapsed("实体:ibizservice 方法: FetchDefault");
console.table({url:config.url, method: config.method, data:config.data});
if(config.url.includes('page')){
let url = config.url.split('?')[1];
let params = qs.parse(url);
Object.assign(config, params);
}
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
let total = mockDatas.length;
let records: Array<any> = [];
if(!config.page || !config.size){
records = mockDatas;
}else{
if((config.page-1)*config.size < total){
records = mockDatas.slice(config.page,config.size);
}
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(records ? records : []);
console.groupEnd();
console.groupEnd();
return [status, records ? records : []];
});
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// Remove
mock.onDelete(new RegExp(/^\/ibizservices\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:ibizservice 方法: Remove");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['serviceid'];
const matchArray:any = new RegExp(/^\/ibizservices\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
let items = mockDatas ? mockDatas : [];
let _items = items.find((item: any) => Object.is(item.serviceid, tempValue.serviceid));
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(_items?_items:{});
console.groupEnd();
console.groupEnd();
return [status, _items?_items:{}];
});
// Get
mock.onGet(new RegExp(/^\/ibizservices\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:ibizservice 方法: Get");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['serviceid'];
const matchArray:any = new RegExp(/^\/ibizservices\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
let items = mockDatas ? mockDatas : [];
let _items = items.find((item: any) => Object.is(item.serviceid, tempValue.serviceid));
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(_items?_items:{});
console.groupEnd();
console.groupEnd();
return [status, _items?_items:{}];
});
...@@ -20,6 +20,7 @@ import './entity/invoices/invoices'; ...@@ -20,6 +20,7 @@ import './entity/invoices/invoices';
import './entity/campaigns/campaigns'; import './entity/campaigns/campaigns';
import './entity/leads/leads'; import './entity/leads/leads';
import './entity/incidents/incidents'; import './entity/incidents/incidents';
import './entity/ibiz-services/ibiz-services';
import './entity/ibiz-lists/ibiz-lists'; import './entity/ibiz-lists/ibiz-lists';
import './entity/campaign-responses/campaign-responses'; import './entity/campaign-responses/campaign-responses';
import './entity/phone-calls/phone-calls'; import './entity/phone-calls/phone-calls';
......
...@@ -7,6 +7,14 @@ import Mock from 'mockjs' ...@@ -7,6 +7,14 @@ import Mock from 'mockjs'
mock.onGet('./assets/json/view-config.json').reply((config: any) => { mock.onGet('./assets/json/view-config.json').reply((config: any) => {
let status = MockAdapter.mockStatus(config); let status = MockAdapter.mockStatus(config);
return [status,{ return [status,{
"ibizserviceeditview": {
"title": "服务编辑视图",
"caption": "服务",
"viewtype": "DEEDITVIEW",
"viewmodule": "Service",
"viewname": "IBizServiceEditView",
"viewtag": "0027cf632b1ee99cb364d2b6aa2b6511"
},
"contacteditabstract": { "contacteditabstract": {
"title": "联系人选项操作视图", "title": "联系人选项操作视图",
"caption": "摘要信息", "caption": "摘要信息",
...@@ -255,6 +263,14 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => { ...@@ -255,6 +263,14 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "ListContactGridView", "viewname": "ListContactGridView",
"viewtag": "3124753ba4abff3aaf49355a5197c4ab" "viewtag": "3124753ba4abff3aaf49355a5197c4ab"
}, },
"accountinfo_all": {
"title": "客户编辑视图",
"caption": "客户",
"viewtype": "DEEDITVIEW",
"viewmodule": "Base",
"viewname": "AccountInfo_All",
"viewtag": "31f2ad06ced735d250dfa5f309b5aea4"
},
"incidentgridview": { "incidentgridview": {
"title": "案例表格视图", "title": "案例表格视图",
"caption": "案例", "caption": "案例",
...@@ -471,6 +487,14 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => { ...@@ -471,6 +487,14 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "GoalEditView", "viewname": "GoalEditView",
"viewtag": "7877d7e7e55fe21f48e8382e07579f33" "viewtag": "7877d7e7e55fe21f48e8382e07579f33"
}, },
"ibizservicegridview": {
"title": "服务表格视图",
"caption": "服务",
"viewtype": "DEGRIDVIEW",
"viewmodule": "Service",
"viewname": "IBizServiceGridView",
"viewtag": "7b487e231caf16a33620396ad7c90634"
},
"campaignresponsequickcreate": { "campaignresponsequickcreate": {
"title": "快速新建", "title": "快速新建",
"caption": "快速新建", "caption": "快速新建",
......
<template>
<studio-view-style2 viewName="ibizserviceeditview" viewTitle="服务编辑视图" class='deeditview ibiz-service-edit-view'>
<template slot='title'>
<span class='caption-info'>{{$t(model.srfTitle)}}</span>
</template>
<template slot="toolbar">
<view-toolbar mode="STYLE2" :model="toolBarModels" @item-click="toolbar_click"/> </template>
<view_form
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:autosave="false"
:viewtag="viewtag"
:showBusyIndicator="true"
updateAction="Update"
removeAction="Remove"
loaddraftAction="GetDraft"
loadAction="Get"
createAction="Create"
WFSubmitAction=""
WFStartAction=""
style=''
name="form"
ref='form'
@save="form_save($event)"
@remove="form_remove($event)"
@load="form_load($event)"
@closeview="closeView($event)">
</view_form>
</studio-view-style2>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import { Subject } from 'rxjs';
import IBizServiceService from '@/service/ibiz-service/ibiz-service-service';
import EditViewEngine from '@engine/view/edit-view-engine';
@Component({
components: {
},
})
export default class IBizServiceEditViewBase extends Vue {
/**
* 实体服务对象
*
* @type {IBizServiceService}
* @memberof IBizServiceEditViewBase
*/
public appEntityService: IBizServiceService = new IBizServiceService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof IBizServiceEditViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof IBizServiceEditViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof IBizServiceEditViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof IBizServiceEditViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof IBizServiceEditViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图标识
*
* @type {string}
* @memberof IBizServiceEditViewBase
*/
public viewtag: string = '0027cf632b1ee99cb364d2b6aa2b6511';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof IBizServiceEditViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof IBizServiceEditViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof IBizServiceEditViewBase
*/
public model: any = {
srfCaption: 'entities.ibizservice.views.editview.caption',
srfTitle: 'entities.ibizservice.views.editview.title',
srfSubTitle: 'entities.ibizservice.views.editview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof IBizServiceEditViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof IBizServiceEditViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
}
}
/**
* 容器模型
*
* @type {*}
* @memberof IBizServiceEditViewBase
*/
public containerModel: any = {
view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
view_form: { name: 'form', type: 'FORM' },
};
/**
* 计数器刷新
*
* @memberof IBizServiceEditViewBase
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof IBizServiceEditViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 工具栏模型
*
* @type {*}
* @memberof IBizServiceEditView
*/
public toolBarModels: any = {
tbitem3: { name: 'tbitem3', caption: '保存','isShowCaption':true,'isShowIcon':true, tooltip: '保存', iconcls: 'fa fa-save', icon: '', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'Save', target: '' }, class: '' },
tbitem4: { name: 'tbitem4', caption: '保存并新建','isShowCaption':true,'isShowIcon':true, tooltip: '保存并新建', iconcls: 'sx-tb-saveandnew', icon: '../sasrfex/images/default/icon_saveandnew.png', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'SaveAndNew', target: '' }, class: '' },
tbitem5: { name: 'tbitem5', caption: '保存并关闭','isShowCaption':true,'isShowIcon':true, tooltip: '保存并关闭', iconcls: 'fa fa-power-off', icon: '', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'SaveAndExit', target: '' }, class: '' },
tbitem6: { name: 'tbitem6', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem7: { name: 'tbitem7', caption: '删除并关闭','isShowCaption':true,'isShowIcon':true, tooltip: '删除并关闭', iconcls: 'fa fa-remove', icon: '', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'RemoveAndExit', target: 'SINGLEKEY' }, class: '' },
tbitem8: { name: 'tbitem8', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem12: { name: 'tbitem12', caption: '新建','isShowCaption':true,'isShowIcon':true, tooltip: '新建', iconcls: 'fa fa-file-text-o', icon: '', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'New', target: '' }, class: '' },
tbitem13: { name: 'tbitem13', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem14: { name: 'tbitem14', caption: '拷贝','isShowCaption':true,'isShowIcon':true, tooltip: '拷贝', iconcls: 'fa fa-copy', icon: '', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'Copy', target: 'SINGLEKEY' }, class: '' },
};
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof IBizServiceEditViewBase
*/
public engine: EditViewEngine = new EditViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof IBizServiceEditViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
form: this.$refs.form,
p2k: '0',
keyPSDEField: 'ibizservice',
majorPSDEField: 'servicename',
isLoadDefault: true,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof IBizServiceEditViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof IBizServiceEditViewBase
*/
public viewparams:any = {};
/**
* 解析视图参数
*
* @public
* @memberof IBizServiceEditViewBase
*/
public parseViewParam(): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
}
/**
* 处理自定义视图数据
*
* @memberof IBizServiceEditViewBase
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof IBizServiceEditViewBase
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* Vue声明周期
*
* @memberof IBizServiceEditViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof IBizServiceEditViewBase
*/
public afterCreated(){
const secondtag = this.$util.createUUID();
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
}
/**
* 销毁之前
*
* @memberof IBizServiceEditViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof IBizServiceEditViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof IBizServiceEditViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* toolbar 部件 click 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBizServiceEditViewBase
*/
public toolbar_click($event: any, $event2?: any) {
if (Object.is($event.tag, 'tbitem3')) {
this.toolbar_tbitem3_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem4')) {
this.toolbar_tbitem4_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem5')) {
this.toolbar_tbitem5_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem7')) {
this.toolbar_tbitem7_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem9')) {
this.toolbar_tbitem9_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem10')) {
this.toolbar_tbitem10_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem12')) {
this.toolbar_tbitem12_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem14')) {
this.toolbar_tbitem14_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem15')) {
this.toolbar_tbitem15_click(null, '', $event2);
}
}
/**
* form 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBizServiceEditViewBase
*/
public form_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'save', $event);
}
/**
* form 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBizServiceEditViewBase
*/
public form_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'remove', $event);
}
/**
* form 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBizServiceEditViewBase
*/
public form_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'load', $event);
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem3_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.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Save(datas, contextJO,paramJO, $event, xData,this,"IBizService");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem4_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.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.SaveAndNew(datas, contextJO,paramJO, $event, xData,this,"IBizService");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem5_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.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.SaveAndExit(datas, contextJO,paramJO, $event, xData,this,"IBizService");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem7_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.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.RemoveAndExit(datas, contextJO,paramJO, $event, xData,this,"IBizService");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem9_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.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.SaveAndStart(datas, contextJO,paramJO, $event, xData,this,"IBizService");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem10_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.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.ViewWFStep(datas, contextJO,paramJO, $event, xData,this,"IBizService");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem12_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.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.New(datas, contextJO,paramJO, $event, xData,this,"IBizService");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem14_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.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Copy(datas, contextJO,paramJO, $event, xData,this,"IBizService");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem15_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.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Print(datas, contextJO,paramJO, $event, xData,this,"IBizService");
}
/**
* 保存
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBizServiceEditViewBase
*/
public Save(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
// 界面行为容器对象 _this
const _this: any = this;
if (xData && xData.save instanceof Function) {
xData.save().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
_this.$emit('viewdataschange', [{ ...response.data }]);
});
} else if (_this.save && _this.save instanceof Function) {
_this.save();
}
}
/**
* 保存并新建
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBizServiceEditViewBase
*/
public SaveAndNew(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (!xData || !(xData.saveAndNew instanceof Function)) {
return;
}
xData.saveAndNew().then((response: any) => {
if (!response || response.status !== 200) {
_this.$emit('viewdataschange', JSON.stringify({status:'error',action:'saveAndNew'}));
return;
}
_this.$emit('viewdataschange', JSON.stringify({status:'success',action:'saveAndNew',data:response.data}));
if (xData.autoLoad instanceof Function) {
xData.autoLoad();
}
});
}
/**
* 保存并关闭
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBizServiceEditViewBase
*/
public SaveAndExit(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (xData && xData.saveAndExit instanceof Function) {
xData.saveAndExit().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
if(window.parent){
window.parent.postMessage([{ ...response.data }],'*');
}
});
} else if (_this.saveAndExit && _this.saveAndExit instanceof Function) {
_this.saveAndExit().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
if(window.parent){
window.parent.postMessage([{ ...response.data }],'*');
}
});
}
}
/**
* 删除并关闭
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBizServiceEditViewBase
*/
public RemoveAndExit(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (xData && xData.removeAndExit instanceof Function) {
xData.removeAndExit().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
if(window.parent){
window.parent.postMessage([{ ...response.data }],'*');
}
});
} else if (_this.removeAndExit && _this.removeAndExit instanceof Function) {
_this.removeAndExit().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
if(window.parent){
window.parent.postMessage([{ ...response.data }],'*');
}
});
}
}
/**
* 开始流程
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBizServiceEditViewBase
*/
public SaveAndStart(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (!xData || !(xData.wfstart instanceof Function)) {
return;
}
xData.wfstart(args).then((response: any) => {
if (!response || response.status !== 200) {
return;
}
const { data: _data } = response;
if(window.parent){
window.parent.postMessage({ ..._data },'*');
}
if (_this.viewdata) {
_this.$emit('viewdataschange', [{ ..._data }]);
_this.$emit('close');
}else if (this.$tabPageExp) {
this.$tabPageExp.onClose(this.$route.fullPath);
}
});
}
/**
* 当前流程步骤
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBizServiceEditViewBase
*/
public ViewWFStep(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
let _this:any = this;
if (!xData || !(xData.wfsubmit instanceof Function)) {
return;
}
xData.wfsubmit(args).then((response: any) => {
if (!response || response.status !== 200) {
return;
}
const { data: _data } = response;
if (_this.viewdata) {
_this.$emit('viewdataschange', [{ ..._data }]);
_this.$emit('close');
} else if (_this.$tabPageExp) {
_this.$tabPageExp.onClose(_this.$route.fullPath);
}
});
}
/**
* 新建
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBizServiceEditViewBase
*/
public New(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (_this.newdata && _this.newdata instanceof Function) {
const data: any = {};
_this.newdata([{ ...data }],[{ ...data }], params, $event, xData);
} else {
_this.$Notice.error({ title: '错误', desc: 'newdata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 拷贝
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBizServiceEditViewBase
*/
public Copy(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
if (args.length === 0) {
return;
}
const _this: any = this;
if (_this.newdata && _this.newdata instanceof Function) {
const data: any = {};
if (args.length > 0) {
Object.assign(data, { srfsourcekey: args[0].srfkey })
actionContext.$store.commit('addCopyData', { srfkey: args[0].srfkey, copyData: args[0] });
}
_this.newdata([{ ...data }],[{ ...data }],params, $event, xData);
} else if (xData && xData.copy instanceof Function) {
if (args.length > 0) {
actionContext.$store.commit('addCopyData', { srfkey: args[0].srfkey, copyData: args[0] });
}
xData.copy(args[0].srfkey);
} else {
_this.$Notice.error({ title: '错误', desc: 'opendata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 打印
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBizServiceEditViewBase
*/
public Print(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
let _this:any = this;
if (!xData || !(xData.print instanceof Function) || !$event) {
return ;
}
xData.print();
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof IBizServiceEditViewBase
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof IBizServiceEditViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof IBizServiceEditViewBase
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
}
}
}
</script>
<style lang='less'>
@import './ibiz-service-edit-view.less';
</style>
\ No newline at end of file
// 避免空文件,后台不让空文件过
.ibiz-service-edit-view {
--ibiz-service-edit-view: 0;
}
// 视图样式
// this is less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import IBizServiceEditViewBase from './ibiz-service-edit-view-base.vue';
import view_form from '@widgets/ibiz-service/main-form/main-form.vue';
@Component({
components: {
view_form,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$store.commit('addCurPageViewtag', { route: to, viewtag: vm.viewtag });
});
},
})
export default class IBizServiceEditView extends IBizServiceEditViewBase {
}
</script>
\ No newline at end of file
<template>
<studio-view-style2 viewName="ibizservicegridview" viewTitle="服务表格视图" class='degridview ibiz-service-grid-view'>
<template slot='title'>
<span class='caption-info'>{{$t(model.srfTitle)}}</span>
</template>
<i-input slot="quickSearch" v-show="!isExpandSearchForm" v-model="query" search @on-search="onSearch($event)"/>
<template slot="toolbar">
<view-toolbar mode="STYLE2" :model="toolBarModels" @item-click="toolbar_click"/> </template>
<template slot="searchForm">
<view_searchform
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:showBusyIndicator="true"
v-show="isExpandSearchForm"
loaddraftAction="FilterGetDraft"
loadAction="FilterGet"
name="searchform"
ref='searchform'
@save="searchform_save($event)"
@search="searchform_search($event)"
@load="searchform_load($event)"
@closeview="closeView($event)">
</view_searchform>
</template>
<view_grid
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:isSingleSelect="isSingleSelect"
:showBusyIndicator="true"
:isOpenEdit="false"
:gridRowActiveMode="gridRowActiveMode"
@save="onSave"
updateAction=""
removeAction="Remove"
loaddraftAction=""
loadAction=""
createAction=""
fetchAction="FetchDefault"
:newdata="newdata"
:opendata="opendata"
name="grid"
ref='grid'
@selectionchange="grid_selectionchange($event)"
@beforeload="grid_beforeload($event)"
@rowdblclick="grid_rowdblclick($event)"
@remove="grid_remove($event)"
@load="grid_load($event)"
@closeview="closeView($event)">
</view_grid>
</studio-view-style2>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import { Subject } from 'rxjs';
import IBizServiceService from '@/service/ibiz-service/ibiz-service-service';
import GridViewEngine from '@engine/view/grid-view-engine';
import CodeListService from "@service/app/codelist-service";
@Component({
components: {
},
})
export default class IBizServiceGridViewBase extends Vue {
/**
* 实体服务对象
*
* @type {IBizServiceService}
* @memberof IBizServiceGridViewBase
*/
public appEntityService: IBizServiceService = new IBizServiceService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof IBizServiceGridViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof IBizServiceGridViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof IBizServiceGridViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof IBizServiceGridViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof IBizServiceGridViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图标识
*
* @type {string}
* @memberof IBizServiceGridViewBase
*/
public viewtag: string = '7b487e231caf16a33620396ad7c90634';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof IBizServiceGridViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof IBizServiceGridViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof IBizServiceGridViewBase
*/
public model: any = {
srfCaption: 'entities.ibizservice.views.gridview.caption',
srfTitle: 'entities.ibizservice.views.gridview.title',
srfSubTitle: 'entities.ibizservice.views.gridview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof IBizServiceGridViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof IBizServiceGridViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
}
}
/**
* 容器模型
*
* @type {*}
* @memberof IBizServiceGridViewBase
*/
public containerModel: any = {
view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
view_grid: { name: 'grid', type: 'GRID' },
view_searchform: { name: 'searchform', type: 'SEARCHFORM' },
};
/**
* 计数器刷新
*
* @memberof IBizServiceGridViewBase
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof IBizServiceGridViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 工具栏模型
*
* @type {*}
* @memberof IBizServiceGridView
*/
public toolBarModels: any = {
tbitem3: { name: 'tbitem3', caption: '新建','isShowCaption':true,'isShowIcon':true, tooltip: '新建', iconcls: 'fa fa-file-text-o', icon: '', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'New', target: '' }, class: '' },
tbitem4: { name: 'tbitem4', caption: '编辑','isShowCaption':true,'isShowIcon':true, tooltip: '编辑', iconcls: 'fa fa-edit', icon: '', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'Edit', target: 'SINGLEKEY' }, class: '' },
tbitem6: { name: 'tbitem6', caption: '拷贝','isShowCaption':true,'isShowIcon':true, tooltip: '拷贝', iconcls: 'fa fa-copy', icon: '', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'Copy', target: 'SINGLEKEY' }, class: '' },
tbitem7: { name: 'tbitem7', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem8: { name: 'tbitem8', caption: '删除','isShowCaption':true,'isShowIcon':true, tooltip: '删除', iconcls: 'fa fa-remove', icon: '', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'Remove', target: 'MULTIKEY' }, class: '' },
tbitem9: { name: 'tbitem9', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem13: { name: 'tbitem13', caption: '导出','isShowCaption':true,'isShowIcon':true, tooltip: '导出', iconcls: 'fa fa-file-excel-o', icon: '', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'ExportExcel', target: '' }, MaxRowCount: 1000, class: '' },
tbitem10: { name: 'tbitem10', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem19: { name: 'tbitem19', caption: '过滤','isShowCaption':true,'isShowIcon':true, tooltip: '过滤', iconcls: 'fa fa-filter', icon: '', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'ToggleFilter', target: '' }, class: '' },
};
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof IBizServiceGridViewBase
*/
public engine: GridViewEngine = new GridViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof IBizServiceGridViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
opendata: (args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) => {
this.opendata(args,fullargs, params, $event, xData);
},
newdata: (args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) => {
this.newdata(args,fullargs, params, $event, xData);
},
grid: this.$refs.grid,
searchform: this.$refs.searchform,
keyPSDEField: 'ibizservice',
majorPSDEField: 'servicename',
isLoadDefault: true,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof IBizServiceGridViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof IBizServiceGridViewBase
*/
public viewparams:any = {};
/**
* 解析视图参数
*
* @public
* @memberof IBizServiceGridViewBase
*/
public parseViewParam(): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
}
/**
* 处理自定义视图数据
*
* @memberof IBizServiceGridViewBase
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof IBizServiceGridViewBase
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* Vue声明周期
*
* @memberof IBizServiceGridViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof IBizServiceGridViewBase
*/
public afterCreated(){
const secondtag = this.$util.createUUID();
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
if(this.formDruipart){
this.formDruipart.subscribe((res:any) =>{
if(Object.is(res.action,'save')){
this.viewState.next({ tag:'grid', action: 'save', data: this.viewparams });
}
if(Object.is(res.action,'load')){
const _this: any = this;
_this.engine.load(res.data,true);
}
});
}
}
/**
* 销毁之前
*
* @memberof IBizServiceGridViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof IBizServiceGridViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof IBizServiceGridViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* toolbar 部件 click 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBizServiceGridViewBase
*/
public toolbar_click($event: any, $event2?: any) {
if (Object.is($event.tag, 'tbitem3')) {
this.toolbar_tbitem3_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem4')) {
this.toolbar_tbitem4_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem6')) {
this.toolbar_tbitem6_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem24')) {
this.toolbar_tbitem24_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem25')) {
this.toolbar_tbitem25_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem8')) {
this.toolbar_tbitem8_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem13')) {
this.toolbar_tbitem13_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem11')) {
this.toolbar_tbitem11_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem19')) {
this.toolbar_tbitem19_click(null, '', $event2);
}
}
/**
* grid 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBizServiceGridViewBase
*/
public grid_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'selectionchange', $event);
}
/**
* grid 部件 beforeload 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBizServiceGridViewBase
*/
public grid_beforeload($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'beforeload', $event);
}
/**
* grid 部件 rowdblclick 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBizServiceGridViewBase
*/
public grid_rowdblclick($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'rowdblclick', $event);
}
/**
* grid 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBizServiceGridViewBase
*/
public grid_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'remove', $event);
}
/**
* grid 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBizServiceGridViewBase
*/
public grid_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'load', $event);
}
/**
* searchform 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBizServiceGridViewBase
*/
public searchform_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'save', $event);
}
/**
* searchform 部件 search 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBizServiceGridViewBase
*/
public searchform_search($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'search', $event);
}
/**
* searchform 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBizServiceGridViewBase
*/
public searchform_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'load', $event);
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem3_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.$refs.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.New(datas, contextJO,paramJO, $event, xData,this,"IBizService");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem4_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.$refs.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Edit(datas, contextJO,paramJO, $event, xData,this,"IBizService");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem6_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.$refs.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Copy(datas, contextJO,paramJO, $event, xData,this,"IBizService");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem24_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.$refs.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.ToggleRowEdit(datas, contextJO,paramJO, $event, xData,this,"IBizService");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem25_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.$refs.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.NewRow(datas, contextJO,paramJO, $event, xData,this,"IBizService");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem8_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.$refs.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Remove(datas, contextJO,paramJO, $event, xData,this,"IBizService");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem13_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.$refs.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.ExportExcel(datas, contextJO,paramJO, $event, xData,this,"IBizService");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem11_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.$refs.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Print(datas, contextJO,paramJO, $event, xData,this,"IBizService");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem19_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.$refs.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.ToggleFilter(datas, contextJO,paramJO, $event, xData,this,"IBizService");
}
/**
* 打开新建数据视图
*
* @param {any[]} args
* @param {*} [params]
* @param {*} [fullargs]
* @param {*} [$event]
* @param {*} [xData]
* @memberof IBizServiceGridView
*/
public newdata(args: any[],fullargs?:any[], params?: any, $event?: any, xData?: any) {
let localContext:any = null;
let localViewParam:any =null;
const data: any = {};
if(args[0].srfsourcekey){
data.srfsourcekey = args[0].srfsourcekey;
}
let tempContext = JSON.parse(JSON.stringify(this.context));
delete tempContext.ibizservice;
if(args.length >0){
Object.assign(tempContext,args[0]);
}
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'ibizservices', parameterName: 'ibizservice' },
{ pathName: 'editview', parameterName: 'editview' },
];
const _this: any = this;
const openIndexViewTab = (data: any) => {
const _data: any = { w: (new Date().getTime()) };
Object.assign(_data, data);
const routePath = this.$viewTool.buildUpRoutePath(this.$route, tempContext, deResParameters, parameters, args, _data);
this.$router.push(routePath);
}
openIndexViewTab(data);
}
/**
* 打开编辑数据视图
*
* @param {any[]} args
* @param {*} [params]
* @param {*} [fullargs]
* @param {*} [$event]
* @param {*} [xData]
* @memberof IBizServiceGridView
*/
public opendata(args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) {
let localContext:any = null;
let localViewParam:any =null;
const data: any = {};
let tempContext = JSON.parse(JSON.stringify(this.context));
if(args.length >0){
Object.assign(tempContext,args[0]);
}
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'ibizservices', parameterName: 'ibizservice' },
{ pathName: 'editview', parameterName: 'editview' },
];
const _this: any = this;
const openIndexViewTab = (data: any) => {
const routePath = this.$viewTool.buildUpRoutePath(this.$route, tempContext, deResParameters, parameters, args, data);
this.$router.push(routePath);
}
openIndexViewTab(data);
}
/**
* 新建
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBizServiceGridViewBase
*/
public New(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (_this.newdata && _this.newdata instanceof Function) {
const data: any = {};
_this.newdata([{ ...data }],[{ ...data }], params, $event, xData);
} else {
_this.$Notice.error({ title: '错误', desc: 'newdata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 编辑
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBizServiceGridViewBase
*/
public Edit(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
if (args.length === 0) {
return;
}
const _this: any = this;
if (_this.opendata && _this.opendata instanceof Function) {
const data: any = { };
if (args.length > 0) {
Object.assign(data, { ibizservice: args[0].ibizservice })
}
_this.opendata([{ ...data }], params, $event, xData);
} else {
_this.$Notice.error({ title: '错误', desc: 'opendata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 拷贝
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBizServiceGridViewBase
*/
public Copy(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
if (args.length === 0) {
return;
}
const _this: any = this;
if (_this.newdata && _this.newdata instanceof Function) {
const data: any = {};
if (args.length > 0) {
Object.assign(data, { srfsourcekey: args[0].srfkey })
actionContext.$store.commit('addCopyData', { srfkey: args[0].srfkey, copyData: args[0] });
}
_this.newdata([{ ...data }],[{ ...data }],params, $event, xData);
} else if (xData && xData.copy instanceof Function) {
if (args.length > 0) {
actionContext.$store.commit('addCopyData', { srfkey: args[0].srfkey, copyData: args[0] });
}
xData.copy(args[0].srfkey);
} else {
_this.$Notice.error({ title: '错误', desc: 'opendata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 行编辑
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBizServiceGridViewBase
*/
public ToggleRowEdit(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
xData.actualIsOpenEdit = !xData.actualIsOpenEdit;
}
/**
* 新建行
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBizServiceGridViewBase
*/
public NewRow(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
const data: any = {};
if (_this.newRow && _this.newRow instanceof Function) {
_this.newRow([{ ...data }], params, $event, xData);
} else if(xData.newRow && xData.newRow instanceof Function) {
xData.newRow([{ ...data }], params, $event, xData);
}else{
_this.$Notice.error({ title: '错误', desc: 'newRow 视图处理逻辑不存在,请添加!' });
}
}
/**
* 删除
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBizServiceGridViewBase
*/
public Remove(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (!xData || !(xData.remove instanceof Function)) {
return ;
}
xData.remove(args);
}
/**
* 导出
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBizServiceGridViewBase
*/
public ExportExcel(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (!xData || !(xData.exportExcel instanceof Function) || !$event) {
return ;
}
xData.exportExcel($event.exportparms);
}
/**
* 打印
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBizServiceGridViewBase
*/
public Print(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
let _this:any = this;
if (!xData || !(xData.print instanceof Function) || !$event) {
return ;
}
xData.print();
}
/**
* 过滤
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBizServiceGridViewBase
*/
public ToggleFilter(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (_this.hasOwnProperty('isExpandSearchForm')) {
_this.isExpandSearchForm = !_this.isExpandSearchForm;
}
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof IBizServiceGridViewBase
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof IBizServiceGridViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof IBizServiceGridViewBase
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
}
}
/**
* 是否单选
*
* @type {boolean}
* @memberof IBizServiceGridViewBase
*/
public isSingleSelect: boolean = false;
/**
* 是否嵌入关系界面
*
* @type {boolean}
* @memberof IBizServiceGridViewBase
*/
@Prop({default:false}) public isformDruipart?: boolean;
/**
* 界面关系通讯对象
*
* @type {Subject<ViewState>}
* @memberof IBizServiceGridViewBase
*/
@Prop() public formDruipart?: Subject<ViewState>;
/**
* 搜索值
*
* @type {string}
* @memberof IBizServiceGridViewBase
*/
public query: string = '';
/**
* 是否展开搜索表单
*
* @type {boolean}
* @memberof IBizServiceGridViewBase
*/
public isExpandSearchForm: boolean = false;
/**
* 表格行数据默认激活模式
* 0 不激活
* 1 单击激活
* 2 双击激活
*
* @type {(number | 0 | 1 | 2)}
* @memberof IBizServiceGridViewBase
*/
public gridRowActiveMode: number | 0 | 1 | 2 = 2;
/**
* 快速搜索
*
* @param {*} $event
* @memberof IBizServiceGridViewBase
*/
public onSearch($event: any): void {
const grid: any = this.$refs.grid;
if (grid) {
grid.load(this.context, true);
}
}
/**
* grid 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof ENTITYTEST1Usr2GridViewBase
*/
public onSave($event: any) {
this.$emit('drdatasaved', $event);
}
/**
* 刷新数据
*
* @readonly
* @type {(number | null)}
* @memberof IBizServiceGridViewBase
*/
get refreshdata(): number | null {
return this.$store.getters['viewaction/getRefreshData'](this.viewtag);
}
/**
* 监控数据变化
*
* @param {*} newVal
* @param {*} oldVal
* @returns
* @memberof IBizServiceGridViewBase
*/
@Watch('refreshdata')
onRefreshData(newVal: any, oldVal: any) {
if (newVal === null || newVal === undefined) {
return;
}
if (newVal === 0) {
return;
}
const grid: any = this.$refs.grid;
if (grid) {
grid.load({});
}
}
}
</script>
<style lang='less'>
@import './ibiz-service-grid-view.less';
</style>
\ No newline at end of file
// 避免空文件,后台不让空文件过
.ibiz-service-grid-view {
--ibiz-service-grid-view: 0;
}
// 视图样式
// this is less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import IBizServiceGridViewBase from './ibiz-service-grid-view-base.vue';
import view_grid from '@widgets/ibiz-service/main-grid/main-grid.vue';
import view_searchform from '@widgets/ibiz-service/default-searchform/default-searchform.vue';
@Component({
components: {
view_grid,
view_searchform,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$store.commit('addCurPageViewtag', { route: to, viewtag: vm.viewtag });
});
},
})
export default class IBizServiceGridView extends IBizServiceGridViewBase {
}
</script>
\ No newline at end of file
...@@ -52,6 +52,7 @@ export const PageComponents = { ...@@ -52,6 +52,7 @@ export const PageComponents = {
Vue.component('ibiz-list-info-abstract', () => import('@pages/marketing/ibiz-list-info-abstract/ibiz-list-info-abstract.vue')); Vue.component('ibiz-list-info-abstract', () => import('@pages/marketing/ibiz-list-info-abstract/ibiz-list-info-abstract.vue'));
Vue.component('ibiz-list-info', () => import('@pages/marketing/ibiz-list-info/ibiz-list-info.vue')); Vue.component('ibiz-list-info', () => import('@pages/marketing/ibiz-list-info/ibiz-list-info.vue'));
Vue.component('ibiz-list-summary', () => import('@pages/marketing/ibiz-list-summary/ibiz-list-summary.vue')); Vue.component('ibiz-list-summary', () => import('@pages/marketing/ibiz-list-summary/ibiz-list-summary.vue'));
Vue.component('ibiz-service-edit-view', () => import('@pages/service/ibiz-service-edit-view/ibiz-service-edit-view.vue'));
Vue.component('lead-pickup-grid-view', () => import('@pages/sales/lead-pickup-grid-view/lead-pickup-grid-view.vue')); Vue.component('lead-pickup-grid-view', () => import('@pages/sales/lead-pickup-grid-view/lead-pickup-grid-view.vue'));
Vue.component('list-account-quick-create-by-list', () => import('@pages/marketing/list-account-quick-create-by-list/list-account-quick-create-by-list.vue')); Vue.component('list-account-quick-create-by-list', () => import('@pages/marketing/list-account-quick-create-by-list/list-account-quick-create-by-list.vue'));
Vue.component('campaign-list-edit-view', () => import('@pages/marketing/campaign-list-edit-view/campaign-list-edit-view.vue')); Vue.component('campaign-list-edit-view', () => import('@pages/marketing/campaign-list-edit-view/campaign-list-edit-view.vue'));
...@@ -66,6 +67,7 @@ export const PageComponents = { ...@@ -66,6 +67,7 @@ export const PageComponents = {
Vue.component('campaign-grid-view', () => import('@pages/marketing/campaign-grid-view/campaign-grid-view.vue')); Vue.component('campaign-grid-view', () => import('@pages/marketing/campaign-grid-view/campaign-grid-view.vue'));
Vue.component('list-lead-by-list', () => import('@pages/marketing/list-lead-by-list/list-lead-by-list.vue')); Vue.component('list-lead-by-list', () => import('@pages/marketing/list-lead-by-list/list-lead-by-list.vue'));
Vue.component('account-info-major-contact', () => import('@pages/base/account-info-major-contact/account-info-major-contact.vue')); Vue.component('account-info-major-contact', () => import('@pages/base/account-info-major-contact/account-info-major-contact.vue'));
Vue.component('ibiz-service-grid-view', () => import('@pages/service/ibiz-service-grid-view/ibiz-service-grid-view.vue'));
Vue.component('sales-order-grid-view', () => import('@pages/sales/sales-order-grid-view/sales-order-grid-view.vue')); Vue.component('sales-order-grid-view', () => import('@pages/sales/sales-order-grid-view/sales-order-grid-view.vue'));
Vue.component('contact-option-view', () => import('@pages/base/contact-option-view/contact-option-view.vue')); Vue.component('contact-option-view', () => import('@pages/base/contact-option-view/contact-option-view.vue'));
Vue.component('contact-edit-abstract', () => import('@pages/base/contact-edit-abstract/contact-edit-abstract.vue')); Vue.component('contact-edit-abstract', () => import('@pages/base/contact-edit-abstract/contact-edit-abstract.vue'));
...@@ -81,6 +83,7 @@ export const PageComponents = { ...@@ -81,6 +83,7 @@ export const PageComponents = {
Vue.component('contact-info-market', () => import('@pages/base/contact-info-market/contact-info-market.vue')); Vue.component('contact-info-market', () => import('@pages/base/contact-info-market/contact-info-market.vue'));
Vue.component('competitor-grid-view', () => import('@pages/sales/competitor-grid-view/competitor-grid-view.vue')); Vue.component('competitor-grid-view', () => import('@pages/sales/competitor-grid-view/competitor-grid-view.vue'));
Vue.component('quote-edit-view', () => import('@pages/sales/quote-edit-view/quote-edit-view.vue')); Vue.component('quote-edit-view', () => import('@pages/sales/quote-edit-view/quote-edit-view.vue'));
Vue.component('account-summary', () => import('@pages/base/account-summary/account-summary.vue'));
Vue.component('incident-grid-view', () => import('@pages/service/incident-grid-view/incident-grid-view.vue')); Vue.component('incident-grid-view', () => import('@pages/service/incident-grid-view/incident-grid-view.vue'));
Vue.component('ibiz-list-quick-create', () => import('@pages/marketing/ibiz-list-quick-create/ibiz-list-quick-create.vue')); Vue.component('ibiz-list-quick-create', () => import('@pages/marketing/ibiz-list-quick-create/ibiz-list-quick-create.vue'));
Vue.component('account-inner-pickup-view', () => import('@pages/base/account-inner-pickup-view/account-inner-pickup-view.vue')); Vue.component('account-inner-pickup-view', () => import('@pages/base/account-inner-pickup-view/account-inner-pickup-view.vue'));
......
...@@ -943,6 +943,20 @@ const router = new Router({ ...@@ -943,6 +943,20 @@ const router = new Router({
}, },
component: () => import('@pages/marketing/ibiz-list-summary/ibiz-list-summary.vue'), component: () => import('@pages/marketing/ibiz-list-summary/ibiz-list-summary.vue'),
}, },
{
path: 'ibizservices/:ibizservice?/editview/:editview?',
meta: {
caption: 'entities.ibizservice.views.editview.title',
info:'',
parameters: [
{ pathName: 'central', parameterName: 'central' },
{ pathName: 'ibizservices', parameterName: 'ibizservice' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/service/ibiz-service-edit-view/ibiz-service-edit-view.vue'),
},
{ {
path: 'campaignresponses/:campaignresponse?/quickcreate/:quickcreate?', path: 'campaignresponses/:campaignresponse?/quickcreate/:quickcreate?',
meta: { meta: {
...@@ -1425,6 +1439,20 @@ const router = new Router({ ...@@ -1425,6 +1439,20 @@ const router = new Router({
}, },
component: () => import('@pages/base/account-info-major-contact/account-info-major-contact.vue'), component: () => import('@pages/base/account-info-major-contact/account-info-major-contact.vue'),
}, },
{
path: 'ibizservices/:ibizservice?/gridview/:gridview?',
meta: {
caption: 'entities.ibizservice.views.gridview.title',
info:'',
parameters: [
{ pathName: 'central', parameterName: 'central' },
{ pathName: 'ibizservices', parameterName: 'ibizservice' },
{ pathName: 'gridview', parameterName: 'gridview' },
],
requireAuth: true,
},
component: () => import('@pages/service/ibiz-service-grid-view/ibiz-service-grid-view.vue'),
},
{ {
path: 'salesorders/:salesorder?/gridview/:gridview?', path: 'salesorders/:salesorder?/gridview/:gridview?',
meta: { meta: {
...@@ -1752,6 +1780,20 @@ const router = new Router({ ...@@ -1752,6 +1780,20 @@ const router = new Router({
}, },
component: () => import('@pages/base/contact-edit-address/contact-edit-address.vue'), component: () => import('@pages/base/contact-edit-address/contact-edit-address.vue'),
}, },
{
path: 'accounts/:account?/summary/:summary?',
meta: {
caption: 'entities.account.views.summary.title',
info:'',
parameters: [
{ pathName: 'central', parameterName: 'central' },
{ pathName: 'accounts', parameterName: 'account' },
{ pathName: 'summary', parameterName: 'summary' },
],
requireAuth: true,
},
component: () => import('@pages/base/account-summary/account-summary.vue'),
},
{ {
path: 'incidents/:incident?/gridview/:gridview?', path: 'incidents/:incident?/gridview/:gridview?',
meta: { meta: {
...@@ -1797,6 +1839,19 @@ const router = new Router({ ...@@ -1797,6 +1839,19 @@ const router = new Router({
...indexRoutes, ...indexRoutes,
], ],
}, },
{
path: '/ibizservices/:ibizservice?/editview/:editview?',
meta: {
caption: 'entities.ibizservice.views.editview.title',
info:'',
parameters: [
{ pathName: 'ibizservices', parameterName: 'ibizservice' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/service/ibiz-service-edit-view/ibiz-service-edit-view.vue'),
},
{ {
path: '/contacts/:contact?/editabstract/:editabstract?', path: '/contacts/:contact?/editabstract/:editabstract?',
meta: { meta: {
...@@ -1810,6 +1865,19 @@ const router = new Router({ ...@@ -1810,6 +1865,19 @@ const router = new Router({
}, },
component: () => import('@pages/base/contact-edit-abstract/contact-edit-abstract.vue'), component: () => import('@pages/base/contact-edit-abstract/contact-edit-abstract.vue'),
}, },
{
path: '/accounts/:account?/summary/:summary?',
meta: {
caption: 'entities.account.views.summary.title',
info:'',
parameters: [
{ pathName: 'accounts', parameterName: 'account' },
{ pathName: 'summary', parameterName: 'summary' },
],
requireAuth: true,
},
component: () => import('@pages/base/account-summary/account-summary.vue'),
},
{ {
path: '/invoices/:invoice?/editview/:editview?', path: '/invoices/:invoice?/editview/:editview?',
meta: { meta: {
...@@ -2743,6 +2811,19 @@ const router = new Router({ ...@@ -2743,6 +2811,19 @@ const router = new Router({
}, },
component: () => import('@pages/sales/goal-edit-view/goal-edit-view.vue'), component: () => import('@pages/sales/goal-edit-view/goal-edit-view.vue'),
}, },
{
path: '/ibizservices/:ibizservice?/gridview/:gridview?',
meta: {
caption: 'entities.ibizservice.views.gridview.title',
info:'',
parameters: [
{ pathName: 'ibizservices', parameterName: 'ibizservice' },
{ pathName: 'gridview', parameterName: 'gridview' },
],
requireAuth: true,
},
component: () => import('@pages/service/ibiz-service-grid-view/ibiz-service-grid-view.vue'),
},
{ {
path: '/campaignresponses/:campaignresponse?/quickcreate/:quickcreate?', path: '/campaignresponses/:campaignresponse?/quickcreate/:quickcreate?',
meta: { meta: {
......
...@@ -52,6 +52,7 @@ export class EntityServiceRegister { ...@@ -52,6 +52,7 @@ export class EntityServiceRegister {
this.allEntityService.set('campaign', () => import('@/service/campaign/campaign-service')); this.allEntityService.set('campaign', () => import('@/service/campaign/campaign-service'));
this.allEntityService.set('lead', () => import('@/service/lead/lead-service')); this.allEntityService.set('lead', () => import('@/service/lead/lead-service'));
this.allEntityService.set('incident', () => import('@/service/incident/incident-service')); this.allEntityService.set('incident', () => import('@/service/incident/incident-service'));
this.allEntityService.set('ibizservice', () => import('@/service/ibiz-service/ibiz-service-service'));
this.allEntityService.set('ibizlist', () => import('@/service/ibiz-list/ibiz-list-service')); this.allEntityService.set('ibizlist', () => import('@/service/ibiz-list/ibiz-list-service'));
this.allEntityService.set('campaignresponse', () => import('@/service/campaign-response/campaign-response-service')); this.allEntityService.set('campaignresponse', () => import('@/service/campaign-response/campaign-response-service'));
this.allEntityService.set('phonecall', () => import('@/service/phone-call/phone-call-service')); this.allEntityService.set('phonecall', () => import('@/service/phone-call/phone-call-service'));
......
import { Http,Util } from '@/utils';
import EntityService from '../entity-service';
/**
* 服务服务对象基类
*
* @export
* @class IBizServiceServiceBase
* @extends {EntityServie}
*/
export default class IBizServiceServiceBase extends EntityService {
/**
* Creates an instance of IBizServiceServiceBase.
*
* @param {*} [opts={}]
* @memberof IBizServiceServiceBase
*/
constructor(opts: any = {}) {
super(opts);
}
/**
* 初始化基础数据
*
* @memberof IBizServiceServiceBase
*/
public initBasicData(){
this.APPLYDEKEY ='ibizservice';
this.APPDEKEY = 'serviceid';
this.APPDENAME = 'ibizservices';
this.APPDETEXT = 'servicename';
this.APPNAME = 'businesscentral';
this.SYSTEMNAME = 'ibizbusinesscentral';
}
// 实体接口
/**
* Select接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBizServiceServiceBase
*/
public async Select(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
return Http.getInstance().get(`/ibizservices/${context.ibizservice}/select`,isloading);
}
/**
* GetDraft接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBizServiceServiceBase
*/
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/ibizservices/getdraft`,isloading);
res.data.ibizservice = data.ibizservice;
return res;
}
/**
* Remove接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBizServiceServiceBase
*/
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
return Http.getInstance().delete(`/ibizservices/${context.ibizservice}`,isloading);
}
/**
* CheckKey接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBizServiceServiceBase
*/
public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
return Http.getInstance().post(`/ibizservices/${context.ibizservice}/checkkey`,data,isloading);
}
/**
* Save接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBizServiceServiceBase
*/
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/ibizservices/${context.ibizservice}/save`,data,isloading);
return res;
}
/**
* Update接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBizServiceServiceBase
*/
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/ibizservices/${context.ibizservice}`,data,isloading);
return res;
}
/**
* Create接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBizServiceServiceBase
*/
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
}
if(data.srffrontuf){
delete data.srffrontuf;
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/ibizservices`,data,isloading);
return res;
}
/**
* Get接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBizServiceServiceBase
*/
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/ibizservices/${context.ibizservice}`,isloading);
return res;
}
/**
* FetchDefault接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBizServiceServiceBase
*/
public async FetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let tempData:any = JSON.parse(JSON.stringify(data));
return Http.getInstance().get(`/ibizservices/fetchdefault`,tempData,isloading);
}
}
\ No newline at end of file
import { Http,Util } from '@/utils';
import IBizServiceServiceBase from './ibiz-service-service-base';
/**
* 服务服务对象
*
* @export
* @class IBizServiceService
* @extends {IBizServiceServiceBase}
*/
export default class IBizServiceService extends IBizServiceServiceBase {
/**
* Creates an instance of IBizServiceService.
*
* @param {*} [opts={}]
* @memberof IBizServiceService
*/
constructor(opts: any = {}) {
super(opts);
}
}
\ No newline at end of file
...@@ -3,6 +3,15 @@ ...@@ -3,6 +3,15 @@
*/ */
export const viewstate: any = { export const viewstate: any = {
appviews: [ appviews: [
{
viewtag: '0027cf632b1ee99cb364d2b6aa2b6511',
viewmodule: 'Service',
viewname: 'IBizServiceEditView',
viewaction: '',
viewdatachange: false,
refviews: [
],
},
{ {
viewtag: '016506dd3f47a5cf8530f2ca3dbdc7b7', viewtag: '016506dd3f47a5cf8530f2ca3dbdc7b7',
viewmodule: 'Base', viewmodule: 'Base',
...@@ -12,6 +21,20 @@ export const viewstate: any = { ...@@ -12,6 +21,20 @@ export const viewstate: any = {
refviews: [ refviews: [
], ],
}, },
{
viewtag: '016e75bb460270519a0ee9dda57b2c90',
viewmodule: 'Base',
viewname: 'AccountSummary',
viewaction: '',
viewdatachange: false,
refviews: [
'aa79d35850f36fbc1a5085353ecd5af5',
'7b487e231caf16a33620396ad7c90634',
'a95d7d9111bc13a8b73a11ee1e4ff92a',
'893e62d6fbdc4580de7e3e802aec9108',
'a5213905238dbc5d8e1a505029105cc9',
],
},
{ {
viewtag: '01c28e25ad9d42977cb91ee890731b64', viewtag: '01c28e25ad9d42977cb91ee890731b64',
viewmodule: 'Finance', viewmodule: 'Finance',
...@@ -236,7 +259,7 @@ export const viewstate: any = { ...@@ -236,7 +259,7 @@ export const viewstate: any = {
refviews: [ refviews: [
'fb06f2c1cea1ac2a5a70c20f4a277ae5', 'fb06f2c1cea1ac2a5a70c20f4a277ae5',
'bae77557d2f7a7852b634dc5d5a93435', 'bae77557d2f7a7852b634dc5d5a93435',
'6e18ac74e5685439110f9b4e534ee005', '016e75bb460270519a0ee9dda57b2c90',
], ],
}, },
{ {
...@@ -531,6 +554,16 @@ export const viewstate: any = { ...@@ -531,6 +554,16 @@ export const viewstate: any = {
refviews: [ refviews: [
], ],
}, },
{
viewtag: '7b487e231caf16a33620396ad7c90634',
viewmodule: 'Service',
viewname: 'IBizServiceGridView',
viewaction: '',
viewdatachange: false,
refviews: [
'0027cf632b1ee99cb364d2b6aa2b6511',
],
},
{ {
viewtag: '7b7560b6d508b7bb0447d3204ed1c8be', viewtag: '7b7560b6d508b7bb0447d3204ed1c8be',
viewmodule: 'Marketing', viewmodule: 'Marketing',
......
...@@ -84,6 +84,7 @@ export default class AccountUIServiceBase extends UIService { ...@@ -84,6 +84,7 @@ export default class AccountUIServiceBase extends UIService {
this.allViewMap.set(':',{viewname:'info_account',srfappde:'accounts'}); this.allViewMap.set(':',{viewname:'info_account',srfappde:'accounts'});
this.allViewMap.set('PICKUPVIEW:',{viewname:'pickupview',srfappde:'accounts'}); this.allViewMap.set('PICKUPVIEW:',{viewname:'pickupview',srfappde:'accounts'});
this.allViewMap.set(':',{viewname:'info',srfappde:'accounts'}); this.allViewMap.set(':',{viewname:'info',srfappde:'accounts'});
this.allViewMap.set(':',{viewname:'info_all',srfappde:'accounts'});
this.allViewMap.set('MDATAVIEW:',{viewname:'gridview',srfappde:'accounts'}); this.allViewMap.set('MDATAVIEW:',{viewname:'gridview',srfappde:'accounts'});
this.allViewMap.set(':',{viewname:'edit_accountinfo',srfappde:'accounts'}); this.allViewMap.set(':',{viewname:'edit_accountinfo',srfappde:'accounts'});
this.allViewMap.set('EDITVIEW:',{viewname:'editview',srfappde:'accounts'}); this.allViewMap.set('EDITVIEW:',{viewname:'editview',srfappde:'accounts'});
...@@ -167,72 +168,6 @@ export default class AccountUIServiceBase extends UIService { ...@@ -167,72 +168,6 @@ export default class AccountUIServiceBase extends UIService {
openDrawer(view, data); openDrawer(view, data);
} }
/**
* 编辑
*
* @param {any[]} args 当前数据
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
* @returns {Promise<any>}
*/
public async Account_Edit_Address(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-address',
height: 0,
width: 450,
title: actionContext.$t('entities.account.views.edit_address.title'),
placement: 'DRAWER_RIGHT',
};
openDrawer(view, data);
}
/** /**
* 编辑 * 编辑
* *
......
import { Environment } from '@/environments/environment';
import { UIActionTool,Util } from '@/utils';
import UIService from '../ui-service';
import { Subject } from 'rxjs';
import IBizServiceService from '@/service/ibiz-service/ibiz-service-service';
/**
* 服务UI服务对象基类
*
* @export
* @class IBizServiceUIServiceBase
*/
export default class IBizServiceUIServiceBase extends UIService {
/**
* 是否支持工作流
*
* @memberof IBizServiceUIServiceBase
*/
public isEnableWorkflow:boolean = false;
/**
* 当前UI服务对应的数据服务对象
*
* @memberof IBizServiceUIServiceBase
*/
public dataService:IBizServiceService = new IBizServiceService();
/**
* 所有关联视图
*
* @memberof IBizServiceUIServiceBase
*/
public allViewMap: Map<string, Object> = new Map();
/**
* 状态值
*
* @memberof IBizServiceUIServiceBase
*/
public stateValue: number = 0;
/**
* 状态属性
*
* @memberof IBizServiceUIServiceBase
*/
public stateField: string = "";
/**
* 主状态属性集合
*
* @memberof IBizServiceUIServiceBase
*/
public mainStateFields:Array<any> = [];
/**
* 主状态集合Map
*
* @memberof IBizServiceUIServiceBase
*/
public allDeMainStateMap:Map<string,string> = new Map();
/**
* Creates an instance of IBizServiceUIServiceBase.
*
* @param {*} [opts={}]
* @memberof IBizServiceUIServiceBase
*/
constructor(opts: any = {}) {
super(opts);
this.initViewMap();
this.initDeMainStateMap();
}
/**
* 初始化视图Map
*
* @memberof IBizServiceUIServiceBase
*/
public initViewMap(){
this.allViewMap.set('EDITVIEW:',{viewname:'editview',srfappde:'ibizservices'});
this.allViewMap.set('MDATAVIEW:',{viewname:'gridview',srfappde:'ibizservices'});
}
/**
* 初始化主状态集合
*
* @memberof IBizServiceUIServiceBase
*/
public initDeMainStateMap(){
}
/**
* 获取指定数据的重定向页面
*
* @param srfkey 数据主键
* @param isEnableWorkflow 重定向视图是否需要处理流程中的数据
* @memberof IBizServiceUIServiceBase
*/
public async getRDAppView(srfkey:string,isEnableWorkflow:boolean){
this.isEnableWorkflow = isEnableWorkflow;
// 进行数据查询
let result:any = await this.dataService.Get({ibizservice:srfkey});
const curData:any = result.data;
//判断当前数据模式,默认为true,todo
const iRealDEModel:boolean = true;
let bDataInWF:boolean = false;
let bWFMode:any = false;
// 计算数据模式
if (this.isEnableWorkflow) {
bDataInWF = await this.dataService.testDataInWF({stateValue:this.stateValue,stateField:this.stateField},curData);
if (bDataInWF) {
bDataInWF = true;
bWFMode = await this.dataService.testUserExistWorklist(null,curData);
}
}
let strPDTViewParam:string = await this.getDESDDEViewPDTParam(curData, bDataInWF, bWFMode);
//若不是当前数据模式,处理strPDTViewParam,todo
//查找视图
//返回视图
return this.allViewMap.get(strPDTViewParam);
}
/**
* 获取实际的数据类型
*
* @memberof IBizServiceUIServiceBase
*/
public getRealDEType(entity:any){
}
/**
* 获取实体单数据实体视图预定义参数
*
* @param curData 当前数据
* @param bDataInWF 是否有数据在工作流中
* @param bWFMode 是否工作流模式
* @memberof IBizServiceUIServiceBase
*/
public async getDESDDEViewPDTParam(curData:any, bDataInWF:boolean, bWFMode:boolean){
let strPDTParam:string = '';
if (bDataInWF) {
// 判断数据是否在流程中
}
//多表单,todo
const isEnableMultiForm:boolean = false;
const multiFormDEField:string|null =null;
if (isEnableMultiForm && multiFormDEField) {
const objFormValue:string = curData[multiFormDEField];
if(!Environment.isAppMode){
return 'MOBEDITVIEW'+objFormValue;
}
return 'EDITVIEW'+objFormValue;
}
if(!Environment.isAppMode){
if(this.getDEMainStateTag(curData)){
return `MOBEDITVIEW:MSTAG:${ await this.getDEMainStateTag(curData)}`;
}
return 'MOBEDITVIEW:';
}
if(this.getDEMainStateTag(curData)){
return `EDITVIEW:MSTAG:${ await this.getDEMainStateTag(curData)}`;
}
return 'EDITVIEW:';
}
/**
* 获取数据对象的主状态标识
*
* @param curData 当前数据
* @memberof IBizServiceUIServiceBase
*/
public async getDEMainStateTag(curData:any){
if(this.mainStateFields.length === 0) return null;
this.mainStateFields.forEach((singleMainField:any) =>{
if(!(singleMainField in curData)){
console.error(`当前数据对象不包含属性singleMainField,可能会发生错误`);
}
})
let strTag:String = "";
for (let i = 0; i <= 1; i++) {
let strTag:string = (curData[this.mainStateFields[0]])?(i == 0) ? curData[this.mainStateFields[0]] : "":"";
if (this.mainStateFields.length >= 2) {
for (let j = 0; j <= 1; j++) {
let strTag2:string = (curData[this.mainStateFields[1]])?`${strTag}__${(j == 0) ? curData[this.mainStateFields[1]] : ""}`:strTag;
if (this.mainStateFields.length >= 3) {
for (let k = 0; k <= 1; k++) {
let strTag3:string = (curData[this.mainStateFields[2]])?`${strTag2}__${(k == 0) ? curData[this.mainStateFields[2]] : ""}`:strTag2;
// 判断是否存在
return this.allDeMainStateMap.get(strTag3);
}
}else{
return this.allDeMainStateMap.get(strTag2);
}
}
}else{
return this.allDeMainStateMap.get(strTag);
}
}
return null;
}
}
\ No newline at end of file
import IBizServiceUIServiceBase from './ibiz-service-ui-service-base';
/**
* 服务UI服务对象
*
* @export
* @class IBizServiceUIService
*/
export default class IBizServiceUIService extends IBizServiceUIServiceBase {
/**
* Creates an instance of IBizServiceUIService.
*
* @param {*} [opts={}]
* @memberof IBizServiceUIService
*/
constructor(opts: any = {}) {
super(opts);
}
}
\ No newline at end of file
...@@ -52,6 +52,7 @@ export class UIServiceRegister { ...@@ -52,6 +52,7 @@ export class UIServiceRegister {
this.allUIService.set('campaign', () => import('@/uiservice/campaign/campaign-ui-service')); this.allUIService.set('campaign', () => import('@/uiservice/campaign/campaign-ui-service'));
this.allUIService.set('lead', () => import('@/uiservice/lead/lead-ui-service')); this.allUIService.set('lead', () => import('@/uiservice/lead/lead-ui-service'));
this.allUIService.set('incident', () => import('@/uiservice/incident/incident-ui-service')); this.allUIService.set('incident', () => import('@/uiservice/incident/incident-ui-service'));
this.allUIService.set('ibizservice', () => import('@/uiservice/ibiz-service/ibiz-service-ui-service'));
this.allUIService.set('ibizlist', () => import('@/uiservice/ibiz-list/ibiz-list-ui-service')); this.allUIService.set('ibizlist', () => import('@/uiservice/ibiz-list/ibiz-list-ui-service'));
this.allUIService.set('campaignresponse', () => import('@/uiservice/campaign-response/campaign-response-ui-service')); this.allUIService.set('campaignresponse', () => import('@/uiservice/campaign-response/campaign-response-ui-service'));
this.allUIService.set('phonecall', () => import('@/uiservice/phone-call/phone-call-ui-service')); this.allUIService.set('phonecall', () => import('@/uiservice/phone-call/phone-call-ui-service'));
......
<template> <template>
<div class='tabviewpanel' style="height:100%;" v-if = 'isActivied' > <div class='tabviewpanel' style="height:100%;" v-if = 'isActivied' >
<account-edit-view <account-summary
class='viewcontainer2' class='viewcontainer2'
:viewdata="viewdata" :viewdata="viewdata"
:viewparam="viewparam" :viewparam="viewparam"
@viewload="viewDatasChange($event)" @viewload="viewDatasChange($event)"
:viewDefaultUsage="false" > :viewDefaultUsage="false" >
</account-edit-view> </account-summary>
</div> </div>
</template> </template>
<script lang='tsx'> <script lang='tsx'>
......
...@@ -19,78 +19,15 @@ ...@@ -19,78 +19,15 @@
<div class="portlet-without-title"> <div class="portlet-without-title">
<card class="portlet-card" :bordered="false" dis-hover :padding="0"> <card class="portlet-card" :bordered="false" dis-hover :padding="0">
<span> <span>
<view_dashboard_sysportlet1 <view_dashboard_sysportlet6
:viewState="viewState" :viewState="viewState"
:viewparams="viewparams" :viewparams="viewparams"
:context="context" :context="context"
name="dashboard_sysportlet1" :height="300"
ref='dashboard_sysportlet1' name="dashboard_sysportlet6"
ref='dashboard_sysportlet6'
@closeview="closeView($event)"> @closeview="closeView($event)">
</view_dashboard_sysportlet1> </view_dashboard_sysportlet6>
</span>
</card>
</div>
</i-col>
<i-col :md="{ span: 24, offset: 0 }">
<div class="portlet-without-title">
<card class="portlet-card" :bordered="false" dis-hover :padding="0">
<span>
<view_dashboard_sysportlet2
:viewState="viewState"
:viewparams="viewparams"
:context="context"
name="dashboard_sysportlet2"
ref='dashboard_sysportlet2'
@closeview="closeView($event)">
</view_dashboard_sysportlet2>
</span>
</card>
</div>
</i-col>
<i-col :md="{ span: 24, offset: 0 }">
<div class="portlet-without-title">
<card class="portlet-card" :bordered="false" dis-hover :padding="0">
<span>
<view_dashboard_sysportlet3
:viewState="viewState"
:viewparams="viewparams"
:context="context"
name="dashboard_sysportlet3"
ref='dashboard_sysportlet3'
@closeview="closeView($event)">
</view_dashboard_sysportlet3>
</span>
</card>
</div>
</i-col>
<i-col :md="{ span: 24, offset: 0 }">
<div class="portlet-without-title">
<card class="portlet-card" :bordered="false" dis-hover :padding="0">
<span>
<view_dashboard_sysportlet4
:viewState="viewState"
:viewparams="viewparams"
:context="context"
name="dashboard_sysportlet4"
ref='dashboard_sysportlet4'
@closeview="closeView($event)">
</view_dashboard_sysportlet4>
</span>
</card>
</div>
</i-col>
<i-col :md="{ span: 24, offset: 0 }">
<div class="portlet-without-title">
<card class="portlet-card" :bordered="false" dis-hover :padding="0">
<span>
<view_dashboard_sysportlet5
:viewState="viewState"
:viewparams="viewparams"
:context="context"
name="dashboard_sysportlet5"
ref='dashboard_sysportlet5'
@closeview="closeView($event)">
</view_dashboard_sysportlet5>
</span> </span>
</card> </card>
</div> </div>
......
...@@ -2,21 +2,13 @@ ...@@ -2,21 +2,13 @@
import { Component } from 'vue-property-decorator'; import { Component } from 'vue-property-decorator';
import SummaryBase from './summary-dashboard-base.vue'; import SummaryBase from './summary-dashboard-base.vue';
import view_dashboard_sysportlet8 from '@widgets/activity-pointer/list-by-parent-key-portlet/list-by-parent-key-portlet.vue'; import view_dashboard_sysportlet8 from '@widgets/activity-pointer/list-by-parent-key-portlet/list-by-parent-key-portlet.vue';
import view_dashboard_sysportlet4 from '@widgets/account/view-contact-setting-portlet/view-contact-setting-portlet.vue'; import view_dashboard_sysportlet6 from '@widgets/account/view-account-info-all-portlet/view-account-info-all-portlet.vue';
import view_dashboard_sysportlet5 from '@widgets/account/view-distribution-portlet/view-distribution-portlet.vue';
import view_dashboard_sysportlet2 from '@widgets/account/view-address-portlet/view-address-portlet.vue';
import view_dashboard_sysportlet3 from '@widgets/account/view-introduction-portlet/view-introduction-portlet.vue';
import view_dashboard_sysportlet1 from '@widgets/account/view-account-info-portlet/view-account-info-portlet.vue';
@Component({ @Component({
components: { components: {
view_dashboard_sysportlet8, view_dashboard_sysportlet8,
view_dashboard_sysportlet4, view_dashboard_sysportlet6,
view_dashboard_sysportlet5,
view_dashboard_sysportlet2,
view_dashboard_sysportlet3,
view_dashboard_sysportlet1,
} }
}) })
......
<template>
<div class='portlet view-account-info-all ' :style="{'height': isAdaptiveSize ? 'calc(100% - 16px)' : (height > 0 ? height+'px' :'300px'),}">
<p class='portlet-title'>
<span>
客户信息
</span>
</p>
<div class="portlet-with-title">
<ibiz-service-grid-view :viewdata="JSON.stringify(context)" :viewDefaultUsage="false" ></ibiz-service-grid-view>
</div>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import AccountService from '@/service/account/account-service';
import View_AccountInfoAllService from './view-account-info-all-portlet-service';
import { Environment } from '@/environments/environment';
@Component({
components: {
}
})
export default class AccountView_AccountInfoAllBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof View_AccountInfoAll
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof View_AccountInfoAll
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof View_AccountInfoAll
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof View_AccountInfoAll
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof View_AccountInfoAll
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof View_AccountInfoAll
*/
public getControlType(): string {
return 'PORTLET'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof View_AccountInfoAll
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {View_AccountInfoAllService}
* @memberof View_AccountInfoAll
*/
public service: View_AccountInfoAllService = new View_AccountInfoAllService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {AccountService}
* @memberof View_AccountInfoAll
*/
public appEntityService: AccountService = new AccountService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof View_AccountInfoAll
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof View_AccountInfoAll
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 长度
*
* @type {number}
* @memberof View_AccountInfoAll
*/
@Prop() public height?: number;
/**
* 宽度
*
* @type {number}
* @memberof View_AccountInfoAll
*/
@Prop() public width?: number;
/**
* 是否自适应大小
*
* @returns {boolean}
* @memberof View_AccountInfoAllBase
*/
@Prop({default: false})public isAdaptiveSize!: boolean;
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof View_AccountInfoAllBase
*/
public getDatas(): any[] {
return [];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof View_AccountInfoAllBase
*/
public getData(): any {
return {};
}
/**
* vue 生命周期
*
* @memberof View_AccountInfoAllBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof View_AccountInfoAllBase
*/
public afterCreated(){
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
const refs: any = this.$refs;
Object.keys(refs).forEach((_name: string) => {
this.viewState.next({ tag: _name, action: action, data: data });
});
});
}
}
/**
* vue 生命周期
*
* @memberof View_AccountInfoAllBase
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof View_AccountInfoAllBase
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
}
</script>
<style lang='less'>
@import './view-account-info-all-portlet.less';
</style>
/**
* View_AccountInfoAll 部件模型
*
* @export
* @class View_AccountInfoAllModel
*/
export default class View_AccountInfoAllModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof View_AccountInfoAllModel
*/
public getDataItems(): any[] {
return [
{
name: 'address1_primarycontactname',
},
{
name: 'openrevenue_date',
},
{
name: 'address2_utcoffset',
},
{
name: 'fax',
},
{
name: 'address1_composite',
},
{
name: 'entityimage',
},
{
name: 'emailaddress1',
},
{
name: 'overriddencreatedon',
},
{
name: 'address1_stateorprovince',
},
{
name: 'openrevenue',
},
{
name: 'address1_upszone',
},
{
name: 'followemail',
},
{
name: 'marketingonly',
},
{
name: 'numberofemployees',
},
{
name: 'telephone1',
},
{
name: 'aging60',
},
{
name: 'sharesoutstanding',
},
{
name: 'address2_freighttermscode',
},
{
name: 'entityimage_timestamp',
},
{
name: 'revenue_base',
},
{
name: 'accountratingcode',
},
{
name: 'donotbulkemail',
},
{
name: 'aging30',
},
{
name: 'donotbulkpostalmail',
},
{
name: 'creditlimit_base',
},
{
name: 'timezoneruleversionnumber',
},
{
name: 'customertypecode',
},
{
name: 'address2_longitude',
},
{
name: 'accountname',
},
{
name: 'participatesinworkflow',
},
{
name: 'preferredcontactmethodcode',
},
{
name: 'preferredappointmentdaycode',
},
{
name: 'marketcap',
},
{
name: 'address2_telephone1',
},
{
name: 'businesstypecode',
},
{
name: 'entityimageid',
},
{
name: 'address2_city',
},
{
name: 'ownershipcode',
},
{
name: 'utcconversiontimezonecode',
},
{
name: 'accountnumber',
},
{
name: 'address1_telephone2',
},
{
name: 'address1_line1',
},
{
name: 'donotphone',
},
{
name: 'address1_telephone3',
},
{
name: 'exchangerate',
},
{
name: 'address2_line2',
},
{
name: 'address2_telephone3',
},
{
name: 'address1_telephone1',
},
{
name: 'address1_fax',
},
{
name: 'address1_freighttermscode',
},
{
name: 'description',
},
{
name: 'merged',
},
{
name: 'address1_shippingmethodcode',
},
{
name: 'address1_name',
},
{
name: 'aging30_base',
},
{
name: 'address2_telephone2',
},
{
name: 'account',
prop: 'accountid',
},
{
name: 'primarytwitterid',
},
{
name: 'tickersymbol',
},
{
name: 'stockexchange',
},
{
name: 'address2_stateorprovince',
},
{
name: 'ftpsiteurl',
},
{
name: 'statuscode',
},
{
name: 'websiteurl',
},
{
name: 'donotpostalmail',
},
{
name: 'address1_city',
},
{
name: 'address2_fax',
},
{
name: 'aging90_base',
},
{
name: 'opendeals_date',
},
{
name: 'traversedpath',
},
{
name: 'shippingmethodcode',
},
{
name: 'address1_line2',
},
{
name: 'openrevenue_base',
},
{
name: 'updatedate',
},
{
name: 'preferredsystemuseridyominame',
},
{
name: 'address2_line3',
},
{
name: 'address1_postalcode',
},
{
name: 'address2_latitude',
},
{
name: 'ibizprivate',
},
{
name: 'territorycode',
},
{
name: 'teamsfollowed',
},
{
name: 'yominame',
},
{
name: 'address1_latitude',
},
{
name: 'telephone3',
},
{
name: 'ownerid',
},
{
name: 'address2_country',
},
{
name: 'masteraccountidyominame',
},
{
name: 'industrycode',
},
{
name: 'lastonholdtime',
},
{
name: 'address2_addressid',
},
{
name: 'onholdtime',
},
{
name: 'accountclassificationcode',
},
{
name: 'address1_country',
},
{
name: 'address1_addresstypecode',
},
{
name: 'statecode',
},
{
name: 'address2_addresstypecode',
},
{
name: 'accountcategorycode',
},
{
name: 'emailaddress2',
},
{
name: 'address2_shippingmethodcode',
},
{
name: 'importsequencenumber',
},
{
name: 'primarysatoriid',
},
{
name: 'customersizecode',
},
{
name: 'opendeals',
},
{
name: 'donotsendmm',
},
{
name: 'processid',
},
{
name: 'paymenttermscode',
},
{
name: 'sic',
},
{
name: 'address2_primarycontactname',
},
{
name: 'address1_utcoffset',
},
{
name: 'owneridyominame',
},
{
name: 'lastusedincampaign',
},
{
name: 'aging60_base',
},
{
name: 'donotfax',
},
{
name: 'updateman',
},
{
name: 'openrevenue_state',
},
{
name: 'opendeals_state',
},
{
name: 'versionnumber',
},
{
name: 'address1_longitude',
},
{
name: 'aging90',
},
{
name: 'entityimage_url',
},
{
name: 'creditlimit',
},
{
name: 'preferredsystemuserid',
},
{
name: 'revenue',
},
{
name: 'address1_county',
},
{
name: 'address1_line3',
},
{
name: 'stageid',
},
{
name: 'donotemail',
},
{
name: 'address2_postalcode',
},
{
name: 'preferredappointmenttimecode',
},
{
name: 'address2_upszone',
},
{
name: 'createdate',
},
{
name: 'address2_county',
},
{
name: 'owneridtype',
},
{
name: 'address2_composite',
},
{
name: 'address2_name',
},
{
name: 'address2_line1',
},
{
name: 'marketcap_base',
},
{
name: 'emailaddress3',
},
{
name: 'telephone2',
},
{
name: 'createman',
},
{
name: 'address1_postofficebox',
},
{
name: 'creditonhold',
},
{
name: 'address1_addressid',
},
{
name: 'address2_postofficebox',
},
{
name: 'slaname',
},
{
name: 'originatingleadid',
},
{
name: 'transactioncurrencyid',
},
{
name: 'defaultpricelevelid',
},
{
name: 'parentaccountid',
},
{
name: 'preferredequipmentid',
},
{
name: 'territoryid',
},
{
name: 'primarycontactid',
},
{
name: 'slaid',
},
{
name: 'preferredserviceid',
},
{
name: 'originatingleadname',
},
{
name: 'defaultpricelevelname',
},
{
name: 'territoryname',
},
{
name: 'parentaccountname',
},
{
name: 'preferredequipmentname',
},
{
name: 'preferredservicename',
},
{
name: 'primarycontactname',
},
{
name: 'transactioncurrencyname',
},
]
}
}
import { Http } from '@/utils';
import ControlService from '@/widgets/control-service';
/**
* View_AccountInfoAll 部件服务对象
*
* @export
* @class View_AccountInfoAllService
*/
export default class View_AccountInfoAllService extends ControlService {
}
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import AccountView_AccountInfoAllBase from './view-account-info-all-portlet-base.vue';
@Component({
components: {
}
})
export default class AccountView_AccountInfoAll extends AccountView_AccountInfoAllBase {
}
</script>
<template>
<i-form :model="this.data" class='app-search-form' ref='searchform' style="">
<input style="display:none;"/>
<div class="search-button">
<i-button size="small" type="primary" ghost @click="onSearch">{{$t('app.searchButton.search')}}</i-button>
<i-button size="small" type="default" ghost @click="onReset">{{this.$t('app.searchButton.reset')}}</i-button>
</div>
<div class="form-content">
</div>
</i-form>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import IBizServiceService from '@/service/ibiz-service/ibiz-service-service';
import DefaultService from './default-searchform-service';
import { FormButtonModel, FormPageModel, FormItemModel, FormDRUIPartModel, FormPartModel, FormGroupPanelModel, FormIFrameModel, FormRowItemModel, FormTabPageModel, FormTabPanelModel, FormUserControlModel } from '@/model/form-detail';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
@Component({
components: {
}
})
export default class DefaultBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof Default
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof Default
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof Default
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof Default
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof Default
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof Default
*/
public getControlType(): string {
return 'SEARCHFORM'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof Default
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {DefaultService}
* @memberof Default
*/
public service: DefaultService = new DefaultService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {IBizServiceService}
* @memberof Default
*/
public appEntityService: IBizServiceService = new IBizServiceService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof Default
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof Default
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof DefaultBase
*/
public getDatas(): any[] {
return [this.data];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof DefaultBase
*/
public getData(): any {
return this.data;
}
/**
* 显示处理提示
*
* @type {boolean}
* @memberof DefaultBase
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof DefaultBase
*/
@Prop() public loaddraftAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof DefaultBase
*/
@Prop() public loadAction!: string;
/**
* 视图标识
*
* @type {string}
* @memberof DefaultBase
*/
@Prop() public viewtag!: string;
/**
* 表单状态
*
* @type {Subject<any>}
* @memberof DefaultBase
*/
public formState: Subject<any> = new Subject();
/**
* 忽略表单项值变化
*
* @type {boolean}
* @memberof DefaultBase
*/
public ignorefieldvaluechange: boolean = false;
/**
* 数据变化
*
* @public
* @type {Subject<any>}
* @memberof DefaultBase
*/
public dataChang: Subject<any> = new Subject();
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof DefaultBase
*/
public dataChangEvent: Subscription | undefined;
/**
* 原始数据
*
* @public
* @type {*}
* @memberof DefaultBase
*/
public oldData: any = {};
/**
* 表单数据对象
*
* @type {*}
* @memberof DefaultBase
*/
public data: any = {
};
/**
* 属性值规则
*
* @type {*}
* @memberof DefaultBase
*/
public rules: any = {
}
/**
* 详情模型集合
*
* @type {*}
* @memberof DefaultBase
*/
public detailsModel: any = {
formpage1: new FormPageModel({ caption: '常规条件', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this })
,
};
/**
* 重置表单项值
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof DefaultBase
*/
public resetFormData({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
}
/**
* 表单逻辑
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof DefaultBase
*/
public formLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
}
/**
* 表单值变化
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @returns {void}
* @memberof DefaultBase
*/
public formDataChange({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
if (this.ignorefieldvaluechange) {
return;
}
this.resetFormData({ name: name, newVal: newVal, oldVal: oldVal });
this.formLogic({ name: name, newVal: newVal, oldVal: oldVal });
this.dataChang.next(JSON.stringify(this.data));
}
/**
* 表单加载完成
*
* @public
* @param {*} [data={}]
* @memberof DefaultBase
*/
public onFormLoad(data: any = {}): void {
this.setFormEnableCond(data);
this.fillForm(data);
this.formLogic({ name: '', newVal: null, oldVal: null });
}
/**
* 值填充
*
* @param {*} [_datas={}]
* @memberof DefaultBase
*/
public fillForm(_datas: any = {}): void {
this.ignorefieldvaluechange = true;
Object.keys(_datas).forEach((name: string) => {
if (this.data.hasOwnProperty(name)) {
this.data[name] = _datas[name];
}
});
this.$nextTick(function () {
this.ignorefieldvaluechange = false;
})
}
/**
* 设置表单项是否启用
*
* @public
* @param {*} data
* @memberof DefaultBase
*/
public setFormEnableCond(data: any): void {
Object.values(this.detailsModel).forEach((detail: any) => {
if (!Object.is(detail.detailType, 'FORMITEM')) {
return;
}
const formItem: FormItemModel = detail;
formItem.setEnableCond(data.srfuf);
});
}
/**
* 重置草稿表单状态
*
* @public
* @memberof DefaultBase
*/
public resetDraftFormStates(): void {
const form: any = this.$refs.form;
if (form) {
form.resetFields();
}
}
/**
* 重置校验结果
*
* @memberof DefaultBase
*/
public resetValidates(): void {
Object.values(this.detailsModel).forEach((detail: any) => {
if (!Object.is(detail.detailType, 'FORMITEM')) {
return;
}
const formItem: FormItemModel = detail;
formItem.setError('');
});
}
/**
* 填充校验结果 (后台)
*
* @param {any[]} fieldErrors
* @memberof DefaultBase
*/
public fillValidates(fieldErrors: any[]): void {
fieldErrors.forEach((error: any) => {
const formItem: FormItemModel = this.detailsModel[error.field];
if (!formItem) {
return;
}
this.$nextTick(() => {
formItem.setError(error.message);
});
});
}
/**
* 表单校验状态
*
* @returns {boolean}
* @memberof DefaultBase
*/
public formValidateStatus(): boolean {
const form: any = this.$refs.searchform;
let validatestate: boolean = true;
form.validate((valid: boolean) => {
validatestate = valid ? true : false;
});
return validatestate
}
/**
* 获取全部值
*
* @returns {*}
* @memberof DefaultBase
*/
public getValues(): any {
return this.data;
}
/**
* 表单项值变更
*
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof DefaultBase
*/
public onFormItemValueChange($event: { name: string, value: any }): void {
if (!$event) {
return;
}
if (!$event.name || Object.is($event.name, '') || !this.data.hasOwnProperty($event.name)) {
return;
}
this.data[$event.name] = $event.value;
}
/**
* 设置数据项值
*
* @param {string} name
* @param {*} value
* @returns {void}
* @memberof DefaultBase
*/
public setDataItemValue(name: string, value: any): void {
if (!name || Object.is(name, '') || !this.data.hasOwnProperty(name)) {
return;
}
if (Object.is(this.data[name], value)) {
return;
}
this.data[name] = value;
}
/**
* 分组界面行为事件
*
* @param {*} $event
* @memberof DefaultBase
*/
public groupUIActionClick($event: any): void {
if (!$event) {
return;
}
const item:any = $event.item;
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof DefaultBase
*/
public created(): void {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof DefaultBase
*/
public afterCreated(){
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
if (Object.is('autoload', action)) {
this.autoLoad(data);
}
if (Object.is('load', action)) {
this.load(data);
}
if (Object.is('loaddraft', action)) {
this.loadDraft(data);
}
});
}
}
/**
* vue 生命周期
*
* @memberof DefaultBase
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof DefaultBase
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if (this.dataChangEvent) {
this.dataChangEvent.unsubscribe();
}
}
/**
* 自动加载
*
* @param {*} [arg={}]
* @returns {void}
* @memberof DefaultBase
*/
public autoLoad(arg: any = {}): void {
if (arg.srfkey && !Object.is(arg.srfkey, '')) {
Object.assign(arg, { srfkey: arg.srfkey });
this.load(arg);
return;
}
if (arg.srfkeys && !Object.is(arg.srfkeys, '')) {
Object.assign(arg, { srfkey: arg.srfkeys });
this.load(arg);
return;
}
this.loadDraft(arg);
}
/**
* 加载
*
* @public
* @param {*} [opt={}]
* @memberof DefaultBase
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: '错误', desc: 'IBizServiceGridView视图搜索表单loadAction参数未配置' });
return;
}
const arg: any = { ...opt };
Object.assign(arg,{viewparams:this.viewparams});
const get: Promise<any> = this.service.get(this.loadAction,JSON.parse(JSON.stringify(this.context)), arg, this.showBusyIndicator);
get.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
this.onFormLoad(data);
this.$emit('load', data);
this.$nextTick(() => {
this.formState.next({ type: 'load', data: data });
});
}
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
const { data: _data } = response;
this.$Notice.error({ title: _data.title, desc: _data.message });
});
}
/**
* 加载草稿
*
* @param {*} [opt={}]
* @memberof DefaultBase
*/
public loadDraft(opt: any = {},mode?:string): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: '错误', desc: 'IBizServiceGridView视图搜索表单loaddraftAction参数未配置' });
return;
}
const arg: any = { ...opt } ;
Object.assign(arg,{viewparams:this.viewparams});
let post: Promise<any> = this.service.loadDraft(this.loaddraftAction,JSON.parse(JSON.stringify(this.context)), arg, this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.errorMessage) {
this.$Notice.error({ title: '错误', desc: response.errorMessage });
}
return;
}
const data = response.data;
this.resetDraftFormStates();
this.onFormLoad(data);
setTimeout(() => {
const form: any = this.$refs.form;
if (form) {
form.fields.forEach((field: any) => {
field.validateMessage = "";
field.validateState = "";
field.validateStatus = false;
});
}
});
if(Object.is(mode,'RESET')){
if (!this.formValidateStatus()) {
return;
}
}
this.$emit('load', data);
this.$nextTick(() => {
this.formState.next({ type: 'load', data: data });
});
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
const { data: _data } = response;
this.$Notice.error({ title: _data.title, desc: _data.message });
});
}
/**
* 表单项更新
*
* @param {string} mode 界面行为名称
* @param {*} [data={}] 请求数据
* @param {string[]} updateDetails 更新项
* @param {boolean} [showloading] 是否显示加载状态
* @returns {void}
* @memberof DefaultBase
*/
public updateFormItems(mode: string, data: any = {}, updateDetails: string[], showloading?: boolean): void {
}
/**
* 回车事件
*
* @param {*} $event
* @memberof DefaultBase
*/
public onEnter($event: any): void {
if (!this.formValidateStatus()) {
return;
}
this.$emit('search', this.data);
}
/**
* 搜索
*
* @memberof DefaultBase
*/
public onSearch() {
if (!this.formValidateStatus()) {
return;
}
this.$emit('search', this.data);
}
/**
* 重置
*
* @memberof DefaultBase
*/
public onReset() {
this.loadDraft({},'RESET');
}
}
</script>
<style lang='less'>
@import './default-searchform.less';
</style>
\ No newline at end of file
/**
* Default 部件模型
*
* @export
* @class DefaultModel
*/
export default class DefaultModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof DefaultModel
*/
public getDataItems(): any[] {
return [
{
name: 'srfwfmemo',
prop: 'srfwfmemo',
dataType: 'TEXT',
},
// 前端新增修改标识,新增为"0",修改为"1"或未设值
{
name: 'srffrontuf',
prop: 'srffrontuf',
dataType: 'TEXT',
},
]
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import IBizServiceService from '@/service/ibiz-service/ibiz-service-service';
import DefaultModel from './default-searchform-model';
/**
* Default 部件服务对象
*
* @export
* @class DefaultService
*/
export default class DefaultService extends ControlService {
/**
* 服务服务对象
*
* @type {IBizServiceService}
* @memberof DefaultService
*/
public appEntityService: IBizServiceService = new IBizServiceService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof DefaultService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of DefaultService.
*
* @param {*} [opts={}]
* @memberof DefaultService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new DefaultModel();
}
/**
* 处理数据
*
* @private
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof DefaultService
*/
private doItems(promise: Promise<any>, deKeyField: string, deName: string): Promise<any> {
return new Promise((resolve, reject) => {
promise.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
data.forEach((item:any,index:number) =>{
item[deName] = item[deKeyField];
data[index] = item;
});
resolve(data);
} else {
reject([])
}
}).catch((response: any) => {
reject([])
});
});
}
/**
* 获取跨实体数据集合
*
* @param {string} serviceName 服务名称
* @param {string} interfaceName 接口名称
* @param {*} data
* @param {boolean} [isloading]
* @returns {Promise<any[]>}
* @memberof DefaultService
*/
@Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
return Promise.reject([])
}
/**
* 启动工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public wfstart(action: string,context: any = {},data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading,localdata);
} else {
result = this.appEntityService.WFStart(context,data, isloading,localdata);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 提交工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading,localdata);
} else {
result = this.appEntityService.WFSubmit(context,data, isloading,localdata);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 添加数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Create(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 删除数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public delete(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Remove(Context,Data, isloading);
}
result.then((response) => {
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 修改数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Update(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public get(action: string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Get(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 加载草稿
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public loadDraft(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
//仿真主键数据
const PrimaryKey = Util.createUUID();
Data.serviceid = PrimaryKey;
Data.ibizservice = PrimaryKey;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.GetDraft(Context,Data, isloading);
}
result.then((response) => {
response.data.serviceid = PrimaryKey;
this.handleResponse(action, response, true);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 前台逻辑
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public frontLogic(action:string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any)=>{
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
return Promise.reject({ status: 500, data: { title: '失败', message: '系统异常' } });
}
result.then((response) => {
this.handleResponse(action, response,true);
resolve(response);
}).catch(response => {
reject(response);
});
})
}
/**
* 处理请求数据
*
* @param action 行为
* @param data 数据
* @memberof DefaultService
*/
public handleRequestData(action: string,context:any, data: any = {}){
let mode: any = this.getMode();
if (!mode && mode.getDataItems instanceof Function) {
return data;
}
let formItemItems: any[] = mode.getDataItems();
let requestData:any = {};
formItemItems.forEach((item:any) =>{
if(item && item.dataType && Object.is(item.dataType,'FONTKEY')){
if(item && item.prop){
requestData[item.prop] = context[item.name];
}
}else{
if(item && item.prop){
requestData[item.prop] = data[item.name];
}
}
});
if(data && data.viewparams){
Object.assign(requestData,data.viewparams);
}
let tempContext:any = JSON.parse(JSON.stringify(context));
if(tempContext && tempContext.srfsessionid){
tempContext.srfsessionkey = tempContext.srfsessionid;
delete tempContext.srfsessionid;
}
return {context:tempContext,data:requestData};
}
}
\ No newline at end of file
.ivu-tabs-no-animation>.ivu-tabs-content{
padding: 0 16px;
}
.ivu-card-head{
padding: 14px 0;
}
.app-search-form {
padding: 8px 14px 0;
.ivu-form-item{
margin-bottom: 8px;
}
.search_reset {
margin-right: 12px;
margin-bottom: 8px;
}
.search-button{
text-align: right;
}
}
.app-search-form-flex {
height: 100%;
> .ivu-row {
height: 100%;
> .ivu-tabs {
height: 100%;
display: flex;
flex-direction: column;
> .ivu-tabs-content {
flex-grow: 1;
overflow: auto;
> .ivu-tabs-tabpane {
height: 100%;
}
}
}
}
}
.app-tabpanel-flex {
height: 100%;
> .ivu-tabs-content {
height: calc(100% - 52px);
> .ivu-tabs-tabpane {
height: 100%;
}
}
}
// this is less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import DefaultBase from './default-searchform-base.vue';
@Component({
components: {
}
})
export default class Default extends DefaultBase {
}
</script>
\ No newline at end of file
<template>
<i-form :model="this.data" class='app-form' ref='form' id='ibizservice_main' style="">
<input style="display:none;" />
<row >
<tabs :animated="false" size="small" name='main' :value="detailsModel.form.activiedPage"
@on-click="detailsModel.form.clickPage($event)">
<tab-pane v-show="detailsModel.formpage1.visible" name='formpage1' :index="0" tab='main' class=''
:label="(h) =>{
return h('span',{
class:'caption'
},[
$t('entities.ibizservice.main_form.details.formpage1')
])
}">
<i-col v-show="detailsModel.group1.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.ibizservice.main_form.details.group1')" :isShowCaption="true" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.servicename.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='servicename' :itemRules="this.rules.servicename" class='' :caption="$t('entities.ibizservice.main_form.details.servicename')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.servicename.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.servicename" @enter="onEnter($event)" unit="" :disabled="detailsModel.servicename.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
</row>
</app-form-group>
</i-col>
</tab-pane>
<tab-pane v-show="detailsModel.formpage2.visible" name='formpage2' :index="1" tab='main' class=''
:label="(h) =>{
return h('span',{
class:'caption'
},[
$t('entities.ibizservice.main_form.details.formpage2')
])
}">
<i-col v-show="detailsModel.group2.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.group2.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.ibizservice.main_form.details.group2')" :isShowCaption="true" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.createman.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='createman' :itemRules="this.rules.createman" class='' :caption="$t('entities.ibizservice.main_form.details.createman')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.createman.error" :isEmptyCaption="false" labelPos="LEFT">
<app-span name='createman' :value="data.createman" tag='SysOperator' codelistType='DYNAMIC' :data="data" :context="context" :viewparams="viewparams" :localContext ='{ }' :localParam ='{ }' style=""></app-span>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.createdate.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='createdate' :itemRules="this.rules.createdate" class='' :caption="$t('entities.ibizservice.main_form.details.createdate')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.createdate.error" :isEmptyCaption="false" labelPos="LEFT">
<app-span name='createdate' :value="data.createdate" :data="data" :context="context" :viewparams="viewparams" :localContext ='{ }' :localParam ='{ }' style=""></app-span>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.updateman.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='updateman' :itemRules="this.rules.updateman" class='' :caption="$t('entities.ibizservice.main_form.details.updateman')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.updateman.error" :isEmptyCaption="false" labelPos="LEFT">
<app-span name='updateman' :value="data.updateman" tag='SysOperator' codelistType='DYNAMIC' :data="data" :context="context" :viewparams="viewparams" :localContext ='{ }' :localParam ='{ }' style=""></app-span>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.updatedate.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='updatedate' :itemRules="this.rules.updatedate" class='' :caption="$t('entities.ibizservice.main_form.details.updatedate')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.updatedate.error" :isEmptyCaption="false" labelPos="LEFT">
<app-span name='updatedate' :value="data.updatedate" :data="data" :context="context" :viewparams="viewparams" :localContext ='{ }' :localParam ='{ }' style=""></app-span>
</app-form-item>
</i-col>
</row>
</app-form-group>
</i-col>
</tab-pane>
</tabs>
</row>
</i-form>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import IBizServiceService from '@/service/ibiz-service/ibiz-service-service';
import MainService from './main-form-service';
import { FormButtonModel, FormPageModel, FormItemModel, FormDRUIPartModel, FormPartModel, FormGroupPanelModel, FormIFrameModel, FormRowItemModel, FormTabPageModel, FormTabPanelModel, FormUserControlModel } from '@/model/form-detail';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
@Component({
components: {
}
})
export default class MainBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof Main
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof Main
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof Main
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof Main
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof Main
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof Main
*/
public getControlType(): string {
return 'FORM'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof Main
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {MainService}
* @memberof Main
*/
public service: MainService = new MainService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {IBizServiceService}
* @memberof Main
*/
public appEntityService: IBizServiceService = new IBizServiceService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof Main
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof Main
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 工作流审批意见控件绑定值
*
* @memberof Main
*/
public srfwfmemo:string = "";
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof Main
*/
public getDatas(): any[] {
return [this.data];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof Main
*/
public getData(): any {
return this.data;
}
/**
* 是否默认保存
*
* @type {boolean}
* @memberof Main
*/
@Prop({ default: false }) public autosave?: boolean;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof Main
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--submit
*
* @type {string}
* @memberof Main
*/
@Prop() public WFSubmitAction!: string;
/**
* 部件行为--start
*
* @type {string}
* @memberof Main
*/
@Prop() public WFStartAction!: string;
/**
* 部件行为--update
*
* @type {string}
* @memberof Main
*/
@Prop() public updateAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof Main
*/
@Prop() public removeAction!: string;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof Main
*/
@Prop() public loaddraftAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof Main
*/
@Prop() public loadAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof Main
*/
@Prop() public createAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof Main
*/
@Prop() public searchAction!: string;
/**
* 视图标识
*
* @type {string}
* @memberof Main
*/
@Prop() public viewtag!: string;
/**
* 表单状态
*
* @type {Subject<any>}
* @memberof Main
*/
public formState: Subject<any> = new Subject();
/**
* 忽略表单项值变化
*
* @type {boolean}
* @memberof Main
*/
public ignorefieldvaluechange: boolean = false;
/**
* 数据变化
*
* @public
* @type {Subject<any>}
* @memberof Main
*/
public dataChang: Subject<any> = new Subject();
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof Main
*/
public dataChangEvent: Subscription | undefined;
/**
* 原始数据
*
* @public
* @type {*}
* @memberof Main
*/
public oldData: any = {};
/**
* 表单数据对象
*
* @type {*}
* @memberof Main
*/
public data: any = {
srfupdatedate: null,
srforikey: null,
srfkey: null,
srfmajortext: null,
srftempmode: null,
srfuf: null,
srfdeid: null,
srfsourcekey: null,
servicename: null,
createman: null,
createdate: null,
updateman: null,
updatedate: null,
serviceid: null,
ibizservice:null,
};
/**
* 当前执行的行为逻辑
*
* @type {string}
* @memberof Main
*/
public currentAction: string = "";
/**
* 关系界面计数器
*
* @type {number}
* @memberof Main
*/
public drcounter: number = 0;
/**
* 需要等待关系界面保存时,第一次调用save参数的备份
*
* @type {number}
* @memberof Main
*/
public drsaveopt: any = {};
/**
* 表单保存回调存储对象
*
* @type {any}
* @memberof Main
*/
public saveState:any ;
/**
* 属性值规则
*
* @type {*}
* @memberof Main
*/
public rules: any = {
srfupdatedate: [
{ type: 'string', message: '更新时间 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '更新时间 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '更新时间 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '更新时间 值不能为空', trigger: 'blur' },
],
srforikey: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfkey: [
{ type: 'string', message: '服务 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '服务 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '服务 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '服务 值不能为空', trigger: 'blur' },
],
srfmajortext: [
{ type: 'string', message: 'service名称 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: 'service名称 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: 'service名称 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: 'service名称 值不能为空', trigger: 'blur' },
],
srftempmode: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfuf: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfdeid: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfsourcekey: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
servicename: [
{ type: 'string', message: 'service名称 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: 'service名称 值必须为字符串类型', trigger: 'blur' },
{ required: true, type: 'string', message: 'service名称 值不能为空', trigger: 'change' },
{ required: true, type: 'string', message: 'service名称 值不能为空', trigger: 'blur' },
],
createman: [
{ type: 'string', message: '建立人 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '建立人 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '建立人 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '建立人 值不能为空', trigger: 'blur' },
],
createdate: [
{ type: 'string', message: '建立时间 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '建立时间 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '建立时间 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '建立时间 值不能为空', trigger: 'blur' },
],
updateman: [
{ type: 'string', message: '更新人 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '更新人 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '更新人 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '更新人 值不能为空', trigger: 'blur' },
],
updatedate: [
{ type: 'string', message: '更新时间 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '更新时间 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '更新时间 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '更新时间 值不能为空', trigger: 'blur' },
],
serviceid: [
{ type: 'string', message: '服务 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '服务 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '服务 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '服务 值不能为空', trigger: 'blur' },
],
}
/**
* 详情模型集合
*
* @type {*}
* @memberof Main
*/
public detailsModel: any = {
group1: new FormGroupPanelModel({ caption: 'service基本信息', detailType: 'GROUPPANEL', name: 'group1', visible: true, isShowCaption: true, form: this, uiActionGroup: { caption: '', langbase: 'entities.ibizservice.main_form', extractMode: 'ITEM', details: [] } })
,
formpage1: new FormPageModel({ caption: '基本信息', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this })
,
group2: new FormGroupPanelModel({ caption: '操作信息', detailType: 'GROUPPANEL', name: 'group2', visible: true, isShowCaption: true, form: this, uiActionGroup: { caption: '', langbase: 'entities.ibizservice.main_form', extractMode: 'ITEM', details: [] } })
,
formpage2: new FormPageModel({ caption: '其它', detailType: 'FORMPAGE', name: 'formpage2', visible: true, isShowCaption: true, form: this })
,
srfupdatedate: new FormItemModel({ caption: '更新时间', detailType: 'FORMITEM', name: 'srfupdatedate', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 0 })
,
srforikey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srforikey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfkey: new FormItemModel({ caption: '服务', detailType: 'FORMITEM', name: 'srfkey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 1 })
,
srfmajortext: new FormItemModel({ caption: 'service名称', detailType: 'FORMITEM', name: 'srfmajortext', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srftempmode: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srftempmode', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfuf: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfuf', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfdeid: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfdeid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfsourcekey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfsourcekey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
servicename: new FormItemModel({ caption: 'service名称', detailType: 'FORMITEM', name: 'servicename', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
createman: new FormItemModel({ caption: '建立人', detailType: 'FORMITEM', name: 'createman', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 0 })
,
createdate: new FormItemModel({ caption: '建立时间', detailType: 'FORMITEM', name: 'createdate', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 0 })
,
updateman: new FormItemModel({ caption: '更新人', detailType: 'FORMITEM', name: 'updateman', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 0 })
,
updatedate: new FormItemModel({ caption: '更新时间', detailType: 'FORMITEM', name: 'updatedate', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 0 })
,
serviceid: new FormItemModel({ caption: '服务', detailType: 'FORMITEM', name: 'serviceid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 1 })
,
form: new FormTabPanelModel({ caption: 'form', detailType: 'TABPANEL', name: 'form', visible: true, isShowCaption: true, form: this, tabPages: [{ name: 'formpage1', index: 0, visible: true }, { name: 'formpage2', index: 1, visible: true }] }),
};
/**
* 监控表单属性 srfupdatedate 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfupdatedate')
onSrfupdatedateChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfupdatedate', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srforikey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srforikey')
onSrforikeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srforikey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfkey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfkey')
onSrfkeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfkey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfmajortext 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfmajortext')
onSrfmajortextChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfmajortext', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srftempmode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srftempmode')
onSrftempmodeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srftempmode', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfuf 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfuf')
onSrfufChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfuf', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfdeid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfdeid')
onSrfdeidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfdeid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfsourcekey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfsourcekey')
onSrfsourcekeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfsourcekey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 servicename 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.servicename')
onServicenameChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'servicename', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 createman 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.createman')
onCreatemanChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'createman', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 createdate 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.createdate')
onCreatedateChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'createdate', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 updateman 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.updateman')
onUpdatemanChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'updateman', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 updatedate 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.updatedate')
onUpdatedateChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'updatedate', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 serviceid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.serviceid')
onServiceidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'serviceid', newVal: newVal, oldVal: oldVal });
}
/**
* 重置表单项值
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof Main
*/
public resetFormData({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
}
/**
* 置空对象
*
* @param {any[]} args
* @memberof EditForm
*/
public ResetData(_datas:any){
if(Object.keys(_datas).length >0){
Object.keys(_datas).forEach((name: string) => {
if (this.data.hasOwnProperty(name)) {
this.data[name] = null;
}
});
}
}
/**
* 表单逻辑
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof Main
*/
public formLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
}
/**
* 表单值变化
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @returns {void}
* @memberof Main
*/
public formDataChange({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
if (this.ignorefieldvaluechange) {
return;
}
this.resetFormData({ name: name, newVal: newVal, oldVal: oldVal });
this.formLogic({ name: name, newVal: newVal, oldVal: oldVal });
this.dataChang.next(JSON.stringify(this.data));
}
/**
* 表单加载完成
*
* @public
* @param {*} [data={}]
* @param {string} [action]
* @memberof Main
*/
public onFormLoad(data: any = {},action:string): void {
if(Object.is(action,"save") || Object.is(action,"autoSave") || Object.is(action,"submit"))
// 更新context的实体主键
if(data.ibizservice){
Object.assign(this.context,{ibizservice:data.ibizservice})
}
this.setFormEnableCond(data);
this.fillForm(data,action);
this.oldData = {};
Object.assign(this.oldData, JSON.parse(JSON.stringify(this.data)));
this.$store.commit('viewaction/setViewDataChange', { viewtag: this.viewtag, viewdatachange: false });
this.formLogic({ name: '', newVal: null, oldVal: null });
}
/**
* 值填充
*
* @param {*} [_datas={}]
* @param {string} [action]
* @memberof Main
*/
public fillForm(_datas: any = {},action:string): void {
this.ignorefieldvaluechange = true;
Object.keys(_datas).forEach((name: string) => {
if (this.data.hasOwnProperty(name)) {
this.data[name] = _datas[name];
}
});
if(Object.is(action,'loadDraft')){
this.createDefault();
}
if(Object.is(action,'load')){
this.updateDefault();
}
this.$nextTick(function () {
this.ignorefieldvaluechange = false;
})
}
/**
* 设置表单项是否启用
*
* @public
* @param {*} data
* @memberof Main
*/
public setFormEnableCond(data: any): void {
Object.values(this.detailsModel).forEach((detail: any) => {
if (!Object.is(detail.detailType, 'FORMITEM')) {
return;
}
const formItem: FormItemModel = detail;
formItem.setEnableCond(data.srfuf);
});
}
/**
* 重置草稿表单状态
*
* @public
* @memberof Main
*/
public resetDraftFormStates(): void {
const form: any = this.$refs.form;
if (form) {
form.resetFields();
}
}
/**
* 重置校验结果
*
* @memberof Main
*/
public resetValidates(): void {
Object.values(this.detailsModel).forEach((detail: any) => {
if (!Object.is(detail.detailType, 'FORMITEM')) {
return;
}
const formItem: FormItemModel = detail;
formItem.setError('');
});
}
/**
* 填充校验结果 (后台)
*
* @param {any[]} fieldErrors
* @memberof Main
*/
public fillValidates(fieldErrors: any[]): void {
fieldErrors.forEach((error: any) => {
const formItem: FormItemModel = this.detailsModel[error.field];
if (!formItem) {
return;
}
this.$nextTick(() => {
formItem.setError(error.message);
});
});
}
/**
* 表单校验状态
*
* @returns {boolean}
* @memberof Main
*/
public formValidateStatus(): boolean {
const form: any = this.$refs.form;
let validatestate: boolean = true;
form.validate((valid: boolean) => {
validatestate = valid ? true : false;
});
return validatestate
}
/**
* 获取全部值
*
* @returns {*}
* @memberof Main
*/
public getValues(): any {
return this.data;
}
/**
* 表单项值变更
*
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof Main
*/
public onFormItemValueChange($event: { name: string, value: any }): void {
if (!$event) {
return;
}
if (!$event.name || Object.is($event.name, '') || !this.data.hasOwnProperty($event.name)) {
return;
}
this.data[$event.name] = $event.value;
}
/**
* 设置数据项值
*
* @param {string} name
* @param {*} value
* @returns {void}
* @memberof Main
*/
public setDataItemValue(name: string, value: any): void {
if (!name || Object.is(name, '') || !this.data.hasOwnProperty(name)) {
return;
}
if (Object.is(this.data[name], value)) {
return;
}
this.data[name] = value;
}
/**
* 分组界面行为事件
*
* @param {*} $event
* @memberof Main
*/
public groupUIActionClick($event: any): void {
if (!$event) {
return;
}
const item:any = $event.item;
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof Main
*/
public created(): void {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof Main
*/
public afterCreated(){
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
if (Object.is('autoload', action)) {
this.autoLoad(data);
}
if (Object.is('load', action)) {
this.load(data);
}
if (Object.is('loaddraft', action)) {
if(this.context.srfsourcekey){
this.copy(this.context.srfsourcekey);
}else{
this.loadDraft(data);
}
}
if (Object.is('save', action)) {
this.save(data,data.showResultInfo);
}
if (Object.is('remove', action)) {
this.remove(data);
}
if (Object.is('saveandexit', action)) {
this.saveAndExit(data);
}
if (Object.is('saveandnew', action)) {
this.saveAndNew(data);
}
if (Object.is('removeandexit', action)) {
this.removeAndExit(data);
}
if (Object.is('refresh', action)) {
this.refresh(data);
}
});
}
this.dataChang
.pipe(
debounceTime(300),
distinctUntilChanged()
).subscribe((data: any) => {
if (this.autosave) {
this.autoSave();
}
const state = !Object.is(JSON.stringify(this.oldData), JSON.stringify(this.data)) ? true : false;
this.$store.commit('viewaction/setViewDataChange', { viewtag: this.viewtag, viewdatachange: state });
});
}
/**
* vue 生命周期
*
* @memberof Main
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof Main
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if (this.dataChangEvent) {
this.dataChangEvent.unsubscribe();
}
}
/**
* 拷贝内容
*
* @param {*} [arg={}]
* @memberof @memberof Main
*/
public copy(srfkey: string): void {
let copyData = this.$store.getters.getCopyData(srfkey);
copyData.srfkey = Util.createUUID();
copyData.ibizservice = copyData.srfkey;
copyData.serviceid = copyData.srfkey;
Object.assign(this.context,{ibizservice:copyData.ibizservice})
this.data = copyData;
this.$nextTick(() => {
this.formState.next({ type: 'load', data: copyData });
this.data.srfuf = '0';
this.setFormEnableCond(this.data);
});
}
/**
*打印
*@memberof @memberof Main
*/
public print(){
let _this:any = this;
_this.$print({id:'ibizservice_main',popTitle:'主编辑表单'});
}
/**
* 部件刷新
*
* @param {any[]} args
* @memberof Main
*/
public refresh(args: any[]): void {
let arg: any = {};
Object.assign(arg,args[0]);
if (this.data.srfkey && !Object.is(this.data.srfkey, '')) {
Object.assign(arg, { srfkey: this.data.srfkey });
this.load(arg);
return;
}
if (this.data.srfkeys && !Object.is(this.data.srfkeys, '')) {
Object.assign(arg, { srfkey: this.data.srfkeys });
this.load(arg);
return;
}
}
/**
* 自动加载
*
* @param {*} [arg={}]
* @returns {void}
* @memberof Main
*/
public autoLoad(arg: any = {}): void {
if (arg.srfkey && !Object.is(arg.srfkey, '')) {
Object.assign(arg, { srfkey: arg.srfkey });
this.load(arg);
return;
}
if (arg.srfkeys && !Object.is(arg.srfkeys, '')) {
Object.assign(arg, { srfkey: arg.srfkeys });
this.load(arg);
return;
}
this.loadDraft(arg);
}
/**
* 加载
*
* @public
* @param {*} [opt={}]
* @memberof Main
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: '错误', desc: 'IBizServiceEditView视图表单loadAction参数未配置' });
return;
}
const arg: any = { ...opt };
let viewparamResult:any = Object.assign(arg,this.viewparams);
const get: Promise<any> = this.service.get(this.loadAction,JSON.parse(JSON.stringify(this.context)),{viewparams:viewparamResult}, this.showBusyIndicator);
get.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
this.onFormLoad(data,'load');
this.$emit('load', data);
this.$nextTick(() => {
this.formState.next({ type: 'load', data: data });
});
}
}).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;
}
});
}
/**
* 加载草稿
*
* @param {*} [opt={}]
* @memberof Main
*/
public loadDraft(opt: any = {}): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: '错误', desc: 'IBizServiceEditView视图表单loaddraftAction参数未配置' });
return;
}
const arg: any = { ...opt } ;
let viewparamResult:any = Object.assign(arg,this.viewparams);
let post: Promise<any> = this.service.loadDraft(this.loaddraftAction,JSON.parse(JSON.stringify(this.context)),{viewparams:viewparamResult}, this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
}
return;
}
const data = response.data;
if(data.ibizservice){
Object.assign(this.context,{ibizservice:data.ibizservice})
}
this.resetDraftFormStates();
this.onFormLoad(data,'loadDraft');
this.$emit('load', data);
this.$nextTick(() => {
this.formState.next({ type: 'load', data: data });
});
setTimeout(() => {
const form: any = this.$refs.form;
if (form) {
form.fields.forEach((field: any) => {
field.validateMessage = "";
field.validateState = "";
field.validateStatus = false;
});
}
});
}).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;
}
});
}
/**
* 自动保存
*
* @param {*} [opt={}]
* @memberof Main
*/
public autoSave(opt: any = {}): void {
if (!this.formValidateStatus()) {
return;
}
const arg: any = { ...opt };
const data = this.getValues();
Object.assign(arg, data);
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: '错误', desc: 'IBizServiceEditView视图表单'+actionName+'参数未配置' });
return;
}
Object.assign(arg,{viewparams:this.viewparams});
const post: Promise<any> = this.service.add(action, 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;
}
const data = response.data;
this.onFormLoad(data,'autoSave');
this.$emit('save', data);
this.$store.dispatch('viewaction/datasaved', { viewtag: this.viewtag });
this.$nextTick(() => {
this.formState.next({ type: 'save', data: data });
});
}).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;
}
});
}
/**
* 保存
*
* @param {*} [opt={}]
* @param {boolean} [showResultInfo]
* @param {boolean} [ifStateNext] formState是否下发通知
* @returns {Promise<any>}
* @memberof Main
*/
public async save(opt: any = {}, showResultInfo?: boolean, ifStateNext: boolean = true): Promise<any> {
return new Promise((resolve: any, reject: any) => {
showResultInfo = showResultInfo === undefined ? true : false;
if (!this.formValidateStatus()) {
this.$Notice.error({ title: '错误', desc: '值规则校验异常' });
return;
}
const arg: any = { ...opt };
const data = this.getValues();
Object.assign(arg, data);
Object.assign(arg, this.context);
if (ifStateNext) {
this.drcounter = 0;
if(this.drcounter !== 0){
this.drsaveopt = opt;
this.formState.next({ type: 'beforesave', data: arg });//先通知关系界面保存
this.saveState = resolve;
return;
}
}
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: '错误', desc: 'IBizServiceEditView视图表单'+actionName+'参数未配置' });
return;
}
Object.assign(arg,{viewparams:this.viewparams});
const post: Promise<any> = Object.is(data.srfuf, '1')?this.service.update(action, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(action,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;
}
const data = response.data;
this.onFormLoad(data,'save');
this.$emit('save', data);
this.$store.dispatch('viewaction/datasaved', { viewtag: this.viewtag });
this.$nextTick(() => {
this.formState.next({ type: 'save', data: data });
});
if (showResultInfo) {
this.$Notice.success({ title: '', desc: (data.srfmajortext ? data.srfmajortext : '') + '&nbsp;保存成功!' });
}
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
});
})
}
/**
* 删除
*
* @public
* @param {*} [opt={}]
* @memberof EditForm
*/
public remove(opt:Array<any> = [],showResultInfo?: boolean): Promise<any> {
return new Promise((resolve: any, reject: any) => {
if(!this.removeAction){
this.$Notice.error({ title: '错误', desc: 'IBizServiceEditView视图表单removeAction参数未配置' });
return;
}
const arg: any = opt[0];
const _this: any = this;
Object.assign(arg,{viewparams:this.viewparams});
this.service.delete(_this.removeAction, JSON.parse(JSON.stringify(this.context)),arg, showResultInfo).then((response: any) => {
if (response) {
const data = response.data;
this.$emit('remove',data);
this.formState.next({ type: 'remove', data: data });
this.data.ismodify = false;
this.$Notice.success({ title: '', desc: (data.srfmajortext ? data.srfmajortext : '') + '&nbsp;删除成功!' });
resolve(response);
}
}).catch((error: any) => {
const { data: _data } = error;
this.$Notice.error({ title: _data.title, desc: _data.message });
reject(error);
});
});
}
/**
* 工作流启动
*
* @param {*} [data={}]
* @param {*} [localdata={}]
* @returns {Promise<any>}
* @memberof Main
*/
public async wfstart(data: any,localdata?:any): Promise<any> {
return new Promise((resolve: any, reject: any) => {
const _this: any = this;
const post: Promise<any> = _this.save({},false);
post.then((response:any) =>{
const arg:any = response.data;
if(this.viewparams){
Object.assign(arg,{viewparams:this.viewparams});
}
const result: Promise<any> = this.service.wfstart(_this.WFStartAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
result.then((response: any) => {
if (!response || response.status !== 200) {
if(response.data){
this.$Notice.error({ title: '', desc: '工作流启动失败, ' + response.data.message });
}
return;
}
this.$Notice.info({ title: '', desc: '工作流启动成功' });
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
});
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
})
});
}
/**
* 工作流提交
*
* @param {*} [data={}]
* @param {*} [localdata={}]
* @returns {Promise<any>}
* @memberof Main
*/
public async wfsubmit(data: any,localdata?:any): Promise<any> {
return new Promise((resolve: any, reject: any) => {
const _this: any = this;
const arg: any = data[0];
Object.assign(arg,{viewparams:this.viewparams});
if (!arg.ibizservice || Object.is(arg.ibizservice, '')) {
return;
}
const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
post.then((response:any) =>{
const arg:any = response.data;
// 保存完成UI处理
this.onFormLoad(arg,'save');
this.$emit('save', arg);
this.$nextTick(() => {
this.formState.next({ type: 'save', data: arg });
});
// 准备提交参数
if(this.viewparams){
Object.assign(arg,{viewparams:this.viewparams});
}
// 强制补充srfwfmemo
if(this.srfwfmemo){
Object.assign(arg,{srfwfmemo:this.srfwfmemo});
}
const result: Promise<any> = this.service.wfsubmit(_this.WFSubmitAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
result.then((response: any) => {
if (!response || response.status !== 200) {
if(response.data){
this.$Notice.error({ title: '', desc: '工作流提交失败, ' + response.data.message });
}
return;
}
this.onFormLoad(arg,'submit');
this.$store.dispatch('viewaction/datasaved', { viewtag: this.viewtag });
this.$Notice.info({ title: '', desc: '工作流提交成功' });
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
});
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
})
})
}
/**
* 表单项更新
*
* @param {string} mode 界面行为名称
* @param {*} [data={}] 请求数据
* @param {string[]} updateDetails 更新项
* @param {boolean} [showloading] 是否显示加载状态
* @returns {void}
* @memberof Main
*/
public updateFormItems(mode: string, data: any = {}, updateDetails: string[], showloading?: boolean): void {
if (!mode || (mode && Object.is(mode, ''))) {
return;
}
const arg: any = { ...data };
Object.assign(arg,this.viewparams);
const post: Promise<any> = this.service.frontLogic(mode,JSON.parse(JSON.stringify(this.context)),arg, showloading);
post.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: '错误', desc: '表单项更新失败' });
return;
}
const data = response.data;
const _data: any = {};
updateDetails.forEach((name: string) => {
if (!data.hasOwnProperty(name)) {
return;
}
Object.assign(_data, { [name]: data[name] });
});
this.setFormEnableCond(_data);
this.fillForm(_data,'updateFormItem');
this.formLogic({ name: '', newVal: null, oldVal: null });
this.dataChang.next(JSON.stringify(this.data));
this.$nextTick(() => {
this.formState.next({ type: 'updateformitem', ufimode: arg.srfufimode, data: _data });
});
}).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;
}
});
}
/**
* 回车事件
*
* @param {*} $event
* @memberof Main
*/
public onEnter($event: any): void {
}
/**
* 保存并退出
*
* @param {any[]} args
* @memberof Main
*/
public saveAndExit(data:any[]):Promise<any>{
let _this = this;
return new Promise((resolve: any, reject: any) =>{
let arg: any = {};
if(data && data.length > 0){
Object.assign(arg,data[0]);
}
_this.currentAction = "saveAndExit";
_this.save([arg]).then((res) =>{
if(res){
_this.closeView(res.data);
}
resolve(res);
}).catch((error) =>{
reject(error);
})
})
}
/**
* 保存并新建
*
* @param {any[]} args
* @memberof Main
*/
public saveAndNew(data:any[]):Promise<any>{
let _this = this;
return new Promise((resolve: any, reject: any) =>{
let arg: any = {};
if(data && data.length > 0){
Object.assign(arg,data[0]);
}
_this.currentAction = "saveAndNew";
_this.save([arg]).then((res) =>{
_this.ResetData(res);
_this.loadDraft({});
}).catch((error) =>{
reject(error);
})
})
}
/**
* 删除并退出
*
* @param {any[]} args
* @memberof Main
*/
public removeAndExit(data:any[]):Promise<any>{
let _this = this;
return new Promise((resolve: any, reject: any) =>{
let arg: any = {};
if(data && data.length > 0){
Object.assign(arg,data[0]);
}
_this.remove([arg]).then((res) =>{
if(res){
_this.closeView(res.data);
}
resolve(res);
}).catch((error) =>{
reject(error);
})
})
}
/**
* 关系界面数据保存完成
*
* @param {any} $event
* @memberof Main
*/
public drdatasaved($event:any){
let _this = this;
this.drcounter--;
if(this.drcounter > 0){
return;
}
this.save(this.drsaveopt, undefined, false).then((res) =>{
this.saveState(res);
this.drsaveopt = {};
if(Object.is(_this.currentAction, "saveAndNew")){
_this.ResetData(res);
_this.loadDraft({});
}else if(Object.is(_this.currentAction, "saveAndExit")){
if(res){
_this.closeView(res.data);
}
}
});
}
/**
* 新建默认值
* @memberof Main
*/
public createDefault(){
}
/**
* 更新默认值
* @memberof Main
*/
public updateDefault(){
}
}
</script>
<style lang='less'>
@import './main-form.less';
</style>
\ No newline at end of file
/**
* Main 部件模型
*
* @export
* @class MainModel
*/
export default class MainModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof MainModel
*/
public getDataItems(): any[] {
return [
{
name: 'srfwfmemo',
prop: 'srfwfmemo',
dataType: 'TEXT',
},
// 前端新增修改标识,新增为"0",修改为"1"或未设值
{
name: 'srffrontuf',
prop: 'srffrontuf',
dataType: 'TEXT',
},
{
name: 'srfupdatedate',
prop: 'updatedate',
dataType: 'DATETIME',
},
{
name: 'srforikey',
},
{
name: 'srfkey',
prop: 'serviceid',
dataType: 'GUID',
},
{
name: 'srfmajortext',
prop: 'servicename',
dataType: 'TEXT',
},
{
name: 'srftempmode',
},
{
name: 'srfuf',
},
{
name: 'srfdeid',
},
{
name: 'srfsourcekey',
},
{
name: 'servicename',
prop: 'servicename',
dataType: 'TEXT',
},
{
name: 'createman',
prop: 'createman',
dataType: 'TEXT',
},
{
name: 'createdate',
prop: 'createdate',
dataType: 'DATETIME',
},
{
name: 'updateman',
prop: 'updateman',
dataType: 'TEXT',
},
{
name: 'updatedate',
prop: 'updatedate',
dataType: 'DATETIME',
},
{
name: 'serviceid',
prop: 'serviceid',
dataType: 'GUID',
},
{
name: 'ibizservice',
prop: 'serviceid',
dataType: 'FONTKEY',
},
]
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import IBizServiceService from '@/service/ibiz-service/ibiz-service-service';
import MainModel from './main-form-model';
/**
* Main 部件服务对象
*
* @export
* @class MainService
*/
export default class MainService extends ControlService {
/**
* 服务服务对象
*
* @type {IBizServiceService}
* @memberof MainService
*/
public appEntityService: IBizServiceService = new IBizServiceService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof MainService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of MainService.
*
* @param {*} [opts={}]
* @memberof MainService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new MainModel();
}
/**
* 处理数据
*
* @private
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof MainService
*/
private doItems(promise: Promise<any>, deKeyField: string, deName: string): Promise<any> {
return new Promise((resolve, reject) => {
promise.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
data.forEach((item:any,index:number) =>{
item[deName] = item[deKeyField];
data[index] = item;
});
resolve(data);
} else {
reject([])
}
}).catch((response: any) => {
reject([])
});
});
}
/**
* 获取跨实体数据集合
*
* @param {string} serviceName 服务名称
* @param {string} interfaceName 接口名称
* @param {*} data
* @param {boolean} [isloading]
* @returns {Promise<any[]>}
* @memberof MainService
*/
@Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
return Promise.reject([])
}
/**
* 启动工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public wfstart(action: string,context: any = {},data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading,localdata);
} else {
result = this.appEntityService.WFStart(context,data, isloading,localdata);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 提交工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading,localdata);
} else {
result = this.appEntityService.WFSubmit(context,data, isloading,localdata);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 添加数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Create(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 删除数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public delete(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Remove(Context,Data, isloading);
}
result.then((response) => {
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 修改数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Update(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public get(action: string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Get(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 加载草稿
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public loadDraft(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
//仿真主键数据
const PrimaryKey = Util.createUUID();
Data.serviceid = PrimaryKey;
Data.ibizservice = PrimaryKey;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.GetDraft(Context,Data, isloading);
}
result.then((response) => {
response.data.serviceid = PrimaryKey;
this.handleResponse(action, response, true);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 前台逻辑
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public frontLogic(action:string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any)=>{
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
return Promise.reject({ status: 500, data: { title: '失败', message: '系统异常' } });
}
result.then((response) => {
this.handleResponse(action, response,true);
resolve(response);
}).catch(response => {
reject(response);
});
})
}
/**
* 处理请求数据
*
* @param action 行为
* @param data 数据
* @memberof MainService
*/
public handleRequestData(action: string,context:any, data: any = {}){
let mode: any = this.getMode();
if (!mode && mode.getDataItems instanceof Function) {
return data;
}
let formItemItems: any[] = mode.getDataItems();
let requestData:any = {};
formItemItems.forEach((item:any) =>{
if(item && item.dataType && Object.is(item.dataType,'FONTKEY')){
if(item && item.prop){
requestData[item.prop] = context[item.name];
}
}else{
if(item && item.prop){
requestData[item.prop] = data[item.name];
}
}
});
if(data && data.viewparams){
Object.assign(requestData,data.viewparams);
}
let tempContext:any = JSON.parse(JSON.stringify(context));
if(tempContext && tempContext.srfsessionid){
tempContext.srfsessionkey = tempContext.srfsessionid;
delete tempContext.srfsessionid;
}
return {context:tempContext,data:requestData};
}
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import MainBase from './main-form-base.vue';
@Component({
components: {
}
})
export default class Main extends MainBase {
}
</script>
\ No newline at end of file
<template>
<div :class="{ 'grid': true, 'show-paging-bar': isEnablePagingBar, 'hidden-paging-bar': !isEnablePagingBar }">
<i-form>
<el-table v-if="isDisplay === true"
:default-sort="{ prop: minorSortPSDEF, order: Object.is(minorSortDir, 'ASC') ? 'ascending' : Object.is(minorSortDir, 'DESC') ? 'descending' : '' }"
@sort-change="onSortChange($event)"
:border="isDragendCol"
:highlight-current-row ="isSingleSelect"
:row-class-name="getRowClassName"
size="mini"
stripe
@row-click="rowClick($event)"
@select-all="selectAll($event)"
@select="select($event)"
@row-class-name="onRowClassName($event)"
@row-dblclick="rowDBLClick($event)"
ref='multipleTable' :data="items" :show-header="!isHideHeader">
<template slot="empty">
无数据
<span class="quick-toolbar">
</span>
</template>
<template v-if="!isSingleSelect">
<el-table-column align="center" type='selection' :width="checkboxColWidth"></el-table-column>
</template>
<template v-if="getColumnState('servicename')">
<el-table-column show-overflow-tooltip :prop="'servicename'" :label="$t('entities.ibizservice.main_grid.columns.servicename')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.ibizservice.main_grid.columns.servicename')}}
</span>
</template>
<template v-slot="{row,column,$index}">
<span>{{row.servicename}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('updateman')">
<el-table-column show-overflow-tooltip :prop="'updateman'" :label="$t('entities.ibizservice.main_grid.columns.updateman')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.ibizservice.main_grid.columns.updateman')}}
</span>
</template>
<template v-slot="{row,column,$index}">
<template >
<codelist :value="row.updateman" tag='SysOperator' codelistType='DYNAMIC' ></codelist>
</template>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('updatedate')">
<el-table-column show-overflow-tooltip :prop="'updatedate'" :label="$t('entities.ibizservice.main_grid.columns.updatedate')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.ibizservice.main_grid.columns.updatedate')}}
</span>
</template>
<template v-slot="{row,column,$index}">
<app-format-data format="YYYY-MM-DD hh:mm:ss" :data="row.updatedate"></app-format-data>
</template>
</el-table-column>
</template>
<template v-if="adaptiveState">
<el-table-column></el-table-column>
</template>
</el-table>
<row class='grid-pagination' v-show="items.length > 0">
<page class='pull-right' @on-change="pageOnChange($event)"
@on-page-size-change="onPageSizeChange($event)"
:transfer="true" :total="totalrow"
show-sizer :current="curPage" :page-size="limit"
:page-size-opts="[10, 20, 30, 40, 50, 60, 70, 80, 90, 100]" show-elevator show-total>
<span>
<span class="page-column">
<poptip transfer placement="top-start">
<i-button icon="md-menu">{{$t('app.gridpage.choicecolumns')}}</i-button>
<div slot="content">
<template v-for="col in allColumns">
<div :key="col.name"><el-checkbox v-model="col.show" @change="onColChange()">{{$t(col.langtag)}}</el-checkbox></div>
</template>
</div>
</poptip>
</span>
<span v-if="selections.length > 0" class="batch-toolbar">
</span>
<span class="page-button"><i-button icon="md-refresh" :title="$t('app.gridpage.refresh')" @click="pageRefresh()"></i-button></span>&nbsp;
<span>
{{$t('app.gridpage.show')}}&nbsp;
<span>
<template v-if="items.length === 1">
1
</template>
<template v-else>
<span>{{(curPage - 1) * limit + 1}}&nbsp;-&nbsp;{{totalrow > curPage * limit ? curPage * limit : totalrow}}</span>
</template>
</span>&nbsp;
{{$t('app.gridpage.records')}},{{$t('app.gridpage.totle')}}&nbsp;{{totalrow}}&nbsp;{{$t('app.gridpage.records')}}
</span>
</span>
</page>
</row>
</i-form>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import IBizServiceService from '@/service/ibiz-service/ibiz-service-service';
import MainService from './main-grid-service';
import CodeListService from "@service/app/codelist-service";
import { FormItemModel } from '@/model/form-detail';
@Component({
components: {
}
})
export default class MainBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof Main
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof Main
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof Main
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof Main
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof Main
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof Main
*/
public getControlType(): string {
return 'GRID'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof Main
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {MainService}
* @memberof Main
*/
public service: MainService = new MainService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {IBizServiceService}
* @memberof Main
*/
public appEntityService: IBizServiceService = new IBizServiceService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof Main
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof Main
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 代码表服务对象
*
* @type {CodeListService}
* @memberof Main
*/
public codeListService:CodeListService = new CodeListService({ $store: this.$store });
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof Main
*/
public getDatas(): any[] {
return this.selections;
}
/**
* 获取单项树
*
* @returns {*}
* @memberof Main
*/
public getData(): any {
return this.selections[0];
}
/**
* 打开新建数据视图
*
* @type {any}
* @memberof Main
*/
@Prop() public newdata: any;
/**
* 打开编辑数据视图
*
* @type {any}
* @memberof Main
*/
@Prop() public opendata: any;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof Main
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--update
*
* @type {string}
* @memberof Main
*/
@Prop() public updateAction!: string;
/**
* 部件行为--fetch
*
* @type {string}
* @memberof Main
*/
@Prop() public fetchAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof Main
*/
@Prop() public removeAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof Main
*/
@Prop() public loadAction!: string;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof Main
*/
@Prop() public loaddraftAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof Main
*/
@Prop() public createAction!: string;
/**
* 当前页
*
* @type {number}
* @memberof Main
*/
public curPage: number = 1;
/**
* 数据
*
* @type {any[]}
* @memberof Main
*/
public items: any[] = [];
/**
* 是否支持分页
*
* @type {boolean}
* @memberof Main
*/
public isEnablePagingBar: boolean = true;
/**
* 是否禁用排序
*
* @type {boolean}
* @memberof Main
*/
public isNoSort: boolean = false;
/**
* 排序方向
*
* @type {string}
* @memberof Main
*/
public minorSortDir: string = '';
/**
* 排序字段
*
* @type {string}
* @memberof Main
*/
public minorSortPSDEF: string = '';
/**
* 分页条数
*
* @type {number}
* @memberof Main
*/
public limit: number = 20;
/**
* 是否显示标题
*
* @type {boolean}
* @memberof Main
*/
public isHideHeader: boolean = false;
/**
* 是否默认选中第一条数据
*
* @type {boolean}
* @memberof Main
*/
@Prop({ default: false }) public isSelectFirstDefault!: boolean;
/**
* 是否单选
*
* @type {boolean}
* @memberof Main
*/
@Prop() public isSingleSelect?: boolean;
/**
* 选中数据字符串
*
* @type {string}
* @memberof Main
*/
@Prop() public selectedData?: string;
/**
* 选中值变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('selectedData')
public onValueChange(newVal: any, oldVal: any) {
this.selections = [];
if(this.selectedData){
const refs: any = this.$refs;
if (refs.multipleTable) {
refs.multipleTable.clearSelection();
JSON.parse(this.selectedData).forEach((selection:any)=>{
let selectedItem = this.items.find((item:any)=>{
return Object.is(item.srfkey, selection.srfkey);
});
if(selectedItem){
this.rowClick(selectedItem);
}
});
}
}
}
/**
* 表格行数据默认激活模式
* 0 不激活
* 1 单击激活
* 2 双击激活
*
* @type {(number | 0 | 1 | 2)}
* @memberof Main
*/
@Prop({default: 2}) public gridRowActiveMode!: number;
/**
* 是否开启行编辑
*
* @type {boolean}
* @memberof Main
*/
@Prop({default: false}) public isOpenEdit!: boolean;
/**
* 实际是否开启行编辑
*
* @type {boolean}
* @memberof Main
*/
public actualIsOpenEdit: boolean = this.isOpenEdit;
/**
* 总条数
*
* @type {number}
* @memberof Main
*/
public totalrow: number = 0;
/**
* 选中行数据
*
* @type {any[]}
* @memberof Main
*/
public selections: any[] = [];
/**
* 拦截行选中
*
* @type {boolean}
* @memberof Main
*/
public stopRowClick: boolean = false;
/**
* 表格是否显示
*
* @type {boolean}
* @memberof Main
*/
public isDisplay:boolean = true;
/**
* 部件刷新
*
* @param {any[]} args
* @memberof Main
*/
public refresh(args: any[]): void {
this.load();
}
/**
* 选项框列宽
*
* @type {number}
* @memberof Main
*/
public checkboxColWidth: number = 35;
/**
* 是否允许拖动列宽
*
* @type {boolean}
* @memberof Main
*/
public isDragendCol: boolean = false;
/**
* 所有列成员
*
* @type {any[]}
* @memberof Main
*/
public allColumns: any[] = [
{
name: 'servicename',
label: 'service名称',
langtag: 'entities.ibizservice.main_grid.columns.servicename',
show: true,
util: 'PX'
},
{
name: 'updateman',
label: '更新人',
langtag: 'entities.ibizservice.main_grid.columns.updateman',
show: true,
util: 'PX'
},
{
name: 'updatedate',
label: '更新时间',
langtag: 'entities.ibizservice.main_grid.columns.updatedate',
show: true,
util: 'PX'
},
]
/**
* 表格模型集合
*
* @type {*}
* @memberof Main
*/
public gridItemsModel: any[] = [];
/**
* 获取表格行模型
*
* @type {*}
* @memberof Main
*/
public getGridRowModel(){
return {
srfkey: new FormItemModel(),
}
}
/**
* 属性值规则
*
* @type {*}
* @memberof Main
*/
public rules: any = {
srfkey: [
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '服务 值不能为空', trigger: 'change' },
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '服务 值不能为空', trigger: 'blur' },
],
}
/**
* 表格行编辑项校验
*
* @param {string} property 属性名
* @param {*} data 行数据
* @param {number} rowIndex 行索引
* @returns Promise<any>
*
* @memberof Main
*/
public validate(property:string, data:any, rowIndex:number):Promise<any>{
return new Promise((resolve, reject) => {
this.$util.validateItem(property,data,this.rules).then(()=>{
this.gridItemsModel[rowIndex][property].setError(null);
resolve(true);
}).catch(({ errors, fields }) => {
this.gridItemsModel[rowIndex][property].setError(errors[0].message);
resolve(false);
});
});
}
/**
* 校验所有修改过的编辑项
*
* @returns Promise<any>
* @memberof Main
*/
public async validateAll(){
let validateState = true;
let index = -1;
for(let item of this.items){
index++;
if(item.rowDataState === "create" || item.rowDataState === "update"){
for(let property of Object.keys(this.rules)){
if(!await this.validate(property,item,index)){
validateState = false;
}
}
}
}
return validateState;
}
/**
* 表格数据加载
*
* @param {*} [arg={}]
* @memberof Main
*/
public load(opt: any = {}, pageReset: boolean = false): void {
if(!this.fetchAction){
this.$Notice.error({ title: '错误', desc: 'IBizServiceGridView视图表格fetchAction参数未配置' });
return;
}
if(pageReset){
this.curPage = 1;
}
const arg: any = {...opt};
const page: any = {};
if (this.isEnablePagingBar) {
Object.assign(page, { page: this.curPage-1, size: this.limit });
}
// 设置排序
if (!this.isNoSort && !Object.is(this.minorSortDir, '') && !Object.is(this.minorSortPSDEF, '')) {
const sort: string = this.minorSortPSDEF+","+this.minorSortDir;
Object.assign(page, { sort: sort });
}
Object.assign(arg, page);
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction,JSON.parse(JSON.stringify(this.context)), arg, this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.errorMessage) {
this.$Notice.error({ title: '错误', desc: response.errorMessage });
}
return;
}
const data: any = response.data;
this.totalrow = response.total;
this.items = JSON.parse(JSON.stringify(data));
// 清空selections,gridItemsModel
this.selections = [];
this.gridItemsModel = [];
this.items.forEach(()=>{this.gridItemsModel.push(this.getGridRowModel())});
this.$emit('load', this.items);
// 设置默认选中
let _this = this;
setTimeout(() => {
if(_this.isSelectFirstDefault){
_this.rowClick(_this.items[0]);
}
if(_this.selectedData){
const refs: any = _this.$refs;
if (refs.multipleTable) {
refs.multipleTable.clearSelection();
JSON.parse(_this.selectedData).forEach((selection:any)=>{
let selectedItem = _this.items.find((item:any)=>{
return Object.is(item.srfkey, selection.srfkey);
});
if(selectedItem){
_this.rowClick(selectedItem);
}
});
}
}
}, 300);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: '错误', desc: response.errorMessage });
});
}
/**
* 删除
*
* @param {any[]} datas
* @returns {Promise<any>}
* @memberof Main
*/
public async remove(datas: any[]): Promise<any> {
if(!this.removeAction){
this.$Notice.error({ title: '错误', desc: 'IBizServiceGridView视图表格removeAction参数未配置' });
return;
}
let _datas:any[] = [];
datas.forEach((record: any, index: number) => {
if (Object.is(record.srfuf, "0")) {
this.items.some((val: any, num: number) =>{
if(JSON.stringify(val) == JSON.stringify(record)){
this.items.splice(num,1);
this.gridItemsModel.splice(num,1);
return true;
}
});
}else{
_datas.push(datas[index]);
}
});
if (_datas.length === 0) {
return;
}
let dataInfo = '';
_datas.forEach((record: any, index: number) => {
let srfmajortext = record.servicename;
if (index < 5) {
if (!Object.is(dataInfo, '')) {
dataInfo += '、';
}
dataInfo += srfmajortext;
} else {
return false;
}
});
if (_datas.length < 5) {
dataInfo = dataInfo + ' 共' + _datas.length + '条数据';
} else {
dataInfo = dataInfo + '...' + ' 共' + _datas.length + '条数据';
}
const removeData = () => {
let keys: any[] = [];
_datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
let _keys = keys.length > 1 ? keys : keys[0] ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ ibizservice: _keys }),Object.assign({ ibizservice: _keys },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: '删除数据失败,' + response.info });
return;
} else {
this.$Notice.success({ title: '', desc: '删除成功!' });
}
//删除items中已删除的项
console.log(this.items);
_datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
this.gridItemsModel.splice(index,1);
return true;
}
});
});
this.totalrow -= _datas.length;
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
});
});
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '');
this.$Modal.confirm({
title: '警告',
content: '确认要删除 ' + dataInfo + ',删除操作将不可恢复?',
onOk: () => {
removeData();
},
onCancel: () => { }
});
return removeData;
}
/**
* 批量添加
*
* @param {*} [arg={}]
* @memberof Main
*/
public addBatch(arg: any = {}): void {
if(!this.fetchAction){
this.$Notice.error({ title: '错误', desc: 'IBizServiceGridView视图表格fetchAction参数未配置' });
return;
}
if(!arg){
arg = {};
}
console.error("批量添加未实现");
}
/**
* 数据导入
*
* @param {*} data
* @memberof Main
*/
public importExcel(data:any ={}):void{
//导入excel
const importDataModel:any ={
}
if(Object.keys(importDataModel).length == 0){
this.$Notice.warning({ 'title': (this.$t("app.utilview.warning") as string), 'desc': (this.$t("app.utilview.info") as string) });
return;
}
const view:any ={
viewname: 'app-data-upload',
title: this.$t("app.utilview.importview"),
width: 900,
height: 700
}
let container: Subject<any> = this.$appmodal.openModal(view, JSON.parse(JSON.stringify(this.context)), importDataModel);
container.subscribe((result: any) => {
if(Object.is(result.ret,'OK')){
this.refresh(result.datas);
}
});
}
/**
* 数据导出
*
* @param {*} data
* @memberof Main
*/
public exportExcel(data: any = {}): void {
// 导出Excel
const doExport = async (_data:any) => {
const tHeader: Array<any> = [];
const filterVal: Array<any> = [];
this.allColumns.forEach((item: any) => {
item.show && item.label ? tHeader.push(this.$t(item.langtag)) : "";
item.show && item.name ? filterVal.push(item.name) : "";
});
const data = await this.formatExcelData(filterVal, _data);
this.$export.exportExcel().then((excel:any)=>{
excel.export_json_to_excel({
header: tHeader, //表头 必填
data, //具体数据 必填
filename: "服务表", //非必填
autoWidth: true, //非必填
bookType: "xlsx" //非必填
});
});
};
const page: any = {};
// 设置page,size
if (Object.is(data.type, 'maxRowCount')) {
Object.assign(page, { page: 0, size: data.maxRowCount });
} else if (Object.is(data.type, 'activatedPage')) {
try {
doExport(JSON.parse(JSON.stringify(this.items)));
} catch (error) {
console.error(error);
}
return;
}
// 设置排序
if (!this.isNoSort && !Object.is(this.minorSortDir, '') && !Object.is(this.minorSortPSDEF, '')) {
const sort: string = this.minorSortPSDEF+","+this.minorSortDir;
Object.assign(page, { sort: sort });
}
const arg: any = {};
Object.assign(arg, page);
// 获取query,搜索表单,viewparams等父数据
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
const post: Promise<any> = this.service.search(this.fetchAction,JSON.parse(JSON.stringify(this.context)), arg, this.showBusyIndicator);
post.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: '数据导出失败,' + response.info });
return;
}
try {
doExport(JSON.parse(JSON.stringify(response.data)));
} catch (error) {
console.error(error);
}
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: '', desc: '数据导出失败' });
});
}
/**
* 导出数据格式化
*
* @param {*} filterVal
* @param {*} jsonData
* @returns {[]}
* @memberof Main
*/
public async formatExcelData(filterVal:any, jsonData:any) {
let codelistColumns:Array<any> = [
{
name: 'updateman',
srfkey: 'SysOperator',
codelistType : 'DYNAMIC',
renderMode: 'other',
textSeparator: '、',
valueSeparator: ',',
},
];
let _this = this;
for (const codelist of codelistColumns) {
// 动态代码表处理
if (Object.is(codelist.codelistType, "DYNAMIC")) {
let items = await _this.codeListService.getItems(codelist.srfkey);
jsonData.forEach((row:any)=>{
row[codelist.name] = _this.getCodelistValue(items, row[codelist.name], codelist);
});
// 静态处理
} else if(Object.is(codelist.codelistType, "STATIC")){
let items = await _this.$store.getters.getCodeListItems(codelist.srfkey);
jsonData.forEach((row:any)=>{
row[codelist.name] = _this.getCodelistValue(items, row[codelist.name], codelist);
});
}
}
return jsonData.map((v:any) => filterVal.map((j:any) => v[j]))
}
/**
* 解析代码表和vlaue,设置items
*
* @public
* @param {any[]} items 代码表数据
* @param {*} value
* @returns {*}
* @memberof Main
*/
public getCodelistValue(items: any[], value: any, codelist: any,){
if(!value){
return this.$t('codelist.'+codelist.srfkey+'.empty');
}
if (items) {
let result:any = [];
if(Object.is(codelist.renderMode,"number")){
items.map((_item: any, index: number)=>{
const nValue = parseInt((value as any), 10);
const codevalue = _item.value;
if((parseInt(codevalue, 10) & nValue) > 0){
result.push(_item);
}
});
} else if(Object.is(codelist.renderMode,"string")){
const arrayValue: Array<any> = (value as any).split(codelist.valueSeparator);
arrayValue.map((value: any, index: number) => {
result.push([]);
let values: any[] = Object.is(this.$util.typeOf(value), 'number') ? [value] : [...(value as any).split(codelist.valueSeparator)];
values.map((val:any ,num: number)=>{
const item = this.getItem(items, val, codelist);
if(item){
result[index].push(item);
}
});
});
} else {
let values: any[] = Object.is(this.$util.typeOf(value), 'number') ? [value] : [...(value as any).split(codelist.valueSeparator)];
values.map((value:any ,index: number)=>{
const item = this.getItem(items, value, codelist);
if(item){
result.push(item);
}
});
}
// 设置items
if(result.length != 0){
return result.join(codelist.valueSeparator);
}else{
return value;
}
}
}
/**
* 获取代码项
*
* @public
* @param {any[]} items
* @param {*} value
* @returns {*}
* @memberof Main
*/
public getItem(items: any[], value: any, codelist: any): any {
const arr: Array<any> = items.filter(item => {return item.value == value});
if (arr.length !== 1) {
return undefined;
}
if(Object.is(codelist.codelistType,'STATIC')){
return this.$t('codelist.'+codelist.srfkey+'.'+arr[0].value);
}else{
return arr[0].text;
}
}
/**
* 生命周期
*
* @memberof Main
*/
public created(): void {
this.afterCreated();
this.$acc.commandLocal(() => {
this.load()
}, 'all', 'SERVICE');
}
/**
* 执行created后的逻辑
*
* @memberof Main
*/
public afterCreated(){
this.setColState();
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
if (Object.is('load', action)) {
this.load(data);
}
if (Object.is('remove', action)) {
this.remove(data);
}
if (Object.is('save', action)) {
this.save(data);
}
});
}
}
/**
* vue 生命周期
*
* @memberof Main
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof Main
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
/**
* 获取选中行胡数据
*
* @returns {any[]}
* @memberof Main
*/
public getSelection(): any[] {
return this.selections;
}
/**
* 行双击事件
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
public rowDBLClick($event: any): void {
if (!$event || this.actualIsOpenEdit || Object.is(this.gridRowActiveMode,0)) {
return;
}
this.selections = [];
this.selections.push(JSON.parse(JSON.stringify($event)));
const refs: any = this.$refs;
if (refs.multipleTable) {
refs.multipleTable.clearSelection();
refs.multipleTable.toggleRowSelection($event);
}
this.$emit('rowdblclick', this.selections);
this.$emit('selectionchange', this.selections);
}
/**
* 复选框数据选中
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
public select($event: any): void {
if (!$event) {
return;
}
this.selections = [];
this.selections = [...JSON.parse(JSON.stringify($event))];
this.$emit('selectionchange', this.selections);
}
/**
* 复选框数据全部选中
*
* @param {*} $event
* @memberof Main
*/
public selectAll($event: any): void {
if (!$event) {
return;
}
this.selections = [];
this.selections = [...JSON.parse(JSON.stringify($event))];
this.$emit('selectionchange', this.selections);
}
/**
* 行单击选中
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
public rowClick($event: any, ifAlways: boolean = false): void {
if (!ifAlways && (!$event || this.actualIsOpenEdit)) {
return;
}
if(this.stopRowClick) {
this.stopRowClick = false;
return;
}
if(this.isSingleSelect){
this.selections = [];
}
// 已选中则删除,没选中则添加
let selectIndex = this.selections.findIndex((item:any)=>{
return Object.is(item.service,$event.service);
});
if (Object.is(selectIndex,-1)){
this.selections.push(JSON.parse(JSON.stringify($event)));
} else {
this.selections.splice(selectIndex,1);
}
const refs: any = this.$refs;
if (refs.multipleTable) {
if(this.isSingleSelect){
refs.multipleTable.clearSelection();
refs.multipleTable.setCurrentRow($event);
}else{
refs.multipleTable.toggleRowSelection($event);
}
}
this.$emit('selectionchange', this.selections);
}
/**
* 页面变化
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
public pageOnChange($event: any): void {
if (!$event) {
return;
}
if ($event === this.curPage) {
return;
}
this.curPage = $event;
this.load({});
}
/**
* 分页条数变化
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
public onPageSizeChange($event: any): void {
if (!$event) {
return;
}
if ($event === this.limit) {
return;
}
this.limit = $event;
if (this.curPage === 1) {
this.load({});
}
}
/**
* 分页刷新
*
* @memberof Main
*/
public pageRefresh(): void {
this.load({});
}
/**
* 排序变化
*
* @param {{ column: any, prop: any, order: any }} { column, prop, order }
* @memberof Main
*/
public onSortChange({ column, prop, order }: { column: any, prop: any, order: any }): void {
const dir = Object.is(order, 'ascending') ? 'asc' : Object.is(order, 'descending') ? 'desc' : '';
if (Object.is(dir, this.minorSortDir) && Object.is(this.minorSortPSDEF, prop)) {
return;
}
this.minorSortDir = dir;
this.minorSortPSDEF = prop ? prop : '';
this.load({});
}
/**
* 表格行选中样式
*
* @param {{ row: any, rowIndex: any }} { row, rowIndex }
* @returns {string}
* @memberof Main
*/
public onRowClassName({ row, rowIndex }: { row: any, rowIndex: any }): string {
const index = this.selections.findIndex((select: any) => Object.is(select.srfkey, row.srfkey));
return index !== -1 ? 'grid-row-select' : '';
}
/**
* 界面行为
*
* @param {*} row
* @param {*} tag
* @param {*} $event
* @memberof Main
*/
public uiAction(row: any, tag: any, $event: any) {
$event.stopPropagation();
}
/**
* 设置列状态
*
* @memberof Main
*/
public setColState() {
const _data: any = localStorage.getItem('service_main_grid');
if (_data) {
let columns = JSON.parse(_data);
columns.forEach((col: any) => {
let column = this.allColumns.find((item) => Object.is(col.name, item.name));
if (column) {
Object.assign(column, col);
}
});
}
}
/**
* 列变化
*
* @memberof Main
*/
public onColChange() {
localStorage.setItem('service_main_grid', JSON.stringify(this.allColumns));
}
/**
* 获取列状态
*
* @param {string} name
* @returns {boolean}
* @memberof Main
*/
public getColumnState(name: string): boolean {
let column = this.allColumns.find((col: any) =>
Object.is(name, col.name)
);
return column.show ? true : false;
}
/**
* 表格列是否自适应布局
*
* @readonly
* @type {boolean}
* @memberof Main
*/
get adaptiveState(): boolean {
return !this.allColumns.find((column: any) => column.show && Object.is(column.util, 'STAR'));
}
/**
* 保存
*
* @param {*} $event
* @returns {Promise<any>}
* @memberof Main
*/
public async save(args: any[], params?: any, $event?: any, xData?: any){
let _this = this;
if(!await this.validateAll()){
this.$Notice.error({ title: '错误', desc: '值规则校验异常' });
return [];
}
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
if(!this.createAction){
this.$Notice.error({ title: '错误', desc: 'IBizServiceGridView视图表格createAction参数未配置' });
}else{
Object.assign(item,{viewparams:this.viewparams});
let response = await this.service.add(this.createAction, JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator);
successItems.push(JSON.parse(JSON.stringify(response.data)));
}
}else if(Object.is(item.rowDataState, 'update')){
if(!this.updateAction){
this.$Notice.error({ title: '错误', desc: 'IBizServiceGridView视图表格updateAction参数未配置' });
}else{
Object.assign(item,{viewparams:this.viewparams});
if(item.ibizservice){
Object.assign(this.context,{ibizservice:item.ibizservice});
}
let response = await this.service.add(this.updateAction,JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator);
successItems.push(JSON.parse(JSON.stringify(response.data)));
}
}
} catch (error) {
errorItems.push(JSON.parse(JSON.stringify(item)));
errorMessage.push(error);
}
}
this.$emit('save', successItems);
this.refresh([]);
if(errorItems.length === 0){
this.$Notice.success({ title: '', desc: '保存成功!' });
}else{
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: '保存失败', desc: item.majorentityname+'保存失败!' });
console.error(errorMessage[index]);
});
}
return successItems;
}
/**
* 获取对应行class
*
* @param {*} $args row 行数据,rowIndex 行索引
* @returns {void}
* @memberof Main
*/
public getRowClassName(args:{row: any,rowIndex: number}){
let isSelected = this.selections.some((item:any)=>{
return Object.is(item.ibizservice,args.row.ibizservice);
});
return isSelected ? "grid-selected-row" : "";
}
/**
* 新建默认值
* @param {*} row 行数据
* @memberof Main
*/
public createDefault(row: any){
}
}
</script>
<style lang='less'>
@import './main-grid.less';
</style>
\ No newline at end of file
/**
* Main 部件模型
*
* @export
* @class MainModel
*/
export default class MainModel {
/**
* 是否是实体数据导出
*
* @returns {any[]}
* @memberof MainGridMode
*/
public isDEExport: boolean = false;
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof MainGridMode
*/
public getDataItems(): any[] {
if(this.isDEExport){
return [
]
}else{
return [
{
name: 'servicename',
prop: 'servicename',
dataType: 'TEXT',
},
{
name: 'updateman',
prop: 'updateman',
dataType: 'TEXT',
},
{
name: 'resourcespecid',
prop: 'resourcespecid',
dataType: 'PICKUP',
},
{
name: 'updatedate',
prop: 'updatedate',
dataType: 'DATETIME',
},
{
name: 'srfmajortext',
prop: 'servicename',
dataType: 'TEXT',
},
{
name: 'srfdataaccaction',
prop: 'serviceid',
dataType: 'GUID',
},
{
name: 'srfkey',
prop: 'serviceid',
dataType: 'GUID',
},
{
name: 'ibizservice',
prop: 'serviceid',
},
{
name:'size',
prop:'size'
},
{
name:'query',
prop:'query'
},
{
name:'page',
prop:'page'
},
{
name:'sort',
prop:'sort'
},
{
name:'srfparentdata',
prop:'srfparentdata'
},
// 前端新增修改标识,新增为"0",修改为"1"或未设值
{
name: 'srffrontuf',
prop: 'srffrontuf',
dataType: 'TEXT',
},
]
}
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import IBizServiceService from '@/service/ibiz-service/ibiz-service-service';
import MainModel from './main-grid-model';
/**
* Main 部件服务对象
*
* @export
* @class MainService
*/
export default class MainService extends ControlService {
/**
* 服务服务对象
*
* @type {IBizServiceService}
* @memberof MainService
*/
public appEntityService: IBizServiceService = new IBizServiceService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof MainService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of MainService.
*
* @param {*} [opts={}]
* @memberof MainService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new MainModel();
}
/**
* 处理数据
*
* @public
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof MainService
*/
public doItems(promise: Promise<any>, deKeyField: string, deName: string): Promise<any> {
return new Promise((resolve, reject) => {
promise.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
data.forEach((item:any,index:number) =>{
item[deName] = item[deKeyField];
data[index] = item;
});
resolve(data);
} else {
reject([])
}
}).catch((response: any) => {
reject([])
});
});
}
/**
* 获取跨实体数据集合
*
* @param {string} serviceName 服务名称
* @param {string} interfaceName 接口名称
* @param {*} data
* @param {boolean} [isloading]
* @returns {Promise<any[]>}
* @memberof MainService
*/
@Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
return Promise.reject([])
}
/**
* 添加数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public add(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.Create(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 删除数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public delete(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.Remove(Context,Data, isloading);
}
result.then((response) => {
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 修改数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@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](Data,Context,isloading);
}else{
result =_appEntityService.Update(Data,Context,isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 获取数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public get(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) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Get(Context,Data, isloading);
}
result.then((response) => {
//处理返回数据,补充判断标识
if(response.data){
Object.assign(response.data,{srfuf:0});
}
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public search(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.FetchDefault(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 加载草稿
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public loadDraft(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) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.GetDraft(Context,Data, isloading);
}
result.then((response) => {
//处理返回数据,补充判断标识
if(response.data){
Object.assign(response.data,{srfuf:'0'});
//仿真主键数据
response.data.serviceid = Util.createUUID();
}
this.handleResponse(action, response, true);
this.mergeDefaults(response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 合并配置的默认值
* @param {*}
* @memberof MainService
*/
public mergeDefaults(response:any = {}){
if(response.data){
}
}
/**
* 前台逻辑
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public frontLogic(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)=>{
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
return Promise.reject({ status: 500, data: { title: '失败', message: '系统异常' } });
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
})
}
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import MainBase from './main-grid-base.vue';
@Component({
components: {
}
})
export default class Main extends MainBase {
}
</script>
\ No newline at end of file
...@@ -55,6 +55,10 @@ zuul: ...@@ -55,6 +55,10 @@ zuul:
path: /incidents/** path: /incidents/**
serviceId: ibizbusinesscentral-centralapi serviceId: ibizbusinesscentral-centralapi
stripPrefix: false stripPrefix: false
service:
path: /ibizservices/**
serviceId: ibizbusinesscentral-centralapi
stripPrefix: false
list: list:
path: /ibizlists/** path: /ibizlists/**
serviceId: ibizbusinesscentral-centralapi serviceId: ibizbusinesscentral-centralapi
......
...@@ -4510,7 +4510,7 @@ ...@@ -4510,7 +4510,7 @@
<!--输出实体[ACCOUNT]数据结构 --> <!--输出实体[ACCOUNT]数据结构 -->
<changeSet author="a_LAB01_e85d8801c" id="tab-account-257-54"> <changeSet author="a_LAB01_e85d8801c" id="tab-account-266-54">
<createTable tableName="ACCOUNT"> <createTable tableName="ACCOUNT">
<column name="ADDRESS1_PRIMARYCONTACTNAME" remarks="" type="VARCHAR(100)"> <column name="ADDRESS1_PRIMARYCONTACTNAME" remarks="" type="VARCHAR(100)">
</column> </column>
...@@ -7777,7 +7777,7 @@ ...@@ -7777,7 +7777,7 @@
<!--输出实体[SERVICE]数据结构 --> <!--输出实体[SERVICE]数据结构 -->
<changeSet author="a_LAB01_e85d8801c" id="tab-service-1-82"> <changeSet author="a_LAB01_e85d8801c" id="tab-service-4-82">
<createTable tableName="SERVICE"> <createTable tableName="SERVICE">
<column name="CREATEDATE" remarks="" type="DATETIME"> <column name="CREATEDATE" remarks="" type="DATETIME">
</column> </column>
...@@ -11122,31 +11122,31 @@ ...@@ -11122,31 +11122,31 @@
<addForeignKeyConstraint baseColumnNames="METRICID" baseTableName="GOAL" constraintName="DER1N_GOAL__METRIC__METRICID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="METRICID" referencedTableName="METRIC" validate="true"/> <addForeignKeyConstraint baseColumnNames="METRICID" baseTableName="GOAL" constraintName="DER1N_GOAL__METRIC__METRICID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="METRICID" referencedTableName="METRIC" validate="true"/>
</changeSet> </changeSet>
<!--输出实体[ACCOUNT]外键关系 --> <!--输出实体[ACCOUNT]外键关系 -->
<changeSet author="a_LAB01_e85d8801c" id="fk-account-257-252"> <changeSet author="a_LAB01_e85d8801c" id="fk-account-266-252">
<addForeignKeyConstraint baseColumnNames="PARENTACCOUNTID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__ACCOUNT__PARENT" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ACCOUNTID" referencedTableName="ACCOUNT" validate="true"/> <addForeignKeyConstraint baseColumnNames="PARENTACCOUNTID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__ACCOUNT__PARENT" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ACCOUNTID" referencedTableName="ACCOUNT" validate="true"/>
</changeSet> </changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-account-257-253"> <changeSet author="a_LAB01_e85d8801c" id="fk-account-266-253">
<addForeignKeyConstraint baseColumnNames="PRIMARYCONTACTID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__CONTACT__PRIMAR" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="CONTACTID" referencedTableName="CONTACT" validate="true"/> <addForeignKeyConstraint baseColumnNames="PRIMARYCONTACTID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__CONTACT__PRIMAR" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="CONTACTID" referencedTableName="CONTACT" validate="true"/>
</changeSet> </changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-account-257-254"> <changeSet author="a_LAB01_e85d8801c" id="fk-account-266-254">
<addForeignKeyConstraint baseColumnNames="PREFERREDEQUIPMENTID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__EQUIPMENT__PREF" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="EQUIPMENTID" referencedTableName="EQUIPMENT" validate="true"/> <addForeignKeyConstraint baseColumnNames="PREFERREDEQUIPMENTID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__EQUIPMENT__PREF" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="EQUIPMENTID" referencedTableName="EQUIPMENT" validate="true"/>
</changeSet> </changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-account-257-255"> <changeSet author="a_LAB01_e85d8801c" id="fk-account-266-255">
<addForeignKeyConstraint baseColumnNames="ORIGINATINGLEADID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__LEAD__ORIGINATI" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="LEADID" referencedTableName="LEAD" validate="true"/> <addForeignKeyConstraint baseColumnNames="ORIGINATINGLEADID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__LEAD__ORIGINATI" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="LEADID" referencedTableName="LEAD" validate="true"/>
</changeSet> </changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-account-257-256"> <changeSet author="a_LAB01_e85d8801c" id="fk-account-266-256">
<addForeignKeyConstraint baseColumnNames="DEFAULTPRICELEVELID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__PRICELEVEL__DEF" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="PRICELEVELID" referencedTableName="PRICELEVEL" validate="true"/> <addForeignKeyConstraint baseColumnNames="DEFAULTPRICELEVELID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__PRICELEVEL__DEF" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="PRICELEVELID" referencedTableName="PRICELEVEL" validate="true"/>
</changeSet> </changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-account-257-257"> <changeSet author="a_LAB01_e85d8801c" id="fk-account-266-257">
<addForeignKeyConstraint baseColumnNames="PREFERREDSERVICEID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__SERVICE__PREFER" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SERVICEID" referencedTableName="SERVICE" validate="true"/> <addForeignKeyConstraint baseColumnNames="PREFERREDSERVICEID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__SERVICE__PREFER" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SERVICEID" referencedTableName="SERVICE" validate="true"/>
</changeSet> </changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-account-257-258"> <changeSet author="a_LAB01_e85d8801c" id="fk-account-266-258">
<addForeignKeyConstraint baseColumnNames="SLAID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__SLA__SLAID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SLAID" referencedTableName="SLA" validate="true"/> <addForeignKeyConstraint baseColumnNames="SLAID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__SLA__SLAID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SLAID" referencedTableName="SLA" validate="true"/>
</changeSet> </changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-account-257-259"> <changeSet author="a_LAB01_e85d8801c" id="fk-account-266-259">
<addForeignKeyConstraint baseColumnNames="TERRITORYID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__TERRITORY__TERR" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="TERRITORYID" referencedTableName="TERRITORY" validate="true"/> <addForeignKeyConstraint baseColumnNames="TERRITORYID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__TERRITORY__TERR" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="TERRITORYID" referencedTableName="TERRITORY" validate="true"/>
</changeSet> </changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-account-257-260"> <changeSet author="a_LAB01_e85d8801c" id="fk-account-266-260">
<addForeignKeyConstraint baseColumnNames="TRANSACTIONCURRENCYID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__TRANSACTIONCURR" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="TRANSACTIONCURRENCYID" referencedTableName="TRANSACTIONCURRENCY" validate="true"/> <addForeignKeyConstraint baseColumnNames="TRANSACTIONCURRENCYID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__TRANSACTIONCURR" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="TRANSACTIONCURRENCYID" referencedTableName="TRANSACTIONCURRENCY" validate="true"/>
</changeSet> </changeSet>
<!--输出实体[KNOWLEDGEARTICLEVIEWS]外键关系 --> <!--输出实体[KNOWLEDGEARTICLEVIEWS]外键关系 -->
...@@ -11360,7 +11360,7 @@ ...@@ -11360,7 +11360,7 @@
</changeSet> </changeSet>
<!--输出实体[CALLBACKREGISTRATION]外键关系 --> <!--输出实体[CALLBACKREGISTRATION]外键关系 -->
<!--输出实体[SERVICE]外键关系 --> <!--输出实体[SERVICE]外键关系 -->
<changeSet author="a_LAB01_e85d8801c" id="fk-service-1-330"> <changeSet author="a_LAB01_e85d8801c" id="fk-service-4-330">
<addForeignKeyConstraint baseColumnNames="RESOURCESPECID" baseTableName="SERVICE" constraintName="DER1N_SERVICE__RESOURCESPEC__R" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="RESOURCESPECID" referencedTableName="RESOURCESPEC" validate="true"/> <addForeignKeyConstraint baseColumnNames="RESOURCESPECID" baseTableName="SERVICE" constraintName="DER1N_SERVICE__RESOURCESPEC__R" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="RESOURCESPECID" referencedTableName="RESOURCESPEC" validate="true"/>
</changeSet> </changeSet>
<!--输出实体[PERSONALDOCUMENTTEMPLATE]外键关系 --> <!--输出实体[PERSONALDOCUMENTTEMPLATE]外键关系 -->
......
...@@ -108,6 +108,14 @@ ...@@ -108,6 +108,14 @@
"datascope":[{"id":"all","name":"全部数据"}, {"id":"createman","name":"创建人"}] "datascope":[{"id":"all","name":"全部数据"}, {"id":"createman","name":"创建人"}]
} }
, { , {
"dename":"IBizService",
"delogicname":"服务",
"sysmoudle":{"id":"SERVICE","name":"Service"},
"dedataset":[{"id":"Default" , "name":"DEFAULT"}],
"deaction":[{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" }],
"datascope":[{"id":"all","name":"全部数据"}, {"id":"createman","name":"创建人"}]
}
, {
"dename":"IBizList", "dename":"IBizList",
"delogicname":"市场营销列表", "delogicname":"市场营销列表",
"sysmoudle":{"id":"MARKETING","name":"Marketing"}, "sysmoudle":{"id":"MARKETING","name":"Marketing"},
......
package cn.ibizlab.businesscentral.centralapi.dto;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.math.BigInteger;
import java.util.Map;
import java.util.HashMap;
import java.io.Serializable;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;
import cn.ibizlab.businesscentral.util.domain.DTOBase;
import lombok.Data;
/**
* 服务DTO对象[IBizServiceDTO]
*/
@Data
public class IBizServiceDTO extends DTOBase implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 属性 [CREATEDATE]
*
*/
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "createdate" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("createdate")
private Timestamp createdate;
/**
* 属性 [TIMEZONERULEVERSIONNUMBER]
*
*/
@JSONField(name = "timezoneruleversionnumber")
@JsonProperty("timezoneruleversionnumber")
private Integer timezoneruleversionnumber;
/**
* 属性 [OVERRIDDENCREATEDON]
*
*/
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "overriddencreatedon" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("overriddencreatedon")
private Timestamp overriddencreatedon;
/**
* 属性 [ANCHOROFFSET]
*
*/
@JSONField(name = "anchoroffset")
@JsonProperty("anchoroffset")
private Integer anchoroffset;
/**
* 属性 [INITIALSTATUSCODE]
*
*/
@JSONField(name = "initialstatuscode")
@JsonProperty("initialstatuscode")
private Integer initialstatuscode;
/**
* 属性 [GRANULARITY]
*
*/
@JSONField(name = "granularity")
@JsonProperty("granularity")
private String granularity;
/**
* 属性 [UPDATEMAN]
*
*/
@JSONField(name = "updateman")
@JsonProperty("updateman")
private String updateman;
/**
* 属性 [DESCRIPTION]
*
*/
@JSONField(name = "description")
@JsonProperty("description")
private String description;
/**
* 属性 [SHOWRESOURCES]
*
*/
@JSONField(name = "showresources")
@JsonProperty("showresources")
private Integer showresources;
/**
* 属性 [SERVICENAME]
*
*/
@JSONField(name = "servicename")
@JsonProperty("servicename")
private String servicename;
/**
* 属性 [IMPORTSEQUENCENUMBER]
*
*/
@JSONField(name = "importsequencenumber")
@JsonProperty("importsequencenumber")
private Integer importsequencenumber;
/**
* 属性 [VISIBLE]
*
*/
@JSONField(name = "visible")
@JsonProperty("visible")
private Integer visible;
/**
* 属性 [CALENDARID]
*
*/
@JSONField(name = "calendarid")
@JsonProperty("calendarid")
private String calendarid;
/**
* 属性 [CREATEMAN]
*
*/
@JSONField(name = "createman")
@JsonProperty("createman")
private String createman;
/**
* 属性 [SCHEDULABLE]
*
*/
@JSONField(name = "schedulable")
@JsonProperty("schedulable")
private Integer schedulable;
/**
* 属性 [STRATEGYID]
*
*/
@JSONField(name = "strategyid")
@JsonProperty("strategyid")
private String strategyid;
/**
* 属性 [VERSIONNUMBER]
*
*/
@JSONField(name = "versionnumber")
@JsonProperty("versionnumber")
private BigInteger versionnumber;
/**
* 属性 [SERVICEID]
*
*/
@JSONField(name = "serviceid")
@JsonProperty("serviceid")
private String serviceid;
/**
* 属性 [DURATION]
*
*/
@JSONField(name = "duration")
@JsonProperty("duration")
private Integer duration;
/**
* 属性 [UPDATEDATE]
*
*/
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "updatedate" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("updatedate")
private Timestamp updatedate;
/**
* 属性 [UTCCONVERSIONTIMEZONECODE]
*
*/
@JSONField(name = "utcconversiontimezonecode")
@JsonProperty("utcconversiontimezonecode")
private Integer utcconversiontimezonecode;
/**
* 属性 [RESOURCESPECID]
*
*/
@JSONField(name = "resourcespecid")
@JsonProperty("resourcespecid")
private String resourcespecid;
/**
* 设置 [TIMEZONERULEVERSIONNUMBER]
*/
public void setTimezoneruleversionnumber(Integer timezoneruleversionnumber){
this.timezoneruleversionnumber = timezoneruleversionnumber ;
this.modify("timezoneruleversionnumber",timezoneruleversionnumber);
}
/**
* 设置 [OVERRIDDENCREATEDON]
*/
public void setOverriddencreatedon(Timestamp overriddencreatedon){
this.overriddencreatedon = overriddencreatedon ;
this.modify("overriddencreatedon",overriddencreatedon);
}
/**
* 设置 [ANCHOROFFSET]
*/
public void setAnchoroffset(Integer anchoroffset){
this.anchoroffset = anchoroffset ;
this.modify("anchoroffset",anchoroffset);
}
/**
* 设置 [INITIALSTATUSCODE]
*/
public void setInitialstatuscode(Integer initialstatuscode){
this.initialstatuscode = initialstatuscode ;
this.modify("initialstatuscode",initialstatuscode);
}
/**
* 设置 [GRANULARITY]
*/
public void setGranularity(String granularity){
this.granularity = granularity ;
this.modify("granularity",granularity);
}
/**
* 设置 [DESCRIPTION]
*/
public void setDescription(String description){
this.description = description ;
this.modify("description",description);
}
/**
* 设置 [SHOWRESOURCES]
*/
public void setShowresources(Integer showresources){
this.showresources = showresources ;
this.modify("showresources",showresources);
}
/**
* 设置 [SERVICENAME]
*/
public void setServicename(String servicename){
this.servicename = servicename ;
this.modify("servicename",servicename);
}
/**
* 设置 [IMPORTSEQUENCENUMBER]
*/
public void setImportsequencenumber(Integer importsequencenumber){
this.importsequencenumber = importsequencenumber ;
this.modify("importsequencenumber",importsequencenumber);
}
/**
* 设置 [VISIBLE]
*/
public void setVisible(Integer visible){
this.visible = visible ;
this.modify("visible",visible);
}
/**
* 设置 [CALENDARID]
*/
public void setCalendarid(String calendarid){
this.calendarid = calendarid ;
this.modify("calendarid",calendarid);
}
/**
* 设置 [SCHEDULABLE]
*/
public void setSchedulable(Integer schedulable){
this.schedulable = schedulable ;
this.modify("schedulable",schedulable);
}
/**
* 设置 [STRATEGYID]
*/
public void setStrategyid(String strategyid){
this.strategyid = strategyid ;
this.modify("strategyid",strategyid);
}
/**
* 设置 [VERSIONNUMBER]
*/
public void setVersionnumber(BigInteger versionnumber){
this.versionnumber = versionnumber ;
this.modify("versionnumber",versionnumber);
}
/**
* 设置 [DURATION]
*/
public void setDuration(Integer duration){
this.duration = duration ;
this.modify("duration",duration);
}
/**
* 设置 [UTCCONVERSIONTIMEZONECODE]
*/
public void setUtcconversiontimezonecode(Integer utcconversiontimezonecode){
this.utcconversiontimezonecode = utcconversiontimezonecode ;
this.modify("utcconversiontimezonecode",utcconversiontimezonecode);
}
/**
* 设置 [RESOURCESPECID]
*/
public void setResourcespecid(String resourcespecid){
this.resourcespecid = resourcespecid ;
this.modify("resourcespecid",resourcespecid);
}
}
package cn.ibizlab.businesscentral.centralapi.mapping;
import org.mapstruct.*;
import cn.ibizlab.businesscentral.core.service.domain.IBizService;
import cn.ibizlab.businesscentral.centralapi.dto.IBizServiceDTO;
import cn.ibizlab.businesscentral.util.domain.MappingBase;
import org.mapstruct.factory.Mappers;
@Mapper(componentModel = "spring", uses = {},
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface IBizServiceMapping extends MappingBase<IBizServiceDTO, IBizService> {
}
package cn.ibizlab.businesscentral.centralapi.rest;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.ServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.http.HttpStatus;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PostAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import cn.ibizlab.businesscentral.centralapi.dto.*;
import cn.ibizlab.businesscentral.centralapi.mapping.*;
import cn.ibizlab.businesscentral.core.service.domain.IBizService;
import cn.ibizlab.businesscentral.core.service.service.IIBizServiceService;
import cn.ibizlab.businesscentral.core.service.filter.IBizServiceSearchContext;
@Slf4j
@Api(tags = {"服务" })
@RestController("CentralApi-ibizservice")
@RequestMapping("")
public class IBizServiceResource {
@Autowired
public IIBizServiceService ibizserviceService;
@Autowired
@Lazy
public IBizServiceMapping ibizserviceMapping;
@ApiOperation(value = "获取服务草稿", tags = {"服务" }, notes = "获取服务草稿")
@RequestMapping(method = RequestMethod.GET, value = "/ibizservices/getdraft")
public ResponseEntity<IBizServiceDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(ibizserviceMapping.toDto(ibizserviceService.getDraft(new IBizService())));
}
@PreAuthorize("hasPermission(this.ibizserviceService.get(#ibizservice_id),'iBizBusinessCentral-IBizService-Remove')")
@ApiOperation(value = "删除服务", tags = {"服务" }, notes = "删除服务")
@RequestMapping(method = RequestMethod.DELETE, value = "/ibizservices/{ibizservice_id}")
@Transactional
public ResponseEntity<Boolean> remove(@PathVariable("ibizservice_id") String ibizservice_id) {
return ResponseEntity.status(HttpStatus.OK).body(ibizserviceService.remove(ibizservice_id));
}
@PreAuthorize("hasPermission(this.ibizserviceService.getIbizserviceByIds(#ids),'iBizBusinessCentral-IBizService-Remove')")
@ApiOperation(value = "批量删除服务", tags = {"服务" }, notes = "批量删除服务")
@RequestMapping(method = RequestMethod.DELETE, value = "/ibizservices/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
ibizserviceService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "检查服务", tags = {"服务" }, notes = "检查服务")
@RequestMapping(method = RequestMethod.POST, value = "/ibizservices/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody IBizServiceDTO ibizservicedto) {
return ResponseEntity.status(HttpStatus.OK).body(ibizserviceService.checkKey(ibizserviceMapping.toDomain(ibizservicedto)));
}
@PreAuthorize("hasPermission(this.ibizserviceMapping.toDomain(#ibizservicedto),'iBizBusinessCentral-IBizService-Save')")
@ApiOperation(value = "保存服务", tags = {"服务" }, notes = "保存服务")
@RequestMapping(method = RequestMethod.POST, value = "/ibizservices/save")
public ResponseEntity<Boolean> save(@RequestBody IBizServiceDTO ibizservicedto) {
return ResponseEntity.status(HttpStatus.OK).body(ibizserviceService.save(ibizserviceMapping.toDomain(ibizservicedto)));
}
@PreAuthorize("hasPermission(this.ibizserviceMapping.toDomain(#ibizservicedtos),'iBizBusinessCentral-IBizService-Save')")
@ApiOperation(value = "批量保存服务", tags = {"服务" }, notes = "批量保存服务")
@RequestMapping(method = RequestMethod.POST, value = "/ibizservices/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<IBizServiceDTO> ibizservicedtos) {
ibizserviceService.saveBatch(ibizserviceMapping.toDomain(ibizservicedtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasPermission(this.ibizserviceService.get(#ibizservice_id),'iBizBusinessCentral-IBizService-Update')")
@ApiOperation(value = "更新服务", tags = {"服务" }, notes = "更新服务")
@RequestMapping(method = RequestMethod.PUT, value = "/ibizservices/{ibizservice_id}")
@Transactional
public ResponseEntity<IBizServiceDTO> update(@PathVariable("ibizservice_id") String ibizservice_id, @RequestBody IBizServiceDTO ibizservicedto) {
IBizService domain = ibizserviceMapping.toDomain(ibizservicedto);
domain .setServiceid(ibizservice_id);
ibizserviceService.update(domain );
IBizServiceDTO dto = ibizserviceMapping.toDto(domain );
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.ibizserviceService.getIbizserviceByEntities(this.ibizserviceMapping.toDomain(#ibizservicedtos)),'iBizBusinessCentral-IBizService-Update')")
@ApiOperation(value = "批量更新服务", tags = {"服务" }, notes = "批量更新服务")
@RequestMapping(method = RequestMethod.PUT, value = "/ibizservices/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<IBizServiceDTO> ibizservicedtos) {
ibizserviceService.updateBatch(ibizserviceMapping.toDomain(ibizservicedtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasPermission(this.ibizserviceMapping.toDomain(#ibizservicedto),'iBizBusinessCentral-IBizService-Create')")
@ApiOperation(value = "新建服务", tags = {"服务" }, notes = "新建服务")
@RequestMapping(method = RequestMethod.POST, value = "/ibizservices")
@Transactional
public ResponseEntity<IBizServiceDTO> create(@RequestBody IBizServiceDTO ibizservicedto) {
IBizService domain = ibizserviceMapping.toDomain(ibizservicedto);
ibizserviceService.create(domain);
IBizServiceDTO dto = ibizserviceMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(this.ibizserviceMapping.toDomain(#ibizservicedtos),'iBizBusinessCentral-IBizService-Create')")
@ApiOperation(value = "批量新建服务", tags = {"服务" }, notes = "批量新建服务")
@RequestMapping(method = RequestMethod.POST, value = "/ibizservices/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<IBizServiceDTO> ibizservicedtos) {
ibizserviceService.createBatch(ibizserviceMapping.toDomain(ibizservicedtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PostAuthorize("hasPermission(this.ibizserviceMapping.toDomain(returnObject.body),'iBizBusinessCentral-IBizService-Get')")
@ApiOperation(value = "获取服务", tags = {"服务" }, notes = "获取服务")
@RequestMapping(method = RequestMethod.GET, value = "/ibizservices/{ibizservice_id}")
public ResponseEntity<IBizServiceDTO> get(@PathVariable("ibizservice_id") String ibizservice_id) {
IBizService domain = ibizserviceService.get(ibizservice_id);
IBizServiceDTO dto = ibizserviceMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-IBizService-Default-all')")
@ApiOperation(value = "获取DEFAULT", tags = {"服务" } ,notes = "获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/ibizservices/fetchdefault")
public ResponseEntity<List<IBizServiceDTO>> fetchDefault(IBizServiceSearchContext context) {
Page<IBizService> domains = ibizserviceService.searchDefault(context) ;
List<IBizServiceDTO> list = ibizserviceMapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-IBizService-Default-all')")
@ApiOperation(value = "查询DEFAULT", tags = {"服务" } ,notes = "查询DEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/ibizservices/searchdefault")
public ResponseEntity<Page<IBizServiceDTO>> searchDefault(@RequestBody IBizServiceSearchContext context) {
Page<IBizService> domains = ibizserviceService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(ibizserviceMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册