Showing
1 changed file
with
111 additions
and
44 deletions
| ... | @@ -316,19 +316,18 @@ | ... | @@ -316,19 +316,18 @@ |
| 316 | <span style="font-size: 12px; transform: scale(0.8); margin-top: 2px;">启用</span> | 316 | <span style="font-size: 12px; transform: scale(0.8); margin-top: 2px;">启用</span> |
| 317 | </div> | 317 | </div> |
| 318 | </el-tooltip> --> | 318 | </el-tooltip> --> |
| 319 | - <!-- <div style="position: absolute; top:20px; right: 15px;"> | 319 | + <div style="position: absolute; top:20px; right: 15px;"> |
| 320 | <el-dropdown trigger="click"> | 320 | <el-dropdown trigger="click"> |
| 321 | <div style="margin-left: 15px;"> | 321 | <div style="margin-left: 15px;"> |
| 322 | - <div style="width: 10px; height: 10px; background-color: #009688; border-radius: 50%; display: inline-block;"></div> <span style="font-size: 13px;">流程版本 (V1)</span> | 322 | + <div style="width: 10px; height: 10px; background-color: #009688; border-radius: 50%; display: inline-block;"></div> <span style="font-size: 13px;">流程版本 (V{{ state.flow_version }})</span> |
| 323 | </div> | 323 | </div> |
| 324 | <template #dropdown> | 324 | <template #dropdown> |
| 325 | <el-dropdown-menu> | 325 | <el-dropdown-menu> |
| 326 | - <el-dropdown-item>流程版本 (V2)</el-dropdown-item> | 326 | + <el-dropdown-item @click.native="onSelectFlowVersion(item.id)" v-for="(item, index) in state.flow_version_list" :key="index">流程版本 (V{{ item.code }})</el-dropdown-item> |
| 327 | - <el-dropdown-item>流程版本 (V3)</el-dropdown-item> | ||
| 328 | </el-dropdown-menu> | 327 | </el-dropdown-menu> |
| 329 | </template> | 328 | </template> |
| 330 | </el-dropdown> | 329 | </el-dropdown> |
| 331 | - </div> --> | 330 | + </div> |
| 332 | </template> | 331 | </template> |
| 333 | <!-- 表单底部按钮 --> | 332 | <!-- 表单底部按钮 --> |
| 334 | <template v-slot:foot> | 333 | <template v-slot:foot> |
| ... | @@ -338,6 +337,12 @@ | ... | @@ -338,6 +337,12 @@ |
| 338 | </div> | 337 | </div> |
| 339 | </template> | 338 | </template> |
| 340 | </vue-flow-editor> | 339 | </vue-flow-editor> |
| 340 | + <div v-if="state.reloadLoading" style="position: absolute; top: 0; right: 0; left: 0; bottom: 0; background-color: rgba(255, 255, 255, 0.5);width: 100%; height: 100%; z-index: 2006;"> | ||
| 341 | + <div class="el-loading-spinner"> | ||
| 342 | + <svg class="circular" viewBox="0 0 50 50"><circle class="path" cx="25" cy="25" r="20" fill="none"></circle></svg> | ||
| 343 | + <p class="el-loading-text">加载流程图中...</p> | ||
| 344 | + </div> | ||
| 345 | + </div> | ||
| 341 | </div> | 346 | </div> |
| 342 | 347 | ||
| 343 | <select-user-view | 348 | <select-user-view |
| ... | @@ -419,6 +424,7 @@ export default { | ... | @@ -419,6 +424,7 @@ export default { |
| 419 | detailModel: null, | 424 | detailModel: null, |
| 420 | editorLoading: false, // 开始编辑器的loading状态 | 425 | editorLoading: false, // 开始编辑器的loading状态 |
| 421 | statusLoading: false, // loading状态 | 426 | statusLoading: false, // loading状态 |
| 427 | + reloadLoading: false, // loading状态 | ||
| 422 | // menuData: [ | 428 | // menuData: [ |
| 423 | // { | 429 | // { |
| 424 | // label: '流程节点', | 430 | // label: '流程节点', |
| ... | @@ -507,6 +513,8 @@ export default { | ... | @@ -507,6 +513,8 @@ export default { |
| 507 | auth_all_edit: false, | 513 | auth_all_edit: false, |
| 508 | field_auths: [], | 514 | field_auths: [], |
| 509 | field_extend: [], | 515 | field_extend: [], |
| 516 | + flow_version: '', | ||
| 517 | + flow_version_list: [], | ||
| 510 | }) | 518 | }) |
| 511 | 519 | ||
| 512 | /** | 520 | /** |
| ... | @@ -574,47 +582,54 @@ export default { | ... | @@ -574,47 +582,54 @@ export default { |
| 574 | 582 | ||
| 575 | // TAG: 接口获取流程图数据 | 583 | // TAG: 接口获取流程图数据 |
| 576 | const flowData = ref<any>(null); | 584 | const flowData = ref<any>(null); |
| 577 | - axios.get('/admin/?a=flow_nodes&flow_id=' + flow_id) | 585 | + const getFlowData = (flow_id) => { |
| 578 | - .then(res => { | 586 | + flowData.value = null; |
| 579 | - if (res.data.code) { | 587 | + axios.get('/admin/?a=flow_nodes&flow_id=' + flow_id) |
| 580 | - let nodes = res.data.data.nodes; | 588 | + .then(res => { |
| 581 | - let edges = res.data.data.edges; | 589 | + if (res.data.code) { |
| 582 | - // 没有流程图数据 | 590 | + let nodes = res.data.data.nodes; |
| 583 | - if (!nodes.length && !edges.length) { | 591 | + let edges = res.data.data.edges; |
| 584 | - flowData.value = AppData; // 设置默认的数据 | 592 | + // 没有流程图数据 |
| 585 | - // 马上保存一次 | 593 | + if (!nodes.length && !edges.length) { |
| 586 | - axios.post('/admin/?a=save_flow', qs.stringify({ | 594 | + flowData.value = AppData; // 设置默认的数据 |
| 587 | - form_id: +form_id, | 595 | + // 马上保存一次 |
| 588 | - flow_id: '', | 596 | + axios.post('/admin/?a=save_flow', qs.stringify({ |
| 589 | - data: JSON.stringify(AppData) | 597 | + form_id: +form_id, |
| 590 | - })) | 598 | + flow_id: '', |
| 591 | - .then(res => { | 599 | + data: JSON.stringify(AppData) |
| 592 | - if (res.data.code) { | 600 | + })) |
| 593 | - flow_id = res.data.data; // 更新flow_id | 601 | + .then(res => { |
| 594 | - updateUrl(flow_id); // 更新url | 602 | + if (res.data.code) { |
| 595 | - } | 603 | + flow_id = res.data.data; // 更新flow_id |
| 596 | - }) | 604 | + updateUrl(flow_id); // 更新url |
| 597 | - .catch(err => { | 605 | + } |
| 598 | - console.log(err); | 606 | + }) |
| 599 | - }); | 607 | + .catch(err => { |
| 608 | + console.log(err); | ||
| 609 | + }); | ||
| 610 | + } else { | ||
| 611 | + flowData.value = res.data.data; // 获取已存在的数据 | ||
| 612 | + } | ||
| 613 | + state.reloadLoading = false; | ||
| 600 | } else { | 614 | } else { |
| 601 | - flowData.value = res.data.data; // 获取已存在的数据 | 615 | + ElMessage({ |
| 616 | + type: 'error', | ||
| 617 | + message: res.data.msg, | ||
| 618 | + }); | ||
| 619 | + state.reloadLoading = false; | ||
| 602 | } | 620 | } |
| 603 | - } else { | 621 | + }) |
| 604 | - ElMessage({ | 622 | + .catch(err => { |
| 605 | - type: 'error', | 623 | + console.error(err); |
| 606 | - message: res.data.msg, | 624 | + state.reloadLoading = false; |
| 607 | - }); | 625 | + }); |
| 608 | - } | 626 | + } |
| 609 | - }) | 627 | + getFlowData(flow_id); |
| 610 | - .catch(err => { | ||
| 611 | - console.error(err); | ||
| 612 | - }); | ||
| 613 | 628 | ||
| 629 | + // 显示提示框的标志位 | ||
| 630 | + var showConfirmation = true; | ||
| 614 | onMounted(async () => { | 631 | onMounted(async () => { |
| 615 | document.title = '可视化流程设计器' | 632 | document.title = '可视化流程设计器' |
| 616 | - // 显示提示框的标志位 | ||
| 617 | - var showConfirmation = true; | ||
| 618 | // 监听 beforeunload 事件 | 633 | // 监听 beforeunload 事件 |
| 619 | window.addEventListener('beforeunload', function (event) { | 634 | window.addEventListener('beforeunload', function (event) { |
| 620 | if (showConfirmation) { | 635 | if (showConfirmation) { |
| ... | @@ -632,7 +647,56 @@ export default { | ... | @@ -632,7 +647,56 @@ export default { |
| 632 | // state.detailModel = null; | 647 | // state.detailModel = null; |
| 633 | // editor.closeModel(); | 648 | // editor.closeModel(); |
| 634 | // }); | 649 | // }); |
| 635 | - }) | 650 | + getVersionList(); |
| 651 | + }); | ||
| 652 | + | ||
| 653 | + const getVersionList = () => { | ||
| 654 | + // 获取版本信息列表 | ||
| 655 | + axios.get('/admin/?a=flow_version&form_id=' + form_id) | ||
| 656 | + .then(res => { | ||
| 657 | + if (res.data.code) { | ||
| 658 | + // 启用的版本号 | ||
| 659 | + res.data.data.forEach((ele) => { | ||
| 660 | + if (ele.status === '1') { | ||
| 661 | + state.flow_version = ele.code; | ||
| 662 | + } | ||
| 663 | + }); | ||
| 664 | + // 版本列表 | ||
| 665 | + state.flow_version_list = res.data.data.filter((ele) => { | ||
| 666 | + return ele.status !== '1'; | ||
| 667 | + }); | ||
| 668 | + } else { | ||
| 669 | + ElMessage({ | ||
| 670 | + type: 'error', | ||
| 671 | + message: res.data.msg, | ||
| 672 | + }); | ||
| 673 | + } | ||
| 674 | + }) | ||
| 675 | + .catch(err => { | ||
| 676 | + console.error(err); | ||
| 677 | + }); | ||
| 678 | + } | ||
| 679 | + | ||
| 680 | + const onSelectFlowVersion = (id: string) => { | ||
| 681 | + // 切换版本信息 | ||
| 682 | + axios.post('/admin/?a=enable_flow_version', qs.stringify({ id: +id })) | ||
| 683 | + .then(res => { | ||
| 684 | + if (res.data.code) { | ||
| 685 | + getVersionList(); | ||
| 686 | + updateUrl(res.data.data); | ||
| 687 | + state.reloadLoading = true; | ||
| 688 | + getFlowData(res.data.data); | ||
| 689 | + } else { | ||
| 690 | + ElMessage({ | ||
| 691 | + type: 'error', | ||
| 692 | + message: res.data.msg, | ||
| 693 | + }); | ||
| 694 | + } | ||
| 695 | + }) | ||
| 696 | + .catch(err => { | ||
| 697 | + console.error(err); | ||
| 698 | + }); | ||
| 699 | + } | ||
| 636 | 700 | ||
| 637 | function handleActiveChange(name: any) { | 701 | function handleActiveChange(name: any) { |
| 638 | console.warn(name) | 702 | console.warn(name) |
| ... | @@ -1451,6 +1515,7 @@ export default { | ... | @@ -1451,6 +1515,7 @@ export default { |
| 1451 | handleBeforeAdd, | 1515 | handleBeforeAdd, |
| 1452 | handleAfterAdd, | 1516 | handleAfterAdd, |
| 1453 | 1517 | ||
| 1518 | + onSelectFlowVersion, | ||
| 1454 | handleActiveChange, | 1519 | handleActiveChange, |
| 1455 | onAuthVisibleChange, | 1520 | onAuthVisibleChange, |
| 1456 | onAuthEditableChange, | 1521 | onAuthEditableChange, |
| ... | @@ -1613,13 +1678,15 @@ body { | ... | @@ -1613,13 +1678,15 @@ body { |
| 1613 | } | 1678 | } |
| 1614 | 1679 | ||
| 1615 | .el-loading-spinner .path { | 1680 | .el-loading-spinner .path { |
| 1616 | - stroke: #009688!important; | 1681 | + stroke: #009688 !important; |
| 1617 | } | 1682 | } |
| 1618 | .el-loading-spinner .el-loading-text { | 1683 | .el-loading-spinner .el-loading-text { |
| 1619 | color: #009688 !important; | 1684 | color: #009688 !important; |
| 1620 | } | 1685 | } |
| 1621 | 1686 | ||
| 1622 | -:focus-visible { outline: none; } | 1687 | +:focus-visible { |
| 1688 | + outline: none; | ||
| 1689 | +} | ||
| 1623 | 1690 | ||
| 1624 | .el-dropdown-menu__item:not(.is-disabled):focus { | 1691 | .el-dropdown-menu__item:not(.is-disabled):focus { |
| 1625 | background-color: white; | 1692 | background-color: white; | ... | ... |
-
Please register or login to post a comment