hookehuyr

fix

Showing 1 changed file with 35 additions and 26 deletions
...@@ -319,14 +319,14 @@ ...@@ -319,14 +319,14 @@
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_enable_version" style="width: 10px; height: 10px; background-color: #009688; border-radius: 50%; display: inline-block; margin-right: 8px;"></div> 322 + <div v-if="state.select_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.select_flow_version }})</span>
325 </div> 325 </div>
326 <template #dropdown> 326 <template #dropdown>
327 <el-dropdown-menu> 327 <el-dropdown-menu>
328 <el-dropdown-item @click.native="onSelectFlowVersion(item.id, item.code, item.note)" v-for="(item, index) in state.version_list" :key="index"> 328 <el-dropdown-item @click.native="onSelectFlowVersion(item.id, item.code, item.note)" v-for="(item, index) in state.version_list" :key="index">
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.select_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_enable_version" 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>
...@@ -572,8 +572,7 @@ export default { ...@@ -572,8 +572,7 @@ export default {
572 field_auths: [], 572 field_auths: [],
573 field_extend: [], 573 field_extend: [],
574 current_enable_version: 0, 574 current_enable_version: 0,
575 - flow_version: 0, 575 + select_flow_version: 0,
576 - flow_version_list: [],
577 version_list: [], 576 version_list: [],
578 dialogVersionFormVisible: false, 577 dialogVersionFormVisible: false,
579 versionForm: { 578 versionForm: {
...@@ -648,25 +647,24 @@ export default { ...@@ -648,25 +647,24 @@ export default {
648 let flow_id = urlQuery.flow_id? urlQuery.flow_id : ''; // 流程id,如果是新的流程,则为空 647 let flow_id = urlQuery.flow_id? urlQuery.flow_id : ''; // 流程id,如果是新的流程,则为空
649 648
650 /** 649 /**
650 + * 因为从外部页面到流程图页面,flow_id都需要从当前页面生成
651 * 获取版本信息列表 651 * 获取版本信息列表
652 */ 652 */
653 const getVersionList = () => { 653 const getVersionList = () => {
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 - // 版本列表 657 + // 流程版本列表
658 state.version_list = res.data.data; 658 state.version_list = res.data.data;
659 - // 版本列表不含有启用的版本 659 + const urlQuery = getQueryParams(location.href);
660 - state.flow_version_list = res.data.data.filter((ele) => { 660 + let flow_id = urlQuery.flow_id? urlQuery.flow_id : ''; // 流程id,如果是新的流程,则为空
661 - return ele.status !== '1'; 661 + // 从外部页面第一次跳到流程编辑页面时,flow_id不存在
662 - });
663 if (flow_id) { 662 if (flow_id) {
664 if (state.version_list.length) { 663 if (state.version_list.length) {
665 - // 启用的版本号
666 state.version_list.forEach((ele) => { 664 state.version_list.forEach((ele) => {
667 if (ele.id === +flow_id) { 665 if (ele.id === +flow_id) {
668 - // 流程版本显示信息 666 + // 选中的版本号
669 - state.flow_version = ele.code; 667 + state.select_flow_version = ele.code;
670 } 668 }
671 if (ele.status === '1') { 669 if (ele.status === '1') {
672 // 流程版本列表显示启用项 670 // 流程版本列表显示启用项
...@@ -677,12 +675,19 @@ export default { ...@@ -677,12 +675,19 @@ export default {
677 } else { 675 } else {
678 // 如果列表里没有启用的版本获取flow_id不存在时,默认选中第一个 676 // 如果列表里没有启用的版本获取flow_id不存在时,默认选中第一个
679 if (state.version_list.length) { 677 if (state.version_list.length) {
680 - if (!state.flow_version_list) { 678 + let ele = state.version_list[0];
681 - let ele = state.version_list[0]; 679 + flow_id = ele.id;
682 - flow_id = ele.id; 680 + updateUrl(flow_id); // 更新url
683 - updateUrl(flow_id); // 更新url 681 + state.select_flow_version = ele.code; // 选中的版本号
684 - state.flow_version = ele.code; 682 + state.version_list.forEach((ele) => {
685 - } 683 + if (ele.status === '1') {
684 + // 流程版本列表显示启用项
685 + state.current_enable_version = ele.code;
686 + }
687 + });
688 + console.warn(ele);
689 +
690 + getFlowData(flow_id);
686 } 691 }
687 } 692 }
688 // 没有默认版本列表,自动新增流程 693 // 没有默认版本列表,自动新增流程
...@@ -745,7 +750,10 @@ export default { ...@@ -745,7 +750,10 @@ export default {
745 state.reloadLoading = false; 750 state.reloadLoading = false;
746 }); 751 });
747 } 752 }
748 - getFlowData(flow_id); 753 +
754 + if (flow_id) {
755 + getFlowData(flow_id);
756 + }
749 757
750 // 显示提示框的标志位 758 // 显示提示框的标志位
751 onMounted(async () => { 759 onMounted(async () => {
...@@ -775,7 +783,7 @@ export default { ...@@ -775,7 +783,7 @@ export default {
775 // 切换版本信息 783 // 切换版本信息
776 updateUrl(id); // 更新URL 784 updateUrl(id); // 更新URL
777 getFlowData(id); // 更新流程图数据 785 getFlowData(id); // 更新流程图数据
778 - state.flow_version = code; 786 + state.select_flow_version = code;
779 } 787 }
780 const showEditFlowVersion = (id: number, code: number, note: string) => { 788 const showEditFlowVersion = (id: number, code: number, note: string) => {
781 // 切换版本信息 789 // 切换版本信息
...@@ -811,7 +819,7 @@ export default { ...@@ -811,7 +819,7 @@ export default {
811 state.version_list.forEach((ele) => { 819 state.version_list.forEach((ele) => {
812 if (ele.id === +flow_id) { 820 if (ele.id === +flow_id) {
813 // 选中新增的版本 821 // 选中新增的版本
814 - state.flow_version = ele.code; 822 + state.select_flow_version = ele.code;
815 } 823 }
816 if (ele.status === '1') { 824 if (ele.status === '1') {
817 state.current_enable_version = ele.code; 825 state.current_enable_version = ele.code;
...@@ -845,10 +853,11 @@ export default { ...@@ -845,10 +853,11 @@ export default {
845 type: 'success', 853 type: 'success',
846 message: '启用成功', 854 message: '启用成功',
847 }); 855 });
848 - getVersionList(); // 刷新版本列表 856 + let flow_id = res.data.data;
849 - updateUrl(res.data.data); // 更新URL
850 state.reloadLoading = true; // 打开loading 857 state.reloadLoading = true; // 打开loading
851 - getFlowData(res.data.data); // 更新流程图数据 858 + updateUrl(flow_id); // 更新URL
859 + getVersionList(); // 刷新版本列表
860 + getFlowData(flow_id); // 更新流程图数据
852 } 861 }
853 }) 862 })
854 .catch(err => { 863 .catch(err => {
...@@ -859,7 +868,7 @@ export default { ...@@ -859,7 +868,7 @@ export default {
859 const editFlowVersion = () => { // 编辑版本 868 const editFlowVersion = () => { // 编辑版本
860 state.dialogVersionFormVisible = true; 869 state.dialogVersionFormVisible = true;
861 state.version_list.forEach((ele) => { 870 state.version_list.forEach((ele) => {
862 - if (ele.code === state.flow_version) { 871 + if (ele.code === state.select_flow_version) {
863 state.versionForm.id = ele.id; 872 state.versionForm.id = ele.id;
864 state.versionForm.code = ele.code; 873 state.versionForm.code = ele.code;
865 state.versionForm.note = ele.note; 874 state.versionForm.note = ele.note;
......