Commit 066f57e5c550507198aa14730cc4b0e47660ccf7

Authored by YunaiV
1 parent 72c8b246

优化 bpmnProcessDesigner 的 id 赋值,必须满足 NCName 规则,避免绘制报错的问题

yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue
@@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
19 </el-select> 19 </el-select>
20 </el-form-item> 20 </el-form-item>
21 <el-form-item label="流程描述" prop="description"> 21 <el-form-item label="流程描述" prop="description">
22 - <el-input type="textarea" v-model="model.description" clearable /> 22 + <el-input type="textarea" v-model="model.description" clearable @change="handleDescriptionUpdate" />
23 </el-form-item> 23 </el-form-item>
24 </el-form> 24 </el-form>
25 </div> 25 </div>
@@ -72,6 +72,16 @@ export default { @@ -72,6 +72,16 @@ export default {
72 this.elementBaseInfo = JSON.parse(JSON.stringify(this.bpmnElement.businessObject)); 72 this.elementBaseInfo = JSON.parse(JSON.stringify(this.bpmnElement.businessObject));
73 }, 73 },
74 handleKeyUpdate(value) { 74 handleKeyUpdate(value) {
  75 + // 校验 value 的值,只有 XML NCName 通过的情况下,才进行赋值。否则,会导致流程图报错,无法绘制的问题
  76 + if (!value) {
  77 + return;
  78 + }
  79 + if (!value.match(/[a-zA-Z_][\-_.0-9_a-zA-Z$]*/)) {
  80 + console.log('key 不满足 XML NCName 规则,所以不进行赋值');
  81 + return;
  82 + }
  83 + console.log('key 满足 XML NCName 规则,所以进行赋值');
  84 +
75 // 在 BPMN 的 XML 中,流程标识 key,其实对应的是 id 节点 85 // 在 BPMN 的 XML 中,流程标识 key,其实对应的是 id 节点
76 this.elementBaseInfo['id'] = value; 86 this.elementBaseInfo['id'] = value;
77 this.updateBaseInfo('id'); 87 this.updateBaseInfo('id');
@@ -80,6 +90,11 @@ export default { @@ -80,6 +90,11 @@ export default {
80 this.elementBaseInfo['name'] = value; 90 this.elementBaseInfo['name'] = value;
81 this.updateBaseInfo('name'); 91 this.updateBaseInfo('name');
82 }, 92 },
  93 + handleDescriptionUpdate(value) {
  94 + // TODO 芋艿:documentation 暂时无法修改,后续在看看
  95 + // this.elementBaseInfo['documentation'] = value;
  96 + // this.updateBaseInfo('documentation');
  97 + },
83 updateBaseInfo(key) { 98 updateBaseInfo(key) {
84 // 触发 elementBaseInfo 对应的字段 99 // 触发 elementBaseInfo 对应的字段
85 const attrObj = Object.create(null); 100 const attrObj = Object.create(null);