提交 77d1b188 编写于 作者: ibizdev's avatar ibizdev

ibiz4j 发布系统代码

上级 5ca37fb5
## v7.0.0-alpha.14 [2020-7-18]
### Bug修复
修复表格列千分位格式化
修复标签值格式化
修复表格转化数据错误问题
修复嵌套关系无数据时设置数据为空数组
### 功能新增及优化
#### 模板
新增编辑器插件
新增数据服务增加临时模式判断
新增支持实体行为定义检查方法
新增实体行为执行前、后逻辑
新增操作栏主状态无权限模式
优化开发环境错误提示友好性
优化应用菜单多层嵌套问题
#### 基础文件
优化popover组件
实体数据服务基类增加saveBatch方法
优化应用菜单多层嵌套问题
## v7.0.0-alpha.13 [2020-7-12]
### Bug修复
修复表格设置更新默认值不生效
修复行编辑中文本字段修改数据保存无法生效
修复行编辑时的错误提示
修复表格开关部件保存异常问题
修复表单可以修改数据主键问题
修复表格操作列问题
#### 基础文件
优化关系界面逻辑
## v7.0.0-alpha.12 [2020-7-2] ## v7.0.0-alpha.12 [2020-7-2]
### Bug修复 ### Bug修复
...@@ -14,6 +72,14 @@ ...@@ -14,6 +72,14 @@
修复多行输入十行 高度问题 修复多行输入十行 高度问题
修复调整实体处理逻辑(参数name转化为codeName)
修复表单项更新值规则校验
修复单位部门选择器禁用功能
修复修复去掉某个子菜单后,主菜单不显示
### 功能新增及优化 ### 功能新增及优化
#### 模板 #### 模板
...@@ -24,14 +90,28 @@ ...@@ -24,14 +90,28 @@
新增状态向导面板(658) 新增状态向导面板(658)
优化门户操作栏 新增门户操作栏图标(654)
新增首页空白模式支持
新增表格支持列拖动
优化应用级数据状态同步功能 新增主状态操作标识权限逻辑
新增工具栏、表格操作列、表单分组主状态操作标识判断
优化应用级数据状态同步功能(654)
优化应用国际化部分
#### 基础文件 #### 基础文件
新增修改密码功能(654) 新增修改密码功能(654)
优化无权限错误信息友好提示
优化应用国际化部分
## v7.0.0-alpha.11 [2020-6-21] ## v7.0.0-alpha.11 [2020-6-21]
### Bug修复 ### Bug修复
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
"@fullcalendar/vue": "^4.4.0", "@fullcalendar/vue": "^4.4.0",
"vuedraggable": "^2.23.2", "vuedraggable": "^2.23.2",
"async-validator": "^3.3.0", "async-validator": "^3.3.0",
"@popperjs/core": "^2.4.3",
"axios": "^0.19.1", "axios": "^0.19.1",
"core-js": "^3.4.4", "core-js": "^3.4.4",
"echarts": "^4.6.0", "echarts": "^4.6.0",
......
...@@ -78,6 +78,7 @@ import AppOrgSelect from './components/app-org-select/app-org-select.vue' ...@@ -78,6 +78,7 @@ import AppOrgSelect from './components/app-org-select/app-org-select.vue'
import AppDepartmentSelect from './components/app-department-select/app-department-select.vue' import AppDepartmentSelect from './components/app-department-select/app-department-select.vue'
import AppGroupSelect from './components/app-group-select/app-group-select.vue' import AppGroupSelect from './components/app-group-select/app-group-select.vue'
import UpdatePwd from './components/app-update-password/app-update-password.vue' import UpdatePwd from './components/app-update-password/app-update-password.vue'
import AppMenuItem from './components/app-menu-item/app-menu-item.vue'
// 全局挂载UI实体服务注册中心 // 全局挂载UI实体服务注册中心
window['uiServiceRegister'] = uiServiceRegister; window['uiServiceRegister'] = uiServiceRegister;
// 全局挂载实体权限服务注册中心 // 全局挂载实体权限服务注册中心
...@@ -168,5 +169,6 @@ export const AppComponents = { ...@@ -168,5 +169,6 @@ export const AppComponents = {
v.component('app-transfer',AppTransfer); v.component('app-transfer',AppTransfer);
v.component('context-menu-drag',ContextMenuDrag); v.component('context-menu-drag',ContextMenuDrag);
v.component('app-update-password',UpdatePwd); v.component('app-update-password',UpdatePwd);
v.component('app-menu-item', AppMenuItem);
}, },
}; };
\ No newline at end of file
<template> <template>
<div class="app-actionbar"> <div class="app-actionbar">
<div class="app-actionbar-item" v-for="(item,index) in items" :key="index"> <div class="app-actionbar-item" v-for="(item,index) in items" :key="index">
<Badge v-if="item.counterService&&item.counterService.counterData" :count="item.counterService.counterData[item.counterId]" type="primary"> <Badge v-if="item.counterService&&item.counterService.counterData" v-show="item.visabled" :count="item.counterService.counterData[item.counterId]" type="primary">
<i-button @click="handleClick(item.viewlogicname)"><i v-if="item.icon" style="margin-right: 5px;" :class="item.icon"></i>{{item.actionName}}</i-button> <i-button :style="{'pointer-events':item.disabled?'none':'auto'}" @click="handleClick(item.viewlogicname)"><i v-if="item.icon" style="margin-right: 5px;" :class="item.icon"></i>{{item.actionName}}</i-button>
</Badge> </Badge>
<i-button v-else @click="handleClick(item.viewlogicname)">{{item.actionName}}</i-button> <i-button v-show="item.visabled" :style="{'pointer-events':item.disabled?'none':'auto'}" v-else @click="handleClick(item.viewlogicname)">{{item.actionName}}</i-button>
</div> </div>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { Vue, Component, Prop, Model, Emit } from "vue-property-decorator"; import { Vue, Component, Prop, Model, Emit,Inject, Watch } from "vue-property-decorator";
import { Subject } from "rxjs"; import { Subject,Subscription } from "rxjs";
@Component({}) @Component({})
export default class AppActionBar extends Vue { export default class AppActionBar extends Vue {
...@@ -24,6 +24,49 @@ export default class AppActionBar extends Vue { ...@@ -24,6 +24,49 @@ export default class AppActionBar extends Vue {
*/ */
@Prop() public items!:any; @Prop() public items!:any;
/**
* 注入的UI服务
*
* @type {*}
* @memberof AppActionBar
*/
@Prop() public uiService!: any;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof AppActionBar
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof ActionlinetestBase
*/
public viewStateEvent: Subscription | undefined;
/**
* 组件初始化
*
* @memberof AppActionBar
*/
public created(){
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, "app-actionbar")) {
return;
}
if(Object.is(action,'loadmodel')){
this.calcActionItemAuthState(data,this.items,this.uiService);
}
});
}
}
/** /**
* 触发界面行为 * 触发界面行为
* *
...@@ -33,6 +76,52 @@ export default class AppActionBar extends Vue { ...@@ -33,6 +76,52 @@ export default class AppActionBar extends Vue {
this.$emit('itemClick',$event); this.$emit('itemClick',$event);
} }
/**
* 计算界面行为项权限状态
*
* @param {*} [data] 传入数据
* @param {*} [ActionModel] 界面行为模型
* @param {*} [UIService] 界面行为服务
* @memberof AppActionBar
*/
public calcActionItemAuthState(data:any,ActionModel:any,UIService:any){
for (const key in ActionModel) {
if (!ActionModel.hasOwnProperty(key)) {
return;
}
const _item = ActionModel[key];
if(_item && _item['dataaccaction'] && UIService && data && Object.keys(data).length >0){
let dataActionResult:any = UIService.getAllOPPrivs(data)[_item['dataaccaction']];
// 无权限:0;有权限:1
if(dataActionResult === 0){
// 禁用:1;隐藏:2;隐藏且默认隐藏:6
if(_item.noprivdisplaymode === 1){
_item.disabled = true;
}
if((_item.noprivdisplaymode === 2) || (_item.noprivdisplaymode === 6)){
_item.visabled = false;
}else{
_item.visabled = true;
}
}
if(dataActionResult === 1){
_item.visabled = true;
_item.disabled = false;
}
}
}
}
/**
* 组件销毁
*
* @memberof AppActionBar
*/
public destory(){
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
} }
</script> </script>
......
...@@ -161,6 +161,7 @@ export default class Breadcrumb extends Vue { ...@@ -161,6 +161,7 @@ export default class Breadcrumb extends Vue {
if(item && item.meta && item.meta.viewType && Object.is(item.meta.viewType,"APPINDEX")){ if(item && item.meta && item.meta.viewType && Object.is(item.meta.viewType,"APPINDEX")){
let path: string | null = window.sessionStorage.getItem(Environment.AppName); let path: string | null = window.sessionStorage.getItem(Environment.AppName);
if (path) { if (path) {
this.$store.commit("removeAllPage");
this.$router.push({ path: path }); this.$router.push({ path: path });
} else { } else {
this.$router.push("/"); this.$router.push("/");
......
...@@ -271,6 +271,7 @@ export default class AppFormDRUIPart extends Vue { ...@@ -271,6 +271,7 @@ export default class AppFormDRUIPart extends Vue {
//设置顶层视图唯一标识 //设置顶层视图唯一标识
Object.assign(tempContext,this.context); Object.assign(tempContext,this.context);
Object.assign(tempContext,{srfparentdename:this.parentName,srfparentkey:_paramitem}); Object.assign(tempContext,{srfparentdename:this.parentName,srfparentkey:_paramitem});
Object.assign(tempParam,{srfparentdename:this.parentName,srfparentkey:_paramitem});
// 设置局部上下文 // 设置局部上下文
if(this.localContext && Object.keys(this.localContext).length >0){ if(this.localContext && Object.keys(this.localContext).length >0){
let _context:any = this.$util.computedNavData(formData,tempContext,this.viewparams,this.localContext); let _context:any = this.$util.computedNavData(formData,tempContext,this.viewparams,this.localContext);
...@@ -292,9 +293,9 @@ export default class AppFormDRUIPart extends Vue { ...@@ -292,9 +293,9 @@ export default class AppFormDRUIPart extends Vue {
} }
} }
if(!this.isForbidLoad){ if(!this.isForbidLoad){
this.$nextTick(() => { setTimeout(() => {
this.formDruipart.next({action:'load',data:{srfparentdename:this.parentName,srfparentkey:_paramitem}}); this.formDruipart.next({action:'load',data:{srfparentdename:this.parentName,srfparentkey:_paramitem}});
}); }, 0);
} }
} }
......
...@@ -165,7 +165,7 @@ export default class AppFormGroup extends Vue { ...@@ -165,7 +165,7 @@ export default class AppFormGroup extends Vue {
if(_item && _item['dataaccaction'] && UIService && data && Object.keys(data).length >0){ if(_item && _item['dataaccaction'] && UIService && data && Object.keys(data).length >0){
let dataActionResult:any = UIService.getAllOPPrivs(data)[_item['dataaccaction']]; let dataActionResult:any = UIService.getAllOPPrivs(data)[_item['dataaccaction']];
// 无权限:0;有权限:1 // 无权限:0;有权限:1
if(!dataActionResult){ if(dataActionResult === 0){
// 禁用:1;隐藏:2;隐藏且默认隐藏:6 // 禁用:1;隐藏:2;隐藏且默认隐藏:6
if(_item.noprivdisplaymode === 1){ if(_item.noprivdisplaymode === 1){
_item.disabled = true; _item.disabled = true;
...@@ -175,7 +175,8 @@ export default class AppFormGroup extends Vue { ...@@ -175,7 +175,8 @@ export default class AppFormGroup extends Vue {
}else{ }else{
_item.visabled = true; _item.visabled = true;
} }
}else{ }
if(dataActionResult === 1){
_item.visabled = true; _item.visabled = true;
_item.disabled = false; _item.disabled = false;
} }
......
<template>
<div class="app-menu-item">
<template v-for="item in menus">
<template v-if="item.items && Array.isArray(item.items) && item.items.length > 0">
<el-submenu v-show="!item.hidden" :index="item.name" :popper-class="popperClass" :key="item.id">
<template slot='title'>
<template v-if="item.icon && item.icon != ''">
<img :src="item.icon" class='app-menu-icon' />
</template>
<template v-else-if="item.iconcls && item.iconcls != ''">
<i :class="[item.iconcls, 'app-menu-icon']"></i>
</template>
<template v-else>
<i v-if="isFirst" class='fa fa-cogs app-menu-icon'></i>
</template>
<span class='text' :title="$t(`app.menus.${ctrlName}.${item.name}`)">{{$t(`app.menus.${ctrlName}.${item.name}`)}}</span>
</template>
<app-menu-item :menus="item.items" :ctrlName="ctrlName" :isFirst="false" :counterdata="counterdata" :popperclass="popperClass"></app-menu-item>
</el-submenu>
</template>
<template v-else>
<template v-if="item.type =='MENUITEM'">
<el-menu-item v-show="!item.hidden" :index="item.name" :key="item.id">
<template v-if="item.icon && item.icon != ''">
<img :src="item.icon" class='app-menu-icon' />
</template>
<template v-else-if="item.iconcls && item.iconcls != ''">
<i :class="[item.iconcls, 'app-menu-icon']"></i>
</template>
<template v-else>
<i v-if="isFirst" class='fa fa-cogs app-menu-icon'></i>
</template>
<template slot="title">
<span class="text" :title="$t(`app.menus.${ctrlName}.${item.name}`)">{{$t(`app.menus.${ctrlName}.${item.name}`)}}</span>
<template v-if="counterdata && counterdata[item.counterid] && counterdata[item.counterid] > 0">
<span class="pull-right">
<badge :count="counterdata[item.counterid]" :overflow-count="9999"></badge>
</span>
</template>
</template>
</el-menu-item>
</template>
<template v-if="item.type =='SEPERATOR'">
<divider :key="item.id" />
</template>
</template>
</template>
</div>
</template>
<script lang="ts">
import { Component, Vue, Prop } from 'vue-property-decorator';
@Component({})
export default class AppMenuItem extends Vue {
/**
* 菜单数据
*
* @type {*}
* @memberof AppMenuItem
*/
@Prop( {default: []} ) public menus!: any;
/**
* 部件名称
*
* @type {*}
* @memberof AppMenuItem
*/
@Prop() public ctrlName!: string;
/**
* 计数器数据
*
* @type {*}
* @memberof AppMenuItem
*/
@Prop() public counterdata!: any;
/**
* 提示框主题样式
*
* @type {*}
* @memberof AppMenuItem
*/
@Prop() public popperClass!: any;
/**
* 是否是一级菜单
*
* @type {*}
* @memberof AppMenuItem
*/
@Prop() public isFirst!: boolean;
}
</script>
\ No newline at end of file
...@@ -242,7 +242,7 @@ export default class AppPicker extends Vue { ...@@ -242,7 +242,7 @@ export default class AppPicker extends Vue {
* @param {*} oldVal * @param {*} oldVal
* @memberof AppPicker * @memberof AppPicker
*/ */
@Watch('value') @Watch('value',{immediate:true})
public onValueChange(newVal: any, oldVal: any) { public onValueChange(newVal: any, oldVal: any) {
this.curvalue = newVal; this.curvalue = newVal;
if (Object.is(this.editortype, 'dropdown') && this.valueitem) { if (Object.is(this.editortype, 'dropdown') && this.valueitem) {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<script lang="ts"> <script lang="ts">
import { Vue, Component, Prop, Watch, Model } from 'vue-property-decorator'; import { Vue, Component, Prop, Watch, Model } from 'vue-property-decorator';
import moment from "moment";
@Component({}) @Component({})
export default class AppSpan extends Vue { export default class AppSpan extends Vue {
...@@ -18,6 +18,38 @@ export default class AppSpan extends Vue { ...@@ -18,6 +18,38 @@ export default class AppSpan extends Vue {
*/ */
@Prop() public value?: any; @Prop() public value?: any;
/**
* 数据类型
*
* @type {string}
* @memberof AppSpan
*/
@Prop() public dataType?: string;
/**
* 单位名称
*
* @type {string}
* @memberof AppSpan
*/
@Prop({default:''}) public unitName?: string;
/**
* 精度
*
* @type {number}
* @memberof AppSpan
*/
@Prop({default:'2'}) public precision?:number;
/**
* 日期值格式化
*
* @type {string}
* @memberof AppSpan
*/
@Prop() public valueFormat?: string;
/** /**
* 当前表单项名称 * 当前表单项名称
* *
...@@ -158,12 +190,52 @@ export default class AppSpan extends Vue { ...@@ -158,12 +190,52 @@ export default class AppSpan extends Vue {
}else{ }else{
if(this.$util.isEmpty(this.value)){ if(this.$util.isEmpty(this.value)){
this.text = ''; this.text = '';
}else if(this.dataType){
this.dataFormat();
}else{ }else{
this.text = this.value; this.text = this.value;
} }
}
}
/**
* 数据格式化
*
* @memberof AppSpan
*/
public dataFormat(){
if(this.valueFormat){
this.dateFormat() ;
return;
}
if(Object.is(this.dataType,"CURRENCY")){
let number:any = Number(this.value);
this.text = Number(number.toFixed(this.precision)).toLocaleString('en-US')+ ' '+ this.unitName;
}else if(Object.is(this.dataType,"FLOAT") || Object.is(this.dataType,"DECIMAL")){
let number:any = Number(this.value);
this.text = number.toFixed(this.precision);
}else {
this.text = this.value;
} }
} }
/**
* 日期格式化
*
* @memberof AppSpan
*/
public dateFormat(){
if(this.valueFormat){
if(this.valueFormat.indexOf('%1$t') !== -1){
this.text= moment(this.data).format("YYYY-MM-DD HH:mm:ss");
}else if(this.valueFormat.indexOf('%1$s') == -1){
this.text= moment(this.data).format(this.valueFormat);
}else{
this.text= this.value;
}
}
}
} }
</script> </script>
......
...@@ -7,8 +7,7 @@ ...@@ -7,8 +7,7 @@
:precision="precision" :precision="precision"
v-model="CurrentVal" v-model="CurrentVal"
:disabled="disabled ? true : false" :disabled="disabled ? true : false"
:formatter="formatter" :active-change="false"
:parser="parser"
></InputNumber> ></InputNumber>
<i-input v-else <i-input v-else
:placeholder="placeholder" :placeholder="placeholder"
...@@ -188,29 +187,7 @@ export default class InputBox extends Vue { ...@@ -188,29 +187,7 @@ export default class InputBox extends Vue {
} }
} }
/**
* 指定输入框展示值的格式
*/
public formatter(value:any){
if(this.precision===0) return this.CurrentVal;
if(value.indexOf('.')!==-1){
let arr:Array<any> = value.split('.');
if(arr[1]==='00'){
return arr[0];
}
if(parseInt(arr[1])%10===0){
return arr[0]+'.'+parseInt(arr[1])/10;
}
}
return value;
}
/**
* 指定从 formatter 里转换回数字的方式
*/
public parser(value:any){
return value;
}
} }
</script> </script>
......
...@@ -193,7 +193,7 @@ export default class ViewEngine { ...@@ -193,7 +193,7 @@ export default class ViewEngine {
if(_item && _item['dataaccaction'] && _this.view.appUIService && data && Object.keys(data).length >0){ if(_item && _item['dataaccaction'] && _this.view.appUIService && data && Object.keys(data).length >0){
let dataActionResult:any = _this.view.appUIService.getAllOPPrivs(data)[_item['dataaccaction']]; let dataActionResult:any = _this.view.appUIService.getAllOPPrivs(data)[_item['dataaccaction']];
// 无权限:0;有权限:1 // 无权限:0;有权限:1
if(!dataActionResult){ if(dataActionResult === 0){
// 禁用:1;隐藏:2;隐藏且默认隐藏:6 // 禁用:1;隐藏:2;隐藏且默认隐藏:6
if(_item.noprivdisplaymode === 1){ if(_item.noprivdisplaymode === 1){
_this.view.toolBarModels[key].disabled = true; _this.view.toolBarModels[key].disabled = true;
...@@ -203,8 +203,10 @@ export default class ViewEngine { ...@@ -203,8 +203,10 @@ export default class ViewEngine {
}else{ }else{
_this.view.toolBarModels[key].visabled = true; _this.view.toolBarModels[key].visabled = true;
} }
}else{ }
if(dataActionResult === 1){
_this.view.toolBarModels[key].visabled = true; _this.view.toolBarModels[key].visabled = true;
_this.view.toolBarModels[key].disabled = false;
} }
} }
} }
......
...@@ -146,7 +146,7 @@ export default class DictCatalogEditViewBase extends Vue { ...@@ -146,7 +146,7 @@ export default class DictCatalogEditViewBase extends Vue {
public appEntityService: DictCatalogService = new DictCatalogService; public appEntityService: DictCatalogService = new DictCatalogService;
/** /**
* 实体权限服务对象 * 实体UI服务对象
* *
* @type DictCatalogUIService * @type DictCatalogUIService
* @memberof DictCatalogEditViewBase * @memberof DictCatalogEditViewBase
......
...@@ -168,7 +168,7 @@ export default class DictCatalogGridViewBase extends Vue { ...@@ -168,7 +168,7 @@ export default class DictCatalogGridViewBase extends Vue {
public appEntityService: DictCatalogService = new DictCatalogService; public appEntityService: DictCatalogService = new DictCatalogService;
/** /**
* 实体权限服务对象 * 实体UI服务对象
* *
* @type DictCatalogUIService * @type DictCatalogUIService
* @memberof DictCatalogGridViewBase * @memberof DictCatalogGridViewBase
...@@ -1367,7 +1367,7 @@ export default class DictCatalogGridViewBase extends Vue { ...@@ -1367,7 +1367,7 @@ export default class DictCatalogGridViewBase extends Vue {
public NewRow(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) { public NewRow(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this; const _this: any = this;
const data: any = {}; const data: any = {};
if (_this.newRow && _this.newRow instanceof Function) { if (_this.hasOwnProperty('newRow') && _this.newRow instanceof Function) {
_this.newRow([{ ...data }], params, $event, xData); _this.newRow([{ ...data }], params, $event, xData);
} else if(xData.newRow && xData.newRow instanceof Function) { } else if(xData.newRow && xData.newRow instanceof Function) {
xData.newRow([{ ...data }], params, $event, xData); xData.newRow([{ ...data }], params, $event, xData);
......
...@@ -73,7 +73,7 @@ export default class DictCatalogPickupGridViewBase extends Vue { ...@@ -73,7 +73,7 @@ export default class DictCatalogPickupGridViewBase extends Vue {
public appEntityService: DictCatalogService = new DictCatalogService; public appEntityService: DictCatalogService = new DictCatalogService;
/** /**
* 实体权限服务对象 * 实体UI服务对象
* *
* @type DictCatalogUIService * @type DictCatalogUIService
* @memberof DictCatalogPickupGridViewBase * @memberof DictCatalogPickupGridViewBase
......
...@@ -58,7 +58,7 @@ export default class DictCatalogPickupViewBase extends Vue { ...@@ -58,7 +58,7 @@ export default class DictCatalogPickupViewBase extends Vue {
public appEntityService: DictCatalogService = new DictCatalogService; public appEntityService: DictCatalogService = new DictCatalogService;
/** /**
* 实体权限服务对象 * 实体UI服务对象
* *
* @type DictCatalogUIService * @type DictCatalogUIService
* @memberof DictCatalogPickupViewBase * @memberof DictCatalogPickupViewBase
...@@ -661,6 +661,7 @@ export default class DictCatalogPickupViewBase extends Vue { ...@@ -661,6 +661,7 @@ export default class DictCatalogPickupViewBase extends Vue {
* @memberof DictCatalogPickupViewBase * @memberof DictCatalogPickupViewBase
*/ */
public onClickCancel(): void { public onClickCancel(): void {
this.$emit('viewdataschange', null);
this.$emit('close', null); this.$emit('close', null);
} }
......
...@@ -83,7 +83,7 @@ export default class DictOptionEditViewBase extends Vue { ...@@ -83,7 +83,7 @@ export default class DictOptionEditViewBase extends Vue {
public appEntityService: DictOptionService = new DictOptionService; public appEntityService: DictOptionService = new DictOptionService;
/** /**
* 实体权限服务对象 * 实体UI服务对象
* *
* @type DictOptionUIService * @type DictOptionUIService
* @memberof DictOptionEditViewBase * @memberof DictOptionEditViewBase
......
...@@ -155,7 +155,7 @@ export default class DictOptionGridEditViewBase extends Vue { ...@@ -155,7 +155,7 @@ export default class DictOptionGridEditViewBase extends Vue {
public appEntityService: DictOptionService = new DictOptionService; public appEntityService: DictOptionService = new DictOptionService;
/** /**
* 实体权限服务对象 * 实体UI服务对象
* *
* @type DictOptionUIService * @type DictOptionUIService
* @memberof DictOptionGridEditViewBase * @memberof DictOptionGridEditViewBase
...@@ -1359,7 +1359,7 @@ export default class DictOptionGridEditViewBase extends Vue { ...@@ -1359,7 +1359,7 @@ export default class DictOptionGridEditViewBase extends Vue {
public NewRow(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) { public NewRow(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this; const _this: any = this;
const data: any = {}; const data: any = {};
if (_this.newRow && _this.newRow instanceof Function) { if (_this.hasOwnProperty('newRow') && _this.newRow instanceof Function) {
_this.newRow([{ ...data }], params, $event, xData); _this.newRow([{ ...data }], params, $event, xData);
} else if(xData.newRow && xData.newRow instanceof Function) { } else if(xData.newRow && xData.newRow instanceof Function) {
xData.newRow([{ ...data }], params, $event, xData); xData.newRow([{ ...data }], params, $event, xData);
......
...@@ -155,7 +155,7 @@ export default class DictOptionGridViewBase extends Vue { ...@@ -155,7 +155,7 @@ export default class DictOptionGridViewBase extends Vue {
public appEntityService: DictOptionService = new DictOptionService; public appEntityService: DictOptionService = new DictOptionService;
/** /**
* 实体权限服务对象 * 实体UI服务对象
* *
* @type DictOptionUIService * @type DictOptionUIService
* @memberof DictOptionGridViewBase * @memberof DictOptionGridViewBase
...@@ -1359,7 +1359,7 @@ export default class DictOptionGridViewBase extends Vue { ...@@ -1359,7 +1359,7 @@ export default class DictOptionGridViewBase extends Vue {
public NewRow(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) { public NewRow(args: any[],contextJO?:any, params?: any, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
const _this: any = this; const _this: any = this;
const data: any = {}; const data: any = {};
if (_this.newRow && _this.newRow instanceof Function) { if (_this.hasOwnProperty('newRow') && _this.newRow instanceof Function) {
_this.newRow([{ ...data }], params, $event, xData); _this.newRow([{ ...data }], params, $event, xData);
} else if(xData.newRow && xData.newRow instanceof Function) { } else if(xData.newRow && xData.newRow instanceof Function) {
xData.newRow([{ ...data }], params, $event, xData); xData.newRow([{ ...data }], params, $event, xData);
......
...@@ -48,7 +48,9 @@ export default class DictCatalogServiceBase extends EntityService { ...@@ -48,7 +48,9 @@ export default class DictCatalogServiceBase extends EntityService {
* @memberof DictCatalogServiceBase * @memberof DictCatalogServiceBase
*/ */
public async Select(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Select(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
return Http.getInstance().get(`/dictcatalogs/${context.dictcatalog}/select`,isloading); let res:any = Http.getInstance().get(`/dictcatalogs/${context.dictcatalog}/select`,isloading);
return res;
} }
/** /**
...@@ -62,21 +64,6 @@ export default class DictCatalogServiceBase extends EntityService { ...@@ -62,21 +64,6 @@ export default class DictCatalogServiceBase extends EntityService {
*/ */
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {}; let masterData:any = {};
let dictoptionsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_dictoptions'),'undefined')){
dictoptionsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_dictoptions') as any);
if(dictoptionsData && dictoptionsData.length && dictoptionsData.length > 0){
dictoptionsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.value_key = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.dictoptions = dictoptionsData;
Object.assign(data,masterData); Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){ if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null; data[this.APPDEKEY] = null;
...@@ -86,7 +73,8 @@ export default class DictCatalogServiceBase extends EntityService { ...@@ -86,7 +73,8 @@ export default class DictCatalogServiceBase extends EntityService {
} }
let tempContext:any = JSON.parse(JSON.stringify(context)); let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/dictcatalogs`,data,isloading); let res:any = await Http.getInstance().post(`/dictcatalogs`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_dictoptions',JSON.stringify(res.data.dictoptions)); this.tempStorage.setItem(tempContext.srfsessionkey+'_dictoptions',JSON.stringify(res.data.dictoptions?res.data.dictoptions:[]));
return res; return res;
} }
...@@ -101,24 +89,9 @@ export default class DictCatalogServiceBase extends EntityService { ...@@ -101,24 +89,9 @@ export default class DictCatalogServiceBase extends EntityService {
*/ */
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {}; let masterData:any = {};
let dictoptionsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_dictoptions'),'undefined')){
dictoptionsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_dictoptions') as any);
if(dictoptionsData && dictoptionsData.length && dictoptionsData.length > 0){
dictoptionsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.value_key = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.dictoptions = dictoptionsData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/dictcatalogs/${context.dictcatalog}`,data,isloading); let res:any = await Http.getInstance().put(`/dictcatalogs/${context.dictcatalog}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_dictoptions',JSON.stringify(res.data.dictoptions));
return res; return res;
} }
...@@ -132,7 +105,8 @@ export default class DictCatalogServiceBase extends EntityService { ...@@ -132,7 +105,8 @@ export default class DictCatalogServiceBase extends EntityService {
* @memberof DictCatalogServiceBase * @memberof DictCatalogServiceBase
*/ */
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
return Http.getInstance().delete(`/dictcatalogs/${context.dictcatalog}`,isloading); let res:any = Http.getInstance().delete(`/dictcatalogs/${context.dictcatalog}`,isloading);
return res;
} }
/** /**
...@@ -146,7 +120,7 @@ export default class DictCatalogServiceBase extends EntityService { ...@@ -146,7 +120,7 @@ export default class DictCatalogServiceBase extends EntityService {
*/ */
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/dictcatalogs/${context.dictcatalog}`,isloading); let res:any = await Http.getInstance().get(`/dictcatalogs/${context.dictcatalog}`,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_dictoptions',JSON.stringify(res.data.dictoptions));
return res; return res;
} }
...@@ -162,7 +136,7 @@ export default class DictCatalogServiceBase extends EntityService { ...@@ -162,7 +136,7 @@ export default class DictCatalogServiceBase extends EntityService {
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/dictcatalogs/getdraft`,isloading); let res:any = await Http.getInstance().get(`/dictcatalogs/getdraft`,isloading);
res.data.dictcatalog = data.dictcatalog; res.data.dictcatalog = data.dictcatalog;
this.tempStorage.setItem(context.srfsessionkey+'_dictoptions',JSON.stringify(res.data.dictoptions));
return res; return res;
} }
...@@ -176,7 +150,8 @@ export default class DictCatalogServiceBase extends EntityService { ...@@ -176,7 +150,8 @@ export default class DictCatalogServiceBase extends EntityService {
* @memberof DictCatalogServiceBase * @memberof DictCatalogServiceBase
*/ */
public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
return Http.getInstance().post(`/dictcatalogs/${context.dictcatalog}/checkkey`,data,isloading); let res:any = Http.getInstance().post(`/dictcatalogs/${context.dictcatalog}/checkkey`,data,isloading);
return res;
} }
/** /**
...@@ -190,24 +165,9 @@ export default class DictCatalogServiceBase extends EntityService { ...@@ -190,24 +165,9 @@ export default class DictCatalogServiceBase extends EntityService {
*/ */
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {}; let masterData:any = {};
let dictoptionsData:any = [];
if(!Object.is(this.tempStorage.getItem(context.srfsessionkey+'_dictoptions'),'undefined')){
dictoptionsData = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_dictoptions') as any);
if(dictoptionsData && dictoptionsData.length && dictoptionsData.length > 0){
dictoptionsData.forEach((item:any) => {
if(item.srffrontuf){
if(Object.is(item.srffrontuf,"0")){
item.value_key = null;
}
delete item.srffrontuf;
}
});
}
}
masterData.dictoptions = dictoptionsData;
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/dictcatalogs/${context.dictcatalog}/save`,data,isloading); let res:any = await Http.getInstance().post(`/dictcatalogs/${context.dictcatalog}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_dictoptions',JSON.stringify(res.data.dictoptions));
return res; return res;
} }
...@@ -222,6 +182,7 @@ export default class DictCatalogServiceBase extends EntityService { ...@@ -222,6 +182,7 @@ export default class DictCatalogServiceBase extends EntityService {
*/ */
public async FetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async FetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let tempData:any = JSON.parse(JSON.stringify(data)); let tempData:any = JSON.parse(JSON.stringify(data));
return Http.getInstance().get(`/dictcatalogs/fetchdefault`,tempData,isloading); let res:any = Http.getInstance().get(`/dictcatalogs/fetchdefault`,tempData,isloading);
return res;
} }
} }
\ No newline at end of file
...@@ -49,9 +49,13 @@ export default class DictOptionServiceBase extends EntityService { ...@@ -49,9 +49,13 @@ export default class DictOptionServiceBase extends EntityService {
*/ */
public async Select(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Select(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.dictcatalog && context.dictoption){ if(context.dictcatalog && context.dictoption){
return Http.getInstance().get(`/dictcatalogs/${context.dictcatalog}/dictoptions/${context.dictoption}/select`,isloading); let res:any = Http.getInstance().get(`/dictcatalogs/${context.dictcatalog}/dictoptions/${context.dictoption}/select`,isloading);
return res;
} }
return Http.getInstance().get(`/dictoptions/${context.dictoption}/select`,isloading); let res:any = Http.getInstance().get(`/dictoptions/${context.dictoption}/select`,isloading);
return res;
} }
/** /**
...@@ -75,6 +79,7 @@ export default class DictOptionServiceBase extends EntityService { ...@@ -75,6 +79,7 @@ export default class DictOptionServiceBase extends EntityService {
} }
let tempContext:any = JSON.parse(JSON.stringify(context)); let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/dictcatalogs/${context.dictcatalog}/dictoptions`,data,isloading); let res:any = await Http.getInstance().post(`/dictcatalogs/${context.dictcatalog}/dictoptions`,data,isloading);
return res; return res;
} }
let masterData:any = {}; let masterData:any = {};
...@@ -87,6 +92,7 @@ export default class DictOptionServiceBase extends EntityService { ...@@ -87,6 +92,7 @@ export default class DictOptionServiceBase extends EntityService {
} }
let tempContext:any = JSON.parse(JSON.stringify(context)); let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/dictoptions`,data,isloading); let res:any = await Http.getInstance().post(`/dictoptions`,data,isloading);
return res; return res;
} }
...@@ -104,11 +110,13 @@ export default class DictOptionServiceBase extends EntityService { ...@@ -104,11 +110,13 @@ export default class DictOptionServiceBase extends EntityService {
let masterData:any = {}; let masterData:any = {};
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/dictcatalogs/${context.dictcatalog}/dictoptions/${context.dictoption}`,data,isloading); let res:any = await Http.getInstance().put(`/dictcatalogs/${context.dictcatalog}/dictoptions/${context.dictoption}`,data,isloading);
return res; return res;
} }
let masterData:any = {}; let masterData:any = {};
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/dictoptions/${context.dictoption}`,data,isloading); let res:any = await Http.getInstance().put(`/dictoptions/${context.dictoption}`,data,isloading);
return res; return res;
} }
...@@ -123,9 +131,11 @@ export default class DictOptionServiceBase extends EntityService { ...@@ -123,9 +131,11 @@ export default class DictOptionServiceBase extends EntityService {
*/ */
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.dictcatalog && context.dictoption){ if(context.dictcatalog && context.dictoption){
return Http.getInstance().delete(`/dictcatalogs/${context.dictcatalog}/dictoptions/${context.dictoption}`,isloading); let res:any = Http.getInstance().delete(`/dictcatalogs/${context.dictcatalog}/dictoptions/${context.dictoption}`,isloading);
return res;
} }
return Http.getInstance().delete(`/dictoptions/${context.dictoption}`,isloading); let res:any = Http.getInstance().delete(`/dictoptions/${context.dictoption}`,isloading);
return res;
} }
/** /**
...@@ -140,9 +150,11 @@ export default class DictOptionServiceBase extends EntityService { ...@@ -140,9 +150,11 @@ export default class DictOptionServiceBase extends EntityService {
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.dictcatalog && context.dictoption){ if(context.dictcatalog && context.dictoption){
let res:any = await Http.getInstance().get(`/dictcatalogs/${context.dictcatalog}/dictoptions/${context.dictoption}`,isloading); let res:any = await Http.getInstance().get(`/dictcatalogs/${context.dictcatalog}/dictoptions/${context.dictoption}`,isloading);
return res; return res;
} }
let res:any = await Http.getInstance().get(`/dictoptions/${context.dictoption}`,isloading); let res:any = await Http.getInstance().get(`/dictoptions/${context.dictoption}`,isloading);
return res; return res;
} }
...@@ -159,10 +171,12 @@ export default class DictOptionServiceBase extends EntityService { ...@@ -159,10 +171,12 @@ export default class DictOptionServiceBase extends EntityService {
if(context.dictcatalog && true){ if(context.dictcatalog && true){
let res:any = await Http.getInstance().get(`/dictcatalogs/${context.dictcatalog}/dictoptions/getdraft`,isloading); let res:any = await Http.getInstance().get(`/dictcatalogs/${context.dictcatalog}/dictoptions/getdraft`,isloading);
res.data.dictoption = data.dictoption; res.data.dictoption = data.dictoption;
return res; return res;
} }
let res:any = await Http.getInstance().get(`/dictoptions/getdraft`,isloading); let res:any = await Http.getInstance().get(`/dictoptions/getdraft`,isloading);
res.data.dictoption = data.dictoption; res.data.dictoption = data.dictoption;
return res; return res;
} }
...@@ -180,9 +194,11 @@ export default class DictOptionServiceBase extends EntityService { ...@@ -180,9 +194,11 @@ export default class DictOptionServiceBase extends EntityService {
let masterData:any = {}; let masterData:any = {};
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/dictcatalogs/${context.dictcatalog}/dictoptions/${context.dictoption}/checkkey`,data,isloading); let res:any = await Http.getInstance().post(`/dictcatalogs/${context.dictcatalog}/dictoptions/${context.dictoption}/checkkey`,data,isloading);
return res; return res;
} }
return Http.getInstance().post(`/dictoptions/${context.dictoption}/checkkey`,data,isloading); let res:any = Http.getInstance().post(`/dictoptions/${context.dictoption}/checkkey`,data,isloading);
return res;
} }
/** /**
...@@ -199,11 +215,13 @@ export default class DictOptionServiceBase extends EntityService { ...@@ -199,11 +215,13 @@ export default class DictOptionServiceBase extends EntityService {
let masterData:any = {}; let masterData:any = {};
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/dictcatalogs/${context.dictcatalog}/dictoptions/${context.dictoption}/save`,data,isloading); let res:any = await Http.getInstance().post(`/dictcatalogs/${context.dictcatalog}/dictoptions/${context.dictoption}/save`,data,isloading);
return res; return res;
} }
let masterData:any = {}; let masterData:any = {};
Object.assign(data,masterData); Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/dictoptions/${context.dictoption}/save`,data,isloading); let res:any = await Http.getInstance().post(`/dictoptions/${context.dictoption}/save`,data,isloading);
return res; return res;
} }
...@@ -219,9 +237,11 @@ export default class DictOptionServiceBase extends EntityService { ...@@ -219,9 +237,11 @@ export default class DictOptionServiceBase extends EntityService {
public async FetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async FetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.dictcatalog && true){ if(context.dictcatalog && true){
let tempData:any = JSON.parse(JSON.stringify(data)); let tempData:any = JSON.parse(JSON.stringify(data));
return Http.getInstance().get(`/dictcatalogs/${context.dictcatalog}/dictoptions/fetchdefault`,tempData,isloading); let res:any = Http.getInstance().get(`/dictcatalogs/${context.dictcatalog}/dictoptions/fetchdefault`,tempData,isloading);
return res;
} }
let tempData:any = JSON.parse(JSON.stringify(data)); let tempData:any = JSON.parse(JSON.stringify(data));
return Http.getInstance().get(`/dictoptions/fetchdefault`,tempData,isloading); let res:any = Http.getInstance().get(`/dictoptions/fetchdefault`,tempData,isloading);
return res;
} }
} }
\ No newline at end of file
...@@ -294,7 +294,8 @@ export default class EntityService { ...@@ -294,7 +294,8 @@ export default class EntityService {
let result:any = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_'+this.APPDENAME) as any); let result:any = JSON.parse(this.tempStorage.getItem(context.srfsessionkey+'_'+this.APPDENAME) as any);
if(result){ if(result){
let tempResult:any = result.filter((item:any) =>{ let tempResult:any = result.filter((item:any) =>{
return !( Object.is(item[this.APPDEKEY],data[this.APPDEKEY]) && Object.is(item[this.APPDETEXT],data[this.APPDETEXT])); // return !( Object.is(item[this.APPDEKEY],data[this.APPDEKEY]) && Object.is(item[this.APPDETEXT],data[this.APPDETEXT]));
return !Object.is(item[this.APPDEKEY],data[this.APPDEKEY]);
}) })
this.tempStorage.setItem(context.srfsessionkey+'_'+this.APPDENAME,JSON.stringify(tempResult)); this.tempStorage.setItem(context.srfsessionkey+'_'+this.APPDENAME,JSON.stringify(tempResult));
return {"status":200,"data":data}; return {"status":200,"data":data};
...@@ -596,6 +597,19 @@ export default class EntityService { ...@@ -596,6 +597,19 @@ export default class EntityService {
return Http.getInstance().post(`/${this.APPDENAME}/batch`,data,isloading); return Http.getInstance().post(`/${this.APPDENAME}/batch`,data,isloading);
} }
/**
* saveBatch接口方法
*
* @param {*} [context={}]
* @param {*} [data]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof EntityService
*/
public async saveBatch(context: any = {},data: any, isloading?: boolean): Promise<any> {
return Http.getInstance().post(`/${this.APPDENAME}/savebatch`,data,isloading);
}
/** /**
* updateBatch接口方法 * updateBatch接口方法
* *
......
...@@ -202,7 +202,7 @@ export default class DictCatalogUIServiceBase extends UIService { ...@@ -202,7 +202,7 @@ export default class DictCatalogUIServiceBase extends UIService {
this.mainStateFields.forEach((singleMainField:any) =>{ this.mainStateFields.forEach((singleMainField:any) =>{
if(!(singleMainField in curData)){ if(!(singleMainField in curData)){
console.error(`当前数据对象不包含属性singleMainField,可能会发生错误`); console.warn(`当前数据对象不包含属性${singleMainField},可能会发生错误`);
} }
}) })
for (let i = 0; i <= 1; i++) { for (let i = 0; i <= 1; i++) {
......
...@@ -201,7 +201,7 @@ export default class DictOptionUIServiceBase extends UIService { ...@@ -201,7 +201,7 @@ export default class DictOptionUIServiceBase extends UIService {
this.mainStateFields.forEach((singleMainField:any) =>{ this.mainStateFields.forEach((singleMainField:any) =>{
if(!(singleMainField in curData)){ if(!(singleMainField in curData)){
console.error(`当前数据对象不包含属性singleMainField,可能会发生错误`); console.warn(`当前数据对象不包含属性${singleMainField},可能会发生错误`);
} }
}) })
for (let i = 0; i <= 1; i++) { for (let i = 0; i <= 1; i++) {
......
.el-popover { .app-popover-wrapper {
overflow-y: auto; position: absolute;
//z-index: 99 !important; top: 0;
background: #ffffff; right: 0;
border: 1px solid #dee0e4; bottom: 0;
padding: 0px; left: 0;
z-index: 2000;
color: var(--app-color-font-content); .app-popover.app-popper {
line-height: 1.4; border-radius: 5px;
text-align: justify; overflow: auto;
font-size: 14px; border: 1px solid #bfbfbf;
overflow-y: hidden; padding: 5px;
overflow-x: hidden; background: #e8e8e8;
.el-card__header { }
padding: 5px 10px;
border-bottom: 1px solid #dee0e4;
color: var(--app-color-font-content);
}
.el-card{
min-width: 150px;
border: none;
background-color: #ffffff;
color: var(--app-color-font-content);
}
.el-card__body {
padding: 0px;
overflow-x:hidden;
overflow-y: auto;
.viewcontainer2{
.content-container{
margin: 0;
}
}
}
}
.clearfix{
position: relative;
.cancel{
position: absolute;
right: 5px;
top: 5px;
}
} }
\ No newline at end of file
import Vue, { CreateElement } from 'vue'; import Vue, { CreateElement } from 'vue';
import PopperJs from 'popper.js'; import { Subject, Observable } from 'rxjs';
import { createPopper, Instance } from '@popperjs/core/lib/popper-lite.js';
import preventOverflow from '@popperjs/core/lib/modifiers/preventOverflow.js';
import flip from '@popperjs/core/lib/modifiers/flip.js';
import { Placement } from '@popperjs/core/lib/enums';
import { on } from '../dom/dom'; import { on } from '../dom/dom';
import './app-popover.less';
import { ViewTool } from '../view-tool/view-tool';
import store from '../../store'; import store from '../../store';
import i18n from '@/locale'; import i18n from '@/locale';
import './app-popover.less';
import { Subject } from 'rxjs';
/** /**
* 悬浮窗控制器实例 * 悬浮窗控制器实例
...@@ -24,6 +24,7 @@ export class AppPopover { ...@@ -24,6 +24,7 @@ export class AppPopover {
* @memberof AppPopover * @memberof AppPopover
*/ */
private static readonly $popover = new AppPopover(); private static readonly $popover = new AppPopover();
/** /**
* vue实例 * vue实例
* *
...@@ -32,14 +33,16 @@ export class AppPopover { ...@@ -32,14 +33,16 @@ export class AppPopover {
* @memberof AppPopover * @memberof AppPopover
*/ */
private vueExample!: Vue; private vueExample!: Vue;
/** /**
* PopperJs实例 * PopperJs实例
* *
* @private * @private
* @type {PopperJs} * @type {Instance}
* @memberof AppPopover * @memberof AppPopover
*/ */
private popperExample?: PopperJs; private popperExample?: Instance;
/** /**
* 是否显示悬浮窗 * 是否显示悬浮窗
* *
...@@ -48,6 +51,7 @@ export class AppPopover { ...@@ -48,6 +51,7 @@ export class AppPopover {
* @memberof AppPopover * @memberof AppPopover
*/ */
private showPopper: boolean = false; private showPopper: boolean = false;
/** /**
* 是否在点击空白区域时自动关闭 * 是否在点击空白区域时自动关闭
* *
...@@ -56,33 +60,15 @@ export class AppPopover { ...@@ -56,33 +60,15 @@ export class AppPopover {
* @memberof AppPopover * @memberof AppPopover
*/ */
private isAutoClose: boolean = true; private isAutoClose: boolean = true;
/**
* 当前激活popver标识
*
* @private
* @type {string}
* @memberof AppPopover
*/
private activePopoverTag?: string;
/**
* 返回数据
*/
private tempResult = { ret: '' };
/**
* 数据传递对象
*/
private subject: any;
/** /**
* 气泡卡片层级 * 当前显示层级
* *
* @private * @private
* @type {(number | null)} * @type {number}
* @memberof AppPopover * @memberof AppPopover
*/ */
private zIndex: number | null = null; private zIndex: number = 0;
/** /**
* Creates an instance of AppPopover. * Creates an instance of AppPopover.
...@@ -92,12 +78,6 @@ export class AppPopover { ...@@ -92,12 +78,6 @@ export class AppPopover {
if (AppPopover.$popover) { if (AppPopover.$popover) {
return AppPopover.$popover; return AppPopover.$popover;
} }
on(document, 'click', () => {
if (!this.showPopper || !this.isAutoClose) {
return;
}
this.destroy();
});
} }
/** /**
...@@ -108,207 +88,112 @@ export class AppPopover { ...@@ -108,207 +88,112 @@ export class AppPopover {
* @memberof AppPopover * @memberof AppPopover
*/ */
private initVueExample(): void { private initVueExample(): void {
const self = this;
const container = document.createElement('div');
container.className = 'app-popover-wrapper';
on(container, 'click', () => {
if (!this.showPopper || !this.isAutoClose) {
return;
}
this.popperDestroy();
});
const div = document.createElement('div'); const div = document.createElement('div');
document.body.appendChild(div); container.appendChild(div);
document.body.appendChild(container);
this.vueExample = new Vue({ this.vueExample = new Vue({
el: div, el: div,
store: store, store: store,
i18n: i18n, i18n: i18n,
data: { data: { content: null, width: 300, height: 300 },
title: null, methods: {
content: null, click(e: MouseEvent) {
isShow: false e.stopPropagation();
}
}, },
render(h: CreateElement) { render(h: CreateElement) {
const content: any = this.content; const content: any = this.content;
const style: string = `display: ${this.isShow ? 'block' : 'none'};`; container.style.zIndex = (self.zIndex - 1).toString();
return <div style={style} class="el-popover el-popper panel-design-popover"> return <div v-show="self.showPopper" style={{ width: this.width + 'px', height: this.height + 'px', 'z-index': self.zIndex }} class="app-popover app-popper" on-click={this.click}>{(self.showPopper && content) ? content(h) : null}</div>;
<el-card ref="datacard">
{
this.title ? <div slot="header" class="clearfix">
<span>{this.title}</span>
<span class="cancel" ref="cancel"><i class="fa fa-times" aria-hidden="true" style="cursor: pointer;"></i></span>
</div> : null
}
<div style="height:100%;">
{content ? content(h) : null}
</div>
</el-card>
<div x-arrow class="popper__arrow"></div>
</div>;
}
});
on(this.vueExample.$el, 'click', (event: any) => {
if (Object.is(event.target.outerHTML, '<i aria-hidden="true" class="fa fa-times" style="cursor: pointer;"></i>')) {
this.destroy();
} else {
event.stopPropagation();
} }
}); });
} }
/** /**
* 打开悬浮窗 * 打开悬浮窗
* *
* @param {MouseEvent} event 事件 * @param {MouseEvent} event 事件
* @param {*} view 视图 * @param {*} view 视图
* @param {*} [context={}] 应用上下文参数 * @param {*} [context={}] 应用上下文参数
* @param {any[]} deResParameters 关系实体参数对象
* @param {any[]} parameters 当前应用视图参数对象
* @param {any[]} args 多项数据
* @param {*} data 行为参数 * @param {*} data 行为参数
* @param {string} [title] 标题 * @param {Placement} position 显示位置
* @param {PopperJs.Placement} [position='left'] 悬浮窗位置 * @param {boolean} isAutoClose 是否可自动关闭
* @param {boolean} [isAutoClose=true] 是否自动关闭 * @returns {Observable<any>}
* @param {number} [width] 宽度
* @param {number} [height] 高度
* @returns {Subject<any>}
* @memberof AppPopover * @memberof AppPopover
*/ */
public openPop(event: MouseEvent, view: any, context: any = {}, data: any, title?: string, position: PopperJs.Placement = 'left', isAutoClose: boolean = true, width?: number, height?: number): Subject<any> { public openPop(event: any, view: any, context: any = {}, data: any, position?: Placement, isAutoClose?: boolean): Observable<any> {
let viewdata: any = {}; const subject = new Subject<any>();
Object.assign(viewdata, JSON.parse(JSON.stringify(context))); if(!event){
this.subject = new Subject<any>(); console.error("事件触发源无值,强制返回");
return subject.asObservable();
}
if(!view.width) view.width = 300;
if(!view.height) view.height = 300;
this.openPopover(event, (h: CreateElement) => { this.openPopover(event, (h: CreateElement) => {
return h(view.viewname, { return h(view.viewname, {
class: {
viewcontainer2: true,
},
props: { props: {
viewdata: JSON.stringify(viewdata), viewdata: JSON.stringify(context),
viewDefaultUsage: false, viewDefaultUsage: false,
viewparam:JSON.stringify(data) viewUsage: 4,
viewparam: JSON.stringify(data)
}, },
on: { on: {
viewdataschange: ($event: any) => this.dataChange($event), close: (result: any) => {
close: ($event: any) => this.viewclose($event) subject.next({ ret: 'OK', datas: result });
}, subject.complete();
subject.unsubscribe();
}
}
}) })
}, view.title, undefined, false, view.width, view.height); }, position, isAutoClose, view.width, view.height);
return this.subject; return subject.asObservable();
}
/**
* 数据变化回调
* @param $event
*/
public dataChange(result: any) {
this.tempResult = { ret: '' };
if (result && Array.isArray(result) && result.length > 0) {
Object.assign(this.tempResult, { ret: 'OK' }, { datas: JSON.parse(JSON.stringify(result)) });
}
this.close();
this.destroy();
}
/**
* 视图关闭
* @param result
*/
public viewclose(result: any) {
if (result && Array.isArray(result) && result.length > 0) {
Object.assign(this.tempResult, { datas: JSON.parse(JSON.stringify(result)) });
}
this.destroy();
}
/**
* 关闭回调(吐值)
*/
public close() {
if (this.tempResult && Object.is(this.tempResult.ret, 'OK')) {
this.subject.next(this.tempResult);
}
} }
/** /**
* 打开悬浮窗 * 打开悬浮窗
* *
* @param {MouseEvent} event * @param {*} event
* @param {(h: CreateElement) => any} [content] * @param {(h: CreateElement) => any} [content]
* @param {string} [title] * @param {Placement} [position='left']
* @param {PopperJs.Placement} [position='left']
* @param {boolean} [isAutoClose=true] * @param {boolean} [isAutoClose=true]
* @param {number} [width] * @param {number} [width=300]
* @param {number} [height] * @param {number} [height=300]
* @returns {void}
* @memberof AppPopover * @memberof AppPopover
*/ */
public openPopover(event: any, content?: (h: CreateElement) => any, title?: string, position: PopperJs.Placement = 'left', isAutoClose: boolean = true, width?: number, height?: number): void { public openPopover(event: any, content?: (h: CreateElement) => any, position: Placement = 'left-end', isAutoClose: boolean = true, width: number = 300, height: number = 300): void {
// 阻止事件冒泡 // 阻止事件冒泡
event.stopPropagation(); event.stopPropagation();
const element: Element = event.toElement || event.srcElement; const element: Element = event.toElement || event.srcElement;
if (element.hasAttribute('app-popover-tag')) { if (!this.vueExample) {
const tag: any = element.getAttribute('app-popover-tag'); this.initVueExample();
if (Object.is(this.activePopoverTag, tag)) {
this.destroy();
return;
}
this.activePopoverTag = tag;
} else {
const tag: string = 'app-popover-tag-' + new Date().getTime();
element.setAttribute('app-popover-tag', tag);
this.activePopoverTag = tag;
}
// if (!this.vueExample) {
// this.initVueExample();
// }
if (this.vueExample) {
this.destroy();
} }
this.initVueExample(); this.popperDestroy();
const _element: any = this.vueExample.$el;
const zIndex = this.vueExample.$store.getters.getZIndex(); const zIndex = this.vueExample.$store.getters.getZIndex();
if (zIndex) { if (zIndex) {
this.zIndex = zIndex + 100; this.zIndex = zIndex + 100;
this.vueExample.$store.commit('updateZIndex', this.zIndex); this.vueExample.$store.commit('updateZIndex', this.zIndex);
} }
_element.style.zIndex = this.zIndex;
const datacard: any = this.vueExample.$refs.datacard;
datacard.$el.style.width = width !== 0 ? width + 'px' : '240px';
datacard.$el.getElementsByClassName('el-card__body')[0].style.height = height !== 0 ? height + 'px' : '562px';
// if (width !== '0px' && width) {
// this.vueExample.$refs.datacard.$el.style.width = width;
// } else {
// this.vueExample.$refs.datacard.$el.style.width = '240px';
// }
// if (height !== '0px' && height) {
// this.vueExample.$refs.datacard.$el.getElementsByClassName('el-card__body')[0].style.height = height;
// } else {
// this.vueExample.$refs.datacard.$el.getElementsByClassName('el-card__body')[0].style.height = '562px';
// }
// this.destroy();
// 是否可自动关闭 // 是否可自动关闭
this.isAutoClose = isAutoClose; this.isAutoClose = isAutoClose;
// 更新vue实例内容 // 更新vue实例内容
this.vueExample.$data.title = title; this.showPopper = true;
this.vueExample.$data.content = content; Object.assign(this.vueExample.$data, { content, width, height, zIndex: this.zIndex });
this.vueExample.$data.isShow = true; const el: any = this.vueExample.$el;
this.vueExample.$forceUpdate(); this.popperExample = createPopper(element, el, {
// 绘制popover
const config: PopperJs.PopperOptions = {
placement: position, placement: position,
onCreate: () => { strategy: 'absolute',
this.showPopper = true; modifiers: [preventOverflow, flip]
}, });
onUpdate: (arg) => { this.vueExample.$forceUpdate();
const popper: any = arg.instance.popper;
popper.style.display = 'none';
},
modifiers: {
flip: {
boundariesElement: 'viewport'
},
preventOverflow: {
boundariesElement: document.getElementsByClassName('app-index')[0]
}
}
};
this.popperExample = new PopperJs(element, this.vueExample.$el, config);
this.popperExample.update();
} }
/** /**
...@@ -316,22 +201,15 @@ export class AppPopover { ...@@ -316,22 +201,15 @@ export class AppPopover {
* *
* @memberof AppPopover * @memberof AppPopover
*/ */
public destroy(): void { public popperDestroy(): void {
if (this.popperExample) { if (this.popperExample) {
this.popperExample.destroy(); this.popperExample.destroy();
if (this.zIndex !== 0) {
if (this.zIndex) {
const zIndex: any = this.zIndex; const zIndex: any = this.zIndex;
this.vueExample.$store.commit('updateZIndex', zIndex - 100); this.vueExample.$store.commit('updateZIndex', zIndex - 100);
this.zIndex = null; this.zIndex = 0;
} }
this.vueExample.$destroy();
document.body.removeChild(this.vueExample.$el);
this.popperExample = undefined;
this.showPopper = false; this.showPopper = false;
this.activePopoverTag = '';
this.vueExample.$data.isShow = false;
this.vueExample.$forceUpdate(); this.vueExample.$forceUpdate();
} }
} }
......
import { Notice } from 'view-design';
export function Errorlog(target: Object, propertyKey: string, descriptor: TypedPropertyDescriptor<any>){ export function Errorlog(target: Object, propertyKey: string, descriptor: TypedPropertyDescriptor<any>){
let origin=descriptor.value; let origin=descriptor.value;
let $Notice: any = Notice;
descriptor.value=function(...args:any[]){ descriptor.value=function(...args:any[]){
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
// 原方法调用方法 // 原方法调用方法
...@@ -12,7 +9,7 @@ export function Errorlog(target: Object, propertyKey: string, descriptor: TypedP ...@@ -12,7 +9,7 @@ export function Errorlog(target: Object, propertyKey: string, descriptor: TypedP
}).catch((error:any)=>{ }).catch((error:any)=>{
// 开发模式下页面报错 // 开发模式下页面报错
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
$Notice.error({ title: '错误', desc: target.constructor.name+'类'+propertyKey+'方法产生异常' }); console.error(target.constructor.name+'类'+propertyKey+'方法产生异常');
} }
// 控制台报错 // 控制台报错
console.error(error); console.error(error);
......
...@@ -260,7 +260,7 @@ export class ViewTool { ...@@ -260,7 +260,7 @@ export class ViewTool {
if(_item && _item['dataaccaction'] && UIService && data && Object.keys(data).length >0){ if(_item && _item['dataaccaction'] && UIService && data && Object.keys(data).length >0){
let dataActionResult:any = UIService.getAllOPPrivs(data)[_item['dataaccaction']]; let dataActionResult:any = UIService.getAllOPPrivs(data)[_item['dataaccaction']];
// 无权限:0;有权限:1 // 无权限:0;有权限:1
if(!dataActionResult){ if(dataActionResult === 0){
// 禁用:1;隐藏:2;隐藏且默认隐藏:6 // 禁用:1;隐藏:2;隐藏且默认隐藏:6
if(_item.noprivdisplaymode === 1){ if(_item.noprivdisplaymode === 1){
_item.disabled = true; _item.disabled = true;
...@@ -270,7 +270,8 @@ export class ViewTool { ...@@ -270,7 +270,8 @@ export class ViewTool {
}else{ }else{
_item.visabled = true; _item.visabled = true;
} }
}else{ }
if(dataActionResult === 1){
_item.visabled = true; _item.visabled = true;
_item.disabled = false; _item.disabled = false;
} }
......
...@@ -8,111 +8,7 @@ ...@@ -8,111 +8,7 @@
:collapse="isCollapse" :collapse="isCollapse"
@select="select" @select="select"
:default-active="defaultActive"> :default-active="defaultActive">
<template v-for="item0 in menus"> <app-menu-item :menus="menus" :ctrlName="'appindexview'" :isFirst="true" :counterdata="counterdata" :popperclass="popperClass"></app-menu-item>
<template v-if="item0.items && Array.isArray(item0.items) && item0.items.length > 0">
<el-submenu v-show="!item0.hidden" :index="item0.name" :popper-class="popperClass" :key="item0.id">
<template slot='title'>
<template v-if="item0.icon && item0.icon != ''">
<img :src="item0.icon" class='app-menu-icon' />
</template>
<template v-else-if="item0.iconcls && item0.iconcls != ''">
<i :class="[item0.iconcls, 'app-menu-icon']"></i>
</template>
<template v-else>
<i class='fa fa-cogs app-menu-icon'></i>
</template>
<span class='text' :title="$t('app.menus.appindexview.' + item0.name)">{{$t('app.menus.appindexview.' + item0.name)}}</span>
</template>
<template v-for="item1 in item0.items">
<template v-if="item1.items && Array.isArray(item1.items) && item1.items.length > 0">
<el-submenu v-show="!item1.hidden" :index="item1.name" :popper-class="popperClass" :key="item1.id">
<template slot='title'>
<template v-if="item1.icon && item1.icon != ''">
<img :src="item1.icon" class='app-menu-icon' />
</template>
<template v-else-if="item1.iconcls && item1.iconcls != ''">
<i :class="[item1.iconcls, 'app-menu-icon']"></i>
</template>
<span class='text' :title="$t('app.menus.appindexview.' + item1.name)">{{$t('app.menus.appindexview.' + item1.name)}}</span>
</template>
<template v-for="item2 in item1.items">
<template v-if="item2.type =='MENUITEM'">
<el-menu-item v-show="!item2.hidden" :index="item2.name" :key="item2.id">
<template v-if="item2.icon && item2.icon != ''">
<img :src="item2.icon" class='app-menu-icon' />
</template>
<template v-else-if="item2.iconcls && item2.iconcls != ''">
<i :class="[item2.iconcls, 'app-menu-icon']"></i>
</template>
<template slot="title">
<span class="text" :title="$t('app.menus.appindexview.' + item2.name)">{{$t('app.menus.appindexview.' + item2.name)}}</span>
<template v-if="counterdata && counterdata[item2.counterid] && counterdata[item2.counterid] > 0">
<span class="pull-right">
<badge :count="counterdata[item2.counterid]" :overflow-count="9999"></badge>
</span>
</template>
</template>
</el-menu-item>
</template>
<template v-if="item2.type =='SEPERATOR'">
<divider :key="item2.id" />
</template>
</template>
</el-submenu>
</template>
<template v-else>
<template v-if="item1.type =='MENUITEM'">
<el-menu-item v-show="!item1.hidden" :index="item1.name" :key="item1.id">
<template v-if="item1.icon && item1.icon != ''">
<img :src="item1.icon" class='app-menu-icon' />
</template>
<template v-else-if="item1.iconcls && item1.iconcls != ''">
<i :class="[item1.iconcls, 'app-menu-icon']"></i>
</template>
<template slot="title">
<span class="text" :title="$t('app.menus.appindexview.' + item1.name)">{{$t('app.menus.appindexview.' + item1.name)}} </span>
<template v-if="counterdata && counterdata[item1.counterid] && counterdata[item1.counterid] > 0">
<span class="pull-right">
<badge :count="counterdata[item1.counterid]" :overflow-count="9999"></badge>
</span>
</template>
</template>
</el-menu-item>
</template>
<template v-if="item1.type =='SEPERATOR'">
<divider :key="item1.id" />
</template>
</template>
</template>
</el-submenu>
</template>
<template v-else>
<template v-if="item0.type =='MENUITEM'">
<el-menu-item v-show="!item0.hidden" :index="item0.name" :key="item0.id">
<template v-if="item0.icon && item0.icon != ''">
<img :src="item0.icon" class='app-menu-icon' />
</template>
<template v-else-if="item0.iconcls && item0.iconcls != ''">
<i :class="[item0.iconcls, 'app-menu-icon']"></i>
</template>
<template v-else>
<i class='fa fa-cogs app-menu-icon'></i>
</template>
<template slot="title">
<span class="text" :title="$t('app.menus.appindexview.' + item0.name)">{{$t('app.menus.appindexview.' + item0.name)}}</span>
<template v-if="counterdata && counterdata[item0.counterid] && counterdata[item0.counterid] > 0">
<span class="pull-right">
<badge :count="counterdata[item0.counterid]" :overflow-count="9999"></badge>
</span>
</template>
</template>
</el-menu-item>
</template>
<template v-if="item0.type =='SEPERATOR'">
<divider :key="item0.id" />
</template>
</template>
</template>
</el-menu> </el-menu>
</div> </div>
</template> </template>
......
...@@ -7,18 +7,21 @@ ...@@ -7,18 +7,21 @@
<i-col v-show="detailsModel.n_ccode_like.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 8, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }"> <i-col v-show="detailsModel.n_ccode_like.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 8, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='n_ccode_like' :itemRules="this.rules.n_ccode_like" class='' :caption="$t('entities.dictcatalog.default_searchform.details.n_ccode_like')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.n_ccode_like.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='n_ccode_like' :itemRules="this.rules.n_ccode_like" class='' :caption="$t('entities.dictcatalog.default_searchform.details.n_ccode_like')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.n_ccode_like.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.n_ccode_like" @enter="onEnter($event)" :disabled="detailsModel.n_ccode_like.disabled" type='text' style="width:100px;"></input-box> <input-box v-model="data.n_ccode_like" @enter="onEnter($event)" :disabled="detailsModel.n_ccode_like.disabled" type='text' style="width:100px;"></input-box>
</app-form-item> </app-form-item>
</i-col> </i-col>
<i-col v-show="detailsModel.n_cname_like.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 8, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }"> <i-col v-show="detailsModel.n_cname_like.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 8, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='n_cname_like' :itemRules="this.rules.n_cname_like" class='' :caption="$t('entities.dictcatalog.default_searchform.details.n_cname_like')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.n_cname_like.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='n_cname_like' :itemRules="this.rules.n_cname_like" class='' :caption="$t('entities.dictcatalog.default_searchform.details.n_cname_like')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.n_cname_like.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.n_cname_like" @enter="onEnter($event)" :disabled="detailsModel.n_cname_like.disabled" type='text' style="width:100px;"></input-box> <input-box v-model="data.n_cname_like" @enter="onEnter($event)" :disabled="detailsModel.n_cname_like.disabled" type='text' style="width:100px;"></input-box>
</app-form-item> </app-form-item>
</i-col> </i-col>
<i-col v-show="detailsModel.n_cgroup_like.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 8, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }"> <i-col v-show="detailsModel.n_cgroup_like.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 8, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='n_cgroup_like' :itemRules="this.rules.n_cgroup_like" class='' :caption="$t('entities.dictcatalog.default_searchform.details.n_cgroup_like')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.n_cgroup_like.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='n_cgroup_like' :itemRules="this.rules.n_cgroup_like" class='' :caption="$t('entities.dictcatalog.default_searchform.details.n_cgroup_like')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.n_cgroup_like.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.n_cgroup_like" @enter="onEnter($event)" :disabled="detailsModel.n_cgroup_like.disabled" type='text' style="width:100px;"></input-box> <input-box v-model="data.n_cgroup_like" @enter="onEnter($event)" :disabled="detailsModel.n_cgroup_like.disabled" type='text' style="width:100px;"></input-box>
</app-form-item> </app-form-item>
</i-col> </i-col>
......
...@@ -150,7 +150,6 @@ export default class DefaultService extends ControlService { ...@@ -150,7 +150,6 @@ export default class DefaultService extends ControlService {
}); });
} }
/** /**
* 添加数据 * 添加数据
* *
...@@ -365,4 +364,25 @@ export default class DefaultService extends ControlService { ...@@ -365,4 +364,25 @@ export default class DefaultService extends ControlService {
return {context:tempContext,data:requestData}; return {context:tempContext,data:requestData};
} }
/**
* 通过属性名称获取表单项名称
*
* @param name 实体属性名称
* @memberof DefaultService
*/
public getItemNameByDeName(name:string) :string{
let itemName = name;
let mode: any = this.getMode();
if (!mode && mode.getDataItems instanceof Function) {
return name;
}
let formItemItems: any[] = mode.getDataItems();
formItemItems.forEach((item:any)=>{
if(item.prop === name){
itemName = item.name;
}
});
return itemName.trim();
}
} }
\ No newline at end of file
...@@ -7,26 +7,30 @@ ...@@ -7,26 +7,30 @@
<app-form-group :uiService="appUIService" :data="transformData(data)" :manageContainerStatus="detailsModel.group1.manageContainerStatus" :isManageContainer="detailsModel.group1.isManageContainer" @managecontainerclick="manageContainerClick('group1')" layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.dictcatalog.main_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" > <app-form-group :uiService="appUIService" :data="transformData(data)" :manageContainerStatus="detailsModel.group1.manageContainerStatus" :isManageContainer="detailsModel.group1.isManageContainer" @managecontainerclick="manageContainerClick('group1')" layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.dictcatalog.main_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row> <row>
<i-col v-show="detailsModel.ccode.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 8, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }"> <i-col v-show="detailsModel.ccode.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 8, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='ccode' :itemRules="this.rules.ccode" class='' :caption="$t('entities.dictcatalog.main_form.details.ccode')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.ccode.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='ccode' :itemRules="this.rules().ccode" class='' :caption="$t('entities.dictcatalog.main_form.details.ccode')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.ccode.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.ccode" @enter="onEnter($event)" unit="" :disabled="detailsModel.ccode.disabled" type='text' style=""></input-box> <input-box v-model="data.ccode" @enter="onEnter($event)" unit="" :disabled="detailsModel.ccode.disabled" type='text' style=""></input-box>
</app-form-item> </app-form-item>
</i-col> </i-col>
<i-col v-show="detailsModel.cname.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 8, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }"> <i-col v-show="detailsModel.cname.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 8, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='cname' :itemRules="this.rules.cname" class='' :caption="$t('entities.dictcatalog.main_form.details.cname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.cname.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='cname' :itemRules="this.rules().cname" class='' :caption="$t('entities.dictcatalog.main_form.details.cname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.cname.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.cname" @enter="onEnter($event)" unit="" :disabled="detailsModel.cname.disabled" type='text' style=""></input-box> <input-box v-model="data.cname" @enter="onEnter($event)" unit="" :disabled="detailsModel.cname.disabled" type='text' style=""></input-box>
</app-form-item> </app-form-item>
</i-col> </i-col>
<i-col v-show="detailsModel.cgroup.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 8, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }"> <i-col v-show="detailsModel.cgroup.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 8, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='cgroup' :itemRules="this.rules.cgroup" class='' :caption="$t('entities.dictcatalog.main_form.details.cgroup')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.cgroup.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='cgroup' :itemRules="this.rules().cgroup" class='' :caption="$t('entities.dictcatalog.main_form.details.cgroup')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.cgroup.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.cgroup" @enter="onEnter($event)" unit="" :disabled="detailsModel.cgroup.disabled" type='text' style=""></input-box> <input-box v-model="data.cgroup" @enter="onEnter($event)" unit="" :disabled="detailsModel.cgroup.disabled" type='text' style=""></input-box>
</app-form-item> </app-form-item>
</i-col> </i-col>
<i-col v-show="detailsModel.memo.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 24, offset: 0 }" :lg="{ span: 24, offset: 0 }" :xl="{ span: 24, offset: 0 }"> <i-col v-show="detailsModel.memo.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 24, offset: 0 }" :lg="{ span: 24, offset: 0 }" :xl="{ span: 24, offset: 0 }">
<app-form-item name='memo' :itemRules="this.rules.memo" class='' :caption="$t('entities.dictcatalog.main_form.details.memo')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.memo.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='memo' :itemRules="this.rules().memo" class='' :caption="$t('entities.dictcatalog.main_form.details.memo')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.memo.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.memo" @enter="onEnter($event)" unit="" :disabled="detailsModel.memo.disabled" type='text' style=""></input-box> <input-box v-model="data.memo" @enter="onEnter($event)" unit="" :disabled="detailsModel.memo.disabled" type='text' style=""></input-box>
</app-form-item> </app-form-item>
</i-col> </i-col>
...@@ -446,7 +450,8 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -446,7 +450,8 @@ export default class MainBase extends Vue implements ControlInterface {
* @type {*} * @type {*}
* @memberof MainBase * @memberof MainBase
*/ */
public rules: any = { public rules() :any {
return {
srfupdatedate: [ srfupdatedate: [
{ type: 'string', message: '最后修改时间 值必须为字符串类型', trigger: 'change' }, { type: 'string', message: '最后修改时间 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '最后修改时间 值必须为字符串类型', trigger: 'blur' }, { type: 'string', message: '最后修改时间 值必须为字符串类型', trigger: 'blur' },
...@@ -525,6 +530,51 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -525,6 +530,51 @@ export default class MainBase extends Vue implements ControlInterface {
{ required: false, type: 'string', message: '标识 值不能为空', trigger: 'change' }, { required: false, type: 'string', message: '标识 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '标识 值不能为空', trigger: 'blur' }, { required: false, type: 'string', message: '标识 值不能为空', trigger: 'blur' },
], ],
}
}
/**
* 属性值规则
*
* @type {*}
* @memberof MainBase
*/
public deRules:any = {
};
/**
* 校验属性值规则
*
* @public
* @param {{ name: string }} { name }
* @memberof MainBase
*/
public verifyDeRules(name:string,rule:any = this.deRules) :{isPast:boolean,infoMessage:string}{
let falg = {isPast:true,infoMessage:""};
if(!rule[name]){
return falg;
}
rule[name].forEach((item:any) => {
if(item.type == 'SIMPLE' && this.data[this.service.getItemNameByDeName(item.deName)] != item.paramValue){
falg.isPast = false;
falg.infoMessage = item.ruleInfo;
}
if(item.type == 'REGEX' && (item.isNotMode? item.RegExCode.test(this.data[name]) : !item.RegExCode.test(this.data[name]))){
falg.isPast = false;
falg.infoMessage = item.ruleInfo;
}
if(item.type == 'STRINGLENGTH' ){
let valueLength :number = this.data[name]?this.data[name].length:0;
if(item.isNotMode? valueLength > item.minValue && valueLength < item.maxValue : !(valueLength > item.minValue && valueLength < item.maxValue)){
falg.isPast = false;
falg.infoMessage = item.ruleInfo;
}
}
if(item.type == 'GROUP'){
falg = this.verifyDeRules('group',item)
}
});
return falg;
} }
/** /**
...@@ -805,7 +855,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -805,7 +855,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/ */
public checkItem(name:string):Promise<any> { public checkItem(name:string):Promise<any> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
var validator = new schema({[name]:this.rules[name]}); var validator = new schema({[name]:this.rules()[name]});
validator.validate({[name]:this.data[name]}).then(()=>{ validator.validate({[name]:this.data[name]}).then(()=>{
resolve(true); resolve(true);
}) })
...@@ -1236,9 +1286,6 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1236,9 +1286,6 @@ export default class MainBase extends Vue implements ControlInterface {
} }
const data = response.data; const data = response.data;
if(data.dictcatalog){
Object.assign(this.context,{dictcatalog:data.dictcatalog})
}
this.resetDraftFormStates(); this.resetDraftFormStates();
this.onFormLoad(data,'loadDraft'); this.onFormLoad(data,'loadDraft');
this.$emit('load', data); this.$emit('load', data);
......
...@@ -150,7 +150,6 @@ export default class MainService extends ControlService { ...@@ -150,7 +150,6 @@ export default class MainService extends ControlService {
}); });
} }
/** /**
* 添加数据 * 添加数据
* *
...@@ -370,4 +369,25 @@ export default class MainService extends ControlService { ...@@ -370,4 +369,25 @@ export default class MainService extends ControlService {
return {context:tempContext,data:requestData}; return {context:tempContext,data:requestData};
} }
/**
* 通过属性名称获取表单项名称
*
* @param name 实体属性名称
* @memberof MainService
*/
public getItemNameByDeName(name:string) :string{
let itemName = name;
let mode: any = this.getMode();
if (!mode && mode.getDataItems instanceof Function) {
return name;
}
let formItemItems: any[] = mode.getDataItems();
formItemItems.forEach((item:any)=>{
if(item.prop === name){
itemName = item.name;
}
});
return itemName.trim();
}
} }
\ No newline at end of file
...@@ -543,7 +543,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -543,7 +543,7 @@ export default class MainBase extends Vue implements ControlInterface {
* *
* @memberof MainBase * @memberof MainBase
*/ */
public defaultUpdateItems:Array<any> =['srfkey']; public defaultUpdateItems:Array<any> =[];
/** /**
* 选中行数据 * 选中行数据
...@@ -1515,7 +1515,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1515,7 +1515,7 @@ export default class MainBase extends Vue implements ControlInterface {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{ }else{
errorItems.forEach((item:any,index:number)=>{ errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+(this.$t('app.commonWords.saveFailed') as string)+'!' }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: errorMessage[index].data.message });
console.error(errorMessage[index]); console.error(errorMessage[index]);
}); });
} }
......
...@@ -60,6 +60,7 @@ export default class MainModel { ...@@ -60,6 +60,7 @@ export default class MainModel {
name: 'srfkey', name: 'srfkey',
prop: 'id', prop: 'id',
dataType: 'TEXT', dataType: 'TEXT',
isEditable:true
}, },
{ {
name: 'cname', name: 'cname',
......
...@@ -99,7 +99,7 @@ export default class MainService extends ControlService { ...@@ -99,7 +99,7 @@ export default class MainService extends ControlService {
*/ */
@Errorlog @Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true); const {data:Data,context:Context} = this.handleRequestDataWithUpdate(action,context,data,true);
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService; const _appEntityService: any = this.appEntityService;
let result: Promise<any>; let result: Promise<any>;
...@@ -158,14 +158,14 @@ export default class MainService extends ControlService { ...@@ -158,14 +158,14 @@ export default class MainService extends ControlService {
*/ */
@Errorlog @Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true); const {data:Data,context:Context} = this.handleRequestDataWithUpdate(action,context,data,true);
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService; const _appEntityService: any = this.appEntityService;
let result: Promise<any>; let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) { if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Data,Context,isloading); result = _appEntityService[action](Context,Data,isloading);
}else{ }else{
result =_appEntityService.Update(Data,Context,isloading); result =_appEntityService.Update(Context,Data,isloading);
} }
result.then((response) => { result.then((response) => {
this.handleResponse(action, response); this.handleResponse(action, response);
...@@ -305,5 +305,41 @@ export default class MainService extends ControlService { ...@@ -305,5 +305,41 @@ export default class MainService extends ControlService {
}); });
}) })
} }
/**
* 处理请求数据(修改或增加数据)
*
* @param action 行为
* @param data 数据
* @memberof MainService
*/
public handleRequestDataWithUpdate(action: string,context:any ={},data: any = {},isMerge:boolean = false){
let model: any = this.getMode();
if (!model && model.getDataItems instanceof Function) {
return data;
}
let dataItems: any[] = model.getDataItems();
let requestData:any = {};
if(isMerge && (data && data.viewparams)){
Object.assign(requestData,data.viewparams);
}
dataItems.forEach((item:any) =>{
if(item && item.dataType && Object.is(item.dataType,'FONTKEY')){
if(item && item.prop && item.name ){
requestData[item.prop] = context[item.name];
}
}else{
if(item && item.isEditable && item.prop && item.name && (data[item.name] || Object.is(data[item.name],0)) ){
requestData[item.prop] = data[item.name];
}
}
});
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
...@@ -7,18 +7,21 @@ ...@@ -7,18 +7,21 @@
<i-col v-show="detailsModel.n_cname_like.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 8, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }"> <i-col v-show="detailsModel.n_cname_like.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 8, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='n_cname_like' :itemRules="this.rules.n_cname_like" class='' :caption="$t('entities.dictoption.default_searchform.details.n_cname_like')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.n_cname_like.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='n_cname_like' :itemRules="this.rules.n_cname_like" class='' :caption="$t('entities.dictoption.default_searchform.details.n_cname_like')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.n_cname_like.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.n_cname_like" @enter="onEnter($event)" :disabled="detailsModel.n_cname_like.disabled" type='text' style="width:100px;"></input-box> <input-box v-model="data.n_cname_like" @enter="onEnter($event)" :disabled="detailsModel.n_cname_like.disabled" type='text' style="width:100px;"></input-box>
</app-form-item> </app-form-item>
</i-col> </i-col>
<i-col v-show="detailsModel.n_val_like.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 8, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }"> <i-col v-show="detailsModel.n_val_like.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 8, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='n_val_like' :itemRules="this.rules.n_val_like" class='' :caption="$t('entities.dictoption.default_searchform.details.n_val_like')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.n_val_like.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='n_val_like' :itemRules="this.rules.n_val_like" class='' :caption="$t('entities.dictoption.default_searchform.details.n_val_like')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.n_val_like.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.n_val_like" @enter="onEnter($event)" :disabled="detailsModel.n_val_like.disabled" type='text' style="width:100px;"></input-box> <input-box v-model="data.n_val_like" @enter="onEnter($event)" :disabled="detailsModel.n_val_like.disabled" type='text' style="width:100px;"></input-box>
</app-form-item> </app-form-item>
</i-col> </i-col>
<i-col v-show="detailsModel.n_label_like.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 8, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }"> <i-col v-show="detailsModel.n_label_like.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 8, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='n_label_like' :itemRules="this.rules.n_label_like" class='' :caption="$t('entities.dictoption.default_searchform.details.n_label_like')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.n_label_like.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='n_label_like' :itemRules="this.rules.n_label_like" class='' :caption="$t('entities.dictoption.default_searchform.details.n_label_like')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.n_label_like.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.n_label_like" @enter="onEnter($event)" :disabled="detailsModel.n_label_like.disabled" type='text' style="width:100px;"></input-box> <input-box v-model="data.n_label_like" @enter="onEnter($event)" :disabled="detailsModel.n_label_like.disabled" type='text' style="width:100px;"></input-box>
</app-form-item> </app-form-item>
</i-col> </i-col>
......
...@@ -150,7 +150,6 @@ export default class DefaultService extends ControlService { ...@@ -150,7 +150,6 @@ export default class DefaultService extends ControlService {
}); });
} }
/** /**
* 添加数据 * 添加数据
* *
...@@ -365,4 +364,25 @@ export default class DefaultService extends ControlService { ...@@ -365,4 +364,25 @@ export default class DefaultService extends ControlService {
return {context:tempContext,data:requestData}; return {context:tempContext,data:requestData};
} }
/**
* 通过属性名称获取表单项名称
*
* @param name 实体属性名称
* @memberof DefaultService
*/
public getItemNameByDeName(name:string) :string{
let itemName = name;
let mode: any = this.getMode();
if (!mode && mode.getDataItems instanceof Function) {
return name;
}
let formItemItems: any[] = mode.getDataItems();
formItemItems.forEach((item:any)=>{
if(item.prop === name){
itemName = item.name;
}
});
return itemName.trim();
}
} }
\ No newline at end of file
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<app-form-group :uiService="appUIService" :data="transformData(data)" :manageContainerStatus="detailsModel.group1.manageContainerStatus" :isManageContainer="detailsModel.group1.isManageContainer" @managecontainerclick="manageContainerClick('group1')" layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.dictoption.main_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" > <app-form-group :uiService="appUIService" :data="transformData(data)" :manageContainerStatus="detailsModel.group1.manageContainerStatus" :isManageContainer="detailsModel.group1.isManageContainer" @managecontainerclick="manageContainerClick('group1')" layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.dictoption.main_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row> <row>
<i-col v-show="detailsModel.cname.visible" :style="{}" :lg="{ span: 24, offset: 0 }"> <i-col v-show="detailsModel.cname.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='cname' :itemRules="this.rules.cname" class='' :caption="$t('entities.dictoption.main_form.details.cname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.cname.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='cname' :itemRules="this.rules().cname" class='' :caption="$t('entities.dictoption.main_form.details.cname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.cname.error" :isEmptyCaption="false" labelPos="LEFT">
<app-picker <app-picker
:formState="formState" :formState="formState"
...@@ -34,31 +34,35 @@ ...@@ -34,31 +34,35 @@
</i-col> </i-col>
<i-col v-show="detailsModel.val.visible" :style="{}" :lg="{ span: 24, offset: 0 }"> <i-col v-show="detailsModel.val.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='val' :itemRules="this.rules.val" class='' :caption="$t('entities.dictoption.main_form.details.val')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.val.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='val' :itemRules="this.rules().val" class='' :caption="$t('entities.dictoption.main_form.details.val')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.val.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.val" @enter="onEnter($event)" unit="" :disabled="detailsModel.val.disabled" type='text' style=""></input-box> <input-box v-model="data.val" @enter="onEnter($event)" unit="" :disabled="detailsModel.val.disabled" type='text' style=""></input-box>
</app-form-item> </app-form-item>
</i-col> </i-col>
<i-col v-show="detailsModel.label.visible" :style="{}" :lg="{ span: 24, offset: 0 }"> <i-col v-show="detailsModel.label.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='label' :itemRules="this.rules.label" class='' :caption="$t('entities.dictoption.main_form.details.label')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.label.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='label' :itemRules="this.rules().label" class='' :caption="$t('entities.dictoption.main_form.details.label')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.label.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.label" @enter="onEnter($event)" unit="" :disabled="detailsModel.label.disabled" type='text' style=""></input-box> <input-box v-model="data.label" @enter="onEnter($event)" unit="" :disabled="detailsModel.label.disabled" type='text' style=""></input-box>
</app-form-item> </app-form-item>
</i-col> </i-col>
<i-col v-show="detailsModel.pval.visible" :style="{}" :lg="{ span: 24, offset: 0 }"> <i-col v-show="detailsModel.pval.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='pval' :itemRules="this.rules.pval" class='' :caption="$t('entities.dictoption.main_form.details.pval')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.pval.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='pval' :itemRules="this.rules().pval" class='' :caption="$t('entities.dictoption.main_form.details.pval')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.pval.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.pval" @enter="onEnter($event)" unit="" :disabled="detailsModel.pval.disabled" type='text' style=""></input-box> <input-box v-model="data.pval" @enter="onEnter($event)" unit="" :disabled="detailsModel.pval.disabled" type='text' style=""></input-box>
</app-form-item> </app-form-item>
</i-col> </i-col>
<i-col v-show="detailsModel.showorder.visible" :style="{}" :lg="{ span: 24, offset: 0 }"> <i-col v-show="detailsModel.showorder.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='showorder' :itemRules="this.rules.showorder" class='' :caption="$t('entities.dictoption.main_form.details.showorder')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.showorder.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='showorder' :itemRules="this.rules().showorder" class='' :caption="$t('entities.dictoption.main_form.details.showorder')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.showorder.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.showorder" @enter="onEnter($event)" unit="" :disabled="detailsModel.showorder.disabled" type='number' style=""></input-box> <input-box v-model="data.showorder" @enter="onEnter($event)" unit="" :disabled="detailsModel.showorder.disabled" type='number' style=""></input-box>
</app-form-item> </app-form-item>
</i-col> </i-col>
<i-col v-show="detailsModel.disabled.visible" :style="{}" :sm="{ span: 12, offset: 0 }" :md="{ span: 12, offset: 0 }" :lg="{ span: 12, offset: 0 }" :xl="{ span: 12, offset: 0 }"> <i-col v-show="detailsModel.disabled.visible" :style="{}" :sm="{ span: 12, offset: 0 }" :md="{ span: 12, offset: 0 }" :lg="{ span: 12, offset: 0 }" :xl="{ span: 12, offset: 0 }">
<app-form-item name='disabled' :itemRules="this.rules.disabled" class='' :caption="$t('entities.dictoption.main_form.details.disabled')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.disabled.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='disabled' :itemRules="this.rules().disabled" class='' :caption="$t('entities.dictoption.main_form.details.disabled')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.disabled.error" :isEmptyCaption="false" labelPos="LEFT">
<dropdown-list <dropdown-list
v-model="data.disabled" v-model="data.disabled"
...@@ -73,11 +77,12 @@ ...@@ -73,11 +77,12 @@
codelistType='STATIC' codelistType='STATIC'
placeholder='请选择...'> placeholder='请选择...'>
</dropdown-list> </dropdown-list>
</app-form-item> </app-form-item>
</i-col> </i-col>
<i-col v-show="detailsModel.expired.visible" :style="{}" :sm="{ span: 12, offset: 0 }" :md="{ span: 12, offset: 0 }" :lg="{ span: 12, offset: 0 }" :xl="{ span: 12, offset: 0 }"> <i-col v-show="detailsModel.expired.visible" :style="{}" :sm="{ span: 12, offset: 0 }" :md="{ span: 12, offset: 0 }" :lg="{ span: 12, offset: 0 }" :xl="{ span: 12, offset: 0 }">
<app-form-item name='expired' :itemRules="this.rules.expired" class='' :caption="$t('entities.dictoption.main_form.details.expired')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.expired.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='expired' :itemRules="this.rules().expired" class='' :caption="$t('entities.dictoption.main_form.details.expired')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.expired.error" :isEmptyCaption="false" labelPos="LEFT">
<dropdown-list <dropdown-list
v-model="data.expired" v-model="data.expired"
...@@ -92,29 +97,33 @@ ...@@ -92,29 +97,33 @@
codelistType='STATIC' codelistType='STATIC'
placeholder='请选择...'> placeholder='请选择...'>
</dropdown-list> </dropdown-list>
</app-form-item> </app-form-item>
</i-col> </i-col>
<i-col v-show="detailsModel.vfilter.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 24, offset: 0 }" :lg="{ span: 24, offset: 0 }" :xl="{ span: 24, offset: 0 }"> <i-col v-show="detailsModel.vfilter.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 24, offset: 0 }" :lg="{ span: 24, offset: 0 }" :xl="{ span: 24, offset: 0 }">
<app-form-item name='vfilter' :itemRules="this.rules.vfilter" class='' :caption="$t('entities.dictoption.main_form.details.vfilter')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.vfilter.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='vfilter' :itemRules="this.rules().vfilter" class='' :caption="$t('entities.dictoption.main_form.details.vfilter')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.vfilter.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.vfilter" @enter="onEnter($event)" unit="" :disabled="detailsModel.vfilter.disabled" type='text' style=""></input-box> <input-box v-model="data.vfilter" @enter="onEnter($event)" unit="" :disabled="detailsModel.vfilter.disabled" type='text' style=""></input-box>
</app-form-item> </app-form-item>
</i-col> </i-col>
<i-col v-show="detailsModel.iconcls.visible" :style="{}" :lg="{ span: 24, offset: 0 }"> <i-col v-show="detailsModel.iconcls.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='iconcls' :itemRules="this.rules.iconcls" class='' :caption="$t('entities.dictoption.main_form.details.iconcls')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.iconcls.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='iconcls' :itemRules="this.rules().iconcls" class='' :caption="$t('entities.dictoption.main_form.details.iconcls')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.iconcls.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.iconcls" @enter="onEnter($event)" unit="" :disabled="detailsModel.iconcls.disabled" type='text' style=""></input-box> <input-box v-model="data.iconcls" @enter="onEnter($event)" unit="" :disabled="detailsModel.iconcls.disabled" type='text' style=""></input-box>
</app-form-item> </app-form-item>
</i-col> </i-col>
<i-col v-show="detailsModel.cls.visible" :style="{}" :lg="{ span: 24, offset: 0 }"> <i-col v-show="detailsModel.cls.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='cls' :itemRules="this.rules.cls" class='' :caption="$t('entities.dictoption.main_form.details.cls')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.cls.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='cls' :itemRules="this.rules().cls" class='' :caption="$t('entities.dictoption.main_form.details.cls')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.cls.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.cls" @enter="onEnter($event)" unit="" :disabled="detailsModel.cls.disabled" type='text' style=""></input-box> <input-box v-model="data.cls" @enter="onEnter($event)" unit="" :disabled="detailsModel.cls.disabled" type='text' style=""></input-box>
</app-form-item> </app-form-item>
</i-col> </i-col>
<i-col v-show="detailsModel.extension.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 24, offset: 0 }" :lg="{ span: 24, offset: 0 }" :xl="{ span: 24, offset: 0 }"> <i-col v-show="detailsModel.extension.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 24, offset: 0 }" :lg="{ span: 24, offset: 0 }" :xl="{ span: 24, offset: 0 }">
<app-form-item name='extension' :itemRules="this.rules.extension" class='' :caption="$t('entities.dictoption.main_form.details.extension')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.extension.error" :isEmptyCaption="false" labelPos="LEFT"> <app-form-item name='extension' :itemRules="this.rules().extension" class='' :caption="$t('entities.dictoption.main_form.details.extension')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.extension.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.extension" :textareaId="this.$util.createUUID()" :disabled="detailsModel.extension.disabled" type='textarea' textareaStyle="height:200px;" ></input-box> <input-box v-model="data.extension" :textareaId="this.$util.createUUID()" :disabled="detailsModel.extension.disabled" type='textarea' textareaStyle="height:200px;" ></input-box>
</app-form-item> </app-form-item>
...@@ -518,7 +527,8 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -518,7 +527,8 @@ export default class MainBase extends Vue implements ControlInterface {
* @type {*} * @type {*}
* @memberof MainBase * @memberof MainBase
*/ */
public rules: any = { public rules() :any {
return {
srfupdatedate: [ srfupdatedate: [
{ type: 'string', message: '最后修改时间 值必须为字符串类型', trigger: 'change' }, { type: 'string', message: '最后修改时间 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '最后修改时间 值必须为字符串类型', trigger: 'blur' }, { type: 'string', message: '最后修改时间 值必须为字符串类型', trigger: 'blur' },
...@@ -645,6 +655,51 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -645,6 +655,51 @@ export default class MainBase extends Vue implements ControlInterface {
{ required: false, type: 'string', message: '标识 值不能为空', trigger: 'change' }, { required: false, type: 'string', message: '标识 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '标识 值不能为空', trigger: 'blur' }, { required: false, type: 'string', message: '标识 值不能为空', trigger: 'blur' },
], ],
}
}
/**
* 属性值规则
*
* @type {*}
* @memberof MainBase
*/
public deRules:any = {
};
/**
* 校验属性值规则
*
* @public
* @param {{ name: string }} { name }
* @memberof MainBase
*/
public verifyDeRules(name:string,rule:any = this.deRules) :{isPast:boolean,infoMessage:string}{
let falg = {isPast:true,infoMessage:""};
if(!rule[name]){
return falg;
}
rule[name].forEach((item:any) => {
if(item.type == 'SIMPLE' && this.data[this.service.getItemNameByDeName(item.deName)] != item.paramValue){
falg.isPast = false;
falg.infoMessage = item.ruleInfo;
}
if(item.type == 'REGEX' && (item.isNotMode? item.RegExCode.test(this.data[name]) : !item.RegExCode.test(this.data[name]))){
falg.isPast = false;
falg.infoMessage = item.ruleInfo;
}
if(item.type == 'STRINGLENGTH' ){
let valueLength :number = this.data[name]?this.data[name].length:0;
if(item.isNotMode? valueLength > item.minValue && valueLength < item.maxValue : !(valueLength > item.minValue && valueLength < item.maxValue)){
falg.isPast = false;
falg.infoMessage = item.ruleInfo;
}
}
if(item.type == 'GROUP'){
falg = this.verifyDeRules('group',item)
}
});
return falg;
} }
/** /**
...@@ -1042,7 +1097,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1042,7 +1097,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/ */
public checkItem(name:string):Promise<any> { public checkItem(name:string):Promise<any> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
var validator = new schema({[name]:this.rules[name]}); var validator = new schema({[name]:this.rules()[name]});
validator.validate({[name]:this.data[name]}).then(()=>{ validator.validate({[name]:this.data[name]}).then(()=>{
resolve(true); resolve(true);
}) })
...@@ -1473,9 +1528,6 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1473,9 +1528,6 @@ export default class MainBase extends Vue implements ControlInterface {
} }
const data = response.data; const data = response.data;
if(data.dictoption){
Object.assign(this.context,{dictoption:data.dictoption})
}
this.resetDraftFormStates(); this.resetDraftFormStates();
this.onFormLoad(data,'loadDraft'); this.onFormLoad(data,'loadDraft');
this.$emit('load', data); this.$emit('load', data);
......
...@@ -162,7 +162,6 @@ export default class MainService extends ControlService { ...@@ -162,7 +162,6 @@ export default class MainService extends ControlService {
}); });
} }
/** /**
* 添加数据 * 添加数据
* *
...@@ -382,4 +381,25 @@ export default class MainService extends ControlService { ...@@ -382,4 +381,25 @@ export default class MainService extends ControlService {
return {context:tempContext,data:requestData}; return {context:tempContext,data:requestData};
} }
/**
* 通过属性名称获取表单项名称
*
* @param name 实体属性名称
* @memberof MainService
*/
public getItemNameByDeName(name:string) :string{
let itemName = name;
let mode: any = this.getMode();
if (!mode && mode.getDataItems instanceof Function) {
return name;
}
let formItemItems: any[] = mode.getDataItems();
formItemItems.forEach((item:any)=>{
if(item.prop === name){
itemName = item.name;
}
});
return itemName.trim();
}
} }
\ No newline at end of file
...@@ -40,10 +40,11 @@ ...@@ -40,10 +40,11 @@
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}"> @change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box> </input-box>
</app-form-item> </app-form-item>
</template> </template>
<template v-if="!actualIsOpenEdit"> <template v-if="!actualIsOpenEdit">
<app-span name='cid' editorType="HIDDEN" :value="row.cid"></app-span> <app-span name='cid' editorType="HIDDEN" :value="row.cid" dataType="PICKUP" precision="0" ></app-span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -67,10 +68,11 @@ ...@@ -67,10 +68,11 @@
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}"> @change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box> </input-box>
</app-form-item> </app-form-item>
</template> </template>
<template v-if="!actualIsOpenEdit"> <template v-if="!actualIsOpenEdit">
<app-span name='val' editorType="TEXTBOX" :value="row.val"></app-span> <app-span name='val' editorType="TEXTBOX" :value="row.val" dataType="TEXT" precision="0" ></app-span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -94,10 +96,11 @@ ...@@ -94,10 +96,11 @@
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}"> @change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box> </input-box>
</app-form-item> </app-form-item>
</template> </template>
<template v-if="!actualIsOpenEdit"> <template v-if="!actualIsOpenEdit">
<app-span name='label' editorType="TEXTBOX" :value="row.label"></app-span> <app-span name='label' editorType="TEXTBOX" :value="row.label" dataType="TEXT" precision="0" ></app-span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -121,10 +124,11 @@ ...@@ -121,10 +124,11 @@
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}"> @change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box> </input-box>
</app-form-item> </app-form-item>
</template> </template>
<template v-if="!actualIsOpenEdit"> <template v-if="!actualIsOpenEdit">
<app-span name='pval' editorType="TEXTBOX" :value="row.pval"></app-span> <app-span name='pval' editorType="TEXTBOX" :value="row.pval" dataType="TEXT" precision="0" ></app-span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -148,10 +152,11 @@ ...@@ -148,10 +152,11 @@
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}"> @change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box> </input-box>
</app-form-item> </app-form-item>
</template> </template>
<template v-if="!actualIsOpenEdit"> <template v-if="!actualIsOpenEdit">
<app-span name='showorder' editorType="TEXTBOX" :value="row.showorder"></app-span> <app-span name='showorder' editorType="TEXTBOX" :value="row.showorder" dataType="INT" precision="0" ></app-span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -191,7 +196,7 @@ ...@@ -191,7 +196,7 @@
</app-form-item> </app-form-item>
</template> </template>
<template v-if="!actualIsOpenEdit"> <template v-if="!actualIsOpenEdit">
<app-span name='cname' editorType="PICKER" :value="row.cname"></app-span> <app-span name='cname' editorType="PICKER" :value="row.cname" dataType="PICKUPTEXT" precision="0" ></app-span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -215,10 +220,11 @@ ...@@ -215,10 +220,11 @@
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}"> @change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box> </input-box>
</app-form-item> </app-form-item>
</template> </template>
<template v-if="!actualIsOpenEdit"> <template v-if="!actualIsOpenEdit">
<app-span name='cls' editorType="TEXTBOX" :value="row.cls"></app-span> <app-span name='cls' editorType="TEXTBOX" :value="row.cls" dataType="TEXT" precision="0" ></app-span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -242,10 +248,11 @@ ...@@ -242,10 +248,11 @@
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}"> @change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box> </input-box>
</app-form-item> </app-form-item>
</template> </template>
<template v-if="!actualIsOpenEdit"> <template v-if="!actualIsOpenEdit">
<app-span name='iconcls' editorType="TEXTBOX" :value="row.iconcls"></app-span> <app-span name='iconcls' editorType="TEXTBOX" :value="row.iconcls" dataType="TEXT" precision="0" ></app-span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -269,10 +276,11 @@ ...@@ -269,10 +276,11 @@
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}"> @change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box> </input-box>
</app-form-item> </app-form-item>
</template> </template>
<template v-if="!actualIsOpenEdit"> <template v-if="!actualIsOpenEdit">
<app-span name='vfilter' editorType="TEXTBOX" :value="row.vfilter"></app-span> <app-span name='vfilter' editorType="TEXTBOX" :value="row.vfilter" dataType="TEXT" precision="0" ></app-span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -364,10 +372,11 @@ ...@@ -364,10 +372,11 @@
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}"> @change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box> </input-box>
</app-form-item> </app-form-item>
</template> </template>
<template v-if="!actualIsOpenEdit"> <template v-if="!actualIsOpenEdit">
<app-span name='extension' editorType="TEXTBOX" :value="row.extension"></app-span> <app-span name='extension' editorType="TEXTBOX" :value="row.extension" dataType="LONGTEXT_1000" precision="0" ></app-span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -846,7 +855,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -846,7 +855,7 @@ export default class MainBase extends Vue implements ControlInterface {
* *
* @memberof MainBase * @memberof MainBase
*/ */
public defaultUpdateItems:Array<any> =['val','pval','cls','expired','label','cid','srfkey','iconcls','extension','vfilter','showorder','cname','disabled']; public defaultUpdateItems:Array<any> =[,,,,,,,,,,,,];
/** /**
* 选中行数据 * 选中行数据
...@@ -1958,7 +1967,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1958,7 +1967,7 @@ export default class MainBase extends Vue implements ControlInterface {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{ }else{
errorItems.forEach((item:any,index:number)=>{ errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+(this.$t('app.commonWords.saveFailed') as string)+'!' }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: errorMessage[index].data.message });
console.error(errorMessage[index]); console.error(errorMessage[index]);
}); });
} }
......
...@@ -30,31 +30,37 @@ export default class MainModel { ...@@ -30,31 +30,37 @@ export default class MainModel {
name: 'val', name: 'val',
prop: 'value', prop: 'value',
dataType: 'TEXT', dataType: 'TEXT',
isEditable:true
}, },
{ {
name: 'pval', name: 'pval',
prop: 'parent', prop: 'parent',
dataType: 'TEXT', dataType: 'TEXT',
isEditable:true
}, },
{ {
name: 'cls', name: 'cls',
prop: 'cls', prop: 'cls',
dataType: 'TEXT', dataType: 'TEXT',
isEditable:true
}, },
{ {
name: 'expired', name: 'expired',
prop: 'expired', prop: 'expired',
dataType: 'YESNO', dataType: 'YESNO',
isEditable:true
}, },
{ {
name: 'label', name: 'label',
prop: 'label', prop: 'label',
dataType: 'TEXT', dataType: 'TEXT',
isEditable:true
}, },
{ {
name: 'cid', name: 'cid',
prop: 'catalog_id', prop: 'catalog_id',
dataType: 'PICKUP', dataType: 'PICKUP',
isEditable:true
}, },
{ {
name: 'srfmajortext', name: 'srfmajortext',
...@@ -70,26 +76,31 @@ export default class MainModel { ...@@ -70,26 +76,31 @@ export default class MainModel {
name: 'srfkey', name: 'srfkey',
prop: 'value_key', prop: 'value_key',
dataType: 'TEXT', dataType: 'TEXT',
isEditable:true
}, },
{ {
name: 'iconcls', name: 'iconcls',
prop: 'icon_class', prop: 'icon_class',
dataType: 'TEXT', dataType: 'TEXT',
isEditable:true
}, },
{ {
name: 'extension', name: 'extension',
prop: 'extension', prop: 'extension',
dataType: 'LONGTEXT_1000', dataType: 'LONGTEXT_1000',
isEditable:true
}, },
{ {
name: 'vfilter', name: 'vfilter',
prop: 'filter', prop: 'filter',
dataType: 'TEXT', dataType: 'TEXT',
isEditable:true
}, },
{ {
name: 'showorder', name: 'showorder',
prop: 'showorder', prop: 'showorder',
dataType: 'INT', dataType: 'INT',
isEditable:true
}, },
{ {
name: 'updatedate', name: 'updatedate',
...@@ -100,11 +111,13 @@ export default class MainModel { ...@@ -100,11 +111,13 @@ export default class MainModel {
name: 'cname', name: 'cname',
prop: 'catalog_name', prop: 'catalog_name',
dataType: 'PICKUPTEXT', dataType: 'PICKUPTEXT',
isEditable:true
}, },
{ {
name: 'disabled', name: 'disabled',
prop: 'disabled', prop: 'disabled',
dataType: 'YESNO', dataType: 'YESNO',
isEditable:true
}, },
{ {
name: 'dictoption', name: 'dictoption',
......
...@@ -111,7 +111,7 @@ export default class MainService extends ControlService { ...@@ -111,7 +111,7 @@ export default class MainService extends ControlService {
*/ */
@Errorlog @Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true); const {data:Data,context:Context} = this.handleRequestDataWithUpdate(action,context,data,true);
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService; const _appEntityService: any = this.appEntityService;
let result: Promise<any>; let result: Promise<any>;
...@@ -170,14 +170,14 @@ export default class MainService extends ControlService { ...@@ -170,14 +170,14 @@ export default class MainService extends ControlService {
*/ */
@Errorlog @Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true); const {data:Data,context:Context} = this.handleRequestDataWithUpdate(action,context,data,true);
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService; const _appEntityService: any = this.appEntityService;
let result: Promise<any>; let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) { if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Data,Context,isloading); result = _appEntityService[action](Context,Data,isloading);
}else{ }else{
result =_appEntityService.Update(Data,Context,isloading); result =_appEntityService.Update(Context,Data,isloading);
} }
result.then((response) => { result.then((response) => {
this.handleResponse(action, response); this.handleResponse(action, response);
...@@ -317,5 +317,41 @@ export default class MainService extends ControlService { ...@@ -317,5 +317,41 @@ export default class MainService extends ControlService {
}); });
}) })
} }
/**
* 处理请求数据(修改或增加数据)
*
* @param action 行为
* @param data 数据
* @memberof MainService
*/
public handleRequestDataWithUpdate(action: string,context:any ={},data: any = {},isMerge:boolean = false){
let model: any = this.getMode();
if (!model && model.getDataItems instanceof Function) {
return data;
}
let dataItems: any[] = model.getDataItems();
let requestData:any = {};
if(isMerge && (data && data.viewparams)){
Object.assign(requestData,data.viewparams);
}
dataItems.forEach((item:any) =>{
if(item && item.dataType && Object.is(item.dataType,'FONTKEY')){
if(item && item.prop && item.name ){
requestData[item.prop] = context[item.name];
}
}else{
if(item && item.isEditable && item.prop && item.name && (data[item.name] || Object.is(data[item.name],0)) ){
requestData[item.prop] = data[item.name];
}
}
});
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
...@@ -40,10 +40,11 @@ ...@@ -40,10 +40,11 @@
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}"> @change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box> </input-box>
</app-form-item> </app-form-item>
</template> </template>
<template v-if="!actualIsOpenEdit"> <template v-if="!actualIsOpenEdit">
<app-span name='cid' editorType="HIDDEN" :value="row.cid"></app-span> <app-span name='cid' editorType="HIDDEN" :value="row.cid" dataType="PICKUP" precision="0" ></app-span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -67,10 +68,11 @@ ...@@ -67,10 +68,11 @@
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}"> @change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box> </input-box>
</app-form-item> </app-form-item>
</template> </template>
<template v-if="!actualIsOpenEdit"> <template v-if="!actualIsOpenEdit">
<app-span name='val' editorType="TEXTBOX" :value="row.val"></app-span> <app-span name='val' editorType="TEXTBOX" :value="row.val" dataType="TEXT" precision="0" ></app-span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -94,10 +96,11 @@ ...@@ -94,10 +96,11 @@
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}"> @change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box> </input-box>
</app-form-item> </app-form-item>
</template> </template>
<template v-if="!actualIsOpenEdit"> <template v-if="!actualIsOpenEdit">
<app-span name='label' editorType="TEXTBOX" :value="row.label"></app-span> <app-span name='label' editorType="TEXTBOX" :value="row.label" dataType="TEXT" precision="0" ></app-span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -121,10 +124,11 @@ ...@@ -121,10 +124,11 @@
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}"> @change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box> </input-box>
</app-form-item> </app-form-item>
</template> </template>
<template v-if="!actualIsOpenEdit"> <template v-if="!actualIsOpenEdit">
<app-span name='pval' editorType="TEXTBOX" :value="row.pval"></app-span> <app-span name='pval' editorType="TEXTBOX" :value="row.pval" dataType="TEXT" precision="0" ></app-span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -148,10 +152,11 @@ ...@@ -148,10 +152,11 @@
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}"> @change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box> </input-box>
</app-form-item> </app-form-item>
</template> </template>
<template v-if="!actualIsOpenEdit"> <template v-if="!actualIsOpenEdit">
<app-span name='showorder' editorType="TEXTBOX" :value="row.showorder"></app-span> <app-span name='showorder' editorType="TEXTBOX" :value="row.showorder" dataType="INT" precision="0" ></app-span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -191,7 +196,7 @@ ...@@ -191,7 +196,7 @@
</app-form-item> </app-form-item>
</template> </template>
<template v-if="!actualIsOpenEdit"> <template v-if="!actualIsOpenEdit">
<app-span name='cname' editorType="PICKER" :value="row.cname"></app-span> <app-span name='cname' editorType="PICKER" :value="row.cname" dataType="PICKUPTEXT" precision="0" ></app-span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -215,10 +220,11 @@ ...@@ -215,10 +220,11 @@
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}"> @change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box> </input-box>
</app-form-item> </app-form-item>
</template> </template>
<template v-if="!actualIsOpenEdit"> <template v-if="!actualIsOpenEdit">
<app-span name='cls' editorType="TEXTBOX" :value="row.cls"></app-span> <app-span name='cls' editorType="TEXTBOX" :value="row.cls" dataType="TEXT" precision="0" ></app-span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -242,10 +248,11 @@ ...@@ -242,10 +248,11 @@
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}"> @change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box> </input-box>
</app-form-item> </app-form-item>
</template> </template>
<template v-if="!actualIsOpenEdit"> <template v-if="!actualIsOpenEdit">
<app-span name='iconcls' editorType="TEXTBOX" :value="row.iconcls"></app-span> <app-span name='iconcls' editorType="TEXTBOX" :value="row.iconcls" dataType="TEXT" precision="0" ></app-span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -269,10 +276,11 @@ ...@@ -269,10 +276,11 @@
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}"> @change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box> </input-box>
</app-form-item> </app-form-item>
</template> </template>
<template v-if="!actualIsOpenEdit"> <template v-if="!actualIsOpenEdit">
<app-span name='vfilter' editorType="TEXTBOX" :value="row.vfilter"></app-span> <app-span name='vfilter' editorType="TEXTBOX" :value="row.vfilter" dataType="TEXT" precision="0" ></app-span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -364,10 +372,11 @@ ...@@ -364,10 +372,11 @@
@change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}"> @change="($event)=>{gridEditItemChange(row, column.property, $event, $index)}">
</input-box> </input-box>
</app-form-item> </app-form-item>
</template> </template>
<template v-if="!actualIsOpenEdit"> <template v-if="!actualIsOpenEdit">
<app-span name='extension' editorType="TEXTBOX" :value="row.extension"></app-span> <app-span name='extension' editorType="TEXTBOX" :value="row.extension" dataType="LONGTEXT_1000" precision="0" ></app-span>
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
...@@ -834,7 +843,7 @@ export default class OptionsBase extends Vue implements ControlInterface { ...@@ -834,7 +843,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
* *
* @memberof OptionsBase * @memberof OptionsBase
*/ */
public defaultUpdateItems:Array<any> =['val','pval','cls','expired','label','cid','srfkey','iconcls','extension','vfilter','showorder','cname','disabled']; public defaultUpdateItems:Array<any> =[,,,,,,,,,,,,];
/** /**
* 选中行数据 * 选中行数据
...@@ -1938,7 +1947,7 @@ export default class OptionsBase extends Vue implements ControlInterface { ...@@ -1938,7 +1947,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) }); this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{ }else{
errorItems.forEach((item:any,index:number)=>{ errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: item.majorentityname+(this.$t('app.commonWords.saveFailed') as string)+'!' }); this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: errorMessage[index].data.message });
console.error(errorMessage[index]); console.error(errorMessage[index]);
}); });
} }
......
...@@ -30,31 +30,37 @@ export default class OptionsModel { ...@@ -30,31 +30,37 @@ export default class OptionsModel {
name: 'val', name: 'val',
prop: 'value', prop: 'value',
dataType: 'TEXT', dataType: 'TEXT',
isEditable:true
}, },
{ {
name: 'pval', name: 'pval',
prop: 'parent', prop: 'parent',
dataType: 'TEXT', dataType: 'TEXT',
isEditable:true
}, },
{ {
name: 'cls', name: 'cls',
prop: 'cls', prop: 'cls',
dataType: 'TEXT', dataType: 'TEXT',
isEditable:true
}, },
{ {
name: 'expired', name: 'expired',
prop: 'expired', prop: 'expired',
dataType: 'YESNO', dataType: 'YESNO',
isEditable:true
}, },
{ {
name: 'label', name: 'label',
prop: 'label', prop: 'label',
dataType: 'TEXT', dataType: 'TEXT',
isEditable:true
}, },
{ {
name: 'cid', name: 'cid',
prop: 'catalog_id', prop: 'catalog_id',
dataType: 'PICKUP', dataType: 'PICKUP',
isEditable:true
}, },
{ {
name: 'srfmajortext', name: 'srfmajortext',
...@@ -70,36 +76,43 @@ export default class OptionsModel { ...@@ -70,36 +76,43 @@ export default class OptionsModel {
name: 'srfkey', name: 'srfkey',
prop: 'value_key', prop: 'value_key',
dataType: 'TEXT', dataType: 'TEXT',
isEditable:true
}, },
{ {
name: 'iconcls', name: 'iconcls',
prop: 'icon_class', prop: 'icon_class',
dataType: 'TEXT', dataType: 'TEXT',
isEditable:true
}, },
{ {
name: 'extension', name: 'extension',
prop: 'extension', prop: 'extension',
dataType: 'LONGTEXT_1000', dataType: 'LONGTEXT_1000',
isEditable:true
}, },
{ {
name: 'vfilter', name: 'vfilter',
prop: 'filter', prop: 'filter',
dataType: 'TEXT', dataType: 'TEXT',
isEditable:true
}, },
{ {
name: 'showorder', name: 'showorder',
prop: 'showorder', prop: 'showorder',
dataType: 'INT', dataType: 'INT',
isEditable:true
}, },
{ {
name: 'cname', name: 'cname',
prop: 'catalog_name', prop: 'catalog_name',
dataType: 'PICKUPTEXT', dataType: 'PICKUPTEXT',
isEditable:true
}, },
{ {
name: 'disabled', name: 'disabled',
prop: 'disabled', prop: 'disabled',
dataType: 'YESNO', dataType: 'YESNO',
isEditable:true
}, },
{ {
name: 'dictoption', name: 'dictoption',
......
...@@ -111,7 +111,7 @@ export default class OptionsService extends ControlService { ...@@ -111,7 +111,7 @@ export default class OptionsService extends ControlService {
*/ */
@Errorlog @Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true); const {data:Data,context:Context} = this.handleRequestDataWithUpdate(action,context,data,true);
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService; const _appEntityService: any = this.appEntityService;
let result: Promise<any>; let result: Promise<any>;
...@@ -170,14 +170,14 @@ export default class OptionsService extends ControlService { ...@@ -170,14 +170,14 @@ export default class OptionsService extends ControlService {
*/ */
@Errorlog @Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true); const {data:Data,context:Context} = this.handleRequestDataWithUpdate(action,context,data,true);
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService; const _appEntityService: any = this.appEntityService;
let result: Promise<any>; let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) { if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Data,Context,isloading); result = _appEntityService[action](Context,Data,isloading);
}else{ }else{
result =_appEntityService.Update(Data,Context,isloading); result =_appEntityService.Update(Context,Data,isloading);
} }
result.then((response) => { result.then((response) => {
this.handleResponse(action, response); this.handleResponse(action, response);
...@@ -296,7 +296,7 @@ export default class OptionsService extends ControlService { ...@@ -296,7 +296,7 @@ export default class OptionsService extends ControlService {
* @param {*} [data={}] * @param {*} [data={}]
* @param {boolean} [isloading] * @param {boolean} [isloading]
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof MainService * @memberof OptionsService
*/ */
@Errorlog @Errorlog
public frontLogic(action:string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> { public frontLogic(action:string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
...@@ -317,5 +317,41 @@ export default class OptionsService extends ControlService { ...@@ -317,5 +317,41 @@ export default class OptionsService extends ControlService {
}); });
}) })
} }
/**
* 处理请求数据(修改或增加数据)
*
* @param action 行为
* @param data 数据
* @memberof OptionsService
*/
public handleRequestDataWithUpdate(action: string,context:any ={},data: any = {},isMerge:boolean = false){
let model: any = this.getMode();
if (!model && model.getDataItems instanceof Function) {
return data;
}
let dataItems: any[] = model.getDataItems();
let requestData:any = {};
if(isMerge && (data && data.viewparams)){
Object.assign(requestData,data.viewparams);
}
dataItems.forEach((item:any) =>{
if(item && item.dataType && Object.is(item.dataType,'FONTKEY')){
if(item && item.prop && item.name ){
requestData[item.prop] = context[item.name];
}
}else{
if(item && item.isEditable && item.prop && item.name && (data[item.name] || Object.is(data[item.name],0)) ){
requestData[item.prop] = data[item.name];
}
}
});
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
...@@ -1210,6 +1210,11 @@ ...@@ -1210,6 +1210,11 @@
dependencies: dependencies:
mkdirp "^1.0.4" mkdirp "^1.0.4"
"@popperjs/core@^2.4.3":
version "2.4.4"
resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.4.4.tgz#11d5db19bd178936ec89cd84519c4de439574398"
integrity sha512-1oO6+dN5kdIA3sKPZhRGJTfGVP4SWV6KqlMOwry4J3HfyD68sl/3KmG7DeYUzvN+RbhXDnv/D8vNNB8168tAMg==
"@soda/friendly-errors-webpack-plugin@^1.7.1": "@soda/friendly-errors-webpack-plugin@^1.7.1":
version "1.7.1" version "1.7.1"
resolved "https://registry.yarnpkg.com/@soda/friendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-1.7.1.tgz#706f64bcb4a8b9642b48ae3ace444c70334d615d" resolved "https://registry.yarnpkg.com/@soda/friendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-1.7.1.tgz#706f64bcb4a8b9642b48ae3ace444c70334d615d"
......
...@@ -9,31 +9,31 @@ zuul: ...@@ -9,31 +9,31 @@ zuul:
routes: routes:
dict_catalog: dict_catalog:
path: /dictcatalogs/** path: /dictcatalogs/**
serviceId: ibzdict-api serviceId: ${ibiz.ref.service.ibzdict-api:ibzdict-api}
stripPrefix: false stripPrefix: false
dict_option: dict_option:
path: /dictoptions/** path: /dictoptions/**
serviceId: ibzdict-api serviceId: ${ibiz.ref.service.ibzdict-api:ibzdict-api}
stripPrefix: false stripPrefix: false
loginv7: loginv7:
path: /v7/login path: /v7/login
serviceId: ibzuaa-api serviceId: ${ibiz.ref.service.uaa:ibzuaa-api}
stripPrefix: false stripPrefix: false
changepwd: changepwd:
path: /v7/changepwd path: /v7/changepwd
serviceId: ibzuaa-api serviceId: ${ibiz.ref.service.uaa:ibzuaa-api}
stripPrefix: false stripPrefix: false
uaa: uaa:
path: /uaa/** path: /uaa/**
serviceId: ibzuaa-api serviceId: ${ibiz.ref.service.uaa:ibzuaa-api}
stripPrefix: false stripPrefix: false
config: config:
path: /config/** path: /config/**
serviceId: ibzuaa-api serviceId: ${ibiz.ref.service.uaa:ibzuaa-api}
stripPrefix: false stripPrefix: false
oucore: oucore:
path: /ibzorganizations/** path: /ibzorganizations/**
serviceId: ibzou-api serviceId: ${ibiz.ref.service.ou:ibzou-api}
stripPrefix: false stripPrefix: false
sensitive-headers: sensitive-headers:
- Cookie,Set-Cookie,Authorization - Cookie,Set-Cookie,Authorization
spring: spring:
profiles: profiles:
include: sys , web-prod include: sys ,nacos, web-prod
application: application:
name: ibzdict-web name: ibzdict-web
spring: spring:
profiles: profiles:
include: sys , web-dev, api-dev, dev include: sys ,nacos, web-dev, api-dev, dev
application: application:
name: ibzdict name: ibzdict
main: main:
......
<?xml version="1.1" encoding="UTF-8" standalone="no"?> !!!!模版产生代码错误:----
<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"> Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
<!--输出实体[DICT_CATALOG]数据结构 --> FTL stack trace ("~" means nesting-related):
<changeSet author="a_A_5d9d78509" id="tab-dict_catalog-67-1"> - Failed at: ${dbinst.getUserName()} [in template "CODETEMPL_zh_CN" at line 28, column 24]
<createTable tableName="IBZDICTCATALOG"> ----
<column name="CID" remarks="" type="VARCHAR(100)"> \ No newline at end of file
<constraints primaryKey="true" primaryKeyName="PK_DICT_CATALOG_CID"/>
</column>
<column name="CCODE" remarks="" type="VARCHAR(100)">
</column>
<column name="CNAME" remarks="" type="VARCHAR(100)">
</column>
<column name="CGROUP" remarks="" type="VARCHAR(100)">
</column>
<column name="MEMO" remarks="" type="VARCHAR(255)">
</column>
<column name="ENABLE" remarks="" type="INT">
</column>
<column name="UPDATEDATE" remarks="" type="DATETIME">
</column>
</createTable>
</changeSet>
<!--输出实体[DICT_OPTION]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-dict_option-95-2">
<createTable tableName="IBZDICTOPTION">
<column name="VKEY" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_DICT_OPTION_VKEY"/>
</column>
<column name="CID" remarks="" type="VARCHAR(100)">
</column>
<column name="CNAME" remarks="" type="VARCHAR(100)">
</column>
<column name="VAL" remarks="" type="VARCHAR(40)">
</column>
<column name="LABEL" remarks="" type="VARCHAR(100)">
</column>
<column name="PVAL" remarks="" type="VARCHAR(40)">
</column>
<column name="VFILTER" remarks="" type="VARCHAR(500)">
</column>
<column name="CLS" remarks="" type="VARCHAR(500)">
</column>
<column name="ICONCLS" remarks="" type="VARCHAR(255)">
</column>
<column name="DISABLED" remarks="" type="INT">
</column>
<column name="EXPIRED" remarks="" type="INT">
</column>
<column name="SHOWORDER" remarks="" type="INT">
</column>
<column name="EXTENSION" remarks="" type="VARCHAR(1000)">
</column>
<column name="UPDATEDATE" remarks="" type="DATETIME">
</column>
</createTable>
</changeSet>
<!--输出实体[DICT_CATALOG]外键关系 -->
<!--输出实体[DICT_OPTION]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-dict_option-95-3">
<addForeignKeyConstraint baseColumnNames="CID" baseTableName="IBZDICTOPTION" constraintName="DER1N_DICT_OPTION_DICT_CATALOG" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="CID" referencedTableName="IBZDICTCATALOG" validate="true"/>
</changeSet>
</databaseChangeLog>
...@@ -77,6 +77,9 @@ ...@@ -77,6 +77,9 @@
<!--baomidou-jobs定时服务 --> <!--baomidou-jobs定时服务 -->
<baomidou-jobs.version>1.0.3</baomidou-jobs.version> <baomidou-jobs.version>1.0.3</baomidou-jobs.version>
<!-- eureka微服务注册中心 -->
<eureka-client.version>2.2.1.RELEASE</eureka-client.version>
<oracle.version>11.2.0.3</oracle.version> <oracle.version>11.2.0.3</oracle.version>
<postgresql.version>42.2.6</postgresql.version> <postgresql.version>42.2.6</postgresql.version>
...@@ -314,6 +317,13 @@ ...@@ -314,6 +317,13 @@
<artifactId>h2</artifactId> <artifactId>h2</artifactId>
</dependency> </dependency>
<!-- eureka服务注册中心 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<version>${eureka-client.version}</version>
</dependency>
<!-- Oracle驱动包 --> <!-- Oracle驱动包 -->
<dependency> <dependency>
<groupId>com.oracle</groupId> <groupId>com.oracle</groupId>
...@@ -332,6 +342,7 @@ ...@@ -332,6 +342,7 @@
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
spring: spring:
profiles: profiles:
include: sys , api-prod include: sys ,nacos, api-prod
application: application:
name: ibzdict-api name: ibzdict-api
\ No newline at end of file
...@@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.PathVariable; ...@@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@FeignClient(value = "ibzou-api",fallback = IBZOUFallback.class) @FeignClient(value = "${ibiz.ref.service.ou:ibzou-api}",fallback = IBZOUFallback.class)
public interface IBZOUFeignClient public interface IBZOUFeignClient
{ {
/** /**
......
...@@ -7,7 +7,7 @@ import org.springframework.cloud.openfeign.FeignClient; ...@@ -7,7 +7,7 @@ import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@FeignClient(value = "ibzuaa-api",fallback = IBZUAAFallback.class) @FeignClient(value = "${ibiz.ref.service.uaa:ibzuaa-api}",fallback = IBZUAAFallback.class)
public interface IBZUAAFeignClient public interface IBZUAAFeignClient
{ {
/** /**
......
...@@ -4,7 +4,7 @@ import org.springframework.cloud.openfeign.FeignClient; ...@@ -4,7 +4,7 @@ import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.*; import java.util.*;
@FeignClient(value = "ibzwf-api",fallback = IBZWFFallback.class) @FeignClient(value = "${ibiz.ref.service.wf:ibzwf-api}",fallback = IBZWFFallback.class)
public interface IBZWFFeignClient public interface IBZWFFeignClient
{ {
@RequestMapping(method = RequestMethod.GET, value = "/{system}-app-{appname}/{entity}/process-definitions/{processDefinitionKey}/usertasks/{taskDefinitionKey}/tasks") @RequestMapping(method = RequestMethod.GET, value = "/{system}-app-{appname}/{entity}/process-definitions/{processDefinitionKey}/usertasks/{taskDefinitionKey}/tasks")
......
...@@ -4,9 +4,9 @@ import lombok.Data; ...@@ -4,9 +4,9 @@ import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Data
@Component @Component
@ConfigurationProperties(prefix = "spring.datasource") @ConfigurationProperties(prefix = "spring.datasource")
@Data
public class LiquibaseProp{ public class LiquibaseProp{
private String url; private String url;
......
...@@ -65,6 +65,10 @@ public class AuthenticationUser implements UserDetails ...@@ -65,6 +65,10 @@ public class AuthenticationUser implements UserDetails
@JsonIgnore @JsonIgnore
private Map<String,Object> userSessionParam;//用户自定义session值 private Map<String,Object> userSessionParam;//用户自定义session值
private Map<String, Set<String>> orgInfo;//上下级组织信息 private Map<String, Set<String>> orgInfo;//上下级组织信息
private String porg;
private String sorg;
private String pdept;
private String sdept;
@JsonIgnore @JsonIgnore
...@@ -133,6 +137,10 @@ public class AuthenticationUser implements UserDetails ...@@ -133,6 +137,10 @@ public class AuthenticationUser implements UserDetails
sessionParams.put("srflocale", this.getLang()); sessionParams.put("srflocale", this.getLang());
sessionParams.put("srftimezone", ""); sessionParams.put("srftimezone", "");
sessionParams.put("srfusercode", this.getUsercode()); sessionParams.put("srfusercode", this.getUsercode());
sessionParams.put("srfporg", this.getPorg());
sessionParams.put("srfsorg", this.getSorg());
sessionParams.put("srfpdept", this.getPdept());
sessionParams.put("srfsdept", this.getSdept());
} }
return this.sessionParams; return this.sessionParams;
} }
...@@ -143,6 +151,26 @@ public class AuthenticationUser implements UserDetails ...@@ -143,6 +151,26 @@ public class AuthenticationUser implements UserDetails
return new HashMap<>(); return new HashMap<>();
} }
public void setOrgInfo(Map<String, Set<String>> orgInfo) {
this.orgInfo = orgInfo;
if(!ObjectUtils.isEmpty(orgInfo) && !ObjectUtils.isEmpty(orgInfo.get("parentorg"))){
porg=(String.format("'%s'",String.join("','",orgInfo.get("parentorg"))));
this.getSessionParams().put("srfporg",porg);
}
if(!ObjectUtils.isEmpty(orgInfo) && !ObjectUtils.isEmpty(orgInfo.get("suborg")) ){
sorg=(String.format("'%s'",String.join("','",orgInfo.get("suborg"))));
this.getSessionParams().put("srfsorg",sorg);
}
if(!ObjectUtils.isEmpty(orgInfo) && !ObjectUtils.isEmpty(orgInfo.get("parentdept"))){
pdept=(String.format("'%s'",String.join("','",orgInfo.get("parentdept"))));
this.getSessionParams().put("srfpdept",pdept);
}
if(!ObjectUtils.isEmpty(orgInfo) && !ObjectUtils.isEmpty(orgInfo.get("subdept"))){
sdept=(String.format("'%s'",String.join("','",orgInfo.get("subdept"))));
this.getSessionParams().put("srfsdept",sdept);
}
}
public void setPermissionList(JSONObject permissionList) { public void setPermissionList(JSONObject permissionList) {
this.permissionList = permissionList; this.permissionList = permissionList;
if(authorities==null && permissionList !=null){ if(authorities==null && permissionList !=null){
......
#eureka配置中心
spring:
cloud:
nacos:
discovery:
enabled: false
eureka:
client:
enabled: true
serviceUrl:
defaultZone: http://127.0.0.1:8762/eureka/
#nacos配置中心
spring:
cloud:
nacos:
discovery:
server-addr: 172.16.102.211:8848
enabled: true
eureka:
client:
enabled: false
#nacos配置中心、数据源 #缓存、数据源
spring: spring:
cloud:
nacos:
discovery:
server-addr: 172.16.102.211:8848
cache: cache:
redis: redis:
time-to-live: 3600 time-to-live: 3600
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册