Files
admin-govern/src/views/govern/device/control/testItemRecords.vue

115 lines
4.1 KiB
Vue
Raw Normal View History

2024-11-27 16:01:08 +08:00
<template>
2024-12-11 11:33:44 +08:00
<!-- 测试项日志 -->
2024-11-27 16:01:08 +08:00
<div :style="{ height: height }">
<vxe-table height="auto" auto-resize :data="dataList" v-bind="defaultAttribute" :key="key">
<vxe-column v-for="item in column" :field="item.field" :title="item.title" :formatter="formatter"
2024-12-11 11:33:44 +08:00
:min-width="item.width" :sortable="item.sortable"></vxe-column>
2024-11-27 16:01:08 +08:00
<vxe-column title="操作" fixed="right" width="100">
<template v-slot:default="scoped">
<el-button link type="danger" @click="remove(scoped.row)">删除</el-button>
</template>
</vxe-column>
</vxe-table>
</div>
</template>
<script setup lang='ts'>
import { mainHeight } from '@/utils/layout'
import { ref, reactive } from 'vue'
import { defaultAttribute } from '@/components/table/defaultAttribute'
import { ElMessageBox, ElMessage } from 'element-plus'
import { activateUser, deluser, passwordConfirm } from '@/api/user-boot/user'
import { useDictData } from '@/stores/dictData'
const dictData = useDictData()
const voltageLevelList: any = dictData.getBasicData('Dev_Voltage_Stand')
import { deleteItem } from '@/api/cs-device-boot/csGroup'
const volConTypeList = dictData.getBasicData('Dev_Connect')
const emit = defineEmits(['onSubmit'])
2024-12-11 11:33:44 +08:00
const height = mainHeight(295).height
2024-11-27 16:01:08 +08:00
const dataList = ref([])
const key: any = ref(0)
const column: any = ref([
2024-12-11 11:33:44 +08:00
{ field: 'startTime', title: '数据起始时间', width: '140px', sortable: true },
{ field: 'endTime', title: '数据结束时间', width: '140px', sortable: true },
{ field: 'itemName', title: '数据来源', width: '100px' },
2024-12-17 11:05:04 +08:00
{ field: 'statisticalInterval', title: '时间间隔(分钟)', width: '120px', },
{ field: 'voltageLevel', title: '电压等级', width: '100px', sortable: true },
{ field: 'volConType', title: ' 电压接线方式', width: '120px', sortable: true },
{
2024-12-17 20:57:07 +08:00
field: 'pt', title: 'PT', width: '100px',
2024-12-17 11:05:04 +08:00
},
2024-12-17 20:57:07 +08:00
{ field: 'ct', title: 'CT', width: '100px', },
2024-12-11 11:33:44 +08:00
{ field: 'capacitySi', title: '用户协议容量(MVA)', width: '140px', },
2024-12-17 11:05:04 +08:00
{ field: 'capacitySt', title: '供电设备容量(MVA)', width: '140px', },
2024-12-11 11:33:44 +08:00
{ field: 'capacitySscb', title: '基准短路容量(MVA)', width: '140px', },
{ field: 'capacitySscmin', title: '最小短路容量(MVA)', width: '140px', },
2024-12-17 11:05:04 +08:00
2024-12-11 11:33:44 +08:00
{ field: 'location', title: ' 测试位置', width: '100px', },
2024-12-17 11:05:04 +08:00
2024-11-27 16:01:08 +08:00
])
const setData = (data: any) => {
dataList.value = JSON.parse(JSON.stringify(data))
key.value += 1
}
const formatter = (row: any) => {
if (row.column.field == 'voltageLevel') {
return row.cellValue == null ? '/' : voltageLevelList.filter((item: any) => item.id == row.cellValue)[0]?.name
} else if (row.column.field == 'volConType') {
return row.cellValue == null ? '/' : volConTypeList.filter((item: any) => item.id == row.cellValue)[0]?.name
} else {
return row.cellValue == null ? '/' : row.cellValue
}
}
// 删除
const remove = (row: any) => {
ElMessageBox.prompt('二次校验密码确认', '', {
confirmButtonText: '确认',
cancelButtonText: '取消',
customClass: 'customInput',
2024-12-17 20:57:07 +08:00
inputType: 'text',
beforeClose: (action, instance, done) => {
if (action === 'confirm') {
if (instance.inputValue == null) {
return ElMessage.warning('请输入密码')
} else if (instance.inputValue?.length > 32) {
return ElMessage.warning('密码长度不能超过32位,当前密码长度为' + instance.inputValue.length)
} else {
done();
}
} else {
done();
}
}
2024-11-27 16:01:08 +08:00
}).then(({ value }) => {
2024-12-17 20:57:07 +08:00
2024-11-27 16:01:08 +08:00
passwordConfirm(value).then(res => {
console.log('密码正确');
deleteItem({ id: row.id }).then(() => {
ElMessage.success('删除成功')
emit('onSubmit')
})
})
})
}
defineExpose({ setData })
</script>
<style lang="scss">
.customInput {
.el-input__inner {
-webkit-text-security: disc !important;
}
}
</style>