1
This commit is contained in:
86
pages/lims/deviceBusInfo/baseInfo.vue
Normal file
86
pages/lims/deviceBusInfo/baseInfo.vue
Normal file
@@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<up-sticky>
|
||||
<navbar-back :title="`(${deviceText})设备信息`"></navbar-back>
|
||||
</up-sticky>
|
||||
<up-tabs lineWidth="30" :list="tabs" @click="tabClick"></up-tabs>
|
||||
<scroll-view scroll-y="true" class="content">
|
||||
<BaseInfoCard v-if="activeIndex == 0" @getDeviceInfo="getDeviceInfo" />
|
||||
<AcceptDetail v-if="activeIndex == 1" />
|
||||
<DailyCheckList v-if="activeIndex == 2" isComponent />
|
||||
<MaintainList v-if="activeIndex == 3" isComponent />
|
||||
<UseRecordList v-if="activeIndex == 4" isComponent />
|
||||
<PeriodCheckList v-if="activeIndex == 5" />
|
||||
<CalibrationList v-if="activeIndex == 6" />
|
||||
<RepairList v-if="activeIndex == 7" />
|
||||
<BorrowList v-if="activeIndex == 8" />
|
||||
<GivebackList v-if="activeIndex == 9" />
|
||||
<StopList v-if="activeIndex == 10" />
|
||||
<DocumentList v-if="activeIndex == 11" />
|
||||
<ScrapInfo v-if="activeIndex == 12 && scrapFlag == 1" />
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import nx from '@/nx'
|
||||
import BaseInfoCard from '@/pages/lims/deviceBusInfo/baseInfoCard'
|
||||
import AcceptDetail from '@/pages/lims/accept/detail'
|
||||
import DailyCheckList from '@/pages/lims/deviceBusDailyCheck/list'
|
||||
import MaintainList from '@/pages/lims/deviceBusMaintain/list'
|
||||
import UseRecordList from '@/pages/lims/deviceBusUseRecord/list'
|
||||
import PeriodCheckList from '@/pages/lims/periodCheckList/index'
|
||||
import CalibrationList from '@/pages/lims/calibrationList/index'
|
||||
import RepairList from '@/pages/lims/repair/list'
|
||||
import BorrowList from '@/pages/lims/borrow/list'
|
||||
import GivebackList from '@/pages/lims/giveback/list'
|
||||
import StopList from '@/pages/lims/stop/list'
|
||||
import DocumentList from '@/pages/lims/documentList/index'
|
||||
import ScrapInfo from '@/pages/lims/scrap/detail'
|
||||
import { tabList } from './deviceBusInfo.data'
|
||||
|
||||
let activeIndex = ref(0)
|
||||
let deviceText = ref('')
|
||||
const detailId = ref('')
|
||||
|
||||
const { id, deviceName, scrapFlag } = nx.$store('biz').deviceInfo
|
||||
onMounted(() => {
|
||||
detailId.value = id
|
||||
})
|
||||
const getDeviceInfo = info => {
|
||||
deviceText.value = info.deviceName + (info.alias ? `[${info.alias}]` : '')
|
||||
}
|
||||
const tabs = computed(() => {
|
||||
return tabList.filter((item, index) => {
|
||||
if (scrapFlag != 1) {
|
||||
return item.name != '报废信息'
|
||||
} else {
|
||||
return item
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
function tabClick(e) {
|
||||
activeIndex.value = e.index
|
||||
if (activeIndex.value == 0) {
|
||||
getDeviceInfo()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.u-sticky {
|
||||
top: 0 !important;
|
||||
}
|
||||
.container {
|
||||
background-color: #f0f2f5;
|
||||
height: 100%;
|
||||
.content {
|
||||
height: 75vh;
|
||||
}
|
||||
}
|
||||
:deep(.u-tabs__wrapper__nav__item__text) {
|
||||
font-size: 18px;
|
||||
}
|
||||
</style>
|
||||
119
pages/lims/deviceBusInfo/baseInfoCard.vue
Normal file
119
pages/lims/deviceBusInfo/baseInfoCard.vue
Normal file
@@ -0,0 +1,119 @@
|
||||
<template>
|
||||
<uni-card spacing="0">
|
||||
<view class="detail-content">
|
||||
<up-row align="top">
|
||||
<template v-for="item in deviceSchema">
|
||||
<up-col :span="item.span ? item.span : 4">
|
||||
<view class="x-f detail-item" :style="item.itemStyle">
|
||||
<view class="detail-label" :style="item.labelStyle">{{ item.label }}:</view>
|
||||
<template v-if="item.field == 'photo'">
|
||||
<view style="height: 50px">
|
||||
<up-album multipleSize="50" singleSize="50" maxCount="2" :urls="imgs"></up-album>
|
||||
</view>
|
||||
</template>
|
||||
<text v-else class="detail-value" :style="item.valueStyle">{{ detailInfo[item.field] }}</text>
|
||||
</view>
|
||||
</up-col>
|
||||
</template>
|
||||
</up-row>
|
||||
</view>
|
||||
</uni-card>
|
||||
<up-loading-page :loading="pageLoading"></up-loading-page>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import nx from '@/nx'
|
||||
import { getDeviceBusInfoById } from '@/nx/api/deviceInfo'
|
||||
import { getImgBaseUrl } from '@/defaultBaseUrl'
|
||||
import { deviceSchema } from './deviceBusInfo.data'
|
||||
const detailId = ref('')
|
||||
const pageLoading = ref(false)
|
||||
const emit = defineEmits(['getDeviceInfo'])
|
||||
onMounted(() => {
|
||||
const { id } = nx.$store('biz').deviceInfo
|
||||
detailId.value = id
|
||||
getDeviceInfo()
|
||||
})
|
||||
let detailInfo = ref({})
|
||||
let imgs = ref([])
|
||||
// 获取设备详情
|
||||
async function getDeviceInfo() {
|
||||
pageLoading.value = true
|
||||
const res = await getDeviceBusInfoById(detailId.value).finally(() => {
|
||||
pageLoading.value = false
|
||||
})
|
||||
detailInfo.value = (data => {
|
||||
const statuses = [
|
||||
data.repairFlag == 1 && '维修',
|
||||
data.demoteFlag == 1 && '降级',
|
||||
data.scrapFlag == 1 && '报废',
|
||||
data.disableFlag == 1 && '停用',
|
||||
data.lendFlag == 1 && '外借'
|
||||
].filter(Boolean) // 去掉 false 值
|
||||
|
||||
if (data.acceptFlag != 'finished') {
|
||||
data.deviceStatus = '--'
|
||||
data.inUseFlag = '--'
|
||||
} else {
|
||||
data.deviceStatus = statuses.length > 0 ? statuses.join('、') : '正常'
|
||||
if (data.inUseFlag == '1') {
|
||||
data.inUseFlag = '是'
|
||||
} else {
|
||||
data.inUseFlag = '否'
|
||||
}
|
||||
}
|
||||
switch (data.acceptFlag) {
|
||||
case '0':
|
||||
data.acceptFlag = '待验收'
|
||||
break
|
||||
case 'running':
|
||||
data.acceptFlag = '验收审批中'
|
||||
break
|
||||
case 'finished':
|
||||
data.acceptFlag = '已验收'
|
||||
break
|
||||
default:
|
||||
data.acceptFlag = '--'
|
||||
}
|
||||
return data
|
||||
})(res)
|
||||
imgs.value = getFileList(res.photo)
|
||||
emit('getDeviceInfo', detailInfo.value)
|
||||
}
|
||||
function getFileList(photo) {
|
||||
if (photo) {
|
||||
let fileIds = photo.split(',').map(item => getImgBaseUrl() + item)
|
||||
return fileIds
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.detail-content {
|
||||
border: 0.5px solid #f0f0f0;
|
||||
width: 100%;
|
||||
.detail-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px 6px;
|
||||
box-sizing: border-box;
|
||||
font-size: 16px;
|
||||
border: 0.5px solid #f0f0f0;
|
||||
.detail-label {
|
||||
color: #000;
|
||||
}
|
||||
.detail-value {
|
||||
font-size: 14px;
|
||||
width: 72%;
|
||||
overflow: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
:deep(.u-row) {
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
104
pages/lims/deviceBusInfo/deviceBusInfo.data.js
Normal file
104
pages/lims/deviceBusInfo/deviceBusInfo.data.js
Normal file
@@ -0,0 +1,104 @@
|
||||
import { ref } from 'vue'
|
||||
export function getColumn(isFold) {
|
||||
return [
|
||||
{
|
||||
label: '设备名称',
|
||||
name: 'deviceName',
|
||||
width: isFold ? 200 : 130,
|
||||
fixed: true
|
||||
},
|
||||
{
|
||||
label: '别名',
|
||||
name: 'alias',
|
||||
width: isFold ? 120 : 90,
|
||||
fixed: true
|
||||
},
|
||||
{
|
||||
label: '设备状态',
|
||||
name: 'stateShow',
|
||||
width: isFold ? 120 : 90
|
||||
},
|
||||
|
||||
{
|
||||
label: '使用状态',
|
||||
name: 'inUseFlag',
|
||||
width: isFold ? 120 : 90
|
||||
},
|
||||
{
|
||||
label: '规格型号',
|
||||
name: 'modelNo',
|
||||
width: isFold ? 160 : 130
|
||||
},
|
||||
{
|
||||
label: '使用班组',
|
||||
name: 'deptName',
|
||||
width: isFold ? 140 : 100
|
||||
},
|
||||
{
|
||||
label: '负责人',
|
||||
name: 'managerUserName',
|
||||
width: isFold ? 100 : 90
|
||||
},
|
||||
{
|
||||
name: 'operation',
|
||||
type: 'operation',
|
||||
label: '操作',
|
||||
renders: [{ name: '设备信息', func: 'detail' }]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
export const tabList = [
|
||||
{ name: '基础信息' },
|
||||
{ name: '验收信息' },
|
||||
{ name: '点检' },
|
||||
{ name: '维护保养' },
|
||||
{ name: '使用记录' },
|
||||
{ name: '期间核查' },
|
||||
{ name: '检定/校准' },
|
||||
{ name: '维修记录' },
|
||||
{ name: '借用记录' },
|
||||
{ name: '归还记录' },
|
||||
{ name: '停用记录' },
|
||||
{ name: '设备文档' },
|
||||
{ name: '报废信息' }
|
||||
]
|
||||
|
||||
export const deviceSchema = [
|
||||
{ label: '设备名称', field: 'deviceName' },
|
||||
{ label: '别名', field: 'alias' },
|
||||
{ label: '设备用途', field: 'deviceUse' },
|
||||
{ label: '存放位置', field: 'position' },
|
||||
{ label: '等级分类', field: 'gradeClassify' },
|
||||
{ label: '设备状态', field: 'stateShow' },
|
||||
{ label: '验收状态', field: 'acceptFlag' },
|
||||
{ label: '使用状态', field: 'inUseFlag' },
|
||||
{ label: '数量', field: 'deviceNum' },
|
||||
{ label: '管理编号', field: 'deviceCode' },
|
||||
{ label: '资产编号', field: 'assetCode' },
|
||||
{ label: '出厂编号', field: 'factoryCode' },
|
||||
{ label: '规格型号', field: 'modelNo' },
|
||||
|
||||
{ label: '购入价格', field: 'purchasePrice' },
|
||||
{ label: '采购时间', field: 'purchaseDate' },
|
||||
{ label: '出厂日期', field: 'productiveDate' },
|
||||
{ label: '安装日期', field: 'deployDate' },
|
||||
{ label: '安装人员', field: 'deployEngineer' },
|
||||
|
||||
{ label: '验收人员', field: 'acceptUserName' },
|
||||
{ label: '负责人', field: 'managerUserName' },
|
||||
{ label: '所属班组', field: 'deptName' },
|
||||
{
|
||||
label: '安装位置',
|
||||
field: 'deployLocation'
|
||||
},
|
||||
{
|
||||
label: '技术指标',
|
||||
field: 'deviceParameters',
|
||||
valueStyle: { fontSize: 12 + 'px', height: 50 + 'px' }
|
||||
},
|
||||
{
|
||||
label: '设备图片',
|
||||
field: 'photo'
|
||||
}
|
||||
]
|
||||
213
pages/lims/deviceBusInfo/index.vue
Normal file
213
pages/lims/deviceBusInfo/index.vue
Normal file
@@ -0,0 +1,213 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<up-sticky>
|
||||
<navbar-back title="设备查询" />
|
||||
</up-sticky>
|
||||
<view class="content">
|
||||
<up-transition :show="!isFold" mode="slide-left">
|
||||
<view class="con-left" v-show="!isFold">
|
||||
<uni-card style="height: 100%; overflow: auto" title="分类和产品" padding="0" margin="0" spacing="0">
|
||||
<DaTree
|
||||
ref="DaTreeRef"
|
||||
:data="roomTreeData"
|
||||
labelField="name"
|
||||
valueField="id"
|
||||
appendField="modelNo"
|
||||
:indent="10"
|
||||
@change="handleTreeChange"
|
||||
></DaTree>
|
||||
</uni-card>
|
||||
</view>
|
||||
</up-transition>
|
||||
<view class="con-right">
|
||||
<uni-card padding="0" margin="10">
|
||||
<view class="p10 x-f" style="width: 60%">
|
||||
<image
|
||||
class="mr15"
|
||||
style="width: 30px; height: 30px"
|
||||
:src="`/static/images/${isFold ? 'zhedie2' : 'zhedie1'}.png`"
|
||||
@click="isFold = !isFold"
|
||||
></image>
|
||||
<up-search
|
||||
v-model="keyword"
|
||||
shape="square"
|
||||
placeholder="请输入设备名称或者扫描设备二维码码查询"
|
||||
actionText="重置"
|
||||
:clearabled="false"
|
||||
:showAction="true"
|
||||
@change="handleInputSearch"
|
||||
@custom="handleReset"
|
||||
></up-search>
|
||||
</view>
|
||||
<view style="height: 73vh; width: 100%">
|
||||
<zb-table
|
||||
ref="zbTableRef"
|
||||
isShowLoadMore
|
||||
stripe
|
||||
:fit="false"
|
||||
:columns="column"
|
||||
:cellStyle="setCellStyle"
|
||||
:cellHeaderStyle="setCellHeaderStyle"
|
||||
:data="listData"
|
||||
@detail="handleDetail"
|
||||
@pullUpLoading="pullUpLoadingAction"
|
||||
></zb-table>
|
||||
</view>
|
||||
</uni-card>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, onUnmounted, watch, computed, toRefs } from 'vue'
|
||||
import DaTree from '@/components/da-tree/index.vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { setCellHeaderStyle, setCellStyle } from '@/nx/config/zbTable'
|
||||
import { useListData } from '@/nx/hooks/usePageListData'
|
||||
import { throttle } from '@/uview-plus'
|
||||
import { getColumn } from './deviceBusInfo.data'
|
||||
import { deviceList, treeData, getDeviceBusInfoById } from '@/nx/api/deviceInfo'
|
||||
import { useScreenOrientation } from '@/nx/hooks/useScreenOrientation'
|
||||
import nx from '@/nx'
|
||||
|
||||
const column = computed(() => getColumn(isFold.value))
|
||||
const isFold = ref(false)
|
||||
const roomTreeData = ref([])
|
||||
|
||||
const { scanQRInfo } = toRefs(nx.$store('biz'))
|
||||
watch(scanQRInfo, newVal => {
|
||||
if (newVal && nx.$router.getCurrentPage().route == 'pages/lims/deviceBusInfo/index') {
|
||||
try {
|
||||
const codeObj = JSON.parse(newVal)
|
||||
handleDetail({ id: codeObj.id })
|
||||
scanQRInfo.value = ''
|
||||
} catch (error) {
|
||||
scanQRInfo.value = ''
|
||||
uni.showToast({
|
||||
title: '请扫描设备码',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
onShow(() => {
|
||||
scanQRInfo.value = ''
|
||||
})
|
||||
async function getTreeData() {
|
||||
const res = await treeData()
|
||||
roomTreeData.value = res
|
||||
}
|
||||
getTreeData()
|
||||
const { lockOrientation } = useScreenOrientation()
|
||||
onMounted(async () => {
|
||||
lockOrientation('landscape')
|
||||
await getInitData()
|
||||
console.log('listData', listData.value)
|
||||
})
|
||||
const searchParams = computed(() => {
|
||||
const params = {
|
||||
deviceName: keyword.value
|
||||
}
|
||||
if (selectedNode.value) {
|
||||
params.productId = selectedNode.value.key
|
||||
}
|
||||
return params
|
||||
})
|
||||
const { listData, loadingData, scrollToLower, loadStatus, getInitData } = useListData({
|
||||
searchParams,
|
||||
api: deviceList,
|
||||
processData: data => {
|
||||
return data.map(item => {
|
||||
const statuses = [
|
||||
item.repairFlag == 1 && '维修',
|
||||
item.demoteFlag == 1 && '降级',
|
||||
item.scrapFlag == 1 && '报废',
|
||||
item.disableFlag == 1 && '停用',
|
||||
item.lendFlag == 1 && '外借'
|
||||
].filter(Boolean) // 去掉 false 值
|
||||
|
||||
if (item.acceptFlag != 'finished') {
|
||||
item.deviceStatus = '--'
|
||||
} else {
|
||||
item.deviceStatus = statuses.length > 0 ? statuses.join('、') : '正常'
|
||||
}
|
||||
if (item.inUseFlag == '1') {
|
||||
item.inUseFlag = '是'
|
||||
} else {
|
||||
item.inUseFlag = '否'
|
||||
}
|
||||
return item
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
let zbTableRef = ref()
|
||||
function pullUpLoadingAction() {
|
||||
if (loadingData.value) return
|
||||
if (loadStatus.value === 'nomore') {
|
||||
zbTableRef.value.pullUpCompleteLoading('ok')
|
||||
} else {
|
||||
scrollToLower()
|
||||
}
|
||||
}
|
||||
let selectedNode = ref(null)
|
||||
let DaTreeRef = ref()
|
||||
function handleTreeChange(allCheckedKeys, currentItem) {
|
||||
console.log(allCheckedKeys, currentItem)
|
||||
|
||||
selectedNode.value = currentItem
|
||||
getInitData()
|
||||
}
|
||||
let keyword = ref('')
|
||||
function handleInputSearch() {
|
||||
if (!keyword.value) return
|
||||
throttle(getInitData, 500)
|
||||
}
|
||||
function handleReset() {
|
||||
keyword.value = ''
|
||||
if (selectedNode.value) {
|
||||
DaTreeRef.value.setCheckedKeys(selectedNode.value.key, false)
|
||||
}
|
||||
selectedNode.value = ''
|
||||
getInitData()
|
||||
}
|
||||
async function handleDetail(row, index) {
|
||||
nx.$store('biz').deviceInfo = row
|
||||
await getDeviceBusInfoById(row.id)
|
||||
nx.$router.go('/pages/lims/deviceBusInfo/baseInfo')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.u-sticky {
|
||||
top: 0 !important;
|
||||
}
|
||||
.container {
|
||||
background-color: #f0f2f5;
|
||||
height: 100%;
|
||||
.content {
|
||||
display: flex;
|
||||
.con-left {
|
||||
height: 83vh;
|
||||
overflow: scroll;
|
||||
margin-top: 10px;
|
||||
margin-left: 10px;
|
||||
flex: 2;
|
||||
}
|
||||
.con-right {
|
||||
flex: 8;
|
||||
overflow: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
:deep(.zb-table uni-button[type='primary']) {
|
||||
background-color: $uni-color-primary !important;
|
||||
}
|
||||
:deep(.u-search__action--active) {
|
||||
padding: 5px;
|
||||
border-radius: 3px;
|
||||
background: #0055a2;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user