This commit is contained in:
hongchao 2025-06-12 10:10:10 +08:00
commit 36566b7ee1
15 changed files with 2030 additions and 837 deletions

View File

@ -32,8 +32,8 @@
@clear="clearPro"
></eselect>
</uni-forms-item>
<uni-forms-item label="退料人员:" name="backPerson">
<uni-easyinput v-model="backPerson" maxlength="10" placeholder="请输入退料人" />
<uni-forms-item label="制单人员:" name="backPerson">
<uni-easyinput v-model="backPerson" maxlength="10" placeholder="请输入制单人" />
</uni-forms-item>
<uni-forms-item label="联系电话:" name="phone">
<uni-easyinput v-model="phone" maxlength="11" placeholder="请输入联系电话" />
@ -166,7 +166,7 @@ const confirmAdd = () => {
if (agreementId.value == '') {
uni.showToast({ title: '请确认退料单位,退料工程!', icon: 'none' })
} else if (backPerson.value == '') {
uni.showToast({ title: '请确认退料人!', icon: 'none' })
uni.showToast({ title: '请确认制单人!', icon: 'none' })
} else if (phone.value == '') {
uni.showToast({ title: '请确认联系电话!', icon: 'none' })
} else {

View File

@ -18,7 +18,7 @@
taskInfo.code
}}</span>
</uni-forms-item>
<uni-forms-item label="退料人员:" name="backPerson">
<uni-forms-item label="制单人员:" name="backPerson">
<span style="height: 100%; display: flex; align-items: center">{{
taskInfo.backPerson
}}</span>
@ -83,23 +83,22 @@
<!-- <uni-easyinput placeholder="请输入内容" v-model="apDetection"/> -->
<radio-group @change="changeRadio">
<radio value="完好" checked style="margin-right: 5px">完好</radio>
<radio value="损坏">损坏</radio>
<radio value="不合格">不合格</radio>
</radio-group>
</uni-col>
</uni-row>
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 10px">
<uni-col :span="6">附件</uni-col>
<uni-col :span="16">
<div class="upload" @click="uploadImg" v-if="imgBeseUrl == ''">+</div>
<div class="upload" @click="uploadImg" v-else>
<image
:src="imgBeseUrl"
style="width: 160rpx; height: 160rpx"
mode=""
></image>
</div>
</uni-col>
</uni-row>
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 10px">
<uni-col :span="4">附件</uni-col>
<uni-col :span="20">
<div class="upload-container">
<div class="upload" @click="uploadImg" v-if="imgList.length < 3">+</div>
<div class="image-preview" v-for="(img, index) in imgList" :key="index">
<image :src="img.url" mode="aspectFill"></image>
<view class="delete-btn" @click.stop="deleteImage(index)">×</view>
</div>
</div>
</uni-col>
</uni-row>
</div>
<div class="btn">
@ -124,7 +123,8 @@ const typeId = ref('') //类型id
const maStatusName = ref('') //
const apDetection = ref('完好') //
const imgBeseUrl = ref('') //
const bmFileInfos = ref([]) //
const imgList = ref([]) //
const bmFileInfos = ref([]) //
const scanQrCodeRef = ref(null)
const changeRadio = (e) => {
@ -292,7 +292,7 @@ const submitCode = () => {
typeId: typeId.value,
apDetection: apDetection.value,
goodNum: apDetection.value == '完好' ? 1 : 0,
badNum: apDetection.value == '损坏' ? 1 : 0,
badNum: apDetection.value == '不合格' ? 1 : 0,
bmFileInfos: bmFileInfos.value,
}
let param = {
@ -329,46 +329,76 @@ const submitCode = () => {
//
const uploadImg = () => {
uni.chooseImage({
count: 1, //
sizeType: ['original', 'compressed'], //original compressed
sourceType: ['album', 'camera'], //album camera 使
success: (res) => {
console.log(res)
let imgFiles = res.tempFilePaths //
imgBeseUrl.value = imgFiles[0]
// console.log('', imgFiles)
// console.log('', baseURL+"/file/upload")
uni.uploadFile({
// url: baseURL+"/file/upload",//app
url: '/file/upload', //h5
filePath: imgFiles[0],
name: 'file',
success: (res) => {
res = JSON.parse(res.data)
console.log('上传成功', res.code)
console.log('上传成功', res.data)
if (res.code && res.code == 200) {
let obj = {
name: res.data.name,
url: res.data.url,
taskType: '10',
}
// console.log(obj)
bmFileInfos.value = [obj]
uni.showToast({ title: '上传成功', icon: 'none' })
} else {
bmFileInfos.value = []
uni.showToast({ title: '上传失败', icon: 'none' })
}
},
fail: (err) => {
console.error('上传失败', err)
},
})
// this.$refs.vForm.clearValidate()
},
})
uni.chooseImage({
count: 3 - imgList.value.length, // 3
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: async (res) => {
const tempFiles = res.tempFiles
if (imgList.value.length + tempFiles.length > 3) {
uni.showToast({ title: '最多只能上传3张图片', icon: 'none' })
return
}
//
for (let i = 0; i < tempFiles.length; i++) {
imgList.value.push({
url: tempFiles[i].path,
uploading: true
})
}
//
const uploadPromises = tempFiles.map(file => {
return new Promise((resolve, reject) => {
uni.uploadFile({
url: '/file/upload',
filePath: file.path,
name: 'file',
success: (uploadRes) => {
const resData = JSON.parse(uploadRes.data)
if (resData.code === 200) {
resolve({
name: resData.data.name,
url: resData.data.url,
taskType: '10'
})
} else {
reject(new Error('上传失败'))
}
},
fail: (err) => {
reject(err)
}
})
})
})
try {
const results = await Promise.all(uploadPromises)
bmFileInfos.value = [...bmFileInfos.value, ...results]
uni.showToast({ title: '上传成功', icon: 'none' })
//
imgList.value = imgList.value.map(img => {
return {
...img,
uploading: false
}
})
} catch (error) {
uni.showToast({ title: '部分图片上传失败', icon: 'none' })
//
imgList.value = imgList.value.filter(img => !img.uploading)
}
}
})
}
//
const deleteImage = (index) => {
imgList.value.splice(index, 1)
bmFileInfos.value.splice(index, 1)
}
onLoad((options) => {
@ -379,6 +409,70 @@ onLoad((options) => {
</script>
<style lang="scss" scoped>
/* 在style部分添加 */
.upload-container {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.upload {
width: 160rpx;
height: 160rpx;
background-color: #f7f8fa;
border: 2rpx dashed #d9d9d9;
border-radius: 12rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 48rpx;
color: #bfbfbf;
transition: all 0.3s ease;
}
.image-preview {
width: 160rpx;
height: 160rpx;
position: relative;
border-radius: 12rpx;
overflow: hidden;
}
.image-preview image {
width: 100%;
height: 100%;
}
.delete-btn {
position: absolute;
top: 0;
right: 0;
width: 40rpx;
height: 40rpx;
background-color: rgba(0, 0, 0, 0.5);
color: white;
display: flex;
justify-content: center;
align-items: center;
border-bottom-left-radius: 12rpx;
font-size: 32rpx;
line-height: 32rpx;
}
.uploading-mask {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.3);
display: flex;
justify-content: center;
align-items: center;
color: white;
font-size: 24rpx;
}
::v-deep .uni-radio-input {
width: 16px;
height: 16px;

File diff suppressed because it is too large Load Diff

View File

@ -47,7 +47,7 @@
<uni-td style="font-size: 24rpx;text-align: center;">
<span>{{item.apDetection}}</span>
<!-- <uni-easyinput placeholder="外观" v-model="item.apDetection"/> -->
<!-- <span>{{ item.goodNum == 1 ? '完好' : '损坏' }}</span> -->
<!-- <span>{{ item.goodNum == 1 ? '完好' : '不合格' }}</span> -->
</uni-td>
<uni-td style="font-size: 24rpx;text-align: center;">{{item.createBy}}</uni-td>
<uni-td style="font-size: 24rpx;text-align: center;">{{item.createTime}}</uni-td>

View File

@ -59,7 +59,7 @@
<uni-th width="90px" style="font-size: 24rpx;" align="center">退料数</uni-th>
<!-- <uni-th width="90px" style="font-size: 24rpx;" align="center">外观</uni-th> -->
<uni-th width="90px" style="font-size: 24rpx;" align="center">完好数量</uni-th>
<uni-th width="90px" style="font-size: 24rpx;" align="center">损坏数量</uni-th>
<uni-th width="90px" style="font-size: 24rpx;" align="center">不合格数量</uni-th>
<uni-th width="70px" style="font-size: 24rpx;" align="center">操作</uni-th>
</uni-tr>
<!-- 表格数据行 -->
@ -90,7 +90,7 @@
</uni-td>
<uni-td style="font-size: 24rpx;text-align: center;">
<uni-easyinput
placeholder="损坏数量"
placeholder="不合格数量"
v-model="item.badNum"
type="number"
:clearable="false"
@ -314,9 +314,9 @@ const changeNum = (row) => {
// preNum
if (Number(row.badNum) + Number(row.goodNum) > row.preNum) {
console.log('🚀 ~ changeNum ~ row.badNum + row.goodNum > row.preNum:', row.badNum , row.goodNum)
// this.$message.error('退')
// this.$message.error('退')
uni.showToast({
title: '完好数量和损坏数量之和不能大于退料数量',
title: '完好数量和不合格数量之和不能大于退料数量',
icon: 'none',
})
row.badNum = 0

View File

@ -14,7 +14,7 @@
<uni-forms-item label="退料单号:" name="code">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.code }}</span>
</uni-forms-item>
<uni-forms-item label="退料人员:" name="backPerson">
<uni-forms-item label="制单人员:" name="backPerson">
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.backPerson }}</span>
</uni-forms-item>
<uni-forms-item label="退料电话:" name="phone">
@ -40,7 +40,7 @@
<uni-th width="80px" style="font-size: 24rpx;" align="center">退料数</uni-th>
<!-- <uni-th width="100px" style="font-size: 24rpx;" align="center">外观</uni-th> -->
<uni-th width="100px" style="font-size: 24rpx;" align="center">完好数量</uni-th>
<uni-th width="100px" style="font-size: 24rpx;" align="center">损坏数量</uni-th>
<uni-th width="100px" style="font-size: 24rpx;" align="center">不合格数量</uni-th>
</uni-tr>
<!-- 表格数据行 -->
<uni-tr v-for="(item,index) in typeList" :key="item.id">

View File

@ -111,7 +111,7 @@
>
</uni-row>
<uni-row :gutter="24">
<uni-col :span="8">退料</uni-col>
<uni-col :span="8">制单</uni-col>
<uni-col :span="16"
><div class="cont">{{ item.backPerson }}</div></uni-col
>

View File

@ -619,9 +619,9 @@ const changeNum = (row) => {
// // preNum
// if (Number(row.badNum) + Number(row.goodNum) > row.preNum) {
// console.log('🚀 ~ changeNum ~ row.badNum + row.goodNum > row.preNum:', row.badNum , row.goodNum)
// // this.$message.error('退')
// // this.$message.error('退')
// uni.showToast({
// title: '退',
// title: '退',
// icon: 'none',
// })
// row.badNum = 0

View File

@ -0,0 +1,690 @@
<template>
<!-- 数量出库 -->
<view class="page-container">
<view class="table-list-item">
<uni-row :gutter="24">
<uni-col :span="6">物资名称</uni-col>
<uni-col :span="18"
><view class="cont">{{ queryParams.typeName }}</view>
</uni-col>
</uni-row>
<uni-row :gutter="24">
<uni-col :span="6">物资类型</uni-col>
<uni-col :span="18"
><view class="cont">{{ queryParams.type }}</view>
</uni-col>
</uni-row>
<uni-row :gutter="24">
<uni-col :span="6">设备编码</uni-col>
<uni-col :span="18"
><view class="cont">{{ selectedCodesDisplay }}</view>
</uni-col>
</uni-row>
</view>
<uni-row
:gutter="24"
class="search-form"
style="background: #fff; padding: 10px; margin: 5px; border-radius: 5px"
>
<uni-col :span="6">
<view class="btnBox complete" @click="saveCode"> 维修完成 </view>
</uni-col>
</uni-row>
<scroll-view scroll-y style="padding-bottom: 20rpx">
<!-- -->
<view class="table-list-item">
<!-- 维修人员 -->
<h2 style="padding: 4rpx 0; font-weight: bold">维修信息</h2>
<uni-forms ref="baseForm" label-align="right">
<uni-forms-item label="维修人员">
<uni-data-select
:localdata="repairPersonData"
v-model="repairPerson"
placeholder="请选择维修人员"
/>
</uni-forms-item>
<uni-forms-item label="备注">
<uni-easyinput placeholder="请填写备注" maxlength="50" v-model="remark" />
</uni-forms-item>
<uni-forms-item label="附件">
<div class="upload" @click="uploadImg" v-if="imgBeseUrl == ''">+</div>
<div class="upload" @click="uploadImg" v-else>
<image
:src="imgBeseUrl"
style="width: 160rpx; height: 160rpx"
mode=""
></image>
</div>
</uni-forms-item>
</uni-forms>
</view>
<!-- 内部维修 -->
<view class="table-list-item" v-if="repairType == 1">
<h2 style="padding: 4rpx 0; font-weight: bold">内部维修</h2>
<uni-forms ref="baseForm" label-align="right">
<!-- <uni-forms-item label="维修数量">
<uni-easyinput placeholder="请填写维修数量" v-model="formLeft.repairNum"/>
</uni-forms-item> -->
<div v-for="(item, index) in partItems" :key="index">
<uni-forms-item label="配件类型">
<treeSelect
style="width: 100%; height: 90rpx"
ref="treeSelectRef"
:options="partTreeData"
@change="partTreeChange"
:index="index"
@clear="clearPart"
:defaultProps="defaultProps"
></treeSelect>
</uni-forms-item>
<uni-forms-item label="配件数量">
<uni-easyinput
placeholder="配件数量"
v-model="item.partNum"
type="number"
:clearable="false"
@input="partCheckNum(item)"
/>
</uni-forms-item>
<uni-forms-item label="是否收费">
<div style="width: 100%; display: flex">
<uni-data-select
:localdata="isChargeList"
v-model="item.partType"
placeholder="请选择是否收费"
:clear="false"
/>
<div class="operation-btns">
<span class="add" @click="addPart">+</span>
<span class="remove" @click="delPart(index)">-</span>
</div>
</div>
</uni-forms-item>
</div>
</uni-forms>
</view>
</scroll-view>
</view>
</template>
<script setup>
import { computed, ref, reactive } from 'vue'
import {
partTypeTreeList,
getSupplierList,
getRepairerListApi,
saveRepairRow,
getScrapReasonList,
} from '@/services/repair/repair.js'
import { baseURL } from '@/utils/http'
import treeSelect from '../tree-select/tselect.vue'
import { onLoad } from '@dcloudio/uni-app'
const queryParams = ref({})
const rowIndex = ref(-1)
//
const selectedCodesDisplay = computed(() => {
if (queryParams.value.selectedCodes && queryParams.value.selectedCodes.length > 0) {
//
const cleanCodes = queryParams.value.selectedCodes.map(code => {
//
if (typeof code === 'string') {
return code.replace(/^["']|["']$/g, '')
}
return String(code)
})
return cleanCodes.join(', ')
}
return ''
})
// onLoad((options) => {
// console.log(options)
// queryParams.value = JSON.parse(options.queryParams)
// rowIndex.value = options.rowIndex
// console.log(queryParams.value)
// getScrapReasonListData()
// })
onLoad((options) => {
queryParams.value = JSON.parse(decodeURIComponent(options.batchParams))
if (queryParams.value.selectedCodes) {
queryParams.value.selectedCodes = queryParams.value.selectedCodes.map(code => {
//
if (typeof code === 'string') {
return code.replace(/^["']|["']$/g, '')
}
return String(code)
})
}
console.log('批量维修参数:', queryParams.value)
console.log('选中的设备:', queryParams.value.selectedDevices)
console.log('选中的编码:', queryParams.value.selectedCodes)
})
const repairType = ref(1)
const changeTab = async (e) => {
repairType.value = e
}
const isChargeList = ref([
{ value: 1, text: '是' },
{ value: 0, text: '否' },
])
const { userInfo } = JSON.parse(uni.getStorageSync('member'))
// console.log('🚀 ~ userInfo:', userInfo)
//
const repairPersonData = ref([])
const repairPerson = ref('')
const getRepairerListData = async () => {
const res = await getRepairerListApi({})
console.log(res)
repairPersonData.value = res.data.map((item) => {
let obj = {
value: item.userId,
text: item.repairer,
}
return obj
})
// userInfo.userId repairPersonData.value ,
if (
repairPersonData.value &&
repairPersonData.value.findIndex((v) => v.value === userInfo.userId) > -1
) {
repairPerson.value = userInfo.userId
} else {
repairPerson.value = repairPersonData.value[0].value
}
}
getRepairerListData()
const remark = ref('') //
const imgBeseUrl = ref('') //
const bmFileInfos = ref([]) //
//
const uploadImg = () => {
uni.chooseImage({
count: 1, //
sizeType: ['original', 'compressed'], //original compressed
sourceType: ['album', 'camera'], //album camera 使
success: (res) => {
console.log(res)
let imgFiles = res.tempFilePaths //
imgBeseUrl.value = imgFiles[0]
// console.log('', baseURL+"/file/upload")
uni.uploadFile({
// url: baseURL+"/file/upload",//app
url: '/file/upload', //h5
filePath: imgFiles[0],
name: 'file',
success: (res) => {
res = JSON.parse(res.data)
console.log('上传成功', res)
if (res.code && res.code == 200) {
let obj = {
name: res.data.name,
url: res.data.url,
}
bmFileInfos.value = [obj]
console.log('上传成功', bmFileInfos.value)
uni.showToast({ title: '上传成功', icon: 'none' })
} else {
bmFileInfos.value = []
uni.showToast({ title: '上传失败', icon: 'none' })
}
},
fail: (err) => {
console.error('上传失败', err)
},
})
},
})
}
//
const partTreeData = ref([])
const defaultProps = ref({
id: 'id',
children: 'children',
label: 'label',
})
const getPartTreeData = async () => {
const res = await partTypeTreeList({})
partTreeData.value = res.data
}
getPartTreeData()
const treeSelectRef = ref([])
const clearPart = (index) => {
partItems.value[index].partId = ''
}
const partTreeChange = (val, index) => {
const isHas = partItems.value.findIndex((v) => v.partId === val.id)
if (isHas > -1) {
//
console.log(isHas)
uni.showToast({ title: '已存在该配件类型', icon: 'none' })
treeSelectRef.value[index].clearInput()
partItems.value[index].partId = ''
partItems.value[index].storageNum = ''
partItems.value[index].partNum = 0
} else {
partItems.value[index].partId = val.id
partItems.value[index].storageNum = val.storageNum
partItems.value[index].partNum = 0
}
}
//
const partItems = ref([{ partNum: '', partType: 0, partId: '', storageNum: '' }])
const addPart = () => {
partItems.value.push({ partNum: '', partType: 0, partId: '', storageNum: '' })
}
const delPart = (index) => {
if (partItems.value.length > 1) {
partItems.value.splice(index, 1)
}
}
const partIds = ref([])
const formLeft = ref({
// repairNum:0
})
const partItemsMiddle = ref([
{ partName: '', supplierId: '', partNum: 0, partPrice: 0, partType: 0 },
])
const addMidPart = () => {
partItemsMiddle.value.push({
partName: '',
supplierId: '',
partNum: 0,
partPrice: 0,
partType: 0,
})
}
const delMidPart = (index) => {
if (partItemsMiddle.value.length > 1) {
partItemsMiddle.value.splice(index, 1)
}
}
const formMiddle = ref({
// supplierId:undefined,
// repairNum:0
})
//
const formRight = ref({
// scrapNum:0,
scrapType: 0,
scrapId: null, // id
scrapReason: '', //
fileList: [],
})
const rowData = ref({})
// change
const partCheckNum = (item) => {
// console.log(item)
// console.log(item.partNum)
setTimeout(() => {
item.partNum = Number(String(item.partNum).replace(/[^\d.]/g, ''))
if (item.storageNum) {
// console.log(item.partNum)
// console.log(item.storageNum)
if (Number(item.partNum) >= Number(item.storageNum)) {
item.partNum = Number(item.storageNum)
}
}
}, 500)
}
// change
const costCheckNum = (item) => {
// console.log(item)
// console.log(item.partPrice)
setTimeout(() => {
item.partPrice = Number(String(item.partPrice).replace(/[^\d.]/g, ''))
}, 500)
}
//
const saveCode = () => {
if (repairType.value == 1) {
let index1 = partItems.value.findIndex((v) => v.partId == '')
let index2 = partItems.value.findIndex((v) => v.partNum == 0)
if (repairPerson.value == '') {
uni.showToast({ title: '请先选择维修人员!', icon: 'none' })
} else if (index1 > -1) {
uni.showToast({ title: '请先选择配件类型!', icon: 'none' })
} else if (index2 > -1) {
uni.showToast({ title: '请填写配件数量!', icon: 'none' })
} else {
saveCodeApi()
}
}
}
//
const saveCodeApi = async () => {
//
rowData.value = queryParams.value
//
for (let i = 0; i < rowData.value.repairDeviceList.length; i++) {
//
rowData.value.repairDeviceList[i].repairList = [
{
repairer: repairPerson.value,
remark: remark.value,
fileList: bmFileInfos.value,
},
]
//
if (!rowData.value.repairDeviceList[i].codeInRepairPartList) {
rowData.value.repairDeviceList[i].codeInRepairPartList = [];
}
//
for (let j = 0; j < partItems.value.length; j++) {
rowData.value.repairDeviceList[i].codeInRepairPartList.push({
partType: partItems.value[j].partType,
partId: partItems.value[j].partId,
partNum: partItems.value[j].partNum,
storageNum: partItems.value[j].storageNum,
})
}
// 1
rowData.value.repairDeviceList[i].repairType = 1;
}
console.log(rowData.value.repairDeviceList)
saveRepairRow(rowData.value.repairDeviceList).then(async (response) => {
if (response.code == 200) {
uni.showToast({ title: '保存成功', icon: 'none' })
uni.navigateBack({
delta: 2, //
})
}
})
}
</script>
<style lang="scss" scoped>
.upload-container {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.upload {
width: 160rpx;
height: 160rpx;
background-color: #f7f8fa;
border: 2rpx dashed #d9d9d9;
border-radius: 12rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 48rpx;
color: #bfbfbf;
transition: all 0.3s ease;
}
.image-preview {
width: 160rpx;
height: 160rpx;
position: relative;
border-radius: 12rpx;
overflow: hidden;
}
.image-preview image {
width: 100%;
height: 100%;
}
.delete-btn {
position: absolute;
top: 0;
right: 0;
width: 40rpx;
height: 40rpx;
background-color: rgba(0, 0, 0, 0.5);
color: white;
display: flex;
justify-content: center;
align-items: center;
border-bottom-left-radius: 12rpx;
font-size: 32rpx;
line-height: 32rpx;
}
//
.upload {
width: 160rpx;
height: 160rpx;
background-color: #f7f8fa;
border: 2rpx dashed #d9d9d9;
border-radius: 12rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 48rpx;
color: #bfbfbf;
transition: all 0.3s ease;
&:active {
background-color: #f0f0f0;
border-color: #3784fb;
}
image {
width: 100%;
height: 100%;
border-radius: 12rpx;
object-fit: cover;
}
}
.page-container {
display: flex;
height: 100vh;
padding: 24rpx;
flex-direction: column;
background-color: #f7f8fa;
//
.table-list-item {
background-color: #fff;
border-radius: 20rpx;
padding: 24rpx;
margin-bottom: 24rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
//
h2 {
font-size: 32rpx;
font-weight: 600;
color: #262626;
margin-bottom: 24rpx;
position: relative;
padding-left: 24rpx;
&::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 6rpx;
height: 28rpx;
background: #3784fb;
border-radius: 6rpx;
}
}
//
.uni-row {
padding: 16rpx 0;
font-size: 28rpx;
border-bottom: 2rpx solid #f5f5f5;
&:last-child {
border-bottom: none;
}
.uni-col-6 {
color: #8c8c8c;
}
.cont {
color: #262626;
}
}
//
:deep(.uni-forms-item) {
padding: 24rpx 0;
margin-bottom: 0;
border-bottom: 2rpx solid #f5f5f5;
&:last-child {
border-bottom: none;
}
.uni-forms-item__label {
color: #8c8c8c;
}
.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-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);
}
}
}
}
}
//
.search-form {
margin-bottom: 24rpx;
background: #fff !important;
border-radius: 20rpx !important;
padding: 24rpx !important;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
.btnBox {
height: 88rpx;
line-height: 88rpx;
text-align: center;
color: #fff;
font-size: 28rpx;
font-weight: 600;
border-radius: 12rpx;
transition: all 0.3s ease;
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
&:active {
transform: scale(0.98);
opacity: 0.9;
}
//
&.internal {
background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
box-shadow: 0 6rpx 20rpx rgba(46, 204, 113, 0.2);
}
//
&.return {
background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
box-shadow: 0 6rpx 20rpx rgba(243, 156, 18, 0.2);
}
//
&.scrap {
background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
box-shadow: 0 6rpx 20rpx rgba(231, 76, 60, 0.2);
}
//
&.complete {
background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
box-shadow: 0 6rpx 20rpx rgba(52, 152, 219, 0.2);
}
}
}
//
.operation-btns {
display: flex;
align-items: center;
gap: 16rpx;
margin-left: 24rpx;
span {
width: 48rpx;
height: 48rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 8rpx;
font-size: 32rpx;
transition: all 0.3s ease;
&:active {
transform: scale(0.95);
opacity: 0.8;
}
//
&.add {
color: #2ecc71;
background-color: rgba(46, 204, 113, 0.1);
}
//
&.remove {
color: #e74c3c;
background-color: rgba(231, 76, 60, 0.1);
}
}
}
}
//
.loading-text {
text-align: center;
font-size: 28rpx;
color: #666;
padding: 20rpx 0;
}
.outbound-btn {
width: 70%;
margin: 25rpx auto;
height: 65rpx;
line-height: 65rpx;
text-align: center;
background-color: #19be6b;
border-radius: 12rpx;
color: #fff;
}
</style>

View File

@ -201,14 +201,21 @@
<uni-easyinput placeholder="请填写其他原因" />
</uni-forms-item> -->
<uni-forms-item label="附件">
<div class="upload" @click="uploadScrapImg" v-if="imgBeseUrl2 == ''">+</div>
<div class="upload" @click="uploadScrapImg" v-else>
<image
:src="imgBeseUrl2"
style="width: 160rpx; height: 160rpx"
mode=""
></image>
<!-- <div class="upload" @click="uploadScrapImg" v-if="imgBeseUrl2 == ''">+</div>-->
<!-- <div class="upload" @click="uploadScrapImg" v-else>-->
<!-- <image-->
<!-- :src="imgBeseUrl2"-->
<!-- style="width: 160rpx; height: 160rpx"-->
<!-- mode=""-->
<!-- ></image>-->
<!-- </div>-->
<div class="upload-container">
<div class="upload" @click="uploadImg2" v-if="imgList2.length < 3">+</div>
<div class="image-preview" v-for="(img, index) in imgList2" :key="index">
<image :src="img.url" mode="aspectFill"></image>
<view class="delete-btn" @click.stop="deleteImage2(index)">×</view>
</div>
</div>
</uni-forms-item>
</uni-forms>
</view>
@ -440,44 +447,77 @@ const formRight = ref({
fileList: [],
})
const imgBeseUrl2 = ref('') //
const imgList2 = ref([]) //
//
const uploadScrapImg = () => {
uni.chooseImage({
count: 1, //
sizeType: ['original', 'compressed'], //original compressed
sourceType: ['album', 'camera'], //album camera 使
success: (res) => {
console.log(res)
let imgFiles = res.tempFilePaths //
imgBeseUrl2.value = imgFiles[0]
// console.log('', baseURL+"/file/upload")
uni.uploadFile({
// url: baseURL+"/file/upload",//app
url: '/file/upload', //h5
filePath: imgFiles[0],
name: 'file',
success: (res) => {
res = JSON.parse(res.data)
console.log('上传成功', res)
const uploadImg2 = () => {
uni.chooseImage({
count: 3 - imgList2.value.length, // 3
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: async (res) => {
const tempFiles = res.tempFiles
if (imgList2.value.length + tempFiles.length > 3) {
uni.showToast({ title: '最多只能上传3张图片', icon: 'none' })
return
}
if (res.code && res.code == 200) {
let obj = {
name: res.data.name,
url: res.data.url,
}
formRight.value.fileList = [obj]
uni.showToast({ title: '上传成功', icon: 'none' })
} else {
formRight.value.fileList = []
uni.showToast({ title: '上传失败', icon: 'none' })
}
},
fail: (err) => {
console.error('上传失败', err)
},
})
},
})
//
for (let i = 0; i < tempFiles.length; i++) {
imgList2.value.push({
url: tempFiles[i].path,
uploading: true
})
}
//
const uploadPromises = tempFiles.map(file => {
return new Promise((resolve, reject) => {
uni.uploadFile({
url: '/file/upload',
filePath: file.path,
name: 'file',
success: (uploadRes) => {
const resData = JSON.parse(uploadRes.data)
if (resData.code === 200) {
resolve({
name: resData.data.name,
url: resData.data.url
})
} else {
reject(new Error('上传失败'))
}
},
fail: (err) => {
reject(err)
}
})
})
})
try {
const results = await Promise.all(uploadPromises)
formRight.value.fileList = [...bmFileInfos.value, ...results]
uni.showToast({ title: '上传成功', icon: 'none' })
//
imgList2.value = imgList2.value.map(img => {
return {
...img,
uploading: false
}
})
} catch (error) {
uni.showToast({ title: '部分图片上传失败', icon: 'none' })
//
imgList2.value = imgList2.value.filter(img => !img.uploading)
}
}
})
}
//
const deleteImage2 = (index) => {
imgList2.value.splice(index, 1)
formRight.value.fileList.splice(index, 1)
}
const rowData = ref({})
@ -594,6 +634,54 @@ const saveCodeApi = async () => {
</script>
<style lang="scss" scoped>
.upload-container {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.upload {
width: 160rpx;
height: 160rpx;
background-color: #f7f8fa;
border: 2rpx dashed #d9d9d9;
border-radius: 12rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 48rpx;
color: #bfbfbf;
transition: all 0.3s ease;
}
.image-preview {
width: 160rpx;
height: 160rpx;
position: relative;
border-radius: 12rpx;
overflow: hidden;
}
.image-preview image {
width: 100%;
height: 100%;
}
.delete-btn {
position: absolute;
top: 0;
right: 0;
width: 40rpx;
height: 40rpx;
background-color: rgba(0, 0, 0, 0.5);
color: white;
display: flex;
justify-content: center;
align-items: center;
border-bottom-left-radius: 12rpx;
font-size: 32rpx;
line-height: 32rpx;
}
//
.upload {
width: 160rpx;

View File

@ -1,7 +1,7 @@
<template>
<view class="page-container">
<uni-row :gutter="24" class="search-form">
<uni-col :span="12">
<uni-col :span="10">
<view>
<uni-easyinput placeholder="请输入内容" />
</view>
@ -12,54 +12,79 @@
<uni-col :span="4">
<view class="search" style="background: #19be6b" @click="onQualified">合格</view>
</uni-col>
<uni-col :span="6">
<view class="search" style="background: #19be6b" @click="onBatchRepair">批量维修</view>
</uni-col>
</uni-row>
<view class="table-list-item">
<uni-row :gutter="24">
<uni-col :span="6">物资名称</uni-col>
<uni-col :span="18"
><view class="cont">{{ queryParams.typeName }}</view>
<uni-col :span="18">
<view class="cont">{{ queryParams.typeName }}</view>
</uni-col>
</uni-row>
<uni-row :gutter="24">
<uni-col :span="6">物资类型</uni-col>
<uni-col :span="18"
><view class="cont">{{ queryParams.type }}</view>
<uni-col :span="18">
<view class="cont">{{ queryParams.type }}</view>
</uni-col>
</uni-row>
<uni-row :gutter="24">
<uni-col :span="6">待修数量</uni-col>
<uni-col :span="18"
><view class="cont">{{
<uni-col :span="18">
<view class="cont">{{
queryParams.typeRepairNum - queryParams.typeRepairedNum
}}</view>
</uni-col>
</uni-row>
</view>
<!-- <view class="table-list-item" style="margin: 0">
<checkbox-group>
<label>
全选
<view class="table-list-item" style="margin: 0">
<checkbox-group @change="handleSelectAll">
<label class="select-all-label">
<checkbox
color="#409eff"
borderColor="#409eff"
activeBorderColor="#409eff"
:checked="allChecked"
:disabled="selectableItems.length === 0"
value="all"
style="transform: scale(0.7)"
/>
<text class="select-all-text">全选</text>
</label>
</checkbox-group>
</view> -->
</view>
<div v-for="(item, index) in repairDeviceList" :key="index">
<view class="code-list-item" @click="goOperate(item,index)">
<uni-row :gutter="24">
<uni-col :span="2">{{ index + 1 }}.</uni-col>
<uni-col :span="16">{{ item.code }}</uni-col>
<uni-col :span="6">
<view class="cont" v-if="item.status == '1'" style="color: green">已完成</view>
<view class="cont" v-if="item.status == '0'" style="color: red">未完成</view>
</uni-col>
</uni-row>
<view class="item-content">
<!-- 左侧复选框和序号 -->
<view class="left-section">
<checkbox
color="#409eff"
:value="item.code"
:checked="selectedItems.includes(item.code)"
:disabled="item.status !== '0'"
@click.stop="handleItemCheck(item.code)"
style="transform: scale(0.7)"
/>
<text class="index-number">{{ index + 1 }}.</text>
</view>
<!-- 中间设备编码 -->
<view class="middle-section">
<text class="device-code">{{ item.code }}</text>
</view>
<!-- 右侧状态 -->
<view class="right-section">
<view class="status-tag" :class="getStatusClass(item.status)">
{{ getStatusText(item.status) }}
</view>
</view>
</view>
</view>
</div>
</view>
@ -69,33 +94,60 @@
import { computed, ref } from 'vue'
import { auditRepairPass } from '@/services/repair/repair.js'
import { onLoad } from '@dcloudio/uni-app'
// const query = defineProps() //
// const queryParams = JSON.parse(query.queryParams)
const queryParams = ref({})
// console.log(queryParams)
const allChecked = ref(false)
const repairDeviceList = ref([])
onLoad((options) => {
queryParams.value = JSON.parse(options.queryParams)
console.log(queryParams.value)
repairDeviceList.value=queryParams.value.repairDeviceList;
console.log(repairDeviceList.value)
const selectedItems = ref([])
const selectableItems = computed(() => {
return repairDeviceList.value.filter(item => item.status === '0').map(item => item.code)
})
onLoad((options) => {
queryParams.value = JSON.parse(options.queryParams)
console.log(queryParams.value)
repairDeviceList.value = queryParams.value.repairDeviceList;
console.log(repairDeviceList.value)
})
const handleSelectAll = (e) => {
const checked = e.detail.value.length > 0
allChecked.value = checked
if (checked) {
selectedItems.value = [...selectableItems.value]
} else {
selectedItems.value = []
}
}
const handleItemCheck = (code) => {
// Only allow selection if item is status '0'
const item = repairDeviceList.value.find(i => i.code === code)
if (item && item.status !== '0') return
const index = selectedItems.value.indexOf(code)
if (index === -1) {
selectedItems.value.push(code)
} else {
selectedItems.value.splice(index, 1)
}
allChecked.value = selectedItems.value.length === selectableItems.value.length
}
//
const goOperate = (item,index) => {
if(item.status==0){
const codingUrl = '/pages/repair/repairManage/code-operate' //
uni.navigateTo({
url: `${codingUrl}?queryParams=${JSON.stringify(queryParams.value)}&rowIndex=${index}`,
})
}
if(item.status==0){
const codingUrl = '/pages/repair/repairManage/code-operate' //
uni.navigateTo({
url: `${codingUrl}?queryParams=${JSON.stringify(queryParams.value)}&rowIndex=${index}`,
})
}
}
const onQualified = async () => {
console.log(queryParams.value.ids[1])
let id = [queryParams.value.ids[1]]
let id = [queryParams.value.ids[1]]
const res = await auditRepairPass(id)
if (res.code === 200) {
uni.showToast({
@ -104,12 +156,67 @@ const onQualified = async () => {
})
uni.navigateBack({
delta: 1, //
success() {
uni.$emit('onUpdate')
},
success() {
uni.$emit('onUpdate')
},
})
}
}
//
const onBatchRepair = () => {
//
if (selectedItems.value.length === 0) {
uni.showToast({
title: '请先勾选数据',
icon: 'none',
duration: 2000
})
return
}
//
const selectedDevices = repairDeviceList.value.filter(item =>
selectedItems.value.includes(item.code)
)
console.log('选中的设备:', selectedDevices)
console.log('选中的设备编码:', selectedItems.value)
//
const batchParams = {
...queryParams.value,
selectedDevices: selectedDevices,
selectedCodes: selectedItems.value,
batchMode: true //
}
//
const batchRepairUrl = '/pages/repair/repairManage/batch-repair' //
uni.navigateTo({
url: `${batchRepairUrl}?batchParams=${encodeURIComponent(JSON.stringify(batchParams))}`,
})
}
//
const getStatusClass = (status) => {
switch(status) {
case '1': return 'status-completed'
case '0': return 'status-pending'
case '2': return 'status-scrap'
default: return ''
}
}
//
const getStatusText = (status) => {
switch(status) {
case '1': return '已完成'
case '0': return '未完成'
case '2': return '待报废'
default: return '未知'
}
}
</script>
<style lang="scss" scoped>
@ -182,6 +289,19 @@ const onQualified = async () => {
color: #262626;
}
}
//
.select-all-label {
display: flex;
align-items: center;
gap: 12rpx;
font-size: 28rpx;
color: #262626;
}
.select-all-text {
line-height: 1;
}
}
//
@ -199,43 +319,76 @@ const onQualified = async () => {
opacity: 0.9;
}
.uni-row {
.item-content {
display: flex;
align-items: center;
font-size: 28rpx;
width: 100%;
min-height: 60rpx;
}
.uni-col-2 {
// +
.left-section {
display: flex;
align-items: center;
gap: 8rpx;
min-width: 100rpx;
flex-shrink: 0;
.index-number {
font-size: 28rpx;
color: #8c8c8c;
line-height: 1;
}
}
.uni-col-16 {
//
.middle-section {
flex: 1;
padding: 0 24rpx;
min-width: 0; //
.device-code {
font-size: 28rpx;
color: #262626;
font-weight: 500;
word-break: break-all; //
line-height: 1.4;
}
}
.uni-col-6 {
text-align: right;
//
.right-section {
flex-shrink: 0;
min-width: 120rpx;
text-align: right;
.cont {
display: inline-block;
padding: 4rpx 16rpx;
border-radius: 8rpx;
font-size: 24rpx;
.status-tag {
display: inline-block;
padding: 8rpx 16rpx;
border-radius: 8rpx;
font-size: 24rpx;
font-weight: 500;
line-height: 1;
&[style*="color: green"] {
color: #52c41a !important;
background-color: rgba(82, 196, 26, 0.1);
}
&.status-completed {
color: #52c41a;
background-color: rgba(82, 196, 26, 0.1);
}
&[style*="color: red"] {
color: #f5222d !important;
background-color: rgba(245, 34, 45, 0.1);
}
&.status-pending {
color: #f5222d;
background-color: rgba(245, 34, 45, 0.1);
}
&.status-scrap {
color: #999;
background-color: rgba(153, 153, 153, 0.1);
}
}
}
}
}
//
.loading-text {
text-align: center;

View File

@ -39,16 +39,17 @@
<view class="table-list-item" :key="index" @click="handleItem(item)" v-for="(item, index) in tableList">
<uni-swipe-action>
<uni-swipe-action-item @click="onClick($event, item)" :right-options="options">
<div class="title">
<div class="title-left">
<span class="code">{{ item.repairCode }}</span>
</div>
<div class="title-right">
<uni-tag v-if="item.repairStatusCode == 0" text="未完成" type="warning" custom-style="warningStyle"/>
<uni-tag v-if="item.repairStatusCode == 1" text="已完成" type="success" custom-style="successStyle"/>
<uni-tag v-if="item.repairStatusCode == 2" text="已驳回" type="warning" custom-style="warningStyle"/>
</div>
</div>
<div class="title">
<div class="title-left">
<span class="code">{{ item.repairCode }}</span>
<span class="sub-code">{{ `${item.backCode}-${item.level}` }}</span>
</div>
<div class="title-right">
<uni-tag v-if="item.repairStatusCode == 0" text="未完成" type="warning" custom-style="warningStyle"/>
<uni-tag v-if="item.repairStatusCode == 1" text="已完成" type="success" custom-style="successStyle"/>
<uni-tag v-if="item.repairStatusCode == 2" text="已驳回" type="warning" custom-style="warningStyle"/>
</div>
</div>
<view class="line"></view>
<uni-row :gutter="24">
<uni-col :span="6">任务时间</uni-col>
@ -265,6 +266,23 @@ const maskClick = () => {}
</script>
<style lang="scss" scoped>
.title-left {
display: flex;
flex-direction: column;
.code {
font-size: 32rpx;
font-weight: 600;
color: #3784fb;
letter-spacing: 1rpx;
}
.sub-code {
font-size: 28rpx; /* 比主code小一点 */
color: #8c8c8c; /* 灰色更柔和 */
margin-top: 4rpx; /* 与主code有一点间距 */
}
}
.page-container {
display: flex;
height: 100vh;

View File

@ -184,10 +184,17 @@
<uni-easyinput placeholder="请填写其他原因" />
</uni-forms-item> -->
<uni-forms-item label="附件">
<div class="upload" @click="uploadScrapImg" v-if="imgBeseUrl2==''">+</div>
<div class="upload" @click="uploadScrapImg" v-else>
<image :src="imgBeseUrl2" style="width: 160rpx;height: 160rpx;" mode=""></image>
<!-- <div class="upload" @click="uploadScrapImg" v-if="imgBeseUrl2==''">+</div>-->
<!-- <div class="upload" @click="uploadScrapImg" v-else>-->
<!-- <image :src="imgBeseUrl2" style="width: 160rpx;height: 160rpx;" mode=""></image>-->
<!-- </div>-->
<div class="upload-container">
<div class="upload" @click="uploadImg2" v-if="imgList2.length < 3">+</div>
<div class="image-preview" v-for="(img, index) in imgList2" :key="index">
<image :src="img.url" mode="aspectFill"></image>
<view class="delete-btn" @click.stop="deleteImage2(index)">×</view>
</div>
</div>
</uni-forms-item>
</uni-forms>
</view>
@ -200,7 +207,7 @@ import { computed, ref } from 'vue'
import { partTypeTreeList, getSupplierList, getRepairerListApi, saveRepairRow } from '@/services/repair/repair.js'
import { baseURL } from '@/utils/http'
import treeSelect from '../tree-select/tselect.vue';
import { onLoad } from '@dcloudio/uni-app'
import { onLoad } from '@dcloudio/uni-app'
// const query = defineProps() //
// const queryParams = JSON.parse(query.queryParams)
const queryParams = ref({})
@ -220,20 +227,30 @@ const isChargeList = ref([
{ value: 0, text: '否' },
])
const { userInfo } = JSON.parse(uni.getStorageSync('member'))
//
const repairPersonData = ref([])
const repairPerson = ref("")
const repairPerson = ref("")
const getRepairerListData = async () => {
console.log('获取维修人员')
const res = await getRepairerListApi({})
console.log('2222222222222222')
console.log(res)
repairPersonData.value = res.data.map((item) => {
let obj = {
value: item.repairer,
value: item.userId,
text: item.repairer,
}
return obj
})
// userInfo.userId repairPersonData.value ,
if (
repairPersonData.value &&
repairPersonData.value.findIndex((v) => v.value === userInfo.userId) > -1
) {
repairPerson.value = userInfo.userId
} else {
repairPerson.value = repairPersonData.value[0].value
}
}
getRepairerListData()
@ -243,46 +260,46 @@ const imgBeseUrl = ref("") //图片展示
const bmFileInfos = ref([])//
//
const uploadImg = () => {
uni.chooseImage({
uni.chooseImage({
count: 1, //
sizeType: ['original', 'compressed'], //original compressed
sourceType: ['album', 'camera',], //album camera 使
success: res => {
console.log(res)
let imgFiles = res.tempFilePaths //
imgBeseUrl.value = imgFiles[0]
// console.log('', baseURL+"/file/upload")
uni.uploadFile({
// url: baseURL+"/file/upload",//app
url: "/file/upload",//h5
filePath: imgFiles[0],
name: 'file',
success: (res) => {
res = JSON.parse(res.data)
console.log('上传成功', res);
if(res.code&&res.code==200){
let obj = {
"name":res.data.name,
"url":res.data.url
}
bmFileInfos.value = [obj]
console.log('上传成功', bmFileInfos.value);
uni.showToast({ title: '上传成功', icon: 'none' })
}else{
bmFileInfos.value = []
uni.showToast({ title: '上传失败', icon: 'none' })
}
},
fail: (err) => {
console.error('上传失败', err);
}
});
}
})
sourceType: ['album', 'camera'], //album camera 使
success: (res) => {
console.log(res)
let imgFiles = res.tempFilePaths //
imgBeseUrl.value = imgFiles[0]
// console.log('', baseURL+"/file/upload")
uni.uploadFile({
// url: baseURL+"/file/upload",//app
url: '/file/upload', //h5
filePath: imgFiles[0],
name: 'file',
success: (res) => {
res = JSON.parse(res.data)
console.log('上传成功', res)
if (res.code && res.code == 200) {
let obj = {
name: res.data.name,
url: res.data.url,
}
bmFileInfos.value = [obj]
console.log('上传成功', bmFileInfos.value)
uni.showToast({ title: '上传成功', icon: 'none' })
} else {
bmFileInfos.value = []
uni.showToast({ title: '上传失败', icon: 'none' })
}
},
fail: (err) => {
console.error('上传失败', err)
},
})
},
})
}
//
//
const partTreeData = ref([])
const defaultProps = ref({
id: 'id',
@ -293,7 +310,7 @@ const getPartTreeData = async () => {
const res = await partTypeTreeList({})
partTreeData.value = res.data;
}
getPartTreeData()
getPartTreeData()
//
const clearPart = (index) =>{
partItems.value[index].partId=""
@ -328,14 +345,14 @@ const getSupplierListData = async () => {
return obj
})
}
getSupplierListData()
getSupplierListData()
//
const formLeft = ref({
repairNum: 0,
})
const partItems = ref([{ partNum: '', partType: 0, partId: '', storageNum: ''}])
const partItems = ref([{ partNum: '', partType: 0, partId: '', storageNum: ''}])
const addPart = () => {
partItems.value.push({ partNum: '', partType: 0, partId: '', storageNum: '' })
}
@ -347,7 +364,7 @@ const delPart = (index) => {
const partIds = ref([])
//
//
const formMiddle = ref({
supplierId: undefined,
repairNum: 0,
@ -371,44 +388,77 @@ const formRight = ref({
fileList:[]
})
const imgBeseUrl2 = ref("") //
const imgList2 = ref([]) //
//
const uploadScrapImg = () => {
uni.chooseImage({
count: 1, //
sizeType: ['original', 'compressed'], //original compressed
sourceType: ['album', 'camera',], //album camera 使
success: res => {
console.log(res)
let imgFiles = res.tempFilePaths //
imgBeseUrl2.value = imgFiles[0]
// console.log('', baseURL+"/file/upload")
uni.uploadFile({
// url: baseURL+"/file/upload",//app
url: "/file/upload",//h5
filePath: imgFiles[0],
name: 'file',
success: (res) => {
res = JSON.parse(res.data)
console.log('上传成功', res);
if(res.code&&res.code==200){
let obj = {
"name":res.data.name,
"url":res.data.url
}
formRight.value.fileList = [obj]
uni.showToast({ title: '上传成功', icon: 'none' })
}else{
formRight.value.fileList = []
uni.showToast({ title: '上传失败', icon: 'none' })
}
},
fail: (err) => {
console.error('上传失败', err);
}
});
const uploadImg2 = () => {
uni.chooseImage({
count: 3 - imgList2.value.length, // 3
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: async (res) => {
const tempFiles = res.tempFiles
if (imgList2.value.length + tempFiles.length > 3) {
uni.showToast({ title: '最多只能上传3张图片', icon: 'none' })
return
}
//
for (let i = 0; i < tempFiles.length; i++) {
imgList2.value.push({
url: tempFiles[i].path,
uploading: true
})
}
//
const uploadPromises = tempFiles.map(file => {
return new Promise((resolve, reject) => {
uni.uploadFile({
url: '/file/upload',
filePath: file.path,
name: 'file',
success: (uploadRes) => {
const resData = JSON.parse(uploadRes.data)
if (resData.code === 200) {
resolve({
name: resData.data.name,
url: resData.data.url
})
} else {
reject(new Error('上传失败'))
}
},
fail: (err) => {
reject(err)
}
})
})
})
try {
const results = await Promise.all(uploadPromises)
formRight.value.fileList = [...bmFileInfos.value, ...results]
uni.showToast({ title: '上传成功', icon: 'none' })
//
imgList2.value = imgList2.value.map(img => {
return {
...img,
uploading: false
}
})
} catch (error) {
uni.showToast({ title: '部分图片上传失败', icon: 'none' })
//
imgList2.value = imgList2.value.filter(img => !img.uploading)
}
}
})
})
}
//
const deleteImage2 = (index) => {
imgList2.value.splice(index, 1)
formRight.value.fileList.splice(index, 1)
}
@ -429,7 +479,7 @@ const saveNumAll = async () => {
uni.showToast({ title: '返厂维修请填写配件名称!', icon: 'none' })
}else if(formMiddle.value.repairNum>0&&partItemsMiddle.value.findIndex(v => v.partNum == 0)>-1){
uni.showToast({ title: '返厂维修请填写配件数量!', icon: 'none' }) //partPrice == 0 uni.showToast({ title: '', icon: 'none' })
}else if(formRight.value.scrapNum>0&&formRight.value.scrapReason==''){
}else if(formRight.value.scrapNum>0&&formRight.value.scrapReason==''){
uni.showToast({ title: '维修报废请填写报废原因!', icon: 'none' })
}else {
//
@ -472,7 +522,7 @@ const saveNumAll = async () => {
delta: 1, //
})
}
})
})
}
}
@ -559,7 +609,7 @@ const partCheckNum = (item) => {
if(Number(item.partNum)>=Number(item.storageNum)){
item.partNum=Number(item.storageNum)
}
}
}
}, 500)
}
// change
@ -571,6 +621,68 @@ const costCheckNum = (item) => {
</script>
<style lang="scss" scoped>
.upload-container {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.upload {
width: 160rpx;
height: 160rpx;
background-color: #f7f8fa;
border: 2rpx dashed #d9d9d9;
border-radius: 12rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 48rpx;
color: #bfbfbf;
transition: all 0.3s ease;
}
.image-preview {
width: 160rpx;
height: 160rpx;
position: relative;
border-radius: 12rpx;
overflow: hidden;
}
.image-preview image {
width: 100%;
height: 100%;
}
.delete-btn {
position: absolute;
top: 0;
right: 0;
width: 40rpx;
height: 40rpx;
background-color: rgba(0, 0, 0, 0.5);
color: white;
display: flex;
justify-content: center;
align-items: center;
border-bottom-left-radius: 12rpx;
font-size: 32rpx;
line-height: 32rpx;
}
.uploading-mask {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.3);
display: flex;
justify-content: center;
align-items: center;
color: white;
font-size: 24rpx;
}
.page-container {
display: flex;
height: 100vh;
@ -796,7 +908,7 @@ const costCheckNum = (item) => {
display: flex;
align-items: center;
}
.confirm-content-wrap1 {
position: relative;
left: 0;
@ -810,23 +922,23 @@ const costCheckNum = (item) => {
z-index: 999;
user-select: none;
}
.content_margin {
padding: 15px 0px 15px 0px;
}
.flex_row_center {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
align-items: center;
}
.label_text {
font-size: 28rpx;
color: #555555;
}
.inputStyle {
border: #bababa 0.5px solid;
width: 169px;
@ -835,13 +947,13 @@ const costCheckNum = (item) => {
font-size: 13px;
padding: 3px 2px;
}
.top_level {
position: fixed;
z-index: 100;
width: 90%;
}
.ly_tree_style {
border: #F5F5F5 1px solid;
width: 169px;

View File

@ -29,7 +29,7 @@
<uni-row :gutter="24">
<uni-col :span="6">待修数量</uni-col>
<uni-col :span="18"
><view class="cont">{{ queryParams.typeRepairNum }}</view>
><view class="cont">{{ Number(queryParams.typeRepairNum)-Number(queryParams.typeRepairedNum)-Number(queryParams.typeScrapNum)}}</view>
</uni-col>
</uni-row>
<uni-row :gutter="24">
@ -62,6 +62,12 @@
<view class="cont">{{ item.repairer||"" }}</view>
</uni-col>
</uni-row>
<uni-row :gutter="24">
<uni-col :span="6">配件</uni-col>
<uni-col :span="16">
<view class="cont">{{ item.partName||"" }}</view>
</uni-col>
</uni-row>
<uni-row :gutter="24">
<uni-col :span="6">操作人</uni-col>
<uni-col :span="16">

View File

@ -100,7 +100,7 @@ export const auditRepairPass = (data) => {
export const getDetailsListApi = (data) => {
return http({
method: 'GET',
url: '/material/repair/getDetailsList',
url: '/material/repair/getDetailsListApp',
data,
})
}