jsk 新购已入库添加报告管理,能过够使已入库的也能够修改上传报告管理
This commit is contained in:
parent
82a4150a8b
commit
887f0c3698
|
|
@ -43,6 +43,13 @@ export function updatePurchaseCheckInfoApi(data) {
|
|||
data,
|
||||
})
|
||||
}
|
||||
export function updatePurchaseFileApi(data) {
|
||||
return request({
|
||||
url: '/material/purchase_check_info/updateFile',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// 新购到货--删除
|
||||
export function purchaseCheckInfoRemove(ids) {
|
||||
|
|
|
|||
|
|
@ -111,6 +111,16 @@
|
|||
<el-table-column label="入库时间" align="center" prop="inputTime" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="入库人员" align="center" prop="inputUser" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="采购单号" align="center" prop="inputCode" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="相关配套资料" align="center" width="120" >
|
||||
<template slot-scope="scope">
|
||||
<div
|
||||
style="color: red; cursor: pointer"
|
||||
@click="openFileDialog(scope.row)"
|
||||
>
|
||||
报告管理
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
|
|
@ -324,12 +334,97 @@
|
|||
@pagination="getDialogWaitDataList"
|
||||
/>
|
||||
</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" :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"
|
||||
:headers="upload.headers"
|
||||
:action="upload.url"
|
||||
:show-file-list="false"
|
||||
accept=".png, .jpg, .jpeg, .pdf, .doc, .docx"
|
||||
:on-success="
|
||||
(response, file, fileList) => handleFileSuccess(scope.row, response, file, fileList)
|
||||
"
|
||||
:auto-upload="true"
|
||||
:before-upload="file => beforeUpload(scope.row, file)"
|
||||
>
|
||||
<el-button size="mini" type="text" @click="beforeFileUpload(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>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleSaveFile">保存</el-button>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 图片查看弹窗 -->
|
||||
<el-dialog :visible.sync="dialogVisible" width="800px">
|
||||
<img width="100%" height="500px" :src="dialogImageUrl" />
|
||||
</el-dialog>
|
||||
|
||||
<!-- 文件查看列表 -->
|
||||
<el-dialog title="文件列表" :visible.sync="dialogVisibleFile" width="500px" height="500px">
|
||||
<el-table :data="fileListInfo" width="100%" height="350px">
|
||||
<el-table-column label="序号" type="index" width="55" align="center" />
|
||||
<el-table-column label="文件名称" align="center" prop="name" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="操作" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" @click="picturePreview(scope.row)" v-if="scope.row.url">
|
||||
查看
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="pictureDelete(scope.row, scope.$index)"
|
||||
v-if="scope.row.url"
|
||||
style="color: red"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getPurChaseReportListApi,getPurChaseReportListNoPageApi,getPurChaseReportDetailsListApi,
|
||||
getPurChaseReportSuccessListApi,getPurChaseReportInBoundListApi,getPurChaseReportNotInBoundListApi } from "@/api/report/report";
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { uploadPurchaseFile, getPurchaseFileList } from '@/api/purchase/goodsAccept'
|
||||
import {
|
||||
updatePurchaseFileApi
|
||||
} from '@/api/purchase/goodsArrived'
|
||||
export default {
|
||||
name: "GoodsEntryReport",
|
||||
data() {
|
||||
|
|
@ -390,6 +485,29 @@
|
|||
keyWord: undefined,
|
||||
},
|
||||
dialogTotal: 0,
|
||||
// 是否显示弹出层
|
||||
taskId:'',
|
||||
open: false,
|
||||
rowData: {},
|
||||
fileDataList: [
|
||||
{ dictLabel: '合格证', fileType: '0', name: '', url: '', fileList: [], fileListTemp: [] },
|
||||
{ dictLabel: '型式试验报告', fileType: '1', name: '', url: '', fileList: [], fileListTemp: [] },
|
||||
{ dictLabel: '出厂检测报告', fileType: '2', name: '', url: '', fileList: [], fileListTemp: [] },
|
||||
{ dictLabel: '第三方检测报告', fileType: '3', name: '', url: '', fileList: [], fileListTemp: [] },
|
||||
{ dictLabel: '其他', fileType: '4', name: '', url: '', fileList: [], fileListTemp: [] }
|
||||
],
|
||||
fileListInfo: [],
|
||||
//图片查看弹窗
|
||||
dialogImageUrl: '',
|
||||
dialogVisible: false,
|
||||
dialogVisibleFile: false,
|
||||
//上传
|
||||
upload: {
|
||||
// 设置上传的请求头部
|
||||
headers: { Authorization: 'Bearer ' + getToken() },
|
||||
// 上传的地址
|
||||
url: process.env.VUE_APP_BASE_API + '/file/upload'
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
|
@ -400,6 +518,239 @@
|
|||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
//文件管理
|
||||
async openFileDialog(row) {
|
||||
console.log('1111111', row)
|
||||
this.rowData = row;
|
||||
this.taskId=this.rowData.taskId;
|
||||
console.log("this.rowData.taskId",this.rowData.taskId)
|
||||
if(this.rowData.taskId==null||this.rowData.taskId==""||this.rowData.taskId==undefined){
|
||||
return;
|
||||
}
|
||||
this.fileDataList = [
|
||||
{ dictLabel: '合格证', fileType: '0', name: '', url: '', fileList: [], fileListTemp: [] },
|
||||
{ dictLabel: '型式试验报告', fileType: '1', name: '', url: '', fileList: [], fileListTemp: [] },
|
||||
{ dictLabel: '出厂检测报告', fileType: '2', name: '', url: '', fileList: [], fileListTemp: [] },
|
||||
{ dictLabel: '第三方检测报告', fileType: '3', name: '', url: '', fileList: [], fileListTemp: [] },
|
||||
{ dictLabel: '其他', fileType: '4', name: '', url: '', fileList: [], fileListTemp: [] }
|
||||
]
|
||||
await this.getFileData();
|
||||
console.log("this.rowData.bmFileInfos",this.rowData.bmFileInfos)
|
||||
if (this.rowData.bmFileInfos == null) {
|
||||
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
|
||||
this.fileDataList[index].fileList.push({
|
||||
name: item.name,
|
||||
url: item.url
|
||||
})
|
||||
this.fileDataList[index].fileListTemp.push({
|
||||
name: item.name,
|
||||
url: item.url
|
||||
})
|
||||
})
|
||||
}
|
||||
} else {
|
||||
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
|
||||
this.fileDataList[index].fileList.push({
|
||||
name: item.name,
|
||||
url: item.url
|
||||
})
|
||||
this.fileDataList[index].fileListTemp.push({
|
||||
name: item.name,
|
||||
url: item.url
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
this.open = true;
|
||||
},
|
||||
|
||||
async getFileData() {
|
||||
let param = {
|
||||
modelId: this.rowData.typeId,
|
||||
taskType: 0,
|
||||
taskId: this.rowData.taskId
|
||||
}
|
||||
this.rowData.bmFileInfos = []
|
||||
await getPurchaseFileList(param)
|
||||
.then(response => {
|
||||
console.log("response.rows",response.rows);
|
||||
if (response.rows.length > 0) {
|
||||
response.rows.forEach(item => {
|
||||
// this.fileDataList[index].fileList.push({
|
||||
// name:item2.name,
|
||||
// url:item2.url
|
||||
// })
|
||||
// this.fileDataList[index].fileListTemp.push({
|
||||
// name:item2.name,
|
||||
// url:item2.url
|
||||
// })
|
||||
if(item.modelId!=null&&item.modelId!=''&&item.modelId!=undefined){
|
||||
this.rowData.partId=item.modelId;
|
||||
}
|
||||
const obj = {
|
||||
taskId: item.taskId,
|
||||
taskType: item. taskType,
|
||||
name: item.name,
|
||||
url: item.url,
|
||||
modelId: item.modelId,
|
||||
fileType: item.fileType
|
||||
}
|
||||
this.rowData.bmFileInfos.push(obj)
|
||||
console.log('77777777', this.rowData)
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
|
||||
beforeFileUpload(row) {
|
||||
this.rowData.fileType = row.fileType
|
||||
},
|
||||
|
||||
beforeUpload(row, file) {
|
||||
row.fileList.push(file)
|
||||
console.log('6666666', row.fileList)
|
||||
if (row.fileList.length > 3) {
|
||||
this.$message.warning('最多只能上传三张图片')
|
||||
// 删除最后一个文件
|
||||
row.fileList.pop()
|
||||
return false // 阻止上传
|
||||
}
|
||||
return true // 允许上传
|
||||
},
|
||||
// 文件上传成功处理
|
||||
handleFileSuccess(row, response, file, fileList) {
|
||||
if (response.code == 200) {
|
||||
//编辑逻辑
|
||||
row.fileListTemp.push({
|
||||
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 => {
|
||||
console.log()
|
||||
this.$modal.msgSuccess('上传成功')
|
||||
})
|
||||
.catch(() => {
|
||||
this.$modal.msgError('上传失败')
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
picturePreviewFile(row) {
|
||||
row.fileList = []
|
||||
row.fileListTemp.forEach(item => {
|
||||
row.fileList.push({
|
||||
name: item.name,
|
||||
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
|
||||
}
|
||||
},
|
||||
|
||||
//删除图片
|
||||
pictureDelete(row, id) {
|
||||
let index = 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
|
||||
)
|
||||
let bmFiles = []
|
||||
this.rowData.bmFileInfos.forEach(item => {
|
||||
if (item.fileType != this.fileId) {
|
||||
bmFiles.push(item)
|
||||
} else {
|
||||
if (item.url != row.url) {
|
||||
bmFiles.push(item)
|
||||
}
|
||||
}
|
||||
})
|
||||
this.rowData.bmFileInfos = bmFiles
|
||||
},
|
||||
|
||||
handleSaveFile(){
|
||||
this.$modal
|
||||
.confirm('是否确认保存当前信息')
|
||||
.then(function () {})
|
||||
.then(() => {
|
||||
this.loading = true
|
||||
updatePurchaseFileApi({
|
||||
purchaseCheckDetailsList: [{"bmFileInfos":this.rowData.bmFileInfos}],
|
||||
purchaseCheckInfo: {"taskId":this.taskId}
|
||||
}).then(response => {
|
||||
if (response.code == 200) {
|
||||
this.$modal.msgSuccess('编辑成功')
|
||||
}
|
||||
this.loading = false
|
||||
//关闭页面
|
||||
this.open=false;
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
|
||||
format(date) {
|
||||
const y = date.getFullYear()
|
||||
const m = String(date.getMonth() + 1).padStart(2, '0')
|
||||
|
|
|
|||
Loading…
Reference in New Issue