维修批量报废
This commit is contained in:
parent
aab5b8ab72
commit
80688f4022
|
|
@ -374,6 +374,13 @@
|
|||
"navigationBarTitleText": "编码批量维修"
|
||||
}
|
||||
},
|
||||
// 6. 批量报废 操作
|
||||
{
|
||||
"path": "pages/repair/repairManage/batch-scrap",
|
||||
"style": {
|
||||
"navigationBarTitleText": "编码批量报废"
|
||||
}
|
||||
},
|
||||
|
||||
/* 定损及其页面 */
|
||||
// 1. 定损列表
|
||||
|
|
|
|||
|
|
@ -0,0 +1,667 @@
|
|||
<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>
|
||||
<uni-row :gutter="24" style="display: flex;align-items: center">
|
||||
<uni-col :span="6">维修人员:</uni-col>
|
||||
<uni-col :span="18">
|
||||
<uni-data-select :localdata="repairPersonData" v-model="repairPerson" placeholder="请选择维修人员" />
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row
|
||||
:gutter="24"
|
||||
class="search-form"
|
||||
style="background: #fff; padding: 10px; margin: 5px; border-radius: 5px"
|
||||
>
|
||||
<uni-col :span="24">
|
||||
<view class="btnBox complete" @click="saveCode"> 提交 </view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</view>
|
||||
<scroll-view scroll-y style="padding-bottom: 20rpx">
|
||||
<!-- 维修报废 -->
|
||||
<view class="table-list-item" v-if="repairType == 3">
|
||||
<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="formRight.scrapReason"
|
||||
style="margin-bottom: 10px"
|
||||
/>
|
||||
<uni-data-select
|
||||
:localdata="scrapReasonList"
|
||||
v-model="formRight.scrapId"
|
||||
placeholder="请选择报废原因"
|
||||
@change="changeScrap"
|
||||
/>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="损坏原因">
|
||||
<uni-data-select
|
||||
:clearable="false"
|
||||
:localdata="damageReasonList"
|
||||
v-model="formRight.scrapType"
|
||||
placeholder="请选择损坏原因"
|
||||
/>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="附件">
|
||||
<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>
|
||||
<PreviewImg :imgUrl="img.url" />
|
||||
</div>
|
||||
</div>
|
||||
</uni-forms-item>
|
||||
<div style="border-bottom: 1 solid #333;"></div>
|
||||
</uni-forms>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref, reactive,nextTick } from 'vue'
|
||||
import {
|
||||
partTypeTreeList,
|
||||
getRepairerListApi,
|
||||
saveRepairRow,
|
||||
getPartItemApi,
|
||||
} from '@/services/repair/repair.js'
|
||||
import { onLoad,onShow } from '@dcloudio/uni-app'
|
||||
import PreviewImg from '@/components/PreviewImg/index.vue'
|
||||
import { decryptWithSM4, encryptWithSM4, hashWithSM3AndSalt } from '@/utils/sm'
|
||||
import {getScrapReasonList} from "../../../services/repair/repair";
|
||||
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) => {
|
||||
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)
|
||||
|
||||
getScrapReasonListData()
|
||||
})
|
||||
|
||||
|
||||
const repairType = ref(3)
|
||||
const damageReasonList = ref([
|
||||
{ value: 0, text: '自然损坏' },
|
||||
{ value: 1, text: '人为损坏' },
|
||||
])
|
||||
const isChargeList = ref([
|
||||
{ value: 1, text: '是' },
|
||||
{ value: 0, text: '否' },
|
||||
])
|
||||
|
||||
const { userInfo } = JSON.parse(uni.getStorageSync('member'))
|
||||
|
||||
// 报废原因
|
||||
const scrapReasonList = ref([])
|
||||
const getScrapReasonListData = async () => {
|
||||
const params = {
|
||||
typeId: queryParams.value.typeId,
|
||||
}
|
||||
const res = await getScrapReasonList(params)
|
||||
scrapReasonList.value = res.data.map((item) => {
|
||||
let obj = {
|
||||
value: item.id,
|
||||
text: item.reason,
|
||||
}
|
||||
return obj
|
||||
})
|
||||
console.log('🚀 ~ 报废原因下拉 ~ res:', res)
|
||||
}
|
||||
|
||||
// 报废原因change事件
|
||||
const changeScrap = (val) => {
|
||||
console.log('🚀 ~ changeScrap ~ val:', val)
|
||||
const scrapReason = scrapReasonList.value.find((v) => v.value === val)
|
||||
console.log('🚀 ~ changeScrap ~ scrapReason:', scrapReason)
|
||||
// formRight.value.scrapReason = scrapReason.text
|
||||
console.log('🚀 ~ changeScrap ~ formRight.value:', formRight.value)
|
||||
}
|
||||
|
||||
//获取维修人员
|
||||
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 partTreeData = ref([])
|
||||
const defaultProps = ref({
|
||||
id: 'id',
|
||||
children: 'children',
|
||||
label: 'label',
|
||||
})
|
||||
|
||||
const treeSelectRef = ref([])
|
||||
|
||||
|
||||
|
||||
const partIds = ref([])
|
||||
const formLeft = ref({
|
||||
// repairNum:0
|
||||
})
|
||||
|
||||
const partItemsMiddle = ref([
|
||||
{ partName: '', supplierId: '', partNum: 0, partPrice: 0, partType: 0 },
|
||||
])
|
||||
const formMiddle = ref({
|
||||
// supplierId:undefined,
|
||||
// repairNum:0
|
||||
})
|
||||
|
||||
//待报废
|
||||
const formRight = ref({
|
||||
// scrapNum:0,
|
||||
scrapType: 1,
|
||||
scrapId: null, // 报废原因id
|
||||
scrapReason: '', // 报废原因
|
||||
fileList: [],
|
||||
})
|
||||
const imgBeseUrl2 = ref('') //图片展示
|
||||
const imgList2 = ref([]) // 图片列表,用于回显
|
||||
//上传
|
||||
const uploadImg2 = () => {
|
||||
uni.showActionSheet({
|
||||
itemList: ['拍照', '从相册选择'],
|
||||
success: (res) => {
|
||||
if (res.tapIndex === 0) {
|
||||
getCameraFjBF()
|
||||
} else if (res.tapIndex === 1) {
|
||||
// 从相册选择
|
||||
getPhotoFjBF()
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('操作菜单选择失败:', err)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 附件拍照
|
||||
const getCameraFjBF = () => {
|
||||
navigator.camera.getPicture(onCameraSuccessFjBF, onCameraErrorFjBF, {
|
||||
quality: 50,
|
||||
destinationType: window.Camera.DestinationType.DATA_URL,
|
||||
sourceType: window.Camera.PictureSourceType.CAMERA,
|
||||
})
|
||||
}
|
||||
// 附件从相册选择
|
||||
const getPhotoFjBF = () => {
|
||||
navigator.camera.getPicture(onCameraSuccessFjBF, onCameraErrorFjBF, {
|
||||
quality: 50,
|
||||
destinationType: window.Camera.DestinationType.DATA_URL,
|
||||
sourceType: window.Camera.PictureSourceType.SAVEDPHOTOALBUM,
|
||||
})
|
||||
}
|
||||
|
||||
const onCameraErrorFjBF = (message) => {
|
||||
console.log(message)
|
||||
}
|
||||
|
||||
const onCameraSuccessFjBF = (file) => {
|
||||
uploadSignUrlFjBF(file)
|
||||
}
|
||||
|
||||
const uploadSignUrlFjBF = (file) => {
|
||||
const base64Data = file
|
||||
|
||||
uni.request({
|
||||
url: '/file/uploadBase64',
|
||||
method: 'POST',
|
||||
data: {
|
||||
base64File:base64Data,
|
||||
fileName: `${generateRandomString(10)}_${Date.now()}.png`,
|
||||
fileType: 'image/png'
|
||||
},
|
||||
success: (uploadRes) => {
|
||||
if(!uploadRes.data.code){
|
||||
uploadRes = JSON.parse(decryptWithSM4(uploadRes.data))
|
||||
}else{
|
||||
uploadRes = JSON.parse(uploadRes.data)
|
||||
}
|
||||
if (uploadRes.code && uploadRes.code == 200) {
|
||||
const fileInfo = {
|
||||
url: uploadRes.data.url,
|
||||
serverUrl: uploadRes.data.url,
|
||||
name: uploadRes.data.name || `${generateRandomString(10)}_${Date.now()}.png`
|
||||
}
|
||||
|
||||
// 同时保存到两个地方
|
||||
imgList2.value.push(fileInfo)
|
||||
formRight.value.fileList.push(fileInfo)
|
||||
uni.showToast({ title: '上传成功', icon: 'none' })
|
||||
} else {
|
||||
uni.showToast({ title: '上传失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('上传失败', err)
|
||||
uni.showToast({ title: '上传失败', icon: 'none' })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 删除图片
|
||||
const deleteImage2 = (index) => {
|
||||
imgList2.value.splice(index, 1)
|
||||
formRight.value.fileList.splice(index, 1)
|
||||
}
|
||||
|
||||
const rowData = ref({})
|
||||
//维修完成校验
|
||||
const saveCode = () => {
|
||||
if (repairType.value == 3) {
|
||||
console.log(formRight.value)
|
||||
if (repairPerson.value == '') {
|
||||
uni.showToast({ title: '请先选择维修人员!', icon: 'none' })
|
||||
} else if (!formRight.value.scrapReason && !formRight.value.scrapId) {
|
||||
uni.showToast({ title: '请填写报废原因', icon: 'none' })
|
||||
} else {
|
||||
saveCodeApi()
|
||||
}
|
||||
}
|
||||
}
|
||||
const loading = ref(false)
|
||||
//维修完成请求
|
||||
const saveCodeApi = async () => {
|
||||
if (loading.value) {
|
||||
uni.showToast({ title: '请勿重复提交!', icon: 'none' })
|
||||
}
|
||||
loading.value = true
|
||||
//请求接口
|
||||
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,
|
||||
},
|
||||
]
|
||||
rowData.value.repairDeviceList[i].codeScrapRepairPartList.push(formRight.value)
|
||||
|
||||
// 设置维修类型为3
|
||||
rowData.value.repairDeviceList[i].repairType = 3;
|
||||
}
|
||||
console.log('🚀 ~ saveCodeApi ~ 提交:', rowData.value.repairDeviceList)
|
||||
const params = rowData.value.repairDeviceList.filter(item => queryParams.value.selectedCodes.includes(item.code))
|
||||
console.log('🚀 ~ saveCodeApi ~ params:', params)
|
||||
uni.showLoading({
|
||||
title: '提交中...',
|
||||
});
|
||||
saveRepairRow(params).then(async (response) => {
|
||||
if (response.code == 200) {
|
||||
uni.showToast({ title: '保存成功', icon: 'none' })
|
||||
uni.navigateBack({
|
||||
delta: 1, // 返回到已存在的页面
|
||||
})
|
||||
}
|
||||
loading.value = false
|
||||
uni.hideLoading()
|
||||
}).catch(() => {
|
||||
loading.value = false
|
||||
uni.hideLoading()
|
||||
})
|
||||
}
|
||||
</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;
|
||||
margin-left: 10px;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: -10px;
|
||||
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;
|
||||
max-height: 119px;
|
||||
overflow: auto;
|
||||
}
|
||||
}
|
||||
|
||||
// 表单样式
|
||||
: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>
|
||||
|
|
@ -1,21 +1,29 @@
|
|||
<template>
|
||||
<view class="page-container">
|
||||
<uni-row :gutter="24" class="search-form">
|
||||
<uni-col :span="10">
|
||||
<uni-col :span="12">
|
||||
<view>
|
||||
<uni-easyinput placeholder="请输入内容" v-model="keyWord" maxlength="10"/>
|
||||
</view>
|
||||
</uni-col>
|
||||
<uni-col :span="4">
|
||||
<uni-col :span="6">
|
||||
<view class="search" @click="search">查询</view>
|
||||
</uni-col>
|
||||
<uni-col :span="4" v-if="queryParams.waitRepairNum > 0">
|
||||
<uni-col :span="6" v-if="queryParams.waitRepairNum > 0">
|
||||
<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-col :span="6">-->
|
||||
<!-- <view class="search" style="background: #19be6b" @click="onBatchRepair">批量维修</view>-->
|
||||
<!-- </uni-col>-->
|
||||
</uni-row>
|
||||
<uni-row :gutter="24" class="search-form">
|
||||
<uni-col :span="6">
|
||||
<view class="search" style="background: #19be6b" @click="onBatchRepair">批量维修</view>
|
||||
</uni-col>
|
||||
<uni-col :span="6">
|
||||
<view class="search" style="background: #E6A23C" @click="onBatchScrap">批量报废</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
|
||||
<view class="table-list-item">
|
||||
<uni-row :gutter="24">
|
||||
|
|
@ -248,6 +256,41 @@ const onBatchRepair = () => {
|
|||
})
|
||||
}
|
||||
|
||||
// 批量报废
|
||||
const onBatchScrap = () => {
|
||||
// 检查是否有勾选数据
|
||||
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-scrap' // 批量维修页面
|
||||
uni.navigateTo({
|
||||
url: `${batchRepairUrl}?batchParams=${encodeURIComponent(JSON.stringify(batchParams))}`,
|
||||
})
|
||||
}
|
||||
|
||||
// 获取状态样式类
|
||||
const getStatusClass = (status) => {
|
||||
switch(status) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue