Showing
1 changed file
with
67 additions
and
2 deletions
| ... | @@ -324,7 +324,7 @@ | ... | @@ -324,7 +324,7 @@ |
| 324 | <template #dropdown> | 324 | <template #dropdown> |
| 325 | <el-dropdown-menu> | 325 | <el-dropdown-menu> |
| 326 | <el-dropdown-item @click.native="onSelectFlowVersion(item.id, item.code, item.note)" v-for="(item, index) in state.flow_version_list" :key="index">流程版本 (V{{ item.code }})</el-dropdown-item> | 326 | <el-dropdown-item @click.native="onSelectFlowVersion(item.id, item.code, item.note)" v-for="(item, index) in state.flow_version_list" :key="index">流程版本 (V{{ item.code }})</el-dropdown-item> |
| 327 | - <el-dropdown-item><i class="el-icon-circle-plus-outline"></i>新增流程</el-dropdown-item> | 327 | + <el-dropdown-item @click.native="addFlowVersion" style="justify-content: center;"><i class="el-icon-circle-plus-outline"></i>新增流程</el-dropdown-item> |
| 328 | </el-dropdown-menu> | 328 | </el-dropdown-menu> |
| 329 | </template> | 329 | </template> |
| 330 | </el-dropdown> | 330 | </el-dropdown> |
| ... | @@ -759,6 +759,70 @@ export default { | ... | @@ -759,6 +759,70 @@ export default { |
| 759 | } | 759 | } |
| 760 | } | 760 | } |
| 761 | 761 | ||
| 762 | + const addFlowVersion = () => { // 新增版本 | ||
| 763 | + axios.post('/admin/?a=save_flow', qs.stringify({ | ||
| 764 | + form_id: +form_id, | ||
| 765 | + flow_id: '', | ||
| 766 | + data: JSON.stringify(AppData) | ||
| 767 | + })) | ||
| 768 | + .then(res => { | ||
| 769 | + if (res.data.code) { | ||
| 770 | + flow_id = res.data.data; // 更新flow_id | ||
| 771 | + updateUrl(flow_id); // 更新url | ||
| 772 | + getFlowData(flow_id); | ||
| 773 | + // 获取版本列表 | ||
| 774 | + axios.get('/admin/?a=flow_version&form_id=' + form_id) | ||
| 775 | + .then(version => { | ||
| 776 | + if (version.data.code) { | ||
| 777 | + // 启用的版本号 | ||
| 778 | + version.data.data.forEach((ele) => { | ||
| 779 | + if (ele.id === flow_id) { | ||
| 780 | + state.flow_version = ele.code; | ||
| 781 | + state.versionForm = { // 当前版本信息 | ||
| 782 | + code: ele.code, | ||
| 783 | + id: ele.id, | ||
| 784 | + note: ele.note, | ||
| 785 | + type: 2, | ||
| 786 | + } | ||
| 787 | + axios.post('/admin/?a=enable_flow_version', qs.stringify(state.versionForm)) | ||
| 788 | + .then(res => { | ||
| 789 | + if (res.data.code) { | ||
| 790 | + getVersionList(); // 刷新版本列表 | ||
| 791 | + } else { | ||
| 792 | + ElMessage({ | ||
| 793 | + type: 'error', | ||
| 794 | + message: res.data.msg, | ||
| 795 | + }); | ||
| 796 | + } | ||
| 797 | + }) | ||
| 798 | + .catch(err => { | ||
| 799 | + console.error(err); | ||
| 800 | + }); | ||
| 801 | + } | ||
| 802 | + }); | ||
| 803 | + // 版本列表 | ||
| 804 | + state.version_list = version.data.data; | ||
| 805 | + // 版本列表不含有启用的版本 | ||
| 806 | + state.flow_version_list = version.data.data.filter((ele) => { | ||
| 807 | + return ele.status !== '1'; | ||
| 808 | + }); | ||
| 809 | + } else { | ||
| 810 | + ElMessage({ | ||
| 811 | + type: 'error', | ||
| 812 | + message: res.data.msg, | ||
| 813 | + }); | ||
| 814 | + } | ||
| 815 | + }) | ||
| 816 | + .catch(err => { | ||
| 817 | + console.error(err); | ||
| 818 | + }); | ||
| 819 | + } | ||
| 820 | + }) | ||
| 821 | + .catch(err => { | ||
| 822 | + console.log(err); | ||
| 823 | + }); | ||
| 824 | + } | ||
| 825 | + | ||
| 762 | const setFLowVersionEnable = () => { // 启用版本 | 826 | const setFLowVersionEnable = () => { // 启用版本 |
| 763 | state.versionForm.type = 2; | 827 | state.versionForm.type = 2; |
| 764 | axios.post('/admin/?a=enable_flow_version', qs.stringify(state.versionForm)) | 828 | axios.post('/admin/?a=enable_flow_version', qs.stringify(state.versionForm)) |
| ... | @@ -775,7 +839,7 @@ export default { | ... | @@ -775,7 +839,7 @@ export default { |
| 775 | getFlowData(res.data.data); // 更新流程图数据 | 839 | getFlowData(res.data.data); // 更新流程图数据 |
| 776 | } | 840 | } |
| 777 | }) | 841 | }) |
| 778 | - .catch(err => { | 842 | + .catch(err => { |
| 779 | console.error(err); | 843 | console.error(err); |
| 780 | }); | 844 | }); |
| 781 | } | 845 | } |
| ... | @@ -1659,6 +1723,7 @@ export default { | ... | @@ -1659,6 +1723,7 @@ export default { |
| 1659 | handleAfterAdd, | 1723 | handleAfterAdd, |
| 1660 | 1724 | ||
| 1661 | onSelectFlowVersion, | 1725 | onSelectFlowVersion, |
| 1726 | + addFlowVersion, | ||
| 1662 | setFLowVersionEnable, | 1727 | setFLowVersionEnable, |
| 1663 | editFlowVersion, | 1728 | editFlowVersion, |
| 1664 | deleteFlowVersion, | 1729 | deleteFlowVersion, | ... | ... |
-
Please register or login to post a comment