yh-i18n 2.3.2 → 2.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/language.vue +16 -15
- package/list.vue +23 -9
- package/package.json +1 -1
package/language.vue
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
split-button
|
|
4
4
|
class="language-dropdown"
|
|
5
5
|
trigger="click"
|
|
6
|
-
@command="setLang">
|
|
6
|
+
@command="(cmd) => { if (cmd !== 'link' && cmd !== 'switch') setLang(cmd) }">
|
|
7
7
|
{{ title }}
|
|
8
8
|
<template #dropdown>
|
|
9
9
|
<el-dropdown-menu>
|
|
@@ -12,23 +12,24 @@
|
|
|
12
12
|
:command="lo.value">
|
|
13
13
|
{{ lo.label }}
|
|
14
14
|
</el-dropdown-item>
|
|
15
|
+
<el-dropdown-item divided disabled v-if="isDev">
|
|
16
|
+
{{ct('翻译工具')}}
|
|
17
|
+
</el-dropdown-item>
|
|
18
|
+
<el-dropdown-item command="link" v-if="isDev">
|
|
19
|
+
<el-link type="warning" href="/#/translate">
|
|
20
|
+
{{ ct("翻译") }}
|
|
21
|
+
</el-link>
|
|
22
|
+
</el-dropdown-item>
|
|
23
|
+
<el-dropdown-item command="switch" v-if="isDev" @click.prevent>
|
|
24
|
+
<el-switch
|
|
25
|
+
:active-text="ct('收集')"
|
|
26
|
+
:inactive-text="ct('不收集')"
|
|
27
|
+
inline-prompt
|
|
28
|
+
v-model="isCollect" />
|
|
29
|
+
</el-dropdown-item>
|
|
15
30
|
</el-dropdown-menu>
|
|
16
31
|
</template>
|
|
17
32
|
</el-dropdown>
|
|
18
|
-
|
|
19
|
-
<el-link
|
|
20
|
-
v-if="isDev"
|
|
21
|
-
type="warning"
|
|
22
|
-
href="/#/translate">
|
|
23
|
-
{{ ct("翻译管理") }}
|
|
24
|
-
</el-link>
|
|
25
|
-
|
|
26
|
-
<el-switch
|
|
27
|
-
active-text="收集"
|
|
28
|
-
inactive-text="不收集"
|
|
29
|
-
inline-prompt
|
|
30
|
-
v-if="isDev"
|
|
31
|
-
v-model="isCollect"></el-switch>
|
|
32
33
|
</template>
|
|
33
34
|
|
|
34
35
|
<script setup>
|
package/list.vue
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div class="yh-i18n-list-container">
|
|
3
3
|
<div class="yh-i18n-list-actions">
|
|
4
4
|
<div class="yh-i18n-list-conditions">
|
|
5
|
-
<el-form inline>
|
|
5
|
+
<el-form inline @submit.prevent>
|
|
6
6
|
<el-form-item :label="ct('翻译键名')">
|
|
7
7
|
<el-input
|
|
8
8
|
v-model="listForm.name"
|
|
@@ -315,13 +315,14 @@ function saveOne() {
|
|
|
315
315
|
.then((res) => {
|
|
316
316
|
if (res?.data?.status === 200) {
|
|
317
317
|
ElMessage.success(res.data.msg);
|
|
318
|
-
if (
|
|
318
|
+
if (isAdd) {
|
|
319
319
|
dataList.value[formDataIndex.value] = {
|
|
320
320
|
...formData,
|
|
321
321
|
};
|
|
322
322
|
nextOne();
|
|
323
323
|
} else {
|
|
324
324
|
cancelForm();
|
|
325
|
+
getDataList();
|
|
325
326
|
}
|
|
326
327
|
} else {
|
|
327
328
|
ElMessage.error(res.data.msg);
|
|
@@ -360,18 +361,31 @@ function delMore() {
|
|
|
360
361
|
let loading = ElLoadingService({
|
|
361
362
|
text: '正在删除选中的翻译……',
|
|
362
363
|
});
|
|
364
|
+
let failCount = 0;
|
|
363
365
|
for (let i = 0; i < ids.length; i++) {
|
|
364
366
|
const id = ids[i];
|
|
365
367
|
loading.setText(`正在删除... ${i + 1}/${len}`);
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
368
|
+
try {
|
|
369
|
+
let res = await http.request({
|
|
370
|
+
url: deleteUrl,
|
|
371
|
+
method: 'POST',
|
|
372
|
+
data: {
|
|
373
|
+
id,
|
|
374
|
+
},
|
|
375
|
+
});
|
|
376
|
+
if (res?.data?.status !== 200) {
|
|
377
|
+
failCount++;
|
|
378
|
+
}
|
|
379
|
+
} catch {
|
|
380
|
+
failCount++;
|
|
381
|
+
}
|
|
373
382
|
}
|
|
374
383
|
loading.close();
|
|
384
|
+
if (failCount === 0) {
|
|
385
|
+
ElMessage.success(`成功删除 ${len} 条`);
|
|
386
|
+
} else {
|
|
387
|
+
ElMessage.warning(`删除 ${len - failCount}/${len} 条,失败 ${failCount} 条`);
|
|
388
|
+
}
|
|
375
389
|
getDataList();
|
|
376
390
|
}
|
|
377
391
|
});
|