From 0713f074ed5212ebb883a38492fc510299cb9948 Mon Sep 17 00:00:00 2001
From: fanluyan <754122931@qq.com>
Date: Tue, 18 Jun 2024 08:26:20 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E6=B7=BB=E5=8A=A0=E6=8E=A8?=
=?UTF-8?q?=E9=80=81=E5=A4=A7=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../homePage/components/rowMsgDialog.vue | 15 ++
src/views/homePage/components/tableMain.vue | 200 +++++++++++++++++-
src/views/report/index.vue | 1 +
src/views/upgradation/index.vue | 49 ++++-
4 files changed, 258 insertions(+), 7 deletions(-)
diff --git a/src/views/homePage/components/rowMsgDialog.vue b/src/views/homePage/components/rowMsgDialog.vue
index 1a45478..5695476 100644
--- a/src/views/homePage/components/rowMsgDialog.vue
+++ b/src/views/homePage/components/rowMsgDialog.vue
@@ -6,6 +6,13 @@
:close-on-click-modal="false"
>
+
刷新
+
+ -
+ {{ item.desc }}{{ item.name }}
+
+
确 定
+
+
+
+
+
+
+
+ -
+ {{ item.desc }}{{ item.name }}
+
+
+
+
+
+ {{ item.fileName }}
+ ({{ item.title }}{{ item.createTime }})
+
+
+
+
+
+
@@ -1062,6 +1113,7 @@ export default {
del_file: "删除文件",
pull_files: "拉取文件",
push_file: "推送文件",
+ dl_file: "推送大文件",
},
taskdrawer: false,
drawer: false,
@@ -1190,6 +1242,30 @@ export default {
},
selectUpObjOta: {},
upOptionsOta: [],
+ //上传大文件
+ //升级
+ configVisible: false,
+ configform: {
+ upVal: "",
+ pathVal: "",
+ },
+ bigpathOption: [
+ {
+ name: "/sdcard/com.xypower.mpapp/data/recog/rp.dat",
+ desc: "AI识别文件",
+ },
+ {
+ name: "/sdcard/com.xypower.mpapp/data/recog/rb.dat",
+ desc: "AI识别文件",
+ },
+ ],
+ selectconfigObj: {},
+ configRules: {
+ upVal: [
+ { required: true, message: "请选择升级文件", trigger: "change" },
+ ],
+ },
+ configOptions: [],
//设置frpc服务器
frpcVisible: false,
frpcform: {
@@ -1286,6 +1362,48 @@ export default {
},
],
},
+ pathOption: [
+ {
+ name: "/sdcard/com.xypower.mpapp/data/App.json",
+ desc: "MpAPP全局配置",
+ },
+ {
+ name: "/sdcard/com.xypower.mpapp/data/recog.json",
+ desc: "AI全局配置",
+ },
+ {
+ name: "/sdcard/com.xypower.mpapp/data/bc.json",
+ desc: "电压电量配置",
+ },
+ {
+ name: "/sdcard/com.xypower.mpapp/data/channels/1.json",
+ desc: "通道拍照配置",
+ },
+ {
+ name: "/sdcard/com.xypower.mpapp/data/channels/2.json",
+ desc: "通道拍照配置",
+ },
+ {
+ name: "/sdcard/com.xypower.mpapp/data/imgparams/1",
+ desc: "图像参数配置",
+ },
+ {
+ name: "/sdcard/com.xypower.mpapp/data/imgparams/2",
+ desc: "图像参数配置",
+ },
+ {
+ name: "/sdcard/com.xypower.mpapp/data/videoparams/1",
+ desc: "短视频参数配置",
+ },
+ {
+ name: "/sdcard/com.xypower.mpapp/data/videoparams/2",
+ desc: "短视频参数配置",
+ },
+ {
+ name: "/sdcard/com.xypower.mpapp/data/videoparams/78",
+ desc: "采样配置",
+ },
+ ],
//上传文件base64
pushFileVisible: false,
fileList: [],
@@ -1783,6 +1901,12 @@ export default {
console.log("下载文件base64");
this.pushFileVisible = true;
return;
+ case 15:
+ console.log("推送大文件");
+
+ this.configVisible = true;
+ this.getconfigList();
+ return;
}
},
//执行操作
@@ -1880,6 +2004,7 @@ export default {
});
console.log(this.selectUpObj);
},
+
//升级确定阿
handleupgradation() {
this.$refs.upgradationRuleForm.validate((valid) => {
@@ -1980,7 +2105,10 @@ export default {
}
});
},
-
+ handlePath(row) {
+ console.log(row);
+ this.pushFileForm.name = row.name;
+ },
//上传文件
beforeUpload(file) {
console.log(file);
@@ -2027,6 +2155,43 @@ export default {
handlePush() {
this.$refs.upload.submit();
},
+ //上传大文件
+ selectChangedconfig(val) {
+ console.log(val);
+ // 找到选中项的整个object对象
+ this.selectconfigObj = this.configOptions.find((item) => {
+ return item["path"] === val;
+ });
+ console.log(this.selectconfigObj);
+ },
+ getconfigList() {
+ upgradeListApi({ type: 3 })
+ .then((res) => {
+ console.log(res);
+ this.configOptions = res.data;
+ })
+ .catch((err) => {});
+ },
+ handlebigPath(row) {
+ console.log(row);
+ this.configform.pathVal = row.name;
+ },
+ handleconfig() {
+ this.$refs.configRuleForm.validate((valid) => {
+ if (valid) {
+ var params = {
+ action: "dl_file",
+ url: this.configform.upVal,
+ path: this.configform.pathVal,
+ md5: this.selectconfigObj.md5,
+ termIds: this.idArray,
+ };
+ console.log(params);
+ this.changeIssue(params);
+ this.configVisible = false;
+ }
+ });
+ },
saveLocalStorage() {
localStorage.setItem("gycheck", this.gycheck);
@@ -2523,7 +2688,18 @@ export default {
}
.pushBoxDialog {
.el-dialog__body {
- height: 172px;
+ height: auto;
+ ul {
+ li {
+ list-style: none;
+ font-size: 13px;
+ line-height: 22px;
+ cursor: pointer;
+ &:hover {
+ background-color: #b9e2dd;
+ }
+ }
+ }
}
.upload-demo {
position: absolute;
@@ -2556,6 +2732,20 @@ export default {
}
}
}
+ .configDialogBox {
+ ul {
+ margin-bottom: 12px;
+ li {
+ list-style: none;
+ font-size: 13px;
+ line-height: 22px;
+ cursor: pointer;
+ &:hover {
+ background-color: #b9e2dd;
+ }
+ }
+ }
+ }
}
.contenBoxMsg {
p {
diff --git a/src/views/report/index.vue b/src/views/report/index.vue
index fd696ca..4dc0ac9 100644
--- a/src/views/report/index.vue
+++ b/src/views/report/index.vue
@@ -199,6 +199,7 @@ export default {
del_file: "删除文件",
pull_files: "拉取文件",
push_file: "推送文件",
+ dl_file: "推送大文件",
},
cmdtimer: null,
endtimer: null,
diff --git a/src/views/upgradation/index.vue b/src/views/upgradation/index.vue
index f2f7c82..7d48af8 100644
--- a/src/views/upgradation/index.vue
+++ b/src/views/upgradation/index.vue
@@ -19,6 +19,7 @@
class="upload-demo"
ref="upload"
action="#"
+ :on-change="handleFileChange"
:before-upload="beforeUpload"
:http-request="customUpload"
:limit="1"
@@ -37,6 +38,7 @@
class="noteClass"
v-model="reportData.title"
placeholder="输入备注"
+ clearable
>
{{ scope.row.fileName }}
+
+
+ {{ scope.row.fileSize | changeType }}
+
+
@@ -80,6 +87,7 @@
>
+
@@ -154,6 +162,10 @@ export default {
value: 1,
label: "OTA",
},
+ {
+ value: 3,
+ label: "配置文件",
+ },
],
fileData: [], //数据列表
fileloading: false,
@@ -173,6 +185,16 @@ export default {
};
},
computed: {},
+ filters: {
+ changeType(val) {
+ if (val == "0") return "0B";
+ var k = 1024;
+ var sizes = ["B", "KB", "MB", "GB", "TB"];
+
+ let i = Math.floor(Math.log(val) / Math.log(k)); //得出该数字的单位应该是kB?MB
+ return (val / Math.pow(k, i)).toPrecision(3) + "" + sizes[i];
+ },
+ },
mounted() {
this.getUpgradeList();
},
@@ -183,7 +205,7 @@ export default {
// 创建一个新的a标签元素
const a = document.createElement("a");
// 设置a标签的href属性为文件的URL
- a.href = "/apk/" + row.path;
+ a.href = row.path;
console.log(a.href);
// 设置文件名(可选,取决于服务器配置)
a.download = row.fileName; // 你希望保存的文件名
@@ -205,9 +227,30 @@ export default {
// 显示上传进度
console.log(this.progress); // 或者你可以使用其他方式来显示进度,比如使用进度条组件等。
},
+ handleFileChange(file) {
+ const titleName = file.name;
+ console.log(titleName);
+ // 正则表达式检查文件名是否符合模式
+ const regex = /^(mpapp|MpMaster)_v\d+\.\d+(\.\d+)?_rel_\d{8}\.apk$/;
+
+ if (regex.test(titleName)) {
+ // 提取版本号(v后面的数字)
+ const versionMatch = titleName.match(/v(\d+\.\d+(\.\d+)?)/);
+ if (versionMatch && versionMatch[1]) {
+ // 构造新的文件名(去掉V和_rel_日期部分)
+ const baseName = titleName.startsWith("mpapp") ? "mpapp" : "mpmst"; // 注意:这里假设mpmaster应该改为mpmst
+ const version = versionMatch[1];
+ this.reportData.title = `${baseName}_v${version}`;
+ }
+ } else {
+ this.reportData.title = "";
+ }
+ console.log(this.reportData.title);
+ },
beforeUpload(file) {
const fileName = file.name;
console.log(fileName);
+
if (fileName.toLowerCase().includes("apk")) {
this.reportData.type = 0;
}
@@ -271,7 +314,9 @@ export default {
this.$refs.upload.clearFiles();
}
})
- .catch((error) => {});
+ .catch((error) => {
+ this.progressLoading = false;
+ });
},
getUpgradeList() {