提交 2ec60a6e 编写于 作者: ibizdev's avatar ibizdev

ibiz4j 发布系统代码

上级 205380a0
...@@ -93,6 +93,11 @@ ...@@ -93,6 +93,11 @@
<template v-if="!Object.is(layoutType, 'FLEX')"> <template v-if="!Object.is(layoutType, 'FLEX')">
<row :gutter="10"><slot></slot></row> <row :gutter="10"><slot></slot></row>
</template> </template>
<template v-if="isManageContainer">
<i-button type="primary" :icon="manageContainerStatus?'ios-repeat':'ios-more'" @click="doManageContainer">
{{manageContainerStatus?$t('components.appFormGroup.hide'):$t('components.appFormGroup.showMore')}}
</i-button>
</template>
</card> </card>
<template v-if="isShowCaption === false"> <template v-if="isShowCaption === false">
<slot></slot> <slot></slot>
...@@ -115,6 +120,22 @@ export default class AppFormGroup extends Vue { ...@@ -115,6 +120,22 @@ export default class AppFormGroup extends Vue {
*/ */
@Prop() public caption?: string; @Prop() public caption?: string;
/**
* 是否为管理容器
*
* @type {string}
* @memberof AppFormGroup
*/
@Prop({ default: false }) public isManageContainer?: boolean;
/**
* 管理容器状态
*
* @type {string}
* @memberof AppFormGroup
*/
@Prop({ default: false }) public manageContainerStatus?: boolean;
/** /**
* 内置界面样式 * 内置界面样式
* *
...@@ -244,6 +265,16 @@ export default class AppFormGroup extends Vue { ...@@ -244,6 +265,16 @@ export default class AppFormGroup extends Vue {
public doUIAction($event: any, item: any): void { public doUIAction($event: any, item: any): void {
this.$emit('groupuiactionclick', { event: $event, item: item }); this.$emit('groupuiactionclick', { event: $event, item: item });
} }
/**
* 操作管理容器
*
* @param {*} $event
* @memberof AppFormGroup
*/
public doManageContainer(){
this.$emit('managecontainerclick');
}
} }
</script> </script>
<style lang='less'> <style lang='less'>
......
...@@ -44,6 +44,11 @@ export default class AppMpicker extends Vue { ...@@ -44,6 +44,11 @@ export default class AppMpicker extends Vue {
*/ */
@Prop() curvalue?: any; @Prop() curvalue?: any;
/**
* 值项
*/
@Prop() valueitem?: any;
/** /**
* 局部上下文导航参数 * 局部上下文导航参数
* *
...@@ -144,14 +149,34 @@ export default class AppMpicker extends Vue { ...@@ -144,14 +149,34 @@ export default class AppMpicker extends Vue {
this.value = []; this.value = [];
this.selectItems = []; this.selectItems = [];
if (newVal) { if (newVal) {
this.selectItems = this.parseValue(JSON.parse(newVal)); try {
this.selectItems.forEach((item: any) => { this.selectItems = this.parseValue(JSON.parse(newVal));
this.value.push(item[this.deKeyField]); this.selectItems.forEach((item: any) => {
let index = this.items.findIndex((i) => Object.is(i[this.deKeyField], item[this.deKeyField])); this.value.push(item[this.deKeyField]);
if (index < 0) { let index = this.items.findIndex((i) => Object.is(i[this.deKeyField], item[this.deKeyField]));
this.items.push({ [this.deMajorField]: item[this.deMajorField], [this.deKeyField]: item[this.deKeyField] }); if (index < 0) {
this.items.push({ [this.deMajorField]: item[this.deMajorField], [this.deKeyField]: item[this.deKeyField] });
}
});
} catch (error) {
if(error.name === 'SyntaxError'){
let srfkeys:any = newVal.split(',');
let srfmajortexts:any = null;
if(this.valueitem && this.activeData[this.valueitem]){
srfmajortexts = this.activeData[this.valueitem].split(',');
} }
}); if(srfkeys.length && srfkeys.length > 0 && srfmajortexts.length && srfmajortexts.length > 0 && srfkeys.length == srfmajortexts.length){
srfkeys.forEach((id: any, index: number) => {
this.value.push(id);
this.selectItems.push({[this.deKeyField]: id, [this.deMajorField]: srfmajortexts[index]});
let _index = this.items.findIndex((i) => Object.is(i[this.deKeyField],id));
if (_index < 0) {
this.items.push({[this.deKeyField]: id, [this.deMajorField]: srfmajortexts[index]});
}
});
}
}
}
} }
this.$forceUpdate(); this.$forceUpdate();
} }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</span> </span>
</el-col> </el-col>
<el-col :span="14"> <el-col :span="14">
<span>{{ item.label }}</span> <span>{{ item.fullName ? item.fullName:item.label }}</span>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<div class="bar"> <div class="bar">
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<Drawer class-name="menu-drawer" width="60" :closable="true" :mask="false" placement="left" v-model="rightDrawerVisiable"> <Drawer class-name="menu-drawer" width="60" :closable="true" :mask="false" placement="left" v-model="rightDrawerVisiable">
<div class="menuItems"> <div class="menuItems">
<div @click="skipTo(item)" class="item" v-for="(item) in list" :key="item.id"> <div @click="skipTo(item)" class="item" v-for="(item) in list" :key="item.id">
<span class="title">{{item.label}}</span> <span class="title">{{ item.fullName ? item.fullName:item.label }}</span>
<span v-if="isStar(item.id)" class="star" @click.stop="outStar(item)"> <span v-if="isStar(item.id)" class="star" @click.stop="outStar(item)">
<Icon type="ios-star" /> <Icon type="ios-star" />
</span> </span>
......
<template>
<el-select size="small" class="filter-mode" placeholder="条件逻辑" clearable v-model="curVal" @change="onChange">
<el-option
v-for="mode in filterMode"
:key="mode.value"
:label="mode.en"
:value="mode.value"
>
</el-option>
</el-select>
</template>
<script lang="ts">
import { Vue, Component, Model } from "vue-property-decorator";
@Component({})
export default class FilterMode extends Vue {
/**
* 值属性
*
* @type {*}
* @memberof FilterMode
*/
@Model('change') readonly value: any;
get curVal() {
return this.value;
}
set curVal(val: any) {
const type: string = this.$util.typeOf(val);
val = Object.is(type, 'null') || Object.is(type, 'undefined') ? undefined : val;
this.$emit('change', val);
}
/**
* 过滤模式
*
* @type {*}
* @memberof FilterMode
*/
public filterMode: any[] = [
// { name: 'AND', value: '$and' },
// { name: 'OR', value: '$or' },
{ zh: '等于(=)', en: 'EQ', value: '$eq' },
{ zh: '', en: 'NE', value: '$ne' },
{ zh: '', en: 'GT', value: '$gt' },
{ zh: '', en: 'GE', value: '$gte' },
{ zh: '', en: 'LT', value: '$lt' },
{ zh: '', en: 'LE', value: '$lte' },
{ zh: '', en: 'IS_NULL', value: '$null' },
{ zh: '', en: 'IS_NOT_NULL', value: '$notNull' },
{ zh: '', en: 'IN', value: '$in' },
{ zh: '', en: 'NOTIN', value: '$notIn' },
{ zh: '', en: 'LIKE', value: '$like' },
{ zh: '', en: 'LIFTLIKE', value: '$startsWith' },
{ zh: '', en: 'RIGHTLIKE', value: '$endsWith' },
{ zh: '', en: 'EXISTS', value: '$exists' },
{ zh: '', en: 'NOTEXISTS', value: '$notExists' }
];
/**
* 值改变
*
* @memberof FilterMode
*/
public onChange() {
this.$emit('mode-change', this.value);
}
}
</script>
\ No newline at end of file
.filter-item {
display: flex;
// margin-top: 10px;
.fa-trash-o {
color: red;
}
.filter-item-group {
width: 100px;
margin-left: 5px;
}
.filter-item-field {
width: 200px;
margin-left: 5px;
}
.filter-item-mode {
width: 200px;
margin-left: 5px;
}
.filter-item-value {
margin-left: 5px;
flex-grow: 1;
}
}
.filter-tree {
.el-tree-node__content {
height: 40px;
.filter-tree-item {
display: flex;
>div {
margin-right: 10px;
}
>div:nth-last-child(1) {
margin-right: 0;
}
.filter-tree-action {
margin-left: 20px;
.ivu-btn {
margin-right: 5px;
}
}
}
}
}
\ No newline at end of file
<template>
<el-tree class="filter-tree" :data="treeItems" :props="defaultProps" :expand-on-click-node="false" default-expand-all>
<template slot-scope="{ node, data }">
<template v-if="Object.is(data.name, '$and') || Object.is(data.name, '$or')">
<div class="filter-tree-item">
<el-select size="small" v-model="data.name">
<el-option v-for="mode in relationModes" :key="mode.value" :label="mode.zh" :value="mode.value"></el-option>
</el-select>
<div class="filter-tree-action">
<i-button title="添加条件" @click="onAddItem(data)"><i class="fa fa-plus" aria-hidden="true"></i> 添加条件</i-button>
<i-button title="添加组" @click="onAddGroup(data)"><i class="fa fa-plus" aria-hidden="true"></i> 添加组</i-button>
</div>
</div>
</template>
<template v-else>
<div class="filter-tree-item">
<el-select size="small" class="filter-item-field" v-model="data.field" clearable placeholder="属性" @change="onFieldChange(data)">
<el-option
v-for="item in fields"
:key="item.prop"
:label="item.label"
:value="item.name">
</el-option>
</el-select>
<filter-mode class="filter-item-mode" v-model="data.mode"></filter-mode>
<div class="filter-item-value">
<i-input v-if="!data.field"></i-input>
<slot v-else :data="data"></slot>
</div>
<div class="filter-tree-action">
<i-button @click="onRemoveItem(node, data)" title="删除"><i class="fa fa-trash-o" aria-hidden="true"></i></i-button>
</div>
</div>
</template>
</template>
</el-tree>
</template>
<script lang="ts">
import {Vue, Component, Prop} from 'vue-property-decorator';
import FilterMode from './filter-mode.vue';
@Component({
components: {
FilterMode
}
})
export default class FilterTree extends Vue {
@Prop() datas: any;
@Prop() fields: any;
protected defaultProps: any = {
children: 'items',
label: 'name'
};
protected relationModes: any[] = [
{ zh: '并且', en: 'AND', value: '$and' },
{ zh: '或', en: 'OR', value: '$or' }
];
get treeItems() {
let root: any = {
name: '$and',
items: this.datas
};
if(this.datas.length == 0) {
this.onAddItem(root);
this.onAddItem(root);
}
return [root];
}
public onFieldChange(data: any) {
if(!data.mode) {
data.mode = '$eq';
}
}
public onAddItem(data: any) {
if(data && data.items) {
data.items.push({
field: null,
mode: null
});
}
}
public onAddGroup(data: any) {
if(data && data.items) {
data.items.push({
name: '$and',
items: []
})
}
}
public onRemoveItem(node: any, data: any) {
if(node && node.parent) {
let pData: any = node.parent.data;
if(pData.items.indexOf(data) >= 0) {
pData.items.splice(pData.items.indexOf(data), 1)
}
}
}
}
</script>
<style lang="less">
@import './filter-tree.less';
</style>
\ No newline at end of file
.ibiz-page-tag { .ibiz-page-tag {
position: relative; position: relative;
margin: 8px 0;
.left{ .left{
.el-tabs__header{ .el-tabs__header{
padding-right:120px; padding-right:120px;
...@@ -60,7 +61,8 @@ ...@@ -60,7 +61,8 @@
border-bottom:2px solid transparent !important; border-bottom:2px solid transparent !important;
} }
.el-tabs__header{ .el-tabs__header{
margin:0 0 1 0; margin:0;
border-bottom: none;
} }
} }
} }
......
...@@ -395,6 +395,9 @@ export default class MDViewEngine extends ViewEngine { ...@@ -395,6 +395,9 @@ export default class MDViewEngine extends ViewEngine {
if (this.getSearchForm() && this.view.isExpandSearchForm) { if (this.getSearchForm() && this.view.isExpandSearchForm) {
Object.assign(arg, this.getSearchForm().getData()); Object.assign(arg, this.getSearchForm().getData());
} }
if (this.view && this.view.searchbar) {
Object.assign(arg, this.view.searchbar.getData());
}
if (this.view && !this.view.isExpandSearchForm) { if (this.view && !this.view.isExpandSearchForm) {
Object.assign(arg, { query: this.view.query }); Object.assign(arg, { query: this.view.query });
} }
......
...@@ -169,4 +169,8 @@ export default { ...@@ -169,4 +169,8 @@ export default {
YouYuan: 'YouYuan', YouYuan: 'YouYuan',
}, },
}, },
appFormGroup: {
hide: 'hide',
showMore: 'show more',
},
}; };
\ No newline at end of file
...@@ -170,4 +170,8 @@ export default { ...@@ -170,4 +170,8 @@ export default {
YouYuan: '幼圆', YouYuan: '幼圆',
}, },
}, },
appFormGroup: {
hide: '隐藏字段',
showMore: '显示更多字段',
},
}; };
\ No newline at end of file
...@@ -46,6 +46,22 @@ export class FormDetailModel { ...@@ -46,6 +46,22 @@ export class FormDetailModel {
*/ */
public visible: boolean = true; public visible: boolean = true;
/**
* 成员是否显示(旧)
*
* @type {boolean}
* @memberof FormDetailModel
*/
public oldVisible: boolean = true;
/**
* 成员是否为受控内容
*
* @type {boolean}
* @memberof FormDetailModel
*/
public isControlledContent: boolean = false;
/** /**
* 成员是否显示标题 * 成员是否显示标题
* *
...@@ -53,6 +69,7 @@ export class FormDetailModel { ...@@ -53,6 +69,7 @@ export class FormDetailModel {
* @memberof FormDetailModel * @memberof FormDetailModel
*/ */
public isShowCaption: boolean = true; public isShowCaption: boolean = true;
/** /**
* Creates an instance of FormDetailModel. * Creates an instance of FormDetailModel.
...@@ -67,7 +84,9 @@ export class FormDetailModel { ...@@ -67,7 +84,9 @@ export class FormDetailModel {
this.form = opts.form ? opts.form : {}; this.form = opts.form ? opts.form : {};
this.name = !Object.is(opts.name, '') ? opts.name : ''; this.name = !Object.is(opts.name, '') ? opts.name : '';
this.visible = opts.visible ? true : false; this.visible = opts.visible ? true : false;
this.oldVisible = opts.visible ? true : false;
this.isShowCaption = opts.isShowCaption ? true : false; this.isShowCaption = opts.isShowCaption ? true : false;
this.isControlledContent = opts.isControlledContent ? true : false;
} }
/** /**
......
...@@ -16,6 +16,30 @@ export class FormGroupPanelModel extends FormDetailModel { ...@@ -16,6 +16,30 @@ export class FormGroupPanelModel extends FormDetailModel {
* @memberof FormGroupPanelModel * @memberof FormGroupPanelModel
*/ */
public uiActionGroup: any = {}; public uiActionGroup: any = {};
/**
* 受控内容组
*
* @type {*}
* @memberof FormGroupPanelModel
*/
public showMoreModeItems: any = [];
/**
* 是否为管理容器
*
* @type {*}
* @memberof FormGroupPanelModel
*/
public isManageContainer: boolean = false;
/**
* 管理容器状态 true显示 false隐藏
*
* @type {*}
* @memberof FormGroupPanelModel
*/
public manageContainerStatus: boolean = true;
/** /**
* Creates an instance of FormGroupPanelModel. * Creates an instance of FormGroupPanelModel.
...@@ -27,5 +51,17 @@ export class FormGroupPanelModel extends FormDetailModel { ...@@ -27,5 +51,17 @@ export class FormGroupPanelModel extends FormDetailModel {
constructor(opts: any = {}) { constructor(opts: any = {}) {
super(opts); super(opts);
Object.assign(this.uiActionGroup, opts.uiActionGroup); Object.assign(this.uiActionGroup, opts.uiActionGroup);
this.showMoreModeItems = opts.showMoreModeItems;
this.isManageContainer = opts.isManageContainer ? true : false;
}
/**
* 设置管理容器状态
*
* @param {boolean} state
* @memberof FormGroupPanelModel
*/
public setManageContainerStatus(state: boolean): void {
this.manageContainerStatus = state;
} }
} }
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<sider :width="collapseChange ? 64 : 200" hide-trigger v-model="collapseChange"> <sider :width="collapseChange ? 64 : 200" hide-trigger v-model="collapseChange">
<div class="sider-top"> <div class="sider-top">
<div class="page-logo"> <div class="page-logo">
<span class="menuicon" @click="contextMenuDragVisiable=!contextMenuDragVisiable"><Icon type="md-menu" /></span> <span class="menuicon" v-if="isEnableAppSwitch" @click="contextMenuDragVisiable=!contextMenuDragVisiable"><Icon type="md-menu" /></span>
<span v-show="!collapseChange" style="overflow-x: hidden;text-overflow: ellipsis;white-space: nowrap;display: block;text-align: center;font-weight: 300;font-size: 20px;">{{$t(model.srfCaption)}}</span> <span v-show="!collapseChange" style="overflow-x: hidden;text-overflow: ellipsis;white-space: nowrap;display: block;text-align: center;font-weight: 300;font-size: 20px;">{{$t(model.srfCaption)}}</span>
</div> </div>
</div> </div>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
ref='appmenu' ref='appmenu'
@closeview="closeView($event)"> @closeview="closeView($event)">
</view_appmenu> </view_appmenu>
<context-menu-drag :contextMenuDragVisiable="contextMenuDragVisiable"></context-menu-drag> <context-menu-drag v-if="isEnableAppSwitch" :contextMenuDragVisiable="contextMenuDragVisiable"></context-menu-drag>
</sider> </sider>
<layout> <layout>
<header class="index_header"> <header class="index_header">
...@@ -408,8 +408,8 @@ export default class AppIndexViewBase extends Vue { ...@@ -408,8 +408,8 @@ export default class AppIndexViewBase extends Vue {
* *
* @memberof AppIndexViewBase * @memberof AppIndexViewBase
*/ */
public initNavDataWithRoute(data:any = null, isNew:boolean = false){ public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if(this.viewDefaultUsage && Object.is(this.navModel,"route")){ if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'app-index-view',tag:this.viewtag,srfkey:isNew ? null : null,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath}); this.navDataService.addNavData({id:'app-index-view',tag:this.viewtag,srfkey:isNew ? null : null,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
} }
} }
...@@ -419,8 +419,8 @@ export default class AppIndexViewBase extends Vue { ...@@ -419,8 +419,8 @@ export default class AppIndexViewBase extends Vue {
* *
* @memberof AppIndexViewBase * @memberof AppIndexViewBase
*/ */
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true){ public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if(this.viewDefaultUsage && !Object.is(this.navModel,"route")){ if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'app-index-view',tag:this.viewtag,srfkey:null,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd); this.navDataService.addNavDataByOnly({id:'app-index-view',tag:this.viewtag,srfkey:null,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
} }
} }
...@@ -542,6 +542,14 @@ export default class AppIndexViewBase extends Vue { ...@@ -542,6 +542,14 @@ export default class AppIndexViewBase extends Vue {
*/ */
public contextMenuDragVisiable: boolean = false; public contextMenuDragVisiable: boolean = false;
/**
* 是否支持应用切换
*
* @type {boolean}
* @memberof AppIndexViewBase
*/
public isEnableAppSwitch: boolean = false;
/** /**
* 初始化之前 * 初始化之前
* *
......
...@@ -91,6 +91,7 @@ ...@@ -91,6 +91,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
height: 100%; height: 100%;
justify-content: center;
>.menuicon{ >.menuicon{
display: block; display: block;
text-align: center; text-align: center;
......
...@@ -544,8 +544,8 @@ export default class DictCatalogEditViewBase extends Vue { ...@@ -544,8 +544,8 @@ export default class DictCatalogEditViewBase extends Vue {
* *
* @memberof DictCatalogEditViewBase * @memberof DictCatalogEditViewBase
*/ */
public initNavDataWithRoute(data:any = null, isNew:boolean = false){ public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if(this.viewDefaultUsage && Object.is(this.navModel,"route")){ if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'dict-catalog-edit-view',tag:this.viewtag,srfkey:isNew ? null : this.context.dictcatalog,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath}); this.navDataService.addNavData({id:'dict-catalog-edit-view',tag:this.viewtag,srfkey:isNew ? null : this.context.dictcatalog,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
} }
} }
...@@ -555,8 +555,8 @@ export default class DictCatalogEditViewBase extends Vue { ...@@ -555,8 +555,8 @@ export default class DictCatalogEditViewBase extends Vue {
* *
* @memberof DictCatalogEditViewBase * @memberof DictCatalogEditViewBase
*/ */
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true){ public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if(this.viewDefaultUsage && !Object.is(this.navModel,"route")){ if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'dict-catalog-edit-view',tag:this.viewtag,srfkey:this.context.dictcatalog,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd); this.navDataService.addNavDataByOnly({id:'dict-catalog-edit-view',tag:this.viewtag,srfkey:this.context.dictcatalog,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
} }
} }
......
...@@ -569,8 +569,8 @@ export default class DictCatalogGridViewBase extends Vue { ...@@ -569,8 +569,8 @@ export default class DictCatalogGridViewBase extends Vue {
* *
* @memberof DictCatalogGridViewBase * @memberof DictCatalogGridViewBase
*/ */
public initNavDataWithRoute(data:any = null, isNew:boolean = false){ public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if(this.viewDefaultUsage && Object.is(this.navModel,"route")){ if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'dict-catalog-grid-view',tag:this.viewtag,srfkey:isNew ? null : this.context.dictcatalog,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath}); this.navDataService.addNavData({id:'dict-catalog-grid-view',tag:this.viewtag,srfkey:isNew ? null : this.context.dictcatalog,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
} }
} }
...@@ -580,8 +580,8 @@ export default class DictCatalogGridViewBase extends Vue { ...@@ -580,8 +580,8 @@ export default class DictCatalogGridViewBase extends Vue {
* *
* @memberof DictCatalogGridViewBase * @memberof DictCatalogGridViewBase
*/ */
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true){ public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if(this.viewDefaultUsage && !Object.is(this.navModel,"route")){ if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'dict-catalog-grid-view',tag:this.viewtag,srfkey:this.context.dictcatalog,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd); this.navDataService.addNavDataByOnly({id:'dict-catalog-grid-view',tag:this.viewtag,srfkey:this.context.dictcatalog,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
} }
} }
...@@ -1186,37 +1186,14 @@ export default class DictCatalogGridViewBase extends Vue { ...@@ -1186,37 +1186,14 @@ export default class DictCatalogGridViewBase extends Vue {
} }
/** !!!!模版产生代码错误:----
* 打开编辑数据视图 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)??
* ----
* @param {any[]} args
* @param {*} [params]
* @param {*} [fullargs]
* @param {*} [$event]
* @param {*} [xData]
* @memberof DictCatalogGridView
*/
public opendata(args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) {
let localContext:any = null;
let localViewParam:any =null;
const data: any = {};
let tempContext = JSON.parse(JSON.stringify(this.context));
if(args.length >0){
Object.assign(tempContext,args[0]);
}
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'dictcatalogs', parameterName: 'dictcatalog' },
{ pathName: 'editview', parameterName: 'editview' },
];
const _this: any = this;
const openIndexViewTab = (data: any) => {
const routePath = this.$viewTool.buildUpRoutePath(this.$route, tempContext, deResParameters, parameters, args, data);
this.$router.push(routePath);
}
openIndexViewTab(data);
}
----
FTL stack trace ("~" means nesting-related):
- Failed at: #if ctrl.getPSControlContainer().getV... [in template "TEMPLCODE_zh_CN" at line 43, column 5]
----
/** /**
* 新建 * 新建
......
...@@ -434,8 +434,8 @@ export default class DictCatalogPickupGridViewBase extends Vue { ...@@ -434,8 +434,8 @@ export default class DictCatalogPickupGridViewBase extends Vue {
* *
* @memberof DictCatalogPickupGridViewBase * @memberof DictCatalogPickupGridViewBase
*/ */
public initNavDataWithRoute(data:any = null, isNew:boolean = false){ public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if(this.viewDefaultUsage && Object.is(this.navModel,"route")){ if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'dict-catalog-pickup-grid-view',tag:this.viewtag,srfkey:isNew ? null : this.context.dictcatalog,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath}); this.navDataService.addNavData({id:'dict-catalog-pickup-grid-view',tag:this.viewtag,srfkey:isNew ? null : this.context.dictcatalog,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
} }
} }
...@@ -445,8 +445,8 @@ export default class DictCatalogPickupGridViewBase extends Vue { ...@@ -445,8 +445,8 @@ export default class DictCatalogPickupGridViewBase extends Vue {
* *
* @memberof DictCatalogPickupGridViewBase * @memberof DictCatalogPickupGridViewBase
*/ */
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true){ public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if(this.viewDefaultUsage && !Object.is(this.navModel,"route")){ if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'dict-catalog-pickup-grid-view',tag:this.viewtag,srfkey:this.context.dictcatalog,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd); this.navDataService.addNavDataByOnly({id:'dict-catalog-pickup-grid-view',tag:this.viewtag,srfkey:this.context.dictcatalog,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
} }
} }
......
...@@ -427,8 +427,8 @@ export default class DictCatalogPickupViewBase extends Vue { ...@@ -427,8 +427,8 @@ export default class DictCatalogPickupViewBase extends Vue {
* *
* @memberof DictCatalogPickupViewBase * @memberof DictCatalogPickupViewBase
*/ */
public initNavDataWithRoute(data:any = null, isNew:boolean = false){ public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if(this.viewDefaultUsage && Object.is(this.navModel,"route")){ if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'dict-catalog-pickup-view',tag:this.viewtag,srfkey:isNew ? null : this.context.dictcatalog,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath}); this.navDataService.addNavData({id:'dict-catalog-pickup-view',tag:this.viewtag,srfkey:isNew ? null : this.context.dictcatalog,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
} }
} }
...@@ -438,8 +438,8 @@ export default class DictCatalogPickupViewBase extends Vue { ...@@ -438,8 +438,8 @@ export default class DictCatalogPickupViewBase extends Vue {
* *
* @memberof DictCatalogPickupViewBase * @memberof DictCatalogPickupViewBase
*/ */
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true){ public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if(this.viewDefaultUsage && !Object.is(this.navModel,"route")){ if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'dict-catalog-pickup-view',tag:this.viewtag,srfkey:this.context.dictcatalog,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd); this.navDataService.addNavDataByOnly({id:'dict-catalog-pickup-view',tag:this.viewtag,srfkey:this.context.dictcatalog,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
} }
} }
......
...@@ -458,8 +458,8 @@ export default class DictOptionEditViewBase extends Vue { ...@@ -458,8 +458,8 @@ export default class DictOptionEditViewBase extends Vue {
* *
* @memberof DictOptionEditViewBase * @memberof DictOptionEditViewBase
*/ */
public initNavDataWithRoute(data:any = null, isNew:boolean = false){ public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if(this.viewDefaultUsage && Object.is(this.navModel,"route")){ if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'dict-option-edit-view',tag:this.viewtag,srfkey:isNew ? null : this.context.dictoption,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath}); this.navDataService.addNavData({id:'dict-option-edit-view',tag:this.viewtag,srfkey:isNew ? null : this.context.dictoption,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
} }
} }
...@@ -469,8 +469,8 @@ export default class DictOptionEditViewBase extends Vue { ...@@ -469,8 +469,8 @@ export default class DictOptionEditViewBase extends Vue {
* *
* @memberof DictOptionEditViewBase * @memberof DictOptionEditViewBase
*/ */
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true){ public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if(this.viewDefaultUsage && !Object.is(this.navModel,"route")){ if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'dict-option-edit-view',tag:this.viewtag,srfkey:this.context.dictoption,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd); this.navDataService.addNavDataByOnly({id:'dict-option-edit-view',tag:this.viewtag,srfkey:this.context.dictoption,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
} }
} }
......
...@@ -556,8 +556,8 @@ export default class DictOptionGridEditViewBase extends Vue { ...@@ -556,8 +556,8 @@ export default class DictOptionGridEditViewBase extends Vue {
* *
* @memberof DictOptionGridEditViewBase * @memberof DictOptionGridEditViewBase
*/ */
public initNavDataWithRoute(data:any = null, isNew:boolean = false){ public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if(this.viewDefaultUsage && Object.is(this.navModel,"route")){ if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'dict-option-grid-edit-view',tag:this.viewtag,srfkey:isNew ? null : this.context.dictoption,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath}); this.navDataService.addNavData({id:'dict-option-grid-edit-view',tag:this.viewtag,srfkey:isNew ? null : this.context.dictoption,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
} }
} }
...@@ -567,8 +567,8 @@ export default class DictOptionGridEditViewBase extends Vue { ...@@ -567,8 +567,8 @@ export default class DictOptionGridEditViewBase extends Vue {
* *
* @memberof DictOptionGridEditViewBase * @memberof DictOptionGridEditViewBase
*/ */
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true){ public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if(this.viewDefaultUsage && !Object.is(this.navModel,"route")){ if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'dict-option-grid-edit-view',tag:this.viewtag,srfkey:this.context.dictoption,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd); this.navDataService.addNavDataByOnly({id:'dict-option-grid-edit-view',tag:this.viewtag,srfkey:this.context.dictoption,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
} }
} }
...@@ -1159,56 +1159,14 @@ export default class DictOptionGridEditViewBase extends Vue { ...@@ -1159,56 +1159,14 @@ export default class DictOptionGridEditViewBase extends Vue {
} }
/** !!!!模版产生代码错误:----
* 打开编辑数据视图 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)??
* ----
* @param {any[]} args
* @param {*} [params]
* @param {*} [fullargs]
* @param {*} [$event]
* @param {*} [xData]
* @memberof DictOptionGridEditView
*/
public opendata(args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) {
let localContext:any = null;
let localViewParam:any =null;
const data: any = {};
let tempContext = JSON.parse(JSON.stringify(this.context));
if(args.length >0){
Object.assign(tempContext,args[0]);
}
let deResParameters: any[] = [];
if(tempContext.dictcatalog && true){
deResParameters = [
{ pathName: 'dictcatalogs', parameterName: 'dictcatalog' },
]
}
const parameters: any[] = [
{ pathName: 'dictoptions', parameterName: 'dictoption' },
];
const _this: any = this;
const openDrawer = (view: any, data: any) => {
let container: Subject<any> = this.$appdrawer.openDrawer(view, tempContext, data);
container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
if (!xData || !(xData.refresh instanceof Function)) {
return;
}
xData.refresh(result.datas);
});
}
const view: any = {
viewname: 'dict-option-edit-view',
height: 0,
width: 0,
title: this.$t('entities.dictoption.views.editview.title'),
placement: 'DRAWER_RIGHT',
};
openDrawer(view, data);
}
----
FTL stack trace ("~" means nesting-related):
- Failed at: #if ctrl.getPSControlContainer().getV... [in template "TEMPLCODE_zh_CN" at line 43, column 5]
----
/** /**
* 新建 * 新建
......
...@@ -556,8 +556,8 @@ export default class DictOptionGridViewBase extends Vue { ...@@ -556,8 +556,8 @@ export default class DictOptionGridViewBase extends Vue {
* *
* @memberof DictOptionGridViewBase * @memberof DictOptionGridViewBase
*/ */
public initNavDataWithRoute(data:any = null, isNew:boolean = false){ public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if(this.viewDefaultUsage && Object.is(this.navModel,"route")){ if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'dict-option-grid-view',tag:this.viewtag,srfkey:isNew ? null : this.context.dictoption,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath}); this.navDataService.addNavData({id:'dict-option-grid-view',tag:this.viewtag,srfkey:isNew ? null : this.context.dictoption,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
} }
} }
...@@ -567,8 +567,8 @@ export default class DictOptionGridViewBase extends Vue { ...@@ -567,8 +567,8 @@ export default class DictOptionGridViewBase extends Vue {
* *
* @memberof DictOptionGridViewBase * @memberof DictOptionGridViewBase
*/ */
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true){ public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if(this.viewDefaultUsage && !Object.is(this.navModel,"route")){ if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'dict-option-grid-view',tag:this.viewtag,srfkey:this.context.dictoption,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd); this.navDataService.addNavDataByOnly({id:'dict-option-grid-view',tag:this.viewtag,srfkey:this.context.dictoption,title:this.$t(this.model.srfTitle),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
} }
} }
...@@ -1159,56 +1159,14 @@ export default class DictOptionGridViewBase extends Vue { ...@@ -1159,56 +1159,14 @@ export default class DictOptionGridViewBase extends Vue {
} }
/** !!!!模版产生代码错误:----
* 打开编辑数据视图 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)??
* ----
* @param {any[]} args
* @param {*} [params]
* @param {*} [fullargs]
* @param {*} [$event]
* @param {*} [xData]
* @memberof DictOptionGridView
*/
public opendata(args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) {
let localContext:any = null;
let localViewParam:any =null;
const data: any = {};
let tempContext = JSON.parse(JSON.stringify(this.context));
if(args.length >0){
Object.assign(tempContext,args[0]);
}
let deResParameters: any[] = [];
if(tempContext.dictcatalog && true){
deResParameters = [
{ pathName: 'dictcatalogs', parameterName: 'dictcatalog' },
]
}
const parameters: any[] = [
{ pathName: 'dictoptions', parameterName: 'dictoption' },
];
const _this: any = this;
const openDrawer = (view: any, data: any) => {
let container: Subject<any> = this.$appdrawer.openDrawer(view, tempContext, data);
container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
if (!xData || !(xData.refresh instanceof Function)) {
return;
}
xData.refresh(result.datas);
});
}
const view: any = {
viewname: 'dict-option-edit-view',
height: 0,
width: 0,
title: this.$t('entities.dictoption.views.editview.title'),
placement: 'DRAWER_RIGHT',
};
openDrawer(view, data);
}
----
FTL stack trace ("~" means nesting-related):
- Failed at: #if ctrl.getPSControlContainer().getV... [in template "TEMPLCODE_zh_CN" at line 43, column 5]
----
/** /**
* 新建 * 新建
......
import { Subject } from 'rxjs';
export interface Message {
/**
* 名称(通常是应用实体名称)
*
* @memberof Message
*/
name: string;
/**
* 行为(操作数据行为)
*
* @memberof Message
*/
action: string;
/**
* 数据(操作数据)
*
* @memberof Message
*/
data: any;
}
/**
* 应用中心服务类
*
* @export
* @class AppCenterService
*/
export default class AppCenterService {
/**
* Vue 状态管理器
*
* @private
* @type {*}
* @memberof AppCenterService
*/
private static store: any;
/**
* 应用数据状态管理对象
*
* @private
* @type {Subject<any>}
* @memberof AppCenterService
*/
private static subject:Subject<any> = new Subject<any>();
/**
* 单例变量声明
*
* @private
* @static
* @type {AppCenterService}
* @memberof AppCenterService
*/
private static appCenterService: AppCenterService;
/**
* 初始化实例
*
* @memberof AppCenterService
*/
constructor() {}
/**
* 获取 AppCenterService 单例对象
*
* @static
* @returns {AppCenterService}
* @memberof AppCenterService
*/
public static getInstance(store: any): AppCenterService {
if (!AppCenterService.appCenterService) {
AppCenterService.appCenterService = new AppCenterService();
}
this.store = store;
return this.appCenterService;
}
/**
* 通知消息
*
* @static
* @memberof AppCenterService
*/
public static notifyMessage(message:Message){
this.subject.next(message);
}
/**
* 获取消息中心
*
* @static
* @memberof AppCenterService
*/
public static getMessageCenter():Subject<any>{
return this.subject;
}
}
\ No newline at end of file
...@@ -48,7 +48,8 @@ export default class DictCatalogServiceBase extends EntityService { ...@@ -48,7 +48,8 @@ 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 = await Http.getInstance().get(`/dictcatalogs/${context.dictcatalog}/select`,isloading);
return res;
} }
/** /**
...@@ -119,7 +120,7 @@ export default class DictCatalogServiceBase extends EntityService { ...@@ -119,7 +120,7 @@ export default class DictCatalogServiceBase extends EntityService {
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)); this.tempStorage.setItem(context.srfsessionkey+'_dictoptions',JSON.stringify(res.data.dictoptions));
return res; return res;
} }
/** /**
...@@ -151,7 +152,7 @@ export default class DictCatalogServiceBase extends EntityService { ...@@ -151,7 +152,7 @@ export default class DictCatalogServiceBase extends EntityService {
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)); this.tempStorage.setItem(context.srfsessionkey+'_dictoptions',JSON.stringify(res.data.dictoptions));
return res; return res;
} }
/** /**
...@@ -164,9 +165,9 @@ export default class DictCatalogServiceBase extends EntityService { ...@@ -164,9 +165,9 @@ export default class DictCatalogServiceBase extends EntityService {
* @memberof DictCatalogServiceBase * @memberof DictCatalogServiceBase
*/ */
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)); this.tempStorage.setItem(context.srfsessionkey+'_dictoptions',JSON.stringify(res.data.dictoptions));
return res; return res;
} }
/** /**
...@@ -195,7 +196,8 @@ export default class DictCatalogServiceBase extends EntityService { ...@@ -195,7 +196,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 = await Http.getInstance().delete(`/dictcatalogs/${context.dictcatalog}`,isloading);
return res;
} }
/** /**
...@@ -208,7 +210,8 @@ export default class DictCatalogServiceBase extends EntityService { ...@@ -208,7 +210,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 = await Http.getInstance().post(`/dictcatalogs/${context.dictcatalog}/checkkey`,data,isloading);
return res;
} }
/** /**
...@@ -222,6 +225,7 @@ export default class DictCatalogServiceBase extends EntityService { ...@@ -222,6 +225,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 = await Http.getInstance().get(`/dictcatalogs/fetchdefault`,tempData,isloading);
return res;
} }
} }
\ No newline at end of file
...@@ -49,9 +49,10 @@ export default class DictOptionServiceBase extends EntityService { ...@@ -49,9 +49,10 @@ 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 = await Http.getInstance().get(`/dictcatalogs/${context.dictcatalog}/dictoptions/${context.dictoption}/select`,isloading);
} }
return Http.getInstance().get(`/dictoptions/${context.dictoption}/select`,isloading); let res:any = await Http.getInstance().get(`/dictoptions/${context.dictoption}/select`,isloading);
return res;
} }
/** /**
...@@ -68,12 +69,11 @@ export default class DictOptionServiceBase extends EntityService { ...@@ -68,12 +69,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().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;
} }
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;
} }
/** /**
...@@ -87,9 +87,10 @@ export default class DictOptionServiceBase extends EntityService { ...@@ -87,9 +87,10 @@ 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 = await Http.getInstance().delete(`/dictcatalogs/${context.dictcatalog}/dictoptions/${context.dictoption}`,isloading);
} }
return Http.getInstance().delete(`/dictoptions/${context.dictoption}`,isloading); let res:any = await Http.getInstance().delete(`/dictoptions/${context.dictoption}`,isloading);
return res;
} }
/** /**
...@@ -106,9 +107,9 @@ export default class DictOptionServiceBase extends EntityService { ...@@ -106,9 +107,9 @@ 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 Http.getInstance().post(`/dictoptions/${context.dictoption}/checkkey`,data,isloading); let res:any = await Http.getInstance().post(`/dictoptions/${context.dictoption}/checkkey`,data,isloading);
return res;
} }
/** /**
...@@ -124,7 +125,6 @@ export default class DictOptionServiceBase extends EntityService { ...@@ -124,7 +125,6 @@ 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;
} }
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;
...@@ -143,10 +143,9 @@ export default class DictOptionServiceBase extends EntityService { ...@@ -143,10 +143,9 @@ 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;
} }
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;
} }
/** /**
...@@ -170,7 +169,6 @@ export default class DictOptionServiceBase extends EntityService { ...@@ -170,7 +169,6 @@ 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;
} }
let masterData:any = {}; let masterData:any = {};
Object.assign(data,masterData); Object.assign(data,masterData);
...@@ -199,12 +197,11 @@ export default class DictOptionServiceBase extends EntityService { ...@@ -199,12 +197,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}/save`,data,isloading); let res:any = await Http.getInstance().post(`/dictcatalogs/${context.dictcatalog}/dictoptions/${context.dictoption}/save`,data,isloading);
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 +216,10 @@ export default class DictOptionServiceBase extends EntityService { ...@@ -219,9 +216,10 @@ 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 = await Http.getInstance().get(`/dictcatalogs/${context.dictcatalog}/dictoptions/fetchdefault`,tempData,isloading);
} }
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 = await Http.getInstance().get(`/dictoptions/fetchdefault`,tempData,isloading);
return res;
} }
} }
\ No newline at end of file
...@@ -44,9 +44,11 @@ export const getAuthMenu = (state: any) => (menu:any) =>{ ...@@ -44,9 +44,11 @@ export const getAuthMenu = (state: any) => (menu:any) =>{
resourceIndex= state.resourceData.findIndex((resourcetag: any, objIndex: any, objs: any) => { resourceIndex= state.resourceData.findIndex((resourcetag: any, objIndex: any, objs: any) => {
return Object.is(menu.resourcetag, resourcetag); return Object.is(menu.resourcetag, resourcetag);
}) })
menuIndex= state.menuData.findIndex((menutag: any, objIndex: any, objs: any) => {
return Object.is(menu.authtag, menutag);
})
return (resourceIndex !== -1 || menuIndex !== -1)?true:false;
}else{
return true;
} }
menuIndex= state.menuData.findIndex((menutag: any, objIndex: any, objs: any) => {
return Object.is(menu.authtag, menutag);
})
return (resourceIndex !== -1 || menuIndex !== -1)?true:false;
} }
\ No newline at end of file
...@@ -63,7 +63,7 @@ export class ViewTool { ...@@ -63,7 +63,7 @@ export class ViewTool {
public static buildUpRoutePath(route: Route, viewParam: any = {}, deResParameters: any[], parameters: any[], args: any[], data: any): string { public static buildUpRoutePath(route: Route, viewParam: any = {}, deResParameters: any[], parameters: any[], args: any[], data: any): string {
const indexRoutePath = this.getIndexRoutePath(route); const indexRoutePath = this.getIndexRoutePath(route);
const deResRoutePath = this.getDeResRoutePath(viewParam, deResParameters, args); const deResRoutePath = this.getDeResRoutePath(viewParam, deResParameters, args);
const deRoutePath = this.getActiveRoutePath(parameters, args, data); const deRoutePath = this.getActiveRoutePath(parameters, args, data,viewParam);
return `${indexRoutePath}${deResRoutePath}${deRoutePath}`; return `${indexRoutePath}${deResRoutePath}${deRoutePath}`;
} }
...@@ -123,7 +123,7 @@ export class ViewTool { ...@@ -123,7 +123,7 @@ export class ViewTool {
* @returns {string} * @returns {string}
* @memberof ViewTool * @memberof ViewTool
*/ */
public static getActiveRoutePath(parameters: any[], args: any[], data: any): string { public static getActiveRoutePath(parameters: any[], args: any[], data: any,viewParam: any = {}): string {
let routePath: string = ''; let routePath: string = '';
// 不存在应用实体 // 不存在应用实体
if(parameters && parameters.length >0){ if(parameters && parameters.length >0){
...@@ -137,8 +137,7 @@ export class ViewTool { ...@@ -137,8 +137,7 @@ export class ViewTool {
let [arg] = args; let [arg] = args;
arg = arg ? arg : {}; arg = arg ? arg : {};
const [{ pathName: _pathName, parameterName: _parameterName }, { pathName: _pathName2, parameterName: _parameterName2 }] = parameters; const [{ pathName: _pathName, parameterName: _parameterName }, { pathName: _pathName2, parameterName: _parameterName2 }] = parameters;
const _value: any = arg[_parameterName] && !Object.is(arg[_parameterName], '') ? const _value: any = arg[_parameterName] || viewParam[_parameterName] || null;
arg[_parameterName] : null;
routePath = `/${_pathName}/${_value}/${_pathName2}`; routePath = `/${_pathName}/${_value}/${_pathName2}`;
if (Object.keys(data).length > 0) { if (Object.keys(data).length > 0) {
routePath = `${routePath}?${qs.stringify(data, { delimiter: ';' })}`; routePath = `${routePath}?${qs.stringify(data, { delimiter: ';' })}`;
......
...@@ -124,6 +124,7 @@ import { Subject, Subscription } from 'rxjs'; ...@@ -124,6 +124,7 @@ import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control'; import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils'; import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service'; import NavDataService from '@/service/app/navdata-service';
import AppCenterService from "@service/app/app-center-service";
import AppIndexViewService from './app-index-view-appmenu-service'; import AppIndexViewService from './app-index-view-appmenu-service';
import AppIndexViewModel from './app-index-view-appmenu-model'; import AppIndexViewModel from './app-index-view-appmenu-model';
......
...@@ -40,6 +40,7 @@ import { Subject, Subscription } from 'rxjs'; ...@@ -40,6 +40,7 @@ import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control'; import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils'; import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service'; import NavDataService from '@/service/app/navdata-service';
import AppCenterService from "@service/app/app-center-service";
import DictCatalogService from '@/service/dict-catalog/dict-catalog-service'; import DictCatalogService from '@/service/dict-catalog/dict-catalog-service';
import DefaultService from './default-searchform-service'; import DefaultService from './default-searchform-service';
......
...@@ -80,6 +80,8 @@ export default class DefaultService extends ControlService { ...@@ -80,6 +80,8 @@ export default class DefaultService extends ControlService {
*/ */
@Errorlog @Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> { public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
data.page = data.page ? data.page : 0;
data.size = data.size ? data.size : 1000;
return Promise.reject([]) return Promise.reject([])
} }
......
...@@ -80,6 +80,8 @@ export default class MainService extends ControlService { ...@@ -80,6 +80,8 @@ export default class MainService extends ControlService {
*/ */
@Errorlog @Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> { public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
data.page = data.page ? data.page : 0;
data.size = data.size ? data.size : 1000;
return Promise.reject([]) return Promise.reject([])
} }
......
...@@ -129,6 +129,7 @@ import { Subject, Subscription } from 'rxjs'; ...@@ -129,6 +129,7 @@ import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control'; import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils'; import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service'; import NavDataService from '@/service/app/navdata-service';
import AppCenterService from "@service/app/app-center-service";
import DictCatalogService from '@/service/dict-catalog/dict-catalog-service'; import DictCatalogService from '@/service/dict-catalog/dict-catalog-service';
import MainService from './main-grid-service'; import MainService from './main-grid-service';
...@@ -258,6 +259,15 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -258,6 +259,15 @@ export default class MainBase extends Vue implements ControlInterface {
*/ */
public codeListService:CodeListService = new CodeListService({ $store: this.$store }); public codeListService:CodeListService = new CodeListService({ $store: this.$store });
/**
* 应用状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof MainBase
*/
public appStateEvent: Subscription | undefined;
/** /**
* 获取多项数据 * 获取多项数据
* *
...@@ -563,35 +573,40 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -563,35 +573,40 @@ export default class MainBase extends Vue implements ControlInterface {
label: '代码', label: '代码',
langtag: 'entities.dictcatalog.main_grid.columns.ccode', langtag: 'entities.dictcatalog.main_grid.columns.ccode',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: false,
}, },
{ {
name: 'cname', name: 'cname',
label: '名称', label: '名称',
langtag: 'entities.dictcatalog.main_grid.columns.cname', langtag: 'entities.dictcatalog.main_grid.columns.cname',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: false,
}, },
{ {
name: 'cgroup', name: 'cgroup',
label: '分组', label: '分组',
langtag: 'entities.dictcatalog.main_grid.columns.cgroup', langtag: 'entities.dictcatalog.main_grid.columns.cgroup',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: false,
}, },
{ {
name: 'memo', name: 'memo',
label: '备注', label: '备注',
langtag: 'entities.dictcatalog.main_grid.columns.memo', langtag: 'entities.dictcatalog.main_grid.columns.memo',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: false,
}, },
{ {
name: 'updatedate', name: 'updatedate',
label: '最后修改时间', label: '最后修改时间',
langtag: 'entities.dictcatalog.main_grid.columns.updatedate', langtag: 'entities.dictcatalog.main_grid.columns.updatedate',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: false,
}, },
] ]
...@@ -1107,6 +1122,16 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1107,6 +1122,16 @@ export default class MainBase extends Vue implements ControlInterface {
} }
}); });
} }
if(AppCenterService && AppCenterService.getMessageCenter()){
this.appStateEvent = AppCenterService.getMessageCenter().subscribe(({ name, action, data }) =>{
if(!Object.is(name,"DictCatalog")){
return;
}
if(Object.is(action,'appRefresh')){
this.refresh([data]);
}
})
}
} }
/** /**
...@@ -1127,6 +1152,9 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1127,6 +1152,9 @@ export default class MainBase extends Vue implements ControlInterface {
if (this.viewStateEvent) { if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe(); this.viewStateEvent.unsubscribe();
} }
if(this.appStateEvent){
this.appStateEvent.unsubscribe();
}
} }
/** /**
...@@ -1572,14 +1600,17 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1572,14 +1600,17 @@ export default class MainBase extends Vue implements ControlInterface {
* @memberof MainBase * @memberof MainBase
*/ */
public getCellClassName(args:{row: any, column: any, rowIndex: number, columnIndex:number}){ public getCellClassName(args:{row: any, column: any, rowIndex: number, columnIndex:number}){
let hasRowEdit:any = { if(args.column.property){
'ccode':false, let col = this.allColumns.find((item:any)=>{
'cname':false, return Object.is(args.column.property,item.name);
'cgroup':false, })
'memo':false, if(col !== undefined){
'updatedate':false, if(col.isEnableRowEdit && this.actualIsOpenEdit ){
return 'edit-cell';
}
}
} }
return ( hasRowEdit[args.column.property] && this.actualIsOpenEdit ) ? "edit-cell" : "info-cell"; return 'info-cell';
} }
/** /**
......
...@@ -81,6 +81,8 @@ export default class MainService extends ControlService { ...@@ -81,6 +81,8 @@ export default class MainService extends ControlService {
*/ */
@Errorlog @Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> { public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
data.page = data.page ? data.page : 0;
data.size = data.size ? data.size : 1000;
return Promise.reject([]) return Promise.reject([])
} }
......
...@@ -24,6 +24,7 @@ import { Subject, Subscription } from 'rxjs'; ...@@ -24,6 +24,7 @@ import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control'; import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils'; import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service'; import NavDataService from '@/service/app/navdata-service';
import AppCenterService from "@service/app/app-center-service";
import DictCatalogService from '@/service/dict-catalog/dict-catalog-service'; import DictCatalogService from '@/service/dict-catalog/dict-catalog-service';
import PickupViewpickupviewpanelService from './pickup-viewpickupviewpanel-pickupviewpanel-service'; import PickupViewpickupviewpanelService from './pickup-viewpickupviewpanel-pickupviewpanel-service';
......
...@@ -40,6 +40,7 @@ import { Subject, Subscription } from 'rxjs'; ...@@ -40,6 +40,7 @@ import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control'; import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils'; import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service'; import NavDataService from '@/service/app/navdata-service';
import AppCenterService from "@service/app/app-center-service";
import DictOptionService from '@/service/dict-option/dict-option-service'; import DictOptionService from '@/service/dict-option/dict-option-service';
import DefaultService from './default-searchform-service'; import DefaultService from './default-searchform-service';
......
...@@ -80,6 +80,8 @@ export default class DefaultService extends ControlService { ...@@ -80,6 +80,8 @@ export default class DefaultService extends ControlService {
*/ */
@Errorlog @Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> { public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
data.page = data.page ? data.page : 0;
data.size = data.size ? data.size : 1000;
return Promise.reject([]) return Promise.reject([])
} }
......
...@@ -89,6 +89,8 @@ export default class MainService extends ControlService { ...@@ -89,6 +89,8 @@ export default class MainService extends ControlService {
*/ */
@Errorlog @Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> { public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
data.page = data.page ? data.page : 0;
data.size = data.size ? data.size : 1000;
if (Object.is(serviceName, 'DictCatalogService') && Object.is(interfaceName, 'FetchDefault')) { if (Object.is(serviceName, 'DictCatalogService') && Object.is(interfaceName, 'FetchDefault')) {
return this.doItems(this.dictcatalogService.FetchDefault(JSON.parse(JSON.stringify(context)),data, isloading), 'id', 'dictcatalog'); return this.doItems(this.dictcatalogService.FetchDefault(JSON.parse(JSON.stringify(context)),data, isloading), 'id', 'dictcatalog');
} }
......
...@@ -432,6 +432,7 @@ import { Subject, Subscription } from 'rxjs'; ...@@ -432,6 +432,7 @@ import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control'; import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils'; import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service'; import NavDataService from '@/service/app/navdata-service';
import AppCenterService from "@service/app/app-center-service";
import DictOptionService from '@/service/dict-option/dict-option-service'; import DictOptionService from '@/service/dict-option/dict-option-service';
import MainService from './main-grid-service'; import MainService from './main-grid-service';
...@@ -561,6 +562,15 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -561,6 +562,15 @@ export default class MainBase extends Vue implements ControlInterface {
*/ */
public codeListService:CodeListService = new CodeListService({ $store: this.$store }); public codeListService:CodeListService = new CodeListService({ $store: this.$store });
/**
* 应用状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof MainBase
*/
public appStateEvent: Subscription | undefined;
/** /**
* 获取多项数据 * 获取多项数据
* *
...@@ -866,91 +876,104 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -866,91 +876,104 @@ export default class MainBase extends Vue implements ControlInterface {
label: '目录代码', label: '目录代码',
langtag: 'entities.dictoption.main_grid.columns.cid', langtag: 'entities.dictoption.main_grid.columns.cid',
show: false, show: false,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'val', name: 'val',
label: '代码值', label: '代码值',
langtag: 'entities.dictoption.main_grid.columns.val', langtag: 'entities.dictoption.main_grid.columns.val',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'label', name: 'label',
label: '名称', label: '名称',
langtag: 'entities.dictoption.main_grid.columns.label', langtag: 'entities.dictoption.main_grid.columns.label',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'pval', name: 'pval',
label: '父代码值', label: '父代码值',
langtag: 'entities.dictoption.main_grid.columns.pval', langtag: 'entities.dictoption.main_grid.columns.pval',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'showorder', name: 'showorder',
label: '排序', label: '排序',
langtag: 'entities.dictoption.main_grid.columns.showorder', langtag: 'entities.dictoption.main_grid.columns.showorder',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'cname', name: 'cname',
label: '目录', label: '目录',
langtag: 'entities.dictoption.main_grid.columns.cname', langtag: 'entities.dictoption.main_grid.columns.cname',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'cls', name: 'cls',
label: '栏目样式', label: '栏目样式',
langtag: 'entities.dictoption.main_grid.columns.cls', langtag: 'entities.dictoption.main_grid.columns.cls',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'iconcls', name: 'iconcls',
label: '图标', label: '图标',
langtag: 'entities.dictoption.main_grid.columns.iconcls', langtag: 'entities.dictoption.main_grid.columns.iconcls',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'vfilter', name: 'vfilter',
label: '过滤项', label: '过滤项',
langtag: 'entities.dictoption.main_grid.columns.vfilter', langtag: 'entities.dictoption.main_grid.columns.vfilter',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'disabled', name: 'disabled',
label: '是否禁用', label: '是否禁用',
langtag: 'entities.dictoption.main_grid.columns.disabled', langtag: 'entities.dictoption.main_grid.columns.disabled',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'expired', name: 'expired',
label: '过期/失效', label: '过期/失效',
langtag: 'entities.dictoption.main_grid.columns.expired', langtag: 'entities.dictoption.main_grid.columns.expired',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'extension', name: 'extension',
label: '扩展', label: '扩展',
langtag: 'entities.dictoption.main_grid.columns.extension', langtag: 'entities.dictoption.main_grid.columns.extension',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'updatedate', name: 'updatedate',
label: '最后修改时间', label: '最后修改时间',
langtag: 'entities.dictoption.main_grid.columns.updatedate', langtag: 'entities.dictoption.main_grid.columns.updatedate',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: false,
}, },
] ]
...@@ -1542,6 +1565,16 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1542,6 +1565,16 @@ export default class MainBase extends Vue implements ControlInterface {
} }
}); });
} }
if(AppCenterService && AppCenterService.getMessageCenter()){
this.appStateEvent = AppCenterService.getMessageCenter().subscribe(({ name, action, data }) =>{
if(!Object.is(name,"DictOption")){
return;
}
if(Object.is(action,'appRefresh')){
this.refresh([data]);
}
})
}
} }
/** /**
...@@ -1562,6 +1595,9 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1562,6 +1595,9 @@ export default class MainBase extends Vue implements ControlInterface {
if (this.viewStateEvent) { if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe(); this.viewStateEvent.unsubscribe();
} }
if(this.appStateEvent){
this.appStateEvent.unsubscribe();
}
} }
/** /**
...@@ -2007,22 +2043,17 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -2007,22 +2043,17 @@ export default class MainBase extends Vue implements ControlInterface {
* @memberof MainBase * @memberof MainBase
*/ */
public getCellClassName(args:{row: any, column: any, rowIndex: number, columnIndex:number}){ public getCellClassName(args:{row: any, column: any, rowIndex: number, columnIndex:number}){
let hasRowEdit:any = { if(args.column.property){
'cid':true, let col = this.allColumns.find((item:any)=>{
'val':true, return Object.is(args.column.property,item.name);
'label':true, })
'pval':true, if(col !== undefined){
'showorder':true, if(col.isEnableRowEdit && this.actualIsOpenEdit ){
'cname':true, return 'edit-cell';
'cls':true, }
'iconcls':true, }
'vfilter':true,
'disabled':true,
'expired':true,
'extension':true,
'updatedate':false,
} }
return ( hasRowEdit[args.column.property] && this.actualIsOpenEdit ) ? "edit-cell" : "info-cell"; return 'info-cell';
} }
/** /**
......
...@@ -90,6 +90,8 @@ export default class MainService extends ControlService { ...@@ -90,6 +90,8 @@ export default class MainService extends ControlService {
*/ */
@Errorlog @Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> { public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
data.page = data.page ? data.page : 0;
data.size = data.size ? data.size : 1000;
if (Object.is(serviceName, 'DictCatalogService') && Object.is(interfaceName, 'FetchDefault')) { if (Object.is(serviceName, 'DictCatalogService') && Object.is(interfaceName, 'FetchDefault')) {
return this.doItems(this.dictcatalogService.FetchDefault(JSON.parse(JSON.stringify(context)),data, isloading), 'id', 'dictcatalog'); return this.doItems(this.dictcatalogService.FetchDefault(JSON.parse(JSON.stringify(context)),data, isloading), 'id', 'dictcatalog');
} }
......
...@@ -420,6 +420,7 @@ import { Subject, Subscription } from 'rxjs'; ...@@ -420,6 +420,7 @@ import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control'; import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils'; import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service'; import NavDataService from '@/service/app/navdata-service';
import AppCenterService from "@service/app/app-center-service";
import DictOptionService from '@/service/dict-option/dict-option-service'; import DictOptionService from '@/service/dict-option/dict-option-service';
import OptionsService from './options-grid-service'; import OptionsService from './options-grid-service';
...@@ -549,6 +550,15 @@ export default class OptionsBase extends Vue implements ControlInterface { ...@@ -549,6 +550,15 @@ export default class OptionsBase extends Vue implements ControlInterface {
*/ */
public codeListService:CodeListService = new CodeListService({ $store: this.$store }); public codeListService:CodeListService = new CodeListService({ $store: this.$store });
/**
* 应用状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof OptionsBase
*/
public appStateEvent: Subscription | undefined;
/** /**
* 获取多项数据 * 获取多项数据
* *
...@@ -854,84 +864,96 @@ export default class OptionsBase extends Vue implements ControlInterface { ...@@ -854,84 +864,96 @@ export default class OptionsBase extends Vue implements ControlInterface {
label: '目录代码', label: '目录代码',
langtag: 'entities.dictoption.options_grid.columns.cid', langtag: 'entities.dictoption.options_grid.columns.cid',
show: false, show: false,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'val', name: 'val',
label: '代码值', label: '代码值',
langtag: 'entities.dictoption.options_grid.columns.val', langtag: 'entities.dictoption.options_grid.columns.val',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'label', name: 'label',
label: '名称', label: '名称',
langtag: 'entities.dictoption.options_grid.columns.label', langtag: 'entities.dictoption.options_grid.columns.label',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'pval', name: 'pval',
label: '父代码值', label: '父代码值',
langtag: 'entities.dictoption.options_grid.columns.pval', langtag: 'entities.dictoption.options_grid.columns.pval',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'showorder', name: 'showorder',
label: '排序', label: '排序',
langtag: 'entities.dictoption.options_grid.columns.showorder', langtag: 'entities.dictoption.options_grid.columns.showorder',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'cname', name: 'cname',
label: '目录', label: '目录',
langtag: 'entities.dictoption.options_grid.columns.cname', langtag: 'entities.dictoption.options_grid.columns.cname',
show: false, show: false,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'cls', name: 'cls',
label: '栏目样式', label: '栏目样式',
langtag: 'entities.dictoption.options_grid.columns.cls', langtag: 'entities.dictoption.options_grid.columns.cls',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'iconcls', name: 'iconcls',
label: '图标', label: '图标',
langtag: 'entities.dictoption.options_grid.columns.iconcls', langtag: 'entities.dictoption.options_grid.columns.iconcls',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'vfilter', name: 'vfilter',
label: '过滤项', label: '过滤项',
langtag: 'entities.dictoption.options_grid.columns.vfilter', langtag: 'entities.dictoption.options_grid.columns.vfilter',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'disabled', name: 'disabled',
label: '是否禁用', label: '是否禁用',
langtag: 'entities.dictoption.options_grid.columns.disabled', langtag: 'entities.dictoption.options_grid.columns.disabled',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'expired', name: 'expired',
label: '过期/失效', label: '过期/失效',
langtag: 'entities.dictoption.options_grid.columns.expired', langtag: 'entities.dictoption.options_grid.columns.expired',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
{ {
name: 'extension', name: 'extension',
label: '扩展', label: '扩展',
langtag: 'entities.dictoption.options_grid.columns.extension', langtag: 'entities.dictoption.options_grid.columns.extension',
show: true, show: true,
util: 'PX' util: 'PX',
isEnableRowEdit: true,
}, },
] ]
...@@ -1523,6 +1545,16 @@ export default class OptionsBase extends Vue implements ControlInterface { ...@@ -1523,6 +1545,16 @@ export default class OptionsBase extends Vue implements ControlInterface {
} }
}); });
} }
if(AppCenterService && AppCenterService.getMessageCenter()){
this.appStateEvent = AppCenterService.getMessageCenter().subscribe(({ name, action, data }) =>{
if(!Object.is(name,"DictOption")){
return;
}
if(Object.is(action,'appRefresh')){
this.refresh([data]);
}
})
}
} }
/** /**
...@@ -1543,6 +1575,9 @@ export default class OptionsBase extends Vue implements ControlInterface { ...@@ -1543,6 +1575,9 @@ export default class OptionsBase extends Vue implements ControlInterface {
if (this.viewStateEvent) { if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe(); this.viewStateEvent.unsubscribe();
} }
if(this.appStateEvent){
this.appStateEvent.unsubscribe();
}
} }
/** /**
...@@ -1988,21 +2023,17 @@ export default class OptionsBase extends Vue implements ControlInterface { ...@@ -1988,21 +2023,17 @@ export default class OptionsBase extends Vue implements ControlInterface {
* @memberof OptionsBase * @memberof OptionsBase
*/ */
public getCellClassName(args:{row: any, column: any, rowIndex: number, columnIndex:number}){ public getCellClassName(args:{row: any, column: any, rowIndex: number, columnIndex:number}){
let hasRowEdit:any = { if(args.column.property){
'cid':true, let col = this.allColumns.find((item:any)=>{
'val':true, return Object.is(args.column.property,item.name);
'label':true, })
'pval':true, if(col !== undefined){
'showorder':true, if(col.isEnableRowEdit && this.actualIsOpenEdit ){
'cname':true, return 'edit-cell';
'cls':true, }
'iconcls':true, }
'vfilter':true,
'disabled':true,
'expired':true,
'extension':true,
} }
return ( hasRowEdit[args.column.property] && this.actualIsOpenEdit ) ? "edit-cell" : "info-cell"; return 'info-cell';
} }
/** /**
......
...@@ -90,6 +90,8 @@ export default class OptionsService extends ControlService { ...@@ -90,6 +90,8 @@ export default class OptionsService extends ControlService {
*/ */
@Errorlog @Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> { public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
data.page = data.page ? data.page : 0;
data.size = data.size ? data.size : 1000;
if (Object.is(serviceName, 'DictCatalogService') && Object.is(interfaceName, 'FetchDefault')) { if (Object.is(serviceName, 'DictCatalogService') && Object.is(interfaceName, 'FetchDefault')) {
return this.doItems(this.dictcatalogService.FetchDefault(JSON.parse(JSON.stringify(context)),data, isloading), 'id', 'dictcatalog'); return this.doItems(this.dictcatalogService.FetchDefault(JSON.parse(JSON.stringify(context)),data, isloading), 'id', 'dictcatalog');
} }
......
...@@ -53,6 +53,7 @@ public interface IDictCatalogService extends IService<DictCatalog>{ ...@@ -53,6 +53,7 @@ public interface IDictCatalogService extends IService<DictCatalog>{
boolean execute(String sql, Map param); boolean execute(String sql, Map param);
} }
...@@ -55,6 +55,7 @@ public interface IDictOptionService extends IService<DictOption>{ ...@@ -55,6 +55,7 @@ public interface IDictOptionService extends IService<DictOption>{
boolean execute(String sql, Map param); boolean execute(String sql, Map param);
} }
...@@ -46,9 +46,9 @@ public class DictCatalogServiceImpl extends ServiceImpl<DictCatalogMapper, DictC ...@@ -46,9 +46,9 @@ public class DictCatalogServiceImpl extends ServiceImpl<DictCatalogMapper, DictC
@Autowired @Autowired
@Lazy @Lazy
private cn.ibizlab.core.dict.service.IDictOptionService dictoptionService; protected cn.ibizlab.core.dict.service.IDictOptionService dictoptionService;
private int batchSize = 500; protected int batchSize = 500;
@Override @Override
@Transactional @Transactional
...@@ -188,4 +188,3 @@ public class DictCatalogServiceImpl extends ServiceImpl<DictCatalogMapper, DictC ...@@ -188,4 +188,3 @@ public class DictCatalogServiceImpl extends ServiceImpl<DictCatalogMapper, DictC
} }
...@@ -46,9 +46,9 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt ...@@ -46,9 +46,9 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt
@Autowired @Autowired
@Lazy @Lazy
private cn.ibizlab.core.dict.service.IDictCatalogService dictcatalogService; protected cn.ibizlab.core.dict.service.IDictCatalogService dictcatalogService;
private int batchSize = 500; protected int batchSize = 500;
@Override @Override
@Transactional @Transactional
...@@ -221,4 +221,3 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt ...@@ -221,4 +221,3 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt
} }
...@@ -5,6 +5,7 @@ import cn.ibizlab.util.helper.UniqueNameGenerator; ...@@ -5,6 +5,7 @@ import cn.ibizlab.util.helper.UniqueNameGenerator;
import com.baomidou.mybatisplus.core.injector.ISqlInjector; import com.baomidou.mybatisplus.core.injector.ISqlInjector;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.pagination.optimize.JsqlParserCountOptimize;
import org.apache.ibatis.mapping.DatabaseIdProvider; import org.apache.ibatis.mapping.DatabaseIdProvider;
import org.apache.ibatis.mapping.VendorDatabaseIdProvider; import org.apache.ibatis.mapping.VendorDatabaseIdProvider;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
...@@ -42,7 +43,14 @@ public class MybatisConfiguration { ...@@ -42,7 +43,14 @@ public class MybatisConfiguration {
*/ */
@Bean @Bean
public PaginationInterceptor paginationInterceptor() { public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor(); PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
// 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求 默认false
// paginationInterceptor.setOverflow(false);
// 设置最大单页限制数量,默认 500 条,-1 不受限制
paginationInterceptor.setLimit(-1);
// 开启 count 的 join 优化,只针对部分 left join
paginationInterceptor.setCountSqlParser(new JsqlParserCountOptimize(true));
return paginationInterceptor;
} }
} }
\ No newline at end of file
...@@ -32,6 +32,7 @@ import cn.ibizlab.api.mapping.*; ...@@ -32,6 +32,7 @@ import cn.ibizlab.api.mapping.*;
import cn.ibizlab.core.dict.domain.DictCatalog; import cn.ibizlab.core.dict.domain.DictCatalog;
import cn.ibizlab.core.dict.service.IDictCatalogService; import cn.ibizlab.core.dict.service.IDictCatalogService;
import cn.ibizlab.core.dict.filter.DictCatalogSearchContext; import cn.ibizlab.core.dict.filter.DictCatalogSearchContext;
import cn.ibizlab.util.annotation.VersionCheck;
@Slf4j @Slf4j
@Api(tags = {"字典" }) @Api(tags = {"字典" })
...@@ -65,6 +66,7 @@ public class DictCatalogResource { ...@@ -65,6 +66,7 @@ public class DictCatalogResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@VersionCheck(entity = "dictcatalog" , versionfield = "updatedate")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdict-DictCatalog-Update-all')") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdict-DictCatalog-Update-all')")
@ApiOperation(value = "更新字典", tags = {"字典" }, notes = "更新字典") @ApiOperation(value = "更新字典", tags = {"字典" }, notes = "更新字典")
@RequestMapping(method = RequestMethod.PUT, value = "/dictcatalogs/{dictcatalog_id}") @RequestMapping(method = RequestMethod.PUT, value = "/dictcatalogs/{dictcatalog_id}")
......
...@@ -32,6 +32,7 @@ import cn.ibizlab.api.mapping.*; ...@@ -32,6 +32,7 @@ import cn.ibizlab.api.mapping.*;
import cn.ibizlab.core.dict.domain.DictOption; import cn.ibizlab.core.dict.domain.DictOption;
import cn.ibizlab.core.dict.service.IDictOptionService; import cn.ibizlab.core.dict.service.IDictOptionService;
import cn.ibizlab.core.dict.filter.DictOptionSearchContext; import cn.ibizlab.core.dict.filter.DictOptionSearchContext;
import cn.ibizlab.util.annotation.VersionCheck;
@Slf4j @Slf4j
@Api(tags = {"字典项" }) @Api(tags = {"字典项" })
...@@ -46,6 +47,7 @@ public class DictOptionResource { ...@@ -46,6 +47,7 @@ public class DictOptionResource {
@Lazy @Lazy
public DictOptionMapping dictoptionMapping; public DictOptionMapping dictoptionMapping;
@VersionCheck(entity = "dictoption" , versionfield = "updatedate")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdict-DictOption-Update-all')") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdict-DictOption-Update-all')")
@ApiOperation(value = "更新字典项", tags = {"字典项" }, notes = "更新字典项") @ApiOperation(value = "更新字典项", tags = {"字典项" }, notes = "更新字典项")
@RequestMapping(method = RequestMethod.PUT, value = "/dictoptions/{dictoption_id}") @RequestMapping(method = RequestMethod.PUT, value = "/dictoptions/{dictoption_id}")
...@@ -158,6 +160,7 @@ public class DictOptionResource { ...@@ -158,6 +160,7 @@ public class DictOptionResource {
return ResponseEntity.status(HttpStatus.OK) return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(dictoptionMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements())); .body(new PageImpl(dictoptionMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
} }
@VersionCheck(entity = "dictoption" , versionfield = "updatedate")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdict-DictOption-Update-all')") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdict-DictOption-Update-all')")
@ApiOperation(value = "根据字典更新字典项", tags = {"字典项" }, notes = "根据字典更新字典项") @ApiOperation(value = "根据字典更新字典项", tags = {"字典项" }, notes = "根据字典更新字典项")
@RequestMapping(method = RequestMethod.PUT, value = "/dictcatalogs/{dictcatalog_id}/dictoptions/{dictoption_id}") @RequestMapping(method = RequestMethod.PUT, value = "/dictcatalogs/{dictcatalog_id}/dictoptions/{dictoption_id}")
......
package cn.ibizlab.util.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD})
public @interface VersionCheck
{
String entity();
String versionfield();
}
package cn.ibizlab.util.aspect;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import cn.ibizlab.util.annotation.VersionCheck;
import cn.ibizlab.util.domain.EntityBase;
import cn.ibizlab.util.errors.BadRequestAlertException;
import cn.ibizlab.util.helper.RuleUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.core.annotation.Order;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import java.lang.reflect.Field;
/**
* 数据库版本检查
*/
@Aspect
@Order(0)
@Component
public class VersionCheckAspect
{
private final ExpressionParser parser = new SpelExpressionParser();
@SneakyThrows
@Before("execution(* cn.ibizlab.*.rest.*.update(..)) && @annotation(versionCheck)")
public void BeforeUpdate(JoinPoint point, VersionCheck versionCheck){
EvaluationContext context = new StandardEvaluationContext();
Object[] args = point.getArgs();
Object id=args[0];
Object dto=args[1];
if(ObjectUtils.isEmpty(id) || ObjectUtils.isEmpty(dto))
return;
String versionField=versionCheck.versionfield();
if(StringUtils.isEmpty(versionCheck))
return;
context.setVariable("dto",dto);
Expression newExp = parser.parseExpression(String.format("#dto.%s",versionField));
Object newVersion=newExp.getValue(context);
if(ObjectUtils.isEmpty(newVersion))
return;
//进行版本检查
Object oldVersion =getDBVersion(versionCheck,getService(point.getTarget(),versionCheck.entity()),id);
if(!ObjectUtils.isEmpty(oldVersion)){
if(RuleUtils.gt(newVersion,oldVersion))
throw new BadRequestAlertException("数据已变更,可能后台数据已被修改,请重新加载数据","VersionCheckAspect","versionCheck");
}
}
/**
* 获取实体服务对象
* @param resource
* @param entity
* @return
*/
@SneakyThrows
private Object getService(Object resource,String entity){
Object service = null;
Field[] fields= resource.getClass().getDeclaredFields();
for(Field field : fields){
if(field.getModifiers()==1 && field.getName().equalsIgnoreCase(String.format("%sService",entity))){
service=field.get(resource);
break;
}
}
return service;
}
/**
* 获取数据库版本
* @param versionCheck
* @param service
* @param id
* @return
*/
@SneakyThrows
private Object getDBVersion(VersionCheck versionCheck,Object service,Object id){
Object dbVersion=null;
String versionField=versionCheck.versionfield();
if(!ObjectUtils.isEmpty(service)){
EvaluationContext oldContext = new StandardEvaluationContext();
oldContext.setVariable("service",service);
oldContext.setVariable("id",id);
Expression oldExp = parser.parseExpression("#service.get(#id)");
EntityBase oldEntity =oldExp.getValue(oldContext, EntityBase.class);
return oldEntity.get(versionField);
}
return dbVersion;
}
}
...@@ -94,8 +94,10 @@ public class LayeringCache extends AbstractValueAdaptingCache { ...@@ -94,8 +94,10 @@ public class LayeringCache extends AbstractValueAdaptingCache {
@Override @Override
public void put(Object key, Object value) { public void put(Object key, Object value) {
caffeineCache.put(key, value); if(value!=null) {
redisCache.put(key, value); caffeineCache.put(key, value);
redisCache.put(key, value);
}
} }
@Override @Override
......
...@@ -55,6 +55,10 @@ public class AppController { ...@@ -55,6 +55,10 @@ public class AppController {
appData.put("unires",uniRes); appData.put("unires",uniRes);
appData.put("appmenu",appMenu); appData.put("appmenu",appMenu);
appData.put("enablepermissionvalid",enablePermissionValid); appData.put("enablepermissionvalid",enablePermissionValid);
if(curUser.getSuperuser()==1)
appData.put("enablepermissionvalid",false);
else
appData.put("enablepermissionvalid",enablePermissionValid);
return ResponseEntity.status(HttpStatus.OK).body(appData); return ResponseEntity.status(HttpStatus.OK).body(appData);
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册