2020 <div style =" display : flex ;align-items : center ; gap : 10px ;" >
2121
2222 <el-tooltip v-if =" isNewLauncher" content =" 取消新建" placement =" top" >
23- <Close theme =" outline" size =" 20" fill =" #333 " @click =" handleNewLauncher" />
23+ <Close theme =" outline" size =" 20" fill =" #a19797 " @click =" handleNewLauncher" />
2424 </el-tooltip >
2525 <el-tooltip v-else content =" 新建编组" placement =" top" >
26- <Add theme =" outline" size =" 20" fill =" #333 " @click =" handleNewLauncher" />
26+ <Add theme =" outline" size =" 20" fill =" #a19797 " @click =" handleNewLauncher" />
2727 </el-tooltip >
2828
2929 <el-select v-if =" !isNewLauncher" append-to =" .home" v-model =" targetLauncher" style =" width : 240px ;"
3535 </div >
3636 </div >
3737
38- <!-- 按钮 -->
3938 <div style =" display : flex ; justify-content : flex-end ;gap :10px ;align-items : center ; margin-top : 20px ;" >
4039 <button class =" cancel-button" @click =" cancelDragDrop" >取消</button >
4140 <button class =" confirm-button" @click =" confirmDragDrop" >确定</button >
@@ -66,7 +65,7 @@ export default {
6665 const theme = inject (' theme' );
6766 const selectPathList = ref (props .pathList );
6867 const launchers = ref ([]);
69- const targetLauncher = ref ({} );
68+ const targetLauncher = ref ();
7069 const isNewLauncher = ref (false );
7170 const newLauncherName = ref (" " );
7271
@@ -77,7 +76,9 @@ export default {
7776
7877 const initTargetLauncher = async () => {
7978 if (launchers .value .length > 0 ) {
80- targetLauncher .value = launchers .value [0 ];
79+ targetLauncher .value = launchers .value [0 ].id ;
80+ } else if (launchers .value .length == 0 ) {
81+ isNewLauncher .value = true ;
8182 }
8283 };
8384
@@ -88,18 +89,25 @@ export default {
8889
8990 const cancelDragDrop = async () => {
9091 emit (" cancel_drag_drop" );
91- }
92-
92+ }
93+
9394 const confirmDragDrop = async () => {
94- // todo
95- console .log (" 保存" )
95+ let launcherId;
96+ if (isNewLauncher .value ) {
97+ launcherId = await invoke (" craete_launcher" , { " name" : newLauncherName .value });
98+ } else {
99+ launcherId = targetLauncher .value ;
100+ }
101+
102+ await invoke (" add_resources" , { " launcherId" : launcherId, " resources" : selectPathList .value .map (path => ({ " path" : path })) });
103+
96104 emit (" confirm_drag_drop" );
97105 }
98106
99- // 在组件挂载时加载主题
100107 onMounted (() => {
101- queryLaunchers ();
102- initTargetLauncher ();
108+ queryLaunchers ().then (() => {
109+ initTargetLauncher ();
110+ })
103111 });
104112
105113 return {
@@ -142,12 +150,13 @@ label {
142150
143151button {
144152 padding : 10px 20px ;
145- background-color : #409eff ;;
153+ background-color : #409eff ;
154+ ;
146155 color : white ;
147156 border : none ;
148157 border-radius : 5px ;
149158 cursor : pointer ;
150- border-color : #409eff ;
159+ border-color : #409eff ;
151160}
152161
153162button :hover {
@@ -189,11 +198,12 @@ input[type="checkbox"] {
189198
190199.confirm-button {
191200 background-color : #409eff ;
192- border-color : #409eff ;
201+ border-color : #409eff ;
193202 color : #fff ;
194203}
204+
195205.confirm-button :hover {
196- background-color : #66b1ff ;
206+ background-color : #66b1ff ;
197207 border-color : #66b1ff ;
198208}
199209 </style >
0 commit comments