review 细节调整

This commit is contained in:
yuebenshan committed 2023-02-15 22:04:28 +08:00
1 parent 367fbdc2e3
commit f5e7f5ae87
4 files changed
+364 -340

No files matched your search

+1
View File
@@ -118,6 +118,7 @@
</v-col> </v-col>
</template> </template>
</v-row> </v-row>
</v-form>
</template> </template>
<script> <script>
+30 -28
View File
@@ -34,6 +34,7 @@
</div> </div>
</template> </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/core/dist/style/index.css" />
<link rel="stylesheet" href="/<$ ctx.app.config.appId $>/public/logicflow/extension/lib/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> <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/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/Control.js"></script>
<script src="/<$ ctx.app.config.appId $>/public/logicflow/extension/lib/Popup.js"></script> <script src="/<$ ctx.app.config.appId $>/public/logicflow/extension/lib/Popup.js"></script>
<!-- <<<<<<<<<<<<< 加载logicflow组件 -->
<script type="module"> <script type="module">
Vue.component("process-flow", { Vue.component("process-flow", {
@@ -262,6 +264,7 @@ Vue.component("process-flow", {
// 选中节点 // 选中节点
logicFlow.on("node:click", (e) => { logicFlow.on("node:click", (e) => {
const {data} = e; const {data} = e;
data.properties.userList = [];
this.editNode(data); this.editNode(data);
}); });
// 添加边 // 添加边
@@ -341,7 +344,7 @@ Vue.component("process-flow", {
// this.logicFlow.render({ "nodes":[], "edges":[] }) // 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":"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({"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 拖拽项 * @param 拖拽项
*/ */
startDrag(item) { startDrag(funObj) {
let id = this.getUUID(item.type); let id = this.getUUID(funObj.type);
let node = { let node = {
type: 'CustomNode', type: 'CustomNode',
id, id,
text: item.name, text: funObj.name,
properties: { properties: {
id, id,
label: item.name, label: funObj.name,
type: item.type, type: funObj.type,
assignType: 'person', assignType: 'person',
assignValue: ['<$ ctx.userInfo.userId $>'], assignValue: ['<$ ctx.userInfo.userId $>'],
lineTypeList: item.type === 'start' ? '同意' : item.type === 'end' ? '' : '同意,拒绝', lineTypeList: funObj.type === 'start' ? '同意' : item.type === 'end' ? '' : '同意,拒绝',
} }
} }
this.logicFlow.dnd.startDrag(node); this.logicFlow.dnd.startDrag(node);
@@ -413,35 +416,34 @@ Vue.component("process-flow", {
if (this.readonly) { if (this.readonly) {
return return
} }
const {id, properties} = line;
let fromNodeData = this.logicFlow.getNodeDataById(line.sourceNodeId).properties; let fromNodeData = this.logicFlow.getNodeDataById(line.sourceNodeId).properties;
const lineTypeList = fromNodeData.lineTypeList ? fromNodeData.lineTypeList.split(',') : []; const lineTypeList = fromNodeData.lineTypeList ? fromNodeData.lineTypeList.split(',') : [];
this.editType = 'line'; this.editType = 'line';
this.currentLineId = line.id; // this.currentLineId = line.id;
this.$nextTick(function () { this.$nextTick(function () {
this.$refs.lineForm.init(line, lineTypeList); this.$refs.lineForm.init(line, lineTypeList);
}) })
}, },
/** /**
* 获取流程图数据(组件外使用) * 获取流程图业务数据(组件外使用)
* @returns {{nodeList: Array, lineList: Array}} * @returns {{nodeList: Array, lineList: Array}}
*/ */
getData() { getBusinessData() {
return this.parseLFDataToBusinessData(); return this.parseLogicFlowDataToBusinessData();
}, },
/** /**
* 将流程设计器数据转换为业务数据 * 将流程设计器数据转换为业务数据
*/ */
parseLFDataToBusinessData() { parseLogicFlowDataToBusinessData() {
const lfData = this.getOrderedGraphData(); const logicFlowData = this.getOrderedGraphData();
return { return {
nodeList: lfData.nodes.map(node => ({ nodeList: logicFlowData.nodes.map(node => ({
...node.properties, ...node.properties,
origin: node origin: node
})), })),
lineList: lfData.edges.map(line => ({ lineList: logicFlowData.edges.map(line => ({
...line.properties, ...line.properties,
origin: line origin: line
})) }))
@@ -453,30 +455,30 @@ Vue.component("process-flow", {
* @param nodeList * @param nodeList
*/ */
getOrderedGraphData() { getOrderedGraphData() {
const lfData = this.logicFlow.getGraphData(); const graphData = this.logicFlow.getGraphData();
const orderedNodes = lfData.edges.reduce((acc, edge) => { const orderedNodes = graphData.edges.reduce((nodeList, edge) => {
const sourceNode = lfData.nodes.find(node => node.id === edge.sourceNodeId); const sourceNode = graphData.nodes.find(node => node.id === edge.sourceNodeId);
const targetNode = lfData.nodes.find(node => node.id === edge.targetNodeId); const targetNode = graphData.nodes.find(node => node.id === edge.targetNodeId);
if (sourceNode && targetNode) { if (sourceNode && targetNode) {
const sourceIndex = acc.findIndex(node => node.id === sourceNode.id); const sourceIndex = nodeList.findIndex(node => node.id === sourceNode.id);
const targetIndex = acc.findIndex(node => node.id === targetNode.id); const targetIndex = nodeList.findIndex(node => node.id === targetNode.id);
if (sourceIndex > targetIndex) { if (sourceIndex > targetIndex) {
acc.splice(targetIndex, 0, sourceNode); nodeList.splice(targetIndex, 0, sourceNode);
acc.splice(sourceIndex + 1, 1); nodeList.splice(sourceIndex + 1, 1);
} }
} }
return acc; return nodeList;
}, lfData.nodes); }, graphData.nodes);
return { return {
nodes: orderedNodes, nodes: orderedNodes,
edges: lfData.edges edges: graphData.edges
} }
}, },
/** /**
* 将业务数据转换为流程设计器数据 * 将业务数据转换为流程设计器数据
*/ */
parseBusinessDataToLfData() { parseBusinessDataTologicFlowData() {
return { return {
nodes: this.data.nodeList.map(node => node.origin).filter(node => node != null), nodes: this.data.nodeList.map(node => node.origin).filter(node => node != null),
edges: this.data.lineList.map(line => line.origin).filter(line => line != null) edges: this.data.lineList.map(line => line.origin).filter(line => line != null)
+79 -70
View File
@@ -1,87 +1,96 @@
<!-- formItem.html >>>>>>>>>>>>> --> <!-- formItem.html >>>>>>>>>>>>> -->
<script type="text/html" id="form-item"> <script type="text/html" id="form-item">
<div> <div>
<span class="jh-input-label">{{ formItem.statement }}</span> <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-select
v-if="formItem.type === 'single'" v-if="formItem.type === 'single'"
v-model="formItem.answer" v-model="formItem.answer"
:items="formItem.optionList" :items="formItem.optionList"
dense single-line filled dense single-line filled
:rules="validationRules.requireRules" :rules="validationRules.requireRules"
:readonly="readonly" :readonly="readonly"
></v-select> ></v-select>
<!-- 多选 --> <!-- 多选 -->
<v-select <v-select
v-if="formItem.type === 'multiple'" v-if="formItem.type === 'multiple'"
v-model="formItem.answer" v-model="formItem.answer"
:items="formItem.optionList" :items="formItem.optionList"
multiple multiple
dense single-line filled dense single-line filled
:rules="validationRules.requireRules" :rules="validationRules.requireRules"
:readonly="readonly" :readonly="readonly"
></v-select> ></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-textarea
v-model="formItem.answer"></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"
<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"> 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> <template v-slot:activator="{on, attrs}">
</v-menu> <v-text-field class="jh-v-input" dense single-line filled readonly v-on="on" v-bind="attr" label="出生日期" v-model="formItem.answer"
</div> :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>
<script> <script>
Vue.component('form-item', { Vue.component('form-item', {
template: "#form-item", template: "#form-item",
vueComponent: 'form-item', vueComponent: 'form-item',
vuetify: new Vuetify(), vuetify: new Vuetify(),
props: { props: {
formItem: { formItem: {
type: Object, type: Object,
default: () => { default: () => {
return {} return {}
},
}, },
readonly: {
type: Boolean,
default: false
}
}, },
data() { readonly: {
return { type: Boolean,
isDataPickerShown: false, default: false
dataPickerPosition: {x: null, y: null}, }
validationRules: { },
requireRules: [ data() {
v => !!v || 'This is required', return {
], isDataPickerShown: false,
}, 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;
}, },
// ---------- <<<<<<<<<< 日期选择 -------- };
}, },
}); created() {
console.log(this.formItem)
},
methods: {},
});
</script> </script>
<style> <style>
</style> </style>
<!-- <<<<<<<<<<<<< formItem.html --> <!-- <<<<<<<<<<<<< formItem.html -->
+254 -242
View File
@@ -22,7 +22,7 @@
<v-col cols="12" xs="12" sm="12" md="8" xl="9" class="d-flex align-center"> <v-col cols="12" xs="12" sm="12" md="8" xl="9" class="d-flex align-center">
<v-row class="jh-backend-form-container justify-end ma-0 py-4 pt-xs-0 "> <v-row class="jh-backend-form-container justify-end ma-0 py-4 pt-xs-0 ">
<v-btn <v-btn
small @click="doUiAction(dialogSaveInfoAction)" color="success" class=""> small @click="doUiAction(submitUiActionId)" color="success" class="">
保存 保存
</v-btn> </v-btn>
</v-row> </v-row>
@@ -37,50 +37,50 @@
<v-col cols="12" sm="12" md="3" xl="3" class=" pb-3"> <v-col cols="12" sm="12" md="3" xl="3" class=" pb-3">
<v-text-field <v-text-field
class="jh-v-input mr-2" dense filled single-line color="success" prefix="流程名:" class="jh-v-input mr-2" dense filled single-line color="success" prefix="流程名:"
v-model="editItem['workflowName']" :rules="validationRules.requireRules"> v-model="formObj['workflowName']" :rules="validationRules.requireRules">
</v-text-field> </v-text-field>
</v-col> </v-col>
<v-col cols="12" sm="12" md="3" xl="3" class=" pb-3"> <v-col cols="12" sm="12" md="3" xl="3" class=" pb-3">
<v-text-field <v-text-field
class="jh-v-input mr-2" dense filled single-line color="success" prefix="备注:" class="jh-v-input mr-2" dense filled single-line color="success" prefix="备注:"
v-model="editItem['workflowRemark']"> v-model="formObj['workflowRemark']">
</v-text-field> </v-text-field>
</v-col> </v-col>
<v-col cols="12" sm="12" md="3" xl="3" class=" pb-3"> <v-col cols="12" sm="12" md="3" xl="3" class=" pb-3">
<v-select <v-select
class="jh-v-input mr-2" dense filled single-line color="success" prefix="审批模式:" class="jh-v-input mr-2" dense filled single-line color="success" prefix="审批模式:"
v-model="editItem['mode']" :items="constantObj.modeList" /> v-model="formObj['mode']" :items="constantObj.modeList" />
</v-col> </v-col>
</v-row> </v-row>
</v-card> </v-card>
<div class="pt-4 pb-4 text-h7">流程设置</div> <div class="pt-4 pb-4 text-h7">流程设置</div>
<process-flow <process-flow
v-if="!loading" ref="processFlow" :data="editItem.workflowConfig" :user="constantObj.userList" v-if="!loading" ref="processFlow"
:data="formObj.workflowConfig"
:user="constantObj.userList"
:group="constantObj.groupList" :group="constantObj.groupList"
:mode="editItem.mode"> :mode="formObj.mode">
</process-flow> </process-flow>
</div> </div>
<!-- 页面loading 效果 -->
<v-overlay :value="loading" absolute>
<v-progress-circular
indeterminate
size="64"
></v-progress-circular>
</v-overlay>
<!-- 帮助页抽屉 >>>>>>>>>>>>> --> <!-- 帮助页抽屉 >>>>>>>>>>>>> -->
<v-navigation-drawer v-model="isHelpPageDrawerShown" v-click-outside="drawerClickOutside" fixed temporary right width="80%" class="elevation-24"> <v-navigation-drawer v-model="isHelpPageDrawerShown" v-click-outside="drawerClickOutside" fixed temporary right width="80%" class="elevation-24">
<iframe style="border: 0" :src="`/${appInfo.appId}/pageDoc#workflowManagement.md`" width="100%" <iframe style="border: 0" :src="`/${appInfo.appId}/pageDoc#workflowManagement.md`" width="100%"
height="100%"></iframe> height="100%"></iframe>
<v-btn elevation="0" color="success" fab absolute top left small tile class="drawer-close-float-btn" <v-btn elevation="0" color="success" fab absolute top left small tile class="drawer-close-float-btn"
@click="isHelpPageDrawerShown = false"> @click="isHelpPageDrawerShown = false">
<v-icon>mdi-close</v-icon> <v-icon>mdi-close</v-icon>
</v-btn> </v-btn>
</v-navigation-drawer> </v-navigation-drawer>
<!-- <<<<<<<<<<<<< 帮助页抽屉 --> <!-- <<<<<<<<<<<<< 帮助页抽屉 -->
<!-- 页面loading 效果 -->
<v-overlay :value="loading" fixed style="z-index: 100">
<v-progress-circular
indeterminate
size="64"
></v-progress-circular>
</v-overlay>
</v-main> </v-main>
</v-app> </v-app>
@@ -100,257 +100,269 @@
{% include 'component/flow/editNode.html' %} {% include 'component/flow/editNode.html' %}
<script type="module"> <script type="module">
new Vue({ new Vue({
el: '#app', el: '#app',
template: '#app-template', template: '#app-template',
vueComponent: 'page', vueComponent: 'page',
vuetify: new Vuetify(), vuetify: new Vuetify(),
data: () => ({ data: () => ({
breadcrumbs: [ breadcrumbs: [
{ text: '首页', disabled: true, }, {text: '首页', disabled: true,},
{ text: '申请模板', disabled: true, } {text: '申请模板', disabled: true,}
],
validationRules: {
requireRules: [
v => !!v || '必填',
], ],
validationRules: { },
requireRules: [ constantObj: {
v => !!v || '必填', userList: [],
], groupList: [],
workflowFormList: [],
modeList: [
{text: '串行', value: 'serial'},
{text: '并行', value: 'parallel'},
]
},
formObj: {},
submitUiActionId: 'createItem',
loading: false,
isHelpPageDrawerShown: false,
axiosActionData: null
}),
watch: {
// 监听表单的workflowForm数据变动,重构constantObj数据
'formObj.workflowForm': {
handler() {
if (!this.formObj.workflowForm) return;
this.buildConstantWorkflowFormList();
if (!this.formObj.workflowConfig) return;
this.buildConstantWorkflowConfig()
}, },
constantObj: { deep: true,
userList: [], immediate: true
groupList: [], }
workflowFormList: [], },
modeList: [ async created() {
{ text: '串行', value: 'serial' }, this.getUrlObj();
{ text: '并行', value: 'parallel' }, await this.syncUpdateFormObj()
] this.doUiAction('getUserGroupData');
}, },
editItem: {}, mounted() {
dialogSaveInfoAction: 'createItem', },
loading: false, methods: {
isHelpPageDrawerShown: false, async doUiAction(uiActionId, uiActionData) {
}), switch (uiActionId) {
watch: { case 'getUserGroupData':
'editItem.workflowForm': { await this.getUserList();
handler(val) { await this.getGroupList();
if (!val) return break;
this.buildWorkflowFormList(val); case 'createItem':
if (!this.editItem.workflowConfig) return; await this.confirmCreateItemDialog();
this.buildWorkflowConfig() await this.prepareAxiosActionData();
}, await this.doCreateItem();
deep: true, await this.syncUpdateFormObj()
immediate: true break;
case 'updateItem':
await this.confirmUpdateItemDialog();
await this.prepareAxiosActionData();
await this.doUpdateItem();
await this.syncUpdateFormObj()
break;
default:
console.error("[doUiAction] uiActionId not find", {uiActionId});
break;
} }
}, },
async created() {
// -- 获取数据 >>>>>>>>>>>>>>>> --------------------
getUrlObj() {
const searchParams = new URLSearchParams(location.search.substring(1)); const searchParams = new URLSearchParams(location.search.substring(1));
const id = searchParams.get('id'); this.formObj.id = searchParams.get('id');
if (id) {
this.editItem = { id };
await this.syncEditItem()
} else {
this.clearItemData();
}
this.getUserList();
this.getGroupList();
}, },
mounted() { /**
* 获取user数据
*/
async getUserList() {
const {rows} = (await window.jianghuAxios({
data: {
appData: {
pageId: 'workflowManagement',
actionId: 'selectUserList',
actionData: {},
where: {},
}
}
})).data.appData.resultData;
this.constantObj.userList = rows.map(e => {
return {text: e.username, value: e.userId, userId: e.userId}
})
}, },
methods: { /**
async doUiAction(uiActionId, uiActionData) { * 获取group数据
switch (uiActionId) { */
case 'createItem': async getGroupList() {
await this.confirmCreateItemDialog(uiActionData); const {rows} = (await window.jianghuAxios({
await this.doCreateItem(uiActionData); data: {
await this.syncEditItem() appData: {
break; pageId: 'workflowManagement',
case 'updateItem': actionId: 'selectGroupList',
await this.confirmUpdateItemDialog(uiActionData); actionData: {},
await this.doUpdateItem(uiActionData); where: {},
await this.syncEditItem()
break;
default:
console.error("[doUiAction] uiActionId not find", { uiActionId });
break;
}
},
buildWorkflowFormList(val) {
this.constantObj.workflowFormList = [];
for (const item of val) {
this.constantObj.workflowFormList.push({
text: item.component.outline,
value: item.id
})
}
},
buildWorkflowConfig() {
for (const config of this.editItem.workflowConfig.nodeList) {
if (!config.formId) return;
const formId = []
for (const item of config.formId) {
if (!this.constantObj.workflowFormList.some(e => e.value === item)) {
formId.push(item)
}
} }
config.formId = formId
} }
}, })).data.appData.resultData;
this.constantObj.groupList = rows.map(e => {
/** return {text: e.groupName, value: e.groupId}
* 获取user数据 });
*/ },
async getUserList() { // -- <<<<<<<<<<<<< 获取数据 --------------------
const { rows } = (await window.jianghuAxios({ // -- constantObj 数据构建 >>>>>>>>>>> ---------------
data: { buildConstantWorkflowFormList() {
appData: { this.constantObj.workflowFormList = [];
pageId: 'workflowManagement', for (const item of this.formObj.workflowForm) {
actionId: 'selectUserList', this.constantObj.workflowFormList.push({
actionData: {}, text: item.component.outline,
where: {}, value: item.id
}
}
})).data.appData.resultData;
this.constantObj.userList = rows.map(e => {
return { text: e.username, value: e.userId, userId: e.userId }
}) })
}, }
/** },
* 获取group数据
*/ buildConstantWorkflowConfig() {
async getGroupList() { for (const config of this.formObj.workflowConfig.nodeList) {
const { rows } = (await window.jianghuAxios({ if (!config.formId) return;
data: { const formId = []
appData: { for (const item of config.formId) {
pageId: 'workflowManagement', if (!this.constantObj.workflowFormList.some(e => e.value === item)) {
actionId: 'selectGroupList', formId.push(item)
actionData: {},
where: {},
}
} }
})).data.appData.resultData;
this.constantObj.groupList = rows.map(e => {
return { text: e.groupName, value: e.groupId }
});
},
async clearItemData() {
this.dialogSaveInfoAction = 'createItem';
this.editItem = { workflowForm: [], workflowConfig: { lineList: [], nodeList: [] }, mode: 'serial' };
},
// ---------- 新建流程 createItem >>>>>>>>>> --------
async confirmCreateItemDialog() {
if (await window.confirmDialog({ title: "新增", content: "确定新增吗?" }) === false) {
throw new Error("[confirmCreateFormDialog] 否");
} }
}, config.formId = formId
async doCreateItem() { }
delete this.editItem.id; },
const item = this.buildEditItem(); // -- <<<<<<<<<<<<< constantObj 数据构建 ---------------
await window.vtoast.loading("新增数据"); // ---- 数据准备 >>>>>>>>>>>>>> ---------
const { rows } = (await window.jianghuAxios({ async syncUpdateFormObj() {
data: { this.loading = true;
appData: { if (this.formObj.id) {
pageId: 'workflowManagement', const {rows} = (await window.jianghuAxios({
actionId: 'insertItem',
actionData: item
}
}
})).data.appData.resultData;
this.editItem.id = rows[0];
history.pushState({}, '', `?id=${rows[0]}`);
await window.vtoast.success("新增数据成功");
},
async syncEditItem() {
this.loading = true;
this.dialogSaveInfoAction = 'updateItem';
const { rows } = (await window.jianghuAxios({
data: { data: {
appData: { appData: {
pageId: 'workflowManagement', pageId: 'workflowManagement',
actionId: 'selectItemList', actionId: 'selectItemList',
where: { id: this.editItem.id }, where: {id: this.formObj.id},
} }
} }
})).data.appData.resultData; })).data.appData.resultData;
if (!rows.length) { if (rows.length) {
this.clearItemData(); await this.prepareUpdateFormObj(rows);
} else { this.hideLoading();
const item = rows[0]; return;
item.workflowConfig = item.workflowConfig ? JSON.parse(item.workflowConfig) : null;
item.workflowForm = item.workflowForm ? JSON.parse(item.workflowForm) : [];
item.mode = item.workflowConfig.mode || 'serial';
this.editItem = item;
} }
setTimeout(() => { }
this.loading = false; await this.prepareCreateFormObj();
}, 500) this.hideLoading();
}, },
buildEditItem() { hideLoading() {
const { id, workflowId, workflowName, workflowRemark, workflowCategory, mode, workflowForm } = this.editItem; setTimeout(() => {
const workflowConfig = this.$refs.processFlow.getData(); this.loading = false;
workflowConfig.mode = mode }, 300)
// TODO: 清除不存在的用户 },
workflowConfig.nodeList.forEach(node => { async prepareCreateFormObj() {
if (node.type === 'userTask') { this.submitUiActionId = 'createItem';
node.assignValue = node.assignValue || []; this.formObj = {workflowForm: [], workflowConfig: {lineList: [], nodeList: []}, mode: 'serial'};
node.assignValue = node.assignValue.filter(userId => this.constantObj.userList.findIndex(u => u.userId === userId) > -1); },
node.origin.properties.assignValue = node.assignValue; async prepareUpdateFormObj(rows) {
this.submitUiActionId = 'updateItem';
const item = rows[0];
item.workflowConfig = item.workflowConfig ? JSON.parse(item.workflowConfig) : null;
item.workflowForm = item.workflowForm ? JSON.parse(item.workflowForm) : [];
item.mode = item.workflowConfig.mode || 'serial';
this.formObj = item;
},
prepareAxiosActionData() {
const {id, workflowId, workflowName, workflowRemark, workflowCategory, mode, workflowForm} = this.formObj;
const workflowConfig = this.$refs.processFlow.getBusinessData();
workflowConfig.mode = mode
// TODO: 清除不存在的用户
workflowConfig.nodeList.forEach(node => {
if (node.type === 'userTask') {
node.assignValue = node.assignValue || [];
node.assignValue = node.assignValue.filter(userId => this.constantObj.userList.findIndex(u => u.userId === userId) > -1);
node.origin.properties.assignValue = node.assignValue;
}
});
this.axiosActionData = {
workflowName,
workflowRemark,
workflowCategory,
workflowId: workflowId || null,
workflowConfig: workflowConfig ? JSON.stringify(workflowConfig) : null,
workflowForm: workflowForm ? JSON.stringify(workflowForm) : null,
}
if (id) {
this.axiosActionData.id = id;
}
},
// ---- <<<<<<<<<<<<<<< 数据准备 ---------
// ---------- 新建流程 createItem >>>>>>>>>> --------
async confirmCreateItemDialog() {
if (await window.confirmDialog({title: "新增", content: "确定新增吗?"}) === false) {
throw new Error("[confirmCreateFormDialog] 否");
}
},
async doCreateItem() {
delete this.formObj.id;
await window.vtoast.loading("新增数据");
const {rows} = (await window.jianghuAxios({
data: {
appData: {
pageId: 'workflowManagement',
actionId: 'insertItem',
actionData: this.axiosActionData
} }
});
let item = {
workflowName,
workflowRemark,
workflowCategory,
workflowId: workflowId || null,
workflowConfig: workflowConfig ? JSON.stringify(workflowConfig) : null,
workflowForm: workflowForm ? JSON.stringify(workflowForm) : null,
} }
if (id) { })).data.appData.resultData;
item.id = id; this.formObj.id = rows[0];
} history.pushState({}, '', `?id=${rows[0]}`);
return item; await window.vtoast.success("新增数据成功");
}, },
// ---------- <<<<<<<<<< 新建流程 createItem -------- // ---------- <<<<<<<<<< 新建流程 createItem --------
// ---------- 修改流程 updateItem >>>>>>>>>> --------
// ---------- 修改流程 updateItem >>>>>>>>>> -------- async confirmUpdateItemDialog() {
async confirmUpdateItemDialog() { if (await window.confirmDialog({title: "修改", content: "确定修改吗?"}) === false) {
if (await window.confirmDialog({ title: "修改", content: "确定修改吗?" }) === false) { throw new Error("[confirmUpdateItemDialog] 否");
throw new Error("[confirmUpdateItemDialog] 否"); }
} },
}, async doUpdateItem() {
async doUpdateItem() { await window.vtoast.loading("修改数据");
const { id, ...item } = this.buildEditItem(); await window.jianghuAxios({
await window.vtoast.loading("修改数据"); data: {
await window.jianghuAxios({ appData: {
data: { pageId: 'workflowManagement',
appData: { actionId: 'updateItem',
pageId: 'workflowManagement', actionData: this.axiosActionData,
actionId: 'updateItem', where: {id: this.axiosActionData.id}
actionData: item,
where: { id: id }
}
} }
}) }
await window.vtoast.success("修改数据成功"); })
}, await window.vtoast.success("修改数据成功");
// ---------- <<<<<<<<<< 修改流程 updateItem -------- },
} // ---------- <<<<<<<<<< 修改流程 updateItem --------
}) }
})
</script> </script>
<style> <style>
.theme--light.v-data-table>.v-data-table__wrapper>table>tbody>tr>td:not(.v-data-table__mobile-row) { .theme--light.v-data-table > .v-data-table__wrapper > table > tbody > tr > td:not(.v-data-table__mobile-row) {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
max-width: 500px; max-width: 500px;
} }
.theme--light.v-data-table>.v-data-table__wrapper>table>tbody>tr { .theme--light.v-data-table > .v-data-table__wrapper > table > tbody > tr {
cursor: pointer; cursor: pointer;
} }
</style> </style>
{% endblock %} {% endblock %}