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

ibiz4j 发布系统代码

上级 5da9c8b2
## 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 DictCatalogAuthServiceBase 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 DictOptionAuthServiceBase 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
......@@ -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 AppIndexViewBase 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 AppIndexViewBase 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 AppIndexViewBase 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();
......
......@@ -358,5 +358,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;
......@@ -434,6 +434,9 @@ export default class DictCatalogEditViewBase 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){
......@@ -442,9 +445,6 @@ export default class DictCatalogEditViewBase 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;
}
......@@ -463,9 +463,6 @@ export default class DictCatalogEditViewBase extends Vue {
if(inputvalue){
Object.assign(this.context,{'dictcatalog':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();
......
......@@ -460,6 +460,9 @@ export default class DictCatalogGridViewBase 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){
......@@ -468,9 +471,6 @@ export default class DictCatalogGridViewBase 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;
}
......@@ -489,9 +489,6 @@ export default class DictCatalogGridViewBase extends Vue {
if(inputvalue){
Object.assign(this.context,{'dictcatalog':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();
......
......@@ -324,6 +324,9 @@ export default class DictCatalogPickupGridViewBase 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){
......@@ -332,9 +335,6 @@ export default class DictCatalogPickupGridViewBase 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;
}
......@@ -353,9 +353,6 @@ export default class DictCatalogPickupGridViewBase extends Vue {
if(inputvalue){
Object.assign(this.context,{'dictcatalog':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();
......
......@@ -317,6 +317,9 @@ export default class DictCatalogPickupViewBase 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){
......@@ -325,9 +328,6 @@ export default class DictCatalogPickupViewBase 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;
}
......@@ -346,9 +346,6 @@ export default class DictCatalogPickupViewBase extends Vue {
if(inputvalue){
Object.assign(this.context,{'dictcatalog':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 DictOptionEditViewBase 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 DictOptionEditViewBase 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 DictOptionEditViewBase extends Vue {
if(inputvalue){
Object.assign(this.context,{'dictoption':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();
......
......@@ -447,6 +447,9 @@ export default class DictOptionGridEditViewBase 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){
......@@ -455,9 +458,6 @@ export default class DictOptionGridEditViewBase 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;
}
......@@ -476,9 +476,6 @@ export default class DictOptionGridEditViewBase extends Vue {
if(inputvalue){
Object.assign(this.context,{'dictoption':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();
......
......@@ -447,6 +447,9 @@ export default class DictOptionGridViewBase 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){
......@@ -455,9 +458,6 @@ export default class DictOptionGridViewBase 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;
}
......@@ -476,9 +476,6 @@ export default class DictOptionGridViewBase extends Vue {
if(inputvalue){
Object.assign(this.context,{'dictoption':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();
......
......@@ -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 = {};
......
......@@ -169,15 +169,14 @@ export default class DictCatalogUIServiceBase 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)){
......
......@@ -168,15 +168,14 @@ export default class DictOptionUIServiceBase 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);
});
......
......@@ -1582,13 +1582,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:"DictCatalog",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) => {
......@@ -1641,13 +1663,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.dictcatalog || Object.is(arg.dictcatalog, '')) {
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);
......@@ -1656,11 +1682,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);
});
......
......@@ -557,7 +557,7 @@ export default class MainBase extends Vue implements ControlInterface {
* 选中行数据
*
* @type {any[]}
* @memberof Main
* @memberof MainBase
*/
public selections: any[] = [];
......@@ -565,10 +565,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;
......@@ -618,7 +626,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '代码',
langtag: 'entities.dictcatalog.main_grid.columns.ccode',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -626,7 +634,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '名称',
langtag: 'entities.dictcatalog.main_grid.columns.cname',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -634,7 +642,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '分组',
langtag: 'entities.dictcatalog.main_grid.columns.cgroup',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -642,7 +650,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '备注',
langtag: 'entities.dictcatalog.main_grid.columns.memo',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
{
......@@ -650,7 +658,7 @@ export default class MainBase extends Vue implements ControlInterface {
label: '最后修改时间',
langtag: 'entities.dictcatalog.main_grid.columns.updatedate',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: false,
},
]
......@@ -693,6 +701,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: '标识 值不能为空', trigger: 'change' },
......@@ -1464,7 +1481,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'));
}
/**
......@@ -1610,6 +1627,7 @@ export default class MainBase extends Vue implements ControlInterface {
row.hasUpdated = true;
}
}
this.curEditRowData = row;
this.validate(property,row,rowIndex);
}
......@@ -1706,6 +1724,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>
......
......@@ -74,42 +74,48 @@ export default class MainModel {
{
name: 'n_ccode_like',
prop: 'n_ccode_like',
dataType: 'TEXT',
dataType: 'QUERYPARAM'
},
{
name: 'n_cname_like',
prop: 'n_cname_like',
dataType: 'TEXT',
dataType: 'QUERYPARAM'
},
{
name: 'n_cgroup_like',
prop: 'n_cgroup_like',
dataType: 'TEXT',
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.dictcatalog;
//补充全量数据
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);
});
......
......@@ -1846,13 +1846,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:"DictOption",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) => {
......@@ -1905,13 +1927,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.dictoption || Object.is(arg.dictoption, '')) {
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);
......@@ -1920,11 +1946,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});
......
......@@ -111,7 +111,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>;
......@@ -169,11 +169,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>;
......@@ -184,8 +185,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);
});
......@@ -228,11 +233,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>;
......@@ -243,8 +249,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);
});
......
......@@ -126,42 +126,48 @@ export default class MainModel {
{
name: 'n_cname_like',
prop: 'n_cname_like',
dataType: 'PICKUPTEXT',
dataType: 'QUERYPARAM'
},
{
name: 'n_val_like',
prop: 'n_val_like',
dataType: 'TEXT',
dataType: 'QUERYPARAM'
},
{
name: 'n_label_like',
prop: 'n_label_like',
dataType: 'TEXT',
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"或未设值
{
......
......@@ -42,6 +42,14 @@ export default class MainService extends ControlService {
this.model = new MainModel();
}
/**
* 备份原生数据
*
* @type {*}
* @memberof MainService
*/
public copynativeData:any;
/**
* 字典服务对象
......@@ -243,6 +251,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 => {
......@@ -341,7 +350,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];
}
}
......@@ -353,5 +362,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.dictoption;
//补充全量数据
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.value_key === 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
......@@ -857,7 +857,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
* 选中行数据
*
* @type {any[]}
* @memberof Main
* @memberof OptionsBase
*/
public selections: any[] = [];
......@@ -865,10 +865,18 @@ export default class OptionsBase extends Vue implements ControlInterface {
* 拦截行选中
*
* @type {boolean}
* @memberof Main
* @memberof OptionsBase
*/
public stopRowClick: boolean = false;
/**
* 当前编辑行数据
*
* @type {boolean}
* @memberof OptionsBase
*/
public curEditRowData:any;
......@@ -918,7 +926,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
label: '目录代码',
langtag: 'entities.dictoption.options_grid.columns.cid',
show: false,
util: 'PX',
unit: 'PX',
isEnableRowEdit: true,
},
{
......@@ -926,7 +934,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
label: '代码值',
langtag: 'entities.dictoption.options_grid.columns.val',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: true,
},
{
......@@ -934,7 +942,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
label: '名称',
langtag: 'entities.dictoption.options_grid.columns.label',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: true,
},
{
......@@ -942,7 +950,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
label: '父代码值',
langtag: 'entities.dictoption.options_grid.columns.pval',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: true,
},
{
......@@ -950,7 +958,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
label: '排序',
langtag: 'entities.dictoption.options_grid.columns.showorder',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: true,
},
{
......@@ -958,7 +966,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
label: '目录',
langtag: 'entities.dictoption.options_grid.columns.cname',
show: false,
util: 'PX',
unit: 'PX',
isEnableRowEdit: true,
},
{
......@@ -966,7 +974,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
label: '栏目样式',
langtag: 'entities.dictoption.options_grid.columns.cls',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: true,
},
{
......@@ -974,7 +982,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
label: '图标',
langtag: 'entities.dictoption.options_grid.columns.iconcls',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: true,
},
{
......@@ -982,7 +990,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
label: '过滤项',
langtag: 'entities.dictoption.options_grid.columns.vfilter',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: true,
},
{
......@@ -990,7 +998,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
label: '是否禁用',
langtag: 'entities.dictoption.options_grid.columns.disabled',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: true,
},
{
......@@ -998,7 +1006,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
label: '过期/失效',
langtag: 'entities.dictoption.options_grid.columns.expired',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: true,
},
{
......@@ -1006,7 +1014,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
label: '扩展',
langtag: 'entities.dictoption.options_grid.columns.extension',
show: true,
util: 'PX',
unit: 'PX',
isEnableRowEdit: true,
},
]
......@@ -1061,6 +1069,15 @@ export default class OptionsBase extends Vue implements ControlInterface {
* @type {*}
* @memberof OptionsBase
*/
public deRules:any = {
};
/**
* 值规则集合
*
* @type {*}
* @memberof OptionsBase
*/
public rules: any = {
val: [
{ required: true, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '代码值 值不能为空', trigger: 'change' },
......@@ -1896,7 +1913,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
* @memberof OptionsBase
*/
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'));
}
/**
......@@ -2042,6 +2059,7 @@ export default class OptionsBase extends Vue implements ControlInterface {
row.hasUpdated = true;
}
}
this.curEditRowData = row;
this.validate(property,row,rowIndex);
}
......@@ -2138,6 +2156,108 @@ export default class OptionsBase extends Vue implements ControlInterface {
*/
public updateDefault(row: any){
}
/**
* 校验属性值规则
*
* @public
* @param {{ name: string }} { name }
* @memberof OptionsBase
*/
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 OptionsBase
*/
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>
......
......@@ -121,42 +121,48 @@ export default class OptionsModel {
{
name: 'n_cname_like',
prop: 'n_cname_like',
dataType: 'PICKUPTEXT',
dataType: 'QUERYPARAM'
},
{
name: 'n_val_like',
prop: 'n_val_like',
dataType: 'TEXT',
dataType: 'QUERYPARAM'
},
{
name: 'n_label_like',
prop: 'n_label_like',
dataType: 'TEXT',
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"或未设值
{
......
......@@ -42,6 +42,14 @@ export default class OptionsService extends ControlService {
this.model = new OptionsModel();
}
/**
* 备份原生数据
*
* @type {*}
* @memberof OptionsService
*/
public copynativeData:any;
/**
* 字典服务对象
......@@ -243,6 +251,7 @@ export default class OptionsService 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 => {
......@@ -341,7 +350,7 @@ export default class OptionsService 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];
}
}
......@@ -353,5 +362,97 @@ export default class OptionsService extends ControlService {
}
return {context:tempContext,data:requestData};
}
/**
* 处理工作流数据
*
* @param data 传入数据
* @memberof OptionsService
*/
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.dictoption;
//补充全量数据
requestData = this.fillNativeData(requestData);
return requestData;
}
/**
* 补充全量数据
*
* @param {*} [data]
* @memberof OptionsService
*/
public fillNativeData(data:any){
if(this.copynativeData && this.copynativeData.length >0){
let targetData:any = this.copynativeData.find((item:any) =>{
return item.value_key === 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 OptionsService
*/
@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
......@@ -47,5 +47,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
package cn.ibizlab.util.client;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
@Component
public class IBZNotifyFallback implements IBZNotifyFeignClient {
@Override
public Boolean SendMsg(JSONObject msg) {
return null;
}
@Override
public Boolean createMsgTemplate(JSONObject template) {
return null;
}
}
package cn.ibizlab.util.client;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
@FeignClient(value = "${ibiz.ref.service.notify:ibznotify-api}",fallback = IBZNotifyFallback.class)
public interface IBZNotifyFeignClient
{
@RequestMapping(method = RequestMethod.POST,value = "/SendMsg")
Boolean SendMsg(@RequestBody JSONObject msg);
@RequestMapping(method = RequestMethod.POST,value = "/createMsgTemplate")
Boolean createMsgTemplate(@RequestBody JSONObject template);
}
......@@ -67,6 +67,33 @@ public class SearchContextBase implements ISearchContext{
* 工作流流程标识
*/
public String processDefinitionKey;
/**
* 获取工作流步骤标识
*/
public String getUserTaskId() {
if(StringUtils.isEmpty(userTaskId)){
Object taskId=params.get("usertaskid");
return StringUtils.isEmpty(taskId)?null:String.valueOf(taskId);
}else{
return userTaskId;
}
}
/**
* 获取工作流流程标识
* @return
*/
public String getProcessDefinitionKey() {
if(StringUtils.isEmpty(processDefinitionKey)){
Object processKey=params.get("processdefinitionkey");
return StringUtils.isEmpty(processKey)?null:String.valueOf(processKey);
}
else{
return processDefinitionKey;
}
}
/**
* 获取分页参数
* @return
......
......@@ -2,6 +2,7 @@ package cn.ibizlab.util.job;
import cn.ibizlab.util.client.IBZUAAFeignClient;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONArray;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -34,6 +35,7 @@ public class PermissionSyncJob implements ApplicationRunner {
private String systemName;
@Override
public void run(ApplicationArguments args) {
try {
......@@ -55,5 +57,6 @@ public class PermissionSyncJob implements ApplicationRunner {
log.error(String.format("向[UAA]同步系统资源失败,请检查[UAA]服务是否正常! [%s]",ex));
}
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册