feat: 流程设计器显示优化

rf
tony 2022-12-16 14:53:33 +08:00
parent 15fd39fe98
commit bc42ac6005
4 changed files with 84 additions and 84 deletions

View File

@ -41,7 +41,7 @@
<div ref="canvas" class="canvas" /> <div ref="canvas" class="canvas" />
</el-main> </el-main>
<el-aside style="width: 400px; min-height: 650px; background-color: #f0f2f5"> <el-aside style="width: 400px; min-height: 650px; background-color: #f0f2f5">
<panel v-if="modeler" :modeler="modeler" :users="users" :groups="groups" :exps="exps" :categorys="categorys" @dataType="dataType" /> <panel v-if="modeler" :modeler="modeler" :users="users" :groups="groups" :exps="exps" :categorys="categorys" />
</el-aside> </el-aside>
</el-container> </el-container>
</el-container> </el-container>
@ -56,7 +56,7 @@ import panel from './PropertyPanel'
import BpmData from './BpmData' import BpmData from './BpmData'
import getInitStr from './flowable/init' import getInitStr from './flowable/init'
// flowable // flowable
import flowableModdle from './flowable/flowable.json' import FlowableModule from './flowable/flowable.json'
export default { export default {
name: 'WorkflowBpmnModeler', name: 'WorkflowBpmnModeler',
components: { components: {
@ -115,8 +115,8 @@ export default {
translate: ['value', customTranslate] translate: ['value', customTranslate]
} }
], ],
moddleExtensions: { moduleExtensions: {
flowable: flowableModdle flowable: FlowableModule
} }
}) })
// //
@ -356,17 +356,13 @@ export default {
return false return false
}, },
downloadFile(filename, data, type) { downloadFile(filename, data, type) {
var a = document.createElement('a') const a = document.createElement('a');
var url = window.URL.createObjectURL(new Blob([data], { type: type })) const url = window.URL.createObjectURL(new Blob([data], {type: type}));
a.href = url a.href = url
a.download = filename a.download = filename
a.click() a.click()
window.URL.revokeObjectURL(url) window.URL.revokeObjectURL(url)
}, },
/** 获取数据类型 */
dataType(data){
this.$emit('dataType', data)
}
} }
} }
</script> </script>

View File

@ -2,6 +2,10 @@ export default {
// Labels // Labels
'Activate the global connect tool': '激活全局连接工具', 'Activate the global connect tool': '激活全局连接工具',
'Append {type}': '添加 {type}', 'Append {type}': '添加 {type}',
'Append Task': '添加任务',
'Append Gateway': '添加网关',
'Append EndEvent': '添加结束事件',
"Append Intermediate/Boundary Event": '添加开始事件',
'Add Lane above': '在上面添加道', 'Add Lane above': '在上面添加道',
'Divide into two Lanes': '分割成两个道', 'Divide into two Lanes': '分割成两个道',
'Divide into three Lanes': '分割成三个道', 'Divide into three Lanes': '分割成三个道',

View File

@ -10,39 +10,39 @@
:is-view="false" :is-view="false"
@save="save" @save="save"
@showXML="showXML" @showXML="showXML"
@dataType="dataType"
/> />
<!--在线查看xml--> <!--在线查看xml-->
<el-dialog :title="xmlTitle" :visible.sync="xmlOpen" width="60%" append-to-body> <el-dialog :title="xmlTitle" :visible.sync="xmlOpen" width="70%" class="showAll_dialog">
<div> <!-- 设置对话框内容高度 -->
<pre v-highlight> <el-scrollbar>
<code class="xml"> <pre v-highlight>
{{xmlContent}} <code class="xml">
</code> {{xmlData}}
</pre> </code>
</div> </pre>
</el-scrollbar>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import {readXml, roleList, saveXml, userList,expList} from "@/api/flowable/definition"; import {readXml, roleList, saveXml, userList,expList} from "@/api/flowable/definition";
import bpmnModeler from '@/components/Process/index' import bpmnModeler from '@/components/Process/index'
import vkbeautify from 'vkbeautify' import vkBeautify from 'vkbeautify'
import Hljs from 'highlight.js' import highlight from 'highlight.js'
import 'highlight.js/styles/atom-one-dark.css' import 'highlight.js/styles/atelier-savanna-dark.css'
export default { export default {
name: "Model", name: "Model",
components: { components: {
bpmnModeler, bpmnModeler,
vkbeautify vkBeautify
}, },
// //
directives: { directives: {
highlight:(el) => { highlight:(el) => {
let blocks = el.querySelectorAll('pre code'); let blocks = el.querySelectorAll('pre code');
blocks.forEach((block) => { blocks.forEach((block) => {
Hljs.highlightBlock(block) highlight.highlightBlock(block)
}) })
} }
}, },
@ -52,7 +52,7 @@ export default {
modeler:"", modeler:"",
xmlOpen: false, xmlOpen: false,
xmlTitle: '', xmlTitle: '',
xmlContent: '', xmlData: '',
users: [], users: [],
groups: [], groups: [],
categorys: [], categorys: [],
@ -122,28 +122,59 @@ export default {
showXML(data){ showXML(data){
this.xmlTitle = 'xml查看'; this.xmlTitle = 'xml查看';
this.xmlOpen = true; this.xmlOpen = true;
this.xmlContent = vkbeautify.xml(data); this.xmlData = vkBeautify.xml(data);
}, },
/** 获取数据类型 */ // /** */
dataType(data){ // dataType(data){
this.users = []; // this.users = [];
this.groups = []; // this.groups = [];
if (data) { // if (data) {
if (data.dataType === 'dynamic') { // if (data.dataType === 'dynamic') {
if (data.userType === 'assignee') { // if (data.userType === 'assignee') {
this.users = [{nickName: "${INITIATOR}", userId: "${INITIATOR}"}, // this.users = [{nickName: "${INITIATOR}", userId: "${INITIATOR}"},
{nickName: "#{approval}", userId: "#{approval}"} // {nickName: "#{approval}", userId: "#{approval}"}
] // ]
} else if (data.userType === 'candidateUsers') { // } else if (data.userType === 'candidateUsers') {
this.users = [ {nickName: "#{approval}", userId: "#{approval}"}] // this.users = [ {nickName: "#{approval}", userId: "#{approval}"}]
} else { // } else {
this.groups = [{roleName: "#{approval}", roleId: "#{approval}"}] // this.groups = [{roleName: "#{approval}", roleId: "#{approval}"}]
} // }
} else { // } else {
this.getDataList() // this.getDataList()
} // }
} // }
} // }
}, },
}; };
</script> </script>
<style lang="scss" scoped>
.content-box{
line-height: 10px;
}
//
.showAll_dialog {
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
::v-deep .el-dialog {
margin: 0 auto !important;
height: 80%;
overflow: hidden;
background-color: #ffffff;
.el-dialog__body {
position: absolute;
left: 0;
top: 54px;
bottom: 0;
right: 0;
z-index: 1;
overflow: hidden;
overflow-y: auto;
//
color: #ffffff;
padding: 0 15px;
}
}
}
</style>

View File

@ -232,24 +232,6 @@ export default {
handleClick(tab, event) { handleClick(tab, event) {
console.log(tab, event); console.log(tab, event);
}, },
/** 查询用户列表 */
getList() {
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.userList = response.rows;
this.total = response.total;
}
);
},
//
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
//
handleNodeClick(data) {
this.queryParams.deptId = data.id;
this.getList();
},
/** xml 文件 */ /** xml 文件 */
getModelDetail(deployId) { getModelDetail(deployId) {
// xml // xml
@ -360,8 +342,13 @@ export default {
this.checkType = "multiple"; this.checkType = "multiple";
} else if (data.type === 'candidateGroups') { // () } else if (data.type === 'candidateGroups') { // ()
this.checkSendRole = true; this.checkSendRole = true;
} else if (data.type === 'multiInstance') { // ? } else if (data.type === 'multiInstance') { //
this.checkSendUser = true; listUser().then(response => {
this.taskForm.values = {
"userList": response.rows
}
}
);
} }
} }
}) })
@ -427,24 +414,6 @@ export default {
this.variables = variables; this.variables = variables;
} }
}, },
/** 申请流程表单数据提交 */
submitForm(data) {
const that = this
if (data) {
const variables = data.valData;
const formData = data.formData;
formData.disabled = true;
formData.formBtns = false;
if (that.taskForm.procDefId) {
variables.variables = formData;
//
definitionStart(that.taskForm.procDefId, JSON.stringify(variables)).then(res => {
that.$modal.msgSuccess(res.msg);
that.goBack();
})
}
}
},
/** 驳回任务 */ /** 驳回任务 */
handleReject() { handleReject() {
this.rejectOpen = true; this.rejectOpen = true;