现场维修

This commit is contained in:
jiang 2025-06-25 18:16:48 +08:00
parent 62ad1fa629
commit 4926028e90
4 changed files with 449 additions and 2 deletions

View File

@ -38,6 +38,12 @@
},
/* */
//
{
"path": "pages/repair/wsMaInfo/index",
"style": {
"navigationBarTitleText": "编码采集"
}
},
{
"path": "pages/new-purchase/accept/index",
"style": {

View File

@ -0,0 +1,364 @@
<template>
<view class="accept">
<div class="card">
<uni-forms label-width="170rpx" :border="true">
<uni-forms-item label="机具类型:" name="maName" required>
<select-one style="width: 100%; height: 90rpx" :options="maNameList" placeholder="请选择机具类型"
@change="onMaNameChange" @clear="onMaNameClear" />
</uni-forms-item>
<uni-forms-item label="机具规格:" name="maModel" required>
<select-one style="width: 100%; height: 90rpx" :options="maModelList" placeholder="请选择机具规格"
:key="new Date()" @change="onMaModelChange" @clear="onMaModelClear" />
</uni-forms-item>
<uni-forms-item label="机具编码:" name="maCode" required>
<uni-easyinput v-model="maCode" maxlength="30" placeholder="请输入机具编码" />
</uni-forms-item>
<uni-forms-item label="出厂厂家:" name="supplier" required>
<select-one style="width: 100%; height: 90rpx" :options="supplierList" placeholder="请选择出厂厂家"
:key="new Date()" @change="onSupplierChange" @clear="onSupplierClear" />
</uni-forms-item>
<uni-forms-item label="检修员:" name="repairMan" required>
<uni-easyinput v-model="repairMan" maxlength="30" placeholder="请输入检修员" />
</uni-forms-item>
<uni-forms-item label="检验员:" name="checkMan" required>
<uni-easyinput v-model="checkMan" maxlength="30" placeholder="请输入检验员" />
</uni-forms-item>
<uni-forms-item label="联系方式:" name="phone" required>
<uni-easyinput v-model="phone" maxlength="11" placeholder="请输入联系方式" />
</uni-forms-item>
</uni-forms>
</div>
<div class="btn">
<button class="btn-cont" @click="clearForm">清空</button>
<button class="btn-cont" @click="confirmAdd">确认</button>
</div>
</view>
</template>
<script setup>
import {
ref
} from 'vue'
import {
addWsMaInfo,
getMaTypeData,
getMaModeData,
getSupplier
} from '@/services/wsMaInfo/wsMaInfo.js'
import SelectOne from '../tree-select/select-one'
import {
onLoad
} from '@dcloudio/uni-app'
const maName = ref('') //
const maModel = ref('') //
const maCode = ref('') //
const supplier = ref('') //
const repairMan = ref('王鹏') //
const checkMan = ref('高民') //
const phone = ref('0551-63703966') //
const modelId = ref('')
const maNameList = ref([]) //
const maModelList = ref([]) //
const supplierList = ref([]) //
//
const clearForm = () => {
maName.value = ''
maModel.value = ''
maCode.value = ''
supplier.value = ''
repairMan.value = ''
checkMan.value = ''
phone.value = ''
}
const onMaNameChange = (item) => {
maName.value = item.label;
maModel.value = null; //
getMaModeData(item.id).then(res => {
if (res.code === 200) {
maModelList.value = res.data.map(option => {
return {
id: option.id,
label: option.name,
}
});
}
}).catch(error => {
console.log(error)
})
};
const onMaModelChange = (item) => {
modelId.value = item.id;
maModel.value = item.label;
}
const onSupplierChange = (item) => {
supplier.value = item.label;
}
const onMaNameClear = () => {
maName.value = null;
maModel.value = null; //
};
const onMaModelClear = () => {
maModel.value = null;
};
const onSupplierClear = () => {
supplier.value = null;
};
const getSupplierSelect = () => {
getSupplier().then(res => {
if (res.code === 200) {
supplierList.value = res.data.map(option => {
return {
id: option.id,
label: option.name,
}
});
}
}).catch(error => {
console.log(error)
})
}
const getMaName = () => {
getMaTypeData().then(res => {
if (res.code === 200) {
maNameList.value = res.data.map(option => {
return {
id: option.id,
label: option.name,
}
});
console.log(maModelList)
}
}).catch(error => {
console.log(error)
})
}
//
const confirmAdd = async () => {
console.log(maName.value)
if (!maName.value) {
return uni.showToast({
title: '请选择机具类型',
icon: 'none'
})
}
if (!maModel.value) {
return uni.showToast({
title: '请选择机具规格',
icon: 'none'
})
}
if (!maCode.value) {
return uni.showToast({
title: '请输入机具编码',
icon: 'none'
})
}
if (!supplier.value) {
return uni.showToast({
title: '请输入出厂厂家',
icon: 'none'
})
}
if (!repairMan.value) {
return uni.showToast({
title: '请输入检修员',
icon: 'none'
})
}
if (!checkMan.value) {
return uni.showToast({
title: '请输入检验员',
icon: 'none'
})
}
if (!phone.value) {
return uni.showToast({
title: '请输入联系方式',
icon: 'none'
})
}
const postData = {
maName: maName.value,
maModel: maModel.value,
maCode: maCode.value,
supplier: supplier.value,
repairMan: repairMan.value,
checkMan: checkMan.value,
phone: phone.value,
modelId: modelId.value
}
try {
const res = await addWsMaInfo(postData)
if (res.code === 200) {
uni.showToast({
title: '新增成功',
icon: 'success'
})
clearForm()
uni.navigateBack()
} else {
uni.showToast({
title: res.msg || '新增失败',
icon: 'none'
})
}
} catch (error) {
console.error(error)
uni.showToast({
title: '请求失败,请稍后重试',
icon: 'none'
})
}
}
onLoad(() => {
getMaName();
getSupplierSelect();
})
</script>
<style lang="scss">
.accept {
padding: 24rpx;
height: 90vh;
word-break: break-all;
background-color: #f7f8fa;
display: flex;
flex-direction: column;
//
.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;
}
.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;
color: #3784fb;
border: 2rpx solid #3784fb;
box-shadow: none;
&:active {
background: #f7f8fa;
}
}
}
}
}
</style>

View File

@ -107,7 +107,7 @@
</text>
</view>
</view>
<view class="new-purchase" >
<div class="title-text">
<div></div>
@ -143,7 +143,7 @@ onShow((options) => {
const newInfoList = ref([
{
title: '编码采集',
url: '/pages/new-purchase/bind/index',
url: '/pages/repair/wsMaInfo/index',
iconSrc: '../../static/workbench/bianMa.png',
},
{
@ -274,6 +274,11 @@ const repairList = ref([
url: '/pages/repair/repairManage/index',
iconSrc: '../../static/workbench/repair.png',
},
{
title: '现场维修',
url: '/pages/repair/fieldMaintenance/index',
iconSrc: '../../static/workbench/repair.png',
},
{
title: '修试审核',
url: '/pages/repair/testExamine/index',

View File

@ -0,0 +1,72 @@
import {
http
} from '@/utils/http' // 你的 axios 封装,支持 Promise
// 查询单个机具信息,传 id
export function getWsMaInfoById(id) {
return http({
url: `/material/wsMaInfo/${id}`,
method: 'get',
})
}
// 查询所有机具信息列表
export function getWsMaInfoList() {
return http({
url: '/material/wsMaInfo/list',
method: 'get',
})
}
// 新增机具信息,传对象 info
export function addWsMaInfo(info) {
return http({
url: '/material/wsMaInfo/addWsMaInfo',
method: 'post',
data: info,
})
}
// 更新机具信息,传对象 info必须带 id
export function updateWsMaInfo(info) {
return http({
url: '/material/wsMaInfo/updateWsMaInfo',
method: 'post',
data: info,
})
}
// 删除机具信息,传 id
export function deleteWsMaInfo(id) {
return http({
url: `/material/wsMaInfo/${id}`,
method: 'post',
})
}
export const getMaTypeData = () => {
return http({
method: 'POST',
url: '/material/wsMaInfo/getMaTypeData',
data: {}
})
}
export const getMaModeData = (parentId) => {
return http({
method: 'POST',
url: '/material/wsMaInfo/getMaModeData',
data: {parentId}
})
}
export const getSupplier = () => {
return http({
method: 'POST',
url: '/material/wsMaInfo/getSupplier',
data: {}
})
}