hookehuyr

样式修改,节点ID使用uuid生成

...@@ -329,6 +329,7 @@ import { Calendar, Search } from '@element-plus/icons-vue' ...@@ -329,6 +329,7 @@ import { Calendar, Search } from '@element-plus/icons-vue'
329 import SelectUserView from './selectUserView.vue' 329 import SelectUserView from './selectUserView.vue'
330 import { Function } from 'lodash' 330 import { Function } from 'lodash'
331 import { extend } from '@vue/shared' 331 import { extend } from '@vue/shared'
332 +import { v4 as uuidv4 } from 'uuid';
332 import type { FormInstance, FormRules } from 'element-plus' 333 import type { FormInstance, FormRules } from 'element-plus'
333 334
334 const G6 = (window as any).G6.default as any 335 const G6 = (window as any).G6.default as any
...@@ -1019,8 +1020,7 @@ export default { ...@@ -1019,8 +1020,7 @@ export default {
1019 } 1020 }
1020 } 1021 }
1021 1022
1022 - // TODO: 测试更新ID, 需要在添加前更新ID,不然会导致添加连接线时ID不一致。 1023 + model.id = uuidv4();
1023 - model.id = String(new Date().getTime());
1024 editor.updateModel(model); 1024 editor.updateModel(model);
1025 state.data.nodes = editor.editorState.graph.save().nodes 1025 state.data.nodes = editor.editorState.graph.save().nodes
1026 } 1026 }
...@@ -1063,9 +1063,7 @@ export default { ...@@ -1063,9 +1063,7 @@ export default {
1063 const copyData = () => { // 复制节点回调 1063 const copyData = () => { // 复制节点回调
1064 if (state.detailModel.control !== 'start' && state.detailModel.control !== 'end') { 1064 if (state.detailModel.control !== 'start' && state.detailModel.control !== 'end') {
1065 editor.clearStates(state.detailModel.id); // 清除选中节点的状态 1065 editor.clearStates(state.detailModel.id); // 清除选中节点的状态
1066 - const timestamp = Date.now(); 1066 + state.detailModel.id = uuidv4(); // ID需要重新生成
1067 - const random = timestamp + '';
1068 - state.detailModel.id = random; // ID需要重新生成
1069 state.detailModel.y = state.detailModel.y + 50 1067 state.detailModel.y = state.detailModel.y + 50
1070 editor.addNode(state.detailModel); 1068 editor.addNode(state.detailModel);
1071 editor.closeModel(); 1069 editor.closeModel();
...@@ -1367,4 +1365,10 @@ body { ...@@ -1367,4 +1365,10 @@ body {
1367 background-color: #009688!important; 1365 background-color: #009688!important;
1368 border-color: #009688!important; 1366 border-color: #009688!important;
1369 } 1367 }
1368 +.el-button:focus, .el-button:hover {
1369 + color: #009688!important;
1370 + border-color: #009688!important;
1371 + background-color: white!important;
1372 + outline: 0;
1373 +}
1370 </style> 1374 </style>
......
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 16:51:48 4 + * @LastEditTime: 2023-11-22 17:29:49
5 * @FilePath: /vue-flow-editor/doc/selectUserView.vue 5 * @FilePath: /vue-flow-editor/doc/selectUserView.vue
6 * @Description: 成员列表选择控件 6 * @Description: 成员列表选择控件
7 --> 7 -->
...@@ -217,7 +217,7 @@ ...@@ -217,7 +217,7 @@
217 <template #footer> 217 <template #footer>
218 <span class="dialog-footer"> 218 <span class="dialog-footer">
219 <el-button @click="closeUserForm">取消</el-button> 219 <el-button @click="closeUserForm">取消</el-button>
220 - <el-button type="primary" @click="confirmUserForm">确定</el-button> 220 + <el-button type="primary" color="#009688" @click="confirmUserForm">确定</el-button>
221 </span> 221 </span>
222 </template> 222 </template>
223 </el-dialog> 223 </el-dialog>
...@@ -480,7 +480,7 @@ const checkNode = (obj, status) => { ...@@ -480,7 +480,7 @@ const checkNode = (obj, status) => {
480 if (status.checkedKeys.indexOf(obj.id) > -1) { // 选中 480 if (status.checkedKeys.indexOf(obj.id) > -1) { // 选中
481 // 新增勾选的用户 481 // 新增勾选的用户
482 let check_nodes = status.checkedNodes.map(ele => { 482 let check_nodes = status.checkedNodes.map(ele => {
483 - return { id: ele.id, name: ele.name }; 483 + return { id: ele.id, name: ele.name, type: ele.type };
484 }); 484 });
485 userTags.value = userTags.value.concat(check_nodes); 485 userTags.value = userTags.value.concat(check_nodes);
486 // 如果ID相同,需要数据去重 486 // 如果ID相同,需要数据去重
...@@ -525,7 +525,7 @@ const checkNode = (obj, status) => { ...@@ -525,7 +525,7 @@ const checkNode = (obj, status) => {
525 */ 525 */
526 const handleCheckedUserListChange = (user, checked) => { 526 const handleCheckedUserListChange = (user, checked) => {
527 if (checked) { // 新增勾选的用户 527 if (checked) { // 新增勾选的用户
528 - userTags.value = userTags.value.concat({ id: user.id, name: user.name }); 528 + userTags.value = userTags.value.concat({ id: user.id, name: user.name, type: user.type });
529 // 如果ID相同,需要数据去重 529 // 如果ID相同,需要数据去重
530 userTags.value = _.uniqBy(userTags.value, 'id'); 530 userTags.value = _.uniqBy(userTags.value, 'id');
531 } else { 531 } else {
...@@ -784,7 +784,7 @@ const onSearchInput = (val) => { ...@@ -784,7 +784,7 @@ const onSearchInput = (val) => {
784 bottom: 0; 784 bottom: 0;
785 left: 0; 785 left: 0;
786 height: 2px; 786 height: 2px;
787 - background-color: #409eff; 787 + background-color: #009688;
788 z-index: 1; 788 z-index: 1;
789 transition: width 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), 789 transition: width 0.3s cubic-bezier(0.645, 0.045, 0.355, 1),
790 transform 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); 790 transform 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
...@@ -810,11 +810,11 @@ const onSearchInput = (val) => { ...@@ -810,11 +810,11 @@ const onSearchInput = (val) => {
810 color: #303133; 810 color: #303133;
811 position: relative; 811 position: relative;
812 &:hover { 812 &:hover {
813 - color: #409eff; 813 + color: #009688;
814 cursor: pointer; 814 cursor: pointer;
815 } 815 }
816 &.is-active { 816 &.is-active {
817 - color: #409eff; 817 + color: #009688;
818 } 818 }
819 &.is-top:nth-child(2) { 819 &.is-top:nth-child(2) {
820 padding-left: 0; 820 padding-left: 0;
...@@ -864,7 +864,7 @@ const onSearchInput = (val) => { ...@@ -864,7 +864,7 @@ const onSearchInput = (val) => {
864 .confirm-btn { 864 .confirm-btn {
865 width: 50px; 865 width: 50px;
866 color: #fff; 866 color: #fff;
867 - background-color: #409eff; 867 + background-color: #009688;
868 &:hover { 868 &:hover {
869 cursor: pointer; 869 cursor: pointer;
870 } 870 }
...@@ -885,4 +885,13 @@ const onSearchInput = (val) => { ...@@ -885,4 +885,13 @@ const onSearchInput = (val) => {
885 .el-tag .el-tag__close { 885 .el-tag .el-tag__close {
886 color: white !important; 886 color: white !important;
887 } 887 }
888 +.el-button:focus, .el-button:hover {
889 + color: #009688!important;
890 + border-color: #009688!important;
891 + background-color: white!important;
892 + outline: 0;
893 +}
894 +.el-checkbox__input.is-checked+.el-checkbox__label {
895 + color: #009688!important;
896 +}
888 </style> 897 </style>
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
31 "lodash": "^4.17.21", 31 "lodash": "^4.17.21",
32 "sass": "^1.69.4", 32 "sass": "^1.69.4",
33 "sass-loader": "10.1.1", 33 "sass-loader": "10.1.1",
34 + "uuid": "^9.0.1",
34 "vue": "^3.0.0", 35 "vue": "^3.0.0",
35 "vue-loader-v16": "^16.0.0-beta.5.4", 36 "vue-loader-v16": "^16.0.0-beta.5.4",
36 "vue-router": "^4.0.0-0", 37 "vue-router": "^4.0.0-0",
......
...@@ -8675,6 +8675,11 @@ uuid@^3.3.2, uuid@^3.4.0: ...@@ -8675,6 +8675,11 @@ uuid@^3.3.2, uuid@^3.4.0:
8675 resolved "https://registry.nlark.com/uuid/download/uuid-3.4.0.tgz" 8675 resolved "https://registry.nlark.com/uuid/download/uuid-3.4.0.tgz"
8676 integrity sha1-sj5DWK+oogL+ehAK8fX4g/AgB+4= 8676 integrity sha1-sj5DWK+oogL+ehAK8fX4g/AgB+4=
8677 8677
8678 +uuid@^9.0.1:
8679 + version "9.0.1"
8680 + resolved "https://mirrors.cloud.tencent.com/npm/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30"
8681 + integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==
8682 +
8678 validate-npm-package-license@^3.0.1: 8683 validate-npm-package-license@^3.0.1:
8679 version "3.0.4" 8684 version "3.0.4"
8680 resolved "https://registry.nlark.com/validate-npm-package-license/download/validate-npm-package-license-3.0.4.tgz" 8685 resolved "https://registry.nlark.com/validate-npm-package-license/download/validate-npm-package-license-3.0.4.tgz"
......