提交 1b172a33 编写于 作者: ibizdev's avatar ibizdev

zhouweidong@lab.ibiz5.com 发布系统代码

上级 52adace1
<template>
<el-select size="small" class="filter-mode" placeholder="条件逻辑" clearable v-model="curVal" @change="onChange">
<el-select size="small" class="filter-mode" placeholder="条件逻辑" v-model="curVal" @change="onChange">
<el-option
v-for="mode in filterMode"
:key="mode.value"
:label="mode.en"
:label="getLabel(mode)"
:value="mode.value"
>
</el-option>
......@@ -43,23 +43,36 @@ export default class FilterMode extends Vue {
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' }
{ 'zh-CN': '等于(=)', 'en-US': 'EQ', value: '$eq' },
{ 'zh-CN': '不等于(<>)', 'en-US': 'NE', value: '$ne' },
{ 'zh-CN': '大于(>)', 'en-US': 'GT', value: '$gt' },
{ 'zh-CN': '大于等于(>=)', 'en-US': 'GE', value: '$gte' },
{ 'zh-CN': '小于(<)', 'en-US': 'LT', value: '$lt' },
{ 'zh-CN': '小于(<=)', 'en-US': 'LE', value: '$lte' },
{ 'zh-CN': '值为空(Nil)', 'en-US': 'IS_NULL', value: '$null' },
{ 'zh-CN': '值不为空(NotNil)', 'en-US': 'IS_NOT_NULL', value: '$notNull' },
{ 'zh-CN': '值在范围中(In)', 'en-US': 'IN', value: '$in' },
{ 'zh-CN': '值不在范围中(NotIn)', 'en-US': 'NOTIN', value: '$notIn' },
{ 'zh-CN': '文本包含(%)', 'en-US': 'LIKE', value: '$like' },
{ 'zh-CN': '文本左包含(%#)', 'en-US': 'LIFTLIKE', value: '$startsWith' },
{ 'zh-CN': '文本右包含(#%)', 'en-US': 'RIGHTLIKE', value: '$endsWith' },
// { 'zh-CN': '', en: 'EXISTS', value: '$exists' },
// { 'zh-CN': '', en: 'NOTEXISTS', value: '$notExists' }
];
/**
* 获取语言文本
*
* @return {string}
* @memberof FilterMode
*/
getLabel(mode: any): string {
if(this.$i18n.locale) {
return mode[this.$i18n.locale];
}
return mode['zh-CN'];
}
/**
* 值改变
*
......
.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;
width: 100%;
>div {
margin-right: 10px;
}
......@@ -33,10 +11,20 @@
margin-right: 0;
}
.filter-tree-action {
margin-left: 20px;
display: none;
align-items: center;
.ivu-btn {
margin-right: 5px;
}
.ivu-icon-md-close {
color: red;
font-size: 24px;
}
}
}
.filter-tree-item:hover {
.filter-tree-action {
display: flex;
}
}
}
......
<template>
<el-tree class="filter-tree" :data="treeItems" :props="defaultProps" :expand-on-click-node="false" default-expand-all>
<el-tree class="filter-tree" :data="treeItems" :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')">
<template v-if="Object.is(data.label, '$and') || Object.is(data.label, '$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 size="small" v-model="data.label" :disabled="data.isroot">
<el-option v-for="mode in relationModes" :key="mode.value" :label="getLabel(mode)" :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>
<icon v-if="!data.isroot" type="md-close" @click="onRemoveItem(node, data)"/>
</div>
</div>
</template>
......@@ -28,7 +29,7 @@
<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>
<icon type="md-close" @click="onRemoveItem(node, data)"/>
</div>
</div>
</template>
......@@ -47,24 +48,44 @@ import FilterMode from './filter-mode.vue';
})
export default class FilterTree extends Vue {
/**
* 数据集
*
* @type {*}
* @memberof FilterTree
*/
@Prop() datas: any;
/**
* 过滤项集合
*
* @type {*}
* @memberof FilterTree
*/
@Prop() fields: any;
protected defaultProps: any = {
children: 'items',
label: 'name'
};
/**
* 组条件集合
*
* @type {*}
* @memberof FilterTree
*/
protected relationModes: any[] = [
{ zh: '并且', en: 'AND', value: '$and' },
{ zh: '或', en: 'OR', value: '$or' }
{ 'zh-CN': '并且', 'en-US': 'AND', value: '$and' },
{ 'zh-CN': '或', 'en-US': 'OR', value: '$or' }
];
/**
* 树数据集合
*
* @type {*}
* @memberof FilterTree
*/
get treeItems() {
let root: any = {
name: '$and',
items: this.datas
label: '$and',
isroot: true,
children: this.datas
};
if(this.datas.length == 0) {
this.onAddItem(root);
......@@ -73,35 +94,72 @@ export default class FilterTree extends Vue {
return [root];
}
/**
* 获取语言文本
*
* @return {string}
* @memberof FilterTree
*/
getLabel(mode: any): string {
if(this.$i18n.locale) {
return mode[this.$i18n.locale];
}
return mode['zh-CN'];
}
/**
* 属性变化
*
* @return {*}
* @memberof FilterTree
*/
public onFieldChange(data: any) {
if(!data.mode) {
data.mode = '$eq';
}
}
/**
* 添加条件
*
* @return {*}
* @memberof FilterTree
*/
public onAddItem(data: any) {
if(data && data.items) {
data.items.push({
if(data && data.children) {
data.children.push({
field: null,
mode: null
});
}
}
/**
* 添加组
*
* @return {*}
* @memberof FilterTree
*/
public onAddGroup(data: any) {
if(data && data.items) {
data.items.push({
name: '$and',
items: []
if(data && data.children) {
data.children.push({
label: '$and',
children: []
})
}
}
/**
* 删除条件/组
*
* @return {*}
* @memberof FilterTree
*/
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)
if(pData.children.indexOf(data) >= 0) {
pData.children.splice(pData.children.indexOf(data), 1)
}
}
}
......
......@@ -49,10 +49,9 @@ export default class IBZDepartmentServiceBase extends EntityService {
*/
public async Select(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.ibzorganization && context.ibzdepartment){
let res:any = await Http.getInstance().get(`/ibzorganizations/${context.ibzorganization}/ibzdepartments/${context.ibzdepartment}/select`,isloading);
return Http.getInstance().get(`/ibzorganizations/${context.ibzorganization}/ibzdepartments/${context.ibzdepartment}/select`,isloading);
}
let res:any = await Http.getInstance().get(`/ibzdepartments/${context.ibzdepartment}/select`,isloading);
return res;
return Http.getInstance().get(`/ibzdepartments/${context.ibzdepartment}/select`,isloading);
}
/**
......@@ -108,6 +107,7 @@ export default class IBZDepartmentServiceBase extends EntityService {
let res:any = await Http.getInstance().post(`/ibzorganizations/${context.ibzorganization}/ibzdepartments`,data,isloading);
this.tempStorage.setItem(tempContext.srfsessionkey+'_ibzemployees',JSON.stringify(res.data.ibzemployees));
this.tempStorage.setItem(tempContext.srfsessionkey+'_ibzdeptmembers',JSON.stringify(res.data.ibzdeptmembers));
return res;
}
let masterData:any = {};
let ibzemployeesData:any = [];
......@@ -200,6 +200,7 @@ export default class IBZDepartmentServiceBase extends EntityService {
let res:any = await Http.getInstance().put(`/ibzorganizations/${context.ibzorganization}/ibzdepartments/${context.ibzdepartment}`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_ibzemployees',JSON.stringify(res.data.ibzemployees));
this.tempStorage.setItem(context.srfsessionkey+'_ibzdeptmembers',JSON.stringify(res.data.ibzdeptmembers));
return res;
}
let masterData:any = {};
let ibzemployeesData:any = [];
......@@ -250,10 +251,9 @@ export default class IBZDepartmentServiceBase extends EntityService {
*/
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.ibzorganization && context.ibzdepartment){
let res:any = await Http.getInstance().delete(`/ibzorganizations/${context.ibzorganization}/ibzdepartments/${context.ibzdepartment}`,isloading);
return Http.getInstance().delete(`/ibzorganizations/${context.ibzorganization}/ibzdepartments/${context.ibzdepartment}`,isloading);
}
let res:any = await Http.getInstance().delete(`/ibzdepartments/${context.ibzdepartment}`,isloading);
return res;
return Http.getInstance().delete(`/ibzdepartments/${context.ibzdepartment}`,isloading);
}
/**
......@@ -270,6 +270,7 @@ export default class IBZDepartmentServiceBase extends EntityService {
let res:any = await Http.getInstance().get(`/ibzorganizations/${context.ibzorganization}/ibzdepartments/${context.ibzdepartment}`,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_ibzemployees',JSON.stringify(res.data.ibzemployees));
this.tempStorage.setItem(context.srfsessionkey+'_ibzdeptmembers',JSON.stringify(res.data.ibzdeptmembers));
return res;
}
let res:any = await Http.getInstance().get(`/ibzdepartments/${context.ibzdepartment}`,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_ibzemployees',JSON.stringify(res.data.ibzemployees));
......@@ -292,6 +293,7 @@ export default class IBZDepartmentServiceBase extends EntityService {
res.data.ibzdepartment = data.ibzdepartment;
this.tempStorage.setItem(context.srfsessionkey+'_ibzemployees',JSON.stringify(res.data.ibzemployees));
this.tempStorage.setItem(context.srfsessionkey+'_ibzdeptmembers',JSON.stringify(res.data.ibzdeptmembers));
return res;
}
let res:any = await Http.getInstance().get(`/ibzdepartments/getdraft`,isloading);
res.data.ibzdepartment = data.ibzdepartment;
......@@ -346,10 +348,10 @@ export default class IBZDepartmentServiceBase extends EntityService {
let res:any = await Http.getInstance().post(`/ibzorganizations/${context.ibzorganization}/ibzdepartments/${context.ibzdepartment}/checkkey`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_ibzemployees',JSON.stringify(res.data.ibzemployees));
this.tempStorage.setItem(context.srfsessionkey+'_ibzdeptmembers',JSON.stringify(res.data.ibzdeptmembers));
}
let res:any = await Http.getInstance().post(`/ibzdepartments/${context.ibzdepartment}/checkkey`,data,isloading);
return res;
}
return Http.getInstance().post(`/ibzdepartments/${context.ibzdepartment}/checkkey`,data,isloading);
}
/**
* Save接口方法
......@@ -397,6 +399,7 @@ export default class IBZDepartmentServiceBase extends EntityService {
let res:any = await Http.getInstance().post(`/ibzorganizations/${context.ibzorganization}/ibzdepartments/${context.ibzdepartment}/save`,data,isloading);
this.tempStorage.setItem(context.srfsessionkey+'_ibzemployees',JSON.stringify(res.data.ibzemployees));
this.tempStorage.setItem(context.srfsessionkey+'_ibzdeptmembers',JSON.stringify(res.data.ibzdeptmembers));
return res;
}
let masterData:any = {};
let ibzemployeesData:any = [];
......@@ -448,10 +451,9 @@ export default class IBZDepartmentServiceBase extends EntityService {
public async FetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.ibzorganization && true){
let tempData:any = JSON.parse(JSON.stringify(data));
let res:any = await Http.getInstance().get(`/ibzorganizations/${context.ibzorganization}/ibzdepartments/fetchdefault`,tempData,isloading);
return Http.getInstance().get(`/ibzorganizations/${context.ibzorganization}/ibzdepartments/fetchdefault`,tempData,isloading);
}
let tempData:any = JSON.parse(JSON.stringify(data));
let res:any = await Http.getInstance().get(`/ibzdepartments/fetchdefault`,tempData,isloading);
return res;
return Http.getInstance().get(`/ibzdepartments/fetchdefault`,tempData,isloading);
}
}
\ No newline at end of file
......@@ -48,8 +48,7 @@ export default class IBZOrganizationServiceBase extends EntityService {
* @memberof IBZOrganizationServiceBase
*/
public async Select(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/ibzorganizations/${context.ibzorganization}/select`,isloading);
return res;
return Http.getInstance().get(`/ibzorganizations/${context.ibzorganization}/select`,isloading);
}
/**
......@@ -165,8 +164,7 @@ export default class IBZOrganizationServiceBase extends EntityService {
* @memberof IBZOrganizationServiceBase
*/
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().delete(`/ibzorganizations/${context.ibzorganization}`,isloading);
return res;
return Http.getInstance().delete(`/ibzorganizations/${context.ibzorganization}`,isloading);
}
/**
......@@ -212,8 +210,7 @@ export default class IBZOrganizationServiceBase extends EntityService {
* @memberof IBZOrganizationServiceBase
*/
public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().post(`/ibzorganizations/${context.ibzorganization}/checkkey`,data,isloading);
return res;
return Http.getInstance().post(`/ibzorganizations/${context.ibzorganization}/checkkey`,data,isloading);
}
/**
......@@ -275,7 +272,6 @@ export default class IBZOrganizationServiceBase extends EntityService {
*/
public async FetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let tempData:any = JSON.parse(JSON.stringify(data));
let res:any = await Http.getInstance().get(`/ibzorganizations/fetchdefault`,tempData,isloading);
return res;
return Http.getInstance().get(`/ibzorganizations/fetchdefault`,tempData,isloading);
}
}
\ No newline at end of file
......@@ -48,8 +48,7 @@ export default class IBZPostServiceBase extends EntityService {
* @memberof IBZPostServiceBase
*/
public async Select(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/ibzposts/${context.ibzpost}/select`,isloading);
return res;
return Http.getInstance().get(`/ibzposts/${context.ibzpost}/select`,isloading);
}
/**
......@@ -101,8 +100,7 @@ export default class IBZPostServiceBase extends EntityService {
* @memberof IBZPostServiceBase
*/
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().delete(`/ibzposts/${context.ibzpost}`,isloading);
return res;
return Http.getInstance().delete(`/ibzposts/${context.ibzpost}`,isloading);
}
/**
......@@ -144,8 +142,7 @@ export default class IBZPostServiceBase extends EntityService {
* @memberof IBZPostServiceBase
*/
public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().post(`/ibzposts/${context.ibzpost}/checkkey`,data,isloading);
return res;
return Http.getInstance().post(`/ibzposts/${context.ibzpost}/checkkey`,data,isloading);
}
/**
......@@ -175,7 +172,6 @@ export default class IBZPostServiceBase extends EntityService {
*/
public async FetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let tempData:any = JSON.parse(JSON.stringify(data));
let res:any = await Http.getInstance().get(`/ibzposts/fetchdefault`,tempData,isloading);
return res;
return Http.getInstance().get(`/ibzposts/fetchdefault`,tempData,isloading);
}
}
\ No newline at end of file
......@@ -48,8 +48,7 @@ export default class IBZTeamServiceBase extends EntityService {
* @memberof IBZTeamServiceBase
*/
public async Select(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/ibzteams/${context.ibzteam}/select`,isloading);
return res;
return Http.getInstance().get(`/ibzteams/${context.ibzteam}/select`,isloading);
}
/**
......@@ -133,8 +132,7 @@ export default class IBZTeamServiceBase extends EntityService {
* @memberof IBZTeamServiceBase
*/
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().delete(`/ibzteams/${context.ibzteam}`,isloading);
return res;
return Http.getInstance().delete(`/ibzteams/${context.ibzteam}`,isloading);
}
/**
......@@ -178,8 +176,7 @@ export default class IBZTeamServiceBase extends EntityService {
* @memberof IBZTeamServiceBase
*/
public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().post(`/ibzteams/${context.ibzteam}/checkkey`,data,isloading);
return res;
return Http.getInstance().post(`/ibzteams/${context.ibzteam}/checkkey`,data,isloading);
}
/**
......@@ -225,7 +222,6 @@ export default class IBZTeamServiceBase extends EntityService {
*/
public async FetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let tempData:any = JSON.parse(JSON.stringify(data));
let res:any = await Http.getInstance().get(`/ibzteams/fetchdefault`,tempData,isloading);
return res;
return Http.getInstance().get(`/ibzteams/fetchdefault`,tempData,isloading);
}
}
\ No newline at end of file
package cn.ibizlab.core.extensions.service;
import cn.ibizlab.core.ou.service.impl.IBZEmployeeServiceImpl;
import lombok.extern.slf4j.Slf4j;
import cn.ibizlab.core.ou.domain.IBZEmployee;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.context.annotation.Primary;
import java.util.*;
/**
* 实体[人员] 自定义服务对象
* 扩展目录已变更,请到[cn.ibizlab.core.extensions.service.xxExService]中来进行扩展
* 若您之前有在当前目录下扩展过其它的service对象,请将扩展的代码移到新的扩展类中,并注释掉老的扩展类,防止Bean重复
*/
@Slf4j
@Primary
@Service("IBZEmployeeServiceEx")
public class IBZEmployeeServiceEx extends IBZEmployeeServiceImpl {
@Override
protected Class currentModelClass() {
return com.baomidou.mybatisplus.core.toolkit.ReflectionKit.getSuperClassGenericType(this.getClass().getSuperclass(), 1);
}
@Deprecated
public class IBZEmployeeServiceEx{
/**
* 自定义行为[InitPwd]用户扩展
* @param et
* @return
*/
@Override
@Transactional
public IBZEmployee initPwd(IBZEmployee et) {
return super.initPwd(et);
}
}
package cn.ibizlab.core.extensions.service;
import cn.ibizlab.core.ou.service.impl.IBZEmployeeServiceImpl;
import lombok.extern.slf4j.Slf4j;
import cn.ibizlab.core.ou.domain.IBZEmployee;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.context.annotation.Primary;
import java.util.*;
/**
* 实体[人员] 自定义服务对象
*/
@Slf4j
@Primary
@Service("IBZEmployeeExService")
public class IBZEmployeeExService extends IBZEmployeeServiceImpl {
@Override
protected Class currentModelClass() {
return com.baomidou.mybatisplus.core.toolkit.ReflectionKit.getSuperClassGenericType(this.getClass().getSuperclass(), 1);
}
/**
* 自定义行为[InitPwd]用户扩展
* @param et
* @return
*/
@Override
@Transactional
public IBZEmployee initPwd(IBZEmployee et) {
return super.initPwd(et);
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册