ソースを参照

移动添加确认操作

jmxd 1 年間 前
コミット
8bc5f4ca4f

+ 25 - 21
src/components/panel/main/magic-resource.vue

@@ -218,28 +218,32 @@ const saveGroup = () => {
 		}
 	})
 }
-const onMove = (src, target) => new Promise(reslove => request.send('/resource/move', { src: src.id, groupId: target.groupId || target.id }).success(r => {
-	const msgId = src.folder ? 'resource.moveGroup' : 'resource.moveResource'
-	const path = getFullPath(src)
-	if(r){
-		if(src.folder){
-			bus.status(msgId + 'Success', true, props.title, path)
-		} else {
-			bus.status(msgId + 'Success', true, path)
-		}
-		src[src.folder ? 'parentId' : 'groupId'] = target.groupId || target.id
+const onMove = (src, target) => new Promise(reslove => {
+	proxy.$confirm($i('message.move'), $i('resource.move', getFullPath(src)), ()=> {
+		request.send('/resource/move', { src: src.id, groupId: target.groupId || target.id }).success(r => {
+			const msgId = src.folder ? 'resource.moveGroup' : 'resource.moveResource'
+			const path = getFullPath(src)
+			if(r){
+				if(src.folder){
+					bus.status(msgId + 'Success', true, props.title, path)
+				} else {
+					bus.status(msgId + 'Success', true, path)
+				}
+				src[src.folder ? 'parentId' : 'groupId'] = target.groupId || target.id
 
-	}else{
-		if(src.folder){
-			bus.status(msgId + 'Failed', false, props.title, path)
-			proxy.$alert($i(msgId + 'Failed', props.title, path))
-		} else {
-			bus.status(msgId + 'Failed', false, path)
-			proxy.$alert($i(msgId + 'Failed', path))
-		}
-	}
-	reslove(r)
-}))
+			}else{
+				if(src.folder){
+					bus.status(msgId + 'Failed', false, props.title, path)
+					proxy.$alert($i(msgId + 'Failed', props.title, path))
+				} else {
+					bus.status(msgId + 'Failed', false, path)
+					proxy.$alert($i(msgId + 'Failed', path))
+				}
+			}
+			reslove(r)
+		})
+	})
+})
 const deleteNode = (node, data) => {
 	data = data || tree.value
 	const index = data.findIndex(it => it === node || it.id === node.id)

+ 3 - 1
src/scripts/i18n/en.js

@@ -51,6 +51,7 @@ export default {
         log: 'Log',
         enable: 'Enable',
         variable: 'Variable Info',
+        move: 'Move',
 
         switchLocale: 'Switch Language To {0}, It work at after refreshing the page, Do you want to Refresh the page ?',
         loadClass: 'Load Classes...',
@@ -123,8 +124,9 @@ export default {
         deleteGroupSuccess: 'Delete {0} Group「{1}」Success',
         deleteGroupFailed: 'Failed to Delete {0} Group 「{1}」',
         groupExport: 'Group「{0}」\'s {1} Exported',
+        move: 'Do you want to move「{0}」?',
         moveGroup: 'Move Group',
-        moveRootGroupConfirm: 'Do you want move Group 「{0}」into root?',
+        moveRootGroupConfirm: 'Do you want to move Group 「{0}」into root?',
         moveRootSuccess: 'Move {0} Group 「{1}」into root Success',
         moveRootFailed: 'Failed to Move {0} Group「{1}」 into root',
         moveGroupSuccess: 'Move {0} Group 「{1}」 Success',

+ 2 - 0
src/scripts/i18n/zh-cn.js

@@ -51,6 +51,7 @@ export default {
         log: '日志',
         enable: '启用',
         variable: '变量信息',
+        move: '移动',
 
         switchLocale: '已切换至{0},刷新页面后生效,是否刷新?',
         loadClass: '加载classes信息...',
@@ -124,6 +125,7 @@ export default {
         deleteGroupSuccess: '删除{0}分组「{1}」成功',
         deleteGroupFailed: '删除{0}分组「{1}」失败',
         groupExport: '分组「{0}」相关{1}已导出',
+        move: '是否要移动「{0}」?',
         moveGroup: '移动分组',
         moveRootGroupConfirm: '是否要将分组「{0}」移动至根节点',
         moveRootSuccess: '移动{0}分组「{1}」至根节点成功',