review 细节调整
This commit is contained in:
1 parent
367fbdc2e3
commit
f5e7f5ae87
4 files changed
+364
-340
No files matched your search
@@ -118,6 +118,7 @@
|
||||
</v-col>
|
||||
</template>
|
||||
</v-row>
|
||||
</v-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 加载logicflow组件 >>>>>>>>>>>>> -->
|
||||
<link rel="stylesheet" href="/<$ ctx.app.config.appId $>/public/logicflow/core/dist/style/index.css" />
|
||||
<link rel="stylesheet" href="/<$ ctx.app.config.appId $>/public/logicflow/extension/lib/style/index.css" />
|
||||
<script src="/<$ ctx.app.config.appId $>/public/logicflow/core/dist/logic-flow.js"></script>
|
||||
@@ -42,6 +43,7 @@
|
||||
<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>
|
||||
<!-- <<<<<<<<<<<<< 加载logicflow组件 -->
|
||||
|
||||
<script type="module">
|
||||
Vue.component("process-flow", {
|
||||
@@ -262,6 +264,7 @@ Vue.component("process-flow", {
|
||||
// 选中节点
|
||||
logicFlow.on("node:click", (e) => {
|
||||
const {data} = e;
|
||||
data.properties.userList = [];
|
||||
this.editNode(data);
|
||||
});
|
||||
// 添加边
|
||||
@@ -341,7 +344,7 @@ Vue.component("process-flow", {
|
||||
// this.logicFlow.render({ "nodes":[], "edges":[] })
|
||||
// this.logicFlow.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.logicFlow.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.logicFlow.render(this.parseBusinessDataToLfData(this.data));
|
||||
this.logicFlow.render(this.parseBusinessDataTologicFlowData(this.data));
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -364,19 +367,19 @@ Vue.component("process-flow", {
|
||||
* 拖拽生成节点
|
||||
* @param 拖拽项
|
||||
*/
|
||||
startDrag(item) {
|
||||
let id = this.getUUID(item.type);
|
||||
startDrag(funObj) {
|
||||
let id = this.getUUID(funObj.type);
|
||||
let node = {
|
||||
type: 'CustomNode',
|
||||
id,
|
||||
text: item.name,
|
||||
text: funObj.name,
|
||||
properties: {
|
||||
id,
|
||||
label: item.name,
|
||||
type: item.type,
|
||||
label: funObj.name,
|
||||
type: funObj.type,
|
||||
assignType: 'person',
|
||||
assignValue: ['<$ ctx.userInfo.userId $>'],
|
||||
lineTypeList: item.type === 'start' ? '同意' : item.type === 'end' ? '' : '同意,拒绝',
|
||||
lineTypeList: funObj.type === 'start' ? '同意' : item.type === 'end' ? '' : '同意,拒绝',
|
||||
}
|
||||
}
|
||||
this.logicFlow.dnd.startDrag(node);
|
||||
@@ -413,35 +416,34 @@ Vue.component("process-flow", {
|
||||
if (this.readonly) {
|
||||
return
|
||||
}
|
||||
const {id, properties} = line;
|
||||
let fromNodeData = this.logicFlow.getNodeDataById(line.sourceNodeId).properties;
|
||||
const lineTypeList = fromNodeData.lineTypeList ? fromNodeData.lineTypeList.split(',') : [];
|
||||
this.editType = 'line';
|
||||
this.currentLineId = line.id;
|
||||
// this.currentLineId = line.id;
|
||||
this.$nextTick(function () {
|
||||
this.$refs.lineForm.init(line, lineTypeList);
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取流程图数据(组件外使用)
|
||||
* 获取流程图业务数据(组件外使用)
|
||||
* @returns {{nodeList: Array, lineList: Array}}
|
||||
*/
|
||||
getData() {
|
||||
return this.parseLFDataToBusinessData();
|
||||
getBusinessData() {
|
||||
return this.parseLogicFlowDataToBusinessData();
|
||||
},
|
||||
|
||||
/**
|
||||
* 将流程设计器数据转换为业务数据
|
||||
*/
|
||||
parseLFDataToBusinessData() {
|
||||
const lfData = this.getOrderedGraphData();
|
||||
parseLogicFlowDataToBusinessData() {
|
||||
const logicFlowData = this.getOrderedGraphData();
|
||||
return {
|
||||
nodeList: lfData.nodes.map(node => ({
|
||||
nodeList: logicFlowData.nodes.map(node => ({
|
||||
...node.properties,
|
||||
origin: node
|
||||
})),
|
||||
lineList: lfData.edges.map(line => ({
|
||||
lineList: logicFlowData.edges.map(line => ({
|
||||
...line.properties,
|
||||
origin: line
|
||||
}))
|
||||
@@ -453,30 +455,30 @@ Vue.component("process-flow", {
|
||||
* @param nodeList
|
||||
*/
|
||||
getOrderedGraphData() {
|
||||
const lfData = this.logicFlow.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);
|
||||
const graphData = this.logicFlow.getGraphData();
|
||||
const orderedNodes = graphData.edges.reduce((nodeList, edge) => {
|
||||
const sourceNode = graphData.nodes.find(node => node.id === edge.sourceNodeId);
|
||||
const targetNode = graphData.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);
|
||||
const sourceIndex = nodeList.findIndex(node => node.id === sourceNode.id);
|
||||
const targetIndex = nodeList.findIndex(node => node.id === targetNode.id);
|
||||
if (sourceIndex > targetIndex) {
|
||||
acc.splice(targetIndex, 0, sourceNode);
|
||||
acc.splice(sourceIndex + 1, 1);
|
||||
nodeList.splice(targetIndex, 0, sourceNode);
|
||||
nodeList.splice(sourceIndex + 1, 1);
|
||||
}
|
||||
}
|
||||
return acc;
|
||||
}, lfData.nodes);
|
||||
return nodeList;
|
||||
}, graphData.nodes);
|
||||
return {
|
||||
nodes: orderedNodes,
|
||||
edges: lfData.edges
|
||||
edges: graphData.edges
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 将业务数据转换为流程设计器数据
|
||||
*/
|
||||
parseBusinessDataToLfData() {
|
||||
parseBusinessDataTologicFlowData() {
|
||||
return {
|
||||
nodes: this.data.nodeList.map(node => node.origin).filter(node => node != null),
|
||||
edges: this.data.lineList.map(line => line.origin).filter(line => line != null)
|
||||
|
||||
@@ -1,87 +1,96 @@
|
||||
<!-- formItem.html >>>>>>>>>>>>> -->
|
||||
<script type="text/html" id="form-item">
|
||||
<div>
|
||||
<span class="jh-input-label">{{ formItem.statement }}</span>
|
||||
<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" :readonly="readonly"></v-text-field>
|
||||
<!-- 文本 -->
|
||||
<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"
|
||||
:readonly="readonly"
|
||||
></v-text-field>
|
||||
|
||||
<!-- 单选 -->
|
||||
<v-select
|
||||
v-if="formItem.type === 'single'"
|
||||
v-model="formItem.answer"
|
||||
:items="formItem.optionList"
|
||||
dense single-line filled
|
||||
:rules="validationRules.requireRules"
|
||||
:readonly="readonly"
|
||||
></v-select>
|
||||
<!-- 单选 -->
|
||||
<v-select
|
||||
v-if="formItem.type === 'single'"
|
||||
v-model="formItem.answer"
|
||||
:items="formItem.optionList"
|
||||
dense single-line filled
|
||||
:rules="validationRules.requireRules"
|
||||
:readonly="readonly"
|
||||
></v-select>
|
||||
|
||||
<!-- 多选 -->
|
||||
<v-select
|
||||
v-if="formItem.type === 'multiple'"
|
||||
v-model="formItem.answer"
|
||||
:items="formItem.optionList"
|
||||
multiple
|
||||
dense single-line filled
|
||||
:rules="validationRules.requireRules"
|
||||
:readonly="readonly"
|
||||
></v-select>
|
||||
<!-- 多选 -->
|
||||
<v-select
|
||||
v-if="formItem.type === 'multiple'"
|
||||
v-model="formItem.answer"
|
||||
:items="formItem.optionList"
|
||||
multiple
|
||||
dense single-line filled
|
||||
:rules="validationRules.requireRules"
|
||||
:readonly="readonly"
|
||||
></v-select>
|
||||
|
||||
<!-- 文本框 -->
|
||||
<v-textarea v-if="formItem.type === 'short'" :rules="validationRules.requireRules" class="jh-v-input" no-resize dense single-line filled label="备注" :readonly="readonly"
|
||||
v-model="formItem.answer"></v-textarea>
|
||||
<!-- 文本框 -->
|
||||
<v-textarea
|
||||
v-if="formItem.type === 'short'"
|
||||
:rules="validationRules.requireRules"
|
||||
class="jh-v-input" no-resize dense single-line filled
|
||||
label="备注"
|
||||
:readonly="readonly"
|
||||
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" :readonly="readonly"></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>
|
||||
<!-- 时间选择 -->
|
||||
<v-menu v-if="formItem.type === 'date'" class="jh-v-input" :close-on-content-click="false" v-model="isDataPickerShown"
|
||||
transition="scale-transition" offset-y min-width="auto">
|
||||
<template v-slot:activator="{on, attrs}">
|
||||
<v-text-field class="jh-v-input" dense single-line filled readonly v-on="on" v-bind="attr" label="出生日期" v-model="formItem.answer"
|
||||
:rules="validationRules.requireRules" :readonly="readonly"></v-text-field>
|
||||
</template>
|
||||
<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: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
},
|
||||
Vue.component('form-item', {
|
||||
template: "#form-item",
|
||||
vueComponent: 'form-item',
|
||||
vuetify: new Vuetify(),
|
||||
props: {
|
||||
formItem: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
},
|
||||
readonly: {
|
||||
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;
|
||||
readonly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isDataPickerShown: false,
|
||||
validationRules: {
|
||||
requireRules: [
|
||||
v => !!v || 'This is required',
|
||||
],
|
||||
},
|
||||
// ---------- <<<<<<<<<< 日期选择 --------
|
||||
},
|
||||
});
|
||||
};
|
||||
},
|
||||
created() {
|
||||
console.log(this.formItem)
|
||||
},
|
||||
methods: {},
|
||||
});
|
||||
|
||||
</script>
|
||||
<style>
|
||||
</style>
|
||||
<!-- <<<<<<<<<<<<< formItem.html -->
|
||||
<!-- <<<<<<<<<<<<< formItem.html -->
|
||||
Reference in new issue
Block a user