Showing
1 changed file
with
33 additions
and
36 deletions
| ... | @@ -319,7 +319,7 @@ | ... | @@ -319,7 +319,7 @@ |
| 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 v-if="state.flow_version === state.current_version_code" style="width: 10px; height: 10px; background-color: #009688; border-radius: 50%; display: inline-block; margin-right: 8px;"></div> | 322 | + <div v-if="state.flow_version === state.current_enable_version" style="width: 10px; height: 10px; background-color: #009688; border-radius: 50%; display: inline-block; margin-right: 8px;"></div> |
| 323 | <div v-else style="width: 10px; height: 10px; background-color: #f0a800; border-radius: 50%; display: inline-block; margin-right: 8px;"></div> | 323 | <div v-else style="width: 10px; height: 10px; background-color: #f0a800; border-radius: 50%; display: inline-block; margin-right: 8px;"></div> |
| 324 | <span style="font-size: 13px;">流程版本 (V{{ state.flow_version }})</span> | 324 | <span style="font-size: 13px;">流程版本 (V{{ state.flow_version }})</span> |
| 325 | </div> | 325 | </div> |
| ... | @@ -329,7 +329,7 @@ | ... | @@ -329,7 +329,7 @@ |
| 329 | <i v-if="item.code === state.flow_version" class="el-icon-check" style="color: #009688; margin-right: 8px;"></i> | 329 | <i v-if="item.code === state.flow_version" class="el-icon-check" style="color: #009688; margin-right: 8px;"></i> |
| 330 | <div v-else style="width: 15px; height: 15px;display: inline-block; margin-right: 8px;"></div> | 330 | <div v-else style="width: 15px; height: 15px;display: inline-block; margin-right: 8px;"></div> |
| 331 | <span>流程版本 (V{{ item.code }})</span> | 331 | <span>流程版本 (V{{ item.code }})</span> |
| 332 | - <span v-if="item.code === state.current_version_code" style="background: #edf9f1; border-color: #46c26f; color: #46c26f;font-size: 10px; padding: 0 5px; border-radius: 3px; margin-left: 8px;">启用中</span> | 332 | + <span v-if="item.code === state.current_enable_version" style="background: #edf9f1; border-color: #46c26f; color: #46c26f;font-size: 10px; padding: 0 5px; border-radius: 3px; margin-left: 8px;">启用中</span> |
| 333 | <!-- <span @click="showEditFlowVersion(item.id, item.code, item.note)" style="margin-left: 10px;"> | 333 | <!-- <span @click="showEditFlowVersion(item.id, item.code, item.note)" style="margin-left: 10px;"> |
| 334 | <i class="el-icon-edit-outline"></i> | 334 | <i class="el-icon-edit-outline"></i> |
| 335 | </span> --> | 335 | </span> --> |
| ... | @@ -358,7 +358,7 @@ | ... | @@ -358,7 +358,7 @@ |
| 358 | <template #footer> | 358 | <template #footer> |
| 359 | <span class="dialog-footer"> | 359 | <span class="dialog-footer"> |
| 360 | <el-popconfirm | 360 | <el-popconfirm |
| 361 | - v-if="state.current_version_code !== state.versionForm.code" | 361 | + v-if="state.current_enable_version !== state.versionForm.code" |
| 362 | title="是否确认启用该版本流程?" | 362 | title="是否确认启用该版本流程?" |
| 363 | width="220px" | 363 | width="220px" |
| 364 | confirm-button-text="确认" | 364 | confirm-button-text="确认" |
| ... | @@ -369,7 +369,7 @@ | ... | @@ -369,7 +369,7 @@ |
| 369 | </template> | 369 | </template> |
| 370 | </el-popconfirm> | 370 | </el-popconfirm> |
| 371 | <el-popconfirm | 371 | <el-popconfirm |
| 372 | - v-if="state.current_version_code !== state.versionForm.code" | 372 | + v-if="state.current_enable_version !== state.versionForm.code" |
| 373 | title="是否确认删除该版本流程?" | 373 | title="是否确认删除该版本流程?" |
| 374 | width="220px" | 374 | width="220px" |
| 375 | confirm-button-text="确认" | 375 | confirm-button-text="确认" |
| ... | @@ -571,7 +571,7 @@ export default { | ... | @@ -571,7 +571,7 @@ export default { |
| 571 | auth_all_edit: false, | 571 | auth_all_edit: false, |
| 572 | field_auths: [], | 572 | field_auths: [], |
| 573 | field_extend: [], | 573 | field_extend: [], |
| 574 | - current_version_code: 0, | 574 | + current_enable_version: 0, |
| 575 | flow_version: 0, | 575 | flow_version: 0, |
| 576 | flow_version_list: [], | 576 | flow_version_list: [], |
| 577 | version_list: [], | 577 | version_list: [], |
| ... | @@ -654,39 +654,35 @@ export default { | ... | @@ -654,39 +654,35 @@ export default { |
| 654 | axios.get('/admin/?a=flow_version&form_id=' + form_id) | 654 | axios.get('/admin/?a=flow_version&form_id=' + form_id) |
| 655 | .then(res => { | 655 | .then(res => { |
| 656 | if (res.data.code) { | 656 | if (res.data.code) { |
| 657 | - // 启用的版本号 | ||
| 658 | - res.data.data.forEach((ele) => { | ||
| 659 | - if (ele.status === '1') { | ||
| 660 | - flow_id = ele.id; | ||
| 661 | - updateUrl(flow_id); // 更新url | ||
| 662 | - // 版本显示信息 | ||
| 663 | - state.flow_version = ele.code; | ||
| 664 | - state.current_version_code = ele.code; | ||
| 665 | - state.versionForm = { // 当前版本信息 | ||
| 666 | - code: ele.code, | ||
| 667 | - id: ele.id, | ||
| 668 | - note: ele.note, | ||
| 669 | - type: null, | ||
| 670 | - } | ||
| 671 | - } | ||
| 672 | - }); | ||
| 673 | // 版本列表 | 657 | // 版本列表 |
| 674 | state.version_list = res.data.data; | 658 | state.version_list = res.data.data; |
| 675 | // 版本列表不含有启用的版本 | 659 | // 版本列表不含有启用的版本 |
| 676 | state.flow_version_list = res.data.data.filter((ele) => { | 660 | state.flow_version_list = res.data.data.filter((ele) => { |
| 677 | return ele.status !== '1'; | 661 | return ele.status !== '1'; |
| 678 | }); | 662 | }); |
| 679 | - // 如果列表里没有启用的版本 | 663 | + if (flow_id) { |
| 680 | - if (state.version_list.length && !state.flow_version_list) { | 664 | + if (state.version_list.length) { |
| 681 | - let ele = state.version_list[0]; | 665 | + // 启用的版本号 |
| 682 | - flow_id = ele.id; | 666 | + state.version_list.forEach((ele) => { |
| 683 | - updateUrl(flow_id); // 更新url | 667 | + if (ele.id === +flow_id) { |
| 684 | - state.flow_version = ele.code; | 668 | + // 流程版本显示信息 |
| 685 | - state.versionForm = { // 当前版本信息 | 669 | + state.flow_version = ele.code; |
| 686 | - code: ele.code, | 670 | + } |
| 687 | - id: ele.id, | 671 | + if (ele.status === '1') { |
| 688 | - note: ele.note, | 672 | + // 流程版本列表显示启用项 |
| 689 | - type: null, | 673 | + state.current_enable_version = ele.code; |
| 674 | + } | ||
| 675 | + }); | ||
| 676 | + } | ||
| 677 | + } else { | ||
| 678 | + // 如果列表里没有启用的版本获取flow_id不存在时,默认选中第一个 | ||
| 679 | + if (state.version_list.length) { | ||
| 680 | + if (!state.flow_version_list) { | ||
| 681 | + let ele = state.version_list[0]; | ||
| 682 | + flow_id = ele.id; | ||
| 683 | + updateUrl(flow_id); // 更新url | ||
| 684 | + state.flow_version = ele.code; | ||
| 685 | + } | ||
| 690 | } | 686 | } |
| 691 | } | 687 | } |
| 692 | // 没有默认版本列表,自动新增流程 | 688 | // 没有默认版本列表,自动新增流程 |
| ... | @@ -722,7 +718,7 @@ export default { | ... | @@ -722,7 +718,7 @@ export default { |
| 722 | 718 | ||
| 723 | // TAG: 接口获取流程图数据 | 719 | // TAG: 接口获取流程图数据 |
| 724 | const flowData = ref<any>(null); | 720 | const flowData = ref<any>(null); |
| 725 | - const getFlowData = (flow_id) => { | 721 | + const getFlowData = (flow_id: any) => { |
| 726 | flowData.value = null; | 722 | flowData.value = null; |
| 727 | axios.get('/admin/?a=flow_nodes&flow_id=' + flow_id) | 723 | axios.get('/admin/?a=flow_nodes&flow_id=' + flow_id) |
| 728 | .then(res => { | 724 | .then(res => { |
| ... | @@ -813,12 +809,12 @@ export default { | ... | @@ -813,12 +809,12 @@ export default { |
| 813 | // 版本列表 | 809 | // 版本列表 |
| 814 | state.version_list = res.data.data; | 810 | state.version_list = res.data.data; |
| 815 | state.version_list.forEach((ele) => { | 811 | state.version_list.forEach((ele) => { |
| 816 | - if (ele.id === flow_id) { | 812 | + if (ele.id === +flow_id) { |
| 817 | // 选中新增的版本 | 813 | // 选中新增的版本 |
| 818 | state.flow_version = ele.code; | 814 | state.flow_version = ele.code; |
| 819 | } | 815 | } |
| 820 | if (ele.status === '1') { | 816 | if (ele.status === '1') { |
| 821 | - state.current_version_code = ele.code; | 817 | + state.current_enable_version = ele.code; |
| 822 | } | 818 | } |
| 823 | }); | 819 | }); |
| 824 | } else { | 820 | } else { |
| ... | @@ -843,7 +839,7 @@ export default { | ... | @@ -843,7 +839,7 @@ export default { |
| 843 | axios.post('/admin/?a=enable_flow_version', qs.stringify(state.versionForm)) | 839 | axios.post('/admin/?a=enable_flow_version', qs.stringify(state.versionForm)) |
| 844 | .then(res => { | 840 | .then(res => { |
| 845 | if (res.data.code) { | 841 | if (res.data.code) { |
| 846 | - state.current_version_code = state.versionForm.code; | 842 | + state.current_enable_version = state.versionForm.code; |
| 847 | state.dialogVersionFormVisible = false; | 843 | state.dialogVersionFormVisible = false; |
| 848 | ElMessage({ | 844 | ElMessage({ |
| 849 | type: 'success', | 845 | type: 'success', |
| ... | @@ -904,6 +900,7 @@ export default { | ... | @@ -904,6 +900,7 @@ export default { |
| 904 | type: 'success', | 900 | type: 'success', |
| 905 | message: '保存成功', | 901 | message: '保存成功', |
| 906 | }); | 902 | }); |
| 903 | + getVersionList(); // 刷新版本列表 | ||
| 907 | } else { | 904 | } else { |
| 908 | ElMessage({ | 905 | ElMessage({ |
| 909 | type: 'error', | 906 | type: 'error', | ... | ... |
-
Please register or login to post a comment