<template>
|
<div>
|
<el-table :data="tableData" style="width: 100%" :row-class-name="tableRowClassName">
|
<el-table-column fixed prop="current_PalletCode" label="托盘条码">
|
</el-table-column>
|
<el-table-column prop="Current_Parts" label="名称">
|
</el-table-column>
|
<el-table-column prop="Current_Vehiclenumber" label="车型">
|
</el-table-column>
|
<el-table-column prop="Current_Models" label="车号">
|
</el-table-column>
|
<el-table-column prop="Current_Carset" label="车组号">
|
</el-table-column>
|
<el-table-column prop="Current_count" label="数量">
|
</el-table-column>
|
<el-table-column prop="Current_Static" label="状态">
|
</el-table-column>
|
<el-table-column prop="ModifyDate" label="开始检修时间">
|
|
</el-table-column>
|
<el-table-column fixed="right" label="操作">
|
<template v-slot="scope">
|
<el-button type="primary" v-if="!scope.row.ModifyDate" v-on:click="startRepair()" >开始检修</el-button>
|
<el-button type="success" v-if="scope.row.ModifyDate" v-on:click="dialogVisible = true" >检修完成</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
|
<el-dialog
|
title="检修完成统计"
|
v-model="dialogVisible"
|
width="40%"
|
>
|
<div style="font-size: 20px; margin-bottom: 20px;"> <!-- 增大内容字体并增加底部间距 -->
|
报废数量:<el-input-number v-model="num" :min="0" :max="this.zwcount" label="数量" style="font-size: 30px;"/> <!-- 增大输入框字体 -->
|
</div>
|
<el-select v-model="selectvalue" placeholder="请选择维修结果">
|
<el-option
|
v-for="item in options"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value">
|
</el-option>
|
</el-select>
|
<el-button type="success" style="width: 100%; margin-top: 30px;font-size: 20px;height: 40px;" v-on:click="queryDa()">确定</el-button> <!-- 调整按钮位置 -->
|
</el-dialog>
|
|
<div style="width: 40%; position: fixed; left: 40%; bottom: 2%">
|
<!-- 输入框,绑定 barocde,清除时触发 clearmessage -->
|
<el-input id="inputId" ref="inputId" placeholder="托盘到位后,请扫描检修" v-model="barocde" clearable focus="true"
|
@input="handleInput" style="width: 50%;height: 80px;font-size: 28px;">
|
</el-input>
|
<!-- 清空按钮,点击时清空 barocde 内容并触发焦点 -->
|
<el-button type="primary" @click="clearBarcode"
|
style="font-size: 30px;margin-left: 20px; padding: 12px 24px; height: 100px;">
|
清空托盘码
|
</el-button>
|
|
<el-button type="success"
|
style="font-size: 30px;margin-left: 20px; padding: 12px 24px; height: 100px;" v-on:click="queryDa2()">
|
未检回库
|
</el-button>
|
</div>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
barocde: '', // 当前条码
|
zwcount:0,
|
tableData: [], // 保存从 API 获取的数据
|
dialogVisible: false,
|
repairStarted:false,
|
num: 0,
|
butboo:true,
|
options: [{
|
value: '1',
|
label: '合格'
|
}, {
|
value: '2',
|
label: '半检修'
|
}],
|
selectvalue: ''
|
}
|
},
|
methods: {
|
handleInput() {
|
if (this.barocde !== '') {
|
// 发送请求时,确保条码不为空
|
console.log('查询条码:', this.barocde);
|
this.http
|
.get("/api/Dt_Repair/GetBarcodeMessage?barocde=" + this.barocde)
|
.then((res) => {
|
|
if (res.status) {
|
if (res.data != null) {
|
console.log(res.data);
|
this.tableData = [];
|
for (let i = 0; i < res.data.length; i++) {
|
this.tableData.push({
|
current_PalletCode: res.data[i].current_PalletCode,
|
Current_Parts: res.data[i].current_Parts,
|
Current_Vehiclenumber: res.data[i].current_Vehiclenumber,
|
Current_Models: res.data[i].current_Models,
|
Current_Carset: res.data[i].current_Carset,
|
Current_count: res.data[i].current_count,
|
Current_Static: res.data[i].current_Static=="10"?"准备检修":"检修中",
|
ModifyDate:res.data[i].modifyDate
|
})
|
this.zwcount=res.data[i].current_count;
|
}
|
}
|
} else {
|
this.$message.error("查询失败!");
|
}
|
})
|
.catch((err) => {
|
console.error(err); // 捕获错误
|
});
|
}
|
},
|
// 清空条码内容并聚焦输入框
|
clearBarcode() {
|
this.barocde = ''; // 清空条码内容
|
this.tableData = [];
|
this.$refs.inputId.focus(); // 重新聚焦输入框
|
},
|
tableRowClassName({row, rowIndex}) {
|
if (rowIndex === 1) {
|
return 'warning-row';
|
} else if (rowIndex === 3) {
|
return 'success-row';
|
}
|
return '';
|
},
|
queryDa(){
|
this.http
|
.get("/api/Dt_Repair/UpdateBarcoend?barocde=" + this.barocde+"&wcount="+ this.num+"&selectvalue="+this.selectvalue)
|
.then((res) => {
|
if (res.status) {
|
this.$message({ message: "维修结束成功!", type: "success" });
|
this.dialogVisible=false,
|
this.handleInput();
|
|
} else {
|
this.$message.error("维修结束失败!");
|
}
|
})
|
.catch((err) => {
|
console.error(err); // 捕获错误
|
});
|
},
|
queryDa2(){
|
this.http
|
.get("/api/Dt_Repair/UpdateBarcoendwj?barocde=" + this.barocde)
|
.then((res) => {
|
if (res.status) {
|
this.$message({ message: "未检回库成功!", type: "success" });
|
this.handleInput();
|
|
} else {
|
this.$message.error("未检回库失败!");
|
}
|
})
|
.catch((err) => {
|
console.error(err); // 捕获错误
|
});
|
},
|
startRepair(){
|
this.http
|
.get("/api/Dt_Repair/UpdateBarcode?barocde=" + this.barocde)
|
.then((res) => {
|
if (res.status) {
|
this.$message({ message: "开始检修!", type: "success" });
|
this.handleInput();
|
} else {
|
this.$message.error("开始检修失败!");
|
}
|
})
|
.catch((err) => {
|
console.error(err); // 捕获错误
|
});
|
}
|
}
|
}
|
</script>
|
|
<style>
|
.el-table .warning-row {
|
background: oldlace;
|
}
|
|
.el-table .success-row {
|
background: #f0f9eb;
|
}
|
</style>
|