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

@@ -1017,7 +1017,7 @@ export default defineComponent({
height: 0; height: 0;
padding: 0; padding: 0;
overflow: hidden; overflow: hidden;
font-size: 14px; font-size: 16px;
line-height: 1; line-height: 1;
visibility: hidden; visibility: hidden;
opacity: 0; opacity: 0;
@@ -1034,8 +1034,8 @@ export default defineComponent({
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 20px; width: 23px;
height: 20px; height: 23px;
overflow: hidden; overflow: hidden;
&--arr { &--arr {
@@ -1163,8 +1163,9 @@ export default defineComponent({
} }
&--append { &--append {
font-size: 60%; font-size: 80%;
opacity: 0.6; opacity: 0.7;
padding-top: 5px;
} }
} }
} }

View File

@@ -41,7 +41,7 @@ const imgs = ref([])
const uploadConfig = reactive({ const uploadConfig = reactive({
baseURL: getBaseUrl(), baseURL: getBaseUrl(),
imgBaseURL: getImgBaseUrl(), imgBaseURL: getImgBaseUrl(),
header: { 'X-Access-Token': uni.getStorageSync('token') } header: { Authorization: 'Bearer ' + uni.getStorageSync('token') }
}) })
// 同步外部值到组件 // 同步外部值到组件
@@ -50,10 +50,12 @@ watch(
newVal => { newVal => {
if (!newVal) return (fileList.value = []) if (!newVal) return (fileList.value = [])
const urls = Array.isArray(newVal) ? newVal : newVal.split(',') const urls = Array.isArray(newVal) ? newVal : newVal.split(',')
imgs.value = urls imgs.value = urls.map(url => url.previewUrl)
fileList.value = urls.map(url => ({ fileList.value = urls.map(url => ({
url: uploadConfig.imgBaseURL + url, url: url.url,
status: 'success', status: 'success',
name: url.name,
id: url.id,
message: '' message: ''
})) }))
}, },
@@ -82,10 +84,13 @@ const afterRead = async event => {
for (let i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
const result = await uploadFile(files[i]) const result = await uploadFile(files[i])
const index = initialLength + i const index = initialLength + i
console.log(files[i])
fileList.value[index] = { fileList.value[index] = {
...files[i],
status: 'success', status: 'success',
url: uploadConfig.imgBaseURL + result.message url: result.url,
name: result.name,
id: result.id
} }
} }
} catch (error) { } catch (error) {
@@ -100,14 +105,19 @@ const afterRead = async event => {
const uploadFile = file => { const uploadFile = file => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.uploadFile({ uni.uploadFile({
url: `${uploadConfig.baseURL}/sys/common/upload`, url: `${uploadConfig.baseURL}/infra/file/upload-with-return`,
filePath: file.url, filePath: file.url,
name: 'file', name: 'file',
header: uploadConfig.header, header: uploadConfig.header,
formData: { biz: 'lims-device' }, formData: { encrypt: false },
success: res => { success: res => {
if (res.statusCode === 200) { if (res.statusCode === 200) {
resolve(JSON.parse(res.data)) let result = JSON.parse(res.data)
if (result.code === 0) {
resolve(result.data)
} else {
reject(new Error(result.msg))
}
} else { } else {
reject(new Error(res.data)) reject(new Error(res.data))
} }
@@ -125,7 +135,7 @@ const formatValue = fileList => {
: fileList.map(item => item.url.slice(baseUrlLength)) : fileList.map(item => item.url.slice(baseUrlLength))
} }
const updateParent = fileList => { const updateParent = fileList => {
emit('update:modelValue', formatValue(fileList)) emit('update:modelValue', fileList)
} }
</script> </script>

View File

@@ -7,7 +7,7 @@ export function useListData({ searchParams, api, needInitListData = false, proce
const loadingData = ref(true) const loadingData = ref(true)
const pageParams = reactive({ const pageParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 15 pageSize: 20
}) })
const total = ref(0) const total = ref(0)
const loadStatus = ref('loadmore') const loadStatus = ref('loadmore')

View File

@@ -344,6 +344,13 @@
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{
"path": "pages/material/openMark/index",
"style": {
"navigationBarTitleText": "试剂开封",
"navigationStyle": "custom"
}
},
{ {
"path": "pages/setting/UrlConfig", "path": "pages/setting/UrlConfig",
"style": { "style": {

View File

@@ -1,4 +1,5 @@
import { ref, reactive } from 'vue' import { ref, reactive } from 'vue'
import nx from '@/nx'
export const detailSchema = [ export const detailSchema = [
{ label: '设备名称', value: 'deviceName' }, { label: '设备名称', value: 'deviceName' },
{ label: '别名', value: 'alias' }, { label: '别名', value: 'alias' },
@@ -11,12 +12,13 @@ export const column = reactive([
{ {
label: '点检人', label: '点检人',
name: 'checkUserName', name: 'checkUserName',
width: 160 width: 200
}, },
{ {
label: '点检日期', label: '点检日期',
name: 'checkDate', name: 'checkDate',
width: 180 width: 200,
formatter: true
}, },
{ {
label: '备注', label: '备注',
@@ -30,3 +32,11 @@ export const column = reactive([
renders: [{ name: '详情', func: 'detail' }] 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> <template>
<view> <view>
<up-sticky v-if="!isComponent"> <up-sticky v-if="!isComponent">
<navbar-back title="检记录"> </navbar-back> <navbar-back title="检记录"> </navbar-back>
</up-sticky> </up-sticky>
<uni-card spacing="0"> <uni-card spacing="0">
<uni-section v-if="!isComponent" titleFontSize="20px" type="line" :title="deviceText"> </uni-section> <uni-section v-if="!isComponent" titleFontSize="20px" type="line" :title="deviceText"> </uni-section>
@@ -15,6 +15,7 @@
:cellStyle="setCellStyle" :cellStyle="setCellStyle"
:cellHeaderStyle="setCellHeaderStyle" :cellHeaderStyle="setCellHeaderStyle"
:data="listData" :data="listData"
:formatter="columnFormatter"
@detail="handleDetail" @detail="handleDetail"
@pullUpLoading="pullUpLoadingAction" @pullUpLoading="pullUpLoadingAction"
></zb-table> ></zb-table>
@@ -31,7 +32,7 @@ import { setCellHeaderStyle, setCellStyle } from '@/nx/config/zbTable'
import DailyCheckDetailPopup from './detail.vue' import DailyCheckDetailPopup from './detail.vue'
import dailyCheckApi from '@/nx/api/dailyCheck' import dailyCheckApi from '@/nx/api/dailyCheck'
import { useListData } from '@/nx/hooks/usePageListData' import { useListData } from '@/nx/hooks/usePageListData'
import { column } from './dailyCheck.data' import { column, columnFormatter } from './dailyCheck.data'
import nx from '@/nx' import nx from '@/nx'
let props = defineProps({ let props = defineProps({
isComponent: { isComponent: {

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More