|
|
|
@ -30,6 +30,7 @@ |
|
|
|
<template slot-scope="scope"> |
|
|
|
<a class="customer-a" @click.stop="openDialog(scope.row)">编辑 |</a> |
|
|
|
<a class="customer-a" @click.stop="handleDelete(scope.row)">删除</a> |
|
|
|
<a class="customer-a" @click="updateQuoDetail(scope.row)">提交</a> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="orderNo" label="询价单号" min-width="140" header-align="center" align="left" show-overflow-tooltip fixed="left" /> |
|
|
|
@ -68,8 +69,6 @@ |
|
|
|
<div class="sub-title"> |
|
|
|
物料明细列表 |
|
|
|
<el-button type="primary" class="customer-bun-min" @click="openMaterialDialog()" style="margin-left: 10px;">新增物料</el-button> |
|
|
|
<!-- <el-button type="text" icon="el-icon-plus" @click="openMaterialDialog(null)" style="margin-left: 10px;" :disabled="!currentInquiry">新增物料</el-button> --> |
|
|
|
<!-- <span v-if="!currentInquiry" style="font-size: 12px; color: #909399; margin-left: 10px;">(请先选择一个询价单)</span> --> |
|
|
|
</div> |
|
|
|
|
|
|
|
<el-table |
|
|
|
@ -82,6 +81,7 @@ |
|
|
|
<template slot-scope="scope"> |
|
|
|
<a class="material-action-btn" @click="openMaterialDialog(scope.row)">编辑</a> |
|
|
|
<a class="material-action-btn" @click="deleteMaterial(scope.row)">删除</a> |
|
|
|
<a class="material-action-btn" @click="openUploadDialog(scope.row)">附件</a> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="partNo" label="物料编码" min-width="130" header-align="center" align="center" show-overflow-tooltip /> |
|
|
|
@ -263,7 +263,111 @@ |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-dialog |
|
|
|
:title="dialogTitle" |
|
|
|
:visible.sync="uploadDialogVisible" |
|
|
|
width="800px" |
|
|
|
:close-on-click-modal="false" |
|
|
|
append-to-body |
|
|
|
@close="handleClose"> |
|
|
|
<div class="customer-css"> |
|
|
|
<!-- 上传按钮 --> |
|
|
|
<el-form label-position="top" style="margin-top: -5px;"> |
|
|
|
<el-row style="margin-top: 10px"> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-button class="customer-bun-min" type="primary" @click="handleUpload">Upload</el-button> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
|
|
|
|
<!-- 文件列表表格 --> |
|
|
|
<el-table |
|
|
|
:height="240" |
|
|
|
:data="fileList" |
|
|
|
ref="fileTableRef" |
|
|
|
style="width: 100%; margin-top: 10px;"> |
|
|
|
<el-table-column |
|
|
|
prop="fileName" |
|
|
|
header-align="center" |
|
|
|
align="left" |
|
|
|
min-width="200" |
|
|
|
label="File"> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column |
|
|
|
prop="createdBy" |
|
|
|
header-align="center" |
|
|
|
align="center" |
|
|
|
min-width="100" |
|
|
|
label="Upload By"> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column |
|
|
|
prop="createDate" |
|
|
|
header-align="center" |
|
|
|
align="center" |
|
|
|
min-width="100" |
|
|
|
label="Upload Time"> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column |
|
|
|
header-align="center" |
|
|
|
align="center" |
|
|
|
width="100" |
|
|
|
fixed="right" |
|
|
|
label="Actions"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<a type="text" size="small" v-if="scope.row.id" @click="handleDownload(scope.row)">View |</a> |
|
|
|
<a type="text" size="small" v-if="scope.row.id" @click="deleteFileReal(scope.row)"> delete</a> |
|
|
|
<a type="text" size="small" v-else @click="deleteFile(scope.$index)"> delete</a> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
</el-form> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- File Upload Dialog --> |
|
|
|
<el-dialog |
|
|
|
title="UpLoad" |
|
|
|
:visible.sync="ossVisible" |
|
|
|
v-drag |
|
|
|
width="400px" |
|
|
|
append-to-body |
|
|
|
:close-on-click-modal="false" |
|
|
|
@close="handleUploadClose"> |
|
|
|
<el-form ref="form" class="rq" label-width="80px" label-position="top"> |
|
|
|
<el-row :gutter="10"> |
|
|
|
<slot></slot> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label=" " class="auto"> |
|
|
|
<el-upload |
|
|
|
drag |
|
|
|
:file-list="fileList2" |
|
|
|
action="#" |
|
|
|
ref="upload" |
|
|
|
:on-remove="onRemoveFile" |
|
|
|
:on-change="onChangeFile" |
|
|
|
multiple |
|
|
|
:auto-upload="false"> |
|
|
|
<i class="el-icon-upload"></i> |
|
|
|
<div class="el-upload__text">Drag files here, or<em> click to upload</em></div> |
|
|
|
</el-upload> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="Remark" class="auto"> |
|
|
|
<el-input type="textarea" v-model="ossForm.remark" resize="none" :autosize="{minRows: 3, maxRows: 3}"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-form> |
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
<el-button type="primary" :loading="uploadLoading" @click="submitData">Confirm</el-button> |
|
|
|
<el-button @click="ossVisible = false">Close</el-button> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
<el-button @click="uploadDialogVisible = false">关闭</el-button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<Chooselist ref="baseList" @getBaseData="getBaseData" /> |
|
|
|
</div> |
|
|
|
@ -279,13 +383,20 @@ import { |
|
|
|
searchMaterialList, |
|
|
|
createMaterial, |
|
|
|
updateMaterial, |
|
|
|
deleteMaterial |
|
|
|
deleteMaterial, |
|
|
|
updatePurDetailStatus |
|
|
|
} from '@/api/supplier/purQuotation.js' |
|
|
|
|
|
|
|
import { |
|
|
|
getSupplierInfo |
|
|
|
} from '@/api/srm/srmSupplier.js' |
|
|
|
|
|
|
|
import { |
|
|
|
ossUploadNoSaveOSSForYJY, |
|
|
|
queryOssFilePlus, |
|
|
|
removeOss, |
|
|
|
downLoadObjectFile |
|
|
|
} from "../../../api/oss/oss"; |
|
|
|
|
|
|
|
export default { |
|
|
|
components: { |
|
|
|
@ -352,6 +463,24 @@ export default { |
|
|
|
remark2: '', |
|
|
|
status: '待提交' |
|
|
|
}, |
|
|
|
searchParams: { |
|
|
|
orderRef1: '', |
|
|
|
orderRef2: '', |
|
|
|
orderRef3: '', |
|
|
|
orderReftype: '' |
|
|
|
}, |
|
|
|
fileList: [], |
|
|
|
fileList2: [], |
|
|
|
ossVisible: false, |
|
|
|
ossForm: { |
|
|
|
remark: '', |
|
|
|
}, |
|
|
|
uploadLoading: false, |
|
|
|
// staged files selected in upload dialog but not yet persisted |
|
|
|
stagedFiles: [], |
|
|
|
stagedFileRemark: '', |
|
|
|
uploadDialogTitle: '上传附件', |
|
|
|
uploadDialogVisible: false, |
|
|
|
tagNo: null, |
|
|
|
tagNo1: null |
|
|
|
} |
|
|
|
@ -583,6 +712,26 @@ export default { |
|
|
|
}) |
|
|
|
}).catch(() => {}) |
|
|
|
}, |
|
|
|
updateQuoDetail(row) { |
|
|
|
this.$confirm('确定提交询价单: ' + row.orderNo + ' ?', '提示', { type: 'warning' }).then(() => { |
|
|
|
updatePurDetailStatus({ |
|
|
|
orderNo: row.orderNo, |
|
|
|
site: row.site, |
|
|
|
status : "待报价", |
|
|
|
submitFlag : "Y" |
|
|
|
}).then(({data}) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.$message.success('提交成功') |
|
|
|
this.getList() |
|
|
|
} else { |
|
|
|
this.$message.error((data && data.msg) || '提交失败') |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
this.$message.error('提交失败: ' + err.message) |
|
|
|
}) |
|
|
|
}).catch(() => {}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 物料操作 |
|
|
|
openMaterialDialog(row) { |
|
|
|
if (!this.currentInquiry) { |
|
|
|
@ -660,6 +809,231 @@ export default { |
|
|
|
this.$message.error('删除失败: ' + err.message) |
|
|
|
}) |
|
|
|
}).catch(() => {}) |
|
|
|
}, |
|
|
|
|
|
|
|
openUploadDialog(row) { |
|
|
|
if (!row) { |
|
|
|
this.$message.warning('请先选择一个物料') |
|
|
|
return |
|
|
|
} |
|
|
|
if (row) { |
|
|
|
this.uploadDialogTitle = '上传附件' |
|
|
|
this.searchParams = { |
|
|
|
orderRef1: this.$store.state.user.site, |
|
|
|
orderRef2: row.partNo, |
|
|
|
orderRef3: row.partDesc, |
|
|
|
orderReftype: 'purQuotationDetail' |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
this.uploadDialogVisible = true |
|
|
|
this.searchTable() |
|
|
|
}, |
|
|
|
// 关闭弹窗 |
|
|
|
handleClose() { |
|
|
|
this.$emit('update:visible', false); |
|
|
|
this.$emit('close'); |
|
|
|
}, |
|
|
|
|
|
|
|
// 关闭上传弹窗 |
|
|
|
handleUploadClose() { |
|
|
|
this.fileList2 = []; |
|
|
|
this.ossForm.remark = ''; |
|
|
|
}, |
|
|
|
|
|
|
|
// 查询文件列表 |
|
|
|
searchTable() { |
|
|
|
queryOssFilePlus(this.searchParams).then(({ data }) => { |
|
|
|
if (data && data.code == 0) { |
|
|
|
this.fileList = data.rows || []; |
|
|
|
} else { |
|
|
|
this.fileList = []; |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
this.fileList = []; |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
// 打开上传弹窗 |
|
|
|
handleUpload() { |
|
|
|
this.$nextTick(() => { |
|
|
|
if (this.$refs.upload) { |
|
|
|
this.$refs.upload.clearFiles(); |
|
|
|
} |
|
|
|
}) |
|
|
|
this.fileList2 = []; |
|
|
|
this.ossForm.remark = ''; |
|
|
|
this.ossVisible = true; |
|
|
|
}, |
|
|
|
|
|
|
|
onRemoveFile(file, fileList) { |
|
|
|
this.fileList2 = fileList; |
|
|
|
}, |
|
|
|
|
|
|
|
onChangeFile(file, fileList) { |
|
|
|
this.fileList2 = fileList; |
|
|
|
}, |
|
|
|
|
|
|
|
// 提交上传 |
|
|
|
submitData() { |
|
|
|
if (this.fileList2.length === 0) { |
|
|
|
this.$message.error('请选择文件'); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
this.stagedFileRemark = this.ossForm.remark || ''; |
|
|
|
this.uploadLoading = true; |
|
|
|
|
|
|
|
// 准备要上传的文件 |
|
|
|
const stagedFiles = []; |
|
|
|
for (let i = 0; i < this.fileList2.length; i++) { |
|
|
|
stagedFiles.push(this.fileList2[i].raw); |
|
|
|
} |
|
|
|
|
|
|
|
// 立即关闭弹窗 |
|
|
|
this.ossVisible = false; |
|
|
|
this.fileList2 = []; |
|
|
|
this.ossForm.remark = ''; |
|
|
|
|
|
|
|
// 上传文件 |
|
|
|
const formData = new FormData(); |
|
|
|
for (let i = 0; i < stagedFiles.length; i++) { |
|
|
|
formData.append('file', stagedFiles[i]); |
|
|
|
} |
|
|
|
formData.append('orderRef1', this.searchParams.orderRef1 || ''); |
|
|
|
formData.append('orderRef2', this.searchParams.orderRef2 || ''); |
|
|
|
formData.append('orderRef3', this.searchParams.orderRef3 || ''); |
|
|
|
formData.append('createdBy', this.$store.state.user.name); |
|
|
|
formData.append('fileRemark', this.stagedFileRemark || ''); |
|
|
|
formData.append('orderReftype', this.searchParams.orderReftype || 'purQuotationDetail'); |
|
|
|
|
|
|
|
ossUploadNoSaveOSSForYJY(formData) |
|
|
|
.then(({ data }) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
// 移除临时文件,添加上传成功的文件 |
|
|
|
this.fileList = this.fileList.filter(f => !f._staged); |
|
|
|
for (let i = 0; i < data.rows.length; i++) { |
|
|
|
this.fileList.push(data.rows[i]); |
|
|
|
} |
|
|
|
|
|
|
|
// 清除暂存数据 |
|
|
|
this.stagedFiles = []; |
|
|
|
this.stagedFileRemark = ''; |
|
|
|
this.uploadLoading = false; |
|
|
|
|
|
|
|
this.$message.success('上传成功'); |
|
|
|
this.$emit('upload-success', data.rows); |
|
|
|
} else { |
|
|
|
this.uploadLoading = false; |
|
|
|
this.$message.warning(data.msg || '文件上传失败'); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
this.uploadLoading = false; |
|
|
|
this.$message.error(err.message || err); |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
// 下载/预览文件 |
|
|
|
handleDownload(row) { |
|
|
|
let image = ['jpg', 'jpeg', 'png', 'gif', 'bmp']; |
|
|
|
let video = ['mp4', 'avi', 'mov', 'wmv', 'flv']; |
|
|
|
let office = ['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx']; |
|
|
|
let txt = ['txt']; |
|
|
|
let pdf = ['pdf']; |
|
|
|
let type = ''; |
|
|
|
|
|
|
|
if (image.includes(row.fileType.toLowerCase())) { |
|
|
|
type = 'image/' + row.fileType; |
|
|
|
downLoadObjectFile(row).then(({ data }) => { |
|
|
|
const blob = new Blob([data], { type: type }); |
|
|
|
const fileURL = URL.createObjectURL(blob); |
|
|
|
window.open(fileURL, '_blank'); |
|
|
|
}); |
|
|
|
} else if (video.includes(row.fileType.toLowerCase())) { |
|
|
|
type = 'video/' + row.fileType; |
|
|
|
downLoadObjectFile(row).then(({ data }) => { |
|
|
|
const blob = new Blob([data], { type: type }); |
|
|
|
const fileURL = URL.createObjectURL(blob); |
|
|
|
window.open(fileURL, '_blank'); |
|
|
|
}); |
|
|
|
} else if (txt.includes(row.fileType.toLowerCase())) { |
|
|
|
type = 'text/plain'; |
|
|
|
downLoadObjectFile(row).then(({ data }) => { |
|
|
|
const blob = new Blob([data], { type: type }); |
|
|
|
const fileURL = URL.createObjectURL(blob); |
|
|
|
window.open(fileURL, '_blank'); |
|
|
|
}); |
|
|
|
} else if (office.includes(row.fileType.toLowerCase())) { |
|
|
|
if (row.fileType.toLowerCase() === 'doc' || row.fileType.toLowerCase() === 'docx') { |
|
|
|
type = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; |
|
|
|
} else if (row.fileType.toLowerCase() === 'ppt' || row.fileType.toLowerCase() === 'pptx') { |
|
|
|
type = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; |
|
|
|
} else { |
|
|
|
type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; |
|
|
|
} |
|
|
|
downLoadObjectFile(row).then(({ data }) => { |
|
|
|
const blob = new Blob([data], { type: 'application/octet-stream;charset=utf-8' }); |
|
|
|
const fileName = row.fileName; |
|
|
|
const linkNode = document.createElement('a'); |
|
|
|
linkNode.download = fileName; |
|
|
|
linkNode.style.display = 'none'; |
|
|
|
linkNode.href = URL.createObjectURL(blob); |
|
|
|
document.body.appendChild(linkNode); |
|
|
|
linkNode.click(); |
|
|
|
URL.revokeObjectURL(linkNode.href); |
|
|
|
document.body.removeChild(linkNode); |
|
|
|
}); |
|
|
|
} else if (pdf.includes(row.fileType.toLowerCase())) { |
|
|
|
type = 'application/pdf'; |
|
|
|
downLoadObjectFile(row).then(({ data }) => { |
|
|
|
const blob = new Blob([data], { type: type }); |
|
|
|
const fileURL = URL.createObjectURL(blob); |
|
|
|
window.open(fileURL, '_blank'); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.$message({ |
|
|
|
message: '不支持的文件类型', |
|
|
|
type: 'warning' |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 删除已保存的文件 |
|
|
|
deleteFileReal(row) { |
|
|
|
if (!row || !row.id) return; |
|
|
|
this.$confirm('确定要删除该文件吗?', '删除确认', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning' |
|
|
|
}).then(() => { |
|
|
|
removeOss([row.id]).then(({ data }) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
const idx = this.fileList.findIndex(f => f.id === row.id); |
|
|
|
if (idx !== -1) this.fileList.splice(idx, 1); |
|
|
|
this.$message.success(data.msg || '文件已删除'); |
|
|
|
this.$emit('delete-success', row); |
|
|
|
} else { |
|
|
|
this.$message.warning(data.msg || '删除失败'); |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
this.$message.error('删除失败:' + (err.message || err)); |
|
|
|
}); |
|
|
|
}).catch(() => { }); |
|
|
|
}, |
|
|
|
|
|
|
|
// 删除临时文件 |
|
|
|
deleteFile(index) { |
|
|
|
const f = this.fileList[index]; |
|
|
|
if (f && f._staged && f.raw) { |
|
|
|
const idx = this.stagedFiles.findIndex(sf => sf.name === f.raw.name && sf.size === f.raw.size); |
|
|
|
if (idx !== -1) this.stagedFiles.splice(idx, 1); |
|
|
|
} |
|
|
|
this.fileList.splice(index, 1); |
|
|
|
}, |
|
|
|
// 刷新列表 |
|
|
|
refresh() { |
|
|
|
this.searchTable(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -706,4 +1080,9 @@ export default { |
|
|
|
.dialog-footer { |
|
|
|
text-align: center; |
|
|
|
} |
|
|
|
|
|
|
|
.rq .auto /deep/ .el-form-item__content { |
|
|
|
height: auto; |
|
|
|
line-height: 1.5; |
|
|
|
} |
|
|
|
</style> |