优化领料审核页面缓存问题,数量退料接收时报废信息填写以及预报废列表等地方回显问题开发

This commit is contained in:
BianLzhaoMin 2024-06-18 15:12:54 +08:00
parent 71c75d2f2f
commit 1c54fbe9a3
7 changed files with 378 additions and 9 deletions

View File

@ -565,7 +565,7 @@ export default {
this.queryParams.examineStatusId = '32'
}
this.queryParams.unitId = data.unitId
this.queryParams.companyId = data.companyId
this.queryParams.companyId = data.companyId.toString()
this.queryParams.proId = data.proId
this.queryParams.leaseApplyInfo.phone =
data.leaseApplyInfoList[0].phone
@ -595,7 +595,7 @@ export default {
this.queryParams.examineStatusId = '32'
}
this.queryParams.unitId = data.unitId
this.queryParams.companyId = data.companyId
this.queryParams.companyId = data.companyId.toString()
this.queryParams.proId = data.proId
this.queryParams.leaseApplyInfo.phone =
data.leaseApplyInfoList[0].phone

View File

@ -590,6 +590,7 @@
<el-button
type="primary"
size="mini"
@click="editScrapInfo"
:disabled="row.scrapNum <= 0"
> </el-button
>
@ -600,6 +601,68 @@
</el-table>
</div>
</el-dialog>
<!-- 报废图片信息填写对话框 -->
<el-dialog
width="30%"
title="报废信息"
:visible.sync="innerVisible"
append-to-body
>
<el-form :model="scrapInfoParams">
<el-form-item label="报废原因:">
<el-input
v-model="scrapInfoParams.scrapReason"
placeholder="请输入报废原因"
size="small"
maxlength="50"
style="width: 350px"
></el-input>
</el-form-item>
<el-form-item label="损坏原因:">
<el-radio-group
style="width: 350px"
v-model="scrapInfoParams.scrapType"
>
<el-radio :label="1">人为</el-radio>
<el-radio :label="0">自然</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="损坏照片:" class="upload-box">
<!-- 报废图片 -->
<Upload
style="width: 350px"
:file-list="fileList"
:action-url="actionUrl"
:limit="3"
:multiple="true"
@remove="handleRemove"
@success="handleSuccess"
>
<template>
<el-row class="Upload-tip">
<el-button size="small" type="primary"
>点击上传</el-button
>
</el-row>
<el-row class="upload-tip">
<span class="tip-text"
>请上传jpgjpegpng格式的图片单张图片大小不可超过5M最多可上传3张</span
>
</el-row>
</template>
</Upload>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancelScrap" size="mini">取消</el-button>
<el-button type="primary" @click="submitScrapInfo" size="mini"
>保存</el-button
>
</div>
</el-dialog>
</div>
</template>
@ -620,9 +683,10 @@ import { equipmentTypeTree } from '@/api/store/tools'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { getInfo } from '@/api/login'
import Upload from './upload.vue'
export default {
// name: "returnInDetail",
components: { Treeselect },
components: { Treeselect, Upload },
props: {
isView: {
type: Boolean,
@ -693,6 +757,17 @@ export default {
codeTotal: 0, //-
codeList: [], //
numList: [], //
innerVisible: false,
//
scrapInfoParams: {
scrapReason: '', //
scrapType: '', //
fileUrl: '',
},
fileList: [],
imgUrlList: [],
actionUrl: process.env.VUE_APP_BASE_API + '/system/sys/file/upload',
}
},
mounted() {
@ -924,6 +999,9 @@ export default {
this.openNum = true
this.dialogIsView = false
this.$set(row, 'backNum', row.num) //退
this.$set(row, 'scrapReason', '') //
this.$set(row, 'scrapType', '') //
this.$set(row, 'fileUrl', '') //
this.returnNum = Number(row.num)
this.dialogData.typeMange = row.manageType
this.dialogData.typeName = row.typeName
@ -979,6 +1057,13 @@ export default {
getCodeList() {
getBackMachine(this.codeQuery).then((response) => {
this.codeList = response.data.rows
this.codeList.map((item) => {
item.scrapReason = ''
item.scrapType = ''
item.fileUrl = ''
return item
})
this.codeTotal = response.data.total
})
},
@ -1053,6 +1138,9 @@ export default {
createBy: this.createBy,
backStatus: 3,
backNum: item.scrapNum,
scrapReason: item.scrapReason,
scrapType: item.scrapType,
fileUrl: item.fileUrl,
}
arr.push(obj)
}
@ -1074,7 +1162,7 @@ export default {
saveCodeBack(row, type) {
if (this.returnNum == 0) {
this.$modal.msgError('退料数量为零,无法操作!')
} else {
} else if (type == 1 || type == 2 || type == 3) {
let arr = [
{
parentId: this.codeQuery.parentId,
@ -1099,6 +1187,9 @@ export default {
this.handleQuery()
}
})
} else {
// this.currentCode = row.maCode
// this.innerVisible = true
}
},
//
@ -1111,7 +1202,7 @@ export default {
saveCodeBackBatch(type) {
if (this.codeSelectList.length > this.returnNum) {
this.$modal.msgError('退料总量已大于待退料数量!')
} else {
} else if (type == 1 || type == 2 || type == 3) {
let arr = []
arr = this.codeSelectList.map((item) => {
return {
@ -1139,8 +1230,141 @@ export default {
this.handleQuery()
}
})
} else {
// if (this.codeSelectList.length < 0) {
// this.$modal.msgError('')
// } else {
// this.scrapAll = true
// this.innerVisible = true
// }
}
},
//
editScrapInfo() {
console.log('编辑报废信息')
this.innerVisible = true
},
//
handleRemove(file) {
this.imgUrlList = this.imgUrlList.filter(
(e) => e !== file.response.data.fileUrl,
)
},
//
handleSuccess(res) {
if (res.code == 200) {
this.imgUrlList.push(res.data.fileUrl)
}
},
//
cancelScrap() {
this.innerVisible = false
},
//
submitScrapInfo() {
if (!this.currentCode && !this.scrapAll) {
this.numList[0].scrapReason = this.scrapInfoParams.scrapReason
this.numList[0].scrapType = this.scrapInfoParams.scrapType
if (this.imgUrlList.length > 0) {
this.numList[0].fileUrl = this.imgUrlList.join(',')
}
} else {
console.log('当前为编码退料---------')
this.codeList.map((item) => {
if (item.maCode === this.currentCode) {
console.log(item.maCode, '当前数据', item, '------')
let arr = [
{
parentId: this.codeQuery.parentId,
typeId: item.typeId,
backNum: 1,
backStatus: 3,
manageType: 0,
createBy: this.createBy,
maId: item.maId,
scrapReason: this.scrapInfoParams.scrapReason,
scrapType: this.scrapInfoParams.scrapType,
fileUrl: '',
},
]
if (this.imgUrlList.length > 0) {
arr[0].fileUrl = this.imgUrlList.join(',')
}
let param = {
taskId: this.codeQuery.taskId,
arr: arr,
}
setCodeBack(param).then((response) => {
if (response.code == 200) {
this.$modal.msgSuccess('操作成功')
// this.openCode = false;
this.returnNum = Number(this.returnNum) - 1
this.handleCodeQuery()
this.handleQuery()
}
})
}
})
}
if (this.scrapAll) {
console.log('批量报废功能!!!')
let arr = []
arr = this.codeSelectList.map((item) => {
return {
parentId: this.codeQuery.parentId,
typeId: item.typeId,
backNum: 1,
backStatus: 3,
manageType: 0,
createBy: this.createBy,
maId: item.maId,
scrapReason: this.scrapInfoParams.scrapReason,
scrapType: this.scrapInfoParams.scrapType,
fileUrl: '',
}
})
if (this.imgUrlList.length > 0) {
arr.map((e) => (e.fileUrl = this.imgUrlList.join(',')))
}
let param = {
taskId: this.codeQuery.taskId,
arr: arr,
}
console.log(param)
setCodeBack(param).then((response) => {
if (response.code == 200) {
this.$modal.msgSuccess('操作成功')
// this.openCode = false;
this.returnNum =
Number(this.returnNum) - this.codeSelectList.length
this.handleCodeQuery()
this.handleQuery()
}
})
}
this.innerVisible = false
},
},
watch: {
innerVisible: {
handler(newValue) {
if (!newValue) {
this.scrapInfoParams.scrapReason = ''
this.scrapInfoParams.scrapType = ''
this.scrapInfoParams.fileUrl = ''
this.currentCode = null
this.scrapAll = false
this.fileList = []
this.imgUrlList = []
}
},
deep: true,
},
},
}
</script>
@ -1154,4 +1378,27 @@ export default {
color: #02a7f0;
cursor: pointer;
}
.upload-tip {
text-align: left;
.tip-text {
font-size: 13px;
color: red;
letter-spacing: 1px;
}
}
.upload-box {
display: flex;
.Upload-tip {
text-align: left;
}
}
.dialog-footer {
display: flex;
justify-content: flex-end;
align-items: center;
}
</style>

View File

@ -0,0 +1,110 @@
<template>
<el-upload
class="upload-demo"
:action="actionUrl"
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
:multiple="multiple"
:limit="limit"
:on-exceed="handleExceed"
:file-list="fileList"
:headers="headers"
:on-success="handleSuccess"
:data="uploadData"
:before-upload="beforeUpload"
>
<slot name="default">
<el-button size="small" type="primary">点击上传</el-button>
</slot>
<!-- <div slot="tip" class="el-upload__tip">{{ uploadTip }}</div> -->
</el-upload>
</template>
<script>
import { getToken } from '@/utils/auth'
export default {
name: 'UploadFile',
props: {
fileList: {
type: Array,
default: () => [],
},
actionUrl: {
type: String,
default: 'https://jsonplaceholder.typicode.com/posts/',
},
limit: {
type: Number,
default: 3,
},
// uploadTip: {
// type: String,
// default: 'jpg/png500kb'
// },
multiple: {
type: Boolean,
default: true,
},
},
data() {
return {
uploadImgUrl:
process.env.VUE_APP_BASE_API + '/dev-api' + this.actionUrl,
headers: {
Authorization: 'Bearer ' + getToken(),
},
uploadData: {
fileType: 'sx',
},
}
},
methods: {
handleRemove(file, fileList) {
this.$emit('remove', file, fileList)
},
handleSuccess(response, file, fileList) {
this.$emit('success', response, fileList)
},
handlePreview(file) {
this.$emit('preview', file)
},
handleExceed(files, fileList) {
this.$message.warning(
`当前限制选择 ${this.limit} 个文件,本次选择了 ${
files.length
} 个文件共选择了 ${files.length + fileList.length} 个文件`,
)
this.$emit('exceed', files, fileList)
},
beforeRemove(file, fileList) {
// return this.$confirm(` ${file.name} `)
// .then(() => {
// this.$emit('before-remove', file, fileList)
// })
// .catch(() => {})
},
beforeUpload(file) {
console.log('file', file)
const isJPGorPNG =
file.type == 'image/png' ||
file.type == 'image/jpg' ||
file.type == 'image/jpeg'
const isLt5M = file.size / 1024 / 1024 < 5 // 5MB
if (!isJPGorPNG) {
this.$message.error('只能上传 jpg、jpeg、png 格式的图片')
}
if (!isLt5M) {
this.$message.error('上传图片大小不能超过 5MB')
}
return isJPGorPNG && isLt5M
},
},
}
</script>
<style scoped>
.upload-demo .el-upload__tip {
margin-top: 10px;
}
</style>

View File

@ -114,7 +114,9 @@
<!-- 损坏原因 -->
<template slot-scope="{ data }" slot="t_damage">
{{ data.scrapType == 1 ? '人为' : '自然' }}
<!-- {{ data.scrapType == 1 ? '人为' : '自然' }} -->
<template v-if="data.scrapType == 1">人为</template>
<template v-if="data.scrapType == 0">自然</template>
</template>
<!-- 报废图片 -->
<template slot-scope="{ data }" slot="t_img">

View File

@ -114,7 +114,13 @@
>
<!-- 损坏原因 -->
<template slot-scope="{ data }" slot="t_damage">
{{ data.scrapType == 1 ? '人为' : '自然' }}
<!-- {{ data.scrapType == 1 ? '人为' : '自然' }} -->
<template v-if="data.scrapType == 1"
>人为</template
>
<template v-if="data.scrapType == 0"
>自然</template
>
</template>
<!-- 报废图片 -->
<template slot="imgPreview" slot-scope="{ data }">

View File

@ -93,7 +93,9 @@
>
<!-- 损坏原因 -->
<template slot-scope="{ data }" slot="t_damage">
{{ data.scrapType == 1 ? '人为' : '自然' }}
<!-- {{ data.scrapType == 1 ? '人为' : '自然' }} -->
<template v-if="data.scrapType == 1">人为</template>
<template v-if="data.scrapType == 0">自然</template>
</template>
<!-- 报废图片 -->
<template slot-scope="{ data }" slot="t_img">

View File

@ -78,7 +78,9 @@
>
<!-- 损坏原因 -->
<template slot-scope="{ data }" slot="t_damage">
{{ data.scrapType == 1 ? '人为' : '自然' }}
<!-- {{ data.scrapType == 1 ? '人为' : '自然' }} -->
<template v-if="data.scrapType == 1">人为</template>
<template v-if="data.scrapType == 0">自然</template>
</template>
<!-- 报废图片 -->
<template slot-scope="{ data }" slot="t_img">