调整页面,v4
This commit is contained in:
1 parent
f3bed51eef
commit
f695923685
16 files changed
+1913
-349
No files matched your search
@@ -35,7 +35,7 @@
|
||||
<span class="inputLabel">名称</span>
|
||||
<v-text-field class="cus-v-input mr-2" dense filled single-line label="名称" v-model="line.label"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" class=" pb-3">
|
||||
<v-col cols="12" class=" pb-3" v-if="mode == 'serial'">
|
||||
<span class="inputLabel">操作类型</span>
|
||||
<v-select
|
||||
:items="lineTypeList"
|
||||
@@ -68,6 +68,10 @@
|
||||
lf: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'serial'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -83,7 +87,6 @@
|
||||
handler: function (line) {
|
||||
this.lf.updateText(line.id, `${line.type}-${line.label}`);
|
||||
this.lf.setProperties(line.id, line);
|
||||
console.log(this.lf.getEdgeModelById(line.id));
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
|
||||
@@ -49,23 +49,22 @@
|
||||
v-model="node.assignType"
|
||||
></v-select>
|
||||
</v-col>
|
||||
-->
|
||||
<v-col cols="12" class=" pb-3">
|
||||
<span class="inputLabel">指派</span>
|
||||
<v-select
|
||||
:items="optionList"
|
||||
color="success"
|
||||
item-color="success"
|
||||
dense filled single-line
|
||||
item-text="text"
|
||||
item-value="value"
|
||||
class="cus-v-input"
|
||||
:label="assignType"
|
||||
:multiple="node.assignType === 'person'"
|
||||
v-model="node.assignValue"
|
||||
:disabled="!node.assignType"
|
||||
></v-select>
|
||||
</v-col> -->
|
||||
<v-col cols="12" class=" pb-3" >
|
||||
<v-autocomplete
|
||||
class="cus-v-input mr-2"
|
||||
dense filled single-line clearable
|
||||
:items="optionList"
|
||||
item-text="text"
|
||||
item-value="value"
|
||||
:label="assignType"
|
||||
:multiple="node.assignType === 'person'"
|
||||
v-model="node.assignValue"
|
||||
:disabled="!node.assignType">
|
||||
</v-autocomplete>
|
||||
</v-col>
|
||||
<v-col cols="12" class=" pb-3" v-if="mode == 'serial'">
|
||||
<span class="inputLabel">允许的操作(英文逗号分隔)</span>
|
||||
<!-- <v-textarea
|
||||
filled single-line
|
||||
@@ -77,7 +76,7 @@
|
||||
></v-textarea> -->
|
||||
<v-text-field class="cus-v-input" dense filled single-line label="允许的操作(英文逗号分隔)" v-model="node.lineTypeList"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" class=" pb-3" >
|
||||
<!-- <v-col cols="12" class=" pb-3" >
|
||||
<span class="inputLabel">可写模板</span>
|
||||
<v-select
|
||||
:items="tpl"
|
||||
@@ -106,6 +105,16 @@
|
||||
multiple
|
||||
v-model="node.formIdHidden"
|
||||
></v-select>
|
||||
</v-col> -->
|
||||
</template>
|
||||
<template v-if="node.id.includes('end-')">
|
||||
<v-col cols="12" class=" pb-3">
|
||||
<span class="inputLabel">流程完成Hook</span>
|
||||
<v-text-field class="cus-v-input mr-2" dense filled single-line label="流程完成Hook" v-model="node.finishHook"></v-text-field>
|
||||
</v-col>
|
||||
<v-col cols="12" class=" pb-3">
|
||||
<span class="inputLabel">流程中断Hook</span>
|
||||
<v-text-field class="cus-v-input mr-2" dense filled single-line label="流程中断Hook" v-model="node.interruptHook"></v-text-field>
|
||||
</v-col>
|
||||
</template>
|
||||
</v-row>
|
||||
@@ -139,6 +148,10 @@
|
||||
return []
|
||||
}
|
||||
},
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'serial'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
<span style="transform: translateY(2px); display: inline-block; ">{{editType == 'node' ? '节点' : '连线'}}属性</span>
|
||||
</div>
|
||||
<div class="flow-edit-content">
|
||||
<edit-node ref="nodeForm" v-if="editType == 'node'" :lf="lf" :user="user" :group="group" :tpl="tpl"></edit-node>
|
||||
<edit-line ref="lineForm" v-if="editType == 'line'" :lf="lf"></edit-line>
|
||||
<edit-node ref="nodeForm" v-if="editType == 'node'" :lf="lf" :user="user" :group="group" :tpl="tpl" :mode="mode"></edit-node>
|
||||
<edit-line ref="lineForm" v-if="editType == 'line'" :lf="lf" :mode="mode"></edit-line>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
@@ -40,6 +40,8 @@
|
||||
<script src="/<$ ctx.app.config.appId $>/public/logicflow/extension/lib/MiniMap.js"></script>
|
||||
<script src="/<$ ctx.app.config.appId $>/public/logicflow/extension/lib/Menu.js"></script>
|
||||
<script src="/<$ ctx.app.config.appId $>/public/logicflow/extension/lib/SelectionSelect.js"></script>
|
||||
<script src="/<$ ctx.app.config.appId $>/public/logicflow/extension/lib/Control.js"></script>
|
||||
<script src="/<$ ctx.app.config.appId $>/public/logicflow/extension/lib/Popup.js"></script>
|
||||
|
||||
<script type="module">
|
||||
Vue.component("process-flow", {
|
||||
@@ -82,6 +84,10 @@
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'serial'
|
||||
}
|
||||
},
|
||||
data: () => {
|
||||
return {
|
||||
@@ -102,6 +108,11 @@
|
||||
]
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
mode() {
|
||||
this.lf.clearData();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
@@ -109,6 +120,7 @@
|
||||
init() {
|
||||
this.initLFInstance();
|
||||
this.initLFCustomType();
|
||||
this.initLFControl();
|
||||
this.initLFMenu();
|
||||
this.initLFEvent();
|
||||
this.initLFData();
|
||||
@@ -143,7 +155,7 @@
|
||||
// edgeTextDraggable: true,
|
||||
stopScrollGraph: true,
|
||||
edgeType: 'polyline',
|
||||
plugins: [MiniMap, Menu, SelectionSelect],
|
||||
plugins: [MiniMap, Menu, SelectionSelect, Control, Popup],
|
||||
isSilentMode: this.readonly
|
||||
|
||||
});
|
||||
@@ -167,7 +179,12 @@
|
||||
const properties = this.properties;
|
||||
if (_this.currentNodeId === this.id) {
|
||||
style.fill = "#4caf50";
|
||||
}
|
||||
} else {
|
||||
const rawNode = _this.data.nodeList.find(o => o.id === this.id)
|
||||
if (rawNode && rawNode.inPath) {
|
||||
style.fill = "#d4ffd6";
|
||||
}
|
||||
}
|
||||
return style;
|
||||
}
|
||||
getTextStyle() {
|
||||
@@ -187,6 +204,17 @@
|
||||
this.lf.register(CustomNode);
|
||||
},
|
||||
|
||||
/**
|
||||
* 初始化LogicFlow控制台
|
||||
*/
|
||||
initLFControl() {
|
||||
let lf = this.lf;
|
||||
// 删除上一步
|
||||
lf.extension.control.removeItem('undo');
|
||||
// 删除下一步
|
||||
lf.extension.control.removeItem('redo');
|
||||
},
|
||||
|
||||
/**
|
||||
* 初始化LogicFlow菜单
|
||||
*/
|
||||
@@ -243,6 +271,21 @@
|
||||
lf.on("edge:add", (e) => {
|
||||
const { data } = e;
|
||||
const { id, sourceNodeId, targetNodeId, properties } = data;
|
||||
// 并行模式不允许多条流程线
|
||||
if(this.mode == 'parallel') {
|
||||
const sourceNodeEdges = lf.getNodeEdges(sourceNodeId);
|
||||
const targetNodeEdges = lf.getNodeEdges(targetNodeId);
|
||||
if (
|
||||
sourceNodeEdges.filter(edge => edge.sourceNodeId == sourceNodeId).length > 1 ||
|
||||
sourceNodeEdges.filter(edge => edge.targetNodeId == sourceNodeId).length > 1 ||
|
||||
targetNodeEdges.filter(edge => edge.sourceNodeId == targetNodeId).length > 1 ||
|
||||
targetNodeEdges.filter(edge => edge.targetNodeId == targetNodeId).length > 1
|
||||
) {
|
||||
window.vtoast.fail("并行模式不允许多条流程线");
|
||||
lf.deleteEdge(id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
let line = {
|
||||
from: sourceNodeId,
|
||||
to: targetNodeId,
|
||||
@@ -302,7 +345,6 @@
|
||||
// this.lf.render({"nodes":[{"id":"3","type":"CustomNode","x":380,"y":140,"properties":{},"text":{"x":380,"y":140,"value":"开始"}},{"id":"1","type":"CustomNode","x":380,"y":280,"properties":{},"text":{"x":380,"y":280,"value":"经理"}},{"id":"2","type":"CustomNode","x":380,"y":420,"properties":{},"text":{"x":380,"y":420,"value":"结束"}}],"edges":[{"id":"a2ed12a0-7548-4725-a8e6-290d565d66da","type":"polyline","sourceNodeId":"3","targetNodeId":"1","startPoint":{"x":380,"y":160},"endPoint":{"x":380,"y":260},"properties":{},"text":{"x":380,"y":190,"value":"开始"},"pointsList":[{"x":380,"y":160},{"x":380,"y":260}]},{"id":"135f3e3a-d8c5-4329-83d6-833512175ea4","type":"polyline","sourceNodeId":"2","targetNodeId":"1","startPoint":{"x":330,"y":420},"endPoint":{"x":330,"y":280},"properties":{},"text":{"x":265,"y":350,"value":"经理审核拒绝"},"pointsList":[{"x":330,"y":420},{"x":265,"y":420},{"x":265,"y":280},{"x":330,"y":280}]},{"id":"c4dbefa6-1ce0-4cef-babe-444329affea7","type":"polyline","sourceNodeId":"1","targetNodeId":"2","startPoint":{"x":430,"y":280},"endPoint":{"x":430,"y":420},"properties":{},"text":{"x":495,"y":350,"value":"经理审核通过"},"pointsList":[{"x":430,"y":280},{"x":495,"y":280},{"x":495,"y":420},{"x":430,"y":420}]},{"id":"6fb6a3b1-a8fc-4d22-b9f0-5692208118d5","type":"polyline","sourceNodeId":"1","targetNodeId":"2","startPoint":{"x":348,"y":300},"endPoint":{"x":348,"y":400},"properties":{},"text":{"x":348,"y":350,"value":"同意-连线文本"},"pointsList":[{"x":348,"y":300},{"x":348,"y":400}]}]})
|
||||
// this.lf.render({"nodes":[{"id":"start-c31f75a55c48","type":"CustomNode","x":100,"y":80,"properties":{"id":"start-c31f75a55c48","label":"起点","type":"start","assignType":"person","assignValue":["admin"],"lineTypeList":"同意"},"text":{"x":100,"y":80,"value":"起点"}},{"id":"end-72e945407d48","type":"CustomNode","x":540,"y":80,"properties":{"id":"end-72e945407d48","label":"终点","type":"end","assignType":"person","assignValue":["admin"],"lineTypeList":""},"text":{"x":540,"y":80,"value":"终点"}},{"id":"userTask-fa96d9f1f548","type":"CustomNode","x":320,"y":80,"properties":{"id":"userTask-fa96d9f1f548","label":"审批节点","type":"userTask","assignType":"person","assignValue":["admin"],"lineTypeList":"同意,拒绝"},"text":{"x":320,"y":80,"value":"审批节点"}}],"edges":[{"id":"line-8c746156fb48","type":"polyline","sourceNodeId":"start-c31f75a55c48","targetNodeId":"userTask-fa96d9f1f548","startPoint":{"x":150,"y":80},"endPoint":{"x":270,"y":80},"properties":{"from":"start-c31f75a55c48","to":"userTask-fa96d9f1f548","label":"同意-连线文本3","type":"同意","id":"line-8c746156fb48","Remark":"","endpoint":"Dot"},"text":{"x":210,"y":80,"value":"同意-连线文本3"},"pointsList":[{"x":150,"y":80},{"x":270,"y":80}]},{"id":"line-088a246e9248","type":"polyline","sourceNodeId":"userTask-fa96d9f1f548","targetNodeId":"end-72e945407d48","startPoint":{"x":370,"y":80},"endPoint":{"x":490,"y":80},"properties":{"from":"userTask-fa96d9f1f548","to":"end-72e945407d48","label":"同意-连线文本","type":"同意","id":"line-088a246e9248","Remark":"","endpoint":"Dot"},"text":{"x":430,"y":80,"value":"同意-连线文本"},"pointsList":[{"x":370,"y":80},{"x":490,"y":80}]}]});
|
||||
this.lf.render(this.parseBusinessDataToLfData(this.data));
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -396,7 +438,7 @@
|
||||
* 将流程设计器数据转换为业务数据
|
||||
*/
|
||||
parseLFDataToBusinessData() {
|
||||
const lfData = this.lf.getGraphData();
|
||||
const lfData = this.getOrderedGraphData();
|
||||
return {
|
||||
nodeList: lfData.nodes.map(node => ({
|
||||
...node.properties,
|
||||
@@ -409,6 +451,31 @@
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取排序后的GraphData
|
||||
* @param nodeList
|
||||
*/
|
||||
getOrderedGraphData() {
|
||||
const lfData = this.lf.getGraphData();
|
||||
const orderedNodes = lfData.edges.reduce((acc, edge) => {
|
||||
const sourceNode = lfData.nodes.find(node => node.id === edge.sourceNodeId);
|
||||
const targetNode = lfData.nodes.find(node => node.id === edge.targetNodeId);
|
||||
if (sourceNode && targetNode) {
|
||||
const sourceIndex = acc.findIndex(node => node.id === sourceNode.id);
|
||||
const targetIndex = acc.findIndex(node => node.id === targetNode.id);
|
||||
if (sourceIndex > targetIndex) {
|
||||
acc.splice(targetIndex, 0, sourceNode);
|
||||
acc.splice(sourceIndex + 1, 1);
|
||||
}
|
||||
}
|
||||
return acc;
|
||||
}, lfData.nodes);
|
||||
return {
|
||||
nodes: orderedNodes,
|
||||
edges: lfData.edges
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 将业务数据转换为流程设计器数据
|
||||
*/
|
||||
@@ -508,4 +575,9 @@
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.lf-control-item i{
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,79 @@
|
||||
<!-- formItem.html >>>>>>>>>>>>> -->
|
||||
<script type="text/html" id="form-item">
|
||||
<div>
|
||||
<span class="jh-input-label">{{ formItem.statement }}</span>
|
||||
|
||||
<!-- 文本 -->
|
||||
<v-text-field v-if="formItem.type === 'input'" :rules="validationRules.requireRules" class="jh-v-input" dense single-line filled label="班级ID" v-model="formItem.answer"></v-text-field>
|
||||
|
||||
<!-- 单选 -->
|
||||
<v-select
|
||||
v-if="formItem.type === 'single'"
|
||||
v-model="formItem.answer"
|
||||
:items="formItem.optionList"
|
||||
dense single-line filled
|
||||
:rules="validationRules.requireRules"
|
||||
></v-select>
|
||||
|
||||
<!-- 多选 -->
|
||||
<v-select
|
||||
v-if="formItem.type === 'multiple'"
|
||||
v-model="formItem.answer"
|
||||
:items="formItem.optionList"
|
||||
multiple
|
||||
dense single-line filled
|
||||
:rules="validationRules.requireRules"
|
||||
></v-select>
|
||||
|
||||
<!-- 文本框 -->
|
||||
<v-textarea v-if="formItem.type === 'short'" :rules="validationRules.requireRules" class="jh-v-input" no-resize dense single-line filled label="备注"
|
||||
v-model="formItem.answer"></v-textarea>
|
||||
|
||||
<!-- 时间选择 -->
|
||||
<v-text-field v-if="formItem.type === 'date'" class="jh-v-input" dense single-line filled readonly @click="openDataPicker" label="出生日期" v-model="formItem.answer" :rules="validationRules.requireRules"></v-text-field>
|
||||
<v-menu v-if="formItem.type === 'date'" class="jh-v-input" :close-on-content-click="false" v-model="isDataPickerShown" :position-x="dataPickerPosition.x" :position-y="dataPickerPosition.y" transition="scale-transition" offset-y min-width="auto">
|
||||
<v-date-picker color="green lighten-1" elevation="20" @input="isDataPickerShown = false" v-model="formItem.answer"></v-date-picker>
|
||||
</v-menu>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
Vue.component('form-item', {
|
||||
template: "#form-item",
|
||||
vueComponent: 'form-item',
|
||||
vuetify: new Vuetify(),
|
||||
props: {
|
||||
formItem: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isDataPickerShown: false,
|
||||
dataPickerPosition: {x: null, y: null},
|
||||
validationRules: {
|
||||
requireRules: [
|
||||
v => !!v || 'This is required',
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
console.log(this.formItem)
|
||||
},
|
||||
methods: {
|
||||
// ---------- 日期选择 >>>>>>>>>> --------
|
||||
async openDataPicker(funObj) {
|
||||
this.dataPickerPosition.x = funObj.x - funObj.offsetX;
|
||||
this.dataPickerPosition.y = funObj.y - funObj.offsetY + 40;
|
||||
this.isDataPickerShown = !this.isDataPickerShown;
|
||||
},
|
||||
// ---------- <<<<<<<<<< 日期选择 --------
|
||||
},
|
||||
});
|
||||
|
||||
</script>
|
||||
<style>
|
||||
</style>
|
||||
<!-- <<<<<<<<<<<<< formItem.html -->
|
||||
@@ -0,0 +1,104 @@
|
||||
<!-- formItem.html >>>>>>>>>>>>> -->
|
||||
<script type="text/html" id="task-history">
|
||||
<div>
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:items="tableData"
|
||||
:items-per-page="-1"
|
||||
mobile-breakpoint="0"
|
||||
:loading="isTableLoading"
|
||||
checkbox-color="success"
|
||||
fixed-header
|
||||
hide-default-footer
|
||||
class="jh-fixed-table-height elevation-0 mt-0 mb-xs-4">
|
||||
<template v-slot:item.taskHandleDesc="{ item }">
|
||||
<span v-if="item.taskConfigId.includes('userTask-')">
|
||||
|
||||
<v-icon
|
||||
large
|
||||
>
|
||||
mdi-arrow-right-thin
|
||||
</v-icon>
|
||||
<v-chip
|
||||
v-if="item.taskHandleDesc === '拒绝'"
|
||||
color="red"
|
||||
small outlined label
|
||||
>
|
||||
{{item.taskHandleDesc}}
|
||||
</v-chip>
|
||||
<v-chip
|
||||
v-else
|
||||
color="green"
|
||||
small outlined label
|
||||
>
|
||||
{{item.taskHandleDesc}}
|
||||
</v-chip>
|
||||
</span>
|
||||
<span v-else>{{item.taskHandleDesc}}</span>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
Vue.component('task-history', {
|
||||
template: "#task-history",
|
||||
vueComponent: 'task-history',
|
||||
vuetify: new Vuetify(),
|
||||
props: {
|
||||
taskId: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isTableLoading: false,
|
||||
headers: [
|
||||
{text: "名称", value: "taskTitle", width: 230, class: 'fixed', cellClass: 'fixed'},
|
||||
{text: "节点说明", value: "taskExplain", width: 200},
|
||||
{text: "操作人", value: "operationByUser", width: 80},
|
||||
{text: "操作描述", value: "taskHandleDesc", width: 120},
|
||||
{text: "操作时间", value: "operationAt", width: 250},
|
||||
],
|
||||
tableData: [],
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
taskId: {
|
||||
handler(val, oldVal) {
|
||||
if (!val) return;
|
||||
this.getTableData();
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// ---------- 获取列表 >>>>>>>>>> --------
|
||||
async getTableData() {
|
||||
this.isTableLoading = true;
|
||||
const result = await window.jianghuAxios({
|
||||
data: {
|
||||
appData: {
|
||||
pageId: 'todo',
|
||||
actionId: 'getTaskHistory',
|
||||
actionData: {taskId: this.taskId},
|
||||
}
|
||||
}
|
||||
})
|
||||
const {taskHistoryList, lineTypeList} = result.data.appData.resultData;
|
||||
taskHistoryList.forEach(task => {
|
||||
task.operationAt = task.taskStatus != 'end' ? dayjs(task.operationAt).format('YYYY-MM-DD HH:mm:ss') : ''
|
||||
})
|
||||
this.tableData = taskHistoryList;
|
||||
this.$emit('line-type-list', lineTypeList);
|
||||
this.isTableLoading = false;
|
||||
},
|
||||
// ---------- <<<<<<<<<< 获取列表 --------
|
||||
},
|
||||
});
|
||||
|
||||
</script>
|
||||
<style>
|
||||
</style>
|
||||
<!-- <<<<<<<<<<<<< formItem.html -->
|
||||
Reference in new issue
Block a user