| | |
| | | </el-drawer> |
| | | |
| | | <!-- 注入西段 编辑/创建 部分 --> |
| | | <el-dialog title="字段配置" :visible.sync="listenerFieldFormModelVisible" width="600px" append-to-body destroy-on-close> |
| | | <el-form :model="listenerFieldForm" label-width="96px" ref="listenerFieldFormRef" style="height: 136px" @submit.native.prevent> |
| | | <el-dialog title="字段配置" :visible.sync="listenerFieldFormModelVisible" :close-on-click-modal="false" width="600px" append-to-body destroy-on-close> |
| | | <el-form :model="listenerFieldForm" label-width="96px" ref="listenerFieldFormRef" @submit.native.prevent> |
| | | <el-form-item label="字段名称:" prop="name" :rules="{ required: true, trigger: ['blur', 'change'] }"> |
| | | <el-input v-model="listenerFieldForm.name" clearable /> |
| | | </el-form-item> |
| | |
| | | :rules="{ required: true, trigger: ['blur', 'change'] }" |
| | | > |
| | | <el-input v-model="listenerFieldForm.string" clearable /> |
| | | <el-alert |
| | | :closable="false" |
| | | title="赋码时间格式为:天-小时,例如:一天零3小时应配置为:1-3" |
| | | type="info"> |
| | | </el-alert> |
| | | </el-form-item> |
| | | <el-form-item |
| | | v-if="listenerFieldForm.fieldType === 'expression'" |
| | |
| | | |
| | | // 打开 监听器详情 侧边栏 |
| | | openListenerForm(listener, index) { |
| | | this.resetListenersList(); |
| | | if (listener) { |
| | | this.listenerForm = this.initListenerForm(listener); |
| | | this.editingListenerIndex = index; |
| | |
| | | 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,3})-(\d{1,2})$/; |
| | | for (let i = 0; i < this.listenerForm.fields.length; i++) { |
| | | if (this.listenerForm.fields[i].name === '红码时长' || 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); |
| | |
| | | }, |
| | | |
| | | initListenerType(listener) { |
| | | console.log("监听器listener",listener) |
| | | let listenerType; |
| | | if (listener.class) listenerType = "classListener"; |
| | | if (listener.expression) listenerType = "expressionListener"; |
| | | if (listener.delegateExpression) listenerType = "delegateExpressionListener"; |
| | | if (listener.script) listenerType = "scriptListener"; |
| | | //监听器字段bug修复 |
| | | if (listener && listener.fields) { |
| | | listener.fields.forEach(field => { |
| | | field.fieldType = field.string ? "string" : "expression"; |
| | | }); |
| | | } |
| | | return { |
| | | ...JSON.parse(JSON.stringify(listener)), |
| | | ...(listener.script ?? {}), |
| | |
| | | self.eventDefinitionType = key.replace("time", "").toLowerCase(); |
| | | } |
| | | } |
| | | console.log(k); |
| | | self.eventTimeDefinitions = listener.eventDefinitions[0][k].body; |
| | | } |
| | | } |
| | |
| | | saveSystemListener() { |
| | | if (this.checkedListenerData.length > 0) { |
| | | this.checkedListenerData.forEach(value => { |
| | | // 保存其他配置 |
| | | value.fields.forEach(field => { |
| | | if (field.name === '开始计时节点') { |
| | | field.string = this.modelerStore.element.id; |
| | | } |
| | | }); |
| | | const listenerObject = createSystemListenerObject(this.modelerStore.moddle, value, true, "flowable"); |
| | | this.bpmnElementListeners.push(listenerObject); |
| | | this.elementListenersList.push(changeListenerObject(value)); |
| | |
| | | this.listenerSystemChecked = true; |
| | | // 隐藏侧边栏 |
| | | this.listenerSystemVisible = false; |
| | | //解析注入字段添加到当前表单 |
| | | this.resetListenersList(); |
| | | } |
| | | } |
| | | } |