升级添加推送大文件

jcbranch
fanluyan 1 year ago
parent d72d98b6e2
commit 0713f074ed

@ -6,6 +6,13 @@
:close-on-click-modal="false"
>
<div class="cmdBoxMain">
<el-button
type="primary"
icon="el-icon-refresh"
class="refresh"
@click="refresh"
>刷新</el-button
>
<el-table
:data="gridData"
style="width: 100%"
@ -190,6 +197,9 @@ export default {
return aString;
},
refresh() {
this.getQueryList();
},
getQueryList() {
this.girdloading = true;
this.gridData = [];
@ -233,6 +243,11 @@ export default {
align-items: center;
justify-items: center;
justify-content: center;
.refresh {
position: absolute;
top: 16px;
left: 110px;
}
.el-dialog {
width: 95%;
height: 83%;

@ -933,7 +933,7 @@
<!-- 下载文件 -->
<el-dialog
title="上传文件"
title="拉取文件"
:visible.sync="pullFileVisible"
:close-on-click-modal="false"
width="30%"
@ -960,10 +960,10 @@
<!-- 上传文件base64 -->
<el-dialog
class="pushBoxDialog"
title="下发文件"
title="推送文件"
:visible.sync="pushFileVisible"
:close-on-click-modal="false"
width="454px"
width="504px"
>
<el-form
:model="pushFileForm"
@ -973,6 +973,11 @@
<el-form-item label="文件路径:" prop="name">
<el-input v-model="pushFileForm.name"></el-input>
</el-form-item>
<ul>
<li v-for="(item, index) in pathOption" @click="handlePath(item)">
{{ item.desc }}{{ item.name }}
</li>
</ul>
<el-form-item label="文件上传:">
<el-upload
class="upload-demo"
@ -994,6 +999,52 @@
<el-button type="primary" @click="handlePush"> </el-button>
</div>
</el-dialog>
<!-- 上传大文件 -->
<el-dialog
class="configDialogBox"
title="请选择配置文件"
:visible.sync="configVisible"
:close-on-click-modal="false"
width="30%"
>
<el-form :model="configform" :rules="configRules" ref="configRuleForm">
<el-form-item label="文件路径:" prop="pathVal">
<el-input v-model="configform.pathVal"></el-input>
</el-form-item>
<ul>
<li
v-for="(item, index) in bigpathOption"
@click="handlebigPath(item)"
>
{{ item.desc }}{{ item.name }}
</li>
</ul>
<el-form-item label="文件名称" prop="upVal">
<el-select
v-model="configform.upVal"
placeholder="请选择文件"
@change="selectChangedconfig"
filterable
>
<el-option
v-for="item in configOptions"
:key="item.id"
:label="item.fileName"
:value="item.path"
:title="item.title"
>
{{ item.fileName }}
<i class="title">{{ item.title }}</i
><i class="time">{{ item.createTime }}</i>
</el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="configVisible = false"> </el-button>
<el-button type="primary" @click="handleconfig"> </el-button>
</div>
</el-dialog>
</div>
</template>
@ -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 {

@ -199,6 +199,7 @@ export default {
del_file: "删除文件",
pull_files: "拉取文件",
push_file: "推送文件",
dl_file: "推送大文件",
},
cmdtimer: null,
endtimer: null,

@ -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
></el-input>
<el-button
class="uploadBtn"
@ -73,6 +75,11 @@
<span> {{ scope.row.fileName }}</span>
</template>
</el-table-column>
<el-table-column prop="fileSize" label="文件大小">
<template slot-scope="scope">
{{ scope.row.fileSize | changeType }}
</template>
</el-table-column>
<el-table-column prop="path" label="文件路径">
<template slot-scope="scope">
<span @click="handleClick(scope.row)" class="buttonText">
@ -80,6 +87,7 @@
>
</template>
</el-table-column>
<el-table-column prop="title" label="备注"> </el-table-column>
<!-- <el-table-column prop="path" label="文件路径"> </el-table-column> -->
<el-table-column label="操作" width="300" class-name="editClass">
@ -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");
// ahrefURL
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"; // mpmastermpmst
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() {

Loading…
Cancel
Save