diff --git a/src/views/homePage/components/tableMain.vue b/src/views/homePage/components/tableMain.vue index e44e912..c34df01 100644 --- a/src/views/homePage/components/tableMain.vue +++ b/src/views/homePage/components/tableMain.vue @@ -847,6 +847,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 选取文件 + + + + + @@ -912,6 +1002,9 @@ export default { yw_cmd_start_frpc: "开启frpc", yw_cmd_stop_frpc: "停止frpc", i1_cmd_stop_aging_test: "停止老化测试", + del_file: "删除文件", + upload_file: "上传文件", + download_file: "下发文件", }, taskdrawer: false, drawer: false, @@ -958,7 +1051,9 @@ export default { notecheck: false, lastIpcheck: false, //运维操作列表 - operateOptions:[], + operateOptions:[ + + ], formIssue: { operate: "", @@ -1106,6 +1201,52 @@ export default { }, newupdatatime: null, cellIndex: null, + + //设置删除文件 + deleteFileVisible: false, + delFileForm: { + delFile: "", + }, + delFileRules: { + delFile: [ + { + required: true, + message: "请输入文件路径", + trigger: "blur", + }, + ], + }, + //下载文件 + pullFileVisible: false, + pullFileForm: { + pullFile: "", + }, + pullFileRules: { + pullFile: [ + { + required: true, + message: "请输入文件路径", + trigger: "blur", + }, + ], + }, + //上传文件base64 + pushFileVisible:false, + fileList: [], + pushFileForm:{ + name:"", + fileData:"", + }, + pushFileRules: { + name: [ + { + required: true, + message: "请输入文件路径", + trigger: "blur", + }, + ], + }, + }; }, mounted() { @@ -1145,6 +1286,7 @@ export default { .then((res) => { console.log(res); this.operateOptions = res.data + //this.operateOptions = this.operateOptions.concat(res.data); }) .catch((err) => {}); }, @@ -1551,6 +1693,18 @@ export default { this.upgradationVisibleOta = true; this.getUpgradeOtaList(); return; + case 12: + console.log("删除文件"); + this.deleteFileVisible = true; + return; + case 13: + console.log("上传文件base64"); + this.pullFileVisible = true; + return; + case 14: + console.log("下载文件base64"); + this.pushFileVisible = true; + return; } }, //执行操作 @@ -1714,6 +1868,84 @@ export default { }); }, + //删除文件 + handleDelete(){ + console.log(this.$refs.delFileFormref); + this.$refs.delFileFormref.validate((valid) => { + if (valid) { + var params = { + action:"del_file", + path: this.delFileForm.delFile, + termIds: this.idArray, + }; + console.log(params) + this.changeIssue(params); + this.deleteFileVisible = false; + } + }); + }, + //下载文件 + handlePull(){ + console.log(this.$refs.pullFileFormref); + this.$refs.pullFileFormref.validate((valid) => { + if (valid) { + var params = { + action:"upload_file", + path: this.pullFileForm.pullFile, + termIds: this.idArray, + }; + console.log(params) + this.changeIssue(params); + this.pullFileVisible = false; + } + }); + }, + + //上传文件 + beforeUpload(file) { + console.log(file) + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = (e) => { + console.log("asdasdad",e) + this.pushFileForm.fileData = e.target.result; // Base64 编码的数据 + const base64Index = this.pushFileForm.fileData.indexOf('base64,'); + if (base64Index > 0) { + // 提取base64编码部分 + const base64Data = this.pushFileForm.fileData.substring(base64Index + 7); // 7 是 "base64," 的长度 + this.pushFileForm.fileData = base64Data; // 保存Base64编码部分 + this.sendToBackend(this.pushFileForm.fileData); + resolve(true); + } else { + // 如果找不到"base64,",则可能不是预期的格式 + reject(new Error('Invalid data URL format')); + } + }; + reader.onerror = error => { + reject(error); + }; + }); + }, + sendToBackend(base64Data){ + this.$refs.pushFileFormref.validate((valid) => { + if (valid) { + var params = { + action:"download_file", + path: this.pushFileForm.name, + content:base64Data, + termIds: this.idArray, + }; + console.log(params) + this.changeIssue(params); + this.pushFileVisible = false; + } + }); + }, + handlePush(){ + this.$refs.upload.submit(); + }, + saveLocalStorage() { localStorage.setItem("gycheck", this.gycheck); localStorage.setItem("dccheck", this.dccheck); @@ -2203,6 +2435,42 @@ export default { font-weight: normal; } } + .pushBoxDialog{ + .el-dialog__body{ + height: 172px; + } + .upload-demo { + position: absolute; + display: flex; + flex-direction: row-reverse; + margin-right: 65px; + top: 36px; + .el-upload-list { + width: 320px; + height: 32px; + line-height: 32px; + border: 1px solid #ddd; + margin-right: 12px; + border-radius: 4px; + .el-upload-list__item { + transition: none; + font-size: 14px; + color: #606266; + position: relative; + box-sizing: border-box; + border-radius: 4px; + width: 100%; + height: 32px; + line-height: 32px; + margin-top: 0px !important; + .el-icon-close { + top: 10px; + } + } + } + } + + } } .contenBoxMsg { p { @@ -2217,5 +2485,6 @@ export default { font-size: 12px; font-style: normal; } + } diff --git a/src/views/logList/index.vue b/src/views/logList/index.vue index 1436425..83570e2 100644 --- a/src/views/logList/index.vue +++ b/src/views/logList/index.vue @@ -1,6 +1,16 @@