| | |
| | | async saveListenerConfig() { |
| | | let validateStatus = await this.$refs["listenerFormRef"].validate(); |
| | | if (!validateStatus) return; // 验证不通过直接返回 |
| | | console.log('监听器参数',this.listenerForm) |
| | | //校验超时监听器参数 |
| | | if (this.listenerForm.class === 'com.ycl.listener.flowable.FlowableOverTimeListener') { |
| | | // 0-0 格式 |
| | | const regex = /^(\d{1,2})-(\d{1,2})$/; |
| | | for (let i = 0; i < this.listenerForm.fields.length; i++) { |
| | | if (this.listenerForm.fields[i].name === '红码时长' || this.listenerForm.fields[i].name === '黄码时长') { |
| | | const match = this.listenerForm.fields[i].string.match(regex); |
| | | if (match) { |
| | | const hours1 = parseInt(match[1], 10); |
| | | const hours2 = parseInt(match[2], 10); |
| | | // 检查小时数是否在合理范围内,并且第二个小时数小于等于24 |
| | | if (hours1 < 0 || hours2 > 24) { |
| | | this.$message.error(this.listenerForm.fields[i].name + '小时数不合理'); |
| | | return; |
| | | } |
| | | } else { |
| | | this.$message.error(this.listenerForm.fields[i].name + '时间格式不正确'); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | const listenerObject = createListenerObject(this.modelerStore.moddle, this.listenerForm, true, "flowable"); |
| | | if (this.editingListenerIndex === -1) { |
| | | this.bpmnElementListeners.push(listenerObject); |