From 850af610b190eeabbd05eba3291fe359775676af Mon Sep 17 00:00:00 2001 From: he wei <858544502@qq.com> Date: 星期三, 09 四月 2025 15:45:25 +0800 Subject: [PATCH] U 定制版本打包配置等 --- src/components/contextMenu.vue | 91 +++++++++++++++++++++++++-------------------- 1 files changed, 50 insertions(+), 41 deletions(-) diff --git a/src/components/contextMenu.vue b/src/components/contextMenu.vue index 1b15dec..a286380 100644 --- a/src/components/contextMenu.vue +++ b/src/components/contextMenu.vue @@ -44,15 +44,15 @@ append-to-body width="30%" > - <el-input v-model="stationName" placeholder="璇疯緭鍏�..."></el-input> + <el-input v-model="stationName" :placeholder="$t('form.inputMsg')"></el-input> <span slot="footer" class="dialog-footer"> - <el-button @click="dialogVisible = false">鍙� 娑�</el-button> - <el-button type="primary" @click="stationNameOk">纭� 瀹�</el-button> + <el-button @click="dialogVisible = false">{{ $t('operate.cancel') }}</el-button> + <el-button type="primary" @click="stationNameOk">{{ $t('operate.ok') }}</el-button> </span> </el-dialog> <!-- 鏂囦欢灞炴�� --> <el-dialog - title="灞炴��" + :title="$t('Properties')" class="file-info" :visible.sync="fileInfoVisible" append-to-body @@ -74,6 +74,10 @@ <script> import FileInfo from "@/components/fileInfo"; +import i18n from './i18n/contextMenu'; +import { createI18nOption } from '@/assets/js/tools/i18n'; + +const i18nMixin = createI18nOption(i18n); import { addStation, addFileInStation, @@ -85,6 +89,7 @@ } from "@/apis"; export default { name: "ContextMenu", + mixins: [i18nMixin], model: { prop: "visible", event: "change", @@ -112,26 +117,26 @@ const menuList = [ { id: 0, - title: "鎵撳紑鏂囦欢", + title: this.$t('OpenFile'), method: "openFile", disabled: false, visible: false, }, { id: 1, - title: "鏂板缓", + title: this.$t('New'), disabled: false, visible: false, children: [ { id: 11, - title: "鏂板缓鏍规枃浠�", + title: this.$t('NewRootFile'), method: "addRootStation", disabled: false, }, { id: 12, - title: "鏂板缓瀛愭枃浠�", + title: this.$t('NewSubFile'), method: "addSubStation", disabled: false, }, @@ -139,19 +144,19 @@ }, { id: 2, - title: "娣诲姞", + title: this.$t('New1'), disabled: false, visible: false, children: [ { id: 13, - title: "鎸囧畾鐩綍涓嬫墍鏈夋枃浠�", + title: this.$t('Allfilesinthespecifieddirectory'), method: "selectDir", disabled: false, }, { id: 14, - title: "鍗曚竴鏂囦欢", + title: this.$t('SingleFile'), method: "selectFile", disabled: false, }, @@ -159,14 +164,14 @@ }, { id: 3, - title: "閲嶅懡鍚�", + title: this.$t('Rename'), method: "rename", disabled: false, visible: false, }, { id: 4, - title: "鍒犻櫎", + title: this.$t('Delete'), method: "deleteItem", disabled: false, visible: false, @@ -177,13 +182,13 @@ dialogTitle: "", dialogVisible: false, stationName: "", - // 鎿嶄綔绫诲瀷 'rename', 'add' type: "", fileInfoVisible: false, fileData: {}, currFile: { name: "", - url: "", + // url: "", + stationId: 0, fileId: undefined, }, }; @@ -235,18 +240,19 @@ }); }, openFile() { - let { url, fileId, label } = this.contextData; + let { fileId, label, stationId } = this.contextData; getParamByFileId(fileId).then((res) => { const { code, data, data2 } = res.data; if (code && data) { // console.log(data2); this.fileData = data2; this.currFile.name = label; - this.currFile.url = url; + // this.currFile.url = url; + this.currFile.stationId = stationId; this.currFile.fileId = fileId; this.fileInfoVisible = true; } else { - this.$message.error("鏂囦欢瑙f瀽澶辫触"); + this.$message.error(this.$t('FileParsingFailed')); } }); }, @@ -276,20 +282,20 @@ // console.log(this.menuList, this.disabledList, 9090); }, addRootStation() { - this.dialogTitle = "鏂板缓鏍规枃浠跺悕绉�"; + this.dialogTitle = this.$t('NewRootFileName'); this.stationName = ""; this.type = "add"; this.dialogVisible = true; }, addSubStation() { - this.dialogTitle = "鏂板缓瀛愭枃浠跺悕绉�"; + this.dialogTitle = this.$t('NewSubFileName'); this.stationName = ""; this.type = "add"; this.dialogVisible = true; }, stationNameOk() { if ("" == this.stationName.trim()) { - this.$message.error("鍚嶇О涓嶈兘涓虹┖"); + this.$message.error(this.$t('Thenamecannotbeblank')); return false; } if (this.type == "add") { @@ -319,10 +325,10 @@ const { code, data } = res.data; if (code && data) { this.dialogVisible = false; - this.$message.success("娣诲姞鎴愬姛"); + this.$message.success(this.$t('AddSuccessfully')); this.reload(); } else { - this.$message.error("鎿嶄綔澶辫触"); + this.$message.error(this.$t('OperationFailed')); } }); }, @@ -333,12 +339,14 @@ window.api.send("open-file-dialog", "ContextMenu"); }, addFileInStation(path) { - let { label, parent } = this.contextData; + let { label, parent, children } = this.contextData; + let fileId = children[0] ? children[0].fileId : 0; parent = parent.map((v) => v); parent.push(label); const params = { FilePath: path, stationName: parent.join("-"), + fileId }; addFileInStation(params).then((res) => { const { code, data, data2 } = res.data; @@ -352,17 +360,17 @@ deleteItem() { let { label, parent, level } = this.contextData; if (level == 3) { - this.$confirm("姝ゆ搷浣滃皢浠庣珯鐐圭Щ闄よ鏂囦欢, 鏄惁缁х画?", "鎻愮ず", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", + this.$confirm(this.$t('Thefilewillberemovedfromthesitewhethertocontinue'), this.$t('Note'), { + confirmButtonText: this.$t('operate.ok'), + cancelButtonText: this.$t('operate.cancel'), type: "warning", }).then(() => { this.deleteFile(); }); } else { - this.$confirm("姝ゆ搷浣滃皢鍒犻櫎璇ョ珯鐐�, 鏄惁缁х画?", "鎻愮ず", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", + this.$confirm(this.$t('Thesitewillbedeletedcontinuetheoperation'), this.$t('Note'), { + confirmButtonText: this.$t('operate.ok'), + cancelButtonText: this.$t('operate.cancel'), type: "warning", }).then(() => { this.deleteStation(); @@ -395,25 +403,25 @@ }); }, deleteFile() { - let { label, parent, url } = this.contextData; + let { fileId, parent } = this.contextData; parent = parent.map((v) => v); let params = { stationName: parent.join("-"), - FilePath: url, + fileId, }; delFileFromStation(params).then((res) => { const { code, data, data2 } = res.data; if (code && data) { - this.$message.success("鎿嶄綔鎴愬姛"); + this.$message.success(this.$t('OperationSuccessfully')); this.reload(); } else { - this.$message.error("鎿嶄綔澶辫触"); + this.$message.error(this.$t('OperationFailed')); } }); }, // 閲嶅懡鍚嶇幇鍙拡瀵瑰彴绔� 锛堟枃浠舵槸鍚﹂噸鍛藉悕闇�瑕佺‘璁ら渶姹�) rename() { - this.dialogTitle = "淇敼绔欑偣鍚嶇О"; + this.dialogTitle = this.$t('ModifySiteName'); this.stationName = this.contextData.label; this.type = "rename"; this.dialogVisible = true; @@ -443,10 +451,10 @@ const { code, data } = res.data; if (code && data) { this.dialogVisible = false; - this.$message.success("鎿嶄綔鎴愬姛"); + this.$message.success(this.$t('OperationSuccessfully')); this.reload(); } else { - this.$message.error("鎿嶄綔澶辫触"); + this.$message.error(this.$t('OperationFailed')); } }); }, @@ -455,12 +463,12 @@ }, editOk(data) { this.fileInfoVisible = false; - updateFileParam(this.currFile.fileId, data).then((res) => { + updateFileParam(this.currFile.stationId, data).then((res) => { const { code, data } = res.data; if (code && data) { - this.$message.success('淇敼鎴愬姛'); + this.$message.success(this.$t('ModifySuccessfully')); } else { - this.$message.error('淇敼澶辫触'); + this.$message.error(this.$t('ModifyFailed')); } }); this.toRes(); @@ -470,12 +478,13 @@ this.toRes(); }, toRes() { - const { name, url, fileId } = this.currFile; + const { name, url, fileId, stationId } = this.currFile; // debugger; this.$router.push({ path: "/result/" + name, query: { url, + stationId, fileId, }, }); -- Gitblit v1.9.1