Browse Source

Merge remote-tracking branch 'origin/master'

master
qiankanghui 2 weeks ago
parent
commit
f1db2f513f
  1. 4
      src/api/oss/oss.js
  2. 1
      src/views/modules/srmPart/partInfoList.vue
  3. 385
      src/views/modules/supplier/purHeaderList.vue

4
src/api/oss/oss.js

@ -32,3 +32,7 @@ export const queryOssFilePlus = data => createAPI(`/oss/queryOssFilePlus`,'post'
export const queryTaskFiles = data => createAPI('/oss/queryTaskFiles', 'post', data) export const queryTaskFiles = data => createAPI('/oss/queryTaskFiles', 'post', data)
//下载附件
export const downLoadObjectFile = data => createAPI(`/sys/oss/downLoadObjectFile?id=`+data.id,'post',777)

1
src/views/modules/srmPart/partInfoList.vue

@ -819,6 +819,7 @@ export default {
orderRef1: this.currentRow.site, orderRef1: this.currentRow.site,
orderRef2: this.currentRow.partNo, orderRef2: this.currentRow.partNo,
orderRef3: this.currentRow.partDesc, orderRef3: this.currentRow.partDesc,
orderReftype: 'part',
height: Number(this.height) - 20 height: Number(this.height) - 20
} }
this.$refs.attachments.init(inData) this.$refs.attachments.init(inData)

385
src/views/modules/supplier/purHeaderList.vue

@ -30,6 +30,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<a class="customer-a" @click.stop="openDialog(scope.row)">编辑 |</a> <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.stop="handleDelete(scope.row)">删除</a>
<a class="customer-a" @click="updateQuoDetail(scope.row)">提交</a>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="orderNo" label="询价单号" min-width="140" header-align="center" align="left" show-overflow-tooltip fixed="left" /> <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"> <div class="sub-title">
物料明细列表 物料明细列表
<el-button type="primary" class="customer-bun-min" @click="openMaterialDialog()" style="margin-left: 10px;">新增物料</el-button> <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> </div>
<el-table <el-table
@ -82,6 +81,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<a class="material-action-btn" @click="openMaterialDialog(scope.row)">编辑</a> <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="deleteMaterial(scope.row)">删除</a>
<a class="material-action-btn" @click="openUploadDialog(scope.row)">附件</a>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="partNo" label="物料编码" min-width="130" header-align="center" align="center" show-overflow-tooltip /> <el-table-column prop="partNo" label="物料编码" min-width="130" header-align="center" align="center" show-overflow-tooltip />
@ -264,6 +264,110 @@
</el-dialog> </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" /> <Chooselist ref="baseList" @getBaseData="getBaseData" />
</div> </div>
@ -279,13 +383,20 @@ import {
searchMaterialList, searchMaterialList,
createMaterial, createMaterial,
updateMaterial, updateMaterial,
deleteMaterial
deleteMaterial,
updatePurDetailStatus
} from '@/api/supplier/purQuotation.js' } from '@/api/supplier/purQuotation.js'
import { import {
getSupplierInfo getSupplierInfo
} from '@/api/srm/srmSupplier.js' } from '@/api/srm/srmSupplier.js'
import {
ossUploadNoSaveOSSForYJY,
queryOssFilePlus,
removeOss,
downLoadObjectFile
} from "../../../api/oss/oss";
export default { export default {
components: { components: {
@ -352,6 +463,24 @@ export default {
remark2: '', remark2: '',
status: '待提交' 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, tagNo: null,
tagNo1: null tagNo1: null
} }
@ -583,6 +712,26 @@ export default {
}) })
}).catch(() => {}) }).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) { openMaterialDialog(row) {
if (!this.currentInquiry) { if (!this.currentInquiry) {
@ -660,6 +809,231 @@ export default {
this.$message.error('删除失败: ' + err.message) this.$message.error('删除失败: ' + err.message)
}) })
}).catch(() => {}) }).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 { .dialog-footer {
text-align: center; text-align: center;
} }
.rq .auto /deep/ .el-form-item__content {
height: auto;
line-height: 1.5;
}
</style> </style>
Loading…
Cancel
Save