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

ibiz4j 发布系统代码

上级 f6993985
## v7.0.0-alpha.19 [2020-9-13]
### Bug修复
修复表单动态隐藏和权限控制冲突问题
修复向导面板上一步去除表单校验逻辑
修复行为逻辑和附加后逻辑共同使用异常问题
修复树导航数据变化刷新当前节点问题
### 功能新增及优化
#### 模板
新增首页统一待办组件
新增实体工作流动态导航表格视图批量提交流程数据
新增菜单、工具栏、表单分组按钮、表单按钮、表格操作列单机模式支持
新增挂载外部配置文件
新增支持静态代码表样式表
新增增加树视图节点、日历项上下文菜单权限支持
新增支持表格导航、列表导航、卡片导航支持快速分组
新增部门人员选择器组件、文件上传(磁盘)组件、图片上传(磁盘)组件、动态表单组件
新增列表、数据视图回到顶部功能
新增表格分组、列表分组、数据视图分组功能
新增数据选择编辑器自填模式文本属性、值属性支持
新增附加逻辑外部逻辑支持
新增应用主题配置
优化项布局面板功能
优化列表样式
优化计数器支持
优化表格行编辑新建行追加在第一行
#### 基础文件
修复表单动态隐藏和权限控制冲突问题
修复嵌入视图组件初始化导航数据和抛值问题
修复app-format-data组件时间格式化转化异常
优化工作流审批组件
优化穿梭框组件样式
优化app-span精度逻辑
优化计数器处理逻辑
优化快速分组代码表抛值逻辑
优化debug组件和头部菜单增加开发环境配置
新增统一待办组件
新增实体工作流动态导航表格视图批量提交数据
新增菜单、工具栏、表单分组按钮、表单按钮、表格操作列单机模式支持
新增挂载外部配置文件
新增支持静态代码表样式表
新增部门人员选择器组件、文件上传(磁盘)组件、图片上传(磁盘)组件、动态表单组件
新增应用主题配置
## v7.0.0-alpha.18 [2020-8-23]
### Bug修复
......
......@@ -86,6 +86,12 @@ import AppLockScren from './components/app-lock-scren/app-lock-scren.vue'
import ActionTimeline from './components/action-timeline/action-timeline.vue'
import CronEditor from './components/cron-editor/cron-editor.vue'
import AppMessagePopover from './components/app-message-popover/app-message-popover.vue'
import AppPanelField from './components/app-panel-field/app-panel-field.vue'
import AppPanelItem from './components/app-panel-item/app-panel-item.vue'
import AppDepartmentPersonnel from './components/app-department-personnel/app-department-personnel.vue'
import DiskFileUpload from './components/disk-file-upload/disk-file-upload.vue'
import AvueCustomForm from './components/avue-custom-form/avue-custom-form.vue'
import DiskImageUpload from './components/disk-image-upload/disk-image-upload.vue'
// 全局挂载UI实体服务注册中心
window['uiServiceRegister'] = uiServiceRegister;
......@@ -111,6 +117,9 @@ export const AppComponents = {
v.prototype.$verify = Verify;
v.prototype.$viewTool = ViewTool;
v.prototype.$uiActionTool = UIActionTool;
v.component('app-department-personnel',AppDepartmentPersonnel);
v.component('app-panel-item',AppPanelItem);
v.component('app-panel-field',AppPanelField);
v.component('app-full-scren',AppFullScren);
v.component('app-lock-scren',AppLockScren);
v.component('input-box', InputBox);
......@@ -186,5 +195,8 @@ export const AppComponents = {
v.component('action-timeline', ActionTimeline);
v.component('cron-editor', CronEditor);
v.component('app-message-popover', AppMessagePopover);
v.component('disk-file-upload', DiskFileUpload);
v.component('avue-custom-form', AvueCustomForm);
v.component('disk-image-upload', DiskImageUpload);
},
};
\ No newline at end of file
......@@ -112,6 +112,9 @@ export default class AuthService {
* @memberof AuthService
*/
public getMenusPermission(item: any): boolean {
if(!this.$store.getters['authresource/getEnablePermissionValid']) {
return true;
}
return this.$store.getters['authresource/getAuthMenu'](item);
}
......@@ -123,6 +126,9 @@ export default class AuthService {
* @memberof AuthService
*/
public getResourcePermission(tag: any): boolean {
if(!this.$store.getters['authresource/getEnablePermissionValid']) {
return true;
}
return this.$store.getters['authresource/getResourceData'](tag);
}
......
......@@ -100,39 +100,37 @@ export default class AppActionBar extends Vue {
* @memberof AppActionBar
*/
public calcActionItemAuthState(data:any,ActionModel:any,UIService:any){
if(Environment.enablePermissionValid){
for (const key in ActionModel) {
if (!ActionModel.hasOwnProperty(key)) {
return;
}
const _item = ActionModel[key];
if(_item && _item['dataaccaction'] && UIService){
let dataActionResult:any;
if(Object.is(_item['actiontarget'],"NONE")){
dataActionResult = UIService.getResourceOPPrivs(_item['dataaccaction']);
}else{
if(data && Object.keys(data).length >0){
dataActionResult = UIService.getAllOPPrivs(data)[_item['dataaccaction']];
}
}
// 无权限:0;有权限:1
if(dataActionResult === 0){
// 禁用:1;隐藏:2;隐藏且默认隐藏:6
if(_item.noprivdisplaymode === 1){
_item.disabled = true;
}
if((_item.noprivdisplaymode === 2) || (_item.noprivdisplaymode === 6)){
_item.visabled = false;
}else{
_item.visabled = true;
}
}
if(dataActionResult === 1){
_item.visabled = true;
_item.disabled = false;
}
}
}
for (const key in ActionModel) {
if (!ActionModel.hasOwnProperty(key)) {
return;
}
const _item = ActionModel[key];
if(_item && _item['dataaccaction'] && UIService){
let dataActionResult:any;
if(Object.is(_item['actiontarget'],"NONE")){
dataActionResult = UIService.getResourceOPPrivs(_item['dataaccaction']);
}else{
if(data && Object.keys(data).length >0){
dataActionResult = UIService.getAllOPPrivs(data)[_item['dataaccaction']];
}
}
// 无权限:0;有权限:1
if(dataActionResult === 0){
// 禁用:1;隐藏:2;隐藏且默认隐藏:6
if(_item.noprivdisplaymode === 1){
_item.disabled = true;
}
if((_item.noprivdisplaymode === 2) || (_item.noprivdisplaymode === 6)){
_item.visabled = false;
}else{
_item.visabled = true;
}
}
if(dataActionResult === 1){
_item.visabled = true;
_item.disabled = false;
}
}
}
}
......
......@@ -18,4 +18,7 @@
font-family: '微软雅黑','黑体','宋体';
font-size: 16px;
}
.progress {
margin-top: -15px;
}
}
\ No newline at end of file
<template>
<div class="app-data-upload-view">
<div class="app-data-upload-view" v-loading.fullscreen="isUploading" element-loading-background="rgba(57, 57, 57, 0.2)">
<el-row style="margin-top:24px" :gutter="20">
<el-col :span="4">
<el-button type="primary" @click="handleUpLoad">{{$t('components.appDataUploadView.selectfile')}}</el-button>
......@@ -13,6 +13,7 @@
</el-col>
</el-row>
<el-divider></el-divider>
<el-progress class="progress" v-show="isUploading" :text-inside="true" :stroke-width="14" :percentage="uploadProgress"></el-progress>
<el-row style="height:480px;padding: 0px 12px;">
<div class="data-info-content" >
<template v-if="importDataArray.length >0 && isUploading === false">
......@@ -50,6 +51,7 @@ import XLSX from 'xlsx';
import CodeListService from "@service/app/codelist-service";
import EntityService from '@/service/entity-service';
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { Environment } from '@/environments/environment';
@Component({
})
......@@ -191,6 +193,22 @@ export default class AppDataUploadView extends Vue {
* @memberof AppDataUploadView
*/
public allFieldMap:Map<string,any> = new Map();
/**
* 上传服务器数据切片数
*
* @type {number}
* @memberof AppDataUploadView
*/
public sliceUploadCnt: number = Environment.sliceUploadCnt;
/**
* 上传服务器进度条百分比
*
* @type {number}
* @memberof AppDataUploadView
*/
public uploadProgress: number = 0;
/**
* 视图参数变化
......@@ -282,10 +300,29 @@ export default class AppDataUploadView extends Vue {
this.transformData(this.importDataArray,tempDataArray);
this.hasImported = true;
this.isUploading = true;
this.uploadProgress = 0;
this.importDataArray = [];
this.sliceUploadService(tempDataArray, 0);
}
/**
* 数据切片上传
*
* @memberof AppDataUploadView
*/
public sliceUploadService(dataArray: Array<any>, cnt: number) {
if(cnt > dataArray.length) {
this.isUploading = false;
this.uploadProgress = 100;
return;
}
let sliceArray: Array<any> = [];
if(dataArray) {
sliceArray = dataArray.slice(cnt, cnt+this.sliceUploadCnt);
}
try{
this.entityService.getService(this.viewparams.serviceName).then((service:any) =>{
service.ImportData(this.viewdata,{name:this.importId,importData:tempDataArray}).then((res:any) =>{
service.ImportData(this.viewdata,{name:this.importId,importData:sliceArray}).then((res:any) =>{
const result:any = res.data;
if(result && result.rst !== 0){
this.promptInfo = (this.$t('components.appDataUploadView.importfailed') as string);
......@@ -294,7 +331,8 @@ export default class AppDataUploadView extends Vue {
}
this.importSuccessData = result.data;
this.promptInfo = (this.$t('components.appDataUploadView.completed') as string);
this.isUploading = false;
this.uploadProgress = Number((cnt / dataArray.length * 100).toFixed(2));
this.sliceUploadService(dataArray, cnt + this.sliceUploadCnt);
}).catch((error:any) =>{
this.isUploading = false;
this.promptInfo = (this.$t('components.appDataUploadView.importfailed') as string);
......@@ -311,7 +349,6 @@ export default class AppDataUploadView extends Vue {
console.error(error);
};
}
/**
* 导出excel
*
......
<template>
<div class="app-debug-actions">
<div class="app-debug-actions" v-if="isShow">
<div class="actions">
<button-group vertical>
<i-button :title="$t('components.appDebugActions.button')" :type="sdc.isShowTool ? 'warning' : 'info'" ghost @click="() => sdc.showToolChange()" :icon="sdc.isShowTool ? 'ios-bug' : 'ios-bug-outline'" ></i-button>
......@@ -25,6 +25,14 @@ import { Environment } from '@/environments/environment';
})
export default class AppDebugActions extends Vue {
/**
* 是否显示
*
* @type {boolean}
* @memberof AppDebugActions
*/
public isShow:boolean = Environment.devMode;
/**
* 配置平台操作控制器
*
......
.app-department-personnel{
position: relative;
.ivu-select-selection{
position: relative;
padding: 0;
.ivu-select-selected-value{
padding-left: 15px;
font-size: 13px;
}
.ivu-tag.ivu-tag-checked{
top: 1px;
font-size: 12px;
height: 24px;
line-height: 22px;
margin: 2px 0px 2px 6px;
padding: 0 3px 0 8px;
background-color: #f4f4f5;
border-color: #e9e9eb;
color: #909399;
.ivu-tag-text{
padding: 0 8px 0 0;
}
}
.ivu-icon.ivu-icon-ios-close{
position: absolute;
width: 10px;
line-height: 10px;
height: 10px;
top: 6px;
margin-left: 8px;
font-size: 4px;
color: #909399;
background-color: #c0c4cc;
border-radius: 50%;
}
.ivu-icon.ivu-icon-ios-close:hover{
color: #fff;
background-color: #909399;
}
.ivu-icon-ios-close:before {
position: absolute;
left: -1px;
}
}
.el-icon-search{
position: absolute;
top: 10px;
right: 27px;
color: #c0c4cc;
}
}
\ No newline at end of file
<template>
<div class="app-department-personnel">
<i-select :multiple="multiple" :transfer="true" transfer-class-name="app-department-personnel-select" :value="selectsLabel" :disabled="disabled" :clearable="true" @on-open-change="onClick" @on-change="change">
<i-option v-for="(item, index) in items" :key="index" :value="item.id" :label="item.label"></i-option>
</i-select>
<template>
<i v-if="!disabled" class="el-icon-search" @click="openView"></i>
</template>
</div>
</template>
<script lang="ts">
import { Component, Vue, Prop, Watch } from 'vue-property-decorator';
import { Subject } from 'rxjs';
import { Http } from '../../utils';
import CodeListService from '@/service/app/codelist-service';
@Component({})
export default class AppDepartmentPersonnel extends Vue {
/**
* 名称标识
*
* @type {*}
* @memberof AppDepartmentPersonnel
*/
@Prop() public name!: string;
/**
* 树加载地址
*
* @type {*}
* @memberof AppDepartmentPersonnel
*/
@Prop() public treeurl?: string;
/**
* 数据接口地址
*
* @type {*}
* @memberof AppDepartmentPersonnel
*/
@Prop() public url!: string;
/**
* 多选
*
* @type {*}
* @memberof AppDepartmentPersonnel
*/
@Prop({default: false}) public multiple?: boolean;
/**
* 数据对象
*
* @type {*}
* @memberof AppDepartmentPersonnel
*/
@Prop() public data: any;
/**
* 代码表标识
*
* @memberof AppDepartmentPersonnel
*/
@Prop() public tag?: string;
/**
* 代码表类型
*
* @memberof AppDepartmentPersonnel
*/
@Prop() public codelistType?: string;
/**
* 过滤属性标识
*
* @type {*}
* @memberof AppDepartmentPersonnel
*/
@Prop() public filter?: string;
/**
* 是否启用
*
* @type {*}
* @memberof AppDepartmentPersonnel
*/
@Prop() public disabled?: boolean;
/**
* 值
*
* @type {*}
* @memberof AppDepartmentPersonnel
*/
@Prop() public value: any;
/**
* 上下文参数
*
* @type {*}
* @memberof AppDepartmentPersonnel
*/
@Prop() public context: any;
/**
* 关联属性
*
* @type {*}
* @memberof AppDepartmentPersonnel
*/
@Prop() public valueitem: any;
/**
* 填充属性
*
* @type {*}
* @memberof AppDepartmentPersonnel
*/
@Prop() public fillmap: any;
/**
* 选中项对象集合
*
* @type {*}
* @memberof AppDepartmentPersonnel
*/
public selects: any[] = [];
/**
* 选中项label集合
*
* @type {*}
* @memberof AppDepartmentPersonnel
*/
public selectsLabel: any[] = [] ;
/**
* 下拉数组
*
* @type {*}
* @memberof AppDepartmentPersonnel
*/
public items: any[] = [];
/**
* 过滤值
*
* @type {string}
* @memberof AppDepartmentPersonnel
*/
public filtervalue: string = '';
/**
* 获取需要过滤的部门id
*
* @memberof AppDepartmentPersonnel
*/
public getDepertmentId(){
const context: any = JSON.parse(JSON.stringify(this.context));
if(this.filter){
if(this.data[this.filter]){
this.filtervalue = this.data[this.filter];
}else if(context[this.filter]){
this.filtervalue = context[this.filter];
}else{
this.filtervalue = context.srfsdept;
}
}else{
this.filtervalue = context.srfsdept;
}
}
/**
* 下拉加载数据
*
* @param {*} $event
* @memberof AppDepartmentPersonnel
*/
public onClick($event: any){
if($event == true){
const items: Array<any> = this.$store.getters.getDepartmentPersonnel();
if(items.length > 0){
this.items = items;
}else{
this.getDepertmentId();
if(this.treeurl){
let tempUrl = this.treeurl.replace('{deptId}',this.filtervalue);
let get = Http.getInstance().get(tempUrl, true);
get.then((response: any)=>{
if(response.status === 200) {
this.getTreeItems(response.data);
}
});
}else{
this.getPersonnelItems(this.filtervalue);
}
}
}
}
/**
* 加载当前部门和其下级部门数据
*
* @param {*} $event
* @memberof AppDepartmentPersonnel
*/
public getTreeItems(treeItems: Array<any>){
if(treeItems.length > 0){
treeItems.forEach((treeItem: any)=>{
this.getPersonnelItems(treeItem.id);
});
}
}
/**
* 加载部门人员数据
*
* @param {*} $event
* @memberof AppDepartmentPersonnel
*/
public getPersonnelItems($event: string){
let tempUrl = this.url.replace('{deptId}',$event);
let get = Http.getInstance().get(tempUrl, true);
get.then((response: any) => {
if(response.status === 200 && response.data.length > 0) {
response.data.forEach((item: any)=>{
this.items.push(item);
});
}
this.$store.commit("addDepartmentPersonnel",this.items);
}).catch((error: any) => {
console.log(error)
})
}
/**
* 值变化
*
* @type {*}
* @memberof AppDepartmentPersonnel
*/
@Watch('data',{immediate:true,deep:true})
onValueChange(newVal: any, oldVal: any) {
this.selects = [];
this.selectsLabel = [];
if (newVal) {
let item: any = {};
item.label = this.data[this.name]?this.data[this.name].split(','):[];
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(',') : [];
}
}
const callback:any = (item:any) =>{
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);
let i = this.items.findIndex((select: any) => Object.is(select.id,_item.id));
if(i < 0){
this.items.push(_item);
}
this.selectsLabel.push(_item.id);
})
}
if(item.label.length == 0 && item.id.length > 0){
this.fillLabel(item,item.id,(result:any) =>{
item.label = result.label;
callback(item);
});
}else{
callback(item);
}
}
}
/**
* 填充label
*
* @memberof AppDepartmentPersonnel
*/
public fillLabel(tempObject:any,valueItem:Array<any>,callback:any){
if(tempObject.label.length === 0 && tempObject.id.length >0 && this.tag && this.codelistType && Object.is(this.codelistType,"DYNAMIC")){
let codeListService:CodeListService = new CodeListService();
codeListService.getItems(this.tag).then((items:any) =>{
if(items && items.length >0 && valueItem.length >0){
let tempLabel:Array<any> = [];
valueItem.forEach((value:any) =>{
let result:any = items.find((item:any) =>{
return item.id === value;
})
tempLabel.push(result.label);
})
Object.assign(tempObject,{label:tempLabel});
}
callback(tempObject);
}).catch((error:any) =>{
console.log(error);
})
}
}
/**
* 打开选择视图
*
* @type {*}
* @memberof AppDepartmentPersonnel
*/
public openView() {
const view: any = {
viewname: 'app-group-picker',
title: (this.$t('components.appGroupSelect.groupSelect') as string)
};
const context: any = JSON.parse(JSON.stringify(this.context));
this.getDepertmentId();
const param: any = {};
Object.assign(param, {
showtree: this.treeurl?true:false,
url:this.url,
treeurl:this.treeurl,
filtervalue: this.filtervalue,
multiple: this.multiple,
selects: this.selects,
selectType: 'dept',
});
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 AppDepartmentPersonnel
*/
public openViewClose(result: any) {
if (result.datas && result.datas.length > 0) {
this.selects = [];
this.selectsLabel = [];
this.selects = [...result.datas];
this.selects.forEach((select: any)=>{
let index = this.items.findIndex((item) => Object.is(item.id, select.id));
if(index < 0){
this.items.push(select);
}
this.selectsLabel.push(select.id);
});
}
this.setValue();
}
/**
* 选中项发生变化时
*
* @type {*}
* @memberof AppDepartmentPersonnel
*/
public change($event: any) {
this.selects = [];
if(this.multiple){
if($event.length > 0){
$event.forEach((select: any)=>{
let index = this.items.findIndex((item) => Object.is(item.id, select));
if (index >= 0) {
this.selects.push(this.items[index]);
}
});
}
}else{
let index = this.items.findIndex((item) => Object.is(item.id, $event));
if (index >= 0) {
this.selects.push(this.items[index]);
}
}
this.setValue();
}
/**
* 设置值
*
* @type {*}
* @memberof AppDepartmentPersonnel
*/
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.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">
@import './app-department-personnel.less';
</style>
\ No newline at end of file
......@@ -158,38 +158,36 @@ export default class AppFormGroup extends Vue {
* @memberof AppFormGroup
*/
public calcActionItemAuthState(data:any,ActionModel:any,UIService:any){
if(Environment.enablePermissionValid){
for (const key in ActionModel) {
if (!ActionModel.hasOwnProperty(key)) {
return;
}
const _item = ActionModel[key];
if(_item && _item['dataaccaction'] && UIService){
let dataActionResult:any;
if(Object.is(_item['actiontarget'],"NONE")){
dataActionResult = UIService.getResourceOPPrivs(_item['dataaccaction']);
}else{
if(data && Object.keys(data).length >0){
dataActionResult = UIService.getAllOPPrivs(data)[_item['dataaccaction']];
}
for (const key in ActionModel) {
if (!ActionModel.hasOwnProperty(key)) {
return;
}
const _item = ActionModel[key];
if(_item && _item['dataaccaction'] && UIService){
let dataActionResult:any;
if(Object.is(_item['actiontarget'],"NONE")){
dataActionResult = UIService.getResourceOPPrivs(_item['dataaccaction']);
}else{
if(data && Object.keys(data).length >0){
dataActionResult = UIService.getAllOPPrivs(data)[_item['dataaccaction']];
}
// 无权限:0;有权限:1
if(dataActionResult === 0){
// 禁用:1;隐藏:2;隐藏且默认隐藏:6
if(_item.noprivdisplaymode === 1){
_item.disabled = true;
}
if((_item.noprivdisplaymode === 2) || (_item.noprivdisplaymode === 6)){
_item.visabled = false;
}else{
_item.visabled = true;
}
}
// 无权限:0;有权限:1
if(dataActionResult === 0){
// 禁用:1;隐藏:2;隐藏且默认隐藏:6
if(_item.noprivdisplaymode === 1){
_item.disabled = true;
}
if(dataActionResult === 1){
if((_item.noprivdisplaymode === 2) || (_item.noprivdisplaymode === 6)){
_item.visabled = false;
}else{
_item.visabled = true;
_item.disabled = false;
}
}
if(dataActionResult === 1){
_item.visabled = true;
_item.disabled = false;
}
}
}
}
......
......@@ -72,10 +72,14 @@ export default class AppFormatData extends Vue {
return result;
}
} else if (this.format){
let date: any = moment(this.data);
if(!date._isValid) {
return this.data;
}
if(this.format.indexOf('%1$t') !== -1){
return moment(this.data).format("YYYY-MM-DD HH:mm:ss");
return date.format("YYYY-MM-DD HH:mm:ss");
}else{
return moment(this.data).format(this.format);
return date.format(this.format);
}
}else{
return this.data;
......
......@@ -176,7 +176,12 @@ export default class AppGroupPicker extends Vue {
*/
public loadTree() {
let orgid = this.viewParam.filtervalue;
let tempTreeUrl:string = this.treeurl.replace('${orgid}',orgid);
let tempTreeUrl: string = '';
if(this.viewParam.selectType && Object.is(this.viewParam.selectType,"dept")){
tempTreeUrl = this.treeurl.replace('{deptId}',orgid);
}else{
tempTreeUrl = this.treeurl.replace('${orgid}',orgid);
}
let get = Http.getInstance().get(tempTreeUrl, true);
get.then((response: any) => {
if(response.status === 200) {
......@@ -194,7 +199,12 @@ export default class AppGroupPicker extends Vue {
* @memberof AppGroupPicker
*/
public loadGroupData(key: string) {
let tempUrl = this.url.replace('${selected-orgid}',key);
let tempUrl: string = '';
if(this.viewParam.selectType && Object.is(this.viewParam.selectType,"dept")){
tempUrl = this.url.replace('{deptId}',key);
}else{
tempUrl = this.url.replace('${selected-orgid}',key);
}
let get = Http.getInstance().get(tempUrl, true);
get.then((response: any) => {
if(response.status === 200) {
......
.ibiz-group-select {
width: 100%;
display: flex;
border: 1px solid #DCDFE6;
height: 32px;
border-radius: 4px;
.ibiz-group-content {
flex-grow: 1;
height: 32px;
.group-item-text{
padding-left: 15px;
font-size: 13px;
}
.ibiz-group-item {
display: inline-block;
border: 1px solid #bbb;
border-radius: 5px;
font-size: 12px;
height: 24px;
line-height: 22px;
margin: 2px 0px 2px 6px;
padding: 1px 3px 0 8px;
background-color: #f4f4f5;
border-color: #e9e9eb;
color: #909399;
.group-item-multiple{
margin: 0 8px 0 0;
}
.el-icon-close{
color: #909399;
background-color: #c0c4cc;
border-radius: 50%;
top: 0;
}
.el-icon-close:hover{
color: #fff;
background-color: #909399;
}
}
}
.ibiz-group-open {
display: flex;
text-align: center;
align-items: center;
padding: 0 5px;
}
}
.ibiz-group-select:hover {
border-color: #108cee;
}
\ No newline at end of file
<template>
<div class="ibiz-group-select">
<div class="ibiz-group-content">
<span v-if="!multiple">
<span class="group-item-text" v-if="!multiple">
{{ selectName }}
</span>
<template v-else v-for="(select, index) of selects">
<div :key="index" class="ibiz-group-item">
{{ select.label }}
<span class="group-item-multiple">{{ select.label }}</span>
<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>
<i class="el-icon-search" @click="openView" style="color: #c0c4cc;"></i>
</div>
</div>
</template>
......@@ -147,9 +147,7 @@ export default class AppGroupSelect extends Vue {
if (newVal) {
let item: any = {};
item.label = this.data[this.name]?this.data[this.name].split(','):[];
if(this.valueitem) {
item.id = this.data[this.valueitem] ? this.data[this.valueitem].split(',') : [];
}
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(',') : [];
......@@ -219,7 +217,7 @@ export default class AppGroupSelect extends Vue {
treeurl:this.treeurl,
filtervalue: filtervalue,
multiple: this.multiple,
selects: this.selects
selects: this.selects,
});
let container: Subject<any> = this.$appmodal.openModal(view, context, param);
container.subscribe((result: any) => {
......@@ -330,32 +328,5 @@ export default class AppGroupSelect extends Vue {
</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;
}
@import './app-group-select.less';
</style>
\ No newline at end of file
<template>
<div class="app-header-menus">
<div class="app-header-menus" v-if="isShow">
<div v-for="(menu,index) in menus" :key="index" class="app-header-menu-item text" @click="openWindow(menu)">
<div class="app-header-menu-item-icon">
<i :class="menu.iconcls" :aria-hidden="true" />
......@@ -19,6 +19,14 @@ import { Environment } from '@/environments/environment';
})
export default class AppHeaderMenus extends Vue {
/**
* 是否显示
*
* @type {boolean}
* @memberof AppHeaderMenus
*/
public isShow:boolean = Environment.devMode;
/**
* 菜单数据
*
......@@ -41,7 +49,7 @@ export default class AppHeaderMenus extends Vue {
{
name: "ibizstudio",
title: "components.appHeaderMenus.ibizstudio.title",
url: `${Environment.StudioUrl}?#/common_slnindex/srfkeys=${Environment.SlnId}/sysdesign_psdevslnsysmodeltreeexpview`,
url: `${Environment.StudioUrl}?#/common_mosindex/srfkeys=${Environment.SysId}`,
iconcls: 'fa fa-wrench',
},
{
......
.item {
height: 24px;
line-height: 24px;
padding: 0 5px 0 0;
}
.show-more {
......
......@@ -18,7 +18,7 @@
</el-col>
<el-col :span="21" class="column2" :draggable="false">
<el-row :draggable="false">
<el-col :span="16" :draggable="false">
<el-col :span="16" :draggable="false" style="width: 65%;">
<div class="process-definition-name" :draggable="false"><strong>{{myTask.processDefinitionName}}</strong></div>
<div class="description" :draggable="false">{{myTask.description}}</div>
<div class="createtime" :draggable="false">{{ formatDate(myTask.createTime, 'MM-DD hh:mm') }}</div>
......@@ -26,7 +26,7 @@
<el-col :span="5" :draggable="false" style='display: flex; align-items: center'>
<el-tag :type="myTask.name.indexOf('驳回')!=-1?'danger':(myTask.name.indexOf('成功')!=-1?'success':(myTask.name.indexOf('取消')!=-1?'info':'-'))"
size="small" @click="handleTag(myTask)"
style="cursor: pointer;" :draggable="false">
style="cursor: pointer;overflow: hidden;text-overflow: ellipsis;" :draggable="false">
{{myTask.name}}
</el-tag>
</el-col>
......@@ -52,7 +52,7 @@
</el-col>
<el-col :span="21" class="column2" :draggable="false">
<el-row :draggable="false">
<el-col :span="16" :draggable="false">
<el-col :span="16" :draggable="false" style="width: 65%;">
<div class="process-definition-name" :draggable="false"><strong>{{myMsg.processDefinitionName}}</strong></div>
<div class="description" :draggable="false">{{myMsg.description}}</div>
<div class="createtime" :draggable="false">{{ formatDate(myMsg.createTime, 'MM-DD hh:mm') }}</div>
......@@ -60,7 +60,7 @@
<el-col :span="5" :draggable="false" style='display: flex; align-items: center'>
<el-tag :type="myMsg.name.indexOf('驳回')!=-1?'danger':(myMsg.name.indexOf('成功')!=-1?'success':(myMsg.name.indexOf('取消')!=-1?'info':'-'))"
size="small" @click="handleTag(myMsg)"
style="cursor: pointer;" :draggable="false">
style="cursor: pointer;overflow: hidden;text-overflow: ellipsis;" :draggable="false">
{{myMsg.name}}
</el-tag>
</el-col>
......@@ -149,7 +149,7 @@
this.getMyMsgs();
}
}).catch((error: any) => {
this.$Notice.error({title: '错误', desc: error});
console.warn("加载数据错误");
})
}
......
.app-panel-field {
height: 100%;
width: 100%;
display: flex;
padding: 0 6px;
.editor{
flex-grow: 1;
.editorstyle{
.ivu-input.ivu-input-default{
border-color: red;
}
}
.errorstyle{
color:red !important;
}
}
.app-panel-field-label {
height: 34px !important;
line-height: 25px;
flex-shrink: 0;
padding: 6px 10px 6px 0px;
}
}
.app-panel-field.label-top {
flex-flow: column;
}
.app-panel-field.label-bottom{
flex-flow: column-reverse;
}
.app-panel-field.label-left {
.app-panel-field-label {
text-align: right;
}
}
.app-panel-field.label-right {
flex-flow: row-reverse;
.app-panel-field-label {
padding: 6px 0px 6px 10px;
}
}
.app-panel-field.label-none {
.app-panel-field-label {
display: none !important;
}
}
<template>
<div :class="classes">
<div v-if="Object.is(labelPos,'NONE') || !labelPos" class="editor">
<div :class="valueCheck == true ?'':'editorstyle'">
<slot ></slot>
<span :class="error ? 'errorstyle':''">{{error}}</span>
</div>
</div>
<div v-if="!Object.is(labelPos,'NONE')" class="app-panel-field-label">
<span v-if="required" style="color:red;">* </span>
{{isEmptyCaption ? '' : caption}}
</div>
<div v-if="Object.is(labelPos,'BOTTOM') || Object.is(labelPos,'TOP') || Object.is(labelPos,'LEFT') || Object.is(labelPos,'RIGHT')" class="editor">
<div :class="valueCheck == true ?'':'editorstyle'">
<slot ></slot>
<span :class="error ? 'errorstyle':''">{{error}}</span>
</div>
</div>
</div>
</template>
<script lang="ts">
import { Vue, Component, Prop, Watch } from "vue-property-decorator";
@Component({})
export default class AppPanelField extends Vue {
/**
* 名称
*
* @type {string}
* @memberof AppPanelField
*/
@Prop() public caption!: string;
/**
* 错误信息
*
* @type {string}
* @memberof AppPanelField
*/
@Prop() public error?: string;
/**
* 标签位置
*
* @type {(string | 'BOTTOM' | 'LEFT' | 'NONE' | 'RIGHT' | 'TOP')}
* @memberof AppPanelField
*/
@Prop() public labelPos?:
| string
| "BOTTOM"
| "LEFT"
| "NONE"
| "RIGHT"
| "TOP";
/**
* 标签是否空白
*
* @type {boolean}
* @memberof AppPanelField
*/
@Prop() public isEmptyCaption?: boolean;
/**
* 列表项名称
*
* @type {string}
* @memberof AppPanelField
*/
@Prop() public name!: string;
/**
* 面板数据
*
* @type {any}
* @memberof AppPanelField
*/
@Prop() public data!: any;
/**
* 编辑器值
*
* @type {any}
* @memberof AppPanelField
*/
@Prop() public value !: any;
/**
* 值规则
*
* @type {string}
* @memberof AppPanelField
*/
@Prop() public itemRules!: any;
/**
* 是否必填
*
* @type {boolean}
* @memberof AppPanelField
*/
public required: boolean = false;
/**
* 值规则数组
*
* @type {any[]}
* @memberof AppPanelField
*/
public rules: any[] = [];
/**
* 值规则监控
*
* @param {*} newVal
* @param {*} oldVal
* @memberof AppPanelField
*/
@Watch("itemRules", { deep: true })
onItemRulesChange(newVal: any, oldVal: any) {
if (newVal) {
try {
this.rules = [];
const _rules: any[] = newVal;
this.rules = [..._rules];
this.rules.some((rule: any) => {
if (rule.hasOwnProperty("required")) {
this.required = rule.required;
return true;
}
return false;
});
} catch (error) {}
}
}
/**
* 编辑器样式
*
* @type {boolean}
* @memberof AppPanelField
*/
public valueCheck: boolean = true;
/**
* 编辑器值监控
*
* @param {*} newVal
* @param {*} oldVal
* @memberof AppPanelField
*/
@Watch("value")
ItemValueRules(newVal: any, oldVal: any) {
if(this.required && !newVal) {
this.valueCheck = false;
}else{
this.valueCheck = true;
}
}
/**
* 计算样式
*
* @readonly
* @type {string []}
* @memberof AppPanelField
*/
get classes(): string[] {
let posClass = "";
switch (this.labelPos) {
case "TOP":
posClass = "label-top";
break;
case "LEFT":
posClass = "label-left";
break;
case "BOTTOM":
posClass = "label-bottom";
break;
case "RIGHT":
posClass = "label-right";
break;
case "NONE":
posClass = "label-none";
break;
}
return [ "app-panel-field", posClass ];
}
/**
* vue 生命周期
*
* @memberof AppPanelField
*/
public mounted() {
if (this.itemRules) {
try {
const _rules: any[] = this.itemRules;
this.rules = [..._rules];
this.rules.some((rule: any) => {
if (rule.hasOwnProperty("required")) {
this.required = rule.required;
return true;
}
return false;
});
} catch (error) {}
}
}
}
</script>
<style lang='less'>
@import "./app-panel-field.less";
</style>
\ No newline at end of file
.app-panel-item{
.app-panel-item-rawitem{
padding-right: 10px;
}
}
\ No newline at end of file
<template>
<div class="app-panel-item">
<div v-if="Object.is(itemType,'BUTTON')" >
<Button type="primary" long @click="onClick">
<i v-if="icon" :class="icon"></i>
<span v-if="showCaption" :class="lableStyle">{{caption ? caption : ''}}</span>
</Button>
</div>
<div v-if="Object.is(itemType,'RAWITEM')">
<i v-if="icon" :class="icon"></i>
<span v-if="caption" class="app-panel-item-rawitem">{{caption}}</span>
<div :class="contentStyle">
<slot></slot>
</div>
</div>
</div>
</template>
<script lang="ts">
import { Vue, Component, Prop, Watch } from "vue-property-decorator";
@Component({})
export default class AppPanelItem extends Vue {
/**
* 面板成员类型
*
* @type {string}
* @memberof AppPanelItem
*/
@Prop() public itemType!: string;
/**
* 图标
*
* @type {string}
* @memberof AppPanelItem
*/
@Prop() public icon?: string;
/**
* 标题
*
* @type {string}
* @memberof AppPanelItem
*/
@Prop() public caption?: string;
/**
* 显示标题
*
* @type {boolean}
* @memberof AppPanelItem
*/
@Prop() public showCaption?: boolean;
/**
* 标题样式
*
* @type {boolean}
* @memberof AppPanelItem
*/
@Prop() public lableStyle?: string;
/**
* 内容样式
*
* @type {boolean}
* @memberof AppPanelItem
*/
@Prop() public contentStyle?: string;
/**
* 部件样式
*
* @type {boolean}
* @memberof AppPanelItem
*/
@Prop() public partsStyle?: string;
/**
* 点击按钮
*
* @param {*} $event
* @memberof AppPanelItem
*/
public onClick($event: any){
this.$emit('onClick',$event);
}
}
</script>
<style lang='less'>
@import "./app-panel-item.less";
</style>
\ No newline at end of file
......@@ -5,14 +5,14 @@
<i v-if=" item.iconcls && !Object.is(item.iconcls, '')" :class="item.iconcls"></i>
<img v-else-if="item.icon && !Object.is(item.icon, '')" :src="item.icon" />
<span class="app-quick-item-label">{{item.label}}</span>
<span v-show="isSelectedItem(item) && counterService && counterService.counterData && counterService.counterData[item.codename]" class="app-quick-item-counter">{{itemTag(item)}}</span>
<span v-show="isSelectedItem(item) && counterService && counterService.counterData && counterService.counterData[item.codename.toLowerCase()]" class="app-quick-item-counter">{{itemTag(item)}}</span>
</span>
<el-dropdown v-if="item.children" style="outline: none !important;" trigger="click" @command="handleCommand($event,item)">
<span :style="{color:item.color}" :class="{'app-seleted-item':isSelectedItem(item)}">
<i v-if=" item.iconcls && !Object.is(item.iconcls, '')" :class="item.iconcls"></i>
<img v-else-if="item.icon && !Object.is(item.icon, '')" :src="item.icon" />
<span class="app-quick-item-label">{{item.label}}</span>
<span v-show="isSelectedItem(item) && counterService && counterService.counterData && counterService.counterData[item.codename]" class="app-quick-item-counter">{{itemTag(item)}}</span>
<span v-show="isSelectedItem(item) && counterService && counterService.counterData && counterService.counterData[item.codename.toLowerCase()]" class="app-quick-item-counter">{{itemTag(item)}}</span>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="childitem in item.children" :command="childitem" :key="childitem.id">
......@@ -65,7 +65,6 @@ export default class AppQuickGroup extends Vue {
*/
get renderArray(){
if(this.items && this.items.length >0){
this.selectedUiItem = this.items[0];
this.handleClick(this.items[0]);
return this.handleDataSet(this.items)
}else{
......@@ -75,7 +74,7 @@ export default class AppQuickGroup extends Vue {
public itemTag(item:any){
if(this.counterService && this.counterService.counterData && item.codename){
return this.counterService.counterData[item.codename];
return this.counterService.counterData[item.codename.toLowerCase()];
}else{
return "";
}
......@@ -145,6 +144,9 @@ export default class AppQuickGroup extends Vue {
* @memberof AppQuickGroup
*/
public handleClick($event:any,isswitch:boolean = true){
if(this.selectedUiItem && (this.selectedUiItem.id === $event.id)){
return;
}
this.$emit('valuechange',$event);
if(isswitch){
this.selectedUiItem = $event;
......
......@@ -214,7 +214,8 @@ export default class AppSpan extends Vue {
this.text = Number(number.toFixed(this.precision)).toLocaleString('en-US')+ ' '+ this.unitName;
}else if(Object.is(this.dataType,"FLOAT") || Object.is(this.dataType,"DECIMAL")){
let number:any = Number(this.value);
this.text = number.toFixed(this.precision);
const decimalCnt:number = this.value.toString().split('.').length > 1 ? this.value.toString().split('.')[1].length : 0;
this.text = (Number(this.precision) === 0 && decimalCnt !== 0) ? number.toFixed(decimalCnt) : number.toFixed(this.precision);
}else {
this.text = this.value;
}
......
.app-theme{
width: auto !important;
padding: 0 5px;
/*** BRGIN:主题选择框样式 ***/
.app-app-theme {
.app-theme-color {
......
......@@ -48,6 +48,7 @@
<script lang = 'ts'>
import { Component, Vue } from 'vue-property-decorator';
import { appConfig } from '@/config/appConfig';
@Component({
})
......@@ -75,23 +76,7 @@ export default class AppTheme extends Vue {
* @type {Array<any>}
* @memberof AppTheme
*/
defaultThemes: Array<any> = [
{
tag: 'app-default-theme',
title: 'light',
color: '#f6f6f6',
},
{
title: 'Blue',
tag: 'app_theme_blue',
color: '#6ba1d1'
},
{
title: 'Dark Blue',
tag: 'app_theme_darkblue',
color: '#606d80'
}
];
defaultThemes: Array<any> = appConfig.themes;
/**
* 所选择的字体
......@@ -106,20 +91,7 @@ export default class AppTheme extends Vue {
*
* @memberof AppTheme
*/
public fontFamilys = [
{
label: 'MicrosoftYaHei',
value: 'Microsoft YaHei',
},
{
label: 'SimHei',
value: 'SimHei',
},
{
label: 'YouYuan',
value: 'YouYuan',
},
];
public fontFamilys = appConfig.fonts;
/**
* 挂载元素事件
......@@ -130,12 +102,12 @@ export default class AppTheme extends Vue {
if (localStorage.getItem('theme-class')) {
this.selectTheme = localStorage.getItem('theme-class');
} else {
this.selectTheme = 'app-default-theme';
this.selectTheme = appConfig.defaultTheme;
}
if (localStorage.getItem('font-family')) {
this.selectFont = localStorage.getItem('font-family');
} else {
this.selectFont = 'Microsoft YaHei';
this.selectFont = appConfig.defaultFont;
}
}
......@@ -146,7 +118,7 @@ export default class AppTheme extends Vue {
* @memberof AppTheme
*/
public themeChange(val: any) {
if (!Object.is(this.activeTheme, val)) {
if (!Object.is(this.selectTheme, val)) {
this.selectTheme = val;
localStorage.setItem('theme-class', val);
this.$router.app.$store.commit('setCurrentSelectTheme', val);
......
<template>
<div v-if="formOption!=null" class="app-custom-form">
<avue-form :option="formOption" v-model="formvalue"></avue-form>
</div>
</template>
<script lang="ts">
import {Vue,Component,Prop,Model,Emit,Watch,} from "vue-property-decorator";
import { Subject, Subscription } from "rxjs";
@Component({})
export default class AvueCustomForm extends Vue {
/**
* 编辑器参数传入组件配置
*
* @type {any}
* @memberof AvueCustomForm
*/
@Prop()
public options?: any;
/**
* 是否需要转换为string类型
*
* @type {boolean}
* @memberof AvueCustomForm
*/
@Prop()
public isParseString?: boolean;
/**
* 远端地址
*
* @type {string}
* @memberof AvueCustomForm
*/
@Prop() public url?: string;
/**
* 表单项值
*
* @type {any}
* @memberof AvueCustomForm
*/
@Prop() public value: any;
/**
* 是否将表单数据通过组件配置带入组件中
*
* @type {boolean}
* @memberof AvueCustomForm
*/
@Prop() public isFormData?: boolean;
/**
* 监听事件
*
* @param {*} newVal
* @param {*} oldVal
* @memberof AvueCustomForm
*/
@Watch("value")
public onValueChange(newVal: any, oldVal: any) {
if (newVal) {
let obj: any = {};
if (newVal && newVal != null) {
if (this.isParseString) obj = JSON.parse(newVal);
else obj = newVal;
}
if (obj) this.formvalue = JSON.parse(JSON.stringify(obj));
}
}
/**
* 表单数据
*
* @type {any}
* @memberof AvueCustomForm
*/
@Prop()
public formData: any;
/**
* 表单状态
*
* @type {Subject<any>}
* @memberof AvueCustomForm
*/
@Prop() public formState!: Subject<any>;
/**
* 视图状态事件
*
* @protected
* @type {(Subscription | undefined)}
* @memberof AvueCustomForm
*/
protected formStateEvent: Subscription | undefined;
/**
* 当前组件配置设置属性
*
* @type {any}
* @memberof AvueCustomForm
*/
public formOption: any = null;
/**
* avue-form绑定值
*
* @type {any}
* @memberof AvueCustomForm
*/
public formvalue: any = {};
/**
* avue-form默认配置
*
* @type {any}
* @memberof AvueCustomForm
*/
public defaultOptions: any = {
column: [
{
type: "dynamic",
label: "子表单",
span: 24,
display: true,
children: {
align: "center",
headerAlign: "center",
index: false,
addBtn: true,
delBtn: true,
column: [
{
type: "input",
label: "属性",
span: 24,
display: true,
prop: "property",
},
{
type: "input",
label: "值",
span: 24,
display: true,
prop: "value",
},
],
},
prop: "1599476281048_17916",
},
],
labelPosition: "left",
labelSuffix: ":",
labelWidth: 120,
gutter: 0,
menuBtn: false,
submitBtn: false,
submitText: "提交",
emptyBtn: false,
emptyText: "清空",
menuPosition: "center",
};
/**
* vue生命周期
*
* @memberof AvueCustomForm
*/
public mounted() {
let that: any = this;
if (this.formState) {
this.formStateEvent = this.formState.subscribe(({ type, data }) => {
if (Object.is("load", type)) that.load();
});
}
}
/**
* 加载表单配置,配置优先级,依次按优先级加载(表单项值 > 远端请求 > 默认值)
*
* @memberof AvueCustomForm
*/
public load() {
let that: any = this;
if (!this.options && this.options == null) {
if (this.url && this.options == null) {
const get: Promise<any> = this.$http.get(this.url);
get.then((response: any) => {
if (response && response.data && response.data.view_config) {
that.formOption = JSON.parse(response.data.view_config)[
"formConfig"
];
if (this.isFormData) that.getFormData();
}
});
} else {
this.formOption = this.defaultOptions;
if (this.isFormData) that.getFormData();
}
} else {
this.formOption = this.options;
if (this.isFormData) that.getFormData();
}
}
/**
* 当组件配置中的属性与表单属性重复时,表单值塞入组件中
*
* @memberof AvueCustomForm
*/
public getFormData() {
let that: any = this;
let obj: any;
if (this.value) obj = JSON.parse(JSON.stringify(this.value));
else obj = {};
let recursionOption: any = function (group: any) {
group.column.forEach((gItem: any) => {
if (group.column && group.column.length > 0) {
if (that.formData[gItem.prop])
obj[gItem.prop] = that.formData[gItem.prop];
}
});
if (group.group && group.group.length > 0)
group.group.forEach((gItem: any) => {
recursionOption(gItem);
});
};
recursionOption(this.formOption);
this.setValue(obj);
}
/**
* 设置表单值
*
* @param {*} value
* @memberof AvueCustomForm
*/
public setValue(value: any) {
if (this.isParseString) this.$emit("change", JSON.stringify(value));
else this.$emit("change", value);
}
}
</script>
\ No newline at end of file
......@@ -293,12 +293,13 @@ export default class ContextMenuDrag extends Vue {
mounted() {
let that: any = this;
const get: Promise<any> = this.entityService.getAllApp(null,{});
get
.then((response: any) => {
get.then((response: any) => {
if (response) {
that.list = response.data.model;
that.listFilter();
}
}).catch((error:any) =>{
console.warn("加载数据错误")
});
}
}
......
......@@ -92,6 +92,14 @@ export default class ContextMenu extends Vue {
*/
@Prop()
public menus?: any[]
/**
* 是否阻止默认绘制上下文菜单
*
* @type {any}
* @memberof ContextMenu
*/
@Prop({default:false})
public isBlocked?:any;
/**
* 显示右键菜单
......@@ -195,7 +203,10 @@ export default class ContextMenu extends Vue {
if (contextRef) {
contextRef.oncontextmenu = (event: MouseEvent) => {
event.preventDefault();
this.showContextMenu(event.clientX, event.clientY);
if(!this.isBlocked){
this.showContextMenu(event.clientX, event.clientY);
}
this.$emit("showContext",event);
};
}
}
......
<template>
<div id="file-upload">
<el-row id="el-row">
<!--拖拽上传-->
<el-col v-if="showDrag==true" class="withDrag">
<el-upload
ref="upload"
drag
multiple
list-type="text"
:action="getAction()"
:headers="myHeaders"
:file-list="uploadFileList"
:show-file-list="false"
:limit="limit"
:http-request="customUploadFile">
<div>
<i class="el-icon-upload"></i>
<div>
<span>{{$t('components.diskFileUpload.fileDrag')}}</span>
<span style="color:#409EFF;">{{$t('components.diskFileUpload.clickUpload')}}</span>
</div>
<div slot="tip" class="el-upload__tip">{{uploadTip}}</div>
</div>
</el-upload>
</el-col>
<!--点击上传-->
<el-col v-else class="withoutDrag">
<el-upload
ref="upload"
multiple
list-type="text"
:action="getAction()"
:headers="myHeaders"
:file-list="uploadFileList"
:show-file-list="false"
:limit="limit"
:http-request="customUploadFile">
<el-button type="primary" size="small" icon="el-icon-upload">{{$t('components.diskFileUpload.clickUpload')}}</el-button>
<div slot="tip" class="el-upload__tip">{{uploadTip}}</div>
</el-upload>
</el-col>
<!--文件操作-->
<el-col v-for="(item,index) in uploadFileList" :key="index" class="fileList">
<div class="fileTitle">
<i class="el-icon-document"></i>
<span>{{item.name}}</span>
</div>
<div class="fileMain">
<el-link type="success" icon="el-icon-download" @click="onDownload(item)">{{$t('components.diskFileUpload.load')}}</el-link>
<el-link type="warning" icon="el-icon-view" v-show="showPreview" @click="onPreview(item)">{{$t('components.diskFileUpload.preview')}}
</el-link>
<el-link type="primary" icon="el-icon-edit"
v-show="showEdit && (item.name.match(/^.+\.(doc|DOC|docx|DOCX|wps|WPS|xls|XLS|xlsx|XLSX|ppt|PPT|et|ET)$/))"
@click="onEdit(item)">{{$t('components.diskFileUpload.edit')}}
</el-link>
<el-link icon="el-icon-camera"
v-show="showOcrview && (item.name.match(/^.+\.(gif|GIF|jpg|JPG|jpeg|JPEG|png|PNG|bmp|BMP|pdf|PDF)$/))"
@click="onOcr(item)">OCR
</el-link>
<el-link type="danger" icon="el-icon-delete" @click="onRemove(item,index)">{{$t('components.diskFileUpload.delete')}}</el-link>
</div>
</el-col>
</el-row>
</div>
</template>
<script lang="ts">
import { Component, Vue, Prop, Watch } from 'vue-property-decorator';
import {Button, Row, Col, Link, Icon, Upload, Message, MessageBox} from 'element-ui';
import Axios from 'axios';
import {Subject, Unsubscribable} from 'rxjs';
@Component({})
export default class DiskFileUpload extends Vue {
/**
* 当前表单对象
*
* @type {*}
* @memberof DiskFileUpload
*/
@Prop() public data!: any;
/**
* 当前属性名
*
* @type {string}
* @memberof DiskFileUpload
*/
@Prop() public formItemName!: string;
/**
* 当前属性值
*
* @type {string}
* @memberof DiskFileUpload
*/
@Prop() public value!: string;
/**
* 当前表单状态
*
* @type {*}
* @memberof DiskFileUpload
*/
@Prop() public formState!: any;
/**
* 默认为当前实体名称,有指定则按表单参数
*
* @type {string}
* @memberof DiskFileUpload
*/
@Prop() public folder!: string;
/**
* 默认为当前实体主键id,有指定则按表单参数
*
* @type {string}
* @memberof DiskFileUpload
*/
@Prop() public ownerid!: string;
/**
* 默认为当前属性名,有指定则按表单参数
*
* @type {string}
* @memberof DiskFileUpload
*/
@Prop() public ownertype!: string;
/**
* 持久化
*
* @type {boolean}
* @memberof DiskFileUpload
*/
@Prop({default: false}) public persistence?: boolean;
/**
* 是否显示拖拽区域
*
* @type {boolean}
* @memberof DiskFileUpload
*/
@Prop({default: false}) public showDrag?: boolean;
/**
* 是否显示预览按钮
*
* @type {boolean}
* @memberof DiskFileUpload
*/
@Prop({default: false}) public showPreview?: boolean;
/**
* 是否显示在线编辑按钮
*
* @type {boolean}
* @memberof DiskFileUpload
*/
@Prop({default: false}) public showEdit?: boolean;
/**
* 是否显示OCR按钮
*
* @type {boolean}
* @memberof DiskFileUpload
*/
@Prop({default: false}) public showOcrview?: boolean;
/**
* 单文件大小
*
* @type {number}
* @memberof DiskFileUpload
*/
@Prop({default: 1}) public size!: number;
/**
* 文件上传个数
*
* @type {number}
* @memberof DiskFileUpload
*/
@Prop({default: 5}) public limit!: number;
/**
* 表单是否处于编辑状态(有真实主键,srfuf='1';srfuf='0'时处于新建未保存)
*
* @type {string}
* @memberof DiskFileUpload
*/
public srfuf: string = '0';
/**
* 上传提示语
*
* @type {string}
* @memberof DiskFileUpload
*/
get uploadTip(): string {
return this.$t('components.diskFileUpload.clues')+this.size.toString()+"M,"+this.$t('components.diskFileUpload.clues1')+this.limit;
}
/**
* 文件列表
*
* @type {Array<any>}
* @memberof DiskFileUpload
*/
public uploadFileList: Array<any> = [];
/**
* 当前登陆人的token
*
* @type {string}
* @memberof DiskFileUpload
*/
public token: string = "Bearer " + localStorage.getItem('token');
/**
* 上传文件请求头
*
* @type {*}
* @memberof DiskFileUpload
*/
public myHeaders: any = {Authorization: this.token};
/**
* 表单状态事件
*
* @type {*}
* @memberof DiskFileUpload
*/
public formStateEvent: any | Unsubscribable | undefined;
/**
* 批量更新标识,false为不更新,true才可以更新
*
* @type {boolean}
* @memberof DiskFileUpload
*/
public isUpdateBatch: boolean = true;
/**
* 新建状态标识,true为新建,false为编辑
*
* @type {boolean}
* @memberof DiskFileUpload
*/
public isCreate: boolean = true;
/**
* 拼接上传路径
*
* @memberof DiskFileUpload
*/
public getAction() {
const uploadUrl = '/net-disk/upload/' + this.getFolder() + '?ownertype=' + this.getOwnertype() + '&ownerid=' + this.getOwnerid();
return uploadUrl;
}
/**
* return folder
*
* @memberof DiskFileUpload
*/
public getFolder() {
const folder = typeof this.folder == "string" ? this.folder : JSON.stringify(this.folder);
return folder;
}
/**
* return ownertype
*
* @memberof DiskFileUpload
*/
public getOwnertype() {
const ownertype = typeof this.ownertype == "string" ? this.ownertype : JSON.stringify(this.ownertype);
return ownertype;
}
/**
* return ownerid
*
* @memberof DiskFileUpload
*/
public getOwnerid() {
const ownerid = typeof this.ownerid == "string" ? this.ownerid : JSON.stringify(this.ownerid);
return ownerid;
}
/**
*
*
* @memberof DiskFileUpload
*/
public created(){
this.formStateEvent = this.formState.subscribe(($event: any) => {
// 表单加载完成
if (Object.is($event.type, 'load')) {
const data = JSON.parse(JSON.stringify($event.data));
// 编辑表单,保存时不进行批量更新
if (data.srfuf == '1') {
this.isCreate = false;
this.isUpdateBatch = false;
}
// 当persistence = true时
if (this.persistence == true) {
// 直接从表单的data数据里获取当前属性的值
if (data[this.formItemName] && this.uploadFileList.length == 0) {
const files = JSON.parse(data[this.formItemName]);
for (let i = 0; i < files.length; i++) {
this.uploadFileList.push(files[i]);
}
}
} else {
// 发送get请求获取文件列表
this.getFiles();
}
}
// 表单保存完成
if (Object.is($event.type, 'save')) {
// 批量更新文件表中的ownerid
if (this.isUpdateBatch == true && this.uploadFileList.length > 0) {
this.updateFileBatch(this.uploadFileList, 'update');
}
}
});
}
/**
* 获取文件列表
*
* @memberof DiskFileUpload
*/
public getFiles(){
// 拼接url
let _this:any = this;
const getUrl = '/net-disk/files/' + this.getFolder();
// 发送get请求
Axios.get(getUrl, {
params: {
ownertype: this.getOwnertype(),
ownerid: this.getOwnerid(),
},
}).then(response => {
if (!response || response.status != 200) {
Message.error(_this.$t('components.diskFileUpload.getFileFailure')+'!');
return;
}
// 返回的是一个jsonArray
if (response.data) {
const files = JSON.parse(JSON.stringify(response.data));
if (this.uploadFileList.length == 0) {
this.uploadFileList.push.apply(this.uploadFileList, files);
}
}
}).catch(error => {
Message.error(_this.$t('components.diskFileUpload.getFileFailure')+':'+ error);
});
}
/**
* 自定义上传文件
*
* @param 上传文件
* @memberof DiskFileUpload
*/
public customUploadFile(param: any) {
// 上传的文件
let _this: any = this;
let file = param.file;
// 文件大小
const isSize = file.size / 1024 / 1024 < this.size;
if (!isSize) {
Message.error(_this.$t('components.diskFileUpload.loadFailure1')+_this.size.toString()+"M!");
return;
}
// formData传参
let formData = new FormData();
formData.append('file', file);
// 拼接url
const uploadUrl = this.getAction();
// 发送post请求
Axios.post(uploadUrl, formData, {timeout: 2000}).then(response => {
if (!response || response.status != 200) {
Message.error(_this.$t('components.diskFileUpload.loadFailure')+'!');
}
// 返回的是一个jsonobject
if (response.data) {
// 新建表单上传,后续需要批量更新操作
if (this.isCreate == true) {
this.isUpdateBatch = true;
}
// 保存到文件列表进行显示
this.uploadFileList.push(response.data);
// persistence=true时需要持久化表单属性
if (this.persistence == true && this.uploadFileList.length > 0) {
const value = JSON.stringify(this.uploadFileList);
this.$emit('formitemvaluechange', {name: this.formItemName, value: value});
}
}
}).catch(err => {
Message.error(_this.$t('components.diskFileUpload.loadFailure')+':'+ err);
})
}
/**
* 下载文件
*
* @param item 下载文件
* @memberof DiskFileUpload
*/
public onDownload(item: any) {
// 拼接url
let _this: any = this;
const id = typeof item.id == "string" ? item.id : JSON.stringify(item.id);
const name = typeof item.name == "string" ? item.name : JSON.stringify(item.filename);
const downloadUrl = '/net-disk/download/' + this.getFolder() + '/' + id + '/' + name;
// 发送get请求
Axios.get(downloadUrl, {
headers: {
'authcode': item.authcode
},
responseType: 'arraybuffer',
}).then(response => {
if (!response || response.status != 200) {
Message.error(_this.$t('components.diskFileUpload.downloadFile')+'!');
return;
}
// 请求成功,后台返回的是一个文件流
if (response.data) {
// 获取文件名
const disposition = response.headers['content-disposition'];
const filename = disposition.split('filename=')[1];
// 用blob对象获取文件流
var blob = new Blob([response.data], {type: response.headers['content-type']});
// 创建下载链接
var href = URL.createObjectURL(blob);
// 创建一个a元素并设置相关属性
var a = document.createElement('a');
a.href = href;
a.download = filename;
// 添加a元素到当前网页
document.body.appendChild(a);
// 触发a元素的点击事件,实现下载
a.click();
// 从当前网页移除a元素
document.body.removeChild(a);
// 释放blob对象
URL.revokeObjectURL(href);
} else {
Message.error(_this.$t('components.diskFileUpload.downloadFile1'));
}
}).catch(error => {
Message.error(_this.$t('components.diskFileUpload.downloadFile')+':'+ error);
});
}
/**
* 预览文件
*
* @param item 预览文件
* @memberof DiskFileUpload
*/
public onPreview(item: any) {
// 拼接url
const id = typeof item.id == "string" ? item.id : JSON.stringify(item.id);
const name = typeof item.name == "string" ? item.name : JSON.stringify(item.name);
const previewUrl = '/net-disk/preview/' + this.getFolder() + '/' + id + '/' + name + '?authcode=' + item.authcode;
// 新窗口打开url
window.open(previewUrl);
}
/**
* 编辑文件
*
* @param item
* @memberof DiskFileUpload
*/
public onEdit(item: any) {
// 拼接url
const id = typeof item.id == "string" ? item.id : JSON.stringify(item.id);
const name = typeof item.name == "string" ? item.name : JSON.stringify(item.name);
const editUrl = '/net-disk/edit/' + this.getFolder() + '/' + id + '/' + name + '?authcode=' + item.authcode;
// 新窗口打开url
window.open(editUrl);
}
/**
* ocr识别
* @param item
* @memberof DiskFileUpload
*/
public onOcr(item: any) {
// 拼接url
const folder = typeof this.folder == "string" ? this.folder : JSON.stringify(this.folder);
const id = typeof item.id == "string" ? item.id : JSON.stringify(item.id);
const name = typeof item.name == "string" ? item.name : JSON.stringify(item.name);
const ocrUrl = '/net-disk/ocrview/' + this.getFolder() + '/' + id + '/' + name + '?authcode=' + item.authcode;
// 新窗口打开url
window.open(ocrUrl);
}
/**
* 删除文件
*
* @param item
* @param index
* @memberof DiskFileUpload
*/
public onRemove(item: any, index: number) {
let _this:any = this;
if (item) {
MessageBox.confirm(_this.$t('components.diskFileUpload.deleteFile'), _this.$t('components.diskFileUpload.deleteFilePrompt'), {
confirmButtonText: _this.$t('components.diskFileUpload.true'),
cancelButtonText: _this.$t('components.diskFileUpload.false'),
type: 'warning'
}).then(() => {
// 拼接url
const deleteUrl = '/net-disk/files/' + item.id;
// 发送delete请求
Axios.delete(deleteUrl).then(response => {
if (!response || response.status != 200) {
Message.error(_this.$t('components.diskFileUpload.deleteFileFailure')+'!');
}
// 从文件列表中删除
this.uploadFileList.splice(index, 1);
// persistence=true时需要持久化表单属性
if (this.persistence == true) {
const value = JSON.stringify(this.uploadFileList);
this.$emit('formitemvaluechange', {name: this.formItemName, value: value});
}
}).catch(error => {
// 提示删除失败
Message.error(_this.$t('components.diskFileUpload.deleteFileFailure')+':'+ error);
});
});
}
}
/**
* 批量更新文件表的ownerid
*
* @memberof DiskFileUpload
*/
public updateFileBatch(files: any, opt: any) {
let _this:any = this;
// 拼接url
const updateUrl = '/net-disk/files/' + this.getFolder() + '?ownertype=' + this.getOwnertype() + "&ownerid=" + this.getOwnerid();
// requestBody参数
let requestBody = [];
if (files) {
requestBody = files;
}
// 发送post请求
Axios.post(updateUrl, requestBody, {
headers: {
"Content-Type": "application/json;charset=UTF-8"
},
timeout: 2000
}).then(response => {
if (!response || response.status != 200) {
Message.error(_this.$t('components.diskFileUpload.updateFailure')+'!');
return;
}
}).catch(error => {
Message.error(_this.$t('components.diskFileUpload.updateFailure')+':'+ error);
});
}
}
</script>
<style lang="less">
#file-upload {
width: auto;
height: auto;
border: 0px solid black;
}
#el-row {
border: 0px solid red;
width: 400px;
}
.withDrag {
border: 0px solid grey;
width: 400px;
}
.withoutDrag {
border: 0px solid grey;
width: 400px;
text-align: left;
padding-left: 0px;
padding-top: 0px;
margin-top: 0px;
}
.el-upload__tip {
margin-top: 0px;
}
.fileList {
width: 400px;
border: 0px solid grey;
margin-top: 0px;
}
.fileTitle {
text-align: left;
margin-left: 0px;
}
.fileTitle i {
margin-right: 5px;
}
.fileMain {
text-align: left;
margin-left: 0px;
margin-top: -10px;
}
.fileMain .el-link:nth-child(n+2) {
margin-left: 10px;
}
</style>
\ No newline at end of file
<template>
<div id="image-upload">
<el-upload
ref="imageUpload"
multiple
:file-list="imageList"
list-type="picture-card"
:action="getAction()"
:headers="myHeaders"
:limit="limit"
:before-upload="beforeUpload"
:http-request="customImageUpload">
<i class="el-icon-plus"></i>
<div slot="file" slot-scope="{file,index}">
<img class="el-upload-list__item-thumbnail" :src="file.url">
<span class="el-upload-list__item-actions">
<!--预览按钮-->
<span class="el-upload-list__item-preview" @click="onPreview(file)" :title="$t('components.diskImageUpload.preview')"
v-show="showPreview">
<i class="el-icon-view"></i>
</span>
<!--OCR按钮-->
<span class="el-upload-list__item-delete" @click="onOcr(file)" :title="$t('components.diskImageUpload.OCRdiscern')"
v-show="showOcrview && (file.name.match(/^.+\.(gif|GIF|jpg|JPG|jpeg|JPEG|png|PNG|bmp|BMP)$/))">
<i class="el-icon-camera"></i>
</span>
<!--下载按钮-->
<span class="el-upload-list__item-delete" @click="onDownload(file)" :title="$t('components.diskImageUpload.load')">
<i class="el-icon-download"></i>
</span>
<!--删除按钮-->
<span class="el-upload-list__item-delete" @click="onRemove(file)" :title="$t('components.diskImageUpload.delete')">
<i class="el-icon-delete"></i>
</span>
</span>
</div>
</el-upload>
<el-dialog :visible.sync="dialogVisible" :modal="false">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
</div>
</template>
<script lang="ts">
import {Component, Vue, Prop, Watch} from 'vue-property-decorator';
import {Message, MessageBox} from 'element-ui';
import Axios from 'axios';
import {Subject, Unsubscribable} from 'rxjs';
@Component({})
export default class DiskImageUplaod extends Vue {
/**
* 当前表单对象
*
* @type {*}
* @memberof DiskImageUplaod
*/
@Prop() public data!: any;
/**
* 当前属性名
*
* @type {string}
* @memberof DiskImageUplaod
*/
@Prop() public formItemName!: string;
/**
* 当前属性值
*
* @type {string}
* @memberof DiskImageUplaod
*/
@Prop() public value!: string;
/**
* 当前表单状态
*
* @type {*}
* @memberof DiskImageUplaod
*/
@Prop() public formState!: any;
/**
* 默认为当前实体名称,有指定则按表单参数
*
* @type {string}
* @memberof DiskImageUplaod
*/
@Prop() public folder!: string;
/**
* 默认为当前实体主键id,有指定则按表单参数
*
* @type {string}
* @memberof DiskImageUplaod
*/
@Prop() public ownerid!: string;
/**
* 默认为当前属性名,有指定则按表单参数
*
* @type {string}
* @memberof DiskImageUplaod
*/
@Prop() public ownertype!: string;
/**
* 持久化
*
* @type {boolean}
* @memberof DiskImageUplaod
*/
@Prop({default: false}) public persistence?: boolean;
/**
* 是否显示预览按钮
*
* @type {boolean}
* @memberof DiskImageUplaod
*/
@Prop({default: false}) public showPreview?: boolean;
/**
* 是否显示OCR按钮
*
* @type {boolean}
* @memberof DiskImageUplaod
*/
@Prop({default: false}) public showOcrview?: boolean;
/**
* 单文件大小
*
* @type {number}
* @memberof DiskImageUplaod
*/
@Prop({default: 1}) public size!: number;
/**
* 文件上传个数
*
* @type {number}
* @memberof DiskImageUplaod
*/
@Prop({default: 5}) public limit!: number;
/**
* 表单是否处于编辑状态(有真实主键,srfuf='1';srfuf='0'时处于新建未保存)
*
* @type {string}
* @memberof DiskImageUplaod
*/
public srfuf: string = '0';
/**
* 图片列表
*
* @type {Array<any>}
* @memberof DiskImageUplaod
*/
public imageList: Array<any> = [];
/**
* 当前登陆人的token
*
* @type {string}
* @memberof DiskImageUplaod
*/
public token: string = "Bearer " + localStorage.getItem('token');
/**
* 上传文件请求头
*
* @type {*}
* @memberof DiskImageUplaod
*/
public myHeaders: any = {Authorization: this.token};
/**
* 表单状态事件
*
* @type {*}
* @memberof DiskImageUplaod
*/
public formStateEvent: any | Unsubscribable | undefined;
/**
* 批量更新标识,false为不更新,true才可以更新
*
* @type {boolean}
* @memberof DiskImageUplaod
*/
public isUpdateBatch: boolean = true;
/**
* 新建状态标识,true为新建,false为编辑
*
* @type {boolean}
* @memberof DiskImageUplaod
*/
public isCreate: boolean = true;
/**
* 预览弹出框显示标识,true显示,false隐藏
*
* @type {boolean}
* @memberof DiskImageUplaod
*/
public dialogVisible: boolean = false;
/**
* 预览弹出框中的图片地址
*
* @type {string}
* @memberof DiskImageUplaod
*/
public dialogImageUrl: string = '';
/**
* 存放图片的fileid,用于图片列表定位
*
* @type {boolean}
* @memberof DiskImageUplaod
*/
public imageFileids: Array<any> = [];
/**
* 拼接上传路径
*
* @memberof DiskImageUplaod
*/
public getAction() {
return '/net-disk/upload/' + this.getFolder() + '?ownertype=' + this.getOwnertype() + '&ownerid=' + this.getOwnerid();
}
/**
* return folder
*
* @memberof DiskImageUplaod
*/
public getFolder() {
return typeof this.folder == "string" ? this.folder : JSON.stringify(this.folder);
}
/**
* return ownertype
*
* @memberof DiskImageUplaod
*/
public getOwnertype() {
return typeof this.ownertype == "string" ? this.ownertype : JSON.stringify(this.ownertype);
}
/**
* return ownerid
*
* @memberof DiskImageUplaod
*/
public getOwnerid() {
return typeof this.ownerid == "string" ? this.ownerid : JSON.stringify(this.ownerid);
}
/**
* vue生命周期create
*
* @memberof DiskImageUplaod
*/
public created() {
this.formStateEvent = this.formState.subscribe(($event: any) => {
// 表单加载完成
if (Object.is($event.type, 'load')) {
const data = JSON.parse(JSON.stringify($event.data));
// 编辑表单,保存时不进行批量更新
if (data.srfuf == '1') {
this.isCreate = false;
this.isUpdateBatch = false;
}
// 当persistence = true时,表单持久化
if (this.persistence == true) {
// 直接从表单的data数据里获取当前属性的值
if (data[this.formItemName] && this.imageList.length == 0) {
const files = JSON.parse(data[this.formItemName]);
files.forEach((item: any, i: number) => {
// 图片列表显示缩略图需要获取真实的图片信息
if (item.id && item.name) {
this.getRealImageData(item);
}
});
}
} else {
// 发送get请求获取图片列表
this.getFiles();
}
}
// 表单保存完成
if (Object.is($event.type, 'save')) {
// 批量更新文件表中的ownerid
if (this.isUpdateBatch == true && this.imageList.length > 0) {
this.updateFileBatch(this.imageList);
}
}
});
}
/**
* 获取图片列表
*
* @memberof DiskImageUplaod
*/
public getFiles() {
// 拼接url
let _this:any = this;
const getUrl = '/net-disk/files/' + this.getFolder();
// 发送get请求
Axios.get(getUrl, {
params: {
ownertype: this.getOwnertype(),
ownerid: this.getOwnerid(),
},
}).then(response => {
if (!response || response.status != 200) {
Message.error(_this.$t('components.diskImageUpload.getImageFailure')+"!");
return;
}
// 返回的是一个jsonArray
if (response.data) {
const files = JSON.parse(JSON.stringify(response.data));
if (this.imageList.length == 0) {
files.forEach((item: any, i: number) => {
// 图片列表显示缩略图需要获取真实的图片信息
if (item.id && item.name) {
this.getRealImageData(item);
}
});
}
}
}).catch(error => {
Message.error(_this.$t('components.diskImageUpload.getImageFailure')+':'+ error);
});
}
/**
* 获取真实的图片信息
* @param file
* @memberof DiskImageUplaod
*/
public getRealImageData(file: any) {
let fileData = file;
let _this: any = this;
// 拼接url,与下载一致
const downloadUrl = '/net-disk/download/' + this.getFolder() + '/' + fileData.id + '/' + fileData.name;
// 发送get请求
Axios.get(downloadUrl, {
headers: {
'authcode': fileData.authcode
},
responseType: 'blob',
}).then(res => {
if (!res || res.status != 200) {
Message.error(_this.$t('components.diskImageUpload.loadImageFailure')+'!');
}
// 请求成功,后台返回的是一个文件流
if (res.data) {
// 用blob对象获取文件流
var blob = new Blob([res.data], {type: res.headers['content-type']});
// 通过文件流创建下载链接
var href = URL.createObjectURL(blob);
// 将下载链接保存到图片中
fileData.url = href;
// 保存图片fileid
if (fileData.fileid) {
this.imageFileids.push(fileData.fileid);
} else if (fileData.id) {
this.imageFileids.push(fileData.id);
} else {
Message.error(_this.$t('components.diskImageUpload.ImageIdNone'));
return;
}
// 保存图片到图片列表进行显示
this.imageList.push(fileData);
} else {
Message.error(_this.$t('components.diskImageUpload.loadImageFailure1'));
}
}).catch(error => {
Message.error(_this.$t('components.diskImageUpload.loadImageFailure')+':' + error);
});
}
/**
* 上传之前
* @param file
* @memberof DiskImageUplaod
*/
public beforeUpload(file: any) {
// 支持上传的图片格式
let _this: any = this;
if (!file.name.match(/^.+\.(gif|GIF|jpg|JPG|jpeg|JPEG|png|PNG|bmp|BMP)$/)) {
Message.error(_this.$t('components.diskImageUpload.uploadImageFailure1'));
return false;
}
// 文件大小
const isSize = file.size / 1024 / 1024 < this.size;
if (!isSize) {
Message.error(_this.$t('components.diskImageUpload.uploadFailure')+this.size.toString()+"M!");
return false;
}
}
/**
* 自定义图片上传
* @param param
* @memberof DiskImageUplaod
*/
public customImageUpload(param: any) {
let _this: any = this;
// 上传的文件
let file = param.file;
// formData传参
let formData = new FormData();
formData.append('file', file);
// 拼接url
const uploadUrl = this.getAction();
// 发送post请求
Axios.post(uploadUrl, formData, {timeout: 2000}).then(response => {
if (!response || response.status != 200) {
Message.error(_this.$t('components.diskImageUpload.uploadImageFailure')+"!");
}
// 返回的是一个jsonobject
if (response.data) {
let returnData = response.data;
// 拼接缩略图下载url
const downloadUrl = '/net-disk/download/' + this.getFolder() + '/' + returnData.id + '/' + returnData.name;
// 发送get请求
Axios.get(downloadUrl, {
headers: {
'authcode': returnData.authcode
},
responseType: 'blob',
}).then(res => {
if (!res || res.status != 200) {
Message.error(_this.$t('components.diskImageUpload.loadImageFailure')+"!");
return;
}
// 请求成功,后台返回的是一个文件流
if (res.data) {
// 用blob对象获取文件流
var blob = new Blob([res.data], {type: res.headers['content-type']});
// 通过文件流创建下载链接
var href = URL.createObjectURL(blob);
// 将下载链接保存到本次上传成功后返回的jsonobject中
returnData.url = href;
// 保存jsonobject中的图片fileid
if (returnData.fileid) {
this.imageFileids.push(returnData.fileid);
} else if (returnData.id) {
this.imageFileids.push(returnData.id);
} else {
Message.error(_this.$t('components.diskImageUpload.ImageIdNone'));
return;
}
// 保存jsonobject到图片列表进行显示
this.imageList.push(returnData);
// 新建表单上传时,后续需要批量更新操作
if (this.isCreate == true) {
this.isUpdateBatch = true;
}
// persistence=true时,需要持久化表单属性
if (this.persistence == true && this.imageList.length > 0) {
const value = JSON.stringify(this.imageList);
this.$emit('formitemvaluechange', {name: this.formItemName, value: value});
}
} else {
Message.error(_this.$t('components.diskImageUpload.loadImageFailure1'));
}
}).catch(error => {
Message.error(_this.$t('components.diskImageUpload.loadImageFailure')+':' + error);
});
}
}).catch(err => {
Message.error(_this.$t('components.diskImageUpload.uploadImageFailure')+':' + err);
});
}
/**
* 预览
* @param file
* @memberof DiskImageUplaod
*/
public onPreview(file: any) {
let _this: any = this;
if (file.url) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
} else {
Message.error(_this.$t('components.diskImageUpload.notImageUrl'));
}
}
/**
* Ocr识别
* @param file
* @memberof DiskImageUplaod
*/
public onOcr(file: any) {
// 拼接url
const id = typeof file.id == "string" ? file.id : JSON.stringify(file.id);
const name = typeof file.name == "string" ? file.name : JSON.stringify(file.name);
const ocrUrl = '/net-disk/ocrview/' + this.getFolder() + '/' + id + '/' + name + '?authcode=' + file.authcode;
// 新窗口打开url
window.open(ocrUrl);
}
/**
* 下载
* @param file
* @memberof DiskImageUplaod
*/
public onDownload(file: any) {
// 拼接url
let _this: any = this;
const id = typeof file.id == "string" ? file.id : JSON.stringify(file.id);
const name = typeof file.name == "string" ? file.name : JSON.stringify(file.filename);
const downloadUrl = '/net-disk/download/' + this.getFolder() + '/' + id + '/' + name;
// 发送get请求
Axios.get(downloadUrl, {
headers: {
'authcode': file.authcode
},
responseType: 'blob',
}).then(response => {
if (!response || response.status != 200) {
Message.error(_this.$t('components.diskImageUpload.loadImageFailure2')+'!');
return;
}
// 请求成功,后台返回的是一个文件流
if (response.data) {
// 获取文件名
const disposition = response.headers['content-disposition'];
const filename = disposition.split('filename=')[1];
// 用blob对象获取文件流
var blob = new Blob([response.data], {type: response.headers['content-type']});
// 通过文件流创建下载链接
var href = URL.createObjectURL(blob);
// 创建一个a元素并设置相关属性
var a = document.createElement('a');
a.href = href;
a.download = filename;
// 添加a元素到当前网页
document.body.appendChild(a);
// 触发a元素的点击事件,实现下载
a.click();
// 下载完成,从当前网页移除a元素
document.body.removeChild(a);
// 释放blob对象
URL.revokeObjectURL(href);
} else {
Message.error(_this.$t('components.diskImageUpload.loadImageFailure3'));
}
}).catch(error => {
Message.error(_this.$t('components.diskImageUpload.loadImageFailure2')+':' + error);
});
}
/**
* 删除
* @param file
* @memberof DiskImageUplaod
*/
public onRemove(file: any) {
let _this: any = this;
if (file) {
MessageBox.confirm(_this.$t('components.diskImageUpload.deleteFile'),_this.$t('components.diskImageUpload.deleteFilePrompt'), {
confirmButtonText: _this.$t('components.diskImageUpload.true'),
cancelButtonText: _this.$t('components.diskImageUpload.false'),
type: 'warning'
}).then(() => {
if (this.imageFileids.indexOf(file.id) != -1) {
// 要删除的图片在图片列表中的下标
const index = this.imageFileids.indexOf(file.id);
// 拼接url
const deleteUrl = '/net-disk/files/' + file.id;
// 发送delete请求
Axios.delete(deleteUrl).then(response => {
if (!response || response.status != 200) {
Message.error(_this.$t('components.diskImageUpload.deleteImageFailure')+'!');
}
// 从fileid数组中删除
this.imageFileids.splice(index, 1);
// 从图片列表中删除
this.imageList.splice(index, 1);
// persistence=true,时需要持久化表单属性
if (this.persistence == true) {
const value = JSON.stringify(this.imageList);
this.$emit('formitemvaluechange', {name: this.formItemName, value: value});
}
}).catch(error => {
// 提示删除失败
Message.error(_this.$t('components.diskImageUpload.deleteImageFailure')+':' + error);
});
}
});
}
}
/**
* 批量更新文件表的ownerid
* @param files
* @memberof DiskImageUplaod
*/
public updateFileBatch(files: any) {
let _this: any = this;
// 拼接url
const updateUrl = '/net-disk/files/' + this.getFolder() + '?ownertype=' + this.getOwnertype() + "&ownerid=" + this.getOwnerid();
// requestBody参数
let requestBody = [];
if (files) {
requestBody = files;
}
// 发送post请求
Axios.post(updateUrl, requestBody, {
headers: {
"Content-Type": "application/json;charset=UTF-8"
},
timeout: 2000
}).then(response => {
if (!response || response.status != 200) {
Message.error(_this.$t('components.diskImageUpload.updateFailure')+'!');
return;
}
}).catch(error => {
Message.error(_this.$t('components.diskImageUpload.updateFailure')+':' + error);
});
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
......@@ -7,7 +7,7 @@
:clearable="true"
:filterable="filterable"
@on-open-change="onClick"
:placeholder="$t('components.dropDownListDynamic.placeholder')">
:placeholder="placeholder?placeholder:$t('components.dropDownListDynamic.placeholder')">
<i-option v-for="(item, index) in items" :key="index" :class="item.class" :value="item.value">{{($t('userCustom.'+tag+'.'+item.value)!== ('userCustom.'+tag+'.'+item.value))?$t('userCustom.'+tag+'.'+item.value) : item.text}}</i-option>
</i-select>
</template>
......
......@@ -11,7 +11,7 @@
:clearable="true"
:filterable="filterable"
@on-open-change="onClick"
:placeholder="$t('components.dropDownListMpicker.placeholder')">
:placeholder="placeholder?placeholder:$t('components.dropDownListMpicker.placeholder')">
<i-option v-for="(item, index) in items" :key="index" :class="item.class" :value="item.value.toString()" :label="item.text">
<Checkbox :value = "(currentVal.indexOf(item.value.toString()))==-1?false:true">
{{Object.is(codelistType,'STATIC') ? $t('codelist.'+tag+'.'+item.value) : item.text}}
......
......@@ -8,7 +8,7 @@
:clearable="true"
:filterable="filterable"
@on-open-change="onClick"
:placeholder="$t('components.dropDownList.placeholder')">
:placeholder="placeholder?placeholder:$t('components.dropDownList.placeholder')">
<i-option v-for="(item, index) in items" :key="index" :class="item.class" :value="item.value">{{($t('codelist.'+tag+'.'+item.value)!== ('codelist.'+tag+'.'+item.value))?$t('codelist.'+tag+'.'+item.value) : item.text}}</i-option>
</i-select>
<ibiz-select-tree v-if="hasChildren" class="tree-dropdown-list" :disabled="disabled" :NodesData="items" v-model="currentVal" :multiple="false"></ibiz-select-tree>
......
export const appConfig = {
//默认主题
defaultTheme: 'app-default-theme',
//默认字体
defaultFont: 'Microsoft YaHei',
//主题集合
themes: [
{
tag: 'app-default-theme',
title: 'light',
color: '#f6f6f6',
},
{
tag: 'app_theme_blue',
title: 'Blue',
color: '#6ba1d1'
},
{
tag: 'app_theme_darkblue',
title: 'Dark Blue',
color: '#606d80'
},
],
//字体集合
fonts: [
{
label: 'MicrosoftYaHei',
value: 'Microsoft YaHei',
},
{
label: 'SimHei',
value: 'SimHei',
},
{
label: 'YouYuan',
value: 'YouYuan',
},
]
}
\ No newline at end of file
import { Store } from 'vuex';
import EntityService from '@/service/entity-service';
/**
* 计数器服务基类
......@@ -16,6 +18,51 @@ export default class CounterService {
* @memberof CounterService
*/
private $store: Store<any> | null = null;
/**
* 当前计数器数据
*
* @protected
* @type {*}
* @memberof CounterService
*/
protected counterData:any ={};
/**
* 应用实体数据服务
*
* @protected
* @type {EntityService}
* @memberof CounterService
*/
protected appEntityService:EntityService = new EntityService();
/**
* 当前计数器导航上下文
*
* @protected
* @type {*}
* @memberof CounterService
*/
protected context:any ={};
/**
* 当前计数器导航参数
*
* @protected
* @type {*}
* @memberof CounterService
*/
protected viewparams:any ={};
/**
* 当前计数器定时器对象
*
* @protected
* @type {*}
* @memberof CounterService
*/
protected timer:any;
/**
* Creates an instance of CounterService.
......@@ -25,6 +72,8 @@ export default class CounterService {
*/
constructor(opts: any = {}) {
this.$store = opts.$store;
this.context = opts.context?opts.context:{};
this.viewparams = opts.viewparams?opts.viewparams:{};
}
/**
......@@ -49,5 +98,13 @@ export default class CounterService {
return (window as any)['counterServiceRegister'].getService(name);
}
/**
* 销毁计数器
*
* @memberof ActionCounterCounterServiceBase
*/
public destroyCounter(){
if(this.timer) clearInterval(this.timer);
}
}
\ No newline at end of file
......@@ -144,6 +144,9 @@ export default class MDViewEngine extends ViewEngine {
if (Object.is(eventName, 'beforeload')) {
this.MDCtrlBeforeLoad(args)
}
if (Object.is(eventName, 'remove')) {
this.MDCtrlRemove(args)
}
}
/**
......@@ -454,5 +457,13 @@ export default class MDViewEngine extends ViewEngine {
return this.getMDCtrl().transformData(arg);
}
/**
* 多数据部件删除后
*
* @param {*} [arg={}]
* @memberof MDViewEngine
*/
public MDCtrlRemove(arg: any = {}): void {
this.view.$emit('drdatasremove', arg);
}
}
\ No newline at end of file
......@@ -186,39 +186,37 @@ export default class ViewEngine {
* @memberof ViewEngine
*/
public calcToolbarItemAuthState(data:any){
if(Environment.enablePermissionValid){
const _this: any = this;
for (const key in _this.view.toolBarModels) {
if (!_this.view.toolBarModels.hasOwnProperty(key)) {
return;
}
const _item = _this.view.toolBarModels[key];
if(_item && _item['dataaccaction'] && _this.view.appUIService){
let dataActionResult:any;
if (_item.uiaction && (Object.is(_item.uiaction.target, 'NONE'))){
dataActionResult = _this.view.appUIService.getResourceOPPrivs(_item['dataaccaction']);
}else{
if(data && Object.keys(data).length >0){
dataActionResult= _this.view.appUIService.getAllOPPrivs(data)[_item['dataaccaction']];
}
const _this: any = this;
for (const key in _this.view.toolBarModels) {
if (!_this.view.toolBarModels.hasOwnProperty(key)) {
return;
}
const _item = _this.view.toolBarModels[key];
if(_item && _item['dataaccaction'] && _this.view.appUIService){
let dataActionResult:any;
if (_item.uiaction && (Object.is(_item.uiaction.target, 'NONE'))){
dataActionResult = _this.view.appUIService.getResourceOPPrivs(_item['dataaccaction']);
}else{
if(data && Object.keys(data).length >0){
dataActionResult= _this.view.appUIService.getAllOPPrivs(data)[_item['dataaccaction']];
}
// 无权限:0;有权限:1
if(dataActionResult === 0){
// 禁用:1;隐藏:2;隐藏且默认隐藏:6
if(_item.noprivdisplaymode === 1){
_this.view.toolBarModels[key].disabled = true;
}
if((_item.noprivdisplaymode === 2) || (_item.noprivdisplaymode === 6)){
_this.view.toolBarModels[key].visabled = false;
}else{
_this.view.toolBarModels[key].visabled = true;
}
}
// 无权限:0;有权限:1
if(dataActionResult === 0){
// 禁用:1;隐藏:2;隐藏且默认隐藏:6
if(_item.noprivdisplaymode === 1){
_this.view.toolBarModels[key].disabled = true;
}
if(dataActionResult === 1){
if((_item.noprivdisplaymode === 2) || (_item.noprivdisplaymode === 6)){
_this.view.toolBarModels[key].visabled = false;
}else{
_this.view.toolBarModels[key].visabled = true;
_this.view.toolBarModels[key].disabled = false;
}
}
if(dataActionResult === 1){
_this.view.toolBarModels[key].visabled = true;
_this.view.toolBarModels[key].disabled = false;
}
}
}
}
......
......@@ -49,6 +49,7 @@ export default class WFDynaExpGridViewEngine extends GridViewEngine {
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
if (Object.is(ctrlName, 'grid')) {
this.GridEvent(eventName, args);
return;
}
super.onCtrlEvent(ctrlName, eventName, args);
}
......
......@@ -15,6 +15,8 @@ export const Environment = {
ExportFile: '/ibizutil/download',
// 文件上传
UploadFile: '/ibizutil/upload',
// 数据导入单次上传最大数量
sliceUploadCnt: 100,
// 是否为pc端应用
isAppMode:true,
//统一地址
......
......@@ -23,7 +23,10 @@ export default {
deleteError: "Failed to delete",
delDataFail: "Failed to delete data",
noData: "No data",
startsuccess:"Start successful"
startsuccess:"Start successful",
loadmore:"Load more",
nomore:"No more",
other:"other"
},
local:{
new: "New",
......@@ -37,6 +40,8 @@ export default {
totle: "totle",
noData: "No data",
valueVail: "Value cannot be empty",
group:"Group",
other:"Other",
notConfig: {
fetchAction: "The view table fetchaction parameter is not configured",
removeAction: "The view table removeaction parameter is not configured",
......
......@@ -23,7 +23,10 @@ export default {
deleteError: "删除失败",
delDataFail: "删除数据失败",
noData: "暂无数据",
startsuccess:"启动成功"
startsuccess:"启动成功",
loadmore:"加载更多",
nomore:"没有更多了",
other:"其他"
},
local:{
new: "新建",
......@@ -37,6 +40,8 @@ export default {
totle: "共",
noData: "无数据",
valueVail: "值不能为空",
group:"分组",
other:"其他",
notConfig: {
fetchAction: "视图表格fetchAction参数未配置",
removeAction: "视图表格removeAction参数未配置",
......
......@@ -328,5 +328,48 @@ export default {
appMessagePopover: {
loadMore: 'Load more',
noMore: 'No more'
},
diskFileUpload:{
fileDrag: 'Drag the file here, or',
clickUpload: 'Click on the upload',
load: 'Load',
preview: 'preview',
edit: 'Edit',
delete: 'Delete',
clues: 'Individual file sizes do not exceed',
clues1: 'Documents not exceeding',
getFileFailure: 'Failed to get file list',
loadFailure: 'Upload file failed',
loadFailure1: 'Upload failed, individual file cannot exceed',
downloadFile: 'Download file failed',
downloadFile1: 'Download file failed, not get file!',
deleteFile: 'This action will permanently delete the file. Do you want to continue?',
deleteFilePrompt: 'Prompt',
true: 'True',
false: 'False',
deleteFileFailure: 'File deletion failed',
updateFailure: 'Batch update file failed',
},
diskImageUpload:{
preview: 'Preview',
OCRdiscern: 'OCRdiscern',
load: 'Load',
delete: 'Delete',
getImageFailure: 'Failed to get list of images',
loadImageFailure: 'Failed to download thumbnails',
loadImageFailure1: 'Failed to download thumbnail, failed to get file!',
loadImageFailure2:'Download image failed',
loadImageFailure3:'Download picture failed, no picture found!',
ImageIdNone: 'Picture ID does not exist!',
uploadImageFailure: 'Failed to upload image',
uploadImageFailure1: "Upload failed, only support 'GIF, JPG, PNG, BMP' format images!",
uploadFailure: 'Upload failed, individual image must not exceed',
notImageUrl: 'The image URL does not exist',
deleteFile: 'This action will permanently delete the file. Do you want to continue?',
deleteFilePrompt: 'Prompt',
true: 'True',
false: 'False',
deleteImageFailure:'Image deletion failed',
updateFailure: 'Batch update file failed',
}
};
\ No newline at end of file
......@@ -329,5 +329,48 @@ export default {
appMessagePopover: {
loadMore: '加载更多',
noMore: '没有更多了'
},
diskFileUpload:{
fileDrag: '将文件拖到此处,或',
clickUpload: '点击上传',
load: '下载',
preview: '预览',
edit: '编辑',
delete: '删除',
clues: '单个文件大小不超过',
clues1: '文件不超过',
getFileFailure: '获取文件列表失败',
loadFailure: '上传文件失败',
loadFailure1: '上传失败,单个文件不得超过',
downloadFile: '下载文件失败',
downloadFile1: '下载文件失败,未获取到文件!',
deleteFile: '此操作将永久删除该文件, 是否继续?',
deleteFilePrompt: '提示',
true: '确定',
false: '取消',
deleteFileFailure: '删除文件失败',
updateFailure: '批量更新文件失败',
},
diskImageUpload:{
preview: '预览',
OCRdiscern: 'ORC识别',
load: '下载',
delete: '删除',
getImageFailure: '获取图片列表失败',
loadImageFailure: '下载缩略图失败',
loadImageFailure1: '下载缩略图失败,未获取到文件!',
loadImageFailure2:'下载图片失败',
loadImageFailure3:'下载图片失败,未找到图片!',
ImageIdNone: '图片id不存在!',
uploadImageFailure: '上传图片失败',
uploadImageFailure1: '上传失败,仅支持'gif,jpg,png,bmp'格式的图片!',
uploadFailure: '上传失败,单个图片不得超过',
notImageUrl: '图片url不存在',
deleteFile: '此操作将永久删除该文件, 是否继续?',
deleteFilePrompt: '提示',
true: '确定',
false: '取消',
deleteImageFailure:'删除图片失败',
updateFailure: '批量更新文件失败',
}
};
\ No newline at end of file
......@@ -33,6 +33,7 @@ mock.onGet('/appdata').reply((config: any) => {
// 当前用户条线代码
srfsectorbc:""
},
enablepermissionvalid:false,
unires:["RESOURCE1","RESOURCE2"],
//当前用户所有组织部门标识
srforgsections:[{"srforgsectorid":"5bd1ecf4d3c31e31cb66373df56b852f","srforgsectorname":"项目一部"},{"srforgsectorid":"2ad1ecf4d3c31e31cb66373df56b852f","srforgsectorname":"项目二部"}]
......
export { PanelDetailModel } from './panel-detail';
export { PanelRawitemModel } from './panel-row-item';
export { PanelTabPanelModel } from './panel-tab-panel';
export { PanelTabPageModel } from './panel-tab-page';
export { PanelFieldModel } from './panel-field';
export { PanelContainerModel } from './panel-container';
export { PanelControlModel } from './panel-control';
export { PanelUserControlModel } from './panel-user-control';
export { PanelButtonModel } from './panel-button';
\ No newline at end of file
import { PanelDetailModel } from './panel-detail';
/**
* 按钮模型
*
* @export
* @class PanelButtonModel
* @extends {PanelDetailModel}
*/
export class PanelButtonModel extends PanelDetailModel {
constructor(opts: any = {}) {
super(opts);
this.$disabled = opts.disabled;
this.uiaction = opts.uiaction;
}
/**
* 是否禁用
*
* @type {boolean}
* @memberof PanelButtonModel
*/
private $disabled:boolean = false;
/**
* 按钮对应的界面行为
*
* @type {*}
* @memberof PanelButtonModel
*/
public uiaction:any;
/**
* 是否启用
*
* @type {boolean}
* @memberof PanelButtonModel
*/
public get disabled(): boolean {
return this.$disabled;
}
/**
* 设置是否启用
*
* @memberof PanelButtonModel
*/
public set disabled(val: boolean) {
if(this.isPower) {
this.$disabled = val;
}
}
}
\ No newline at end of file
import { PanelDetailModel } from './panel-detail';
/**
* 面板容器模型
*
* @export
* @class PanelContainerModel
* @extends {PanelDetailModel}
*/
export class PanelContainerModel extends PanelDetailModel {
constructor(opts: any = {}) {
super(opts);
}
}
\ No newline at end of file
import { PanelDetailModel } from './panel-detail';
/**
* 用户控件模型
*
* @export
* @class PanelControlModel
* @extends {PanelDetailModel}
*/
export class PanelControlModel extends PanelDetailModel {
constructor(otps:any = {}) {
super(otps);
}
}
\ No newline at end of file
/**
* 表单成员模型
*
* @export
* @class PanelDetailModel
*/
export class PanelDetailModel {
/**
* 是否有权限
*
* @type {boolean}
* @memberof PanelDetailModel
*/
public isPower: boolean = true;
/**
* 成员标题
*
* @type {string}
* @memberof PanelDetailModel
*/
public caption: string = '';
/**
* 成员类型
*
* @type {string}
* @memberof PanelDetailModel
*/
public itemType: string = '';
/**
* 面板对象
*
* @type {*}
* @memberof PanelDetailModel
*/
public panel: any = null;
/**
* 成员名称
*
* @type {string}
* @memberof PanelDetailModel
*/
public name: string = '';
/**
* 成员是否显示
*
* @type {boolean}
* @memberof PanelDetailModel
*/
public $visible: boolean = true;
/**
* 成员是否显示(旧)
*
* @type {boolean}
* @memberof PanelDetailModel
*/
public oldVisible: boolean = true;
/**
* 成员是否显示标题
*
* @type {boolean}
* @memberof PanelDetailModel
*/
public isShowCaption: boolean = true;
/**
* Creates an instance of PanelDetailModel.
* PanelDetailModel 实例
*
* @param {*} [opts={}]
* @memberof PanelDetailModel
*/
constructor(opts: any = {}) {
this.caption = !Object.is(opts.caption, '') ? opts.caption : '';
this.itemType = !Object.is(opts.itemType, '') ? opts.itemType : '';
this.panel = opts.panel ? opts.panel : {};
this.name = !Object.is(opts.name, '') ? opts.name : '';
this.$visible = opts.visible ? true : false;
this.oldVisible = opts.visible ? true : false;
this.isShowCaption = opts.isShowCaption ? true : false;
}
/**
* 设置成员是否隐藏
*
* @memberof PanelDetailModel
*/
public set visible(val: boolean) {
if(this.isPower) {
this.$visible = val;
}
}
/**
* 获取成员是否隐藏
*
* @memberof PanelDetailModel
*/
public get visible() {
return this.$visible;
}
/**
* 设置显示与隐藏
*
* @param {boolean} state
* @memberof PanelDetailModel
*/
public setVisible(state: boolean): void {
if(this.isPower) {
this.visible = state;
}
}
/**
* 设置显示标题栏
*
* @param {boolean} state
* @memberof PanelDetailModel
*/
public setShowCaption(state: boolean): void {
this.isShowCaption = state;
}
}
\ No newline at end of file
import { PanelDetailModel } from './panel-detail';
/**
* 面板属性项模型
*
* @export
* @class PanelFieldModel
* @extends {PanelDetailModel}
*/
export class PanelFieldModel extends PanelDetailModel {
/**
* 是否启用
*
* @type {boolean}
* @memberof PanelFieldModel
*/
public disabled: boolean = false;
/**
* 错误信息
*
* @type {string}
* @memberof PanelFieldModel
*/
public error: string = '';
/**
* 表单项启用条件
*
* 0 不启用
* 1 新建
* 2 更新
* 3 全部启用
*
* @type {(number | 0 | 1 | 2 | 3)}
* @memberof PanelFieldModel
*/
public enableCond: number | 0 | 1 | 2 | 3 = 3;
/**
* Creates an instance of PanelFieldModel.
* PanelFieldModel 实例
*
* @param {*} [opts={}]
* @memberof PanelFieldModel
*/
constructor(opts: any = {}) {
super(opts);
this.disabled = opts.disabled ? true : false;
this.enableCond = opts.enableCond;
}
/**
* 设置是否启用
*
* @param {boolean} state
* @memberof PanelFieldModel
*/
public setDisabled(state: boolean): void {
this.disabled = state;
}
/**
* 设置信息内容
*
* @param {string} error
* @memberof PanelFieldModel
*/
public setError(error: string): void {
this.error = error;
}
/**
* 设置是否启用
*
* @param {string} srfuf
* @memberof PanelFieldModel
*/
public setEnableCond(srfuf: string): void {
// 是否有权限
const isReadOk: boolean = true;
const _srfuf: number = parseInt(srfuf, 10);
let state: boolean = true;
if (isReadOk) {
if (_srfuf === 1) {
if ((this.enableCond & 2) === 2) {
state = false;
}
} else {
if ((this.enableCond & 1) === 1) {
state = false;
}
}
}
this.setDisabled(state);
}
}
\ No newline at end of file
import { PanelDetailModel } from './panel-detail';
/**
* 直接内容模型
*
* @export
* @class PanelRawitemModel
* @extends {PanelDetailModel}
*/
export class PanelRawitemModel extends PanelDetailModel {
constructor(opts: any = {}) {
super(opts);
}
}
\ No newline at end of file
import { PanelDetailModel } from './panel-detail';
import { PanelTabPanelModel } from './panel-tab-panel';
/**
* 分页面板模型
*
* @export
* @class PanelTabPageModel
* @extends {PanelDetailModel}
*/
export class PanelTabPageModel extends PanelDetailModel {
/**
* Creates an instance of PanelTabPageModel.
* PanelTabPageModel 实例
*
* @param {*} [opts={}]
* @memberof PanelTabPageModel
*/
constructor(opts: any = {}) {
super(opts);
}
/**
* 设置分页是否启用
*
* @param {boolean} state
* @memberof PanelTabPageModel
*/
public setVisible(state: boolean): void {
this.visible = state;
const tabPanel = this.getTabPanelModel();
if (tabPanel) {
tabPanel.setActiviePage();
}
}
/**
* 获取分页面板
*
* @returns {(PanelTabPanelModel | null)}
* @memberof PanelTabPageModel
*/
public getTabPanelModel(): PanelTabPanelModel | null {
if (!this.panel) {
return null;
}
const tabPanels: any[] = Object.values(this.panel.detailsModel).filter((model: any) => Object.is(model.itemType, 'TABPANEL'));
let index = tabPanels.findIndex((tabPanel: any) => {
return tabPanel.tabPages.some((tabPag: any) => Object.is(tabPag.name, this.name));
});
if (index === -1) {
return null;
}
const tabPanel: PanelTabPanelModel = tabPanels[index];
return tabPanel;
}
}
\ No newline at end of file
import { PanelDetailModel } from './panel-detail';
/**
* 分页部件模型
*
* @export
* @class PanelTabPanelModel
* @extends {PanelDetailModel}
*/
export class PanelTabPanelModel extends PanelDetailModel {
/**
* 被激活分页
*
* @type {string}
* @memberof PanelTabPanelModel
*/
public activiedPage: string = '';
/**
* 选中激活状态
*
* @type {string}
* @memberof PanelTabPanelModel
*/
public clickActiviePage: string = '';
/**
* 分页子成员
*
* @type {any[]}
* @memberof PanelTabPanelModel
*/
public tabPages: any[] = [];
/**
* Creates an instance of PanelTabPanelModel.
* PanelTabPanelModel 实例
*
* @param {*} [opts={}]
* @memberof PanelTabPanelModel
*/
constructor(opts: any = {}) {
super(opts);
this.tabPages = [...opts.tabPages];
if (this.tabPages.length > 0) {
this.activiedPage = this.tabPages[0].name;
}
}
/**
* 设置激活分页
*
* @memberof PanelTabPanelModel
*/
public setActiviePage(): void {
if (!this.panel) {
return;
}
const detailsModel: any = this.panel.detailsModel;
const index = this.tabPages.findIndex((tabpage: any) => Object.is(tabpage.name, this.clickActiviePage) && Object.is(tabpage.name, this.activiedPage) && detailsModel[tabpage.name].visible);
if (index !== - 1) {
return;
}
this.tabPages.some((tabpage: any) => {
if (detailsModel[tabpage.name].visible) {
this.activiedPage = tabpage.name;
return true;
}
return false;
});
}
/**
* 选中页面
*
* @param {*} $event
* @returns {void}
* @memberof PanelTabPanelModel
*/
public clickPage($event: any): void {
if (!$event) {
return;
}
this.clickActiviePage = $event;
this.activiedPage = $event;
}
}
\ No newline at end of file
import { PanelDetailModel } from './panel-detail';
/**
* 用户控件模型
*
* @export
* @class PanelUserControlModel
* @extends {PanelDetailModel}
*/
export class PanelUserControlModel extends PanelDetailModel {
constructor(otps:any = {}) {
super(otps);
}
}
\ No newline at end of file
......@@ -152,15 +152,6 @@ export default class SDFileEditViewBase extends Vue {
* @memberof SDFileEditViewBase
*/
public appUIService: SDFileUIService = new SDFileUIService(this.$store);
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SDFileEditViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
......@@ -280,6 +271,8 @@ export default class SDFileEditViewBase extends Vue {
_this.engine.load();
});
} else if(!Object.is(newVal, oldVal) && _this.refresh() && Object.is(_this.$util.typeOf(_this.refresh()), 'function')) {
_this.refresh();
}
}
......@@ -423,6 +416,15 @@ export default class SDFileEditViewBase extends Vue {
*/
public viewCacheData:any;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SDFileEditViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 解析视图参数
*
......@@ -1554,6 +1556,14 @@ export default class SDFileEditViewBase extends Vue {
this.serviceStateEvent.unsubscribe();
}
}
// 销毁计数器定时器
if(this.counterServiceArray && this.counterServiceArray.length >0){
this.counterServiceArray.forEach((item:any) =>{
if(item.destroyCounter && item.destroyCounter instanceof Function){
item.destroyCounter();
}
})
}
}
......
......@@ -182,15 +182,6 @@ export default class SDFileGridViewBase extends Vue {
* @memberof SDFileGridViewBase
*/
public appUIService: SDFileUIService = new SDFileUIService(this.$store);
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SDFileGridViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
......@@ -310,6 +301,8 @@ export default class SDFileGridViewBase extends Vue {
_this.engine.load();
});
} else if(!Object.is(newVal, oldVal) && _this.refresh() && Object.is(_this.$util.typeOf(_this.refresh()), 'function')) {
_this.refresh();
}
}
......@@ -458,6 +451,15 @@ export default class SDFileGridViewBase extends Vue {
*/
public viewCacheData:any;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SDFileGridViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 解析视图参数
*
......@@ -1603,6 +1605,14 @@ export default class SDFileGridViewBase extends Vue {
this.serviceStateEvent.unsubscribe();
}
}
// 销毁计数器定时器
if(this.counterServiceArray && this.counterServiceArray.length >0){
this.counterServiceArray.forEach((item:any) =>{
if(item.destroyCounter && item.destroyCounter instanceof Function){
item.destroyCounter();
}
})
}
}
/**
......
......@@ -63,6 +63,7 @@
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch,Inject } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
......@@ -71,21 +72,14 @@ import { Subject,Subscription } from 'rxjs';
import { appConfig } from '@/config/appConfig';
@Component({
components: {
},
})
export default class SDIndexViewBase extends Vue {
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SDIndexViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 数据变化
......@@ -197,6 +191,8 @@ export default class SDIndexViewBase extends Vue {
_this.engine.load();
});
} else if(!Object.is(newVal, oldVal) && _this.refresh() && Object.is(_this.$util.typeOf(_this.refresh()), 'function')) {
_this.refresh();
}
}
......@@ -288,6 +284,15 @@ export default class SDIndexViewBase extends Vue {
*/
public viewCacheData:any;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SDIndexViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 解析视图参数
*
......@@ -575,7 +580,7 @@ export default class SDIndexViewBase extends Vue {
} else if (localStorage.getItem('theme-class')) {
return localStorage.getItem('theme-class');
} else {
return 'app-default-theme';
return appConfig.defaultTheme;
}
}
......@@ -591,7 +596,7 @@ export default class SDIndexViewBase extends Vue {
} else if (localStorage.getItem('font-family')) {
return localStorage.getItem('font-family');
} else {
return 'Microsoft YaHei';
return appConfig.defaultFont;
}
}
......@@ -644,12 +649,8 @@ export default class SDIndexViewBase extends Vue {
* @type {string[]}
* @memberof SDIndexViewBase
*/
get themeClasses(): string[] {
return [
Object.is(this.selectTheme, 'app_theme_blue') ? 'app_theme_blue' : '',
Object.is(this.selectTheme, 'app-default-theme') ? 'app-default-theme' : '',
Object.is(this.selectTheme, 'app_theme_darkblue') ? 'app_theme_darkblue' : '',
];
get themeClasses(): string {
return this.selectTheme;
}
/**
......
......@@ -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: ${item.getKeyPSAppDEField().getCodeNa... [in template "TEMPLCODE_en_US" at line 570, column 26]
- Failed at: ${item.getKeyPSAppDEField().getCodeNa... [in template "TEMPLCODE_en_US" at line 616, column 26]
----
\ No newline at end of file
/**
* 获取部门成员
*
* @param state
*/
export const getDepartmentPersonnel = (state: any) => () => {
return state.departmentPersonnel;
}
/**
* 获取代码表对象
*
......
import { Environment } from '@/environments/environment';
/**
* 添加部门成员
*
* @param state
* @param codelists
*/
export const addDepartmentPersonnel = (state: any, departmentPersonnel: Array<any>) => {
state.departmentPersonnel = [];
state.departmentPersonnel = [...departmentPersonnel];
}
/**
* 添加代码表
*
......@@ -101,7 +112,7 @@ export const addPage = (state: any, arg: any) => {
// 视图类型为REDIRECTVIEW和NOTAB的视图不添加缓存
if(Object.is(arg.meta.viewType, 'REDIRECTVIEW') || Object.is(arg.meta.viewType, 'NOTAB')){
return;
}else if(Object.is(arg.meta.viewType, 'APPINDEX')) {
}else if (Object.is(arg.meta.viewType, 'APPINDEX')) {
window.sessionStorage.setItem(Environment.AppName, arg.fullPath);
} else {
const page: any = {};
......
......@@ -7,6 +7,7 @@ export const rootstate: any = {
pageMetas: [],
historyPathList: [],
codelists: [],
departmentPersonnel:[],
selectTheme: '',
selectFont: '',
appdata: '',
......
......@@ -632,7 +632,7 @@ export default class SDIndexViewBase extends Vue implements ControlInterface {
* @memberof SDIndexViewBase
*/
public handleMenusResource(inputMenus:Array<any>){
if(Environment.enablePermissionValid){
if(this.$store.getters['authresource/getEnablePermissionValid']){
this.computedEffectiveMenus(inputMenus);
this.computeParentMenus(inputMenus);
}
......
......@@ -563,7 +563,7 @@ export default class MainBase extends Vue implements ControlInterface {
public saveState:any ;
/**
* 属性值规则
* 值规则
*
* @type {*}
* @memberof MainBase
......@@ -1409,20 +1409,18 @@ export default class MainBase extends Vue implements ControlInterface {
* @memberof MainBase
*/
public computeButtonState(data:any){
if(Environment.enablePermissionValid){
let targetData:any = this.transformData(data);
if(this.detailsModel && Object.keys(this.detailsModel).length >0){
Object.keys(this.detailsModel).forEach((name:any) =>{
if(this.detailsModel[name] && this.detailsModel[name].uiaction && this.detailsModel[name].uiaction.dataaccaction && Object.is(this.detailsModel[name].detailType,"BUTTON")){
this.detailsModel[name].isPower = true;
let tempUIAction:any = JSON.parse(JSON.stringify(this.detailsModel[name].uiaction));
let result: any[] = ViewTool.calcActionItemAuthState(targetData,[tempUIAction],this.appUIService);
this.detailsModel[name].visible = tempUIAction.visabled;
this.detailsModel[name].disabled = tempUIAction.disabled;
this.detailsModel[name].isPower = result[0] === 1 ? true : false;
}
})
}
let targetData:any = this.transformData(data);
if(this.detailsModel && Object.keys(this.detailsModel).length >0){
Object.keys(this.detailsModel).forEach((name:any) =>{
if(this.detailsModel[name] && this.detailsModel[name].uiaction && this.detailsModel[name].uiaction.dataaccaction && Object.is(this.detailsModel[name].detailType,"BUTTON")){
this.detailsModel[name].isPower = true;
let tempUIAction:any = JSON.parse(JSON.stringify(this.detailsModel[name].uiaction));
let result: any[] = ViewTool.calcActionItemAuthState(targetData,[tempUIAction],this.appUIService);
this.detailsModel[name].visible = tempUIAction.visabled;
this.detailsModel[name].disabled = tempUIAction.disabled;
this.detailsModel[name].isPower = result[0] === 1 ? true : false;
}
})
}
}
......
......@@ -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_en_US" at line 1103, column 39]
- Failed at: ${ctrl.getPSAppDataEntity().getMajorP... [in template "TEMPLCODE_en_US" at line 1142, column 39]
----
\ No newline at end of file
......@@ -116,7 +116,61 @@
}
}
}
.cell-indeterminate {
>div>label {
>span {
.el-checkbox__inner {
background-color: #409eff;
border-color: #409eff;
}
.el-checkbox__inner:before {
content: "";
position: absolute;
display: block;
background-color: #fff;
height: 2px;
transform: scale(.5);
left: 0;
right: 0;
top: 5px;
}
}
>span.is-checked {
.el-checkbox__inner {
background-color: #409eff;
border-color: #409eff;
}
.el-checkbox__inner:after {
border: 0px;
}
}
}
}
.cell-select-all {
>div>label {
>span {
.el-checkbox__inner {
background-color: #409eff;
border-color: #409eff;
}
.el-checkbox__inner:after {
box-sizing: content-box;
content: "";
border: 1px solid #fff;
border-left: 0;
border-top: 0;
height: 7px;
left: 4px;
position: absolute;
top: 1px;
transform: rotate(45deg) scaleY(1);
width: 3px;
transition: transform .15s ease-in .05s;
transform-origin: center;
}
}
}
}
// this is less
......@@ -3,7 +3,6 @@ package cn.ibizlab.config;
import cn.ibizlab.util.security.AuthenticationEntryPoint;
import cn.ibizlab.util.security.AuthorizationTokenFilter;
import cn.ibizlab.util.service.AuthenticationUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
......@@ -55,7 +54,7 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
private String previewpath;
@Value("${ibiz.auth.excludesPattern:}")
private String excludesPattern;
private String[] excludesPattern;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
......@@ -119,11 +118,10 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/"+uploadpath).permitAll()
.antMatchers("/"+previewpath+"/**").permitAll();
if (StringUtils.isNotBlank(excludesPattern)) {
for (String excludePattern : excludesPattern.split("\\s*,\\s*")) {
authenticationTokenFilter.addExcludePattern(excludePattern);
httpSecurity.authorizeRequests().antMatchers(excludePattern).permitAll();
}
for (String excludePattern : excludesPattern) {
authenticationTokenFilter.addExcludePattern(excludePattern);
httpSecurity.authorizeRequests().antMatchers(excludePattern).permitAll();
}
httpSecurity.authorizeRequests().anyRequest().authenticated()
......
......@@ -22,6 +22,7 @@ import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.util.ObjectUtils;
import org.springframework.beans.factory.annotation.Value;
import cn.ibizlab.util.errors.BadRequestAlertException;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.context.annotation.Lazy;
import cn.ibizlab.core.disk.domain.SDFile;
......@@ -35,6 +36,7 @@ import cn.ibizlab.util.helper.DEFieldCacheMap;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.ibizlab.core.disk.mapper.SDFileMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.alibaba.fastjson.JSONObject;
import org.springframework.util.StringUtils;
......@@ -59,6 +61,7 @@ public class SDFileServiceImpl extends ServiceImpl<SDFileMapper, SDFile> impleme
}
@Override
@Transactional
public void createBatch(List<SDFile> list) {
this.saveBatch(list,batchSize);
}
......@@ -66,13 +69,14 @@ public class SDFileServiceImpl extends ServiceImpl<SDFileMapper, SDFile> impleme
@Override
@Transactional
public boolean update(SDFile et) {
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("fileid",et.getId())))
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("fileid",et.getId())))
return false;
CachedBeanCopier.copy(get(et.getId()),et);
return true;
}
@Override
@Transactional
public void updateBatch(List<SDFile> list) {
updateBatchById(list,batchSize);
}
......@@ -85,6 +89,7 @@ public class SDFileServiceImpl extends ServiceImpl<SDFileMapper, SDFile> impleme
}
@Override
@Transactional
public void removeBatch(Collection<String> idList) {
removeByIds(idList);
}
......@@ -130,12 +135,14 @@ public class SDFileServiceImpl extends ServiceImpl<SDFileMapper, SDFile> impleme
}
@Override
@Transactional
public boolean saveBatch(Collection<SDFile> list) {
saveOrUpdateBatch(list,batchSize);
return true;
}
@Override
@Transactional
public void saveBatch(List<SDFile> list) {
saveOrUpdateBatch(list,batchSize);
}
......@@ -201,6 +208,7 @@ public class SDFileServiceImpl extends ServiceImpl<SDFileMapper, SDFile> impleme
return entities;
}
}
......
......@@ -16,7 +16,7 @@
<!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 -->
<resultMap id="SDFileResultMap" type="cn.ibizlab.core.disk.domain.SDFile" autoMapping="true">
<id property="id" column="fileid" /><!--主键字段映射-->
<id property="id" column="fileid" /><!--主键字段映射-->
<result property="name" column="filename" />
<result property="extension" column="fileext" />
......
......@@ -3,7 +3,6 @@ package cn.ibizlab.api.config;
import cn.ibizlab.util.security.AuthenticationEntryPoint;
import cn.ibizlab.util.security.AuthorizationTokenFilter;
import cn.ibizlab.util.service.AuthenticationUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
......@@ -57,7 +56,7 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
private String previewpath;
@Value("${ibiz.auth.excludesPattern:}")
private String excludesPattern;
private String[] excludesPattern;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
......@@ -124,11 +123,9 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/"+uploadpath).permitAll()
.antMatchers("/"+previewpath+"/**").permitAll();
if (StringUtils.isNotBlank(excludesPattern)) {
for (String excludePattern : excludesPattern.split("\\s*,\\s*")) {
authenticationTokenFilter.addExcludePattern(excludePattern);
httpSecurity.authorizeRequests().antMatchers(excludePattern).permitAll();
}
for (String excludePattern : excludesPattern) {
authenticationTokenFilter.addExcludePattern(excludePattern);
httpSecurity.authorizeRequests().antMatchers(excludePattern).permitAll();
}
// 所有请求都需要认证
......
......@@ -12,6 +12,9 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import cn.ibizlab.util.domain.DTOBase;
import cn.ibizlab.util.domain.DTOClient;
import lombok.Data;
......@@ -30,6 +33,7 @@ public class SDFileDTO extends DTOBase implements Serializable {
*/
@JSONField(name = "id")
@JsonProperty("id")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
private String id;
/**
......@@ -38,6 +42,7 @@ public class SDFileDTO extends DTOBase implements Serializable {
*/
@JSONField(name = "name")
@JsonProperty("name")
@Size(min = 0, max = 200, message = "内容长度必须小于等于[200]")
private String name;
/**
......@@ -46,6 +51,7 @@ public class SDFileDTO extends DTOBase implements Serializable {
*/
@JSONField(name = "file_path")
@JsonProperty("file_path")
@Size(min = 0, max = 500, message = "内容长度必须小于等于[500]")
private String filePath;
/**
......@@ -54,6 +60,7 @@ public class SDFileDTO extends DTOBase implements Serializable {
*/
@JSONField(name = "folder")
@JsonProperty("folder")
@Size(min = 0, max = 40, message = "内容长度必须小于等于[40]")
private String folder;
/**
......@@ -70,6 +77,7 @@ public class SDFileDTO extends DTOBase implements Serializable {
*/
@JSONField(name = "extension")
@JsonProperty("extension")
@Size(min = 0, max = 20, message = "内容长度必须小于等于[20]")
private String extension;
/**
......@@ -78,6 +86,7 @@ public class SDFileDTO extends DTOBase implements Serializable {
*/
@JSONField(name = "owner_type")
@JsonProperty("owner_type")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
private String ownerType;
/**
......@@ -86,6 +95,7 @@ public class SDFileDTO extends DTOBase implements Serializable {
*/
@JSONField(name = "owner_id")
@JsonProperty("owner_id")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
private String ownerId;
/**
......@@ -94,6 +104,7 @@ public class SDFileDTO extends DTOBase implements Serializable {
*/
@JSONField(name = "memo")
@JsonProperty("memo")
@Size(min = 0, max = 500, message = "内容长度必须小于等于[500]")
private String memo;
/**
......@@ -102,6 +113,7 @@ public class SDFileDTO extends DTOBase implements Serializable {
*/
@JSONField(name = "digest_code")
@JsonProperty("digest_code")
@Size(min = 0, max = 64, message = "内容长度必须小于等于[64]")
private String digestCode;
/**
......@@ -110,6 +122,7 @@ public class SDFileDTO extends DTOBase implements Serializable {
*/
@JSONField(name = "createman")
@JsonProperty("createman")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
private String createman;
/**
......@@ -127,6 +140,7 @@ public class SDFileDTO extends DTOBase implements Serializable {
*/
@JSONField(name = "updateman")
@JsonProperty("updateman")
@Size(min = 0, max = 100, message = "内容长度必须小于等于[100]")
private String updateman;
/**
......@@ -214,3 +228,4 @@ public class SDFileDTO extends DTOBase implements Serializable {
}
......@@ -22,6 +22,7 @@ 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 org.springframework.validation.annotation.Validated;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
......@@ -49,7 +50,7 @@ public class SDFileResource {
@PreAuthorize("hasPermission(this.sdfileMapping.toDomain(#sdfiledto),'ibzdisk-SDFile-Create')")
@ApiOperation(value = "新建文件", tags = {"文件" }, notes = "新建文件")
@RequestMapping(method = RequestMethod.POST, value = "/sdfiles")
public ResponseEntity<SDFileDTO> create(@RequestBody SDFileDTO sdfiledto) {
public ResponseEntity<SDFileDTO> create(@Validated @RequestBody SDFileDTO sdfiledto) {
SDFile domain = sdfileMapping.toDomain(sdfiledto);
sdfileService.create(domain);
SDFileDTO dto = sdfileMapping.toDto(domain);
......
......@@ -213,7 +213,7 @@ public class DEFieldDefaultValueAspect
private void fillPreFieldValue(String fieldname , DEPredefinedFieldType preFieldType ,EntityBase et , String actionName,String logicValue ,AuthenticationUser curUser) throws Exception {
Object fieldValue = et.get(fieldname);
//为预置属性进行赋值
if( actionName.equalsIgnoreCase("create")||
if( actionName.toLowerCase().startsWith("create") ||
preFieldType== DEPredefinedFieldType.UPDATEDATE|| preFieldType== DEPredefinedFieldType.UPDATEMAN||
preFieldType== DEPredefinedFieldType.UPDATEMANNAME){
......
......@@ -22,12 +22,6 @@ public class PayTrade{
@JSONField(name = "total_amount")
@JsonProperty("total_amount")
private String totalAmount;
/**
* 支付类型
*/
@JSONField(name = "trade_type")
@JsonProperty("trade_type")
private String tradeType;
/**
* 订单号
*/
......@@ -35,13 +29,7 @@ public class PayTrade{
@JsonProperty("out_trade_no")
private String outTradeNo;
/**
* 应用标识
*/
@JSONField(name = "app_id")
@JsonProperty("app_id")
private String appId;
/**
* 支付平台接入标识
* rt开放平台配置标识(OpenAccessId或AppId)
*/
@JSONField(name = "access_id")
@JsonProperty("access_id")
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册