feat:设备管理

This commit is contained in:
houjunxiang
2026-03-09 17:53:33 +08:00
parent 9c88c45d66
commit 6004f6c032
19 changed files with 1196 additions and 1057 deletions

View File

@@ -1,4 +1,5 @@
import { ref, reactive } from 'vue'
import nx from '@/nx'
export const detailSchema = [
{ label: '设备名称', value: 'deviceName' },
{ label: '别名', value: 'alias' },
@@ -11,12 +12,13 @@ export const column = reactive([
{
label: '点检人',
name: 'checkUserName',
width: 160
width: 200
},
{
label: '点检日期',
name: 'checkDate',
width: 180
width: 200,
formatter: true
},
{
label: '备注',
@@ -30,3 +32,11 @@ export const column = reactive([
renders: [{ name: '详情', func: 'detail' }]
}
])
export function columnFormatter(row, column, rowIndex, columnIndex) {
// 判断是哪一列需要格式化
if (column.name === 'checkDate') {
return nx.$helper.formateToDateTime(row.checkDate)
}
// 对于不需要特殊格式化的列,返回原始值
return row[column.name]
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
<template>
<view>
<up-sticky v-if="!isComponent">
<navbar-back title="检记录"> </navbar-back>
<navbar-back title="检记录"> </navbar-back>
</up-sticky>
<uni-card spacing="0">
<uni-section v-if="!isComponent" titleFontSize="20px" type="line" :title="deviceText"> </uni-section>
@@ -15,6 +15,7 @@
:cellStyle="setCellStyle"
:cellHeaderStyle="setCellHeaderStyle"
:data="listData"
:formatter="columnFormatter"
@detail="handleDetail"
@pullUpLoading="pullUpLoadingAction"
></zb-table>
@@ -31,7 +32,7 @@ import { setCellHeaderStyle, setCellStyle } from '@/nx/config/zbTable'
import DailyCheckDetailPopup from './detail.vue'
import dailyCheckApi from '@/nx/api/dailyCheck'
import { useListData } from '@/nx/hooks/usePageListData'
import { column } from './dailyCheck.data'
import { column, columnFormatter } from './dailyCheck.data'
import nx from '@/nx'
let props = defineProps({
isComponent: {

View File

@@ -4,7 +4,7 @@ export function getColumn(isFold) {
{
label: '设备名称',
name: 'deviceName',
width: isFold ? 200 : 130
width: isFold ? 200 : 110
},
{
label: '别名',
@@ -14,13 +14,13 @@ export function getColumn(isFold) {
{
label: '设备状态',
name: 'stateShow',
width: isFold ? 120 : 90
width: isFold ? 120 : 100
},
{
label: '使用状态',
name: 'inUseFlag',
width: isFold ? 120 : 90
width: isFold ? 120 : 100
},
{
label: '规格型号',

View File

@@ -6,11 +6,11 @@
<up-row class="flex-wrap pt10 pl10" style="background-color: #f5f7fa">
<up-col class="mb8" :span="gridCol" v-for="(item, index) in detailSchema">
<view style="color: #666"
><span style="color: #333">{{ item.label }}</span>{{ detailInfo[item.value] }}</view
><span style="color: #333">{{ item.label }}</span>{{ deviceInfo[item.value] }}</view
>
</up-col>
</up-row>
<view class="pt5">
<view class="p10">
<up-row>
<up-col span="6">
<view
@@ -19,10 +19,10 @@
{{ detailInfo.checkUserName }}
</text>
</view>
<view class="pt5"
<view class="pt10"
>维护保养日期
<text style="color: #666">
{{ detailInfo.checkDate }}
{{ nx.$helper.formateToDateTime(detailInfo.checkDate) }}
</text>
</view>
</up-col>
@@ -73,8 +73,9 @@
import { ref, reactive, onMounted, watch, computed } from 'vue'
import { useGridCol } from '@/nx/hooks/useGridCol'
import dailyCheckApi from '@/nx/api/dailyCheck'
import { getDeviceBusInfoById } from '@/nx/api/deviceInfo'
import { getImgBaseUrl } from '@/defaultBaseUrl'
import nx from '@/nx'
const { gridCol } = useGridCol([700], [6, 4])
const props = defineProps({
show: {
@@ -113,12 +114,18 @@ async function getDetailInfo(id) {
const res = await dailyCheckApi.queryById(id)
detailInfo.value = res
}
const deviceInfo = ref({})
async function getDeviceInfo(id) {
const res = await getDeviceBusInfoById(id)
deviceInfo.value = res
}
const emit = defineEmits(['close', 'open'])
function handleClose() {
emit('close')
}
function handleOpen() {
getDetailInfo(props.checkInfo.id)
getDeviceInfo(props.checkInfo.deviceId)
}
</script>
@@ -139,4 +146,7 @@ function handleOpen() {
:deep(.uicon-close) {
font-size: 22px !important;
}
:deep(.u-popup__content__close--top-right) {
top: 30px;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -14,6 +14,7 @@
:columns="column"
:cellStyle="setCellStyle"
:cellHeaderStyle="setCellHeaderStyle"
:formatter="columnFormatter"
:data="listData"
@detail="handleDetail"
@pullUpLoading="pullUpLoadingAction"
@@ -47,7 +48,8 @@ const column = reactive([
{
label: '维护保养日期',
name: 'checkDate',
width: 300
width: 300,
formatter: true
},
{
name: 'operation',
@@ -56,7 +58,14 @@ const column = reactive([
renders: [{ name: '详情', func: 'detail' }]
}
])
function columnFormatter(row, column, rowIndex, columnIndex) {
// 判断是哪一列需要格式化
if (column.name === 'checkDate') {
return nx.$helper.formateToDateTime(row.checkDate)
}
// 对于不需要特殊格式化的列,返回原始值
return row[column.name]
}
const deviceId = ref('')
const deviceText = ref('')
onMounted(() => {

View File

@@ -65,11 +65,6 @@ const column = reactive([
width: 170,
formatter: true
},
{
label: '结束使用人',
name: 'userNameEnd',
width: 100
},
{
label: '结束时间',
name: 'useTimeEnd',
@@ -78,19 +73,23 @@ const column = reactive([
},
{
label: '使用前状态',
name: 'stateBefore'
name: 'stateBefore',
width: 110
},
{
label: '使用后状态',
name: 'stateAfter'
name: 'stateAfter',
width: 110
},
{
label: '温度(℃)',
name: 'temperature'
name: 'temperature',
width: 110
},
{
label: '湿度(%RH)',
name: 'humidity'
name: 'humidity',
width: 110
},
{
name: 'operation',

View File

@@ -1,6 +1,6 @@
<template>
<view>
<navbar-back title="实验室管理系统【设备管理】" :autoBack="false" leftIcon="" leftText="">
<navbar-back title="实验室管理系统【设备管理】" titleWidth="800" :autoBack="false" leftIcon="" leftText="">
<u-icon @click="popupShow = true" size="28" color="#FFF" name="setting-fill" />
</navbar-back>
<up-grid :col="gridCol" :border="false">