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

ibiz4j 发布系统代码

上级 205380a0
......@@ -93,6 +93,11 @@
<template v-if="!Object.is(layoutType, 'FLEX')">
<row :gutter="10"><slot></slot></row>
</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>
<template v-if="isShowCaption === false">
<slot></slot>
......@@ -115,6 +120,22 @@ export default class AppFormGroup extends Vue {
*/
@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 {
public doUIAction($event: any, item: any): void {
this.$emit('groupuiactionclick', { event: $event, item: item });
}
/**
* 操作管理容器
*
* @param {*} $event
* @memberof AppFormGroup
*/
public doManageContainer(){
this.$emit('managecontainerclick');
}
}
</script>
<style lang='less'>
......
......@@ -44,6 +44,11 @@ export default class AppMpicker extends Vue {
*/
@Prop() curvalue?: any;
/**
* 值项
*/
@Prop() valueitem?: any;
/**
* 局部上下文导航参数
*
......@@ -144,6 +149,7 @@ export default class AppMpicker extends Vue {
this.value = [];
this.selectItems = [];
if (newVal) {
try {
this.selectItems = this.parseValue(JSON.parse(newVal));
this.selectItems.forEach((item: any) => {
this.value.push(item[this.deKeyField]);
......@@ -152,6 +158,25 @@ export default class AppMpicker extends Vue {
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();
}
......
......@@ -25,7 +25,7 @@
</span>
</el-col>
<el-col :span="14">
<span>{{ item.label }}</span>
<span>{{ item.fullName ? item.fullName:item.label }}</span>
</el-col>
<el-col :span="6">
<div class="bar">
......@@ -46,7 +46,7 @@
<Drawer class-name="menu-drawer" width="60" :closable="true" :mask="false" placement="left" v-model="rightDrawerVisiable">
<div class="menuItems">
<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)">
<Icon type="ios-star" />
</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 {
position: relative;
margin: 8px 0;
.left{
.el-tabs__header{
padding-right:120px;
......@@ -60,7 +61,8 @@
border-bottom:2px solid transparent !important;
}
.el-tabs__header{
margin:0 0 1 0;
margin:0;
border-bottom: none;
}
}
}
......
......@@ -395,6 +395,9 @@ export default class MDViewEngine extends ViewEngine {
if (this.getSearchForm() && this.view.isExpandSearchForm) {
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) {
Object.assign(arg, { query: this.view.query });
}
......
......@@ -169,4 +169,8 @@ export default {
YouYuan: 'YouYuan',
},
},
appFormGroup: {
hide: 'hide',
showMore: 'show more',
},
};
\ No newline at end of file
......@@ -170,4 +170,8 @@ export default {
YouYuan: '幼圆',
},
},
appFormGroup: {
hide: '隐藏字段',
showMore: '显示更多字段',
},
};
\ No newline at end of file
......@@ -46,6 +46,22 @@ export class FormDetailModel {
*/
public visible: boolean = true;
/**
* 成员是否显示(旧)
*
* @type {boolean}
* @memberof FormDetailModel
*/
public oldVisible: boolean = true;
/**
* 成员是否为受控内容
*
* @type {boolean}
* @memberof FormDetailModel
*/
public isControlledContent: boolean = false;
/**
* 成员是否显示标题
*
......@@ -54,6 +70,7 @@ export class FormDetailModel {
*/
public isShowCaption: boolean = true;
/**
* Creates an instance of FormDetailModel.
* FormDetailModel 实例
......@@ -67,7 +84,9 @@ export class FormDetailModel {
this.form = opts.form ? opts.form : {};
this.name = !Object.is(opts.name, '') ? opts.name : '';
this.visible = opts.visible ? true : false;
this.oldVisible = opts.visible ? true : false;
this.isShowCaption = opts.isShowCaption ? true : false;
this.isControlledContent = opts.isControlledContent ? true : false;
}
/**
......
......@@ -17,6 +17,30 @@ export class FormGroupPanelModel extends FormDetailModel {
*/
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.
* 创建 FormGroupPanelModel 实例
......@@ -27,5 +51,17 @@ export class FormGroupPanelModel extends FormDetailModel {
constructor(opts: any = {}) {
super(opts);
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 @@
<sider :width="collapseChange ? 64 : 200" hide-trigger v-model="collapseChange">
<div class="sider-top">
<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>
</div>
</div>
......@@ -26,7 +26,7 @@
ref='appmenu'
@closeview="closeView($event)">
</view_appmenu>
<context-menu-drag :contextMenuDragVisiable="contextMenuDragVisiable"></context-menu-drag>
<context-menu-drag v-if="isEnableAppSwitch" :contextMenuDragVisiable="contextMenuDragVisiable"></context-menu-drag>
</sider>
<layout>
<header class="index_header">
......@@ -408,8 +408,8 @@ export default class AppIndexViewBase extends Vue {
*
* @memberof AppIndexViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false){
if(this.viewDefaultUsage && Object.is(this.navModel,"route")){
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
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});
}
}
......@@ -419,8 +419,8 @@ export default class AppIndexViewBase extends Vue {
*
* @memberof AppIndexViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true){
if(this.viewDefaultUsage && !Object.is(this.navModel,"route")){
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
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);
}
}
......@@ -542,6 +542,14 @@ export default class AppIndexViewBase extends Vue {
*/
public contextMenuDragVisiable: boolean = false;
/**
* 是否支持应用切换
*
* @type {boolean}
* @memberof AppIndexViewBase
*/
public isEnableAppSwitch: boolean = false;
/**
* 初始化之前
*
......
......@@ -91,6 +91,7 @@
display: flex;
align-items: center;
height: 100%;
justify-content: center;
>.menuicon{
display: block;
text-align: center;
......
......@@ -544,8 +544,8 @@ export default class DictCatalogEditViewBase extends Vue {
*
* @memberof DictCatalogEditViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false){
if(this.viewDefaultUsage && Object.is(this.navModel,"route")){
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
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});
}
}
......@@ -555,8 +555,8 @@ export default class DictCatalogEditViewBase extends Vue {
*
* @memberof DictCatalogEditViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true){
if(this.viewDefaultUsage && !Object.is(this.navModel,"route")){
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
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);
}
}
......
......@@ -569,8 +569,8 @@ export default class DictCatalogGridViewBase extends Vue {
*
* @memberof DictCatalogGridViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false){
if(this.viewDefaultUsage && Object.is(this.navModel,"route")){
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
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});
}
}
......@@ -580,8 +580,8 @@ export default class DictCatalogGridViewBase extends Vue {
*
* @memberof DictCatalogGridViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true){
if(this.viewDefaultUsage && !Object.is(this.navModel,"route")){
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
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);
}
}
......@@ -1186,37 +1186,14 @@ export default class DictCatalogGridViewBase extends Vue {
}
/**
* 打开编辑数据视图
*
* @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);
}
!!!!模版产生代码错误:----
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)??
----
----
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 {
*
* @memberof DictCatalogPickupGridViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false){
if(this.viewDefaultUsage && Object.is(this.navModel,"route")){
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
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});
}
}
......@@ -445,8 +445,8 @@ export default class DictCatalogPickupGridViewBase extends Vue {
*
* @memberof DictCatalogPickupGridViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true){
if(this.viewDefaultUsage && !Object.is(this.navModel,"route")){
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
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);
}
}
......
......@@ -427,8 +427,8 @@ export default class DictCatalogPickupViewBase extends Vue {
*
* @memberof DictCatalogPickupViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false){
if(this.viewDefaultUsage && Object.is(this.navModel,"route")){
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
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});
}
}
......@@ -438,8 +438,8 @@ export default class DictCatalogPickupViewBase extends Vue {
*
* @memberof DictCatalogPickupViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true){
if(this.viewDefaultUsage && !Object.is(this.navModel,"route")){
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
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);
}
}
......
......@@ -458,8 +458,8 @@ export default class DictOptionEditViewBase extends Vue {
*
* @memberof DictOptionEditViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false){
if(this.viewDefaultUsage && Object.is(this.navModel,"route")){
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
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});
}
}
......@@ -469,8 +469,8 @@ export default class DictOptionEditViewBase extends Vue {
*
* @memberof DictOptionEditViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true){
if(this.viewDefaultUsage && !Object.is(this.navModel,"route")){
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
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);
}
}
......
......@@ -556,8 +556,8 @@ export default class DictOptionGridEditViewBase extends Vue {
*
* @memberof DictOptionGridEditViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false){
if(this.viewDefaultUsage && Object.is(this.navModel,"route")){
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
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});
}
}
......@@ -567,8 +567,8 @@ export default class DictOptionGridEditViewBase extends Vue {
*
* @memberof DictOptionGridEditViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true){
if(this.viewDefaultUsage && !Object.is(this.navModel,"route")){
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
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);
}
}
......@@ -1159,56 +1159,14 @@ export default class DictOptionGridEditViewBase extends Vue {
}
/**
* 打开编辑数据视图
*
* @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);
}
!!!!模版产生代码错误:----
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)??
----
----
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 {
*
* @memberof DictOptionGridViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false){
if(this.viewDefaultUsage && Object.is(this.navModel,"route")){
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
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});
}
}
......@@ -567,8 +567,8 @@ export default class DictOptionGridViewBase extends Vue {
*
* @memberof DictOptionGridViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true){
if(this.viewDefaultUsage && !Object.is(this.navModel,"route")){
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
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);
}
}
......@@ -1159,56 +1159,14 @@ export default class DictOptionGridViewBase extends Vue {
}
/**
* 打开编辑数据视图
*
* @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);
}
!!!!模版产生代码错误:----
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)??
----
----
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 {
* @memberof DictCatalogServiceBase
*/
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;
}
/**
......@@ -195,7 +196,8 @@ export default class DictCatalogServiceBase extends EntityService {
* @memberof DictCatalogServiceBase
*/
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 {
* @memberof DictCatalogServiceBase
*/
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 {
*/
public async FetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
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 {
*/
public async Select(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
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,7 +69,6 @@ export default class DictOptionServiceBase extends EntityService {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/dictcatalogs/${context.dictcatalog}/dictoptions/${context.dictoption}`,data,isloading);
return res;
}
let masterData:any = {};
Object.assign(data,masterData);
......@@ -87,9 +87,10 @@ export default class DictOptionServiceBase extends EntityService {
*/
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
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 {
let masterData:any = {};
Object.assign(data,masterData);
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 {
if(context.dictcatalog && true){
let res:any = await Http.getInstance().get(`/dictcatalogs/${context.dictcatalog}/dictoptions/getdraft`,isloading);
res.data.dictoption = data.dictoption;
return res;
}
let res:any = await Http.getInstance().get(`/dictoptions/getdraft`,isloading);
res.data.dictoption = data.dictoption;
......@@ -143,7 +143,6 @@ export default class DictOptionServiceBase extends EntityService {
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.dictcatalog && context.dictoption){
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);
return res;
......@@ -170,7 +169,6 @@ export default class DictOptionServiceBase extends EntityService {
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/dictcatalogs/${context.dictcatalog}/dictoptions`,data,isloading);
return res;
}
let masterData:any = {};
Object.assign(data,masterData);
......@@ -199,7 +197,6 @@ export default class DictOptionServiceBase extends EntityService {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/dictcatalogs/${context.dictcatalog}/dictoptions/${context.dictoption}/save`,data,isloading);
return res;
}
let masterData:any = {};
Object.assign(data,masterData);
......@@ -219,9 +216,10 @@ export default class DictOptionServiceBase extends EntityService {
public async FetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.dictcatalog && true){
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));
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) =>{
resourceIndex= state.resourceData.findIndex((resourcetag: any, objIndex: any, objs: any) => {
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;
}
}
\ No newline at end of file
......@@ -63,7 +63,7 @@ export class ViewTool {
public static buildUpRoutePath(route: Route, viewParam: any = {}, deResParameters: any[], parameters: any[], args: any[], data: any): string {
const indexRoutePath = this.getIndexRoutePath(route);
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}`;
}
......@@ -123,7 +123,7 @@ export class ViewTool {
* @returns {string}
* @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 = '';
// 不存在应用实体
if(parameters && parameters.length >0){
......@@ -137,8 +137,7 @@ export class ViewTool {
let [arg] = args;
arg = arg ? arg : {};
const [{ pathName: _pathName, parameterName: _parameterName }, { pathName: _pathName2, parameterName: _parameterName2 }] = parameters;
const _value: any = arg[_parameterName] && !Object.is(arg[_parameterName], '') ?
arg[_parameterName] : null;
const _value: any = arg[_parameterName] || viewParam[_parameterName] || null;
routePath = `/${_pathName}/${_value}/${_pathName2}`;
if (Object.keys(data).length > 0) {
routePath = `${routePath}?${qs.stringify(data, { delimiter: ';' })}`;
......
......@@ -124,6 +124,7 @@ import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import AppCenterService from "@service/app/app-center-service";
import AppIndexViewService from './app-index-view-appmenu-service';
import AppIndexViewModel from './app-index-view-appmenu-model';
......
......@@ -40,6 +40,7 @@ import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
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 DefaultService from './default-searchform-service';
......
......@@ -80,6 +80,8 @@ export default class DefaultService extends ControlService {
*/
@Errorlog
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([])
}
......
......@@ -4,7 +4,7 @@
<row >
<i-col v-show="detailsModel.group1.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.dictcatalog.main_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<app-form-group :manageContainerStatus="detailsModel.group1.manageContainerStatus" :isManageContainer="detailsModel.group1.isManageContainer" @managecontainerclick="manageContainerClick('group1')" layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.dictcatalog.main_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.ccode.visible" :style="{}" :sm="{ span: 24, offset: 0 }" :md="{ span: 8, offset: 0 }" :lg="{ span: 8, offset: 0 }" :xl="{ span: 8, offset: 0 }">
<app-form-item name='ccode' :itemRules="this.rules.ccode" class='' :caption="$t('entities.dictcatalog.main_form.details.ccode')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.ccode.error" :isEmptyCaption="false" labelPos="LEFT">
......@@ -74,6 +74,7 @@ import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
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 MainService from './main-form-service';
......@@ -511,37 +512,37 @@ export default class MainBase extends Vue implements ControlInterface {
* @memberof MainBase
*/
public detailsModel: any = {
group1: new FormGroupPanelModel({ caption: '字典基本信息', detailType: 'GROUPPANEL', name: 'group1', visible: true, isShowCaption: false, form: this, uiActionGroup: { caption: '', langbase: 'entities.dictcatalog.main_form', extractMode: 'ITEM', details: [] } })
group1: new FormGroupPanelModel({ caption: '字典基本信息', detailType: 'GROUPPANEL', name: 'group1', visible: true, isShowCaption: false, form: this, isControlledContent: false , uiActionGroup: { caption: '', langbase: 'entities.dictcatalog.main_form', extractMode: 'ITEM', details: [] }, isManageContainer: false, showMoreModeItems: [] })
,
druipart1: new FormDRUIPartModel({ caption: '字典项', detailType: 'DRUIPART', name: 'druipart1', visible: true, isShowCaption: true, form: this })
druipart1: new FormDRUIPartModel({ caption: '字典项', detailType: 'DRUIPART', name: 'druipart1', visible: true, isShowCaption: true, form: this, isControlledContent: false })
,
formpage1: new FormPageModel({ caption: '基本信息', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this })
formpage1: new FormPageModel({ caption: '基本信息', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this, isControlledContent: false })
,
srfupdatedate: new FormItemModel({ caption: '最后修改时间', detailType: 'FORMITEM', name: 'srfupdatedate', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
srfupdatedate: new FormItemModel({ caption: '最后修改时间', detailType: 'FORMITEM', name: 'srfupdatedate', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
srforikey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srforikey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
srforikey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srforikey', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
srfkey: new FormItemModel({ caption: '标识', detailType: 'FORMITEM', name: 'srfkey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
srfkey: new FormItemModel({ caption: '标识', detailType: 'FORMITEM', name: 'srfkey', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
srfmajortext: new FormItemModel({ caption: '名称', detailType: 'FORMITEM', name: 'srfmajortext', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
srfmajortext: new FormItemModel({ caption: '名称', detailType: 'FORMITEM', name: 'srfmajortext', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
srftempmode: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srftempmode', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
srftempmode: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srftempmode', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
srfuf: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfuf', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
srfuf: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfuf', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
srfdeid: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfdeid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
srfdeid: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfdeid', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
srfsourcekey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfsourcekey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
srfsourcekey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfsourcekey', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
ccode: new FormItemModel({ caption: '代码', detailType: 'FORMITEM', name: 'ccode', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 1 })
ccode: new FormItemModel({ caption: '代码', detailType: 'FORMITEM', name: 'ccode', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 1 })
,
cname: new FormItemModel({ caption: '名称', detailType: 'FORMITEM', name: 'cname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
cname: new FormItemModel({ caption: '名称', detailType: 'FORMITEM', name: 'cname', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
cgroup: new FormItemModel({ caption: '分组', detailType: 'FORMITEM', name: 'cgroup', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
cgroup: new FormItemModel({ caption: '分组', detailType: 'FORMITEM', name: 'cgroup', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
memo: new FormItemModel({ caption: '备注', detailType: 'FORMITEM', name: 'memo', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
memo: new FormItemModel({ caption: '备注', detailType: 'FORMITEM', name: 'memo', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
cid: new FormItemModel({ caption: '标识', detailType: 'FORMITEM', name: 'cid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
cid: new FormItemModel({ caption: '标识', detailType: 'FORMITEM', name: 'cid', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
};
......@@ -702,6 +703,24 @@ export default class MainBase extends Vue implements ControlInterface {
}
/**
* 显示更多模式切换操作
*
* @type {string}
* @memberof MainBase
*/
public manageContainerClick(name: string){
let model = this.detailsModel[name];
if(model.isManageContainer){
model.setManageContainerStatus(!model.manageContainerStatus);
model.showMoreModeItems.forEach((item:any) => {
if(this.detailsModel[item].isControlledContent){
this.detailsModel[item].setVisible(model.manageContainerStatus? this.detailsModel[item].oldVisible : false);
}
});
}
}
/**
* 重置表单项值
*
......@@ -1239,13 +1258,24 @@ export default class MainBase extends Vue implements ControlInterface {
const data = response.data;
this.onFormLoad(data,'autoSave');
this.$emit('save', data);
this.$store.dispatch('viewaction/datasaved', { viewtag: this.viewtag });
AppCenterService.notifyMessage({name:"DictCatalog",action:'appRefresh',data:data});
this.$nextTick(() => {
this.formState.next({ type: 'save', data: data });
});
}).catch((response: any) => {
if (response && response.status && response.data) {
if(response.data.errorKey && Object.is(response.data.errorKey,"versionCheck")){
this.$Modal.confirm({
title: '保存数据发生错误',
content: '数据不一致,可能后台数据已经被修改,是否要重新加载数据?',
onOk: () => {
this.refresh([]);
},
onCancel: () => { }
});
}else{
this.$Notice.error({ title: '错误', desc: response.data.message });
}
return;
}
if (!response || !response.status || !response.data) {
......@@ -1303,7 +1333,7 @@ export default class MainBase extends Vue implements ControlInterface {
const data = response.data;
this.onFormLoad(data,'save');
this.$emit('save', data);
this.$store.dispatch('viewaction/datasaved', { viewtag: this.viewtag });
AppCenterService.notifyMessage({name:"DictCatalog",action:'appRefresh',data:data});
this.$nextTick(() => {
this.formState.next({ type: 'save', data: data });
});
......@@ -1313,8 +1343,19 @@ export default class MainBase extends Vue implements ControlInterface {
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
if(response.data.errorKey && Object.is(response.data.errorKey,"versionCheck")){
this.$Modal.confirm({
title: '保存数据发生错误',
content: '数据不一致,可能后台数据已经被修改,是否要重新加载数据?',
onOk: () => {
this.refresh([]);
},
onCancel: () => { }
});
}else{
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
}
return;
}
if (!response || !response.status || !response.data) {
......@@ -1350,6 +1391,7 @@ export default class MainBase extends Vue implements ControlInterface {
this.formState.next({ type: 'remove', data: data });
this.data.ismodify = false;
this.$Notice.success({ title: '', desc: (data.srfmajortext ? data.srfmajortext : '') + '&nbsp;删除成功!' });
AppCenterService.notifyMessage({name:"DictCatalog",action:'appRefresh',data:data});
resolve(response);
}
}).catch((error: any) => {
......@@ -1438,6 +1480,7 @@ export default class MainBase extends Vue implements ControlInterface {
// 保存完成UI处理
this.onFormLoad(arg,'save');
this.$emit('save', arg);
AppCenterService.notifyMessage({name:"DictCatalog",action:'appRefresh',data:data});
this.$nextTick(() => {
this.formState.next({ type: 'save', data: arg });
});
......@@ -1524,6 +1567,7 @@ export default class MainBase extends Vue implements ControlInterface {
this.fillForm(_data,'updateFormItem');
this.formLogic({ name: '', newVal: null, oldVal: null });
this.dataChang.next(JSON.stringify(this.data));
AppCenterService.notifyMessage({name:"DictCatalog",action:'appRefresh',data:data});
this.$nextTick(() => {
this.formState.next({ type: 'updateformitem', ufimode: arg.srfufimode, data: _data });
});
......
......@@ -80,6 +80,8 @@ export default class MainService extends ControlService {
*/
@Errorlog
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([])
}
......
......@@ -129,6 +129,7 @@ import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
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 MainService from './main-grid-service';
......@@ -258,6 +259,15 @@ export default class MainBase extends Vue implements ControlInterface {
*/
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 {
label: '代码',
langtag: 'entities.dictcatalog.main_grid.columns.ccode',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: false,
},
{
name: 'cname',
label: '名称',
langtag: 'entities.dictcatalog.main_grid.columns.cname',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: false,
},
{
name: 'cgroup',
label: '分组',
langtag: 'entities.dictcatalog.main_grid.columns.cgroup',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: false,
},
{
name: 'memo',
label: '备注',
langtag: 'entities.dictcatalog.main_grid.columns.memo',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: false,
},
{
name: 'updatedate',
label: '最后修改时间',
langtag: 'entities.dictcatalog.main_grid.columns.updatedate',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: false,
},
]
......@@ -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 {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if(this.appStateEvent){
this.appStateEvent.unsubscribe();
}
}
/**
......@@ -1572,14 +1600,17 @@ export default class MainBase extends Vue implements ControlInterface {
* @memberof MainBase
*/
public getCellClassName(args:{row: any, column: any, rowIndex: number, columnIndex:number}){
let hasRowEdit:any = {
'ccode':false,
'cname':false,
'cgroup':false,
'memo':false,
'updatedate':false,
}
return ( hasRowEdit[args.column.property] && this.actualIsOpenEdit ) ? "edit-cell" : "info-cell";
if(args.column.property){
let col = this.allColumns.find((item:any)=>{
return Object.is(args.column.property,item.name);
})
if(col !== undefined){
if(col.isEnableRowEdit && this.actualIsOpenEdit ){
return 'edit-cell';
}
}
}
return 'info-cell';
}
/**
......
......@@ -81,6 +81,8 @@ export default class MainService extends ControlService {
*/
@Errorlog
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([])
}
......
......@@ -24,6 +24,7 @@ import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
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 PickupViewpickupviewpanelService from './pickup-viewpickupviewpanel-pickupviewpanel-service';
......
......@@ -40,6 +40,7 @@ import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
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 DefaultService from './default-searchform-service';
......
......@@ -80,6 +80,8 @@ export default class DefaultService extends ControlService {
*/
@Errorlog
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([])
}
......
......@@ -4,7 +4,7 @@
<row >
<i-col v-show="detailsModel.group1.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.dictoption.main_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<app-form-group :manageContainerStatus="detailsModel.group1.manageContainerStatus" :isManageContainer="detailsModel.group1.isManageContainer" @managecontainerclick="manageContainerClick('group1')" layoutType="TABLE_24COL" titleStyle="" class='' :uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.dictoption.main_form.details.group1')" :isShowCaption="false" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.cname.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='cname' :itemRules="this.rules.cname" class='' :caption="$t('entities.dictoption.main_form.details.cname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.cname.error" :isEmptyCaption="false" labelPos="LEFT">
......@@ -138,6 +138,7 @@ import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
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 MainService from './main-form-service';
......@@ -631,51 +632,51 @@ export default class MainBase extends Vue implements ControlInterface {
* @memberof MainBase
*/
public detailsModel: any = {
group1: new FormGroupPanelModel({ caption: '字典项基本信息', detailType: 'GROUPPANEL', name: 'group1', visible: true, isShowCaption: false, form: this, uiActionGroup: { caption: '', langbase: 'entities.dictoption.main_form', extractMode: 'ITEM', details: [] } })
group1: new FormGroupPanelModel({ caption: '字典项基本信息', detailType: 'GROUPPANEL', name: 'group1', visible: true, isShowCaption: false, form: this, isControlledContent: false , uiActionGroup: { caption: '', langbase: 'entities.dictoption.main_form', extractMode: 'ITEM', details: [] }, isManageContainer: false, showMoreModeItems: [] })
,
formpage1: new FormPageModel({ caption: '基本信息', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this })
formpage1: new FormPageModel({ caption: '基本信息', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this, isControlledContent: false })
,
srfupdatedate: new FormItemModel({ caption: '最后修改时间', detailType: 'FORMITEM', name: 'srfupdatedate', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
srfupdatedate: new FormItemModel({ caption: '最后修改时间', detailType: 'FORMITEM', name: 'srfupdatedate', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
srforikey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srforikey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
srforikey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srforikey', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
srfkey: new FormItemModel({ caption: '标识', detailType: 'FORMITEM', name: 'srfkey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
srfkey: new FormItemModel({ caption: '标识', detailType: 'FORMITEM', name: 'srfkey', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
srfmajortext: new FormItemModel({ caption: '名称', detailType: 'FORMITEM', name: 'srfmajortext', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
srfmajortext: new FormItemModel({ caption: '名称', detailType: 'FORMITEM', name: 'srfmajortext', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
srftempmode: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srftempmode', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
srftempmode: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srftempmode', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
srfuf: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfuf', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
srfuf: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfuf', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
srfdeid: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfdeid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
srfdeid: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfdeid', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
srfsourcekey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfsourcekey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
srfsourcekey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfsourcekey', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
cname: new FormItemModel({ caption: '目录', detailType: 'FORMITEM', name: 'cname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
cname: new FormItemModel({ caption: '目录', detailType: 'FORMITEM', name: 'cname', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
val: new FormItemModel({ caption: '代码值', detailType: 'FORMITEM', name: 'val', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
val: new FormItemModel({ caption: '代码值', detailType: 'FORMITEM', name: 'val', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
label: new FormItemModel({ caption: '名称', detailType: 'FORMITEM', name: 'label', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
label: new FormItemModel({ caption: '名称', detailType: 'FORMITEM', name: 'label', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
pval: new FormItemModel({ caption: '父代码值', detailType: 'FORMITEM', name: 'pval', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
pval: new FormItemModel({ caption: '父代码值', detailType: 'FORMITEM', name: 'pval', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
showorder: new FormItemModel({ caption: '排序', detailType: 'FORMITEM', name: 'showorder', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
showorder: new FormItemModel({ caption: '排序', detailType: 'FORMITEM', name: 'showorder', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
disabled: new FormItemModel({ caption: '是否禁用', detailType: 'FORMITEM', name: 'disabled', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
disabled: new FormItemModel({ caption: '是否禁用', detailType: 'FORMITEM', name: 'disabled', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
expired: new FormItemModel({ caption: '过期/失效', detailType: 'FORMITEM', name: 'expired', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
expired: new FormItemModel({ caption: '过期/失效', detailType: 'FORMITEM', name: 'expired', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
vfilter: new FormItemModel({ caption: '过滤项', detailType: 'FORMITEM', name: 'vfilter', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
vfilter: new FormItemModel({ caption: '过滤项', detailType: 'FORMITEM', name: 'vfilter', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
iconcls: new FormItemModel({ caption: '图标', detailType: 'FORMITEM', name: 'iconcls', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
iconcls: new FormItemModel({ caption: '图标', detailType: 'FORMITEM', name: 'iconcls', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
cls: new FormItemModel({ caption: '栏目样式', detailType: 'FORMITEM', name: 'cls', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
cls: new FormItemModel({ caption: '栏目样式', detailType: 'FORMITEM', name: 'cls', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
extension: new FormItemModel({ caption: '扩展', detailType: 'FORMITEM', name: 'extension', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
extension: new FormItemModel({ caption: '扩展', detailType: 'FORMITEM', name: 'extension', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
cid: new FormItemModel({ caption: '目录代码', detailType: 'FORMITEM', name: 'cid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
cid: new FormItemModel({ caption: '目录代码', detailType: 'FORMITEM', name: 'cid', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
vkey: new FormItemModel({ caption: '标识', detailType: 'FORMITEM', name: 'vkey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
vkey: new FormItemModel({ caption: '标识', detailType: 'FORMITEM', name: 'vkey', visible: true, isShowCaption: true, form: this, isControlledContent: false , disabled: false, enableCond: 3 })
,
};
......@@ -932,6 +933,24 @@ export default class MainBase extends Vue implements ControlInterface {
}
/**
* 显示更多模式切换操作
*
* @type {string}
* @memberof MainBase
*/
public manageContainerClick(name: string){
let model = this.detailsModel[name];
if(model.isManageContainer){
model.setManageContainerStatus(!model.manageContainerStatus);
model.showMoreModeItems.forEach((item:any) => {
if(this.detailsModel[item].isControlledContent){
this.detailsModel[item].setVisible(model.manageContainerStatus? this.detailsModel[item].oldVisible : false);
}
});
}
}
/**
* 重置表单项值
*
......@@ -1476,13 +1495,24 @@ export default class MainBase extends Vue implements ControlInterface {
const data = response.data;
this.onFormLoad(data,'autoSave');
this.$emit('save', data);
this.$store.dispatch('viewaction/datasaved', { viewtag: this.viewtag });
AppCenterService.notifyMessage({name:"DictOption",action:'appRefresh',data:data});
this.$nextTick(() => {
this.formState.next({ type: 'save', data: data });
});
}).catch((response: any) => {
if (response && response.status && response.data) {
if(response.data.errorKey && Object.is(response.data.errorKey,"versionCheck")){
this.$Modal.confirm({
title: '保存数据发生错误',
content: '数据不一致,可能后台数据已经被修改,是否要重新加载数据?',
onOk: () => {
this.refresh([]);
},
onCancel: () => { }
});
}else{
this.$Notice.error({ title: '错误', desc: response.data.message });
}
return;
}
if (!response || !response.status || !response.data) {
......@@ -1540,7 +1570,7 @@ export default class MainBase extends Vue implements ControlInterface {
const data = response.data;
this.onFormLoad(data,'save');
this.$emit('save', data);
this.$store.dispatch('viewaction/datasaved', { viewtag: this.viewtag });
AppCenterService.notifyMessage({name:"DictOption",action:'appRefresh',data:data});
this.$nextTick(() => {
this.formState.next({ type: 'save', data: data });
});
......@@ -1550,8 +1580,19 @@ export default class MainBase extends Vue implements ControlInterface {
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
if(response.data.errorKey && Object.is(response.data.errorKey,"versionCheck")){
this.$Modal.confirm({
title: '保存数据发生错误',
content: '数据不一致,可能后台数据已经被修改,是否要重新加载数据?',
onOk: () => {
this.refresh([]);
},
onCancel: () => { }
});
}else{
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
}
return;
}
if (!response || !response.status || !response.data) {
......@@ -1587,6 +1628,7 @@ export default class MainBase extends Vue implements ControlInterface {
this.formState.next({ type: 'remove', data: data });
this.data.ismodify = false;
this.$Notice.success({ title: '', desc: (data.srfmajortext ? data.srfmajortext : '') + '&nbsp;删除成功!' });
AppCenterService.notifyMessage({name:"DictOption",action:'appRefresh',data:data});
resolve(response);
}
}).catch((error: any) => {
......@@ -1675,6 +1717,7 @@ export default class MainBase extends Vue implements ControlInterface {
// 保存完成UI处理
this.onFormLoad(arg,'save');
this.$emit('save', arg);
AppCenterService.notifyMessage({name:"DictOption",action:'appRefresh',data:data});
this.$nextTick(() => {
this.formState.next({ type: 'save', data: arg });
});
......@@ -1761,6 +1804,7 @@ export default class MainBase extends Vue implements ControlInterface {
this.fillForm(_data,'updateFormItem');
this.formLogic({ name: '', newVal: null, oldVal: null });
this.dataChang.next(JSON.stringify(this.data));
AppCenterService.notifyMessage({name:"DictOption",action:'appRefresh',data:data});
this.$nextTick(() => {
this.formState.next({ type: 'updateformitem', ufimode: arg.srfufimode, data: _data });
});
......
......@@ -89,6 +89,8 @@ export default class MainService extends ControlService {
*/
@Errorlog
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')) {
return this.doItems(this.dictcatalogService.FetchDefault(JSON.parse(JSON.stringify(context)),data, isloading), 'id', 'dictcatalog');
}
......
......@@ -432,6 +432,7 @@ import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
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 MainService from './main-grid-service';
......@@ -561,6 +562,15 @@ export default class MainBase extends Vue implements ControlInterface {
*/
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 {
label: '目录代码',
langtag: 'entities.dictoption.main_grid.columns.cid',
show: false,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'val',
label: '代码值',
langtag: 'entities.dictoption.main_grid.columns.val',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'label',
label: '名称',
langtag: 'entities.dictoption.main_grid.columns.label',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'pval',
label: '父代码值',
langtag: 'entities.dictoption.main_grid.columns.pval',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'showorder',
label: '排序',
langtag: 'entities.dictoption.main_grid.columns.showorder',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'cname',
label: '目录',
langtag: 'entities.dictoption.main_grid.columns.cname',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'cls',
label: '栏目样式',
langtag: 'entities.dictoption.main_grid.columns.cls',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'iconcls',
label: '图标',
langtag: 'entities.dictoption.main_grid.columns.iconcls',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'vfilter',
label: '过滤项',
langtag: 'entities.dictoption.main_grid.columns.vfilter',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'disabled',
label: '是否禁用',
langtag: 'entities.dictoption.main_grid.columns.disabled',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'expired',
label: '过期/失效',
langtag: 'entities.dictoption.main_grid.columns.expired',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'extension',
label: '扩展',
langtag: 'entities.dictoption.main_grid.columns.extension',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'updatedate',
label: '最后修改时间',
langtag: 'entities.dictoption.main_grid.columns.updatedate',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: false,
},
]
......@@ -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 {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if(this.appStateEvent){
this.appStateEvent.unsubscribe();
}
}
/**
......@@ -2007,22 +2043,17 @@ export default class MainBase extends Vue implements ControlInterface {
* @memberof MainBase
*/
public getCellClassName(args:{row: any, column: any, rowIndex: number, columnIndex:number}){
let hasRowEdit:any = {
'cid':true,
'val':true,
'label':true,
'pval':true,
'showorder':true,
'cname':true,
'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";
if(args.column.property){
let col = this.allColumns.find((item:any)=>{
return Object.is(args.column.property,item.name);
})
if(col !== undefined){
if(col.isEnableRowEdit && this.actualIsOpenEdit ){
return 'edit-cell';
}
}
}
return 'info-cell';
}
/**
......
......@@ -90,6 +90,8 @@ export default class MainService extends ControlService {
*/
@Errorlog
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')) {
return this.doItems(this.dictcatalogService.FetchDefault(JSON.parse(JSON.stringify(context)),data, isloading), 'id', 'dictcatalog');
}
......
......@@ -420,6 +420,7 @@ import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
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 OptionsService from './options-grid-service';
......@@ -549,6 +550,15 @@ export default class OptionsBase extends Vue implements ControlInterface {
*/
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 {
label: '目录代码',
langtag: 'entities.dictoption.options_grid.columns.cid',
show: false,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'val',
label: '代码值',
langtag: 'entities.dictoption.options_grid.columns.val',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'label',
label: '名称',
langtag: 'entities.dictoption.options_grid.columns.label',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'pval',
label: '父代码值',
langtag: 'entities.dictoption.options_grid.columns.pval',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'showorder',
label: '排序',
langtag: 'entities.dictoption.options_grid.columns.showorder',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'cname',
label: '目录',
langtag: 'entities.dictoption.options_grid.columns.cname',
show: false,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'cls',
label: '栏目样式',
langtag: 'entities.dictoption.options_grid.columns.cls',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'iconcls',
label: '图标',
langtag: 'entities.dictoption.options_grid.columns.iconcls',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'vfilter',
label: '过滤项',
langtag: 'entities.dictoption.options_grid.columns.vfilter',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'disabled',
label: '是否禁用',
langtag: 'entities.dictoption.options_grid.columns.disabled',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'expired',
label: '过期/失效',
langtag: 'entities.dictoption.options_grid.columns.expired',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
{
name: 'extension',
label: '扩展',
langtag: 'entities.dictoption.options_grid.columns.extension',
show: true,
util: 'PX'
util: 'PX',
isEnableRowEdit: true,
},
]
......@@ -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 {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if(this.appStateEvent){
this.appStateEvent.unsubscribe();
}
}
/**
......@@ -1988,21 +2023,17 @@ export default class OptionsBase extends Vue implements ControlInterface {
* @memberof OptionsBase
*/
public getCellClassName(args:{row: any, column: any, rowIndex: number, columnIndex:number}){
let hasRowEdit:any = {
'cid':true,
'val':true,
'label':true,
'pval':true,
'showorder':true,
'cname':true,
'cls':true,
'iconcls':true,
'vfilter':true,
'disabled':true,
'expired':true,
'extension':true,
}
return ( hasRowEdit[args.column.property] && this.actualIsOpenEdit ) ? "edit-cell" : "info-cell";
if(args.column.property){
let col = this.allColumns.find((item:any)=>{
return Object.is(args.column.property,item.name);
})
if(col !== undefined){
if(col.isEnableRowEdit && this.actualIsOpenEdit ){
return 'edit-cell';
}
}
}
return 'info-cell';
}
/**
......
......@@ -90,6 +90,8 @@ export default class OptionsService extends ControlService {
*/
@Errorlog
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')) {
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>{
boolean execute(String sql, Map param);
}
......@@ -55,6 +55,7 @@ public interface IDictOptionService extends IService<DictOption>{
boolean execute(String sql, Map param);
}
......@@ -46,9 +46,9 @@ public class DictCatalogServiceImpl extends ServiceImpl<DictCatalogMapper, DictC
@Autowired
@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
@Transactional
......@@ -188,4 +188,3 @@ public class DictCatalogServiceImpl extends ServiceImpl<DictCatalogMapper, DictC
}
......@@ -46,9 +46,9 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt
@Autowired
@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
@Transactional
......@@ -221,4 +221,3 @@ public class DictOptionServiceImpl extends ServiceImpl<DictOptionMapper, DictOpt
}
......@@ -5,6 +5,7 @@ import cn.ibizlab.util.helper.UniqueNameGenerator;
import com.baomidou.mybatisplus.core.injector.ISqlInjector;
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.VendorDatabaseIdProvider;
import org.springframework.context.annotation.Bean;
......@@ -42,7 +43,14 @@ public class MybatisConfiguration {
*/
@Bean
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.*;
import cn.ibizlab.core.dict.domain.DictCatalog;
import cn.ibizlab.core.dict.service.IDictCatalogService;
import cn.ibizlab.core.dict.filter.DictCatalogSearchContext;
import cn.ibizlab.util.annotation.VersionCheck;
@Slf4j
@Api(tags = {"字典" })
......@@ -65,6 +66,7 @@ public class DictCatalogResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@VersionCheck(entity = "dictcatalog" , versionfield = "updatedate")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdict-DictCatalog-Update-all')")
@ApiOperation(value = "更新字典", tags = {"字典" }, notes = "更新字典")
@RequestMapping(method = RequestMethod.PUT, value = "/dictcatalogs/{dictcatalog_id}")
......
......@@ -32,6 +32,7 @@ import cn.ibizlab.api.mapping.*;
import cn.ibizlab.core.dict.domain.DictOption;
import cn.ibizlab.core.dict.service.IDictOptionService;
import cn.ibizlab.core.dict.filter.DictOptionSearchContext;
import cn.ibizlab.util.annotation.VersionCheck;
@Slf4j
@Api(tags = {"字典项" })
......@@ -46,6 +47,7 @@ public class DictOptionResource {
@Lazy
public DictOptionMapping dictoptionMapping;
@VersionCheck(entity = "dictoption" , versionfield = "updatedate")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdict-DictOption-Update-all')")
@ApiOperation(value = "更新字典项", tags = {"字典项" }, notes = "更新字典项")
@RequestMapping(method = RequestMethod.PUT, value = "/dictoptions/{dictoption_id}")
......@@ -158,6 +160,7 @@ public class DictOptionResource {
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(dictoptionMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
@VersionCheck(entity = "dictoption" , versionfield = "updatedate")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdict-DictOption-Update-all')")
@ApiOperation(value = "根据字典更新字典项", tags = {"字典项" }, notes = "根据字典更新字典项")
@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,9 +94,11 @@ public class LayeringCache extends AbstractValueAdaptingCache {
@Override
public void put(Object key, Object value) {
if(value!=null) {
caffeineCache.put(key, value);
redisCache.put(key, value);
}
}
@Override
public ValueWrapper putIfAbsent(Object key, Object value) {
......
......@@ -55,6 +55,10 @@ public class AppController {
appData.put("unires",uniRes);
appData.put("appmenu",appMenu);
appData.put("enablepermissionvalid",enablePermissionValid);
if(curUser.getSuperuser()==1)
appData.put("enablepermissionvalid",false);
else
appData.put("enablepermissionvalid",enablePermissionValid);
return ResponseEntity.status(HttpStatus.OK).body(appData);
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册