现场维修二维码
This commit is contained in:
parent
6ce7237725
commit
dd7c0ffc0c
|
|
@ -108,7 +108,6 @@ const onQrCode = () => {
|
||||||
|
|
||||||
const handleSearch = () => {
|
const handleSearch = () => {
|
||||||
console.log('🚀 ~ handleSearch ~ 查询:', keyWord.value)
|
console.log('🚀 ~ handleSearch ~ 查询:', keyWord.value)
|
||||||
// typeList.value =[];
|
|
||||||
reset()
|
reset()
|
||||||
getWsMaInfoList({ maCode: keyWord.value }).then(res => {
|
getWsMaInfoList({ maCode: keyWord.value }).then(res => {
|
||||||
if (res.code === 200 && res.data && res.data.length > 0) {
|
if (res.code === 200 && res.data && res.data.length > 0) {
|
||||||
|
|
@ -116,9 +115,7 @@ const handleSearch = () => {
|
||||||
return {
|
return {
|
||||||
id: option.id,
|
id: option.id,
|
||||||
label: option.maName + '-' + option.maModel + '-' + option.maCode,
|
label: option.maName + '-' + option.maModel + '-' + option.maCode,
|
||||||
/* isChecked: 1,*/
|
|
||||||
item: option,
|
item: option,
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (res.data.length === 1) {
|
if (res.data.length === 1) {
|
||||||
|
|
@ -164,7 +161,7 @@ const handleCheck = (item) => {
|
||||||
|
|
||||||
// 处理扫描成功事件
|
// 处理扫描成功事件
|
||||||
const handleScanSuccess = (result) => {
|
const handleScanSuccess = (result) => {
|
||||||
keyWord.value = result?.data?.split('?qrcode=')[1] || result?.data
|
keyWord.value = result?.data?.split('?qrcode=')[1]
|
||||||
if (keyWord.value === '') {
|
if (keyWord.value === '') {
|
||||||
uni.showToast({ title: '扫码识别失败', icon: 'none' })
|
uni.showToast({ title: '扫码识别失败', icon: 'none' })
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -293,13 +290,17 @@ const handleSubmit = () => {
|
||||||
|
|
||||||
// 底部按钮
|
// 底部按钮
|
||||||
.btn {
|
.btn {
|
||||||
margin-top: auto;
|
position: fixed;
|
||||||
padding: 32rpx;
|
bottom: 0;
|
||||||
// background: #fff;
|
left: 0;
|
||||||
// box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
|
width: calc(100% - 20px);
|
||||||
|
background-color: #fff; /* 可根据需要设定背景色 */
|
||||||
|
padding: 10px;
|
||||||
|
box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1); /* 可选:添加顶部阴影 */
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: center; /* 水平居中 */
|
||||||
gap: 24rpx;
|
gap: 10px; /* 按钮间距 */
|
||||||
|
z-index: 999; /* 保证显示在最上层 */
|
||||||
|
|
||||||
.btn-cont {
|
.btn-cont {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|
|
||||||
|
|
@ -1,346 +1,424 @@
|
||||||
<template>
|
<template>
|
||||||
<uni-nav-bar
|
<uni-nav-bar
|
||||||
fixed
|
fixed
|
||||||
:border="false"
|
:border="false"
|
||||||
background-color="#dcf4ff"
|
background-color="#dcf4ff"
|
||||||
color="black"
|
color="black"
|
||||||
status-bar
|
status-bar
|
||||||
title="铭牌信息更新"
|
title="铭牌信息更新"
|
||||||
><template v-slot:left>
|
|
||||||
<view style="display: flex; align-items: center" @click="back">
|
|
||||||
<!-- 图标 -->
|
|
||||||
<uni-icons type="left" size="20" color="black"></uni-icons>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
<template v-slot:right>
|
|
||||||
<view style="display: flex; align-items: center" @click="onQrCode">
|
|
||||||
<!-- 文本 -->
|
|
||||||
<text>二维码</text>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
</uni-nav-bar>
|
|
||||||
<div class="content">
|
|
||||||
<div class="search">
|
|
||||||
<uni-easyinput v-model="keyWord" placeholder="请输入设备编码"></uni-easyinput>
|
|
||||||
<button
|
|
||||||
type="primary"
|
|
||||||
size="mini"
|
|
||||||
@click="handleSearch"
|
|
||||||
style="margin-left: 10px; background-color: #18bc37"
|
|
||||||
>
|
|
||||||
查询
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
|
||||||
v-if="typeList.length > 1"
|
|
||||||
class="popup"
|
|
||||||
style="margin-bottom: 30px"
|
|
||||||
@click="handlePopup(1)"
|
|
||||||
>
|
>
|
||||||
{{ typeName || '请选择对应机具' }}
|
<template v-slot:left>
|
||||||
</div>
|
<view class="nav-back" @click="handleBack">
|
||||||
|
<uni-icons type="left" size="20" color="black" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</uni-nav-bar>
|
||||||
|
|
||||||
<div class="search-item">
|
<view class="container">
|
||||||
<div>设备类型:{{ formData.materialName }}</div>
|
<!-- 搜索区域 -->
|
||||||
<div>
|
<view class="search-card card">
|
||||||
<span><span style="color: red">*</span>规格型号:</span
|
<view class="search-container">
|
||||||
><uni-easyinput v-model="formData.materialModel" placeholder="请输入"></uni-easyinput>
|
<uni-easyinput
|
||||||
</div>
|
v-model="searchParams.keyWord"
|
||||||
<div>二维码:{{ formData.qrCode }}</div>
|
placeholder="请输入设备编码"
|
||||||
<div>设备编码:{{ formData.maCode }}</div>
|
clearable
|
||||||
<div>设备状态:{{ formData.maStatus }}</div>
|
/>
|
||||||
<div>
|
<button
|
||||||
<span>本次检修人员:</span
|
type="primary"
|
||||||
><uni-easyinput v-model="formData.checkMan" placeholder="请输入"></uni-easyinput>
|
size="mini"
|
||||||
</div>
|
@click="handleSearch"
|
||||||
<div>
|
class="search-btn"
|
||||||
<span>本次检修时间:</span>
|
>
|
||||||
<uni-datetime-picker type="date" v-model="formData.thisCheckTime" @change="changeTime" />
|
查询
|
||||||
</div>
|
</button>
|
||||||
<div>
|
<button
|
||||||
<span>下次检修时间:</span>
|
type="primary"
|
||||||
<uni-datetime-picker
|
size="mini"
|
||||||
type="date"
|
@click="handleScanQrCode"
|
||||||
v-model="formData.nextCheckTime"
|
class="search-btn"
|
||||||
@change="changeNextTime"
|
>
|
||||||
/>
|
二维码
|
||||||
</div>
|
</button>
|
||||||
<div>
|
</view>
|
||||||
<span><span style="color: red">*</span>出厂时间:</span>
|
</view>
|
||||||
<uni-datetime-picker type="date" v-model="formData.outFacTime" @change="changeFacTime" />
|
|
||||||
</div>
|
|
||||||
<div style="display: flex; align-items: center; justify-content: space-between">
|
|
||||||
<div><span style="color: red">*</span>机具厂家:</div>
|
|
||||||
<div class="popup" style="width: 70%" @click="handlePopup(2)">
|
|
||||||
{{ formData.maVender || '请选择' }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
type="primary"
|
|
||||||
size="mini"
|
|
||||||
@click="handleSubmit"
|
|
||||||
style="margin-top: 30px; background-color: #18bc37; width: 100%"
|
|
||||||
>
|
|
||||||
确认修改
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<uni-popup ref="popup" border-radius="5px 5px 5px 5px" background-color="#fff">
|
<!-- 设备类型选择 -->
|
||||||
<div
|
<view class="card" v-if="deviceTypes.length > 1">
|
||||||
v-for="(item, index) in list"
|
<select-one
|
||||||
:key="index"
|
v-model="selectedDeviceTypeId"
|
||||||
class="popup-item"
|
:options="deviceTypes"
|
||||||
@click.stop="handleCheck(item)"
|
placeholder="请选择对应机具"
|
||||||
>
|
@change="handleDeviceTypeChange"
|
||||||
<div>{{ item.name }}</div>
|
/>
|
||||||
<uni-data-checkbox
|
</view>
|
||||||
v-model="item.isChecked"
|
|
||||||
:localdata="range"
|
<!-- 表单区域 -->
|
||||||
@change="handleCheck(item, $event)"
|
<view class="card">
|
||||||
></uni-data-checkbox>
|
<uni-forms :model="formData" label-width="200rpx" :border="true">
|
||||||
</div>
|
<uni-forms-item label="设备类型" name="materialName" required>
|
||||||
</uni-popup>
|
<uni-easyinput disabled v-model="formData.materialName" />
|
||||||
<ScanQrCode ref="scanQrCodeRef" @scanSuccess="handleScanSuccess" @scanError="handleScanError" />
|
</uni-forms-item>
|
||||||
|
|
||||||
|
<uni-forms-item label="规格型号" name="materialModel" required>
|
||||||
|
<uni-easyinput v-model="formData.materialModel" />
|
||||||
|
</uni-forms-item>
|
||||||
|
|
||||||
|
<uni-forms-item label="二维码" name="qrCode" required>
|
||||||
|
<uni-easyinput disabled v-model="formData.qrCode" />
|
||||||
|
</uni-forms-item>
|
||||||
|
|
||||||
|
<uni-forms-item label="设备编码" name="maCode" required>
|
||||||
|
<uni-easyinput disabled v-model="formData.maCode" />
|
||||||
|
</uni-forms-item>
|
||||||
|
|
||||||
|
<uni-forms-item label="设备状态" name="maStatus" required>
|
||||||
|
<uni-easyinput disabled v-model="formData.maStatus" />
|
||||||
|
</uni-forms-item>
|
||||||
|
|
||||||
|
<uni-forms-item label="本次检修人员" name="checkMan" required>
|
||||||
|
<uni-easyinput v-model="formData.checkMan" />
|
||||||
|
</uni-forms-item>
|
||||||
|
|
||||||
|
<uni-forms-item label="本次检修时间" name="thisCheckTime" required>
|
||||||
|
<uni-datetime-picker
|
||||||
|
type="date"
|
||||||
|
v-model="formData.thisCheckTime"
|
||||||
|
@change="handleThisCheckTimeChange"
|
||||||
|
/>
|
||||||
|
</uni-forms-item>
|
||||||
|
|
||||||
|
<uni-forms-item label="下次检修时间" name="nextCheckTime" required>
|
||||||
|
<uni-datetime-picker
|
||||||
|
type="date"
|
||||||
|
v-model="formData.nextCheckTime"
|
||||||
|
@change="handleNextCheckTimeChange"
|
||||||
|
/>
|
||||||
|
</uni-forms-item>
|
||||||
|
|
||||||
|
<uni-forms-item label="出厂时间" name="outFacTime" required>
|
||||||
|
<uni-datetime-picker
|
||||||
|
type="date"
|
||||||
|
v-model="formData.outFacTime"
|
||||||
|
@change="handleOutFacTimeChange"
|
||||||
|
/>
|
||||||
|
</uni-forms-item>
|
||||||
|
|
||||||
|
<uni-forms-item label="机具厂家" name="supplierId" required>
|
||||||
|
<select-one
|
||||||
|
ref="supplierSelect"
|
||||||
|
v-model="formData.supplierId"
|
||||||
|
:options="suppliers"
|
||||||
|
placeholder="请选择机具厂家"
|
||||||
|
@change="handleSupplierChange"
|
||||||
|
/>
|
||||||
|
</uni-forms-item>
|
||||||
|
</uni-forms>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 提交按钮 -->
|
||||||
|
<view class="submit-btn-container">
|
||||||
|
<button class="submit-btn" @click="handleSubmit">
|
||||||
|
确认
|
||||||
|
</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<ScanQrCode
|
||||||
|
ref="scanQrCodeRef"
|
||||||
|
@scanSuccess="handleScanSuccess"
|
||||||
|
@scanError="handleScanError"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { getInfoByCode, updateInfo } from '@/services/information'
|
import { ref, onMounted } from 'vue'
|
||||||
import { getSupplierList } from '@/services/repair/repair.js'
|
import {
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
getInfoByCode,
|
||||||
import { reactive, ref } from 'vue'
|
updateInfo,
|
||||||
|
getSupplierList,
|
||||||
|
} from '@/services/information'
|
||||||
import ScanQrCode from '@/pages/devicesSearch/ScanQrCode'
|
import ScanQrCode from '@/pages/devicesSearch/ScanQrCode'
|
||||||
|
import SelectOne from '../repair/tree-select/select-one.vue'
|
||||||
|
|
||||||
const keyWord = ref('')
|
// Refs
|
||||||
const qrCode = ref('')
|
const scanQrCodeRef = ref(null)
|
||||||
let formData = reactive({
|
const selectedDeviceTypeId = ref('')
|
||||||
id: '',
|
const supplierSelect = ref('')
|
||||||
maVender: '',
|
|
||||||
supplierId: '',
|
|
||||||
})
|
|
||||||
const scanQrCodeRef = ref()
|
|
||||||
const popup = ref()
|
|
||||||
const typeName = ref('')
|
|
||||||
const list = ref([])
|
|
||||||
const typeList = ref([]) // 设备类型
|
|
||||||
const range = ref([{ value: 0, text: '' }])
|
|
||||||
const supplierList = ref([]) // 厂家
|
|
||||||
|
|
||||||
onLoad(() => {
|
// 搜索参数
|
||||||
console.log('onLoad')
|
const searchParams = ref({
|
||||||
getSupplier()
|
keyWord: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
const back = () => {
|
// 表单数据
|
||||||
uni.navigateBack({
|
const formData = ref({
|
||||||
delta: 1,
|
materialName: '',
|
||||||
})
|
materialModel: '',
|
||||||
|
qrCode: '',
|
||||||
|
maCode: '',
|
||||||
|
maStatus: '',
|
||||||
|
checkMan: '',
|
||||||
|
thisCheckTime: '',
|
||||||
|
nextCheckTime: '',
|
||||||
|
outFacTime: '',
|
||||||
|
supplierId: '',
|
||||||
|
})
|
||||||
|
|
||||||
|
// 数据列表
|
||||||
|
const deviceTypes = ref([])
|
||||||
|
const suppliers = ref([])
|
||||||
|
|
||||||
|
// 生命周期钩子
|
||||||
|
onMounted(() => {
|
||||||
|
fetchSuppliers()
|
||||||
|
})
|
||||||
|
|
||||||
|
// 方法
|
||||||
|
const handleBack = () => {
|
||||||
|
uni.navigateBack({ delta: 1 })
|
||||||
}
|
}
|
||||||
|
|
||||||
const onQrCode = () => {
|
const handleSearch = async () => {
|
||||||
console.log('🚀 ~ onQrCode ~ 二维码:')
|
if (!searchParams.value.keyWord) {
|
||||||
if (scanQrCodeRef.value) scanQrCodeRef.value.scanQrCode()
|
uni.showToast({ title: '请输入设备编码', icon: 'none' })
|
||||||
}
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const handleSearch = () => {
|
try {
|
||||||
console.log('🚀 ~ handleSearch ~ 查询:', keyWord.value)
|
const res = await getInfoByCode({ maCode: searchParams.value.keyWord })
|
||||||
if (!keyWord.value) {
|
if (res.code === 200 && res.data?.length) {
|
||||||
uni.showToast({
|
deviceTypes.value = res.data.map(item => ({
|
||||||
title: '请输入设备编码',
|
...item,
|
||||||
icon: 'none',
|
id: item.maId,
|
||||||
})
|
label: `${item.materialName}-${item.materialModel}`,
|
||||||
return
|
}))
|
||||||
}
|
|
||||||
qrCode.value = ''
|
if (res.data.length === 1) {
|
||||||
typeList.value = []
|
handleDeviceTypeChange(res.data[0])
|
||||||
getInfo()
|
}
|
||||||
}
|
|
||||||
const getInfo = () => {
|
|
||||||
const params = {
|
|
||||||
maCode: keyWord.value,
|
|
||||||
qrCode: qrCode.value,
|
|
||||||
}
|
|
||||||
resetFormData()
|
|
||||||
getInfoByCode(params)
|
|
||||||
.then((res) => {
|
|
||||||
if (res.code === 200 && res.data && res.data.length > 0) {
|
|
||||||
typeList.value = res.data.map((option) => {
|
|
||||||
return {
|
|
||||||
...option,
|
|
||||||
id: option.maId,
|
|
||||||
name: option.materialName + '-' + option.materialModel,
|
|
||||||
isChecked: 1,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if (res.data.length === 1) {
|
|
||||||
formData = res.data[0]
|
|
||||||
}
|
}
|
||||||
}
|
} catch (error) {
|
||||||
})
|
console.error('获取设备信息失败:', error)
|
||||||
.catch((error) => {
|
uni.showToast({ title: '查询失败', icon: 'none' })
|
||||||
console.log(error)
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取厂家
|
const fetchSuppliers = async () => {
|
||||||
const getSupplier = () => {
|
try {
|
||||||
getSupplierList()
|
const res = await getSupplierList()
|
||||||
.then((res) => {
|
if (res.code === 200) {
|
||||||
if (res.code === 200) {
|
suppliers.value = res.rows.map(item => ({
|
||||||
supplierList.value = res.rows.map((item) => {
|
id: item.supplierId,
|
||||||
return {
|
label: item.supplier,
|
||||||
...item,
|
}))
|
||||||
id: item.supplierId,
|
}
|
||||||
name: item.supplier,
|
} catch (error) {
|
||||||
isChecked: 1,
|
console.error('获取供应商列表失败:', error)
|
||||||
isSupplier: true,
|
}
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.log(error)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const changeTime = (e) => {
|
const handleDeviceTypeChange = (item) => {
|
||||||
formData.thisCheckTime = e
|
console.log(item)
|
||||||
|
selectedDeviceTypeId.value = item.maId
|
||||||
|
formData.value = {
|
||||||
|
materialName: item.materialName,
|
||||||
|
materialModel: item.materialModel,
|
||||||
|
qrCode: item.qrCode,
|
||||||
|
maCode: item.maCode,
|
||||||
|
maStatus: item.maStatus,
|
||||||
|
checkMan: item.checkMan || '',
|
||||||
|
thisCheckTime: item.thisCheckTime || '',
|
||||||
|
nextCheckTime: item.nextCheckTime || '',
|
||||||
|
outFacTime: item.outFacTime || '',
|
||||||
|
supplierId: item.supplierId || '',
|
||||||
|
}
|
||||||
|
|
||||||
|
supplierSelect.value.showLabel = item.maVender
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const changeNextTime = (e) => {
|
const handleSupplierChange = (item) => {
|
||||||
formData.nextCheckTime = e
|
formData.value.supplierId = item.id
|
||||||
}
|
}
|
||||||
|
|
||||||
const changeFacTime = (e) => {
|
const handleThisCheckTimeChange = (date) => {
|
||||||
formData.outFacTime = e
|
formData.value.thisCheckTime = date
|
||||||
|
// 自动计算下次检修时间(1年后)
|
||||||
|
if (date) {
|
||||||
|
const nextDate = new Date(date)
|
||||||
|
nextDate.setFullYear(nextDate.getFullYear() + 1)
|
||||||
|
formData.value.nextCheckTime = formatDate(nextDate)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handlePopup = (type) => {
|
const handleNextCheckTimeChange = (date) => {
|
||||||
console.log('🚀 ~ handlePopup ~ 弹窗:')
|
formData.value.nextCheckTime = date
|
||||||
if (type === 1) {
|
|
||||||
list.value = typeList.value
|
|
||||||
} else {
|
|
||||||
list.value = supplierList.value
|
|
||||||
}
|
|
||||||
if (list.value.length === 0) {
|
|
||||||
uni.showToast({ title: '暂无数据', icon: 'none' })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
popup.value.open()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleCheck = (item) => {
|
const handleOutFacTimeChange = (date) => {
|
||||||
console.log('🚀 ~ handleCheck ~ 单选:', item)
|
formData.value.outFacTime = date
|
||||||
// 循环 typeList 将当前点击的 item.isChecked 设置为 0 其他设置 1
|
}
|
||||||
list.value.forEach((i) => {
|
|
||||||
i.isChecked = i.id === item.id ? 0 : 1
|
const handleScanQrCode = () => {
|
||||||
})
|
scanQrCodeRef.value?.scanQrCode()
|
||||||
|
|
||||||
if (item.isSupplier) {
|
|
||||||
formData.maVender = item.supplier
|
|
||||||
formData.supplierId = item.supplierId
|
|
||||||
} else {
|
|
||||||
formData = {}
|
|
||||||
formData = item
|
|
||||||
typeName.value = item.name
|
|
||||||
}
|
|
||||||
|
|
||||||
popup.value.close()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理扫描成功事件
|
|
||||||
const handleScanSuccess = (result) => {
|
const handleScanSuccess = (result) => {
|
||||||
qrCode.value = result?.data?.split('?qrcode=')[1] || result?.data
|
const qrCode = result?.data?.split('?qrcode=')[1]
|
||||||
if (qrCode.value === '') {
|
if (qrCode) {
|
||||||
uni.showToast({ title: '扫码识别失败', icon: 'none' })
|
searchParams.value.keyWord = ''
|
||||||
} else {
|
formData.value.qrCode = qrCode
|
||||||
keyWord.value = ''
|
handleSearch()
|
||||||
getInfo()
|
} else {
|
||||||
}
|
uni.showToast({ title: '扫码识别失败', icon: 'none' })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理扫描失败事件
|
|
||||||
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 = async () => {
|
||||||
const handleSubmit = () => {
|
const requiredFields = ['materialModel', 'outFacTime', 'supplierId']
|
||||||
// 必填项 验证
|
const missingField = requiredFields.find(field => !formData.value[field])
|
||||||
console.log('🚀 ~ handleSubmit ~ formData:', formData)
|
|
||||||
if (!formData.materialModel || !formData.outFacTime || !formData.maVender) {
|
if (missingField) {
|
||||||
uni.showToast({ title: '请填写完整信息', icon: 'none' })
|
uni.showToast({ title: '请填写完整信息', icon: 'none' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
delete formData.maStatus
|
|
||||||
updateInfo(formData)
|
try {
|
||||||
.then((res) => {
|
const payload = {
|
||||||
if (res.code === 200) {
|
maId: selectedDeviceTypeId.value,
|
||||||
uni.showToast({
|
materialModel: formData.value.materialModel,
|
||||||
title: res.msg,
|
checkMan: formData.value.checkMan,
|
||||||
icon: 'none',
|
thisCheckTime: formData.value.thisCheckTime,
|
||||||
})
|
nextCheckTime: formData.value.nextCheckTime,
|
||||||
getInfo()
|
outFacTime: formData.value.outFacTime,
|
||||||
}
|
maVender: formData.value.supplierId,
|
||||||
})
|
}
|
||||||
.catch((error) => {
|
|
||||||
console.log(error)
|
const res = await updateInfo(payload)
|
||||||
})
|
if (res.code === 200) {
|
||||||
|
resetForm()
|
||||||
|
uni.showToast({ title: res.msg, icon: 'none' })
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('提交失败:', error)
|
||||||
|
uni.showToast({ title: '提交失败', icon: 'none' })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const resetFormData = () => {
|
|
||||||
Object.keys(formData).forEach((key) => {
|
const resetForm = () => {
|
||||||
formData[key] = ''
|
deviceTypes.value = []
|
||||||
})
|
formData.value = {
|
||||||
typeName.value = ''
|
materialName: '',
|
||||||
typeList.value = []
|
materialModel: '',
|
||||||
|
qrCode: '',
|
||||||
|
maCode: '',
|
||||||
|
maStatus: '',
|
||||||
|
checkMan: '',
|
||||||
|
thisCheckTime: '',
|
||||||
|
nextCheckTime: '',
|
||||||
|
outFacTime: '',
|
||||||
|
supplierId: '',
|
||||||
|
}
|
||||||
|
supplierSelect.value.showLabel = ''
|
||||||
|
selectedDeviceTypeId.value = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
const formatDate = (date) => {
|
||||||
|
const year = date.getFullYear()
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||||
|
const day = String(date.getDate()).padStart(2, '0')
|
||||||
|
return `${year}-${month}-${day}`
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style lang="scss">
|
||||||
.content {
|
.container {
|
||||||
padding: 10px;
|
padding: 24rpx 24rpx 100rpx;
|
||||||
|
background-color: #f7f8fa;
|
||||||
|
}
|
||||||
|
|
||||||
.search {
|
.nav-back {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
}
|
||||||
margin-bottom: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup {
|
.card {
|
||||||
background: #fff;
|
padding: 32rpx;
|
||||||
/* margin: 20px 0 30px; */
|
background-color: #fff;
|
||||||
padding: 5px 10px;
|
border-radius: 20rpx;
|
||||||
}
|
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.search-item {
|
.search-card {
|
||||||
line-height: 1.9;
|
.search-container {
|
||||||
div {
|
display: flex;
|
||||||
display: flex;
|
align-items: center;
|
||||||
align-items: center;
|
gap: 10px;
|
||||||
margin-bottom: 5px;
|
|
||||||
|
.search-btn {
|
||||||
|
margin-left: 10px;
|
||||||
|
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.popup-item {
|
.submit-btn-container {
|
||||||
padding: 10px;
|
position: fixed;
|
||||||
border-bottom: 1px solid #c7c9ce;
|
bottom: 0;
|
||||||
display: flex;
|
left: 0;
|
||||||
align-items: center;
|
right: 0;
|
||||||
justify-content: space-between;
|
padding: 20rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
|
||||||
|
|
||||||
|
.submit-btn {
|
||||||
|
width: 100%;
|
||||||
|
height: 88rpx;
|
||||||
|
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 44rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
opacity: 0.9;
|
||||||
|
transform: scale(0.98);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .uni-popup__wrapper {
|
/* 表单样式优化 */
|
||||||
width: calc(100% - 20px);
|
.uni-forms-item {
|
||||||
max-height: 80vh;
|
padding: 24rpx 0;
|
||||||
overflow: auto;
|
border-bottom: 2rpx solid #f5f5f5;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-forms-item__label {
|
||||||
|
color: #8c8c8c;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .uni-data-checklist {
|
/* 输入框和选择框统一样式 */
|
||||||
// 去掉 flex: 1
|
.uni-easyinput__content,
|
||||||
flex: none;
|
.uni-select {
|
||||||
|
border: 2rpx solid #e8e8e8;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
padding: 0 24rpx;
|
||||||
|
|
||||||
|
&:focus-within {
|
||||||
|
border-color: #3784fb;
|
||||||
|
box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -293,8 +293,7 @@ onLoad(() => {
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.accept {
|
.accept {
|
||||||
padding: 24rpx;
|
padding: 24rpx 24rpx 100rpx;
|
||||||
height: 90vh;
|
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
background-color: #f7f8fa;
|
background-color: #f7f8fa;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
@ -380,13 +379,17 @@ onLoad(() => {
|
||||||
|
|
||||||
// 底部按钮
|
// 底部按钮
|
||||||
.btn {
|
.btn {
|
||||||
margin-top: auto;
|
position: fixed;
|
||||||
padding: 32rpx;
|
bottom: 0;
|
||||||
// background: #fff;
|
left: 0;
|
||||||
// box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
|
width: calc(100% - 20px);
|
||||||
|
background-color: #fff; /* 可根据需要设定背景色 */
|
||||||
|
padding: 10px;
|
||||||
|
box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1); /* 可选:添加顶部阴影 */
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: center; /* 水平居中 */
|
||||||
gap: 24rpx;
|
gap: 10px; /* 按钮间距 */
|
||||||
|
z-index: 999; /* 保证显示在最上层 */
|
||||||
|
|
||||||
.btn-cont {
|
.btn-cont {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,14 @@ export const updateInfo = (data) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const getSupplierList = (data) => {
|
||||||
|
return http({
|
||||||
|
method: 'GET',
|
||||||
|
url: '/material/ma_supplier_info/select',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 盘点绑定-获取设备信息
|
// 盘点绑定-获取设备信息
|
||||||
export const getInventoryInfo = (data) => {
|
export const getInventoryInfo = (data) => {
|
||||||
return http({
|
return http({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue