This commit is contained in:
jjLv 2024-11-15 16:02:29 +08:00
parent 576f6d11b9
commit 64fa253bcf
2 changed files with 273 additions and 14 deletions

View File

@ -22,6 +22,15 @@ export function getNewBuyBindListDetailsApi(query) {
}) })
} }
//二级页面 查看
export function getMaCodeInfo(query) {
return request({
url: '/material/purchase_macode_info/list',
method: 'get',
params: query,
})
}
//任务 详情 //任务 详情
export function bindAllData(data) { export function bindAllData(data) {
return request({ return request({
@ -40,6 +49,7 @@ export function getListDetailById(query) {
}) })
} }
// 导出 // 导出
export function exportNewBuy(data) { export function exportNewBuy(data) {
return request({ return request({

View File

@ -97,12 +97,12 @@
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column align="center" label="单位" prop="unitName" /> <el-table-column align="center" label="单位" prop="unitName" />
<el-table-column <!-- <el-table-column
align="center" align="center"
label="供应商" label="供应商"
prop="supplierName" prop="supplierName"
show-overflow-tooltip show-overflow-tooltip
/> /> -->
<el-table-column <el-table-column
align="center" align="center"
label="出厂日期" label="出厂日期"
@ -110,12 +110,15 @@
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column label="相关配套资料" align="center" prop="checkUrlName"> <el-table-column label="相关配套资料" align="center" prop="bmFileInfos">
<!-- <template slot-scope="scope"> <template slot-scope="scope">
<div @click="openGt(scope.row)" style="color: #02a7f0; cursor: pointer"> <div
{{ '报告管理' }} style="color: rgb(2, 167, 240); cursor: pointer"
</div> @click="openFileDialog(scope.row)"
</template> --> >
报告管理
</div>
</template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="状态"> <el-table-column align="center" label="状态">
@ -181,9 +184,9 @@
> >
<el-table border max-height="600px" :data="viewCodeList"> <el-table border max-height="600px" :data="viewCodeList">
<el-table-column label="序号" align="center" type="index" /> <el-table-column label="序号" align="center" type="index" />
<el-table-column align="center" label="类型名称" prop="materialName" /> <el-table-column align="center" label="类型名称" prop="maTypeName" />
<el-table-column align="center" label="规格型号" prop="materialModel" /> <el-table-column align="center" label="规格型号" prop="typeName" />
<el-table-column align="center" prop="maCode" label="设备编码" /> <el-table-column align="center" label="设备编码" prop="maCode" />
<el-table-column align="center" label="绑定人员" prop="createBy" /> <el-table-column align="center" label="绑定人员" prop="createBy" />
<el-table-column align="center" label="绑定时间" prop="createTime" /> <el-table-column align="center" label="绑定时间" prop="createTime" />
<el-table-column align="center" label="出厂编号" prop="outFacCode" /> <el-table-column align="center" label="出厂编号" prop="outFacCode" />
@ -247,8 +250,8 @@
</el-form> </el-form>
<el-table border max-height="600px" :data="codeTableList"> <el-table border max-height="600px" :data="codeTableList">
<el-table-column align="center" label="序号" type="index" /> <el-table-column align="center" label="序号" type="index" />
<el-table-column align="center" label="设备名称" prop="materialName" /> <el-table-column align="center" label="设备名称" prop="maTypeName" />
<el-table-column align="center" label="规格型号" prop="materialModel" /> <el-table-column align="center" label="规格型号" prop="typeName" />
<el-table-column align="center" label="设备编码"> <el-table-column align="center" label="设备编码">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<el-input clearable v-model="row.maCode" placeholder="请填写编码" /> <el-input clearable v-model="row.maCode" placeholder="请填写编码" />
@ -286,6 +289,93 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-dialog> </el-dialog>
<el-dialog
title="报告管理"
:visible.sync="open"
width="900px"
append-to-body
>
<el-table :data="fileDataList" width="100%" height="350px">
<el-table-column label="序号" type="index" width="55" align="center" />
<el-table-column
label="报告类型"
align="center"
prop="dictLabel"
:show-overflow-tooltip="true"
/>
<el-table-column
label="文件名称"
align="center"
prop="name"
:show-overflow-tooltip="true"
/>
<el-table-column
label="类型名称"
align="center"
:show-overflow-tooltip="true"
>
<template>
<div>{{ this.rowData.maTypeName }}</div>
</template>
</el-table-column>
<el-table-column
label="规格型号"
align="center"
:show-overflow-tooltip="true"
>
<template>
<div>{{ this.rowData.typeName }}</div>
</template>
</el-table-column>
<!-- <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">
<template slot-scope="scope">
<div
style="
display: flex;
align-items: center;
justify-content: space-between;
"
>
<el-upload
ref="upload"
:limit="1"
:headers="upload.headers"
:action="upload.url"
:show-file-list="false"
accept=".png, .jpg, .jpeg, .pdf, .doc, .docx"
:on-success="handleFileSuccess"
:auto-upload="true"
>
<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.url"
>
查看
</el-button>
</div>
</template>
</el-table-column>
</el-table>
</el-dialog>
<!-- 图片查看弹窗 -->
<el-dialog :visible.sync="dialogVisible" width="500px" height="500px">
<img width="100%" height="500px" :src="dialogImageUrl" />
</el-dialog>
</div> </div>
</template> </template>
@ -294,7 +384,13 @@ import {
bindAllData, bindAllData,
getListDetailById, getListDetailById,
getNewBuyBindListDetailsApi, getNewBuyBindListDetailsApi,
getMaCodeInfo,
} from "@/api/purchase/goodsBind"; } from "@/api/purchase/goodsBind";
import { getToken } from "@/utils/auth";
import {
uploadPurchaseFile,
getPurchaseFileList,
} from "@/api/purchase/goodsAccept";
export default { export default {
name: "BindTools", name: "BindTools",
@ -376,6 +472,26 @@ export default {
productDate: "", productDate: "",
taskStatus: 3, taskStatus: 3,
}, },
//
open: false,
rowData: {},
fileDataList: [
{ dictLabel: "合格证", fileType: "0", name: "", url: "" },
{ dictLabel: "型式试验报告", fileType: "1", name: "", url: "" },
{ dictLabel: "出厂检测报告", fileType: "2", name: "", url: "" },
{ dictLabel: "第三方监测报告", fileType: "3", name: "", url: "" },
{ dictLabel: "其他报告", fileType: "4", name: "", url: "" },
],
//
dialogImageUrl: "",
dialogVisible: false,
//
upload: {
//
headers: { Authorization: "Bearer " + getToken() },
//
url: process.env.VUE_APP_BASE_API + "/file/upload",
},
}; };
}, },
created() { created() {
@ -421,6 +537,13 @@ export default {
// //
handleView(row) { handleView(row) {
this.viewCodeVisible = true; this.viewCodeVisible = true;
getMaCodeInfo({ taskId: row.taskId, typeId: row.typeId }).then(
(response) => {
this.viewCodeList = response.rows;
this.titleBind = "查看";
this.loadingTwo = false;
}
);
// this.loadingTwo = true // this.loadingTwo = true
// getListDetailById({ taskId: row.taskId, typeId: row.typeId }).then( // getListDetailById({ taskId: row.taskId, typeId: row.typeId }).then(
// (response) => { // (response) => {
@ -434,7 +557,7 @@ export default {
// //
handleBind(row) { handleBind(row) {
this.bindCodeVisible = true; this.bindCodeVisible = true;
this.waitBindNum = row.purchaseNum; this.waitBindNum = row.checkNum - row.bindNum;
this.queryBindForm.typeId = row.typeId; this.queryBindForm.typeId = row.typeId;
this.queryBindForm.typeName = row.typeName; this.queryBindForm.typeName = row.typeName;
this.queryBindForm.maTypeName = row.maTypeName; this.queryBindForm.maTypeName = row.maTypeName;
@ -459,6 +582,130 @@ export default {
.then(() => {}) .then(() => {})
.catch(() => {}); .catch(() => {});
}, },
//
openFileDialog(row) {
this.rowData = row;
this.fileDataList = [
{ dictLabel: "合格证", fileType: "0", name: "", url: "" },
{ dictLabel: "型式试验报告", fileType: "1", name: "", url: "" },
{ dictLabel: "出厂检测报告", fileType: "2", name: "", url: "" },
{ dictLabel: "第三方监测报告", fileType: "3", name: "", url: "" },
{ dictLabel: "其他报告", fileType: "4", name: "", url: "" },
];
if (this.taskId == "") {
// console.log(this.rowData)
// console.log(this.rowData.bmFileInfos)
if (this.rowData.bmFileInfos.length > 0) {
this.rowData.bmFileInfos.forEach((item) => {
let index = this.fileDataList.findIndex(
(v) => v.fileType == item.fileType
);
this.fileDataList[index].name = item.name;
this.fileDataList[index].url = item.url;
});
}
} else {
this.getFileData();
}
this.open = true;
},
getFileData() {
let param = {
modelId: this.rowData.typeId,
taskType: 0,
taskId: this.rowData.taskId,
};
getPurchaseFileList(param)
.then((response) => {
if (response.rows.length > 0) {
response.rows.forEach((item) => {
let index = this.fileDataList.findIndex(
(v) => v.fileType == item.fileType
);
this.fileDataList[index].name = item.name;
this.fileDataList[index].url = item.url;
});
}
})
.catch(() => {});
},
beforeFileUpload(row) {
this.rowData.fileType = row.fileType;
},
//
handleFileSuccess(response, file, fileList) {
if (response.code == 200) {
if (this.taskId == "") {
//
// 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.typeId,
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 {
//
let param = {
taskId: this.taskId,
taskType: "0",
name: response.data.name,
url: response.data.url,
modelId: this.rowData.typeId,
fileType: this.rowData.fileType,
// "dictLabel": this.rowData.dictLabel,
};
uploadPurchaseFile(param)
.then((response) => {
this.$modal.msgSuccess("上传成功");
this.getFileData();
})
.catch(() => {
this.$modal.msgError("上传失败");
});
}
}
},
//
picturePreview(file) {
this.dialogImageUrl = file.url;
const parts = file.name.split(".");
const extension = parts.pop();
if (extension === "doc" || extension === "docx" || extension === "pdf") {
const windowName = file.name;
window.open(file.url, windowName);
} else {
this.dialogVisible = true;
}
},
// //
onDownloadQr() { onDownloadQr() {
console.log("二维码下载"); console.log("二维码下载");
@ -531,6 +778,8 @@ export default {
if (res.code == 200) { if (res.code == 200) {
this.$modal.msgSuccess("绑定成功"); this.$modal.msgSuccess("绑定成功");
} }
this.getCodeList();
this.bindCodeVisible = false;
console.log(res, "编码结果--"); console.log(res, "编码结果--");
}, },
// //