安全工器具预警

This commit is contained in:
bb_pan 2025-08-06 19:04:51 +08:00
parent 0e72577081
commit 4909c0e377
5 changed files with 179 additions and 74 deletions

View File

@ -880,6 +880,12 @@
"style": {
"navigationBarTitleText": "材料员确认"
}
},
{
"path": "pages/materialsStation/index/expiryDateList",
"style": {
"navigationBarTitleText": "安全工器具预警"
}
}
// end
],

View File

@ -0,0 +1,102 @@
<template>
<div class="content">
<div class="query">
<uni-easyinput
errorMessage
v-model="queryParams.keyWord"
placeholder="请输入关键字"
style="margin: 0 5px"
/>
<button size="mini" style="background-color: #f0a037; color: #fff" @click="getList">
查询
</button>
</div>
<!-- 滚动 -->
<scroll-view scroll-y="true" class="scroll-container" @scrolltolower="onScrollTolower">
<!-- 列表 -->
<uni-table ref="table" border stripe emptyText="暂无更多数据">
<uni-tr>
<uni-th width="50" align="center">序号</uni-th>
<uni-th width="150" align="center">设备类型</uni-th>
<uni-th width="150" align="center">规格型号</uni-th>
<uni-th width="120" align="center">设备编码</uni-th>
<uni-th width="100" align="center">本次检修时间</uni-th>
<uni-th width="100" align="center">下次检修时间</uni-th>
<uni-th width="100" align="center">再用班组</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in tableList" :key="index">
<uni-td align="center">{{ index + 1 }}</uni-td>
<uni-td align="center">{{ item.typeName }}</uni-td>
<uni-td align="center">{{ item.typeModelName }}</uni-td>
<uni-td align="center">{{ item.maCode || '-' }}</uni-td>
<uni-td align="center">{{ item.thisCheckTime || '-' }}</uni-td>
<uni-td align="center">{{ item.nextCheckTime || '-' }}</uni-td>
<uni-td align="center">{{ item.teamName || '-' }}</uni-td>
</uni-tr>
</uni-table>
<div style="display: flex; justify-content: center; align-items: center; height: 50px">
{{ total == tableList.length ? '没有更多数据了~' : '正在加载...' }}
</div>
</scroll-view>
</div>
</template>
<script setup>
import { ref, computed } from 'vue'
import { getAgreementIdApi, getSafeDetailsListApi } from '@/services/materialsStation'
import { onLoad } from '@dcloudio/uni-app'
const queryParams = ref({
pageNum: 1,
pageSize: 25,
keyWord: '',
status: '', // 2:1 1:3
})
const tableList = ref([])
const total = ref(0)
onLoad((opt) => {
console.log('🚀 ~ opt:', opt)
const params = opt.params ? JSON.parse(opt.params) : null
console.log('🚀 ~ params:', params)
queryParams.value.status = params.status || ''
getList()
})
const onScrollTolower = () => {
console.log('滚动到底部')
queryParams.value.pageSize += 10
getList()
}
const getList = async () => {
try {
uni.showLoading({ title: '加载中...', mask: true })
const { data: agreementIdList } = await getAgreementIdApi()
const res = await getSafeDetailsListApi({ ...queryParams.value, agreementIdList })
tableList.value = res.data.rows || []
total.value = res.data.total || 0
} catch (error) {
console.error('获取列表失败:', error)
} finally {
uni.hideLoading()
}
}
</script>
<style lang="scss" scoped>
.content {
padding: 10px;
}
.query {
display: flex;
justify-content: space-between;
align-items: center;
color: #f0a037;
margin-bottom: 15px;
}
.scroll-container {
height: calc(100vh - 120px);
overflow-y: auto;
}
</style>

View File

@ -1,5 +1,5 @@
<template>
<div v-if="isIOS" :style="{ height: statusBarHeight}"></div>
<div v-if="isIOS" :style="{ height: statusBarHeight }"></div>
<view class="page-bg">
<view class="upper-user">
<view class="user-rig">
@ -8,15 +8,15 @@
</view>
</view>
<view class="sliders">
<view>
<view @click="handleExpiryDate('')">
<h2>{{ todayDatas.normalNum || 0 }}</h2>
<span>检修期内</span>
</view>
<view>
<view @click="handleExpiryDate(1)">
<h2>{{ todayDatas.threeMonthNum || 0 }}</h2>
<span>临近检期3个月</span>
</view>
<view>
<view @click="handleExpiryDate(2)">
<h2>{{ todayDatas.oneMonthNum || 0 }}</h2>
<span>临近检期1个月</span>
</view>
@ -50,6 +50,8 @@ import {
getUserInfoByIdCardApi,
getToolsLedgerDetailsListApi,
getBmTeamList,
getAgreementIdApi,
getSafeNumListApi,
} from '@/services/materialsStation'
import { useMemberStore } from '@/stores'
@ -166,7 +168,9 @@ const projectInfoList = async () => {
//
const getToolsLedgerDetailsList = async () => {
try {
const res = await getToolsLedgerDetailsListApi()
const { data: agreementIdList } = await getAgreementIdApi()
// console.log('🚀 ~ getAgreementIdApi ~:', agreementIdList)
const res = await getSafeNumListApi({ agreementIdList })
todayDatas.normalNum = res.data.normalNum
todayDatas.threeMonthNum = res.data.threeMonthNum
todayDatas.oneMonthNum = res.data.oneMonthNum
@ -190,6 +194,17 @@ const getTeamList = async () => {
}
}
//
const handleExpiryDate = (status) => {
console.log('🚀 ~ handleExpiryDate ~ status:', status)
const params = {
status,
}
uni.navigateTo({
url: `/pages/materialsStation/index/expiryDateList?params=${JSON.stringify(params)}`,
})
}
//
onShow(async () => {
userInfo.value = memberStore.userInfo || {}
@ -199,7 +214,10 @@ onShow(async () => {
// item.path urlPermissions.value item.isShow = true item.isShow = false
item.isShow = urlPermissions.value.includes(item.path)
})
console.log('isUsingList.value:', isUsingList.value.every((item) => !item.isShow))
console.log(
'isUsingList.value:',
isUsingList.value.every((item) => !item.isShow),
)
if (isUsingList.value.every((item) => !item.isShow)) return
getToolsLedgerDetailsList()
getUserInfoByUserName()

View File

@ -36,19 +36,14 @@
</view>
<view class="table-list-item">
<uni-forms :model="codeData" label-width="100" :border="true">
<uni-forms-item label="物资名称:" name="materialType">
<uni-forms-item label="设备类型:" name="maName">
<text style="height: 100%; display: flex; align-items: center">{{
codeData.materialType
codeData.maName
}}</text>
</uni-forms-item>
<uni-forms-item label="物资类型:" name="materialName">
<uni-forms-item label="规格型号:" name="maModel">
<text style="height: 100%; display: flex; align-items: center">{{
codeData.materialName
}}</text>
</uni-forms-item>
<uni-forms-item label="规格型号:" name="materialModel">
<text style="height: 100%; display: flex; align-items: center">{{
codeData.materialModel
codeData.maModel
}}</text>
</uni-forms-item>
<uni-forms-item label="设备编码:" name="maCode">
@ -58,8 +53,11 @@
</uni-forms-item>
</uni-forms>
</view>
<div style="width: 100%">
<ElectronicSeal :maCode="codeData?.maCode" :maId="codeData?.maId" />
</div>
<button type="primary" @click="addCode">添加编码</button>
<button type="primary" style="margin-top: 20px;" @click="addCode">添加编码</button>
</view>
<!-- 相机预览页面 -->
@ -108,8 +106,10 @@
<script>
import { decryptWithSM4 } from '@/utils/sm'
import { getDeviceListAPI } from '@/services/picking/outbound'
import ElectronicSeal from '@/components/ElectronicSeal/index.vue'
export default {
components: { ElectronicSeal },
data() {
return {
showCamera: false,
@ -162,8 +162,8 @@ export default {
const params = {
maCode: this.codeData.maCode,
maId: this.codeData.maId,
materialType: this.codeData.materialType,
materialName: this.codeData.materialName,
typeName: this.codeData.maModel,
materialName: this.codeData.maName,
typeId: this.codeData.typeId,
outType: 4,
}
@ -505,7 +505,6 @@ export default {
console.log('清理后的纯base64:', cleanBase64)
console.log('开始处理图片...')
console.log('图片处理完成开始OCR识别...')
uni.request({
@ -711,7 +710,7 @@ export default {
},
//
async getCode() {
getCode() {
if (!this.queryCodeParams.maCode.trim()) {
uni.showToast({
title: '请输入设备编码',
@ -723,13 +722,13 @@ export default {
getDeviceListAPI({ maCode: this.queryCodeParams.maCode })
.then((response) => {
console.log('xxxxxxxxxxx', response)
if (response.data && response.data.length !== 0) {
this.optionList = response.data.data.map((option) => ({
if (response.code === 200 && response.data && response.data.length > 0) {
this.optionList = response.data.map((option) => ({
value: option.maId,
text: option.maCode,
}))
if (response.data.data.length === 1) {
this.codeData = response.data.data[0]
if (response.data.length === 1) {
this.codeData = response.data[0]
}
} else {
uni.showToast({
@ -743,40 +742,6 @@ export default {
console.error('获取设备信息失败', error)
uni.hideLoading()
})
// const response = await new Promise((resolve, reject)=>
// {
// uni.request({
// url: '/material/ma_machine/getHisByCode',
// method: 'GET',
// data: {maCode: this.queryCodeParams.maCode},
// success: resolve,
// fail: reject
// });
// }
// )
// ;
// let res;
// if (!response.data.code) {
// res=JSON.parse(decryptWithSM4(res.data))
// } else {
// res =res.data
// }
// console.log("res", res);
// if (response.data?.data && response.data.data.length > 0) {
// this.optionList = response.data.data.map(option => ({
// value: option.maId,
// text: option.maCode
// }));
// if (response.data.data.length === 1) {
// this.codeData = response.data.data[0];
// }
// } else {
// uni.showToast({
// title: '',
// icon: 'none'
// });
// }
} catch (error) {
console.error('查询失败:', error)
uni.showToast({
@ -790,22 +755,9 @@ export default {
async changeTag() {
if (!this.queryCodeParams.maId) return
try {
const response = await new Promise((resolve, reject) => {
uni.request({
url: '/material/ma_machine/getHisByCode',
method: 'GET',
data: { maId: this.queryCodeParams.maId },
success: resolve,
fail: reject,
})
})
if (response.data?.data && response.data.data.length > 0) {
this.codeData = response.data.data[0]
} else {
uni.showToast({
title: '获取编号信息失败',
icon: 'none',
})
const response = await getDeviceListAPI({ maId: this.queryCodeParams.maId })
if (response.data && response.data.length !== 0) {
this.codeData = response.data[0]
}
} catch (error) {
console.error('获取编号信息失败', error)

View File

@ -344,4 +344,31 @@ export const confirmMaterialApi = (data) => {
url: '/material/lease_apply_info/confirmMaterial',
data,
})
}
// 获取协议id
export const getAgreementIdApi = (data) => {
return http({
method: 'GET',
url: '/material/material_maMachine/getAgreementId',
data,
})
}
// 查询安全工机具状态数量
export const getSafeNumListApi = (data) => {
return http({
method: 'GET',
url: '/material/material_maMachine/getSafeNumList',
data,
})
}
// 临期详情
export const getSafeDetailsListApi = (data) => {
return http({
method: 'GET',
url: '/material/material_maMachine/getSafeDetailsList',
data,
})
}