配件库存、维修单签名、报废附件校验、报告loding

This commit is contained in:
hayu 2025-10-23 18:47:45 +08:00
parent 58739a7637
commit 2d2de874d2
4 changed files with 401 additions and 216 deletions

View File

@ -0,0 +1,155 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item prop="keyWord">
<el-input
v-model="queryParams.keyWord"
placeholder="请输入关键词"
clearable
@keyup.enter.native="handleQuery"
maxlength="20"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="warning" plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出数据</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :data="tableList" ref="multipleTable" row-key="taskId" border>
<el-table-column label="序号" align="center" width="80" type="index">
<template slot-scope="scope">
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="配件名称" align="center" prop="typeName" :show-overflow-tooltip="true"/>
<el-table-column label="规格型号" align="center" prop="typeModelName" :show-overflow-tooltip="true"/>
<el-table-column label="单位" align="center" prop="unit" :show-overflow-tooltip="true"/>
<el-table-column label="库存" align="center" prop="storeNum" :show-overflow-tooltip="true"/>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import {getPartPersonNumApi} from '@/api/part/partArrived';
import vueEasyPrint from "vue-easy-print";
export default {
name: "PartAccept",
dicts: ['part_task_status'],
components: { vueEasyPrint },
data() {
return {
//
loading: false,
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
tableList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
keyWord:undefined,
},
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
getPartPersonNumApi(this.queryParams).then(response => {
this.tableList = response.data.rows;
this.total = response.data.total;
this.loading = false;
});
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.queryParams.keyWord=null;
this.handleQuery();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
handleExport() {
const formatTime = (date) => {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}${month}${day}_${hours}${minutes}${seconds}`;
};
const currentTime = formatTime(new Date());
this.download(
"/material/complex_query/export",
{ ...this.queryParams},
`配件库存_${currentTime}.xlsx`
);
},
}
};
</script>
<style lang="scss" scoped>
.uploadImg {
padding-top: 20px;
display: flex;
align-items: center;
justify-content: center;
}
.deviceCode {
margin-top: 10px;
padding-bottom: 20px;
font-size: 18px;
}
::v-deep.el-table .fixed-width .el-button--mini {
width: 60px !important;
margin-bottom: 10px;
}
//css
::v-deep.disabled {
.el-upload--picture-card {
display: none;
}
}
</style>

View File

@ -348,25 +348,43 @@
<!-- <el-table-column label="报告日期" align="center" prop="orgName" :show-overflow-tooltip="true"/> <!-- <el-table-column label="报告日期" align="center" prop="orgName" :show-overflow-tooltip="true"/>
<el-table-column label="截止有效期" align="center" prop="orgName" :show-overflow-tooltip="true"/> --> <el-table-column label="截止有效期" align="center" prop="orgName" :show-overflow-tooltip="true"/> -->
<el-table-column label="操作" align="center" width="100"> <el-table-column label="操作" align="center" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<div style="display: flex; align-items: center; justify-content: space-between"> <div style="display: flex; align-items: center; justify-content: space-between">
<el-upload ref="upload" :headers="upload.headers" <el-upload
:action="upload.url" :show-file-list="false" accept=".png, .jpg, .jpeg, .pdf, .doc, .docx" ref="upload"
:on-success="(response, file, fileList) => handleFileSuccess(scope.row, response, file, fileList)" :auto-upload="true" :headers="upload.headers"
:before-upload="(file) => beforeUpload(scope.row, file)" :action="upload.url"
> :show-file-list="false"
<el-button size="mini" type="text" @click="beforeFileUpload(scope.row)"> accept=".png, .jpg, .jpeg, .pdf, .doc, .docx"
上传 :auto-upload="true"
</el-button> :on-success="(response, file, fileList) => handleFileSuccess(scope.row, response, file, fileList)"
</el-upload> :before-upload="(file) => beforeUpload(scope.row, file)"
:on-error="handleUploadError"
:on-change="(file, fileList) => handleFileChange(file, fileList, scope.row)"
>
<el-button
size="mini"
type="text"
@click="beforeFileUpload(scope.row)"
:loading="uploadLoading && currentUploadRow === scope.row"
:disabled="uploadLoading && currentUploadRow !== scope.row"
>
{{ (uploadLoading && currentUploadRow === scope.row) ? '上传中...' : '上传' }}
</el-button>
</el-upload>
<el-button size="mini" type="text" @click="picturePreviewFile(scope.row)" v-if="scope.row.fileListTemp!=0" style="margin-left: 20px;"> <el-button
size="mini"
type="text"
@click="picturePreviewFile(scope.row)"
v-if="scope.row.fileListTemp != 0"
style="margin-left: 20px;"
:disabled="uploadLoading"
>
查看 查看
</el-button> </el-button>
</div> </div>
</template>
</template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-dialog> </el-dialog>
@ -552,7 +570,9 @@ export default {
currentMatchIndex: -1, // currentMatchIndex: -1, //
matchedOptions: [], // matchedOptions: [], //
keepSelectOpen: false, // keepSelectOpen: false, //
isSearching: false // isSearching: false, //
uploadLoading: false, //
currentUploadRow: null, //
} }
}, },
computed: { computed: {
@ -1107,142 +1127,121 @@ export default {
}) })
.catch(() => {}) .catch(() => {})
}, },
beforeFileUpload(row){ //
this.rowData.fileType = row.fileType beforeFileUpload(row) {
}, this.rowData.fileType = row.fileType;
this.currentUploadRow = row;
},
beforeUpload(row, file) { //
row.fileList.push(file); beforeUpload(row, file) {
console.log('6666666',row.fileList) this.uploadLoading = true;
if (row.fileList.length > 3) { row.fileList.push(file);
this.$message.warning('最多只能上传三张图片'); if (row.fileList.length > 3) {
// this.$message.warning('最多只能上传三张图片');
row.fileList.pop(); row.fileList.pop();
return false; // this.uploadLoading = false;
} return false;
return true; // }
}, return true;
},
//
handleFileChange(file, fileList, row) {
// fileList
if (!fileList || fileList.length === 0) {
this.uploadLoading = false;
this.currentUploadRow = null;
}
},
// //
handleFileSuccess(row,response, file, fileList) { handleFileSuccess(row, response, file, fileList) {
if (response.code == 200) { this.uploadLoading = false;
if (this.taskId == "") {// this.currentUploadRow = null;
row.fileListTemp.push({
"name": response.data.name,
"url": response.data.url,
})
// console.log(response)
// console.log(this.rowData)
// console.log(this.rowData.bmFileInfos)
let obj = {
"taskId": this.taskId,
"taskType": "0",
"name": response.data.name,
"url": response.data.url,
"modelId": this.rowData.partId,
"fileType": this.rowData.fileType,
// "dictLabel": this.rowData.dictLabel,
}
//
let index = this.fileDataList.findIndex(v=>v.fileType==this.rowData.fileType)
this.fileDataList[index].name = response.data.name
this.fileDataList[index].url = response.data.url
//-
if(this.rowData.bmFileInfos.length>0){
let index2 = this.rowData.bmFileInfos.findIndex(v=>v.fileType==this.rowData.fileType)
if(index2>-1){//-
this.rowData.bmFileInfos.splice(index2,0,obj)
}else{//-
this.rowData.bmFileInfos.push(obj)
}
}else{
this.rowData.bmFileInfos.push(obj)
}
} else {// if (response.code === 200) {
row.fileListTemp.push({ //
"name": response.data.name, row.fileListTemp.push({
"url": response.data.url, name: response.data.name,
}) url: response.data.url,
let obj = { });
"taskId": this.taskId,
"taskType": "0",
"name": response.data.name,
"url": response.data.url,
"modelId": this.rowData.partId,
"fileType": this.rowData.fileType,
// "dictLabel": this.rowData.dictLabel,
}
//
let index = this.fileDataList.findIndex(v=>v.fileType==this.rowData.fileType)
this.fileDataList[index].name = response.data.name
this.fileDataList[index].url = response.data.url
//-
if(this.rowData.bmFileInfos.length>0){
let index2 = this.rowData.bmFileInfos.findIndex(v=>v.fileType==this.rowData.fileType)
if(index2>-1){//-
this.rowData.bmFileInfos.splice(index2,0,obj)
}else{//-
this.rowData.bmFileInfos.push(obj)
}
}else{
this.rowData.bmFileInfos.push(obj)
}
uploadPurchaseFile(obj).then((response) => {
this.$modal.msgSuccess('上传成功')
}).catch(() => { const obj = {
this.$modal.msgError('上传失败') taskId: this.taskId,
}) taskType: "0",
name: response.data.name,
url: response.data.url,
modelId: this.rowData.partId,
fileType: this.rowData.fileType,
};
const index = this.fileDataList.findIndex(v => v.fileType == this.rowData.fileType);
if (index > -1) {
this.fileDataList[index].name = response.data.name;
this.fileDataList[index].url = response.data.url;
}
if (this.rowData.bmFileInfos.length > 0) {
const index2 = this.rowData.bmFileInfos.findIndex(v => v.fileType == this.rowData.fileType);
if (index2 > -1) {
this.rowData.bmFileInfos.splice(index2, 0, obj);
} else {
this.rowData.bmFileInfos.push(obj);
} }
} else {
this.rowData.bmFileInfos.push(obj);
} }
},
picturePreviewFile(row) { //
row.fileList = [] if (this.taskId !== "") {
row.fileListTemp.forEach(item=>{ uploadPurchaseFile(obj)
row.fileList.push({ .then(() => this.$modal.msgSuccess("上传成功"))
"name": item.name, .catch(() => this.$modal.msgError("上传失败"));
"url": item.url,
})
})
this.fileId = row.fileType
this.fileListInfo = row.fileListTemp
this.dialogVisibleFile = true
},
//
picturePreview(file) {
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'){
const windowName = file.name
window.open(file.url,windowName)
}else{
this.dialogVisible = true
} }
}, }
},
//
handleUploadError(error, file, fileList) {
this.uploadLoading = false;
this.currentUploadRow = null;
this.$modal.msgError("上传失败");
console.error("上传失败:", error);
},
// picturePreviewFile(row) {
pictureDelete(row, id) { row.fileList = row.fileListTemp.map(item => ({
let index = id name: item.name,
this.fileListInfo = this.fileListInfo.filter(item => item.url !== row.url); url: item.url,
this.fileDataList[this.fileId].fileList = this.fileDataList[this.fileId].fileList.filter(item => item.url !== row.url); }));
this.fileDataList[this.fileId].fileListTemp = this.fileDataList[this.fileId].fileListTemp.filter(item => item.url !== row.url); this.fileId = row.fileType;
let bmFiles = [] this.fileListInfo = row.fileListTemp;
this.rowData.bmFileInfos.forEach((item)=>{ this.dialogVisibleFile = true;
if (item.fileType != this.fileId) { },
bmFiles.push(item)
}else{
if (item.url!= row.url) { //
bmFiles.push(item) picturePreview(file) {
} this.dialogImageUrl = file.url.replaceAll("#", "%23");
} const ext = file.name.split('.').pop().toLowerCase();
}) if (["doc", "docx", "pdf"].includes(ext)) {
this.rowData.bmFileInfos = bmFiles; window.open(file.url, file.name);
}, } else {
this.dialogVisible = true;
}
},
//
pictureDelete(row, id) {
this.fileListInfo = this.fileListInfo.filter(item => item.url !== row.url);
this.fileDataList[this.fileId].fileList =
this.fileDataList[this.fileId].fileList.filter(item => item.url !== row.url);
this.fileDataList[this.fileId].fileListTemp =
this.fileDataList[this.fileId].fileListTemp.filter(item => item.url !== row.url);
this.rowData.bmFileInfos = this.rowData.bmFileInfos.filter(item => {
if (item.fileType !== this.fileId) return true;
return item.url !== row.url;
});
},
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {

View File

@ -295,7 +295,7 @@
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-row> <el-row>
<el-form-item label="照片"> <el-form-item label="照片" required>
<el-upload <el-upload
action="#" action="#"
:file-list="fileList" :file-list="fileList"
@ -518,7 +518,7 @@
<el-form-item label="报废原因" prop="scrapReason"> <el-form-item label="报废原因" prop="scrapReason">
<el-input v-model="formRight.scrapReason" placeholder="请输入报废原因" clearable maxlength="150" type="textarea" style="width: 240px" rows="4"></el-input> <el-input v-model="formRight.scrapReason" placeholder="请输入报废原因" clearable maxlength="150" type="textarea" style="width: 240px" rows="4"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="照片"> <el-form-item label="照片" required>
<el-upload <el-upload
action="#" action="#"
:file-list="fileList" :file-list="fileList"
@ -1310,6 +1310,11 @@ export default {
this.uploadKey = Date.now(); this.uploadKey = Date.now();
this.$refs["scrapForm"].validate(async(valid) => { this.$refs["scrapForm"].validate(async(valid) => {
if(valid){ if(valid){
//
if(this.fileList.length === 0){
this.$message.error('请上传照片');
return;
}
if(this.fileList.length!=0){ if(this.fileList.length!=0){
await this.getImaUpload(), await this.getImaUpload(),
await this.addWaitRepairPic(this.scrapForm); await this.addWaitRepairPic(this.scrapForm);
@ -1539,6 +1544,13 @@ export default {
}) })
return return
} }
if((Number(this.formLeft.repairNum) + Number(this.formMiddle.repairNum)+ Number(this.formRight.scrapNum)) ==0) {
this.$message({
message: '请输入维修数量 ',
type: 'warning'
})
return
}
let refTemp = []; let refTemp = [];
if(this.formLeft.repairNum!=0){ if(this.formLeft.repairNum!=0){
refTemp.push(this.$refs.formLeft) refTemp.push(this.$refs.formLeft)
@ -1548,6 +1560,11 @@ export default {
} }
if(this.formRight.scrapNum!=0){ if(this.formRight.scrapNum!=0){
refTemp.push(this.$refs.formRight) refTemp.push(this.$refs.formRight)
//
if(this.fileList.length === 0){
this.$message.error('请上传照片');
return;
}
} }
const valid = await this.validateForms(refTemp) const valid = await this.validateForms(refTemp)
if(valid){ if(valid){

View File

@ -311,40 +311,50 @@
</tbody> </tbody>
</table> </table>
<div class="fillIn" style=" margin-top: 20px; display: flex; justify-content: space-between;"> <div class="fillIn" style="margin-top: 20px; display: flex; align-items: center; justify-content: space-between;">
<div class="item" style="width: 50%"> <!-- 负责人 + 签名 -->
<div> <div class="item" style="width: 50%; display: flex; align-items: center;">
<span>负责人</span> <div style="width: 30%; white-space: nowrap; display: flex; align-items: center;">
维修人员
</div>
<div
v-if="repairTicketlLevelOne.signUrl"
style="width: 70%; display: flex; justify-content: flex-start;"
>
<img
:src="repairTicketlLevelOne.signUrl"
style="width: 40px; height: 100px; object-fit: contain;"
:class="{ 'is-rotate': repairTicketlLevelOne.signType == 0 }"
alt=""
/>
</div> </div>
</div> </div>
<div class="item" style="width: 50%"> <!-- 完成日期 -->
<div> <div class="item" style="width: 50%; display: flex; align-items: center;">
<span>完成日期</span> <span>完成日期</span>
{{ repairTicketlLevelOne.finishTime }} <span style="margin-left: 4px;">{{ repairTicketlLevelOne.repairTime }}</span>
</div>
</div>
</div>
<div class="fillIn" style="margin-top: 20px; display: flex; justify-content: space-between;">
<div class="item" style="width: 33%">
<div>
<span>维修人员</span>
</div>
</div>
<div class="item" style="width: 33%">
<div>
<span>试验人员</span>
</div>
</div>
<div class="item" style="width: 33%">
<div>
<span>检验人员</span>
</div>
</div> </div>
</div> </div>
<!-- <div class="fillIn" style="margin-top: 20px; display: flex; justify-content: space-between;">-->
<!-- <div class="item" style="width: 33%">-->
<!-- <div>-->
<!-- <span>维修人员</span>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="item" style="width: 33%">-->
<!-- <div>-->
<!-- <span>试验人员</span>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="item" style="width: 33%">-->
<!-- <div>-->
<!-- <span>检验人员</span>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
</div> </div>
<!-- </vue-easy-print> --> <!-- </vue-easy-print> -->
</div> </div>
@ -510,8 +520,8 @@ export default {
// //
openPrint:false, openPrint:false,
printData: {}, printData: {},
//taskId // //taskId
ids:[], // ids:[],
taskList:[], taskList:[],
// //
repairTicketlLevelOne:{}, repairTicketlLevelOne:{},
@ -866,4 +876,8 @@ export default {
.part-info .total-price { .part-info .total-price {
margin-left: 20px; /* 调整间距大小 */ margin-left: 20px; /* 调整间距大小 */
} }
.is-rotate {
transform: rotate(-90deg);
transform-origin: center center;
}
</style> </style>