修改测试用例1

This commit is contained in:
guanj
2026-01-12 11:06:54 +08:00
parent 08afdddc51
commit e9d7231a75
16 changed files with 923 additions and 822 deletions

View File

@@ -51,7 +51,7 @@
</template>
</TableHeader>
<Table ref="tableRef" />
<PopupDictionary ref="popupDictionary" v-if="show" @close="show=false"></PopupDictionary>
<PopupDictionary ref="popupDictionary" v-if="show" @close="show = false"></PopupDictionary>
</div>
</template>
<script setup lang="ts">
@@ -90,7 +90,20 @@ const tableStore = new TableStore({
{ title: '别名', field: 'otherName', minWidth: 220 },
{ title: '展示名称', field: 'showName', minWidth: 170 },
{ title: '告警码', field: 'defaultValue', minWidth: 170 },
{ title: '相别', field: 'phaseName', minWidth: 80 },
{
title: '相别',
field: 'phase',
minWidth: 80,
formatter: (row: any) => {
return row.cellValue
? row.cellValue == '/'
? '/'
: row.cellValue == 'M'
? '无相别'
: row.cellValue + '相'
: '/'
}
},
{ title: '单位', field: 'unit', minWidth: 80 },
{ title: '基础数据类型', field: 'type', minWidth: 170 },
{ title: '数据谐波次数', field: 'harmStartEnd', minWidth: 170 },
@@ -143,7 +156,7 @@ const tableStore = new TableStore({
tableStore.table.data.forEach((item: any) => {
item.classIdName = DataSelect.find((child: any) => child.id == item.classId)?.name || '/'
item.resourcesIdName = ResourcesIdSelect.find((child: any) => child.id == item.resourcesId)?.name || '/'
item.phaseName = item.phase === 'M' ? '/' : item.phase || '/'
// item.phaseName = item.phase === 'M' ? '无相别' : item.phase || '/'
item.harmStartEnd = item.harmEnd ? item.harmStart + '-' + item.harmEnd : '/'
for (let key in item) {
if (typeof item[key] !== 'number') {

View File

@@ -61,7 +61,7 @@
placeholder="请输入单位"
></el-input>
</el-form-item>
<el-form-item label="基础数据类型:" >
<el-form-item label="基础数据类型:">
<el-input
maxlength="32"
show-word-limit
@@ -284,7 +284,23 @@ const phaseSelect = [
{
name: 'T相',
id: 'T'
}
},
{
name: 'AB相',
id: 'AB'
},
{
name: 'BC相',
id: 'BC'
},
{
name: 'CA相',
id: 'CA'
},
{
name: '无相别',
id: 'M'
},
]
const StatMethodSelect = [
{
@@ -372,8 +388,8 @@ const open = (text: string, data?: anyObj) => {
if (data) {
for (let key in form) {
if (key == 'statMethod') {
form[key] = data[key].split(',')
} else {
form[key] = data[key] == '/' ? [] : data[key].split(',')
} else {
form[key] = data[key] === '/' ? null : data[key]
}
}

View File

@@ -88,7 +88,7 @@
></el-input>
</el-form-item>
</el-form>
<el-form :model="form" label-width="100px" class="mt10 form-one" >
<el-form :model="form" label-width="100px" class="mt10 form-one">
<el-form-item label="描述:" prop="description">
<el-input
maxlength="300"
@@ -103,6 +103,7 @@
<el-form-item label="升级文件:" prop="file">
<el-upload
:limit="1"
accept=".bin"
:auto-upload="false"
:on-change="fileChange"
:on-exceed="fileExceed"
@@ -212,12 +213,27 @@ const formDevModelOptionsFilter = computed(() => {
})
})
const fileChange = (e: any) => {
if (!beforeUpload(e.raw)) return
form.file = e.raw
fileList.value = [e.raw]
}
const fileExceed = (e: any) => {
ElMessage.error('只能上传一个文件')
}
// 处理上传前检查
const beforeUpload = (file: any) => {
const isWord = file.name.endsWith('.bin')
if (!isWord) {
ElMessage.error('请上传(.bin)格式文件!')
fileList.value = []
return false
}
// 校验通过后允许上传,交由 http-request 处理
return true
}
const fileRemove = (e: any) => {
form.file = null
fileList.value = []

View File

@@ -33,7 +33,7 @@ import { useDictData } from '@/stores/dictData'
import PopupVersion from '@/views/govern/manage/basic/popupVersion.vue'
import { Plus } from '@element-plus/icons-vue'
import { auditEdData } from '@/api/cs-device-boot/edData'
import { getFileUrl, downLoadFile } from '@/api/cs-system-boot/manage'
defineOptions({
name: 'govern/manage/basic/version'
})
@@ -72,6 +72,16 @@ const tableStore = new TableStore({
width: '180',
render: 'buttons',
buttons: [
{
name: 'productSetting',
title: '下载文件',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
click: row => {
downloadTheReport(row.filePath)
}
},
{
name: 'edit',
title: '编辑',
@@ -151,11 +161,30 @@ queryByCode('Device_Type').then(res => {
res1.data.splice(index, 1)
}
})
console.log('🚀 ~ res1.data.map ~ res1.data:', res1.data)
DevTypeOptions.value = res1.data
})
})
// 下载报告
const downloadTheReport = (name: string) => {
getFileUrl(name).then((res: any) => {
downLoadFile(res.data).then(res => {
let blob = new Blob([res], {
type: 'application/octet-stream'
})
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = name.split('/').pop() || '升级文件' // 设置下载的文件名
document.body.appendChild(link)
link.click() //执行下载
document.body.removeChild(link)
ElMessage.success('下载成功')
})
})
}
tableStore.table.params.devType = ''
provide('tableStore', tableStore)
onMounted(() => {