设备类型增加参数、说明、视频

This commit is contained in:
liub
2026-02-27 15:20:07 +08:00
parent 3231df14d9
commit 0ff3e4b1bc
6 changed files with 840 additions and 85 deletions

View File

@ -25,7 +25,7 @@
<el-collapse-item name="1">
<el-form ref="queryFormRef" :model="queryParams" :inline="true" class="queryFormRef">
<el-form-item label="设备类型" prop="deviceType">
<el-select v-model="queryParams.deviceType" placeholder="设备类型">
<el-select v-model="queryParams.deviceType" placeholder="设备类型" clearable filterable>
<el-option v-for="item in deviceTypeOptions" :key="item.value" :label="item.typeName" :value="item.deviceTypeId" />
</el-select>
</el-form-item>
@ -69,7 +69,7 @@
:data="List"
:height="Status.showSearch.length > 0 ? 'calc(100vh - 355px)' : 'calc(100vh - 255px)'"
>
<el-table-column type="selection" width="50" align="center" :selectable="isSelectable"/>
<el-table-column type="selection" width="50" align="center" :selectable="isSelectable" />
<el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="设备图片" align="center" prop="devicePic">
<template #default="scope">
@ -189,7 +189,7 @@
<div class="Preview">
<div class="imgContent" v-for="(item, index) in cEdit.fileParam">
<img class="img" :src="item.src" />
<div class="opt" @click.stop="DelImg(item,index,'fileParam')">
<div class="opt" @click.stop="DelImg(item, index, 'fileParam')">
<el-icon>
<Delete />
</el-icon>
@ -207,7 +207,14 @@
<div class="title">操作说明</div>
<div class="imgs">
<div class="Preview">
<img onerror="this.style.display='none'" v-for="(item, index) in cEdit.fileOprat" class="img" :src="item.src" />
<div class="imgContent" v-for="(item, index) in cEdit.fileOprat">
<img class="img" :src="item.src" />
<div class="opt" @click.stop="DelImg(item, index, 'fileOprat')">
<el-icon>
<Delete />
</el-icon>
</div>
</div>
</div>
</div>
<div class="option center" @click.stop="showCheckFile('fileOprat')">添加</div>
@ -231,8 +238,8 @@
<!-- 提示框 -->
<el-dialog :width="300" :draggable="true" v-model="Status.confirm.Visible" :title="Status.confirm.title" center>
<span>
{{ Status.confirm.text }}
<span v-html="Status.confirm.text">
</span>
<template #footer>
<div class="dialog-footer">
@ -248,7 +255,7 @@
import api from '@/api/debugCenter/debugCenter';
import common from '@/utils/common';
import apiTypeAll from '@/api/equipmentManagement/device/index';
import uploadHelper from '@/api/debugCenter/deviceApi';
import uploadHelper from '@/api/debugCenter/deviceApi';
var fileInput = document.getElementById('fileInput');
var fileInputs = {
@ -293,7 +300,7 @@ var cEdit = reactive({
fileParam: [],
fileOprat: [],
Video: '',
fileIds:[]
fileIds: []
});
//页码控件数据
var pagin = reactive({
@ -340,8 +347,7 @@ function handleQuery() {
const isSelectable = (row: any) => {
// 仅当在线状态onlineStatus == 1时允许选中
return row.onlineStatus === 1;
}
};
function getList() {
Status.loading = true;
@ -425,10 +431,11 @@ function ShowMultiEdit(type: MideaType) {
setTimeout(dragImgAddEvt, 500);
}
function ShowSingleEdit(item) {
Status.ShowEditPop = true;
//期待接口返回以下4个字段
cEdit.deviceId = item.id;
cEdit.deviceImei = item.deviceImei;
cEdit.Video = item.Video;
@ -454,7 +461,7 @@ function ShowSingleEdit(item) {
return v.fileType == 1;
})
.map((v) => {
return {id:v.id, name: v.fileName, type: '', size: '', src: v.fileUrl, file: null };
return { id: v.id, name: v.fileName, type: '', size: '', src: v.fileUrl, file: null };
});
cEdit.fileParam = arr
@ -462,7 +469,7 @@ function ShowSingleEdit(item) {
return v.fileType == 2;
})
.map((v) => {
return {id:v.id, name: v.fileName, type: '', size: '', src: v.fileUrl, file: null };
return { id: v.id, name: v.fileName, type: '', size: '', src: v.fileUrl, file: null };
});
cEdit.fileBoot.src = '';
@ -478,7 +485,7 @@ function CloseSingleEdit() {
cEdit.fileBoot = { name: '', type: '', size: '', src: '', file: null };
cEdit.fileOprat = [];
cEdit.fileParam = [];
cEdit.fileIds=[];
cEdit.fileIds = [];
}
//关闭上传框
@ -575,7 +582,7 @@ function updaeLogo(ids, file, deviceType?: number) {
}
const finalDeviceType = deviceType || realDeviceType;
const finalIds = Array.isArray(ids) ? ids : [ids];
const finalFile = file || checkFile.file || cEdit.fileBoot.file;
const finalFile = file || checkFile.file || cEdit.fileBoot.file;
if (!finalFile || finalIds.length === 0) {
return Promise.resolve({ code: 200, msg: '成功' });
}
@ -591,7 +598,7 @@ function SaveItemData() {
var formData = new FormData();
formData.append('deviceId', cEdit.deviceId);
formData.append('deviceImei', cEdit.deviceImei);
formData.append("fileIds",cEdit.fileIds);
formData.append('fileIds', cEdit.fileIds);
cEdit.fileParam.forEach((v) => {
if (v.file) {
@ -615,11 +622,20 @@ function SaveItemData() {
if (res[0].status == 'fulfilled' && res[1].status == 'fulfilled') {
if (res[0].value.code == 200 && res[1].value.code == 200) {
CloseSingleEdit();
alert('操作成功');
alert('<span class="green">操作成功</span>');
return;
}
}
alert('全部失败或部分失败');
if(res[0].status == 'fulfilled' && res[0].value.code == 200){
alert('<span class="green">产品参数、操作说明、操作视频保存成功</span><span class="red">开机画面保存失败</span>');
return;
}
if(res[1].status == 'fulfilled' && res[1].value.code == 200){
alert('<span class="red">产品参数、操作说明、操作视频保存失败</span><span class="green">开机画面保存成功</span>');
return;
}
alert('<span class="red">操作失败</span>');
})
.finally(() => {
Status.fullLoading = false;
@ -822,17 +838,15 @@ var hideConfirm = function () {
};
//删除某个图片
function DelImg(item,index,type){
if(item.id){
confirm('您确认删除吗?',()=>{
cEdit.fileIds.push(item.id);
cEdit[type].splice(index,1);
});
}else{
cEdit[type].splice(index,1);
}
function DelImg(item, index, type) {
if (item.id) {
confirm('您确认删除吗?', () => {
cEdit.fileIds.push(item.id);
cEdit[type].splice(index, 1);
});
} else {
cEdit[type].splice(index, 1);
}
}
onMounted(() => {
@ -1079,8 +1093,8 @@ onMounted(() => {
cursor: pointer;
color: #bd2b2b;
font-size: 30px;
text-align: center;
line-height: 90px;
text-align: center;
line-height: 90px;
}
.SingEditContent .item .imgContent:hover .opt {
display: block !important;
@ -1093,5 +1107,4 @@ onMounted(() => {
.red {
color: rgba(224, 52, 52, 1);
}
</style>