现场维修
This commit is contained in:
parent
417a2b94ab
commit
7fba7e1ea2
|
|
@ -1,12 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<uni-nav-bar
|
<uni-nav-bar fixed :border="false" background-color="#dcf4ff" color="black" status-bar title="日期更新"><template
|
||||||
fixed
|
v-slot:left>
|
||||||
:border="false"
|
|
||||||
background-color="#dcf4ff"
|
|
||||||
color="black"
|
|
||||||
status-bar
|
|
||||||
title="日期更新"
|
|
||||||
><template v-slot:left>
|
|
||||||
<view style="display: flex; align-items: center" @click="back">
|
<view style="display: flex; align-items: center" @click="back">
|
||||||
<!-- 图标 -->
|
<!-- 图标 -->
|
||||||
<uni-icons type="left" size="20" color="black"></uni-icons>
|
<uni-icons type="left" size="20" color="black"></uni-icons>
|
||||||
|
|
@ -22,12 +16,8 @@
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<uni-easyinput v-model="keyWord" placeholder="请输入设备编码"></uni-easyinput>
|
<uni-easyinput v-model="keyWord" placeholder="请输入设备编码"></uni-easyinput>
|
||||||
<button
|
<button type="primary" size="mini" @click="handleSearch"
|
||||||
type="primary"
|
style="margin-left: 10px; background-color: #18bc37">
|
||||||
size="mini"
|
|
||||||
@click="handleSearch"
|
|
||||||
style="margin-left: 10px; background-color: #18bc37"
|
|
||||||
>
|
|
||||||
查询
|
查询
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -42,86 +32,63 @@
|
||||||
<div>本次检修时间:{{ formData.repairTime }}</div>
|
<div>本次检修时间:{{ formData.repairTime }}</div>
|
||||||
<div>下次检修时间:{{ formData.nextRepairTime }}</div>
|
<div>下次检修时间:{{ formData.nextRepairTime }}</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button type="primary" size="mini" @click="handleSubmit"
|
||||||
type="primary"
|
style="margin-top: 30px; background-color: #18bc37; width: 100%">
|
||||||
size="mini"
|
|
||||||
@click="handleSubmit"
|
|
||||||
style="margin-top: 30px; background-color: #18bc37; width: 100%"
|
|
||||||
>
|
|
||||||
确认修改
|
确认修改
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<uni-popup ref="popup" border-radius="5px 5px 5px 5px" background-color="#fff">
|
<uni-popup ref="popup" border-radius="5px 5px 5px 5px" background-color="#fff">
|
||||||
<div
|
<div v-for="(item, index) in typeList" :key="index" class="popup-item" @click.stop="handleCheck(item)">
|
||||||
v-for="(item, index) in typeList"
|
|
||||||
:key="index"
|
|
||||||
class="popup-item"
|
|
||||||
@click.stop="handleCheck(item)"
|
|
||||||
>
|
|
||||||
<div>{{ item.name }}</div>
|
<div>{{ item.name }}</div>
|
||||||
<uni-data-checkbox
|
<uni-data-checkbox v-model="item.isChecked" :localdata="range"
|
||||||
v-model="item.isChecked"
|
@change="handleCheck(item, $event)"></uni-data-checkbox>
|
||||||
:localdata="range"
|
|
||||||
@change="handleCheck(item, $event)"
|
|
||||||
></uni-data-checkbox>
|
|
||||||
</div>
|
</div>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
<ScanQrCode ref="scanQrCodeRef" @scanSuccess="handleScanSuccess" @scanError="handleScanError" />
|
<ScanQrCode ref="scanQrCodeRef" @scanSuccess="handleScanSuccess" @scanError="handleScanError" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import {
|
||||||
import { reactive, ref } from 'vue'
|
getWsMaInfoList,
|
||||||
import ScanQrCode from '@/pages/devicesSearch/ScanQrCode'
|
updateCheckTime
|
||||||
|
} from '@/services/wsMaInfo/wsMaInfo.js'
|
||||||
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
import { reactive, ref } from 'vue'
|
||||||
|
import ScanQrCode from '@/pages/devicesSearch/ScanQrCode'
|
||||||
|
|
||||||
const keyWord = ref('')
|
const keyWord = ref('')
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
|
id: '',
|
||||||
maType: '', // 设备类型
|
maType: '', // 设备类型
|
||||||
typeName: '', // 规格型号
|
typeName: '', // 规格型号
|
||||||
code: '', // 设备编码
|
code: '', // 设备编码
|
||||||
repairer: '', // 维修人
|
repairer: '', // 维修人
|
||||||
repairTime: '', // 维修时间
|
repairTime: '', // 维修时间
|
||||||
nextRepairTime: '', // 下次维修时间
|
nextRepairTime: '', // 下次维修时间
|
||||||
})
|
})
|
||||||
const scanQrCodeRef = ref()
|
const scanQrCodeRef = ref()
|
||||||
const popup = ref()
|
const popup = ref()
|
||||||
const typeName = ref('请选择对应机具')
|
const typeName = ref('请选择对应机具')
|
||||||
const typeList = ref([
|
const typeList = ref([])
|
||||||
{
|
const range = ref([{ value: 0, text: '' }])
|
||||||
id: '1',
|
|
||||||
name: '卸扣DG-50-W202303-7466',
|
|
||||||
isChecked: 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '2',
|
|
||||||
name: '卸扣DG-50-W202303-7467',
|
|
||||||
isChecked: 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '3',
|
|
||||||
name: '卸扣DG-50-W202303-7468',
|
|
||||||
isChecked: 1,
|
|
||||||
},
|
|
||||||
])
|
|
||||||
const range = ref([{ value: 0, text: '' }])
|
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
console.log('onLoad')
|
console.log('onLoad')
|
||||||
})
|
})
|
||||||
|
|
||||||
const back = () => {
|
const back = () => {
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
delta: 1,
|
delta: 1,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const onQrCode = () => {
|
const onQrCode = () => {
|
||||||
console.log('🚀 ~ onQrCode ~ 二维码:')
|
console.log('🚀 ~ onQrCode ~ 二维码:')
|
||||||
if (scanQrCodeRef.value) scanQrCodeRef.value.scanQrCode()
|
if (scanQrCodeRef.value) scanQrCodeRef.value.scanQrCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSearch = () => {
|
const handleSearch = () => {
|
||||||
console.log('🚀 ~ handleSearch ~ 查询:', keyWord.value)
|
console.log('🚀 ~ handleSearch ~ 查询:', keyWord.value)
|
||||||
if (!keyWord.value) {
|
if (!keyWord.value) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|
@ -129,73 +96,117 @@ const handleSearch = () => {
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
typeList.value =[];
|
||||||
|
getWsMaInfoList({ maCode: keyWord.value }).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
typeList.value = res.data.map(option => {
|
||||||
|
return {
|
||||||
|
id: option.id,
|
||||||
|
name: option.maName + option.maModel,
|
||||||
|
isChecked: 1,
|
||||||
|
item: option
|
||||||
|
|
||||||
const handlePopup = () => {
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.log(error)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePopup = () => {
|
||||||
console.log('🚀 ~ handlePopup ~ 弹窗:')
|
console.log('🚀 ~ handlePopup ~ 弹窗:')
|
||||||
popup.value.open()
|
popup.value.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleCheck = (item) => {
|
const handleCheck = (item) => {
|
||||||
console.log('🚀 ~ handleCheck ~ 单选:', item)
|
console.log('🚀 ~ handleCheck ~ 单选:', item)
|
||||||
// 循环 typeList 将当前点击的 item.isChecked 设置为 0 其他设置 1
|
// 循环 typeList 将当前点击的 item.isChecked 设置为 0 其他设置 1
|
||||||
typeList.value.forEach((i) => {
|
typeList.value.forEach((i) => {
|
||||||
i.isChecked = i.id === item.id ? 0 : 1
|
i.isChecked = i.id === item.id ? 0 : 1
|
||||||
})
|
})
|
||||||
typeName.value = item.name
|
|
||||||
popup.value.close()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理扫描成功事件
|
typeName.value = item.item.name
|
||||||
const handleScanSuccess = (result) => {
|
formData.id = item.item.id
|
||||||
|
formData.code = item.item.maCode
|
||||||
|
formData.maType = item.item.maName
|
||||||
|
formData.nextRepairTime = item.item.nextCheckTime
|
||||||
|
formData.repairTime = item.item.thisCheckTime
|
||||||
|
formData.typeName = item.item.maModel
|
||||||
|
formData.repairer = item.item.repairMan
|
||||||
|
typeName.value = item.name
|
||||||
|
|
||||||
|
popup.value.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理扫描成功事件
|
||||||
|
const handleScanSuccess = (result) => {
|
||||||
keyWord.value = result?.text?.split('?qrcode=')[1] || result?.text
|
keyWord.value = result?.text?.split('?qrcode=')[1] || result?.text
|
||||||
if (keyWord.value === '') {
|
if (keyWord.value === '') {
|
||||||
uni.showToast({ title: '扫码识别失败', icon: 'none' })
|
uni.showToast({ title: '扫码识别失败', icon: 'none' })
|
||||||
} else {
|
} else {
|
||||||
handleSearch()
|
handleSearch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理扫描失败事件
|
// 处理扫描失败事件
|
||||||
const handleScanError = (error) => {
|
const handleScanError = (error) => {
|
||||||
console.error('扫描出错:', error.message)
|
console.error('扫描出错:', error.message)
|
||||||
uni.showToast({ title: error.message, icon: 'none' })
|
uni.showToast({ title: error.message, icon: 'none' })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提交
|
// 提交
|
||||||
const handleSubmit = () => {}
|
const handleSubmit = () => {
|
||||||
|
updateCheckTime(formData.id).then(res => {
|
||||||
|
if(res.code === 200){
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.log(error)
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.content {
|
.content {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|
||||||
.search {
|
.search {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
.popup {
|
.popup {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
margin: 20px 0 30px;
|
margin: 20px 0 30px;
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-item {
|
.search-item {
|
||||||
line-height: 1.9;
|
line-height: 1.9;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.popup-item {
|
|
||||||
|
.popup-item {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border-bottom: 1px solid #c7c9ce;
|
border-bottom: 1px solid #c7c9ce;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
::v-deep .uni-popup__wrapper {
|
|
||||||
|
::v-deep .uni-popup__wrapper {
|
||||||
width: calc(100% - 20px);
|
width: calc(100% - 20px);
|
||||||
/* padding: 10px; */
|
/* padding: 10px; */
|
||||||
}
|
}
|
||||||
::v-deep .uni-data-checklist {
|
|
||||||
|
::v-deep .uni-data-checklist {
|
||||||
// 去掉 flex: 1
|
// 去掉 flex: 1
|
||||||
flex: none;
|
flex: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -11,10 +11,11 @@ export function getWsMaInfoById(id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询所有机具信息列表
|
// 查询所有机具信息列表
|
||||||
export function getWsMaInfoList() {
|
export function getWsMaInfoList(data) {
|
||||||
return http({
|
return http({
|
||||||
url: '/material/wsMaInfo/list',
|
url: '/material/wsMaInfo/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,6 +64,18 @@ export const getMaModeData = (parentId) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const updateCheckTime = (id) => {
|
||||||
|
return http({
|
||||||
|
method: 'POST',
|
||||||
|
url: '/material/wsMaInfo/updateCheckTime',
|
||||||
|
data: {id}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const getSupplier = () => {
|
export const getSupplier = () => {
|
||||||
return http({
|
return http({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue