编码退料-完好,损坏数量

This commit is contained in:
bb_pan 2025-02-11 15:03:58 +08:00
parent 81707a15f7
commit 7dfc37fa54
3 changed files with 168 additions and 103 deletions

View File

@ -1,6 +1,14 @@
<template>
<div>
<el-form :model="queryParams" ref="queryForm" size="small" :rules="queryRules" :inline="true" v-show="showSearch" label-width="100px">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:rules="queryRules"
:inline="true"
v-show="showSearch"
label-width="100px"
>
<el-row>
<el-form-item label="退料单位" prop="unitId">
<treeselect
@ -76,63 +84,61 @@
style="width: 240px"
:maxlength="11"
/>
</el-form-item>
</el-form-item>
</el-row>
<el-row :gutter="24" style="display: flex;align-items: center;">
<el-col :span="1.5" style="text-align: center;margin-left: 20px;">
<span style="color: red;">*</span>
<span style="font-size: 14px;font-weight: 600;color: #606266;">物品类型</span>
</el-col>
<el-col :span="6">
<el-select
ref="typeSelect"
v-model="tempDeviceType"
multiple
filterable
placeholder="请输入物品类型"
style="width: 400px"
@change="handleTypeChange"
clearable
collapse-tags
:filter-method="handleSearchImpl"
:popper-class="'type-select-dropdown'"
:popper-append-to-body="false"
@visible-change="handleVisibleChange"
<el-row :gutter="24" style="display: flex; align-items: center">
<el-col :span="1.5" style="text-align: center; margin-left: 20px">
<span style="color: red">*</span>
<span style="font-size: 14px; font-weight: 600; color: #606266">物品类型</span>
</el-col>
<el-col :span="6">
<el-select
ref="typeSelect"
v-model="tempDeviceType"
multiple
filterable
placeholder="请输入物品类型"
style="width: 400px"
@change="handleTypeChange"
clearable
collapse-tags
:filter-method="handleSearchImpl"
:popper-class="'type-select-dropdown'"
:popper-append-to-body="false"
@visible-change="handleVisibleChange"
>
<el-option
v-for="item in filteredOptions"
:key="item.typeId"
:label="item.fullPath"
:value="item.typeId"
:data-key="item.typeId"
>
<el-option
v-for="item in filteredOptions"
:key="item.typeId"
:label="item.fullPath"
:value="item.typeId"
:data-key="item.typeId"
>
<span v-html="highlightText(item.fullPath, searchKeyword)"></span>
<span style="float: right; color: #8492a6; font-size: 13px">
出库:{{ item.num }}
</span>
</el-option>
</el-select>
</el-col>
<el-col :span="5">
<el-input
ref="searchInput"
v-model="searchKeyword"
placeholder="输入物品类型高亮搜索"
prefix-icon="el-icon-search"
clearable
style="width: 300px"
@input="handleHighlightSearch"
@focus="handleSearchFocus"
@click.native="handleSearchClick"
>
<template slot="append">
<span v-if="matchedOptions.length" style="margin: 0 5px">
{{ currentMatchIndex + 1 }}/{{ matchedOptions.length }}
</span>
</template>
</el-input>
</el-col>
<!-- <el-cascader
<span v-html="highlightText(item.fullPath, searchKeyword)"></span>
<span style="float: right; color: #8492a6; font-size: 13px">出库:{{ item.num }}</span>
</el-option>
</el-select>
</el-col>
<el-col :span="5">
<el-input
ref="searchInput"
v-model="searchKeyword"
placeholder="输入物品类型高亮搜索"
prefix-icon="el-icon-search"
clearable
style="width: 300px"
@input="handleHighlightSearch"
@focus="handleSearchFocus"
@click.native="handleSearchClick"
>
<template slot="append">
<span v-if="matchedOptions.length" style="margin: 0 5px">
{{ currentMatchIndex + 1 }}/{{ matchedOptions.length }}
</span>
</template>
</el-input>
</el-col>
<!-- <el-cascader
:key="propsKey"
v-model="deviceType"
:show-all-levels="false"
@ -146,13 +152,14 @@
popper-class="popper-select"
@change="deviceTypeChange"
></el-cascader> -->
<!-- </el-form-item> -->
<!-- </el-form-item> -->
<el-form-item label="备注" prop="roleName">
<el-input
v-model="queryParams.remark"
placeholder="请输入备注"
clearable
rows="2" maxlength="100"
rows="2"
maxlength="100"
type="textarea"
style="width: 240px"
/>
@ -203,9 +210,11 @@
</el-table-column>
<el-table-column label="退料数量" align="center" prop="preNum" min-width="100">
<template slot-scope="scope">
<div style="color: rgb(2, 167, 240)"
<div
style="color: rgb(2, 167, 240)"
@click="openAddCode(scope.row)"
v-if="scope.row.manageType == 0">
v-if="scope.row.manageType == 0"
>
添加编码
</div>
<el-input
@ -228,6 +237,7 @@
clearable
style="width: 100%"
@input="changeNum(scope.row)"
:disabled="scope.row.manageType == 0"
/>
</template>
</el-table-column>
@ -239,6 +249,7 @@
clearable
style="width: 100%"
@input="changeNum(scope.row)"
:disabled="scope.row.manageType == 0"
/>
</template>
</el-table-column>
@ -284,7 +295,8 @@
size="mini"
type="text"
@click="picturePreview(scope.row)"
v-if="scope.row.bmFileInfos && scope.row.bmFileInfos.length > 0"fileName
v-if="scope.row.bmFileInfos && scope.row.bmFileInfos.length > 0"
fileName
>
查看
</el-button>
@ -316,27 +328,59 @@
<el-button type="primary" size="mini" @click="handleAddCode">添加编码</el-button>
</el-col>
</el-row> -->
<el-table :data="machineList" width="100%" ref="codeTableList" height="450px" row-key="maId" @selection-change="codeSelectionChange">
<el-table
:data="machineList"
width="100%"
ref="codeTableList"
height="450px"
row-key="maId"
@selection-change="codeSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" type="index" width="55" align="center" />
<el-table-column label="类型名称" prop="typeName" align="center" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="规格型号" prop="materialName" align="center" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="设备编码" prop="maCode" align="center" :show-overflow-tooltip="true"></el-table-column>
<el-table-column
label="类型名称"
prop="typeName"
align="center"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column
label="规格型号"
prop="materialName"
align="center"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column
label="设备编码"
prop="maCode"
align="center"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column label="设备状态" prop="maStatus" align="center" :show-overflow-tooltip="true">
<template slot-scope="scope">
<dict-tag :options="dict.type.ma_machine_status" :value="scope.row.maStatus" />
</template>
</el-table-column>
<el-table-column label="外观判定11" prop="apDetection" align="center" width="150" :show-overflow-tooltip="true">
<el-table-column
label="外观判定"
prop="apDetection"
align="center"
width="160"
:show-overflow-tooltip="true"
>
<template slot-scope="scope">
<el-input
<!-- <el-input
v-model.number="scope.row.apDetection"
placeholder="外观判定"
maxlength="20"
type="text"
clearable
style="width: 100%"
/>
/> -->
<el-radio-group v-model="scope.row.apDetection">
<el-radio label="1">完好</el-radio>
<el-radio label="0">损坏</el-radio>
</el-radio-group>
</template>
</el-table-column>
<el-table-column label="附件" align="center" width="120" :show-overflow-tooltip="true">
@ -354,13 +398,16 @@
>
<el-button size="mini" type="text" @click="beforeFileUpload(scope.row)">上传</el-button>
</el-upload>
<el-button size="mini" type="text" @click="picturePreview(scope.row)"
v-if="scope.row.bmFileInfos && scope.row.bmFileInfos.length > 0">
查看
<el-button
size="mini"
type="text"
@click="picturePreview(scope.row)"
v-if="scope.row.bmFileInfos && scope.row.bmFileInfos.length > 0"
>
查看
</el-button>
</div>
</template>
</el-table-column>
<!-- <el-table-column
label="文件名称"
@ -579,8 +626,9 @@ export default {
},
mounted() {
this.GetUnitData()
this.GetProData()
if (this.backId) { //
this.GetProData()
if (this.backId) {
//
this.rowId = this.backId
this.GetViewByApply()
}
@ -605,12 +653,14 @@ export default {
}
// preNum
if (row.badNum + row.goodNum > row.preNum) {
console.log('🚀 ~ changeNum ~ row.badNum + row.goodNum > row.preNum:', row.badNum + row.goodNum > row.preNum)
console.log(
'🚀 ~ changeNum ~ row.badNum + row.goodNum > row.preNum:',
row.badNum + row.goodNum > row.preNum
)
this.$message.error('完好数量和损坏数量之和不能大于退料数量')
row.badNum = 0
row.goodNum = 0
}
},
/** 转换菜单数据结构 */
normalizer(node) {
@ -689,9 +739,9 @@ export default {
},
//
processTypeData(data) {
const result = []
const result = []
const traverse = (node, parents = []) => {
const path = [...parents, node.typeName]
const path = [...parents, node.typeName]
if (!node.children || node.children.length === 0) {
result.push({
typeId: node.typeId,
@ -752,11 +802,11 @@ export default {
...typeData,
preNum: 0,
typeModel: typeData.typeName,
typeName:typeData.specificationType,
typeName: typeData.specificationType,
apDetection: '',
remark:'',
maCodeList:[],
bmFileInfos:[]
remark: '',
maCodeList: [],
bmFileInfos: []
})
this.deviceType.push(lastSelected)
this.$message({
@ -817,7 +867,7 @@ export default {
async GetViewByApply(params) {
const res = await getBackApplyInfo(this.rowId)
console.log(res)
const data = res.data;
const data = res.data
this.queryParams.unitId = data.backApplyInfo.unitId
// this.unitId = this.treeParentsById(this.unitList, this.queryParams.unitId)
this.GetProData()
@ -829,8 +879,10 @@ export default {
this.queryParams.backPerson = data.backApplyInfo.backPerson
this.queryParams.agreementId = data.backApplyInfo.agreementId
this.queryParams.remark = data.backApplyInfo.remark
this.equipmentList = data.backApplyDetailsList;
this.equipmentList.forEach(item=>{item.tempMaCodeList=item.maCodeList})
this.equipmentList = data.backApplyDetailsList
this.equipmentList.forEach(item => {
item.tempMaCodeList = item.maCodeList
})
this.GetDeviceTypeTreeFn(data.backApplyInfo.agreementId)
},
//
@ -1036,7 +1088,7 @@ export default {
template.num = node.data.num
template.useNum = node.data.useNum
return template
},
},
// changeMachine(val){
// console.log(val)
// this.maData = this.machineList.find(option => option.maId == val);
@ -1054,27 +1106,27 @@ export default {
this.machineList = res.data
this.machineList.forEach(item => {
item.bmFileInfos = []
item.apDetection = ''
item.apDetection = '1'
})
})
},
//-
async openAddCode(row) {
this.rowData = row;
this.rowData = row
await this.getMachineById(row.typeId)
// this.maId=""
if (this.rowData.maCodeList && this.rowData.maCodeList.length > 0) {
if (this.rowData.maCodeList && this.rowData.maCodeList.length > 0) {
console.log(this.maCodeList)
console.log(this.machineList)
if (this.rowId != '') {
// //
this.rowData.tempMaCodeList.forEach(item => {
// //
this.rowData.tempMaCodeList.forEach(item => {
this.machineList.unshift(item) //
// this.$nextTick(() => {
// this.$refs.codeTableList.toggleRowSelection(item, true)
// })
})
this.maCodeList = this.rowData.maCodeList;
this.maCodeList = this.rowData.maCodeList
this.machineList.forEach(item => {
this.maCodeList.forEach(sub => {
if (sub.maId == item.maId) {
@ -1086,7 +1138,6 @@ export default {
}
})
})
} else {
//
// console.log("")
@ -1109,7 +1160,7 @@ export default {
},
codeSelectionChange(selection) {
this.maCodeList = selection
// console.log(selection)
// console.log(selection)
// this.queryParams.equipmentList = selection
},
//
@ -1147,8 +1198,11 @@ export default {
saveDevCode() {
console.log(this.rowData)
console.log(this.maCodeList)
this.rowData.maCodeList = this.maCodeList;
this.rowData.preNum = this.maCodeList.length;
this.rowData.maCodeList = this.maCodeList
this.rowData.preNum = this.maCodeList.length
// this.rowData.goodNum = this.maCodeList apDetection 1
this.rowData.goodNum = this.maCodeList.filter(item => item.apDetection === '1').length
this.rowData.badNum = this.maCodeList.filter(item => item.apDetection === '0').length
this.open = false
console.log(this.equipmentList)
},
@ -1177,7 +1231,7 @@ export default {
}
this.machineList.map((item, index2) => {
if (item.maCode == this.fileData.maCode) {
this.$set(item, 'bmFileInfos', [obj])
this.$set(item, 'bmFileInfos', [obj])
this.$set(item, 'fileName', response.data.name)
}
})
@ -1199,10 +1253,17 @@ export default {
console.log(row.bmFileInfos)
if (row.bmFileInfos.length > 0) {
let file = row.bmFileInfos[0]
this.dialogImageUrl = file.url.replaceAll('#','%23')
this.dialogImageUrl = file.url.replaceAll('#', '%23')
const parts = file.name.split('.')
const extension = parts.pop()
if (extension === 'doc' || extension === 'DOC' || extension === 'docx' || extension === 'DOCX' || extension === 'pdf' || extension === 'PDF') {
if (
extension === 'doc' ||
extension === 'DOC' ||
extension === 'docx' ||
extension === 'DOCX' ||
extension === 'pdf' ||
extension === 'PDF'
) {
const windowName = file.name
window.open(file.url, windowName)
} else {

View File

@ -297,14 +297,18 @@
<dict-tag :options="dict.type.ma_machine_status" :value="scope.row.maStatus"/>
</template>
</el-table-column>
<el-table-column label="外观判定222" prop="apDetection" align="center" width="150" :show-overflow-tooltip="true">
<el-table-column label="外观判定" prop="apDetection" align="center" width="160" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-input
<!-- <el-input
v-model.number="scope.row.apDetection"
placeholder="外观判定" maxlength="20"
type="text" clearable :readonly="isView"
style="width: 100%"
/>
/> -->
<el-radio-group v-model="scope.row.apDetection" disabled>
<el-radio label="1">完好</el-radio>
<el-radio label="0">损坏</el-radio>
</el-radio-group>
</template>
</el-table-column>
<el-table-column label="附件" align="center" width="100">

View File

@ -36,7 +36,7 @@ module.exports = {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
// target: `http://localhost:18080`,
target: `http://192.168.2.246:18080`,//马
target: `http://192.168.2.247:18080`,//马
// target: `http://192.168.0.244:18580`,//测试
// target: `http://192.168.2.223:18080`,//山
// target: `http://192.168.2.23:18080`,//洪