| | |
| | | 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 |
| | |
| | | |
| | | <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, |
| | |
| | | } from "@/apis"; |
| | | export default { |
| | | name: "ContextMenu", |
| | | mixins: [i18nMixin], |
| | | model: { |
| | | prop: "visible", |
| | | event: "change", |
| | |
| | | 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, |
| | | }, |
| | |
| | | }, |
| | | { |
| | | 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, |
| | | }, |
| | |
| | | }, |
| | | { |
| | | 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, |
| | |
| | | dialogTitle: "", |
| | | dialogVisible: false, |
| | | stationName: "", |
| | | // 操作类型 'rename', 'add' |
| | | type: "", |
| | | fileInfoVisible: false, |
| | | fileData: {}, |
| | |
| | | this.currFile.fileId = fileId; |
| | | this.fileInfoVisible = true; |
| | | } else { |
| | | this.$message.error("文件解析失败"); |
| | | this.$message.error(this.$t('FileParsingFailed')); |
| | | } |
| | | }); |
| | | }, |
| | |
| | | // 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") { |
| | |
| | | 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')); |
| | | } |
| | | }); |
| | | }, |
| | |
| | | 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(); |
| | |
| | | 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; |
| | |
| | | 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')); |
| | | } |
| | | }); |
| | | }, |
| | |
| | | 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(); |