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

ibiz4j 发布系统代码

上级 2a090687
## v7.0.0-alpha.6 [2020-5-23]
### Bug修复
修复处理快速分组模型动态数据部分
修复列表,数据视图默认排序
### 功能新增及优化
#### 模板
补充单位选择器、部门选择器、人员选择器
#### 基础文件
补充单位选择器、部门选择器、人员选择器
## v7.0.0-alpha.5 [2020-5-21]
### Bug修复
修复表格视图搜索placeholder显示为搜索字段
修复表单嵌表单分页异常
修复门户视图操作栏标题
修复看板部件高度自动撑
修复表单分组,界面行为组不显示
修复表格操作列数据异常
### 功能新增及优化
#### 模板
支持拷贝功能
支持实体甘特图视图
支持面板项隐藏表单项
支持表格列最小宽度和操作列样式支持
支持列表项、面板代码表转化
#### 基础文件
支持列表项、面板代码表转化
修复表单分组,界面行为组不显示
## v7.0.0-alpha.4 [2020-5-14]
### Bug修复
修复代码表代码项图标和数据
修复数据多项选择视图UI逻辑不匹配
修复列表高度异常
修复树节点上下文
修复表格(视图)高度,滚动条问题
修复表单loaddraft服务仿真主键丢失修复
修复user显示名称逻辑
修复issue地址为正式环境地址
### 功能新增及优化
#### 模板
模态时视图样式调整
增加菜单权限
增加快速分组搜索或快速搜索表单功能
增加表格内置工具栏
代码表多选控件分割符从分号转化为逗号
#### 基础文件
增加数据选择类插件表格呈现插件
## v7.0.0-alpha.3 [2020-5-10]
### Bug修复
......@@ -65,3 +162,5 @@
## v7.0.0-alpha.1 [2020-4-29]
初始化文件
......@@ -117,7 +117,9 @@ $ yarn build
|─ ─ favicon.ico 图标
​ |─ ─ src 工程文件夹
|─ ─ assets 静态资源
|─ ─ codelist 动态代码表服务
|─ ─ components 基础组件,主要包含编辑器组件和其他全局使用的组件
|─ ─ counter 计数器服务
|─ ─ engine 引擎文件,主要封装了内置视图的内置逻辑
|─ ─ environments 环境文件
​ |─ ─ interface 接口文件
......@@ -150,6 +152,7 @@ $ yarn build
|─ ─ YYY-ui-logic-base.ts 应用实体界面处理逻辑文件
|─ ─ YYY-ui-logic.ts 自定义应用实体界面处理逻辑文件
|─ ─ utils 工具类文件
|─ ─ utilservice 应用功能服务
|─ ─ widgets 部件文件夹
|─ ─ appde 应用实体名称
​ |─ ─ XXX 部件名称
......
......@@ -18,12 +18,16 @@
"@fullcalendar/list": "^4.4.0",
"@fullcalendar/timegrid": "^4.4.0",
"@fullcalendar/vue": "^4.4.0",
"vuedraggable": "^2.23.2",
"async-validator": "^3.3.0",
"axios": "^0.19.1",
"core-js": "^3.4.4",
"echarts": "^4.6.0",
"element-ui": "^2.13.0",
"file-saver": "^2.0.2",
"font-awesome": "^4.7.0",
"ibiz-gantt-elastic": "^1.0.15",
"ibiz-vue-lib": "^0.1.9",
"interactjs": "^1.9.4",
"moment": "^2.24.0",
"path-to-regexp": "^6.1.0",
......
......@@ -71,6 +71,11 @@ import AppUploadFileInfo from './components/app-upload-file-info/app-upload-file
import ContextMenu from './components/context-menu/context-menu'
import AppColumnFormat from './components/app-column-format/app-column-format.vue'
import AppQuickGroup from './components/app-quick-group/app-quick-group.vue'
import AppOrgSelect from './components/app-org-select/app-org-select.vue'
import AppDepartmentSelect from './components/app-department-select/app-department-select.vue'
import IBizGroupSelect from './components/ibiz-group-select/ibiz-group-select.vue'
import IBizGroupPicker from './components/ibiz-group-picker/ibiz-group-picker.vue'
import AppWFApproval from './components/app-wf-approval/app-wf-approval.vue'
// 全局挂载UI实体服务注册中心
window['uiServiceRegister'] = uiServiceRegister;
......@@ -151,5 +156,10 @@ export const AppComponents = {
v.component('context-menu',ContextMenu);
v.component('app-column-format',AppColumnFormat);
v.component('app-quick-group',AppQuickGroup);
v.component('app-org-select',AppOrgSelect);
v.component('app-department-select',AppDepartmentSelect);
v.component('ibiz-group-select',IBizGroupSelect);
v.component('ibiz-group-picker',IBizGroupPicker);
v.component('app-wf-approval',AppWFApproval);
},
};
\ No newline at end of file
.ivu-dropdown{
.ivu-dropdown-rel{
.tree-input{
.ivu-input-suffix{
width: auto;
text-align: right;
.icon-arrow{
margin-right: 4px;
}
}
.el-icon-circle-close{
display: none;
}
}
.tree-input:hover{
.el-icon-circle-close{
display: inline-block;
}
}
}
.ivu-select-dropdown{
max-height: 200px;
overflow: scroll;
.tree-contant{
overflow:inherit;
}
}
}
<template>
<div class="app-department-select">
<ibiz-select-tree :NodesData="Nodesdata" v-model="selectTreeValue" :multiple="multiple" @select="onSelect"></ibiz-select-tree>
</div>
</template>
<script lang="ts">
import { Vue, Component, Watch, Prop, Model } from 'vue-property-decorator';
@Component({
})
export default class AppDepartmentSelect extends Vue {
/**
* 接口url
*
* @type {*}
* @memberof AppDepartmentSelect
*/
@Prop() public url?: any;
/**
* 过滤项
*
* @type {*}
* @memberof AppDepartmentSelect
*/
@Prop() public filter?: any;
/**
* 过滤项
*
* @type {*}
* @memberof AppDepartmentSelect
*/
@Prop() public fillMap?: any;
/**
* 是否多选
*
* @type {*}
* @memberof AppDepartmentSelect
*/
@Prop({default:false}) public multiple?: any;
/**
* 表单数据
*
* @type {*}
* @memberof AppDepartmentSelect
*/
@Prop() public data!: any;
/**
* 上下文变量
*
* @type {*}
* @memberof AppDepartmentSelect
*/
@Prop() public context!: any;
/**
* 选中数值
*
* @type {*}
* @memberof AppDepartmentSelect
*/
public selectTreeValue:any = "";
/**
* 树节点数据
*
* @type {*}
* @memberof AppDepartmentSelect
*/
public Nodesdata: any[] = [];
/**
* 当前树节点数据的url
*
* @type {*}
* @memberof AppDepartmentSelect
*/
public oldurl: any[] = [];
/**
* 获取节点数据
*
* @memberof AppDepartmentSelect
*/
public handleFilter(){
if(this.filter){
if(this.data && this.data[this.filter]){
return this.data[this.filter];
}else if(this.context && this.context[this.filter]){
return this.context[this.filter];
}
}else{
return this.context.srforgid;
}
}
/**
* 获取节点数据
*
* @memberof AppDepartmentSelect
*/
public searchNodesData(){
// 处理过滤参数,生成url
let param = this.handleFilter();
let _url = this.url.replace('${orgid}',param)
if(this.oldurl === _url){
return;
}
this.oldurl = _url;
// 缓存机制
const result:any = this.$store.getters.getCopyData(_url);
if(result){
this.Nodesdata = result;
return;
}
this.$http.get(_url).then((response: any) => {
this.Nodesdata = response.data;
this.$store.commit('addDepData', { srfkey: this.filter, orgData: response.data });
}).catch((response: any) => {
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常!' });
return;
}
});
}
/**
* 值变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof AppDepartmentSelect
*/
@Watch('data',{immediate:true,deep:true})
public onValueChange(newVal: any, oldVal: any) {
if(newVal){
this.computedSelectedData();
this.$nextTick(()=>{
this.searchNodesData();
});
}
}
/**
* 计算选中值
*
* @memberof AppOrgSelect
*/
public computedSelectedData(){
// 单选
if(!this.multiple){
if(this.fillMap && Object.keys(this.fillMap).length >0){
let templateValue = {};
Object.keys(this.fillMap).forEach((item:any) =>{
if(this.data && this.data[this.fillMap[item]]){
Object.assign(templateValue,{[item]:this.data[this.fillMap[item]]});
}
})
this.selectTreeValue = JSON.stringify([templateValue]);
}
}else{
// 多选
if(this.fillMap && Object.keys(this.fillMap).length >0){
let tempArray:Array<any> = [];
Object.keys(this.fillMap).forEach((item:any) =>{
if(this.data && this.data[this.fillMap[item]]){
let tempDataArray:Array<any> = (this.data[this.fillMap[item]]).split(",");
tempDataArray.forEach((tempData:any,index:number) =>{
if(tempArray.length < tempDataArray.length){
let singleData:any ={[item]:tempData};
tempArray.push(singleData);
}else{
Object.assign(tempArray[index],{[item]:tempData});
}
})
}
})
this.selectTreeValue = JSON.stringify(tempArray);
}
}
}
/**
* select事件处理
*
* @param {*} $event
* @memberof AppDepartmentSelect
*/
public onSelect($event:any){
// 组件自身抛值事件
let selectArr = JSON.parse($event);
// fillMap抛值事件
if(this.fillMap && Object.keys(this.fillMap).length > 0){
Object.keys(this.fillMap).forEach((attribute:string) => {
let _name = this.fillMap[attribute];
let values = selectArr.map((item:any) => item[attribute]);
let _value = $event === "[]" ? null : values.join(",");
this.$emit('select-change',{name: this.fillMap[attribute], value: _value})
});
}
}
}
</script>
<style lang='less'>
@import './app-department-select.less';
</style>
\ No newline at end of file
......@@ -47,6 +47,14 @@ export default class AppFormDRUIPart extends Vue {
*/
@Prop({ default: '' }) public refreshitems!: string;
/**
* 禁止加载
*
* @type {string}
* @memberof AppFormDRUIPart
*/
@Prop({ default: false }) public isForbidLoad!: boolean;
/**
* 关系视图类型
*
......@@ -232,7 +240,7 @@ export default class AppFormDRUIPart extends Vue {
}
const formData: any = data?data:JSON.parse(this.data);
const _paramitem = formData[this.paramItem];
let viewdata = {srfparentdename:this.parentName,srfparentkey:_paramitem};
let viewdata = {};
Object.assign(viewdata, this.$viewTool.getIndexViewParam());
const _parameters: any[] = [...this.$viewTool.getIndexParameters(), ...this.parameters];
_parameters.forEach((parameter: any) => {
......@@ -244,6 +252,7 @@ export default class AppFormDRUIPart extends Vue {
Object.assign(viewdata, { [this.paramItem]: _paramitem });
//设置顶层视图唯一标识
Object.assign(viewdata,this.context);
Object.assign(viewdata,{srfparentdename:this.parentName,srfparentkey:_paramitem});
this.viewdata = JSON.stringify(viewdata);
this.viewparam = JSON.stringify(this.viewparams);
if (this.isRelationalData) {
......@@ -254,7 +263,11 @@ export default class AppFormDRUIPart extends Vue {
this.blockUIStop();
}
}
this.formDruipart.next({action:'load',data:{srfparentdename:this.parentName,srfparentkey:_paramitem}});
if(!this.isForbidLoad){
this.$nextTick(() => {
this.formDruipart.next({action:'load',data:{srfparentdename:this.parentName,srfparentkey:_paramitem}});
});
}
}
/**
......
......@@ -9,6 +9,7 @@
}
>.ivu-card-extra {
.item-extract-mode {
display: flex;
.item {
margin-left: 12px;
}
......
.app-org-select {
width: 100%;
}
\ No newline at end of file
<template>
<div class="app-org-select">
<ibiz-select-tree :NodesData="NodesData" v-model="selectTreeValue" :multiple="multiple" @select="treeSelectChange"></ibiz-select-tree>
</div>
</template>
<script lang = 'ts'>
import { Vue, Component, Prop, Watch } from "vue-property-decorator";
import { Http } from '@/utils';
@Component({})
export default class AppOrgSelect extends Vue {
/**
* 表单数据
*
* @memberof AppOrgSelect
*/
@Prop() public data!:any;
/**
* 上下文
*
* @memberof AppOrgSelect
*/
@Prop() public context!:any;
/**
* 填充对象
*
* @memberof AppOrgSelect
*/
@Prop() public fillMap:any;
/**
* 过滤项
*
* @memberof AppOrgSelect
*/
@Prop() public filter?:string;
/**
* 是否多选
*
* @memberof AppOrgSelect
*/
@Prop({default:false}) public multiple?:boolean;
/**
* 查询单位路径
*
* @memberof AppOrgSelect
*/
@Prop() public url!:string;
/**
* 监听表单数据变化
*
* @memberof AppOrgSelect
*/
@Watch('data',{immediate:true,deep:true})
onDataChange(newVal: any, oldVal: any) {
if(newVal){
this.computedSelectedData();
if(this.filter){
let tempFilterValue:any = this.initBasicData();
// filter值变化才去请求数据
if(tempFilterValue && (this.copyFilterValue !== tempFilterValue)){
this.loadTreeData(this.url.replace('${orgid}',tempFilterValue));
this.copyFilterValue = tempFilterValue;
}
}
}
}
/**
* 选择值
*
* @memberof AppOrgSelect
*/
public selectTreeValue:any = "";
/**
* 树节点数据
*
* @memberof AppOrgSelect
*/
public NodesData:any = [];
/**
* 备份过滤值
*
* @memberof AppOrgSelect
*/
public copyFilterValue:any;
/**
* vue生命周期
*
* @memberof AppOrgSelect
*/
public created(){
if(!this.filter){
this.loadTreeData(this.url);
}
}
/**
* 加载树数据
*
* @memberof AppOrgSelect
*/
public initBasicData(){
// 计算出过滤值
if(this.filter){
if(this.data && this.data[this.filter]){
return this.data[this.filter];
}else if(this.context && this.context[this.filter]){
return this.context[this.filter];
}else{
return null;
}
}
}
/**
* 计算选中值
*
* @memberof AppOrgSelect
*/
public computedSelectedData(){
// 单选
if(!this.multiple){
if(this.fillMap && Object.keys(this.fillMap).length >0){
let templateValue = {};
Object.keys(this.fillMap).forEach((item:any) =>{
if(this.data && this.data[this.fillMap[item]]){
Object.assign(templateValue,{[item]:this.data[this.fillMap[item]]});
}
})
this.selectTreeValue = JSON.stringify([templateValue]);
}
}else{
// 多选
if(this.fillMap && Object.keys(this.fillMap).length >0){
let tempArray:Array<any> = [];
Object.keys(this.fillMap).forEach((item:any) =>{
if(this.data && this.data[this.fillMap[item]]){
let tempDataArray:Array<any> = (this.data[this.fillMap[item]]).split(",");
tempDataArray.forEach((tempData:any,index:number) =>{
if(tempArray.length < tempDataArray.length){
let singleData:any ={[item]:tempData};
tempArray.push(singleData);
}else{
Object.assign(tempArray[index],{[item]:tempData});
}
})
}
})
this.selectTreeValue = JSON.stringify(tempArray);
}
}
}
/**
* 加载树数据
*
* @memberof AppOrgSelect
*/
public loadTreeData(requestUrl:string){
if(this.filter){
const result:any = this.$store.getters.getCopyData(this.filter);
if(result){
this.NodesData = result;
return;
}
}
Http.getInstance().get(requestUrl).then((res:any) =>{
if(!res.status && res.status !== 200){
console.error("加载数据失败");
return;
}
this.NodesData = res.data;
if(this.filter){
this.$store.commit('addOrgData', { srfkey: this.filter, orgData: res.data });
}
})
}
/**
* 树选择触发事件
*
* @memberof AppOrgSelect
*/
public treeSelectChange($event:any){
// 多选
if(this.multiple){
if(!Object.is($event,'[]')){
const tempValue:any = JSON.parse($event);
if(this.fillMap && Object.keys(this.fillMap).length >0){
Object.keys(this.fillMap).forEach((item:any) =>{
let tempResult:any ="";
tempValue.forEach((value:any,index:number) =>{
tempResult += index>0?`,${value[item]}`:`${value[item]}`;
})
this.emitValue(this.fillMap[item],tempResult);
})
}
}else{
if(this.fillMap && Object.keys(this.fillMap).length >0){
Object.keys(this.fillMap).forEach((item:any) =>{
this.emitValue(this.fillMap[item],null);
})
}
}
}else{
// 单选
if(!Object.is($event,'[]')){
const tempValue:any = JSON.parse($event)[0];
if(this.fillMap && Object.keys(this.fillMap).length >0){
Object.keys(this.fillMap).forEach((item:any) =>{
this.emitValue(this.fillMap[item],tempValue[item]);
})
}
}else{
if(this.fillMap && Object.keys(this.fillMap).length >0){
Object.keys(this.fillMap).forEach((item:any) =>{
this.emitValue(this.fillMap[item],null);
})
}
}
}
}
/**
* 抛值
*
* @memberof AppOrgSelect
*/
public emitValue(name:string,value:any){
this.$emit('select-change',{name:name,value:value});
}
}
</script>
<style lang="less">
@import "./app-org-select.less";
</style>
\ No newline at end of file
......@@ -81,9 +81,16 @@ export default class AppUser extends Vue {
* @memberof AppUser
*/
public logout() {
localStorage.removeItem('user');
localStorage.removeItem('token');
this.$router.push({ name: 'login' });
const get: Promise<any> = this.$http.get('v7/logout');
get.then((response:any) =>{
if (response && response.status === 200) {
localStorage.removeItem('user');
localStorage.removeItem('token');
this.$router.push({ name: 'login' });
}
}).catch((error: any) =>{
console.error(error);
})
}
}
</script>
......
.app-wf-approval{
width:100%;
.app-wf-approval-header{
width: 100%;
text-align: center;
background: #e5eaef;
height: 32px;
line-height: 32px;
font-size: 16px;
border: 1px solid #565656;
.approval-header-left{
margin-right: 24px;
}
}
.app-wf-approval-bottom{
width: 100%;
text-align: center;
background: #e5eaef;
height: 32px;
line-height: 32px;
font-size: 16px;
border-style: solid;
border-width: 0px 1px 1px 1px;
border-color: #565656;
}
.app-wf-approval-content{
border-left: 1px solid #565656;
border-right: 1px solid #565656;
.approval-content-item{
display: flex;
align-items: center;
font-size: 16px;
border-bottom: 1px solid #565656;
.approval-content-item-left{
width: 130px;
padding: 8px;
text-align: center;
}
.approval-content-item-right{
width: calc(100% - 130px);
border-left:1px solid #565656;
.approval-content-item-wait{
padding: 0px 4px;
height: 32px;
line-height: 32px;
font-size: 16px;
border-bottom:1px solid #565656;
background: #d1ef5c;
>span{
font-size: 18px;
color: #000;
font-weight: 600;
}
}
.approval-content-item-info{
.approval-content-item-info-item {
padding: 0px 4px;
height: 32px;
line-height: 32px;
border-bottom:1px solid #565656;
}
.approval-content-item-info-top{
font-size: 16px;
}
.approval-content-item-info-bottom{
font-size: 14px;
text-align: right;
>span{
margin-right:6px;
}
.info-bottom-name{
font-size: 18px;
font-weight: 600;
}
}
> div:nth-last-child(1){
> .approval-content-item-info-item:nth-last-child(1){
border-bottom: 0;
}
}
}
.approval-content-item-memo{
padding: 0px 4px;
.el-textarea__inner{
border: 0px !important;
padding: 0px !important;
}
}
}
}
}
}
\ No newline at end of file
<template>
<div class='app-wf-approval'>
<div class="app-wf-approval-header">
<span class="approval-header-left">{{data.startTime}}</span>
<span>{{data.startUserName}}提交</span>
</div>
<div class="app-wf-approval-content" v-if="data.usertasks && data.usertasks.length >0">
<div class="approval-content-item" v-for="(usertask,index) in data.usertasks" :key="index">
<div class="approval-content-item-left">
{{usertask.userTaskName}}
</div>
<div class="approval-content-item-right">
<div class="approval-content-item-wait" v-if="usertask.identitylinks.length >0">
等待<span v-for="(identitylink,inx) in usertask.identitylinks" :key="inx">{{identitylink.displayname}}<span v-if="inx >0"></span></span>处理
</div>
<div class="approval-content-item-info" v-if="usertask.comments.length >0">
<div v-for="(comment,commentInx) in usertask.comments" :key="commentInx">
<div class="approval-content-item-info-item approval-content-item-info-top">
{{`【${comment.type}】${comment.fullMessage}`}}
</div>
<div class="approval-content-item-info-item approval-content-item-info-bottom">
<span class="info-bottom-name">{{comment.authorName}}</span>
<span>{{comment.time}}</span>
</div>
</div>
</div>
<div class="approval-content-item-memo" v-if="usertask.userTaskId === viewparams.userTaskId">
<el-input type="textarea" v-model="initmemo" :rows="2" @blur="handleBlur" placeholder="请输入内容"></el-input>
</div>
</div>
</div>
</div>
<div class="app-wf-approval-bottom">
<span v-if="data.endTime">{{data.endTime}}结束</span>
</div>
</div>
</template>
<script lang = 'ts'>
import { Vue, Component,Prop,Model } from 'vue-property-decorator';
@Component({
})
export default class AppWFApproval extends Vue {
/**
* 双向绑定值
*
* @memberof AppWFApproval
*/
@Model ('change') value!: string;
/**
* 数据
*
* @memberof AppWFApproval
*/
public data:any = {};
/**
* 初始化memo
*
* @memberof AppWFApproval
*/
public initmemo:string = "";
/**
* 传入数据服务
*
* @memberof AppWFApproval
*/
@Prop() public service:any;
/**
* 上下文
*
* @memberof AppWFApproval
*/
@Prop() public context:any;
/**
* 视图参数
*
* @memberof AppWFApproval
*/
@Prop() public viewparams:any;
/**
* 初始化数据
*
* @memberof AppWFApproval
*/
public created(){
if(this.service){
this.service.GetWFHistory(this.context).then((res:any) =>{
if(res && (res.status === 200)){
this.data = res.data;
}
})
}
}
/**
* 抛出wfprocmemo
*
* @memberof AppWFApproval
*/
public handleBlur($event:any){
this.$emit('change',$event.target.value);
}
}
</script>
<style lang="less">
@import './app-wf-approval.less';
</style>
\ No newline at end of file
<template>
<div class="ibiz-group-picker">
<div class="ibiz-group-container">
<div v-if="showTree" class="ibiz-group-tree">
<ibiz-select-tree :NodesData="treeItems" v-model="treeSelectVal" :treeOnly="true" :defaultChecked="true" @select="treeSelect"></ibiz-select-tree>
</div>
<div class="ibiz-group-content">
<ibiz-group-card :data="cardItems" text="label" value="id" groupName="group" :multiple="multiple" :defaultSelect="cardSelctVal" @select="groupSelect"></ibiz-group-card>
</div>
</div>
<div class="ibiz-group-footer">
<el-button size="small" type="primary" @click="onOK">确认</el-button>
<el-button size="small" @click="onCancel">取消</el-button>
</div>
</div>
</template>
<script lang="ts">
import { Component, Vue, Prop, Watch } from 'vue-property-decorator';
import { Subject } from 'rxjs';
import { Http } from '../../utils';
@Component({})
export default class IBizGroupPicker extends Vue {
/**
* 视图上下文参数
*
* @type {*}
* @memberof IBizGroupPicker
*/
@Prop() viewdata: any;
/**
* 视图参数
*
* @type {*}
* @memberof IBizGroupPicker
*/
@Prop() viewparam: any;
/**
* 多选
*
* @type {*}
* @memberof IBizGroupPicker
*/
protected multiple: boolean = false;
/**
* 加载树url
*
* @type {*}
* @memberof IBizGroupPicker
*/
protected treeurl:any;
/**
* 加载人员url
*
* @type {*}
* @memberof IBizGroupPicker
*/
protected url:any;
/**
* 树数据集
*
* @type {*}
* @memberof IBizGroupPicker
*/
protected treeItems: any[] = [];
/**
* 分组表数据集
*
* @type {*}
* @memberof IBizGroupPicker
*/
protected cardItems: any[] = [];
/**
* 视图上下文参数对象
*
* @type {*}
* @memberof IBizGroupPicker
*/
protected viewData: any;
/**
* 视图参数对象
*
* @type {*}
* @memberof IBizGroupPicker
*/
protected viewParam: any;
/**
* 树选中值
*
* @type {*}
* @memberof IBizGroupPicker
*/
protected treeSelectVal: string = '';
/**
* 分组表选中集合
*
* @type {*}
* @memberof IBizGroupPicker
*/
protected cardSelctVal: any = [];
/**
* 数据选中集合
*
* @type {*}
* @memberof IBizGroupPicker
*/
protected selects: any[] = [];
/**
* 是否显示树
*
* @type {*}
* @memberof IBizGroupPicker
*/
get showTree() {
if(this.viewParam) {
return this.viewParam.showtree;
}
}
/**
* 生命周期
*
* @type {*}
* @memberof IBizGroupPicker
*/
public created() {
if(!this.viewdata || !this.viewparam) {
return;
}
this.viewData = JSON.parse(this.viewdata);
this.viewParam = JSON.parse(this.viewparam);
this.multiple = this.viewParam.multiple;
this.treeurl = this.viewParam.treeurl;
this.url = this.viewParam.url;
if (this.viewParam.selects) {
this.viewParam.selects.forEach((select: any) => {
this.selects.push(select);
this.cardSelctVal.push(select.id)
})
}
this.load();
}
/**
* 加载数据
*
* @type {*}
* @memberof IBizGroupPicker
*/
public load() {
if(this.showTree) {
this.loadTree();
} else {
this.loadGroupData(this.viewParam.filtervalue);
}
}
/**
* 加载树数据
*
* @type {*}
* @memberof IBizGroupPicker
*/
public loadTree() {
let orgid = this.viewParam.filtervalue;
let tempTreeUrl:string = this.treeurl.replace('${orgid}',orgid);
let get = Http.getInstance().get(tempTreeUrl, true);
get.then((response: any) => {
if(response.status === 200) {
this.treeItems = response.data;
}
}).catch((error: any) => {
console.log(error)
})
}
/**
* 加载分组表数据
*
* @type {*}
* @memberof IBizGroupPicker
*/
public loadGroupData(key: string) {
let tempUrl = this.url.replace('${selected-orgid}',key);
let get = Http.getInstance().get(tempUrl, true);
get.then((response: any) => {
if(response.status === 200) {
this.cardItems = response.data;
}
}).catch((error: any) => {
console.log(error)
})
}
/**
* 树选中
*
* @type {*}
* @memberof IBizGroupPicker
*/
public treeSelect(event: any) {
if(!event || JSON.parse(event).length == 0) {
return;
}
const items: any = JSON.parse(event);
this.loadGroupData(items[0].id);
}
/**
* 分组表选中
*
* @type {*}
* @memberof IBizGroupPicker
*/
public groupSelect(event: any) {
if (!event || !event.select) {
return;
}
if(!this.multiple) {
this.selects = [];
}
if(event.rselect) {
let index: number = this.selects.findIndex((item: any) => Object.is(event.rselect, item.id));
if(index >= 0) {
this.selects.splice(index, 1);
}
} else {
event.select.forEach((key: string) => {
let index: number = this.selects.findIndex((item: any) => Object.is(key, item.id));
if(index >= 0) {
return;
}
let item: any = this.cardItems.find((item: any) => Object.is(key, item.id));
if (item) {
this.selects.push(item);
}
});
}
}
/**
* 确认
*
* @type {*}
* @memberof IBizGroupPicker
*/
public onOK() {
this.$emit('close', this.selects);
}
/**
* 取消
*
* @type {*}
* @memberof IBizGroupPicker
*/
public onCancel() {
this.$emit('close');
}
}
</script>
<style lang="less">
.ibiz-group-container {
display: flex;
height: calc(100% - 65px);
.ibiz-group-tree {
width: 400px;
border-right: 1px solid #ddd;
padding: 0 10px;
overflow: auto;
height: 100%;
}
.ibiz-group-content {
flex-grow: 1;
padding: 0 10px;
overflow: auto;
height: 100%;
}
}
.ibiz-group-footer {
padding: 16px;
text-align: right;
border-top: 1px solid #ddd;
}
</style>
\ No newline at end of file
<template>
<div class="ibiz-group-select">
<div class="ibiz-group-content">
<span v-if="!multiple">
{{ selectName }}
</span>
<template v-else v-for="(select, index) of selects">
<div :key="index" class="ibiz-group-item">
{{ select.label }}
<i v-if="!disabled" class="el-icon-close" @click="remove(select)"></i>
</div>
</template>
</div>
<div v-if="!disabled" class="ibiz-group-open">
<i v-if="!disabled && !multiple && selects.length > 0" class="el-icon-close" @click="remove(selects[0])"></i>
<i class="el-icon-search" @click="openView"></i>
</div>
</div>
</template>
<script lang="ts">
import { Component, Vue, Prop, Watch } from 'vue-property-decorator';
import { Subject } from 'rxjs';
@Component({})
export default class IBizGroupSelect extends Vue {
/**
* 名称标识
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Prop() name!: string;
/**
* 树加载地址
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Prop() treeurl?:boolean;
/**
* 数据接口地址
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Prop() url!: string;
/**
* 多选
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Prop({default: false}) multiple?: boolean;
/**
* 数据对象
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Prop() data: any;
/**
* 过滤属性标识
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Prop() filter?: string;
/**
* 是否启用
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Prop() disabled?: boolean;
/**
* 值
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Prop() value: any;
/**
* 上下文参数
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Prop() context: any;
/**
* 关联属性
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Prop() valueitem: any;
/**
* 填充属性
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Prop() fillmap: any;
/**
* 选中项集合
*
* @type {*}
* @memberof IBizGroupSelect
*/
protected selects: any[] = [];
/**
* 值变化
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Watch('value')
onValueChange(newVal: any) {
this.selects = [];
if (newVal) {
let item: any = {};
item.label = newVal.split(',');
if(this.valueitem) {
item.id = this.data[this.valueitem] ? this.data[this.valueitem].split(',') : [];
}
if(this.fillmap) {
for(let key in this.fillmap) {
item[this.fillmap[key]] = this.data[key] ? this.data[key].split(',') : [];
}
}
item.label.forEach((val: string, index: number) => {
let _item: any = {};
for(let key in item) {
_item[key] = item[key][index] ? item[key][index] : null;
}
this.selects.push(_item)
})
}
}
/**
* 单选时选中名称
*
* @type {*}
* @memberof IBizGroupSelect
*/
get selectName() {
if(this.selects.length > 0) {
return this.selects[0].label;
}
}
/**
* 打开选择视图
*
* @type {*}
* @memberof IBizGroupSelect
*/
public openView() {
const view: any = {
viewname: 'ibiz-group-picker',
title: '分组选择'
};
const context: any = JSON.parse(JSON.stringify(this.context));
let filtervalue:string = "";
if(this.filter){
if(this.data[this.filter]){
filtervalue = this.data[this.filter];
}else if(context[this.filter]){
filtervalue = context[this.filter];
}else{
filtervalue = context.srforgid;
}
}else{
filtervalue = context.srforgid;
}
const param: any = {};
Object.assign(param, {
showtree: this.treeurl?true:false,
url:this.url,
treeurl:this.treeurl,
filtervalue: filtervalue,
multiple: this.multiple,
selects: this.selects
});
let container: Subject<any> = this.$appmodal.openModal(view, context, param);
container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
this.openViewClose(result);
});
}
/**
* 选择视图关闭
*
* @type {*}
* @memberof IBizGroupSelect
*/
public openViewClose(result: any) {
this.selects = [];
if (result.datas && result.datas.length > 0) {
this.selects = result.datas
}
this.setValue()
}
/**
* 数据删除
*
* @type {*}
* @memberof IBizGroupSelect
*/
public remove(item: any) {
this.selects.splice(this.selects.indexOf(item), 1);
this.setValue()
}
/**
* 设置值
*
* @type {*}
* @memberof IBizGroupSelect
*/
public setValue() {
let item: any = {};
item[this.name] = null;
if(this.valueitem) {
item[this.valueitem] = null;
}
if(this.fillmap) {
for(let key in this.fillmap) {
item[key] = null;
}
}
if(this.multiple) {
this.selects.forEach((select: any) => {
item[this.name] = item[this.name] ? `${item[this.name]},${select.label}` : select.label;
if(this.valueitem) {
item[this.valueitem] = item[this.valueitem] ? `${item[this.valueitem]},${select.id}` : select.id;
}
if(this.fillmap) {
for(let key in this.fillmap) {
item[key] = item[key] ? `${item[key]},${select[this.fillmap[key]]}` : select[this.fillmap[key]];
}
}
});
} else {
item = this.selects.length > 0 ? this.selects[0] : {};
item[this.name] = this.selects.length > 0 ? this.selects[0].label : null;
if(this.valueitem) {
item[this.valueitem] = this.selects.length > 0 ? this.selects[0].id : null;
}
if(this.fillmap) {
for(let key in this.fillmap) {
item[key] = this.selects.length > 0 ? this.selects[0][this.fillmap[key]] : null;
}
}
}
for(let key in item) {
this.$emit('formitemvaluechange', { name: key, value: item[key] });
}
}
}
</script>
<style lang="less">
.ibiz-group-select {
width: 100%;
display: flex;
border: 1px solid #DCDFE6;
min-height: 32px;
border-radius: 4px;
.ibiz-group-content {
flex-grow: 1;
padding: 0 16px;
.ibiz-group-item {
display: inline-block;
border: 1px solid #bbb;
line-height: 24px;
border-radius: 5px;
margin-right: 5px;
padding: 0 5px;
}
}
.ibiz-group-open {
display: flex;
text-align: center;
align-items: center;
padding: 0 5px;
}
}
.ibiz-group-select:hover {
border-color: #108cee;
}
</style>
\ No newline at end of file
......@@ -26,28 +26,45 @@
top: 50%;
transform: translateY(-60%);
width: 300px;
.ivu-card-head {
padding: 14px 6px;
>p{
line-height: 20px;
font-size: 14px;
color: #17233d;
font-weight: 700;
.ivu-card{
border-radius: 15px;
.ivu-card-head {
padding: 14px 6px;
>p{
line-height: 20px;
font-size: 20px;
color: #17233d;
font-weight: 700;
text-align:center;
}
}
}
&-header{
font-size: 16px;
font-weight: 300;
text-align: center;
padding: 30px 0;
}
.form-con{
padding: 10px 0 0;
}
.login-tip{
font-size: 10px;
text-align: center;
color: #c3c3c3;
}
&-header{
font-size: 16px;
font-weight: 300;
text-align: center;
padding: 30px 0;
}
.form-con{
padding: 10px 0 0;
.ivu-form-item{
margin-bottom: 20px;
}
p{
font-size: 14px;
font-weight: bold;
height: 21px;
line-height: 21px;
}
button{
background-image: linear-gradient(to bottom,#8bbcf1 0%,#2d8cf0 100%);
border-color:#8bbcf1;
}
}
.login-tip{
font-size: 10px;
text-align: center;
color: #5f4949;
}
}
}
}
\ No newline at end of file
......@@ -10,12 +10,14 @@
<div class='login-con'>
<card :bordered="false">
<p slot='title'>
<icon type='ios-log-in'></icon>
&nbsp;&nbsp;{{this.$t('components.login.caption')}}
<!-- <icon type='ios-log-in'></icon> -->
<!-- &nbsp;&nbsp; -->
{{this.$t('components.login.caption')}}
</p>
<div class='form-con'>
<i-form ref='loginForm' :rules="rules" :model="form">
<form-item prop='loginname'>
<p>用户名</p>
<i-input
prefix='ios-contact'
v-model="form.loginname"
......@@ -23,6 +25,7 @@
</i-input>
</form-item>
<form-item prop='password'>
<p>密码</p>
<i-input
prefix='ios-key'
v-model="form.password"
......
......@@ -201,11 +201,11 @@ export default class TabPageExp extends Vue {
* @param {*} caption
* @memberof TabPageExp
*/
public setCurPageCaption(routename: string, caption: any, info: string) {
if(!Object.is(this.$route.name, routename)) {
public setCurPageCaption(caption: string, title: any, info: string) {
if(this.$route.meta && (!Object.is(this.$route.meta.caption, caption))) {
return;
}
this.$store.commit("setCurPageCaption", { route: this.$route, caption: caption, info: info });
this.$store.commit("setCurPageCaption", { route: this.$route, caption: title, info: info });
setTimeout(() => {
this.moveToView(this.$route);
}, 1);
......
......@@ -247,9 +247,9 @@ export default class EditViewEngine extends ViewEngine {
*/
public setTabCaption(info: string): void {
let viewdata: any = this.view.model;
let viewParam = this.view.$store.getters['viewaction/getAppView'](this.view.viewtag);
if (viewdata && viewParam && info && !Object.is(info, '') && this.view.$tabPageExp) {
this.view.$tabPageExp.setCurPageCaption(`${viewParam.viewmodule}_${viewParam.viewname}`.toLocaleLowerCase(), viewdata.srfCaption, info);
if (viewdata && info && !Object.is(info, '') && this.view.$tabPageExp && (viewdata.srfTitle.indexOf(" - ") === -1)) {
this.view.$tabPageExp.setCurPageCaption(viewdata.srfCaption, viewdata.srfTitle, info);
this.view.model.srfTitle = `${this.view.$t(viewdata.srfTitle)} - ${viewdata.dataInfo}`;
}
}
......
......@@ -35,4 +35,20 @@ export default class PickupTreeViewEngine extends TreeViewEngine {
this.view.$emit('viewdataschange', args);
}
}
/**
* 双击选中激活数据
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof PickupTreeViewEngine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
if (Object.is(ctrlName, 'tree') && Object.is(eventName, 'nodedblclick')) {
this.view.$emit('viewdatasactivated', args);
return ;
}
super.onCtrlEvent(ctrlName, eventName, args);
}
}
\ No newline at end of file
......@@ -22,7 +22,7 @@ export const Environment = {
// 是否为开发模式
devMode: true,
// 项目模板地址
ProjectUrl: "http://demo.ibizlab.cn/groups/ibizr7pfstdtempl",
ProjectUrl: "http://demo.ibizlab.cn/ibizr7pfstdtempl/ibizvuer7",
// 配置平台地址
StudioUrl: "http://172.16.170.145/slnstudio/",
// 中心标识
......
import { ChartSeries } from './chart-series';
/**
* 雷达图序列模型
*
* @export
* @class ChartRadarSeries
*/
export class ChartRadarSeries extends ChartSeries{
/**
* 分类属性
*
* @type {string}
* @memberof ChartRadarSeries
*/
public categorField: string = '';
/**
* 值属性
*
* @type {string}
* @memberof ChartRadarSeries
*/
public valueField: string = '';
/**
* 雷达图指示器
*
* @type {string}
* @memberof ChartRadarSeries
*/
public indicator: Array<any> = [];
/**
* 分类代码表
*
* @type {string}
* @memberof ChartRadarSeries
*/
public categorCodeList: any = null;
/**
* 维度编码
*
* @type {*}
* @memberof ChartRadarSeries
*/
public encode:any = null;
/**
* Creates an instance of ChartRadarSeries.
* ChartRadarSeries 实例
*
* @param {*} [opts={}]
* @memberof ChartRadarSeries
*/
constructor(opts: any = {}) {
super(opts);
this.categorField = !Object.is(opts.categorField, '') ? opts.categorField : '';
this.categorCodeList = opts.categorCodeList ? opts.categorCodeList : null;
this.valueField = !Object.is(opts.valueField, '') ? opts.valueField : '';
this.encode = opts.encode ? opts.encode : null;
this.indicator = opts.indicator ? opts.indicator:[];
}
/**
* 设置分类属性
*
* @param {string} state
* @memberof ChartRadarSeries
*/
public setCategorField(state: string): void {
this.categorField = state;
}
/**
* 设置序列名称
*
* @param {string} state
* @memberof ChartRadarSeries
*/
public setValueField(state: string): void {
this.valueField = state;
}
/**
* 分类代码表
*
* @param {*} state
* @memberof ChartRadarSeries
*/
public setCategorCodeList(state: any): void {
this.categorCodeList = state;
}
/**
* 设置编码
*
* @param {*} state
* @memberof ChartRadarSeries
*/
public setEncode(state: any): void {
this.encode = state;
}
/**
* 设置雷达图指示器
*
* @param {*} state
* @memberof ChartRadarSeries
*/
public setIndicator(state: any): void {
this.indicator = state;
}
}
\ No newline at end of file
......@@ -2,4 +2,5 @@ export { ChartDataSetField } from './chart-dataset-field';
export { ChartLineSeries } from './chart-line-series';
export { ChartFunnelSeries } from './chart-funnel-series';
export { ChartPieSeries } from './chart-pie-series';
export { ChartBarSeries } from './chart-bar-series';
\ No newline at end of file
export { ChartBarSeries } from './chart-bar-series';
export { ChartRadarSeries } from './chart-radar-series';
\ No newline at end of file
......@@ -561,46 +561,46 @@ export default class SDFileEditViewBase extends Vue {
*/
public toolbar_click($event: any, $event2?: any) {
if (Object.is($event.tag, 'tbitem3')) {
this.toolbar_tbitem3_click($event, '', $event2);
this.toolbar_tbitem3_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem4')) {
this.toolbar_tbitem4_click($event, '', $event2);
this.toolbar_tbitem4_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem5')) {
this.toolbar_tbitem5_click($event, '', $event2);
this.toolbar_tbitem5_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem7')) {
this.toolbar_tbitem7_click($event, '', $event2);
this.toolbar_tbitem7_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem9')) {
this.toolbar_tbitem9_click($event, '', $event2);
this.toolbar_tbitem9_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem10')) {
this.toolbar_tbitem10_click($event, '', $event2);
this.toolbar_tbitem10_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem12')) {
this.toolbar_tbitem12_click($event, '', $event2);
this.toolbar_tbitem12_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem14')) {
this.toolbar_tbitem14_click($event, '', $event2);
this.toolbar_tbitem14_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem15')) {
this.toolbar_tbitem15_click($event, '', $event2);
this.toolbar_tbitem15_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem23')) {
this.toolbar_tbitem23_click($event, '', $event2);
this.toolbar_tbitem23_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem24')) {
this.toolbar_tbitem24_click($event, '', $event2);
this.toolbar_tbitem24_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem25')) {
this.toolbar_tbitem25_click($event, '', $event2);
this.toolbar_tbitem25_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem26')) {
this.toolbar_tbitem26_click($event, '', $event2);
this.toolbar_tbitem26_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem22')) {
this.toolbar_tbitem22_click($event, '', $event2);
this.toolbar_tbitem22_click(null, '', $event2);
}
}
......@@ -664,6 +664,9 @@ export default class SDFileEditViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Save(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -690,6 +693,9 @@ export default class SDFileEditViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.SaveAndNew(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -716,6 +722,9 @@ export default class SDFileEditViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.SaveAndExit(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -742,6 +751,9 @@ export default class SDFileEditViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.RemoveAndExit(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -768,6 +780,9 @@ export default class SDFileEditViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.SaveAndStart(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -794,6 +809,9 @@ export default class SDFileEditViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.ViewWFStep(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -820,6 +838,9 @@ export default class SDFileEditViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.New(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -846,6 +867,9 @@ export default class SDFileEditViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Copy(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -872,6 +896,9 @@ export default class SDFileEditViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Print(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -898,6 +925,9 @@ export default class SDFileEditViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.FirstRecord(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -924,6 +954,9 @@ export default class SDFileEditViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.PrevRecord(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -950,6 +983,9 @@ export default class SDFileEditViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.NextRecord(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -976,6 +1012,9 @@ export default class SDFileEditViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.LastRecord(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -1002,6 +1041,9 @@ export default class SDFileEditViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Help(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -1227,14 +1269,14 @@ export default class SDFileEditViewBase extends Vue {
const data: any = {};
if (args.length > 0) {
Object.assign(data, { srfsourcekey: args[0].srfkey })
actionContext.$store.commit('addCopyData', { srfkey: args[0].srfkey, copyData: args[0] });
}
_this.newdata([{ ...data }],[{ ...data }],params, $event, xData);
} else if (xData && xData.copy instanceof Function) {
const data2: any = {};
if (args.length > 0) {
Object.assign(data2, { srfsourcekey: args[0].srfkey })
actionContext.$store.commit('addCopyData', { srfkey: args[0].srfkey, copyData: args[0] });
}
xData.copy(data2);
xData.copy(args[0].srfkey);
} else {
_this.$Notice.error({ title: '错误', desc: 'opendata 视图处理逻辑不存在,请添加!' });
}
......
<template>
<div class='view-container degridview sdfile-grid-view'>
<div class='view-container degridview sdfile-grid-view'>
<app-studioaction :viewTitle="$t(model.srfTitle)" viewName="sdfilegridview"></app-studioaction>
<card class='view-card ' :dis-hover="true" :bordered="false">
<p slot='title'>
......@@ -9,7 +9,7 @@
<div class='view-top-messages'>
</div>
<div style='margin-bottom: 6px;'>
<i-input v-show="!isExpandSearchForm" v-model="query" search enter-button @on-search="onSearch($event)" class='quick-search-input' style='max-width: 400px;' />
<i-input v-show="!isExpandSearchForm" v-model="query" search enter-button @on-search="onSearch($event)" class='quick-search-input' style='max-width: 400px;' placeholder="" />
<div class='pull-right'>
<div class='toolbar-container'>
<tooltip :transfer="true" :max-width="600">
......@@ -604,43 +604,43 @@ export default class SDFileGridViewBase extends Vue {
*/
public toolbar_click($event: any, $event2?: any) {
if (Object.is($event.tag, 'tbitem3')) {
this.toolbar_tbitem3_click($event, '', $event2);
this.toolbar_tbitem3_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem4')) {
this.toolbar_tbitem4_click($event, '', $event2);
this.toolbar_tbitem4_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem5')) {
this.toolbar_tbitem5_click($event, '', $event2);
this.toolbar_tbitem5_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem6')) {
this.toolbar_tbitem6_click($event, '', $event2);
this.toolbar_tbitem6_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem24')) {
this.toolbar_tbitem24_click($event, '', $event2);
this.toolbar_tbitem24_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem25')) {
this.toolbar_tbitem25_click($event, '', $event2);
this.toolbar_tbitem25_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem8')) {
this.toolbar_tbitem8_click($event, '', $event2);
this.toolbar_tbitem8_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem13')) {
this.toolbar_tbitem13_click($event, '', $event2);
this.toolbar_tbitem13_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem11')) {
this.toolbar_tbitem11_click($event, '', $event2);
this.toolbar_tbitem11_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem21')) {
this.toolbar_tbitem21_click($event, '', $event2);
this.toolbar_tbitem21_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem23')) {
this.toolbar_tbitem23_click($event, '', $event2);
this.toolbar_tbitem23_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem19')) {
this.toolbar_tbitem19_click($event, '', $event2);
this.toolbar_tbitem19_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem18')) {
this.toolbar_tbitem18_click($event, '', $event2);
this.toolbar_tbitem18_click(null, '', $event2);
}
}
......@@ -764,6 +764,9 @@ export default class SDFileGridViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.New(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -790,6 +793,9 @@ export default class SDFileGridViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Edit(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -816,6 +822,9 @@ export default class SDFileGridViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.View(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -842,6 +851,9 @@ export default class SDFileGridViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Copy(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -868,6 +880,9 @@ export default class SDFileGridViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.ToggleRowEdit(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -894,6 +909,9 @@ export default class SDFileGridViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.NewRow(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -920,6 +938,9 @@ export default class SDFileGridViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Remove(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -946,6 +967,9 @@ export default class SDFileGridViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.ExportExcel(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -972,6 +996,9 @@ export default class SDFileGridViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Print(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -998,6 +1025,9 @@ export default class SDFileGridViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.ExportModel(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -1024,6 +1054,9 @@ export default class SDFileGridViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Import(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -1050,6 +1083,9 @@ export default class SDFileGridViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.ToggleFilter(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -1076,6 +1112,9 @@ export default class SDFileGridViewBase extends Vue {
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
this.Help(datas, contextJO,paramJO, $event, xData,this,"SDFile");
}
......@@ -1092,6 +1131,9 @@ export default class SDFileGridViewBase extends Vue {
*/
public newdata(args: any[],fullargs?:any[], params?: any, $event?: any, xData?: any) {
const data: any = {};
if(args[0].srfsourcekey){
data.srfsourcekey = args[0].srfsourcekey;
}
let curViewParam = JSON.parse(JSON.stringify(this.context));
if(args.length >0){
Object.assign(curViewParam,args[0]);
......@@ -1260,14 +1302,14 @@ export default class SDFileGridViewBase extends Vue {
const data: any = {};
if (args.length > 0) {
Object.assign(data, { srfsourcekey: args[0].srfkey })
actionContext.$store.commit('addCopyData', { srfkey: args[0].srfkey, copyData: args[0] });
}
_this.newdata([{ ...data }],[{ ...data }],params, $event, xData);
} else if (xData && xData.copy instanceof Function) {
const data2: any = {};
if (args.length > 0) {
Object.assign(data2, { srfsourcekey: args[0].srfkey })
actionContext.$store.commit('addCopyData', { srfkey: args[0].srfkey, copyData: args[0] });
}
xData.copy(data2);
xData.copy(args[0].srfkey);
} else {
_this.$Notice.error({ title: '错误', desc: 'opendata 视图处理逻辑不存在,请添加!' });
}
......
......@@ -4,12 +4,14 @@ import VueRouter from 'vue-router';
import App from '@/App.vue';
import ElementUi from 'element-ui';
import ViewUI from 'view-design';
import ibizLab from 'ibiz-vue-lib';
import { Interceptors } from '@/utils';
import {Print} from '@/utils/print';
import i18n from '@/locale'
import 'element-ui/lib/theme-chalk/index.css';
import 'view-design/dist/styles/iview.css';
import 'ibiz-vue-lib/lib/ibiz-vue-lib.css';
import '@/styles/default.less';
......@@ -30,7 +32,8 @@ Vue.config.errorHandler = function (err: any, vm: any, info: any) {
console.log(err);
}
Vue.config.productionTip = false;
Vue.use(Print)
Vue.use(Print);
Vue.use(ibizLab);
Vue.use(Vuex);
Vue.use(VueRouter);;
Vue.use(ElementUi, {
......
......@@ -619,7 +619,22 @@ export default class EntityService {
* @memberof EntityService
*/
public async removeBatch(context: any = {},data: any, isloading?: boolean): Promise<any> {
return Http.getInstance().delete(`/${this.APPDENAME}/batch`,isloading,data);
return Http.getInstance().delete(`/${this.APPDENAME}/batch`,isloading,data[this.APPDEKEY]);
}
/**
* getDataInfo接口方法
*
* @param {*} [context={}]
* @param {*} [data]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof EntityService
*/
public async getDataInfo(context: any = {},data: any, isloading?: boolean):Promise<any> {
if(context[this.APPLYDEKEY]){
return this.Get(context,data, isloading);
}
}
/**
......@@ -765,6 +780,19 @@ export default class EntityService {
return Http.getInstance().get(`/wfcore/${this.SYSTEMNAME}-app-${this.APPNAME}/${this.APPDENAME}/${context[this.APPLYDEKEY]}/usertasks/${data['taskDefinitionKey']}/ways`);
}
/**
* GetWFHistory接口方法(根据业务主键获取工作流程记录)
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof EntityService
*/
public async GetWFHistory(context: any = {},data: any = {}, isloading?: boolean):Promise<any> {
return Http.getInstance().get(`/wfcore/${this.SYSTEMNAME}-app-${this.APPNAME}/${this.APPDENAME}/${context[this.APPLYDEKEY]}/process-instances/alls/history`);
}
/**
* WFSubmit接口方法
*
......
......@@ -75,4 +75,37 @@ export const getZIndex = (state: any) => () => {
*/
export const getViewSplit = (state: any) => (viewUID: string) => {
return state.viewSplit[viewUID];
}
/**
* 获取拷贝数据
*
* @param state
*/
export const getCopyData = (state: any) => (srfkey: string) => {
let copyData = state.copyDataMap[srfkey];
if(copyData){
delete state.copyDataMap[srfkey];
}
return copyData;
}
/**
* 获取单位数据
*
* @param state
*/
export const getOrgData = (state: any) => (srfkey: string) => {
let orgData = state.orgDataMap[srfkey];
return orgData;
}
/**
* 获取部门数据
*
* @param state
*/
export const getDepData = (state: any) => (srfkey: string) => {
let depData = state.depDataMap[srfkey];
return depData;
}
\ No newline at end of file
......@@ -253,4 +253,40 @@ export const updateZIndex = (state: any, zIndex: number) => {
*/
export const setViewSplit = (state: any, args: {viewSplit: number,viewUID:string}) => {
state.viewSplit[args.viewUID] = args.viewSplit;
}
/**
* 添加拷贝数据
*
* @param state
* @param localdata
*/
export const addCopyData = (state: any, args: {srfkey: string,copyData: any}) => {
if(args && args.srfkey && args.copyData){
state.copyDataMap[args.srfkey] = JSON.parse(JSON.stringify(args.copyData));
}
}
/**
* 添加单位数据
*
* @param state
* @param args
*/
export const addOrgData = (state: any, args: {srfkey: string,orgData: any}) => {
if(args && args.srfkey && args.orgData){
state.orgDataMap[args.srfkey] = JSON.parse(JSON.stringify(args.orgData));
}
}
/**
* 添加部门数据
*
* @param state
* @param args
*/
export const addDepData = (state: any, args: {srfkey: string,depData: any}) => {
if(args && args.srfkey && args.depData){
state.depDataMap[args.srfkey] = JSON.parse(JSON.stringify(args.depData));
}
}
\ No newline at end of file
......@@ -13,4 +13,7 @@ export const rootstate: any = {
localdata: {},
zIndex: 300,
viewSplit: {},
copyDataMap:{},
orgDataMap:{},
depDataMap:{},
}
\ No newline at end of file
......@@ -92,7 +92,7 @@ export class StudioActionUtil {
const config: any = await this.getConfig(viewName);
if (config) {
const context: string = `视图模块:${config.viewmodule}\n视图标识:${config.viewname}\n视图类型:${config.viewtype}\n`;
window.open(`${Environment.ProjectUrl}/issues/`, '_blank');
window.open(`${Environment.ProjectUrl}/issues/new?issue[title]=${encodeURIComponent('问题')}&issue[description]=${encodeURIComponent(context)}`, '_blank');
}
}
......
......@@ -138,6 +138,17 @@ export declare interface Util {
* @memberof Util
*/
dateFormat(date: any,fmt?: string):string
/**
* 表单项校验
*
* @param property 表单项属性名
* @param data 表单数据
* @param rules 表单值规则
* @returns {Promise}
* @memberof Util
*/
validateItem(property: string, data:any, rules:any): Promise<any>
}
declare module "vue/types/vue" {
......
......@@ -41,6 +41,7 @@ export class UIActionTool {
if (Object.is(actionTarget, 'SINGLEKEY')) {
let [arg] = args;
Object.keys(_params).forEach((name: string) => {
let hasProperty = true;
if (!name) {
return;
}
......@@ -50,13 +51,16 @@ export class UIActionTool {
if (arg && arg.hasOwnProperty(key)) {
value = (arg[key] !== null && arg[key] !== undefined) ? arg[key] : null;
} else {
value = null;
hasProperty = false;
}
}
Object.assign(_data, { [name]: value });
if(hasProperty){
Object.assign(_data, { [name]: value });
}
});
} else if (Object.is(actionTarget, 'MULTIKEY')) {
Object.keys(_params).forEach((name: string) => {
let noPropertyNum = 0;
if (!name) {
return;
}
......@@ -69,11 +73,14 @@ export class UIActionTool {
value = (arg[key] !== null && arg[key] !== undefined) ? arg[key] : null;
} else {
value = null;
noPropertyNum++;
}
values.push(value);
});
}
Object.assign(_data, { [name]: values.length > 0 ? values.join(';') : value });
if(values.length !== noPropertyNum){
Object.assign(_data, { [name]: values.length > 0 ? values.join(';') : value });
}
});
}
return _data;
......
import qs from 'qs';
import { Route } from 'vue-router';
import Schema from "async-validator";
/**
* 平台工具类
......@@ -362,4 +363,23 @@ export class Util {
return FirstOBJ;
}
/**
* 表单项校验
*
* @param property 表单项属性名
* @param data 表单数据
* @param rules 表单值规则
* @returns {Promise}
* @memberof Util
*/
public static validateItem(property: string, data:any, rules:any) {
// 1.获取数值和规则
const value = data[property];
const rule = rules[property];
// 2.创建校验规则
const schema = new Schema({ [property]: rule })
// 校验返回Promise
return schema.validate({ [property]: value })
}
}
\ No newline at end of file
import { Store } from 'vuex';
import { Util } from '@/utils/util/util';
import CodeListService from "@service/app/codelist-service";
/**
* 部件服务基类
......@@ -26,6 +27,14 @@ export default class ControlService {
*/
public model: any | null = null;
/**
* 代码表服务对象
*
* @type {any}
* @memberof ControlService
*/
public codeListService:any;
/**
* 是否为从数据模式
*
......@@ -43,6 +52,7 @@ export default class ControlService {
constructor(opts: any = {}) {
this.$store = opts.$store;
this.setTempMode();
this.codeListService = new CodeListService({ $store:opts.$store });
}
/**
......@@ -118,31 +128,41 @@ export default class ControlService {
* @param {*} response
* @memberof ControlService
*/
public handleResponse(action: string, response: any,isCreate:boolean = false){
public async handleResponse(action: string, response: any,isCreate:boolean = false){
let result = null;
if (!response.data) {
return
} else if (response.data instanceof Array) {
result = [];
response.data.forEach((item:any) =>{
result.push(this.handleResponseData(action, item, isCreate));
});
}else{
result = this.handleResponseData(action, response.data, isCreate);
}
// response状态,头文件
if(response.headers){
if(response.headers['x-page']){
Object.assign(response,{page:Number(response.headers['x-page'])});
}
if(response.headers['x-per-page']){
Object.assign(response,{size:Number(response.headers['x-per-page'])});
const handleResult:any = (action: string, response: any,isCreate:boolean,codelistArray?:any) =>{
if (response.data instanceof Array) {
result = [];
response.data.forEach((item:any) =>{
result.push(this.handleResponseData(action, item, isCreate,codelistArray));
});
}else{
result = this.handleResponseData(action, response.data, isCreate,codelistArray);
}
if(response.headers['x-total']){
Object.assign(response,{total:Number(response.headers['x-total'])});
// response状态,头文件
if(response.headers){
if(response.headers['x-page']){
Object.assign(response,{page:Number(response.headers['x-page'])});
}
if(response.headers['x-per-page']){
Object.assign(response,{size:Number(response.headers['x-per-page'])});
}
if(response.headers['x-total']){
Object.assign(response,{total:Number(response.headers['x-total'])});
}
}
response.data = result;
}
let codelistModel:Array<any> = this.handleCodelist();
if(codelistModel.length >0){
let res:any = await this.getAllCodeList(codelistModel);
handleResult(action, response,isCreate,res);
}else{
handleResult(action, response,isCreate);
}
response.data = result;
}
/**
......@@ -152,7 +172,7 @@ export default class ControlService {
* @param {*} response
* @memberof ControlService
*/
public handleResponseData(action: string, data: any = {},isCreate?:boolean){
public handleResponseData(action: string, data: any = {},isCreate?:boolean,codelistArray?:any){
let model: any = this.getMode();
if (!model && model.getDataItems instanceof Function) {
return data;
......@@ -167,10 +187,13 @@ export default class ControlService {
if((isCreate === undefined || isCreate === null ) && Object.is(dataitem.dataType, 'GUID') && Object.is(dataitem.name, 'srfkey') && (val && !Object.is(val, ''))){
isCreate = true;
}
// if((Object.is(dataitem.dataType,'DATE') || Object.is(dataitem.dataType,'DATETIME')) && !Object.is(Date.parse(val),NaN)){
// val = Util.dateFormat(new Date(val));
// }
item[dataitem.name] = val;
// 转化代码表
if(codelistArray && dataitem.codelist){
if(codelistArray.get(dataitem.codelist.tag) && codelistArray.get(dataitem.codelist.tag).get(val)){
item[dataitem.name] = codelistArray.get(dataitem.codelist.tag).get(val);
}
}
});
item.srfuf = data.srfuf ? data.srfuf : (isCreate ? "0" : "1");
return item;
......@@ -199,4 +222,88 @@ export default class ControlService {
return requestData;
}
/**
* 处理代码表
*
* @memberof ControlService
*/
public handleCodelist(){
let model: any = this.getMode();
if (!model) {
return [];
}
let dataItems: any[] = model.getDataItems();
let codelistMap:Map<string,any> = new Map();
if(dataItems && dataItems.length >0){
dataItems.forEach((item:any) =>{
if(item.codelist){
codelistMap.set(item.name,item.codelist);
}
})
}
if(codelistMap.size >0){
return Array.from(codelistMap).map(item => item[1]);
}else{
return [];
}
}
/**
* 获取所有代码表
*
* @param codelistArray 代码表模型数组
* @memberof ControlService
*/
public getAllCodeList(codelistArray:Array<any>):Promise<any>{
return new Promise((resolve:any,reject:any) =>{
let codeListMap:Map<string,any> = new Map();
let promiseArray:Array<any> = [];
codelistArray.forEach((item:any) =>{
if(!codeListMap.get(item.tag)){
promiseArray.push(this.getCodeList(item));
Promise.all(promiseArray).then((result:any) =>{
if(result && result.length >0){
result.forEach((codeList:any) =>{
let tempCodeListMap:Map<number,any> = new Map();
if(codeList.length >0){
codeList.forEach((codeListItem:any) =>{
tempCodeListMap.set(codeListItem.value,codeListItem.text);
})
}
codeListMap.set(item.tag,tempCodeListMap);
})
resolve(codeListMap);
}
})
}
})
})
}
/**
* 获取代码表
*
* @param codeListObject 传入代码表对象
* @memberof ControlService
*/
public getCodeList(codeListObject:any):Promise<any>{
return new Promise((resolve:any,reject:any) =>{
if(codeListObject.tag && Object.is(codeListObject.codelistType,"STATIC")){
const codelist = (this.getStore() as Store<any>).getters.getCodeList(codeListObject.tag);
if (codelist) {
resolve([...JSON.parse(JSON.stringify(codelist.items))]);
} else {
resolve([]);
console.log(`----${codeListObject.tag}----代码表不存在`);
}
}else if(codeListObject.tag && Object.is(codeListObject.codelistType,"DYNAMIC")){
this.codeListService.getItems(codeListObject.tag).then((res:any) => {
resolve(res);
}).catch((error:any) => {
resolve([]);
console.log(`----${codeListObject.tag}----代码表不存在`);
});
}
})
}
}
\ No newline at end of file
......@@ -4,5 +4,5 @@ Tip: If the failing expression is known to be legally refer to something that's
----
FTL stack trace ("~" means nesting-related):
- Failed at: ${appde.getKeyPSAppDEField().getCodeN... [in template "TEMPLCODE_zh_CN" at line 348, column 14]
- Failed at: ${appde.getKeyPSAppDEField().getCodeN... [in template "TEMPLCODE_zh_CN" at line 349, column 14]
----
\ No newline at end of file
<template>
<i-form :model="this.data" class='app-form' ref='form' id='form' style="">
<input style="display:none;" />
<row >
<i-col v-show="detailsModel.group1.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-group layoutType="TABLE_24COL" titleStyle="" class='' uiActionGroup="detailsModel.group1.uiActionGroup" @groupuiactionclick="groupUIActionClick($event)" :caption="$t('entities.sdfile.main_form.details.group1')" :isShowCaption="true" uiStyle="DEFAULT" :titleBarCloseMode="0" :isInfoGroupMode="false" >
<row>
<i-col v-show="detailsModel.filename.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='filename' :itemRules="this.rules.filename" class='' :caption="$t('entities.sdfile.main_form.details.filename')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.filename.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.filename" @enter="onEnter($event)" unit="" :disabled="detailsModel.filename.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.filepath.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='filepath' :itemRules="this.rules.filepath" class='' :caption="$t('entities.sdfile.main_form.details.filepath')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.filepath.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.filepath" @enter="onEnter($event)" unit="" :disabled="detailsModel.filepath.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.filesize.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='filesize' :itemRules="this.rules.filesize" class='' :caption="$t('entities.sdfile.main_form.details.filesize')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.filesize.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.filesize" @enter="onEnter($event)" unit="" :disabled="detailsModel.filesize.disabled" type='number' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.fileext.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='fileext' :itemRules="this.rules.fileext" class='' :caption="$t('entities.sdfile.main_form.details.fileext')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.fileext.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.fileext" @enter="onEnter($event)" unit="" :disabled="detailsModel.fileext.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.folder.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='folder' :itemRules="this.rules.folder" class='' :caption="$t('entities.sdfile.main_form.details.folder')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.folder.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.folder" @enter="onEnter($event)" unit="" :disabled="detailsModel.folder.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.digestcode.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='digestcode' :itemRules="this.rules.digestcode" class='' :caption="$t('entities.sdfile.main_form.details.digestcode')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.digestcode.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.digestcode" @enter="onEnter($event)" unit="" :disabled="detailsModel.digestcode.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.ownerid.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='ownerid' :itemRules="this.rules.ownerid" class='' :caption="$t('entities.sdfile.main_form.details.ownerid')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.ownerid.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.ownerid" @enter="onEnter($event)" unit="" :disabled="detailsModel.ownerid.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.ownertype.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='ownertype' :itemRules="this.rules.ownertype" class='' :caption="$t('entities.sdfile.main_form.details.ownertype')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.ownertype.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.ownertype" @enter="onEnter($event)" unit="" :disabled="detailsModel.ownertype.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.memo.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='memo' :itemRules="this.rules.memo" class='' :caption="$t('entities.sdfile.main_form.details.memo')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.memo.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box v-model="data.memo" @enter="onEnter($event)" unit="" :disabled="detailsModel.memo.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.createman.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='createman' :itemRules="this.rules.createman" class='' :caption="$t('entities.sdfile.main_form.details.createman')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.createman.error" :isEmptyCaption="false" labelPos="LEFT">
<app-span name='createman'
:value="data.createman" tag='SysOperator' codelistType='DYNAMIC' style=""></app-span>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.createdate.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='createdate' :itemRules="this.rules.createdate" class='' :caption="$t('entities.sdfile.main_form.details.createdate')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.createdate.error" :isEmptyCaption="false" labelPos="LEFT">
<app-span name='createdate'
:value="data.createdate" style=""></app-span>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.updateman.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='updateman' :itemRules="this.rules.updateman" class='' :caption="$t('entities.sdfile.main_form.details.updateman')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.updateman.error" :isEmptyCaption="false" labelPos="LEFT">
<app-span name='updateman'
:value="data.updateman" tag='SysOperator' codelistType='DYNAMIC' style=""></app-span>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.updatedate.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='updatedate' :itemRules="this.rules.updatedate" class='' :caption="$t('entities.sdfile.main_form.details.updatedate')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.updatedate.error" :isEmptyCaption="false" labelPos="LEFT">
<app-span name='updatedate'
:value="data.updatedate" style=""></app-span>
</app-form-item>
</i-col>
</row>
</app-form-group>
</i-col>
</row>
</i-form>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import SDFileService from '@/service/sdfile/sdfile-service';
import MainService from './main-form-service';
import { FormButtonModel, FormPageModel, FormItemModel, FormDRUIPartModel, FormPartModel, FormGroupPanelModel, FormIFrameModel, FormRowItemModel, FormTabPageModel, FormTabPanelModel, FormUserControlModel } from '@/model/form-detail';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
@Component({
components: {
}
})
export default class MainBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof Main
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof Main
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof Main
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof Main
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof Main
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof Main
*/
public getControlType(): string {
return 'FORM'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof Main
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {MainService}
* @memberof Main
*/
public service: MainService = new MainService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {SDFileService}
* @memberof Main
*/
public appEntityService: SDFileService = new SDFileService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any} args
* @memberof Main
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof Main
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof Main
*/
public getDatas(): any[] {
return [this.data];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof Main
*/
public getData(): any {
return this.data;
}
/**
* 是否默认保存
*
* @type {boolean}
* @memberof Main
*/
@Prop({ default: false }) public autosave?: boolean;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof Main
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--submit
*
* @type {string}
* @memberof Main
*/
@Prop() public WFSubmitAction!: string;
/**
* 部件行为--start
*
* @type {string}
* @memberof Main
*/
@Prop() public WFStartAction!: string;
/**
* 部件行为--update
*
* @type {string}
* @memberof Main
*/
@Prop() public updateAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof Main
*/
@Prop() public removeAction!: string;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof Main
*/
@Prop() public loaddraftAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof Main
*/
@Prop() public loadAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof Main
*/
@Prop() public createAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof Main
*/
@Prop() public searchAction!: string;
/**
* 视图标识
*
* @type {string}
* @memberof Main
*/
@Prop() public viewtag!: string;
/**
* 表单状态
*
* @type {Subject<any>}
* @memberof Main
*/
public formState: Subject<any> = new Subject();
/**
* 忽略表单项值变化
*
* @type {boolean}
* @memberof Main
*/
public ignorefieldvaluechange: boolean = false;
/**
* 数据变化
*
* @public
* @type {Subject<any>}
* @memberof Main
*/
public dataChang: Subject<any> = new Subject();
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof Main
*/
public dataChangEvent: Subscription | undefined;
/**
* 原始数据
*
* @public
* @type {*}
* @memberof Main
*/
public oldData: any = {};
/**
* 表单数据对象
*
* @type {*}
* @memberof Main
*/
public data: any = {
srfupdatedate: null,
srforikey: null,
srfkey: null,
srfmajortext: null,
srftempmode: null,
srfuf: null,
srfdeid: null,
srfsourcekey: null,
filename: null,
filepath: null,
filesize: null,
fileext: null,
folder: null,
digestcode: null,
ownerid: null,
ownertype: null,
memo: null,
createman: null,
createdate: null,
updateman: null,
updatedate: null,
fileid: null,
sdfile:null,
};
/**
* 当前执行的行为逻辑
*
* @type {string}
* @memberof Main
*/
public currentAction: string = "";
/**
* 关系界面计数器
*
* @type {number}
* @memberof Main
*/
public drcounter: number = 0;
/**
* 需要等待关系界面保存时,第一次调用save参数的备份
*
* @type {number}
* @memberof Main
*/
public drsaveopt: any = {};
/**
* 表单保存回调存储对象
*
* @type {any}
* @memberof Main
*/
public saveState:any ;
/**
* 属性值规则
*
* @type {*}
* @memberof Main
*/
public rules: any = {
srfupdatedate: [
{ type: 'string', message: '更新时间 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '更新时间 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '更新时间 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '更新时间 值不能为空', trigger: 'blur' },
],
srforikey: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfkey: [
{ type: 'string', message: '标识 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '标识 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '标识 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '标识 值不能为空', trigger: 'blur' },
],
srfmajortext: [
{ type: 'string', message: '名称 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '名称 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '名称 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '名称 值不能为空', trigger: 'blur' },
],
srftempmode: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfuf: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfdeid: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfsourcekey: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
filename: [
{ type: 'string', message: '名称 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '名称 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '名称 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '名称 值不能为空', trigger: 'blur' },
],
filepath: [
{ type: 'string', message: '路径 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '路径 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '路径 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '路径 值不能为空', trigger: 'blur' },
],
filesize: [
{ type: 'number', message: '文件大小 值必须为数值类型', trigger: 'change' },
{ type: 'number', message: '文件大小 值必须为数值类型', trigger: 'blur' },
{ required: false, type: 'number', message: '文件大小 值不能为空', trigger: 'change' },
{ required: false, type: 'number', message: '文件大小 值不能为空', trigger: 'blur' },
],
fileext: [
{ type: 'string', message: '扩展名 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '扩展名 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '扩展名 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '扩展名 值不能为空', trigger: 'blur' },
],
folder: [
{ type: 'string', message: '特定目录 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '特定目录 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '特定目录 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '特定目录 值不能为空', trigger: 'blur' },
],
digestcode: [
{ type: 'string', message: '签名 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '签名 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '签名 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '签名 值不能为空', trigger: 'blur' },
],
ownerid: [
{ type: 'string', message: '所属主体 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '所属主体 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '所属主体 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '所属主体 值不能为空', trigger: 'blur' },
],
ownertype: [
{ type: 'string', message: '所属类型 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '所属类型 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '所属类型 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '所属类型 值不能为空', trigger: 'blur' },
],
memo: [
{ type: 'string', message: '备注 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '备注 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '备注 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '备注 值不能为空', trigger: 'blur' },
],
createman: [
{ type: 'string', message: '创建人 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '创建人 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '创建人 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '创建人 值不能为空', trigger: 'blur' },
],
createdate: [
{ type: 'string', message: '创建日期 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '创建日期 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '创建日期 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '创建日期 值不能为空', trigger: 'blur' },
],
updateman: [
{ type: 'string', message: '更新人 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '更新人 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '更新人 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '更新人 值不能为空', trigger: 'blur' },
],
updatedate: [
{ type: 'string', message: '更新时间 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '更新时间 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '更新时间 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '更新时间 值不能为空', trigger: 'blur' },
],
fileid: [
{ type: 'string', message: '标识 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '标识 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '标识 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '标识 值不能为空', trigger: 'blur' },
],
}
/**
* 详情模型集合
*
* @type {*}
* @memberof Main
*/
public detailsModel: any = {
group1: new FormGroupPanelModel({ caption: '文件基本信息', detailType: 'GROUPPANEL', name: 'group1', visible: true, isShowCaption: true, form: this, uiActionGroup: { caption: '', langbase: 'entities.sdfile.main_form', extractMode: 'ITEM', details: [] } })
,
formpage1: new FormPageModel({ caption: '基本信息', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this })
,
srfupdatedate: new FormItemModel({ caption: '更新时间', detailType: 'FORMITEM', name: 'srfupdatedate', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srforikey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srforikey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfkey: new FormItemModel({ caption: '标识', detailType: 'FORMITEM', name: 'srfkey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfmajortext: new FormItemModel({ caption: '名称', detailType: 'FORMITEM', name: 'srfmajortext', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srftempmode: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srftempmode', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfuf: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfuf', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfdeid: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfdeid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfsourcekey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfsourcekey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
filename: new FormItemModel({ caption: '名称', detailType: 'FORMITEM', name: 'filename', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
filepath: new FormItemModel({ caption: '路径', detailType: 'FORMITEM', name: 'filepath', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
filesize: new FormItemModel({ caption: '文件大小', detailType: 'FORMITEM', name: 'filesize', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
fileext: new FormItemModel({ caption: '扩展名', detailType: 'FORMITEM', name: 'fileext', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
folder: new FormItemModel({ caption: '特定目录', detailType: 'FORMITEM', name: 'folder', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
digestcode: new FormItemModel({ caption: '签名', detailType: 'FORMITEM', name: 'digestcode', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
ownerid: new FormItemModel({ caption: '所属主体', detailType: 'FORMITEM', name: 'ownerid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
ownertype: new FormItemModel({ caption: '所属类型', detailType: 'FORMITEM', name: 'ownertype', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
memo: new FormItemModel({ caption: '备注', detailType: 'FORMITEM', name: 'memo', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
createman: new FormItemModel({ caption: '创建人', detailType: 'FORMITEM', name: 'createman', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
createdate: new FormItemModel({ caption: '创建日期', detailType: 'FORMITEM', name: 'createdate', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
updateman: new FormItemModel({ caption: '更新人', detailType: 'FORMITEM', name: 'updateman', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
updatedate: new FormItemModel({ caption: '更新时间', detailType: 'FORMITEM', name: 'updatedate', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
fileid: new FormItemModel({ caption: '标识', detailType: 'FORMITEM', name: 'fileid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
};
/**
* 监控表单属性 srfupdatedate 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfupdatedate')
onSrfupdatedateChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfupdatedate', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srforikey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srforikey')
onSrforikeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srforikey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfkey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfkey')
onSrfkeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfkey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfmajortext 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfmajortext')
onSrfmajortextChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfmajortext', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srftempmode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srftempmode')
onSrftempmodeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srftempmode', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfuf 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfuf')
onSrfufChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfuf', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfdeid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfdeid')
onSrfdeidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfdeid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 srfsourcekey 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.srfsourcekey')
onSrfsourcekeyChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'srfsourcekey', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 filename 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.filename')
onFilenameChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'filename', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 filepath 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.filepath')
onFilepathChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'filepath', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 filesize 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.filesize')
onFilesizeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'filesize', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 fileext 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.fileext')
onFileextChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'fileext', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 folder 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.folder')
onFolderChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'folder', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 digestcode 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.digestcode')
onDigestcodeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'digestcode', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 ownerid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.ownerid')
onOwneridChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'ownerid', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 ownertype 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.ownertype')
onOwnertypeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'ownertype', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 memo 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.memo')
onMemoChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'memo', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 createman 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.createman')
onCreatemanChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'createman', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 createdate 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.createdate')
onCreatedateChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'createdate', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 updateman 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.updateman')
onUpdatemanChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'updateman', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 updatedate 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.updatedate')
onUpdatedateChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'updatedate', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 fileid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.fileid')
onFileidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'fileid', newVal: newVal, oldVal: oldVal });
}
/**
* 重置表单项值
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof Main
*/
public resetFormData({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
}
/**
* 置空对象
*
* @param {any[]} args
* @memberof EditForm
*/
public ResetData(_datas:any){
if(Object.keys(_datas).length >0){
Object.keys(_datas).forEach((name: string) => {
if (this.data.hasOwnProperty(name)) {
this.data[name] = null;
}
});
}
}
/**
* 表单逻辑
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof Main
*/
public formLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
}
/**
* 表单值变化
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @returns {void}
* @memberof Main
*/
public formDataChange({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
if (this.ignorefieldvaluechange) {
return;
}
this.resetFormData({ name: name, newVal: newVal, oldVal: oldVal });
this.formLogic({ name: name, newVal: newVal, oldVal: oldVal });
this.dataChang.next(JSON.stringify(this.data));
}
/**
* 表单加载完成
*
* @public
* @param {*} [data={}]
* @param {string} [action]
* @memberof Main
*/
public onFormLoad(data: any = {},action:string): void {
if(Object.is(action,"save") || Object.is(action,"autoSave") || Object.is(action,"submit"))
// 更新context的实体主键
if(data.sdfile){
Object.assign(this.context,{sdfile:data.sdfile})
}
this.setFormEnableCond(data);
this.fillForm(data,action);
this.oldData = {};
Object.assign(this.oldData, JSON.parse(JSON.stringify(this.data)));
this.$store.commit('viewaction/setViewDataChange', { viewtag: this.viewtag, viewdatachange: false });
this.formLogic({ name: '', newVal: null, oldVal: null });
}
/**
* 值填充
*
* @param {*} [_datas={}]
* @param {string} [action]
* @memberof Main
*/
public fillForm(_datas: any = {},action:string): void {
this.ignorefieldvaluechange = true;
Object.keys(_datas).forEach((name: string) => {
if (this.data.hasOwnProperty(name)) {
this.data[name] = _datas[name];
}
});
if(Object.is(action,'loadDraft')){
this.createDefault();
}
if(Object.is(action,'load')){
this.updateDefault();
}
this.$nextTick(function () {
this.ignorefieldvaluechange = false;
})
}
/**
* 设置表单项是否启用
*
* @public
* @param {*} data
* @memberof Main
*/
public setFormEnableCond(data: any): void {
Object.values(this.detailsModel).forEach((detail: any) => {
if (!Object.is(detail.detailType, 'FORMITEM')) {
return;
}
const formItem: FormItemModel = detail;
formItem.setEnableCond(data.srfuf);
});
}
/**
* 重置草稿表单状态
*
* @public
* @memberof Main
*/
public resetDraftFormStates(): void {
const form: any = this.$refs.form;
if (form) {
form.resetFields();
}
}
/**
* 重置校验结果
*
* @memberof Main
*/
public resetValidates(): void {
Object.values(this.detailsModel).forEach((detail: any) => {
if (!Object.is(detail.detailType, 'FORMITEM')) {
return;
}
const formItem: FormItemModel = detail;
formItem.setError('');
});
}
/**
* 填充校验结果 (后台)
*
* @param {any[]} fieldErrors
* @memberof Main
*/
public fillValidates(fieldErrors: any[]): void {
fieldErrors.forEach((error: any) => {
const formItem: FormItemModel = this.detailsModel[error.field];
if (!formItem) {
return;
}
this.$nextTick(() => {
formItem.setError(error.message);
});
});
}
/**
* 表单校验状态
*
* @returns {boolean}
* @memberof Main
*/
public formValidateStatus(): boolean {
const form: any = this.$refs.form;
let validatestate: boolean = true;
form.validate((valid: boolean) => {
validatestate = valid ? true : false;
});
return validatestate
}
/**
* 获取全部值
*
* @returns {*}
* @memberof Main
*/
public getValues(): any {
return this.data;
}
/**
* 表单项值变更
*
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof Main
*/
public onFormItemValueChange($event: { name: string, value: any }): void {
if (!$event) {
return;
}
if (!$event.name || Object.is($event.name, '') || !this.data.hasOwnProperty($event.name)) {
return;
}
this.data[$event.name] = $event.value;
}
/**
* 设置数据项值
*
* @param {string} name
* @param {*} value
* @returns {void}
* @memberof Main
*/
public setDataItemValue(name: string, value: any): void {
if (!name || Object.is(name, '') || !this.data.hasOwnProperty(name)) {
return;
}
if (Object.is(this.data[name], value)) {
return;
}
this.data[name] = value;
}
/**
* 分组界面行为事件
*
* @param {*} $event
* @memberof Main
*/
public groupUIActionClick($event: any): void {
if (!$event) {
return;
}
const item:any = $event.item;
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof Main
*/
public created(): void {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof Main
*/
public afterCreated(){
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
if (Object.is('autoload', action)) {
this.autoLoad(data);
}
if (Object.is('load', action)) {
this.load(data);
}
if (Object.is('loaddraft', action)) {
this.loadDraft(data);
}
if (Object.is('save', action)) {
this.save(data,data.showResultInfo);
}
if (Object.is('remove', action)) {
this.remove(data);
}
if (Object.is('saveandexit', action)) {
this.saveAndExit(data);
}
if (Object.is('saveandnew', action)) {
this.saveAndNew(data);
}
if (Object.is('removeandexit', action)) {
this.removeAndExit(data);
}
if (Object.is('refresh', action)) {
this.refresh(data);
}
});
}
this.dataChang
.pipe(
debounceTime(300),
distinctUntilChanged()
).subscribe((data: any) => {
if (this.autosave) {
this.autoSave();
}
const state = !Object.is(JSON.stringify(this.oldData), JSON.stringify(this.data)) ? true : false;
this.$store.commit('viewaction/setViewDataChange', { viewtag: this.viewtag, viewdatachange: state });
});
}
/**
* vue 生命周期
*
* @memberof Main
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof Main
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if (this.dataChangEvent) {
this.dataChangEvent.unsubscribe();
}
}
/**
* 拷贝内容
*
* @param {*} [arg={}]
* @memberof @memberof Main
*/
public copy(arg: any = {}): void {
this.loadDraft(arg);
}
/**
*打印
*@memberof @memberof Main
*/
public print(){
let _this:any = this;
_this.$print({id:'form',popTitle:'主编辑表单'});
}
/**
* 部件刷新
*
* @param {any[]} args
* @memberof Main
*/
public refresh(args: any[]): void {
let arg: any = {};
Object.assign(arg,args[0]);
if (this.data.srfkey && !Object.is(this.data.srfkey, '')) {
Object.assign(arg, { srfkey: this.data.srfkey });
this.load(arg);
return;
}
if (this.data.srfkeys && !Object.is(this.data.srfkeys, '')) {
Object.assign(arg, { srfkey: this.data.srfkeys });
this.load(arg);
return;
}
}
/**
* 自动加载
*
* @param {*} [arg={}]
* @returns {void}
* @memberof Main
*/
public autoLoad(arg: any = {}): void {
if (arg.srfkey && !Object.is(arg.srfkey, '')) {
Object.assign(arg, { srfkey: arg.srfkey });
this.load(arg);
return;
}
if (arg.srfkeys && !Object.is(arg.srfkeys, '')) {
Object.assign(arg, { srfkey: arg.srfkeys });
this.load(arg);
return;
}
this.loadDraft(arg);
}
/**
* 加载
*
* @public
* @param {*} [opt={}]
* @memberof Main
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: '错误', desc: 'SDFileEditView视图表单loadAction参数未配置' });
return;
}
const arg: any = { ...opt };
let viewparamResult:any = Object.assign(arg,this.viewparams);
const get: Promise<any> = this.service.get(this.loadAction,JSON.parse(JSON.stringify(this.context)),{viewparams:viewparamResult}, this.showBusyIndicator);
get.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
this.onFormLoad(data,'load');
this.$emit('load', data);
this.$nextTick(() => {
this.formState.next({ type: 'load', data: data });
});
}
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
});
}
/**
* 加载草稿
*
* @param {*} [opt={}]
* @memberof Main
*/
public loadDraft(opt: any = {}): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: '错误', desc: 'SDFileEditView视图表单loaddraftAction参数未配置' });
return;
}
const arg: any = { ...opt } ;
let viewparamResult:any = Object.assign(arg,this.viewparams);
let post: Promise<any> = this.service.loadDraft(this.loaddraftAction,JSON.parse(JSON.stringify(this.context)),{viewparams:viewparamResult}, this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
}
return;
}
const data = response.data;
if(data.sdfile){
Object.assign(this.context,{sdfile:data.sdfile})
}
this.resetDraftFormStates();
this.onFormLoad(data,'loadDraft');
this.$emit('load', data);
this.$nextTick(() => {
this.formState.next({ type: 'load', data: data });
});
setTimeout(() => {
const form: any = this.$refs.form;
if (form) {
form.fields.forEach((field: any) => {
field.validateMessage = "";
field.validateState = "";
field.validateStatus = false;
});
}
});
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
});
}
/**
* 自动保存
*
* @param {*} [opt={}]
* @memberof Main
*/
public autoSave(opt: any = {}): void {
if (!this.formValidateStatus()) {
return;
}
const arg: any = { ...opt };
const data = this.getValues();
Object.assign(arg, data);
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: '错误', desc: 'SDFileEditView视图表单'+actionName+'参数未配置' });
return;
}
Object.assign(arg,{viewparams:this.viewparams});
const post: Promise<any> = this.service.add(action, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
}
return;
}
const data = response.data;
this.onFormLoad(data,'autoSave');
this.$emit('save', data);
this.$store.dispatch('viewaction/datasaved', { viewtag: this.viewtag });
this.$nextTick(() => {
this.formState.next({ type: 'save', data: data });
});
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
});
}
/**
* 保存
*
* @param {*} [opt={}]
* @param {boolean} [showResultInfo]
* @param {boolean} [ifStateNext] formState是否下发通知
* @returns {Promise<any>}
* @memberof Main
*/
public async save(opt: any = {}, showResultInfo?: boolean, ifStateNext: boolean = true): Promise<any> {
return new Promise((resolve: any, reject: any) => {
showResultInfo = showResultInfo === undefined ? true : false;
if (!this.formValidateStatus()) {
this.$Notice.error({ title: '错误', desc: '值规则校验异常' });
return;
}
const arg: any = { ...opt };
const data = this.getValues();
Object.assign(arg, data);
Object.assign(arg, this.context);
if (ifStateNext) {
this.drcounter = 0;
if(this.drcounter !== 0){
this.drsaveopt = opt;
this.formState.next({ type: 'beforesave', data: arg });//先通知关系界面保存
this.saveState = resolve;
return;
}
}
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: '错误', desc: 'SDFileEditView视图表单'+actionName+'参数未配置' });
return;
}
Object.assign(arg,{viewparams:this.viewparams});
const post: Promise<any> = Object.is(data.srfuf, '1')?this.service.update(action, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(action,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
}
return;
}
const data = response.data;
this.onFormLoad(data,'save');
this.$emit('save', data);
this.$store.dispatch('viewaction/datasaved', { viewtag: this.viewtag });
this.$nextTick(() => {
this.formState.next({ type: 'save', data: data });
});
if (showResultInfo) {
this.$Notice.success({ title: '', desc: (data.srfmajortext ? data.srfmajortext : '') + '&nbsp;保存成功!' });
}
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
});
})
}
/**
* 删除
*
* @public
* @param {*} [opt={}]
* @memberof EditForm
*/
public remove(opt:Array<any> = [],showResultInfo?: boolean): Promise<any> {
return new Promise((resolve: any, reject: any) => {
if(!this.removeAction){
this.$Notice.error({ title: '错误', desc: 'SDFileEditView视图表单removeAction参数未配置' });
return;
}
const arg: any = opt[0];
const _this: any = this;
Object.assign(arg,{viewparams:this.viewparams});
this.service.delete(_this.removeAction, JSON.parse(JSON.stringify(this.context)),arg, showResultInfo).then((response: any) => {
if (response) {
const data = response.data;
this.$emit('remove',data);
this.formState.next({ type: 'remove', data: data });
this.data.ismodify = false;
this.$Notice.success({ title: '', desc: (data.srfmajortext ? data.srfmajortext : '') + '&nbsp;删除成功!' });
resolve(response);
}
}).catch((error: any) => {
const { data: _data } = error;
this.$Notice.error({ title: _data.title, desc: _data.message });
reject(error);
});
});
}
/**
* 工作流启动
*
* @param {*} [data={}]
* @param {*} [localdata={}]
* @returns {Promise<any>}
* @memberof Main
*/
public async wfstart(data: any,localdata?:any): Promise<any> {
return new Promise((resolve: any, reject: any) => {
const _this: any = this;
const post: Promise<any> = _this.save({},false);
post.then((response:any) =>{
const arg:any = response.data;
if(this.viewparams){
Object.assign(arg,{viewparams:this.viewparams});
}
const result: Promise<any> = this.service.wfstart(_this.WFStartAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
result.then((response: any) => {
if (!response || response.status !== 200) {
if(response.data){
this.$Notice.error({ title: '', desc: '工作流启动失败, ' + response.data.message });
}
return;
}
this.$Notice.info({ title: '', desc: '工作流启动成功' });
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
});
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
})
});
}
/**
* 工作流提交
*
* @param {*} [data={}]
* @param {*} [localdata={}]
* @returns {Promise<any>}
* @memberof Main
*/
public async wfsubmit(data: any,localdata?:any): Promise<any> {
return new Promise((resolve: any, reject: any) => {
const _this: any = this;
const arg: any = data[0];
Object.assign(arg,{viewparams:this.viewparams});
if (!arg.sdfile || Object.is(arg.sdfile, '')) {
return;
}
const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
post.then((response:any) =>{
const arg:any = response.data;
// 保存完成UI处理
this.onFormLoad(arg,'save');
this.$emit('save', arg);
this.$nextTick(() => {
this.formState.next({ type: 'save', data: arg });
});
// 准备提交参数
if(this.viewparams){
Object.assign(arg,{viewparams:this.viewparams});
}
const result: Promise<any> = this.service.wfsubmit(_this.WFSubmitAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
result.then((response: any) => {
if (!response || response.status !== 200) {
if(response.data){
this.$Notice.error({ title: '', desc: '工作流提交失败, ' + response.data.message });
}
return;
}
this.onFormLoad(arg,'submit');
this.$store.dispatch('viewaction/datasaved', { viewtag: this.viewtag });
this.$Notice.info({ title: '', desc: '工作流提交成功' });
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
});
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
})
})
}
/**
* 表单项更新
*
* @param {string} mode 界面行为名称
* @param {*} [data={}] 请求数据
* @param {string[]} updateDetails 更新项
* @param {boolean} [showloading] 是否显示加载状态
* @returns {void}
* @memberof Main
*/
public updateFormItems(mode: string, data: any = {}, updateDetails: string[], showloading?: boolean): void {
if (!mode || (mode && Object.is(mode, ''))) {
return;
}
const arg: any = { ...data };
Object.assign(arg,this.viewparams);
const post: Promise<any> = this.service.frontLogic(mode,JSON.parse(JSON.stringify(this.context)),arg, showloading);
post.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: '错误', desc: '表单项更新失败' });
return;
}
const data = response.data;
const _data: any = {};
updateDetails.forEach((name: string) => {
if (!data.hasOwnProperty(name)) {
return;
}
Object.assign(_data, { [name]: data[name] });
});
this.setFormEnableCond(_data);
this.fillForm(_data,'updateFormItem');
this.formLogic({ name: '', newVal: null, oldVal: null });
this.dataChang.next(JSON.stringify(this.data));
this.$nextTick(() => {
this.formState.next({ type: 'updateformitem', ufimode: arg.srfufimode, data: _data });
});
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: '错误', desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
});
}
/**
* 回车事件
*
* @param {*} $event
* @memberof Main
*/
public onEnter($event: any): void {
}
/**
* 保存并退出
*
* @param {any[]} args
* @memberof Main
*/
public saveAndExit(data:any[]):Promise<any>{
let _this = this;
return new Promise((resolve: any, reject: any) =>{
let arg: any = {};
if(data && data.length > 0){
Object.assign(arg,data[0]);
}
_this.currentAction = "saveAndExit";
_this.save([arg]).then((res) =>{
if(res){
_this.closeView(res.data);
}
resolve(res);
}).catch((error) =>{
reject(error);
})
})
}
/**
* 保存并新建
*
* @param {any[]} args
* @memberof Main
*/
public saveAndNew(data:any[]):Promise<any>{
let _this = this;
return new Promise((resolve: any, reject: any) =>{
let arg: any = {};
if(data && data.length > 0){
Object.assign(arg,data[0]);
}
_this.currentAction = "saveAndNew";
_this.save([arg]).then((res) =>{
_this.ResetData(res);
_this.loadDraft({});
}).catch((error) =>{
reject(error);
})
})
}
/**
* 删除并退出
*
* @param {any[]} args
* @memberof Main
*/
public removeAndExit(data:any[]):Promise<any>{
let _this = this;
return new Promise((resolve: any, reject: any) =>{
let arg: any = {};
if(data && data.length > 0){
Object.assign(arg,data[0]);
}
_this.remove([arg]).then((res) =>{
if(res){
_this.closeView(res.data);
}
resolve(res);
}).catch((error) =>{
reject(error);
})
})
}
/**
* 关系界面数据保存完成
*
* @param {any} $event
* @memberof Main
*/
public drdatasaved($event:any){
let _this = this;
this.drcounter--;
if(this.drcounter > 0){
return;
}
this.save(this.drsaveopt, undefined, false).then((res) =>{
this.saveState(res);
this.drsaveopt = {};
if(Object.is(_this.currentAction, "saveAndNew")){
_this.ResetData(res);
_this.loadDraft({});
}else if(Object.is(_this.currentAction, "saveAndExit")){
if(res){
_this.closeView(res.data);
}
}
});
}
/**
* 新建默认值
* @memberof Main
*/
public createDefault(){
}
/**
* 更新默认值
* @memberof Main
*/
public updateDefault(){
}
}
</script>
<style lang='less'>
@import './main-form.less';
</style>
\ No newline at end of file
!!!!模版产生代码错误:----
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: ${appde.getKeyPSAppDEField().getCodeN... [in template "TEMPLCODE_zh_CN" at line 1006, column 18]
----
\ No newline at end of file
......@@ -4,5 +4,5 @@ Tip: If the failing expression is known to be legally refer to something that's
----
FTL stack trace ("~" means nesting-related):
- Failed at: ${appde.getKeyPSAppDEField().getCodeN... [in template "TEMPLCODE_zh_CN" at line 348, column 14]
- Failed at: ${appde.getKeyPSAppDEField().getCodeN... [in template "TEMPLCODE_zh_CN" at line 349, column 14]
----
\ No newline at end of file
......@@ -4,5 +4,5 @@ Tip: If the failing expression is known to be legally refer to something that's
----
FTL stack trace ("~" means nesting-related):
- Failed at: ${ctrl.getPSAppDataEntity().getMajorP... [in template "TEMPLCODE_zh_CN" at line 809, column 39]
- Failed at: ${ctrl.getPSAppDataEntity().getMajorP... [in template "TEMPLCODE_zh_CN" at line 884, column 39]
----
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import SDFileService from '@/service/sdfile/sdfile-service';
import MainModel from './main-grid-model';
/**
* Main 部件服务对象
*
* @export
* @class MainService
*/
export default class MainService extends ControlService {
/**
* 文件服务对象
*
* @type {SDFileService}
* @memberof MainService
*/
public appEntityService: SDFileService = new SDFileService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof MainService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of MainService.
*
* @param {*} [opts={}]
* @memberof MainService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new MainModel();
}
/**
* 处理数据
*
* @public
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof MainService
*/
public doItems(promise: Promise<any>, deKeyField: string, deName: string): Promise<any> {
return new Promise((resolve, reject) => {
promise.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
data.forEach((item:any,index:number) =>{
item[deName] = item[deKeyField];
data[index] = item;
});
resolve(data);
} else {
reject([])
}
}).catch((response: any) => {
reject([])
});
});
}
/**
* 获取跨实体数据集合
*
* @param {string} serviceName 服务名称
* @param {string} interfaceName 接口名称
* @param {*} data
* @param {boolean} [isloading]
* @returns {Promise<any[]>}
* @memberof MainService
*/
@Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
return Promise.reject([])
}
/**
* 添加数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
}else{
result =_appEntityService.Create(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 删除数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public delete(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
}else{
result =_appEntityService.Remove(Context,Data, isloading);
}
result.then((response) => {
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 修改数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Data,Context,isloading);
}else{
result =_appEntityService.Update(Data,Context,isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 获取数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public get(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Get(Context,Data, isloading);
}
result.then((response) => {
//处理返回数据,补充判断标识
if(response.data){
Object.assign(response.data,{srfuf:0});
}
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public search(action: string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
}else{
result =_appEntityService.FetchDefault(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 加载草稿
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public loadDraft(action: string, context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.GetDraft(Context,Data, isloading);
}
result.then((response) => {
//处理返回数据,补充判断标识
if(response.data){
Object.assign(response.data,{srfuf:'0'});
//仿真主键数据
response.data.sdfile = Util.createUUID();
}
this.handleResponse(action, response, true);
this.mergeDefaults(response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 合并配置的默认值
* @param {*}
* @memberof MainService
*/
public mergeDefaults(response:any = {}){
if(response.data){
}
}
/**
* 前台逻辑
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public frontLogic(action:string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any)=>{
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
return Promise.reject({ status: 500, data: { title: '失败', message: '系统异常' } });
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
})
}
}
\ No newline at end of file
!!!!模版产生代码错误:----
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: ${appde.getKeyPSAppDEField().getCodeN... [in template "TEMPLCODE_zh_CN" at line 357, column 35]
----
\ No newline at end of file
......@@ -25,6 +25,10 @@
overflow: hidden;
word-break: break-all;
}
.el-table-column--selection .cell {
padding-left: 0px;
padding-right: 0px;
}
.app-column-link, .app-format-data{
display: inline;
}
......
......@@ -15,7 +15,7 @@ module.exports = {
port: 8111,
compress: true,
disableHostCheck: true,
// proxy: "http://127.0.0.1:8080/web",
// proxy: "http://127.0.0.1:8080/",
historyApiFallback: {
rewrites: [
]
......
......@@ -2089,6 +2089,11 @@ async-validator@^1.10.0:
resolved "https://registry.yarnpkg.com/async-validator/-/async-validator-1.12.2.tgz#beae671e7174d2938b7b4b69d2fb7e722b7fd72c"
integrity sha512-57EETfCPFiB7M4QscvQzWSGNsmtkjjzZv318SK1CBlstk+hycV72ocjriMOOM48HjvmoAoJGpJNjC7Z76RlnZA==
async-validator@^3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/async-validator/-/async-validator-3.3.0.tgz#1d92193bbe60d6d6c8b246692c7005e9ed14a8ee"
integrity sha512-cAHGD9EL8aCqWXjnb44q94MWiDFzUo1tMhvLb2WzcpWqGiKugsjWG9cvl+jPgkPca7asNbsBU3fa0cwkI/P+Xg==
async-validator@~1.8.1:
version "1.8.5"
resolved "https://registry.yarnpkg.com/async-validator/-/async-validator-1.8.5.tgz#dc3e08ec1fd0dddb67e60842f02c0cd1cec6d7f0"
......@@ -2157,6 +2162,13 @@ axios@^0.19.1:
dependencies:
follow-redirects "1.5.10"
axios@^0.19.2:
version "0.19.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27"
integrity sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==
dependencies:
follow-redirects "1.5.10"
babel-code-frame@^6.22.0, babel-code-frame@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
......@@ -3258,6 +3270,11 @@ core-js@^3.4.4:
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.6.4.tgz#440a83536b458114b9cb2ac1580ba377dc470647"
integrity sha512-4paDGScNgZP2IXXilaffL9X7968RuvwlkK3xWtZRVqgd8SYNiVKRJvkFd1aqqEuPfN7E68ZHEp9hDj6lHj4Hyw==
core-js@^3.6.4:
version "3.6.5"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.6.5.tgz#7395dc273af37fb2e50e9bd3d9fe841285231d1a"
integrity sha512-vZVEEwZoIsI+vPEuoF9Iqf5H7/M3eeQqWlQnYa8FSKKePuYTf5MWnxb5SDAzCa60b3JBRS5g9b+Dq7b1y/RCrA==
core-util-is@1.0.2, core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
......@@ -3626,6 +3643,11 @@ date-fns@^1.27.2:
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c"
integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==
dayjs@^1.8.16:
version "1.8.27"
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.8.27.tgz#a8ae63ee990af28c05c430f0e160ae835a0fbbf8"
integrity sha512-Jpa2acjWIeOkg8KURUHICk0EqnEFSSF5eMEscsOgyJ92ZukXwmpmRkPSUka7KHSfbj5eKH30ieosYip+ky9emQ==
de-indent@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d"
......@@ -4017,6 +4039,18 @@ element-ui@^2.13.0:
resize-observer-polyfill "^1.5.0"
throttle-debounce "^1.0.1"
element-ui@^2.13.2:
version "2.13.2"
resolved "https://registry.yarnpkg.com/element-ui/-/element-ui-2.13.2.tgz#582bf47aaaaaafe23ea1958fae217a687ad06447"
integrity sha512-r761DRPssMPKDiJZWFlG+4e4vr0cRG/atKr3Eqr8Xi0tQMNbtmYU1QXvFnKiFPFFGkgJ6zS6ASkG+sellcoHlQ==
dependencies:
async-validator "~1.8.1"
babel-helper-vue-jsx-merge-props "^2.0.0"
deepmerge "^1.2.0"
normalize-wheel "^1.0.1"
resize-observer-polyfill "^1.5.0"
throttle-debounce "^1.0.1"
elliptic@^6.0.0:
version "6.5.2"
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.2.tgz#05c5678d7173c049d8ca433552224a495d0e3762"
......@@ -5204,6 +5238,28 @@ human-signals@^1.1.1:
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3"
integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==
ibiz-gantt-elastic@^1.0.15:
version "1.0.15"
resolved "https://registry.yarnpkg.com/ibiz-gantt-elastic/-/ibiz-gantt-elastic-1.0.15.tgz#e57736254aaf5baea28225bce2d29d8bd8adcc2d"
integrity sha512-V3uLoN3BN32BagpV1kLm4nFSs4neJ/Cnykd7OIyLv11rjqTWFAENHBpZekioPFF4k2iCyAdRr5smzZbGJdSQxg==
dependencies:
dayjs "^1.8.16"
resize-observer-polyfill "^1.5.1"
vue "^2.6.10"
vue-slider-component "^3.0.40"
vue-switches "^2.0.1"
ibiz-vue-lib@^0.1.9:
version "0.1.9"
resolved "https://registry.yarnpkg.com/ibiz-vue-lib/-/ibiz-vue-lib-0.1.9.tgz#d7088deb5577af3095887ca897c1710bae174682"
integrity sha512-CotV3xIB04+QUUeMlfsVj5BseVPQ+IHyKdwU+MXGh+2e91Nt7N/z/LElakhAiGkSpaaKoMdlKCOdhD0qqJ3wNQ==
dependencies:
axios "^0.19.2"
core-js "^3.6.4"
element-ui "^2.13.2"
view-design "^4.1.0"
vue "^2.6.11"
iconv-lite@0.4.24:
version "0.4.24"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
......@@ -8623,7 +8679,7 @@ requires-port@^1.0.0:
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=
resize-observer-polyfill@^1.5.0:
resize-observer-polyfill@^1.5.0, resize-observer-polyfill@^1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464"
integrity sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==
......@@ -9052,6 +9108,11 @@ sort-keys@^1.0.0:
dependencies:
is-plain-obj "^1.0.0"
sortablejs@^1.10.1:
version "1.10.2"
resolved "https://registry.yarnpkg.com/sortablejs/-/sortablejs-1.10.2.tgz#6e40364d913f98b85a14f6678f92b5c1221f5290"
integrity sha512-YkPGufevysvfwn5rfdlGyrGjt7/CRHwvRPogD/lC+TnvcN29jDpCifKP+rBqf+LRldfXSTh+0CGLcSg0VIxq3A==
source-list-map@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34"
......@@ -10115,6 +10176,13 @@ vue-loader@^15.7.2:
vue-hot-reload-api "^2.3.0"
vue-style-loader "^4.1.0"
vue-property-decorator@^8.0.0:
version "8.4.2"
resolved "https://registry.yarnpkg.com/vue-property-decorator/-/vue-property-decorator-8.4.2.tgz#016e17f259f73bc547e77a50ce282ba18db4ee41"
integrity sha512-IqbARlvgPE2pzKfbecKxsu2yEH0Wv7hfHR6m4eZA3LTnNw9hveAX77vDfLFyTeMISS5N7Kucp/xRSHjcQ6bAfQ==
dependencies:
vue-class-component "^7.1.0"
vue-property-decorator@^8.3.0:
version "8.3.0"
resolved "https://registry.yarnpkg.com/vue-property-decorator/-/vue-property-decorator-8.3.0.tgz#536f027dc7d626f37c8d85a2dc02f0a6cb979440"
......@@ -10127,6 +10195,13 @@ vue-router@^3.1.3:
resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-3.1.4.tgz#98a6a4dd38fca0db3b9f3c04bfbd008a3b6d958d"
integrity sha512-pX2BGvZg5/MOXbJoYsRppoZM+0B4LSszvIXQvLPZ7govbgbBorYQ4JHx99lDTjzEBkbTyKfRG+ru1VCnMuVcUg==
vue-slider-component@^3.0.40:
version "3.1.3"
resolved "https://registry.yarnpkg.com/vue-slider-component/-/vue-slider-component-3.1.3.tgz#f5e61cdbd7b677840f7286ee590c6450469f71fb"
integrity sha512-SPFb1I3G2a4thIwghvVNhcvPGCUz6PIZR1ClwtvN4MT44ZUzvqCMDS7osdKz0hdKu4kfanxET8qZn826A/XPxA==
dependencies:
vue-property-decorator "^8.0.0"
vue-style-loader@^4.1.0:
version "4.1.2"
resolved "https://registry.yarnpkg.com/vue-style-loader/-/vue-style-loader-4.1.2.tgz#dedf349806f25ceb4e64f3ad7c0a44fba735fcf8"
......@@ -10135,6 +10210,13 @@ vue-style-loader@^4.1.0:
hash-sum "^1.0.2"
loader-utils "^1.0.2"
vue-switches@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/vue-switches/-/vue-switches-2.0.1.tgz#f23436259c7fe4ffca9c4a6df49ac78941e20a20"
integrity sha512-rDqBtK3TKy1pEvyZeWmnSHVeXqAcn+ozch7LiNThBzr1QMjg5rhvqBY7uWeli/baDDslf6CXmBJbHPwASJLqoA==
dependencies:
vue "^2.2.6"
vue-template-compiler@^2.6.10:
version "2.6.11"
resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.6.11.tgz#c04704ef8f498b153130018993e56309d4698080"
......@@ -10148,11 +10230,18 @@ vue-template-es2015-compiler@^1.6.0, vue-template-es2015-compiler@^1.9.0:
resolved "https://registry.yarnpkg.com/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.9.1.tgz#1ee3bc9a16ecbf5118be334bb15f9c46f82f5825"
integrity sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==
vue@^2.6.10:
vue@^2.2.6, vue@^2.6.10, vue@^2.6.11:
version "2.6.11"
resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.11.tgz#76594d877d4b12234406e84e35275c6d514125c5"
integrity sha512-VfPwgcGABbGAue9+sfrD4PuwFar7gPb1yl1UK1MwXoQPAw0BKSqWfoYCT/ThFrdEVWoI51dBuyCoiNU9bZDZxQ==
vuedraggable@^2.23.2:
version "2.23.2"
resolved "https://registry.yarnpkg.com/vuedraggable/-/vuedraggable-2.23.2.tgz#0d95d7fdf4f02f56755a26b3c9dca5c7ca9cfa72"
integrity sha512-PgHCjUpxEAEZJq36ys49HfQmXglattf/7ofOzUrW2/rRdG7tu6fK84ir14t1jYv4kdXewTEa2ieKEAhhEMdwkQ==
dependencies:
sortablejs "^1.10.1"
vuex@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/vuex/-/vuex-3.1.2.tgz#a2863f4005aa73f2587e55c3fadf3f01f69c7d4d"
......
......@@ -13,4 +13,5 @@ services:
networks:
agent_network:
driver: overlay
attachable: true
\ No newline at end of file
attachable: true
......@@ -42,6 +42,9 @@ public class webSecurityConfig extends WebSecurityConfigurerAdapter {
@Value("${ibiz.auth.path:v7/login}")
private String loginPath;
@Value("${ibiz.auth.logoutpath:v7/logout}")
private String logoutPath;
@Value("${ibiz.file.uploadpath:ibizutil/upload}")
private String uploadpath;
......@@ -107,6 +110,8 @@ public class webSecurityConfig extends WebSecurityConfigurerAdapter {
).permitAll()
//放行登录请求
.antMatchers( HttpMethod.POST,"/"+loginPath).permitAll()
//放行注销请求
.antMatchers( HttpMethod.GET,"/"+logoutPath).permitAll()
// 文件操作
.antMatchers("/"+downloadpath+"/**").permitAll()
.antMatchers("/"+uploadpath).permitAll()
......
......@@ -23,7 +23,7 @@ import java.util.List;
@Configuration
@EnableFeignClients(basePackages = {"cn.ibizlab" })
@EnableZuulProxy
@ComponentScan(basePackages = {"cn.ibizlab"})
@ComponentScan(basePackages = {"cn.ibizlab.web","cn.ibizlab.util"})
@MapperScan("cn.ibizlab.*.mapper")
@SpringBootApplication(exclude = {
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class,
......
......@@ -4,11 +4,13 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.context.annotation.ComponentScan;
import java.util.List;
@Slf4j
......@@ -18,6 +20,14 @@ import java.util.List;
@EnableFeignClients(basePackages = {"cn.ibizlab" })
@SpringBootApplication(exclude = {
})
@ComponentScan(basePackages = {"cn.ibizlab"}
// ,excludeFilters={
// @ComponentScan.Filter(type= org.springframework.context.annotation.FilterType.REGEX,pattern="cn.ibizlab.xxx.rest.xxx"),
// }
)
@Import({
org.springframework.cloud.openfeign.FeignClientsConfiguration.class
})
public class DevBootApplication extends WebMvcConfigurerAdapter{
public static void main(String[] args) {
......
......@@ -41,6 +41,9 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
@Value("${ibiz.auth.path:v7/login}")
private String loginPath;
@Value("${ibiz.auth.logoutpath:v7/logout}")
private String logoutPath;
@Value("${ibiz.file.uploadpath:ibizutil/upload}")
private String uploadpath;
......@@ -102,6 +105,8 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
).permitAll()
//放行登录请求
.antMatchers( HttpMethod.POST,"/"+loginPath).permitAll()
//放行注销请求
.antMatchers( HttpMethod.GET,"/"+logoutPath).permitAll()
// 文件操作
.antMatchers("/"+downloadpath+"/**").permitAll()
.antMatchers("/"+uploadpath).permitAll()
......
server:
port: 8080
#zuul网关路由设置
zuul:
routes:
......@@ -10,5 +8,9 @@ zuul:
path: /v7/login
serviceId: ibzuaa-api
stripPrefix: false
oucore:
path: /ibzorganizations/**
serviceId: ibzou-api
stripPrefix: false
sensitive-headers:
- Cookie,Set-Cookie,Authorization
......@@ -94,4 +94,75 @@
</dependencies>
<properties>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
</properties>
<profiles>
<profile>
<id>diff</id>
<build>
<plugins>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase.version}</version>
<executions>
<execution>
<id>prepare-newdb</id>
<configuration>
<changeLogFile>${project.basedir}/src/main/resources/liquibase/h2_table.xml</changeLogFile>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:file:${project.build.directory}/db/new;MODE=mysql</url>
<username>root</username>
<dropFirst>true</dropFirst>
</configuration>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
<execution>
<id>prepare-olddb</id>
<configuration>
<changeLogFile>${project.basedir}/src/main/resources/liquibase/master_table.xml</changeLogFile>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:file:${project.build.directory}/db/last;MODE=mysql</url>
<username>root</username>
<dropFirst>true</dropFirst>
</configuration>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
<execution>
<id>make-diff</id>
<configuration>
<changeLogFile>${project.basedir}/src/main/resources/liquibase/empty.xml</changeLogFile>
<diffChangeLogFile>${project.basedir}/src/main/resources/liquibase/changelog/${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:file:${project.build.directory}/db/last;MODE=mysql</url>
<username>root</username>
<password></password>
<referenceUrl>jdbc:h2:file:${project.build.directory}/db/new;MODE=mysql</referenceUrl>
<referenceDriver>org.h2.Driver</referenceDriver>
<referenceUsername>root</referenceUsername>
<verbose>true</verbose>
<logging>debug</logging>
<contexts>!test</contexts>
<diffExcludeObjects>Index:.*,table:ibzfile,ibzuser,ibzdataaudit,IBZFILE,IBZUSER,IBZDATAAUDIT</diffExcludeObjects>
</configuration>
<phase>process-resources</phase>
<goals>
<goal>diff</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
......@@ -11,12 +11,14 @@ import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.util.ObjectUtils;
import org.springframework.util.DigestUtils;
import cn.ibizlab.util.domain.EntityBase;
import cn.ibizlab.util.annotation.DEField;
import cn.ibizlab.util.enums.DEPredefinedFieldType;
import cn.ibizlab.util.enums.DEFieldDefaultValueType;
import java.io.Serializable;
import lombok.Data;
import lombok.*;
import org.springframework.data.annotation.Transient;
......@@ -157,11 +159,7 @@ public class SDFile extends EntityMongo implements Serializable {
}
}
......@@ -8,7 +8,7 @@ import java.util.List;
import java.util.Map;
import java.util.HashMap;
import lombok.Data;
import lombok.*;
import lombok.extern.slf4j.Slf4j;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;
......
......@@ -12,6 +12,7 @@ import java.math.BigInteger;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cache.annotation.CacheEvict;
import cn.ibizlab.core.disk.domain.SDFile;
import cn.ibizlab.core.disk.filter.SDFileSearchContext;
......@@ -35,6 +36,8 @@ public interface ISDFileService{
void saveBatch(List<SDFile> list) ;
Page<SDFile> searchDefault(SDFileSearchContext context) ;
List<SDFile> getSdfileByIds(List<String> ids) ;
List<SDFile> getSdfileByEntities(List<SDFile> entities) ;
}
......
......@@ -35,7 +35,7 @@ import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.BasicQuery;
import org.springframework.data.mongodb.core.query.Query;
import javax.annotation.Resource;
import com.mongodb.QueryBuilder;
/**
* 实体[文件] 服务对象接口实现
*/
......@@ -141,7 +141,34 @@ public class SDFileServiceImpl implements ISDFileService {
return new PageImpl<SDFile>(list,context.getPageable(),total);
}
@Override
public List<SDFile> getSdfileByIds(List<String> ids) {
QueryBuilder permissionCond=new QueryBuilder();
permissionCond.and("id").in(ids);
Query query = new BasicQuery(permissionCond.get().toString());
return mongoTemplate.find(query,SDFile.class);
}
@Override
public List<SDFile> getSdfileByEntities(List<SDFile> entities) {
List ids =new ArrayList();
for(SDFile entity : entities){
Serializable id=entity.getId();
if(!ObjectUtils.isEmpty(id)){
ids.add(id);
}
}
if(ids.size()>0){
QueryBuilder permissionCond=new QueryBuilder();
permissionCond.and("id").in(ids);
Query query = new BasicQuery(permissionCond.get().toString());
return mongoTemplate.find(query,SDFile.class);
}
else
return entities;
}
}
......
......@@ -56,6 +56,7 @@
<column name="FONTSIZE" type="VARCHAR2(10 BYTE)"/>
<column name="LANG" type="VARCHAR2(100 BYTE)"/>
<column name="MEMO" type="VARCHAR2(500 BYTE)"/>
<column name="SUPERUSER" type="INTEGER"/>
</createTable>
</changeSet>
<changeSet author="Think (generated)" id="1561433044682-3">
......@@ -65,6 +66,7 @@
<column name="USERNAME" value="系统管理员"/>
<column name="USERCODE" value="0100"/>
<column name="LOGINNAME" value="ibzadmin"/>
<column name="SUPERUSER" value="1"/>
<column name="PASSWORD" value="123456"/>
<column name="DOMAINS" value="100000"/>
<column name="MDEPTID"/>
......
......@@ -5,7 +5,6 @@
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<include file="changelog/20190625112530_init_ibizsys.xml" relativeToChangelogFile="true"/>
<include file="changelog/20190817112530_init_ibizsys_audit.xml" relativeToChangelogFile="true"/>
<include file="h2_table.xml" relativeToChangelogFile="true"/>
<include file="view.xml" relativeToChangelogFile="true"/>
......
!!!!模版产生代码错误:----
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: ${dbinst.getUserName()} [in template "CODETEMPL_zh_CN" at line 17, column 24]
----
\ No newline at end of file
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
</databaseChangeLog>
{
"systemid":"ibzdisk",
"unires":[
],
"entities":[
{
"dename":"SDFile",
"delogicname":"文件",
"sysmoudle":{"id":"DISK","name":"disk"},
"dedataset":[{"id":"Default" , "name":"DEFAULT"}],
"deaction":[{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" }],
"datascope":[{"id":"all","name":"全部数据"}, {"id":"createman","name":"创建人"}]
}
],
"appmenus":[
{
"appid":"web",
"appname":"存储",
"appmenu":[{"menuid":"SDIndexView", "menuname":"SDIndexView", "menuitem":[{ "id":"menuitem1" , "name":"文件" }] }]
}
]
}
......@@ -46,9 +46,6 @@
<!-- Security -->
<spring-cloud-security.version>2.1.1.RELEASE</spring-cloud-security.version>
<!-- Activity -->
<activiti.version>7.1.0.M2</activiti.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<!--logstash-logback-encoder-->
<logstash.version>5.2</logstash.version>
......@@ -63,7 +60,10 @@
<jsonwebtoken-jjwt.version>0.9.1</jsonwebtoken-jjwt.version>
<!--Liquibase数据库版本更新工具-->
<liquibase.version>3.6.3</liquibase.version>
<liquibase.version>3.8.7</liquibase.version>
<!--H2内存数据库-->
<h2.version>1.4.200</h2.version>
<!--caffeine缓存-->
<caffeine-cache.version>2.6.0</caffeine-cache.version>
......@@ -71,6 +71,9 @@
<!--反序列化工具-->
<kryo.version>4.0.2</kryo.version>
<!--httpClient -->
<openfeign-httpclient.version>11.0</openfeign-httpclient.version>
</properties>
<dependencyManagement>
......@@ -124,6 +127,13 @@
<version>${liquibase.version}</version>
</dependency>
<!-- H2 -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
<!-- Swagger2 -->
<dependency>
<groupId>io.springfox</groupId>
......@@ -170,23 +180,6 @@
<version>${drools-version}</version>
</dependency>
<!-- Activiti -->
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter</artifactId>
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-json-converter</artifactId>
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-image-generator</artifactId>
<version>${activiti.version}</version>
</dependency>
<!-- Error -->
<!-- Security -->
......@@ -250,6 +243,11 @@
<version>${kryo.version}</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-httpclient</artifactId>
<version>${openfeign-httpclient.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
......@@ -304,6 +302,12 @@
<artifactId>druid-spring-boot-starter</artifactId>
</dependency>
<!-- H2内存库 -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<!-- Error -->
<!-- Security -->
......
......@@ -13,4 +13,5 @@ services:
networks:
agent_network:
driver: overlay
attachable: true
\ No newline at end of file
attachable: true
......@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
@Profile("api-prod")
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
......@@ -39,6 +40,21 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
AuthorizationTokenFilter authenticationTokenFilter;
@Value("${ibiz.auth.path:v7/login}")
private String loginPath;
@Value("${ibiz.auth.logoutpath:v7/logout}")
private String logoutPath;
@Value("${ibiz.file.uploadpath:ibizutil/upload}")
private String uploadpath;
@Value("${ibiz.file.downloadpath:ibizutil/download}")
private String downloadpath;
@Value("${ibiz.file.previewpath:ibizutil/preview}")
private String previewpath;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
......@@ -66,13 +82,16 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
httpSecurity
// 禁用 CSRF
.csrf().disable()
// 授权异常
.exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
// 不创建会话
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
// 过滤请求
.authorizeRequests()
.antMatchers(
......@@ -87,15 +106,21 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
"/**/fonts/**",
"/**/js/**",
"/**/img/**",
"/",
"/webjars/**",
"/swagger-resources/**",
"/v2/**"
"/"
).permitAll()
// 服务中暂时只为重构用户身份,不进行身份认证
.anyRequest().permitAll()
//放行登录请求
.antMatchers( HttpMethod.POST,"/"+loginPath).permitAll()
//放行注销请求
.antMatchers( HttpMethod.GET,"/"+logoutPath).permitAll()
// 文件操作
.antMatchers("/"+downloadpath+"/**").permitAll()
.antMatchers("/"+uploadpath).permitAll()
.antMatchers("/"+previewpath+"/**").permitAll()
// 所有请求都需要认证
.anyRequest().authenticated()
// 防止iframe 造成跨域
.and().headers().frameOptions().disable();
httpSecurity
.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
}
......
......@@ -6,6 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.mybatis.spring.annotation.MapperScan;
......@@ -18,12 +19,19 @@ import java.util.List;
@EnableDiscoveryClient
@Configuration
@EnableTransactionManagement
@ComponentScan(basePackages = {"cn.ibizlab"})
@ComponentScan(basePackages = {"cn.ibizlab"}
// ,excludeFilters={
// @ComponentScan.Filter(type= org.springframework.context.annotation.FilterType.REGEX,pattern="cn.ibizlab.api.rest.xxx"),
// }
)
@EnableMongoRepositories(basePackages = {"cn.ibizlab"})
@MapperScan("cn.ibizlab.*.mapper")
@SpringBootApplication(exclude = {
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class,
})
@Import({
org.springframework.cloud.openfeign.FeignClientsConfiguration.class
})
@EnableFeignClients(basePackages = {"cn.ibizlab" })
public class ibzdiskapiApplication extends WebMvcConfigurerAdapter{
......
......@@ -6,10 +6,8 @@ import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.ServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
......@@ -24,21 +22,17 @@ import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PostAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import cn.ibizlab.api.dto.*;
import cn.ibizlab.api.mapping.*;
import cn.ibizlab.core.disk.domain.SDFile;
import cn.ibizlab.core.disk.service.ISDFileService;
import cn.ibizlab.core.disk.filter.SDFileSearchContext;
@Slf4j
@Api(tags = {"SDFile" })
@RestController("api-sdfile")
......@@ -46,28 +40,25 @@ import cn.ibizlab.core.disk.filter.SDFileSearchContext;
public class SDFileResource {
@Autowired
private ISDFileService sdfileService;
public ISDFileService sdfileService;
@Autowired
@Lazy
private SDFileMapping sdfileMapping;
public SDFileMapping sdfileMapping;
@PreAuthorize("hasPermission(#sdfile_id,'Update',{this.getEntity(),'NoSQL'})")
@PreAuthorize("hasPermission(this.sdfileService.get(#sdfile_id),'ibzdisk-SDFile-Update')")
@ApiOperation(value = "Update", tags = {"SDFile" }, notes = "Update")
@RequestMapping(method = RequestMethod.PUT, value = "/sdfiles/{sdfile_id}")
@Transactional
public ResponseEntity<SDFileDTO> update(@PathVariable("sdfile_id") String sdfile_id, @RequestBody SDFileDTO sdfiledto) {
SDFile domain = sdfileMapping.toDomain(sdfiledto);
domain.setId(sdfile_id);
sdfileService.update(domain);
SDFileDTO dto = sdfileMapping.toDto(domain);
SDFile domain = sdfileMapping.toDomain(sdfiledto);
domain .setId(sdfile_id);
sdfileService.update(domain );
SDFileDTO dto = sdfileMapping.toDto(domain );
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission(#sdfile_id,'Update',{this.getEntity(),'NoSQL'})")
@PreAuthorize("hasPermission(this.sdfileService.getSdfileByEntities(this.sdfileMapping.toDomain(#sdfiledtos)),'ibzdisk-SDFile-Update')")
@ApiOperation(value = "UpdateBatch", tags = {"SDFile" }, notes = "UpdateBatch")
@RequestMapping(method = RequestMethod.PUT, value = "/sdfiles/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<SDFileDTO> sdfiledtos) {
......@@ -75,10 +66,7 @@ public class SDFileResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasPermission('','Create',{this.getEntity(),'NoSQL'})")
@PreAuthorize("hasPermission(this.sdfileMapping.toDomain(#sdfiledto),'ibzdisk-SDFile-Create')")
@ApiOperation(value = "Create", tags = {"SDFile" }, notes = "Create")
@RequestMapping(method = RequestMethod.POST, value = "/sdfiles")
@Transactional
......@@ -89,7 +77,7 @@ public class SDFileResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('','Create',{this.getEntity(),'NoSQL'})")
@PreAuthorize("hasPermission(this.sdfileMapping.toDomain(#sdfiledtos),'ibzdisk-SDFile-Create')")
@ApiOperation(value = "createBatch", tags = {"SDFile" }, notes = "createBatch")
@RequestMapping(method = RequestMethod.POST, value = "/sdfiles/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<SDFileDTO> sdfiledtos) {
......@@ -97,28 +85,19 @@ public class SDFileResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "CheckKey", tags = {"SDFile" }, notes = "CheckKey")
@RequestMapping(method = RequestMethod.POST, value = "/sdfiles/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody SDFileDTO sdfiledto) {
return ResponseEntity.status(HttpStatus.OK).body(sdfileService.checkKey(sdfileMapping.toDomain(sdfiledto)));
}
@ApiOperation(value = "GetDraft", tags = {"SDFile" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/sdfiles/getdraft")
public ResponseEntity<SDFileDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(sdfileMapping.toDto(sdfileService.getDraft(new SDFile())));
}
@PreAuthorize("hasPermission(#sdfile_id,'Get',{this.getEntity(),'NoSQL'})")
@PostAuthorize("hasPermission(this.sdfileMapping.toDomain(returnObject.body),'ibzdisk-SDFile-Get')")
@ApiOperation(value = "Get", tags = {"SDFile" }, notes = "Get")
@RequestMapping(method = RequestMethod.GET, value = "/sdfiles/{sdfile_id}")
public ResponseEntity<SDFileDTO> get(@PathVariable("sdfile_id") String sdfile_id) {
......@@ -127,10 +106,7 @@ public class SDFileResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Remove',{#sdfile_id,{this.getEntity(),'NoSQL'}})")
@PreAuthorize("hasPermission(this.sdfileService.get(#sdfile_id),'ibzdisk-SDFile-Remove')")
@ApiOperation(value = "Remove", tags = {"SDFile" }, notes = "Remove")
@RequestMapping(method = RequestMethod.DELETE, value = "/sdfiles/{sdfile_id}")
@Transactional
......@@ -138,6 +114,7 @@ public class SDFileResource {
return ResponseEntity.status(HttpStatus.OK).body(sdfileService.remove(sdfile_id));
}
@PreAuthorize("hasPermission(this.sdfileService.getSdfileByIds(#ids),'ibzdisk-SDFile-Remove')")
@ApiOperation(value = "RemoveBatch", tags = {"SDFile" }, notes = "RemoveBatch")
@RequestMapping(method = RequestMethod.DELETE, value = "/sdfiles/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
......@@ -145,15 +122,14 @@ public class SDFileResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasPermission(this.sdfileMapping.toDomain(#sdfiledto),'ibzdisk-SDFile-Save')")
@ApiOperation(value = "Save", tags = {"SDFile" }, notes = "Save")
@RequestMapping(method = RequestMethod.POST, value = "/sdfiles/save")
public ResponseEntity<Boolean> save(@RequestBody SDFileDTO sdfiledto) {
return ResponseEntity.status(HttpStatus.OK).body(sdfileService.save(sdfileMapping.toDomain(sdfiledto)));
}
@PreAuthorize("hasPermission(this.sdfileMapping.toDomain(#sdfiledtos),'ibzdisk-SDFile-Save')")
@ApiOperation(value = "SaveBatch", tags = {"SDFile" }, notes = "SaveBatch")
@RequestMapping(method = RequestMethod.POST, value = "/sdfiles/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<SDFileDTO> sdfiledtos) {
......@@ -161,7 +137,7 @@ public class SDFileResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasPermission('Get',{#context,'Default',this.getEntity(),'NoSQL'})")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdisk-SDFile-Default-all')")
@ApiOperation(value = "fetchDEFAULT", tags = {"SDFile" } ,notes = "fetchDEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/sdfiles/fetchdefault")
public ResponseEntity<List<SDFileDTO>> fetchDefault(SDFileSearchContext context) {
......@@ -174,22 +150,13 @@ public class SDFileResource {
.body(list);
}
@PreAuthorize("hasPermission('Get',{#context,'Default',this.getEntity(),'NoSQL'})")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdisk-SDFile-Default-all')")
@ApiOperation(value = "searchDEFAULT", tags = {"SDFile" } ,notes = "searchDEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/sdfiles/searchdefault")
public ResponseEntity<Page<SDFileDTO>> searchDefault(SDFileSearchContext context) {
@RequestMapping(method= RequestMethod.POST , value="/sdfiles/searchdefault")
public ResponseEntity<Page<SDFileDTO>> searchDefault(@RequestBody SDFileSearchContext context) {
Page<SDFile> domains = sdfileService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(sdfileMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
/**
* 用户权限校验
* @return
*/
public SDFile getEntity(){
return new SDFile();
}
}
......@@ -85,5 +85,10 @@
<artifactId>springfox-swagger-ui</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-httpclient</artifactId>
</dependency>
</dependencies>
</project>
......@@ -32,11 +32,11 @@ public class DEFieldDefaultValueAspect
* @param point
* @throws Exception
*/
@Before(value = "execution(* com.cntmtech.support.core.*.service.*.create(..))")
@Before(value = "execution(* cn.ibizlab.core.*.service.*.create(..))")
public void BeforeCreate(JoinPoint point) throws Exception {
fillDEFieldDefaultValue(point);
}
@Before(value = "execution(* com.cntmtech.support.core.*.service.*.createBatch(..))")
@Before(value = "execution(* cn.ibizlab.core.*.service.*.createBatch(..))")
public void BeforeCreateBatch(JoinPoint point) throws Exception {
fillDEFieldDefaultValue(point);
}
......@@ -46,11 +46,11 @@ public class DEFieldDefaultValueAspect
* @param point
* @throws Exception
*/
@Before(value = "execution(* com.cntmtech.support.core.*.service.*.update(..))")
@Before(value = "execution(* cn.ibizlab.core.*.service.*.update(..))")
public void BeforeUpdate(JoinPoint point) throws Exception {
fillDEFieldDefaultValue(point);
}
@Before(value = "execution(* com.cntmtech.support.core.*.service.*.updateBatch(..))")
@Before(value = "execution(* cn.ibizlab.core.*.service.*.updateBatch(..))")
public void BeforeUpdateBatch(JoinPoint point) throws Exception {
fillDEFieldDefaultValue(point);
}
......@@ -60,11 +60,11 @@ public class DEFieldDefaultValueAspect
* @param point
* @throws Exception
*/
@Before(value = "execution(* com.cntmtech.support.core.*.service.*.save(..))")
@Before(value = "execution(* cn.ibizlab.core.*.service.*.save(..))")
public void BeforeSave(JoinPoint point) throws Exception {
fillDEFieldDefaultValue(point);
}
@Before(value = "execution(* com.cntmtech.support.core.*.service.*.saveBatch(..))")
@Before(value = "execution(* cn.ibizlab.core.*.service.*.saveBatch(..))")
public void BeforeSaveBatch(JoinPoint point) throws Exception {
fillDEFieldDefaultValue(point);
}
......
......@@ -4,7 +4,7 @@ import com.github.benmanes.caffeine.cache.CaffeineSpec;
import cn.ibizlab.util.cache.cacheManager.CaffeineCacheManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.cache.CacheProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
......@@ -19,7 +19,7 @@ import org.springframework.util.StringUtils;
@EnableCaching
@Configuration
@EnableConfigurationProperties(CacheProperties.class)
@ConditionalOnProperty("ibiz.enableCaffeineCache")
@ConditionalOnExpression("'${ibiz.cacheLevel:None}'.equals('L1')")
public class CaffeineCacheConfig {
@Autowired
......
......@@ -11,7 +11,7 @@ import cn.ibizlab.util.cache.redis.StringRedisSerializer;
import cn.ibizlab.util.enums.RedisChannelTopic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.cache.CacheProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
......@@ -36,7 +36,7 @@ import org.springframework.util.StringUtils;
@EnableCaching
@Configuration
@EnableConfigurationProperties(CacheProperties.class)
@ConditionalOnProperty("ibiz.enableRedisCache")
@ConditionalOnExpression("'${ibiz.cacheLevel:None}'.equals('L2')")
public class RedisCacheConfig {
@Autowired
......
......@@ -3,7 +3,7 @@ package cn.ibizlab.util.cache.cacheManager;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.CaffeineSpec;
import lombok.Data;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.caffeine.CaffeineCache;
......@@ -22,7 +22,7 @@ import java.util.concurrent.TimeUnit;
*/
@Data
@Component
@ConditionalOnProperty("ibiz.enableCaffeineCache")
@ConditionalOnExpression("'${ibiz.cacheLevel:None}'.equals('L1')")
public class CaffeineCacheManager implements CacheManager {
private static final int DEFAULT_EXPIRE_AFTER_WRITE = 1;
......
......@@ -5,7 +5,7 @@ import com.github.benmanes.caffeine.cache.CaffeineSpec;
import lombok.Data;
import cn.ibizlab.util.cache.cache.LayeringCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.data.redis.cache.RedisCacheConfiguration;
......@@ -27,7 +27,7 @@ import java.util.concurrent.TimeUnit;
*/
@Data
@Component
@ConditionalOnProperty("ibiz.enableRedisCache")
@ConditionalOnExpression("'${ibiz.cacheLevel:None}'.equals('L2')")
public class LayeringCacheManager implements CacheManager {
private static final int DEFAULT_EXPIRE_AFTER_WRITE = 1;
......
......@@ -5,7 +5,7 @@ import cn.ibizlab.util.enums.RedisChannelTopic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.data.redis.connection.Message;
......@@ -22,7 +22,7 @@ import java.util.Map;
*/
@Component
@ConditionalOnProperty("ibiz.enableRedisCache")
@ConditionalOnExpression("'${ibiz.cacheLevel:None}'.equals('L2')")
public class RedisMessageListener extends MessageListenerAdapter {
private static final Logger logger = LoggerFactory.getLogger(RedisPublisher.class);
@Autowired
......
......@@ -3,13 +3,13 @@ package cn.ibizlab.util.client;
import cn.ibizlab.util.security.AuthenticationUser;
import cn.ibizlab.util.security.AuthorizationLogin;
import org.springframework.stereotype.Component;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
@Component
public class IBZUAAFallback implements IBZUAAFeignClient {
@Override
public Map<String, Object> pushSystemPermissionData(Map<String, Object> systemPermissionData, String systemId) {
public Boolean syncSysAuthority(JSONObject system) {
return null;
}
......
......@@ -4,19 +4,18 @@ import cn.ibizlab.util.security.AuthenticationUser;
import cn.ibizlab.util.security.AuthorizationLogin;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
@FeignClient(value = "ibzuaa-api",fallback = IBZUAAFallback.class)
public interface IBZUAAFeignClient
{
/**
* 推送系统权限数据到uaa
* @param systemPermissionData
* @param systemId
* 同步系统资源到uaa
* @param system 系统资源信息
* @return
*/
@PostMapping("/uaa/permission/save")
Map<String,Object> pushSystemPermissionData(@RequestBody Map<String, Object> systemPermissionData, @RequestParam("systemid") String systemId);
@PostMapping("/syspssystems/save")
Boolean syncSysAuthority(@RequestBody JSONObject system);
/**
* 用户登录
......
......@@ -111,4 +111,6 @@ public class IBZUSER implements Serializable{
@Size(min = 0, max = 500, message = "[备注]长度必须在[500]以内!")
private String memo;
private int superuser;
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ package cn.ibizlab.util.filter;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.mongodb.QueryBuilder;
import lombok.Data;
import lombok.*;
import lombok.extern.slf4j.Slf4j;
@Slf4j
......
......@@ -5,7 +5,7 @@ import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Sort;
import org.springframework.util.ObjectUtils;
......
......@@ -4,9 +4,10 @@ import cn.ibizlab.util.security.AuthenticationUser;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.PageRequest;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.util.StringUtils;
......@@ -54,6 +55,7 @@ public class SearchContextBase implements ISearchContext{
/**
* 排序对象
*/
@JsonIgnore
public Sort pageSort;
/**
* 工作流步骤标识
......
......@@ -183,7 +183,7 @@ public class DEFieldCacheMap {
Field field = DEFieldCacheMap.getField(clazz,fieldname);
if(field!=null) {
DEField deField=field.getAnnotation(DEField.class);
if(deField!=null&&deField.name()!=null)
if(deField!=null&& !StringUtils.isEmpty(deField.name()))
return deField.name();
}
return fieldname;
......
package cn.ibizlab.util.job;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import cn.ibizlab.util.client.IBZUAAFeignClient;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
import java.io.IOException;
/**
* 权限:向uaa同步当前系统菜单、权限资源任务类
*/
//@Component //开启此类需要保证Main中开启了feign :EnableFeignClients
@Slf4j
@Component
@ConditionalOnProperty( name = "ibiz.enablePermissionValid", havingValue = "true")
public class PermissionSyncJob implements ApplicationRunner {
private Log log = LogFactory.getLog(PermissionSyncJob.class);
@Autowired
@Lazy
private IBZUAAFeignClient client;
@Value("${ibiz.enablePermissionValid:false}")
boolean enablePermissionValid; //是否开启权限校验
@Value("${ibiz.systemid:ibzdisk}")
private String systemId;
@Override
public void run(ApplicationArguments args) {
if(enablePermissionValid){
try {
InputStream permission= this.getClass().getResourceAsStream("/deprivs/DEPrivs.json"); //获取当前系统所有实体资源能力
String permissionResult = IOUtils.toString(permission,"UTF-8");
JSONObject jsonNodePermission = JSONObject.parseObject(permissionResult);
Map<String,Object> map=new HashMap<>();
map.put("permission",jsonNodePermission);
client.pushSystemPermissionData(map,systemId);
}
catch (Exception ex) {
log.error(String.format("向UAA同步数据发生错误,请检查UAA服务是否正常! [%s]",ex));
try {
Thread.sleep(10000);
InputStream permission= this.getClass().getResourceAsStream("/permission/systemResource.json"); //获取当前系统所有实体资源能力
String permissionResult = IOUtils.toString(permission,"UTF-8");
JSONObject system= new JSONObject();
system.put("pssystemid",systemId);
system.put("pssystemname",systemId);
system.put("sysstructure",JSONObject.parseObject(permissionResult));
if(client.syncSysAuthority(system)){
log.info("向[UAA]同步系统资源成功");
}else{
log.error("向[UAA]同步系统资源失败");
}
}
catch (Exception ex) {
log.error(String.format("向[UAA]同步系统资源失败,请检查[UAA]服务是否正常! [%s]",ex));
}
}
}
\ No newline at end of file
package cn.ibizlab.util.rest;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import cn.ibizlab.util.security.AuthenticationUser;
import cn.ibizlab.util.service.AuthenticationUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ObjectUtils;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Value;
import cn.ibizlab.util.security.AuthenticationUser;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
@RestController
@RequestMapping(value = "")
......@@ -18,19 +23,38 @@ public class AppController {
@Value("${ibiz.enablePermissionValid:false}")
boolean enablePermissionValid; //是否开启权限校验
@Autowired
private AuthenticationUserService userDetailsService;
@RequestMapping(method = RequestMethod.GET, value = "/appdata")
public ResponseEntity<JSONObject> getAppData() {
JSONObject appData = new JSONObject() ;
JSONArray uniRes=new JSONArray();
Set<String> appMenu = new HashSet();
Set<String> uniRes = new HashSet();
if(enablePermissionValid){
JSONObject userPermission=AuthenticationUser.getAuthenticationUser().getPermissionList();
if(!ObjectUtils.isEmpty(userPermission)){
uniRes = userPermission.getJSONArray("unires");
}
Collection<GrantedAuthority> authorities=AuthenticationUser.getAuthenticationUser().getAuthorities();
Iterator it = authorities.iterator();
while(it.hasNext()) {
GrantedAuthority authority = (GrantedAuthority)it.next();
String strAuthority=authority.getAuthority();
if(strAuthority.startsWith("UNIRES"))
uniRes.add(strAuthority);
else if(strAuthority.startsWith("APPMENU"))
appMenu.add(strAuthority);
}
}
appData.put("unires",uniRes);
appData.put("appmenu",appMenu);
appData.put("enablepermissionvalid",enablePermissionValid);
return ResponseEntity.status(HttpStatus.OK).body(appData);
}
@RequestMapping(method = RequestMethod.GET, value = "${ibiz.auth.logoutpath:v7/logout}")
public void logout() {
if(AuthenticationUser.getAuthenticationUser()!=null){
userDetailsService.resetByUsername(AuthenticationUser.getAuthenticationUser().getUsername());
}
}
}
package cn.ibizlab.util.security;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mongodb.QueryBuilder;
import cn.ibizlab.util.annotation.DEField;
import cn.ibizlab.util.domain.EntityBase;
import cn.ibizlab.util.enums.DEPredefinedFieldType;
import cn.ibizlab.util.filter.QueryBuildContext;
import cn.ibizlab.util.filter.QueryWrapperContext;
import cn.ibizlab.util.helper.DEFieldCacheMap;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.BasicQuery;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.security.access.PermissionEvaluator;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.*;
/**
......@@ -36,322 +23,90 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
@Value("${ibiz.enablePermissionValid:false}")
boolean enablePermissionValid; //是否开启权限校验
/**
* 实体行为操作标识
*/
private String DEActionType="DEACTION";
/**
* 实体数据集操作标识
*/
private String DataSetTag="DATASET";
/**
*实体主键标识
*/
private String keyFieldTag="keyfield";
@Resource
@Lazy
private MongoTemplate mongoTemplate;
/**
* 表格权限检查 :用于检查当前用户是否拥有表格数据的读取、删除权限
*
* 实体行为鉴权
* @param authentication
* @param deAction 表格行为,如:[READ,DELETE]
* @param gridParam 表格参数,如:当前表格所处实体(EntityName)、表格删除的数据主键(srfkeys)
* @return true/false true则允许当前行为,false拒绝行为
* @param entity
* @param action
* @return
*/
@Override
public boolean hasPermission(Authentication authentication, Object deAction, Object gridParam) {
public boolean hasPermission(Authentication authentication, Object entity, Object action) {
//未开启权限校验、超级管理员则不进行权限检查
if(AuthenticationUser.getAuthenticationUser().getSuperuser()==1 || !enablePermissionValid)
return true;
String action = "";
String deStorageMode;
if (deAction instanceof String)
action = (String) deAction;
if (StringUtils.isEmpty(action))
String strAction=String.valueOf(action);
Set<String> userAuthorities = getAuthorities(authentication,strAction);
if(userAuthorities.size()==0)
return false;
//获取当前用户权限列表
JSONObject userPermission= AuthenticationUser.getAuthenticationUser().getPermissionList();
if(userPermission==null)
return false;
List gridParamList = (ArrayList) gridParam;
if(action.equalsIgnoreCase("remove")){
//准备参数
Object srfKey =gridParamList.get(0);
EntityBase entity = (EntityBase) gridParamList.get(1);
deStorageMode= (String) gridParamList.get(2);
String entityName = entity.getClass().getSimpleName();
//获取实体行为权限信息
JSONObject permissionList=userPermission.getJSONObject("entities");
//检查是否有操作权限[create.update.delete.read]
if(!validDEActionHasPermission(permissionList,entityName,action)){
return false;
}
//检查是否有数据权限
return deActionPermissionValidRouter(deStorageMode, entity , action , srfKey, permissionList);
}
else{
//准备参数
Object searchContext=gridParamList.get(0);
String dataSetName=String.valueOf(gridParamList.get(1));
EntityBase entity = (EntityBase) gridParamList.get(2);
deStorageMode= (String) gridParamList.get(3);
String entityName = entity.getClass().getSimpleName();
//获取数据集权限信息
JSONObject permissionList=userPermission.getJSONObject("entities");
if(StringUtils.isEmpty(entityName)|| StringUtils.isEmpty(dataSetName))
return false;
//检查是否有访问数据集的权限
if(!validDataSetHasPermission(permissionList,entityName,dataSetName)){
return false;
}
}
return true;
}
/**
* 表单权限检查 :用于检查当前用户是否拥有表单的新建、编辑、删除权限
*
* @param authentication
* @param srfKey 当前操作数据的主键
* @param action 当前操作行为:如:[READ、UPDATE、DELETE]
* @param formParam 表单参数对象
* @return true/false true则允许当前行为,false拒绝行为
*/
@Override
public boolean hasPermission(Authentication authentication, Serializable srfKey, String action, Object formParam) {
//未开启权限校验、超级管理员则不进行权限检查
if(AuthenticationUser.getAuthenticationUser().getSuperuser()==1 || !enablePermissionValid)
//拥有全部数据访问权限时,则跳过权限检查
if(isAllData(strAction,userAuthorities)){
return true;
List formParamList = (ArrayList) formParam;
EntityBase entity = (EntityBase) formParamList.get(0);
String deStorageMode= (String) formParamList.get(1);
if (StringUtils.isEmpty(entity))
return false;
JSONObject userPermission= AuthenticationUser.getAuthenticationUser().getPermissionList();
JSONObject permissionList=userPermission.getJSONObject("entities");
String entityName = entity.getClass().getSimpleName();
if(action.equalsIgnoreCase("create")){
return validDEActionHasPermission(permissionList,entityName,action);
}
else{
//拥有全部数据访问权限时,则跳过权限检查
if(isAllData(permissionList,entityName,action)){
return true;
}
//检查是否有操作权限[create.update.delete.read]
if(!validDEActionHasPermission(permissionList,entityName,action)){
return false;
if(entity instanceof ArrayList){
List<EntityBase> entities= (List<EntityBase>) entity;
for(EntityBase entityBase: entities){
boolean result=actionValid(entityBase, strAction ,userAuthorities);
if(!result){
return false;
}
}
//检查是否有数据权限
return deActionPermissionValidRouter(deStorageMode, entity , action , srfKey, permissionList);
}
}
/**
* 是否为全部数据
* @param permissionList
* @param entityName
* @param action
* @return
*/
private boolean isAllData(JSONObject permissionList, String entityName, String action) {
if(permissionList==null)
return false;
if(!permissionList.containsKey(entityName))
return false;
JSONObject entity=permissionList.getJSONObject(entityName);
if(entity.containsKey(action) && entity.getJSONArray(action).contains("ALL"))
return true;
return false;
}
/**
* 实体行为权限校验
* @param userPermission
* @param entityName
* @param action
* userPermission:{"ENTITY":{"DEACTION":{"READ":["CURORG"]},"DATASET":{"Default":["CURORG"]}}}
* @return
*/
private boolean validDEActionHasPermission(JSONObject userPermission,String entityName , String action ){
boolean hasPermission=false;
if(userPermission==null)
return false;
if(!userPermission.containsKey(entityName))
return false;
JSONObject entity=userPermission.getJSONObject(entityName);//获取实体
if(!entity.containsKey(DEActionType))
return false;
JSONObject dataRange=entity.getJSONObject(DEActionType);//获取实体行为对应的数据范围
if(dataRange.containsKey(action)){
hasPermission=true;
else{
EntityBase entityBase= (EntityBase) entity;
return actionValid(entityBase , strAction ,userAuthorities);
}
return hasPermission;
return true;
}
/**
* 数据集合权限校验
* @param userPermission
* @param entityName
* @param dataSetName
* userPermission:{"ENTITY":{"DEACTION":{"READ":["CURORG"]},"DATASET":{"Default":["CURORG"]}}}
* @return
*/
private boolean validDataSetHasPermission(JSONObject userPermission,String entityName ,String dataSetName){
boolean hasPermission=false;
if(userPermission==null)
return false;
if(!userPermission.containsKey(entityName))
return false;
JSONObject entity=userPermission.getJSONObject(entityName);//获取实体
if(!entity.containsKey(DataSetTag))
return false;
JSONObject dataSetList=entity.getJSONObject(DataSetTag);//获取数据集
if(!dataSetList.containsKey(dataSetName))
return false;
JSONArray dataRange=dataSetList.getJSONArray(dataSetName);//获取数据范围
if(dataRange!=null && dataRange.size()>0){
hasPermission=true;
}
return hasPermission;
@Override
public boolean hasPermission(Authentication authentication, Serializable id, String action, Object params) {
return true;
}
/**
* 根据实体存储模式,进行鉴权
* @param deStorageMode
* @param entity
* 获取用户权限资源
* @param authentication
* @param action
* @param srfKey
* @param permissionList
* @return
*/
private boolean deActionPermissionValidRouter(String deStorageMode, EntityBase entity , String action , Object srfKey , JSONObject permissionList){
if(deStorageMode.equalsIgnoreCase("sql")){
return sqlPermissionValid(entity , action , srfKey, permissionList);
}
else if(deStorageMode.equalsIgnoreCase("nosql")){
return noSqlPermissionValid(entity , action , srfKey, permissionList);
}
else if(deStorageMode.equalsIgnoreCase("serviceapi")){
return true;
}
else {
throw new RuntimeException(String.format("未能识别[%s]实体对应存储模式[%s]",entity.getClass().getSimpleName(),deStorageMode));
private Set<String> getAuthorities(Authentication authentication , String action){
Collection authorities=authentication.getAuthorities();
Set<String> userAuthorities = new HashSet();
Iterator it = authorities.iterator();
while(it.hasNext()) {
GrantedAuthority authority = (GrantedAuthority)it.next();
if(authority.getAuthority().contains(action))
userAuthorities.add(authority.getAuthority());
}
return userAuthorities;
}
/**
* sql存储模式实体行为鉴权
* @param entity
* 是否为全部数据
* @param action
* @param srfKey
* @param permissionList
* @param entityDataRange
* @return
*/
private boolean sqlPermissionValid(EntityBase entity , String action , Object srfKey, JSONObject permissionList){
String entityName=entity.getClass().getSimpleName();
ServiceImpl service= SpringContextHolder.getBean(String.format("%s%s",entityName,"ServiceImpl"));//获取实体service对象
Map<String,String> permissionField=getPermissionField(entity);//获取组织、部门预置属性
String keyField=permissionField.get(keyFieldTag);
if(StringUtils.isEmpty(keyField)){
throw new RuntimeException("权限校验失败,请检查当前实体中是否已经配置主键属性!");
}
//获取权限表达式[全部数据、本单位、本部门等]
JSONObject entityObj=permissionList.getJSONObject(entity.getClass().getSimpleName());//获取实体
JSONObject permissionType= entityObj.getJSONObject(DEActionType);
JSONArray opprivList=permissionType.getJSONArray(action);//行为:read;insert...
if(opprivList.size()==0)
return false;
//通过权限表达式来获取sql
String tempPermissionSQL=getPermissionSQL(entity,opprivList);
String permissionSQL= String.format(" (%s) AND (%s='%s')",tempPermissionSQL,keyField,srfKey); //拼接权限条件-编辑
//执行sql进行权限检查
QueryWrapper permissionWrapper=getPermissionWrapper(permissionSQL);//构造权限条件
List list=service.list(permissionWrapper);
if(list.size()>0){
return true;
}else{
return false;
private boolean isAllData(String action , Set<String> entityDataRange) {
for(String dataRange : entityDataRange ){
if(dataRange.endsWith(String.format("%s-all",action))){
return true;
}
}
return false;
}
/**
* NoSQL实体行为鉴权
* 实体行为权限校验
* @param entity
* @param action
* @param srfKey
* @param permissionList
* @param userAuthorities
* @return
*/
private boolean noSqlPermissionValid(EntityBase entity, String action, Object srfKey, JSONObject permissionList) {
Map<String,String> permissionField=getPermissionField(entity);//获取组织、部门预置属性
String keyField=permissionField.get(keyFieldTag);
if(StringUtils.isEmpty(keyField)){
throw new RuntimeException("权限校验失败,请检查当前实体中是否已经配置主键属性!");
}
//获取权限表达式[全部数据、本单位、本部门等]
JSONObject entityObj=permissionList.getJSONObject(entity.getClass().getSimpleName());//获取实体
JSONObject permissionType= entityObj.getJSONObject(DEActionType);
JSONArray dataRange=permissionType.getJSONArray(action);//行为:read;insert...
if(dataRange.size()==0)
return false;
//根据权限表达式填充权限条件
QueryBuilder permissionCond=new QueryBuilder();
fillNoSqlPermissionCond(dataRange,entity,permissionCond);
//权限条件拼接主键
permissionCond.and(keyField).is(srfKey);
//执行权限检查
Query query = new BasicQuery(permissionCond.get().toString());
List list=mongoTemplate.find(query,entity.getClass());
if(list.size()>0){
return true;
}
else{
return false;
}
}
/**
* 为NoSQL存储模式的表格查询填充权限条件
* @param oppriList
* @param entity
* @param permissionSQL
*/
private void fillNoSqlPermissionCond(JSONArray oppriList, EntityBase entity, QueryBuilder permissionSQL){
private boolean actionValid(EntityBase entity, String action , Set<String> userAuthorities){
Map<String,String> permissionField=getPermissionField(entity);//获取组织、部门预置属性
String orgField=permissionField.get("orgfield");
......@@ -364,105 +119,54 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
Set<String> orgDeptParent = userInfo.get("parentdept");
Set<String> orgDeptChild = userInfo.get("subdept");
for(int i=0;i<oppriList.size();i++){
String permissionCond=oppriList.getString(i);//权限配置条件
if(permissionCond.equals("CURORG")){ //本单位
permissionSQL.or(new QueryBuilder().and(orgField).is(AuthenticationUser.getAuthenticationUser().getOrgid()).get());
}
else if(permissionCond.equals("PORG")){//上级单位
permissionSQL.or(new QueryBuilder().and(orgField).in(formatStringArr(orgParent)).get());
}
else if(permissionCond.equals("SORG")){//下级单位
permissionSQL.or(new QueryBuilder().and(orgField).in(formatStringArr(orgChild)).get());
}
else if(permissionCond.equals("CREATEMAN")){//建立人
permissionSQL.or(new QueryBuilder().and(createManField).is(AuthenticationUser.getAuthenticationUser().getUserid()).get());
}
else if(permissionCond.equals("CURORGDEPT")){//本部门
permissionSQL.or(new QueryBuilder().and(orgDeptField).is(AuthenticationUser.getAuthenticationUser().getMdeptid()).get());
}
else if(permissionCond.equals("PORGDEPT")){//上级部门
permissionSQL.or(new QueryBuilder().and(orgDeptField).in(formatStringArr(orgDeptParent)).get());
}
else if(permissionCond.equals("SORGDEPT")){//下级部门
permissionSQL.or(new QueryBuilder().and(orgDeptField).in(formatStringArr(orgDeptChild)).get());
}
else if(permissionCond.equals("ALL")){
permissionSQL.or(new QueryBuilder().get());
}
}
}
Object orgFieldValue=entity.get(orgField);
Object orgDeptFieldValue=entity.get(orgDeptField);
Object crateManFieldValue=entity.get(createManField);
/**
* SQL获取权限条件
* @param entity
* @param oppriList
* @return
*/
private String getPermissionSQL(EntityBase entity, JSONArray oppriList){
Map<String,String> permissionField=getPermissionField(entity);//获取组织、部门预置属性
String nPermissionSQL = "1<>1";
String orgField=permissionField.get("orgfield");
String orgDeptField=permissionField.get("orgsecfield");
String createManField=permissionField.get("createmanfield");
StringBuffer permissionSQL=new StringBuffer();
AuthenticationUser authenticationUser = AuthenticationUser.getAuthenticationUser();
Map<String, Set<String>> userInfo = authenticationUser.getOrgInfo();
Set<String> orgParent = userInfo.get("parentorg");
Set<String> orgChild = userInfo.get("suborg");
Set<String> orgDeptParent = userInfo.get("parentdept");
Set<String> orgDeptChild = userInfo.get("subdept");
Set<String> userOrg = new HashSet<>();
Set<String> userOrgDept = new HashSet<>();
for(int i=0;i<oppriList.size();i++){
permissionSQL.append("OR");
String permissionCond=oppriList.getString(i);//权限配置条件
if(permissionCond.equals("CURORG")){ //本单位
permissionSQL.append(String.format("(%s='%s')",orgField,AuthenticationUser.getAuthenticationUser().getOrgid()));
}
else if(permissionCond.equals("PORG")){//上级单位
permissionSQL.append(String.format(" %s in(%s) ", orgField, formatStringArr(orgParent)));
for(String authority:userAuthorities){
if(authority.endsWith("curorg")){ //本单位
userOrg.add(authenticationUser.getOrgid());
}
else if(permissionCond.equals("SORG")){//下级单位
permissionSQL.append(String.format(" %s in(%s) ", orgField, formatStringArr(orgChild)));
else if(authority.endsWith("porg")){//上级单位
userOrg.addAll(orgParent);
}
else if(permissionCond.equals("CREATEMAN")){//建立人
permissionSQL.append(String.format("(%s='%s')",createManField,AuthenticationUser.getAuthenticationUser().getUserid()));
else if(authority.endsWith("sorg")){//下级单位
userOrg.addAll(orgChild);
}
else if(permissionCond.equals("CURORGDEPT")){//本部门
permissionSQL.append(String.format("(%s='%s')",orgDeptField,AuthenticationUser.getAuthenticationUser().getMdeptid()));
else if(authority.endsWith("curorgdept")){//本部门
userOrgDept.add(authenticationUser.getMdeptid());
}
else if(permissionCond.equals("PORGDEPT")){//上级部门
permissionSQL.append(String.format(" %s in (%s) ", orgDeptField, formatStringArr(orgDeptParent)));
else if(authority.endsWith("porgdept")){//上级部门
userOrgDept.addAll(orgDeptParent);
}
else if(permissionCond.equals("SORGDEPT")){//下级部门
permissionSQL.append(String.format(" %s in (%s) ", orgDeptField, formatStringArr(orgDeptChild)));
}
else if(permissionCond.equals("ALL")){//全部数据
permissionSQL.append("(1=1)");
}
else{
permissionSQL.append(nPermissionSQL);
else if(authority.endsWith("sorgdept")){//下级部门
userOrgDept.addAll(orgDeptChild);
}
}
if(StringUtils.isEmpty(permissionSQL.toString()))
return "";
String resultCond=parseResult(permissionSQL, "OR");
return resultCond;
}
/**
* 构造 wrapper
* @param whereCond
* @return
*/
private QueryWrapper getPermissionWrapper(String whereCond){
if(action.endsWith("Create") || action.endsWith("Save")){
if(!ObjectUtils.isEmpty(orgFieldValue) && !userOrg.contains(orgFieldValue))
return false;
if(!ObjectUtils.isEmpty(orgDeptFieldValue) && !userOrgDept.contains(orgDeptFieldValue))
return false;
if(!ObjectUtils.isEmpty(crateManFieldValue) && !authenticationUser.getUserid().equals(crateManFieldValue))
return false;
QueryWrapper permissionWrapper=new QueryWrapper();
if(!StringUtils.isEmpty(whereCond)){
permissionWrapper.apply(whereCond);
return true;
}
else{
if(!ObjectUtils.isEmpty(orgFieldValue) && userOrg.contains(orgFieldValue))
return true;
if(!ObjectUtils.isEmpty(orgDeptFieldValue) && userOrgDept.contains(orgDeptFieldValue))
return true;
if(!ObjectUtils.isEmpty(crateManFieldValue) && authenticationUser.getUserid().equals(crateManFieldValue))
return true;
return false;
}
return permissionWrapper;
}
/**
......@@ -476,71 +180,24 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
String orgField="orgid"; //组织属性
String orgDeptField="orgsecid"; //部门属性
String createManField="createman"; //创建人属性
String keyField="";//主键属性
DEFieldCacheMap.getFieldMap(entityBase.getClass().getName());
Map <Field, DEField> preFields= SearchDEField(entityBase.getClass().getName()); //从缓存中获取当前类预置属性
Map <String, DEField> preFields= DEFieldCacheMap.getDEFields(entityBase.getClass()); //从缓存中获取当前类预置属性
for (Map.Entry<Field,DEField> entry : preFields.entrySet()){
Field preField=entry.getKey();//获取注解字段
for (Map.Entry<String,DEField> entry : preFields.entrySet()){
String fieldName=entry.getKey();//获取注解字段
DEField fieldAnnotation=entry.getValue();//获取注解值
DEPredefinedFieldType prefieldType=fieldAnnotation.preType();
if(prefieldType==prefieldType.ORGID)//用户配置系统预置属性-组织机构标识
orgField=preField.getName();
orgField=fieldName;
if(prefieldType==prefieldType.ORGSECTORID)//用户配置系统预置属性-部门标识
orgDeptField=preField.getName();
if(fieldAnnotation.isKeyField())//用户配置系统预置属性-部门标识
keyField=preField.getName();
orgDeptField=fieldName;
if(prefieldType==prefieldType.CREATEMAN)//用户配置系统预置属性-部门标识
createManField=fieldName;
}
permissionFiled.put("orgfield",orgField);
permissionFiled.put("orgsecfield",orgDeptField);
permissionFiled.put("createmanfield",createManField);
permissionFiled.put("keyfield",keyField);
return permissionFiled;
}
/**
*获取含有@DEField注解的实体属性
* @param className do对象类名
* @return
*/
private Map <Field, DEField> SearchDEField(String className){
List<Field> fields = DEFieldCacheMap.getFields(className);
Map <Field, DEField> deFieldMap =new HashMap<>();
for(Field field:fields){
DEField deField=field.getAnnotation(DEField.class);
if(!ObjectUtils.isEmpty(deField)) {
deFieldMap.put(field,deField);
}
}
return deFieldMap;
}
/**
* 转换[a,b]格式字符串到 'a','b'格式
* @return
*/
private String formatStringArr(Set<String> array) {
String[] arr = array.toArray(new String[array.size()]);
return "'" + String.join("','", arr) + "'";
}
/**
* 格式转换
* @param cond
* @param operator
* @return
*/
private String parseResult(StringBuffer cond, String operator) {
String resultCond = cond.toString();
if (resultCond.startsWith(operator))
resultCond = resultCond.replaceFirst(operator, "");
if (resultCond.endsWith(operator))
resultCond = resultCond.substring(0, resultCond.lastIndexOf(operator));
return resultCond;
}
}
\ No newline at end of file
......@@ -6,13 +6,11 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.util.ObjectUtils;
import java.util.Map;
import java.util.HashMap;
import java.sql.Timestamp;
import java.util.Collection;
import java.util.Set;
import java.util.*;
import com.alibaba.fastjson.JSONObject;
@Data
......@@ -58,8 +56,8 @@ public class AuthenticationUser implements UserDetails
private String memo;
private Map <String,Object> sessionParams;
@JsonIgnore
private Collection<GrantedAuthority> authorities;
@JsonIgnore
private Collection<GrantedAuthority> authorities;
private int superuser;
private JSONObject permissionList;
private String orglevel;//单位级别
......@@ -144,4 +142,15 @@ public class AuthenticationUser implements UserDetails
else
return new HashMap<>();
}
public Collection<GrantedAuthority> getAuthorities() {
if(authorities==null && permissionList !=null){
if(permissionList.getJSONArray("authorities")!=null){
authorities=new ArrayList<>();
permissionList.getJSONArray("authorities").
forEach(item->authorities.add(new SimpleGrantedAuthority(String.valueOf(item))));
}
}
return authorities;
}
}
......@@ -14,6 +14,7 @@ import cn.ibizlab.util.domain.IBZUSER;
import org.springframework.util.DigestUtils;
import org.springframework.util.StringUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.security.core.authority.AuthorityUtils;
/**
* 实体[IBZUSER] 服务对象接口实现
......@@ -72,6 +73,9 @@ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> impl
public AuthenticationUser createUserDetails(IBZUSER user) {
AuthenticationUser userdatail = new AuthenticationUser();
CachedBeanCopier.copy(user,userdatail);
if(userdatail.getSuperuser()==1){
userdatail.setAuthorities(AuthorityUtils.createAuthorityList("ROLE_SUPERADMIN"));
}
return userdatail;
}
}
\ No newline at end of file
......@@ -12,7 +12,7 @@ import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.security.core.authority.AuthorityUtils;
/**
* 实体[IBZUSER] 服务对象接口实现
*/
......@@ -44,6 +44,8 @@ public class SimpleUserService implements AuthenticationUserService{
user.setOrgid(domains);
user.setOrgcode(domains);
user.setOrgname(domains);
user.setSuperuser(1);
user.setAuthorities(AuthorityUtils.createAuthorityList("ROLE_SUPERADMIN"));
return user;
}
......
package cn.ibizlab.util.web;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
/**
* feign请求拦截器
* 拦截所有使用feign发出的请求,附加原始请求Header参数及Token
*/
@Configuration
public class FeignRequestInterceptor implements RequestInterceptor {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Override
public void apply(RequestTemplate requestTemplate) {
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if(requestAttributes!=null){
HttpServletRequest request = requestAttributes.getRequest();
Enumeration<String> headerNames = request.getHeaderNames();
if (headerNames != null) {
while (headerNames.hasMoreElements()) {
String name = headerNames.nextElement();
String values = request.getHeader(name);
requestTemplate.header(name, values);
}
logger.info("feign interceptor header:{}",requestTemplate);
}
}
}
}
\ No newline at end of file
......@@ -20,6 +20,32 @@ spring:
max-wait: 300ms
max-idle: 16
min-idle: 8
datasource:
username: root
password: '123456'
url: jdbc:mysql://127.0.0.1:3306/ibzdisk?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true
driver-class-name: com.mysql.jdbc.Driver
filters: stat,wall,log4j2
#配置初始化大小/最小/最大
initial-size: 1
min-idle: 1
max-active: 20
#获取连接等待超时时间
max-wait: 60000
#间隔多久进行一次检测,检测需要关闭的空闲连接
time-between-eviction-runs-millis: 60000
#一个连接在池中最小生存的时间
min-evictable-idle-time-millis: 300000
validation-query: SELECT 1 FROM DUAL
test-while-idle: true
test-on-borrow: false
test-on-return: false
#打开PSCache,并指定每个连接上PSCache的大小。oracle设为true,mysql设为false。分库分表较多推荐设置为false
pool-prepared-statements: false
max-pool-prepared-statement-per-connection-size: 20
isSyncDBSchema: false
defaultSchema: root
conf: classpath:liquibase/master.xml
#Mybatis-plus配置
mybatis-plus:
......@@ -37,6 +63,8 @@ mybatis-plus:
#阿里sentinel熔断器
feign:
httpclient:
enabled: true
sentinel:
enabled: true
......@@ -52,9 +80,8 @@ ribbon:
ConnectTimeout: 60000
#系统是否开启权限验证、是否开启缓存
#缓存模式:关闭缓存(无配置项)、本地缓存(enableCaffeineCache=true-默认)、caffeine+redis两级缓存(enableRedisCache=true)
#缓存级别:无缓存(无配置项)、一级缓存(L1)、二级缓存(L2)
ibiz:
enablePermissionValid: true
enableCaffeineCache: true
#enableRedisCache: true
cacheLevel: L1 #(L1)一级本地caffeine缓存;(L2)caffeine缓存+Redis缓存
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册