This commit is contained in:
parent
28fdc5b9e1
commit
2628a1dbb7
|
|
@ -52,7 +52,15 @@
|
|||
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 10px">
|
||||
<uni-col :span="6">设备编码:</uni-col>
|
||||
<uni-col :span="12">
|
||||
<uni-easyinput placeholder="请输入内容" maxlength="30" v-model="maCode" />
|
||||
<!-- <uni-easyinput placeholder="请输入内容" maxlength="30" v-model="maCode" /> -->
|
||||
<eselect
|
||||
style="width: 100%; height: 90rpx"
|
||||
v-model="maCode"
|
||||
ref="treeSelect2"
|
||||
:options="codeList"
|
||||
@change="changeMaCode"
|
||||
@clear="clearMaCode"
|
||||
></eselect>
|
||||
</uni-col>
|
||||
<uni-col :span="6">
|
||||
<view class="coding-btn search-btn" @click="getMaInfo">编码检索</view>
|
||||
|
|
@ -111,9 +119,10 @@
|
|||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { getMachine, insertApp } from '../../services/back.js'
|
||||
import { getMachine, insertApp, getSelectMachineByIdApi } from '../../services/back.js'
|
||||
import ScanQrCode from '@/pages/devicesSearch/ScanQrCode.vue'
|
||||
import { baseURL } from '@/utils/http'
|
||||
import eselect from '@/components/tree-select/eselect.vue'
|
||||
const taskInfo = ref({})
|
||||
const maId = ref('') //编码
|
||||
const maCode = ref('') //编码
|
||||
|
|
@ -126,15 +135,62 @@ const imgBeseUrl = ref('') //图片展示
|
|||
const imgList = ref([]) // 图片列表,用于回显
|
||||
const bmFileInfos = ref([]) // 上传后的图片信息
|
||||
const scanQrCodeRef = ref(null)
|
||||
const codeList = ref([])
|
||||
|
||||
const changeRadio = (e) => {
|
||||
console.log(e.detail.value)
|
||||
apDetection.value = e.detail.value
|
||||
}
|
||||
|
||||
// 获取编码下拉
|
||||
const getMaCodeList = async () => {
|
||||
let param = {
|
||||
unitId: taskInfo.value.unitId,
|
||||
proId: taskInfo.value.proId,
|
||||
id: taskInfo.value.id,
|
||||
}
|
||||
try {
|
||||
const res = await getSelectMachineByIdApi(param)
|
||||
console.log('🚀 ~ getMaCodeList ~ res:', res)
|
||||
if (!res.data || res.data.length === 0) return
|
||||
codeList.value = res.data.map((item) => {
|
||||
return {
|
||||
id: item.maCode,
|
||||
name: item.maCode,
|
||||
parentId: 0,
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ getMaCodeList ~ error:', error)
|
||||
}
|
||||
}
|
||||
|
||||
const changeMaCode = (e) => {
|
||||
console.log('🚀 ~ changeMaCode ~ e:', e)
|
||||
maCode.value = e.id
|
||||
}
|
||||
|
||||
const clearMaCode = () => {
|
||||
maCode.value = ''
|
||||
typeName.value = ''
|
||||
materialName.value = ''
|
||||
maStatusName.value = ''
|
||||
typeId.value = ''
|
||||
maId.value = ''
|
||||
maCode.value = ''
|
||||
typeId.value = ''
|
||||
apDetection.value = '完好'
|
||||
bmFileInfos.value = []
|
||||
imgBeseUrl.value = ''
|
||||
imgList.value = []
|
||||
}
|
||||
//根据编码获取设备类型
|
||||
const getMaInfo = () => {
|
||||
console.log(maCode.value)
|
||||
if (!maCode.value) {
|
||||
uni.showToast({ title: '请选择设备编码!', icon: 'none' })
|
||||
return
|
||||
}
|
||||
let param = {
|
||||
maCode: maCode.value,
|
||||
unitId: taskInfo.value.unitId,
|
||||
|
|
@ -303,7 +359,7 @@ const submitCode = () => {
|
|||
console.log(taskInfo.value)
|
||||
if (maId.value == '') {
|
||||
uni.showToast({ title: '请先添加退料设备编码!', icon: 'none' })
|
||||
} else if(apDetection.value == '不合格' && bmFileInfos.value.length == 0) {
|
||||
} else if (apDetection.value == '不合格' && bmFileInfos.value.length == 0) {
|
||||
uni.showToast({ title: '请上传附件!', icon: 'none' })
|
||||
} else {
|
||||
// console.log(typeList.value)
|
||||
|
|
@ -335,6 +391,8 @@ const submitCode = () => {
|
|||
apDetection.value = '完好'
|
||||
bmFileInfos.value = []
|
||||
imgBeseUrl.value = ''
|
||||
imgList.value = []
|
||||
getMaCodeList()
|
||||
// uni.navigateBack({
|
||||
// delta: 1 // 返回到已存在的页面
|
||||
// });
|
||||
|
|
@ -365,12 +423,12 @@ const uploadImg = () => {
|
|||
for (let i = 0; i < tempFiles.length; i++) {
|
||||
imgList.value.push({
|
||||
url: tempFiles[i].path,
|
||||
uploading: true
|
||||
uploading: true,
|
||||
})
|
||||
}
|
||||
|
||||
// 上传所有图片
|
||||
const uploadPromises = tempFiles.map(file => {
|
||||
const uploadPromises = tempFiles.map((file) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
url: '/file/upload',
|
||||
|
|
@ -382,7 +440,7 @@ const uploadImg = () => {
|
|||
resolve({
|
||||
name: resData.data.name,
|
||||
url: resData.data.url,
|
||||
taskType: '10'
|
||||
taskType: '10',
|
||||
})
|
||||
} else {
|
||||
reject(new Error('上传失败'))
|
||||
|
|
@ -390,7 +448,7 @@ const uploadImg = () => {
|
|||
},
|
||||
fail: (err) => {
|
||||
reject(err)
|
||||
}
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
@ -401,18 +459,18 @@ const uploadImg = () => {
|
|||
uni.showToast({ title: '上传成功', icon: 'none' })
|
||||
|
||||
// 更新图片状态
|
||||
imgList.value = imgList.value.map(img => {
|
||||
imgList.value = imgList.value.map((img) => {
|
||||
return {
|
||||
...img,
|
||||
uploading: false
|
||||
uploading: false,
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
uni.showToast({ title: '部分图片上传失败', icon: 'none' })
|
||||
// 移除上传失败的图片
|
||||
imgList.value = imgList.value.filter(img => !img.uploading)
|
||||
}
|
||||
imgList.value = imgList.value.filter((img) => !img.uploading)
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -426,10 +484,14 @@ onLoad((options) => {
|
|||
console.log(options)
|
||||
taskInfo.value = JSON.parse(options.taskInfo)
|
||||
console.log(taskInfo.value)
|
||||
getMaCodeList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .tree-item .head {
|
||||
justify-content: center !important;
|
||||
}
|
||||
::v-deep .uni-easyinput__content {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,8 +185,6 @@ const submitCode = () => {
|
|||
uni.showToast({ title: '请先扫码确认退料单位,退料工程!', icon: 'none' })
|
||||
} else if (backPerson.value == '') {
|
||||
uni.showToast({ title: '请填写退料人!', icon: 'none' })
|
||||
} else if (phone.value == '') {
|
||||
uni.showToast({ title: '请确认联系电话!', icon: 'none' })
|
||||
} else {
|
||||
let info = {
|
||||
agreementId: maInfo.value.agreementId,
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
</uni-col>
|
||||
</uni-row>
|
||||
<div class="table-list-item" v-for="(item, index) in tableList" :key="index">
|
||||
<uni-swipe-action class="swipe-action">
|
||||
<uni-swipe-action-item @click="onClick($event, item)" :right-options="item.manageType==1 ? options:options2">
|
||||
<uni-swipe-action class="swipe-action" ref="swipeRef">
|
||||
<uni-swipe-action-item @click="onClick($event, item, index)" :right-options="item.manageType==1 ? options:options2">
|
||||
<div class="title">
|
||||
<span style="font-size: 15px; font-weight: 800">退料任务</span>
|
||||
<!-- <span v-if="item.status == 2" style="color: #ff4d4f">未验收</span> -->
|
||||
|
|
@ -65,6 +65,7 @@ const taskId = ref('')
|
|||
const statusList = ref(["2","12"])
|
||||
const tableList = ref([])
|
||||
const taskInfo = ref({})
|
||||
const swipeRef = ref()
|
||||
|
||||
// 右滑按钮组
|
||||
const options = ref([
|
||||
|
|
@ -127,7 +128,7 @@ const goCode = () => {
|
|||
const goNum = () => {
|
||||
uni.navigateTo({ url: `/pages/back/backNum?taskInfo=${JSON.stringify(taskInfo.value)}` })
|
||||
}
|
||||
const onClick = (e, item) => {
|
||||
const onClick = (e, item, itemIndex) => {
|
||||
const { index } = e
|
||||
// 1. 查看
|
||||
if (index === 0) {
|
||||
|
|
@ -155,6 +156,7 @@ const onClick = (e, item) => {
|
|||
console.log(error)
|
||||
})
|
||||
}
|
||||
swipeRef.value[itemIndex].closeAll()
|
||||
}
|
||||
onLoad((options)=>{
|
||||
console.log(options)
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@
|
|||
</uni-row>
|
||||
<scroll-view scroll-y @scrolltolower="onScrollTolower" class="scroll-container">
|
||||
<div class="table-list-item" v-for="(item, index) in tableList" :key="index" @click="handleItem(item)">
|
||||
<uni-swipe-action class="swipe-action">
|
||||
<uni-swipe-action-item :right-options="item.taskStatus==0 ? options:options2" @click="onClick($event,item)">
|
||||
<uni-swipe-action class="swipe-action" ref="swipeRef">
|
||||
<uni-swipe-action-item :right-options="item.taskStatus==0 ? options:options2" @click="onClick($event,item, index)">
|
||||
<div class="title">
|
||||
<span class="code">{{ item.code }}</span>
|
||||
<div class="status-tag">
|
||||
|
|
@ -151,6 +151,7 @@ const total = ref(0) // 数据总量
|
|||
const active = ref(1) // tap索引
|
||||
const tableList = ref([]) // 列表数据源
|
||||
const dateArray = ref([]) // 日期范围
|
||||
const swipeRef = ref()
|
||||
// 签字状态选项
|
||||
const signOptions = ref([
|
||||
{ value: 0, text: "全部" },
|
||||
|
|
@ -223,7 +224,7 @@ const options2 = ref([
|
|||
// },
|
||||
])
|
||||
//点击事件
|
||||
const onClick=(e,item)=> {
|
||||
const onClick=(e,item,itemIndex)=> {
|
||||
console.log('🚀 ~ onClick ~ item:', item)
|
||||
const { index } = e
|
||||
console.log(index)
|
||||
|
|
@ -280,6 +281,7 @@ const onClick=(e,item)=> {
|
|||
console.log(error)
|
||||
})
|
||||
}
|
||||
swipeRef.value[itemIndex].closeAll()
|
||||
}
|
||||
|
||||
//获取列表
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ const complete = (e) => {
|
|||
// console.log(e) // 返回本地生成的base图片路径
|
||||
const img = new Image()
|
||||
img.src = e
|
||||
console.log('🚀 ~ complete ~ img.src:', img.src)
|
||||
img.onload = () => {
|
||||
const canvas = document.createElement('canvas')
|
||||
canvas.width = img.width
|
||||
|
|
@ -105,7 +106,7 @@ const complete = (e) => {
|
|||
ctx.drawImage(img, 0, 0)
|
||||
|
||||
// 转换为 WebP 格式,质量 0.8
|
||||
const webpBase64 = canvas.toDataURL('image/webp', 0.8)
|
||||
const webpBase64 = canvas.toDataURL('image/webp', 0.8).replace(/^data:image\/(jpeg|png|webp);base64,/, '')
|
||||
|
||||
console.log('🚀 ~ WebP base64:', webpBase64)
|
||||
uploadImg2(webpBase64)
|
||||
|
|
|
|||
|
|
@ -263,3 +263,12 @@ export const directEdit = (data) => {
|
|||
data:data,
|
||||
})
|
||||
}
|
||||
|
||||
// 退料编码-下拉
|
||||
export const getSelectMachineByIdApi = (data) => {
|
||||
return http({
|
||||
method: 'GET',
|
||||
url: '/material/back_apply_info/selectMachineById',
|
||||
data:data,
|
||||
})
|
||||
}
|
||||
Loading…
Reference in New Issue