This commit is contained in:
hongchao 2025-06-25 18:24:27 +08:00
commit d8fbad3f46
7 changed files with 841 additions and 18 deletions

View File

@ -38,6 +38,12 @@
},
/* */
//
{
"path": "pages/repair/wsMaInfo/index",
"style": {
"navigationBarTitleText": "编码采集"
}
},
{
"path": "pages/new-purchase/accept/index",
"style": {
@ -662,6 +668,12 @@
"navigationBarTitleText": "现场维修数量"
}
},
{
"path": "pages/dateUpdate/index",
"style": {
"navigationStyle": "custom"
}
},
// start
//
{

View File

@ -0,0 +1,201 @@
<template>
<uni-nav-bar
fixed
:border="false"
background-color="#dcf4ff"
color="black"
status-bar
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 class="popup" @click="handlePopup">{{ typeName }}</div>
<div class="search-item">
<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>
<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
v-for="(item, index) in typeList"
:key="index"
class="popup-item"
@click.stop="handleCheck(item)"
>
<div>{{ item.name }}</div>
<uni-data-checkbox
v-model="item.isChecked"
:localdata="range"
@change="handleCheck(item, $event)"
></uni-data-checkbox>
</div>
</uni-popup>
<ScanQrCode ref="scanQrCodeRef" @scanSuccess="handleScanSuccess" @scanError="handleScanError" />
</template>
<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app'
import { reactive, ref } from 'vue'
import ScanQrCode from '@/pages/devicesSearch/ScanQrCode'
const keyWord = ref('')
const formData = reactive({
maType: '', //
typeName: '', //
code: '', //
repairer: '', //
repairTime: '', //
nextRepairTime: '', //
})
const scanQrCodeRef = ref()
const popup = ref()
const typeName = ref('请选择对应机具')
const typeList = ref([
{
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(() => {
console.log('onLoad')
})
const back = () => {
uni.navigateBack({
delta: 1,
})
}
const onQrCode = () => {
console.log('🚀 ~ onQrCode ~ 二维码:')
if (scanQrCodeRef.value) scanQrCodeRef.value.scanQrCode()
}
const handleSearch = () => {
console.log('🚀 ~ handleSearch ~ 查询:', keyWord.value)
if (!keyWord.value) {
uni.showToast({
title: '请输入设备编码',
icon: 'none',
})
}
}
const handlePopup = () => {
console.log('🚀 ~ handlePopup ~ 弹窗:')
popup.value.open()
}
const handleCheck = (item) => {
console.log('🚀 ~ handleCheck ~ 单选:', item)
// typeList item.isChecked 0 1
typeList.value.forEach((i) => {
i.isChecked = i.id === item.id ? 0 : 1
})
typeName.value = item.name
popup.value.close()
}
//
const handleScanSuccess = (result) => {
keyWord.value = result?.text?.split('?qrcode=')[1] || result?.text
if (keyWord.value === '') {
uni.showToast({ title: '扫码识别失败', icon: 'none' })
} else {
handleSearch()
}
}
//
const handleScanError = (error) => {
console.error('扫描出错:', error.message)
uni.showToast({ title: error.message, icon: 'none' })
}
//
const handleSubmit = () => {}
</script>
<style scoped lang="scss">
.content {
padding: 10px;
.search {
display: flex;
align-items: center;
justify-content: space-between;
}
.popup {
background: #fff;
margin: 20px 0 30px;
padding: 5px 10px;
}
.search-item {
line-height: 1.9;
}
}
.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);
/* padding: 10px; */
}
::v-deep .uni-data-checklist {
// flex: 1
flex: none;
}
</style>

View File

@ -0,0 +1,169 @@
<template>
<view class="select-box">
<!-- 蒙版 -->
<view class="mask" v-show="show" @click="show = false"></view>
<!-- 输入框 -->
<view class="input-box" @click="openOptions">
<uni-easyinput v-model="showLabel" :placeholder="placeholder" maxlength="20" :disabled="disabled"
style="width: 100%; font-size: 28rpx;" @input="inputChange" @clear="handleClear" />
</view>
<!-- 下拉选项 -->
<view v-show="show" class="dropdown-wrap">
<scroll-view class="dropdown" scroll-y>
<view v-for="item in selectData" :key="item[valueKey]" class="option-item" @click="selectItem(item)">
{{ item[labelKey] }}
</view>
<view v-if="selectData.length === 0" class="option-no-data">无数据...</view>
</scroll-view>
<text class="triangle"></text>
</view>
</view>
</template>
<script>
export default {
name: "SelectOne",
props: {
options: {
type: Array,
default: () => [],
},
value: [String, Number],
placeholder: {
type: String,
default: "请选择",
},
labelKey: {
type: String,
default: "label",
},
valueKey: {
type: String,
default: "id",
},
disabled: {
type: Boolean,
default: false,
},
},
data() {
return {
show: false,
showLabel: "",
selectData: [],
};
},
watch: {
value: {
immediate: true,
handler(val) {
console.log(val)
if (!val) {
this.showLabel = '';
} else {
const match = this.options.find((item) => item[this.valueKey] === val);
this.showLabel = match ? match[this.labelKey] : '';
}
this.selectData = this.options;
}
},
options: {
immediate: true,
handler(val) {
this.selectData = val || [];
},
},
},
methods: {
openOptions() {
if (!this.disabled) this.show = true;
},
inputChange(val) {
this.selectData = this.options.filter((item) =>
item[this.labelKey].includes(val)
);
},
selectItem(item) {
this.show = false;
this.showLabel = item[this.labelKey];
this.$emit("change", item);
this.$emit("update:value", item[this.valueKey]); // v-model
},
handleClear() {
this.showLabel = "";
this.selectData = this.options;
this.$emit("clear");
this.$emit("update:value", "");
},
},
};
</script>
<style scoped>
.select-box {
position: relative;
width: 100%;
}
.mask {
position: fixed;
z-index: 999;
top: 0;
right: 0;
left: 0;
bottom: 0;
}
.input-box {
cursor: pointer;
}
.dropdown-wrap {
max-height: 30vh;
width: 100%;
position: absolute;
top: 88rpx;
left: 0;
z-index: 1000;
padding-top: 6px;
}
.dropdown {
background-color: #fff;
padding: 3px 0;
box-shadow: 0 0 20rpx 5rpx rgba(0, 0, 0, 0.2);
border-radius: 5px;
max-height: 300rpx;
}
.option-item {
padding: 20rpx;
font-size: 28rpx;
/* border-bottom: 1px solid #eee; */
}
.option-item:last-child {
border-bottom: none;
}
.option-no-data {
text-align: center;
color: #999;
padding: 20rpx;
}
.triangle {
width: 0;
height: 0;
border-top: 6px solid transparent;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
position: absolute;
top: -6px;
left: 50%;
transform: translateX(-50%);
}
</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',
},
{
@ -153,7 +153,7 @@ const newInfoList = ref([
},
{
title: '日期更新',
url: '/pages/new-purchase/accept/index',
url: '/pages/dateUpdate/index',
iconSrc: '../../static/workbench/panDian.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

@ -58,7 +58,7 @@ export const getBmTeamList = (data) => {
export const getPickingOutboundListAPI = (data) => {
return http({
method: 'GET',
url: '/material/lease_apply_info/list',
url: '/material/material_lease_apply_info/list',
data,
})
}
@ -67,7 +67,7 @@ export const getPickingOutboundListAPI = (data) => {
export const deleteLeaseApplyApi = (id) => {
return http({
method: 'delete',
url: `/material/lease_apply_info/${id}`,
url: `/material/material_lease_apply_info/${id}`,
data: id,
})
}
@ -94,7 +94,7 @@ export const getTypeTreeList = (data) => {
export const addLeaseTask = (data) => {
return http({
method: 'POST',
url: '/material/lease_apply_info',
url: '/material/material_lease_apply_info',
data,
})
}
@ -102,7 +102,7 @@ export const addLeaseTask = (data) => {
export const editLeaseTask = (data) => {
return http({
method: 'put',
url: '/material/lease_apply_info',
url: '/material/material_lease_apply_info',
data,
})
}
@ -110,7 +110,7 @@ export const editLeaseTask = (data) => {
export const detailsLeaseTask = (data) => {
return http({
method: 'get',
url: `/material/lease_apply_info/${data}`,
url: `/material/material_lease_apply_info/${data}`,
// data:data,
})
}
@ -118,7 +118,7 @@ export const detailsLeaseTask = (data) => {
export const detailsBackTask = (data) => {
return http({
method: 'get',
url: `/material/back_apply_info/${data}`,
url: `/material/material_back_apply_info/${data}`,
})
}
@ -135,7 +135,7 @@ export const getAgreementInfoByIdApi = (data) => {
export const getOutNum = (data) => {
return http({
method: 'GET',
url: '/material/lease_apply_info/getOutNum',
url: '/material/material_lease_apply_info/getOutNum',
data,
})
}
@ -144,7 +144,7 @@ export const getOutNum = (data) => {
export const getCodeScanAPI = (data) => {
return http({
method: 'GET',
url: '/material/lease_apply_info/getInfoByQrcode',
url: '/material/material_lease_apply_info/getInfoByQrcode',
data,
})
}
@ -153,7 +153,7 @@ export const getCodeScanAPI = (data) => {
export const getMachineByIdApi = (data) => {
return http({
method: 'GET',
url: '/material/back_apply_info/getMachineById',
url: '/material/material_back_apply_info/getMachineById',
data,
})
}
@ -171,7 +171,7 @@ export const getCodeDeviceListAPI = (data) => {
export const getBackListAPI = (data) => {
return http({
method: 'GET',
url: '/material/back_apply_info/list',
url: '/material/material_back_apply_info/list',
data,
})
}
@ -180,7 +180,7 @@ export const getBackListAPI = (data) => {
export const deleteBackApi = (data) => {
return http({
method: 'POST',
url: `/material/back_apply_info/deleteById`,
url: `/material/material_back_apply_info/deleteById`,
data,
})
}
@ -189,7 +189,7 @@ export const deleteBackApi = (data) => {
export const backTask = (data) => {
return http({
method: 'POST',
url: '/material/back_apply_info',
url: '/material/material_back_apply_info',
data,
})
}
@ -198,7 +198,7 @@ export const backTask = (data) => {
export const editBackTask = (data) => {
return http({
method: 'POST',
url: '/material/back_apply_info/edit',
url: '/material/material_back_apply_info/edit',
data,
})
}
@ -216,7 +216,7 @@ export const getUseTypeTree = (data) => {
export const editBack = (data) => {
return http({
method: 'POST',
url: '/material/back_apply_info//edit',
url: '/material/material_back_apply_info//edit',
data,
})
}
@ -225,7 +225,7 @@ export const editBack = (data) => {
export const getMachine = (data) => {
return http({
method: 'GET',
url: '/material/back_apply_info/getMachine',
url: '/material/material_back_apply_info/getMachine',
data,
})
}

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: {}
})
}