hookehuyr

流程启用下,相关操作调整

Showing 1 changed file with 37 additions and 13 deletions
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
43 </vue-flow-edit-menu> 43 </vue-flow-edit-menu>
44 </vue-flow-edit-menu-group> --> 44 </vue-flow-edit-menu-group> -->
45 <vue-flow-edit-menu 45 <vue-flow-edit-menu
46 + v-if="state.current_enable_version !== state.select_flow_version"
46 v-for="(value, key) in state.controlList" 47 v-for="(value, key) in state.controlList"
47 :key="key" 48 :key="key"
48 :model="{ control: key, text: value.text, desc: value.desc }" 49 :model="{ control: key, text: value.text, desc: value.desc }"
...@@ -296,13 +297,13 @@ ...@@ -296,13 +297,13 @@
296 </template> 297 </template>
297 <!-- 工具栏 --> 298 <!-- 工具栏 -->
298 <template v-slot:toolbar> 299 <template v-slot:toolbar>
299 - <el-tooltip content="复制节点"> 300 + <el-tooltip v-if="state.current_enable_version !== state.select_flow_version" content="复制节点">
300 <div :class="['vue-flow-editor-toolbar-item', state.detailModel ? '' : 'vue-flow-editor-toolbar-item-disabled']" @click="copyData"> 301 <div :class="['vue-flow-editor-toolbar-item', state.detailModel ? '' : 'vue-flow-editor-toolbar-item-disabled']" @click="copyData">
301 <i class="el-icon-coin" style=" margin-top: 4px;" /> 302 <i class="el-icon-coin" style=" margin-top: 4px;" />
302 <span style="font-size: 12px; transform: scale(0.8); margin-top: 2px;">复制</span> 303 <span style="font-size: 12px; transform: scale(0.8); margin-top: 2px;">复制</span>
303 </div> 304 </div>
304 </el-tooltip> 305 </el-tooltip>
305 - <el-tooltip content="节点排序"> 306 + <el-tooltip v-if="state.current_enable_version !== state.select_flow_version" content="节点排序">
306 <div class="vue-flow-editor-toolbar-item" @click="sortData"> 307 <div class="vue-flow-editor-toolbar-item" @click="sortData">
307 <i class="el-icon-sort" style=" margin-top: 4px;" /> 308 <i class="el-icon-sort" style=" margin-top: 4px;" />
308 <span style="font-size: 12px; transform: scale(0.8); margin-top: 2px;">排序</span> 309 <span style="font-size: 12px; transform: scale(0.8); margin-top: 2px;">排序</span>
...@@ -411,7 +412,11 @@ ...@@ -411,7 +412,11 @@
411 </template> 412 </template>
412 </el-dialog> 413 </el-dialog>
413 </div> 414 </div>
414 - <div class="help-tip" @click="showHelp"> 415 + <!-- TODO: 提示功能 -->
416 + <div v-if="state.current_enable_version === state.select_flow_version" class="add-tip">
417 + <i class="el-icon-warning icon"></i>&nbsp;<span style="font-size: 13px;">流程已启用,如需增删节点和连线,请 <span class="add" @click="addFlowVersion">添加新版本</span></span>
418 + </div>
419 + <div v-else class="help-tip" @click="showHelp">
415 <i class="el-icon-warning"></i>&nbsp;<span style="font-size: 13px;">查看新手引导</span> 420 <i class="el-icon-warning"></i>&nbsp;<span style="font-size: 13px;">查看新手引导</span>
416 </div> 421 </div>
417 <!-- TODO:需要完善操作动图 --> 422 <!-- TODO:需要完善操作动图 -->
...@@ -537,7 +542,7 @@ ...@@ -537,7 +542,7 @@
537 </template> 542 </template>
538 543
539 <script lang="ts"> 544 <script lang="ts">
540 -import { ref, reactive, onMounted, watch, nextTick } from 'vue' 545 +import { ref, reactive, onMounted, watch, nextTick, computed } from 'vue'
541 import { AppData } from './data.js' 546 import { AppData } from './data.js'
542 import { staticPath } from './utils' 547 import { staticPath } from './utils'
543 import { ElNotification, ElMessage, ElMessageBox, ElLoading } from 'element-plus' 548 import { ElNotification, ElMessage, ElMessageBox, ElLoading } from 'element-plus'
...@@ -800,7 +805,6 @@ export default { ...@@ -800,7 +805,6 @@ export default {
800 805
801 const getFlowData = async (flow_id: any) => { 806 const getFlowData = async (flow_id: any) => {
802 flowData.value = null; 807 flowData.value = null;
803 - rawFlowData.value = null;
804 state.reloadLoading = true; // 打开loading 808 state.reloadLoading = true; // 打开loading
805 const { code, data } = await flowNodesAPI({ flow_id }); 809 const { code, data } = await flowNodesAPI({ flow_id });
806 if (code) { 810 if (code) {
...@@ -813,14 +817,11 @@ export default { ...@@ -813,14 +817,11 @@ export default {
813 // 没有流程图数据 817 // 没有流程图数据
814 if (!nodes.length && !edges.length) { 818 if (!nodes.length && !edges.length) {
815 flowData.value = AppData; // 设置默认的数据 819 flowData.value = AppData; // 设置默认的数据
816 - rawFlowData.value = AppData; // 设置默认的数据
817 } else { 820 } else {
818 flowData.value = { nodes, edges }; // 获取已存在的数据 821 flowData.value = { nodes, edges }; // 获取已存在的数据
819 - rawFlowData.value = _.cloneDeep({ nodes, edges }); // 获取已存在的数据
820 // 内部刷新graph数据 822 // 内部刷新graph数据
821 nextTick(() => { 823 nextTick(() => {
822 editor.editorState.graph.read(flowData.value) 824 editor.editorState.graph.read(flowData.value)
823 - editor1?.editorState.graph?.read(rawFlowData.value)
824 }); 825 });
825 } 826 }
826 827
...@@ -1893,6 +1894,12 @@ export default { ...@@ -1893,6 +1894,12 @@ export default {
1893 let start_edge_count = edges.filter((edge: { source: string }) => edge.source === 'start-node'); // 连接到开始节点连接线的数量 1894 let start_edge_count = edges.filter((edge: { source: string }) => edge.source === 'start-node'); // 连接到开始节点连接线的数量
1894 let end_edge_count = edges.filter((edge: { target: string }) => edge.target === 'end-node'); // 连接到结束节点连接线的数量 1895 let end_edge_count = edges.filter((edge: { target: string }) => edge.target === 'end-node'); // 连接到结束节点连接线的数量
1895 1896
1897 + // 流程启用中不允许节点操作
1898 + if (state.current_enable_version === state.select_flow_version) {
1899 + ElNotification.error('流程启用中,不可以删除')
1900 + return Promise.reject('reject')
1901 + }
1902 +
1896 // 不可以删除开始与结束连接线 1903 // 不可以删除开始与结束连接线
1897 let node_id = model.id; 1904 let node_id = model.id;
1898 for (let index = 0; index < edges.length; index++) { 1905 for (let index = 0; index < edges.length; index++) {
...@@ -2268,9 +2275,13 @@ export default { ...@@ -2268,9 +2275,13 @@ export default {
2268 * @return {Array} - The filtered array of buttons 2275 * @return {Array} - The filtered array of buttons
2269 */ 2276 */
2270 function toolbarButtonHandler(buttons: any[]): Array<any> { 2277 function toolbarButtonHandler(buttons: any[]): Array<any> {
2271 - // TAG:测试隐藏缩略图和网格 2278 + let disabledKeys = ['miniMapSwitcher', 'gridSwitcher'];
2272 - let map = buttons.filter((item) => item.key !== 'miniMapSwitcher' && item.key !=='gridSwitcher') 2279 + // 如果在启用版本中,隐藏 节点操作功能 和 缩略图和网格
2273 - return map 2280 + if (state.current_enable_version === state.select_flow_version) {
2281 + disabledKeys = ['delete', 'miniMapSwitcher', 'gridSwitcher', 'undo', 'redo'];
2282 + }
2283 + let map = buttons.filter((item) => !disabledKeys.includes(item.key));
2284 + return map;
2274 } 2285 }
2275 2286
2276 /** 2287 /**
...@@ -2333,6 +2344,7 @@ export default { ...@@ -2333,6 +2344,7 @@ export default {
2333 } 2344 }
2334 2345
2335 const openPreview = () => { 2346 const openPreview = () => {
2347 + editor.closeModel();
2336 // 打开弹框 2348 // 打开弹框
2337 state.dialogPreviewVisible = true; 2349 state.dialogPreviewVisible = true;
2338 // 获取最新数据 2350 // 获取最新数据
...@@ -2359,8 +2371,6 @@ export default { ...@@ -2359,8 +2371,6 @@ export default {
2359 */ 2371 */
2360 const onClickNodePreview = async (e: myEvent) => { 2372 const onClickNodePreview = async (e: myEvent) => {
2361 // TODO: 有一个预览状态可以看到节点相应的表单内容 2373 // TODO: 有一个预览状态可以看到节点相应的表单内容
2362 - console.warn('点击节点,如果预览状态,可以预览表单内容');
2363 -
2364 const model = G6.Util.clone(e.item.get('model')); // 节点的基本属性 2374 const model = G6.Util.clone(e.item.get('model')); // 节点的基本属性
2365 console.log("🚀 ~ file: App.vue:2338 ~ onClickNodePreview ~ model.id:", model.id); 2375 console.log("🚀 ~ file: App.vue:2338 ~ onClickNodePreview ~ model.id:", model.id);
2366 model.style = model.style || {} 2376 model.style = model.style || {}
...@@ -2648,6 +2658,20 @@ body { ...@@ -2648,6 +2658,20 @@ body {
2648 cursor: pointer; 2658 cursor: pointer;
2649 } 2659 }
2650 } 2660 }
2661 +.add-tip {
2662 + position: absolute;
2663 + z-index: 9;
2664 + top: 70px;
2665 + .icon {
2666 + color: #f0a800 !important;
2667 + }
2668 + .add {
2669 + color: #009688 !important;
2670 + &:hover {
2671 + cursor: pointer;
2672 + }
2673 + }
2674 +}
2651 2675
2652 .el-tabs__item.is-active, 2676 .el-tabs__item.is-active,
2653 .el-radio-button__inner:hover { 2677 .el-radio-button__inner:hover {
......