Showing
5 changed files
with
247 additions
and
98 deletions
| ... | @@ -314,6 +314,7 @@ | ... | @@ -314,6 +314,7 @@ |
| 314 | 314 | ||
| 315 | <select-user-view | 315 | <select-user-view |
| 316 | :visible="state.dialogUserFormVisible" | 316 | :visible="state.dialogUserFormVisible" |
| 317 | + :list="state.dialogUserTags" | ||
| 317 | @close="onCloseUserView" | 318 | @close="onCloseUserView" |
| 318 | @confirm="onConfirmUserView" | 319 | @confirm="onConfirmUserView" |
| 319 | /> | 320 | /> |
| ... | @@ -323,7 +324,7 @@ | ... | @@ -323,7 +324,7 @@ |
| 323 | import { ref, reactive, onMounted, watch, nextTick } from 'vue' | 324 | import { ref, reactive, onMounted, watch, nextTick } from 'vue' |
| 324 | import { AppData } from './data.js' | 325 | import { AppData } from './data.js' |
| 325 | import { staticPath } from './utils' | 326 | import { staticPath } from './utils' |
| 326 | -import { ElNotification, ElMessage, ElMessageBox } from 'element-plus' | 327 | +import { ElNotification, ElMessage, ElMessageBox, ElLoading } from 'element-plus' |
| 327 | import axios from './axios' | 328 | import axios from './axios' |
| 328 | import $ from 'jquery' | 329 | import $ from 'jquery' |
| 329 | import { Calendar, Search } from '@element-plus/icons-vue' | 330 | import { Calendar, Search } from '@element-plus/icons-vue' |
| ... | @@ -332,6 +333,7 @@ import { Function } from 'lodash' | ... | @@ -332,6 +333,7 @@ import { Function } from 'lodash' |
| 332 | import { extend } from '@vue/shared' | 333 | import { extend } from '@vue/shared' |
| 333 | import { v4 as uuidv4 } from 'uuid'; | 334 | import { v4 as uuidv4 } from 'uuid'; |
| 334 | import type { FormInstance, FormRules } from 'element-plus' | 335 | import type { FormInstance, FormRules } from 'element-plus' |
| 336 | +import qs from 'qs' | ||
| 335 | 337 | ||
| 336 | const G6 = (window as any).G6.default as any | 338 | const G6 = (window as any).G6.default as any |
| 337 | 339 | ||
| ... | @@ -452,6 +454,7 @@ export default { | ... | @@ -452,6 +454,7 @@ export default { |
| 452 | }, | 454 | }, |
| 453 | search_auth_value: '', | 455 | search_auth_value: '', |
| 454 | dialogUserFormVisible: false, | 456 | dialogUserFormVisible: false, |
| 457 | + dialogUserTags: [], | ||
| 455 | activeName: 'node', | 458 | activeName: 'node', |
| 456 | attr_radio: '基础属性', | 459 | attr_radio: '基础属性', |
| 457 | main_attr_set: true, | 460 | main_attr_set: true, |
| ... | @@ -467,53 +470,47 @@ export default { | ... | @@ -467,53 +470,47 @@ export default { |
| 467 | userTags: [], // 节点负责人, | 470 | userTags: [], // 节点负责人, |
| 468 | auth_all_checked: false, | 471 | auth_all_checked: false, |
| 469 | auth_all_edit: false, | 472 | auth_all_edit: false, |
| 470 | - field_auths: [ // 字段权限 | 473 | + field_auths: [], |
| 471 | - { | ||
| 472 | - name: '字段1', | ||
| 473 | - visible: { | ||
| 474 | - checked: false, | ||
| 475 | - disabled: true, | ||
| 476 | - }, | ||
| 477 | - editable: { | ||
| 478 | - checked: false, | ||
| 479 | - disabled: true, | ||
| 480 | - }, | ||
| 481 | - show: true, | ||
| 482 | - }, | ||
| 483 | - { | ||
| 484 | - name: '字段2', | ||
| 485 | - visible: { | ||
| 486 | - checked: true, | ||
| 487 | - disabled: false, | ||
| 488 | - }, | ||
| 489 | - editable: { | ||
| 490 | - checked: false, | ||
| 491 | - disabled: false, | ||
| 492 | - }, | ||
| 493 | - show: true, | ||
| 494 | - }, | ||
| 495 | - { | ||
| 496 | - name: '字段3', | ||
| 497 | - visible: { | ||
| 498 | - checked: true, | ||
| 499 | - disabled: false, | ||
| 500 | - }, | ||
| 501 | - editable: { | ||
| 502 | - checked: false, | ||
| 503 | - disabled: false, | ||
| 504 | - }, | ||
| 505 | - show: true, | ||
| 506 | - }, | ||
| 507 | - ], | ||
| 508 | }) | 474 | }) |
| 509 | 475 | ||
| 510 | /** | 476 | /** |
| 477 | + * 更新URL | ||
| 478 | + * @param flowId | ||
| 479 | + */ | ||
| 480 | + const updateUrl = (flowId: string) => { | ||
| 481 | + // 获取当前 URL | ||
| 482 | + const url = new URL(window.location.href); | ||
| 483 | + | ||
| 484 | + // 获取 flow_id 的值(可以是一个变量) | ||
| 485 | + // const flowId = 'some_value'; | ||
| 486 | + | ||
| 487 | + // 获取 URL 中的查询参数对象 | ||
| 488 | + const searchParams = url.searchParams; | ||
| 489 | + | ||
| 490 | + // 检查是否存在 form_id 参数 | ||
| 491 | + if (!searchParams.has('form_id')) { | ||
| 492 | + // 如果不存在 form_id 参数,则添加 form_id 和 flow_id 参数 | ||
| 493 | + searchParams.append('flow_id', flowId); | ||
| 494 | + } else { | ||
| 495 | + // 如果存在 form_id 参数,则更新 flow_id 参数的值 | ||
| 496 | + searchParams.set('flow_id', flowId); | ||
| 497 | + } | ||
| 498 | + | ||
| 499 | + // 将更新后的查询参数设置回 URL 对象 | ||
| 500 | + url.search = searchParams.toString(); | ||
| 501 | + | ||
| 502 | + // 修改完 URL 后,更新浏览器地址栏显示的 URL | ||
| 503 | + window.history.replaceState(null, '', url.toString()); | ||
| 504 | + } | ||
| 505 | + | ||
| 506 | + /** | ||
| 511 | * 获取url参数 | 507 | * 获取url参数 |
| 512 | * @param url | 508 | * @param url |
| 513 | */ | 509 | */ |
| 514 | function getQueryParams(url: string) { | 510 | function getQueryParams(url: string) { |
| 515 | const params = { | 511 | const params = { |
| 516 | flow_id: '', | 512 | flow_id: '', |
| 513 | + form_id: '', | ||
| 517 | }; | 514 | }; |
| 518 | // 将url以问号为分隔符拆分为两部分 | 515 | // 将url以问号为分隔符拆分为两部分 |
| 519 | const parts = url.split("?"); | 516 | const parts = url.split("?"); |
| ... | @@ -533,9 +530,13 @@ export default { | ... | @@ -533,9 +530,13 @@ export default { |
| 533 | return params; | 530 | return params; |
| 534 | } | 531 | } |
| 535 | 532 | ||
| 533 | + const urlQuery = getQueryParams(location.href); | ||
| 534 | + let flow_id = urlQuery.flow_id ? urlQuery.flow_id : ''; // 流程id,如果是新创建的流程,则为空 | ||
| 535 | + let form_id = urlQuery.form_id? urlQuery.form_id : ''; // 表单id | ||
| 536 | + | ||
| 536 | // TAG: 接口获取流程图数据 | 537 | // TAG: 接口获取流程图数据 |
| 537 | const flowData = ref<any>(null); | 538 | const flowData = ref<any>(null); |
| 538 | - axios.get('/admin/?a=flow_nodes&flow_id=' + getQueryParams(location.href).flow_id) | 539 | + axios.get('/admin/?a=flow_nodes&flow_id=' + flow_id) |
| 539 | .then(res => { | 540 | .then(res => { |
| 540 | if (res.data.code) { | 541 | if (res.data.code) { |
| 541 | let nodes = res.data.data.nodes; | 542 | let nodes = res.data.data.nodes; |
| ... | @@ -543,6 +544,21 @@ export default { | ... | @@ -543,6 +544,21 @@ export default { |
| 543 | // 没有流程图数据 | 544 | // 没有流程图数据 |
| 544 | if (!nodes.length && !edges.length) { | 545 | if (!nodes.length && !edges.length) { |
| 545 | flowData.value = AppData; // 设置默认的数据 | 546 | flowData.value = AppData; // 设置默认的数据 |
| 547 | + // 马上保存一次 | ||
| 548 | + axios.post('/admin/?a=save_flow', qs.stringify({ | ||
| 549 | + form_id: +form_id, | ||
| 550 | + flow_id: '', | ||
| 551 | + data: JSON.stringify(AppData) | ||
| 552 | + })) | ||
| 553 | + .then(res => { | ||
| 554 | + if (res.data.code) { | ||
| 555 | + flow_id = res.data.data; // 更新flow_id | ||
| 556 | + updateUrl(flow_id); // 更新url | ||
| 557 | + } | ||
| 558 | + }) | ||
| 559 | + .catch(err => { | ||
| 560 | + console.log(err); | ||
| 561 | + }); | ||
| 546 | } else { | 562 | } else { |
| 547 | flowData.value = res.data.data; // 获取已存在的数据 | 563 | flowData.value = res.data.data; // 获取已存在的数据 |
| 548 | } | 564 | } |
| ... | @@ -698,7 +714,7 @@ export default { | ... | @@ -698,7 +714,7 @@ export default { |
| 698 | /****** 用户选择控件弹框 ******/ | 714 | /****** 用户选择控件弹框 ******/ |
| 699 | const openUserForm = () => { | 715 | const openUserForm = () => { |
| 700 | // 打开设置用户弹框 | 716 | // 打开设置用户弹框 |
| 701 | - state.dialogUserFormVisible = true | 717 | + state.dialogUserFormVisible = true; |
| 702 | } | 718 | } |
| 703 | 719 | ||
| 704 | const onCloseUserView = (status: boolean) => { | 720 | const onCloseUserView = (status: boolean) => { |
| ... | @@ -758,25 +774,67 @@ export default { | ... | @@ -758,25 +774,67 @@ export default { |
| 758 | model.labelCfg = model.labelCfg || { style: {} } | 774 | model.labelCfg = model.labelCfg || { style: {} } |
| 759 | 775 | ||
| 760 | model.data = model.data ? model.data : {}; | 776 | model.data = model.data ? model.data : {}; |
| 761 | - // 查询节点的属性 | ||
| 762 | - // 节点名称 state.node_name,节点负责人 state.userTags,基础属性 state.field_auths,更多属性 state.more_attr | ||
| 763 | - console.warn('节点名称', state.node_name); | ||
| 764 | - console.warn('节点负责人', state.userTags); | ||
| 765 | - console.warn('基础属性', state.field_auths); | ||
| 766 | - console.warn('更多属性', state.more_attr); // 非结束节点才显示 | ||
| 767 | 777 | ||
| 768 | state.detailModel = model | 778 | state.detailModel = model |
| 769 | 779 | ||
| 770 | // 判断是否是流程节点 | 780 | // 判断是否是流程节点 |
| 771 | let model_id = model.id | 781 | let model_id = model.id |
| 772 | - if (model_id!== 'end-node') { | 782 | + if (model_id !== 'end-node') { |
| 773 | - state.detailModel = model; | 783 | + // TODO: 接口查询节点的属性 |
| 774 | - // 获取节点名称 | 784 | + // 节点名称 state.node_name,节点负责人 state.userTags,基础属性 state.field_auths,更多属性 state.more_attr |
| 775 | - state.node_name = state.detailModel.text; | 785 | + console.warn('基础属性', state.field_auths); |
| 776 | - // 检查字段权限选中情况 | 786 | + console.warn('更多属性', state.more_attr); |
| 777 | - checkAuthAll('visible'); | 787 | + const loading = ElLoading.service({ |
| 778 | - checkAuthAll('editable'); | 788 | + target: document.getElementById('app'), |
| 789 | + lock: true, | ||
| 790 | + text: '加载中', | ||
| 791 | + // background: 'rgba(f, f, f, 0.7)', | ||
| 792 | + }); | ||
| 793 | + axios.get('/admin/?a=flow_node_property&node_code=' + model.id + '&flow_id=' + flow_id) | ||
| 794 | + .then((res: any) => { | ||
| 795 | + if (res.data.code) { | ||
| 796 | + state.node_name = res.data.data.name ? res.data.data.name : model.text; | ||
| 797 | + state.userTags = res.data.data.user; | ||
| 798 | + state.dialogUserTags = state.userTags; | ||
| 779 | // TODO: 需要处理更多属性数据,节点类型是抄送时不显示节点操作 | 799 | // TODO: 需要处理更多属性数据,节点类型是抄送时不显示节点操作 |
| 800 | + state.field_auths = [ // 字段权限 | ||
| 801 | + { | ||
| 802 | + name: '字段1', | ||
| 803 | + visible: { | ||
| 804 | + checked: false, | ||
| 805 | + disabled: true, | ||
| 806 | + }, | ||
| 807 | + editable: { | ||
| 808 | + checked: false, | ||
| 809 | + disabled: true, | ||
| 810 | + }, | ||
| 811 | + show: true, | ||
| 812 | + }, | ||
| 813 | + { | ||
| 814 | + name: '字段2', | ||
| 815 | + visible: { | ||
| 816 | + checked: true, | ||
| 817 | + disabled: false, | ||
| 818 | + }, | ||
| 819 | + editable: { | ||
| 820 | + checked: false, | ||
| 821 | + disabled: false, | ||
| 822 | + }, | ||
| 823 | + show: true, | ||
| 824 | + }, | ||
| 825 | + { | ||
| 826 | + name: '字段3', | ||
| 827 | + visible: { | ||
| 828 | + checked: true, | ||
| 829 | + disabled: false, | ||
| 830 | + }, | ||
| 831 | + editable: { | ||
| 832 | + checked: false, | ||
| 833 | + disabled: false, | ||
| 834 | + }, | ||
| 835 | + show: true, | ||
| 836 | + }, | ||
| 837 | + ] | ||
| 780 | state.more_attr = [ // 更多属性 | 838 | state.more_attr = [ // 更多属性 |
| 781 | { | 839 | { |
| 782 | id: 'no-1', | 840 | id: 'no-1', |
| ... | @@ -835,6 +893,9 @@ export default { | ... | @@ -835,6 +893,9 @@ export default { |
| 835 | ], | 893 | ], |
| 836 | } | 894 | } |
| 837 | ]; | 895 | ]; |
| 896 | + // 检查字段权限选中情况 | ||
| 897 | + checkAuthAll('visible'); | ||
| 898 | + checkAuthAll('editable'); | ||
| 838 | if (state.detailModel.control === 'cc') { | 899 | if (state.detailModel.control === 'cc') { |
| 839 | state.more_attr = state.more_attr.filter((ele: any) => { | 900 | state.more_attr = state.more_attr.filter((ele: any) => { |
| 840 | return ele.label !== '节点操作' | 901 | return ele.label !== '节点操作' |
| ... | @@ -843,6 +904,19 @@ export default { | ... | @@ -843,6 +904,19 @@ export default { |
| 843 | // 打开属性表单 | 904 | // 打开属性表单 |
| 844 | state.attr_radio = '基础属性'; // 还原tab默认值 | 905 | state.attr_radio = '基础属性'; // 还原tab默认值 |
| 845 | editor.openModel(); | 906 | editor.openModel(); |
| 907 | + loading.close(); | ||
| 908 | + } else { | ||
| 909 | + loading.close(); | ||
| 910 | + ElMessage({ | ||
| 911 | + type: 'error', | ||
| 912 | + message: res.data.msg, | ||
| 913 | + }); | ||
| 914 | + } | ||
| 915 | + }) | ||
| 916 | + .catch((err: any) => { | ||
| 917 | + loading.close(); | ||
| 918 | + console.log(err); | ||
| 919 | + }); | ||
| 846 | } else { | 920 | } else { |
| 847 | editor.closeModel() | 921 | editor.closeModel() |
| 848 | } | 922 | } |
| ... | @@ -900,21 +974,70 @@ export default { | ... | @@ -900,21 +974,70 @@ export default { |
| 900 | * | 974 | * |
| 901 | */ | 975 | */ |
| 902 | async function saveForm() { | 976 | async function saveForm() { |
| 903 | - // if (!formRef.value) return | 977 | + if (state.node_name === '') { |
| 904 | - // await formRef.value.validate((valid) => { | 978 | + ElMessage({ |
| 905 | - // if (!valid) { | 979 | + type: 'error', |
| 906 | - // return false | 980 | + message: '节点名称不能为空', |
| 907 | - // } | 981 | + }); |
| 908 | - // }) | 982 | + return; |
| 983 | + } | ||
| 984 | + if (state.userTags.length === 0) { | ||
| 985 | + ElMessage({ | ||
| 986 | + type: 'error', | ||
| 987 | + message: '节点负责人不能为空', | ||
| 988 | + }); | ||
| 989 | + return; | ||
| 990 | + } | ||
| 991 | + let avail_visible_count = state.field_auths.filter((ele) => { | ||
| 992 | + if (ele.visible.checked && !ele.visible.disabled) { | ||
| 993 | + return ele; | ||
| 994 | + } | ||
| 995 | + }); | ||
| 996 | + let avail_editable_count = state.field_auths.filter((ele) => { | ||
| 997 | + if (ele.editable.checked && !ele.editable.disabled) { | ||
| 998 | + return ele; | ||
| 999 | + } | ||
| 1000 | + }); | ||
| 1001 | + if (avail_visible_count.length === 0 && avail_editable_count.length === 0) { | ||
| 1002 | + ElMessage({ | ||
| 1003 | + type: 'error', | ||
| 1004 | + message: '请至少选择一个字段权限', | ||
| 1005 | + }); | ||
| 1006 | + return; | ||
| 1007 | + } | ||
| 1008 | + // TAG: 保存表单信息 | ||
| 1009 | + axios.post('/admin/?a=save_node_property', qs.stringify({ | ||
| 1010 | + flow_id: +flow_id, | ||
| 1011 | + node_code: state.detailModel.id, | ||
| 1012 | + // data: JSON.stringify({ name: state.node_name, users: state.userTags, field_auths: state.field_auths, more_attr: state.more_attr }) | ||
| 1013 | + data: JSON.stringify({ name: state.node_name, users: state.userTags }) | ||
| 1014 | + })) | ||
| 1015 | + .then(res => { | ||
| 1016 | + if (res.data.code) { | ||
| 1017 | + // console.log(state.detailModel.id) | ||
| 909 | state.detailModel.text = state.node_name; | 1018 | state.detailModel.text = state.node_name; |
| 910 | - // state.detailModel.label = state.node_name | 1019 | + // // state.detailModel.label = state.node_name |
| 911 | // 更新流程图信息 | 1020 | // 更新流程图信息 |
| 912 | editor.updateModel(state.detailModel); | 1021 | editor.updateModel(state.detailModel); |
| 913 | editor.closeModel(); | 1022 | editor.closeModel(); |
| 914 | - console.log('节点名称', state.node_name); | 1023 | + // console.log('节点名称', state.node_name); |
| 915 | - console.log('节点负责人', state.userTags); | 1024 | + // console.log('节点负责人', state.userTags); |
| 916 | - console.log('字段权限', state.field_auths); | 1025 | + // console.log('字段权限', state.field_auths); |
| 917 | - console.log('更多属性', state.more_attr); | 1026 | + // console.log('更多属性', state.more_attr); |
| 1027 | + ElMessage({ | ||
| 1028 | + type:'success', | ||
| 1029 | + message: '保存成功', | ||
| 1030 | + }); | ||
| 1031 | + } else { | ||
| 1032 | + ElMessage({ | ||
| 1033 | + type: 'error', | ||
| 1034 | + message: res.data.msg, | ||
| 1035 | + }); | ||
| 1036 | + } | ||
| 1037 | + }) | ||
| 1038 | + .catch(err => { | ||
| 1039 | + console.error(err); | ||
| 1040 | + }); | ||
| 918 | } | 1041 | } |
| 919 | 1042 | ||
| 920 | /** | 1043 | /** |
| ... | @@ -1104,19 +1227,14 @@ export default { | ... | @@ -1104,19 +1227,14 @@ export default { |
| 1104 | * @return {void} No return value. | 1227 | * @return {void} No return value. |
| 1105 | */ | 1228 | */ |
| 1106 | function saveData(): void { | 1229 | function saveData(): void { |
| 1107 | - let { nodes, edges } = editor.editorState.graph.save() | 1230 | + let { nodes, edges } = editor.editorState.graph.save(); |
| 1108 | - // console.log("nodes", nodes); | 1231 | + |
| 1109 | - // console.log("edges", edges); | ||
| 1110 | // 使用时需要把自定义节点的类型带过去 activity/control | 1232 | // 使用时需要把自定义节点的类型带过去 activity/control |
| 1111 | nodes.forEach((node: { [x: string]: string; shape: string }) => { | 1233 | nodes.forEach((node: { [x: string]: string; shape: string }) => { |
| 1112 | - // if (node.shape === 'activity') { | ||
| 1113 | - // node['shape'] = 'activity_' + node['activity'] | ||
| 1114 | - // } | ||
| 1115 | if (node.shape === 'control') { | 1234 | if (node.shape === 'control') { |
| 1116 | - // node['shape'] = 'control_' + node['control'] | ||
| 1117 | node['control'] = node['control'] | 1235 | node['control'] = node['control'] |
| 1118 | } | 1236 | } |
| 1119 | - }) | 1237 | + }); |
| 1120 | 1238 | ||
| 1121 | nodes = nodes.map( | 1239 | nodes = nodes.map( |
| 1122 | ({ data, id, label, shape, x, y, text, desc, img, control }) => ({ | 1240 | ({ data, id, label, shape, x, y, text, desc, img, control }) => ({ |
| ... | @@ -1131,14 +1249,13 @@ export default { | ... | @@ -1131,14 +1249,13 @@ export default { |
| 1131 | img, | 1249 | img, |
| 1132 | control, | 1250 | control, |
| 1133 | }), | 1251 | }), |
| 1134 | - ) | 1252 | + ); |
| 1135 | edges = edges.map(({ source, sourceAnchor, target, targetAnchor }) => ({ | 1253 | edges = edges.map(({ source, sourceAnchor, target, targetAnchor }) => ({ |
| 1136 | source, | 1254 | source, |
| 1137 | sourceAnchor, | 1255 | sourceAnchor, |
| 1138 | target, | 1256 | target, |
| 1139 | targetAnchor, | 1257 | targetAnchor, |
| 1140 | - })) | 1258 | + })); |
| 1141 | - // console.log(JSON.stringify({ nodes, edges }, null, 2)); | ||
| 1142 | 1259 | ||
| 1143 | ElMessageBox.confirm( | 1260 | ElMessageBox.confirm( |
| 1144 | '是否确定保存流程图?', | 1261 | '是否确定保存流程图?', |
| ... | @@ -1151,15 +1268,32 @@ export default { | ... | @@ -1151,15 +1268,32 @@ export default { |
| 1151 | ) | 1268 | ) |
| 1152 | .then(() => { | 1269 | .then(() => { |
| 1153 | // 检查路径有效性 | 1270 | // 检查路径有效性 |
| 1154 | - // let { edges } = editor.editorState.graph.save() | ||
| 1155 | const paths = []; | 1271 | const paths = []; |
| 1156 | findPathsToEndNode(edges, 'start-node', [], paths); | 1272 | findPathsToEndNode(edges, 'start-node', [], paths); |
| 1157 | - console.log(paths); // 输出满足条件的路径结果数组 | ||
| 1158 | if (paths.length) { | 1273 | if (paths.length) { |
| 1274 | + axios.post('/admin/?a=save_flow', qs.stringify({ | ||
| 1275 | + form_id: +form_id, | ||
| 1276 | + flow_id: +flow_id, | ||
| 1277 | + data: JSON.stringify({ nodes, edges }) | ||
| 1278 | + })) | ||
| 1279 | + .then(res => { | ||
| 1280 | + if (res.data.code) { | ||
| 1159 | ElMessage({ | 1281 | ElMessage({ |
| 1160 | type: 'success', | 1282 | type: 'success', |
| 1161 | message: '保存流程图成功', | 1283 | message: '保存流程图成功', |
| 1162 | }); | 1284 | }); |
| 1285 | + flow_id = res.data.data.flow_id; // 更新flow_id | ||
| 1286 | + console.log(paths); // 输出满足条件的路径结果数组 | ||
| 1287 | + } else { | ||
| 1288 | + ElMessage({ | ||
| 1289 | + type: 'error', | ||
| 1290 | + message: res.data.msg, | ||
| 1291 | + }); | ||
| 1292 | + } | ||
| 1293 | + }) | ||
| 1294 | + .catch(err => { | ||
| 1295 | + console.log(err); | ||
| 1296 | + }); | ||
| 1163 | } else { | 1297 | } else { |
| 1164 | ElNotification.error('缺少一条从开始节点到结束节点的完整流程!'); | 1298 | ElNotification.error('缺少一条从开始节点到结束节点的完整流程!'); |
| 1165 | } | 1299 | } | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2023-11-01 10:18:53 | 2 | * @Date: 2023-11-01 10:18:53 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2023-11-22 17:29:49 | 4 | + * @LastEditTime: 2023-11-23 10:24:27 |
| 5 | * @FilePath: /vue-flow-editor/doc/selectUserView.vue | 5 | * @FilePath: /vue-flow-editor/doc/selectUserView.vue |
| 6 | * @Description: 成员列表选择控件 | 6 | * @Description: 成员列表选择控件 |
| 7 | --> | 7 | --> |
| ... | @@ -232,7 +232,8 @@ import _ from "lodash"; | ... | @@ -232,7 +232,8 @@ import _ from "lodash"; |
| 232 | import { ElNotification, ElMessage, ElMessageBox } from 'element-plus' | 232 | import { ElNotification, ElMessage, ElMessageBox } from 'element-plus' |
| 233 | 233 | ||
| 234 | const props = defineProps({ | 234 | const props = defineProps({ |
| 235 | - visible: Boolean | 235 | + visible: Boolean, |
| 236 | + list: Array, | ||
| 236 | }); | 237 | }); |
| 237 | const emit = defineEmits(["close", "confirm"]); | 238 | const emit = defineEmits(["close", "confirm"]); |
| 238 | 239 | ||
| ... | @@ -316,8 +317,6 @@ onMounted(async () => { | ... | @@ -316,8 +317,6 @@ onMounted(async () => { |
| 316 | message: role_list.data.msg, | 317 | message: role_list.data.msg, |
| 317 | }); | 318 | }); |
| 318 | } | 319 | } |
| 319 | - // TODO: 查询到的用户选中列表数据,等待接口数据 | ||
| 320 | - userTags.value = [{ id: 35697, name: "西园寺" },{ id: 492081, name: "营员" }]; | ||
| 321 | // Tabs菜单的完整数据结构 | 320 | // Tabs菜单的完整数据结构 |
| 322 | userTabs.value.forEach(item => { | 321 | userTabs.value.forEach(item => { |
| 323 | if (item.type === 'corp-tree') { | 322 | if (item.type === 'corp-tree') { |
| ... | @@ -330,17 +329,6 @@ onMounted(async () => { | ... | @@ -330,17 +329,6 @@ onMounted(async () => { |
| 330 | item.data = roleList.value; | 329 | item.data = roleList.value; |
| 331 | } | 330 | } |
| 332 | }); | 331 | }); |
| 333 | - // 第一项目是组织结构树,默认展开第一个节点 | ||
| 334 | - if (userTabs.value[activeTabIdx.value]['type'] === 'corp-tree') { | ||
| 335 | - if (userTabs.value[activeTabIdx.value]['data'].length) { | ||
| 336 | - // 默认展开第一个节点 | ||
| 337 | - defaultExpandedKeys.value = [userTabs.value[activeTabIdx.value]['data'][0]['id']]; | ||
| 338 | - // 把用户选中的节点注入树结构显示选中状态 | ||
| 339 | - nextTick(() => { | ||
| 340 | - currentCheckedNodeKey.value = userTags.value.map(ele => ele.id); | ||
| 341 | - }); | ||
| 342 | - } | ||
| 343 | - } | ||
| 344 | }); | 332 | }); |
| 345 | 333 | ||
| 346 | watch(() => { | 334 | watch(() => { |
| ... | @@ -369,6 +357,25 @@ watch( | ... | @@ -369,6 +357,25 @@ watch( |
| 369 | } | 357 | } |
| 370 | } | 358 | } |
| 371 | ); | 359 | ); |
| 360 | +watch( | ||
| 361 | + () => props.list, | ||
| 362 | + val => { | ||
| 363 | + if (val) { | ||
| 364 | + userTags.value = val; | ||
| 365 | + // 第一项目是组织结构树,默认展开第一个节点 | ||
| 366 | + if (userTabs.value[activeTabIdx.value]['type'] === 'corp-tree') { | ||
| 367 | + if (userTabs.value[activeTabIdx.value]['data'].length) { | ||
| 368 | + // 默认展开第一个节点 | ||
| 369 | + defaultExpandedKeys.value = [userTabs.value[activeTabIdx.value]['data'][0]['id']]; | ||
| 370 | + // 把用户选中的节点注入树结构显示选中状态 | ||
| 371 | + nextTick(() => { | ||
| 372 | + currentCheckedNodeKey.value = userTags.value.map(ele => ele.id); | ||
| 373 | + }); | ||
| 374 | + } | ||
| 375 | + } | ||
| 376 | + } | ||
| 377 | + } | ||
| 378 | +); | ||
| 372 | 379 | ||
| 373 | /** | 380 | /** |
| 374 | * 点击Tab切换回调 | 381 | * 点击Tab切换回调 | ... | ... |
| ... | @@ -26,9 +26,10 @@ | ... | @@ -26,9 +26,10 @@ |
| 26 | "@vue/composition-api": "^1.7.2", | 26 | "@vue/composition-api": "^1.7.2", |
| 27 | "axios": "^1.6.0", | 27 | "axios": "^1.6.0", |
| 28 | "echarts": "^5.1.2", | 28 | "echarts": "^5.1.2", |
| 29 | - "element-plus": "^2.4.1", | 29 | + "element-plus": "^2.4.2", |
| 30 | "jquery": "^3.7.1", | 30 | "jquery": "^3.7.1", |
| 31 | "lodash": "^4.17.21", | 31 | "lodash": "^4.17.21", |
| 32 | + "qs": "^6.11.2", | ||
| 32 | "sass": "^1.69.4", | 33 | "sass": "^1.69.4", |
| 33 | "sass-loader": "10.1.1", | 34 | "sass-loader": "10.1.1", |
| 34 | "uuid": "^9.0.1", | 35 | "uuid": "^9.0.1", | ... | ... |
yarn-error.log
0 → 100644
This diff could not be displayed because it is too large.
| ... | @@ -3787,10 +3787,10 @@ electron-to-chromium@^1.3.793: | ... | @@ -3787,10 +3787,10 @@ electron-to-chromium@^1.3.793: |
| 3787 | resolved "https://registry.nlark.com/electron-to-chromium/download/electron-to-chromium-1.3.806.tgz?cache=0&sync_timestamp=1628906712766&other_urls=https%3A%2F%2Fregistry.nlark.com%2Felectron-to-chromium%2Fdownload%2Felectron-to-chromium-1.3.806.tgz" | 3787 | resolved "https://registry.nlark.com/electron-to-chromium/download/electron-to-chromium-1.3.806.tgz?cache=0&sync_timestamp=1628906712766&other_urls=https%3A%2F%2Fregistry.nlark.com%2Felectron-to-chromium%2Fdownload%2Felectron-to-chromium-1.3.806.tgz" |
| 3788 | integrity sha1-IVAhAPEa6tbFAdHNfyUE8WyTZkI= | 3788 | integrity sha1-IVAhAPEa6tbFAdHNfyUE8WyTZkI= |
| 3789 | 3789 | ||
| 3790 | -element-plus@^2.4.1: | 3790 | +element-plus@^2.4.2: |
| 3791 | - version "2.4.1" | 3791 | + version "2.4.2" |
| 3792 | - resolved "https://mirrors.cloud.tencent.com/npm/element-plus/-/element-plus-2.4.1.tgz#8a5faa69e856d82494b94d77fb485d9e727c8bc1" | 3792 | + resolved "https://mirrors.cloud.tencent.com/npm/element-plus/-/element-plus-2.4.2.tgz#2a24632e0904ccd7bbbd64c269704f6b9969833c" |
| 3793 | - integrity sha512-t7nl+vQlkBKVk1Ag6AufSDyFV8YIXxTFsaya4Nz/0tiRlcz65WPN4WMFeNURuFJleu1HLNtP4YyQKMuS7El8uA== | 3793 | + integrity sha512-E/HwXX7JF1LPvQSjs0fZ8WblIoc0quoXsRXQZiL7QDq7xJdNGSUaXtdk7xiEv7axPmLfEFtxE5du9fFspDrmJw== |
| 3794 | dependencies: | 3794 | dependencies: |
| 3795 | "@ctrl/tinycolor" "^3.4.1" | 3795 | "@ctrl/tinycolor" "^3.4.1" |
| 3796 | "@element-plus/icons-vue" "^2.0.6" | 3796 | "@element-plus/icons-vue" "^2.0.6" |
| ... | @@ -7185,6 +7185,13 @@ qs@6.7.0: | ... | @@ -7185,6 +7185,13 @@ qs@6.7.0: |
| 7185 | resolved "https://registry.npm.taobao.org/qs/download/qs-6.7.0.tgz?cache=0&sync_timestamp=1616385248556&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fqs%2Fdownload%2Fqs-6.7.0.tgz" | 7185 | resolved "https://registry.npm.taobao.org/qs/download/qs-6.7.0.tgz?cache=0&sync_timestamp=1616385248556&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fqs%2Fdownload%2Fqs-6.7.0.tgz" |
| 7186 | integrity sha1-QdwaAV49WB8WIXdr4xr7KHapsbw= | 7186 | integrity sha1-QdwaAV49WB8WIXdr4xr7KHapsbw= |
| 7187 | 7187 | ||
| 7188 | +qs@^6.11.2: | ||
| 7189 | + version "6.11.2" | ||
| 7190 | + resolved "https://mirrors.cloud.tencent.com/npm/qs/-/qs-6.11.2.tgz#64bea51f12c1f5da1bc01496f48ffcff7c69d7d9" | ||
| 7191 | + integrity sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA== | ||
| 7192 | + dependencies: | ||
| 7193 | + side-channel "^1.0.4" | ||
| 7194 | + | ||
| 7188 | qs@~6.5.2: | 7195 | qs@~6.5.2: |
| 7189 | version "6.5.2" | 7196 | version "6.5.2" |
| 7190 | resolved "https://registry.npm.taobao.org/qs/download/qs-6.5.2.tgz?cache=0&sync_timestamp=1616385248556&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fqs%2Fdownload%2Fqs-6.5.2.tgz" | 7197 | resolved "https://registry.npm.taobao.org/qs/download/qs-6.5.2.tgz?cache=0&sync_timestamp=1616385248556&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fqs%2Fdownload%2Fqs-6.5.2.tgz" | ... | ... |
-
Please register or login to post a comment