提交 3591a23d 编写于 作者: ibizdev's avatar ibizdev

ibizdev提交

上级 e001be57
......@@ -15,6 +15,14 @@
"viewname": "IBZEmployeeEditView",
"viewtag": "16f9ed1179f9b3cf686cbcd796512299"
},
"ibzdepartmentoptionview": {
"title": "部门选项操作视图",
"caption": "部门",
"viewtype": "DEOPTVIEW",
"viewmodule": "ou",
"viewname": "IBZDepartmentOptionView",
"viewtag": "17f1f78c7a23f7546dbfef7f8fa9fcd0"
},
"ibzdepartmenteditview": {
"title": "部门编辑视图",
"caption": "部门",
......@@ -39,6 +47,14 @@
"viewname": "IBZOrganizationPickupGridView",
"viewtag": "4c3fc434585ac656b753c26c1f10482b"
},
"ibzemployeeoptionview": {
"title": "人员选项操作视图",
"caption": "人员",
"viewtype": "DEOPTVIEW",
"viewmodule": "ou",
"viewname": "IBZEmployeeOptionView",
"viewtag": "61a772e0bde33e5e8e9b83ea0f354271"
},
"ibzdepartmentpickupgridview": {
"title": "部门选择表格视图",
"caption": "部门",
......
......@@ -17,6 +17,10 @@ export default {
updatedate: '最后修改时间',
},
views: {
optionview: {
caption: "部门",
title: '部门',
},
editview: {
caption: "部门",
title: '部门',
......@@ -34,6 +38,29 @@ export default {
title: '部门',
},
},
newform_form: {
details: {
group1: "部门基本信息",
formpage1: "基本信息",
srfupdatedate: "最后修改时间",
srforikey: "",
srfkey: "部门标识",
srfmajortext: "部门名称",
srftempmode: "",
srfuf: "",
srfdeid: "",
srfsourcekey: "",
deptcode: "部门代码",
deptname: "部门名称",
orgname: "单位",
pdeptname: "上级部门",
pdeptid: "上级部门",
deptid: "部门标识",
orgid: "单位",
},
uiactions: {
},
},
main_form: {
details: {
formpage1: "基本信息",
......@@ -112,9 +139,13 @@ export default {
},
},
gridviewtoolbar_toolbar: {
tbitem3: {
caption: "New",
tip: "New",
tbitem1_opennewcreateview: {
caption: "新建",
tip: "新建",
},
tbitem2: {
caption: "-",
tip: "",
},
tbitem4: {
caption: "Edit",
......
......@@ -16,6 +16,10 @@ export default {
updatedate: '最后修改时间',
},
views: {
optionview: {
caption: '部门',
title: '部门',
},
editview: {
caption: '部门',
title: '部门',
......@@ -33,6 +37,29 @@ export default {
title: '部门',
},
},
newform_form: {
details: {
group1: '部门基本信息',
formpage1: '基本信息',
srfupdatedate: '最后修改时间',
srforikey: '',
srfkey: '部门标识',
srfmajortext: '部门名称',
srftempmode: '',
srfuf: '',
srfdeid: '',
srfsourcekey: '',
deptcode: '部门代码',
deptname: '部门名称',
orgname: '单位',
pdeptname: '上级部门',
pdeptid: '上级部门',
deptid: '部门标识',
orgid: '单位',
},
uiactions: {
},
},
main_form: {
details: {
formpage1: '基本信息',
......@@ -111,10 +138,14 @@ export default {
},
},
gridviewtoolbar_toolbar: {
tbitem3: {
tbitem1_opennewcreateview: {
caption: '新建',
tip: '新建',
},
tbitem2: {
caption: '-',
tip: '',
},
tbitem4: {
caption: '编辑',
tip: '编辑',
......
......@@ -45,6 +45,10 @@ export default {
},
gridview: {
caption: "人员",
title: '人员',
},
optionview: {
caption: "人员",
title: '人员',
},
changepwdview: {
......@@ -94,6 +98,30 @@ export default {
uiactions: {
},
},
newform_form: {
details: {
group1: "人员基本信息",
formpage1: "基本信息",
srfupdatedate: "最后修改时间",
srforikey: "",
srfkey: "用户标示",
srfmajortext: "姓名",
srftempmode: "",
srfuf: "",
srfdeid: "",
srfsourcekey: "",
usercode: "用户工号",
personname: "姓名",
loginname: "登录名",
orgname: "单位",
mdeptname: "部门",
orgid: "单位",
userid: "用户标示",
mdeptid: "主部门",
},
uiactions: {
},
},
changepw_form: {
details: {
group1: "密码信息",
......@@ -164,18 +192,14 @@ export default {
},
},
gridviewtoolbar_toolbar: {
tbitem1_initpwd: {
caption: "初始化密码",
tip: "初始化密码",
tbitem1_opennewcreateview: {
caption: "新建",
tip: "新建",
},
tbitem2: {
caption: "-",
tip: "",
},
tbitem3: {
caption: "New",
tip: "New",
},
tbitem4: {
caption: "Edit",
tip: "Edit {0}",
......@@ -204,6 +228,14 @@ export default {
caption: "-",
tip: "",
},
tbitem14_initpwd: {
caption: "初始化密码",
tip: "初始化密码",
},
tbitem15: {
caption: "-",
tip: "",
},
tbitem19: {
caption: "Filter",
tip: "Filter",
......
......@@ -44,6 +44,10 @@ export default {
},
gridview: {
caption: '人员',
title: '人员',
},
optionview: {
caption: '人员',
title: '人员',
},
changepwdview: {
......@@ -93,6 +97,30 @@ export default {
uiactions: {
},
},
newform_form: {
details: {
group1: '人员基本信息',
formpage1: '基本信息',
srfupdatedate: '最后修改时间',
srforikey: '',
srfkey: '用户标示',
srfmajortext: '姓名',
srftempmode: '',
srfuf: '',
srfdeid: '',
srfsourcekey: '',
usercode: '用户工号',
personname: '姓名',
loginname: '登录名',
orgname: '单位',
mdeptname: '部门',
orgid: '单位',
userid: '用户标示',
mdeptid: '主部门',
},
uiactions: {
},
},
changepw_form: {
details: {
group1: '密码信息',
......@@ -163,18 +191,14 @@ export default {
},
},
gridviewtoolbar_toolbar: {
tbitem1_initpwd: {
caption: '初始化密码',
tip: '初始化密码',
tbitem1_opennewcreateview: {
caption: '新建',
tip: '新建',
},
tbitem2: {
caption: '-',
tip: '',
},
tbitem3: {
caption: '新建',
tip: '新建',
},
tbitem4: {
caption: '编辑',
tip: '编辑',
......@@ -203,6 +227,14 @@ export default {
caption: '-',
tip: '',
},
tbitem14_initpwd: {
caption: '初始化密码',
tip: '初始化密码',
},
tbitem15: {
caption: '-',
tip: '',
},
tbitem19: {
caption: '过滤',
tip: '过滤',
......
......@@ -75,6 +75,7 @@ export default {
orgcode: "单位代码",
orgname: "名称",
porgname: "上级单位",
enable: "逻辑有效",
orgid: "单位标识",
porgid: "上级单位",
},
......@@ -138,10 +139,6 @@ export default {
caption: "-",
tip: "",
},
tbitem3: {
caption: "New",
tip: "New",
},
tbitem4: {
caption: "Edit",
tip: "Edit {0}",
......
......@@ -74,6 +74,7 @@ export default {
orgcode: '单位代码',
orgname: '名称',
porgname: '上级单位',
enable: '逻辑有效',
orgid: '单位标识',
porgid: '上级单位',
},
......@@ -137,10 +138,6 @@ export default {
caption: '-',
tip: '',
},
tbitem3: {
caption: '新建',
tip: '新建',
},
tbitem4: {
caption: '编辑',
tip: '编辑',
......
......@@ -23,6 +23,14 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "IBZEmployeeEditView",
"viewtag": "16f9ed1179f9b3cf686cbcd796512299"
},
"ibzdepartmentoptionview": {
"title": "部门选项操作视图",
"caption": "部门",
"viewtype": "DEOPTVIEW",
"viewmodule": "ou",
"viewname": "IBZDepartmentOptionView",
"viewtag": "17f1f78c7a23f7546dbfef7f8fa9fcd0"
},
"ibzdepartmenteditview": {
"title": "部门编辑视图",
"caption": "部门",
......@@ -47,6 +55,14 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "IBZOrganizationPickupGridView",
"viewtag": "4c3fc434585ac656b753c26c1f10482b"
},
"ibzemployeeoptionview": {
"title": "人员选项操作视图",
"caption": "人员",
"viewtype": "DEOPTVIEW",
"viewmodule": "ou",
"viewname": "IBZEmployeeOptionView",
"viewtag": "61a772e0bde33e5e8e9b83ea0f354271"
},
"ibzdepartmentpickupgridview": {
"title": "部门选择表格视图",
"caption": "部门",
......
......@@ -13,13 +13,13 @@
<div class='pull-right'>
<div class='toolbar-container'>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem3.visabled" :disabled="toolBarModels.tbitem3.disabled" class='' @click="toolbar_click({ tag: 'tbitem3' }, $event)">
<i class='fa fa-file-text-o'></i>
<span class='caption'>{{$t('entities.ibzdepartment.gridviewtoolbar_toolbar.tbitem3.caption')}}</span>
<i-button v-show="toolBarModels.tbitem1_opennewcreateview.visabled" :disabled="toolBarModels.tbitem1_opennewcreateview.disabled" class='' @click="toolbar_click({ tag: 'tbitem1_opennewcreateview' }, $event)">
<i class=''></i>
<span class='caption'>{{$t('entities.ibzdepartment.gridviewtoolbar_toolbar.tbitem1_opennewcreateview.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.ibzdepartment.gridviewtoolbar_toolbar.tbitem3.tip')}}</div>
<div slot='content'>{{$t('entities.ibzdepartment.gridviewtoolbar_toolbar.tbitem1_opennewcreateview.tip')}}</div>
</tooltip>
<tooltip :transfer="true" :max-width="600">
<span class='seperator'>|</span> <tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem4.visabled" :disabled="toolBarModels.tbitem4.disabled" class='' @click="toolbar_click({ tag: 'tbitem4' }, $event)">
<i class='fa fa-edit'></i>
<span class='caption'>{{$t('entities.ibzdepartment.gridviewtoolbar_toolbar.tbitem4.caption')}}</span>
......@@ -111,6 +111,7 @@ import IBZDepartmentService from '@/service/ibzdepartment/ibzdepartment-service'
import GridViewEngine from '@engine/view/grid-view-engine';
import IBZDepartmentUIService from '@/uiservice/ibzdepartment/ibzdepartment-ui-service';
@Component({
components: {
......@@ -289,8 +290,9 @@ export default class IBZDepartmentGridViewBase extends Vue {
* @memberof IBZDepartmentGridView
*/
public toolBarModels: any = {
tbitem3: { name: 'tbitem3', caption: '新建', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'New', target: '' } },
tbitem1_opennewcreateview: { name: 'tbitem1_opennewcreateview', caption: '新建', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'OpenNewCreateView', target: 'NONE' } },
tbitem2: { name: 'tbitem2', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem4: { name: 'tbitem4', caption: '编辑', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'Edit', target: 'SINGLEKEY' } },
tbitem6: { name: 'tbitem6', caption: '拷贝', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'Copy', target: 'SINGLEKEY' } },
......@@ -549,8 +551,8 @@ export default class IBZDepartmentGridViewBase extends Vue {
* @memberof IBZDepartmentGridViewBase
*/
public toolbar_click($event: any, $event2?: any) {
if (Object.is($event.tag, 'tbitem3')) {
this.toolbar_tbitem3_click($event, '', $event2);
if (Object.is($event.tag, 'tbitem1_opennewcreateview')) {
this.toolbar_tbitem1_opennewcreateview_click($event, '', $event2);
}
if (Object.is($event.tag, 'tbitem4')) {
this.toolbar_tbitem4_click($event, '', $event2);
......@@ -687,7 +689,7 @@ export default class IBZDepartmentGridViewBase extends Vue {
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem3_click(params: any = {}, tag?: any, $event?: any) {
public toolbar_tbitem1_opennewcreateview_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
......@@ -702,7 +704,8 @@ export default class IBZDepartmentGridViewBase extends Vue {
datas = [...xData.getDatas()];
}
// 界面行为
this.New(datas, contextJO,paramJO, $event, xData,this,"IBZDepartment");
const curUIService:IBZDepartmentUIService = new IBZDepartmentUIService();
curUIService.IBZDepartment_OpenNewCreateView(datas,contextJO, paramJO, $event, xData,this,"IBZDepartment");
}
/**
......@@ -1037,26 +1040,6 @@ export default class IBZDepartmentGridViewBase extends Vue {
}
/**
* 新建
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBZDepartmentGridViewBase
*/
public New(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (_this.newdata && _this.newdata instanceof Function) {
const data: any = {};
_this.newdata([{ ...data }],[{ ...data }], params, $event, xData);
} else {
_this.$Notice.error({ title: '错误', desc: 'newdata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 编辑
*
......
<template>
<div class="view-container deoptview ibzdepartment-option-view">
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="ibzdepartmentoptionview"></app-studioaction>
<card class='view-card view-no-caption view-no-toolbar' dis-hover :padding="0" :bordered="false">
<div class="content-container">
<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>
</div>
<card dis-hover :bordered="false" class='footer'>
<row style=" text-align: right ">
<i-button type='primary' @click="onClickOk">{{ containerModel.view_okbtn.text }}</i-button>
&nbsp;&nbsp;
<i-button @click="onClickCancel">{{ containerModel.view_cancelbtn.text }}</i-button>
</row>
</card>
</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 IBZDepartmentService from '@/service/ibzdepartment/ibzdepartment-service';
import OptionViewEngine from '@engine/view/option-view-engine';
@Component({
components: {
},
})
export default class IBZDepartmentOptionViewBase extends Vue {
/**
* 实体服务对象
*
* @type {IBZDepartmentService}
* @memberof IBZDepartmentOptionViewBase
*/
public appEntityService: IBZDepartmentService = new IBZDepartmentService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof IBZDepartmentOptionViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof IBZDepartmentOptionViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof IBZDepartmentOptionViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof IBZDepartmentOptionViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof IBZDepartmentOptionViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图标识
*
* @type {string}
* @memberof IBZDepartmentOptionViewBase
*/
public viewtag: string = '17f1f78c7a23f7546dbfef7f8fa9fcd0';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof IBZDepartmentOptionViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof IBZDepartmentOptionViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof IBZDepartmentOptionViewBase
*/
public model: any = {
srfCaption: 'entities.ibzdepartment.views.optionview.caption',
srfTitle: 'entities.ibzdepartment.views.optionview.title',
srfSubTitle: 'entities.ibzdepartment.views.optionview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof IBZDepartmentOptionViewBase
*/
@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 IBZDepartmentOptionViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
_this.parseViewParam();
_this.engine.load();
}
}
/**
* 容器模型
*
* @type {*}
* @memberof IBZDepartmentOptionViewBase
*/
public containerModel: any = {
view_form: { name: 'form', type: 'FORM' },
view_okbtn: { name: 'okbtn', type: 'button', text: '确定', disabled: true },
view_cancelbtn: { name: 'cancelbtn', type: 'button', text: '取消', disabled: false },
view_leftbtn: { name: 'leftbtn', type: 'button', text: '左移', disabled: true },
view_rightbtn: { name: 'rightbtn', type: 'button', text: '右移', disabled: true },
view_allleftbtn: { name: 'allleftbtn', type: 'button', text: '全部左移', disabled: true },
view_allrightbtn: { name: 'allrightbtn', type: 'button', text: '全部右移', disabled: true },
};
/**
* 计数器刷新
*
* @memberof IBZDepartmentOptionViewBase
*/
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 IBZDepartmentOptionViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof IBZDepartmentOptionViewBase
*/
public engine: OptionViewEngine = new OptionViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof IBZDepartmentOptionViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
form: this.$refs.form,
p2k: '0',
keyPSDEField: 'ibzdepartment',
majorPSDEField: 'deptname',
isLoadDefault: true,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof IBZDepartmentOptionViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof IBZDepartmentOptionViewBase
*/
public viewparams:any = {};
/**
* 解析视图参数
*
* @public
* @memberof IBZDepartmentOptionViewBase
*/
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});
}
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 IBZDepartmentOptionViewBase
*/
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 IBZDepartmentOptionViewBase
*/
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 IBZDepartmentOptionViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof IBZDepartmentOptionViewBase
*/
public afterCreated(){
const secondtag = this.$util.createUUID();
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
}
/**
* 销毁之前
*
* @memberof IBZDepartmentOptionViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof IBZDepartmentOptionViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof IBZDepartmentOptionViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* form 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBZDepartmentOptionViewBase
*/
public form_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'save', $event);
}
/**
* form 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBZDepartmentOptionViewBase
*/
public form_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'remove', $event);
}
/**
* form 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBZDepartmentOptionViewBase
*/
public form_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'load', $event);
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof IBZDepartmentOptionViewBase
*/
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 IBZDepartmentOptionViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof IBZDepartmentOptionViewBase
*/
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 IBZDepartmentOptionViewBase
*/
public onClickOk(): void {
const form: any = this.$refs.form;
if (!form) return;
form.save().then((res:any) =>{
if(res.status == 200){
this.$emit('close',[res.data]);
}
});
}
/**
* 取消
*
* @memberof IBZDepartmentOptionViewBase
*/
public onClickCancel(): void {
this.$emit('close', null);
}
}
</script>
<style lang='less'>
@import './ibzdepartment-option-view.less';
</style>
\ No newline at end of file
.ibzdepartment-option-view{
position: relative;
}
.view-container {
.view-card {
.ivu-card-body {
.content-container{
height: calc(100% - 64px);
}
}
}
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import IBZDepartmentOptionViewBase from './ibzdepartment-option-view-base.vue';
import view_form from '@widgets/ibzdepartment/new-form-form/new-form-form.vue';
@Component({
components: {
view_form,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class IBZDepartmentOptionView extends IBZDepartmentOptionViewBase {
}
</script>
\ No newline at end of file
......@@ -13,20 +13,13 @@
<div class='pull-right'>
<div class='toolbar-container'>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem1_initpwd.visabled" :disabled="toolBarModels.tbitem1_initpwd.disabled" class='' @click="toolbar_click({ tag: 'tbitem1_initpwd' }, $event)">
<i-button v-show="toolBarModels.tbitem1_opennewcreateview.visabled" :disabled="toolBarModels.tbitem1_opennewcreateview.disabled" class='' @click="toolbar_click({ tag: 'tbitem1_opennewcreateview' }, $event)">
<i class=''></i>
<span class='caption'>{{$t('entities.ibzemployee.gridviewtoolbar_toolbar.tbitem1_initpwd.caption')}}</span>
<span class='caption'>{{$t('entities.ibzemployee.gridviewtoolbar_toolbar.tbitem1_opennewcreateview.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.ibzemployee.gridviewtoolbar_toolbar.tbitem1_initpwd.tip')}}</div>
<div slot='content'>{{$t('entities.ibzemployee.gridviewtoolbar_toolbar.tbitem1_opennewcreateview.tip')}}</div>
</tooltip>
<span class='seperator'>|</span> <tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem3.visabled" :disabled="toolBarModels.tbitem3.disabled" class='' @click="toolbar_click({ tag: 'tbitem3' }, $event)">
<i class='fa fa-file-text-o'></i>
<span class='caption'>{{$t('entities.ibzemployee.gridviewtoolbar_toolbar.tbitem3.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.ibzemployee.gridviewtoolbar_toolbar.tbitem3.tip')}}</div>
</tooltip>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem4.visabled" :disabled="toolBarModels.tbitem4.disabled" class='' @click="toolbar_click({ tag: 'tbitem4' }, $event)">
<i class='fa fa-edit'></i>
<span class='caption'>{{$t('entities.ibzemployee.gridviewtoolbar_toolbar.tbitem4.caption')}}</span>
......@@ -51,6 +44,13 @@
<app-export-excel :item="toolBarModels.tbitem13" :caption="$t('entities.ibzemployee.gridviewtoolbar_toolbar.tbitem13.caption')" @exportexcel="toolbar_click({ tag: 'tbitem13' }, $event)"></app-export-excel>
<div slot='content'>{{$t('entities.ibzemployee.gridviewtoolbar_toolbar.tbitem13.tip')}}</div>
</tooltip>
<span class='seperator'>|</span> <tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem14_initpwd.visabled" :disabled="toolBarModels.tbitem14_initpwd.disabled" class='' @click="toolbar_click({ tag: 'tbitem14_initpwd' }, $event)">
<i class=''></i>
<span class='caption'>{{$t('entities.ibzemployee.gridviewtoolbar_toolbar.tbitem14_initpwd.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.ibzemployee.gridviewtoolbar_toolbar.tbitem14_initpwd.tip')}}</div>
</tooltip>
<span class='seperator'>|</span> <tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem19.visabled" :disabled="toolBarModels.tbitem19.disabled" class='' @click="toolbar_click({ tag: 'tbitem19' }, $event)">
<i class='fa fa-filter'></i>
......@@ -297,11 +297,9 @@ export default class IBZEmployeeGridViewBase extends Vue {
* @memberof IBZEmployeeGridView
*/
public toolBarModels: any = {
tbitem1_initpwd: { name: 'tbitem1_initpwd', caption: '初始化密码', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'InitPwd', target: 'MULTIKEY' } },
tbitem1_opennewcreateview: { name: 'tbitem1_opennewcreateview', caption: '新建', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'OpenNewCreateView', target: 'NONE' } },
tbitem2: { name: 'tbitem2', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem3: { name: 'tbitem3', caption: '新建', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'New', target: '' } },
tbitem4: { name: 'tbitem4', caption: '编辑', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'Edit', target: 'SINGLEKEY' } },
tbitem6: { name: 'tbitem6', caption: '拷贝', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'Copy', target: 'SINGLEKEY' } },
......@@ -313,6 +311,9 @@ export default class IBZEmployeeGridViewBase extends Vue {
tbitem13: { name: 'tbitem13', caption: '导出', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'ExportExcel', target: '' }, MaxRowCount: 1000 },
tbitem10: { name: 'tbitem10', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem14_initpwd: { name: 'tbitem14_initpwd', caption: '初始化密码', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'InitPwd', target: 'MULTIKEY' } },
tbitem15: { name: 'tbitem15', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem19: { name: 'tbitem19', caption: '过滤', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'ToggleFilter', target: '' } },
};
......@@ -560,11 +561,8 @@ export default class IBZEmployeeGridViewBase extends Vue {
* @memberof IBZEmployeeGridViewBase
*/
public toolbar_click($event: any, $event2?: any) {
if (Object.is($event.tag, 'tbitem1_initpwd')) {
this.toolbar_tbitem1_initpwd_click($event, '', $event2);
}
if (Object.is($event.tag, 'tbitem3')) {
this.toolbar_tbitem3_click($event, '', $event2);
if (Object.is($event.tag, 'tbitem1_opennewcreateview')) {
this.toolbar_tbitem1_opennewcreateview_click($event, '', $event2);
}
if (Object.is($event.tag, 'tbitem4')) {
this.toolbar_tbitem4_click($event, '', $event2);
......@@ -590,6 +588,9 @@ export default class IBZEmployeeGridViewBase extends Vue {
if (Object.is($event.tag, 'tbitem11')) {
this.toolbar_tbitem11_click($event, '', $event2);
}
if (Object.is($event.tag, 'tbitem14_initpwd')) {
this.toolbar_tbitem14_initpwd_click($event, '', $event2);
}
if (Object.is($event.tag, 'tbitem19')) {
this.toolbar_tbitem19_click($event, '', $event2);
}
......@@ -701,7 +702,7 @@ export default class IBZEmployeeGridViewBase extends Vue {
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem1_initpwd_click(params: any = {}, tag?: any, $event?: any) {
public toolbar_tbitem1_opennewcreateview_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
......@@ -717,7 +718,7 @@ export default class IBZEmployeeGridViewBase extends Vue {
}
// 界面行为
const curUIService:IBZEmployeeUIService = new IBZEmployeeUIService();
curUIService.IBZEmployee_InitPwd(datas,contextJO, paramJO, $event, xData,this,"IBZEmployee");
curUIService.IBZEmployee_OpenNewCreateView(datas,contextJO, paramJO, $event, xData,this,"IBZEmployee");
}
/**
......@@ -728,7 +729,7 @@ export default class IBZEmployeeGridViewBase extends Vue {
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem3_click(params: any = {}, tag?: any, $event?: any) {
public toolbar_tbitem4_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
......@@ -743,7 +744,7 @@ export default class IBZEmployeeGridViewBase extends Vue {
datas = [...xData.getDatas()];
}
// 界面行为
this.New(datas, contextJO,paramJO, $event, xData,this,"IBZEmployee");
this.Edit(datas, contextJO,paramJO, $event, xData,this,"IBZEmployee");
}
/**
......@@ -754,7 +755,7 @@ export default class IBZEmployeeGridViewBase extends Vue {
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem4_click(params: any = {}, tag?: any, $event?: any) {
public toolbar_tbitem5_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
......@@ -769,7 +770,7 @@ export default class IBZEmployeeGridViewBase extends Vue {
datas = [...xData.getDatas()];
}
// 界面行为
this.Edit(datas, contextJO,paramJO, $event, xData,this,"IBZEmployee");
this.View(datas, contextJO,paramJO, $event, xData,this,"IBZEmployee");
}
/**
......@@ -780,7 +781,7 @@ export default class IBZEmployeeGridViewBase extends Vue {
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem5_click(params: any = {}, tag?: any, $event?: any) {
public toolbar_tbitem6_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
......@@ -795,7 +796,7 @@ export default class IBZEmployeeGridViewBase extends Vue {
datas = [...xData.getDatas()];
}
// 界面行为
this.View(datas, contextJO,paramJO, $event, xData,this,"IBZEmployee");
this.Copy(datas, contextJO,paramJO, $event, xData,this,"IBZEmployee");
}
/**
......@@ -806,7 +807,7 @@ export default class IBZEmployeeGridViewBase extends Vue {
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem6_click(params: any = {}, tag?: any, $event?: any) {
public toolbar_tbitem24_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
......@@ -821,7 +822,7 @@ export default class IBZEmployeeGridViewBase extends Vue {
datas = [...xData.getDatas()];
}
// 界面行为
this.Copy(datas, contextJO,paramJO, $event, xData,this,"IBZEmployee");
this.ToggleRowEdit(datas, contextJO,paramJO, $event, xData,this,"IBZEmployee");
}
/**
......@@ -832,7 +833,7 @@ export default class IBZEmployeeGridViewBase extends Vue {
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem24_click(params: any = {}, tag?: any, $event?: any) {
public toolbar_tbitem25_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
......@@ -847,7 +848,7 @@ export default class IBZEmployeeGridViewBase extends Vue {
datas = [...xData.getDatas()];
}
// 界面行为
this.ToggleRowEdit(datas, contextJO,paramJO, $event, xData,this,"IBZEmployee");
this.NewRow(datas, contextJO,paramJO, $event, xData,this,"IBZEmployee");
}
/**
......@@ -858,7 +859,7 @@ export default class IBZEmployeeGridViewBase extends Vue {
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem25_click(params: any = {}, tag?: any, $event?: any) {
public toolbar_tbitem8_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
......@@ -873,7 +874,7 @@ export default class IBZEmployeeGridViewBase extends Vue {
datas = [...xData.getDatas()];
}
// 界面行为
this.NewRow(datas, contextJO,paramJO, $event, xData,this,"IBZEmployee");
this.Remove(datas, contextJO,paramJO, $event, xData,this,"IBZEmployee");
}
/**
......@@ -884,7 +885,7 @@ export default class IBZEmployeeGridViewBase extends Vue {
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem8_click(params: any = {}, tag?: any, $event?: any) {
public toolbar_tbitem13_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
......@@ -899,7 +900,7 @@ export default class IBZEmployeeGridViewBase extends Vue {
datas = [...xData.getDatas()];
}
// 界面行为
this.Remove(datas, contextJO,paramJO, $event, xData,this,"IBZEmployee");
this.ExportExcel(datas, contextJO,paramJO, $event, xData,this,"IBZEmployee");
}
/**
......@@ -910,7 +911,7 @@ export default class IBZEmployeeGridViewBase extends Vue {
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem13_click(params: any = {}, tag?: any, $event?: any) {
public toolbar_tbitem11_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
......@@ -925,7 +926,7 @@ export default class IBZEmployeeGridViewBase extends Vue {
datas = [...xData.getDatas()];
}
// 界面行为
this.ExportExcel(datas, contextJO,paramJO, $event, xData,this,"IBZEmployee");
this.Print(datas, contextJO,paramJO, $event, xData,this,"IBZEmployee");
}
/**
......@@ -936,7 +937,7 @@ export default class IBZEmployeeGridViewBase extends Vue {
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem11_click(params: any = {}, tag?: any, $event?: any) {
public toolbar_tbitem14_initpwd_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
......@@ -951,7 +952,8 @@ export default class IBZEmployeeGridViewBase extends Vue {
datas = [...xData.getDatas()];
}
// 界面行为
this.Print(datas, contextJO,paramJO, $event, xData,this,"IBZEmployee");
const curUIService:IBZEmployeeUIService = new IBZEmployeeUIService();
curUIService.IBZEmployee_InitPwd(datas,contextJO, paramJO, $event, xData,this,"IBZEmployee");
}
/**
......@@ -1078,26 +1080,6 @@ export default class IBZEmployeeGridViewBase extends Vue {
}
/**
* 新建
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBZEmployeeGridViewBase
*/
public New(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (_this.newdata && _this.newdata instanceof Function) {
const data: any = {};
_this.newdata([{ ...data }],[{ ...data }], params, $event, xData);
} else {
_this.$Notice.error({ title: '错误', desc: 'newdata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 编辑
*
......
<template>
<div class="view-container deoptview ibzemployee-option-view">
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="ibzemployeeoptionview"></app-studioaction>
<card class='view-card view-no-caption view-no-toolbar' dis-hover :padding="0" :bordered="false">
<div class="content-container">
<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>
</div>
<card dis-hover :bordered="false" class='footer'>
<row style=" text-align: right ">
<i-button type='primary' @click="onClickOk">{{ containerModel.view_okbtn.text }}</i-button>
&nbsp;&nbsp;
<i-button @click="onClickCancel">{{ containerModel.view_cancelbtn.text }}</i-button>
</row>
</card>
</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 IBZEmployeeService from '@/service/ibzemployee/ibzemployee-service';
import OptionViewEngine from '@engine/view/option-view-engine';
@Component({
components: {
},
})
export default class IBZEmployeeOptionViewBase extends Vue {
/**
* 实体服务对象
*
* @type {IBZEmployeeService}
* @memberof IBZEmployeeOptionViewBase
*/
public appEntityService: IBZEmployeeService = new IBZEmployeeService;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof IBZEmployeeOptionViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof IBZEmployeeOptionViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof IBZEmployeeOptionViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof IBZEmployeeOptionViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof IBZEmployeeOptionViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图标识
*
* @type {string}
* @memberof IBZEmployeeOptionViewBase
*/
public viewtag: string = '61a772e0bde33e5e8e9b83ea0f354271';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof IBZEmployeeOptionViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof IBZEmployeeOptionViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof IBZEmployeeOptionViewBase
*/
public model: any = {
srfCaption: 'entities.ibzemployee.views.optionview.caption',
srfTitle: 'entities.ibzemployee.views.optionview.title',
srfSubTitle: 'entities.ibzemployee.views.optionview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof IBZEmployeeOptionViewBase
*/
@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 IBZEmployeeOptionViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
_this.parseViewParam();
_this.engine.load();
}
}
/**
* 容器模型
*
* @type {*}
* @memberof IBZEmployeeOptionViewBase
*/
public containerModel: any = {
view_form: { name: 'form', type: 'FORM' },
view_okbtn: { name: 'okbtn', type: 'button', text: '确定', disabled: true },
view_cancelbtn: { name: 'cancelbtn', type: 'button', text: '取消', disabled: false },
view_leftbtn: { name: 'leftbtn', type: 'button', text: '左移', disabled: true },
view_rightbtn: { name: 'rightbtn', type: 'button', text: '右移', disabled: true },
view_allleftbtn: { name: 'allleftbtn', type: 'button', text: '全部左移', disabled: true },
view_allrightbtn: { name: 'allrightbtn', type: 'button', text: '全部右移', disabled: true },
};
/**
* 计数器刷新
*
* @memberof IBZEmployeeOptionViewBase
*/
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 IBZEmployeeOptionViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof IBZEmployeeOptionViewBase
*/
public engine: OptionViewEngine = new OptionViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof IBZEmployeeOptionViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
form: this.$refs.form,
p2k: '0',
keyPSDEField: 'ibzemployee',
majorPSDEField: 'personname',
isLoadDefault: true,
});
}
/**
* 应用上下文
*
* @type {*}
* @memberof IBZEmployeeOptionViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof IBZEmployeeOptionViewBase
*/
public viewparams:any = {};
/**
* 解析视图参数
*
* @public
* @memberof IBZEmployeeOptionViewBase
*/
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});
}
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 IBZEmployeeOptionViewBase
*/
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 IBZEmployeeOptionViewBase
*/
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 IBZEmployeeOptionViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof IBZEmployeeOptionViewBase
*/
public afterCreated(){
const secondtag = this.$util.createUUID();
this.$store.commit('viewaction/createdView', { viewtag: this.viewtag, secondtag: secondtag });
this.viewtag = secondtag;
this.parseViewParam();
}
/**
* 销毁之前
*
* @memberof IBZEmployeeOptionViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof IBZEmployeeOptionViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof IBZEmployeeOptionViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* form 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBZEmployeeOptionViewBase
*/
public form_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'save', $event);
}
/**
* form 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBZEmployeeOptionViewBase
*/
public form_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'remove', $event);
}
/**
* form 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBZEmployeeOptionViewBase
*/
public form_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('form', 'load', $event);
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof IBZEmployeeOptionViewBase
*/
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 IBZEmployeeOptionViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof IBZEmployeeOptionViewBase
*/
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 IBZEmployeeOptionViewBase
*/
public onClickOk(): void {
const form: any = this.$refs.form;
if (!form) return;
form.save().then((res:any) =>{
if(res.status == 200){
this.$emit('close',[res.data]);
}
});
}
/**
* 取消
*
* @memberof IBZEmployeeOptionViewBase
*/
public onClickCancel(): void {
this.$emit('close', null);
}
}
</script>
<style lang='less'>
@import './ibzemployee-option-view.less';
</style>
\ No newline at end of file
.ibzemployee-option-view{
position: relative;
}
.view-container {
.view-card {
.ivu-card-body {
.content-container{
height: calc(100% - 64px);
}
}
}
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import IBZEmployeeOptionViewBase from './ibzemployee-option-view-base.vue';
import view_form from '@widgets/ibzemployee/new-form-form/new-form-form.vue';
@Component({
components: {
view_form,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class IBZEmployeeOptionView extends IBZEmployeeOptionViewBase {
}
</script>
\ No newline at end of file
......@@ -20,13 +20,6 @@
<div slot='content'>{{$t('entities.ibzorganization.gridviewtoolbar_toolbar.tbitem1_opennewcreateview.tip')}}</div>
</tooltip>
<span class='seperator'>|</span> <tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem3.visabled" :disabled="toolBarModels.tbitem3.disabled" class='' @click="toolbar_click({ tag: 'tbitem3' }, $event)">
<i class='fa fa-file-text-o'></i>
<span class='caption'>{{$t('entities.ibzorganization.gridviewtoolbar_toolbar.tbitem3.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.ibzorganization.gridviewtoolbar_toolbar.tbitem3.tip')}}</div>
</tooltip>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem4.visabled" :disabled="toolBarModels.tbitem4.disabled" class='' @click="toolbar_click({ tag: 'tbitem4' }, $event)">
<i class='fa fa-edit'></i>
<span class='caption'>{{$t('entities.ibzorganization.gridviewtoolbar_toolbar.tbitem4.caption')}}</span>
......@@ -300,8 +293,6 @@ export default class IBZOrganizationGridViewBase extends Vue {
tbitem1_opennewcreateview: { name: 'tbitem1_opennewcreateview', caption: '新建', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'OpenNewCreateView', target: 'NONE' } },
tbitem2: { name: 'tbitem2', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem3: { name: 'tbitem3', caption: '新建', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'New', target: '' } },
tbitem4: { name: 'tbitem4', caption: '编辑', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'Edit', target: 'SINGLEKEY' } },
tbitem6: { name: 'tbitem6', caption: '拷贝', disabled: false, type: 'DEUIACTION', visabled: true, dataaccaction: '', uiaction: { tag: 'Copy', target: 'SINGLEKEY' } },
......@@ -563,9 +554,6 @@ export default class IBZOrganizationGridViewBase extends Vue {
if (Object.is($event.tag, 'tbitem1_opennewcreateview')) {
this.toolbar_tbitem1_opennewcreateview_click($event, '', $event2);
}
if (Object.is($event.tag, 'tbitem3')) {
this.toolbar_tbitem3_click($event, '', $event2);
}
if (Object.is($event.tag, 'tbitem4')) {
this.toolbar_tbitem4_click($event, '', $event2);
}
......@@ -720,32 +708,6 @@ export default class IBZOrganizationGridViewBase extends Vue {
curUIService.IBZOrganization_OpenNewCreateView(datas,contextJO, paramJO, $event, xData,this,"IBZOrganization");
}
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem3_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.grid;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
// 界面行为
this.New(datas, contextJO,paramJO, $event, xData,this,"IBZOrganization");
}
/**
* 逻辑事件
*
......@@ -1068,26 +1030,6 @@ export default class IBZOrganizationGridViewBase extends Vue {
}
/**
* 新建
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @memberof IBZOrganizationGridViewBase
*/
public New(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this;
if (_this.newdata && _this.newdata instanceof Function) {
const data: any = {};
_this.newdata([{ ...data }],[{ ...data }], params, $event, xData);
} else {
_this.$Notice.error({ title: '错误', desc: 'newdata 视图处理逻辑不存在,请添加!' });
}
}
/**
* 编辑
*
......
export const PageComponents = {
install(Vue: any, opt: any) {
Vue.component('ibzdepartment-option-view', () => import('@pages/ou/ibzdepartment-option-view/ibzdepartment-option-view.vue'));
Vue.component('ibzemployee-edit-view', () => import('@pages/ou/ibzemployee-edit-view/ibzemployee-edit-view.vue'));
Vue.component('ibzdepartment-pickup-grid-view', () => import('@pages/ou/ibzdepartment-pickup-grid-view/ibzdepartment-pickup-grid-view.vue'));
Vue.component('ibzorganization-edit-view', () => import('@pages/ou/ibzorganization-edit-view/ibzorganization-edit-view.vue'));
Vue.component('ibzdepartment-edit-view', () => import('@pages/ou/ibzdepartment-edit-view/ibzdepartment-edit-view.vue'));
Vue.component('ibzorganization-pickup-view', () => import('@pages/ou/ibzorganization-pickup-view/ibzorganization-pickup-view.vue'));
Vue.component('ibzorganization-option-view', () => import('@pages/ou/ibzorganization-option-view/ibzorganization-option-view.vue'));
Vue.component('ibzemployee-grid-view', () => import('@pages/ou/ibzemployee-grid-view/ibzemployee-grid-view.vue'));
Vue.component('ibzorganization-option-view', () => import('@pages/ou/ibzorganization-option-view/ibzorganization-option-view.vue'));
Vue.component('ibzorganization-pickup-grid-view', () => import('@pages/ou/ibzorganization-pickup-grid-view/ibzorganization-pickup-grid-view.vue'));
Vue.component('ibzdepartment-grid-view', () => import('@pages/ou/ibzdepartment-grid-view/ibzdepartment-grid-view.vue'));
Vue.component('ibzdepartment-pickup-view', () => import('@pages/ou/ibzdepartment-pickup-view/ibzdepartment-pickup-view.vue'));
Vue.component('ibzorganization-grid-view', () => import('@pages/ou/ibzorganization-grid-view/ibzorganization-grid-view.vue'));
Vue.component('ibzorganization-edit-view', () => import('@pages/ou/ibzorganization-edit-view/ibzorganization-edit-view.vue'));
Vue.component('ibzdepartment-edit-view', () => import('@pages/ou/ibzdepartment-edit-view/ibzdepartment-edit-view.vue'));
Vue.component('ibzorganization-pickup-view', () => import('@pages/ou/ibzorganization-pickup-view/ibzorganization-pickup-view.vue'));
Vue.component('ibzemployee-option-view', () => import('@pages/ou/ibzemployee-option-view/ibzemployee-option-view.vue'));
Vue.component('ibzdepartment-pickup-view', () => import('@pages/ou/ibzdepartment-pickup-view/ibzdepartment-pickup-view.vue'));
}
};
\ No newline at end of file
......@@ -34,6 +34,33 @@ const router = new Router({
},
component: () => import('@pages/ou/ouindex-view/ouindex-view.vue'),
children: [
{
path: 'ibzorganizations/:ibzorganization?/ibzdepartments/:ibzdepartment?/optionview/:optionview?',
meta: {
caption: 'entities.ibzdepartment.views.optionview.caption',
parameters: [
{ pathName: 'ouindexview', parameterName: 'ouindexview' },
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
{ pathName: 'optionview', parameterName: 'optionview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzdepartment-option-view/ibzdepartment-option-view.vue'),
},
{
path: 'ibzdepartments/:ibzdepartment?/optionview/:optionview?',
meta: {
caption: 'entities.ibzdepartment.views.optionview.caption',
parameters: [
{ pathName: 'ouindexview', parameterName: 'ouindexview' },
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
{ pathName: 'optionview', parameterName: 'optionview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzdepartment-option-view/ibzdepartment-option-view.vue'),
},
{
path: 'ibzorganizations/:ibzorganization?/ibzdepartments/:ibzdepartment?/ibzemployees/:ibzemployee?/editview/:editview?',
meta: {
......@@ -118,57 +145,60 @@ const router = new Router({
component: () => import('@pages/ou/ibzdepartment-pickup-grid-view/ibzdepartment-pickup-grid-view.vue'),
},
{
path: 'ibzorganizations/:ibzorganization?/editview/:editview?',
path: 'ibzorganizations/:ibzorganization?/ibzdepartments/:ibzdepartment?/ibzemployees/:ibzemployee?/gridview/:gridview?',
meta: {
caption: 'entities.ibzorganization.views.editview.caption',
caption: 'entities.ibzemployee.views.gridview.caption',
parameters: [
{ pathName: 'ouindexview', parameterName: 'ouindexview' },
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
{ pathName: 'editview', parameterName: 'editview' },
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
{ pathName: 'ibzemployees', parameterName: 'ibzemployee' },
{ pathName: 'gridview', parameterName: 'gridview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzorganization-edit-view/ibzorganization-edit-view.vue'),
component: () => import('@pages/ou/ibzemployee-grid-view/ibzemployee-grid-view.vue'),
},
{
path: 'ibzorganizations/:ibzorganization?/ibzdepartments/:ibzdepartment?/editview/:editview?',
path: 'ibzorganizations/:ibzorganization?/ibzemployees/:ibzemployee?/gridview/:gridview?',
meta: {
caption: 'entities.ibzdepartment.views.editview.caption',
caption: 'entities.ibzemployee.views.gridview.caption',
parameters: [
{ pathName: 'ouindexview', parameterName: 'ouindexview' },
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
{ pathName: 'editview', parameterName: 'editview' },
{ pathName: 'ibzemployees', parameterName: 'ibzemployee' },
{ pathName: 'gridview', parameterName: 'gridview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzdepartment-edit-view/ibzdepartment-edit-view.vue'),
component: () => import('@pages/ou/ibzemployee-grid-view/ibzemployee-grid-view.vue'),
},
{
path: 'ibzdepartments/:ibzdepartment?/editview/:editview?',
path: 'ibzdepartments/:ibzdepartment?/ibzemployees/:ibzemployee?/gridview/:gridview?',
meta: {
caption: 'entities.ibzdepartment.views.editview.caption',
caption: 'entities.ibzemployee.views.gridview.caption',
parameters: [
{ pathName: 'ouindexview', parameterName: 'ouindexview' },
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
{ pathName: 'editview', parameterName: 'editview' },
{ pathName: 'ibzemployees', parameterName: 'ibzemployee' },
{ pathName: 'gridview', parameterName: 'gridview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzdepartment-edit-view/ibzdepartment-edit-view.vue'),
component: () => import('@pages/ou/ibzemployee-grid-view/ibzemployee-grid-view.vue'),
},
{
path: 'ibzorganizations/:ibzorganization?/pickupview/:pickupview?',
path: 'ibzemployees/:ibzemployee?/gridview/:gridview?',
meta: {
caption: 'entities.ibzorganization.views.pickupview.caption',
caption: 'entities.ibzemployee.views.gridview.caption',
parameters: [
{ pathName: 'ouindexview', parameterName: 'ouindexview' },
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
{ pathName: 'pickupview', parameterName: 'pickupview' },
{ pathName: 'ibzemployees', parameterName: 'ibzemployee' },
{ pathName: 'gridview', parameterName: 'gridview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzorganization-pickup-view/ibzorganization-pickup-view.vue'),
component: () => import('@pages/ou/ibzemployee-grid-view/ibzemployee-grid-view.vue'),
},
{
path: 'ibzorganizations/:ibzorganization?/optionview/:optionview?',
......@@ -184,121 +214,174 @@ const router = new Router({
component: () => import('@pages/ou/ibzorganization-option-view/ibzorganization-option-view.vue'),
},
{
path: 'ibzorganizations/:ibzorganization?/ibzdepartments/:ibzdepartment?/ibzemployees/:ibzemployee?/gridview/:gridview?',
path: 'ibzorganizations/:ibzorganization?/pickupgridview/:pickupgridview?',
meta: {
caption: 'entities.ibzemployee.views.gridview.caption',
caption: 'entities.ibzorganization.views.pickupgridview.caption',
parameters: [
{ pathName: 'ouindexview', parameterName: 'ouindexview' },
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
{ pathName: 'ibzemployees', parameterName: 'ibzemployee' },
{ pathName: 'gridview', parameterName: 'gridview' },
{ pathName: 'pickupgridview', parameterName: 'pickupgridview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzemployee-grid-view/ibzemployee-grid-view.vue'),
component: () => import('@pages/ou/ibzorganization-pickup-grid-view/ibzorganization-pickup-grid-view.vue'),
},
{
path: 'ibzorganizations/:ibzorganization?/ibzemployees/:ibzemployee?/gridview/:gridview?',
path: 'ibzorganizations/:ibzorganization?/ibzdepartments/:ibzdepartment?/gridview/:gridview?',
meta: {
caption: 'entities.ibzemployee.views.gridview.caption',
caption: 'entities.ibzdepartment.views.gridview.caption',
parameters: [
{ pathName: 'ouindexview', parameterName: 'ouindexview' },
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
{ pathName: 'ibzemployees', parameterName: 'ibzemployee' },
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
{ pathName: 'gridview', parameterName: 'gridview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzemployee-grid-view/ibzemployee-grid-view.vue'),
component: () => import('@pages/ou/ibzdepartment-grid-view/ibzdepartment-grid-view.vue'),
},
{
path: 'ibzdepartments/:ibzdepartment?/ibzemployees/:ibzemployee?/gridview/:gridview?',
path: 'ibzdepartments/:ibzdepartment?/gridview/:gridview?',
meta: {
caption: 'entities.ibzemployee.views.gridview.caption',
caption: 'entities.ibzdepartment.views.gridview.caption',
parameters: [
{ pathName: 'ouindexview', parameterName: 'ouindexview' },
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
{ pathName: 'ibzemployees', parameterName: 'ibzemployee' },
{ pathName: 'gridview', parameterName: 'gridview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzemployee-grid-view/ibzemployee-grid-view.vue'),
component: () => import('@pages/ou/ibzdepartment-grid-view/ibzdepartment-grid-view.vue'),
},
{
path: 'ibzemployees/:ibzemployee?/gridview/:gridview?',
path: 'ibzorganizations/:ibzorganization?/gridview/:gridview?',
meta: {
caption: 'entities.ibzemployee.views.gridview.caption',
caption: 'entities.ibzorganization.views.gridview.caption',
parameters: [
{ pathName: 'ouindexview', parameterName: 'ouindexview' },
{ pathName: 'ibzemployees', parameterName: 'ibzemployee' },
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
{ pathName: 'gridview', parameterName: 'gridview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzemployee-grid-view/ibzemployee-grid-view.vue'),
component: () => import('@pages/ou/ibzorganization-grid-view/ibzorganization-grid-view.vue'),
},
{
path: 'ibzorganizations/:ibzorganization?/pickupgridview/:pickupgridview?',
path: 'ibzorganizations/:ibzorganization?/editview/:editview?',
meta: {
caption: 'entities.ibzorganization.views.pickupgridview.caption',
caption: 'entities.ibzorganization.views.editview.caption',
parameters: [
{ pathName: 'ouindexview', parameterName: 'ouindexview' },
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
{ pathName: 'pickupgridview', parameterName: 'pickupgridview' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzorganization-pickup-grid-view/ibzorganization-pickup-grid-view.vue'),
component: () => import('@pages/ou/ibzorganization-edit-view/ibzorganization-edit-view.vue'),
},
{
path: 'ibzorganizations/:ibzorganization?/ibzdepartments/:ibzdepartment?/gridview/:gridview?',
path: 'ibzorganizations/:ibzorganization?/ibzdepartments/:ibzdepartment?/editview/:editview?',
meta: {
caption: 'entities.ibzdepartment.views.gridview.caption',
caption: 'entities.ibzdepartment.views.editview.caption',
parameters: [
{ pathName: 'ouindexview', parameterName: 'ouindexview' },
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
{ pathName: 'gridview', parameterName: 'gridview' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzdepartment-grid-view/ibzdepartment-grid-view.vue'),
component: () => import('@pages/ou/ibzdepartment-edit-view/ibzdepartment-edit-view.vue'),
},
{
path: 'ibzdepartments/:ibzdepartment?/gridview/:gridview?',
path: 'ibzdepartments/:ibzdepartment?/editview/:editview?',
meta: {
caption: 'entities.ibzdepartment.views.gridview.caption',
caption: 'entities.ibzdepartment.views.editview.caption',
parameters: [
{ pathName: 'ouindexview', parameterName: 'ouindexview' },
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
{ pathName: 'gridview', parameterName: 'gridview' },
{ pathName: 'editview', parameterName: 'editview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzdepartment-grid-view/ibzdepartment-grid-view.vue'),
component: () => import('@pages/ou/ibzdepartment-edit-view/ibzdepartment-edit-view.vue'),
},
{
path: 'ibzorganizations/:ibzorganization?/ibzdepartments/:ibzdepartment?/pickupview/:pickupview?',
path: 'ibzorganizations/:ibzorganization?/pickupview/:pickupview?',
meta: {
caption: 'entities.ibzdepartment.views.pickupview.caption',
caption: 'entities.ibzorganization.views.pickupview.caption',
parameters: [
{ pathName: 'ouindexview', parameterName: 'ouindexview' },
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
{ pathName: 'pickupview', parameterName: 'pickupview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzdepartment-pickup-view/ibzdepartment-pickup-view.vue'),
component: () => import('@pages/ou/ibzorganization-pickup-view/ibzorganization-pickup-view.vue'),
},
{
path: 'ibzdepartments/:ibzdepartment?/pickupview/:pickupview?',
path: 'ibzorganizations/:ibzorganization?/ibzdepartments/:ibzdepartment?/ibzemployees/:ibzemployee?/optionview/:optionview?',
meta: {
caption: 'entities.ibzemployee.views.optionview.caption',
parameters: [
{ pathName: 'ouindexview', parameterName: 'ouindexview' },
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
{ pathName: 'ibzemployees', parameterName: 'ibzemployee' },
{ pathName: 'optionview', parameterName: 'optionview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzemployee-option-view/ibzemployee-option-view.vue'),
},
{
path: 'ibzorganizations/:ibzorganization?/ibzemployees/:ibzemployee?/optionview/:optionview?',
meta: {
caption: 'entities.ibzemployee.views.optionview.caption',
parameters: [
{ pathName: 'ouindexview', parameterName: 'ouindexview' },
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
{ pathName: 'ibzemployees', parameterName: 'ibzemployee' },
{ pathName: 'optionview', parameterName: 'optionview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzemployee-option-view/ibzemployee-option-view.vue'),
},
{
path: 'ibzdepartments/:ibzdepartment?/ibzemployees/:ibzemployee?/optionview/:optionview?',
meta: {
caption: 'entities.ibzemployee.views.optionview.caption',
parameters: [
{ pathName: 'ouindexview', parameterName: 'ouindexview' },
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
{ pathName: 'ibzemployees', parameterName: 'ibzemployee' },
{ pathName: 'optionview', parameterName: 'optionview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzemployee-option-view/ibzemployee-option-view.vue'),
},
{
path: 'ibzemployees/:ibzemployee?/optionview/:optionview?',
meta: {
caption: 'entities.ibzemployee.views.optionview.caption',
parameters: [
{ pathName: 'ouindexview', parameterName: 'ouindexview' },
{ pathName: 'ibzemployees', parameterName: 'ibzemployee' },
{ pathName: 'optionview', parameterName: 'optionview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzemployee-option-view/ibzemployee-option-view.vue'),
},
{
path: 'ibzorganizations/:ibzorganization?/ibzdepartments/:ibzdepartment?/pickupview/:pickupview?',
meta: {
caption: 'entities.ibzdepartment.views.pickupview.caption',
parameters: [
{ pathName: 'ouindexview', parameterName: 'ouindexview' },
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
{ pathName: 'pickupview', parameterName: 'pickupview' },
],
......@@ -307,17 +390,17 @@ const router = new Router({
component: () => import('@pages/ou/ibzdepartment-pickup-view/ibzdepartment-pickup-view.vue'),
},
{
path: 'ibzorganizations/:ibzorganization?/gridview/:gridview?',
path: 'ibzdepartments/:ibzdepartment?/pickupview/:pickupview?',
meta: {
caption: 'entities.ibzorganization.views.gridview.caption',
caption: 'entities.ibzdepartment.views.pickupview.caption',
parameters: [
{ pathName: 'ouindexview', parameterName: 'ouindexview' },
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
{ pathName: 'gridview', parameterName: 'gridview' },
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
{ pathName: 'pickupview', parameterName: 'pickupview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzorganization-grid-view/ibzorganization-grid-view.vue'),
component: () => import('@pages/ou/ibzdepartment-pickup-view/ibzdepartment-pickup-view.vue'),
},
...indexRoutes,
],
......@@ -386,6 +469,31 @@ const router = new Router({
},
component: () => import('@pages/ou/ibzemployee-edit-view/ibzemployee-edit-view.vue'),
},
{
path: '/ibzorganizations/:ibzorganization?/ibzdepartments/:ibzdepartment?/optionview/:optionview?',
meta: {
caption: 'entities.ibzdepartment.views.optionview.caption',
parameters: [
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
{ pathName: 'optionview', parameterName: 'optionview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzdepartment-option-view/ibzdepartment-option-view.vue'),
},
{
path: '/ibzdepartments/:ibzdepartment?/optionview/:optionview?',
meta: {
caption: 'entities.ibzdepartment.views.optionview.caption',
parameters: [
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
{ pathName: 'optionview', parameterName: 'optionview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzdepartment-option-view/ibzdepartment-option-view.vue'),
},
{
path: '/ibzorganizations/:ibzorganization?/ibzdepartments/:ibzdepartment?/editview/:editview?',
meta: {
......@@ -475,6 +583,58 @@ const router = new Router({
},
component: () => import('@pages/ou/ibzorganization-pickup-grid-view/ibzorganization-pickup-grid-view.vue'),
},
{
path: '/ibzorganizations/:ibzorganization?/ibzdepartments/:ibzdepartment?/ibzemployees/:ibzemployee?/optionview/:optionview?',
meta: {
caption: 'entities.ibzemployee.views.optionview.caption',
parameters: [
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
{ pathName: 'ibzemployees', parameterName: 'ibzemployee' },
{ pathName: 'optionview', parameterName: 'optionview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzemployee-option-view/ibzemployee-option-view.vue'),
},
{
path: '/ibzorganizations/:ibzorganization?/ibzemployees/:ibzemployee?/optionview/:optionview?',
meta: {
caption: 'entities.ibzemployee.views.optionview.caption',
parameters: [
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
{ pathName: 'ibzemployees', parameterName: 'ibzemployee' },
{ pathName: 'optionview', parameterName: 'optionview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzemployee-option-view/ibzemployee-option-view.vue'),
},
{
path: '/ibzdepartments/:ibzdepartment?/ibzemployees/:ibzemployee?/optionview/:optionview?',
meta: {
caption: 'entities.ibzemployee.views.optionview.caption',
parameters: [
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
{ pathName: 'ibzemployees', parameterName: 'ibzemployee' },
{ pathName: 'optionview', parameterName: 'optionview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzemployee-option-view/ibzemployee-option-view.vue'),
},
{
path: '/ibzemployees/:ibzemployee?/optionview/:optionview?',
meta: {
caption: 'entities.ibzemployee.views.optionview.caption',
parameters: [
{ pathName: 'ibzemployees', parameterName: 'ibzemployee' },
{ pathName: 'optionview', parameterName: 'optionview' },
],
requireAuth: true,
},
component: () => import('@pages/ou/ibzemployee-option-view/ibzemployee-option-view.vue'),
},
{
path: '/ibzorganizations/:ibzorganization?/ibzdepartments/:ibzdepartment?/pickupgridview/:pickupgridview?',
meta: {
......
......@@ -24,6 +24,17 @@ export const viewstate: any = {
'b59db4df07430a34645566a64d59244c',
],
},
{
viewtag: '17f1f78c7a23f7546dbfef7f8fa9fcd0',
viewmodule: 'ou',
viewname: 'IBZDepartmentOptionView',
viewaction: '',
viewdatachange: false,
refviews: [
'9e25d15d43ff644fa008c9cf7d063ac3',
'b59db4df07430a34645566a64d59244c',
],
},
{
viewtag: '21259e2d03645750f1d3d71839f1223b',
viewmodule: 'ou',
......@@ -43,6 +54,7 @@ export const viewstate: any = {
viewdatachange: false,
refviews: [
'16f9ed1179f9b3cf686cbcd796512299',
'61a772e0bde33e5e8e9b83ea0f354271',
],
},
{
......@@ -54,6 +66,17 @@ export const viewstate: any = {
refviews: [
],
},
{
viewtag: '61a772e0bde33e5e8e9b83ea0f354271',
viewmodule: 'ou',
viewname: 'IBZEmployeeOptionView',
viewaction: '',
viewdatachange: false,
refviews: [
'9e25d15d43ff644fa008c9cf7d063ac3',
'b59db4df07430a34645566a64d59244c',
],
},
{
viewtag: '66fa282d24a21eec39d958e7fc6c23a8',
viewmodule: 'ou',
......@@ -132,6 +155,7 @@ export const viewstate: any = {
viewaction: '',
viewdatachange: false,
refviews: [
'17f1f78c7a23f7546dbfef7f8fa9fcd0',
'21259e2d03645750f1d3d71839f1223b',
],
},
......
......@@ -79,6 +79,7 @@ export default class IBZDepartmentUIServiceBase extends UIService {
* @memberof IBZDepartmentUIServiceBase
*/
public initViewMap(){
this.allViewMap.set(':',{viewname:'optionview',srfappde:'ibzdepartments'});
this.allViewMap.set('EDITVIEW:',{viewname:'editview',srfappde:'ibzdepartments'});
this.allViewMap.set(':',{viewname:'pickupgridview',srfappde:'ibzdepartments'});
this.allViewMap.set('PICKUPVIEW:',{viewname:'pickupview',srfappde:'ibzdepartments'});
......@@ -93,6 +94,126 @@ export default class IBZDepartmentUIServiceBase extends UIService {
public initDeMainStateMap(){
}
/**
* 打开注视图
*
* @param {any[]} args 当前数据
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
* @returns {Promise<any>}
*/
public async IBZDepartment_OpenMainView(args: any[], context:any = {} ,params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
let data: any = {};
const _args: any[] = Util.deepCopy(args);
const _this: any = actionContext;
const actionTarget: string | null = 'SINGLEKEY';
Object.assign(context, { ibzdepartment: '%ibzdepartment%' });
Object.assign(params, { deptid: '%ibzdepartment%' });
Object.assign(params, { deptname: '%deptname%' });
context = UIActionTool.handleContextParam(actionTarget,_args,context);
data = UIActionTool.handleActionParam(actionTarget,_args,params);
context = Object.assign({},actionContext.context,context);
let parentObj:any = {srfparentdename:srfParentDeName?srfParentDeName:null,srfparentkey:srfParentDeName?context[srfParentDeName.toLowerCase()]:null};
Object.assign(data,parentObj);
Object.assign(context,parentObj);
let deResParameters: any[] = [];
if(context.ibzorganization && true){
deResParameters = [
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
]
}
const parameters: any[] = [
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
];
const openDrawer = (view: any, data: any) => {
let container: Subject<any> = actionContext.$appdrawer.openDrawer(view, context,data);
container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
const _this: any = actionContext;
if(window.opener){
window.opener.postMessage({status:'OK',identification:'WF'},Environment.uniteAddress);
window.close();
}
return result.datas;
});
}
const view: any = {
viewname: 'ibzdepartment-edit-view',
height: 0,
width: 0,
title: actionContext.$t('entities.ibzdepartment.views.editview.title'),
placement: 'DRAWER_RIGHT',
};
openDrawer(view, data);
}
/**
* 新建
*
* @param {any[]} args 当前数据
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
* @returns {Promise<any>}
*/
public async IBZDepartment_OpenNewCreateView(args: any[], context:any = {} ,params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
let data: any = {};
const _args: any[] = Util.deepCopy(args);
const _this: any = actionContext;
const actionTarget: string | null = 'NONE';
context = UIActionTool.handleContextParam(actionTarget,_args,context);
data = UIActionTool.handleActionParam(actionTarget,_args,params);
context = Object.assign({},actionContext.context,context);
let parentObj:any = {srfparentdename:srfParentDeName?srfParentDeName:null,srfparentkey:srfParentDeName?context[srfParentDeName.toLowerCase()]:null};
Object.assign(data,parentObj);
Object.assign(context,parentObj);
let deResParameters: any[] = [];
if(context.ibzorganization && true){
deResParameters = [
{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' },
]
}
const parameters: any[] = [
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
];
const openPopupModal = (view: any, data: any) => {
let container: Subject<any> = actionContext.$appmodal.openModal(view, context, data);
container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
const _this: any = actionContext;
if (xData && xData.refresh && xData.refresh instanceof Function) {
xData.refresh(args);
}
if (this.IBZDepartment_OpenMainView && this.IBZDepartment_OpenMainView instanceof Function) {
this.IBZDepartment_OpenMainView(result.datas,context, params, $event, xData,actionContext);
}
if(window.opener){
window.opener.postMessage({status:'OK',identification:'WF'},Environment.uniteAddress);
window.close();
}
return result.datas;
});
}
const view: any = {
viewname: 'ibzdepartment-option-view',
height: 400,
width: 700,
title: actionContext.$t('entities.ibzdepartment.views.optionview.title'),
};
openPopupModal(view, data);
}
/**
* 获取指定数据的重定向页面
......
......@@ -81,6 +81,7 @@ export default class IBZEmployeeUIServiceBase extends UIService {
public initViewMap(){
this.allViewMap.set('EDITVIEW:',{viewname:'editview',srfappde:'ibzemployees'});
this.allViewMap.set('MDATAVIEW:',{viewname:'gridview',srfappde:'ibzemployees'});
this.allViewMap.set(':',{viewname:'optionview',srfappde:'ibzemployees'});
this.allViewMap.set(':',{viewname:'changepwdview',srfappde:'ibzemployees'});
}
......@@ -92,6 +93,50 @@ export default class IBZEmployeeUIServiceBase extends UIService {
public initDeMainStateMap(){
}
/**
* 打开主视图
*
* @param {any[]} args 当前数据
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
* @returns {Promise<any>}
*/
public async IBZEmployee_OpenMainView(args: any[], context:any = {} ,params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
let data: any = {};
const _args: any[] = Util.deepCopy(args);
const _this: any = actionContext;
const actionTarget: string | null = 'SINGLEKEY';
Object.assign(context, { ibzemployee: '%ibzemployee%' });
Object.assign(params, { userid: '%ibzemployee%' });
Object.assign(params, { personname: '%personname%' });
context = UIActionTool.handleContextParam(actionTarget,_args,context);
data = UIActionTool.handleActionParam(actionTarget,_args,params);
context = Object.assign({},actionContext.context,context);
let parentObj:any = {srfparentdename:srfParentDeName?srfParentDeName:null,srfparentkey:srfParentDeName?context[srfParentDeName.toLowerCase()]:null};
Object.assign(data,parentObj);
Object.assign(context,parentObj);
let deResParameters: any[] = [];
if(context.ibzdepartment && true){
deResParameters = [
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
]
}
const parameters: any[] = [
{ pathName: 'ibzemployees', parameterName: 'ibzemployee' },
{ pathName: 'editview', parameterName: 'editview' },
];
const openIndexViewTab = (data: any) => {
const routePath = actionContext.$viewTool.buildUpRoutePath(actionContext.$route, context, deResParameters, parameters, _args, data);
actionContext.$router.push(routePath);
return null;
}
openIndexViewTab(data);
}
/**
* 初始化密码
*
......@@ -148,6 +193,67 @@ export default class IBZEmployeeUIServiceBase extends UIService {
backend();
}
/**
* 新建
*
* @param {any[]} args 当前数据
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
* @returns {Promise<any>}
*/
public async IBZEmployee_OpenNewCreateView(args: any[], context:any = {} ,params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
let data: any = {};
const _args: any[] = Util.deepCopy(args);
const _this: any = actionContext;
const actionTarget: string | null = 'NONE';
context = UIActionTool.handleContextParam(actionTarget,_args,context);
data = UIActionTool.handleActionParam(actionTarget,_args,params);
context = Object.assign({},actionContext.context,context);
let parentObj:any = {srfparentdename:srfParentDeName?srfParentDeName:null,srfparentkey:srfParentDeName?context[srfParentDeName.toLowerCase()]:null};
Object.assign(data,parentObj);
Object.assign(context,parentObj);
let deResParameters: any[] = [];
if(context.ibzdepartment && true){
deResParameters = [
{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' },
]
}
const parameters: any[] = [
{ pathName: 'ibzemployees', parameterName: 'ibzemployee' },
];
const openPopupModal = (view: any, data: any) => {
let container: Subject<any> = actionContext.$appmodal.openModal(view, context, data);
container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
const _this: any = actionContext;
if (xData && xData.refresh && xData.refresh instanceof Function) {
xData.refresh(args);
}
if (this.IBZEmployee_OpenMainView && this.IBZEmployee_OpenMainView instanceof Function) {
this.IBZEmployee_OpenMainView(result.datas,context, params, $event, xData,actionContext);
}
if(window.opener){
window.opener.postMessage({status:'OK',identification:'WF'},Environment.uniteAddress);
window.close();
}
return result.datas;
});
}
const view: any = {
viewname: 'ibzemployee-option-view',
height: 450,
width: 700,
title: actionContext.$t('entities.ibzemployee.views.optionview.title'),
};
openPopupModal(view, data);
}
/**
* 获取指定数据的重定向页面
......
......@@ -143,8 +143,8 @@ export default class IBZOrganizationUIServiceBase extends UIService {
}
const view: any = {
viewname: 'ibzorganization-option-view',
height: 0,
width: 0,
height: 400,
width: 700,
title: actionContext.$t('entities.ibzorganization.views.optionview.title'),
};
openPopupModal(view, data);
......
<template>
<i-form :model="this.data" class='app-form' ref='form' id='form' 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.ibzdepartment.newform_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.deptcode.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='deptcode' :itemRules="this.rules.deptcode" class='' :caption="$t('entities.ibzdepartment.newform_form.details.deptcode')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.deptcode.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.deptcode" @enter="onEnter($event)" unit="" :disabled="detailsModel.deptcode.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.deptname.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='deptname' :itemRules="this.rules.deptname" class='' :caption="$t('entities.ibzdepartment.newform_form.details.deptname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.deptname.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.deptname" @enter="onEnter($event)" unit="" :disabled="detailsModel.deptname.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.orgname.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='orgname' :itemRules="this.rules.orgname" class='' :caption="$t('entities.ibzdepartment.newform_form.details.orgname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.orgname.error" :isEmptyCaption="false" labelPos="LEFT">
<app-picker
:formState="formState"
:data="data"
:context="context"
:viewparams="viewparams"
:itemParam='{ }'
:disabled="detailsModel.orgname.disabled"
name='orgname'
deMajorField='orgname'
deKeyField='ibzorganization'
:service="service"
:acParams="{ serviceName: 'IBZOrganizationService', interfaceName: 'FetchDefault'}"
valueitem='orgid'
:value="data.orgname"
editortype=""
:pickupView="{ viewname: 'ibzorganization-pickup-view', title: $t('entities.ibzorganization.views.pickupview.title'), deResParameters: [], parameters: [{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' }, { pathName: 'pickupview', parameterName: 'pickupview' } ], placement:'' }"
style=""
@formitemvaluechange="onFormItemValueChange">
</app-picker>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.pdeptname.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='pdeptname' :itemRules="this.rules.pdeptname" class='' :caption="$t('entities.ibzdepartment.newform_form.details.pdeptname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.pdeptname.error" :isEmptyCaption="false" labelPos="LEFT">
<app-picker
:formState="formState"
:data="data"
:context="context"
:viewparams="viewparams"
:itemParam='{ }'
:disabled="detailsModel.pdeptname.disabled"
name='pdeptname'
deMajorField='deptname'
deKeyField='ibzdepartment'
:service="service"
:acParams="{ serviceName: 'IBZDepartmentService', interfaceName: 'FetchDefault'}"
valueitem='pdeptid'
:value="data.pdeptname"
editortype=""
:pickupView="{ viewname: 'ibzdepartment-pickup-view', title: $t('entities.ibzdepartment.views.pickupview.title'), deResParameters: [{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' }, ], parameters: [{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' }, { pathName: 'pickupview', parameterName: 'pickupview' } ], placement:'' }"
style=""
@formitemvaluechange="onFormItemValueChange">
</app-picker>
</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 IBZDepartmentService from '@/service/ibzdepartment/ibzdepartment-service';
import NewFormService from './new-form-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 NewFormBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof NewForm
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof NewForm
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof NewForm
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof NewForm
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof NewForm
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof NewForm
*/
public getControlType(): string {
return 'FORM'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof NewForm
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {NewFormService}
* @memberof NewForm
*/
public service: NewFormService = new NewFormService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {IBZDepartmentService}
* @memberof NewForm
*/
public appEntityService: IBZDepartmentService = new IBZDepartmentService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof NewForm
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof NewForm
*/
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 NewForm
*/
public getDatas(): any[] {
return [this.data];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof NewForm
*/
public getData(): any {
return this.data;
}
/**
* 是否默认保存
*
* @type {boolean}
* @memberof NewForm
*/
@Prop({ default: false }) public autosave?: boolean;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof NewForm
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--submit
*
* @type {string}
* @memberof NewForm
*/
@Prop() public WFSubmitAction!: string;
/**
* 部件行为--start
*
* @type {string}
* @memberof NewForm
*/
@Prop() public WFStartAction!: string;
/**
* 部件行为--update
*
* @type {string}
* @memberof NewForm
*/
@Prop() public updateAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof NewForm
*/
@Prop() public removeAction!: string;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof NewForm
*/
@Prop() public loaddraftAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof NewForm
*/
@Prop() public loadAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof NewForm
*/
@Prop() public createAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof NewForm
*/
@Prop() public searchAction!: string;
/**
* 视图标识
*
* @type {string}
* @memberof NewForm
*/
@Prop() public viewtag!: string;
/**
* 表单状态
*
* @type {Subject<any>}
* @memberof NewForm
*/
public formState: Subject<any> = new Subject();
/**
* 忽略表单项值变化
*
* @type {boolean}
* @memberof NewForm
*/
public ignorefieldvaluechange: boolean = false;
/**
* 数据变化
*
* @public
* @type {Subject<any>}
* @memberof NewForm
*/
public dataChang: Subject<any> = new Subject();
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof NewForm
*/
public dataChangEvent: Subscription | undefined;
/**
* 原始数据
*
* @public
* @type {*}
* @memberof NewForm
*/
public oldData: any = {};
/**
* 表单数据对象
*
* @type {*}
* @memberof NewForm
*/
public data: any = {
srfupdatedate: null,
srforikey: null,
srfkey: null,
srfmajortext: null,
srftempmode: null,
srfuf: null,
srfdeid: null,
srfsourcekey: null,
deptcode: null,
deptname: null,
orgname: null,
pdeptname: null,
pdeptid: null,
deptid: null,
orgid: null,
ibzdepartment:null,
};
/**
* 当前执行的行为逻辑
*
* @type {string}
* @memberof NewForm
*/
public currentAction: string = "";
/**
* 关系界面计数器
*
* @type {number}
* @memberof NewForm
*/
public drcounter: number = 0;
/**
* 需要等待关系界面保存时,第一次调用save参数的备份
*
* @type {number}
* @memberof NewForm
*/
public drsaveopt: any = {};
/**
* 表单保存回调存储对象
*
* @type {any}
* @memberof NewForm
*/
public saveState:any ;
/**
* 属性值规则
*
* @type {*}
* @memberof NewForm
*/
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' },
],
deptcode: [
{ type: 'string', message: '部门代码 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '部门代码 值必须为字符串类型', trigger: 'blur' },
{ required: true, type: 'string', message: '部门代码 值不能为空', trigger: 'change' },
{ required: true, type: 'string', message: '部门代码 值不能为空', trigger: 'blur' },
],
deptname: [
{ type: 'string', message: '部门名称 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '部门名称 值必须为字符串类型', trigger: 'blur' },
{ required: true, type: 'string', message: '部门名称 值不能为空', trigger: 'change' },
{ required: true, type: 'string', message: '部门名称 值不能为空', trigger: 'blur' },
],
orgname: [
{ type: 'string', message: '单位 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '单位 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '单位 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '单位 值不能为空', trigger: 'blur' },
],
pdeptname: [
{ type: 'string', message: '上级部门 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '上级部门 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '上级部门 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '上级部门 值不能为空', trigger: 'blur' },
],
pdeptid: [
{ type: 'string', message: '上级部门 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '上级部门 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '上级部门 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '上级部门 值不能为空', trigger: 'blur' },
],
deptid: [
{ type: 'string', message: '部门标识 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '部门标识 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '部门标识 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '部门标识 值不能为空', trigger: 'blur' },
],
orgid: [
{ 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 NewForm
*/
public detailsModel: any = {
group1: new FormGroupPanelModel({ caption: '部门基本信息', detailType: 'GROUPPANEL', name: 'group1', visible: true, isShowCaption: false, form: this, uiActionGroup: { caption: '', langbase: 'entities.ibzdepartment.newform_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: 3 })
,
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: 3 })
,
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 })
,
deptcode: new FormItemModel({ caption: '部门代码', detailType: 'FORMITEM', name: 'deptcode', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 1 })
,
deptname: new FormItemModel({ caption: '部门名称', detailType: 'FORMITEM', name: 'deptname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
orgname: new FormItemModel({ caption: '单位', detailType: 'FORMITEM', name: 'orgname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
pdeptname: new FormItemModel({ caption: '上级部门', detailType: 'FORMITEM', name: 'pdeptname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
pdeptid: new FormItemModel({ caption: '上级部门', detailType: 'FORMITEM', name: 'pdeptid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
deptid: new FormItemModel({ caption: '部门标识', detailType: 'FORMITEM', name: 'deptid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
orgid: new FormItemModel({ caption: '单位', detailType: 'FORMITEM', name: 'orgid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
};
/**
* 监控表单属性 srfupdatedate 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.srfupdatedate')
onSrfupdatedateChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfupdatedate', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srforikey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.srforikey')
onSrforikeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srforikey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfkey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.srfkey')
onSrfkeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfkey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfmajortext 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.srfmajortext')
onSrfmajortextChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfmajortext', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srftempmode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.srftempmode')
onSrftempmodeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srftempmode', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfuf 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.srfuf')
onSrfufChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfuf', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfdeid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.srfdeid')
onSrfdeidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfdeid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfsourcekey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.srfsourcekey')
onSrfsourcekeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfsourcekey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 deptcode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.deptcode')
onDeptcodeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'deptcode', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 deptname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.deptname')
onDeptnameChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'deptname', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 orgname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.orgname')
onOrgnameChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'orgname', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 pdeptname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.pdeptname')
onPdeptnameChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'pdeptname', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 pdeptid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.pdeptid')
onPdeptidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'pdeptid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 deptid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.deptid')
onDeptidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'deptid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 orgid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.orgid')
onOrgidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'orgid', newVal: newVal, oldVal: oldVal });
}
/**
* 重置表单项值
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof NewForm
*/
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 NewForm
*/
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 NewForm
*/
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 NewForm
*/
public onFormLoad(data: any = {},action:string): void {
if(Object.is(action,"save") || Object.is(action,"autoSave") || Object.is(action,"submit"))
// 更新context的实体主键
if(data.ibzdepartment){
Object.assign(this.context,{ibzdepartment:data.ibzdepartment})
}
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 NewForm
*/
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 NewForm
*/
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 NewForm
*/
public resetDraftFormStates(): void {
const form: any = this.$refs.form;
if (form) {
form.resetFields();
}
}
/**
* 重置校验结果
*
* @memberof NewForm
*/
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 NewForm
*/
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 NewForm
*/
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 NewForm
*/
public getValues(): any {
return this.data;
}
/**
* 表单项值变更
*
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof NewForm
*/
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 NewForm
*/
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 NewForm
*/
public groupUIActionClick($event: any): void {
if (!$event) {
return;
}
const item:any = $event.item;
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof NewForm
*/
public created(): void {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof NewForm
*/
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);
}
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 NewForm
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof NewForm
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if (this.dataChangEvent) {
this.dataChangEvent.unsubscribe();
}
}
/**
* 拷贝内容
*
* @param {*} [arg={}]
* @memberof @memberof NewForm
*/
public copy(arg: any = {}): void {
this.loadDraft(arg);
}
/**
*打印
*@memberof @memberof NewForm
*/
public print(){
let _this:any = this;
_this.$print({id:'form',popTitle:'新建表单'});
}
/**
* 部件刷新
*
* @param {any[]} args
* @memberof NewForm
*/
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 NewForm
*/
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 NewForm
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: '错误', desc: 'IBZDepartmentOptionView视图表单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 NewForm
*/
public loadDraft(opt: any = {}): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: '错误', desc: 'IBZDepartmentOptionView视图表单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.ibzdepartment){
Object.assign(this.context,{ibzdepartment:data.ibzdepartment})
}
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 NewForm
*/
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: 'IBZDepartmentOptionView视图表单'+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 NewForm
*/
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: 'IBZDepartmentOptionView视图表单'+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: 'IBZDepartmentOptionView视图表单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 NewForm
*/
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 NewForm
*/
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.ibzdepartment || Object.is(arg.ibzdepartment, '')) {
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});
}
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 NewForm
*/
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 NewForm
*/
public onEnter($event: any): void {
}
/**
* 保存并退出
*
* @param {any[]} args
* @memberof NewForm
*/
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 NewForm
*/
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 NewForm
*/
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 NewForm
*/
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 NewForm
*/
public createDefault(){
}
/**
* 更新默认值
* @memberof NewForm
*/
public updateDefault(){
}
}
</script>
<style lang='less'>
@import './new-form-form.less';
</style>
\ No newline at end of file
/**
* NewForm 部件模型
*
* @export
* @class NewFormModel
*/
export default class NewFormModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof NewFormModel
*/
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: 'deptid',
dataType: 'TEXT',
},
{
name: 'srfmajortext',
prop: 'deptname',
dataType: 'TEXT',
},
{
name: 'srftempmode',
},
{
name: 'srfuf',
},
{
name: 'srfdeid',
},
{
name: 'srfsourcekey',
},
{
name: 'deptcode',
prop: 'deptcode',
dataType: 'TEXT',
},
{
name: 'deptname',
prop: 'deptname',
dataType: 'TEXT',
},
{
name: 'orgname',
prop: 'orgname',
dataType: 'PICKUPTEXT',
},
{
name: 'pdeptname',
prop: 'parentdeptname',
dataType: 'PICKUPTEXT',
},
{
name: 'pdeptid',
prop: 'parentdeptid',
dataType: 'PICKUP',
},
{
name: 'deptid',
prop: 'deptid',
dataType: 'TEXT',
},
{
name: 'orgid',
prop: 'orgid',
dataType: 'PICKUP',
},
{
name: 'ibzdepartment',
prop: 'deptid',
dataType: 'FONTKEY',
},
]
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import IBZDepartmentService from '@/service/ibzdepartment/ibzdepartment-service';
import NewFormModel from './new-form-form-model';
import IBZOrganizationService from '@/service/ibzorganization/ibzorganization-service';
/**
* NewForm 部件服务对象
*
* @export
* @class NewFormService
*/
export default class NewFormService extends ControlService {
/**
* 部门服务对象
*
* @type {IBZDepartmentService}
* @memberof NewFormService
*/
public appEntityService: IBZDepartmentService = new IBZDepartmentService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof NewFormService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of NewFormService.
*
* @param {*} [opts={}]
* @memberof NewFormService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new NewFormModel();
}
/**
* 单位机构服务对象
*
* @type {IBZOrganizationService}
* @memberof NewFormService
*/
public ibzorganizationService: IBZOrganizationService = new IBZOrganizationService();
/**
* 处理数据
*
* @private
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof NewFormService
*/
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 NewFormService
*/
@Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
if (Object.is(serviceName, 'IBZOrganizationService') && Object.is(interfaceName, 'FetchDefault')) {
return this.doItems(this.ibzorganizationService.FetchDefault(JSON.parse(JSON.stringify(context)),data, isloading), 'orgid', 'ibzorganization');
}
if (Object.is(serviceName, 'IBZDepartmentService') && Object.is(interfaceName, 'FetchDefault')) {
return this.doItems(this.appEntityService.FetchDefault(JSON.parse(JSON.stringify(context)), data, isloading), 'deptid', 'ibzdepartment');
}
return Promise.reject([])
}
/**
* 启动工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>}
* @memberof NewFormService
*/
@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 NewFormService
*/
@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 NewFormService
*/
@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 NewFormService
*/
@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 NewFormService
*/
@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 NewFormService
*/
@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 NewFormService
*/
@Errorlog
public loadDraft(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
//仿真主键数据
Data.deptid = Util.createUUID();
Data.ibzdepartment = Data.deptid;
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) => {
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 NewFormService
*/
@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 NewFormService
*/
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-form {
overflow: auto;
> .ivu-row {
> .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%;
}
}
}
.app-form {
>.ivu-row:nth-child(2) {
>.ivu-col:nth-child(1) {
>.ivu-row.app-form-group.app-group-hiddden-caption:nth-child(1) {
margin-top: 12px;
}
}
}
}
// 表单行间距
.app-form{
.app-form-item{
margin-bottom: 20px;
}
}
// this is less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import NewFormBase from './new-form-form-base.vue';
@Component({
components: {
}
})
export default class NewForm extends NewFormBase {
}
</script>
\ No newline at end of file
<template>
<i-form :model="this.data" class='app-form' ref='form' id='form' 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.ibzemployee.newform_form.details.group1')" :isShowCaption="true" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.usercode.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='usercode' :itemRules="this.rules.usercode" class='' :caption="$t('entities.ibzemployee.newform_form.details.usercode')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.usercode.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.usercode" @enter="onEnter($event)" unit="" :disabled="detailsModel.usercode.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.personname.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='personname' :itemRules="this.rules.personname" class='' :caption="$t('entities.ibzemployee.newform_form.details.personname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.personname.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.personname" @enter="onEnter($event)" unit="" :disabled="detailsModel.personname.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.loginname.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='loginname' :itemRules="this.rules.loginname" class='' :caption="$t('entities.ibzemployee.newform_form.details.loginname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.loginname.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.loginname" @enter="onEnter($event)" unit="" :disabled="detailsModel.loginname.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.orgname.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='orgname' :itemRules="this.rules.orgname" class='' :caption="$t('entities.ibzemployee.newform_form.details.orgname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.orgname.error" :isEmptyCaption="false" labelPos="LEFT">
<app-picker
:formState="formState"
:data="data"
:context="context"
:viewparams="viewparams"
:itemParam='{ }'
:disabled="detailsModel.orgname.disabled"
name='orgname'
deMajorField='orgname'
deKeyField='ibzorganization'
:service="service"
:acParams="{ serviceName: 'IBZOrganizationService', interfaceName: 'FetchDefault'}"
valueitem='orgid'
:value="data.orgname"
editortype=""
:pickupView="{ viewname: 'ibzorganization-pickup-view', title: $t('entities.ibzorganization.views.pickupview.title'), deResParameters: [], parameters: [{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' }, { pathName: 'pickupview', parameterName: 'pickupview' } ], placement:'' }"
style=""
@formitemvaluechange="onFormItemValueChange">
</app-picker>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.mdeptname.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='mdeptname' :itemRules="this.rules.mdeptname" class='' :caption="$t('entities.ibzemployee.newform_form.details.mdeptname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.mdeptname.error" :isEmptyCaption="false" labelPos="LEFT">
<app-picker
:formState="formState"
:data="data"
:context="context"
:viewparams="viewparams"
:itemParam='{ }'
:disabled="detailsModel.mdeptname.disabled"
name='mdeptname'
deMajorField='deptname'
deKeyField='ibzdepartment'
:service="service"
:acParams="{ serviceName: 'IBZDepartmentService', interfaceName: 'FetchDefault'}"
valueitem='mdeptid'
:value="data.mdeptname"
editortype=""
:pickupView="{ viewname: 'ibzdepartment-pickup-view', title: $t('entities.ibzdepartment.views.pickupview.title'), deResParameters: [{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' }, ], parameters: [{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' }, { pathName: 'pickupview', parameterName: 'pickupview' } ], placement:'' }"
style=""
@formitemvaluechange="onFormItemValueChange">
</app-picker>
</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 IBZEmployeeService from '@/service/ibzemployee/ibzemployee-service';
import NewFormService from './new-form-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 NewFormBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof NewForm
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof NewForm
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof NewForm
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof NewForm
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof NewForm
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof NewForm
*/
public getControlType(): string {
return 'FORM'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof NewForm
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {NewFormService}
* @memberof NewForm
*/
public service: NewFormService = new NewFormService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {IBZEmployeeService}
* @memberof NewForm
*/
public appEntityService: IBZEmployeeService = new IBZEmployeeService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof NewForm
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof NewForm
*/
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 NewForm
*/
public getDatas(): any[] {
return [this.data];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof NewForm
*/
public getData(): any {
return this.data;
}
/**
* 是否默认保存
*
* @type {boolean}
* @memberof NewForm
*/
@Prop({ default: false }) public autosave?: boolean;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof NewForm
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--submit
*
* @type {string}
* @memberof NewForm
*/
@Prop() public WFSubmitAction!: string;
/**
* 部件行为--start
*
* @type {string}
* @memberof NewForm
*/
@Prop() public WFStartAction!: string;
/**
* 部件行为--update
*
* @type {string}
* @memberof NewForm
*/
@Prop() public updateAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof NewForm
*/
@Prop() public removeAction!: string;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof NewForm
*/
@Prop() public loaddraftAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof NewForm
*/
@Prop() public loadAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof NewForm
*/
@Prop() public createAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof NewForm
*/
@Prop() public searchAction!: string;
/**
* 视图标识
*
* @type {string}
* @memberof NewForm
*/
@Prop() public viewtag!: string;
/**
* 表单状态
*
* @type {Subject<any>}
* @memberof NewForm
*/
public formState: Subject<any> = new Subject();
/**
* 忽略表单项值变化
*
* @type {boolean}
* @memberof NewForm
*/
public ignorefieldvaluechange: boolean = false;
/**
* 数据变化
*
* @public
* @type {Subject<any>}
* @memberof NewForm
*/
public dataChang: Subject<any> = new Subject();
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof NewForm
*/
public dataChangEvent: Subscription | undefined;
/**
* 原始数据
*
* @public
* @type {*}
* @memberof NewForm
*/
public oldData: any = {};
/**
* 表单数据对象
*
* @type {*}
* @memberof NewForm
*/
public data: any = {
srfupdatedate: null,
srforikey: null,
srfkey: null,
srfmajortext: null,
srftempmode: null,
srfuf: null,
srfdeid: null,
srfsourcekey: null,
usercode: null,
personname: null,
loginname: null,
orgname: null,
mdeptname: null,
orgid: null,
userid: null,
mdeptid: null,
ibzemployee:null,
};
/**
* 当前执行的行为逻辑
*
* @type {string}
* @memberof NewForm
*/
public currentAction: string = "";
/**
* 关系界面计数器
*
* @type {number}
* @memberof NewForm
*/
public drcounter: number = 0;
/**
* 需要等待关系界面保存时,第一次调用save参数的备份
*
* @type {number}
* @memberof NewForm
*/
public drsaveopt: any = {};
/**
* 表单保存回调存储对象
*
* @type {any}
* @memberof NewForm
*/
public saveState:any ;
/**
* 属性值规则
*
* @type {*}
* @memberof NewForm
*/
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' },
],
usercode: [
{ type: 'string', message: '用户工号 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '用户工号 值必须为字符串类型', trigger: 'blur' },
{ required: true, type: 'string', message: '用户工号 值不能为空', trigger: 'change' },
{ required: true, type: 'string', message: '用户工号 值不能为空', trigger: 'blur' },
],
personname: [
{ type: 'string', message: '姓名 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '姓名 值必须为字符串类型', trigger: 'blur' },
{ required: true, type: 'string', message: '姓名 值不能为空', trigger: 'change' },
{ required: true, type: 'string', message: '姓名 值不能为空', trigger: 'blur' },
],
loginname: [
{ type: 'string', message: '登录名 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '登录名 值必须为字符串类型', trigger: 'blur' },
{ required: true, type: 'string', message: '登录名 值不能为空', trigger: 'change' },
{ required: true, type: 'string', message: '登录名 值不能为空', trigger: 'blur' },
],
orgname: [
{ type: 'string', message: '单位 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '单位 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '单位 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '单位 值不能为空', trigger: 'blur' },
],
mdeptname: [
{ type: 'string', message: '部门 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '部门 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '部门 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '部门 值不能为空', trigger: 'blur' },
],
orgid: [
{ type: 'string', message: '单位 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '单位 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '单位 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '单位 值不能为空', trigger: 'blur' },
],
userid: [
{ type: 'string', message: '用户标示 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '用户标示 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '用户标示 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '用户标示 值不能为空', trigger: 'blur' },
],
mdeptid: [
{ 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 NewForm
*/
public detailsModel: any = {
group1: new FormGroupPanelModel({ caption: '人员基本信息', detailType: 'GROUPPANEL', name: 'group1', visible: true, isShowCaption: true, form: this, uiActionGroup: { caption: '', langbase: 'entities.ibzemployee.newform_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: 3 })
,
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: 3 })
,
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 })
,
usercode: new FormItemModel({ caption: '用户工号', detailType: 'FORMITEM', name: 'usercode', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 1 })
,
personname: new FormItemModel({ caption: '姓名', detailType: 'FORMITEM', name: 'personname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
loginname: new FormItemModel({ caption: '登录名', detailType: 'FORMITEM', name: 'loginname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 1 })
,
orgname: new FormItemModel({ caption: '单位', detailType: 'FORMITEM', name: 'orgname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
mdeptname: new FormItemModel({ caption: '部门', detailType: 'FORMITEM', name: 'mdeptname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
orgid: new FormItemModel({ caption: '单位', detailType: 'FORMITEM', name: 'orgid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
userid: new FormItemModel({ caption: '用户标示', detailType: 'FORMITEM', name: 'userid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
mdeptid: new FormItemModel({ caption: '主部门', detailType: 'FORMITEM', name: 'mdeptid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
};
/**
* 监控表单属性 srfupdatedate 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.srfupdatedate')
onSrfupdatedateChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfupdatedate', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srforikey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.srforikey')
onSrforikeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srforikey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfkey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.srfkey')
onSrfkeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfkey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfmajortext 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.srfmajortext')
onSrfmajortextChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfmajortext', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srftempmode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.srftempmode')
onSrftempmodeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srftempmode', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfuf 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.srfuf')
onSrfufChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfuf', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfdeid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.srfdeid')
onSrfdeidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfdeid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfsourcekey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.srfsourcekey')
onSrfsourcekeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfsourcekey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 usercode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.usercode')
onUsercodeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'usercode', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 personname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.personname')
onPersonnameChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'personname', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 loginname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.loginname')
onLoginnameChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'loginname', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 orgname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.orgname')
onOrgnameChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'orgname', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 mdeptname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.mdeptname')
onMdeptnameChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'mdeptname', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 orgid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.orgid')
onOrgidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'orgid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 userid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.userid')
onUseridChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'userid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 mdeptid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.mdeptid')
onMdeptidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'mdeptid', newVal: newVal, oldVal: oldVal });
}
/**
* 重置表单项值
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof NewForm
*/
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 NewForm
*/
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 NewForm
*/
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 NewForm
*/
public onFormLoad(data: any = {},action:string): void {
if(Object.is(action,"save") || Object.is(action,"autoSave") || Object.is(action,"submit"))
// 更新context的实体主键
if(data.ibzemployee){
Object.assign(this.context,{ibzemployee:data.ibzemployee})
}
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 NewForm
*/
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 NewForm
*/
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 NewForm
*/
public resetDraftFormStates(): void {
const form: any = this.$refs.form;
if (form) {
form.resetFields();
}
}
/**
* 重置校验结果
*
* @memberof NewForm
*/
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 NewForm
*/
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 NewForm
*/
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 NewForm
*/
public getValues(): any {
return this.data;
}
/**
* 表单项值变更
*
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof NewForm
*/
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 NewForm
*/
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 NewForm
*/
public groupUIActionClick($event: any): void {
if (!$event) {
return;
}
const item:any = $event.item;
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof NewForm
*/
public created(): void {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof NewForm
*/
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);
}
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 NewForm
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof NewForm
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if (this.dataChangEvent) {
this.dataChangEvent.unsubscribe();
}
}
/**
* 拷贝内容
*
* @param {*} [arg={}]
* @memberof @memberof NewForm
*/
public copy(arg: any = {}): void {
this.loadDraft(arg);
}
/**
*打印
*@memberof @memberof NewForm
*/
public print(){
let _this:any = this;
_this.$print({id:'form',popTitle:'新建表单'});
}
/**
* 部件刷新
*
* @param {any[]} args
* @memberof NewForm
*/
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 NewForm
*/
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 NewForm
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: '错误', desc: 'IBZEmployeeOptionView视图表单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 NewForm
*/
public loadDraft(opt: any = {}): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: '错误', desc: 'IBZEmployeeOptionView视图表单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.ibzemployee){
Object.assign(this.context,{ibzemployee:data.ibzemployee})
}
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 NewForm
*/
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: 'IBZEmployeeOptionView视图表单'+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 NewForm
*/
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: 'IBZEmployeeOptionView视图表单'+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: 'IBZEmployeeOptionView视图表单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 NewForm
*/
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 NewForm
*/
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.ibzemployee || Object.is(arg.ibzemployee, '')) {
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});
}
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 NewForm
*/
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 NewForm
*/
public onEnter($event: any): void {
}
/**
* 保存并退出
*
* @param {any[]} args
* @memberof NewForm
*/
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 NewForm
*/
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 NewForm
*/
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 NewForm
*/
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 NewForm
*/
public createDefault(){
}
/**
* 更新默认值
* @memberof NewForm
*/
public updateDefault(){
}
}
</script>
<style lang='less'>
@import './new-form-form.less';
</style>
\ No newline at end of file
/**
* NewForm 部件模型
*
* @export
* @class NewFormModel
*/
export default class NewFormModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof NewFormModel
*/
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: 'userid',
dataType: 'TEXT',
},
{
name: 'srfmajortext',
prop: 'personname',
dataType: 'TEXT',
},
{
name: 'srftempmode',
},
{
name: 'srfuf',
},
{
name: 'srfdeid',
},
{
name: 'srfsourcekey',
},
{
name: 'usercode',
prop: 'usercode',
dataType: 'TEXT',
},
{
name: 'personname',
prop: 'personname',
dataType: 'TEXT',
},
{
name: 'loginname',
prop: 'loginname',
dataType: 'TEXT',
},
{
name: 'orgname',
prop: 'orgname',
dataType: 'PICKUPTEXT',
},
{
name: 'mdeptname',
prop: 'mdeptname',
dataType: 'PICKUPTEXT',
},
{
name: 'orgid',
prop: 'orgid',
dataType: 'PICKUP',
},
{
name: 'userid',
prop: 'userid',
dataType: 'TEXT',
},
{
name: 'mdeptid',
prop: 'mdeptid',
dataType: 'PICKUP',
},
{
name: 'ibzemployee',
prop: 'userid',
dataType: 'FONTKEY',
},
]
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import IBZEmployeeService from '@/service/ibzemployee/ibzemployee-service';
import NewFormModel from './new-form-form-model';
import IBZOrganizationService from '@/service/ibzorganization/ibzorganization-service';
import IBZDepartmentService from '@/service/ibzdepartment/ibzdepartment-service';
/**
* NewForm 部件服务对象
*
* @export
* @class NewFormService
*/
export default class NewFormService extends ControlService {
/**
* 人员服务对象
*
* @type {IBZEmployeeService}
* @memberof NewFormService
*/
public appEntityService: IBZEmployeeService = new IBZEmployeeService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof NewFormService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of NewFormService.
*
* @param {*} [opts={}]
* @memberof NewFormService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new NewFormModel();
}
/**
* 单位机构服务对象
*
* @type {IBZOrganizationService}
* @memberof NewFormService
*/
public ibzorganizationService: IBZOrganizationService = new IBZOrganizationService();
/**
* 部门服务对象
*
* @type {IBZDepartmentService}
* @memberof NewFormService
*/
public ibzdepartmentService: IBZDepartmentService = new IBZDepartmentService();
/**
* 处理数据
*
* @private
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof NewFormService
*/
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 NewFormService
*/
@Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
if (Object.is(serviceName, 'IBZOrganizationService') && Object.is(interfaceName, 'FetchDefault')) {
return this.doItems(this.ibzorganizationService.FetchDefault(JSON.parse(JSON.stringify(context)),data, isloading), 'orgid', 'ibzorganization');
}
if (Object.is(serviceName, 'IBZDepartmentService') && Object.is(interfaceName, 'FetchDefault')) {
return this.doItems(this.ibzdepartmentService.FetchDefault(JSON.parse(JSON.stringify(context)),data, isloading), 'deptid', 'ibzdepartment');
}
return Promise.reject([])
}
/**
* 启动工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>}
* @memberof NewFormService
*/
@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 NewFormService
*/
@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 NewFormService
*/
@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 NewFormService
*/
@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 NewFormService
*/
@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 NewFormService
*/
@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 NewFormService
*/
@Errorlog
public loadDraft(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
//仿真主键数据
Data.userid = Util.createUUID();
Data.ibzemployee = Data.userid;
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) => {
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 NewFormService
*/
@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 NewFormService
*/
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-form {
overflow: auto;
> .ivu-row {
> .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%;
}
}
}
.app-form {
>.ivu-row:nth-child(2) {
>.ivu-col:nth-child(1) {
>.ivu-row.app-form-group.app-group-hiddden-caption:nth-child(1) {
margin-top: 12px;
}
}
}
}
// 表单行间距
.app-form{
.app-form-item{
margin-bottom: 20px;
}
}
// this is less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import NewFormBase from './new-form-form-base.vue';
@Component({
components: {
}
})
export default class NewForm extends NewFormBase {
}
</script>
\ No newline at end of file
......@@ -351,6 +351,7 @@ export default class NewFormBase extends Vue implements ControlInterface {
orgcode: null,
orgname: null,
porgname: null,
enable: null,
orgid: null,
porgid: null,
ibzorganization:null,
......@@ -461,6 +462,12 @@ export default class NewFormBase extends Vue implements ControlInterface {
{ required: false, type: 'string', message: '上级单位 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '上级单位 值不能为空', trigger: 'blur' },
],
enable: [
{ type: 'number', message: '逻辑有效 值必须为数值类型', trigger: 'change' },
{ type: 'number', message: '逻辑有效 值必须为数值类型', trigger: 'blur' },
{ required: false, type: 'number', message: '逻辑有效 值不能为空', trigger: 'change' },
{ required: false, type: 'number', message: '逻辑有效 值不能为空', trigger: 'blur' },
],
orgid: [
{ type: 'string', message: '单位标识 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '单位标识 值必须为字符串类型', trigger: 'blur' },
......@@ -507,6 +514,8 @@ export default class NewFormBase extends Vue implements ControlInterface {
orgname: new FormItemModel({ caption: '名称', detailType: 'FORMITEM', name: 'orgname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
porgname: new FormItemModel({ caption: '上级单位', detailType: 'FORMITEM', name: 'porgname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
enable: new FormItemModel({ caption: '逻辑有效', detailType: 'FORMITEM', name: 'enable', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
orgid: new FormItemModel({ caption: '单位标识', detailType: 'FORMITEM', name: 'orgid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 1 })
,
......@@ -646,6 +655,18 @@ export default class NewFormBase extends Vue implements ControlInterface {
this.formDataChange({ name: 'porgname', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 enable 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof NewForm
*/
@Watch('data.enable')
onEnableChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'enable', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 orgid 值
*
......@@ -721,6 +742,7 @@ export default class NewFormBase extends Vue implements ControlInterface {
}
/**
......@@ -1601,6 +1623,9 @@ export default class NewFormBase extends Vue implements ControlInterface {
* @memberof NewForm
*/
public createDefault(){
if (this.data.hasOwnProperty('enable')) {
this.data['enable'] = 1;
}
}
/**
......
......@@ -70,6 +70,11 @@ export default class NewFormModel {
prop: 'parentorgname',
dataType: 'PICKUPTEXT',
},
{
name: 'enable',
prop: 'enable',
dataType: 'YESNO',
},
{
name: 'orgid',
prop: 'orgid',
......
......@@ -2,7 +2,7 @@
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<!--输出实体[IBZORG]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-ibzorg-417-1">
<changeSet author="a_A_5d9d78509" id="tab-ibzorg-420-1">
<createTable tableName="IBZORG">
<column name="ORGID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_IBZORG_ORGID"/>
......@@ -28,7 +28,7 @@
</createTable>
</changeSet>
<!--输出实体[IBZEMP]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-ibzemp-590-2">
<changeSet author="a_A_5d9d78509" id="tab-ibzemp-601-2">
<createTable tableName="IBZEMP">
<column name="USERID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_IBZEMP_USERID"/>
......@@ -106,7 +106,7 @@
</createTable>
</changeSet>
<!--输出实体[IBZDEPT]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-ibzdept-516-3">
<changeSet author="a_A_5d9d78509" id="tab-ibzdept-528-3">
<createTable tableName="IBZDEPT">
<column name="DEPTID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_IBZDEPT_DEPTID"/>
......@@ -137,21 +137,21 @@
</changeSet>
<!--输出实体[IBZORG]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-ibzorg-417-4">
<changeSet author="a_A_5d9d78509" id="fk-ibzorg-420-4">
<addForeignKeyConstraint baseColumnNames="PORGID" baseTableName="IBZORG" constraintName="DER1N_IBZORG_IBZORG_PORGID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ORGID" referencedTableName="IBZORG" validate="true"/>
</changeSet>
<!--输出实体[IBZEMP]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-ibzemp-590-5">
<changeSet author="a_A_5d9d78509" id="fk-ibzemp-601-5">
<addForeignKeyConstraint baseColumnNames="MDEPTID" baseTableName="IBZEMP" constraintName="DER1N_IBZEMP_IBZDEPT_MDEPTID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="DEPTID" referencedTableName="IBZDEPT" validate="true"/>
</changeSet>
<changeSet author="a_A_5d9d78509" id="fk-ibzemp-590-6">
<changeSet author="a_A_5d9d78509" id="fk-ibzemp-601-6">
<addForeignKeyConstraint baseColumnNames="ORGID" baseTableName="IBZEMP" constraintName="DER1N_IBZEMP_IBZORG_ORGID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ORGID" referencedTableName="IBZORG" validate="true"/>
</changeSet>
<!--输出实体[IBZDEPT]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-ibzdept-516-7">
<changeSet author="a_A_5d9d78509" id="fk-ibzdept-528-7">
<addForeignKeyConstraint baseColumnNames="PDEPTID" baseTableName="IBZDEPT" constraintName="DER1N_IBZDEPT_IBZDEPT_PDEPTID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="DEPTID" referencedTableName="IBZDEPT" validate="true"/>
</changeSet>
<changeSet author="a_A_5d9d78509" id="fk-ibzdept-516-8">
<changeSet author="a_A_5d9d78509" id="fk-ibzdept-528-8">
<addForeignKeyConstraint baseColumnNames="ORGID" baseTableName="IBZDEPT" constraintName="DER1N_IBZDEPT_IBZORG_ORGID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ORGID" referencedTableName="IBZORG" validate="true"/>
</changeSet>
......
package cn.ibizlab.util.helper;
import cn.ibizlab.util.domain.EntityBase;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
import com.alibaba.fastjson.JSONObject;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
public class RuleUtils
{
public static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
public static Object getObj(Object object, String members)
{
if(object==null)
return null;
Object currentObj = object;
String[] arrayOfString = members.split("\\.");
int i = arrayOfString.length;
for (int j = 0; j < i; ++j)
{
String methodName = arrayOfString[j];
try
{
if(currentObj instanceof EntityBase)
{
currentObj=((EntityBase) currentObj).get(methodName);
if (currentObj == null)
return null;
}
else if(currentObj instanceof JSONObject)
{
currentObj=((JSONObject) currentObj).get(methodName);
if (currentObj == null)
return null;
}
else if(currentObj instanceof Map)
{
currentObj=((Map) currentObj).get(methodName);
if (currentObj == null)
return null;
}
else
{
Class clazz = currentObj.getClass();
Method method = null;
try
{
method=clazz.getMethod("get" , new Class[0]);
}
catch (Exception e2)
{
method=clazz.getDeclaredMethod("get" , new Class[0]);
}
currentObj = method.invoke(currentObj, methodName);
if (currentObj == null)
return null;
}
}
catch (Exception e)
{
return null;
}
}
return currentObj;
}
public static boolean test(Object finalObject,String option,Object exp)
{
if(option.equalsIgnoreCase("eq")||option.equalsIgnoreCase("equal")||option.equalsIgnoreCase("="))
return equal(exp,finalObject);
else if (option.equalsIgnoreCase("noteq")||option.equalsIgnoreCase("notequal")||option.equalsIgnoreCase("<>")||option.equalsIgnoreCase("!="))
return !equal(exp,finalObject);
else if (option.equalsIgnoreCase("gt")||option.equalsIgnoreCase(">"))
return gt(exp,finalObject);
else if (option.equalsIgnoreCase("lt")||option.equalsIgnoreCase("<"))
return lt(exp,finalObject);
else if (option.equalsIgnoreCase("gtandeq")||option.equalsIgnoreCase("ge")||option.equalsIgnoreCase(">="))
return ge(exp,finalObject);
else if (option.equalsIgnoreCase("ltandeq")||option.equalsIgnoreCase("le")||option.equalsIgnoreCase("<="))
return le(exp,finalObject);
else if (option.equalsIgnoreCase("null")||option.equalsIgnoreCase("isnull"))
return isNull(finalObject);
else if (option.equalsIgnoreCase("notnull")||option.equalsIgnoreCase("isnotnull"))
return isNotNull(finalObject);
else if (option.equalsIgnoreCase("like")||option.equalsIgnoreCase("matchor"))
return matchor(exp,finalObject);
else if (option.equalsIgnoreCase("leftlike")||option.equalsIgnoreCase("startswith")||option.equalsIgnoreCase("begin"))
return leftmatchor(exp,finalObject);
else if (option.equalsIgnoreCase("rightlike")||option.equalsIgnoreCase("endswith")||option.equalsIgnoreCase("end"))
return rightmatchor(exp,finalObject);
else if (option.equalsIgnoreCase("match")||option.equalsIgnoreCase("matchand")||option.equalsIgnoreCase("matches"))
return matchand(exp,finalObject);
else if (option.equalsIgnoreCase("in"))
return in(exp,finalObject);
else if (option.equalsIgnoreCase("notin"))
return notin(exp,finalObject);
else if (option.equalsIgnoreCase("NOTLIKE"))
return notmatchor(exp,finalObject);
else if (option.equalsIgnoreCase("LEFTNOTLIKE"))
return !leftmatchor(exp,finalObject);
else if (option.equalsIgnoreCase("RIGHTNOTLIKE"))
return !rightmatchor(exp,finalObject);
else if (option.equalsIgnoreCase("NOTMATCHES"))
return notmatchand(exp,finalObject);
else
return false;
}
public static boolean equal(Object exp, Object object, String members)
{
return equal(exp,getObj(object, members));
}
public static boolean equal(Object exp, Object finalObject)
{
if(exp==null)
return false;
if(finalObject ==null)
return false;
if(exp instanceof String && ((String) exp).length()==10 && finalObject instanceof Timestamp)
{
return dateFormat.format(finalObject).equals(exp);
}
else if(exp instanceof Timestamp && finalObject instanceof Timestamp)
{
return dateFormat.format(finalObject).equals(dateFormat.format(exp));
}
else if(finalObject instanceof Timestamp)
{
Timestamp tm=DataObject.getTimestampValue(exp,null);
if(tm == null) return false;
return ObjectUtils.nullSafeEquals(tm,finalObject);
}
if(ObjectUtils.nullSafeEquals(exp,finalObject))
return true;
if(exp.toString().equalsIgnoreCase(finalObject.toString()))
return true;
return false;
}
public static boolean gt(Object exp, Object object, String members)
{
return gt(exp,getObj(object, members));
}
public static boolean gt(Object exp, Object finalObject)
{
if(ObjectUtils.isEmpty(exp))
return false;
if(ObjectUtils.isEmpty(finalObject))
return false;
try
{
if(finalObject instanceof java.sql.Timestamp)
{
java.sql.Timestamp finalTime=(java.sql.Timestamp)finalObject;
Timestamp tm=null;
if (exp instanceof java.sql.Timestamp)
{
tm=(java.sql.Timestamp)exp;
}
else
{
tm=DataObject.getTimestampValue(exp,null);
if(tm==null)
return false;
}
return finalTime.getTime()>tm.getTime();
}
else if (finalObject instanceof Integer)
{
return ((Integer) finalObject) > DataObject.getIntegerValue(exp,Integer.MAX_VALUE);
}
else if (finalObject instanceof Double)
{
return ((Double) finalObject) > DataObject.getDoubleValue(exp,Double.MAX_VALUE);
}
else if (finalObject instanceof Float)
{
return ((Float) finalObject) > DataObject.getFloatValue(exp,Float.MAX_VALUE);
}
else if (finalObject instanceof BigDecimal)
{
return ((BigDecimal) finalObject).compareTo(DataObject.getBigDecimalValue(exp,BigDecimal.valueOf(Double.MAX_VALUE)))>0;
}
else if (finalObject instanceof BigInteger)
{
return ((BigInteger) finalObject).compareTo(DataObject.getBigIntegerValue(exp,BigInteger.valueOf(Long.MAX_VALUE)))>0;
}
else if (finalObject instanceof Long)
{
return ((Long) finalObject) > DataObject.getLongValue(exp,Long.MAX_VALUE);
}
else if (finalObject instanceof String)
{
return finalObject.toString().compareToIgnoreCase(exp.toString())>0;
}
else
return false;
}
catch(Exception ex)
{
return false;
}
}
public static boolean lt(Object exp, Object object, String members)
{
return lt(exp,getObj(object, members));
}
public static boolean lt(Object exp, Object finalObject)
{
if(ObjectUtils.isEmpty(exp))
return false;
if(ObjectUtils.isEmpty(finalObject))
return false;
try
{
if(finalObject instanceof java.sql.Timestamp)
{
java.sql.Timestamp finalTime=(java.sql.Timestamp)finalObject;
Timestamp tm=null;
if((exp instanceof String)&& (exp.toString().trim().length()==10))
{
tm=new Timestamp(dateFormat.parse(exp.toString().trim()).getTime());
}
else if (exp instanceof java.sql.Timestamp)
{
tm=(java.sql.Timestamp)exp;
}
else
{
return false;
}
return finalTime.getTime()<tm.getTime();
}
else if (finalObject instanceof Integer)
{
return (((Integer) finalObject).intValue() < ((Integer)exp).intValue());
}
else if (finalObject instanceof Double)
{
return (((Double) finalObject).doubleValue() < ((Double)exp).doubleValue());
}
else if (finalObject instanceof Float)
{
return (((Float) finalObject).floatValue() < ((Float)exp).floatValue());
}
else if (finalObject instanceof String)
{
return finalObject.toString().compareToIgnoreCase(exp.toString())<0;
}
else
return false;
}
catch(Exception ex)
{
return false;
}
}
public static boolean ge(Object exp, Object object, String members)
{
return ge(exp,getObj(object, members));
}
public static boolean ge(Object exp, Object finalObject)
{
return (!(lt(exp, finalObject)));
}
public static boolean le(Object exp, Object object, String members)
{
return le(exp,getObj(object, members));
}
public static boolean le(Object exp, Object finalObject)
{
return (!(gt(exp, finalObject)));
}
public static boolean notin(Object expObj, Object object, String members)
{
return notin(expObj,getObj(object, members));
}
public static boolean notin(Object expObj, Object finalObject)
{
return (!in(expObj,finalObject));
}
public static boolean in(Object expObj, Object object, String members)
{
return in(expObj,getObj(object, members));
}
public static boolean in(Object expObj, Object finalObject)
{
if (ObjectUtils.isEmpty(finalObject))
return false;
String tvs=expObj.toString().trim();
if(StringUtils.isEmpty(tvs))
return false;
if (finalObject instanceof Integer)
{
tvs="i:"+tvs;
}
else if (finalObject instanceof String)
{
tvs="s:"+tvs;
}
List acts = parseTvs(tvs);
for (Iterator localIterator = acts.iterator(); localIterator.hasNext();)
{
Object act = localIterator.next();
if (equal(act,finalObject))
return true;
}
return false;
}
public static boolean isNotNull(Object object, String members)
{
return isNotNull(getObj(object, members));
}
public static boolean isNotNull(Object finalObject)
{
return !isNull(finalObject);
}
public static boolean isNull(Object object, String members)
{
return isNull(getObj(object, members));
}
public static boolean isNull(Object finalObject)
{
if(finalObject instanceof String)
return StringUtils.isEmpty(finalObject.toString().trim());
return (ObjectUtils.isEmpty(finalObject));
}
public static boolean notmatchor(Object expObj, Object object, String members)
{
return notmatchor(expObj,getObj(object, members));
}
public static boolean notmatchor(Object expObj, Object obj)
{
return (!matchor(expObj,obj));
}
public static boolean notmatchand(Object expObj, Object object, String members)
{
return notmatchand(expObj,getObj(object, members));
}
public static boolean notmatchand(Object expObj, Object finalObject)
{
return (!matchand(expObj,finalObject));
}
public static boolean matchor(Object expObj,Object object,String members)
{
return matchor(expObj,getObj(object, members));
}
public static boolean matchor(Object expObj, Object obj)
{
if(obj==null)
return false;
String exp=expObj.toString().trim();
if(StringUtils.isEmpty(exp))
return false;
exp=exp.replace(";", ",");
exp=exp.replace(";", ",");
exp=exp.replace(",", ",");
String[] arr=exp.split(",");
boolean bRt=false;
for(String strExp:arr)
{
bRt=(obj.toString()).matches("(.*)"+(strExp)+"(.*)");
if(bRt)
return true;
}
return bRt;
}
public static boolean leftmatchor(Object expObj, Object obj)
{
if(obj==null)
return false;
String exp=expObj.toString().trim();
if(StringUtils.isEmpty(exp))
return false;
exp=exp.replace(";", ",");
exp=exp.replace(";", ",");
exp=exp.replace(",", ",");
String[] arr=exp.split(",");
boolean bRt=false;
for(String strExp:arr)
{
bRt=obj.toString().matches(strExp+"(.*)");
if(bRt)
return true;
}
return bRt;
}
public static boolean rightmatchor(Object expObj, Object obj)
{
if(obj==null)
return false;
String exp=expObj.toString().trim();
if(StringUtils.isEmpty(exp))
return false;
exp=exp.replace(";", ",");
exp=exp.replace(";", ",");
exp=exp.replace(",", ",");
String[] arr=exp.split(",");
boolean bRt=false;
for(String strExp:arr)
{
bRt=obj.toString().matches("(.*)"+strExp);
if(bRt)
return true;
}
return bRt;
}
public static boolean matchand(Object expObj,Object object,String members)
{
return matchand(expObj,getObj(object, members));
}
public static boolean matchand(Object expObj,Object obj)
{
if(obj==null)
return false;
if(expObj==null)
return false;
String exp=expObj.toString().trim();
if(StringUtils.isEmpty(exp))
return false;
exp=exp.replace(";", ",");
exp=exp.replace(";", ",");
exp=exp.replace(",", ",");
String[] arr=exp.split(",");
String objstr=obj.toString();
boolean bRt=true;
for(String strExp:arr)
{
if(strExp.trim().length()==0)
continue;
bRt=(obj.toString()).matches("(.*)"+(strExp)+"(.*)");
if(!bRt)
return false;
}
return bRt;
}
private static List<Object> parseTvs(String tvs)
{
tvs=tvs.replace(";", ",");
tvs=tvs.replace(";", ",");
tvs=tvs.replace(",", ",");
String[] arrayOfString1;
int j;
int k;
String value;
String type = "s";
String values = "";
String[] tv = tvs.split(":");
if(tv.length>1)
{
type = tv[0];
values = tv[1];
}
else
{
values=tvs;
}
List acts = new ArrayList();
String str1 = type;
int i = -1;
switch (str1.hashCode())
{
case 105:
if (str1.equals("i"))
i = 0;
break;
case 115:
if (str1.equals("s"))
i = 1;
}
switch (i)
{
case 0:
arrayOfString1 = values.split(",");
j = arrayOfString1.length;
for (k = 0; k < j; ++k)
{
value = arrayOfString1[k];
acts.add(new Integer(value.trim()));
}
break;
case 1:
arrayOfString1 = values.split(",");
j = arrayOfString1.length;
for (k = 0; k < j; ++k)
{
value = arrayOfString1[k];
acts.add(value.trim());
}
}
return acts;
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册