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

ibiz4j 发布系统代码

上级 fce4cb86
## v7.0.0-alpha.18 [2020-8-23]
### Bug修复
修复后续界面行为异常问题
修复表格合计行去掉N/A字样
修复树表跳转页面逻辑
修复嵌入表格保存提示信息重复问题
修复表格表格值清空保存问题
### 功能新增及优化
#### 模板
新增向导面板支持状态属性
新增应用全屏功能和应用锁屏功能
新增搜索表单新建默认值逻辑
新增实体表格值规则
新增动态工作流导航视图计数器
新增工作流审批意见控件时光轴样式组件和cron表达式组件
新增支持日历部件项布局面板
优化视图标题问题
优化表单属性值规则,无值的时候不校验
优化表单按钮、表单分组界面行为、表格操作列、工具栏、操作列权限控制
优化实体数据多项选择视图选中效果
优化动态代码表本地缓存逻辑
优化合入应用级上下文时机
优化实体数据重定向视图逻辑
优化表单开始流程和提交流程逻辑
#### 基础文件
修复表格滑动条表头与内容不齐
修复数据选择(嵌入视图)抛值异常问题
优化权限服务基类菜单权限和统一资源权限
优化动态工作流导航视图引擎
优化表单按钮、表单分组界面行为、表格操作列、工具栏、操作列权限控制
优化表单项增加padding
新增应用全屏组件和应用锁屏组件
新增工作流审批意见控件时光轴样式组件和cron表达式组件
## v7.0.0-alpha.17 [2020-8-9]
### Bug修复
......
......@@ -83,6 +83,10 @@ import UpdatePwd from './components/app-update-password/app-update-password.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'
import AppMessagePopover from './components/app-message-popover/app-message-popover.vue'
// 全局挂载UI实体服务注册中心
window['uiServiceRegister'] = uiServiceRegister;
// 全局挂载实体权限服务注册中心
......@@ -179,5 +183,8 @@ export const AppComponents = {
v.component('context-menu-drag',ContextMenuDrag);
v.component('app-update-password',UpdatePwd);
v.component('app-menu-item', AppMenuItem);
v.component('action-timeline', ActionTimeline);
v.component('cron-editor', CronEditor);
v.component('app-message-popover', AppMessagePopover);
},
};
\ No newline at end of file
......@@ -28,9 +28,16 @@ export default class JobsInfoAuthServiceBase extends AuthService {
*/
public getOPPrivs(mainSateOPPrivs:any):any{
let curDefaultOPPrivs:any = this.getSysOPPrivs();
let copyDefaultOPPrivs:any = JSON.parse(JSON.stringify(curDefaultOPPrivs));
if(mainSateOPPrivs){
Object.assign(curDefaultOPPrivs,mainSateOPPrivs);
}
// 统一资源优先
Object.keys(curDefaultOPPrivs).forEach((name:string) => {
if(this.sysOPPrivsMap.get(name) && copyDefaultOPPrivs[name] === 0){
curDefaultOPPrivs[name] = copyDefaultOPPrivs[name];
}
});
return curDefaultOPPrivs;
}
......
......@@ -28,9 +28,16 @@ export default class JobsLockAuthServiceBase extends AuthService {
*/
public getOPPrivs(mainSateOPPrivs:any):any{
let curDefaultOPPrivs:any = this.getSysOPPrivs();
let copyDefaultOPPrivs:any = JSON.parse(JSON.stringify(curDefaultOPPrivs));
if(mainSateOPPrivs){
Object.assign(curDefaultOPPrivs,mainSateOPPrivs);
}
// 统一资源优先
Object.keys(curDefaultOPPrivs).forEach((name:string) => {
if(this.sysOPPrivsMap.get(name) && copyDefaultOPPrivs[name] === 0){
curDefaultOPPrivs[name] = copyDefaultOPPrivs[name];
}
});
return curDefaultOPPrivs;
}
......
......@@ -28,9 +28,16 @@ export default class JobsLogAuthServiceBase extends AuthService {
*/
public getOPPrivs(mainSateOPPrivs:any):any{
let curDefaultOPPrivs:any = this.getSysOPPrivs();
let copyDefaultOPPrivs:any = JSON.parse(JSON.stringify(curDefaultOPPrivs));
if(mainSateOPPrivs){
Object.assign(curDefaultOPPrivs,mainSateOPPrivs);
}
// 统一资源优先
Object.keys(curDefaultOPPrivs).forEach((name:string) => {
if(this.sysOPPrivsMap.get(name) && copyDefaultOPPrivs[name] === 0){
curDefaultOPPrivs[name] = copyDefaultOPPrivs[name];
}
});
return curDefaultOPPrivs;
}
......
......@@ -28,9 +28,16 @@ export default class JobsRegistryAuthServiceBase extends AuthService {
*/
public getOPPrivs(mainSateOPPrivs:any):any{
let curDefaultOPPrivs:any = this.getSysOPPrivs();
let copyDefaultOPPrivs:any = JSON.parse(JSON.stringify(curDefaultOPPrivs));
if(mainSateOPPrivs){
Object.assign(curDefaultOPPrivs,mainSateOPPrivs);
}
// 统一资源优先
Object.keys(curDefaultOPPrivs).forEach((name:string) => {
if(this.sysOPPrivsMap.get(name) && copyDefaultOPPrivs[name] === 0){
curDefaultOPPrivs[name] = copyDefaultOPPrivs[name];
}
});
return curDefaultOPPrivs;
}
......
.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
......@@ -104,8 +104,15 @@ export default class AppActionBar extends Vue {
return;
}
const _item = ActionModel[key];
if(_item && _item['dataaccaction'] && UIService && data && Object.keys(data).length >0){
let dataActionResult:any = UIService.getAllOPPrivs(data)[_item['dataaccaction']];
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
......
......@@ -101,7 +101,7 @@ export default class AppEmbedPicker extends Vue {
* @type {string}
* @memberof AppEmbedPicker
*/
@Prop() public valueItem?: string;
@Prop() public valueItem!: string;
/**
* 关联视图名称
......@@ -176,17 +176,28 @@ export default class AppEmbedPicker extends Vue {
if (!this.data) {
return;
}
let formData:any = JSON.parse(this.data);
let arg: any = {};
// 合并视图上下文参数和视图参数
arg.param = JSON.parse(JSON.stringify(this.viewparams));
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) {
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);
}
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);
}
this.viewdata = JSON.stringify(arg.context);
......@@ -257,12 +268,10 @@ export default class AppEmbedPicker extends Vue {
srfkey = srfkey.substring(0,srfkey.length-1);
srfmajortext = srfmajortext.substring(0,srfmajortext.length-1);
if (this.valueItem) {
let value = srfkey;
this.$emit('formitemvaluechange', { name: this.valueItem, value: value });
this.$emit('formitemvaluechange', { name: this.valueItem, value: srfkey });
}
if (this.name) {
let value = srfmajortext;
this.$emit('formitemvaluechange', { name: this.name, value: value });
this.$emit('formitemvaluechange', { name: this.name, value: srfmajortext });
}
}
}
......
......@@ -162,8 +162,15 @@ export default class AppFormGroup extends Vue {
return;
}
const _item = ActionModel[key];
if(_item && _item['dataaccaction'] && UIService && data && Object.keys(data).length >0){
let dataActionResult:any = UIService.getAllOPPrivs(data)[_item['dataaccaction']];
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
......
.app-form-item {
height: 100%;
padding: 0 6px;
.editor {
height: 100%;
.ivu-form-item-content {
......
.item {
height: 24px;
line-height: 24px;
}
.show-more {
text-align: center;
margin-top: 10px;
height: 20px;
color: #409eff;
label {
cursor: pointer;
}
}
#bellBtn {
height: 24px;
font-size: 19px;
padding-top: 2px;
padding-right: 2px;
color: #aaa;
}
.Row {
height: 70px;
border-bottom: 1px solid lightgray;
display: flex;
align-items: center;
.column1 {
text-align: center;
border: 0px solid red;
}
.column2 {
border: 0px red solid;
.process-definition-name {
font-size: 14px;
}
.el-row {
display: flex;
.el-col {
flex-grow: 1;
div {
margin-bottom: 5px;
}
div:first-child {
font-weight: 500;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
div:nth-child(n+2) {
font-size: 12px;
}
}
}
}
}
<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 @@
class='dropdown-list-dynamic'
:transfer="true"
v-model="currentVal"
:disabled="disabled === true ? true : false"
:disabled="disabled"
:clearable="true"
:filterable="filterable === true ? true : false"
:filterable="filterable"
@on-open-change="onClick"
: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>
......@@ -114,7 +114,7 @@ export default class DropDownListDynamic extends Vue {
* @type {boolean}
* @memberof DropDownListDynamic
*/
@Prop() public filterable?: boolean;
public filterable: boolean = true;
/**
* 下拉选提示内容
......
......@@ -7,9 +7,9 @@
:transfer="true"
transfer-class-name="dropdown-list-mpicker-transfer"
v-model="currentVal"
:disabled="disabled === true ? true : false"
:disabled="disabled"
:clearable="true"
:filterable="filterable === true ? true : false"
:filterable="filterable"
@on-open-change="onClick"
:placeholder="$t('components.dropDownListMpicker.placeholder')">
<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 {
* @type {boolean}
* @memberof DropDownListMpicker
*/
@Prop() public filterable?: boolean;
public filterable: boolean = true;
/**
* 下拉选提示内容
......
......@@ -4,9 +4,9 @@
class='dropdown-list'
:transfer="true"
v-model="currentVal"
:disabled="disabled === true ? true : false"
:disabled="disabled"
:clearable="true"
:filterable="filterable === true ? true : false"
:filterable="filterable"
@on-open-change="onClick"
: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>
......@@ -141,7 +141,7 @@ export default class DropDownList extends Vue {
* @type {boolean}
* @memberof DropDownList
*/
@Prop() public filterable?: boolean;
public filterable: boolean = true;
/**
* 下拉选提示内容
......
......@@ -360,6 +360,8 @@ export default class MDViewEngine extends ViewEngine {
this.calcToolbarItemState(state);
if(args && args.length > 0){
this.calcToolbarItemAuthState(this.transformData(args[0]));
}else{
this.calcToolbarItemAuthState(null);
}
}
......@@ -383,6 +385,7 @@ export default class MDViewEngine extends ViewEngine {
this.view.$emit('viewload', args);
}
this.calcToolbarItemState(true);
this.calcToolbarItemAuthState(null);
}
/**
......
......@@ -190,8 +190,15 @@ export default class ViewEngine {
return;
}
const _item = _this.view.toolBarModels[key];
if(_item && _item['dataaccaction'] && _this.view.appUIService && data && Object.keys(data).length >0){
let dataActionResult:any = _this.view.appUIService.getAllOPPrivs(data)[_item['dataaccaction']];
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
......
......@@ -25,6 +25,9 @@ export default class WFDynaExpGridViewEngine extends GridViewEngine {
*/
public load(opts: any = {},isnotify:boolean=false): void {
this.view.getWFStepModel().then((res:any) =>{
if(!res || res.length === 0) {
return;
}
if(!this.view.isformDruipart){
super.load(opts);
}else{
......@@ -34,4 +37,76 @@ 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();
}
/**
* 选中变化
*
* @param {any[]} args
* @memberof WFDynaExpGridViewEngine
*/
public selectionChange(args: any[]): void {
if (this.view) {
this.view.selectedData = args;
this.view.$emit('viewdataschange', args);
}
const state = args.length > 0 && !Object.is(args[0].srfkey, '') ? false : true;
this.calcToolbarItemState(state);
}
/**
* 计算工具栏状态
*
* @param {boolean} state
* @param {*} [dataaccaction]
* @memberof WFDynaExpGridViewEngine
*/
public calcToolbarItemState(state: boolean, dataaccaction?: any) {
const _this: any = this;
if (!_this.view.linkModel || Object.keys(_this.view.linkModel).length === 0) {
return;
}
_this.view.linkModel.forEach((item:any) => {
item.disabled = state;
});
this.view.$forceUpdate();
}
}
\ No newline at end of file
......@@ -258,6 +258,75 @@ export default {
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"',
},
},
appMessagePopover: {
loadMore: 'Load more',
noMore: 'No more'
}
};
\ No newline at end of file
......@@ -259,5 +259,75 @@ export default {
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: '日期与星期必须有一个为“不指定”',
},
},
appMessagePopover: {
loadMore: '加载更多',
noMore: '没有更多了'
}
};
\ No newline at end of file
......@@ -348,6 +348,9 @@ export default class JobsInfoEditViewBase extends Vue {
for(let key in this.context){
delete this.context[key];
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
......@@ -356,9 +359,6 @@ export default class JobsInfoEditViewBase extends Vue {
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
......@@ -377,9 +377,6 @@ export default class JobsInfoEditViewBase extends Vue {
if(inputvalue){
Object.assign(this.context,{'jobsinfo':inputvalue});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
......
......@@ -428,6 +428,9 @@ export default class JobsInfoGridViewBase extends Vue {
for(let key in this.context){
delete this.context[key];
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
......@@ -436,9 +439,6 @@ export default class JobsInfoGridViewBase extends Vue {
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
......@@ -457,9 +457,6 @@ export default class JobsInfoGridViewBase extends Vue {
if(inputvalue){
Object.assign(this.context,{'jobsinfo':inputvalue});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
......
......@@ -318,6 +318,9 @@ export default class JobsLogEditViewBase extends Vue {
for(let key in this.context){
delete this.context[key];
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
......@@ -326,9 +329,6 @@ export default class JobsLogEditViewBase extends Vue {
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
......@@ -347,9 +347,6 @@ export default class JobsLogEditViewBase extends Vue {
if(inputvalue){
Object.assign(this.context,{'jobslog':inputvalue});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
......
......@@ -353,6 +353,9 @@ export default class JobsLogGridViewBase extends Vue {
for(let key in this.context){
delete this.context[key];
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
......@@ -361,9 +364,6 @@ export default class JobsLogGridViewBase extends Vue {
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
......@@ -382,9 +382,6 @@ export default class JobsLogGridViewBase extends Vue {
if(inputvalue){
Object.assign(this.context,{'jobslog':inputvalue});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
......
......@@ -348,6 +348,9 @@ export default class JobsRegistryEditViewBase extends Vue {
for(let key in this.context){
delete this.context[key];
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
......@@ -356,9 +359,6 @@ export default class JobsRegistryEditViewBase extends Vue {
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
......@@ -377,9 +377,6 @@ export default class JobsRegistryEditViewBase extends Vue {
if(inputvalue){
Object.assign(this.context,{'jobsregistry':inputvalue});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
......
......@@ -401,6 +401,9 @@ export default class JobsRegistryGridViewBase extends Vue {
for(let key in this.context){
delete this.context[key];
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
......@@ -409,9 +412,6 @@ export default class JobsRegistryGridViewBase extends Vue {
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
......@@ -430,9 +430,6 @@ export default class JobsRegistryGridViewBase extends Vue {
if(inputvalue){
Object.assign(this.context,{'jobsregistry':inputvalue});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
......
......@@ -244,5 +244,10 @@ const router = new Router({
},
],
});
// 解决路由跳转路由重复时报错
const originalPush = Router.prototype.push
Router.prototype.push = function push(location: any) {
let result: any = originalPush.call(this, location);
return result.catch((err: any) => err);
}
export default router;
......@@ -44,6 +44,7 @@
<app-lang style='font-size: 15px;padding: 0 10px;'></app-lang>
<app-orgsector></app-orgsector>
<app-user></app-user>
<app-message-popover></app-message-popover>
<app-lock-scren />
<app-full-scren />
<app-theme style="width:45px;display: flex;justify-content: center;"></app-theme>
......@@ -297,6 +298,9 @@ export default class TaskIndexViewBase extends Vue {
for(let key in this.context){
delete this.context[key];
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
Object.assign(this.context, JSON.parse(this.viewdata));
if(this.context && this.context.srfparentdename){
......@@ -305,9 +309,6 @@ export default class TaskIndexViewBase extends Vue {
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
return;
}
......@@ -323,9 +324,6 @@ export default class TaskIndexViewBase extends Vue {
});
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
this.handleCustomViewData();
//初始化导航数据
this.initNavDataWithRoute();
......
......@@ -148,49 +148,36 @@ export default class CodeListService {
let cacheTimeout:any = codelist.cacheTimeout;
// 启用缓存
if(isEnableCache){
const callback:Function = (context:any ={},data:any ={},tag:string,promise:Promise<any>) =>{
promise.then((result:any) =>{
if(result.length > 0){
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);
}else{
return resolve([]);
}
}).catch((result:any) =>{
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(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(new Date().getTime() <= codelist.getExpirationTime()){
return resolve(items);
}
}
}
if (codelist) {
const callback:Function = (context:any ={},data:any ={},tag:string,promise:Promise<any>) =>{
promise.then((result:any) =>{
if(result.length > 0){
CodeListService.codelistCached.set(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`,{items:result});
return resolve(result);
}else{
return resolve([]);
}
}).catch((result:any) =>{
return reject(result);
})
}
// 加载中,UI又需要数据,解决连续加载同一代码表问题
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}`));
}else{
let result:Promise<any> = codelist.getItems(context,data,isloading);
CodeListService.codelistCache.set(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`,result);
if(cacheTimeout !== -1){
codelist.expirationTime = new Date().getTime() + cacheTimeout;
}
codelist.setExpirationTime(new Date().getTime() + cacheTimeout);
callback(context,data,tag,result);
}
}
......
......@@ -829,6 +829,32 @@ export default class EntityService {
return Http.getInstance().get(`/wfcore/${this.SYSTEMNAME}-app-${this.APPNAME}/${this.APPDENAME}/${context[this.APPLYDEKEY]}/usertasks/${data['taskDefinitionKey']}/ways`);
}
/**
* GetWFLinks接口方法(根据当前步骤和任务获取批量操作路径)
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof EntityService
*/
public async getWFLinks(context: any = {},data: any = {}, isloading?: boolean):Promise<any>{
return Http.getInstance().get(`/wfcore/${this.SYSTEMNAME}-app-${this.APPNAME}/${this.APPDENAME}/process-definitions/${data['processDefinitionKey']}/usertasks/${data['userTaskId']}/ways`);
}
/**
* wfSubmitBatch接口方法(批量提交)
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof EntityService
*/
public async wfSubmitBatch(context: any = {},data: any = {},localdata:any,isloading?: boolean):Promise<any>{
return Http.getInstance().post(`/wfcore/${this.SYSTEMNAME}-app-${this.APPNAME}/${this.APPDENAME}/process-definitions/${localdata['processDefinitionKey']}/usertasks/${localdata['taskDefinitionKey']}/ways/${localdata['sequenceFlowId']}/submit`,data);
}
/**
* GetWFHistory接口方法(根据业务主键获取工作流程记录)
*
......
......@@ -11,7 +11,7 @@ export const commitAuthData = ({ commit, state }: { commit: any, state: any }, {
if(appmenu && appmenu.length >0){
commit('setMenuData', appmenu);
}
if(enablepermissionvalid){
if(enablepermissionvalid === true || enablepermissionvalid === false){
commit('setEnablePermissionValid', enablepermissionvalid);
}
}
\ No newline at end of file
......@@ -98,7 +98,10 @@ export const addPage = (state: any, arg: any) => {
if (!arg) {
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);
} else {
const page: any = {};
......
......@@ -359,15 +359,14 @@ export default class JobsInfoUIServiceBase extends UIService {
// 判断数据是否在流程中
}
//多表单,todo
const isEnableMultiForm:boolean = false;
const multiFormDEField:string|null =null;
if (isEnableMultiForm && multiFormDEField) {
if (multiFormDEField) {
const objFormValue:string = curData[multiFormDEField];
if(!Environment.isAppMode){
return 'MOBEDITVIEW'+objFormValue;
return 'MOBEDITVIEW:'+objFormValue;
}
return 'EDITVIEW'+objFormValue;
return 'EDITVIEW:'+objFormValue;
}
if(!Environment.isAppMode){
if(this.getDEMainStateTag(curData)){
......
......@@ -165,15 +165,14 @@ export default class JobsLockUIServiceBase extends UIService {
// 判断数据是否在流程中
}
//多表单,todo
const isEnableMultiForm:boolean = false;
const multiFormDEField:string|null =null;
if (isEnableMultiForm && multiFormDEField) {
if (multiFormDEField) {
const objFormValue:string = curData[multiFormDEField];
if(!Environment.isAppMode){
return 'MOBEDITVIEW'+objFormValue;
return 'MOBEDITVIEW:'+objFormValue;
}
return 'EDITVIEW'+objFormValue;
return 'EDITVIEW:'+objFormValue;
}
if(!Environment.isAppMode){
if(this.getDEMainStateTag(curData)){
......
......@@ -167,15 +167,14 @@ export default class JobsLogUIServiceBase extends UIService {
// 判断数据是否在流程中
}
//多表单,todo
const isEnableMultiForm:boolean = false;
const multiFormDEField:string|null =null;
if (isEnableMultiForm && multiFormDEField) {
if (multiFormDEField) {
const objFormValue:string = curData[multiFormDEField];
if(!Environment.isAppMode){
return 'MOBEDITVIEW'+objFormValue;
return 'MOBEDITVIEW:'+objFormValue;
}
return 'EDITVIEW'+objFormValue;
return 'EDITVIEW:'+objFormValue;
}
if(!Environment.isAppMode){
if(this.getDEMainStateTag(curData)){
......
......@@ -167,15 +167,14 @@ export default class JobsRegistryUIServiceBase extends UIService {
// 判断数据是否在流程中
}
//多表单,todo
const isEnableMultiForm:boolean = false;
const multiFormDEField:string|null =null;
if (isEnableMultiForm && multiFormDEField) {
if (multiFormDEField) {
const objFormValue:string = curData[multiFormDEField];
if(!Environment.isAppMode){
return 'MOBEDITVIEW'+objFormValue;
return 'MOBEDITVIEW:'+objFormValue;
}
return 'EDITVIEW'+objFormValue;
return 'EDITVIEW:'+objFormValue;
}
if(!Environment.isAppMode){
if(this.getDEMainStateTag(curData)){
......
......@@ -56,5 +56,16 @@ export default class UIService {
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 {
return;
}
const _item = ActionModel[key];
if(_item && _item['dataaccaction'] && UIService && data && Object.keys(data).length >0){
let dataActionResult:any = UIService.getAllOPPrivs(data)[_item['dataaccaction']];
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
......
......@@ -214,6 +214,10 @@ export default class ControlService {
dataItems.forEach((item:any) =>{
if(item && item.prop){
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)){
......
......@@ -99,7 +99,7 @@ export default class DefaultService extends ControlService {
*/
@Errorlog
public wfstart(action: string,context: any = {},data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data);
data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
......@@ -157,11 +157,12 @@ export default class DefaultService extends ControlService {
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {boolean} [isWorkflow] 是否在工作流中添加数据
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
public add(action: string, context: any = {},data: any = {}, isloading?: boolean,isWorkflow?:boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
......@@ -172,8 +173,12 @@ export default class DefaultService extends ControlService {
result = this.appEntityService.Create(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
if(isWorkflow){
resolve(response);
}else{
this.handleResponse(action, response);
resolve(response);
}
}).catch(response => {
reject(response);
});
......@@ -216,11 +221,12 @@ export default class DefaultService extends ControlService {
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {boolean} [isWorkflow] 是否在工作流中修改数据
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
public update(action: string, context: any = {},data: any = {}, isloading?: boolean,isWorkflow?:boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
......@@ -231,8 +237,12 @@ export default class DefaultService extends ControlService {
result = this.appEntityService.Update(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
if(isWorkflow){
resolve(response);
}else{
this.handleResponse(action, response);
resolve(response);
}
}).catch(response => {
reject(response);
});
......
......@@ -1881,13 +1881,35 @@ export default class MainBase extends Vue implements ControlInterface {
public async wfstart(data: any,localdata?:any): Promise<any> {
return new Promise((resolve: any, reject: any) => {
const _this: any = this;
const post: Promise<any> = _this.save({},false);
const formData:any = this.getData();
const copyData:any = Util.deepCopy(formData);
const post: Promise<any> = Object.is(formData.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),formData, this.showBusyIndicator,true):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),formData, this.showBusyIndicator,true);
post.then((response:any) =>{
const arg:any = response.data;
const responseData:any = response.data;
let tempResponseData:any = Util.deepCopy(response);
this.service.handleResponse('save', tempResponseData);
const arg:any = tempResponseData.data;
// 保存完成UI处理
this.onFormLoad(arg,'save');
this.$emit('save', arg);
AppCenterService.notifyMessage({name:"JobsInfo",action:'appRefresh',data:data});
this.$nextTick(() => {
this.formState.next({ type: 'save', data: arg });
});
// 准备工作流数据,填充未存库数据
Object.assign(arg,this.getData());
Object.assign(arg,copyData);
// 准备提交参数
if(this.viewparams){
Object.assign(arg,{viewparams:this.viewparams});
let copyViewParams:any = Util.deepCopy(this.viewparams);
if(copyViewParams.w){
delete copyViewParams.w;
}
Object.assign(responseData,copyViewParams);
}
Object.assign(arg,{viewparams:responseData});
// 强制补充srfwfmemo
if(this.srfwfmemo){
Object.assign(arg,{srfwfmemo:this.srfwfmemo});
}
const result: Promise<any> = this.service.wfstart(_this.WFStartAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
result.then((response: any) => {
......@@ -1940,13 +1962,17 @@ export default class MainBase extends Vue implements ControlInterface {
return new Promise((resolve: any, reject: any) => {
const _this: any = this;
const arg: any = data[0];
const copyData:any = Util.deepCopy(arg);
Object.assign(arg,{viewparams:this.viewparams});
if (!arg.jobsinfo || Object.is(arg.jobsinfo, '')) {
return;
}
const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,true):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,true);
post.then((response:any) =>{
const arg:any = response.data;
const responseData:any = response.data;
let tempResponseData:any = Util.deepCopy(response);
this.service.handleResponse('save', tempResponseData);
const arg:any = tempResponseData.data;
// 保存完成UI处理
this.onFormLoad(arg,'save');
this.$emit('save', arg);
......@@ -1955,11 +1981,12 @@ export default class MainBase extends Vue implements ControlInterface {
this.formState.next({ type: 'save', data: arg });
});
// 准备工作流数据,填充未存库数据
Object.assign(arg,this.getData());
Object.assign(arg,copyData);
// 准备提交参数
if(this.viewparams){
Object.assign(arg,{viewparams:this.viewparams});
Object.assign(responseData,this.viewparams);
}
Object.assign(arg,{viewparams:responseData});
// 强制补充srfwfmemo
if(this.srfwfmemo){
Object.assign(arg,{srfwfmemo:this.srfwfmemo});
......
......@@ -99,7 +99,7 @@ export default class MainService extends ControlService {
*/
@Errorlog
public wfstart(action: string,context: any = {},data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data);
data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
......@@ -157,11 +157,12 @@ export default class MainService extends ControlService {
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {boolean} [isWorkflow] 是否在工作流中添加数据
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
public add(action: string, context: any = {},data: any = {}, isloading?: boolean,isWorkflow?:boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
......@@ -172,8 +173,12 @@ export default class MainService extends ControlService {
result = this.appEntityService.Create(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
if(isWorkflow){
resolve(response);
}else{
this.handleResponse(action, response);
resolve(response);
}
}).catch(response => {
reject(response);
});
......@@ -216,11 +221,12 @@ export default class MainService extends ControlService {
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {boolean} [isWorkflow] 是否在工作流中修改数据
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
public update(action: string, context: any = {},data: any = {}, isloading?: boolean,isWorkflow?:boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
......@@ -231,8 +237,12 @@ export default class MainService extends ControlService {
result = this.appEntityService.Update(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
if(isWorkflow){
resolve(response);
}else{
this.handleResponse(action, response);
resolve(response);
}
}).catch(response => {
reject(response);
});
......
......@@ -607,7 +607,7 @@ export default class MainBase extends Vue implements ControlInterface {
* 选中行数据
*
* @type {any[]}
* @memberof Main
* @memberof MainBase
*/
public selections: any[] = [];
......@@ -615,10 +615,18 @@ export default class MainBase extends Vue implements ControlInterface {
* 拦截行选中
*
* @type {boolean}
* @memberof Main
* @memberof MainBase
*/
public stopRowClick: boolean = false;
/**
* 当前编辑行数据
*
* @type {boolean}
* @memberof MainBase
*/
public curEditRowData:any;
......@@ -668,7 +676,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '主键ID',
langtag: 'entities.jobsinfo.main_grid.columns.id',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -676,7 +684,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '服务名',
langtag: 'entities.jobsinfo.main_grid.columns.app',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -684,7 +692,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '执行器任务HANDLER',
langtag: 'entities.jobsinfo.main_grid.columns.handler',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -692,7 +700,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '任务执行CRON',
langtag: 'entities.jobsinfo.main_grid.columns.cron',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -700,7 +708,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '上次调度时间',
langtag: 'entities.jobsinfo.main_grid.columns.last_time',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -708,7 +716,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '下次调度时间',
langtag: 'entities.jobsinfo.main_grid.columns.next_time',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -716,7 +724,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '状态',
langtag: 'entities.jobsinfo.main_grid.columns.status',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -724,7 +732,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '任务执行超时时间(秒)',
langtag: 'entities.jobsinfo.main_grid.columns.timeout',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -732,7 +740,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '更新时间',
langtag: 'entities.jobsinfo.main_grid.columns.update_time',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
]
......@@ -775,6 +783,15 @@ export default class MainBase extends Vue implements ControlInterface {
* @type {*}
* @memberof MainBase
*/
public deRules:any = {
};
/**
* 值规则集合
*
* @type {*}
* @memberof MainBase
*/
public rules: any = {
srfkey: [
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '主键ID 值不能为空', trigger: 'change' },
......@@ -1554,7 +1571,7 @@ export default class MainBase extends Vue implements ControlInterface {
* @memberof MainBase
*/
get adaptiveState(): boolean {
return !this.allColumns.find((column: any) => column.show && Object.is(column.util, 'STAR'));
return !this.allColumns.find((column: any) => column.show && Object.is(column.unit, 'STAR'));
}
/**
......@@ -1700,6 +1717,7 @@ export default class MainBase extends Vue implements ControlInterface {
row.hasUpdated = true;
}
}
this.curEditRowData = row;
this.validate(property,row,rowIndex);
}
......@@ -1796,6 +1814,108 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public updateDefault(row: any){
}
/**
* 校验属性值规则
*
* @public
* @param {{ name: string }} { name }
* @memberof MainBase
*/
public verifyDeRules(name:string,rule:any = this.deRules,op:string = "AND",value:any) :{isPast:boolean}{
let falg:any = {};
if(!rule || !rule[name]){
return falg;
}
let opValue = op == 'AND'? true :false;
let startOp = (val:boolean)=>{
if(falg.isPast){
if(opValue){
falg.isPast = falg && val;
}else{
falg.isPast = falg || val;
}
}else{
falg.isPast = val;
}
}
rule[name].forEach((item:any) => {
// 常规规则
if(item.type == 'SIMPLE'){
startOp(!this.$verify.checkFieldSimpleRule(value,item.condOP,item.paramValue,item.ruleInfo,item.paramType,this.curEditRowData,item.isKeyCond));
}
// 数值范围
if(item.type == 'VALUERANGE2'){
startOp( !this.$verify.checkFieldValueRangeRule(value,item.minValue,item.isIncludeMinValue,item.maxValue,item.isIncludeMaxValue,item.ruleInfo,item.isKeyCond));
}
// 正则式
if (item.type == "REGEX") {
startOp(!this.$verify.checkFieldRegExRule(value,item.regExCode,item.ruleInfo,item.isKeyCond));
}
// 长度
if (item.type == "STRINGLENGTH") {
startOp(!this.$verify.checkFieldStringLengthRule(value,item.minValue,item.isIncludeMinValue,item.maxValue,item.isIncludeMaxValue,item.ruleInfo,item.isKeyCond));
}
// 系统值规则
if(item.type == "SYSVALUERULE") {
startOp(!this.$verify.checkFieldSysValueRule(value,item.sysRule.regExCode,item.ruleInfo,item.isKeyCond));
}
// 分组
if(item.type == 'GROUP'){
falg = this.verifyDeRules('group',item,"AND",value)
if(item.isNotMode){
falg.isPast = !falg.isPast;
}
}
});
if(!falg.hasOwnProperty("isPast")){
falg.isPast = true;
}
if(!value){
falg.isPast = true;
}
return falg;
}
/**
* 工作流提交
*
* @param {*} [data={}]
* @param {*} [localdata={}]
* @returns {Promise<any>}
* @memberof MainBase
*/
public async submitbatch(data: any,localdata:any): Promise<any> {
return new Promise((resolve: any, reject: any) => {
const _this: any = this;
const arg: any = data;
const result: Promise<any> = this.service.submitbatch(_this.WFSubmitAction, JSON.parse(JSON.stringify(this.context)),arg,localdata,this.showBusyIndicator);
result.then((response: any) => {
if (!response || response.status !== 200) {
if(response.data){
this.$Notice.error({ title: '', desc: (this.$t('app.formpage.workflow.submiterror') as string) + ', ' + response.data.message });
}
return;
}
this.$Notice.info({ title: '', desc: (this.$t('app.formpage.workflow.submitsuccess') as string) });
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
})
}
}
</script>
......
......@@ -94,42 +94,48 @@ export default class MainModel {
{
name: 'n_app_like',
prop: 'n_app_like',
dataType: 'TEXT',
dataType: 'QUERYPARAM'
},
{
name: 'n_handler_like',
prop: 'n_handler_like',
dataType: 'TEXT',
dataType: 'QUERYPARAM'
},
{
name: 'n_status_eq',
prop: 'n_status_eq',
dataType: 'NSCODELIST',
dataType: 'QUERYPARAM'
},
{
name:'size',
prop:'size'
prop:'size',
dataType: 'QUERYPARAM'
},
{
name:'query',
prop:'query'
prop:'query',
dataType: 'QUERYPARAM'
},
{
name:'filter',
prop:'filter'
prop:'filter',
dataType: 'QUERYPARAM'
},
{
name:'page',
prop:'page'
prop:'page',
dataType: 'QUERYPARAM'
},
{
name:'sort',
prop:'sort'
prop:'sort',
dataType: 'QUERYPARAM'
},
{
name:'srfparentdata',
prop:'srfparentdata'
prop:'srfparentdata',
dataType: 'QUERYPARAM'
},
// 前端新增修改标识,新增为"0",修改为"1"或未设值
{
......
......@@ -41,6 +41,14 @@ export default class MainService extends ControlService {
this.model = new MainModel();
}
/**
* 备份原生数据
*
* @type {*}
* @memberof MainService
*/
public copynativeData:any;
/**
* 处理数据
......@@ -231,6 +239,7 @@ export default class MainService extends ControlService {
result =_appEntityService.FetchDefault(Context,Data, isloading);
}
result.then((response) => {
this.copynativeData = Util.deepCopy(response.data);
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
......@@ -329,7 +338,7 @@ export default class MainService extends ControlService {
requestData[item.prop] = context[item.name];
}
}else{
if(item && item.isEditable && item.prop && item.name && (data[item.name] || Object.is(data[item.name],0)) ){
if(item && item.isEditable && item.prop && item.name && (data[item.name] || Object.is(data[item.name],0) || Object.is(data[item.name],"")) ){
requestData[item.prop] = data[item.name];
}
}
......@@ -341,5 +350,97 @@ export default class MainService extends ControlService {
}
return {context:tempContext,data:requestData};
}
/**
* 处理工作流数据
*
* @param data 传入数据
* @memberof MainService
*/
public handleWFData(data:any, isMerge:boolean = false){
let model: any = this.getMode();
if (!model && model.getDataItems instanceof Function) {
return data;
}
let dataItems: any[] = model.getDataItems();
let requestData:any = {};
dataItems.forEach((item:any) =>{
if(item && item.prop){
if(item.dataType){
if(!Object.is(item.dataType,'QUERYPARAM')){
requestData[item.prop] = data[item.name];
}
}else{
requestData[item.prop] = data[item.name];
}
}
});
if(isMerge && (data.viewparams && Object.keys(data.viewparams).length > 0)){
Object.assign(requestData,data.viewparams);
}
// 删除前端srffrontuf标识
if(requestData.hasOwnProperty('srffrontuf')){
delete requestData.srffrontuf;
}
//补充工作流所需主键
requestData.srfkey = data.jobsinfo;
//补充全量数据
requestData = this.fillNativeData(requestData);
return requestData;
}
/**
* 补充全量数据
*
* @param {*} [data]
* @memberof MainService
*/
public fillNativeData(data:any){
if(this.copynativeData && this.copynativeData.length >0){
let targetData:any = this.copynativeData.find((item:any) =>{
return item.id === data.srfkey;
})
data = Object.assign(targetData,data);
return data;
}
}
/**
* 提交工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public submitbatch(action: string,context: any = {}, data: any,localdata:any,isloading?: boolean): Promise<any> {
let tempData:any = [];
if(data && data.length > 0){
data.forEach((item:any) => {
let data:any = this.handleWFData(item,true);
tempData.push(data);
});
}
context = this.handleRequestData(action,context,data,true).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,tempData, localdata,isloading);
} else {
result = this.appEntityService.wfSubmitBatch(context,tempData,localdata,isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
}
\ No newline at end of file
......@@ -99,7 +99,7 @@ export default class DefaultService extends ControlService {
*/
@Errorlog
public wfstart(action: string,context: any = {},data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data);
data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
......@@ -157,11 +157,12 @@ export default class DefaultService extends ControlService {
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {boolean} [isWorkflow] 是否在工作流中添加数据
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
public add(action: string, context: any = {},data: any = {}, isloading?: boolean,isWorkflow?:boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
......@@ -172,8 +173,12 @@ export default class DefaultService extends ControlService {
result = this.appEntityService.Create(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
if(isWorkflow){
resolve(response);
}else{
this.handleResponse(action, response);
resolve(response);
}
}).catch(response => {
reject(response);
});
......@@ -216,11 +221,12 @@ export default class DefaultService extends ControlService {
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {boolean} [isWorkflow] 是否在工作流中修改数据
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
public update(action: string, context: any = {},data: any = {}, isloading?: boolean,isWorkflow?:boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
......@@ -231,8 +237,12 @@ export default class DefaultService extends ControlService {
result = this.appEntityService.Update(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
if(isWorkflow){
resolve(response);
}else{
this.handleResponse(action, response);
resolve(response);
}
}).catch(response => {
reject(response);
});
......
......@@ -1692,13 +1692,35 @@ export default class MainBase extends Vue implements ControlInterface {
public async wfstart(data: any,localdata?:any): Promise<any> {
return new Promise((resolve: any, reject: any) => {
const _this: any = this;
const post: Promise<any> = _this.save({},false);
const formData:any = this.getData();
const copyData:any = Util.deepCopy(formData);
const post: Promise<any> = Object.is(formData.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),formData, this.showBusyIndicator,true):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),formData, this.showBusyIndicator,true);
post.then((response:any) =>{
const arg:any = response.data;
const responseData:any = response.data;
let tempResponseData:any = Util.deepCopy(response);
this.service.handleResponse('save', tempResponseData);
const arg:any = tempResponseData.data;
// 保存完成UI处理
this.onFormLoad(arg,'save');
this.$emit('save', arg);
AppCenterService.notifyMessage({name:"JobsLog",action:'appRefresh',data:data});
this.$nextTick(() => {
this.formState.next({ type: 'save', data: arg });
});
// 准备工作流数据,填充未存库数据
Object.assign(arg,this.getData());
Object.assign(arg,copyData);
// 准备提交参数
if(this.viewparams){
Object.assign(arg,{viewparams:this.viewparams});
let copyViewParams:any = Util.deepCopy(this.viewparams);
if(copyViewParams.w){
delete copyViewParams.w;
}
Object.assign(responseData,copyViewParams);
}
Object.assign(arg,{viewparams:responseData});
// 强制补充srfwfmemo
if(this.srfwfmemo){
Object.assign(arg,{srfwfmemo:this.srfwfmemo});
}
const result: Promise<any> = this.service.wfstart(_this.WFStartAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
result.then((response: any) => {
......@@ -1751,13 +1773,17 @@ export default class MainBase extends Vue implements ControlInterface {
return new Promise((resolve: any, reject: any) => {
const _this: any = this;
const arg: any = data[0];
const copyData:any = Util.deepCopy(arg);
Object.assign(arg,{viewparams:this.viewparams});
if (!arg.jobslog || Object.is(arg.jobslog, '')) {
return;
}
const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,true):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,true);
post.then((response:any) =>{
const arg:any = response.data;
const responseData:any = response.data;
let tempResponseData:any = Util.deepCopy(response);
this.service.handleResponse('save', tempResponseData);
const arg:any = tempResponseData.data;
// 保存完成UI处理
this.onFormLoad(arg,'save');
this.$emit('save', arg);
......@@ -1766,11 +1792,12 @@ export default class MainBase extends Vue implements ControlInterface {
this.formState.next({ type: 'save', data: arg });
});
// 准备工作流数据,填充未存库数据
Object.assign(arg,this.getData());
Object.assign(arg,copyData);
// 准备提交参数
if(this.viewparams){
Object.assign(arg,{viewparams:this.viewparams});
Object.assign(responseData,this.viewparams);
}
Object.assign(arg,{viewparams:responseData});
// 强制补充srfwfmemo
if(this.srfwfmemo){
Object.assign(arg,{srfwfmemo:this.srfwfmemo});
......
......@@ -99,7 +99,7 @@ export default class MainService extends ControlService {
*/
@Errorlog
public wfstart(action: string,context: any = {},data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data);
data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
......@@ -157,11 +157,12 @@ export default class MainService extends ControlService {
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {boolean} [isWorkflow] 是否在工作流中添加数据
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
public add(action: string, context: any = {},data: any = {}, isloading?: boolean,isWorkflow?:boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
......@@ -172,8 +173,12 @@ export default class MainService extends ControlService {
result = this.appEntityService.Create(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
if(isWorkflow){
resolve(response);
}else{
this.handleResponse(action, response);
resolve(response);
}
}).catch(response => {
reject(response);
});
......@@ -216,11 +221,12 @@ export default class MainService extends ControlService {
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {boolean} [isWorkflow] 是否在工作流中修改数据
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
public update(action: string, context: any = {},data: any = {}, isloading?: boolean,isWorkflow?:boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
......@@ -231,8 +237,12 @@ export default class MainService extends ControlService {
result = this.appEntityService.Update(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
if(isWorkflow){
resolve(response);
}else{
this.handleResponse(action, response);
resolve(response);
}
}).catch(response => {
reject(response);
});
......
......@@ -593,7 +593,7 @@ export default class MainBase extends Vue implements ControlInterface {
* 选中行数据
*
* @type {any[]}
* @memberof Main
* @memberof MainBase
*/
public selections: any[] = [];
......@@ -601,10 +601,18 @@ export default class MainBase extends Vue implements ControlInterface {
* 拦截行选中
*
* @type {boolean}
* @memberof Main
* @memberof MainBase
*/
public stopRowClick: boolean = false;
/**
* 当前编辑行数据
*
* @type {boolean}
* @memberof MainBase
*/
public curEditRowData:any;
......@@ -654,7 +662,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '主键ID',
langtag: 'entities.jobslog.main_grid.columns.id',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -662,7 +670,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '任务ID',
langtag: 'entities.jobslog.main_grid.columns.job_id',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -670,7 +678,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '执行器任务HANDLER',
langtag: 'entities.jobslog.main_grid.columns.handler',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -678,7 +686,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '执行地址',
langtag: 'entities.jobslog.main_grid.columns.address',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -686,7 +694,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '触发器调度返回码',
langtag: 'entities.jobslog.main_grid.columns.trigger_code',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -694,7 +702,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '触发器调度类型',
langtag: 'entities.jobslog.main_grid.columns.trigger_type',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -702,7 +710,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '失败重试次数',
langtag: 'entities.jobslog.main_grid.columns.fail_retry_count',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -710,7 +718,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '创建时间',
langtag: 'entities.jobslog.main_grid.columns.create_time',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
]
......@@ -753,6 +761,15 @@ export default class MainBase extends Vue implements ControlInterface {
* @type {*}
* @memberof MainBase
*/
public deRules:any = {
};
/**
* 值规则集合
*
* @type {*}
* @memberof MainBase
*/
public rules: any = {
srfkey: [
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '主键ID 值不能为空', trigger: 'change' },
......@@ -1524,7 +1541,7 @@ export default class MainBase extends Vue implements ControlInterface {
* @memberof MainBase
*/
get adaptiveState(): boolean {
return !this.allColumns.find((column: any) => column.show && Object.is(column.util, 'STAR'));
return !this.allColumns.find((column: any) => column.show && Object.is(column.unit, 'STAR'));
}
/**
......@@ -1670,6 +1687,7 @@ export default class MainBase extends Vue implements ControlInterface {
row.hasUpdated = true;
}
}
this.curEditRowData = row;
this.validate(property,row,rowIndex);
}
......@@ -1766,6 +1784,108 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public updateDefault(row: any){
}
/**
* 校验属性值规则
*
* @public
* @param {{ name: string }} { name }
* @memberof MainBase
*/
public verifyDeRules(name:string,rule:any = this.deRules,op:string = "AND",value:any) :{isPast:boolean}{
let falg:any = {};
if(!rule || !rule[name]){
return falg;
}
let opValue = op == 'AND'? true :false;
let startOp = (val:boolean)=>{
if(falg.isPast){
if(opValue){
falg.isPast = falg && val;
}else{
falg.isPast = falg || val;
}
}else{
falg.isPast = val;
}
}
rule[name].forEach((item:any) => {
// 常规规则
if(item.type == 'SIMPLE'){
startOp(!this.$verify.checkFieldSimpleRule(value,item.condOP,item.paramValue,item.ruleInfo,item.paramType,this.curEditRowData,item.isKeyCond));
}
// 数值范围
if(item.type == 'VALUERANGE2'){
startOp( !this.$verify.checkFieldValueRangeRule(value,item.minValue,item.isIncludeMinValue,item.maxValue,item.isIncludeMaxValue,item.ruleInfo,item.isKeyCond));
}
// 正则式
if (item.type == "REGEX") {
startOp(!this.$verify.checkFieldRegExRule(value,item.regExCode,item.ruleInfo,item.isKeyCond));
}
// 长度
if (item.type == "STRINGLENGTH") {
startOp(!this.$verify.checkFieldStringLengthRule(value,item.minValue,item.isIncludeMinValue,item.maxValue,item.isIncludeMaxValue,item.ruleInfo,item.isKeyCond));
}
// 系统值规则
if(item.type == "SYSVALUERULE") {
startOp(!this.$verify.checkFieldSysValueRule(value,item.sysRule.regExCode,item.ruleInfo,item.isKeyCond));
}
// 分组
if(item.type == 'GROUP'){
falg = this.verifyDeRules('group',item,"AND",value)
if(item.isNotMode){
falg.isPast = !falg.isPast;
}
}
});
if(!falg.hasOwnProperty("isPast")){
falg.isPast = true;
}
if(!value){
falg.isPast = true;
}
return falg;
}
/**
* 工作流提交
*
* @param {*} [data={}]
* @param {*} [localdata={}]
* @returns {Promise<any>}
* @memberof MainBase
*/
public async submitbatch(data: any,localdata:any): Promise<any> {
return new Promise((resolve: any, reject: any) => {
const _this: any = this;
const arg: any = data;
const result: Promise<any> = this.service.submitbatch(_this.WFSubmitAction, JSON.parse(JSON.stringify(this.context)),arg,localdata,this.showBusyIndicator);
result.then((response: any) => {
if (!response || response.status !== 200) {
if(response.data){
this.$Notice.error({ title: '', desc: (this.$t('app.formpage.workflow.submiterror') as string) + ', ' + response.data.message });
}
return;
}
this.$Notice.info({ title: '', desc: (this.$t('app.formpage.workflow.submitsuccess') as string) });
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
})
}
}
</script>
......
......@@ -89,42 +89,48 @@ export default class MainModel {
{
name: 'n_job_id_eq',
prop: 'n_job_id_eq',
dataType: 'TEXT',
dataType: 'QUERYPARAM'
},
{
name: 'n_handler_like',
prop: 'n_handler_like',
dataType: 'TEXT',
dataType: 'QUERYPARAM'
},
{
name: 'n_trigger_code_eq',
prop: 'n_trigger_code_eq',
dataType: 'INT',
dataType: 'QUERYPARAM'
},
{
name:'size',
prop:'size'
prop:'size',
dataType: 'QUERYPARAM'
},
{
name:'query',
prop:'query'
prop:'query',
dataType: 'QUERYPARAM'
},
{
name:'filter',
prop:'filter'
prop:'filter',
dataType: 'QUERYPARAM'
},
{
name:'page',
prop:'page'
prop:'page',
dataType: 'QUERYPARAM'
},
{
name:'sort',
prop:'sort'
prop:'sort',
dataType: 'QUERYPARAM'
},
{
name:'srfparentdata',
prop:'srfparentdata'
prop:'srfparentdata',
dataType: 'QUERYPARAM'
},
// 前端新增修改标识,新增为"0",修改为"1"或未设值
{
......
......@@ -41,6 +41,14 @@ export default class MainService extends ControlService {
this.model = new MainModel();
}
/**
* 备份原生数据
*
* @type {*}
* @memberof MainService
*/
public copynativeData:any;
/**
* 处理数据
......@@ -231,6 +239,7 @@ export default class MainService extends ControlService {
result =_appEntityService.FetchDefault(Context,Data, isloading);
}
result.then((response) => {
this.copynativeData = Util.deepCopy(response.data);
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
......@@ -329,7 +338,7 @@ export default class MainService extends ControlService {
requestData[item.prop] = context[item.name];
}
}else{
if(item && item.isEditable && item.prop && item.name && (data[item.name] || Object.is(data[item.name],0)) ){
if(item && item.isEditable && item.prop && item.name && (data[item.name] || Object.is(data[item.name],0) || Object.is(data[item.name],"")) ){
requestData[item.prop] = data[item.name];
}
}
......@@ -341,5 +350,97 @@ export default class MainService extends ControlService {
}
return {context:tempContext,data:requestData};
}
/**
* 处理工作流数据
*
* @param data 传入数据
* @memberof MainService
*/
public handleWFData(data:any, isMerge:boolean = false){
let model: any = this.getMode();
if (!model && model.getDataItems instanceof Function) {
return data;
}
let dataItems: any[] = model.getDataItems();
let requestData:any = {};
dataItems.forEach((item:any) =>{
if(item && item.prop){
if(item.dataType){
if(!Object.is(item.dataType,'QUERYPARAM')){
requestData[item.prop] = data[item.name];
}
}else{
requestData[item.prop] = data[item.name];
}
}
});
if(isMerge && (data.viewparams && Object.keys(data.viewparams).length > 0)){
Object.assign(requestData,data.viewparams);
}
// 删除前端srffrontuf标识
if(requestData.hasOwnProperty('srffrontuf')){
delete requestData.srffrontuf;
}
//补充工作流所需主键
requestData.srfkey = data.jobslog;
//补充全量数据
requestData = this.fillNativeData(requestData);
return requestData;
}
/**
* 补充全量数据
*
* @param {*} [data]
* @memberof MainService
*/
public fillNativeData(data:any){
if(this.copynativeData && this.copynativeData.length >0){
let targetData:any = this.copynativeData.find((item:any) =>{
return item.id === data.srfkey;
})
data = Object.assign(targetData,data);
return data;
}
}
/**
* 提交工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public submitbatch(action: string,context: any = {}, data: any,localdata:any,isloading?: boolean): Promise<any> {
let tempData:any = [];
if(data && data.length > 0){
data.forEach((item:any) => {
let data:any = this.handleWFData(item,true);
tempData.push(data);
});
}
context = this.handleRequestData(action,context,data,true).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,tempData, localdata,isloading);
} else {
result = this.appEntityService.wfSubmitBatch(context,tempData,localdata,isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
}
\ No newline at end of file
......@@ -99,7 +99,7 @@ export default class DefaultService extends ControlService {
*/
@Errorlog
public wfstart(action: string,context: any = {},data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data);
data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
......@@ -157,11 +157,12 @@ export default class DefaultService extends ControlService {
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {boolean} [isWorkflow] 是否在工作流中添加数据
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
public add(action: string, context: any = {},data: any = {}, isloading?: boolean,isWorkflow?:boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
......@@ -172,8 +173,12 @@ export default class DefaultService extends ControlService {
result = this.appEntityService.Create(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
if(isWorkflow){
resolve(response);
}else{
this.handleResponse(action, response);
resolve(response);
}
}).catch(response => {
reject(response);
});
......@@ -216,11 +221,12 @@ export default class DefaultService extends ControlService {
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {boolean} [isWorkflow] 是否在工作流中修改数据
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
public update(action: string, context: any = {},data: any = {}, isloading?: boolean,isWorkflow?:boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
......@@ -231,8 +237,12 @@ export default class DefaultService extends ControlService {
result = this.appEntityService.Update(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
if(isWorkflow){
resolve(response);
}else{
this.handleResponse(action, response);
resolve(response);
}
}).catch(response => {
reject(response);
});
......
......@@ -1500,13 +1500,35 @@ export default class MainBase extends Vue implements ControlInterface {
public async wfstart(data: any,localdata?:any): Promise<any> {
return new Promise((resolve: any, reject: any) => {
const _this: any = this;
const post: Promise<any> = _this.save({},false);
const formData:any = this.getData();
const copyData:any = Util.deepCopy(formData);
const post: Promise<any> = Object.is(formData.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),formData, this.showBusyIndicator,true):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),formData, this.showBusyIndicator,true);
post.then((response:any) =>{
const arg:any = response.data;
const responseData:any = response.data;
let tempResponseData:any = Util.deepCopy(response);
this.service.handleResponse('save', tempResponseData);
const arg:any = tempResponseData.data;
// 保存完成UI处理
this.onFormLoad(arg,'save');
this.$emit('save', arg);
AppCenterService.notifyMessage({name:"JobsRegistry",action:'appRefresh',data:data});
this.$nextTick(() => {
this.formState.next({ type: 'save', data: arg });
});
// 准备工作流数据,填充未存库数据
Object.assign(arg,this.getData());
Object.assign(arg,copyData);
// 准备提交参数
if(this.viewparams){
Object.assign(arg,{viewparams:this.viewparams});
let copyViewParams:any = Util.deepCopy(this.viewparams);
if(copyViewParams.w){
delete copyViewParams.w;
}
Object.assign(responseData,copyViewParams);
}
Object.assign(arg,{viewparams:responseData});
// 强制补充srfwfmemo
if(this.srfwfmemo){
Object.assign(arg,{srfwfmemo:this.srfwfmemo});
}
const result: Promise<any> = this.service.wfstart(_this.WFStartAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
result.then((response: any) => {
......@@ -1559,13 +1581,17 @@ export default class MainBase extends Vue implements ControlInterface {
return new Promise((resolve: any, reject: any) => {
const _this: any = this;
const arg: any = data[0];
const copyData:any = Util.deepCopy(arg);
Object.assign(arg,{viewparams:this.viewparams});
if (!arg.jobsregistry || Object.is(arg.jobsregistry, '')) {
return;
}
const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,true):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,true);
post.then((response:any) =>{
const arg:any = response.data;
const responseData:any = response.data;
let tempResponseData:any = Util.deepCopy(response);
this.service.handleResponse('save', tempResponseData);
const arg:any = tempResponseData.data;
// 保存完成UI处理
this.onFormLoad(arg,'save');
this.$emit('save', arg);
......@@ -1574,11 +1600,12 @@ export default class MainBase extends Vue implements ControlInterface {
this.formState.next({ type: 'save', data: arg });
});
// 准备工作流数据,填充未存库数据
Object.assign(arg,this.getData());
Object.assign(arg,copyData);
// 准备提交参数
if(this.viewparams){
Object.assign(arg,{viewparams:this.viewparams});
Object.assign(responseData,this.viewparams);
}
Object.assign(arg,{viewparams:responseData});
// 强制补充srfwfmemo
if(this.srfwfmemo){
Object.assign(arg,{srfwfmemo:this.srfwfmemo});
......
......@@ -99,7 +99,7 @@ export default class MainService extends ControlService {
*/
@Errorlog
public wfstart(action: string,context: any = {},data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data);
data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
......@@ -157,11 +157,12 @@ export default class MainService extends ControlService {
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {boolean} [isWorkflow] 是否在工作流中添加数据
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
public add(action: string, context: any = {},data: any = {}, isloading?: boolean,isWorkflow?:boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
......@@ -172,8 +173,12 @@ export default class MainService extends ControlService {
result = this.appEntityService.Create(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
if(isWorkflow){
resolve(response);
}else{
this.handleResponse(action, response);
resolve(response);
}
}).catch(response => {
reject(response);
});
......@@ -216,11 +221,12 @@ export default class MainService extends ControlService {
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {boolean} [isWorkflow] 是否在工作流中修改数据
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
public update(action: string, context: any = {},data: any = {}, isloading?: boolean,isWorkflow?:boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
......@@ -231,8 +237,12 @@ export default class MainService extends ControlService {
result = this.appEntityService.Update(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
if(isWorkflow){
resolve(response);
}else{
this.handleResponse(action, response);
resolve(response);
}
}).catch(response => {
reject(response);
});
......
......@@ -547,7 +547,7 @@ export default class MainBase extends Vue implements ControlInterface {
* 选中行数据
*
* @type {any[]}
* @memberof Main
* @memberof MainBase
*/
public selections: any[] = [];
......@@ -555,10 +555,18 @@ export default class MainBase extends Vue implements ControlInterface {
* 拦截行选中
*
* @type {boolean}
* @memberof Main
* @memberof MainBase
*/
public stopRowClick: boolean = false;
/**
* 当前编辑行数据
*
* @type {boolean}
* @memberof MainBase
*/
public curEditRowData:any;
......@@ -608,7 +616,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '主键ID',
langtag: 'entities.jobsregistry.main_grid.columns.id',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -616,7 +624,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '服务名',
langtag: 'entities.jobsregistry.main_grid.columns.app',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -624,7 +632,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '执行地址',
langtag: 'entities.jobsregistry.main_grid.columns.address',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -632,7 +640,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '状态',
langtag: 'entities.jobsregistry.main_grid.columns.status',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
]
......@@ -675,6 +683,15 @@ export default class MainBase extends Vue implements ControlInterface {
* @type {*}
* @memberof MainBase
*/
public deRules:any = {
};
/**
* 值规则集合
*
* @type {*}
* @memberof MainBase
*/
public rules: any = {
srfkey: [
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '主键ID 值不能为空', trigger: 'change' },
......@@ -1454,7 +1471,7 @@ export default class MainBase extends Vue implements ControlInterface {
* @memberof MainBase
*/
get adaptiveState(): boolean {
return !this.allColumns.find((column: any) => column.show && Object.is(column.util, 'STAR'));
return !this.allColumns.find((column: any) => column.show && Object.is(column.unit, 'STAR'));
}
/**
......@@ -1600,6 +1617,7 @@ export default class MainBase extends Vue implements ControlInterface {
row.hasUpdated = true;
}
}
this.curEditRowData = row;
this.validate(property,row,rowIndex);
}
......@@ -1696,6 +1714,108 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public updateDefault(row: any){
}
/**
* 校验属性值规则
*
* @public
* @param {{ name: string }} { name }
* @memberof MainBase
*/
public verifyDeRules(name:string,rule:any = this.deRules,op:string = "AND",value:any) :{isPast:boolean}{
let falg:any = {};
if(!rule || !rule[name]){
return falg;
}
let opValue = op == 'AND'? true :false;
let startOp = (val:boolean)=>{
if(falg.isPast){
if(opValue){
falg.isPast = falg && val;
}else{
falg.isPast = falg || val;
}
}else{
falg.isPast = val;
}
}
rule[name].forEach((item:any) => {
// 常规规则
if(item.type == 'SIMPLE'){
startOp(!this.$verify.checkFieldSimpleRule(value,item.condOP,item.paramValue,item.ruleInfo,item.paramType,this.curEditRowData,item.isKeyCond));
}
// 数值范围
if(item.type == 'VALUERANGE2'){
startOp( !this.$verify.checkFieldValueRangeRule(value,item.minValue,item.isIncludeMinValue,item.maxValue,item.isIncludeMaxValue,item.ruleInfo,item.isKeyCond));
}
// 正则式
if (item.type == "REGEX") {
startOp(!this.$verify.checkFieldRegExRule(value,item.regExCode,item.ruleInfo,item.isKeyCond));
}
// 长度
if (item.type == "STRINGLENGTH") {
startOp(!this.$verify.checkFieldStringLengthRule(value,item.minValue,item.isIncludeMinValue,item.maxValue,item.isIncludeMaxValue,item.ruleInfo,item.isKeyCond));
}
// 系统值规则
if(item.type == "SYSVALUERULE") {
startOp(!this.$verify.checkFieldSysValueRule(value,item.sysRule.regExCode,item.ruleInfo,item.isKeyCond));
}
// 分组
if(item.type == 'GROUP'){
falg = this.verifyDeRules('group',item,"AND",value)
if(item.isNotMode){
falg.isPast = !falg.isPast;
}
}
});
if(!falg.hasOwnProperty("isPast")){
falg.isPast = true;
}
if(!value){
falg.isPast = true;
}
return falg;
}
/**
* 工作流提交
*
* @param {*} [data={}]
* @param {*} [localdata={}]
* @returns {Promise<any>}
* @memberof MainBase
*/
public async submitbatch(data: any,localdata:any): Promise<any> {
return new Promise((resolve: any, reject: any) => {
const _this: any = this;
const arg: any = data;
const result: Promise<any> = this.service.submitbatch(_this.WFSubmitAction, JSON.parse(JSON.stringify(this.context)),arg,localdata,this.showBusyIndicator);
result.then((response: any) => {
if (!response || response.status !== 200) {
if(response.data){
this.$Notice.error({ title: '', desc: (this.$t('app.formpage.workflow.submiterror') as string) + ', ' + response.data.message });
}
return;
}
this.$Notice.info({ title: '', desc: (this.$t('app.formpage.workflow.submitsuccess') as string) });
resolve(response);
}).catch((response: any) => {
if (response && response.status && response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.data.message });
reject(response);
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
reject(response);
return;
}
reject(response);
});
})
}
}
</script>
......
......@@ -69,37 +69,43 @@ export default class MainModel {
{
name: 'n_app_like',
prop: 'n_app_like',
dataType: 'TEXT',
dataType: 'QUERYPARAM'
},
{
name: 'n_status_eq',
prop: 'n_status_eq',
dataType: 'NSCODELIST',
dataType: 'QUERYPARAM'
},
{
name:'size',
prop:'size'
prop:'size',
dataType: 'QUERYPARAM'
},
{
name:'query',
prop:'query'
prop:'query',
dataType: 'QUERYPARAM'
},
{
name:'filter',
prop:'filter'
prop:'filter',
dataType: 'QUERYPARAM'
},
{
name:'page',
prop:'page'
prop:'page',
dataType: 'QUERYPARAM'
},
{
name:'sort',
prop:'sort'
prop:'sort',
dataType: 'QUERYPARAM'
},
{
name:'srfparentdata',
prop:'srfparentdata'
prop:'srfparentdata',
dataType: 'QUERYPARAM'
},
// 前端新增修改标识,新增为"0",修改为"1"或未设值
{
......
......@@ -41,6 +41,14 @@ export default class MainService extends ControlService {
this.model = new MainModel();
}
/**
* 备份原生数据
*
* @type {*}
* @memberof MainService
*/
public copynativeData:any;
/**
* 处理数据
......@@ -231,6 +239,7 @@ export default class MainService extends ControlService {
result =_appEntityService.FetchDefault(Context,Data, isloading);
}
result.then((response) => {
this.copynativeData = Util.deepCopy(response.data);
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
......@@ -329,7 +338,7 @@ export default class MainService extends ControlService {
requestData[item.prop] = context[item.name];
}
}else{
if(item && item.isEditable && item.prop && item.name && (data[item.name] || Object.is(data[item.name],0)) ){
if(item && item.isEditable && item.prop && item.name && (data[item.name] || Object.is(data[item.name],0) || Object.is(data[item.name],"")) ){
requestData[item.prop] = data[item.name];
}
}
......@@ -341,5 +350,97 @@ export default class MainService extends ControlService {
}
return {context:tempContext,data:requestData};
}
/**
* 处理工作流数据
*
* @param data 传入数据
* @memberof MainService
*/
public handleWFData(data:any, isMerge:boolean = false){
let model: any = this.getMode();
if (!model && model.getDataItems instanceof Function) {
return data;
}
let dataItems: any[] = model.getDataItems();
let requestData:any = {};
dataItems.forEach((item:any) =>{
if(item && item.prop){
if(item.dataType){
if(!Object.is(item.dataType,'QUERYPARAM')){
requestData[item.prop] = data[item.name];
}
}else{
requestData[item.prop] = data[item.name];
}
}
});
if(isMerge && (data.viewparams && Object.keys(data.viewparams).length > 0)){
Object.assign(requestData,data.viewparams);
}
// 删除前端srffrontuf标识
if(requestData.hasOwnProperty('srffrontuf')){
delete requestData.srffrontuf;
}
//补充工作流所需主键
requestData.srfkey = data.jobsregistry;
//补充全量数据
requestData = this.fillNativeData(requestData);
return requestData;
}
/**
* 补充全量数据
*
* @param {*} [data]
* @memberof MainService
*/
public fillNativeData(data:any){
if(this.copynativeData && this.copynativeData.length >0){
let targetData:any = this.copynativeData.find((item:any) =>{
return item.id === data.srfkey;
})
data = Object.assign(targetData,data);
return data;
}
}
/**
* 提交工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public submitbatch(action: string,context: any = {}, data: any,localdata:any,isloading?: boolean): Promise<any> {
let tempData:any = [];
if(data && data.length > 0){
data.forEach((item:any) => {
let data:any = this.handleWFData(item,true);
tempData.push(data);
});
}
context = this.handleRequestData(action,context,data,true).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,tempData, localdata,isloading);
} else {
result = this.appEntityService.wfSubmitBatch(context,tempData,localdata,isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
}
\ No newline at end of file
......@@ -55,5 +55,9 @@ zuul:
path: /dictionarys/**
serviceId: ${ibiz.ref.service.dict:ibzdict-api}
stripPrefix: false
disk:
path: /net-disk/**
serviceId: ${ibiz.ref.service.disk:ibzdisk-api}
stripPrefix: false
sensitive-headers:
- Cookie,Set-Cookie,Authorization
......@@ -36,5 +36,9 @@ zuul:
path: /dictionarys/**
serviceId: ${ibiz.ref.service.dict:ibzdict-api}
stripPrefix: false
disk:
path: /net-disk/**
serviceId: ${ibiz.ref.service.disk:ibzdisk-api}
stripPrefix: false
sensitive-headers:
- Cookie,Set-Cookie,Authorization
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册