优化代码

This commit is contained in:
java110 2021-08-22 19:17:48 +08:00
parent d0329097d8
commit c7fff2ae8d
2 changed files with 18 additions and 14 deletions

View File

@ -36,16 +36,23 @@
body{
background: #fff;
}
.no_display {
display: none;
}
</style>
</head>
<body>
<vc:create path="frame/bodyTop"></vc:create>
<div id="component">
</div>
<div id="form"></div>
<div>
<div class="r btn-group">
<button type="button" class="btn btn-white ">返回</button>
<button type="button" class="btn btn-primary" style="margin-left:10px">
<button type="button" class="btn btn-white " onclick="_closeBpmnjs()">返回</button>
<button type="button" class="btn btn-primary" onclick="_doSaveDiagram()" style="margin-left:10px">
保存
</button>

View File

@ -18,26 +18,22 @@
container: document.querySelector('#form')
});
let _doSaveDiagram = function (_xml, svg) {
//发送get请求
let _modelId = vc.getParam('modelId');
_doSaveDiagram = function (_xml, svg) {
let _param = {
'xml': _xml,
'svg': svg
'formJson': JSON.stringify(formEditor.saveSchema()),
'flowId': vc.getParam('flowId')
};
vc.http.apiPost('/activiti/model/' + _modelId + '/save',
vc.http.apiPost('/oaWorkflow/saveOaWorkflowForm',
JSON.stringify(_param),
{
emulateJSON: true
},
function (json, res) {
let listRoomData = JSON.parse(json);
console.log(json)
vc.toast(listRoomData.msg);
if (listRoomData.code == 0) {
vc.toast('保存成功');
window.close();
}
}, function (errInfo, error) {
console.log('请求失败处理');
}
@ -45,13 +41,14 @@
}
initFormJs = function (_context) {
try {
formEditor.importSchema(_context);
console.log(_context)
formEditor.importSchema(_context);
} catch (err) {
console.log('importing form failed', err);
}
};
window._getSchema = function(){
window._getSchema = function () {
const schema = formEditor.saveSchema();
console.log('exported schema', JSON.stringify(schema));
}
@ -71,7 +68,7 @@
let _flowXml = JSON.parse(json);
if (_flowXml.data.length > 0) {
//初始化
initFormJs(_flowXml.data[0].bpmnXml);
initFormJs(JSON.parse(_flowXml.data[0].formJson));
return;
}
//初始化