优化布局,整体字体按钮大一点。

选择厂家不回显,提交不成功。
This commit is contained in:
jiang 2025-07-28 18:40:39 +08:00
parent bdca51254b
commit 2bb643a1e7
3 changed files with 686 additions and 556 deletions

View File

@ -1,5 +1,6 @@
<template> <template>
<uni-nav-bar fixed :border="false" background-color="#dcf4ff" color="black" status-bar title="日期更新"><template <uni-nav-bar fixed :border="false" background-color="#dcf4ff" color="black" status-bar title="日期更新">
<template
v-slot:left> v-slot:left>
<view style="display: flex; align-items: center" @click="back"> <view style="display: flex; align-items: center" @click="back">
<!-- 图标 --> <!-- 图标 -->
@ -13,36 +14,52 @@
</view> </view>
</template> </template>
</uni-nav-bar> </uni-nav-bar>
<div class="content"> <view class="accept">
<div class="search"> <div class="card">
<div style="display: flex; justify-content: space-between; align-items: center">
<uni-easyinput v-model="keyWord" placeholder="请输入设备编码"></uni-easyinput> <uni-easyinput v-model="keyWord" placeholder="请输入设备编码"></uni-easyinput>
<button type="primary" size="mini" @click="handleSearch" <button type="primary" size="mini" class="btn-cont" @click="handleSearch"
style="margin-left: 10px; background-color: #18bc37"> style="margin-left: 10px;background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
">
查询 查询
</button> </button>
</div> </div>
<div v-if="typeList.length > 1" class="popup" @click="handlePopup">{{ typeName || '请选择对应机具' }}</div>
<div class="search-item" v-if="typeList.length > 0">
<div>设备类型{{ formData.maType }}</div>
<div>规格型号{{ formData.typeName }}</div>
<div>设备编码{{ formData.code }}</div>
<div>本次检修人员{{ formData.repairer }}</div>
<div>本次检修时间{{ formData.repairTime }}</div>
<div>下次检修时间{{ formData.nextRepairTime }}</div>
</div> </div>
<button v-if="typeList.length > 0" type="primary" size="mini" @click="handleSubmit"
style="margin-top: 30px; background-color: #18bc37; width: 100%">
<div v-if="typeList.length > 1" class="card">
<select-one style="width: 100%; height: 90rpx" :options="typeList" placeholder="请选择对应机具"
:key="typeList" @change="handleCheck" />
</div>
<div class="card" v-if="typeList.length > 0">
<div style="margin-bottom: 5px">设备类型{{ formData.maType }}</div>
<div style="margin-bottom: 5px">规格型号{{ formData.typeName }}</div>
<div style="margin-bottom: 5px">设备编码{{ formData.code }}</div>
<div style="margin-bottom: 5px">本次检修人员{{ formData.repairer }}</div>
<div style="margin-bottom: 5px">本次检修时间{{ formData.repairTime }}</div>
<div style="margin-bottom: 5px">下次检修时间{{ formData.nextRepairTime }}</div>
</div>
<div class="btn">
<button class="btn-cont" v-if="typeList.length > 0" type="primary" @click="handleSubmit"
>
确认修改 确认修改
</button> </button>
</div> </div>
</view>
<uni-popup ref="popup" border-radius="5px 5px 5px 5px" background-color="#fff"> <uni-popup ref="popup" class="card">
<div v-for="(item, index) in typeList" :key="index" class="popup-item" @click.stop="handleCheck(item)"> <div class="card" v-for="(item, index) in typeList" :key="index" @click.stop="handleCheck(item)">
<div>{{ item.name }}</div> <div style="display: flex; justify-content: space-between; align-items: center">
<uni-data-checkbox v-model="item.isChecked" :localdata="range" <uni-data-checkbox v-model="item.isChecked" :localdata="range"
@change="handleCheck(item, $event)"></uni-data-checkbox> @change="handleCheck(item, $event)"></uni-data-checkbox>
<div class="card">{{ item.name }}</div>
</div>
</div> </div>
</uni-popup> </uni-popup>
<ScanQrCode ref="scanQrCodeRef" @scanSuccess="handleScanSuccess" @scanError="handleScanError" /> <ScanQrCode ref="scanQrCodeRef" @scanSuccess="handleScanSuccess" @scanError="handleScanError" />
@ -51,11 +68,12 @@
<script setup> <script setup>
import { import {
getWsMaInfoList, getWsMaInfoList,
updateCheckTime updateCheckTime,
} from '@/services/wsMaInfo/wsMaInfo.js' } from '@/services/wsMaInfo/wsMaInfo.js'
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { reactive, ref } from 'vue' import { reactive, ref } from 'vue'
import ScanQrCode from '@/pages/devicesSearch/ScanQrCode' import ScanQrCode from '@/pages/devicesSearch/ScanQrCode'
import SelectOne from '../repair/tree-select/select-one.vue'
const keyWord = ref('') const keyWord = ref('')
const formData = reactive({ const formData = reactive({
@ -97,12 +115,12 @@
typeList.value = res.data.map(option => { typeList.value = res.data.map(option => {
return { return {
id: option.id, id: option.id,
name: option.maName + '-' + option.maModel + '-' + option.maCode, label: option.maName + '-' + option.maModel + '-' + option.maCode,
isChecked: 1, /* isChecked: 1,*/
item: option item: option,
} }
}); })
if (res.data.length === 1) { if (res.data.length === 1) {
console.log('🚀 ~ getWsMaInfoList ~ res.data.length:', res.data.length) console.log('🚀 ~ getWsMaInfoList ~ res.data.length:', res.data.length)
formData.id = res.data[0].id formData.id = res.data[0].id
@ -170,7 +188,7 @@
// //
const handleSubmit = () => { const handleSubmit = () => {
updateCheckTime(formData.id).then(res => { updateCheckTime(formData.code).then(res => {
if (res.code === 200) { if (res.code === 200) {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
@ -186,44 +204,135 @@
} }
</script> </script>
<style scoped lang="scss"> <style lang="scss">
.content { .accept {
padding: 10px; padding: 24rpx;
height: 90vh;
.search { word-break: break-all;
background-color: #f7f8fa;
display: flex; display: flex;
align-items: center; flex-direction: column;
justify-content: space-between;
margin-bottom: 30px; //
.card {
padding: 32rpx;
background-color: #fff;
border-radius: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
margin-bottom: 24rpx;
height: auto;
//
:deep(.uni-forms) {
.uni-forms-item {
padding: 24rpx 0;
margin-bottom: 0;
border-bottom: 2rpx solid #f5f5f5;
&:last-child {
border-bottom: none;
} }
.popup { .uni-forms-item__label {
height: 2.75rem;
color: #8c8c8c;
}
//
.uni-data-select {
.uni-select {
border: 2rpx solid #e8e8e8;
border-radius: 12rpx;
height: 88rpx;
padding: 0 24rpx;
transition: all 0.3s ease;
&:focus-within {
border-color: #3784fb;
box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1);
}
.uni-select__input-box {
height: 88rpx;
line-height: 88rpx;
}
.uni-select__input-text {
font-size: 28rpx;
color: #262626;
}
}
}
//
.uni-easyinput {
.uni-easyinput__content {
background-color: #f7f8fa;
border: 2rpx solid #e8e8e8;
border-radius: 12rpx;
height: 88rpx;
padding: 0 24rpx;
transition: all 0.3s ease;
&:focus-within {
border-color: #3784fb;
box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1);
}
.uni-easyinput__content-input {
font-size: 28rpx;
height: 88rpx;
line-height: 88rpx;
color: #262626;
}
}
}
}
}
}
//
.btn {
margin-top: auto;
padding: 32rpx;
// background: #fff;
// box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
display: flex;
justify-content: space-between;
gap: 24rpx;
.btn-cont {
flex: 1;
height: 88rpx;
line-height: 88rpx;
text-align: center;
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
color: #fff;
border-radius: 44rpx;
font-size: 32rpx;
font-weight: 600;
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
transition: all 0.3s ease;
&:active {
transform: scale(0.98);
opacity: 0.9;
box-shadow: 0 2rpx 8rpx rgba(55, 132, 251, 0.2);
}
//
&:first-child {
background: #fff; background: #fff;
margin: 0 0 30px; color: #3784fb;
padding: 5px 10px; border: 2rpx solid #3784fb;
} box-shadow: none;
.search-item { &:active {
line-height: 1.9; background: #f7f8fa;
} }
} }
.popup-item {
padding: 10px;
border-bottom: 1px solid #c7c9ce;
display: flex;
align-items: center;
justify-content: space-between;
} }
::v-deep .uni-popup__wrapper {
width: calc(100% - 20px);
max-height: 80vh;
overflow: auto;
} }
::v-deep .uni-data-checklist {
// flex: 1
flex: none;
} }
</style> </style>

View File

@ -1,5 +1,20 @@
<template> <template>
<view class="accept"> <view class="accept">
<div class="card">
<div style="display: flex; justify-content: space-between; align-items: center">
<button type="primary" v-if="fillNum >1" size="mini" @click="handleFillCode"
style="margin-right: 10px;">填充编码
</button>
<!-- 填充数量 -->
<uni-easyinput type="number" v-model="fillNum" maxlength="30" placeholder="请输入填充数量"
@blur="handleFillNumBlur" />
</div>
<div
style="display: flex; flex-wrap: wrap; justify-content: flex-start;max-height: 200px; overflow-y: auto">
<div v-for="(item, index) in maCode" :key="index" style="margin-right: 10px;">{{ item }}</div>
</div>
</div>
<div class="card"> <div class="card">
<uni-forms label-width="91px" :border="true"> <uni-forms label-width="91px" :border="true">
<uni-forms-item label="机具类型:" name="maName" required> <uni-forms-item label="机具类型:" name="maName" required>
@ -8,16 +23,22 @@
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="机具规格:" name="maModel" required> <uni-forms-item label="机具规格:" name="maModel" required>
<select-one style="width: 100%; height: 90rpx" :options="maModelList" placeholder="请选择机具规格" <select-one ref="maModelSelect" style="width: 100%; height: 90rpx" :options="maModelList"
placeholder="请选择机具规格"
:key="maName" @change="onMaModelChange" @clear="onMaModelClear" /> :key="maName" @change="onMaModelChange" @clear="onMaModelClear" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="机具编码:" name="maCode" required> <uni-forms-item v-if="fillNum>1" label="机具编码" name="maCode" required>
<div style="display: flex; justify-content: space-between; align-items: center;"> <div>
<uni-easyinput v-model="prefix" maxlength="30" placeholder="前缀"/> <uni-easyinput v-model="prefix" maxlength="30" placeholder="前缀" style="margin-bottom: 10px" />
<span style="margin: 0 10rpx;"> - </span>
<uni-easyinput type="number" v-model="postfix" maxlength="30" placeholder="后缀" /> <uni-easyinput type="number" v-model="postfix" maxlength="30" placeholder="后缀" />
</div> </div>
</uni-forms-item> </uni-forms-item>
<uni-forms-item v-if="fillNum === 1" label="机具编码:" name="maCodeOne" required>
<div style="display: flex; justify-content: space-between; align-items: center;">
<uni-easyinput v-model="maCodeOne" maxlength="30" placeholder="机具编码" />
</div>
</uni-forms-item>
<uni-forms-item label="出厂厂家:" name="supplier" required> <uni-forms-item label="出厂厂家:" name="supplier" required>
<select-one style="width: 100%; height: 90rpx" :options="supplierList" placeholder="请选择出厂厂家" <select-one style="width: 100%; height: 90rpx" :options="supplierList" placeholder="请选择出厂厂家"
:key="maName" @change="onSupplierChange" @clear="onSupplierClear" /> :key="maName" @change="onSupplierChange" @clear="onSupplierClear" />
@ -37,17 +58,6 @@
</uni-forms> </uni-forms>
</div> </div>
<div class="card">
<div style="display: flex; justify-content: space-between; align-items: center">
<button type="primary" size="mini" @click="handleFillCode" style="margin-right: 10px;">填充编码</button>
<!-- 填充数量 -->
<uni-easyinput type="number" v-model="fillNum" maxlength="30" placeholder="请输入填充数量" @blur="handleFillNumBlur" />
</div>
<div style="display: flex; flex-wrap: wrap; justify-content: flex-start;max-height: 200px; overflow-y: auto">
<div v-for="(item, index) in maCode" :key="index" style="margin-right: 10px;">{{ item }}</div>
</div>
</div>
<div class="btn"> <div class="btn">
<button class="btn-cont" @click="clearForm">清空</button> <button class="btn-cont" @click="clearForm">清空</button>
@ -58,22 +68,23 @@
<script setup> <script setup>
import { import {
ref ref,
} from 'vue' } from 'vue'
import { import {
addWsMaInfo, addWsMaInfo,
getMaTypeData, getMaTypeData,
getMaModeData, getMaModeData,
getSupplier getSupplier,
} from '@/services/wsMaInfo/wsMaInfo.js' } from '@/services/wsMaInfo/wsMaInfo.js'
import SelectOne from '../tree-select/select-one' import SelectOne from '../tree-select/select-one'
import { import {
onLoad onLoad,
} from '@dcloudio/uni-app' } from '@dcloudio/uni-app'
const maName = ref('') // const maName = ref('') //
const maModel = ref('') // const maModel = ref('') //
const maCode = ref([]) // const maCode = ref([]) //
const maCodeOne = ref('')
const supplier = ref('') // const supplier = ref('') //
const repairMan = ref('王鹏') // const repairMan = ref('王鹏') //
const checkMan = ref('高民') // const checkMan = ref('高民') //
@ -85,15 +96,13 @@
const prefix = ref() const prefix = ref()
const postfix = ref() const postfix = ref()
const fillNum = ref(1) // const fillNum = ref(1) //
const maModelSelect = ref(null)
// //
const clearForm = () => { const clearForm = () => {
maName.value = '' maModel.value = null
maModel.value = '' maModelSelect.value.showLabel = ''
maCode.value = [] maCode.value = []
supplier.value = '' maCodeOne.value = ''
repairMan.value = ''
checkMan.value = ''
phone.value = ''
} }
// //
@ -101,7 +110,7 @@
if (!prefix.value || !postfix.value) { if (!prefix.value || !postfix.value) {
uni.showToast({ uni.showToast({
title: '请填写编码前缀和后缀', title: '请填写编码前缀和后缀',
icon: 'none' icon: 'none',
}) })
return return
} }
@ -126,8 +135,8 @@
} }
const onMaNameChange = (item) => { const onMaNameChange = (item) => {
maName.value = item.label; maName.value = item.label
maModel.value = null; // maModel.value = null //
getMaModeData(item.id).then(res => { getMaModeData(item.id).then(res => {
if (res.code === 200) { if (res.code === 200) {
maModelList.value = res.data.map(option => { maModelList.value = res.data.map(option => {
@ -135,32 +144,32 @@
id: option.id, id: option.id,
label: option.name, label: option.name,
} }
}); })
} }
}).catch(error => { }).catch(error => {
console.log(error) console.log(error)
}) })
}; }
const onMaModelChange = (item) => { const onMaModelChange = (item) => {
modelId.value = item.id; modelId.value = item.id
maModel.value = item.label; maModel.value = item.label
} }
const onSupplierChange = (item) => { const onSupplierChange = (item) => {
supplier.value = item.label; supplier.value = item.label
} }
const onMaNameClear = () => { const onMaNameClear = () => {
maName.value = null; maName.value = null
maModel.value = null; // maModel.value = null //
}; }
const onMaModelClear = () => { const onMaModelClear = () => {
maModel.value = null; maModel.value = null
}; }
const onSupplierClear = () => { const onSupplierClear = () => {
supplier.value = null; supplier.value = null
}; }
const getSupplierSelect = () => { const getSupplierSelect = () => {
getSupplier().then(res => { getSupplier().then(res => {
@ -170,7 +179,7 @@
id: option.id, id: option.id,
label: option.name, label: option.name,
} }
}); })
} }
}).catch(error => { }).catch(error => {
console.log(error) console.log(error)
@ -184,7 +193,7 @@
id: option.id, id: option.id,
label: option.name, label: option.name,
} }
}); })
console.log(maModelList) console.log(maModelList)
} }
}).catch(error => { }).catch(error => {
@ -195,58 +204,70 @@
// //
const confirmAdd = async () => { const confirmAdd = async () => {
console.log(maName.value) console.log(maName.value)
console.log(maCode.value)
if (!maName.value) { if (!maName.value) {
return uni.showToast({ return uni.showToast({
title: '请选择机具类型', title: '请选择机具类型',
icon: 'none' icon: 'none',
}) })
} }
if (!maModel.value) { if (!maModel.value) {
return uni.showToast({ return uni.showToast({
title: '请选择机具规格', title: '请选择机具规格',
icon: 'none' icon: 'none',
}) })
} }
if (fillNum.value === 1) {
if (!maCodeOne.value) {
return uni.showToast({
title: '请填写具编码',
icon: 'none',
})
}
} else {
if (maCode.value.length === 0) { if (maCode.value.length === 0) {
return uni.showToast({ return uni.showToast({
title: '请生成机具编码', title: '请生成机具编码',
icon: 'none' icon: 'none',
}) })
} }
}
if (!supplier.value) { if (!supplier.value) {
return uni.showToast({ return uni.showToast({
title: '请输入出厂厂家', title: '请输入出厂厂家',
icon: 'none' icon: 'none',
}) })
} }
if (!repairMan.value) { if (!repairMan.value) {
return uni.showToast({ return uni.showToast({
title: '请输入检修员', title: '请输入检修员',
icon: 'none' icon: 'none',
}) })
} }
if (!checkMan.value) { if (!checkMan.value) {
return uni.showToast({ return uni.showToast({
title: '请输入检验员', title: '请输入检验员',
icon: 'none' icon: 'none',
}) })
} }
if (!phone.value) { if (!phone.value) {
return uni.showToast({ return uni.showToast({
title: '请输入联系方式', title: '请输入联系方式',
icon: 'none' icon: 'none',
}) })
} }
const postData = { const postData = {
maName: maName.value, maName: maName.value,
maModel: maModel.value, maModel: maModel.value,
maCodeList: maCode.value, maCodeList: fillNum.value > 1 ? maCode.value : [maCodeOne.value],
supplier: supplier.value, supplier: supplier.value,
repairMan: repairMan.value, repairMan: repairMan.value,
checkMan: checkMan.value, checkMan: checkMan.value,
phone: phone.value, phone: phone.value,
modelId: modelId.value modelId: modelId.value,
} }
try { try {
@ -254,18 +275,18 @@
if (res.code === 200) { if (res.code === 200) {
uni.showToast({ uni.showToast({
title: '新增成功', title: '新增成功',
icon: 'success' icon: 'success',
}) })
clearForm() clearForm()
uni.navigateBack() //uni.navigateBack()
} }
} catch (error) { } catch (error) {
console.error(error) console.error(error)
} }
} }
onLoad(() => { onLoad(() => {
getMaName(); getMaName()
getSupplierSelect(); getSupplierSelect()
}) })
</script> </script>

View File

@ -64,11 +64,11 @@ export const getMaModeData = (parentId) => {
} }
export const updateCheckTime = (id) => { export const updateCheckTime = (maCode) => {
return http({ return http({
method: 'POST', method: 'POST',
url: '/material/wsMaInfo/updateCheckTime', url: '/material/wsMaInfo/updateCheckTime',
data: {id} data: {maCode}
}) })
} }