提交 79a54a86 编写于 作者: ibizdev's avatar ibizdev

xignzi006 发布系统代码

上级 63429034
<template>
<studio-embed-view viewName="contactabstracteditview9" viewTitle="联系人编辑视图" class='deeditview9 contact-abstract-edit-view9'>
<template slot='title'>
<span class='caption-info'>{{$t(model.srfTitle)}}</span>
</template>
<template slot="toolbar">
<div class='toolbar-container'>
<i-button :title="$t('entities.contact.abstracteditview9toolbar_toolbar.deuiaction2.tip')" v-show="toolBarModels.deuiaction2.visabled" :disabled="toolBarModels.deuiaction2.disabled" class='' @click="toolbar_click({ tag: 'deuiaction2' }, $event)">
<i class='fa fa-edit'></i>
<span class='caption'>{{$t('entities.contact.abstracteditview9toolbar_toolbar.deuiaction2.caption')}}</span>
</i-button>
</div>
</template>
<view_form
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:autosave="false"
:viewtag="viewtag"
:showBusyIndicator="true"
updateAction="Update"
removeAction="Remove"
loaddraftAction="GetDraft"
loadAction="Get"
createAction="Create"
WFSubmitAction=""
WFStartAction=""
style=''
name="form"
ref='form'
@save="form_save($event)"
@remove="form_remove($event)"
@load="form_load($event)"
@closeview="closeView($event)">
</view_form>
</studio-embed-view>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import { Subject } from 'rxjs';
import ContactService from '@/service/contact/contact-service';
import EditView9Engine from '@engine/view/edit-view9-engine';
@Component({
components: {
},
})
export default class ContactAbstractEditView9Base extends Vue {
/**
* 实体服务对象
*
* @type {ContactService}
* @memberof ContactAbstractEditView9Base
*/
public appEntityService: ContactService = new ContactService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof ContactAbstractEditView9Base
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof ContactAbstractEditView9Base
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof ContactAbstractEditView9Base
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof ContactAbstractEditView9Base
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof ContactAbstractEditView9Base
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图标识
*
* @type {string}
* @memberof ContactAbstractEditView9Base
*/
public viewtag: string = '928f354b1e67a8b855b7f19f485299b0';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof ContactAbstractEditView9Base
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof ContactAbstractEditView9Base
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof ContactAbstractEditView9Base
*/
public model: any = {
srfCaption: 'entities.contact.views.abstracteditview9.caption',
srfTitle: 'entities.contact.views.abstracteditview9.title',
srfSubTitle: 'entities.contact.views.abstracteditview9.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof ContactAbstractEditView9Base
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof ContactAbstractEditView9Base
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
}
}
/**
* 容器模型
*
* @type {*}
* @memberof ContactAbstractEditView9Base
*/
public containerModel: any = {
view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
view_form: { name: 'form', type: 'FORM' },
};
/**
* 计数器刷新
*
* @memberof ContactAbstractEditView9Base
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof ContactAbstractEditView9Base
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 工具栏模型
*
* @type {*}
* @memberof ContactAbstractEditView9
*/
public toolBarModels: any = {
deuiaction2: { name: 'deuiaction2', caption: '编辑', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'OpenEditMode', target: 'SINGLEKEY' } },
};
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof ContactAbstractEditView9Base
*/
public engine: EditView9Engine = new EditView9Engine();
/**
* 引擎初始化
*
* @public
* @memberof ContactAbstractEditView9Base
*/
public engineInit(): void {
this.engine.init({
view: this,
form: this.$refs.form,
p2k: '0',
keyPSDEField: 'contact',
majorPSDEField: 'fullname',
isLoadDefault: true,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof ContactAbstractEditView9Base
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof ContactAbstractEditView9Base
*/
public viewparams:any = {};
/**
* 解析视图参数
*
* @public
* @memberof ContactAbstractEditView9Base
*/
public parseViewParam(): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
}
/**
* 处理自定义视图数据
*
* @memberof ContactAbstractEditView9Base
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof ContactAbstractEditView9Base
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* Vue声明周期
*
* @memberof ContactAbstractEditView9Base
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof ContactAbstractEditView9Base
*/
public afterCreated(){
const secondtag = this.$util.createUUID();
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
}
/**
* 销毁之前
*
* @memberof ContactAbstractEditView9Base
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof ContactAbstractEditView9Base
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof ContactAbstractEditView9Base
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
if(this.panelState){
this.panelState.subscribe((res:any) =>{
if(Object.is(res.tag,'meditviewpanel')){
if(Object.is(res.action,'save')){
this.viewState.next({ tag:'form', action: 'save', data:res.data});
}
if(Object.is(res.action,'remove')){
this.viewState.next({ tag:'form', action: 'remove', data:res.data});
}
}
});
}
}
/**
* toolbar 部件 click 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof ContactAbstractEditView9Base
*/
public toolbar_click($event: any, $event2?: any) {
if (Object.is($event.tag, 'deuiaction2')) {
this.toolbar_deuiaction2_click(null, '', $event2);
}
}
/**
* form 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof ContactAbstractEditView9Base
*/
public form_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'save', $event);
}
/**
* form 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof ContactAbstractEditView9Base
*/
public form_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'remove', $event);
}
/**
* form 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof ContactAbstractEditView9Base
*/
public form_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'load', $event);
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_deuiaction2_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.OpenEditMode(datas, contextJO,paramJO, $event, xData,this,"Contact");
}
/**
* 编辑
*
* @param {any[]} args 当前数据
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
* @returns {Promise<any>}
*/
public async OpenEditMode(args: any[], context:any = {} ,params: any={}, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
xData = $event;
$event = params;
params = context;
let context2: any = {};
let data: any = {};
let parentContext:any = {};
let parentViewParam:any = {};
const _args: any[] = this.$util.deepCopy(args);
const _this: any = this;
const actionTarget: string | null = 'SINGLEKEY';
Object.assign(context2, { res_partner: '%id%' });
Object.assign(params, { id: '%id%' });
Object.assign(params, { name: '%name%' })
if(actionContext.context){
parentContext = actionContext.context;
}
if(actionContext.viewparams){
parentViewParam = actionContext.viewparams;
}
context = UIActionTool.handleContextParam(actionTarget,_args,parentContext,parentViewParam,context);
data = UIActionTool.handleActionParam(actionTarget,_args,parentContext,parentViewParam,params);
Object.assign(context,this.context,context);
if(context && context.srfsessionid){
context.srfsessionkey = context.srfsessionid;
delete context.srfsessionid;
}
const parameters: any[] = [
{ pathName: 'res_partners', parameterName: 'res_partner' },
];
const openDrawer = (view: any, data: any) => {
let container: Subject<any> = this.$appdrawer.openDrawer(view, context,data);
container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
const _this: any = this;
if (xData && xData.refresh && xData.refresh instanceof Function) {
xData.refresh(args);
}
return result.datas;
});
}
const view: any = {
viewname: 'contact-abstract-edit-view9-edit-mode',
height: 0,
width: 0,
title: '联系人编辑视图',
placement: 'DRAWER_TOP',
};
openDrawer(view, data);
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof ContactAbstractEditView9Base
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof ContactAbstractEditView9Base
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof ContactAbstractEditView9Base
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
}
}
/**
* meditview9状态下发变量
*
* @memberof IBZSAM02MobEditView
*/
@Prop() public panelState ?:Subject<ViewState>;
}
</script>
<style lang='less'>
@import './contact-abstract-edit-view9.less';
</style>
\ No newline at end of file
// 避免空文件,后台不让空文件过
.contact-abstract-edit-view9 {
--contact-abstract-edit-view9: 0;
}
// 视图样式
// this is less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import ContactAbstractEditView9Base from './contact-abstract-edit-view9-base.vue';
import view_form from '@widgets/contact/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 ContactAbstractEditView9 extends ContactAbstractEditView9Base {
}
</script>
\ No newline at end of file
<template>
<studio-embed-view viewName="contactdetailinfoeditview9" viewTitle="联系人编辑视图" class='deeditview9 contact-detail-info-edit-view9'>
<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>
</studio-embed-view>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import { Subject } from 'rxjs';
import ContactService from '@/service/contact/contact-service';
import EditView9Engine from '@engine/view/edit-view9-engine';
@Component({
components: {
},
})
export default class ContactDetailInfoEditView9Base extends Vue {
/**
* 实体服务对象
*
* @type {ContactService}
* @memberof ContactDetailInfoEditView9Base
*/
public appEntityService: ContactService = new ContactService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof ContactDetailInfoEditView9Base
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof ContactDetailInfoEditView9Base
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof ContactDetailInfoEditView9Base
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof ContactDetailInfoEditView9Base
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof ContactDetailInfoEditView9Base
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图标识
*
* @type {string}
* @memberof ContactDetailInfoEditView9Base
*/
public viewtag: string = '60093dd36f07238d7a7e72e9ed372942';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof ContactDetailInfoEditView9Base
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof ContactDetailInfoEditView9Base
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof ContactDetailInfoEditView9Base
*/
public model: any = {
srfCaption: 'entities.contact.views.detailinfoeditview9.caption',
srfTitle: 'entities.contact.views.detailinfoeditview9.title',
srfSubTitle: 'entities.contact.views.detailinfoeditview9.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof ContactDetailInfoEditView9Base
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof ContactDetailInfoEditView9Base
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
}
}
/**
* 容器模型
*
* @type {*}
* @memberof ContactDetailInfoEditView9Base
*/
public containerModel: any = {
view_form: { name: 'form', type: 'FORM' },
};
/**
* 计数器刷新
*
* @memberof ContactDetailInfoEditView9Base
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof ContactDetailInfoEditView9Base
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof ContactDetailInfoEditView9Base
*/
public engine: EditView9Engine = new EditView9Engine();
/**
* 引擎初始化
*
* @public
* @memberof ContactDetailInfoEditView9Base
*/
public engineInit(): void {
this.engine.init({
view: this,
form: this.$refs.form,
p2k: '0',
keyPSDEField: 'contact',
majorPSDEField: 'fullname',
isLoadDefault: true,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof ContactDetailInfoEditView9Base
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof ContactDetailInfoEditView9Base
*/
public viewparams:any = {};
/**
* 解析视图参数
*
* @public
* @memberof ContactDetailInfoEditView9Base
*/
public parseViewParam(): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
}
/**
* 处理自定义视图数据
*
* @memberof ContactDetailInfoEditView9Base
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof ContactDetailInfoEditView9Base
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* Vue声明周期
*
* @memberof ContactDetailInfoEditView9Base
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof ContactDetailInfoEditView9Base
*/
public afterCreated(){
const secondtag = this.$util.createUUID();
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
}
/**
* 销毁之前
*
* @memberof ContactDetailInfoEditView9Base
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof ContactDetailInfoEditView9Base
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof ContactDetailInfoEditView9Base
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
if(this.panelState){
this.panelState.subscribe((res:any) =>{
if(Object.is(res.tag,'meditviewpanel')){
if(Object.is(res.action,'save')){
this.viewState.next({ tag:'form', action: 'save', data:res.data});
}
if(Object.is(res.action,'remove')){
this.viewState.next({ tag:'form', action: 'remove', data:res.data});
}
}
});
}
}
/**
* form 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof ContactDetailInfoEditView9Base
*/
public form_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'save', $event);
}
/**
* form 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof ContactDetailInfoEditView9Base
*/
public form_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'remove', $event);
}
/**
* form 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof ContactDetailInfoEditView9Base
*/
public form_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'load', $event);
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof ContactDetailInfoEditView9Base
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof ContactDetailInfoEditView9Base
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof ContactDetailInfoEditView9Base
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
}
}
/**
* meditview9状态下发变量
*
* @memberof IBZSAM02MobEditView
*/
@Prop() public panelState ?:Subject<ViewState>;
}
</script>
<style lang='less'>
@import './contact-detail-info-edit-view9.less';
</style>
\ No newline at end of file
// 避免空文件,后台不让空文件过
.contact-detail-info-edit-view9 {
--contact-detail-info-edit-view9: 0;
}
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import ContactDetailInfoEditView9Base from './contact-detail-info-edit-view9-base.vue';
import view_form from '@widgets/contact/detail-info-form/detail-info-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 ContactDetailInfoEditView9 extends ContactDetailInfoEditView9Base {
}
</script>
\ No newline at end of file
<template>
<studio-view viewName="contacttabexpview" viewTitle="联系人分页导航视图" class='detabexpview contact-tab-exp-view'>
<template slot='title'>
<span class='caption-info'>{{$t(model.srfTitle)}}</span>
</template>
<view_tabexppanel
:viewState="viewState"
:viewparams="viewparams"
:context="context"
name="tabexppanel"
ref='tabexppanel'
@closeview="closeView($event)">
</view_tabexppanel>
</studio-view>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import { Subject } from 'rxjs';
import ContactService from '@/service/contact/contact-service';
import TabExpViewEngine from '@engine/view/tab-exp-view-engine';
@Component({
components: {
},
})
export default class ContactTabExpViewBase extends Vue {
/**
* 实体服务对象
*
* @type {ContactService}
* @memberof ContactTabExpViewBase
*/
public appEntityService: ContactService = new ContactService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof ContactTabExpViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof ContactTabExpViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof ContactTabExpViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof ContactTabExpViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof ContactTabExpViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图标识
*
* @type {string}
* @memberof ContactTabExpViewBase
*/
public viewtag: string = 'fcdb236b65d78c4a8ae64e74f9483a63';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof ContactTabExpViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof ContactTabExpViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof ContactTabExpViewBase
*/
public model: any = {
srfCaption: 'entities.contact.views.tabexpview.caption',
srfTitle: 'entities.contact.views.tabexpview.title',
srfSubTitle: 'entities.contact.views.tabexpview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof ContactTabExpViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof ContactTabExpViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
}
}
/**
* 容器模型
*
* @type {*}
* @memberof ContactTabExpViewBase
*/
public containerModel: any = {
view_tabexppanel: { name: 'tabexppanel', type: 'TABEXPPANEL' },
};
/**
* 计数器刷新
*
* @memberof ContactTabExpViewBase
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof ContactTabExpViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof ContactTabExpViewBase
*/
public engine: TabExpViewEngine = new TabExpViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof ContactTabExpViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
keyPSDEField: 'contact',
majorPSDEField: 'fullname',
isLoadDefault: true,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof ContactTabExpViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof ContactTabExpViewBase
*/
public viewparams:any = {};
/**
* 解析视图参数
*
* @public
* @memberof ContactTabExpViewBase
*/
public parseViewParam(): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
}
/**
* 处理自定义视图数据
*
* @memberof ContactTabExpViewBase
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof ContactTabExpViewBase
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* Vue声明周期
*
* @memberof ContactTabExpViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof ContactTabExpViewBase
*/
public afterCreated(){
const secondtag = this.$util.createUUID();
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
}
/**
* 销毁之前
*
* @memberof ContactTabExpViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof ContactTabExpViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof ContactTabExpViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof ContactTabExpViewBase
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof ContactTabExpViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof ContactTabExpViewBase
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
}
}
/**
* 加载模型
*
* @memberof ContactTabExpViewBase
*/
public loadModel(){
if(this.context.contact){
this.appEntityService.getDataInfo(JSON.parse(JSON.stringify(this.context)),{},false).then((response:any) =>{
if (!response || response.status !== 200) {
return;
}
const { data: _data } = response;
if (_data.fullname) {
Object.assign(this.model, { dataInfo: _data.fullname });
if (this.$tabPageExp) {
this.$tabPageExp.setCurPageCaption(this.model.srfTitle, this.model.srfTitle, this.model.dataInfo);
}
if(this.$route){
this.$route.meta.info = this.model.dataInfo;
}
Object.assign(this.model, { srfTitle: `${this.$t(this.model.srfTitle)} - ${this.model.dataInfo}` });
}
})
}
}
}
</script>
<style lang='less'>
@import './contact-tab-exp-view.less';
</style>
\ No newline at end of file
// 避免空文件,后台不让空文件过
.contact-tab-exp-view {
--contact-tab-exp-view: 0;
}
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import ContactTabExpViewBase from './contact-tab-exp-view-base.vue';
import view_tabexppanel from '@widgets/contact/tab-exp-viewtabexppanel-tabexppanel/tab-exp-viewtabexppanel-tabexppanel.vue';
@Component({
components: {
view_tabexppanel,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$store.commit('addCurPageViewtag', { route: to, viewtag: vm.viewtag });
});
},
})
export default class ContactTabExpView extends ContactTabExpViewBase {
}
</script>
\ No newline at end of file
<template>
<studio-view viewName="transactioncurrencypickupgridview" viewTitle="transactioncurrency选择表格视图" class='depickupgridview transaction-currency-pickup-grid-view'>
<template slot='title'>
<span class='caption-info'>{{$t(model.srfTitle)}}</span>
</template>
<template slot="searchForm">
<view_searchform
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:showBusyIndicator="true"
v-show="isExpandSearchForm"
loaddraftAction="FilterGetDraft"
loadAction="FilterGet"
name="searchform"
ref='searchform'
@save="searchform_save($event)"
@search="searchform_search($event)"
@load="searchform_load($event)"
@closeview="closeView($event)">
</view_searchform>
</template>
<view_grid
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
:showBusyIndicator="true"
updateAction=""
removeAction="Remove"
loaddraftAction=""
loadAction=""
createAction=""
fetchAction="FetchDefault"
name="grid"
ref='grid'
@selectionchange="grid_selectionchange($event)"
@beforeload="grid_beforeload($event)"
@rowdblclick="grid_rowdblclick($event)"
@load="grid_load($event)"
@closeview="closeView($event)">
</view_grid>
</studio-view>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import { Subject } from 'rxjs';
import TransactionCurrencyService from '@/service/transaction-currency/transaction-currency-service';
import PickupGridViewEngine from '@engine/view/pickup-grid-view-engine';
@Component({
components: {
},
})
export default class TransactionCurrencyPickupGridViewBase extends Vue {
/**
* 实体服务对象
*
* @type {TransactionCurrencyService}
* @memberof TransactionCurrencyPickupGridViewBase
*/
public appEntityService: TransactionCurrencyService = new TransactionCurrencyService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof TransactionCurrencyPickupGridViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof TransactionCurrencyPickupGridViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof TransactionCurrencyPickupGridViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof TransactionCurrencyPickupGridViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof TransactionCurrencyPickupGridViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图标识
*
* @type {string}
* @memberof TransactionCurrencyPickupGridViewBase
*/
public viewtag: string = '6d8a2615030eed5779caea69f7f001aa';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof TransactionCurrencyPickupGridViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof TransactionCurrencyPickupGridViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof TransactionCurrencyPickupGridViewBase
*/
public model: any = {
srfCaption: 'entities.transactioncurrency.views.pickupgridview.caption',
srfTitle: 'entities.transactioncurrency.views.pickupgridview.title',
srfSubTitle: 'entities.transactioncurrency.views.pickupgridview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof TransactionCurrencyPickupGridViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof TransactionCurrencyPickupGridViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
}
}
/**
* 容器模型
*
* @type {*}
* @memberof TransactionCurrencyPickupGridViewBase
*/
public containerModel: any = {
view_grid: { name: 'grid', type: 'GRID' },
view_searchform: { name: 'searchform', type: 'SEARCHFORM' },
};
/**
* 计数器刷新
*
* @memberof TransactionCurrencyPickupGridViewBase
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof TransactionCurrencyPickupGridViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof TransactionCurrencyPickupGridViewBase
*/
public engine: PickupGridViewEngine = new PickupGridViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof TransactionCurrencyPickupGridViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
grid: this.$refs.grid,
searchform: this.$refs.searchform,
keyPSDEField: 'transactioncurrency',
majorPSDEField: 'currencyname',
isLoadDefault: true,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof TransactionCurrencyPickupGridViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof TransactionCurrencyPickupGridViewBase
*/
public viewparams:any = {};
/**
* 解析视图参数
*
* @public
* @memberof TransactionCurrencyPickupGridViewBase
*/
public parseViewParam(): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
}
/**
* 处理自定义视图数据
*
* @memberof TransactionCurrencyPickupGridViewBase
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof TransactionCurrencyPickupGridViewBase
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* Vue声明周期
*
* @memberof TransactionCurrencyPickupGridViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof TransactionCurrencyPickupGridViewBase
*/
public afterCreated(){
const secondtag = this.$util.createUUID();
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
}
/**
* 销毁之前
*
* @memberof TransactionCurrencyPickupGridViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof TransactionCurrencyPickupGridViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof TransactionCurrencyPickupGridViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* grid 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof TransactionCurrencyPickupGridViewBase
*/
public grid_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'selectionchange', $event);
}
/**
* grid 部件 beforeload 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof TransactionCurrencyPickupGridViewBase
*/
public grid_beforeload($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'beforeload', $event);
}
/**
* grid 部件 rowdblclick 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof TransactionCurrencyPickupGridViewBase
*/
public grid_rowdblclick($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'rowdblclick', $event);
}
/**
* grid 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof TransactionCurrencyPickupGridViewBase
*/
public grid_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'load', $event);
}
/**
* searchform 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof TransactionCurrencyPickupGridViewBase
*/
public searchform_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'save', $event);
}
/**
* searchform 部件 search 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof TransactionCurrencyPickupGridViewBase
*/
public searchform_search($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'search', $event);
}
/**
* searchform 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof TransactionCurrencyPickupGridViewBase
*/
public searchform_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'load', $event);
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof TransactionCurrencyPickupGridViewBase
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof TransactionCurrencyPickupGridViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof TransactionCurrencyPickupGridViewBase
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
}
}
/**
* 选中数据字符串
*
* @type {string}
* @memberof TransactionCurrencyPickupGridView
*/
@Prop() public selectedData?: string;
/**
* 是否单选
*
* @type {boolean}
* @memberof TransactionCurrencyPickupGridView
*/
@Prop() public isSingleSelect?: boolean;
/**
* 搜索值
*
* @type {string}
* @memberof TransactionCurrencyPickupGridView
*/
public query: string = '';
/**
* 是否展开搜索表单
*
* @type {boolean}
* @memberof TransactionCurrencyPickupGridView
*/
public isExpandSearchForm: boolean = true;
/**
* 表格行数据默认激活模式
* 0 不激活
* 1 单击激活
* 2 双击激活
*
* @type {(number | 0 | 1 | 2)}
* @memberof TransactionCurrencyPickupGridView
*/
public gridRowActiveMode: number | 0 | 1 | 2 = 2;
/**
* 快速搜索
*
* @param {*} $event
* @memberof TransactionCurrencyPickupGridView
*/
public onSearch($event: any): void {
const refs: any = this.$refs;
if (refs.grid) {
refs.grid.load({});
}
}
}
</script>
<style lang='less'>
@import './transaction-currency-pickup-grid-view.less';
</style>
\ No newline at end of file
.pickup-view {
--pickup-view: 0;
}
// 避免空文件,后台不让空文件过
.transaction-currency-pickup-grid-view {
--transaction-currency-pickup-grid-view: 0;
}
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import TransactionCurrencyPickupGridViewBase from './transaction-currency-pickup-grid-view-base.vue';
import view_grid from '@widgets/transaction-currency/main-grid/main-grid.vue';
import view_searchform from '@widgets/transaction-currency/default-searchform/default-searchform.vue';
@Component({
components: {
view_grid,
view_searchform,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$store.commit('addCurPageViewtag', { route: to, viewtag: vm.viewtag });
});
},
})
export default class TransactionCurrencyPickupGridView extends TransactionCurrencyPickupGridViewBase {
}
</script>
\ No newline at end of file
<template>
<div class="view-container depickupview transaction-currency-pickup-view">
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="transactioncurrencypickupview"></app-studioaction>
<card class='view-card view-no-caption view-no-toolbar' :dis-hover="true" :padding="0" :bordered="false">
<div class="content-container pickup-view">
<view_pickupviewpanel
:viewState="viewState"
:viewparams="JSON.parse(JSON.stringify(viewparams))"
:context="JSON.parse(JSON.stringify(context))"
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
:isShowButton="isShowButton"
name="pickupviewpanel"
ref='pickupviewpanel'
@selectionchange="pickupviewpanel_selectionchange($event)"
@activated="pickupviewpanel_activated($event)"
@load="pickupviewpanel_load($event)"
@closeview="closeView($event)">
</view_pickupviewpanel>
<card v-if="isShowButton" :dis-hover="true" :bordered="false" class="footer">
<row :style="{ textAlign: 'right' }">
<i-button type="primary" :disabled="this.viewSelections.length > 0 ? false : true" @click="onClickOk">{{this.containerModel.view_okbtn.text}}</i-button>
&nbsp;&nbsp;
<i-button @click="onClickCancel">{{this.containerModel.view_cancelbtn.text}}</i-button>
</row>
</card>
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import { Subject } from 'rxjs';
import TransactionCurrencyService from '@/service/transaction-currency/transaction-currency-service';
import PickupViewEngine from '@engine/view/pickup-view-engine';
@Component({
components: {
},
})
export default class TransactionCurrencyPickupViewBase extends Vue {
/**
* 实体服务对象
*
* @type {TransactionCurrencyService}
* @memberof TransactionCurrencyPickupViewBase
*/
public appEntityService: TransactionCurrencyService = new TransactionCurrencyService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof TransactionCurrencyPickupViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof TransactionCurrencyPickupViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof TransactionCurrencyPickupViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof TransactionCurrencyPickupViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof TransactionCurrencyPickupViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图标识
*
* @type {string}
* @memberof TransactionCurrencyPickupViewBase
*/
public viewtag: string = 'da3f8c1f20f440f3df54d6c13a8de586';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof TransactionCurrencyPickupViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof TransactionCurrencyPickupViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof TransactionCurrencyPickupViewBase
*/
public model: any = {
srfCaption: 'entities.transactioncurrency.views.pickupview.caption',
srfTitle: 'entities.transactioncurrency.views.pickupview.title',
srfSubTitle: 'entities.transactioncurrency.views.pickupview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof TransactionCurrencyPickupViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
if(this.viewparams.selectedData){
this.selectedData = JSON.stringify(this.viewparams.selectedData);
}
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof TransactionCurrencyPickupViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
}
}
/**
* 容器模型
*
* @type {*}
* @memberof TransactionCurrencyPickupViewBase
*/
public containerModel: any = {
view_pickupviewpanel: { name: 'pickupviewpanel', type: 'PICKUPVIEWPANEL' },
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 },
};
/**
* 计数器刷新
*
* @memberof TransactionCurrencyPickupViewBase
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof TransactionCurrencyPickupViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof TransactionCurrencyPickupViewBase
*/
public engine: PickupViewEngine = new PickupViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof TransactionCurrencyPickupViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
pickupviewpanel: this.$refs.pickupviewpanel,
keyPSDEField: 'transactioncurrency',
majorPSDEField: 'currencyname',
isLoadDefault: true,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof TransactionCurrencyPickupViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof TransactionCurrencyPickupViewBase
*/
public viewparams:any = {};
/**
* 解析视图参数
*
* @public
* @memberof TransactionCurrencyPickupViewBase
*/
public parseViewParam(): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
}
/**
* 处理自定义视图数据
*
* @memberof TransactionCurrencyPickupViewBase
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof TransactionCurrencyPickupViewBase
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* Vue声明周期
*
* @memberof TransactionCurrencyPickupViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof TransactionCurrencyPickupViewBase
*/
public afterCreated(){
const secondtag = this.$util.createUUID();
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
}
/**
* 销毁之前
*
* @memberof TransactionCurrencyPickupViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof TransactionCurrencyPickupViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof TransactionCurrencyPickupViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
if(this.viewparams.selectedData){
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', this.viewparams.selectedData);
}
}
/**
* pickupviewpanel 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof TransactionCurrencyPickupViewBase
*/
public pickupviewpanel_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', $event);
}
/**
* pickupviewpanel 部件 activated 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof TransactionCurrencyPickupViewBase
*/
public pickupviewpanel_activated($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'activated', $event);
}
/**
* pickupviewpanel 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof TransactionCurrencyPickupViewBase
*/
public pickupviewpanel_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'load', $event);
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof TransactionCurrencyPickupViewBase
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof TransactionCurrencyPickupViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof TransactionCurrencyPickupViewBase
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
}
}
/**
* 选中数据的字符串
*
* @type {string}
* @memberof TransactionCurrencyPickupView
*/
public selectedData: string = "";
/**
* 视图选中数据
*
* @type {any[]}
* @memberof TransactionCurrencyPickupViewBase
*/
public viewSelections:any[] = [];
/**
* 是否显示按钮
*
* @type {boolean}
* @memberof TransactionCurrencyPickupViewBase
*/
@Prop({default: true}) public isShowButton!: boolean;
/**
* 是否单选
*
* @type {boolean}
* @memberof TransactionCurrencyPickupViewBase
*/
public isSingleSelect: boolean = true;
/**
* 确定
*
* @memberof TransactionCurrencyPickupViewBase
*/
public onClickOk(): void {
this.$emit('viewdataschange', this.viewSelections);
this.$emit('close', null);
}
/**
* 取消
*
* @memberof TransactionCurrencyPickupViewBase
*/
public onClickCancel(): void {
this.$emit('close', null);
}
}
</script>
<style lang='less'>
@import './transaction-currency-pickup-view.less';
</style>
\ No newline at end of file
// 避免空文件,后台不让空文件过
.transaction-currency-pickup-view {
--transaction-currency-pickup-view: 0;
}
.pickup-view {
>.pickupviewpanel {
flex-grow: 1;
display: flex;
justify-content: flex-end;
height: calc(100% - 64px);
}
>.footer {
height: 64px;
}
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import TransactionCurrencyPickupViewBase from './transaction-currency-pickup-view-base.vue';
import view_pickupviewpanel from '@widgets/transaction-currency/pickup-viewpickupviewpanel-pickupviewpanel/pickup-viewpickupviewpanel-pickupviewpanel.vue';
@Component({
components: {
view_pickupviewpanel,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$store.commit('addCurPageViewtag', { route: to, viewtag: vm.viewtag });
});
},
})
export default class TransactionCurrencyPickupView extends TransactionCurrencyPickupViewBase {
}
</script>
\ No newline at end of file
<template>
<studio-view viewName="leadpickupgridview" viewTitle="lead选择表格视图" class='depickupgridview lead-pickup-grid-view'>
<template slot='title'>
<span class='caption-info'>{{$t(model.srfTitle)}}</span>
</template>
<template slot="searchForm">
<view_searchform
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:showBusyIndicator="true"
v-show="isExpandSearchForm"
loaddraftAction="FilterGetDraft"
loadAction="FilterGet"
name="searchform"
ref='searchform'
@save="searchform_save($event)"
@search="searchform_search($event)"
@load="searchform_load($event)"
@closeview="closeView($event)">
</view_searchform>
</template>
<view_grid
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
:showBusyIndicator="true"
updateAction=""
removeAction="Remove"
loaddraftAction=""
loadAction=""
createAction=""
fetchAction="FetchDefault"
name="grid"
ref='grid'
@selectionchange="grid_selectionchange($event)"
@beforeload="grid_beforeload($event)"
@rowdblclick="grid_rowdblclick($event)"
@load="grid_load($event)"
@closeview="closeView($event)">
</view_grid>
</studio-view>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import { Subject } from 'rxjs';
import LeadService from '@/service/lead/lead-service';
import PickupGridViewEngine from '@engine/view/pickup-grid-view-engine';
@Component({
components: {
},
})
export default class LeadPickupGridViewBase extends Vue {
/**
* 实体服务对象
*
* @type {LeadService}
* @memberof LeadPickupGridViewBase
*/
public appEntityService: LeadService = new LeadService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof LeadPickupGridViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof LeadPickupGridViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof LeadPickupGridViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof LeadPickupGridViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof LeadPickupGridViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图标识
*
* @type {string}
* @memberof LeadPickupGridViewBase
*/
public viewtag: string = '7d00f63c306adf3537efeabb3326095d';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof LeadPickupGridViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof LeadPickupGridViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof LeadPickupGridViewBase
*/
public model: any = {
srfCaption: 'entities.lead.views.pickupgridview.caption',
srfTitle: 'entities.lead.views.pickupgridview.title',
srfSubTitle: 'entities.lead.views.pickupgridview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof LeadPickupGridViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof LeadPickupGridViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
}
}
/**
* 容器模型
*
* @type {*}
* @memberof LeadPickupGridViewBase
*/
public containerModel: any = {
view_grid: { name: 'grid', type: 'GRID' },
view_searchform: { name: 'searchform', type: 'SEARCHFORM' },
};
/**
* 计数器刷新
*
* @memberof LeadPickupGridViewBase
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof LeadPickupGridViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof LeadPickupGridViewBase
*/
public engine: PickupGridViewEngine = new PickupGridViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof LeadPickupGridViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
grid: this.$refs.grid,
searchform: this.$refs.searchform,
keyPSDEField: 'lead',
majorPSDEField: 'fullname',
isLoadDefault: true,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof LeadPickupGridViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof LeadPickupGridViewBase
*/
public viewparams:any = {};
/**
* 解析视图参数
*
* @public
* @memberof LeadPickupGridViewBase
*/
public parseViewParam(): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
}
/**
* 处理自定义视图数据
*
* @memberof LeadPickupGridViewBase
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof LeadPickupGridViewBase
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* Vue声明周期
*
* @memberof LeadPickupGridViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof LeadPickupGridViewBase
*/
public afterCreated(){
const secondtag = this.$util.createUUID();
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
}
/**
* 销毁之前
*
* @memberof LeadPickupGridViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof LeadPickupGridViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof LeadPickupGridViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* grid 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof LeadPickupGridViewBase
*/
public grid_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'selectionchange', $event);
}
/**
* grid 部件 beforeload 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof LeadPickupGridViewBase
*/
public grid_beforeload($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'beforeload', $event);
}
/**
* grid 部件 rowdblclick 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof LeadPickupGridViewBase
*/
public grid_rowdblclick($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'rowdblclick', $event);
}
/**
* grid 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof LeadPickupGridViewBase
*/
public grid_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'load', $event);
}
/**
* searchform 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof LeadPickupGridViewBase
*/
public searchform_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'save', $event);
}
/**
* searchform 部件 search 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof LeadPickupGridViewBase
*/
public searchform_search($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'search', $event);
}
/**
* searchform 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof LeadPickupGridViewBase
*/
public searchform_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'load', $event);
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof LeadPickupGridViewBase
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof LeadPickupGridViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof LeadPickupGridViewBase
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
}
}
/**
* 选中数据字符串
*
* @type {string}
* @memberof LeadPickupGridView
*/
@Prop() public selectedData?: string;
/**
* 是否单选
*
* @type {boolean}
* @memberof LeadPickupGridView
*/
@Prop() public isSingleSelect?: boolean;
/**
* 搜索值
*
* @type {string}
* @memberof LeadPickupGridView
*/
public query: string = '';
/**
* 是否展开搜索表单
*
* @type {boolean}
* @memberof LeadPickupGridView
*/
public isExpandSearchForm: boolean = true;
/**
* 表格行数据默认激活模式
* 0 不激活
* 1 单击激活
* 2 双击激活
*
* @type {(number | 0 | 1 | 2)}
* @memberof LeadPickupGridView
*/
public gridRowActiveMode: number | 0 | 1 | 2 = 2;
/**
* 快速搜索
*
* @param {*} $event
* @memberof LeadPickupGridView
*/
public onSearch($event: any): void {
const refs: any = this.$refs;
if (refs.grid) {
refs.grid.load({});
}
}
}
</script>
<style lang='less'>
@import './lead-pickup-grid-view.less';
</style>
\ No newline at end of file
.pickup-view {
--pickup-view: 0;
}
// 避免空文件,后台不让空文件过
.lead-pickup-grid-view {
--lead-pickup-grid-view: 0;
}
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import LeadPickupGridViewBase from './lead-pickup-grid-view-base.vue';
import view_grid from '@widgets/lead/main-grid/main-grid.vue';
import view_searchform from '@widgets/lead/default-searchform/default-searchform.vue';
@Component({
components: {
view_grid,
view_searchform,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$store.commit('addCurPageViewtag', { route: to, viewtag: vm.viewtag });
});
},
})
export default class LeadPickupGridView extends LeadPickupGridViewBase {
}
</script>
\ No newline at end of file
<template>
<div class="view-container depickupview lead-pickup-view">
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="leadpickupview"></app-studioaction>
<card class='view-card view-no-caption view-no-toolbar' :dis-hover="true" :padding="0" :bordered="false">
<div class="content-container pickup-view">
<view_pickupviewpanel
:viewState="viewState"
:viewparams="JSON.parse(JSON.stringify(viewparams))"
:context="JSON.parse(JSON.stringify(context))"
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
:isShowButton="isShowButton"
name="pickupviewpanel"
ref='pickupviewpanel'
@selectionchange="pickupviewpanel_selectionchange($event)"
@activated="pickupviewpanel_activated($event)"
@load="pickupviewpanel_load($event)"
@closeview="closeView($event)">
</view_pickupviewpanel>
<card v-if="isShowButton" :dis-hover="true" :bordered="false" class="footer">
<row :style="{ textAlign: 'right' }">
<i-button type="primary" :disabled="this.viewSelections.length > 0 ? false : true" @click="onClickOk">{{this.containerModel.view_okbtn.text}}</i-button>
&nbsp;&nbsp;
<i-button @click="onClickCancel">{{this.containerModel.view_cancelbtn.text}}</i-button>
</row>
</card>
</div>
</card>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import { Subject } from 'rxjs';
import LeadService from '@/service/lead/lead-service';
import PickupViewEngine from '@engine/view/pickup-view-engine';
@Component({
components: {
},
})
export default class LeadPickupViewBase extends Vue {
/**
* 实体服务对象
*
* @type {LeadService}
* @memberof LeadPickupViewBase
*/
public appEntityService: LeadService = new LeadService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof LeadPickupViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof LeadPickupViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof LeadPickupViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof LeadPickupViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof LeadPickupViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图标识
*
* @type {string}
* @memberof LeadPickupViewBase
*/
public viewtag: string = '1bc48b15dbe69c5f30dafe489f58aacb';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof LeadPickupViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof LeadPickupViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof LeadPickupViewBase
*/
public model: any = {
srfCaption: 'entities.lead.views.pickupview.caption',
srfTitle: 'entities.lead.views.pickupview.title',
srfSubTitle: 'entities.lead.views.pickupview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof LeadPickupViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
Object.assign(this.viewparams, JSON.parse(this.viewparam));
if(this.viewparams.selectedData){
this.selectedData = JSON.stringify(this.viewparams.selectedData);
}
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof LeadPickupViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
}
}
/**
* 容器模型
*
* @type {*}
* @memberof LeadPickupViewBase
*/
public containerModel: any = {
view_pickupviewpanel: { name: 'pickupviewpanel', type: 'PICKUPVIEWPANEL' },
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 },
};
/**
* 计数器刷新
*
* @memberof LeadPickupViewBase
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof LeadPickupViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof LeadPickupViewBase
*/
public engine: PickupViewEngine = new PickupViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof LeadPickupViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
pickupviewpanel: this.$refs.pickupviewpanel,
keyPSDEField: 'lead',
majorPSDEField: 'fullname',
isLoadDefault: true,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof LeadPickupViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof LeadPickupViewBase
*/
public viewparams:any = {};
/**
* 解析视图参数
*
* @public
* @memberof LeadPickupViewBase
*/
public parseViewParam(): void {
for(let key in this.context){
delete this.context[key];
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: matchArray[index + 1]
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
}
/**
* 处理自定义视图数据
*
* @memberof LeadPickupViewBase
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof LeadPickupViewBase
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()]){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* Vue声明周期
*
* @memberof LeadPickupViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof LeadPickupViewBase
*/
public afterCreated(){
const secondtag = this.$util.createUUID();
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
}
/**
* 销毁之前
*
* @memberof LeadPickupViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof LeadPickupViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof LeadPickupViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
if(this.viewparams.selectedData){
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', this.viewparams.selectedData);
}
}
/**
* pickupviewpanel 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof LeadPickupViewBase
*/
public pickupviewpanel_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', $event);
}
/**
* pickupviewpanel 部件 activated 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof LeadPickupViewBase
*/
public pickupviewpanel_activated($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'activated', $event);
}
/**
* pickupviewpanel 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof LeadPickupViewBase
*/
public pickupviewpanel_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('pickupviewpanel', 'load', $event);
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof LeadPickupViewBase
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', [args]);
_view.$emit('close', [args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof LeadPickupViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof LeadPickupViewBase
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
}
}
/**
* 选中数据的字符串
*
* @type {string}
* @memberof LeadPickupView
*/
public selectedData: string = "";
/**
* 视图选中数据
*
* @type {any[]}
* @memberof LeadPickupViewBase
*/
public viewSelections:any[] = [];
/**
* 是否显示按钮
*
* @type {boolean}
* @memberof LeadPickupViewBase
*/
@Prop({default: true}) public isShowButton!: boolean;
/**
* 是否单选
*
* @type {boolean}
* @memberof LeadPickupViewBase
*/
public isSingleSelect: boolean = true;
/**
* 确定
*
* @memberof LeadPickupViewBase
*/
public onClickOk(): void {
this.$emit('viewdataschange', this.viewSelections);
this.$emit('close', null);
}
/**
* 取消
*
* @memberof LeadPickupViewBase
*/
public onClickCancel(): void {
this.$emit('close', null);
}
}
</script>
<style lang='less'>
@import './lead-pickup-view.less';
</style>
\ No newline at end of file
// 避免空文件,后台不让空文件过
.lead-pickup-view {
--lead-pickup-view: 0;
}
.pickup-view {
>.pickupviewpanel {
flex-grow: 1;
display: flex;
justify-content: flex-end;
height: calc(100% - 64px);
}
>.footer {
height: 64px;
}
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import LeadPickupViewBase from './lead-pickup-view-base.vue';
import view_pickupviewpanel from '@widgets/lead/pickup-viewpickupviewpanel-pickupviewpanel/pickup-viewpickupviewpanel-pickupviewpanel.vue';
@Component({
components: {
view_pickupviewpanel,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$store.commit('addCurPageViewtag', { route: to, viewtag: vm.viewtag });
});
},
})
export default class LeadPickupView extends LeadPickupViewBase {
}
</script>
\ No newline at end of file
...@@ -7,7 +7,6 @@ export const PageComponents = { ...@@ -7,7 +7,6 @@ export const PageComponents = {
Vue.component('sales-order-edit-view', () => import('@pages/sales/sales-order-edit-view/sales-order-edit-view.vue')); Vue.component('sales-order-edit-view', () => import('@pages/sales/sales-order-edit-view/sales-order-edit-view.vue'));
Vue.component('account-edit-view', () => import('@pages/base/account-edit-view/account-edit-view.vue')); Vue.component('account-edit-view', () => import('@pages/base/account-edit-view/account-edit-view.vue'));
Vue.component('fax-edit-view', () => import('@pages/base/fax-edit-view/fax-edit-view.vue')); Vue.component('fax-edit-view', () => import('@pages/base/fax-edit-view/fax-edit-view.vue'));
Vue.component('contact-abstract-edit-view9', () => import('@pages/base/contact-abstract-edit-view9/contact-abstract-edit-view9.vue'));
Vue.component('lead-pickup-view', () => import('@pages/sales/lead-pickup-view/lead-pickup-view.vue')); Vue.component('lead-pickup-view', () => import('@pages/sales/lead-pickup-view/lead-pickup-view.vue'));
Vue.component('incident-edit-view', () => import('@pages/service/incident-edit-view/incident-edit-view.vue')); Vue.component('incident-edit-view', () => import('@pages/service/incident-edit-view/incident-edit-view.vue'));
Vue.component('activity-pointer-edit-view', () => import('@pages/base/activity-pointer-edit-view/activity-pointer-edit-view.vue')); Vue.component('activity-pointer-edit-view', () => import('@pages/base/activity-pointer-edit-view/activity-pointer-edit-view.vue'));
...@@ -27,7 +26,6 @@ export const PageComponents = { ...@@ -27,7 +26,6 @@ export const PageComponents = {
Vue.component('goal-edit-view', () => import('@pages/sales/goal-edit-view/goal-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('transaction-currency-pickup-view', () => import('@pages/base/transaction-currency-pickup-view/transaction-currency-pickup-view.vue'));
Vue.component('account-address', () => import('@pages/base/account-address/account-address.vue')); Vue.component('account-address', () => import('@pages/base/account-address/account-address.vue'));
Vue.component('contact-detail-info-edit-view9', () => import('@pages/base/contact-detail-info-edit-view9/contact-detail-info-edit-view9.vue'));
Vue.component('appointment-edit-view', () => import('@pages/base/appointment-edit-view/appointment-edit-view.vue')); Vue.component('appointment-edit-view', () => import('@pages/base/appointment-edit-view/appointment-edit-view.vue'));
Vue.component('contact-tab-exp-view', () => import('@pages/base/contact-tab-exp-view/contact-tab-exp-view.vue')); Vue.component('contact-tab-exp-view', () => import('@pages/base/contact-tab-exp-view/contact-tab-exp-view.vue'));
Vue.component('email-edit-view', () => import('@pages/base/email-edit-view/email-edit-view.vue')); Vue.component('email-edit-view', () => import('@pages/base/email-edit-view/email-edit-view.vue'));
...@@ -62,7 +60,9 @@ export const PageComponents = { ...@@ -62,7 +60,9 @@ export const PageComponents = {
Vue.component('quote-edit-view', () => import('@pages/sales/quote-edit-view/quote-edit-view.vue')); Vue.component('quote-edit-view', () => import('@pages/sales/quote-edit-view/quote-edit-view.vue'));
Vue.component('incident-grid-view', () => import('@pages/service/incident-grid-view/incident-grid-view.vue')); Vue.component('incident-grid-view', () => import('@pages/service/incident-grid-view/incident-grid-view.vue'));
Vue.component('account-edit-account-info', () => import('@pages/base/account-edit-account-info/account-edit-account-info.vue')); Vue.component('account-edit-account-info', () => import('@pages/base/account-edit-account-info/account-edit-account-info.vue'));
Vue.component('contact-detail-info-edit-view9', () => import('@pages/base/contact-detail-info-edit-view9/contact-detail-info-edit-view9.vue'));
Vue.component('account-edit-address', () => import('@pages/base/account-edit-address/account-edit-address.vue')); Vue.component('account-edit-address', () => import('@pages/base/account-edit-address/account-edit-address.vue'));
Vue.component('contact-abstract-edit-view9', () => import('@pages/base/contact-abstract-edit-view9/contact-abstract-edit-view9.vue'));
Vue.component('contact-pickup-view', () => import('@pages/base/contact-pickup-view/contact-pickup-view.vue')); Vue.component('contact-pickup-view', () => import('@pages/base/contact-pickup-view/contact-pickup-view.vue'));
} }
}; };
\ No newline at end of file
...@@ -1024,6 +1024,19 @@ const router = new Router({ ...@@ -1024,6 +1024,19 @@ const router = new Router({
}, },
component: () => import('@pages/sales/lead-grid-view/lead-grid-view.vue'), component: () => import('@pages/sales/lead-grid-view/lead-grid-view.vue'),
}, },
{
path: '/leads/:lead?/pickupview/:pickupview?',
meta: {
caption: 'entities.lead.views.pickupview.title',
info:'',
parameters: [
{ pathName: 'leads', parameterName: 'lead' },
{ pathName: 'pickupview', parameterName: 'pickupview' },
],
requireAuth: true,
},
component: () => import('@pages/sales/lead-pickup-view/lead-pickup-view.vue'),
},
{ {
path: '/accounts/:account?/accountinfo/:accountinfo?', path: '/accounts/:account?/accountinfo/:accountinfo?',
meta: { meta: {
...@@ -1219,6 +1232,19 @@ const router = new Router({ ...@@ -1219,6 +1232,19 @@ const router = new Router({
}, },
component: () => import('@pages/sales/opportunity-grid-view/opportunity-grid-view.vue'), component: () => import('@pages/sales/opportunity-grid-view/opportunity-grid-view.vue'),
}, },
{
path: '/contacts/:contact?/detailinfoeditview9/:detailinfoeditview9?',
meta: {
caption: 'entities.contact.views.detailinfoeditview9.title',
info:'',
parameters: [
{ pathName: 'contacts', parameterName: 'contact' },
{ pathName: 'detailinfoeditview9', parameterName: 'detailinfoeditview9' },
],
requireAuth: true,
},
component: () => import('@pages/base/contact-detail-info-edit-view9/contact-detail-info-edit-view9.vue'),
},
{ {
path: '/goals/:goal?/gridview/:gridview?', path: '/goals/:goal?/gridview/:gridview?',
meta: { meta: {
...@@ -1232,6 +1258,19 @@ const router = new Router({ ...@@ -1232,6 +1258,19 @@ const router = new Router({
}, },
component: () => import('@pages/sales/goal-grid-view/goal-grid-view.vue'), component: () => import('@pages/sales/goal-grid-view/goal-grid-view.vue'),
}, },
{
path: '/transactioncurrencies/:transactioncurrency?/pickupgridview/:pickupgridview?',
meta: {
caption: 'entities.transactioncurrency.views.pickupgridview.title',
info:'',
parameters: [
{ pathName: 'transactioncurrencies', parameterName: 'transactioncurrency' },
{ pathName: 'pickupgridview', parameterName: 'pickupgridview' },
],
requireAuth: true,
},
component: () => import('@pages/base/transaction-currency-pickup-grid-view/transaction-currency-pickup-grid-view.vue'),
},
{ {
path: '/accounts/:account?/editview/:editview?', path: '/accounts/:account?/editview/:editview?',
meta: { meta: {
...@@ -1297,6 +1336,19 @@ const router = new Router({ ...@@ -1297,6 +1336,19 @@ const router = new Router({
}, },
component: () => import('@pages/sales/opportunity-edit-view/opportunity-edit-view.vue'), component: () => import('@pages/sales/opportunity-edit-view/opportunity-edit-view.vue'),
}, },
{
path: '/leads/:lead?/pickupgridview/:pickupgridview?',
meta: {
caption: 'entities.lead.views.pickupgridview.title',
info:'',
parameters: [
{ pathName: 'leads', parameterName: 'lead' },
{ pathName: 'pickupgridview', parameterName: 'pickupgridview' },
],
requireAuth: true,
},
component: () => import('@pages/sales/lead-pickup-grid-view/lead-pickup-grid-view.vue'),
},
{ {
path: '/centeralportal/:centeralportal?', path: '/centeralportal/:centeralportal?',
meta: { meta: {
...@@ -1375,30 +1427,30 @@ const router = new Router({ ...@@ -1375,30 +1427,30 @@ const router = new Router({
component: () => import('@pages/base/account-address/account-address.vue'), component: () => import('@pages/base/account-address/account-address.vue'),
}, },
{ {
path: '/serviceappointments/:serviceappointment?/editview/:editview?', path: '/contacts/:contact?/abstracteditview9/:abstracteditview9?',
meta: { meta: {
caption: 'entities.serviceappointment.views.editview.title', caption: 'entities.contact.views.abstracteditview9.title',
info:'', info:'',
parameters: [ parameters: [
{ pathName: 'serviceappointments', parameterName: 'serviceappointment' }, { pathName: 'contacts', parameterName: 'contact' },
{ pathName: 'editview', parameterName: 'editview' }, { pathName: 'abstracteditview9', parameterName: 'abstracteditview9' },
], ],
requireAuth: true, requireAuth: true,
}, },
component: () => import('@pages/service/service-appointment-edit-view/service-appointment-edit-view.vue'), component: () => import('@pages/base/contact-abstract-edit-view9/contact-abstract-edit-view9.vue'),
}, },
{ {
path: '/contacts/:contact?/editview/:editview?', path: '/serviceappointments/:serviceappointment?/editview/:editview?',
meta: { meta: {
caption: 'entities.contact.views.editview.title', caption: 'entities.serviceappointment.views.editview.title',
info:'', info:'',
parameters: [ parameters: [
{ pathName: 'contacts', parameterName: 'contact' }, { pathName: 'serviceappointments', parameterName: 'serviceappointment' },
{ pathName: 'editview', parameterName: 'editview' }, { pathName: 'editview', parameterName: 'editview' },
], ],
requireAuth: true, requireAuth: true,
}, },
component: () => import('@pages/base/contact-edit-view/contact-edit-view.vue'), component: () => import('@pages/service/service-appointment-edit-view/service-appointment-edit-view.vue'),
}, },
{ {
path: '/appointments/:appointment?/editview/:editview?', path: '/appointments/:appointment?/editview/:editview?',
...@@ -1569,6 +1621,19 @@ const router = new Router({ ...@@ -1569,6 +1621,19 @@ const router = new Router({
}, },
component: () => import('@pages/sales/competitor-grid-view/competitor-grid-view.vue'), component: () => import('@pages/sales/competitor-grid-view/competitor-grid-view.vue'),
}, },
{
path: '/transactioncurrencies/:transactioncurrency?/pickupview/:pickupview?',
meta: {
caption: 'entities.transactioncurrency.views.pickupview.title',
info:'',
parameters: [
{ pathName: 'transactioncurrencies', parameterName: 'transactioncurrency' },
{ pathName: 'pickupview', parameterName: 'pickupview' },
],
requireAuth: true,
},
component: () => import('@pages/base/transaction-currency-pickup-view/transaction-currency-pickup-view.vue'),
},
{ {
path: '/pricelevels/:pricelevel?/pickupgridview/:pickupgridview?', path: '/pricelevels/:pricelevel?/pickupgridview/:pickupgridview?',
meta: { meta: {
...@@ -1685,6 +1750,19 @@ const router = new Router({ ...@@ -1685,6 +1750,19 @@ const router = new Router({
requireAuth: true, requireAuth: true,
}, },
component: () => import('@pages/sales/competitor-edit-view/competitor-edit-view.vue'), component: () => import('@pages/sales/competitor-edit-view/competitor-edit-view.vue'),
},
{
path: '/contacts/:contact?/tabexpview/:tabexpview?',
meta: {
caption: 'entities.contact.views.tabexpview.title',
info:'',
parameters: [
{ pathName: 'contacts', parameterName: 'contact' },
{ pathName: 'tabexpview', parameterName: 'tabexpview' },
],
requireAuth: true,
},
component: () => import('@pages/base/contact-tab-exp-view/contact-tab-exp-view.vue'),
}, },
...globalRoutes, ...globalRoutes,
{ {
......
...@@ -72,6 +72,16 @@ export const viewstate: any = { ...@@ -72,6 +72,16 @@ export const viewstate: any = {
'2e17cb1d009dd49ac529319ac15319cd', '2e17cb1d009dd49ac529319ac15319cd',
], ],
}, },
{
viewtag: '1bc48b15dbe69c5f30dafe489f58aacb',
viewmodule: 'Sales',
viewname: 'LeadPickupView',
viewaction: '',
viewdatachange: false,
refviews: [
'7d00f63c306adf3537efeabb3326095d',
],
},
{ {
viewtag: '1d3b94223a5d3f8ab1d2fe334c8c4afd', viewtag: '1d3b94223a5d3f8ab1d2fe334c8c4afd',
viewmodule: 'Base', viewmodule: 'Base',
...@@ -239,6 +249,17 @@ export const viewstate: any = { ...@@ -239,6 +249,17 @@ export const viewstate: any = {
'7bf35293fd1d9db7816755a74c4d575e', '7bf35293fd1d9db7816755a74c4d575e',
], ],
}, },
{
viewtag: '60093dd36f07238d7a7e72e9ed372942',
viewmodule: 'Base',
viewname: 'ContactDetailInfoEditView9',
viewaction: '',
viewdatachange: false,
refviews: [
'da3f8c1f20f440f3df54d6c13a8de586',
'1bc48b15dbe69c5f30dafe489f58aacb',
],
},
{ {
viewtag: '631a4276161c551802f3aaf4bd7e607c', viewtag: '631a4276161c551802f3aaf4bd7e607c',
viewmodule: 'Sales', viewmodule: 'Sales',
...@@ -249,6 +270,15 @@ export const viewstate: any = { ...@@ -249,6 +270,15 @@ export const viewstate: any = {
'7877d7e7e55fe21f48e8382e07579f33', '7877d7e7e55fe21f48e8382e07579f33',
], ],
}, },
{
viewtag: '6d8a2615030eed5779caea69f7f001aa',
viewmodule: 'Base',
viewname: 'TransactionCurrencyPickupGridView',
viewaction: '',
viewdatachange: false,
refviews: [
],
},
{ {
viewtag: '6e18ac74e5685439110f9b4e534ee005', viewtag: '6e18ac74e5685439110f9b4e534ee005',
viewmodule: 'Base', viewmodule: 'Base',
...@@ -296,6 +326,15 @@ export const viewstate: any = { ...@@ -296,6 +326,15 @@ export const viewstate: any = {
refviews: [ refviews: [
], ],
}, },
{
viewtag: '7d00f63c306adf3537efeabb3326095d',
viewmodule: 'Sales',
viewname: 'LeadPickupGridView',
viewaction: '',
viewdatachange: false,
refviews: [
],
},
{ {
viewtag: '7FCD2E75-E34A-493C-922E-8AE47BCE08CA', viewtag: '7FCD2E75-E34A-493C-922E-8AE47BCE08CA',
viewmodule: 'Ungroup', viewmodule: 'Ungroup',
...@@ -377,18 +416,18 @@ export const viewstate: any = { ...@@ -377,18 +416,18 @@ export const viewstate: any = {
], ],
}, },
{ {
viewtag: '99d4a530c13b03a98cd143f341394354', viewtag: '928f354b1e67a8b855b7f19f485299b0',
viewmodule: 'Service', viewmodule: 'Base',
viewname: 'ServiceAppointmentEditView', viewname: 'ContactAbstractEditView9',
viewaction: '', viewaction: '',
viewdatachange: false, viewdatachange: false,
refviews: [ refviews: [
], ],
}, },
{ {
viewtag: '9a96ebf2e57358b3590b9d4479edb77a', viewtag: '99d4a530c13b03a98cd143f341394354',
viewmodule: 'Base', viewmodule: 'Service',
viewname: 'ContactEditView', viewname: 'ServiceAppointmentEditView',
viewaction: '', viewaction: '',
viewdatachange: false, viewdatachange: false,
refviews: [ refviews: [
...@@ -527,6 +566,16 @@ export const viewstate: any = { ...@@ -527,6 +566,16 @@ export const viewstate: any = {
'fc2117de593df9cc982bd802cbdb2154', 'fc2117de593df9cc982bd802cbdb2154',
], ],
}, },
{
viewtag: 'da3f8c1f20f440f3df54d6c13a8de586',
viewmodule: 'Base',
viewname: 'TransactionCurrencyPickupView',
viewaction: '',
viewdatachange: false,
refviews: [
'6d8a2615030eed5779caea69f7f001aa',
],
},
{ {
viewtag: 'dd10cba0f2ded085120f7dc8eccc7c10', viewtag: 'dd10cba0f2ded085120f7dc8eccc7c10',
viewmodule: 'Product', viewmodule: 'Product',
...@@ -611,6 +660,17 @@ export const viewstate: any = { ...@@ -611,6 +660,17 @@ export const viewstate: any = {
refviews: [ refviews: [
], ],
}, },
{
viewtag: 'fcdb236b65d78c4a8ae64e74f9483a63',
viewmodule: 'Base',
viewname: 'ContactTabExpView',
viewaction: '',
viewdatachange: false,
refviews: [
'60093dd36f07238d7a7e72e9ed372942',
'928f354b1e67a8b855b7f19f485299b0',
],
},
], ],
createdviews: [], createdviews: [],
} }
\ No newline at end of file
<template>
<i-form :model="this.data" class='app-form' ref='form' id='contact_detailinfo' 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.contact.detailinfo_form.details.group1')" :isShowCaption="true" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.gendercode.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='gendercode' :itemRules="this.rules.gendercode" class='' :caption="$t('entities.contact.detailinfo_form.details.gendercode')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.gendercode.error" :isEmptyCaption="false" labelPos="LEFT">
<dropdown-list
v-model="data.gendercode"
:data="data"
:context="context"
:viewparams="viewparams"
:localContext ='{ }'
:localParam ='{ }'
:disabled="detailsModel.gendercode.disabled"
tag='Contact__GenderCode'
codelistType='STATIC'
placeholder='请选择...' style="">
</dropdown-list>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.familystatuscode.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='familystatuscode' :itemRules="this.rules.familystatuscode" class='' :caption="$t('entities.contact.detailinfo_form.details.familystatuscode')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.familystatuscode.error" :isEmptyCaption="false" labelPos="LEFT">
<dropdown-list
v-model="data.familystatuscode"
:data="data"
:context="context"
:viewparams="viewparams"
:localContext ='{ }'
:localParam ='{ }'
:disabled="detailsModel.familystatuscode.disabled"
tag='Contact__FamilyStatusCode'
codelistType='STATIC'
placeholder='请选择...' style="">
</dropdown-list>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.spousesname.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='spousesname' :itemRules="this.rules.spousesname" class='' :caption="$t('entities.contact.detailinfo_form.details.spousesname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.spousesname.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.spousesname" @enter="onEnter($event)" unit="" :disabled="detailsModel.spousesname.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.birthdate.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='birthdate' :itemRules="this.rules.birthdate" class='' :caption="$t('entities.contact.detailinfo_form.details.birthdate')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.birthdate.error" :isEmptyCaption="false" labelPos="LEFT">
<date-picker type="datetime" :transfer="true" format="yyyy-MM-dd HH:mm:ss" placeholder="请选择时间..." :value="data.birthdate" :disabled="detailsModel.birthdate.disabled" style="min-width: 150px; width:160px;" @on-change="(val1, val2) => { this.data.birthdate = val1 }"></date-picker>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.anniversary.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='anniversary' :itemRules="this.rules.anniversary" class='' :caption="$t('entities.contact.detailinfo_form.details.anniversary')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.anniversary.error" :isEmptyCaption="false" labelPos="LEFT">
<date-picker type="datetime" :transfer="true" format="yyyy-MM-dd HH:mm:ss" placeholder="请选择时间..." :value="data.anniversary" :disabled="detailsModel.anniversary.disabled" style="min-width: 150px; width:160px;" @on-change="(val1, val2) => { this.data.anniversary = val1 }"></date-picker>
</app-form-item>
</i-col>
</row>
</app-form-group>
</i-col>
<i-col v-show="detailsModel.grouppanel1.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.grouppanel1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.contact.detailinfo_form.details.grouppanel1')" :isShowCaption="true" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.originatingleadname.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='originatingleadname' :itemRules="this.rules.originatingleadname" class='' :caption="$t('entities.contact.detailinfo_form.details.originatingleadname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.originatingleadname.error" :isEmptyCaption="false" labelPos="LEFT">
<app-picker
:formState="formState"
:data="data"
:context="context"
:viewparams="viewparams"
:localContext ='{ }'
:localParam ='{ }'
:disabled="detailsModel.originatingleadname.disabled"
name='originatingleadname'
deMajorField='fullname'
deKeyField='lead'
:service="service"
:acParams="{ serviceName: 'LeadService', interfaceName: 'FetchDefault'}"
valueitem='originatingleadid'
:value="data.originatingleadname"
editortype=""
:pickupView="{ viewname: 'lead-pickup-view', title: $t('entities.lead.views.pickupview.title'), deResParameters: [], parameters: [{ pathName: 'leads', parameterName: 'lead' }, { pathName: 'pickupview', parameterName: 'pickupview' } ], placement:'' }"
style=""
@formitemvaluechange="onFormItemValueChange">
</app-picker>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.lastusedincampaign.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='lastusedincampaign' :itemRules="this.rules.lastusedincampaign" class='' :caption="$t('entities.contact.detailinfo_form.details.lastusedincampaign')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.lastusedincampaign.error" :isEmptyCaption="false" labelPos="LEFT">
<date-picker type="datetime" :transfer="true" format="yyyy-MM-dd HH:mm:ss" placeholder="请选择时间..." :value="data.lastusedincampaign" :disabled="detailsModel.lastusedincampaign.disabled" style="min-width: 150px; width:160px;" @on-change="(val1, val2) => { this.data.lastusedincampaign = val1 }"></date-picker>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.donotsendmm.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='donotsendmm' :itemRules="this.rules.donotsendmm" class='' :caption="$t('entities.contact.detailinfo_form.details.donotsendmm')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.donotsendmm.error" :isEmptyCaption="false" labelPos="LEFT">
<dropdown-list
v-model="data.donotsendmm"
:data="data"
:context="context"
:viewparams="viewparams"
:localContext ='{ }'
:localParam ='{ }'
:disabled="detailsModel.donotsendmm.disabled"
style="width:100px;width: 100px;"
tag='YesNo'
codelistType='STATIC'
placeholder='请选择...'>
</dropdown-list>
</app-form-item>
</i-col>
</row>
</app-form-group>
</i-col>
<i-col v-show="detailsModel.grouppanel2.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.grouppanel2.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.contact.detailinfo_form.details.grouppanel2')" :isShowCaption="true" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.transactioncurrencyname.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='transactioncurrencyname' :itemRules="this.rules.transactioncurrencyname" class='' :caption="$t('entities.contact.detailinfo_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.creditlimit.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='creditlimit' :itemRules="this.rules.creditlimit" class='' :caption="$t('entities.contact.detailinfo_form.details.creditlimit')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.creditlimit.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.creditlimit" @enter="onEnter($event)" unit="" :disabled="detailsModel.creditlimit.disabled" type='number' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.creditonhold.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='creditonhold' :itemRules="this.rules.creditonhold" class='' :caption="$t('entities.contact.detailinfo_form.details.creditonhold')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.creditonhold.error" :isEmptyCaption="false" labelPos="LEFT">
<dropdown-list
v-model="data.creditonhold"
:data="data"
:context="context"
:viewparams="viewparams"
:localContext ='{ }'
:localParam ='{ }'
:disabled="detailsModel.creditonhold.disabled"
style="width:100px;width: 100px;"
tag='YesNo'
codelistType='STATIC'
placeholder='请选择...'>
</dropdown-list>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.paymenttermscode.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='paymenttermscode' :itemRules="this.rules.paymenttermscode" class='' :caption="$t('entities.contact.detailinfo_form.details.paymenttermscode')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.paymenttermscode.error" :isEmptyCaption="false" labelPos="LEFT">
<dropdown-list
v-model="data.paymenttermscode"
:data="data"
:context="context"
:viewparams="viewparams"
:localContext ='{ }'
:localParam ='{ }'
:disabled="detailsModel.paymenttermscode.disabled"
tag='Contact__PaymentTermsCode'
codelistType='STATIC'
placeholder='请选择...' style="">
</dropdown-list>
</app-form-item>
</i-col>
</row>
</app-form-group>
</i-col>
<i-col v-show="detailsModel.grouppanel3.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.grouppanel3.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.contact.detailinfo_form.details.grouppanel3')" :isShowCaption="true" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.shippingmethodcode.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='shippingmethodcode' :itemRules="this.rules.shippingmethodcode" class='' :caption="$t('entities.contact.detailinfo_form.details.shippingmethodcode')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.shippingmethodcode.error" :isEmptyCaption="false" labelPos="LEFT">
<dropdown-list
v-model="data.shippingmethodcode"
:data="data"
:context="context"
:viewparams="viewparams"
:localContext ='{ }'
:localParam ='{ }'
:disabled="detailsModel.shippingmethodcode.disabled"
tag='Contact__ShippingMethodCode'
codelistType='STATIC'
placeholder='请选择...' style="">
</dropdown-list>
</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 ContactService from '@/service/contact/contact-service';
import DetailInfoService from './detail-info-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 DetailInfoBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof DetailInfo
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof DetailInfo
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof DetailInfo
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof DetailInfo
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof DetailInfo
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof DetailInfo
*/
public getControlType(): string {
return 'FORM'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof DetailInfo
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {DetailInfoService}
* @memberof DetailInfo
*/
public service: DetailInfoService = new DetailInfoService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {ContactService}
* @memberof DetailInfo
*/
public appEntityService: ContactService = new ContactService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof DetailInfo
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof DetailInfo
*/
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 DetailInfo
*/
public srfwfmemo:string = "";
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof DetailInfo
*/
public getDatas(): any[] {
return [this.data];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof DetailInfo
*/
public getData(): any {
return this.data;
}
/**
* 是否默认保存
*
* @type {boolean}
* @memberof DetailInfo
*/
@Prop({ default: false }) public autosave?: boolean;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof DetailInfo
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--submit
*
* @type {string}
* @memberof DetailInfo
*/
@Prop() public WFSubmitAction!: string;
/**
* 部件行为--start
*
* @type {string}
* @memberof DetailInfo
*/
@Prop() public WFStartAction!: string;
/**
* 部件行为--update
*
* @type {string}
* @memberof DetailInfo
*/
@Prop() public updateAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof DetailInfo
*/
@Prop() public removeAction!: string;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof DetailInfo
*/
@Prop() public loaddraftAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof DetailInfo
*/
@Prop() public loadAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof DetailInfo
*/
@Prop() public createAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof DetailInfo
*/
@Prop() public searchAction!: string;
/**
* 视图标识
*
* @type {string}
* @memberof DetailInfo
*/
@Prop() public viewtag!: string;
/**
* 表单状态
*
* @type {Subject<any>}
* @memberof DetailInfo
*/
public formState: Subject<any> = new Subject();
/**
* 忽略表单项值变化
*
* @type {boolean}
* @memberof DetailInfo
*/
public ignorefieldvaluechange: boolean = false;
/**
* 数据变化
*
* @public
* @type {Subject<any>}
* @memberof DetailInfo
*/
public dataChang: Subject<any> = new Subject();
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof DetailInfo
*/
public dataChangEvent: Subscription | undefined;
/**
* 原始数据
*
* @public
* @type {*}
* @memberof DetailInfo
*/
public oldData: any = {};
/**
* 表单数据对象
*
* @type {*}
* @memberof DetailInfo
*/
public data: any = {
srfupdatedate: null,
srforikey: null,
srfkey: null,
srfmajortext: null,
srftempmode: null,
srfuf: null,
srfdeid: null,
srfsourcekey: null,
gendercode: null,
familystatuscode: null,
spousesname: null,
birthdate: null,
anniversary: null,
originatingleadname: null,
lastusedincampaign: null,
donotsendmm: null,
transactioncurrencyname: null,
creditlimit: null,
creditonhold: null,
paymenttermscode: null,
shippingmethodcode: null,
originatingleadid: null,
transactioncurrencyid: null,
contactid: null,
contact:null,
};
/**
* 当前执行的行为逻辑
*
* @type {string}
* @memberof DetailInfo
*/
public currentAction: string = "";
/**
* 关系界面计数器
*
* @type {number}
* @memberof DetailInfo
*/
public drcounter: number = 0;
/**
* 需要等待关系界面保存时,第一次调用save参数的备份
*
* @type {number}
* @memberof DetailInfo
*/
public drsaveopt: any = {};
/**
* 表单保存回调存储对象
*
* @type {any}
* @memberof DetailInfo
*/
public saveState:any ;
/**
* 属性值规则
*
* @type {*}
* @memberof DetailInfo
*/
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' },
],
gendercode: [
{ type: 'string', message: '性别 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '性别 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '性别 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '性别 值不能为空', trigger: 'blur' },
],
familystatuscode: [
{ type: 'string', message: '婚姻状况 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '婚姻状况 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '婚姻状况 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '婚姻状况 值不能为空', trigger: 'blur' },
],
spousesname: [
{ type: 'string', message: '配偶/伴侣姓名 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '配偶/伴侣姓名 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '配偶/伴侣姓名 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '配偶/伴侣姓名 值不能为空', trigger: 'blur' },
],
birthdate: [
{ type: 'string', message: '生日 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '生日 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '生日 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '生日 值不能为空', trigger: 'blur' },
],
anniversary: [
{ type: 'string', message: '纪念日 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '纪念日 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '纪念日 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '纪念日 值不能为空', trigger: 'blur' },
],
originatingleadname: [
{ type: 'string', message: '原始潜在顾客 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '原始潜在顾客 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '原始潜在顾客 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '原始潜在顾客 值不能为空', trigger: 'blur' },
],
lastusedincampaign: [
{ type: 'string', message: '上次参与市场活动的日期 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '上次参与市场活动的日期 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '上次参与市场活动的日期 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '上次参与市场活动的日期 值不能为空', trigger: 'blur' },
],
donotsendmm: [
{ type: 'number', message: '发送市场营销资料 值必须为数值类型', trigger: 'change' },
{ type: 'number', message: '发送市场营销资料 值必须为数值类型', trigger: 'blur' },
{ required: false, type: 'number', message: '发送市场营销资料 值不能为空', trigger: 'change' },
{ required: false, type: 'number', 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' },
],
creditlimit: [
{ type: 'number', message: '信用额度 值必须为数值类型', trigger: 'change' },
{ type: 'number', message: '信用额度 值必须为数值类型', trigger: 'blur' },
{ required: false, type: 'number', message: '信用额度 值不能为空', trigger: 'change' },
{ required: false, type: 'number', message: '信用额度 值不能为空', trigger: 'blur' },
],
creditonhold: [
{ type: 'number', message: '信用冻结 值必须为数值类型', trigger: 'change' },
{ type: 'number', message: '信用冻结 值必须为数值类型', trigger: 'blur' },
{ required: false, type: 'number', message: '信用冻结 值不能为空', trigger: 'change' },
{ required: false, type: 'number', message: '信用冻结 值不能为空', trigger: 'blur' },
],
paymenttermscode: [
{ type: 'string', message: '付款方式 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '付款方式 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '付款方式 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '付款方式 值不能为空', trigger: 'blur' },
],
shippingmethodcode: [
{ type: 'string', message: '送货方式 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '送货方式 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '送货方式 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '送货方式 值不能为空', trigger: 'blur' },
],
originatingleadid: [
{ 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' },
],
contactid: [
{ 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 DetailInfo
*/
public detailsModel: any = {
group1: new FormGroupPanelModel({ caption: '个人信息', detailType: 'GROUPPANEL', name: 'group1', visible: true, isShowCaption: true, form: this, uiActionGroup: { caption: '', langbase: 'entities.contact.detailinfo_form', extractMode: 'ITEM', details: [] } })
,
grouppanel1: new FormGroupPanelModel({ caption: '市场营销', detailType: 'GROUPPANEL', name: 'grouppanel1', visible: true, isShowCaption: true, form: this, uiActionGroup: { caption: '', langbase: 'entities.contact.detailinfo_form', extractMode: 'ITEM', details: [] } })
,
grouppanel2: new FormGroupPanelModel({ caption: '记账', detailType: 'GROUPPANEL', name: 'grouppanel2', visible: true, isShowCaption: true, form: this, uiActionGroup: { caption: '', langbase: 'entities.contact.detailinfo_form', extractMode: 'ITEM', details: [] } })
,
grouppanel3: new FormGroupPanelModel({ caption: '送货', detailType: 'GROUPPANEL', name: 'grouppanel3', visible: true, isShowCaption: true, form: this, uiActionGroup: { caption: '', langbase: 'entities.contact.detailinfo_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 })
,
gendercode: new FormItemModel({ caption: '性别', detailType: 'FORMITEM', name: 'gendercode', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
familystatuscode: new FormItemModel({ caption: '婚姻状况', detailType: 'FORMITEM', name: 'familystatuscode', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
spousesname: new FormItemModel({ caption: '配偶/伴侣姓名', detailType: 'FORMITEM', name: 'spousesname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
birthdate: new FormItemModel({ caption: '生日', detailType: 'FORMITEM', name: 'birthdate', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
anniversary: new FormItemModel({ caption: '纪念日', detailType: 'FORMITEM', name: 'anniversary', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
originatingleadname: new FormItemModel({ caption: '原始潜在顾客', detailType: 'FORMITEM', name: 'originatingleadname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
lastusedincampaign: new FormItemModel({ caption: '上次参与市场活动的日期', detailType: 'FORMITEM', name: 'lastusedincampaign', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 2 })
,
donotsendmm: new FormItemModel({ caption: '发送市场营销资料', detailType: 'FORMITEM', name: 'donotsendmm', 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 })
,
creditlimit: new FormItemModel({ caption: '信用额度', detailType: 'FORMITEM', name: 'creditlimit', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
creditonhold: new FormItemModel({ caption: '信用冻结', detailType: 'FORMITEM', name: 'creditonhold', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
paymenttermscode: new FormItemModel({ caption: '付款方式', detailType: 'FORMITEM', name: 'paymenttermscode', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
shippingmethodcode: new FormItemModel({ caption: '送货方式', detailType: 'FORMITEM', name: 'shippingmethodcode', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
originatingleadid: new FormItemModel({ caption: '原始潜在顾客', detailType: 'FORMITEM', name: 'originatingleadid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 1 })
,
transactioncurrencyid: new FormItemModel({ caption: '货币', detailType: 'FORMITEM', name: 'transactioncurrencyid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
contactid: new FormItemModel({ caption: '联系人', detailType: 'FORMITEM', name: 'contactid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 1 })
,
};
/**
* 监控表单属性 srfupdatedate 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.srfupdatedate')
onSrfupdatedateChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfupdatedate', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srforikey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.srforikey')
onSrforikeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srforikey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfkey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.srfkey')
onSrfkeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfkey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfmajortext 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.srfmajortext')
onSrfmajortextChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfmajortext', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srftempmode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.srftempmode')
onSrftempmodeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srftempmode', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfuf 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.srfuf')
onSrfufChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfuf', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfdeid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.srfdeid')
onSrfdeidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfdeid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfsourcekey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.srfsourcekey')
onSrfsourcekeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfsourcekey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 gendercode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.gendercode')
onGendercodeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'gendercode', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 familystatuscode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.familystatuscode')
onFamilystatuscodeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'familystatuscode', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 spousesname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.spousesname')
onSpousesnameChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'spousesname', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 birthdate 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.birthdate')
onBirthdateChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'birthdate', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 anniversary 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.anniversary')
onAnniversaryChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'anniversary', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 originatingleadname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.originatingleadname')
onOriginatingleadnameChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'originatingleadname', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 lastusedincampaign 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.lastusedincampaign')
onLastusedincampaignChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'lastusedincampaign', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 donotsendmm 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.donotsendmm')
onDonotsendmmChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'donotsendmm', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 transactioncurrencyname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.transactioncurrencyname')
onTransactioncurrencynameChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'transactioncurrencyname', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 creditlimit 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.creditlimit')
onCreditlimitChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'creditlimit', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 creditonhold 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.creditonhold')
onCreditonholdChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'creditonhold', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 paymenttermscode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.paymenttermscode')
onPaymenttermscodeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'paymenttermscode', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 shippingmethodcode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.shippingmethodcode')
onShippingmethodcodeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'shippingmethodcode', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 originatingleadid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.originatingleadid')
onOriginatingleadidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'originatingleadid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 transactioncurrencyid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.transactioncurrencyid')
onTransactioncurrencyidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'transactioncurrencyid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 contactid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof DetailInfo
*/
@Watch('data.contactid')
onContactidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'contactid', newVal: newVal, oldVal: oldVal });
}
/**
* 重置表单项值
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof DetailInfo
*/
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 DetailInfo
*/
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 DetailInfo
*/
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 DetailInfo
*/
public onFormLoad(data: any = {},action:string): void {
if(Object.is(action,"save") || Object.is(action,"autoSave") || Object.is(action,"submit"))
// 更新context的实体主键
if(data.contact){
Object.assign(this.context,{contact:data.contact})
}
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 DetailInfo
*/
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 DetailInfo
*/
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 DetailInfo
*/
public resetDraftFormStates(): void {
const form: any = this.$refs.form;
if (form) {
form.resetFields();
}
}
/**
* 重置校验结果
*
* @memberof DetailInfo
*/
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 DetailInfo
*/
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 DetailInfo
*/
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 DetailInfo
*/
public getValues(): any {
return this.data;
}
/**
* 表单项值变更
*
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof DetailInfo
*/
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 DetailInfo
*/
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 DetailInfo
*/
public groupUIActionClick($event: any): void {
if (!$event) {
return;
}
const item:any = $event.item;
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof DetailInfo
*/
public created(): void {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof DetailInfo
*/
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 DetailInfo
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof DetailInfo
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if (this.dataChangEvent) {
this.dataChangEvent.unsubscribe();
}
}
/**
* 拷贝内容
*
* @param {*} [arg={}]
* @memberof @memberof DetailInfo
*/
public copy(srfkey: string): void {
let copyData = this.$store.getters.getCopyData(srfkey);
copyData.srfkey = Util.createUUID();
copyData.contact = copyData.srfkey;
copyData.contactid = copyData.srfkey;
Object.assign(this.context,{contact:copyData.contact})
this.data = copyData;
this.$nextTick(() => {
this.formState.next({ type: 'load', data: copyData });
this.data.srfuf = '0';
this.setFormEnableCond(this.data);
});
}
/**
*打印
*@memberof @memberof DetailInfo
*/
public print(){
let _this:any = this;
_this.$print({id:'contact_detailinfo',popTitle:'联系人详细信息表单'});
}
/**
* 部件刷新
*
* @param {any[]} args
* @memberof DetailInfo
*/
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 DetailInfo
*/
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 DetailInfo
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: '错误', desc: 'ContactDetailInfoEditView9视图表单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 DetailInfo
*/
public loadDraft(opt: any = {}): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: '错误', desc: 'ContactDetailInfoEditView9视图表单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.contact){
Object.assign(this.context,{contact:data.contact})
}
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 DetailInfo
*/
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: 'ContactDetailInfoEditView9视图表单'+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 DetailInfo
*/
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: 'ContactDetailInfoEditView9视图表单'+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: 'ContactDetailInfoEditView9视图表单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 DetailInfo
*/
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 DetailInfo
*/
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.contact || Object.is(arg.contact, '')) {
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 DetailInfo
*/
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 DetailInfo
*/
public onEnter($event: any): void {
}
/**
* 保存并退出
*
* @param {any[]} args
* @memberof DetailInfo
*/
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 DetailInfo
*/
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 DetailInfo
*/
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 DetailInfo
*/
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 DetailInfo
*/
public createDefault(){
}
/**
* 更新默认值
* @memberof DetailInfo
*/
public updateDefault(){
}
}
</script>
<style lang='less'>
@import './detail-info-form.less';
</style>
\ No newline at end of file
/**
* DetailInfo 部件模型
*
* @export
* @class DetailInfoModel
*/
export default class DetailInfoModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof DetailInfoModel
*/
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: 'contactid',
dataType: 'GUID',
},
{
name: 'srfmajortext',
prop: 'fullname',
dataType: 'TEXT',
},
{
name: 'srftempmode',
},
{
name: 'srfuf',
},
{
name: 'srfdeid',
},
{
name: 'srfsourcekey',
},
{
name: 'gendercode',
prop: 'gendercode',
dataType: 'SSCODELIST',
},
{
name: 'familystatuscode',
prop: 'familystatuscode',
dataType: 'SSCODELIST',
},
{
name: 'spousesname',
prop: 'spousesname',
dataType: 'TEXT',
},
{
name: 'birthdate',
prop: 'birthdate',
dataType: 'DATETIME',
},
{
name: 'anniversary',
prop: 'anniversary',
dataType: 'DATETIME',
},
{
name: 'originatingleadname',
prop: 'originatingleadname',
dataType: 'PICKUPTEXT',
},
{
name: 'lastusedincampaign',
prop: 'lastusedincampaign',
dataType: 'DATETIME',
},
{
name: 'donotsendmm',
prop: 'donotsendmm',
dataType: 'YESNO',
},
{
name: 'transactioncurrencyname',
prop: 'transactioncurrencyname',
dataType: 'PICKUPTEXT',
},
{
name: 'creditlimit',
prop: 'creditlimit',
dataType: 'BIGDECIMAL',
},
{
name: 'creditonhold',
prop: 'creditonhold',
dataType: 'YESNO',
},
{
name: 'paymenttermscode',
prop: 'paymenttermscode',
dataType: 'SSCODELIST',
},
{
name: 'shippingmethodcode',
prop: 'shippingmethodcode',
dataType: 'SSCODELIST',
},
{
name: 'originatingleadid',
prop: 'originatingleadid',
dataType: 'PICKUP',
},
{
name: 'transactioncurrencyid',
prop: 'transactioncurrencyid',
dataType: 'PICKUP',
},
{
name: 'contactid',
prop: 'contactid',
dataType: 'GUID',
},
{
name: 'contact',
prop: 'contactid',
dataType: 'FONTKEY',
},
]
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import ContactService from '@/service/contact/contact-service';
import DetailInfoModel from './detail-info-form-model';
import LeadService from '@/service/lead/lead-service';
import TransactionCurrencyService from '@/service/transaction-currency/transaction-currency-service';
/**
* DetailInfo 部件服务对象
*
* @export
* @class DetailInfoService
*/
export default class DetailInfoService extends ControlService {
/**
* 联系人服务对象
*
* @type {ContactService}
* @memberof DetailInfoService
*/
public appEntityService: ContactService = new ContactService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof DetailInfoService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of DetailInfoService.
*
* @param {*} [opts={}]
* @memberof DetailInfoService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new DetailInfoModel();
}
/**
* 潜在顾客服务对象
*
* @type {LeadService}
* @memberof DetailInfoService
*/
public leadService: LeadService = new LeadService();
/**
* 货币服务对象
*
* @type {TransactionCurrencyService}
* @memberof DetailInfoService
*/
public transactioncurrencyService: TransactionCurrencyService = new TransactionCurrencyService();
/**
* 处理数据
*
* @private
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof DetailInfoService
*/
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 DetailInfoService
*/
@Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
if (Object.is(serviceName, 'LeadService') && Object.is(interfaceName, 'FetchDefault')) {
return this.doItems(this.leadService.FetchDefault(JSON.parse(JSON.stringify(context)),data, isloading), 'leadid', 'lead');
}
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 DetailInfoService
*/
@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 DetailInfoService
*/
@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 DetailInfoService
*/
@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 DetailInfoService
*/
@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 DetailInfoService
*/
@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 DetailInfoService
*/
@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 DetailInfoService
*/
@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.contactid = PrimaryKey;
Data.contact = 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.contactid = 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 DetailInfoService
*/
@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 DetailInfoService
*/
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 DetailInfoBase from './detail-info-form-base.vue';
@Component({
components: {
}
})
export default class DetailInfo extends DetailInfoBase {
}
</script>
\ No newline at end of file
<template>
<div class='tabviewpanel'>
<tabs :value="activiedTabViewPanel" :animated="false" class='tabexppanel' name='tabexpviewtabexppanel' @on-click="tabPanelClick">
<tab-pane :index="0" name='tabviewpanel' tab='tabexpviewtabexppanel' class=''
:label="(h) =>{
return h('div', [
h('span', '摘要'),
h('Badge', {
props: {
count: undefined,
type: 'primary'
}
})
])
}" >
<view_tabviewpanel
:viewState="viewState"
:viewparams="JSON.parse(JSON.stringify(viewparams))"
:context="JSON.parse(JSON.stringify(context))"
v-if="isInit.tabviewpanel"
name="tabviewpanel"
ref='tabviewpanel'
@viewpanelDatasChange = "tabViewPanelDatasChange"
@closeview="closeView($event)">
</view_tabviewpanel>
</tab-pane>
<tab-pane :index="1" name='tabviewpanel2' tab='tabexpviewtabexppanel' class=''
:label="(h) =>{
return h('div', [
h('span', '详细信息'),
h('Badge', {
props: {
count: undefined,
type: 'primary'
}
})
])
}" >
<view_tabviewpanel2
:viewState="viewState"
:viewparams="JSON.parse(JSON.stringify(viewparams))"
:context="JSON.parse(JSON.stringify(context))"
v-if="isInit.tabviewpanel2"
name="tabviewpanel2"
ref='tabviewpanel2'
@viewpanelDatasChange = "tabViewPanelDatasChange"
@closeview="closeView($event)">
</view_tabviewpanel2>
</tab-pane>
</tabs>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import ContactService from '@/service/contact/contact-service';
import TabExpViewtabexppanelService from './tab-exp-viewtabexppanel-tabexppanel-service';
@Component({
components: {
}
})
export default class TabExpViewtabexppanelBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof TabExpViewtabexppanel
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof TabExpViewtabexppanel
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof TabExpViewtabexppanel
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof TabExpViewtabexppanel
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof TabExpViewtabexppanel
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof TabExpViewtabexppanel
*/
public getControlType(): string {
return 'TABEXPPANEL'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof TabExpViewtabexppanel
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {TabExpViewtabexppanelService}
* @memberof TabExpViewtabexppanel
*/
public service: TabExpViewtabexppanelService = new TabExpViewtabexppanelService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {ContactService}
* @memberof TabExpViewtabexppanel
*/
public appEntityService: ContactService = new ContactService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof TabExpViewtabexppanel
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof TabExpViewtabexppanel
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 是否初始化
*
* @returns {any}
* @memberof TabExpViewtabexppanel
*/
public isInit: any = {
tabviewpanel: true ,
tabviewpanel2: false ,
}
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof TabExpViewtabexppanel
*/
public getDatas(): any[] {
return [];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof TabExpViewtabexppanel
*/
public getData(): any {
return null;
}
/**
* 行为参数
*
* @public
* @type {*}
* @memberof TabExpViewtabexppanel
*/
public action:any = '';
/**
* 被激活的分页面板
*
* @type {string}
* @memberof TabExpViewtabexppanel
*/
public activiedTabViewPanel: string = 'tabviewpanel';
/**
* 分页视图面板数据变更
*
* @memberof TabExpViewtabexppanel
*/
public tabViewPanelDatasChange(){
this.counterRefresh();
}
/**
* vue 生命周期
*
* @returns
* @memberof TabExpViewtabexppanel
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof TabExpViewtabexppanel
*/
public afterCreated(){
//设置分页导航srfparentdename和srfparentkey
if (this.context.contact) {
Object.assign(this.context, { srfparentdename: 'Contact', srfparentkey: this.context.contact });
}
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
this.action = action;
this.viewState.next({ tag: this.activiedTabViewPanel, action: action, data: data });
this.$forceUpdate();
});
}
}
/**
* 组件加载完毕
*
* @memberof TabExpViewtabexppanel
*/
public mounted(): void {
if (this.viewparams) {
const activate = this.viewparams.srftabactivate;
if (activate && this.isInit[activate] !== undefined) {
for (const key in this.isInit) {
if (this.isInit.hasOwnProperty(key)) {
this.isInit[key] = false;
}
}
this.$nextTick(() => {
this.tabPanelClick(activate);
});
}
}
}
/**
* vue 生命周期
*
* @memberof TabExpViewtabexppanel
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof TabExpViewtabexppanel
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
/**
* 分页面板选中
*
* @param {*} $event
* @returns
* @memberof TabExpViewtabexppanel
*/
public tabPanelClick($event: any) {
if (!$event) {
return;
}
this.isInit[$event] = true;
if (!this.viewState) {
return;
}
this.activiedTabViewPanel = $event;
this.viewState.next({ tag: this.activiedTabViewPanel, action: this.action, data: {}});
}
}
</script>
<style lang='less'>
@import './tab-exp-viewtabexppanel-tabexppanel.less';
</style>
\ No newline at end of file
/**
* TabExpViewtabexppanel 部件模型
*
* @export
* @class TabExpViewtabexppanelModel
*/
export default class TabExpViewtabexppanelModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof TabExpViewtabexppanelModel
*/
public getDataItems(): any[] {
return [
{
name: 'address1_freighttermscode',
},
{
name: 'address3_city',
},
{
name: 'department',
},
{
name: 'parentcustomeridtype',
},
{
name: 'address1_stateorprovince',
},
{
name: 'aging90_base',
},
{
name: 'accountidyominame',
},
{
name: 'donotbulkpostalmail',
},
{
name: 'managername',
},
{
name: 'donotpostalmail',
},
{
name: 'spousesname',
},
{
name: 'familystatuscode',
},
{
name: 'owneridtype',
},
{
name: 'address3_composite',
},
{
name: 'address3_shippingmethodcode',
},
{
name: 'lastname',
},
{
name: 'lastonholdtime',
},
{
name: 'educationcode',
},
{
name: 'address2_line1',
},
{
name: 'birthdate',
},
{
name: 'owneridyominame',
},
{
name: 'haschildrencode',
},
{
name: 'company',
},
{
name: 'address2_fax',
},
{
name: 'assistantphone',
},
{
name: 'callback',
},
{
name: 'paymenttermscode',
},
{
name: 'address2_telephone1',
},
{
name: 'marketingonly',
},
{
name: 'address2_utcoffset',
},
{
name: 'address2_shippingmethodcode',
},
{
name: 'traversedpath',
},
{
name: 'employeeid',
},
{
name: 'creditlimit_base',
},
{
name: 'followemail',
},
{
name: 'address3_postalcode',
},
{
name: 'merged',
},
{
name: 'jobtitle',
},
{
name: 'address1_telephone1',
},
{
name: 'customersizecode',
},
{
name: 'address3_addresstypecode',
},
{
name: 'pager',
},
{
name: 'assistantname',
},
{
name: 'address1_composite',
},
{
name: 'address1_line1',
},
{
name: 'yomimiddlename',
},
{
name: 'address1_telephone3',
},
{
name: 'telephone2',
},
{
name: 'address2_addressid',
},
{
name: 'parentcontactidyominame',
},
{
name: 'leadsourcecode',
},
{
name: 'statecode',
},
{
name: 'address2_freighttermscode',
},
{
name: 'emailaddress1',
},
{
name: 'entityimage_timestamp',
},
{
name: 'address3_line1',
},
{
name: 'salutation',
},
{
name: 'address1_line3',
},
{
name: 'address3_primarycontactname',
},
{
name: 'ibizprivate',
},
{
name: 'donotfax',
},
{
name: 'createdate',
},
{
name: 'preferredsystemuseridyominame',
},
{
name: 'updatedate',
},
{
name: 'address3_stateorprovince',
},
{
name: 'address3_line3',
},
{
name: 'creditlimit',
},
{
name: 'timezoneruleversionnumber',
},
{
name: 'parentcustomerid',
},
{
name: 'childrensnames',
},
{
name: 'address1_addresstypecode',
},
{
name: 'accountrolecode',
},
{
name: 'donotphone',
},
{
name: 'managerphone',
},
{
name: 'creditonhold',
},
{
name: 'updateman',
},
{
name: 'address2_postalcode',
},
{
name: 'address1_line2',
},
{
name: 'nickname',
},
{
name: 'versionnumber',
},
{
name: 'yomifullname',
},
{
name: 'entityimage',
},
{
name: 'shippingmethodcode',
},
{
name: 'customertypecode',
},
{
name: 'address2_county',
},
{
name: 'aging90',
},
{
name: 'address2_stateorprovince',
},
{
name: 'address3_utcoffset',
},
{
name: 'fullname',
},
{
name: 'participatesinworkflow',
},
{
name: 'websiteurl',
},
{
name: 'description',
},
{
name: 'address3_telephone1',
},
{
name: 'address2_upszone',
},
{
name: 'address3_county',
},
{
name: 'entityimage_url',
},
{
name: 'address3_upszone',
},
{
name: 'address1_name',
},
{
name: 'mastercontactidyominame',
},
{
name: 'autocreate',
},
{
name: 'backofficecustomer',
},
{
name: 'address2_longitude',
},
{
name: 'address1_fax',
},
{
name: 'exchangerate',
},
{
name: 'address1_city',
},
{
name: 'entityimageid',
},
{
name: 'address1_telephone2',
},
{
name: 'address2_composite',
},
{
name: 'importsequencenumber',
},
{
name: 'gendercode',
},
{
name: 'annualincome',
},
{
name: 'subscriptionid',
},
{
name: 'territorycode',
},
{
name: 'firstname',
},
{
name: 'overriddencreatedon',
},
{
name: 'address3_country',
},
{
name: 'yomilastname',
},
{
name: 'donotbulkemail',
},
{
name: 'address3_telephone2',
},
{
name: 'ownerid',
},
{
name: 'externaluseridentifier',
},
{
name: 'teamsfollowed',
},
{
name: 'donotemail',
},
{
name: 'anniversary',
},
{
name: 'preferredappointmentdaycode',
},
{
name: 'middlename',
},
{
name: 'emailaddress3',
},
{
name: 'address2_telephone2',
},
{
name: 'fax',
},
{
name: 'mobilephone',
},
{
name: 'home2',
},
{
name: 'createman',
},
{
name: 'onholdtime',
},
{
name: 'preferredappointmenttimecode',
},
{
name: 'statuscode',
},
{
name: 'governmentid',
},
{
name: 'address3_telephone3',
},
{
name: 'business2',
},
{
name: 'preferredsystemuserid',
},
{
name: 'address1_upszone',
},
{
name: 'aging60',
},
{
name: 'yomifirstname',
},
{
name: 'address3_postofficebox',
},
{
name: 'address2_city',
},
{
name: 'processid',
},
{
name: 'annualincome_base',
},
{
name: 'address3_addressid',
},
{
name: 'parentcustomeridyominame',
},
{
name: 'contact',
prop: 'contactid',
},
{
name: 'aging60_base',
},
{
name: 'address3_latitude',
},
{
name: 'telephone3',
},
{
name: 'address1_primarycontactname',
},
{
name: 'address3_fax',
},
{
name: 'preferredcontactmethodcode',
},
{
name: 'address1_utcoffset',
},
{
name: 'donotsendmm',
},
{
name: 'address2_telephone3',
},
{
name: 'address2_country',
},
{
name: 'aging30',
},
{
name: 'address2_postofficebox',
},
{
name: 'telephone1',
},
{
name: 'address3_longitude',
},
{
name: 'lastusedincampaign',
},
{
name: 'ftpsiteurl',
},
{
name: 'aging30_base',
},
{
name: 'address2_name',
},
{
name: 'suffix',
},
{
name: 'address1_county',
},
{
name: 'address2_addresstypecode',
},
{
name: 'address1_longitude',
},
{
name: 'address3_line2',
},
{
name: 'address1_addressid',
},
{
name: 'address2_line3',
},
{
name: 'address2_latitude',
},
{
name: 'address2_line2',
},
{
name: 'address1_shippingmethodcode',
},
{
name: 'address3_freighttermscode',
},
{
name: 'address1_postofficebox',
},
{
name: 'utcconversiontimezonecode',
},
{
name: 'address3_name',
},
{
name: 'address1_latitude',
},
{
name: 'numberofchildren',
},
{
name: 'address2_primarycontactname',
},
{
name: 'address1_postalcode',
},
{
name: 'stageid',
},
{
name: 'address1_country',
},
{
name: 'emailaddress2',
},
{
name: 'slaname',
},
{
name: 'defaultpricelevelid',
},
{
name: 'preferredequipmentid',
},
{
name: 'transactioncurrencyid',
},
{
name: 'slaid',
},
{
name: 'originatingleadid',
},
{
name: 'preferredserviceid',
},
{
name: 'defaultpricelevelname',
},
{
name: 'originatingleadname',
},
{
name: 'transactioncurrencyname',
},
{
name: 'preferredservicename',
},
{
name: 'preferredequipmentname',
},
]
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import ContactService from '@/service/contact/contact-service';
import TabExpViewtabexppanelModel from './tab-exp-viewtabexppanel-tabexppanel-model';
/**
* TabExpViewtabexppanel 部件服务对象
*
* @export
* @class TabExpViewtabexppanelService
*/
export default class TabExpViewtabexppanelService extends ControlService {
/**
* 联系人服务对象
*
* @type {ContactService}
* @memberof TabExpViewtabexppanelService
*/
public appEntityService: ContactService = new ContactService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof TabExpViewtabexppanelService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of TabExpViewtabexppanelService.
*
* @param {*} [opts={}]
* @memberof TabExpViewtabexppanelService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new TabExpViewtabexppanelModel();
}
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import TabExpViewtabexppanelBase from './tab-exp-viewtabexppanel-tabexppanel-base.vue';
import view_tabviewpanel from '@widgets/contact/tab-exp-viewtabviewpanel-tabviewpanel/tab-exp-viewtabviewpanel-tabviewpanel.vue';
import view_tabviewpanel2 from '@widgets/contact/tab-exp-viewtabviewpanel2-tabviewpanel/tab-exp-viewtabviewpanel2-tabviewpanel.vue';
@Component({
components: {
view_tabviewpanel,
view_tabviewpanel2,
}
})
export default class TabExpViewtabexppanel extends TabExpViewtabexppanelBase {
}
</script>
\ No newline at end of file
<template>
<div class='tabviewpanel' style="height:100%;" v-if = 'isActivied' >
<contact-abstract-edit-view9
class='viewcontainer2'
:viewdata="viewdata"
:viewparam="viewparam"
@viewload="viewDatasChange($event)"
:viewDefaultUsage="false" >
</contact-abstract-edit-view9>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import ContactService from '@/service/contact/contact-service';
import TabExpViewtabviewpanelService from './tab-exp-viewtabviewpanel-tabviewpanel-service';
@Component({
components: {
}
})
export default class TabExpViewtabviewpanelBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof TabExpViewtabviewpanel
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof TabExpViewtabviewpanel
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof TabExpViewtabviewpanel
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof TabExpViewtabviewpanel
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof TabExpViewtabviewpanel
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof TabExpViewtabviewpanel
*/
public getControlType(): string {
return 'TABVIEWPANEL'
}
/**
* 建构部件服务对象
*
* @type {TabExpViewtabviewpanelService}
* @memberof TabExpViewtabviewpanel
*/
public service: TabExpViewtabviewpanelService = new TabExpViewtabviewpanelService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {ContactService}
* @memberof TabExpViewtabviewpanel
*/
public appEntityService: ContactService = new ContactService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof TabExpViewtabviewpanel
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof TabExpViewtabviewpanel
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof TabExpViewtabviewpanel
*/
public getDatas(): any[] {
return [];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof TabExpViewtabviewpanel
*/
public getData(): any {
return null;
}
/**
* 是否被激活
*
* @type {boolean}
* @memberof TabExpViewtabviewpanel
*/
public isActivied: boolean = true;
/**
* 局部上下文
*
* @type {*}
* @memberof TabExpViewtabviewpanel
*/
public localContext: any = null;
/**
* 局部视图参数
*
* @type {*}
* @memberof TabExpViewtabviewpanel
*/
public localViewParam: any = null;
/**
* 传入上下文
*
* @type {string}
* @memberof TabExpViewtabviewpanel
*/
public viewdata: string = JSON.stringify(this.context);
/**
* 传入视图参数
*
* @type {string}
* @memberof PickupViewpickupviewpanel
*/
public viewparam: string = JSON.stringify(this.viewparams);
/**
* 视图面板过滤项
*
* @type {string}
* @memberof TabExpViewtabviewpanel
*/
public navfilter: string = "";
/**
* vue 生命周期
*
* @returns
* @memberof TabExpViewtabviewpanel
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof TabExpViewtabviewpanel
*/
public afterCreated(){
this.initNavParam();
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
this.$forceUpdate();
this.initNavParam();
});
}
}
/**
* 初始化导航参数
*
* @memberof TabExpViewtabviewpanel
*/
public initNavParam(){
if(!Object.is(this.navfilter,"")){
Object.assign(this.viewparams,{[this.navfilter]:this.context['majorentity']})
}
if(this.localContext && Object.keys(this.localContext).length >0){
let _context:any = this.$util.computedNavData({},this.context,this.viewparams,this.localContext);
Object.assign(this.context,_context);
}
if(this.localViewParam && Object.keys(this.localViewParam).length >0){
let _param:any = this.$util.computedNavData({},this.context,this.viewparams,this.localViewParam);
Object.assign(this.viewparams,_param);
}
this.viewdata =JSON.stringify(this.context);
this.viewparam = JSON.stringify(this.viewparams);
}
/**
* 视图数据变化
*
* @memberof TabExpViewtabviewpanel
*/
public viewDatasChange($event:any){
this.$emit('viewpanelDatasChange',$event);
}
/**
* vue 生命周期
*
* @memberof TabExpViewtabviewpanel
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof TabExpViewtabviewpanel
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
}
</script>
<style lang='less'>
@import './tab-exp-viewtabviewpanel-tabviewpanel.less';
</style>
\ No newline at end of file
/**
* TabExpViewtabviewpanel 部件模型
*
* @export
* @class TabExpViewtabviewpanelModel
*/
export default class TabExpViewtabviewpanelModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof TabExpViewtabviewpanelModel
*/
public getDataItems(): any[] {
return [
{
name: 'address1_freighttermscode',
},
{
name: 'address3_city',
},
{
name: 'department',
},
{
name: 'parentcustomeridtype',
},
{
name: 'address1_stateorprovince',
},
{
name: 'aging90_base',
},
{
name: 'accountidyominame',
},
{
name: 'donotbulkpostalmail',
},
{
name: 'managername',
},
{
name: 'donotpostalmail',
},
{
name: 'spousesname',
},
{
name: 'familystatuscode',
},
{
name: 'owneridtype',
},
{
name: 'address3_composite',
},
{
name: 'address3_shippingmethodcode',
},
{
name: 'lastname',
},
{
name: 'lastonholdtime',
},
{
name: 'educationcode',
},
{
name: 'address2_line1',
},
{
name: 'birthdate',
},
{
name: 'owneridyominame',
},
{
name: 'haschildrencode',
},
{
name: 'company',
},
{
name: 'address2_fax',
},
{
name: 'assistantphone',
},
{
name: 'callback',
},
{
name: 'paymenttermscode',
},
{
name: 'address2_telephone1',
},
{
name: 'marketingonly',
},
{
name: 'address2_utcoffset',
},
{
name: 'address2_shippingmethodcode',
},
{
name: 'traversedpath',
},
{
name: 'employeeid',
},
{
name: 'creditlimit_base',
},
{
name: 'followemail',
},
{
name: 'address3_postalcode',
},
{
name: 'merged',
},
{
name: 'jobtitle',
},
{
name: 'address1_telephone1',
},
{
name: 'customersizecode',
},
{
name: 'address3_addresstypecode',
},
{
name: 'pager',
},
{
name: 'assistantname',
},
{
name: 'address1_composite',
},
{
name: 'address1_line1',
},
{
name: 'yomimiddlename',
},
{
name: 'address1_telephone3',
},
{
name: 'telephone2',
},
{
name: 'address2_addressid',
},
{
name: 'parentcontactidyominame',
},
{
name: 'leadsourcecode',
},
{
name: 'statecode',
},
{
name: 'address2_freighttermscode',
},
{
name: 'emailaddress1',
},
{
name: 'entityimage_timestamp',
},
{
name: 'address3_line1',
},
{
name: 'salutation',
},
{
name: 'address1_line3',
},
{
name: 'address3_primarycontactname',
},
{
name: 'ibizprivate',
},
{
name: 'donotfax',
},
{
name: 'createdate',
},
{
name: 'preferredsystemuseridyominame',
},
{
name: 'updatedate',
},
{
name: 'address3_stateorprovince',
},
{
name: 'address3_line3',
},
{
name: 'creditlimit',
},
{
name: 'timezoneruleversionnumber',
},
{
name: 'parentcustomerid',
},
{
name: 'childrensnames',
},
{
name: 'address1_addresstypecode',
},
{
name: 'accountrolecode',
},
{
name: 'donotphone',
},
{
name: 'managerphone',
},
{
name: 'creditonhold',
},
{
name: 'updateman',
},
{
name: 'address2_postalcode',
},
{
name: 'address1_line2',
},
{
name: 'nickname',
},
{
name: 'versionnumber',
},
{
name: 'yomifullname',
},
{
name: 'entityimage',
},
{
name: 'shippingmethodcode',
},
{
name: 'customertypecode',
},
{
name: 'address2_county',
},
{
name: 'aging90',
},
{
name: 'address2_stateorprovince',
},
{
name: 'address3_utcoffset',
},
{
name: 'fullname',
},
{
name: 'participatesinworkflow',
},
{
name: 'websiteurl',
},
{
name: 'description',
},
{
name: 'address3_telephone1',
},
{
name: 'address2_upszone',
},
{
name: 'address3_county',
},
{
name: 'entityimage_url',
},
{
name: 'address3_upszone',
},
{
name: 'address1_name',
},
{
name: 'mastercontactidyominame',
},
{
name: 'autocreate',
},
{
name: 'backofficecustomer',
},
{
name: 'address2_longitude',
},
{
name: 'address1_fax',
},
{
name: 'exchangerate',
},
{
name: 'address1_city',
},
{
name: 'entityimageid',
},
{
name: 'address1_telephone2',
},
{
name: 'address2_composite',
},
{
name: 'importsequencenumber',
},
{
name: 'gendercode',
},
{
name: 'annualincome',
},
{
name: 'subscriptionid',
},
{
name: 'territorycode',
},
{
name: 'firstname',
},
{
name: 'overriddencreatedon',
},
{
name: 'address3_country',
},
{
name: 'yomilastname',
},
{
name: 'donotbulkemail',
},
{
name: 'address3_telephone2',
},
{
name: 'ownerid',
},
{
name: 'externaluseridentifier',
},
{
name: 'teamsfollowed',
},
{
name: 'donotemail',
},
{
name: 'anniversary',
},
{
name: 'preferredappointmentdaycode',
},
{
name: 'middlename',
},
{
name: 'emailaddress3',
},
{
name: 'address2_telephone2',
},
{
name: 'fax',
},
{
name: 'mobilephone',
},
{
name: 'home2',
},
{
name: 'createman',
},
{
name: 'onholdtime',
},
{
name: 'preferredappointmenttimecode',
},
{
name: 'statuscode',
},
{
name: 'governmentid',
},
{
name: 'address3_telephone3',
},
{
name: 'business2',
},
{
name: 'preferredsystemuserid',
},
{
name: 'address1_upszone',
},
{
name: 'aging60',
},
{
name: 'yomifirstname',
},
{
name: 'address3_postofficebox',
},
{
name: 'address2_city',
},
{
name: 'processid',
},
{
name: 'annualincome_base',
},
{
name: 'address3_addressid',
},
{
name: 'parentcustomeridyominame',
},
{
name: 'contact',
prop: 'contactid',
},
{
name: 'aging60_base',
},
{
name: 'address3_latitude',
},
{
name: 'telephone3',
},
{
name: 'address1_primarycontactname',
},
{
name: 'address3_fax',
},
{
name: 'preferredcontactmethodcode',
},
{
name: 'address1_utcoffset',
},
{
name: 'donotsendmm',
},
{
name: 'address2_telephone3',
},
{
name: 'address2_country',
},
{
name: 'aging30',
},
{
name: 'address2_postofficebox',
},
{
name: 'telephone1',
},
{
name: 'address3_longitude',
},
{
name: 'lastusedincampaign',
},
{
name: 'ftpsiteurl',
},
{
name: 'aging30_base',
},
{
name: 'address2_name',
},
{
name: 'suffix',
},
{
name: 'address1_county',
},
{
name: 'address2_addresstypecode',
},
{
name: 'address1_longitude',
},
{
name: 'address3_line2',
},
{
name: 'address1_addressid',
},
{
name: 'address2_line3',
},
{
name: 'address2_latitude',
},
{
name: 'address2_line2',
},
{
name: 'address1_shippingmethodcode',
},
{
name: 'address3_freighttermscode',
},
{
name: 'address1_postofficebox',
},
{
name: 'utcconversiontimezonecode',
},
{
name: 'address3_name',
},
{
name: 'address1_latitude',
},
{
name: 'numberofchildren',
},
{
name: 'address2_primarycontactname',
},
{
name: 'address1_postalcode',
},
{
name: 'stageid',
},
{
name: 'address1_country',
},
{
name: 'emailaddress2',
},
{
name: 'slaname',
},
{
name: 'defaultpricelevelid',
},
{
name: 'preferredequipmentid',
},
{
name: 'transactioncurrencyid',
},
{
name: 'slaid',
},
{
name: 'originatingleadid',
},
{
name: 'preferredserviceid',
},
{
name: 'defaultpricelevelname',
},
{
name: 'originatingleadname',
},
{
name: 'transactioncurrencyname',
},
{
name: 'preferredservicename',
},
{
name: 'preferredequipmentname',
},
]
}
}
\ No newline at end of file
import { Http } from '@/utils';
import ControlService from '@/widgets/control-service';
/**
* TabExpViewtabviewpanel 部件服务对象
*
* @export
* @class TabExpViewtabviewpanelService
*/
export default class TabExpViewtabviewpanelService extends ControlService {
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import TabExpViewtabviewpanelBase from './tab-exp-viewtabviewpanel-tabviewpanel-base.vue';
@Component({
components: {
}
})
export default class TabExpViewtabviewpanel extends TabExpViewtabviewpanelBase {
}
</script>
\ No newline at end of file
<template>
<div class='tabviewpanel' style="height:100%;" v-if = 'isActivied' >
<contact-detail-info-edit-view9
class='viewcontainer2'
:viewdata="viewdata"
:viewparam="viewparam"
@viewload="viewDatasChange($event)"
:viewDefaultUsage="false" >
</contact-detail-info-edit-view9>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import ContactService from '@/service/contact/contact-service';
import TabExpViewtabviewpanel2Service from './tab-exp-viewtabviewpanel2-tabviewpanel-service';
@Component({
components: {
}
})
export default class TabExpViewtabviewpanel2Base extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof TabExpViewtabviewpanel2
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof TabExpViewtabviewpanel2
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof TabExpViewtabviewpanel2
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof TabExpViewtabviewpanel2
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof TabExpViewtabviewpanel2
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof TabExpViewtabviewpanel2
*/
public getControlType(): string {
return 'TABVIEWPANEL'
}
/**
* 建构部件服务对象
*
* @type {TabExpViewtabviewpanel2Service}
* @memberof TabExpViewtabviewpanel2
*/
public service: TabExpViewtabviewpanel2Service = new TabExpViewtabviewpanel2Service({ $store: this.$store });
/**
* 实体服务对象
*
* @type {ContactService}
* @memberof TabExpViewtabviewpanel2
*/
public appEntityService: ContactService = new ContactService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof TabExpViewtabviewpanel2
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof TabExpViewtabviewpanel2
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof TabExpViewtabviewpanel2
*/
public getDatas(): any[] {
return [];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof TabExpViewtabviewpanel2
*/
public getData(): any {
return null;
}
/**
* 是否被激活
*
* @type {boolean}
* @memberof TabExpViewtabviewpanel2
*/
public isActivied: boolean = true;
/**
* 局部上下文
*
* @type {*}
* @memberof TabExpViewtabviewpanel2
*/
public localContext: any = null;
/**
* 局部视图参数
*
* @type {*}
* @memberof TabExpViewtabviewpanel2
*/
public localViewParam: any = null;
/**
* 传入上下文
*
* @type {string}
* @memberof TabExpViewtabviewpanel
*/
public viewdata: string = JSON.stringify(this.context);
/**
* 传入视图参数
*
* @type {string}
* @memberof PickupViewpickupviewpanel
*/
public viewparam: string = JSON.stringify(this.viewparams);
/**
* 视图面板过滤项
*
* @type {string}
* @memberof TabExpViewtabviewpanel2
*/
public navfilter: string = "";
/**
* vue 生命周期
*
* @returns
* @memberof TabExpViewtabviewpanel2
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof TabExpViewtabviewpanel2
*/
public afterCreated(){
this.initNavParam();
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
this.$forceUpdate();
this.initNavParam();
});
}
}
/**
* 初始化导航参数
*
* @memberof TabExpViewtabviewpanel2
*/
public initNavParam(){
if(!Object.is(this.navfilter,"")){
Object.assign(this.viewparams,{[this.navfilter]:this.context['majorentity']})
}
if(this.localContext && Object.keys(this.localContext).length >0){
let _context:any = this.$util.computedNavData({},this.context,this.viewparams,this.localContext);
Object.assign(this.context,_context);
}
if(this.localViewParam && Object.keys(this.localViewParam).length >0){
let _param:any = this.$util.computedNavData({},this.context,this.viewparams,this.localViewParam);
Object.assign(this.viewparams,_param);
}
this.viewdata =JSON.stringify(this.context);
this.viewparam = JSON.stringify(this.viewparams);
}
/**
* 视图数据变化
*
* @memberof TabExpViewtabviewpanel2
*/
public viewDatasChange($event:any){
this.$emit('viewpanelDatasChange',$event);
}
/**
* vue 生命周期
*
* @memberof TabExpViewtabviewpanel2
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof TabExpViewtabviewpanel2
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
}
</script>
<style lang='less'>
@import './tab-exp-viewtabviewpanel2-tabviewpanel.less';
</style>
\ No newline at end of file
/**
* TabExpViewtabviewpanel2 部件模型
*
* @export
* @class TabExpViewtabviewpanel2Model
*/
export default class TabExpViewtabviewpanel2Model {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof TabExpViewtabviewpanel2Model
*/
public getDataItems(): any[] {
return [
{
name: 'address1_freighttermscode',
},
{
name: 'address3_city',
},
{
name: 'department',
},
{
name: 'parentcustomeridtype',
},
{
name: 'address1_stateorprovince',
},
{
name: 'aging90_base',
},
{
name: 'accountidyominame',
},
{
name: 'donotbulkpostalmail',
},
{
name: 'managername',
},
{
name: 'donotpostalmail',
},
{
name: 'spousesname',
},
{
name: 'familystatuscode',
},
{
name: 'owneridtype',
},
{
name: 'address3_composite',
},
{
name: 'address3_shippingmethodcode',
},
{
name: 'lastname',
},
{
name: 'lastonholdtime',
},
{
name: 'educationcode',
},
{
name: 'address2_line1',
},
{
name: 'birthdate',
},
{
name: 'owneridyominame',
},
{
name: 'haschildrencode',
},
{
name: 'company',
},
{
name: 'address2_fax',
},
{
name: 'assistantphone',
},
{
name: 'callback',
},
{
name: 'paymenttermscode',
},
{
name: 'address2_telephone1',
},
{
name: 'marketingonly',
},
{
name: 'address2_utcoffset',
},
{
name: 'address2_shippingmethodcode',
},
{
name: 'traversedpath',
},
{
name: 'employeeid',
},
{
name: 'creditlimit_base',
},
{
name: 'followemail',
},
{
name: 'address3_postalcode',
},
{
name: 'merged',
},
{
name: 'jobtitle',
},
{
name: 'address1_telephone1',
},
{
name: 'customersizecode',
},
{
name: 'address3_addresstypecode',
},
{
name: 'pager',
},
{
name: 'assistantname',
},
{
name: 'address1_composite',
},
{
name: 'address1_line1',
},
{
name: 'yomimiddlename',
},
{
name: 'address1_telephone3',
},
{
name: 'telephone2',
},
{
name: 'address2_addressid',
},
{
name: 'parentcontactidyominame',
},
{
name: 'leadsourcecode',
},
{
name: 'statecode',
},
{
name: 'address2_freighttermscode',
},
{
name: 'emailaddress1',
},
{
name: 'entityimage_timestamp',
},
{
name: 'address3_line1',
},
{
name: 'salutation',
},
{
name: 'address1_line3',
},
{
name: 'address3_primarycontactname',
},
{
name: 'ibizprivate',
},
{
name: 'donotfax',
},
{
name: 'createdate',
},
{
name: 'preferredsystemuseridyominame',
},
{
name: 'updatedate',
},
{
name: 'address3_stateorprovince',
},
{
name: 'address3_line3',
},
{
name: 'creditlimit',
},
{
name: 'timezoneruleversionnumber',
},
{
name: 'parentcustomerid',
},
{
name: 'childrensnames',
},
{
name: 'address1_addresstypecode',
},
{
name: 'accountrolecode',
},
{
name: 'donotphone',
},
{
name: 'managerphone',
},
{
name: 'creditonhold',
},
{
name: 'updateman',
},
{
name: 'address2_postalcode',
},
{
name: 'address1_line2',
},
{
name: 'nickname',
},
{
name: 'versionnumber',
},
{
name: 'yomifullname',
},
{
name: 'entityimage',
},
{
name: 'shippingmethodcode',
},
{
name: 'customertypecode',
},
{
name: 'address2_county',
},
{
name: 'aging90',
},
{
name: 'address2_stateorprovince',
},
{
name: 'address3_utcoffset',
},
{
name: 'fullname',
},
{
name: 'participatesinworkflow',
},
{
name: 'websiteurl',
},
{
name: 'description',
},
{
name: 'address3_telephone1',
},
{
name: 'address2_upszone',
},
{
name: 'address3_county',
},
{
name: 'entityimage_url',
},
{
name: 'address3_upszone',
},
{
name: 'address1_name',
},
{
name: 'mastercontactidyominame',
},
{
name: 'autocreate',
},
{
name: 'backofficecustomer',
},
{
name: 'address2_longitude',
},
{
name: 'address1_fax',
},
{
name: 'exchangerate',
},
{
name: 'address1_city',
},
{
name: 'entityimageid',
},
{
name: 'address1_telephone2',
},
{
name: 'address2_composite',
},
{
name: 'importsequencenumber',
},
{
name: 'gendercode',
},
{
name: 'annualincome',
},
{
name: 'subscriptionid',
},
{
name: 'territorycode',
},
{
name: 'firstname',
},
{
name: 'overriddencreatedon',
},
{
name: 'address3_country',
},
{
name: 'yomilastname',
},
{
name: 'donotbulkemail',
},
{
name: 'address3_telephone2',
},
{
name: 'ownerid',
},
{
name: 'externaluseridentifier',
},
{
name: 'teamsfollowed',
},
{
name: 'donotemail',
},
{
name: 'anniversary',
},
{
name: 'preferredappointmentdaycode',
},
{
name: 'middlename',
},
{
name: 'emailaddress3',
},
{
name: 'address2_telephone2',
},
{
name: 'fax',
},
{
name: 'mobilephone',
},
{
name: 'home2',
},
{
name: 'createman',
},
{
name: 'onholdtime',
},
{
name: 'preferredappointmenttimecode',
},
{
name: 'statuscode',
},
{
name: 'governmentid',
},
{
name: 'address3_telephone3',
},
{
name: 'business2',
},
{
name: 'preferredsystemuserid',
},
{
name: 'address1_upszone',
},
{
name: 'aging60',
},
{
name: 'yomifirstname',
},
{
name: 'address3_postofficebox',
},
{
name: 'address2_city',
},
{
name: 'processid',
},
{
name: 'annualincome_base',
},
{
name: 'address3_addressid',
},
{
name: 'parentcustomeridyominame',
},
{
name: 'contact',
prop: 'contactid',
},
{
name: 'aging60_base',
},
{
name: 'address3_latitude',
},
{
name: 'telephone3',
},
{
name: 'address1_primarycontactname',
},
{
name: 'address3_fax',
},
{
name: 'preferredcontactmethodcode',
},
{
name: 'address1_utcoffset',
},
{
name: 'donotsendmm',
},
{
name: 'address2_telephone3',
},
{
name: 'address2_country',
},
{
name: 'aging30',
},
{
name: 'address2_postofficebox',
},
{
name: 'telephone1',
},
{
name: 'address3_longitude',
},
{
name: 'lastusedincampaign',
},
{
name: 'ftpsiteurl',
},
{
name: 'aging30_base',
},
{
name: 'address2_name',
},
{
name: 'suffix',
},
{
name: 'address1_county',
},
{
name: 'address2_addresstypecode',
},
{
name: 'address1_longitude',
},
{
name: 'address3_line2',
},
{
name: 'address1_addressid',
},
{
name: 'address2_line3',
},
{
name: 'address2_latitude',
},
{
name: 'address2_line2',
},
{
name: 'address1_shippingmethodcode',
},
{
name: 'address3_freighttermscode',
},
{
name: 'address1_postofficebox',
},
{
name: 'utcconversiontimezonecode',
},
{
name: 'address3_name',
},
{
name: 'address1_latitude',
},
{
name: 'numberofchildren',
},
{
name: 'address2_primarycontactname',
},
{
name: 'address1_postalcode',
},
{
name: 'stageid',
},
{
name: 'address1_country',
},
{
name: 'emailaddress2',
},
{
name: 'slaname',
},
{
name: 'defaultpricelevelid',
},
{
name: 'preferredequipmentid',
},
{
name: 'transactioncurrencyid',
},
{
name: 'slaid',
},
{
name: 'originatingleadid',
},
{
name: 'preferredserviceid',
},
{
name: 'defaultpricelevelname',
},
{
name: 'originatingleadname',
},
{
name: 'transactioncurrencyname',
},
{
name: 'preferredservicename',
},
{
name: 'preferredequipmentname',
},
]
}
}
\ No newline at end of file
import { Http } from '@/utils';
import ControlService from '@/widgets/control-service';
/**
* TabExpViewtabviewpanel2 部件服务对象
*
* @export
* @class TabExpViewtabviewpanel2Service
*/
export default class TabExpViewtabviewpanel2Service extends ControlService {
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import TabExpViewtabviewpanel2Base from './tab-exp-viewtabviewpanel2-tabviewpanel-base.vue';
@Component({
components: {
}
})
export default class TabExpViewtabviewpanel2 extends TabExpViewtabviewpanel2Base {
}
</script>
\ No newline at end of file
...@@ -561,7 +561,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -561,7 +561,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/ */
public load(opt: any = {}): void { public load(opt: any = {}): void {
if(!this.loadAction){ if(!this.loadAction){
this.$Notice.error({ title: '错误', desc: 'LeadGridView视图搜索表单loadAction参数未配置' }); this.$Notice.error({ title: '错误', desc: 'LeadPickupGridView视图搜索表单loadAction参数未配置' });
return; return;
} }
const arg: any = { ...opt }; const arg: any = { ...opt };
...@@ -598,7 +598,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -598,7 +598,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/ */
public loadDraft(opt: any = {},mode?:string): void { public loadDraft(opt: any = {},mode?:string): void {
if(!this.loaddraftAction){ if(!this.loaddraftAction){
this.$Notice.error({ title: '错误', desc: 'LeadGridView视图搜索表单loaddraftAction参数未配置' }); this.$Notice.error({ title: '错误', desc: 'LeadPickupGridView视图搜索表单loaddraftAction参数未配置' });
return; return;
} }
const arg: any = { ...opt } ; const arg: any = { ...opt } ;
......
...@@ -258,20 +258,6 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -258,20 +258,6 @@ export default class MainBase extends Vue implements ControlInterface {
return this.selections[0]; return this.selections[0];
} }
/**
* 打开新建数据视图
*
* @type {any}
* @memberof Main
*/
@Prop() public newdata: any;
/**
* 打开编辑数据视图
*
* @type {any}
* @memberof Main
*/
@Prop() public opendata: any;
/** /**
* 显示处理提示 * 显示处理提示
...@@ -646,7 +632,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -646,7 +632,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/ */
public load(opt: any = {}, pageReset: boolean = false): void { public load(opt: any = {}, pageReset: boolean = false): void {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: '错误', desc: 'LeadGridView视图表格fetchAction参数未配置' }); this.$Notice.error({ title: '错误', desc: 'LeadPickupGridView视图表格fetchAction参数未配置' });
return; return;
} }
if(pageReset){ if(pageReset){
...@@ -723,7 +709,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -723,7 +709,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/ */
public async remove(datas: any[]): Promise<any> { public async remove(datas: any[]): Promise<any> {
if(!this.removeAction){ if(!this.removeAction){
this.$Notice.error({ title: '错误', desc: 'LeadGridView视图表格removeAction参数未配置' }); this.$Notice.error({ title: '错误', desc: 'LeadPickupGridView视图表格removeAction参数未配置' });
return; return;
} }
let _datas:any[] = []; let _datas:any[] = [];
...@@ -829,7 +815,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -829,7 +815,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/ */
public addBatch(arg: any = {}): void { public addBatch(arg: any = {}): void {
if(!this.fetchAction){ if(!this.fetchAction){
this.$Notice.error({ title: '错误', desc: 'LeadGridView视图表格fetchAction参数未配置' }); this.$Notice.error({ title: '错误', desc: 'LeadPickupGridView视图表格fetchAction参数未配置' });
return; return;
} }
if(!arg){ if(!arg){
...@@ -1375,7 +1361,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1375,7 +1361,7 @@ export default class MainBase extends Vue implements ControlInterface {
try { try {
if(Object.is(item.rowDataState, 'create')){ if(Object.is(item.rowDataState, 'create')){
if(!this.createAction){ if(!this.createAction){
this.$Notice.error({ title: '错误', desc: 'LeadGridView视图表格createAction参数未配置' }); this.$Notice.error({ title: '错误', desc: 'LeadPickupGridView视图表格createAction参数未配置' });
}else{ }else{
Object.assign(item,{viewparams:this.viewparams}); Object.assign(item,{viewparams:this.viewparams});
let response = await this.service.add(this.createAction, JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator); let response = await this.service.add(this.createAction, JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator);
...@@ -1383,7 +1369,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1383,7 +1369,7 @@ export default class MainBase extends Vue implements ControlInterface {
} }
}else if(Object.is(item.rowDataState, 'update')){ }else if(Object.is(item.rowDataState, 'update')){
if(!this.updateAction){ if(!this.updateAction){
this.$Notice.error({ title: '错误', desc: 'LeadGridView视图表格updateAction参数未配置' }); this.$Notice.error({ title: '错误', desc: 'LeadPickupGridView视图表格updateAction参数未配置' });
}else{ }else{
Object.assign(item,{viewparams:this.viewparams}); Object.assign(item,{viewparams:this.viewparams});
if(item.lead){ if(item.lead){
......
<template>
<div class='pickupviewpanel'>
<component
v-if="inited && view.viewname && !Object.is(view.viewname, '')"
:is="view.viewname"
class="viewcontainer3"
:viewdata="viewdata"
:viewparam="viewparam"
:viewDefaultUsage="false"
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
:isShowButton="isShowButton"
@viewdataschange="onViewDatasChange"
@viewdatasactivated="viewDatasActivated"
@viewload="onViewLoad">
</component>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import LeadService from '@/service/lead/lead-service';
import PickupViewpickupviewpanelService from './pickup-viewpickupviewpanel-pickupviewpanel-service';
import PickupViewpickupviewpanelModel from './pickup-viewpickupviewpanel-pickupviewpanel-model';
@Component({
components: {
}
})
export default class PickupViewpickupviewpanelBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof PickupViewpickupviewpanel
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof PickupViewpickupviewpanel
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof PickupViewpickupviewpanel
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof PickupViewpickupviewpanel
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof PickupViewpickupviewpanel
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof PickupViewpickupviewpanel
*/
public getControlType(): string {
return 'PICKUPVIEWPANEL'
}
/**
* 建构部件服务对象
*
* @type {PickupViewpickupviewpanelService}
* @memberof PickupViewpickupviewpanel
*/
public service: PickupViewpickupviewpanelService = new PickupViewpickupviewpanelService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {LeadService}
* @memberof PickupViewpickupviewpanel
*/
public appEntityService: LeadService = new LeadService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof PickupViewpickupviewpanel
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof PickupViewpickupviewpanel
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 选中数据字符串
*
* @type {string}
* @memberof PickupViewpickupviewpanel
*/
@Prop() public selectedData?: string;
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof PickupViewpickupviewpanel
*/
public getDatas(): any[] {
return [];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof PickupViewpickupviewpanel
*/
public getData(): any {
return {};
}
/**
* 视图名称
*
* @type {*}
* @memberof PickupViewpickupviewpanel
*/
public view: any = {
viewname: 'lead-pickup-grid-view',
data: {},
}
/**
* 局部上下文
*
* @type {*}
* @memberof PickupViewpickupviewpanel
*/
public localContext: any = null;
/**
* 局部视图参数
*
* @type {*}
* @memberof PickupViewpickupviewpanel
*/
public localViewParam: any = null;
/**
* 视图数据
*
* @type {*}
* @memberof PickupViewpickupviewpanel
*/
public viewdata: string = JSON.stringify(this.context);
/**
* 视图参数
*
* @type {*}
* @memberof PickupViewpickupviewpanel
*/
public viewparam: string = JSON.stringify(this.viewparams);
/**
* 是否显示按钮
*
* @type {boolean}
* @memberof PickupViewpickupviewpanel
*/
@Prop({default: true}) public isShowButton!: boolean;
/**
* 是否单选
*
* @type {boolean}
* @memberof PickupViewpickupviewpanel
*/
@Prop() public isSingleSelect?: boolean;
/**
* 初始化完成
*
* @type {boolean}
* @memberof PickupViewpickupviewpanel
*/
public inited: boolean = false;
/**
* 视图数据变化
*
* @param {*} $event
* @memberof PickupViewpickupviewpanel
*/
public onViewDatasChange($event: any): void {
if($event.length>0){
$event.forEach((item:any,index:any) => {
let srfmajortext = item['fullname'];
if(srfmajortext){
Object.assign($event[index],{srfmajortext: srfmajortext});
}
});
}
this.$emit('selectionchange', $event);
}
/**
* 视图数据被激活
*
* @param {*} $event
* @memberof PickupViewpickupviewpanel
*/
public viewDatasActivated($event: any): void {
this.$emit('activated', $event);
}
/**
* 视图加载完成
*
* @param {*} $event
* @memberof PickupViewpickupviewpanel
*/
public onViewLoad($event: any): void {
this.$emit('load', $event);
}
/**
* vue 生命周期
*
* @memberof PickupViewpickupviewpanel
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof PickupViewpickupviewpanel
*/
public afterCreated(){
this.initNavParam();
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
if (Object.is('load', action)) {
this.viewdata = JSON.stringify(this.context);
this.viewparam = JSON.stringify(Object.assign(data, this.viewparams));
this.inited = true;
}
});
}
}
/**
* 初始化导航参数
*
* @memberof PickupViewpickupviewpanel
*/
public initNavParam(){
if(this.localContext && Object.keys(this.localContext).length >0){
let _context:any = this.$util.computedNavData({},this.context,this.viewparams,this.localContext);
Object.assign(this.context,_context);
}
if(this.localViewParam && Object.keys(this.localViewParam).length >0){
let _param:any = this.$util.computedNavData({},this.context,this.viewparams,this.localViewParam);
Object.assign(this.viewparams,_param);
}
this.viewdata = JSON.stringify(this.context);
this.viewparam = JSON.stringify(this.viewparams);
}
/**
* vue 生命周期
*
* @memberof PickupViewpickupviewpanel
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof PickupViewpickupviewpanel
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
}
</script>
<style lang='less'>
@import './pickup-viewpickupviewpanel-pickupviewpanel.less';
</style>
\ No newline at end of file
/**
* PickupViewpickupviewpanel 部件模型
*
* @export
* @class PickupViewpickupviewpanelModel
*/
export default class PickupViewpickupviewpanelModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof PickupViewpickupviewpanelModel
*/
public getDataItems(): any[] {
return [
{
name: 'address1_fax',
},
{
name: 'address2_utcoffset',
},
{
name: 'jobtitle',
},
{
name: 'address2_country',
},
{
name: 'budgetamount',
},
{
name: 'address2_fax',
},
{
name: 'onholdtime',
},
{
name: 'lastname',
},
{
name: 'address1_telephone2',
},
{
name: 'address1_stateorprovince',
},
{
name: 'masterleadidyominame',
},
{
name: 'estimatedvalue',
},
{
name: 'lead',
prop: 'leadid',
},
{
name: 'address1_longitude',
},
{
name: 'address1_line1',
},
{
name: 'leadqualitycode',
},
{
name: 'donotphone',
},
{
name: 'exchangerate',
},
{
name: 'entityimage_url',
},
{
name: 'createman',
},
{
name: 'address2_stateorprovince',
},
{
name: 'description',
},
{
name: 'numberofemployees',
},
{
name: 'address1_city',
},
{
name: 'entityimageid',
},
{
name: 'address2_line3',
},
{
name: 'statuscode',
},
{
name: 'address2_line1',
},
{
name: 'customerid',
},
{
name: 'companyname',
},
{
name: 'versionnumber',
},
{
name: 'qualificationcomments',
},
{
name: 'owneridtype',
},
{
name: 'contactidyominame',
},
{
name: 'address2_name',
},
{
name: 'emailaddress1',
},
{
name: 'followemail',
},
{
name: 'address1_country',
},
{
name: 'websiteurl',
},
{
name: 'yomicompanyname',
},
{
name: 'updatedate',
},
{
name: 'address1_line3',
},
{
name: 'address2_addressid',
},
{
name: 'address1_composite',
},
{
name: 'subject',
},
{
name: 'address1_utcoffset',
},
{
name: 'budgetamount_base',
},
{
name: 'address1_addresstypecode',
},
{
name: 'address2_telephone3',
},
{
name: 'evaluatefit',
},
{
name: 'address1_latitude',
},
{
name: 'address1_telephone3',
},
{
name: 'fullname',
},
{
name: 'estimatedamount_base',
},
{
name: 'budgetstatus',
},
{
name: 'industrycode',
},
{
name: 'address1_line2',
},
{
name: 'initialcommunication',
},
{
name: 'address1_postofficebox',
},
{
name: 'address1_telephone1',
},
{
name: 'revenue',
},
{
name: 'yomilastname',
},
{
name: 'address2_county',
},
{
name: 'stageid',
},
{
name: 'address1_shippingmethodcode',
},
{
name: 'estimatedamount',
},
{
name: 'address1_county',
},
{
name: 'utcconversiontimezonecode',
},
{
name: 'lastonholdtime',
},
{
name: 'createdate',
},
{
name: 'teamsfollowed',
},
{
name: 'salutation',
},
{
name: 'address2_shippingmethodcode',
},
{
name: 'address2_latitude',
},
{
name: 'participatesinworkflow',
},
{
name: 'yomifirstname',
},
{
name: 'address2_composite',
},
{
name: 'salesstage',
},
{
name: 'donotpostalmail',
},
{
name: 'customeridyominame',
},
{
name: 'revenue_base',
},
{
name: 'overriddencreatedon',
},
{
name: 'schedulefollowup_prospect',
},
{
name: 'address2_city',
},
{
name: 'telephone1',
},
{
name: 'ibizprivate',
},
{
name: 'customeridtype',
},
{
name: 'mobilephone',
},
{
name: 'need',
},
{
name: 'prioritycode',
},
{
name: 'address1_addressid',
},
{
name: 'yomifullname',
},
{
name: 'salesstagecode',
},
{
name: 'importsequencenumber',
},
{
name: 'address2_telephone1',
},
{
name: 'ownerid',
},
{
name: 'middlename',
},
{
name: 'telephone2',
},
{
name: 'purchasetimeframe',
},
{
name: 'yomimiddlename',
},
{
name: 'leadsourcecode',
},
{
name: 'entityimage_timestamp',
},
{
name: 'preferredcontactmethodcode',
},
{
name: 'entityimage',
},
{
name: 'address2_telephone2',
},
{
name: 'donotsendmm',
},
{
name: 'purchaseprocess',
},
{
name: 'donotbulkemail',
},
{
name: 'sic',
},
{
name: 'donotemail',
},
{
name: 'address2_longitude',
},
{
name: 'confirminterest',
},
{
name: 'address2_postofficebox',
},
{
name: 'statecode',
},
{
name: 'autocreate',
},
{
name: 'address1_name',
},
{
name: 'timezoneruleversionnumber',
},
{
name: 'lastusedincampaign',
},
{
name: 'estimatedclosedate',
},
{
name: 'address2_line2',
},
{
name: 'emailaddress3',
},
{
name: 'pager',
},
{
name: 'address2_upszone',
},
{
name: 'traversedpath',
},
{
name: 'fax',
},
{
name: 'schedulefollowup_qualify',
},
{
name: 'telephone3',
},
{
name: 'processid',
},
{
name: 'emailaddress2',
},
{
name: 'updateman',
},
{
name: 'decisionmaker',
},
{
name: 'owneridyominame',
},
{
name: 'address1_postalcode',
},
{
name: 'address2_postalcode',
},
{
name: 'donotfax',
},
{
name: 'firstname',
},
{
name: 'merged',
},
{
name: 'address2_addresstypecode',
},
{
name: 'address1_upszone',
},
{
name: 'slaname',
},
{
name: 'qualifyingopportunityid',
},
{
name: 'slaid',
},
{
name: 'campaignid',
},
{
name: 'relatedobjectid',
},
{
name: 'transactioncurrencyid',
},
{
name: 'parentaccountid',
},
{
name: 'originatingcaseid',
},
{
name: 'parentcontactid',
},
{
name: 'originatingcasename',
},
{
name: 'qualifyingopportunityname',
},
{
name: 'campaignname',
},
{
name: 'parentcontactname',
},
{
name: 'parentaccountname',
},
{
name: 'relatedobjectname',
},
{
name: 'transactioncurrencyname',
},
]
}
}
\ No newline at end of file
import { Http } from '@/utils';
import ControlService from '@/widgets/control-service';
/**
* PickupViewpickupviewpanel 部件服务对象
*
* @export
* @class PickupViewpickupviewpanelService
*/
export default class PickupViewpickupviewpanelService extends ControlService {
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import PickupViewpickupviewpanelBase from './pickup-viewpickupviewpanel-pickupviewpanel-base.vue';
@Component({
components: {
}
})
export default class PickupViewpickupviewpanel extends PickupViewpickupviewpanelBase {
}
</script>
\ No newline at end of file
<template>
<i-form :model="this.data" class='app-search-form' ref='searchform' style="">
<input style="display:none;"/>
<row>
<i-col span="20" class="form-content">
<row>
</row>
</i-col>
<i-col span="4" class="search-button">
<row v-show="Object.keys(data).length>0">
<i-button class='search_reset' size="default" type="primary" @click="onSearch">{{$t('app.searchButton.search')}}</i-button>
<i-button class='search_reset' size="default" @click="onReset">{{this.$t('app.searchButton.reset')}}</i-button>
</row>
</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 TransactionCurrencyService from '@/service/transaction-currency/transaction-currency-service';
import DefaultService from './default-searchform-service';
import { FormButtonModel, FormPageModel, FormItemModel, FormDRUIPartModel, FormPartModel, FormGroupPanelModel, FormIFrameModel, FormRowItemModel, FormTabPageModel, FormTabPanelModel, FormUserControlModel } from '@/model/form-detail';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
@Component({
components: {
}
})
export default class DefaultBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof Default
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof Default
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof Default
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof Default
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof Default
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof Default
*/
public getControlType(): string {
return 'SEARCHFORM'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof Default
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {DefaultService}
* @memberof Default
*/
public service: DefaultService = new DefaultService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {TransactionCurrencyService}
* @memberof Default
*/
public appEntityService: TransactionCurrencyService = new TransactionCurrencyService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof Default
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof Default
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof DefaultBase
*/
public getDatas(): any[] {
return [this.data];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof DefaultBase
*/
public getData(): any {
return this.data;
}
/**
* 显示处理提示
*
* @type {boolean}
* @memberof DefaultBase
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof DefaultBase
*/
@Prop() public loaddraftAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof DefaultBase
*/
@Prop() public loadAction!: string;
/**
* 视图标识
*
* @type {string}
* @memberof DefaultBase
*/
@Prop() public viewtag!: string;
/**
* 表单状态
*
* @type {Subject<any>}
* @memberof DefaultBase
*/
public formState: Subject<any> = new Subject();
/**
* 忽略表单项值变化
*
* @type {boolean}
* @memberof DefaultBase
*/
public ignorefieldvaluechange: boolean = false;
/**
* 数据变化
*
* @public
* @type {Subject<any>}
* @memberof DefaultBase
*/
public dataChang: Subject<any> = new Subject();
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof DefaultBase
*/
public dataChangEvent: Subscription | undefined;
/**
* 原始数据
*
* @public
* @type {*}
* @memberof DefaultBase
*/
public oldData: any = {};
/**
* 表单数据对象
*
* @type {*}
* @memberof DefaultBase
*/
public data: any = {
};
/**
* 属性值规则
*
* @type {*}
* @memberof DefaultBase
*/
public rules: any = {
}
/**
* 详情模型集合
*
* @type {*}
* @memberof DefaultBase
*/
public detailsModel: any = {
formpage1: new FormPageModel({ caption: '常规条件', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this })
,
};
/**
* 重置表单项值
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof DefaultBase
*/
public resetFormData({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
}
/**
* 表单逻辑
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof DefaultBase
*/
public formLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
}
/**
* 表单值变化
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @returns {void}
* @memberof DefaultBase
*/
public formDataChange({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
if (this.ignorefieldvaluechange) {
return;
}
this.resetFormData({ name: name, newVal: newVal, oldVal: oldVal });
this.formLogic({ name: name, newVal: newVal, oldVal: oldVal });
this.dataChang.next(JSON.stringify(this.data));
}
/**
* 表单加载完成
*
* @public
* @param {*} [data={}]
* @memberof DefaultBase
*/
public onFormLoad(data: any = {}): void {
this.setFormEnableCond(data);
this.fillForm(data);
this.formLogic({ name: '', newVal: null, oldVal: null });
}
/**
* 值填充
*
* @param {*} [_datas={}]
* @memberof DefaultBase
*/
public fillForm(_datas: any = {}): void {
this.ignorefieldvaluechange = true;
Object.keys(_datas).forEach((name: string) => {
if (this.data.hasOwnProperty(name)) {
this.data[name] = _datas[name];
}
});
this.$nextTick(function () {
this.ignorefieldvaluechange = false;
})
}
/**
* 设置表单项是否启用
*
* @public
* @param {*} data
* @memberof DefaultBase
*/
public setFormEnableCond(data: any): void {
Object.values(this.detailsModel).forEach((detail: any) => {
if (!Object.is(detail.detailType, 'FORMITEM')) {
return;
}
const formItem: FormItemModel = detail;
formItem.setEnableCond(data.srfuf);
});
}
/**
* 重置草稿表单状态
*
* @public
* @memberof DefaultBase
*/
public resetDraftFormStates(): void {
const form: any = this.$refs.form;
if (form) {
form.resetFields();
}
}
/**
* 重置校验结果
*
* @memberof DefaultBase
*/
public resetValidates(): void {
Object.values(this.detailsModel).forEach((detail: any) => {
if (!Object.is(detail.detailType, 'FORMITEM')) {
return;
}
const formItem: FormItemModel = detail;
formItem.setError('');
});
}
/**
* 填充校验结果 (后台)
*
* @param {any[]} fieldErrors
* @memberof DefaultBase
*/
public fillValidates(fieldErrors: any[]): void {
fieldErrors.forEach((error: any) => {
const formItem: FormItemModel = this.detailsModel[error.field];
if (!formItem) {
return;
}
this.$nextTick(() => {
formItem.setError(error.message);
});
});
}
/**
* 表单校验状态
*
* @returns {boolean}
* @memberof DefaultBase
*/
public formValidateStatus(): boolean {
const form: any = this.$refs.searchform;
let validatestate: boolean = true;
form.validate((valid: boolean) => {
validatestate = valid ? true : false;
});
return validatestate
}
/**
* 获取全部值
*
* @returns {*}
* @memberof DefaultBase
*/
public getValues(): any {
return this.data;
}
/**
* 表单项值变更
*
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof DefaultBase
*/
public onFormItemValueChange($event: { name: string, value: any }): void {
if (!$event) {
return;
}
if (!$event.name || Object.is($event.name, '') || !this.data.hasOwnProperty($event.name)) {
return;
}
this.data[$event.name] = $event.value;
}
/**
* 设置数据项值
*
* @param {string} name
* @param {*} value
* @returns {void}
* @memberof DefaultBase
*/
public setDataItemValue(name: string, value: any): void {
if (!name || Object.is(name, '') || !this.data.hasOwnProperty(name)) {
return;
}
if (Object.is(this.data[name], value)) {
return;
}
this.data[name] = value;
}
/**
* 分组界面行为事件
*
* @param {*} $event
* @memberof DefaultBase
*/
public groupUIActionClick($event: any): void {
if (!$event) {
return;
}
const item:any = $event.item;
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof DefaultBase
*/
public created(): void {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof DefaultBase
*/
public afterCreated(){
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
if (Object.is('autoload', action)) {
this.autoLoad(data);
}
if (Object.is('load', action)) {
this.load(data);
}
if (Object.is('loaddraft', action)) {
this.loadDraft(data);
}
});
}
}
/**
* vue 生命周期
*
* @memberof DefaultBase
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof DefaultBase
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if (this.dataChangEvent) {
this.dataChangEvent.unsubscribe();
}
}
/**
* 自动加载
*
* @param {*} [arg={}]
* @returns {void}
* @memberof DefaultBase
*/
public autoLoad(arg: any = {}): void {
if (arg.srfkey && !Object.is(arg.srfkey, '')) {
Object.assign(arg, { srfkey: arg.srfkey });
this.load(arg);
return;
}
if (arg.srfkeys && !Object.is(arg.srfkeys, '')) {
Object.assign(arg, { srfkey: arg.srfkeys });
this.load(arg);
return;
}
this.loadDraft(arg);
}
/**
* 加载
*
* @public
* @param {*} [opt={}]
* @memberof DefaultBase
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: '错误', desc: 'TransactionCurrencyPickupGridView视图搜索表单loadAction参数未配置' });
return;
}
const arg: any = { ...opt };
Object.assign(arg,{viewparams:this.viewparams});
const get: Promise<any> = this.service.get(this.loadAction,JSON.parse(JSON.stringify(this.context)), arg, this.showBusyIndicator);
get.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
this.onFormLoad(data);
this.$emit('load', data);
this.$nextTick(() => {
this.formState.next({ type: 'load', data: data });
});
}
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
const { data: _data } = response;
this.$Notice.error({ title: _data.title, desc: _data.message });
});
}
/**
* 加载草稿
*
* @param {*} [opt={}]
* @memberof DefaultBase
*/
public loadDraft(opt: any = {},mode?:string): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: '错误', desc: 'TransactionCurrencyPickupGridView视图搜索表单loaddraftAction参数未配置' });
return;
}
const arg: any = { ...opt } ;
Object.assign(arg,{viewparams:this.viewparams});
let post: Promise<any> = this.service.loadDraft(this.loaddraftAction,JSON.parse(JSON.stringify(this.context)), arg, this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.errorMessage) {
this.$Notice.error({ title: '错误', desc: response.errorMessage });
}
return;
}
const data = response.data;
this.resetDraftFormStates();
this.onFormLoad(data);
setTimeout(() => {
const form: any = this.$refs.form;
if (form) {
form.fields.forEach((field: any) => {
field.validateMessage = "";
field.validateState = "";
field.validateStatus = false;
});
}
});
if(Object.is(mode,'RESET')){
if (!this.formValidateStatus()) {
return;
}
}
this.$emit('load', data);
this.$nextTick(() => {
this.formState.next({ type: 'load', data: data });
});
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
const { data: _data } = response;
this.$Notice.error({ title: _data.title, desc: _data.message });
});
}
/**
* 表单项更新
*
* @param {string} mode 界面行为名称
* @param {*} [data={}] 请求数据
* @param {string[]} updateDetails 更新项
* @param {boolean} [showloading] 是否显示加载状态
* @returns {void}
* @memberof DefaultBase
*/
public updateFormItems(mode: string, data: any = {}, updateDetails: string[], showloading?: boolean): void {
}
/**
* 回车事件
*
* @param {*} $event
* @memberof DefaultBase
*/
public onEnter($event: any): void {
if (!this.formValidateStatus()) {
return;
}
this.$emit('search', this.data);
}
/**
* 搜索
*
* @memberof DefaultBase
*/
public onSearch() {
if (!this.formValidateStatus()) {
return;
}
this.$emit('search', this.data);
}
/**
* 重置
*
* @memberof DefaultBase
*/
public onReset() {
this.loadDraft({},'RESET');
}
}
</script>
<style lang='less'>
@import './default-searchform.less';
</style>
\ No newline at end of file
/**
* Default 部件模型
*
* @export
* @class DefaultModel
*/
export default class DefaultModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof DefaultModel
*/
public getDataItems(): any[] {
return [
{
name: 'srfwfmemo',
prop: 'srfwfmemo',
dataType: 'TEXT',
},
// 前端新增修改标识,新增为"0",修改为"1"或未设值
{
name: 'srffrontuf',
prop: 'srffrontuf',
dataType: 'TEXT',
},
]
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import TransactionCurrencyService from '@/service/transaction-currency/transaction-currency-service';
import DefaultModel from './default-searchform-model';
/**
* Default 部件服务对象
*
* @export
* @class DefaultService
*/
export default class DefaultService extends ControlService {
/**
* 货币服务对象
*
* @type {TransactionCurrencyService}
* @memberof DefaultService
*/
public appEntityService: TransactionCurrencyService = new TransactionCurrencyService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof DefaultService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of DefaultService.
*
* @param {*} [opts={}]
* @memberof DefaultService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new DefaultModel();
}
/**
* 处理数据
*
* @private
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof DefaultService
*/
private doItems(promise: Promise<any>, deKeyField: string, deName: string): Promise<any> {
return new Promise((resolve, reject) => {
promise.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
data.forEach((item:any,index:number) =>{
item[deName] = item[deKeyField];
data[index] = item;
});
resolve(data);
} else {
reject([])
}
}).catch((response: any) => {
reject([])
});
});
}
/**
* 获取跨实体数据集合
*
* @param {string} serviceName 服务名称
* @param {string} interfaceName 接口名称
* @param {*} data
* @param {boolean} [isloading]
* @returns {Promise<any[]>}
* @memberof DefaultService
*/
@Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
return Promise.reject([])
}
/**
* 启动工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public wfstart(action: string,context: any = {},data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading,localdata);
} else {
result = this.appEntityService.WFStart(context,data, isloading,localdata);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 提交工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading,localdata);
} else {
result = this.appEntityService.WFSubmit(context,data, isloading,localdata);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 添加数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Create(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 删除数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public delete(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Remove(Context,Data, isloading);
}
result.then((response) => {
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 修改数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Update(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public get(action: string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Get(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 加载草稿
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public loadDraft(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
//仿真主键数据
const PrimaryKey = Util.createUUID();
Data.transactioncurrencyid = PrimaryKey;
Data.transactioncurrency = 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.transactioncurrencyid = PrimaryKey;
this.handleResponse(action, response, true);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 前台逻辑
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public frontLogic(action:string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any)=>{
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
return Promise.reject({ status: 500, data: { title: '失败', message: '系统异常' } });
}
result.then((response) => {
this.handleResponse(action, response,true);
resolve(response);
}).catch(response => {
reject(response);
});
})
}
/**
* 处理请求数据
*
* @param action 行为
* @param data 数据
* @memberof DefaultService
*/
public handleRequestData(action: string,context:any, data: any = {}){
let mode: any = this.getMode();
if (!mode && mode.getDataItems instanceof Function) {
return data;
}
let formItemItems: any[] = mode.getDataItems();
let requestData:any = {};
formItemItems.forEach((item:any) =>{
if(item && item.dataType && Object.is(item.dataType,'FONTKEY')){
if(item && item.prop){
requestData[item.prop] = context[item.name];
}
}else{
if(item && item.prop){
requestData[item.prop] = data[item.name];
}
}
});
if(data && data.viewparams){
Object.assign(requestData,data.viewparams);
}
let tempContext:any = JSON.parse(JSON.stringify(context));
if(tempContext && tempContext.srfsessionid){
tempContext.srfsessionkey = tempContext.srfsessionid;
delete tempContext.srfsessionid;
}
return {context:tempContext,data:requestData};
}
}
\ No newline at end of file
.ivu-tabs-no-animation>.ivu-tabs-content{
padding: 0 16px;
}
.ivu-card-head{
padding: 14px 0;
}
.app-search-form {
padding: 8px 14px 0;
.ivu-form-item{
margin-bottom: 8px;
}
.search_reset {
margin-right: 12px;
margin-bottom: 8px;
}
.search-button{
text-align: right;
}
}
.app-search-form-flex {
height: 100%;
> .ivu-row {
height: 100%;
> .ivu-tabs {
height: 100%;
display: flex;
flex-direction: column;
> .ivu-tabs-content {
flex-grow: 1;
overflow: auto;
> .ivu-tabs-tabpane {
height: 100%;
}
}
}
}
}
.app-tabpanel-flex {
height: 100%;
> .ivu-tabs-content {
height: calc(100% - 52px);
> .ivu-tabs-tabpane {
height: 100%;
}
}
}
// this is less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import DefaultBase from './default-searchform-base.vue';
@Component({
components: {
}
})
export default class Default extends DefaultBase {
}
</script>
\ No newline at end of file
<template>
<div :class="{ 'grid': true, 'show-paging-bar': isEnablePagingBar, 'hidden-paging-bar': !isEnablePagingBar }">
<i-form>
<el-table v-if="isDisplay === true"
:default-sort="{ prop: minorSortPSDEF, order: Object.is(minorSortDir, 'ASC') ? 'ascending' : Object.is(minorSortDir, 'DESC') ? 'descending' : '' }"
@sort-change="onSortChange($event)"
:border="isDragendCol"
:highlight-current-row ="isSingleSelect"
:row-class-name="getRowClassName"
size="mini"
stripe
@row-click="rowClick($event)"
@select-all="selectAll($event)"
@select="select($event)"
@row-class-name="onRowClassName($event)"
@row-dblclick="rowDBLClick($event)"
ref='multipleTable' :data="items" :show-header="!isHideHeader">
<template slot="empty">
无数据
<span class="quick-toolbar">
</span>
</template>
<template v-if="!isSingleSelect">
<el-table-column align="center" type='selection' :width="checkboxColWidth"></el-table-column>
</template>
<template v-if="getColumnState('currencyname')">
<el-table-column show-overflow-tooltip :prop="'currencyname'" :label="$t('entities.transactioncurrency.main_grid.columns.currencyname')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.transactioncurrency.main_grid.columns.currencyname')}}
</span>
</template>
<template v-slot="{row,column,$index}">
<span>{{row.currencyname}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('updateman')">
<el-table-column show-overflow-tooltip :prop="'updateman'" :label="$t('entities.transactioncurrency.main_grid.columns.updateman')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.transactioncurrency.main_grid.columns.updateman')}}
</span>
</template>
<template v-slot="{row,column,$index}">
<template >
<codelist :value="row.updateman" tag='SysOperator' codelistType='DYNAMIC' ></codelist>
</template>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('updatedate')">
<el-table-column show-overflow-tooltip :prop="'updatedate'" :label="$t('entities.transactioncurrency.main_grid.columns.updatedate')" :width="150" :align="'left'" :sortable="'custom'">
<template v-slot:header="{column}">
<span class="column-header ">
{{$t('entities.transactioncurrency.main_grid.columns.updatedate')}}
</span>
</template>
<template v-slot="{row,column,$index}">
<app-format-data format="YYYY-MM-DD hh:mm:ss" :data="row.updatedate"></app-format-data>
</template>
</el-table-column>
</template>
<template v-if="adaptiveState">
<el-table-column></el-table-column>
</template>
</el-table>
<row class='grid-pagination' v-show="items.length > 0">
<page class='pull-right' @on-change="pageOnChange($event)"
@on-page-size-change="onPageSizeChange($event)"
:transfer="true" :total="totalrow"
show-sizer :current="curPage" :page-size="limit"
:page-size-opts="[10, 20, 30, 40, 50, 60, 70, 80, 90, 100]" show-elevator show-total>
<span>
<span class="page-column">
<poptip transfer placement="top-start">
<i-button icon="md-menu">{{$t('app.gridpage.choicecolumns')}}</i-button>
<div slot="content">
<template v-for="col in allColumns">
<div :key="col.name"><el-checkbox v-model="col.show" @change="onColChange()">{{$t(col.langtag)}}</el-checkbox></div>
</template>
</div>
</poptip>
</span>
<span v-if="selections.length > 0" class="batch-toolbar">
</span>
<span class="page-button"><i-button icon="md-refresh" :title="$t('app.gridpage.refresh')" @click="pageRefresh()"></i-button></span>&nbsp;
<span>
{{$t('app.gridpage.show')}}&nbsp;
<span>
<template v-if="items.length === 1">
1
</template>
<template v-else>
<span>{{(curPage - 1) * limit + 1}}&nbsp;-&nbsp;{{totalrow > curPage * limit ? curPage * limit : totalrow}}</span>
</template>
</span>&nbsp;
{{$t('app.gridpage.records')}},{{$t('app.gridpage.totle')}}&nbsp;{{totalrow}}&nbsp;{{$t('app.gridpage.records')}}
</span>
</span>
</page>
</row>
</i-form>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import TransactionCurrencyService from '@/service/transaction-currency/transaction-currency-service';
import MainService from './main-grid-service';
import CodeListService from "@service/app/codelist-service";
import { FormItemModel } from '@/model/form-detail';
@Component({
components: {
}
})
export default class MainBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof Main
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof Main
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof Main
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof Main
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof Main
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof Main
*/
public getControlType(): string {
return 'GRID'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof Main
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {MainService}
* @memberof Main
*/
public service: MainService = new MainService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {TransactionCurrencyService}
* @memberof Main
*/
public appEntityService: TransactionCurrencyService = new TransactionCurrencyService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof Main
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof Main
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 代码表服务对象
*
* @type {CodeListService}
* @memberof Main
*/
public codeListService:CodeListService = new CodeListService({ $store: this.$store });
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof Main
*/
public getDatas(): any[] {
return this.selections;
}
/**
* 获取单项树
*
* @returns {*}
* @memberof Main
*/
public getData(): any {
return this.selections[0];
}
/**
* 显示处理提示
*
* @type {boolean}
* @memberof Main
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--update
*
* @type {string}
* @memberof Main
*/
@Prop() public updateAction!: string;
/**
* 部件行为--fetch
*
* @type {string}
* @memberof Main
*/
@Prop() public fetchAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof Main
*/
@Prop() public removeAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof Main
*/
@Prop() public loadAction!: string;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof Main
*/
@Prop() public loaddraftAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof Main
*/
@Prop() public createAction!: string;
/**
* 当前页
*
* @type {number}
* @memberof Main
*/
public curPage: number = 1;
/**
* 数据
*
* @type {any[]}
* @memberof Main
*/
public items: any[] = [];
/**
* 是否支持分页
*
* @type {boolean}
* @memberof Main
*/
public isEnablePagingBar: boolean = true;
/**
* 是否禁用排序
*
* @type {boolean}
* @memberof Main
*/
public isNoSort: boolean = false;
/**
* 排序方向
*
* @type {string}
* @memberof Main
*/
public minorSortDir: string = '';
/**
* 排序字段
*
* @type {string}
* @memberof Main
*/
public minorSortPSDEF: string = '';
/**
* 分页条数
*
* @type {number}
* @memberof Main
*/
public limit: number = 20;
/**
* 是否显示标题
*
* @type {boolean}
* @memberof Main
*/
public isHideHeader: boolean = false;
/**
* 是否默认选中第一条数据
*
* @type {boolean}
* @memberof Main
*/
@Prop({ default: false }) public isSelectFirstDefault!: boolean;
/**
* 是否单选
*
* @type {boolean}
* @memberof Main
*/
@Prop() public isSingleSelect?: boolean;
/**
* 选中数据字符串
*
* @type {string}
* @memberof Main
*/
@Prop() public selectedData?: string;
/**
* 选中值变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('selectedData')
public onValueChange(newVal: any, oldVal: any) {
this.selections = [];
if(this.selectedData){
const refs: any = this.$refs;
if (refs.multipleTable) {
refs.multipleTable.clearSelection();
JSON.parse(this.selectedData).forEach((selection:any)=>{
let selectedItem = this.items.find((item:any)=>{
return Object.is(item.srfkey, selection.srfkey);
});
if(selectedItem){
this.rowClick(selectedItem);
}
});
}
}
}
/**
* 表格行数据默认激活模式
* 0 不激活
* 1 单击激活
* 2 双击激活
*
* @type {(number | 0 | 1 | 2)}
* @memberof Main
*/
@Prop({default: 2}) public gridRowActiveMode!: number;
/**
* 是否开启行编辑
*
* @type {boolean}
* @memberof Main
*/
@Prop({default: false}) public isOpenEdit!: boolean;
/**
* 实际是否开启行编辑
*
* @type {boolean}
* @memberof Main
*/
public actualIsOpenEdit: boolean = this.isOpenEdit;
/**
* 总条数
*
* @type {number}
* @memberof Main
*/
public totalrow: number = 0;
/**
* 选中行数据
*
* @type {any[]}
* @memberof Main
*/
public selections: any[] = [];
/**
* 拦截行选中
*
* @type {boolean}
* @memberof Main
*/
public stopRowClick: boolean = false;
/**
* 表格是否显示
*
* @type {boolean}
* @memberof Main
*/
public isDisplay:boolean = true;
/**
* 部件刷新
*
* @param {any[]} args
* @memberof Main
*/
public refresh(args: any[]): void {
this.load();
}
/**
* 选项框列宽
*
* @type {number}
* @memberof Main
*/
public checkboxColWidth: number = 35;
/**
* 是否允许拖动列宽
*
* @type {boolean}
* @memberof Main
*/
public isDragendCol: boolean = false;
/**
* 所有列成员
*
* @type {any[]}
* @memberof Main
*/
public allColumns: any[] = [
{
name: 'currencyname',
label: '货币名称',
langtag: 'entities.transactioncurrency.main_grid.columns.currencyname',
show: true,
util: 'PX'
},
{
name: 'updateman',
label: '更新人',
langtag: 'entities.transactioncurrency.main_grid.columns.updateman',
show: true,
util: 'PX'
},
{
name: 'updatedate',
label: '更新时间',
langtag: 'entities.transactioncurrency.main_grid.columns.updatedate',
show: true,
util: 'PX'
},
]
/**
* 表格模型集合
*
* @type {*}
* @memberof Main
*/
public gridItemsModel: any[] = [];
/**
* 获取表格行模型
*
* @type {*}
* @memberof Main
*/
public getGridRowModel(){
return {
srfkey: new FormItemModel(),
}
}
/**
* 属性值规则
*
* @type {*}
* @memberof Main
*/
public rules: any = {
srfkey: [
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '交易币种 值不能为空', trigger: 'change' },
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '交易币种 值不能为空', trigger: 'blur' },
],
}
/**
* 表格行编辑项校验
*
* @param {string} property 属性名
* @param {*} data 行数据
* @param {number} rowIndex 行索引
* @returns Promise<any>
*
* @memberof Main
*/
public validate(property:string, data:any, rowIndex:number):Promise<any>{
return new Promise((resolve, reject) => {
this.$util.validateItem(property,data,this.rules).then(()=>{
this.gridItemsModel[rowIndex][property].setError(null);
resolve(true);
}).catch(({ errors, fields }) => {
this.gridItemsModel[rowIndex][property].setError(errors[0].message);
resolve(false);
});
});
}
/**
* 校验所有修改过的编辑项
*
* @returns Promise<any>
* @memberof Main
*/
public async validateAll(){
let validateState = true;
let index = -1;
for(let item of this.items){
index++;
if(item.rowDataState === "create" || item.rowDataState === "update"){
for(let property of Object.keys(this.rules)){
if(!await this.validate(property,item,index)){
validateState = false;
}
}
}
}
return validateState;
}
/**
* 表格数据加载
*
* @param {*} [arg={}]
* @memberof Main
*/
public load(opt: any = {}, pageReset: boolean = false): void {
if(!this.fetchAction){
this.$Notice.error({ title: '错误', desc: 'TransactionCurrencyPickupGridView视图表格fetchAction参数未配置' });
return;
}
if(pageReset){
this.curPage = 1;
}
const arg: any = {...opt};
const page: any = {};
if (this.isEnablePagingBar) {
Object.assign(page, { page: this.curPage-1, size: this.limit });
}
// 设置排序
if (!this.isNoSort && !Object.is(this.minorSortDir, '') && !Object.is(this.minorSortPSDEF, '')) {
const sort: string = this.minorSortPSDEF+","+this.minorSortDir;
Object.assign(page, { sort: sort });
}
Object.assign(arg, page);
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
let tempViewParams:any = parentdata.viewparams?parentdata.viewparams:{};
Object.assign(tempViewParams,JSON.parse(JSON.stringify(this.viewparams)));
Object.assign(arg,{viewparams:tempViewParams});
const post: Promise<any> = this.service.search(this.fetchAction,JSON.parse(JSON.stringify(this.context)), arg, this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.errorMessage) {
this.$Notice.error({ title: '错误', desc: response.errorMessage });
}
return;
}
const data: any = response.data;
this.totalrow = response.total;
this.items = JSON.parse(JSON.stringify(data));
// 清空selections,gridItemsModel
this.selections = [];
this.gridItemsModel = [];
this.items.forEach(()=>{this.gridItemsModel.push(this.getGridRowModel())});
this.$emit('load', this.items);
// 设置默认选中
let _this = this;
setTimeout(() => {
if(_this.isSelectFirstDefault){
_this.rowClick(_this.items[0]);
}
if(_this.selectedData){
const refs: any = _this.$refs;
if (refs.multipleTable) {
refs.multipleTable.clearSelection();
JSON.parse(_this.selectedData).forEach((selection:any)=>{
let selectedItem = _this.items.find((item:any)=>{
return Object.is(item.srfkey, selection.srfkey);
});
if(selectedItem){
_this.rowClick(selectedItem);
}
});
}
}
}, 300);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: '错误', desc: response.errorMessage });
});
}
/**
* 删除
*
* @param {any[]} datas
* @returns {Promise<any>}
* @memberof Main
*/
public async remove(datas: any[]): Promise<any> {
if(!this.removeAction){
this.$Notice.error({ title: '错误', desc: 'TransactionCurrencyPickupGridView视图表格removeAction参数未配置' });
return;
}
let _datas:any[] = [];
datas.forEach((record: any, index: number) => {
if (Object.is(record.srfuf, "0")) {
this.items.some((val: any, num: number) =>{
if(JSON.stringify(val) == JSON.stringify(record)){
this.items.splice(num,1);
this.gridItemsModel.splice(num,1);
return true;
}
});
}else{
_datas.push(datas[index]);
}
});
if (_datas.length === 0) {
return;
}
let dataInfo = '';
_datas.forEach((record: any, index: number) => {
let srfmajortext = record.currencyname;
if (index < 5) {
if (!Object.is(dataInfo, '')) {
dataInfo += '、';
}
dataInfo += srfmajortext;
} else {
return false;
}
});
if (_datas.length < 5) {
dataInfo = dataInfo + ' 共' + _datas.length + '条数据';
} else {
dataInfo = dataInfo + '...' + ' 共' + _datas.length + '条数据';
}
const removeData = () => {
let keys: any[] = [];
_datas.forEach((data: any) => {
keys.push(data.srfkey);
});
let _removeAction = keys.length > 1 ? 'removeBatch' : this.removeAction ;
let _keys = keys.length > 1 ? keys : keys[0] ;
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(_removeAction,Object.assign(context,{ transactioncurrency: _keys }),Object.assign({ transactioncurrency: _keys },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: '删除数据失败,' + response.info });
return;
} else {
this.$Notice.success({ title: '', desc: '删除成功!' });
}
//删除items中已删除的项
console.log(this.items);
_datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
this.gridItemsModel.splice(index,1);
return true;
}
});
});
this.totalrow -= _datas.length;
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
});
});
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '');
this.$Modal.confirm({
title: '警告',
content: '确认要删除 ' + dataInfo + ',删除操作将不可恢复?',
onOk: () => {
removeData();
},
onCancel: () => { }
});
return removeData;
}
/**
* 批量添加
*
* @param {*} [arg={}]
* @memberof Main
*/
public addBatch(arg: any = {}): void {
if(!this.fetchAction){
this.$Notice.error({ title: '错误', desc: 'TransactionCurrencyPickupGridView视图表格fetchAction参数未配置' });
return;
}
if(!arg){
arg = {};
}
console.error("批量添加未实现");
}
/**
* 数据导入
*
* @param {*} data
* @memberof Main
*/
public importExcel(data:any ={}):void{
//导入excel
const importDataModel:any ={
}
if(Object.keys(importDataModel).length == 0){
this.$Notice.warning({ 'title': (this.$t("app.utilview.warning") as string), 'desc': (this.$t("app.utilview.info") as string) });
return;
}
const view:any ={
viewname: 'app-data-upload',
title: this.$t("app.utilview.importview"),
width: 900,
height: 700
}
let container: Subject<any> = this.$appmodal.openModal(view, JSON.parse(JSON.stringify(this.context)), importDataModel);
container.subscribe((result: any) => {
if(Object.is(result.ret,'OK')){
this.refresh(result.datas);
}
});
}
/**
* 数据导出
*
* @param {*} data
* @memberof Main
*/
public exportExcel(data: any = {}): void {
// 导出Excel
const doExport = async (_data:any) => {
const tHeader: Array<any> = [];
const filterVal: Array<any> = [];
this.allColumns.forEach((item: any) => {
item.show && item.label ? tHeader.push(this.$t(item.langtag)) : "";
item.show && item.name ? filterVal.push(item.name) : "";
});
const data = await this.formatExcelData(filterVal, _data);
this.$export.exportExcel().then((excel:any)=>{
excel.export_json_to_excel({
header: tHeader, //表头 必填
data, //具体数据 必填
filename: "货币表", //非必填
autoWidth: true, //非必填
bookType: "xlsx" //非必填
});
});
};
const page: any = {};
// 设置page,size
if (Object.is(data.type, 'maxRowCount')) {
Object.assign(page, { page: 0, size: data.maxRowCount });
} else if (Object.is(data.type, 'activatedPage')) {
try {
doExport(JSON.parse(JSON.stringify(this.items)));
} catch (error) {
console.error(error);
}
return;
}
// 设置排序
if (!this.isNoSort && !Object.is(this.minorSortDir, '') && !Object.is(this.minorSortPSDEF, '')) {
const sort: string = this.minorSortPSDEF+","+this.minorSortDir;
Object.assign(page, { sort: sort });
}
const arg: any = {};
Object.assign(arg, page);
// 获取query,搜索表单,viewparams等父数据
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
const post: Promise<any> = this.service.search(this.fetchAction,JSON.parse(JSON.stringify(this.context)), arg, this.showBusyIndicator);
post.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: '数据导出失败,' + response.info });
return;
}
try {
doExport(JSON.parse(JSON.stringify(response.data)));
} catch (error) {
console.error(error);
}
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: '', desc: '数据导出失败' });
});
}
/**
* 导出数据格式化
*
* @param {*} filterVal
* @param {*} jsonData
* @returns {[]}
* @memberof Main
*/
public async formatExcelData(filterVal:any, jsonData:any) {
let codelistColumns:Array<any> = [
{
name: 'updateman',
srfkey: 'SysOperator',
codelistType : 'DYNAMIC',
renderMode: 'other',
textSeparator: '、',
valueSeparator: ',',
},
];
let _this = this;
for (const codelist of codelistColumns) {
// 动态代码表处理
if (Object.is(codelist.codelistType, "DYNAMIC")) {
let items = await _this.codeListService.getItems(codelist.srfkey);
jsonData.forEach((row:any)=>{
row[codelist.name] = _this.getCodelistValue(items, row[codelist.name], codelist);
});
// 静态处理
} else if(Object.is(codelist.codelistType, "STATIC")){
let items = await _this.$store.getters.getCodeListItems(codelist.srfkey);
jsonData.forEach((row:any)=>{
row[codelist.name] = _this.getCodelistValue(items, row[codelist.name], codelist);
});
}
}
return jsonData.map((v:any) => filterVal.map((j:any) => v[j]))
}
/**
* 解析代码表和vlaue,设置items
*
* @public
* @param {any[]} items 代码表数据
* @param {*} value
* @returns {*}
* @memberof Main
*/
public getCodelistValue(items: any[], value: any, codelist: any,){
if(!value){
return this.$t('codelist.'+codelist.srfkey+'.empty');
}
if (items) {
let result:any = [];
if(Object.is(codelist.renderMode,"number")){
items.map((_item: any, index: number)=>{
const nValue = parseInt((value as any), 10);
const codevalue = _item.value;
if((parseInt(codevalue, 10) & nValue) > 0){
result.push(_item);
}
});
} else if(Object.is(codelist.renderMode,"string")){
const arrayValue: Array<any> = (value as any).split(codelist.valueSeparator);
arrayValue.map((value: any, index: number) => {
result.push([]);
let values: any[] = Object.is(this.$util.typeOf(value), 'number') ? [value] : [...(value as any).split(codelist.valueSeparator)];
values.map((val:any ,num: number)=>{
const item = this.getItem(items, val, codelist);
if(item){
result[index].push(item);
}
});
});
} else {
let values: any[] = Object.is(this.$util.typeOf(value), 'number') ? [value] : [...(value as any).split(codelist.valueSeparator)];
values.map((value:any ,index: number)=>{
const item = this.getItem(items, value, codelist);
if(item){
result.push(item);
}
});
}
// 设置items
if(result.length != 0){
return result.join(codelist.valueSeparator);
}else{
return value;
}
}
}
/**
* 获取代码项
*
* @public
* @param {any[]} items
* @param {*} value
* @returns {*}
* @memberof Main
*/
public getItem(items: any[], value: any, codelist: any): any {
const arr: Array<any> = items.filter(item => {return item.value == value});
if (arr.length !== 1) {
return undefined;
}
if(Object.is(codelist.codelistType,'STATIC')){
return this.$t('codelist.'+codelist.srfkey+'.'+arr[0].value);
}else{
return arr[0].text;
}
}
/**
* 生命周期
*
* @memberof Main
*/
public created(): void {
this.afterCreated();
this.$acc.commandLocal(() => {
this.load()
}, 'all', 'TRANSACTIONCURRENCY');
}
/**
* 执行created后的逻辑
*
* @memberof Main
*/
public afterCreated(){
this.setColState();
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
if (Object.is('load', action)) {
this.load(data);
}
if (Object.is('remove', action)) {
this.remove(data);
}
if (Object.is('save', action)) {
this.save(data);
}
});
}
}
/**
* vue 生命周期
*
* @memberof Main
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof Main
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
/**
* 获取选中行胡数据
*
* @returns {any[]}
* @memberof Main
*/
public getSelection(): any[] {
return this.selections;
}
/**
* 行双击事件
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
public rowDBLClick($event: any): void {
if (!$event || this.actualIsOpenEdit || Object.is(this.gridRowActiveMode,0)) {
return;
}
this.selections = [];
this.selections.push(JSON.parse(JSON.stringify($event)));
const refs: any = this.$refs;
if (refs.multipleTable) {
refs.multipleTable.clearSelection();
refs.multipleTable.toggleRowSelection($event);
}
this.$emit('rowdblclick', this.selections);
this.$emit('selectionchange', this.selections);
}
/**
* 复选框数据选中
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
public select($event: any): void {
if (!$event) {
return;
}
this.selections = [];
this.selections = [...JSON.parse(JSON.stringify($event))];
this.$emit('selectionchange', this.selections);
}
/**
* 复选框数据全部选中
*
* @param {*} $event
* @memberof Main
*/
public selectAll($event: any): void {
if (!$event) {
return;
}
this.selections = [];
this.selections = [...JSON.parse(JSON.stringify($event))];
this.$emit('selectionchange', this.selections);
}
/**
* 行单击选中
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
public rowClick($event: any, ifAlways: boolean = false): void {
if (!ifAlways && (!$event || this.actualIsOpenEdit)) {
return;
}
if(this.stopRowClick) {
this.stopRowClick = false;
return;
}
if(this.isSingleSelect){
this.selections = [];
}
// 已选中则删除,没选中则添加
let selectIndex = this.selections.findIndex((item:any)=>{
return Object.is(item.transactioncurrency,$event.transactioncurrency);
});
if (Object.is(selectIndex,-1)){
this.selections.push(JSON.parse(JSON.stringify($event)));
} else {
this.selections.splice(selectIndex,1);
}
const refs: any = this.$refs;
if (refs.multipleTable) {
if(this.isSingleSelect){
refs.multipleTable.clearSelection();
refs.multipleTable.setCurrentRow($event);
}else{
refs.multipleTable.toggleRowSelection($event);
}
}
this.$emit('selectionchange', this.selections);
}
/**
* 页面变化
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
public pageOnChange($event: any): void {
if (!$event) {
return;
}
if ($event === this.curPage) {
return;
}
this.curPage = $event;
this.load({});
}
/**
* 分页条数变化
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
public onPageSizeChange($event: any): void {
if (!$event) {
return;
}
if ($event === this.limit) {
return;
}
this.limit = $event;
if (this.curPage === 1) {
this.load({});
}
}
/**
* 分页刷新
*
* @memberof Main
*/
public pageRefresh(): void {
this.load({});
}
/**
* 排序变化
*
* @param {{ column: any, prop: any, order: any }} { column, prop, order }
* @memberof Main
*/
public onSortChange({ column, prop, order }: { column: any, prop: any, order: any }): void {
const dir = Object.is(order, 'ascending') ? 'asc' : Object.is(order, 'descending') ? 'desc' : '';
if (Object.is(dir, this.minorSortDir) && Object.is(this.minorSortPSDEF, prop)) {
return;
}
this.minorSortDir = dir;
this.minorSortPSDEF = prop ? prop : '';
this.load({});
}
/**
* 表格行选中样式
*
* @param {{ row: any, rowIndex: any }} { row, rowIndex }
* @returns {string}
* @memberof Main
*/
public onRowClassName({ row, rowIndex }: { row: any, rowIndex: any }): string {
const index = this.selections.findIndex((select: any) => Object.is(select.srfkey, row.srfkey));
return index !== -1 ? 'grid-row-select' : '';
}
/**
* 界面行为
*
* @param {*} row
* @param {*} tag
* @param {*} $event
* @memberof Main
*/
public uiAction(row: any, tag: any, $event: any) {
$event.stopPropagation();
}
/**
* 设置列状态
*
* @memberof Main
*/
public setColState() {
const _data: any = localStorage.getItem('transactioncurrency_main_grid');
if (_data) {
let columns = JSON.parse(_data);
columns.forEach((col: any) => {
let column = this.allColumns.find((item) => Object.is(col.name, item.name));
if (column) {
Object.assign(column, col);
}
});
}
}
/**
* 列变化
*
* @memberof Main
*/
public onColChange() {
localStorage.setItem('transactioncurrency_main_grid', JSON.stringify(this.allColumns));
}
/**
* 获取列状态
*
* @param {string} name
* @returns {boolean}
* @memberof Main
*/
public getColumnState(name: string): boolean {
let column = this.allColumns.find((col: any) =>
Object.is(name, col.name)
);
return column.show ? true : false;
}
/**
* 表格列是否自适应布局
*
* @readonly
* @type {boolean}
* @memberof Main
*/
get adaptiveState(): boolean {
return !this.allColumns.find((column: any) => column.show && Object.is(column.util, 'STAR'));
}
/**
* 保存
*
* @param {*} $event
* @returns {Promise<any>}
* @memberof Main
*/
public async save(args: any[], params?: any, $event?: any, xData?: any){
let _this = this;
if(!await this.validateAll()){
this.$Notice.error({ title: '错误', desc: '值规则校验异常' });
return [];
}
let successItems:any = [];
let errorItems:any = [];
let errorMessage:any = [];
for (const item of _this.items) {
try {
if(Object.is(item.rowDataState, 'create')){
if(!this.createAction){
this.$Notice.error({ title: '错误', desc: 'TransactionCurrencyPickupGridView视图表格createAction参数未配置' });
}else{
Object.assign(item,{viewparams:this.viewparams});
let response = await this.service.add(this.createAction, JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator);
successItems.push(JSON.parse(JSON.stringify(response.data)));
}
}else if(Object.is(item.rowDataState, 'update')){
if(!this.updateAction){
this.$Notice.error({ title: '错误', desc: 'TransactionCurrencyPickupGridView视图表格updateAction参数未配置' });
}else{
Object.assign(item,{viewparams:this.viewparams});
if(item.transactioncurrency){
Object.assign(this.context,{transactioncurrency:item.transactioncurrency});
}
let response = await this.service.add(this.updateAction,JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator);
successItems.push(JSON.parse(JSON.stringify(response.data)));
}
}
} catch (error) {
errorItems.push(JSON.parse(JSON.stringify(item)));
errorMessage.push(error);
}
}
this.$emit('save', successItems);
this.refresh([]);
if(errorItems.length === 0){
this.$Notice.success({ title: '', desc: '保存成功!' });
}else{
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: '保存失败', desc: item.majorentityname+'保存失败!' });
console.error(errorMessage[index]);
});
}
return successItems;
}
/**
* 获取对应行class
*
* @param {*} $args row 行数据,rowIndex 行索引
* @returns {void}
* @memberof Main
*/
public getRowClassName(args:{row: any,rowIndex: number}){
let isSelected = this.selections.some((item:any)=>{
return Object.is(item.transactioncurrency,args.row.transactioncurrency);
});
return isSelected ? "grid-selected-row" : "";
}
/**
* 新建默认值
* @param {*} row 行数据
* @memberof Main
*/
public createDefault(row: any){
}
}
</script>
<style lang='less'>
@import './main-grid.less';
</style>
\ No newline at end of file
/**
* Main 部件模型
*
* @export
* @class MainModel
*/
export default class MainModel {
/**
* 是否是实体数据导出
*
* @returns {any[]}
* @memberof MainGridMode
*/
public isDEExport: boolean = false;
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof MainGridMode
*/
public getDataItems(): any[] {
if(this.isDEExport){
return [
]
}else{
return [
{
name: 'updateman',
prop: 'updateman',
dataType: 'TEXT',
},
{
name: 'updatedate',
prop: 'updatedate',
dataType: 'DATETIME',
},
{
name: 'currencyname',
prop: 'currencyname',
dataType: 'TEXT',
},
{
name: 'srfmajortext',
prop: 'currencyname',
dataType: 'TEXT',
},
{
name: 'srfdataaccaction',
prop: 'transactioncurrencyid',
dataType: 'GUID',
},
{
name: 'srfkey',
prop: 'transactioncurrencyid',
dataType: 'GUID',
},
{
name: 'transactioncurrency',
prop: 'transactioncurrencyid',
},
{
name:'size',
prop:'size'
},
{
name:'query',
prop:'query'
},
{
name:'page',
prop:'page'
},
{
name:'sort',
prop:'sort'
},
{
name:'srfparentdata',
prop:'srfparentdata'
},
// 前端新增修改标识,新增为"0",修改为"1"或未设值
{
name: 'srffrontuf',
prop: 'srffrontuf',
dataType: 'TEXT',
},
]
}
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import TransactionCurrencyService from '@/service/transaction-currency/transaction-currency-service';
import MainModel from './main-grid-model';
/**
* Main 部件服务对象
*
* @export
* @class MainService
*/
export default class MainService extends ControlService {
/**
* 货币服务对象
*
* @type {TransactionCurrencyService}
* @memberof MainService
*/
public appEntityService: TransactionCurrencyService = new TransactionCurrencyService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof MainService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of MainService.
*
* @param {*} [opts={}]
* @memberof MainService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new MainModel();
}
/**
* 处理数据
*
* @public
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof MainService
*/
public doItems(promise: Promise<any>, deKeyField: string, deName: string): Promise<any> {
return new Promise((resolve, reject) => {
promise.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
data.forEach((item:any,index:number) =>{
item[deName] = item[deKeyField];
data[index] = item;
});
resolve(data);
} else {
reject([])
}
}).catch((response: any) => {
reject([])
});
});
}
/**
* 获取跨实体数据集合
*
* @param {string} serviceName 服务名称
* @param {string} interfaceName 接口名称
* @param {*} data
* @param {boolean} [isloading]
* @returns {Promise<any[]>}
* @memberof MainService
*/
@Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
return Promise.reject([])
}
/**
* 添加数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
}else{
result =_appEntityService.Create(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 删除数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public delete(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
}else{
result =_appEntityService.Remove(Context,Data, isloading);
}
result.then((response) => {
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 修改数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Data,Context,isloading);
}else{
result =_appEntityService.Update(Data,Context,isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 获取数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public get(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Get(Context,Data, isloading);
}
result.then((response) => {
//处理返回数据,补充判断标识
if(response.data){
Object.assign(response.data,{srfuf:0});
}
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public search(action: string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
}else{
result =_appEntityService.FetchDefault(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 加载草稿
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public loadDraft(action: string, context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.GetDraft(Context,Data, isloading);
}
result.then((response) => {
//处理返回数据,补充判断标识
if(response.data){
Object.assign(response.data,{srfuf:'0'});
//仿真主键数据
response.data.transactioncurrencyid = Util.createUUID();
}
this.handleResponse(action, response, true);
this.mergeDefaults(response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 合并配置的默认值
* @param {*}
* @memberof MainService
*/
public mergeDefaults(response:any = {}){
if(response.data){
}
}
/**
* 前台逻辑
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public frontLogic(action:string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any)=>{
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
return Promise.reject({ status: 500, data: { title: '失败', message: '系统异常' } });
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
})
}
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import MainBase from './main-grid-base.vue';
@Component({
components: {
}
})
export default class Main extends MainBase {
}
</script>
\ No newline at end of file
<template>
<div class='pickupviewpanel'>
<component
v-if="inited && view.viewname && !Object.is(view.viewname, '')"
:is="view.viewname"
class="viewcontainer3"
:viewdata="viewdata"
:viewparam="viewparam"
:viewDefaultUsage="false"
:isSingleSelect="isSingleSelect"
:selectedData="selectedData"
:isShowButton="isShowButton"
@viewdataschange="onViewDatasChange"
@viewdatasactivated="viewDatasActivated"
@viewload="onViewLoad">
</component>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import TransactionCurrencyService from '@/service/transaction-currency/transaction-currency-service';
import PickupViewpickupviewpanelService from './pickup-viewpickupviewpanel-pickupviewpanel-service';
import PickupViewpickupviewpanelModel from './pickup-viewpickupviewpanel-pickupviewpanel-model';
@Component({
components: {
}
})
export default class PickupViewpickupviewpanelBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof PickupViewpickupviewpanel
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof PickupViewpickupviewpanel
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof PickupViewpickupviewpanel
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof PickupViewpickupviewpanel
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof PickupViewpickupviewpanel
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof PickupViewpickupviewpanel
*/
public getControlType(): string {
return 'PICKUPVIEWPANEL'
}
/**
* 建构部件服务对象
*
* @type {PickupViewpickupviewpanelService}
* @memberof PickupViewpickupviewpanel
*/
public service: PickupViewpickupviewpanelService = new PickupViewpickupviewpanelService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {TransactionCurrencyService}
* @memberof PickupViewpickupviewpanel
*/
public appEntityService: TransactionCurrencyService = new TransactionCurrencyService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof PickupViewpickupviewpanel
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof PickupViewpickupviewpanel
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 选中数据字符串
*
* @type {string}
* @memberof PickupViewpickupviewpanel
*/
@Prop() public selectedData?: string;
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof PickupViewpickupviewpanel
*/
public getDatas(): any[] {
return [];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof PickupViewpickupviewpanel
*/
public getData(): any {
return {};
}
/**
* 视图名称
*
* @type {*}
* @memberof PickupViewpickupviewpanel
*/
public view: any = {
viewname: 'transaction-currency-pickup-grid-view',
data: {},
}
/**
* 局部上下文
*
* @type {*}
* @memberof PickupViewpickupviewpanel
*/
public localContext: any = null;
/**
* 局部视图参数
*
* @type {*}
* @memberof PickupViewpickupviewpanel
*/
public localViewParam: any = null;
/**
* 视图数据
*
* @type {*}
* @memberof PickupViewpickupviewpanel
*/
public viewdata: string = JSON.stringify(this.context);
/**
* 视图参数
*
* @type {*}
* @memberof PickupViewpickupviewpanel
*/
public viewparam: string = JSON.stringify(this.viewparams);
/**
* 是否显示按钮
*
* @type {boolean}
* @memberof PickupViewpickupviewpanel
*/
@Prop({default: true}) public isShowButton!: boolean;
/**
* 是否单选
*
* @type {boolean}
* @memberof PickupViewpickupviewpanel
*/
@Prop() public isSingleSelect?: boolean;
/**
* 初始化完成
*
* @type {boolean}
* @memberof PickupViewpickupviewpanel
*/
public inited: boolean = false;
/**
* 视图数据变化
*
* @param {*} $event
* @memberof PickupViewpickupviewpanel
*/
public onViewDatasChange($event: any): void {
if($event.length>0){
$event.forEach((item:any,index:any) => {
let srfmajortext = item['currencyname'];
if(srfmajortext){
Object.assign($event[index],{srfmajortext: srfmajortext});
}
});
}
this.$emit('selectionchange', $event);
}
/**
* 视图数据被激活
*
* @param {*} $event
* @memberof PickupViewpickupviewpanel
*/
public viewDatasActivated($event: any): void {
this.$emit('activated', $event);
}
/**
* 视图加载完成
*
* @param {*} $event
* @memberof PickupViewpickupviewpanel
*/
public onViewLoad($event: any): void {
this.$emit('load', $event);
}
/**
* vue 生命周期
*
* @memberof PickupViewpickupviewpanel
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof PickupViewpickupviewpanel
*/
public afterCreated(){
this.initNavParam();
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
if (Object.is('load', action)) {
this.viewdata = JSON.stringify(this.context);
this.viewparam = JSON.stringify(Object.assign(data, this.viewparams));
this.inited = true;
}
});
}
}
/**
* 初始化导航参数
*
* @memberof PickupViewpickupviewpanel
*/
public initNavParam(){
if(this.localContext && Object.keys(this.localContext).length >0){
let _context:any = this.$util.computedNavData({},this.context,this.viewparams,this.localContext);
Object.assign(this.context,_context);
}
if(this.localViewParam && Object.keys(this.localViewParam).length >0){
let _param:any = this.$util.computedNavData({},this.context,this.viewparams,this.localViewParam);
Object.assign(this.viewparams,_param);
}
this.viewdata = JSON.stringify(this.context);
this.viewparam = JSON.stringify(this.viewparams);
}
/**
* vue 生命周期
*
* @memberof PickupViewpickupviewpanel
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof PickupViewpickupviewpanel
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
}
</script>
<style lang='less'>
@import './pickup-viewpickupviewpanel-pickupviewpanel.less';
</style>
\ No newline at end of file
/**
* PickupViewpickupviewpanel 部件模型
*
* @export
* @class PickupViewpickupviewpanelModel
*/
export default class PickupViewpickupviewpanelModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof PickupViewpickupviewpanelModel
*/
public getDataItems(): any[] {
return [
{
name: 'updatedate',
},
{
name: 'entityimageid',
},
{
name: 'transactioncurrency',
prop: 'transactioncurrencyid',
},
{
name: 'versionnumber',
},
{
name: 'entityimage_url',
},
{
name: 'exchangerate',
},
{
name: 'overriddencreatedon',
},
{
name: 'createdate',
},
{
name: 'uniquedscid',
},
{
name: 'statecode',
},
{
name: 'statuscode',
},
{
name: 'updateman',
},
{
name: 'currencyprecision',
},
{
name: 'currencyname',
},
{
name: 'createman',
},
{
name: 'entityimage',
},
{
name: 'isocurrencycode',
},
{
name: 'entityimage_timestamp',
},
{
name: 'currencysymbol',
},
{
name: 'importsequencenumber',
},
]
}
}
\ No newline at end of file
import { Http } from '@/utils';
import ControlService from '@/widgets/control-service';
/**
* PickupViewpickupviewpanel 部件服务对象
*
* @export
* @class PickupViewpickupviewpanelService
*/
export default class PickupViewpickupviewpanelService extends ControlService {
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import PickupViewpickupviewpanelBase from './pickup-viewpickupviewpanel-pickupviewpanel-base.vue';
@Component({
components: {
}
})
export default class PickupViewpickupviewpanel extends PickupViewpickupviewpanelBase {
}
</script>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册