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

This commit is contained in:
YunaiV 2022-01-03 09:38:57 +08:00
parent 72c8b24604
commit 066f57e5c5

View File

@ -19,7 +19,7 @@
</el-select>
</el-form-item>
<el-form-item label="流程描述" prop="description">
<el-input type="textarea" v-model="model.description" clearable />
<el-input type="textarea" v-model="model.description" clearable @change="handleDescriptionUpdate" />
</el-form-item>
</el-form>
</div>
@ -72,6 +72,16 @@ export default {
this.elementBaseInfo = JSON.parse(JSON.stringify(this.bpmnElement.businessObject));
},
handleKeyUpdate(value) {
// value XML NCName
if (!value) {
return;
}
if (!value.match(/[a-zA-Z_][\-_.0-9_a-zA-Z$]*/)) {
console.log('key 不满足 XML NCName 规则,所以不进行赋值');
return;
}
console.log('key 满足 XML NCName 规则,所以进行赋值');
// BPMN XML key id
this.elementBaseInfo['id'] = value;
this.updateBaseInfo('id');
@ -80,6 +90,11 @@ export default {
this.elementBaseInfo['name'] = value;
this.updateBaseInfo('name');
},
handleDescriptionUpdate(value) {
// TODO documentation
// this.elementBaseInfo['documentation'] = value;
// this.updateBaseInfo('documentation');
},
updateBaseInfo(key) {
// elementBaseInfo
const attrObj = Object.create(null);