2024-11-20 14:24:17 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view class="accept page-common">
|
|
|
|
|
|
<div class="card">
|
|
|
|
|
|
<div>任务信息</div>
|
2024-11-21 09:22:25 +08:00
|
|
|
|
<uni-forms :model="taskInfo" label-width="160rpx" :border="true">
|
2024-11-20 14:24:17 +08:00
|
|
|
|
<uni-forms-item label="退料单位" name="unitName">
|
2024-11-21 09:22:25 +08:00
|
|
|
|
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.unitName }}</span>
|
2024-11-20 14:24:17 +08:00
|
|
|
|
</uni-forms-item>
|
|
|
|
|
|
<uni-forms-item label="退料工程:" name="proName">
|
2024-11-21 09:22:25 +08:00
|
|
|
|
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.proName }}</span>
|
2024-11-20 14:24:17 +08:00
|
|
|
|
</uni-forms-item>
|
|
|
|
|
|
<uni-forms-item label="退料单号:" name="code">
|
2024-11-21 09:22:25 +08:00
|
|
|
|
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.code }}</span>
|
2024-11-20 14:24:17 +08:00
|
|
|
|
</uni-forms-item>
|
|
|
|
|
|
<uni-forms-item label="退料人员:" name="backPerson">
|
2024-11-21 09:22:25 +08:00
|
|
|
|
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.backPerson }}</span>
|
2024-11-20 14:24:17 +08:00
|
|
|
|
</uni-forms-item>
|
|
|
|
|
|
<uni-forms-item label="联系电话:" name="phone">
|
2024-11-21 09:22:25 +08:00
|
|
|
|
<span style="height: 100%;display: flex;align-items: center;">{{ taskInfo.phone }}</span>
|
2024-11-20 14:24:17 +08:00
|
|
|
|
</uni-forms-item>
|
|
|
|
|
|
</uni-forms>
|
|
|
|
|
|
</div>
|
2024-11-21 09:22:25 +08:00
|
|
|
|
<div class="card" style="margin-top: 20px;">
|
|
|
|
|
|
<div>退料物资</div>
|
2024-11-22 09:40:01 +08:00
|
|
|
|
<div style="width: 92%;height: auto;margin: 10px;margin-bottom: 30px;" >
|
2024-11-21 09:22:25 +08:00
|
|
|
|
<uni-row :gutter="24" style="display: flex; align-items: center">
|
|
|
|
|
|
<uni-col :span="10">
|
|
|
|
|
|
<view>
|
2024-11-22 09:40:01 +08:00
|
|
|
|
<uni-data-select v-model="typeId"
|
|
|
|
|
|
:localdata="maTypeSelectList" @change="getMaCode">
|
|
|
|
|
|
</uni-data-select>
|
2024-11-21 09:22:25 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</uni-col>
|
|
|
|
|
|
<uni-col :span="10">
|
|
|
|
|
|
<view>
|
2024-11-22 09:40:01 +08:00
|
|
|
|
<uni-data-select v-model="typeCode"
|
|
|
|
|
|
:localdata="maCodeSelectList" @change="selectMaCode">
|
|
|
|
|
|
</uni-data-select>
|
2024-11-21 09:22:25 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</uni-col>
|
|
|
|
|
|
|
|
|
|
|
|
</uni-row>
|
|
|
|
|
|
</div>
|
2024-11-22 09:40:01 +08:00
|
|
|
|
<div style="width: 92%;height: 100%;margin: 10px;font-size: 20rpx;">
|
2024-11-21 09:22:25 +08:00
|
|
|
|
<uni-table border stripe emptyText="暂无更多数据" >
|
|
|
|
|
|
<!-- 表头行 -->
|
|
|
|
|
|
<uni-tr>
|
2024-11-22 09:40:01 +08:00
|
|
|
|
<uni-th width="90px" align="center">类型名称</uni-th>
|
|
|
|
|
|
<uni-th width="90px" align="center">规格型号</uni-th>
|
|
|
|
|
|
<uni-th width="70px" align="center">在用数</uni-th>
|
2024-11-21 09:22:25 +08:00
|
|
|
|
<uni-th width="100px" align="center">退料数</uni-th>
|
|
|
|
|
|
<uni-th width="100px" align="center">外观</uni-th>
|
2024-11-22 09:40:01 +08:00
|
|
|
|
<uni-th width="60px" align="center">操作</uni-th>
|
2024-11-21 09:22:25 +08:00
|
|
|
|
</uni-tr>
|
|
|
|
|
|
<!-- 表格数据行 -->
|
|
|
|
|
|
<uni-tr v-for="(item,index) in typeList" :key="item.id">
|
2024-11-22 09:40:01 +08:00
|
|
|
|
<uni-td>{{item.materialName}}</uni-td>
|
2024-11-21 09:22:25 +08:00
|
|
|
|
<uni-td>{{item.typeName}}</uni-td>
|
|
|
|
|
|
<uni-td>{{item.num}}</uni-td>
|
|
|
|
|
|
<uni-td>
|
|
|
|
|
|
<uni-easyinput placeholder="退料数" v-model="item.preNum"/>
|
|
|
|
|
|
</uni-td>
|
|
|
|
|
|
<uni-td>
|
|
|
|
|
|
<uni-easyinput placeholder="外观" v-model="item.apDetection"/>
|
|
|
|
|
|
</uni-td>
|
|
|
|
|
|
<uni-td>
|
|
|
|
|
|
<view class="uni-group">
|
2024-11-22 09:40:01 +08:00
|
|
|
|
<!-- <button class="uni-button" size="mini" type="primary" @click="uploadImg(item)">上传</button> -->
|
|
|
|
|
|
<!-- <button class="uni-button" size="mini" type="warn" >删除</button> -->
|
|
|
|
|
|
<uni-icons type="camera" size="20" style="color: #3784fb;" @click="uploadImg(item)"></uni-icons>
|
|
|
|
|
|
<uni-icons type="trash-filled" size="20" style="color: red;margin-left:10px;" @click="delRow(index)"></uni-icons>
|
2024-11-21 09:22:25 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</uni-td>
|
|
|
|
|
|
</uni-tr>
|
|
|
|
|
|
</uni-table>
|
|
|
|
|
|
</div>
|
2024-11-20 14:24:17 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="btn">
|
|
|
|
|
|
<!-- <button class="btn-cont" @click="reject">取消</button> -->
|
2024-11-22 09:40:01 +08:00
|
|
|
|
<button class="btn-cont" @click="submitNum">确认</button>
|
2024-11-20 14:24:17 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
|
import { ref, reactive } from 'vue'
|
|
|
|
|
|
import { onLoad } from '@dcloudio/uni-app'
|
2024-11-22 09:40:01 +08:00
|
|
|
|
import { getUseType,insertApp } from '../../services/back.js';
|
2024-11-21 09:22:25 +08:00
|
|
|
|
const taskInfo = ref({})
|
2024-11-22 09:40:01 +08:00
|
|
|
|
|
|
|
|
|
|
const maTypeSelectList = ref([])
|
|
|
|
|
|
const typeId = ref("")//类型
|
|
|
|
|
|
const maCodeSelectList = ref([])
|
|
|
|
|
|
const typeCode = ref("")//规格型号
|
2024-11-21 09:22:25 +08:00
|
|
|
|
const typeList = ref([])
|
2024-11-22 09:40:01 +08:00
|
|
|
|
//类型下拉选
|
|
|
|
|
|
const getMaType = () => {
|
|
|
|
|
|
let obj = {
|
|
|
|
|
|
"agreementId":taskInfo.value.agreementId,
|
|
|
|
|
|
}
|
|
|
|
|
|
getUseType(obj).then(res => {
|
|
|
|
|
|
console.log(res)
|
|
|
|
|
|
maTypeSelectList.value = res.data.map(option => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
value:option.typeId,
|
|
|
|
|
|
text:option.typeName,
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
|
console.log(error)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
//规格
|
|
|
|
|
|
const getMaCode = () => {
|
|
|
|
|
|
let obj = {
|
|
|
|
|
|
"agreementId":taskInfo.value.agreementId,
|
|
|
|
|
|
"typeId":typeId.value
|
|
|
|
|
|
}
|
|
|
|
|
|
getUseType(obj).then(res => {
|
|
|
|
|
|
console.log(res)
|
|
|
|
|
|
maCodeSelectList.value = res.data.map(option => {
|
|
|
|
|
|
let obj = {
|
|
|
|
|
|
...option,
|
|
|
|
|
|
bmFileInfos:[],
|
|
|
|
|
|
value:option.typeId,
|
|
|
|
|
|
text:option.typeName,
|
|
|
|
|
|
}
|
|
|
|
|
|
return obj
|
|
|
|
|
|
});
|
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
|
console.log(error)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
//选择规格型号
|
|
|
|
|
|
const selectMaCode = (e) => {
|
|
|
|
|
|
console.log(e)
|
|
|
|
|
|
maCodeSelectList.value.forEach(item=>{
|
|
|
|
|
|
console.log(item)
|
|
|
|
|
|
if(item.typeId==e){
|
|
|
|
|
|
typeList.value.push(item)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
console.log(typeList.value)
|
|
|
|
|
|
}
|
|
|
|
|
|
//提交
|
|
|
|
|
|
const submitNum = () => {
|
|
|
|
|
|
console.log(taskInfo.value)
|
|
|
|
|
|
console.log(typeList.value)
|
|
|
|
|
|
let obj = {
|
|
|
|
|
|
"backApplyInfo":taskInfo.value,
|
|
|
|
|
|
"backApplyDetailsList":typeList.value
|
|
|
|
|
|
}
|
|
|
|
|
|
insertApp(obj).then(res => {
|
|
|
|
|
|
console.log(res)
|
|
|
|
|
|
if(res.code==200){
|
|
|
|
|
|
uni.showToast({ title: '编辑成功', icon: 'none' })
|
|
|
|
|
|
uni.navigateBack({
|
|
|
|
|
|
delta: 1 // 返回到已存在的页面
|
|
|
|
|
|
});
|
|
|
|
|
|
}else{
|
|
|
|
|
|
uni.showToast({ title: res.msg, icon: 'none' })
|
|
|
|
|
|
}
|
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
|
console.log(error)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
//上传
|
|
|
|
|
|
const uploadImg = (item) => {
|
|
|
|
|
|
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
|
|
|
|
|
|
}
|
|
|
|
|
|
item.bmFileInfos.value = [obj]
|
|
|
|
|
|
uni.showToast({ title: '上传成功', icon: 'none' })
|
|
|
|
|
|
}else{
|
|
|
|
|
|
item.bmFileInfos.value = []
|
|
|
|
|
|
uni.showToast({ title: '上传失败', icon: 'none' })
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
fail: (err) => {
|
|
|
|
|
|
console.error('上传失败', err);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
// this.$refs.vForm.clearValidate()
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
//删除
|
|
|
|
|
|
const delRow = (index) => {
|
|
|
|
|
|
console.log(index)
|
|
|
|
|
|
console.log(typeList.value)
|
|
|
|
|
|
typeList.value.splice(index,1)
|
|
|
|
|
|
}
|
2024-11-20 14:24:17 +08:00
|
|
|
|
|
|
|
|
|
|
onLoad((options)=>{
|
|
|
|
|
|
console.log(options)
|
2024-11-21 09:22:25 +08:00
|
|
|
|
taskInfo.value = JSON.parse(options.taskInfo)
|
|
|
|
|
|
console.log(taskInfo.value)
|
2024-11-22 09:40:01 +08:00
|
|
|
|
getMaType()
|
2024-11-20 14:24:17 +08:00
|
|
|
|
})
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
|
.accept {
|
|
|
|
|
|
padding: 10px;
|
2024-11-21 09:22:25 +08:00
|
|
|
|
height: 95vh;
|
2024-11-20 14:24:17 +08:00
|
|
|
|
word-break: break-all;
|
|
|
|
|
|
}
|
|
|
|
|
|
.card {
|
|
|
|
|
|
padding: 10px;
|
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
box-shadow: 0 2upx 4upx 0 rgba(0, 0, 0, 0.1);
|
|
|
|
|
|
}
|
|
|
|
|
|
.upload {
|
|
|
|
|
|
width: 80px;
|
|
|
|
|
|
height: 80px;
|
|
|
|
|
|
background-color: #f5f5f5;
|
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
|
color: #ccc;
|
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.btn {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-around;
|
|
|
|
|
|
margin-top: 30px;
|
|
|
|
|
|
|
|
|
|
|
|
.btn-cont {
|
|
|
|
|
|
width: 40%;
|
|
|
|
|
|
height: 40px;
|
|
|
|
|
|
line-height: 40px;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
background-color: #3784fb;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
border-radius: 20px;
|
|
|
|
|
|
// 取消按钮淡蓝色
|
2024-11-21 09:22:25 +08:00
|
|
|
|
// &:first-child {
|
|
|
|
|
|
// background-color: #aacefb;
|
|
|
|
|
|
// }
|
2024-11-20 14:24:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|