提交 939b1d17 编写于 作者: ibizdev's avatar ibizdev

chitanda 发布系统代码

上级 cfa4ba28
......@@ -149,6 +149,16 @@
"viewtag": "15d12c1173fcb6e742b6a6d92cbc53ed",
"memo": ""
},
"competitoroptionview": {
"title": "竞争对手选项操作视图",
"caption": "竞争对手",
"viewtype": "DEOPTVIEW",
"viewmodule": "Sales",
"viewname": "CompetitorOptionView",
"viewfilename": "competitor-option-view",
"viewtag": "172607e680c007004183ab01c1a674d6",
"memo": ""
},
"opportunitydashboardview": {
"title": "商机数据看板视图",
"caption": "商机",
......
......@@ -84,6 +84,10 @@ export default {
transactioncurrencyname: '货币',
},
views: {
optionview: {
caption: "竞争对手",
title: '竞争对手选项操作视图',
},
gridview: {
caption: "竞争对手",
title: '竞争对手表格视图',
......@@ -93,6 +97,32 @@ export default {
title: '竞争对手编辑视图',
},
},
quickcreate_form: {
details: {
group1: "竞争对手基本信息",
formpage1: "基本信息",
srfupdatedate: "更新时间",
srforikey: "",
srfkey: "竞争对手",
srfmajortext: "竞争对手名称",
srftempmode: "",
srfuf: "",
srfdeid: "",
srfsourcekey: "",
competitorname: "竞争对手名称",
websiteurl: "网站",
transactioncurrencyname: "货币",
address1_postalcode: "邮政编码",
address1_country: "国家/地区",
address1_stateorprovince: "省/直辖市/自治区",
address1_city: "市/县",
address1_line1: "街道",
transactioncurrencyid: "货币",
competitorid: "竞争对手",
},
uiactions: {
},
},
main_form: {
details: {
group1: "competitor基本信息",
......@@ -120,8 +150,7 @@ export default {
main_grid: {
columns: {
competitorname: "竞争对手名称",
updateman: "更新人",
updatedate: "更新时间",
websiteurl: "网站",
},
uiactions: {
},
......@@ -134,9 +163,13 @@ export default {
},
},
gridviewtoolbar_toolbar: {
tbitem3: {
caption: "New",
tip: "New",
tbitem1_openquickcreateview: {
caption: "新建",
tip: "新建",
},
tbitem2: {
caption: "-",
tip: "",
},
tbitem4: {
caption: "Edit",
......
......@@ -83,6 +83,10 @@ export default {
transactioncurrencyname: '货币',
},
views: {
optionview: {
caption: '竞争对手',
title: '竞争对手选项操作视图',
},
gridview: {
caption: '竞争对手',
title: '竞争对手表格视图',
......@@ -92,6 +96,32 @@ export default {
title: '竞争对手编辑视图',
},
},
quickcreate_form: {
details: {
group1: '竞争对手基本信息',
formpage1: '基本信息',
srfupdatedate: '更新时间',
srforikey: '',
srfkey: '竞争对手',
srfmajortext: '竞争对手名称',
srftempmode: '',
srfuf: '',
srfdeid: '',
srfsourcekey: '',
competitorname: '竞争对手名称',
websiteurl: '网站',
transactioncurrencyname: '货币',
address1_postalcode: '邮政编码',
address1_country: '国家/地区',
address1_stateorprovince: '省/直辖市/自治区',
address1_city: '市/县',
address1_line1: '街道',
transactioncurrencyid: '货币',
competitorid: '竞争对手',
},
uiactions: {
},
},
main_form: {
details: {
group1: 'competitor基本信息',
......@@ -119,8 +149,7 @@ export default {
main_grid: {
columns: {
competitorname: '竞争对手名称',
updateman: '更新人',
updatedate: '更新时间',
websiteurl: '网站',
},
uiactions: {
},
......@@ -133,10 +162,14 @@ export default {
},
},
gridviewtoolbar_toolbar: {
tbitem3: {
tbitem1_openquickcreateview: {
caption: '新建',
tip: '新建',
},
tbitem2: {
caption: '-',
tip: '',
},
tbitem4: {
caption: '编辑',
tip: '编辑',
......
......@@ -127,6 +127,14 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "LeadGridView",
"viewtag": "15d12c1173fcb6e742b6a6d92cbc53ed"
},
"competitoroptionview": {
"title": "竞争对手选项操作视图",
"caption": "竞争对手",
"viewtype": "DEOPTVIEW",
"viewmodule": "Sales",
"viewname": "CompetitorOptionView",
"viewtag": "172607e680c007004183ab01c1a674d6"
},
"opportunitydashboardview": {
"title": "商机数据看板视图",
"caption": "商机",
......
......@@ -63,6 +63,7 @@ import CompetitorService from '@/service/competitor/competitor-service';
import GridViewEngine from '@engine/view/grid-view-engine';
import CompetitorUIService from '@/uiservice/competitor/competitor-ui-service';
import CodeListService from "@service/app/codelist-service";
......@@ -149,8 +150,9 @@ export default class CompetitorGridViewBase extends GridViewBase {
* @memberof CompetitorGridView
*/
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: '' },
tbitem1_openquickcreateview: { name: 'tbitem1_openquickcreateview', caption: '新建','isShowCaption':true,'isShowIcon':true, tooltip: '新建', iconcls: 'fa fa-user-plus', icon: '', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'OpenQuickCreateView', target: 'NONE' }, class: '' },
tbitem2: { name: 'tbitem2', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
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: '' },
......@@ -208,8 +210,8 @@ export default class CompetitorGridViewBase extends GridViewBase {
* @memberof CompetitorGridViewBase
*/
public toolbar_click($event: any, $event2?: any): void {
if (Object.is($event.tag, 'tbitem3')) {
this.toolbar_tbitem3_click(null, '', $event2);
if (Object.is($event.tag, 'tbitem1_openquickcreateview')) {
this.toolbar_tbitem1_openquickcreateview_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem4')) {
this.toolbar_tbitem4_click(null, '', $event2);
......@@ -217,12 +219,6 @@ export default class CompetitorGridViewBase extends GridViewBase {
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);
}
......@@ -333,7 +329,7 @@ export default class CompetitorGridViewBase extends GridViewBase {
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem3_click(params: any = {}, tag?: any, $event?: any) {
public toolbar_tbitem1_openquickcreateview_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
......@@ -350,7 +346,8 @@ export default class CompetitorGridViewBase extends GridViewBase {
datas = [params];
}
// 界面行为
this.New(datas, contextJO,paramJO, $event, xData,this,"Competitor");
const curUIService:CompetitorUIService = new CompetitorUIService();
curUIService.Competitor_OpenQuickCreateView(datas,contextJO, paramJO, $event, xData,this,"Competitor");
}
/**
......@@ -409,62 +406,6 @@ export default class CompetitorGridViewBase extends GridViewBase {
this.Copy(datas, contextJO,paramJO, $event, xData,this,"Competitor");
}
/**
* 逻辑事件
*
* @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,"Competitor");
}
/**
* 逻辑事件
*
* @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,"Competitor");
}
/**
* 逻辑事件
*
......@@ -602,7 +543,7 @@ export default class CompetitorGridViewBase extends GridViewBase {
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'competitors', parameterName: 'competitor' },
{ pathName: 'editview', parameterName: 'editview' },
{ pathName: 'optionview', parameterName: 'optionview' },
];
const _this: any = this;
const openIndexViewTab = (data: any) => {
......@@ -647,26 +588,6 @@ export default class CompetitorGridViewBase extends GridViewBase {
}
/**
* 新建
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof CompetitorGridViewBase
*/
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 视图处理逻辑不存在,请添加!' });
}
}
/**
* 编辑
*
......@@ -725,42 +646,6 @@ export default class CompetitorGridViewBase extends GridViewBase {
_this.$Notice.error({ title: '错误', desc: 'opendata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 行编辑
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof CompetitorGridViewBase
*/
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 CompetitorGridViewBase
*/
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 视图处理逻辑不存在,请添加!' });
}
}
/**
* 删除
*
......
<template>
<studio-view-style2 viewName="competitoroptionview" viewTitle="竞争对手选项操作视图" class='deoptview competitor-option-view'>
<template slot='title'>
<span class='caption-info'>{{$t(model.srfTitle)}}</span>
</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>
<template slot="footer">
<div class="option-view-footer-actions">
<i-button type='primary' @click="onClickOk">{{ containerModel.view_okbtn.text }}</i-button>
&nbsp;&nbsp;
<i-button @click="onClickCancel">{{ containerModel.view_cancelbtn.text }}</i-button>
</div>
</template>
</studio-view-style2>
</template>
<script lang='tsx'>
import { Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { Subject } from 'rxjs';
import { UIActionTool, Util } from '@/utils';
import { VueLifeCycleProcessing, OptionViewBase } from '@/studio-core';
import CompetitorService from '@/service/competitor/competitor-service';
import OptionViewEngine from '@engine/view/option-view-engine';
/**
* 竞争对手选项操作视图视图基类
*
* @export
* @class CompetitorOptionViewBase
* @extends {OptionViewBase}
*/
@Component({})
@VueLifeCycleProcessing()
export default class CompetitorOptionViewBase extends OptionViewBase {
/**
* 实体服务对象
*
* @type {CompetitorService}
* @memberof CompetitorOptionViewBase
*/
protected appEntityService: CompetitorService = new CompetitorService;
/**
* 计数器服务对象集合
*
* @protected
* @type {Array<*>}
* @memberof CompetitorOptionViewBase
*/
protected counterServiceArray: Array<any> = [];
/**
* 自定义视图导航上下文集合
*
* @protected
* @type {*}
* @memberof CompetitorOptionViewBase
*/
protected customViewNavContexts: any = {
};
/**
* 自定义视图导航参数集合
*
* @protected
* @type {*}
* @memberof CompetitorOptionViewBase
*/
protected customViewParams: any = {
};
/**
* 视图模型数据
*
* @protected
* @type {*}
* @memberof CompetitorOptionViewBase
*/
protected model: any = {
srfCaption: 'entities.competitor.views.optionview.caption',
srfTitle: 'entities.competitor.views.optionview.title',
srfSubTitle: 'entities.competitor.views.optionview.subtitle',
dataInfo: ''
}
/**
* 容器模型
*
* @protected
* @type {*}
* @memberof CompetitorOptionViewBase
*/
protected containerModel: any = {
view_form: { name: 'form', type: 'FORM' },
view_okbtn: { name: 'okbtn', type: 'button', text: '确定', disabled: true },
view_cancelbtn: { name: 'cancelbtn', type: 'button', text: '取消', disabled: false },
view_leftbtn: { name: 'leftbtn', type: 'button', text: '左移', disabled: true },
view_rightbtn: { name: 'rightbtn', type: 'button', text: '右移', disabled: true },
view_allleftbtn: { name: 'allleftbtn', type: 'button', text: '全部左移', disabled: true },
view_allrightbtn: { name: 'allrightbtn', type: 'button', text: '全部右移', disabled: true },
};
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof CompetitorOptionViewBase
*/
public engine: OptionViewEngine = new OptionViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof CompetitorOptionViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
form: this.$refs.form,
p2k: '0',
keyPSDEField: 'competitor',
majorPSDEField: 'competitorname',
isLoadDefault: true,
});
}
/**
* form 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof CompetitorOptionViewBase
*/
public form_save($event: any, $event2?: any): void {
this.engine.onCtrlEvent('form', 'save', $event);
}
/**
* form 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof CompetitorOptionViewBase
*/
public form_remove($event: any, $event2?: any): void {
this.engine.onCtrlEvent('form', 'remove', $event);
}
/**
* form 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof CompetitorOptionViewBase
*/
public form_load($event: any, $event2?: any): void {
this.engine.onCtrlEvent('form', 'load', $event);
}
}
</script>
<style lang='less'>
@import './competitor-option-view.less';
</style>
\ No newline at end of file
.option-view {
--option-view: 0;
}
// 避免空文件,后台不让空文件过
.competitor-option-view {
--competitor-option-view: 0;
}
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import CompetitorOptionViewBase from './competitor-option-view-base.vue';
import view_form from '@widgets/competitor/quick-create-form/quick-create-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 CompetitorOptionView extends CompetitorOptionViewBase {
}
</script>
\ No newline at end of file
......@@ -2,6 +2,7 @@ export const PageComponents = {
install(Vue: any, opt: any) {
Vue.component('account-quick-create', () => import('@pages/base/account-quick-create/account-quick-create.vue'));
Vue.component('list-account-by-list', () => import('@pages/marketing/list-account-by-list/list-account-by-list.vue'));
Vue.component('competitor-option-view', () => import('@pages/sales/competitor-option-view/competitor-option-view.vue'));
Vue.component('campaign-response-by-parent-key', () => import('@pages/marketing/campaign-response-by-parent-key/campaign-response-by-parent-key.vue'));
Vue.component('account-edit-view', () => import('@pages/base/account-edit-view/account-edit-view.vue'));
Vue.component('lead-pickup-view', () => import('@pages/sales/lead-pickup-view/lead-pickup-view.vue'));
......@@ -14,8 +15,8 @@ export const PageComponents = {
Vue.component('contact-info-person', () => import('@pages/base/contact-info-person/contact-info-person.vue'));
Vue.component('campaign-info-schedule', () => import('@pages/marketing/campaign-info-schedule/campaign-info-schedule.vue'));
Vue.component('opportunity-grid-view', () => import('@pages/sales/opportunity-grid-view/opportunity-grid-view.vue'));
Vue.component('goal-edit-view', () => import('@pages/sales/goal-edit-view/goal-edit-view.vue'));
Vue.component('letter-edit-view', () => import('@pages/base/letter-edit-view/letter-edit-view.vue'));
Vue.component('goal-edit-view', () => import('@pages/sales/goal-edit-view/goal-edit-view.vue'));
Vue.component('transaction-currency-pickup-view', () => import('@pages/base/transaction-currency-pickup-view/transaction-currency-pickup-view.vue'));
Vue.component('opportunity-product-edit-view', () => import('@pages/sales/opportunity-product-edit-view/opportunity-product-edit-view.vue'));
Vue.component('email-edit-view', () => import('@pages/base/email-edit-view/email-edit-view.vue'));
......
......@@ -93,6 +93,20 @@ const router = new Router({
},
component: () => import('@pages/marketing/list-account-by-list/list-account-by-list.vue'),
},
{
path: 'competitors/:competitor?/optionview/:optionview?',
meta: {
caption: 'entities.competitor.views.optionview.title',
info:'',
parameters: [
{ pathName: 'central', parameterName: 'central' },
{ pathName: 'competitors', parameterName: 'competitor' },
{ pathName: 'optionview', parameterName: 'optionview' },
],
requireAuth: true,
},
component: () => import('@pages/sales/competitor-option-view/competitor-option-view.vue'),
},
{
path: 'campaignresponses/:campaignresponse?/byparentkey/:byparentkey?',
meta: {
......@@ -430,32 +444,32 @@ const router = new Router({
component: () => import('@pages/sales/opportunity-grid-view/opportunity-grid-view.vue'),
},
{
path: 'goals/:goal?/editview/:editview?',
path: 'letters/:letter?/editview/:editview?',
meta: {
caption: 'entities.goal.views.editview.title',
caption: 'entities.letter.views.editview.title',
info:'',
parameters: [
{ pathName: 'central', parameterName: 'central' },
{ pathName: 'goals', parameterName: 'goal' },
{ pathName: 'letters', parameterName: 'letter' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/sales/goal-edit-view/goal-edit-view.vue'),
component: () => import('@pages/base/letter-edit-view/letter-edit-view.vue'),
},
{
path: 'letters/:letter?/editview/:editview?',
path: 'goals/:goal?/editview/:editview?',
meta: {
caption: 'entities.letter.views.editview.title',
caption: 'entities.goal.views.editview.title',
info:'',
parameters: [
{ pathName: 'central', parameterName: 'central' },
{ pathName: 'letters', parameterName: 'letter' },
{ pathName: 'goals', parameterName: 'goal' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/base/letter-edit-view/letter-edit-view.vue'),
component: () => import('@pages/sales/goal-edit-view/goal-edit-view.vue'),
},
{
path: 'transactioncurrencies/:transactioncurrency?/pickupview/:pickupview?',
......@@ -3575,6 +3589,19 @@ const router = new Router({
},
component: () => import('@pages/sales/lead-grid-view/lead-grid-view.vue'),
},
{
path: '/competitors/:competitor?/optionview/:optionview?',
meta: {
caption: 'entities.competitor.views.optionview.title',
info:'',
parameters: [
{ pathName: 'competitors', parameterName: 'competitor' },
{ pathName: 'optionview', parameterName: 'optionview' },
],
requireAuth: true,
},
component: () => import('@pages/sales/competitor-option-view/competitor-option-view.vue'),
},
{
path: '/accounts/:account?/contacts/:contact?/opportunities/:opportunity?/dashboardview/:dashboardview?',
meta: {
......
......@@ -155,6 +155,16 @@ export const viewstate: any = {
'4745ca10fe4421ea043cb9ace1840224',
],
},
{
viewtag: '172607e680c007004183ab01c1a674d6',
viewmodule: 'Sales',
viewname: 'CompetitorOptionView',
viewaction: '',
viewdatachange: false,
refviews: [
'da3f8c1f20f440f3df54d6c13a8de586',
],
},
{
viewtag: '177c00d1674621e8933efe6db68bce0e',
viewmodule: 'Sales',
......@@ -1094,6 +1104,7 @@ export const viewstate: any = {
viewdatachange: false,
refviews: [
'fc2117de593df9cc982bd802cbdb2154',
'172607e680c007004183ab01c1a674d6',
],
},
{
......
......@@ -79,6 +79,7 @@ export default class CompetitorUIServiceBase extends UIService {
* @memberof CompetitorUIServiceBase
*/
public initViewMap(){
this.allViewMap.set(':',{viewname:'optionview',srfappde:'competitors'});
this.allViewMap.set('MDATAVIEW:',{viewname:'gridview',srfappde:'competitors'});
this.allViewMap.set('EDITVIEW:',{viewname:'editview',srfappde:'competitors'});
}
......@@ -91,6 +92,51 @@ export default class CompetitorUIServiceBase extends UIService {
public initDeMainStateMap(){
}
/**
* 新建
*
* @param {any[]} args 当前数据
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
* @returns {Promise<any>}
*/
public async Competitor_OpenQuickCreateView(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 = 'NONE';
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: 'competitors', parameterName: 'competitor' },
{ pathName: 'optionview', parameterName: 'optionview' },
];
const openIndexViewTab = (data: any) => {
const routePath = actionContext.$viewTool.buildUpRoutePath(actionContext.$route, context, deResParameters, parameters, _args, data);
actionContext.$router.push(routePath);
return null;
}
openIndexViewTab(data);
}
/**
* 获取指定数据的重定向页面
......
......@@ -63,7 +63,7 @@
</i-col>
<i-col v-show="detailsModel.grouppanel5.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 24, offset: 0 }" :lg="{ span: 24, offset: 0 }" :xl="{ span: 24, offset: 0 }">
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.grouppanel5.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.account.info_all_form.details.grouppanel5')" :isShowCaption="true" uiStyle="STYLE4" :titleBarCloseMode="1" :isInfoGroupMode="true" >
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.grouppanel5.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.account.info_all_form.details.grouppanel5')" :isShowCaption="false" uiStyle="STYLE4" :titleBarCloseMode="1" :isInfoGroupMode="true" >
<row>
<i-col v-show="detailsModel.industrycode1.visible" :style="{}" :md="{ span: 12, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 6, offset: 0 }">
<app-form-item name='industrycode1' :itemRules="this.rules.industrycode1" class='' :caption="$t('entities.account.info_all_form.details.industrycode1')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.industrycode1.error" :isEmptyCaption="false" labelPos="LEFT">
......@@ -1094,7 +1094,7 @@ export default class Info_AllBase extends Vue implements ControlInterface {
* @memberof Info_All
*/
public detailsModel: any = {
grouppanel5: new FormGroupPanelModel({ caption: '简介', detailType: 'GROUPPANEL', name: 'grouppanel5', visible: true, isShowCaption: true, form: this, uiActionGroup: { caption: '', langbase: 'entities.account.info_all_form', extractMode: 'ITEM', details: [] } })
grouppanel5: new FormGroupPanelModel({ caption: '简介', detailType: 'GROUPPANEL', name: 'grouppanel5', visible: true, isShowCaption: false, form: this, uiActionGroup: { caption: '', langbase: 'entities.account.info_all_form', extractMode: 'ITEM', details: [] } })
,
group1: new FormGroupPanelModel({ caption: '账户信息', detailType: 'GROUPPANEL', name: 'group1', visible: true, isShowCaption: true, form: this, uiActionGroup: { caption: '编辑_账户信息', langbase: 'entities.account.info_all_form', extractMode: 'ITEM', details: [{ name: 'group1_uc040f39', caption: '编辑', uiactiontag: 'edit_accountinfo', icon: 'fa fa-pencil',isShowCaption:false,isShowIcon:true }] } })
,
......
......@@ -24,7 +24,7 @@
<el-table-column align="center" type='selection' :width="checkboxColWidth"></el-table-column>
</template>
<template v-if="getColumnState('competitorname')">
<el-table-column show-overflow-tooltip :prop="'competitorname'" :label="$t('entities.competitor.main_grid.columns.competitorname')" :width="150" :align="'left'" :sortable="'custom'">
<el-table-column show-overflow-tooltip :prop="'competitorname'" :label="$t('entities.competitor.main_grid.columns.competitorname')" :width="160" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.competitor.main_grid.columns.competitorname')}}
......@@ -35,29 +35,15 @@
</template>
</el-table-column>
</template>
<template v-if="getColumnState('updateman')">
<el-table-column show-overflow-tooltip :prop="'updateman'" :label="$t('entities.competitor.main_grid.columns.updateman')" :width="150" :align="'left'" :sortable="'custom'">
<template v-if="getColumnState('websiteurl')">
<el-table-column show-overflow-tooltip :prop="'websiteurl'" :label="$t('entities.competitor.main_grid.columns.websiteurl')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.competitor.main_grid.columns.updateman')}}
{{$t('entities.competitor.main_grid.columns.websiteurl')}}
</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.competitor.main_grid.columns.updatedate')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.competitor.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>
<span>{{row.websiteurl}}</span>
</template>
</el-table-column>
</template>
......@@ -546,16 +532,9 @@ export default class MainBase extends Vue implements ControlInterface {
util: 'PX'
},
{
name: 'updateman',
label: '更新人',
langtag: 'entities.competitor.main_grid.columns.updateman',
show: true,
util: 'PX'
},
{
name: 'updatedate',
label: '更新时间',
langtag: 'entities.competitor.main_grid.columns.updatedate',
name: 'websiteurl',
label: '网站',
langtag: 'entities.competitor.main_grid.columns.websiteurl',
show: true,
util: 'PX'
},
......@@ -946,14 +925,6 @@ export default class MainBase extends Vue implements ControlInterface {
*/
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) {
......
......@@ -32,8 +32,8 @@ export default class MainModel {
dataType: 'TEXT',
},
{
name: 'updateman',
prop: 'updateman',
name: 'websiteurl',
prop: 'websiteurl',
dataType: 'TEXT',
},
{
......@@ -41,11 +41,6 @@ export default class MainModel {
prop: 'transactioncurrencyid',
dataType: 'PICKUP',
},
{
name: 'updatedate',
prop: 'updatedate',
dataType: 'DATETIME',
},
{
name: 'srfmajortext',
prop: 'competitorname',
......
<template>
<i-form :model="this.data" class='app-form' ref='form' id='competitor_quickcreate' style="">
<input style="display:none;" />
<row >
<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.competitor.quickcreate_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.competitorname.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 12, offset: 0 }">
<app-form-item name='competitorname' :itemRules="this.rules.competitorname" class='' :caption="$t('entities.competitor.quickcreate_form.details.competitorname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.competitorname.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.competitorname" @enter="onEnter($event)" unit="" :disabled="detailsModel.competitorname.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.websiteurl.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 12, offset: 0 }">
<app-form-item name='websiteurl' :itemRules="this.rules.websiteurl" class='' :caption="$t('entities.competitor.quickcreate_form.details.websiteurl')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.websiteurl.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.websiteurl" @enter="onEnter($event)" unit="" :disabled="detailsModel.websiteurl.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.transactioncurrencyname.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 12, offset: 0 }">
<app-form-item name='transactioncurrencyname' :itemRules="this.rules.transactioncurrencyname" class='' :caption="$t('entities.competitor.quickcreate_form.details.transactioncurrencyname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.transactioncurrencyname.error" :isEmptyCaption="false" labelPos="LEFT">
<app-picker
:formState="formState"
:data="data"
:context="context"
:viewparams="viewparams"
:localContext ='{ }'
:localParam ='{ }'
:disabled="detailsModel.transactioncurrencyname.disabled"
name='transactioncurrencyname'
deMajorField='currencyname'
deKeyField='transactioncurrency'
:service="service"
:acParams="{ serviceName: 'TransactionCurrencyService', interfaceName: 'FetchDefault'}"
valueitem='transactioncurrencyid'
:value="data.transactioncurrencyname"
editortype=""
:pickupView="{ viewname: 'transaction-currency-pickup-view', title: $t('entities.transactioncurrency.views.pickupview.title'), deResParameters: [], parameters: [{ pathName: 'transactioncurrencies', parameterName: 'transactioncurrency' }, { pathName: 'pickupview', parameterName: 'pickupview' } ], placement:'' }"
style=""
@formitemvaluechange="onFormItemValueChange">
</app-picker>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.address1_postalcode.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 12, offset: 0 }">
<app-form-item name='address1_postalcode' :itemRules="this.rules.address1_postalcode" class='' :caption="$t('entities.competitor.quickcreate_form.details.address1_postalcode')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.address1_postalcode.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.address1_postalcode" @enter="onEnter($event)" unit="" :disabled="detailsModel.address1_postalcode.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.address1_country.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 12, offset: 0 }">
<app-form-item name='address1_country' :itemRules="this.rules.address1_country" class='' :caption="$t('entities.competitor.quickcreate_form.details.address1_country')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.address1_country.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.address1_country" @enter="onEnter($event)" unit="" :disabled="detailsModel.address1_country.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.address1_stateorprovince.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 12, offset: 0 }">
<app-form-item name='address1_stateorprovince' :itemRules="this.rules.address1_stateorprovince" class='' :caption="$t('entities.competitor.quickcreate_form.details.address1_stateorprovince')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.address1_stateorprovince.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.address1_stateorprovince" @enter="onEnter($event)" unit="" :disabled="detailsModel.address1_stateorprovince.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.address1_city.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 12, offset: 0 }">
<app-form-item name='address1_city' :itemRules="this.rules.address1_city" class='' :caption="$t('entities.competitor.quickcreate_form.details.address1_city')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.address1_city.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.address1_city" @enter="onEnter($event)" unit="" :disabled="detailsModel.address1_city.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.address1_line1.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 12, offset: 0 }">
<app-form-item name='address1_line1' :itemRules="this.rules.address1_line1" class='' :caption="$t('entities.competitor.quickcreate_form.details.address1_line1')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.address1_line1.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.address1_line1" @enter="onEnter($event)" unit="" :disabled="detailsModel.address1_line1.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
</row>
</app-form-group>
</i-col>
</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 CompetitorService from '@/service/competitor/competitor-service';
import QuickCreateService from './quick-create-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 QuickCreateBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof QuickCreate
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof QuickCreate
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof QuickCreate
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof QuickCreate
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof QuickCreate
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof QuickCreate
*/
public getControlType(): string {
return 'FORM'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof QuickCreate
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {QuickCreateService}
* @memberof QuickCreate
*/
public service: QuickCreateService = new QuickCreateService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {CompetitorService}
* @memberof QuickCreate
*/
public appEntityService: CompetitorService = new CompetitorService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof QuickCreate
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof QuickCreate
*/
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 QuickCreate
*/
public srfwfmemo:string = "";
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof QuickCreate
*/
public getDatas(): any[] {
return [this.data];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof QuickCreate
*/
public getData(): any {
return this.data;
}
/**
* 是否默认保存
*
* @type {boolean}
* @memberof QuickCreate
*/
@Prop({ default: false }) public autosave?: boolean;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof QuickCreate
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--submit
*
* @type {string}
* @memberof QuickCreate
*/
@Prop() public WFSubmitAction!: string;
/**
* 部件行为--start
*
* @type {string}
* @memberof QuickCreate
*/
@Prop() public WFStartAction!: string;
/**
* 部件行为--update
*
* @type {string}
* @memberof QuickCreate
*/
@Prop() public updateAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof QuickCreate
*/
@Prop() public removeAction!: string;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof QuickCreate
*/
@Prop() public loaddraftAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof QuickCreate
*/
@Prop() public loadAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof QuickCreate
*/
@Prop() public createAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof QuickCreate
*/
@Prop() public searchAction!: string;
/**
* 视图标识
*
* @type {string}
* @memberof QuickCreate
*/
@Prop() public viewtag!: string;
/**
* 表单状态
*
* @type {Subject<any>}
* @memberof QuickCreate
*/
public formState: Subject<any> = new Subject();
/**
* 忽略表单项值变化
*
* @type {boolean}
* @memberof QuickCreate
*/
public ignorefieldvaluechange: boolean = false;
/**
* 数据变化
*
* @public
* @type {Subject<any>}
* @memberof QuickCreate
*/
public dataChang: Subject<any> = new Subject();
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof QuickCreate
*/
public dataChangEvent: Subscription | undefined;
/**
* 原始数据
*
* @public
* @type {*}
* @memberof QuickCreate
*/
public oldData: any = {};
/**
* 表单数据对象
*
* @type {*}
* @memberof QuickCreate
*/
public data: any = {
srfupdatedate: null,
srforikey: null,
srfkey: null,
srfmajortext: null,
srftempmode: null,
srfuf: null,
srfdeid: null,
srfsourcekey: null,
competitorname: null,
websiteurl: null,
transactioncurrencyname: null,
address1_postalcode: null,
address1_country: null,
address1_stateorprovince: null,
address1_city: null,
address1_line1: null,
transactioncurrencyid: null,
competitorid: null,
competitor:null,
};
/**
* 当前执行的行为逻辑
*
* @type {string}
* @memberof QuickCreate
*/
public currentAction: string = "";
/**
* 关系界面计数器
*
* @type {number}
* @memberof QuickCreate
*/
public drcounter: number = 0;
/**
* 需要等待关系界面保存时,第一次调用save参数的备份
*
* @type {number}
* @memberof QuickCreate
*/
public drsaveopt: any = {};
/**
* 表单保存回调存储对象
*
* @type {any}
* @memberof QuickCreate
*/
public saveState:any ;
/**
* 属性值规则
*
* @type {*}
* @memberof QuickCreate
*/
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: '竞争对手名称 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '竞争对手名称 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '竞争对手名称 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '竞争对手名称 值不能为空', 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' },
],
competitorname: [
{ type: 'string', message: '竞争对手名称 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '竞争对手名称 值必须为字符串类型', trigger: 'blur' },
{ required: true, type: 'string', message: '竞争对手名称 值不能为空', trigger: 'change' },
{ required: true, type: 'string', message: '竞争对手名称 值不能为空', trigger: 'blur' },
],
websiteurl: [
{ type: 'string', message: '网站 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '网站 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '网站 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '网站 值不能为空', trigger: 'blur' },
],
transactioncurrencyname: [
{ type: 'string', message: '货币 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '货币 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '货币 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '货币 值不能为空', trigger: 'blur' },
],
address1_postalcode: [
{ type: 'string', message: '邮政编码 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '邮政编码 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '邮政编码 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '邮政编码 值不能为空', trigger: 'blur' },
],
address1_country: [
{ type: 'string', message: '国家/地区 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '国家/地区 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '国家/地区 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '国家/地区 值不能为空', trigger: 'blur' },
],
address1_stateorprovince: [
{ type: 'string', message: '省/直辖市/自治区 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '省/直辖市/自治区 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '省/直辖市/自治区 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '省/直辖市/自治区 值不能为空', trigger: 'blur' },
],
address1_city: [
{ type: 'string', message: '市/县 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '市/县 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '市/县 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '市/县 值不能为空', trigger: 'blur' },
],
address1_line1: [
{ type: 'string', message: '街道 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '街道 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '街道 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '街道 值不能为空', trigger: 'blur' },
],
transactioncurrencyid: [
{ type: 'string', message: '货币 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '货币 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '货币 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '货币 值不能为空', trigger: 'blur' },
],
competitorid: [
{ 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 QuickCreate
*/
public detailsModel: any = {
group1: new FormGroupPanelModel({ caption: '竞争对手基本信息', detailType: 'GROUPPANEL', name: 'group1', visible: true, isShowCaption: false, form: this, uiActionGroup: { caption: '', langbase: 'entities.competitor.quickcreate_form', extractMode: 'ITEM', details: [] } })
,
formpage1: new FormPageModel({ caption: '基本信息', detailType: 'FORMPAGE', name: 'formpage1', 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: '竞争对手名称', 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 })
,
competitorname: new FormItemModel({ caption: '竞争对手名称', detailType: 'FORMITEM', name: 'competitorname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
websiteurl: new FormItemModel({ caption: '网站', detailType: 'FORMITEM', name: 'websiteurl', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
transactioncurrencyname: new FormItemModel({ caption: '货币', detailType: 'FORMITEM', name: 'transactioncurrencyname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
address1_postalcode: new FormItemModel({ caption: '邮政编码', detailType: 'FORMITEM', name: 'address1_postalcode', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
address1_country: new FormItemModel({ caption: '国家/地区', detailType: 'FORMITEM', name: 'address1_country', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
address1_stateorprovince: new FormItemModel({ caption: '省/直辖市/自治区', detailType: 'FORMITEM', name: 'address1_stateorprovince', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
address1_city: new FormItemModel({ caption: '市/县', detailType: 'FORMITEM', name: 'address1_city', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
address1_line1: new FormItemModel({ caption: '街道', detailType: 'FORMITEM', name: 'address1_line1', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
transactioncurrencyid: new FormItemModel({ caption: '货币', detailType: 'FORMITEM', name: 'transactioncurrencyid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
competitorid: new FormItemModel({ caption: '竞争对手', detailType: 'FORMITEM', name: 'competitorid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 1 })
,
};
/**
* 监控表单属性 srfupdatedate 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof QuickCreate
*/
@Watch('data.srfupdatedate')
onSrfupdatedateChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfupdatedate', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srforikey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof QuickCreate
*/
@Watch('data.srforikey')
onSrforikeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srforikey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfkey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof QuickCreate
*/
@Watch('data.srfkey')
onSrfkeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfkey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfmajortext 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof QuickCreate
*/
@Watch('data.srfmajortext')
onSrfmajortextChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfmajortext', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srftempmode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof QuickCreate
*/
@Watch('data.srftempmode')
onSrftempmodeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srftempmode', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfuf 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof QuickCreate
*/
@Watch('data.srfuf')
onSrfufChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfuf', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfdeid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof QuickCreate
*/
@Watch('data.srfdeid')
onSrfdeidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfdeid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfsourcekey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof QuickCreate
*/
@Watch('data.srfsourcekey')
onSrfsourcekeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfsourcekey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 competitorname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof QuickCreate
*/
@Watch('data.competitorname')
onCompetitornameChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'competitorname', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 websiteurl 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof QuickCreate
*/
@Watch('data.websiteurl')
onWebsiteurlChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'websiteurl', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 transactioncurrencyname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof QuickCreate
*/
@Watch('data.transactioncurrencyname')
onTransactioncurrencynameChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'transactioncurrencyname', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 address1_postalcode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof QuickCreate
*/
@Watch('data.address1_postalcode')
onAddress1_postalcodeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'address1_postalcode', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 address1_country 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof QuickCreate
*/
@Watch('data.address1_country')
onAddress1_countryChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'address1_country', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 address1_stateorprovince 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof QuickCreate
*/
@Watch('data.address1_stateorprovince')
onAddress1_stateorprovinceChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'address1_stateorprovince', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 address1_city 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof QuickCreate
*/
@Watch('data.address1_city')
onAddress1_cityChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'address1_city', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 address1_line1 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof QuickCreate
*/
@Watch('data.address1_line1')
onAddress1_line1Change(newVal: any, oldVal: any) {
this.formDataChange({ name: 'address1_line1', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 transactioncurrencyid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof QuickCreate
*/
@Watch('data.transactioncurrencyid')
onTransactioncurrencyidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'transactioncurrencyid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 competitorid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof QuickCreate
*/
@Watch('data.competitorid')
onCompetitoridChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'competitorid', newVal: newVal, oldVal: oldVal });
}
/**
* 重置表单项值
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof QuickCreate
*/
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 QuickCreate
*/
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 QuickCreate
*/
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 QuickCreate
*/
public onFormLoad(data: any = {},action:string): void {
if(Object.is(action,"save") || Object.is(action,"autoSave") || Object.is(action,"submit"))
// 更新context的实体主键
if(data.competitor){
Object.assign(this.context,{competitor:data.competitor})
}
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 QuickCreate
*/
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 QuickCreate
*/
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 QuickCreate
*/
public resetDraftFormStates(): void {
const form: any = this.$refs.form;
if (form) {
form.resetFields();
}
}
/**
* 重置校验结果
*
* @memberof QuickCreate
*/
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 QuickCreate
*/
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 QuickCreate
*/
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 QuickCreate
*/
public getValues(): any {
return this.data;
}
/**
* 表单项值变更
*
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof QuickCreate
*/
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 QuickCreate
*/
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 QuickCreate
*/
public groupUIActionClick($event: any): void {
if (!$event) {
return;
}
const item:any = $event.item;
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof QuickCreate
*/
public created(): void {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof QuickCreate
*/
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 QuickCreate
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof QuickCreate
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if (this.dataChangEvent) {
this.dataChangEvent.unsubscribe();
}
}
/**
* 拷贝内容
*
* @param {*} [arg={}]
* @memberof @memberof QuickCreate
*/
public copy(srfkey: string): void {
let copyData = this.$store.getters.getCopyData(srfkey);
copyData.srfkey = Util.createUUID();
copyData.competitor = copyData.srfkey;
copyData.competitorid = copyData.srfkey;
Object.assign(this.context,{competitor:copyData.competitor})
this.data = copyData;
this.$nextTick(() => {
this.formState.next({ type: 'load', data: copyData });
this.data.srfuf = '0';
this.setFormEnableCond(this.data);
});
}
/**
*打印
*@memberof @memberof QuickCreate
*/
public print(){
let _this:any = this;
_this.$print({id:'competitor_quickcreate',popTitle:'快速新建表单'});
}
/**
* 部件刷新
*
* @param {any[]} args
* @memberof QuickCreate
*/
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 QuickCreate
*/
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 QuickCreate
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: '错误', desc: 'CompetitorOptionView视图表单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 QuickCreate
*/
public loadDraft(opt: any = {}): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: '错误', desc: 'CompetitorOptionView视图表单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.competitor){
Object.assign(this.context,{competitor:data.competitor})
}
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 QuickCreate
*/
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: 'CompetitorOptionView视图表单'+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 QuickCreate
*/
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: 'CompetitorOptionView视图表单'+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: 'CompetitorOptionView视图表单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 QuickCreate
*/
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 QuickCreate
*/
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.competitor || Object.is(arg.competitor, '')) {
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 QuickCreate
*/
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 QuickCreate
*/
public onEnter($event: any): void {
}
/**
* 保存并退出
*
* @param {any[]} args
* @memberof QuickCreate
*/
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 QuickCreate
*/
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 QuickCreate
*/
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 QuickCreate
*/
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 QuickCreate
*/
public createDefault(){
}
/**
* 更新默认值
* @memberof QuickCreate
*/
public updateDefault(){
}
}
</script>
<style lang='less'>
@import './quick-create-form.less';
</style>
\ No newline at end of file
/**
* QuickCreate 部件模型
*
* @export
* @class QuickCreateModel
*/
export default class QuickCreateModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof QuickCreateModel
*/
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: 'competitorid',
dataType: 'GUID',
},
{
name: 'srfmajortext',
prop: 'competitorname',
dataType: 'TEXT',
},
{
name: 'srftempmode',
},
{
name: 'srfuf',
},
{
name: 'srfdeid',
},
{
name: 'srfsourcekey',
},
{
name: 'competitorname',
prop: 'competitorname',
dataType: 'TEXT',
},
{
name: 'websiteurl',
prop: 'websiteurl',
dataType: 'TEXT',
},
{
name: 'transactioncurrencyname',
prop: 'transactioncurrencyname',
dataType: 'PICKUPTEXT',
},
{
name: 'address1_postalcode',
prop: 'address1_postalcode',
dataType: 'TEXT',
},
{
name: 'address1_country',
prop: 'address1_country',
dataType: 'TEXT',
},
{
name: 'address1_stateorprovince',
prop: 'address1_stateorprovince',
dataType: 'TEXT',
},
{
name: 'address1_city',
prop: 'address1_city',
dataType: 'TEXT',
},
{
name: 'address1_line1',
prop: 'address1_line1',
dataType: 'TEXT',
},
{
name: 'transactioncurrencyid',
prop: 'transactioncurrencyid',
dataType: 'PICKUP',
},
{
name: 'competitorid',
prop: 'competitorid',
dataType: 'GUID',
},
{
name: 'competitor',
prop: 'competitorid',
dataType: 'FONTKEY',
},
]
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import CompetitorService from '@/service/competitor/competitor-service';
import QuickCreateModel from './quick-create-form-model';
import TransactionCurrencyService from '@/service/transaction-currency/transaction-currency-service';
/**
* QuickCreate 部件服务对象
*
* @export
* @class QuickCreateService
*/
export default class QuickCreateService extends ControlService {
/**
* 竞争对手服务对象
*
* @type {CompetitorService}
* @memberof QuickCreateService
*/
public appEntityService: CompetitorService = new CompetitorService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof QuickCreateService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of QuickCreateService.
*
* @param {*} [opts={}]
* @memberof QuickCreateService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new QuickCreateModel();
}
/**
* 货币服务对象
*
* @type {TransactionCurrencyService}
* @memberof QuickCreateService
*/
public transactioncurrencyService: TransactionCurrencyService = new TransactionCurrencyService();
/**
* 处理数据
*
* @private
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof QuickCreateService
*/
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 QuickCreateService
*/
@Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
if (Object.is(serviceName, 'TransactionCurrencyService') && Object.is(interfaceName, 'FetchDefault')) {
return this.doItems(this.transactioncurrencyService.FetchDefault(JSON.parse(JSON.stringify(context)),data, isloading), 'transactioncurrencyid', 'transactioncurrency');
}
return Promise.reject([])
}
/**
* 启动工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>}
* @memberof QuickCreateService
*/
@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 QuickCreateService
*/
@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 QuickCreateService
*/
@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 QuickCreateService
*/
@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 QuickCreateService
*/
@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 QuickCreateService
*/
@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 QuickCreateService
*/
@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.competitorid = PrimaryKey;
Data.competitor = 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.competitorid = 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 QuickCreateService
*/
@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 QuickCreateService
*/
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 QuickCreateBase from './quick-create-form-base.vue';
@Component({
components: {
}
})
export default class QuickCreate extends QuickCreateBase {
}
</script>
\ No newline at end of file
......@@ -4514,7 +4514,7 @@
<!--输出实体[ACCOUNT]数据结构 -->
<changeSet author="a_LAB01_e85d8801c" id="tab-account-295-54">
<changeSet author="a_LAB01_e85d8801c" id="tab-account-299-54">
<createTable tableName="ACCOUNT">
<column name="ADDRESS1_PRIMARYCONTACTNAME" remarks="" type="VARCHAR(100)">
</column>
......@@ -8085,7 +8085,7 @@
<!--输出实体[COMPETITOR]数据结构 -->
<changeSet author="a_LAB01_e85d8801c" id="tab-competitor-6-89">
<changeSet author="a_LAB01_e85d8801c" id="tab-competitor-16-89">
<createTable tableName="COMPETITOR">
<column name="ENTITYIMAGE" remarks="" type="VARCHAR(100)">
</column>
......@@ -11135,31 +11135,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"/>
</changeSet>
<!--输出实体[ACCOUNT]外键关系 -->
<changeSet author="a_LAB01_e85d8801c" id="fk-account-295-255">
<changeSet author="a_LAB01_e85d8801c" id="fk-account-299-255">
<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 author="a_LAB01_e85d8801c" id="fk-account-295-256">
<changeSet author="a_LAB01_e85d8801c" id="fk-account-299-256">
<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 author="a_LAB01_e85d8801c" id="fk-account-295-257">
<changeSet author="a_LAB01_e85d8801c" id="fk-account-299-257">
<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 author="a_LAB01_e85d8801c" id="fk-account-295-258">
<changeSet author="a_LAB01_e85d8801c" id="fk-account-299-258">
<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 author="a_LAB01_e85d8801c" id="fk-account-295-259">
<changeSet author="a_LAB01_e85d8801c" id="fk-account-299-259">
<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 author="a_LAB01_e85d8801c" id="fk-account-295-260">
<changeSet author="a_LAB01_e85d8801c" id="fk-account-299-260">
<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 author="a_LAB01_e85d8801c" id="fk-account-295-261">
<changeSet author="a_LAB01_e85d8801c" id="fk-account-299-261">
<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 author="a_LAB01_e85d8801c" id="fk-account-295-262">
<changeSet author="a_LAB01_e85d8801c" id="fk-account-299-262">
<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 author="a_LAB01_e85d8801c" id="fk-account-295-263">
<changeSet author="a_LAB01_e85d8801c" id="fk-account-299-263">
<addForeignKeyConstraint baseColumnNames="TRANSACTIONCURRENCYID" baseTableName="ACCOUNT" constraintName="DER1N_ACCOUNT__TRANSACTIONCURR" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="TRANSACTIONCURRENCYID" referencedTableName="TRANSACTIONCURRENCY" validate="true"/>
</changeSet>
<!--输出实体[KNOWLEDGEARTICLEVIEWS]外键关系 -->
......@@ -11419,7 +11419,7 @@
<!--输出实体[CAMPAIGNLIST]外键关系 -->
<!--输出实体[LISTCONTACT]外键关系 -->
<!--输出实体[COMPETITOR]外键关系 -->
<changeSet author="a_LAB01_e85d8801c" id="fk-competitor-6-346">
<changeSet author="a_LAB01_e85d8801c" id="fk-competitor-16-346">
<addForeignKeyConstraint baseColumnNames="TRANSACTIONCURRENCYID" baseTableName="COMPETITOR" constraintName="DER1N_COMPETITOR__TRANSACTIONC" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="TRANSACTIONCURRENCYID" referencedTableName="TRANSACTIONCURRENCY" validate="true"/>
</changeSet>
<!--输出实体[PRODUCT]外键关系 -->
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册