提交 3ba384cc 编写于 作者: tony001's avatar tony001

Merge branch '2020.08.09-667' of...

Merge branch '2020.08.09-667' of http://demo.ibizlab.cn/ibizr7pfstdtempl/ibizvuer7res into 2020.08.09-667
## v7.0.0-alpha.18 [2020-8-23]
### Bug修复
修复后续界面行为异常问题
修复表格合计行去掉N/A字样
修复树表跳转页面逻辑
修复嵌入表格保存提示信息重复问题
修复表格表格值清空保存问题
### 功能新增及优化
#### 模板
新增向导面板支持状态属性
新增应用全屏功能和应用锁屏功能
新增搜索表单新建默认值逻辑
新增实体表格值规则
新增动态工作流导航视图计数器
新增工作流审批意见控件时光轴样式组件和cron表达式组件
新增支持日历部件项布局面板
优化视图标题问题
优化表单属性值规则,无值的时候不校验
优化表单按钮、表单分组界面行为、表格操作列、工具栏、操作列权限控制
优化实体数据多项选择视图选中效果
优化动态代码表本地缓存逻辑
优化合入应用级上下文时机
优化实体数据重定向视图逻辑
优化表单开始流程和提交流程逻辑
#### 基础文件
修复表格滑动条表头与内容不齐
修复数据选择(嵌入视图)抛值异常问题
优化权限服务基类菜单权限和统一资源权限
优化动态工作流导航视图引擎
优化表单按钮、表单分组界面行为、表格操作列、工具栏、操作列权限控制
优化表单项增加padding
新增应用全屏组件和应用锁屏组件
新增工作流审批意见控件时光轴样式组件和cron表达式组件
## v7.0.0-alpha.17 [2020-8-9] ## v7.0.0-alpha.17 [2020-8-9]
### Bug修复 ### Bug修复
......
...@@ -81,6 +81,10 @@ import AppDepartmentSelect from './components/app-department-select/app-departme ...@@ -81,6 +81,10 @@ import AppDepartmentSelect from './components/app-department-select/app-departme
import AppGroupSelect from './components/app-group-select/app-group-select.vue' import AppGroupSelect from './components/app-group-select/app-group-select.vue'
import UpdatePwd from './components/app-update-password/app-update-password.vue' import UpdatePwd from './components/app-update-password/app-update-password.vue'
import AppMenuItem from './components/app-menu-item/app-menu-item.vue' import AppMenuItem from './components/app-menu-item/app-menu-item.vue'
import AppFullScren from './components/app-full-scren/app-full-scren.vue'
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'
// 全局挂载UI实体服务注册中心 // 全局挂载UI实体服务注册中心
window['uiServiceRegister'] = uiServiceRegister; window['uiServiceRegister'] = uiServiceRegister;
// 全局挂载实体权限服务注册中心 // 全局挂载实体权限服务注册中心
...@@ -105,6 +109,8 @@ export const AppComponents = { ...@@ -105,6 +109,8 @@ export const AppComponents = {
v.prototype.$verify = Verify; v.prototype.$verify = Verify;
v.prototype.$viewTool = ViewTool; v.prototype.$viewTool = ViewTool;
v.prototype.$uiActionTool = UIActionTool; v.prototype.$uiActionTool = UIActionTool;
v.component('app-full-scren',AppFullScren);
v.component('app-lock-scren',AppLockScren);
v.component('input-box', InputBox); v.component('input-box', InputBox);
v.component('app-keep-alive',AppKeepAlive); v.component('app-keep-alive',AppKeepAlive);
v.component('tab-page-exp',TabPageExp); v.component('tab-page-exp',TabPageExp);
...@@ -175,5 +181,7 @@ export const AppComponents = { ...@@ -175,5 +181,7 @@ export const AppComponents = {
v.component('context-menu-drag',ContextMenuDrag); v.component('context-menu-drag',ContextMenuDrag);
v.component('app-update-password',UpdatePwd); v.component('app-update-password',UpdatePwd);
v.component('app-menu-item', AppMenuItem); v.component('app-menu-item', AppMenuItem);
v.component('action-timeline', ActionTimeline);
v.component('cron-editor', CronEditor);
}, },
}; };
\ No newline at end of file
import { Store } from 'vuex';
/**
* 实体权限服务
*
* @export
* @class AuthService
*/
export default class AuthService {
/**
* Vue 状态管理器
*
* @public
* @type {(any | null)}
* @memberof AuthService
*/
public $store: Store<any> | null = null;
/**
* 默认操作标识
*
* @public
* @type {(any)}
* @memberof AuthService
*/
public defaultOPPrivs: any = { UPDATE: 1, CREATE: 1, READ: 1, DELETE: 1, WFSTART:1,DENY:1,NONE:1 };
/**
* Creates an instance of AuthService.
*
* @param {*} [opts={}]
* @memberof AuthService
*/
constructor(opts: any = {}) {
this.$store = opts.$store;
}
/**
* 获取状态管理器
*
* @returns {(any | null)}
* @memberof AuthService
*/
public getStore(): Store<any> | null {
return this.$store;
}
/**
* 获取实体权限服务
*
* @param {string} name 实体名称
* @returns {Promise<any>}
* @memberof AuthService
*/
public getService(name: string): Promise<any> {
return (window as any)['authServiceRegister'].getService(name);
}
/**
* 根据当前数据获取实体操作标识
*
* @param {string} name 实体名称
* @returns {any}
* @memberof AuthService
*/
public getOPPrivs(data: any): any {
return null;
}
/**
* 根据菜单项获取菜单权限
*
* @param {*} item 菜单标识
* @returns {boolean}
* @memberof AuthService
*/
public getMenusPermission(item: any): boolean {
return true;
}
/**
* 根据统一资源标识获取统一资源权限
*
* @param {*} tag 统一资源标识
* @returns {boolean}
* @memberof AuthService
*/
public getResourcePermission(tag: any): boolean {
return true;
}
}
\ No newline at end of file
.action-timeline-table {
width: calc(100% - 60px);
margin: 0 30px;
border-collapse:separate;
border-spacing:0px 40px;
.action-timeline-thead {
th:nth-child(1) {
min-width: 200px;
}
th:nth-child(2) {
width: 100%
}
}
.action-timeline-tbody {
tr {
td {
position: relative;
> .date {
display: flex;
width: max-content;
padding: 16px;
font-size: 16px;
border: 2px solid #515a6e;
.arrow {
margin-left: 10px;
}
}
>.date::before {
content: ' ';
display: block;
position: absolute;
right: -20px;
top: 30px;
height: 2px;
width: 20px;
background-color: #515a6e;
}
>.timeline {
padding: 16px;
border: 2px solid #515a6e;
min-height: 68px;
margin-left: 18px;
.action-timeline-wrapper {
padding-left: 115px;
color: var(--view-font-color-bright);
>.action-timeline-item {
position: relative;
height: 30px;
display: list-item;
list-style: none;
top: -6px;
>.timeline-time {
position: absolute;
left: -115px;
top: 5px;
font-size: 12px;
}
>.timeline-content {
padding: 5px;
padding-left: 65px;
}
}
>.action-timeline-item::before {
position: absolute;
top: 17px;
left: 45px;
z-index: 3;
width: 7px;
height: 7px;
background-color: var(--view-button-background-color);
border: 1px solid #515a6e;
content: ' ';
border-radius: 50%;
}
>.action-timeline-item:nth-child(n+2)::after {
position: absolute;
top: -7px;
bottom: 12px;
left: 48px;
z-index: 1;
display: block;
content: ' ';
border-left: 1px solid #515a6e;
}
}
}
}
}
}
}
\ No newline at end of file
<template>
<div class="action-timeline">
<table class="action-timeline-table">
<thead class="action-timeline-thead">
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody class="action-timeline-tbody">
<template v-for="(usertask, usertaskIndex) in data.usertasks">
<tr :key='usertaskIndex'>
<td align="right" valign="top">
<div class='date'>
<div class='usertaskname'>{{ usertask.userTaskName }}</div>
<div class='arrow' @click="changeExpand(usertask)">
<i :class="usertask.isShow ? 'el-icon-arrow-down' : 'el-icon-arrow-up' " />
</div>
</div>
</td>
<td>
<div class='timeline'>
<template v-if="usertask.identitylinks && usertask.identitylinks.length > 0">
{{$t('components.appWFApproval.wait')}}
<strong>
<template v-for="(identitylink, len) in usertask.identitylinks">
<template v-if="identitylink.displayname">
{{ identitylink.displayname }}
<template v-if="len != usertask.identitylinks.length - 1">
</template>
</template>
</template>
</strong>
{{$t('components.appWFApproval.handle')}}
</template>
<template v-else>
<ul class="action-timeline-wrapper">
<template v-if="!usertask.isShow">
<li v-if="usertask.comments && usertask.comments.length > 0" class="action-timeline-item">
<div class='timeline-time'>
{{ formatDate(usertask.comments[0].time, 'MM月DD日 HH:mm') }}&nbsp;{{ usertask.comments[0].authorName }}
</div>
<div class='timeline-content'>
{{ usertask.comments[0].type }}&nbsp;{{ usertask.comments[0].fullMessage }}
</div>
</li>
</template>
<template v-else>
<template v-for="(comment, commentIndex) in usertask.comments">
<li :key="commentIndex" class="action-timeline-item">
<div class='timeline-time'>
{{ formatDate(comment.time, 'MM月DD日 HH:mm')}} &nbsp;{{ comment.authorName }}
</div>
<div class='timeline-content'>
{{ comment.type }}&nbsp;{{ comment.fullMessage }}
</div>
</li>
</template>
</template>
</ul>
</template>
</div>
</td>
</tr>
</template>
</tbody>
</table>
</div>
</template>
<script lang="ts">
import { Vue, Component, Prop, Watch } from 'vue-property-decorator';
import moment from 'moment';
@Component({
})
export default class ActionTimeline extends Vue {
/**
* 数据
*
* @memberof ActionTimeline
*/
public data:any = {};
/**
* 初始化memo
*
* @memberof ActionTimeline
*/
public initmemo:string = "";
/**
* 传入数据服务
*
* @memberof ActionTimeline
*/
@Prop() public service:any;
/**
* 上下文
*
* @memberof ActionTimeline
*/
@Prop() public context:any;
/**
* 视图参数
*
* @memberof ActionTimeline
*/
@Prop() public viewparams:any;
/**
* 初始化数据
*
* @memberof ActionTimeline
*/
public created(){
if(this.service){
this.service.GetWFHistory(this.context).then((res:any) =>{
if(res && (res.status === 200)){
this.data = res.data;
this.initUIStateData();
}
})
}
}
/**
* 初始化数据添加标记
*
* @memberof ActionTimeline
*/
public initUIStateData() {
if(this.data && this.data.usertasks) {
this.data.usertasks.forEach((item: any) => {
item.isShow = true;
})
}
}
/**
* 时间转换
*
* @memberof ActionTimeline
*/
public formatDate(date: string, format: string) {
return moment(date).format(format);
}
/**
* 点击事件
*
* @memberof ActionTimeline
*/
public changeExpand(usertask:any) {
usertask.isShow = !usertask.isShow;
this.$forceUpdate();
}
}
</script>
<style lang='less'>
@import './action-timeline.less';
</style>
\ No newline at end of file
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
<div class="app-actionbar"> <div class="app-actionbar">
<div class="app-actionbar-item" v-for="(item,index) in items" :key="index"> <div class="app-actionbar-item" v-for="(item,index) in items" :key="index">
<Badge v-if="item.counterService&&item.counterService.counterData" v-show="item.visabled" :count="item.counterService.counterData[item.counterId]" type="primary"> <Badge v-if="item.counterService&&item.counterService.counterData" v-show="item.visabled" :count="item.counterService.counterData[item.counterId]" type="primary">
<i-button :style="{'pointer-events':item.disabled?'none':'auto'}" @click="handleClick(item, $event)"><i v-if="item.icon" style="margin-right: 5px;" :class="item.icon"></i>{{item.actionName}}</i-button> <i-button :disabled="item.disabled" @click="handleClick(item, $event)"><i v-if="item.icon" style="margin-right: 5px;" :class="item.icon"></i>{{item.actionName}}</i-button>
</Badge> </Badge>
<i-button v-show="item.visabled" :style="{'pointer-events':item.disabled?'none':'auto'}" v-else @click="handleClick(item, $event)">{{item.actionName}}</i-button> <i-button v-show="item.visabled" :disabled="item.disabled" v-else @click="handleClick(item, $event)">{{item.actionName}}</i-button>
</div> </div>
</div> </div>
</template> </template>
...@@ -104,8 +104,15 @@ export default class AppActionBar extends Vue { ...@@ -104,8 +104,15 @@ export default class AppActionBar extends Vue {
return; return;
} }
const _item = ActionModel[key]; const _item = ActionModel[key];
if(_item && _item['dataaccaction'] && UIService && data && Object.keys(data).length >0){ if(_item && _item['dataaccaction'] && UIService){
let dataActionResult:any = UIService.getAllOPPrivs(data)[_item['dataaccaction']]; 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 // 无权限:0;有权限:1
if(dataActionResult === 0){ if(dataActionResult === 0){
// 禁用:1;隐藏:2;隐藏且默认隐藏:6 // 禁用:1;隐藏:2;隐藏且默认隐藏:6
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</div> </div>
<template v-if="placeholder"> <template v-if="placeholder">
<div v-if="value" class="app-embed-value"> <div v-if="value" class="app-embed-value">
<span v-for="(item,index) in value" :key="index"> <span v-for="(item,index) in value.split(',')" :key="index">
{{item}} {{item}}
</span> </span>
</div> </div>
...@@ -101,7 +101,7 @@ export default class AppEmbedPicker extends Vue { ...@@ -101,7 +101,7 @@ export default class AppEmbedPicker extends Vue {
* @type {string} * @type {string}
* @memberof AppEmbedPicker * @memberof AppEmbedPicker
*/ */
@Prop() public valueItem?: string; @Prop() public valueItem!: string;
/** /**
* 关联视图名称 * 关联视图名称
...@@ -176,17 +176,28 @@ export default class AppEmbedPicker extends Vue { ...@@ -176,17 +176,28 @@ export default class AppEmbedPicker extends Vue {
if (!this.data) { if (!this.data) {
return; return;
} }
let formData:any = JSON.parse(this.data);
let arg: any = {}; let arg: any = {};
// 合并视图上下文参数和视图参数 // 合并视图上下文参数和视图参数
arg.param = JSON.parse(JSON.stringify(this.viewparams)); arg.param = JSON.parse(JSON.stringify(this.viewparams));
arg.context = JSON.parse(JSON.stringify(this.context)); arg.context = JSON.parse(JSON.stringify(this.context));
if(formData[this.name] && formData[this.valueItem]){
let selectItems:Array<any> = [];
let tempvalue: Array<any> = formData[this.valueItem].split(',');
let temptext: Array<any> = formData[this.name].split(',');
tempvalue.forEach((srfkey: any, index: number)=>{
selectItems.push({ srfmajortext : temptext[index], srfkey: srfkey });
});
arg.param.selectedData = selectItems;
this.$forceUpdate();
}
// 附加参数处理 // 附加参数处理
if (this.localContext && Object.keys(this.localContext).length >0) { if (this.localContext && Object.keys(this.localContext).length >0) {
let _context = this.$util.computedNavData(this.data,arg.context,arg.param,this.localContext); let _context = this.$util.computedNavData(formData,arg.context,arg.param,this.localContext);
Object.assign(arg.context,_context); Object.assign(arg.context,_context);
} }
if (this.localParam && Object.keys(this.localParam).length >0) { if (this.localParam && Object.keys(this.localParam).length >0) {
let _param = this.$util.computedNavData(this.data,arg.param,arg.param,this.localParam); let _param = this.$util.computedNavData(formData,arg.context,arg.param,this.localParam);
Object.assign(arg.param,_param); Object.assign(arg.param,_param);
} }
this.viewdata = JSON.stringify(arg.context); this.viewdata = JSON.stringify(arg.context);
...@@ -247,20 +258,20 @@ export default class AppEmbedPicker extends Vue { ...@@ -247,20 +258,20 @@ export default class AppEmbedPicker extends Vue {
* @memberof AppEmbedPicker * @memberof AppEmbedPicker
*/ */
public setValue(item: any) { public setValue(item: any) {
let selectsrfkey: Array<any> = []; let srfkey: string = '';
let selectsrfmajortext: Array<any> = []; let srfmajortext: string = '';
if(item && Array.isArray(item)){ if(item && Array.isArray(item)){
item.forEach((select: any)=>{ item.forEach((select: any)=>{
selectsrfkey.push(select.srfkey); srfkey += select.srfkey+",";
selectsrfmajortext.push(select.srfmajortext); srfmajortext += select.srfmajortext+',';
}) })
srfkey = srfkey.substring(0,srfkey.length-1);
srfmajortext = srfmajortext.substring(0,srfmajortext.length-1);
if (this.valueItem) { if (this.valueItem) {
let value = selectsrfkey.length > 0 ? selectsrfkey : ''; this.$emit('formitemvaluechange', { name: this.valueItem, value: srfkey });
this.$emit('formitemvaluechange', { name: this.valueItem, value: value });
} }
if (this.name) { if (this.name) {
let value = selectsrfmajortext.length > 0 ? selectsrfmajortext : ''; this.$emit('formitemvaluechange', { name: this.name, value: srfmajortext });
this.$emit('formitemvaluechange', { name: this.name, value: value });
} }
} }
} }
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</a> </a>
<dropdown-menu slot='list' v-if="uiActionGroup.details && Array.isArray(uiActionGroup.details)"> <dropdown-menu slot='list' v-if="uiActionGroup.details && Array.isArray(uiActionGroup.details)">
<dropdown-item v-for="(detail,index) in (uiActionGroup.details)" :key="index" :name="detail.name"> <dropdown-item v-for="(detail,index) in (uiActionGroup.details)" :key="index" :name="detail.name">
<span class='item' v-show="detail.visabled" :style="{'pointer-events':detail.disabled?'none':'auto'}" @click="doUIAction($event, detail)"> <span class='item' v-show="detail.visabled" :style="{'pointer-events':detail.disabled?'none':'auto','color':detail.disabled?'#7b7979':'#2d8cf0'}" @click="doUIAction($event, detail)">
<template v-if="detail.isShowIcon"> <template v-if="detail.isShowIcon">
<template v-if="detail.icon && !Object.is(detail.icon, '')"> <template v-if="detail.icon && !Object.is(detail.icon, '')">
<i :class="detail.icon" ></i> <i :class="detail.icon" ></i>
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
<span class='item-extract-mode'> <span class='item-extract-mode'>
<template v-if="uiActionGroup.details && Array.isArray(uiActionGroup.details)"> <template v-if="uiActionGroup.details && Array.isArray(uiActionGroup.details)">
<div v-for="(detail,index) in uiActionGroup.details" :key="index"> <div v-for="(detail,index) in uiActionGroup.details" :key="index">
<span v-show="detail.visabled" :style="{'pointer-events':detail.disabled?'none':'auto'}" class='item' @click="doUIAction($event, detail)"> <span v-show="detail.visabled" :style="{'pointer-events':detail.disabled?'none':'auto','color':detail.disabled?'#7b7979':'#2d8cf0'}" class='item' @click="doUIAction($event, detail)">
<template v-if="detail.isShowIcon"> <template v-if="detail.isShowIcon">
<template v-if="detail.icon && !Object.is(detail.icon, '')"> <template v-if="detail.icon && !Object.is(detail.icon, '')">
<i :class="detail.icon" ></i> <i :class="detail.icon" ></i>
...@@ -162,8 +162,15 @@ export default class AppFormGroup extends Vue { ...@@ -162,8 +162,15 @@ export default class AppFormGroup extends Vue {
return; return;
} }
const _item = ActionModel[key]; const _item = ActionModel[key];
if(_item && _item['dataaccaction'] && UIService && data && Object.keys(data).length >0){ if(_item && _item['dataaccaction'] && UIService){
let dataActionResult:any = UIService.getAllOPPrivs(data)[_item['dataaccaction']]; 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 // 无权限:0;有权限:1
if(dataActionResult === 0){ if(dataActionResult === 0){
// 禁用:1;隐藏:2;隐藏且默认隐藏:6 // 禁用:1;隐藏:2;隐藏且默认隐藏:6
......
.app-form-item { .app-form-item {
height: 100%; height: 100%;
padding: 0 6px;
.editor { .editor {
height: 100%; height: 100%;
.ivu-form-item-content { .ivu-form-item-content {
......
<template>
<div class="fullscren">
<Icon :type="fullScren == true ? 'ios-contract' : 'ios-expand'" color="#aaa" size="22" @click="handleScreen"/>
</div>
</template>
<script lang = 'ts'>
import { Vue, Component, Prop, Model, Watch } from 'vue-property-decorator';
@Component({})
export default class AppFullScren extends Vue{
public fullScren: boolean = false;
public handleScreen(){
if(this.fullscreenEnable()){
this.exitFullScreen();
}else{
this.reqFullScreen();
}
}
/**
* 监控全屏状态和键盘
*/
public created(){
let _this = this;
window.onresize = function(){
if(_this.fullscreenEnable()){
_this.fullScren = true;
}else{
_this.fullScren = false;
}
};
window.addEventListener("keydown", this.keyDown, true);
}
/**
* 监控F11
*/
public keyDown($event: any){
if ($event.keyCode == 122) {
$event.returnValue = false;
this.fullScren = !this.fullScren;
this.handleScreen();
}
}
/**
* 浏览器判断是否全屏
*/
public fullscreenEnable(){
const isFullscreen = (document as any).isFullScreen || (document as any).mozIsFullScreen || (document as any).webkitIsFullScreen;
return isFullscreen;
}
/**
* 浏览器全屏
*/
public reqFullScreen(){
if ((document as any).documentElement.requestFullScreen) {
(document as any).documentElement.requestFullScreen();
} else if ((document as any).documentElement.webkitRequestFullScreen) {
(document as any).documentElement.webkitRequestFullScreen();
} else if ((document as any).documentElement.mozRequestFullScreen) {
(document as any).documentElement.mozRequestFullScreen();
}
};
/**
* 浏览器退出全屏
*/
public exitFullScreen(){
if ((document as any).documentElement.requestFullScreen) {
(document as any).exitFullScreen();
} else if ((document as any).documentElement.webkitRequestFullScreen) {
(document as any).webkitCancelFullScreen();
} else if ((document as any).documentElement.mozRequestFullScreen) {
(document as any).mozCancelFullScreen();
}
}
}
</script>
<style lang='less'>
.fullscren{
cursor:pointer;
padding: 0 5px;
}
.ivu-icon-ios-expand{
font-weight: bolder;
}
.ivu-icon-ios-contract{
font-weight: bolder;
}
</style>
\ No newline at end of file
<template>
<div class="lockscren">
<span>
<Icon type="md-lock" size="22" color="#aaa" @click="handleLock"/>
<el-dialog :title="this.$t('components.lockScren.title')"
:visible.sync="box"
width="30%"
append-to-body>
<el-form :model="form"
ref="form"
label-width="82px">
<el-form-item :label="this.$t('components.lockScren.label')"
prop="passwd"
:rules="[{ required: true, message: this.$t('components.lockScren.message')}]">
<el-input v-model="form.passwd"
:placeholder="this.$t('components.lockScren.placeholder')"></el-input>
</el-form-item>
</el-form>
<span slot="footer"
class="dialog-footer">
<el-button type="primary" @click="handleSetLock">{{this.$t('components.lockScren.confirmButtonText')}}</el-button>
</span>
</el-dialog>
</span>
</div>
</template>
<script lang = 'ts'>
import { Vue, Component, Prop, Model, Watch } from 'vue-property-decorator';
@Component({})
export default class AppLockScren extends Vue{
/**
* 对话框状态
*/
public box: boolean = false;
/**
* 锁屏密码
*/
public form: any = {passwd: ''};
/**
* 用户名
*/
public user: any = {name: ''};
/**
* 点击锁屏图表展示对话框
*/
public handleLock(){
this.box = true;
}
/**
* 锁屏确认
*/
public handleSetLock(){
(this.$refs["form"] as any).validate((valid: any )=> {
if (valid) {
const username = this.user.name == '' ? 'visitor' : this.user.name;
const password = window.btoa(this.form.passwd);
const routerPath = window.btoa(this.$route.path);
sessionStorage.setItem('lockPassword',password);
sessionStorage.setItem('lockState','true');
sessionStorage.setItem('userName',username);
sessionStorage.setItem('routerPath',routerPath);
this.$router.push({ path: "/lock" });
}
});
}
/**
* 获取当前用户名
*
* @memberof AppUser
*/
public mounted() {
let _user:any = {};
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context && this.$store.getters.getAppData().context.srfusername){
_user.name = this.$store.getters.getAppData().context.srfusername;
}
if(localStorage.getItem("user")){
let user:any = JSON.parse(localStorage.getItem("user") as string);
if(user && user.personname){
_user.name = user.personname;
}
}
Object.assign(this.user,_user);
}
}
</script>
<style lang='less'>
.lockscren{
cursor:pointer;
padding: 0 5px;
}
</style>
\ No newline at end of file
.lock-container {
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
position: relative;
.title {
margin-bottom: 8px;
color: #333;
}
.el-icon-unlock{
font-size: 20px;
}
.el-icon-switch-button{
font-size: 20px;
}
}
.lock-container::before {
z-index: -999;
content: "";
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-image: url("/assets/img/lock_login.png");
background-size: cover;
}
.lock-form {
width: 300px;
}
\ No newline at end of file
<template>
<div class="lock-container">
<div class="lock-form animated bounceInDown">
<div class="animated">
<h3 class="title">{{username}}</h3>
<el-input :placeholder="this.$t('components.lockScren.placeholder1')"
type="password"
class="input-with-select animated"
v-model="passwd">
<el-button slot="append"
icon="el-icon-unlock"
size="25px"
@click="handleLogin"></el-button>
<el-button slot="append"
icon="el-icon-switch-button"
size="25px"
@click="handleLogout"></el-button>
</el-input>
</div>
</div>
</div>
</template>
<script lang = 'ts'>
import { Vue, Component, Prop, Model, Watch } from 'vue-property-decorator';
@Component({})
export default class AppLockIndex extends Vue{
/**
* 输入密码
*/
public passwd: string = '';
/**
* 保存的密码
*/
public lockpasswd: string = '';
/**
* 用户名
*/
public username: string = '';
/**
* 锁屏前的页面路由
*/
public path: string = '';
/**
* 获取锁屏相关信息
*
* @memberof AppLockIndex
*/
public mounted() {
this.username = (sessionStorage.getItem('userName') as string);
this.lockpasswd = window.atob(sessionStorage.getItem('lockPassword') as string);
this.path = window.atob(sessionStorage.getItem('routerPath') as string);
}
/**
* 解除锁屏
*
* @memberof AppLockIndex
*/
public handleLogin(){
if(this.lockpasswd != this.passwd){
this.passwd = '';
this.$message({
message: (this.$t('components.lockScren.message1') as string),
type: "error"
});
return;
}
this.clearSession();
this.$router.push({ path: this.path});
}
/**
* 登出
*
* @memberof AppLockIndex
*/
public handleLogout(){
this.$confirm((this.$t('components.lockScren.promptInformation') as string), (this.$t('components.lockScren.prompt') as string), {
confirmButtonText: (this.$t('components.lockScren.confirmButtonText') as string),
cancelButtonText: (this.$t('components.lockScren.cancelButtonText') as string),
type: "warning"
}).then(() => {
this.clearSession();
const get: Promise<any> = this.$http.get('/v7/logout');
get.then((response:any) =>{
if (response && response.status === 200) {
localStorage.removeItem('user');
localStorage.removeItem('token');
let leftTime = new Date();
leftTime.setTime(leftTime.getSeconds() - 1);
document.cookie = "ibzuaa-token=;expires=" + leftTime.toUTCString();
this.$router.push({ name: 'login' });
}
}).catch((error: any) =>{
console.error(error);
})
});
}
/**
* 清除锁屏时生成的session
*/
public clearSession(){
sessionStorage.removeItem('lockPassword');
sessionStorage.removeItem('lockState');
sessionStorage.removeItem('userName');
sessionStorage.removeItem('routerPath');
}
}
</script>
<style lang='less'>
@import './app-lock.less';
</style>
\ No newline at end of file
...@@ -316,7 +316,14 @@ export default class AppPickerSelectView extends Vue { ...@@ -316,7 +316,14 @@ export default class AppPickerSelectView extends Vue {
this.keySet = []; this.keySet = [];
this.selectItems = []; this.selectItems = [];
if (newVal) { if (newVal) {
this.selectItems = JSON.parse(newVal); if (!this.data || !this.valueitem || !this.data[this.valueitem]) {
this.$Notice.error({ title: (this.$t('components.appPickerSelectView.error') as any), desc: (this.$t('components.appPickerSelectView.editor') as any)+this.name+(this.$t('components.appPickerSelectView.valueitemException') as any) });
}else{
let tempvalue: Array<any> = this.data[this.valueitem].split(',');
let temptext: Array<any> = newVal.split(',');
tempvalue.forEach((srfkey: any, index: number)=>{
this.selectItems.push({ srfmajortext : temptext[index], srfkey: srfkey });
});
this.selectItems.forEach((item: any) => { this.selectItems.forEach((item: any) => {
this.keySet.push(item.srfkey); this.keySet.push(item.srfkey);
let index = this.items.findIndex((i) => Object.is(i.srfkey, item.srfkey)); let index = this.items.findIndex((i) => Object.is(i.srfkey, item.srfkey));
...@@ -325,6 +332,7 @@ export default class AppPickerSelectView extends Vue { ...@@ -325,6 +332,7 @@ export default class AppPickerSelectView extends Vue {
} }
}); });
} }
}
let _viewparam = JSON.parse(this.viewparam); let _viewparam = JSON.parse(this.viewparam);
_viewparam.selectedData = this.selectItems; _viewparam.selectedData = this.selectItems;
this.viewparam = JSON.stringify(_viewparam); this.viewparam = JSON.stringify(_viewparam);
...@@ -376,23 +384,31 @@ export default class AppPickerSelectView extends Vue { ...@@ -376,23 +384,31 @@ export default class AppPickerSelectView extends Vue {
this.$emit('formitemvaluechange', { name: this.valueitem, value: tempvalue }); this.$emit('formitemvaluechange', { name: this.valueitem, value: tempvalue });
} }
if (this.name) { if (this.name) {
let tempvalue = $event[0][this.deMajorField] ? $event[0][this.deMajorField] : $event[0].srfmajortext; let temptext = $event[0][this.deMajorField] ? $event[0][this.deMajorField] : $event[0].srfmajortext;
this.$emit('formitemvaluechange', { name: this.name, value: tempvalue }); this.$emit('formitemvaluechange', { name: this.name, value: temptext });
} }
}else{ }else{
let selects: Array<any> = []; let tempvalue: string = '';
let temptext: string = '';
if ($event && Array.isArray($event)) { if ($event && Array.isArray($event)) {
$event.forEach((select: any) => { $event.forEach((select: any) => {
selects.push({ srfkey: select.srfkey, srfmajortext: select.srfmajortext }); let srfkey = select[this.deKeyField] ? select[this.deKeyField] : select.srfkey;
let index = this.items.findIndex((item) => Object.is(item.srfkey, select.srfkey)); tempvalue += srfkey+",";
let srfmajortext = select[this.deMajorField] ? select[this.deMajorField] : select.srfmajortext;
temptext += srfmajortext+",";
let index = this.items.findIndex((item) => Object.is(item.srfkey, srfkey));
if (index < 0) { if (index < 0) {
this.items.push({ srfmajortext : select.srfmajortext, srfkey: select.srfkey }); this.items.push({ srfmajortext : srfmajortext, srfkey: srfkey });
} }
}); });
} }
tempvalue = tempvalue.substring(0,tempvalue.length-1);
temptext = temptext.substring(0,temptext.length-1);
if(this.valueitem){
this.$emit('formitemvaluechange',{ name: this.valueitem, value: tempvalue });
}
if (this.name) { if (this.name) {
let value = selects.length > 0 ? JSON.stringify(selects) : ''; this.$emit('formitemvaluechange', { name: this.name, value: temptext });
this.$emit('formitemvaluechange', { name: this.name, value: value });
} }
} }
} }
...@@ -553,8 +569,18 @@ export default class AppPickerSelectView extends Vue { ...@@ -553,8 +569,18 @@ export default class AppPickerSelectView extends Vue {
} }
}); });
} }
let value = val.length > 0 ? JSON.stringify(val) : ''; let tempvalue: string = '';
this.$emit('formitemvaluechange', { name: this.name, value: value }); let temptext: string = '';
val.forEach((select: any)=>{
let srfkey = select[this.deKeyField] ? select[this.deKeyField] : select.srfkey;
tempvalue += srfkey+",";
let srfmajortext = select[this.deMajorField] ? select[this.deMajorField] : select.srfmajortext;
temptext += srfmajortext+",";
});
tempvalue = tempvalue.substring(0,tempvalue.length-1);
temptext = temptext.substring(0,temptext.length-1);
this.$emit('formitemvaluechange',{ name: this.valueitem, value: tempvalue });
this.$emit('formitemvaluechange', { name: this.name, value: temptext });
} }
} }
......
...@@ -172,6 +172,14 @@ export default class AppUpicker extends Vue { ...@@ -172,6 +172,14 @@ export default class AppUpicker extends Vue {
*/ */
public inputState: boolean = false; public inputState: boolean = false;
/**
* vue 生命周期
*
* @memberof AppUpicker
*/
public created() {
this.analysis(this.itemParams);
}
/** /**
* 获取关联数据项值 * 获取关联数据项值
* *
...@@ -185,6 +193,77 @@ export default class AppUpicker extends Vue { ...@@ -185,6 +193,77 @@ export default class AppUpicker extends Vue {
return this.curvalue; return this.curvalue;
} }
/**
* 展开下拉
*
* @memberof AppUpicker
*/
public openDropdown() {
const appUpicker: any = this.$refs.appUpicker;
if(appUpicker) {
appUpicker.focus();
}
}
/**
* 收起下拉
*
* @memberof AppUpicker
*/
public closeDropdown() {
const appUpicker: any = this.$refs.appUpicker;
if(appUpicker) {
appUpicker.blur();
}
}
/**
* 下拉切换回调
* @param flag
*
* @memberof AppUpicker
*/
public onSelectOpen(flag: boolean): void {
this.open = flag;
if (this.open) {
this.fectchItemList(this.url);
}
}
/**
* 下拉选中
*
* @param {string} val
* @memberof AppUpicker
*/
public onSelect(val: string) {
let index = this.items.findIndex((item) => Object.is(item.value, val));
if (index >= 0) {
let item:any = this.items[index];
if (this.valueitem) {
this.$emit('formitemvaluechange', { name: this.valueitem, value: item.value });
}
if (this.name) {
this.$emit('formitemvaluechange', { name: this.name, value: item.label });
}
}
}
/**
* 清除
*
* @memberof AppUpicker
*/
public onClear($event: any): void {
if (this.valueitem) {
this.$emit('formitemvaluechange', { name: this.valueitem, value: '' });
}
if (this.name) {
this.$emit('formitemvaluechange', { name: this.name, value: '' });
}
this.$forceUpdate();
}
/** /**
* 值变化 * 值变化
* *
...@@ -209,16 +288,6 @@ export default class AppUpicker extends Vue { ...@@ -209,16 +288,6 @@ export default class AppUpicker extends Vue {
} }
} }
/**
* vue 生命周期
*
* @memberof AppUpicker
*/
public created() {
// 解析编辑器参数
this.analysis(this.itemParams);
}
/** /**
* 解析编辑器参数 * 解析编辑器参数
* @param {*} itemparams * @param {*} itemparams
...@@ -281,53 +350,6 @@ export default class AppUpicker extends Vue { ...@@ -281,53 +350,6 @@ export default class AppUpicker extends Vue {
}); });
} }
/**
* 下拉切换回调
* @param flag
*
* @memberof AppUpicker
*/
public onSelectOpen(flag: boolean): void {
this.open = flag;
if (this.open) {
this.fectchItemList(this.url);
}
}
/**
* 下拉选中
*
* @param {string} val
* @memberof AppUpicker
*/
public onSelect(val: string) {
let index = this.items.findIndex((item) => Object.is(item.value, val));
if (index >= 0) {
let item:any = this.items[index];
if (this.valueitem) {
this.$emit('formitemvaluechange', { name: this.valueitem, value: item.value });
}
if (this.name) {
this.$emit('formitemvaluechange', { name: this.name, value: item.label });
}
}
}
/**
* 清除
*
* @memberof AppUpicker
*/
public onClear($event: any): void {
if (this.valueitem) {
this.$emit('formitemvaluechange', { name: this.valueitem, value: '' });
}
if (this.name) {
this.$emit('formitemvaluechange', { name: this.name, value: '' });
}
this.$forceUpdate();
}
/** /**
* 公共参数处理 * 公共参数处理
* *
...@@ -354,32 +376,6 @@ export default class AppUpicker extends Vue { ...@@ -354,32 +376,6 @@ export default class AppUpicker extends Vue {
} }
return true; return true;
} }
/**
* 展开下拉
*
* @memberof AppUpicker
*/
public openDropdown() {
const appUpicker: any = this.$refs.appUpicker;
if(appUpicker) {
appUpicker.focus();
}
}
/**
* 收起下拉
*
* @memberof AppUpicker
*/
public closeDropdown() {
const appUpicker: any = this.$refs.appUpicker;
if(appUpicker) {
appUpicker.blur();
}
}
} }
</script> </script>
<style lang="less"> <style lang="less">
......
<template>
<Select
v-model="value[0]"
class="transfer-select"
@on-change='handleCronChange'
:disabled="disabled"
:placeholder="placeholder">
<Option class="hidden" v-for="(item,i) in value" :value="item" :label="item" :key="i">
</Option>
<vue-cron class='vue-cron' @cronValue='handleCronChange'></vue-cron>
</Select>
</template>
<script lang="ts">
import { Vue, Component, Prop, Watch, Model } from 'vue-property-decorator';
import VueCron from './vue-cron/vue-cron.vue';
@Component({
components: {
'vue-cron': VueCron,
}
})
export default class CronEditor extends Vue {
/**
* 启用状态
*
* @type {any}
* @memberof CronEditor
*/
@Prop() disabled: any;
/**
* 下拉框显示值
*
* @type {any}
* @memberof CronEditor
*/
@Prop() placeholder:any;
/**
* 绑定Cron表达式
*
* @type {any[]}
* @memberof CronEditor
*/
public value: any[] = [];
/**
* 处理返回Cron表达式
*
* @type {any}
* @memberof CronEditor
*/
public handleCronChange(val: any) {
this.value[0] = val;
this.value.push(val);
}
/**
* Vue生命周期
*
*/
public created() {
this.value[0] = '';
}
}
</script>
<style lang="less">
.transfer-select{
.ivu-select-dropdown {
padding: 0px;
overflow: inherit;
.hidden {
display: none;
}
.vue-cron{
min-width: 100% !important;
}
}
}
</style>
\ No newline at end of file
<template>
<div :val="value_">
<div>
<el-radio v-model="type" label="1" size="mini" border>{{ $t('components.cronEditor.day.daily') }}</el-radio>
</div>
<div>
<el-radio v-model="type" label="5" size="mini" border>{{ $t('components.cronEditor.public.notSpecify') }}</el-radio>
</div>
<div>
<el-radio v-model="type" label="2" size="mini" border>{{ $t('components.cronEditor.public.cycle') }}</el-radio>
<span style="margin-left: 10px; margin-right: 5px;">{{ $t('components.cronEditor.public.from') }}</span>
<el-input-number @change="type = '2'" v-model="cycle.start" :min="1" :max="31" size="mini" style="width: 100px;"></el-input-number>
<span style="margin-left: 5px; margin-right: 5px;">{{ $t('components.cronEditor.public.to') }}</span>
<el-input-number @change="type = '2'" v-model="cycle.end" :min="2" :max="31" size="mini" style="width: 100px;"></el-input-number>
{{ $t('components.cronEditor.day.title') }}
</div>
<div>
<el-radio v-model="type" label="3" size="mini" border>{{ $t('components.cronEditor.public.loop') }}</el-radio>
<span style="margin-left: 10px; margin-right: 5px;">{{ $t('components.cronEditor.public.from') }}</span>
<el-input-number @change="type = '3'" v-model="loop.start" :min="1" :max="31" size="mini" style="width: 100px;"></el-input-number>
<span style="margin-left: 5px; margin-right: 5px;">{{ $t('components.cronEditor.day.dayStart') }}</span>
<el-input-number @change="type = '3'" v-model="loop.end" :min="1" :max="31" size="mini" style="width: 100px;"></el-input-number>
{{ $t('components.cronEditor.day.onceADay') }}
</div>
<div>
<el-radio v-model="type" label="8" size="mini" border>{{ $t('components.cronEditor.day.workDay') }}</el-radio>
<span style="margin-left: 10px; margin-right: 5px;">{{ $t('components.cronEditor.day.thisMonth') }}</span>
<el-input-number @change="type = '8'" v-model="work" :min="1" :max="7" size="mini" style="width: 100px;"></el-input-number>
{{ $t('components.cronEditor.day.lastWorkDay') }}
</div>
<div>
<el-radio v-model="type" label="6" size="mini" border>{{ $t('components.cronEditor.day.lastDayOfMonth') }}</el-radio>
</div>
<div>
<el-radio v-model="type" label="4" size="mini" border>{{ $t('components.cronEditor.public.specify') }}</el-radio>
<el-checkbox-group v-model="appoint">
<div v-for="i in 4" :key="i" style="margin-left: 10px; line-height: 25px;">
<template v-for="j in 10">
<el-checkbox @change="type = '4'" v-if="parseInt((i - 1) + '' + (j - 1)) < 32 && !(i === 1 && j === 1)" :key="j" :label="(i - 1) + '' + (j - 1)"></el-checkbox>
</template>
</div>
</el-checkbox-group>
</div>
</div>
</template>
<script lang='ts'>
import { Vue, Component, Prop, Watch } from 'vue-property-decorator';
@Component({})
export default class Day extends Vue {
/**
* Cron表达式
*
* @type {any}
* @memberof Day
*/
public value: any;
/**
* 标签类型标识
*
* @type {any}
* @memberof Day
*/
public type: string = '5';
/**
* 周期
*
* @type {any}
* @memberof Day
*/
public cycle: any = {
start: 0,
end: 0
};
/**
* 循环
*
* @type {any}
* @memberof Day
*/
public loop: any = {
start: 0,
end: 0
};
/**
* 指定周
*
* @type {any}
* @memberof Day
*/
public week: any = {
start: 0,
end: 0
};
/**
* 工作日
*
* @type {any}
* @memberof Day
*/
public work: number = 0;
/**
* 最后
*
* @type {any}
* @memberof Day
*/
public last: number = 0;
/**
* 指定
*
* @type {any}
* @memberof Day
*/
public appoint: any = [];
/**
* 获取Cron表达式
*
* @returns
* @memberof Day
*/
get value_() {
let result: any = [];
switch (this.type) {
case '1': // 每秒
result.push('*')
break
case '2': // 周期
result.push(`${this.cycle.start}-${this.cycle.end}`)
break
case '3': // 循环
result.push(`${this.loop.start}/${this.loop.end}`)
break
case '4': // 指定
result.push(this.appoint.join(','))
break
case '6': // 最后
result.push(`${this.last === 0 ? '' : this.last}L`)
break
case '7': // 指定周
result.push(`${this.week.start}#${this.week.end}`)
break
case '8': // 工作日
result.push(`${this.work}W`)
break
default: // 不指定
result.push('?')
break
}
this.$emit('input', result.join(''))
return result.join('')
}
/**
* 数据值变化
*
* @returns
* @memberof Day
*/
@Watch('value')
public updateVal() {
if (!this.value) {
return
}
if (this.value === '?') {
this.type = '5'
} else if (this.value.indexOf('-') !== -1) { // 2周期
if (this.value.split('-').length === 2) {
this.type = '2'
this.cycle.start = this.value.split('-')[0]
this.cycle.end = this.value.split('-')[1]
}
} else if (this.value.indexOf('/') !== -1) { // 3循环
if (this.value.split('/').length === 2) {
this.type = '3'
this.loop.start = this.value.split('/')[0]
this.loop.end = this.value.split('/')[1]
}
} else if (this.value.indexOf('*') !== -1) { // 1每
this.type = '1'
} else if (this.value.indexOf('L') !== -1) { // 6最后
this.type = '6'
this.last = this.value.replace('L', '')
} else if (this.value.indexOf('#') !== -1) { // 7指定周
if (this.value.split('#').length === 2) {
this.type = '7'
this.week.start = this.value.split('#')[0]
this.week.end = this.value.split('#')[1]
}
} else if (this.value.indexOf('W') !== -1) { // 8工作日
this.type = '8'
this.work = this.value.replace('W', '')
} else { // *
this.type = '4'
this.appoint = this.value.split(',')
}
}
/**
* Vue生命周期
*
* @returns
* @memberof Day
*/
public created() {
this.updateVal();
}
}
</script>
<style lang="css">
.el-checkbox+.el-checkbox {
margin-left: 10px;
}
</style>
<template lang="html">
<div :val="value_">
<div>
<el-radio v-model="type" label="1" size="mini" border>{{ $t('components.cronEditor.hour.everyHour') }}</el-radio>
</div>
<div>
<el-radio v-model="type" label="2" size="mini" border>{{ $t('components.cronEditor.public.cycle') }}</el-radio>
<span style="margin-left: 10px; margin-right: 5px;">{{ $t('components.cronEditor.public.from') }}</span>
<el-input-number @change="type = '2'" v-model="cycle.start" :min="0" :max="23" size="mini" style="width: 100px;"></el-input-number>
<span style="margin-left: 5px; margin-right: 5px;">{{ $t('components.cronEditor.public.to') }}</span>
<el-input-number @change="type = '2'" v-model="cycle.end" :min="2" :max="23" size="mini" style="width: 100px;"></el-input-number>
{{ $t('components.cronEditor.hour.title') }}
</div>
<div>
<el-radio v-model="type" label="3" size="mini" border>{{ $t('components.cronEditor.public.loop') }}</el-radio>
<span style="margin-left: 10px; margin-right: 5px;">{{ $t('components.cronEditor.public.from') }}</span>
<el-input-number @change="type = '3'" v-model="loop.start" :min="0" :max="23" size="mini" style="width: 100px;"></el-input-number>
<span style="margin-left: 5px; margin-right: 5px;">{{ $t('components.cronEditor.hour.hourStart') }}</span>
<el-input-number @change="type = '3'" v-model="loop.end" :min="1" :max="23" size="mini" style="width: 100px;"></el-input-number>
{{ $t('components.cronEditor.hour.onceAHour') }}
</div>
<div>
<el-radio v-model="type" label="4" size="mini" border>{{ $t('components.cronEditor.public.specify') }}</el-radio>
<el-checkbox-group v-model="appoint">
<div v-for="i in 3" :key="i" style="margin-left: 10px; line-height: 25px;">
<template v-for="j in 10">
<el-checkbox @change="type = '4'" v-if="parseInt((i - 1) + '' + (j - 1)) < 24" :key="j" :label="(i - 1) + '' + (j - 1)"></el-checkbox>
</template>
</div>
</el-checkbox-group>
</div>
</div>
</template>
<script lang='ts'>
import { Vue, Watch, Component } from 'vue-property-decorator';
@Component({})
export default class Hour extends Vue {
/**
* Cron表达式
*
* @type {any}
* @memberof Day
*/
public value: any;
/**
* 标签类型标识
*
* @type {any}
* @memberof Day
*/
public type: string = '1';
/**
* 周期
*
* @type {any}
* @memberof Day
*/
public cycle: any = {
start: 0,
end: 0
};
/**
* 循环
*
* @type {any}
* @memberof Day
*/
public loop: any = {
start: 0,
end: 0
}
/**
* 周
*
* @type {any}
* @memberof Day
*/
public week: any = {
start: 0,
end: 0
}
/**
* 工作日
*
* @type {any}
* @memberof Day
*/
public work: number = 0;
/**
* 最后
*
* @type {any}
* @memberof Day
*/
public last: number = 0;
/**
* 指定
*
* @type {any}
* @memberof Day
*/
public appoint: any = [];
/**
* 获取Cron表达式
*
* @returns
* @memberof Day
*/
get value_() {
let result: any = [];
switch (this.type) {
case '1': // 每秒
result.push('*')
break;
case '2': // 年期
result.push(`${this.cycle.start}-${this.cycle.end}`)
break;
case '3': // 循环
result.push(`${this.loop.start}/${this.loop.end}`)
break;
case '4': // 指定
result.push(this.appoint.join(','))
break;
case '6': // 最后
result.push(`${this.last === 0 ? '' : this.last}L`)
break;
default: // 不指定
result.push('?')
break;
}
this.$emit('input', result.join(''));
return result.join('');
}
/**
* 数据值变化
*
* @returns
* @memberof Hour
*/
@Watch('value')
public updateVal() {
if (!this.value) {
return
}
if (this.value === '?') {
this.type = '5'
} else if (this.value.indexOf('-') !== -1) { // 2周期
if (this.value.split('-').length === 2) {
this.type = '2'
this.cycle.start = this.value.split('-')[0]
this.cycle.end = this.value.split('-')[1]
}
} else if (this.value.indexOf('/') !== -1) { // 3循环
if (this.value.split('/').length === 2) {
this.type = '3'
this.loop.start = this.value.split('/')[0]
this.loop.end = this.value.split('/')[1]
}
} else if (this.value.indexOf('*') !== -1) { // 1每
this.type = '1'
} else if (this.value.indexOf('L') !== -1) { // 6最后
this.type = '6'
this.last = this.value.replace('L', '')
} else if (this.value.indexOf('#') !== -1) { // 7指定周
if (this.value.split('#').length === 2) {
this.type = '7'
this.week.start = this.value.split('#')[0]
this.week.end = this.value.split('#')[1]
}
} else if (this.value.indexOf('W') !== -1) { // 8工作日
this.type = '8'
this.work = this.value.replace('W', '')
} else { // *
this.type = '4'
this.appoint = this.value.split(',')
}
}
/**
* Vue生命周期
*
* @returns
* @memberof Day
*/
public created () {
this.updateVal()
}
}
</script>
<style lang="css">
.el-checkbox+.el-checkbox {
margin-left: 10px;
}
</style>
<template lang="html">
<div :val="value_">
<div>
<el-radio v-model="type" label="1" size="mini" border>{{ $t('components.cronEditor.month.everyMonth') }}</el-radio>
</div>
<div>
<el-radio v-model="type" label="5" size="mini" border>{{ $t('components.cronEditor.public.notSpecify') }}</el-radio>
</div>
<div>
<el-radio v-model="type" label="2" size="mini" border>{{ $t('components.cronEditor.public.cycle') }}</el-radio>
<span style="margin-left: 10px; margin-right: 5px;">{{ $t('components.cronEditor.public.from') }}</span>
<el-input-number @change="type = '2'" v-model="cycle.start" :min="1" :max="12" size="mini" style="width: 100px;"></el-input-number>
<span style="margin-left: 5px; margin-right: 5px;">{{ $t('components.cronEditor.public.to') }}</span>
<el-input-number @change="type = '2'" v-model="cycle.end" :min="2" :max="12" size="mini" style="width: 100px;"></el-input-number>
{{ $t('components.cronEditor.month.title') }}
</div>
<div>
<el-radio v-model="type" label="3" size="mini" border>{{ $t('components.cronEditor.public.loop') }}</el-radio>
<span style="margin-left: 10px; margin-right: 5px;">{{ $t('components.cronEditor.public.from') }}</span>
<el-input-number @change="type = '3'" v-model="loop.start" :min="1" :max="12" size="mini" style="width: 100px;"></el-input-number>
<span style="margin-left: 5px; margin-right: 5px;">{{ $t('components.cronEditor.month.monthStart') }}</span>
<el-input-number @change="type = '3'" v-model="loop.end" :min="1" :max="12" size="mini" style="width: 100px;"></el-input-number>
{{ $t('components.cronEditor.month.onceAMonth') }}
</div>
<div>
<el-radio v-model="type" label="4" size="mini" border>{{ $t('components.cronEditor.public.specify') }}</el-radio>
<el-checkbox-group v-model="appoint" style="margin-left: 0px; line-height: 25px;">
<el-checkbox @change="type = '4'" v-for="i in 12" :key="i" :label="i.toString()" ></el-checkbox>
</el-checkbox-group>
</div>
</div>
</template>
<script lang='ts'>
import { Vue, Watch, Component } from 'vue-property-decorator';
@Component({})
export default class Month extends Vue {
/**
* Cron表达式
*
* @type {any}
* @memberof Day
*/
public value: any;
/**
* 标签类型标识
*
* @type {any}
* @memberof Day
*/
public type: string = '1';
/**
* 周期
*
* @type {any}
* @memberof Day
*/
public cycle: any = {
start: 0,
end: 0
};
/**
* 循环
*
* @type {any}
* @memberof Day
*/
public loop: any = {
start: 0,
end: 0
}
/**
* 周
*
* @type {any}
* @memberof Day
*/
public week: any = {
start: 0,
end: 0
}
/**
* 工作日
*
* @type {any}
* @memberof Day
*/
public work: number = 0;
/**
* 最后
*
* @type {any}
* @memberof Day
*/
public last: number = 0;
/**
* 指定
*
* @type {any}
* @memberof Day
*/
public appoint: any = [];
/**
* 获取Cron表达式
*
* @returns
* @memberof Day
*/
get value_() {
let result = []
switch (this.type) {
case '1': // 每秒
result.push('*')
break
case '2': // 年期
result.push(`${this.cycle.start}-${this.cycle.end}`)
break
case '3': // 循环
result.push(`${this.loop.start}/${this.loop.end}`)
break
case '4': // 指定
result.push(this.appoint.join(','))
break
case '6': // 最后
result.push(`${this.last === 0 ? '' : this.last}L`)
break
default: // 不指定
result.push('?')
break
}
this.$emit('input', result.join(''))
return result.join('')
}
/**
* 数据值变化
*
* @returns
* @memberof Month
*/
@Watch('value')
public updateVal() {
if (!this.value) {
return
}
if (this.value === '?') {
this.type = '5'
} else if (this.value.indexOf('-') !== -1) { // 2周期
if (this.value.split('-').length === 2) {
this.type = '2'
this.cycle.start = this.value.split('-')[0]
this.cycle.end = this.value.split('-')[1]
}
} else if (this.value.indexOf('/') !== -1) { // 3循环
if (this.value.split('/').length === 2) {
this.type = '3'
this.loop.start = this.value.split('/')[0]
this.loop.end = this.value.split('/')[1]
}
} else if (this.value.indexOf('*') !== -1) { // 1每
this.type = '1'
} else if (this.value.indexOf('L') !== -1) { // 6最后
this.type = '6'
this.last = this.value.replace('L', '')
} else if (this.value.indexOf('#') !== -1) { // 7指定周
if (this.value.split('#').length === 2) {
this.type = '7'
this.week.start = this.value.split('#')[0]
this.week.end = this.value.split('#')[1]
}
} else if (this.value.indexOf('W') !== -1) { // 8工作日
this.type = '8'
this.work = this.value.replace('W', '')
} else { // *
this.type = '4'
this.appoint = this.value.split(',')
}
}
public created() {
this.updateVal();
}
}
</script>
<style lang="css">
.el-checkbox+.el-checkbox {
margin-left: 10px;
}
</style>
<!-- 秒,分钟 -->
<template lang="html">
<div :val="value_">
<div>
<el-radio v-model="type" label="1" size="mini" border>{{ $t('components.cronEditor.public.every') }} {{ showLabel }}</el-radio>
</div>
<div>
<el-radio v-model="type" label="2" size="mini" border>{{ $t('components.cronEditor.public.cycle') }}</el-radio>
<span style="margin-left: 10px; margin-right: 5px;">{{ $t('components.cronEditor.public.from') }}</span>
<el-input-number @change="type = '2'" v-model="cycle.start" :min="1" :max="59" size="mini" style="width: 100px;"></el-input-number>
<span style="margin-left: 5px; margin-right: 5px;">{{ $t('components.cronEditor.public.to') }}</span>
<el-input-number @change="type = '2'" v-model="cycle.end" :min="2" :max="59" size="mini" style="width: 100px;"></el-input-number>
{{showLabel}}
</div>
<div>
<el-radio v-model="type" label="3" size="mini" border>{{ $t('components.cronEditor.public.loop') }}</el-radio>
<span style="margin-left: 10px; margin-right: 5px;">{{ $t('components.cronEditor.public.from') }}</span>
<el-input-number @change="type = '3'" v-model="loop.start" :min="0" :max="59" size="mini" style="width: 100px;"></el-input-number>
<span style="margin-left: 5px; margin-right: 5px;">{{showLabel}} {{ $t('components.cronEditor.week.start') }}</span>
<el-input-number @change="type = '3'" v-model="loop.end" :min="1" :max="59" size="mini" style="width: 100px;"></el-input-number>
{{showLabel}} {{ $t('components.cronEditor.public.once') }}
</div>
<div>
<el-radio v-model="type" label="4" size="mini" border>{{ $t('components.cronEditor.public.specify') }}</el-radio>
<el-checkbox-group v-model="appoint">
<div v-for="i in 6" :key="i" style="margin-left: 10px; line-height: 25px;">
<el-checkbox @change="type = '4'" v-for="j in 10" :key="j" :label="(i - 1) + '' + (j - 1)"></el-checkbox>
</div>
</el-checkbox-group>
</div>
</div>
</template>
<script lang='ts'>
import { Vue, Watch, Component, Prop } from 'vue-property-decorator';
@Component({})
export default class SecondAndMinute extends Vue {
/**
* 标题
*
* @type {any}
* @memberof Day
*/
@Prop() public label: any;
/**
* 显示标题
*
* @type {any}
* @memberof Day
*/
public showLabel: any;
/**
* Cron表达式
*
* @type {any}
* @memberof Day
*/
public value: any;
/**
* 标签类型标识
*
* @type {any}
* @memberof Day
*/
public type: string = '1';
/**
* 周期
*
* @type {any}
* @memberof Day
*/
public cycle: any = {
start: 0,
end: 0
};
/**
* 循环
*
* @type {any}
* @memberof Day
*/
public loop: any = {
start: 0,
end: 0
}
/**
* 周
*
* @type {any}
* @memberof Day
*/
public week: any = {
start: 0,
end: 0
}
/**
* 工作日
*
* @type {any}
* @memberof Day
*/
public work: number = 0;
/**
* 最后
*
* @type {any}
* @memberof Day
*/
public last: number = 0;
/**
* 指定
*
* @type {any}
* @memberof Day
*/
public appoint: any = [];
/**
* 获取Cron表达式
*
* @returns
* @memberof Day
*/
get value_() {
let result = []
switch (this.type) {
case '1': // 每秒
result.push('*')
break
case '2': // 年期
result.push(`${this.cycle.start}-${this.cycle.end}`)
break
case '3': // 循环
result.push(`${this.loop.start}/${this.loop.end}`)
break
case '4': // 指定
result.push(this.appoint.join(','))
break
case '6': // 最后
result.push(`${this.last === 0 ? '' : this.last}L`)
break
default: // 不指定
result.push('?')
break
}
this.$emit('input', result.join(''))
return result.join('')
}
/**
* 数据值变化
*
* @returns
* @memberof SecondAndMinute
*/
@Watch('value')
public updateVal() {
if (!this.value) {
return
}
if (this.value === '?') {
this.type = '5'
} else if (this.value.indexOf('-') !== -1) { // 2周期
if (this.value.split('-').length === 2) {
this.type = '2'
this.cycle.start = this.value.split('-')[0]
this.cycle.end = this.value.split('-')[1]
}
} else if (this.value.indexOf('/') !== -1) { // 3循环
if (this.value.split('/').length === 2) {
this.type = '3'
this.loop.start = this.value.split('/')[0]
this.loop.end = this.value.split('/')[1]
}
} else if (this.value.indexOf('*') !== -1) { // 1每
this.type = '1'
} else if (this.value.indexOf('L') !== -1) { // 6最后
this.type = '6'
this.last = this.value.replace('L', '')
} else if (this.value.indexOf('#') !== -1) { // 7指定周
if (this.value.split('#').length === 2) {
this.type = '7'
this.week.start = this.value.split('#')[0]
this.week.end = this.value.split('#')[1]
}
} else if (this.value.indexOf('W') !== -1) { // 8工作日
this.type = '8'
this.work = this.value.replace('W', '')
} else { // *
this.type = '4'
this.appoint = this.value.split(',')
}
}
/**
* 数据值变化
*
* @returns
* @memberof Day
*/
@Watch('label')
public updateLabel(newVal: any, oldVal: any) {
this.showLabel = this.label ? this.label : oldVal;
}
public created() {
this.showLabel = this.label ? this.label : '';
this.updateVal();
}
}
</script>
<style lang="css">
.el-checkbox+.el-checkbox {
margin-left: 10px;
}
</style>
<template>
<div class="cron" :val="_value">
<el-tabs v-model="activeName">
<el-tab-pane :label="$t('components.cronEditor.label.second')" name="s">
<second-and-minute v-model="sVal" :label="$t('components.cronEditor.second')"></second-and-minute >
</el-tab-pane>
<el-tab-pane :label="$t('components.cronEditor.label.minute')" name="m">
<second-and-minute v-model="mVal" :label="$t('components.cronEditor.minute')"></second-and-minute >
</el-tab-pane>
<el-tab-pane :label="$t('components.cronEditor.label.hour')" name="h">
<hour v-model="hVal" :lable="$t('components.cronEditor.hour.title')"></hour>
</el-tab-pane>
<el-tab-pane :label="$t('components.cronEditor.label.day')" name="d">
<day v-model="dVal" :lable="$t('components.cronEditor.day.title')"></day>
</el-tab-pane>
<el-tab-pane :label="$t('components.cronEditor.label.month')" name="month">
<month v-model="monthVal" :lable="$t('components.cronEditor.month.title')"></month>
</el-tab-pane>
<el-tab-pane :label="$t('components.cronEditor.label.week')" name="week">
<week v-model="weekVal" :lable="$t('components.cronEditor.week.title')"></week>
</el-tab-pane>
<el-tab-pane :label="$t('components.cronEditor.label.year')" name="year">
<year v-model="yearVal" :lable="$t('components.cronEditor.year.title')"></year>
</el-tab-pane>
</el-tabs>
<!-- table -->
<el-table
:data="tableData"
size="mini"
border
style="width: 100%;">
<el-table-column
prop="sVal"
:label="$t('components.cronEditor.second')"
width="70">
</el-table-column>
<el-table-column
prop="mVal"
:label="$t('components.cronEditor.minute')"
width="70">
</el-table-column>
<el-table-column
prop="hVal"
:label="$t('components.cronEditor.hour.title')"
width="70">
</el-table-column>
<el-table-column
prop="dVal"
:label="$t('components.cronEditor.day.title')"
width="70">
</el-table-column>
<el-table-column
prop="monthVal"
:label="$t('components.cronEditor.month.title')"
width="70">
</el-table-column>
<el-table-column
prop="weekVal"
:label="$t('components.cronEditor.week.title')"
width="70">
</el-table-column>
<el-table-column
prop="yearVal"
:label="this.$t('components.cronEditor.year.title')">
</el-table-column>
</el-table>
</div>
</template>
<script lang='ts'>
import SecondAndMinute from './secondAndMinute.vue';
import hour from './hour.vue';
import day from './day.vue';
import month from './month.vue';
import week from './week.vue';
import year from './year.vue';
import { Vue, Component, Prop, Watch, Model } from 'vue-property-decorator';
@Component({
components: {
'second-and-minute': SecondAndMinute,
hour,
day,
month,
week,
year
}
})
export default class VueCron extends Vue {
/**
* 传递数据
*
* @type {any}
* @memberof VueCron
*/
@Prop() data: any;
/**
* Cron表达式
*
* @type {any}
* @memberof VueCron
*/
public value: any = '';
/**
* 标签名
*
* @type {any}
* @memberof VueCron
*/
public activeName: string = 's';
/**
* 标签-秒 数据
*
* @type {any}
* @memberof VueCron
*/
public sVal: any = '';
/**
* 标签-分 数据
*
* @type {any}
* @memberof VueCron
*/
public mVal: any = '';
/**
* 标签-天 数据
*
* @type {any}
* @memberof VueCron
*/
public dVal: any = '';
/**
* 标签-时 数据
*
* @type {any}
* @memberof VueCron
*/
public hVal: any = '';
/**
* 标签月 数据
*
* @type {any}
* @memberof VueCron
*/
public monthVal:any = '';
/**
* 标签-周 数据
*
* @type {any}
* @memberof VueCron
*/
public weekVal: any = '';
/**
* 标签年 数据
*
* @type {any}
* @memberof VueCron
*/
public yearVal: any = '';
/**
* 数据值变化
* @returns
* @memberof VueCron
*/
@Watch('value')
public updateVal() {
if (!this.value) {
return
}
let arrays: Array<any> = this.value.split(' ');
this.sVal = arrays[0];
this.mVal = arrays[1];
this.hVal = arrays[2];
this.dVal = arrays[3];
this.monthVal = arrays[4];
this.weekVal = arrays[5];
this.yearVal = arrays[6];
}
/**
* 获取表格内容
* @returns
* @memberof VueCron
*/
get tableData() {
return [{
sVal: this.sVal,
mVal: this.mVal,
hVal: this.hVal,
dVal: this.dVal,
monthVal: this.monthVal,
weekVal: this.weekVal,
yearVal: this.yearVal
}]
}
/**
* 获取Cron表达式
* @returns
* @memberof VueCron
*/
get _value() {
if (!this.dVal && !this.weekVal) {
return '';
}
if (this.dVal === '?' && this.weekVal === '?') {
this.$message.error(this.$t('components.cronEditor.message.error1') as string);
}
if (this.dVal !== '?' && this.weekVal !== '?') {
this.$message.error(this.$t('components.cronEditor.message.error1') as string);
}
let v: any = `${this.sVal} ${this.mVal} ${this.hVal} ${this.dVal} ${this.monthVal} ${this.weekVal} ${this.yearVal}`;
if (v !== this.value) {
this.$emit('cronValue', v);
}
this.value = v;
return v;
}
/**
* Vue生命周期
* @returns
* @memberof VueCron
*/
public created() {
if(!this.value) {
this.value = '';
}
this.updateVal();
}
}
</script>
<style lang="less">
.cron {
text-align: left;
padding: 10px;
background: #fff;
border: 1px solid #dcdfe6;
box-shadow: 0 2px 4px 0 rgba(0,0,0,.12), 0 0 6px 0 rgba(0,0,0,.04);
}
</style>
<template lang="html">
<div :val="value_">
<div>
<el-radio v-model="type" label="1" size="mini" border>{{ $t('components.cronEditor.week.everyWeek') }}</el-radio>
</div>
<div>
<el-radio v-model="type" label="5" size="mini" border>{{ $t('components.cronEditor.public.notSpecify') }}</el-radio>
</div>
<div>
<el-radio v-model="type" label="2" size="mini" border>{{ $t('components.cronEditor.public.cycle') }}</el-radio>
<span style="margin-left: 10px; margin-right: 5px;">{{ $t('components.cronEditor.week.from') }}</span>
<el-input-number @change="type = '2'" v-model="cycle.start" :min="1" :max="7" size="mini" style="width: 100px;"></el-input-number>
<span style="margin-left: 5px; margin-right: 5px;">{{ $t('components.cronEditor.week.to') }}</span>
<el-input-number @change="type = '2'" v-model="cycle.end" :min="2" :max="7" size="mini" style="width: 100px;"></el-input-number>
</div>
<div>
<el-radio v-model="type" label="3" size="mini" border>{{ $t('components.cronEditor.public.loop') }}</el-radio>
<span style="margin-left: 10px; margin-right: 5px;">{{ $t('components.cronEditor.week.from') }}</span>
<el-input-number @change="type = '3'" v-model="loop.start" :min="1" :max="7" size="mini" style="width: 100px;"></el-input-number>
<span style="margin-left: 5px; margin-right: 5px;">{{ $t('components.cronEditor.week.start') }}</span>
<el-input-number @change="type = '3'" v-model="loop.end" :min="1" :max="7" size="mini" style="width: 100px;"></el-input-number>
{{ $t('components.cronEditor.week.onceADay') }}
</div>
<div>
<el-radio v-model="type" label="7" size="mini" border>{{ $t('components.cronEditor.week.specifyWeek') }}</el-radio>
<span style="margin-left: 10px; margin-right: 5px;">{{ $t('components.cronEditor.week.weekOfMonth') }}</span>
<el-input-number @change="type = '7'" v-model="week.start" :min="1" :max="4" size="mini" style="width: 100px;"></el-input-number>
<span style="margin-left: 5px; margin-right: 5px;">{{ $t('components.cronEditor.week.weekWeek') }}</span>
<el-input-number @change="type = '7'" v-model="week.end" :min="1" :max="7" size="mini" style="width: 100px;"></el-input-number>
</div>
<div>
<el-radio v-model="type" label="6" size="mini" border>{{ $t('components.cronEditor.week.lastOfMonth') }}</el-radio>
<span style="margin-left: 10px; margin-right: 5px;">{{ $t('components.cronEditor.week.week') }}</span>
<el-input-number @change="type = '6'" v-model="last" :min="1" :max="7" size="mini" style="width: 100px;"></el-input-number>
</div>
<div>
<el-radio v-model="type" label="4" size="mini" border>{{ $t('components.cronEditor.public.specify') }}</el-radio>
<el-checkbox-group v-model="appoint" style="margin-left: 50px; line-height: 25px;">
<template v-for="i in 7" >
<el-checkbox @change="type = '4'" :key="i" :label="i.toString()"></el-checkbox>
</template>
</el-checkbox-group>
</div>
</div>
</template>
<script lang='ts'>
import { Vue, Watch, Component } from 'vue-property-decorator';
@Component({})
export default class Week extends Vue {
/**
* Cron表达式
*
* @type {any}
* @memberof Day
*/
public value: any;
/**
* 标签类型标识
*
* @type {any}
* @memberof Day
*/
public type: string = '1';
/**
* 周期
*
* @type {any}
* @memberof Day
*/
public cycle: any = {
start: 0,
end: 0
};
/**
* 循环
*
* @type {any}
* @memberof Day
*/
public loop: any = {
start: 0,
end: 0
}
/**
* 周
*
* @type {any}
* @memberof Day
*/
public week: any = {
start: 0,
end: 0
}
/**
* 工作日
*
* @type {any}
* @memberof Day
*/
public work: number = 0;
/**
* 最后
*
* @type {any}
* @memberof Day
*/
public last: number = 0;
/**
* 指定
*
* @type {any}
* @memberof Day
*/
public appoint: any = [];
/**
* 获取Cron表达式
*
* @returns
* @memberof Day
*/
get value_() {
let result = []
switch (this.type) {
case '1': // 每秒
result.push('*')
break
case '2': // 年期
result.push(`${this.cycle.start}-${this.cycle.end}`)
break
case '3': // 循环
result.push(`${this.loop.start}/${this.loop.end}`)
break
case '4': // 指定
result.push(this.appoint.join(','))
console.log(this.appoint);
break
case '6': // 最后
result.push(`${this.last === 0 ? '' : this.last}L`)
break
case '7': // 指定周
result.push(`${this.week.start}#${this.week.end}`)
break
default: // 不指定
result.push('?')
break
}
this.$emit('input', result.join(''))
return result.join('')
}
/**
* 数据值变化
*
* @returns
* @memberof Day
*/
@Watch('value')
public updateVal() {
if (!this.value) {
return
}
if (this.value === '?') {
this.type = '5'
} else if (this.value.indexOf('-') !== -1) { // 2周期
if (this.value.split('-').length === 2) {
this.type = '2'
this.cycle.start = this.value.split('-')[0]
this.cycle.end = this.value.split('-')[1]
}
} else if (this.value.indexOf('/') !== -1) { // 3循环
if (this.value.split('/').length === 2) {
this.type = '3'
this.loop.start = this.value.split('/')[0]
this.loop.end = this.value.split('/')[1]
}
} else if (this.value.indexOf('*') !== -1) { // 1每
this.type = '1'
} else if (this.value.indexOf('L') !== -1) { // 6最后
this.type = '6'
this.last = this.value.replace('L', '')
} else if (this.value.indexOf('#') !== -1) { // 7指定周
if (this.value.split('#').length === 2) {
this.type = '7'
this.week.start = this.value.split('#')[0]
this.week.end = this.value.split('#')[1]
}
} else if (this.value.indexOf('W') !== -1) { // 8工作日
this.type = '8'
this.work = this.value.replace('W', '')
} else { // *
this.type = '4'
this.appoint = this.value.split(',')
}
}
public created() {
this.updateVal();
}
}
</script>
<style lang="css">
.el-checkbox+.el-checkbox {
margin-left: 10px;
}
</style>
<template lang="html">
<div :val="value_">
<div>
<el-radio v-model="type" label="1" size="mini" border>{{ $t('components.cronEditor.year.everyYear') }}</el-radio>
</div>
<div>
<el-radio v-model="type" label="5" size="mini" border>{{ $t('components.cronEditor.public.notSpecify') }}</el-radio>
</div>
<div>
<el-radio v-model="type" label="2" size="mini" border>{{ $t('components.cronEditor.public.cycle') }}</el-radio>
<span style="margin-left: 10px; margin-right: 5px;">{{ $t('components.cronEditor.public.from') }}</span>
<el-input-number @change="type = '2'" v-model="cycle.start" :min="2000" size="mini" style="width: 100px;"></el-input-number>
<span style="margin-left: 5px; margin-right: 5px;">{{ $t('components.cronEditor.public.to') }}</span>
<el-input-number @change="type = '2'" v-model="cycle.end" :min="2000" size="mini" style="width: 100px;"></el-input-number>
{{ $t('components.cronEditor.year.title') }}
</div>
</div>
</template>
<script lang='ts'>
import { Vue, Watch, Component } from 'vue-property-decorator';
@Component({})
export default class Year extends Vue {
/**
* Cron表达式
*
* @type {any}
* @memberof Day
*/
public value: any;
/**
* 标签类型标识
*
* @type {any}
* @memberof Day
*/
public type: string = '1';
/**
* 周期
*
* @type {any}
* @memberof Day
*/
public cycle: any = {
start: 0,
end: 0
};
/**
* 循环
*
* @type {any}
* @memberof Day
*/
public loop: any = {
start: 0,
end: 0
}
/**
* 周
*
* @type {any}
* @memberof Day
*/
public week: any = {
start: 0,
end: 0
}
/**
* 工作日
*
* @type {any}
* @memberof Day
*/
public work: number = 0;
/**
* 最后
*
* @type {any}
* @memberof Day
*/
public last: number = 0;
/**
* 指定
*
* @type {any}
* @memberof Day
*/
public appoint: any = [];
/**
* 获取Cron表达式
*
* @returns
* @memberof Day
*/
get value_() {
let result = []
switch (this.type) {
case '1': // 每秒
result.push('*')
break
case '2': // 年期
result.push(`${this.cycle.start}-${this.cycle.end}`)
break
case '3': // 循环
result.push(`${this.loop.start}/${this.loop.end}`)
break
case '4': // 指定
result.push(this.appoint.join(','))
break
case '6': // 最后
result.push(`${this.last === 0 ? '' : this.last}L`)
break
default: // 不指定
result.push('?')
break
}
this.$emit('input', result.join(''))
return result.join('')
}
/**
* 数据值变化
*
* @returns
* @memberof Day
*/
@Watch('value')
public updateVal() {
if (!this.value) {
return
}
if (this.value === '?') {
this.type = '5'
} else if (this.value.indexOf('-') !== -1) { // 2周期
if (this.value.split('-').length === 2) {
this.type = '2'
this.cycle.start = this.value.split('-')[0]
this.cycle.end = this.value.split('-')[1]
}
} else if (this.value.indexOf('/') !== -1) { // 3循环
if (this.value.split('/').length === 2) {
this.type = '3'
this.loop.start = this.value.split('/')[0]
this.loop.end = this.value.split('/')[1]
}
} else if (this.value.indexOf('*') !== -1) { // 1每
this.type = '1'
} else if (this.value.indexOf('L') !== -1) { // 6最后
this.type = '6'
this.last = this.value.replace('L', '')
} else if (this.value.indexOf('#') !== -1) { // 7指定周
if (this.value.split('#').length === 2) {
this.type = '7'
this.week.start = this.value.split('#')[0]
this.week.end = this.value.split('#')[1]
}
} else if (this.value.indexOf('W') !== -1) { // 8工作日
this.type = '8'
this.work = this.value.replace('W', '')
} else { // *
this.type = '4'
this.appoint = this.value.split(',')
}
}
public created() {
this.updateVal();
}
}
</script>
<style lang="css">
.el-checkbox+.el-checkbox {
margin-left: 10px;
}
</style>
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
class='dropdown-list-dynamic' class='dropdown-list-dynamic'
:transfer="true" :transfer="true"
v-model="currentVal" v-model="currentVal"
:disabled="disabled === true ? true : false" :disabled="disabled"
:clearable="true" :clearable="true"
:filterable="filterable === true ? true : false" :filterable="filterable"
@on-open-change="onClick" @on-open-change="onClick"
:placeholder="$t('components.dropDownListDynamic.placeholder')"> :placeholder="$t('components.dropDownListDynamic.placeholder')">
<i-option v-for="(item, index) in items" :key="index" :value="item.value">{{($t('userCustom.'+tag+'.'+item.value)!== ('userCustom.'+tag+'.'+item.value))?$t('userCustom.'+tag+'.'+item.value) : item.text}}</i-option> <i-option v-for="(item, index) in items" :key="index" :value="item.value">{{($t('userCustom.'+tag+'.'+item.value)!== ('userCustom.'+tag+'.'+item.value))?$t('userCustom.'+tag+'.'+item.value) : item.text}}</i-option>
...@@ -114,7 +114,7 @@ export default class DropDownListDynamic extends Vue { ...@@ -114,7 +114,7 @@ export default class DropDownListDynamic extends Vue {
* @type {boolean} * @type {boolean}
* @memberof DropDownListDynamic * @memberof DropDownListDynamic
*/ */
@Prop() public filterable?: boolean; public filterable: boolean = true;
/** /**
* 下拉选提示内容 * 下拉选提示内容
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
:transfer="true" :transfer="true"
transfer-class-name="dropdown-list-mpicker-transfer" transfer-class-name="dropdown-list-mpicker-transfer"
v-model="currentVal" v-model="currentVal"
:disabled="disabled === true ? true : false" :disabled="disabled"
:clearable="true" :clearable="true"
:filterable="filterable === true ? true : false" :filterable="filterable"
@on-open-change="onClick" @on-open-change="onClick"
:placeholder="$t('components.dropDownListMpicker.placeholder')"> :placeholder="$t('components.dropDownListMpicker.placeholder')">
<i-option v-for="(item, index) in items" :key="index" :value="item.value.toString()" :label="item.text"> <i-option v-for="(item, index) in items" :key="index" :value="item.value.toString()" :label="item.text">
...@@ -88,7 +88,7 @@ export default class DropDownListMpicker extends Vue { ...@@ -88,7 +88,7 @@ export default class DropDownListMpicker extends Vue {
* @type {boolean} * @type {boolean}
* @memberof DropDownListMpicker * @memberof DropDownListMpicker
*/ */
@Prop() public filterable?: boolean; public filterable: boolean = true;
/** /**
* 下拉选提示内容 * 下拉选提示内容
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
class='dropdown-list' class='dropdown-list'
:transfer="true" :transfer="true"
v-model="currentVal" v-model="currentVal"
:disabled="disabled === true ? true : false" :disabled="disabled"
:clearable="true" :clearable="true"
:filterable="filterable === true ? true : false" :filterable="filterable"
@on-open-change="onClick" @on-open-change="onClick"
:placeholder="$t('components.dropDownList.placeholder')"> :placeholder="$t('components.dropDownList.placeholder')">
<i-option v-for="(item, index) in items" :key="index" :value="item.value">{{($t('codelist.'+tag+'.'+item.value)!== ('codelist.'+tag+'.'+item.value))?$t('codelist.'+tag+'.'+item.value) : item.text}}</i-option> <i-option v-for="(item, index) in items" :key="index" :value="item.value">{{($t('codelist.'+tag+'.'+item.value)!== ('codelist.'+tag+'.'+item.value))?$t('codelist.'+tag+'.'+item.value) : item.text}}</i-option>
...@@ -141,7 +141,7 @@ export default class DropDownList extends Vue { ...@@ -141,7 +141,7 @@ export default class DropDownList extends Vue {
* @type {boolean} * @type {boolean}
* @memberof DropDownList * @memberof DropDownList
*/ */
@Prop() public filterable?: boolean; public filterable: boolean = true;
/** /**
* 下拉选提示内容 * 下拉选提示内容
......
...@@ -193,19 +193,19 @@ export default class EditViewEngine extends ViewEngine { ...@@ -193,19 +193,19 @@ export default class EditViewEngine extends ViewEngine {
*/ */
public setTabCaption(info: string,isNew:boolean): void { public setTabCaption(info: string,isNew:boolean): void {
let viewdata: any = this.view.model; let viewdata: any = this.view.model;
let index:number = viewdata.srfTitle.indexOf("-"); let index:number = viewdata.srfCaption.indexOf("-");
if (viewdata && info && !Object.is(info, '')) { if (viewdata && info && !Object.is(info, '')) {
if(index !== -1){ if(index !== -1){
viewdata.srfTitle = viewdata.srfTitle.substr(0,index); viewdata.srfCaption = viewdata.srfCaption.substr(0,index);
} }
// 解决表格视图标题问题 // 解决表格视图标题问题
if(this.view.$tabPageExp && this.view.viewDefaultUsage){ if(this.view.$tabPageExp && this.view.viewDefaultUsage){
this.view.$tabPageExp.setCurPageCaption(this.view.$t(viewdata.srfTitle), this.view.$t(viewdata.srfTitle), info); this.view.$tabPageExp.setCurPageCaption(this.view.$t(viewdata.srfCaption), this.view.$t(viewdata.srfCaption), info);
} }
if(this.view.$route){ if(this.view.$route){
this.view.$route.meta.info = info; this.view.$route.meta.info = info;
} }
this.view.model.srfTitle = `${this.view.$t(viewdata.srfTitle)}-${viewdata.dataInfo}`; this.view.model.srfCaption = `${this.view.$t(viewdata.srfCaption)}-${viewdata.dataInfo}`;
this.view.initNavDataWithRoute(null,isNew); this.view.initNavDataWithRoute(null,isNew);
} }
} }
......
...@@ -360,6 +360,8 @@ export default class MDViewEngine extends ViewEngine { ...@@ -360,6 +360,8 @@ export default class MDViewEngine extends ViewEngine {
this.calcToolbarItemState(state); this.calcToolbarItemState(state);
if(args && args.length > 0){ if(args && args.length > 0){
this.calcToolbarItemAuthState(this.transformData(args[0])); this.calcToolbarItemAuthState(this.transformData(args[0]));
}else{
this.calcToolbarItemAuthState(null);
} }
} }
...@@ -383,6 +385,7 @@ export default class MDViewEngine extends ViewEngine { ...@@ -383,6 +385,7 @@ export default class MDViewEngine extends ViewEngine {
this.view.$emit('viewload', args); this.view.$emit('viewload', args);
} }
this.calcToolbarItemState(true); this.calcToolbarItemState(true);
this.calcToolbarItemAuthState(null);
} }
/** /**
......
import MDViewEngine from './md-view-engine';
/**
* 视图引擎基础
*
* @export
* @class TreeGridExViewEngine
* @extends {MDViewEngine}
*/
export default class TreeGridExViewEngine extends MDViewEngine {
/**
* 表格部件
*
* @type {*}
* @memberof TreeGridExViewEngine
*/
protected treegridex: any;
/**
* Creates an instance of TreeGridExViewEngine.
* @memberof TreeGridExViewEngine
*/
constructor() {
super();
}
/**
* 引擎初始化
*
* @param {*} [options={}]
* @memberof TreeGridExViewEngine
*/
public init(options: any = {}): void {
this.treegridex = options.treegridex;
super.init(options);
}
/**
* 引擎加载
*
* @param {*} [opts={}]
* @memberof TreeGridExViewEngine
*/
public load(opts: any = {},isnotify:boolean=false): void {
if(!this.view.isformDruipart){
super.load(opts);
}else{
if(isnotify){
super.load(opts);
}
}
}
/**
* 部件事件
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof TreeGridExViewEngine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
if (Object.is(ctrlName, 'treegridex')) {
this.MDCtrlEvent(eventName, args);
}
super.onCtrlEvent(ctrlName, eventName, args);
}
/**
* 获取多数据部件
*
* @returns {*}
* @memberof TreeGridExViewEngine
*/
public getMDCtrl(): any {
return this.treegridex;
}
/**
* 事件处理
*
* @param {string} eventName
* @param {*} args
* @memberof TreeGridExViewEngine
*/
public MDCtrlEvent(eventName: string, args: any): void {
if (Object.is(eventName, 'rowdblclick') && this.gridRowAllowActive(2)) {
this.doEdit(args);
return;
}
if (Object.is(eventName, 'selectionchange')) {
this.selectionChange(args);
if (this.gridRowAllowActive(1)) {
this.doEdit(args);
}
return;
}
super.MDCtrlEvent(eventName, args);
}
/**
* 表格是否被允许激活
*
* @param {number} mode
* @returns {boolean}
* @memberof TreeGridExViewEngine
*/
public gridRowAllowActive(mode: number): boolean {
return this.view.gridRowActiveMode === mode ? true : false;
}
}
\ No newline at end of file
...@@ -190,8 +190,15 @@ export default class ViewEngine { ...@@ -190,8 +190,15 @@ export default class ViewEngine {
return; return;
} }
const _item = _this.view.toolBarModels[key]; const _item = _this.view.toolBarModels[key];
if(_item && _item['dataaccaction'] && _this.view.appUIService && data && Object.keys(data).length >0){ if(_item && _item['dataaccaction'] && _this.view.appUIService){
let dataActionResult:any = _this.view.appUIService.getAllOPPrivs(data)[_item['dataaccaction']]; 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 // 无权限:0;有权限:1
if(dataActionResult === 0){ if(dataActionResult === 0){
// 禁用:1;隐藏:2;隐藏且默认隐藏:6 // 禁用:1;隐藏:2;隐藏且默认隐藏:6
......
...@@ -25,6 +25,9 @@ export default class WFDynaExpGridViewEngine extends GridViewEngine { ...@@ -25,6 +25,9 @@ export default class WFDynaExpGridViewEngine extends GridViewEngine {
*/ */
public load(opts: any = {},isnotify:boolean=false): void { public load(opts: any = {},isnotify:boolean=false): void {
this.view.getWFStepModel().then((res:any) =>{ this.view.getWFStepModel().then((res:any) =>{
if(!res || res.length === 0) {
return;
}
if(!this.view.isformDruipart){ if(!this.view.isformDruipart){
super.load(opts); super.load(opts);
}else{ }else{
...@@ -34,4 +37,43 @@ export default class WFDynaExpGridViewEngine extends GridViewEngine { ...@@ -34,4 +37,43 @@ export default class WFDynaExpGridViewEngine extends GridViewEngine {
} }
}) })
} }
/**
* 部件事件
*
* @param {string} ctrlName
* @param {string} eventName
* @param {*} args
* @memberof WFDynaExpGridViewEngine
*/
public onCtrlEvent(ctrlName: string, eventName: string, args: any): void {
if (Object.is(ctrlName, 'grid')) {
this.GridEvent(eventName, args);
}
super.onCtrlEvent(ctrlName, eventName, args);
}
/**
* 事件处理
*
* @param {string} eventName
* @param {*} args
* @memberof WFDynaExpGridViewEngine
*/
public GridEvent(eventName: string, args: any): void {
if (Object.is(eventName, 'load')) {
this.GridLoad(args);
}
super.MDCtrlEvent(eventName, args);
}
/**
* 表格加载完成
*
* @param {any[]} args
* @memberof WFDynaExpGridViewEngine
*/
public GridLoad(args: any[]) {
this.view.getWFStepModel();
}
} }
\ No newline at end of file
...@@ -246,6 +246,83 @@ export default { ...@@ -246,6 +246,83 @@ export default {
localUpload:'Local upload', localUpload:'Local upload',
or:'Or', or:'Or',
imgMsg1:'Select from stock' imgMsg1:'Select from stock'
},
lockScren:{
title:'Set the password lock screen',
label:'password',
message:'The lock screen password cannot be empty',
placeholder:'Please enter the lock screen password',
placeholder1:'Please enter your login password',
message1: 'The unlock password is wrong. Please reenter it',
promptInformation:'Do you want to quit the system? Do you want to continue?',
prompt:'prompt',
confirmButtonText:'determine',
cancelButtonText:'cancel',
},
cronEditor: {
label: {
second: 'Second',
minute: 'Minute',
hour: 'Hour',
day: 'Day',
week: 'Week',
month: 'Month',
year: 'Year',
},
public : {
specify: 'Specify',
notSpecify: 'Not specify',
cycle: 'Cycle',
from: 'From',
to: 'to',
loop: 'Loop',
every: 'Every',
once: 'execute once',
},
second: 'second',
minute: 'minute',
hour: {
title: 'hour',
everyHour: 'Every hour',
hourStart: "o'clock start, every ",
onceAHour: "o'clock to execute once.",
},
day: {
title: 'day',
daily: 'Every day',
workDay: 'Working day',
dayStart: 'rd start, every ',
onceADay: 'rd to execute once',
thisMonth: 'this month',
lastWorkDay: 'rd, Recent working day',
lastDayOfMonth: 'Last day of the month',
},
month: {
title: 'month',
everyMonth: 'Every month',
monthStart: ' month start, every',
onceAMonth: ' month to execute once',
},
week: {
title: 'week',
everyWeek: 'Every week',
from: '',
to: 'from weekday',
start: 'start, every',
onceADay: 'days to execute once',
specifyWeek: 'Specify week',
weekOfMonth: 'this month',
weekWeek: 'week, weekday',
lastOfMonth: 'Last of the month',
week: 'weekday',
},
year: {
title: 'year',
everyYear: 'Every year',
},
message: {
error1: 'Date and day of the week cannot be "not specified" at the same time',
error2: 'Both the date and the day of the week must be "not specified"',
},
} }
}; };
\ No newline at end of file
...@@ -247,5 +247,83 @@ export default { ...@@ -247,5 +247,83 @@ export default {
localUpload:'本地上传', localUpload:'本地上传',
or:'或', or:'或',
imgMsg1:'从素材库选择' imgMsg1:'从素材库选择'
},
lockScren:{
title:'设置锁屏密码',
label:'锁屏密码',
message:'锁屏密码不能为空',
placeholder:'请输入锁屏密码',
placeholder1:'请输入登录密码',
message1: '解锁密码错误,请重新输入',
promptInformation:'是否退出系统, 是否继续?',
prompt:'提示',
confirmButtonText:'确定',
cancelButtonText:'取消',
},
cronEditor: {
label: {
second: '秒',
minute: '分',
hour: '时',
day: '日',
week: '周',
month: '月',
year: '年',
},
public : {
specify: '指定',
notSpecify: '不指定',
cycle: '周期',
from: '从',
to: '至',
loop: '循环',
every: '每',
once: '执行一次',
},
second: '秒',
minute: '分',
hour: {
title: '时',
everyHour: '每时',
hourStart: '时开始,每',
onceAHour: '时执行一次',
},
day: {
title: '日',
daily: '每日',
workDay: '工作日',
dayStart: '日开始,每',
onceADay: '日执行一次',
thisMonth: '本月',
lastWorkDay: '号,最近的工作日',
lastDayOfMonth: '本月最后一天',
},
month: {
title: '月',
everyMonth: '每月',
monthStart: '月开始,每',
onceAMonth: '月执行一次',
},
week: {
title: '周',
everyWeek: '每周',
from: '从星期',
to: '至星期',
start: '开始,每',
onceADay: '天执行一次',
specifyWeek: '指定周',
weekOfMonth: '本月第',
weekWeek: '周,星期',
lastOfMonth: '本月最后一个',
week: '星期',
},
year: {
title: '年',
everyYear: '每年',
},
message: {
error1: '日期与星期不可以同时为“不指定”',
error2: '日期与星期必须有一个为“不指定”',
},
} }
}; };
\ No newline at end of file
...@@ -33,6 +33,7 @@ mock.onGet('/appdata').reply((config: any) => { ...@@ -33,6 +33,7 @@ mock.onGet('/appdata').reply((config: any) => {
// 当前用户条线代码 // 当前用户条线代码
srfsectorbc:"" srfsectorbc:""
}, },
unires:["RESOURCE1","RESOURCE2"],
//当前用户所有组织部门标识 //当前用户所有组织部门标识
srforgsections:[{"srforgsectorid":"5bd1ecf4d3c31e31cb66373df56b852f","srforgsectorname":"项目一部"},{"srforgsectorid":"2ad1ecf4d3c31e31cb66373df56b852f","srforgsectorname":"项目二部"}] srforgsections:[{"srforgsectorid":"5bd1ecf4d3c31e31cb66373df56b852f","srforgsectorname":"项目一部"},{"srforgsectorid":"2ad1ecf4d3c31e31cb66373df56b852f","srforgsectorname":"项目二部"}]
}]; }];
......
...@@ -11,5 +11,24 @@ export class FormButtonModel extends FormDetailModel { ...@@ -11,5 +11,24 @@ export class FormButtonModel extends FormDetailModel {
constructor(opts: any = {}) { constructor(opts: any = {}) {
super(opts); super(opts);
this.disabled = opts.disabled;
this.uiaction = opts.uiaction;
} }
/**
* 是否禁用
*
* @type {boolean}
* @memberof FormButtonModel
*/
public disabled:boolean = false;
/**
* 按钮对应的界面行为
*
* @type {*}
* @memberof FormButtonModel
*/
public uiaction:any;
} }
\ No newline at end of file
...@@ -148,32 +148,11 @@ export default class CodeListService { ...@@ -148,32 +148,11 @@ export default class CodeListService {
let cacheTimeout:any = codelist.cacheTimeout; let cacheTimeout:any = codelist.cacheTimeout;
// 启用缓存 // 启用缓存
if(isEnableCache){ if(isEnableCache){
// 加载完成,从本地缓存获取
if(CodeListService.codelistCached.get(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`)){
let items:any = CodeListService.codelistCached.get(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`).items;
if(items.length >0){
if(cacheTimeout !== -1){
if(new Date().getTime() > codelist.expirationTime){
codelist.getItems(context,data,isloading).then((result:any) =>{
CodeListService.codelistCached.set(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`,{items:result});
codelist.expirationTime = new Date().getTime() + cacheTimeout;
resolve(result);
}).catch((error:any) =>{
Promise.reject([]);
})
}else{
return resolve(items);
}
}else{
return resolve(items);
}
}
}
if (codelist) {
const callback:Function = (context:any ={},data:any ={},tag:string,promise:Promise<any>) =>{ const callback:Function = (context:any ={},data:any ={},tag:string,promise:Promise<any>) =>{
promise.then((result:any) =>{ promise.then((result:any) =>{
if(result.length > 0){ if(result.length > 0){
CodeListService.codelistCached.set(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`,{items:result}); CodeListService.codelistCached.set(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`,{items:result});
CodeListService.codelistCache.delete(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`);
return resolve(result); return resolve(result);
}else{ }else{
return resolve([]); return resolve([]);
...@@ -182,15 +161,23 @@ export default class CodeListService { ...@@ -182,15 +161,23 @@ export default class CodeListService {
return reject(result); return reject(result);
}) })
} }
// 加载完成,从本地缓存获取
if(CodeListService.codelistCached.get(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`)){
let items:any = CodeListService.codelistCached.get(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`).items;
if(items.length >0){
if(new Date().getTime() <= codelist.getExpirationTime()){
return resolve(items);
}
}
}
if (codelist) {
// 加载中,UI又需要数据,解决连续加载同一代码表问题 // 加载中,UI又需要数据,解决连续加载同一代码表问题
if(CodeListService.codelistCache.get(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`)){ if(CodeListService.codelistCache.get(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`)){
callback(context,data,tag,CodeListService.codelistCache.get(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`)); callback(context,data,tag,CodeListService.codelistCache.get(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`));
}else{ }else{
let result:Promise<any> = codelist.getItems(context,data,isloading); let result:Promise<any> = codelist.getItems(context,data,isloading);
CodeListService.codelistCache.set(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`,result); CodeListService.codelistCache.set(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`,result);
if(cacheTimeout !== -1){ codelist.setExpirationTime(new Date().getTime() + cacheTimeout);
codelist.expirationTime = new Date().getTime() + cacheTimeout;
}
callback(context,data,tag,result); callback(context,data,tag,result);
} }
} }
......
...@@ -11,7 +11,7 @@ export const commitAuthData = ({ commit, state }: { commit: any, state: any }, { ...@@ -11,7 +11,7 @@ export const commitAuthData = ({ commit, state }: { commit: any, state: any }, {
if(appmenu && appmenu.length >0){ if(appmenu && appmenu.length >0){
commit('setMenuData', appmenu); commit('setMenuData', appmenu);
} }
if(enablepermissionvalid){ if(enablepermissionvalid === true || enablepermissionvalid === false){
commit('setEnablePermissionValid', enablepermissionvalid); commit('setEnablePermissionValid', enablepermissionvalid);
} }
} }
\ No newline at end of file
...@@ -98,7 +98,10 @@ export const addPage = (state: any, arg: any) => { ...@@ -98,7 +98,10 @@ export const addPage = (state: any, arg: any) => {
if (!arg) { if (!arg) {
return; return;
} }
if (Object.is(arg.meta.viewType, 'APPINDEX')) { // 视图类型为REDIRECTVIEW和NOTAB的视图不添加缓存
if(Object.is(arg.meta.viewType, 'REDIRECTVIEW') || Object.is(arg.meta.viewType, 'NOTAB')){
return;
}else if(Object.is(arg.meta.viewType, 'APPINDEX')) {
window.sessionStorage.setItem(Environment.AppName, arg.fullPath); window.sessionStorage.setItem(Environment.AppName, arg.fullPath);
} else { } else {
const page: any = {}; const page: any = {};
......
...@@ -38,6 +38,10 @@ ...@@ -38,6 +38,10 @@
.el-table th { .el-table th {
padding: 5px 0; padding: 5px 0;
} }
.el-table th.gutter:last-of-type {
display: block !important;
width: 10px !important;
}
.grid .el-table__body-wrapper .el-table__row td{ .grid .el-table__body-wrapper .el-table__row td{
border-left: 1px solid rgb(245,245,245); border-left: 1px solid rgb(245,245,245);
border-top: 1px solid rgb(245,245,245); border-top: 1px solid rgb(245,245,245);
...@@ -116,7 +120,7 @@ ...@@ -116,7 +120,7 @@
> .ivu-card-body { > .ivu-card-body {
// height: 50%; // height: 50%;
// flex-grow: 1; // flex-grow: 1;
height: calc(100% - 62px); height: calc(100% - 74px);
padding: 0px; padding: 0px;
> .content-container { > .content-container {
height: 100%; height: 100%;
......
...@@ -56,5 +56,16 @@ export default class UIService { ...@@ -56,5 +56,16 @@ export default class UIService {
return (window as any)['uiServiceRegister'].getService(name); return (window as any)['uiServiceRegister'].getService(name);
} }
/**
* 获取资源标识是否有权限(无数据目标)
*
* @param tag 资源标识
* @memberof UIService
*/
public getResourceOPPrivs(tag:any){
return this.authService.getResourcePermission(this.authService.sysOPPrivsMap.get(tag))?1:0;
}
} }
\ No newline at end of file
...@@ -257,8 +257,15 @@ export class ViewTool { ...@@ -257,8 +257,15 @@ export class ViewTool {
return; return;
} }
const _item = ActionModel[key]; const _item = ActionModel[key];
if(_item && _item['dataaccaction'] && UIService && data && Object.keys(data).length >0){ if(_item && _item['dataaccaction'] && UIService){
let dataActionResult:any = UIService.getAllOPPrivs(data)[_item['dataaccaction']]; 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 // 无权限:0;有权限:1
if(dataActionResult === 0){ if(dataActionResult === 0){
// 禁用:1;隐藏:2;隐藏且默认隐藏:6 // 禁用:1;隐藏:2;隐藏且默认隐藏:6
......
...@@ -214,6 +214,10 @@ export default class ControlService { ...@@ -214,6 +214,10 @@ export default class ControlService {
dataItems.forEach((item:any) =>{ dataItems.forEach((item:any) =>{
if(item && item.prop){ if(item && item.prop){
requestData[item.prop] = data[item.name]; requestData[item.prop] = data[item.name];
}else{
if(item && item.dataType && Object.is(item.dataType,"FORMITEM")){
requestData[item.name] = data[item.name]
}
} }
}); });
if(isMerge && (data.viewparams && Object.keys(data.viewparams).length > 0)){ if(isMerge && (data.viewparams && Object.keys(data.viewparams).length > 0)){
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册