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

View File

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

View File

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

View File

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

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>

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