供应商比选材料 附件上传
parent
9f6d4a30b6
commit
326a3343ae
|
@ -302,20 +302,19 @@
|
||||||
:before-remove="(file, fileList) => beforeSupplierMaterialRemove(scope, file, fileList)"
|
:before-remove="(file, fileList) => beforeSupplierMaterialRemove(scope, file, fileList)"
|
||||||
:on-success="(response, file, fileList) => handleSupplierMaterialFileUploaded(scope, response, file, fileList)"
|
:on-success="(response, file, fileList) => handleSupplierMaterialFileUploaded(scope, response, file, fileList)"
|
||||||
:on-exceed="(files, fileList) => handleSupplierMaterialExceed(scope, files, fileList)">
|
:on-exceed="(files, fileList) => handleSupplierMaterialExceed(scope, files, fileList)">
|
||||||
<el-button size="small" type="text">上传附件</el-button>
|
<el-popover placement="top-end" title="已经上传的附件" width="380" trigger="hover">
|
||||||
|
|
||||||
<el-popover placement="top-end" title="已经上传的附件" width="200" trigger="hover">
|
|
||||||
<el-button size="small" type="text" slot="reference">上传附件</el-button>
|
<el-button size="small" type="text" slot="reference">上传附件</el-button>
|
||||||
<#--展示已经上传的文件-->
|
<#--展示已经上传的文件-->
|
||||||
<div v-if="scope.row.attachment">
|
<div>只能上传PDF、excel、word、图片、压缩包,且不超过50MB</div>
|
||||||
<el-tag size="small" v-for="attachment in scope.row.attachment" closable
|
<div v-if="isNotEmpty(scope.row.attachment)" style="margin-top: 10px">
|
||||||
|
<el-tag size="small" v-for="attachment in scope.row.attachment" closable :key="attachment.name"
|
||||||
@close="removeSupplierMaterialAttachment(scope, attachment)">
|
@close="removeSupplierMaterialAttachment(scope, attachment)">
|
||||||
<a :href="attachment.uri" target="_blank">
|
<a :href="attachment.uri" target="_blank">
|
||||||
<i class="el-icon-document"></i> {{attachment.name}}
|
<i class="el-icon-document"></i> {{attachment.name|ellipsis}}
|
||||||
</a>
|
</a>
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
<span v-else>暂未上传</span>
|
<span v-else style="margin-top: 10px;text-align: center"><strong>暂未上传</strong></span>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
|
|
||||||
|
@ -723,9 +722,7 @@
|
||||||
const mapAttachment = attachment => {
|
const mapAttachment = attachment => {
|
||||||
if (hasText(attachment)) {
|
if (hasText(attachment)) {
|
||||||
try {
|
try {
|
||||||
return JSON.parse(attachment).map(item => ({
|
return JSON.parse(attachment)
|
||||||
name: item.name, url: item.uri
|
|
||||||
}))
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
@ -1042,16 +1039,22 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
handleSupplierMaterialRemove(scope, fileList) {
|
handleSupplierMaterialRemove(scope, fileList) {
|
||||||
scope.row['attachment'] = fileList
|
scope.row['attachment'] = fileList.map(file => ({
|
||||||
|
uri: file.response.data.url,
|
||||||
|
name: file.name
|
||||||
|
}))
|
||||||
},
|
},
|
||||||
|
|
||||||
removeSupplierMaterialAttachment(scope, attachmentToRemove) {
|
removeSupplierMaterialAttachment(scope, attachmentToRemove) {
|
||||||
scope.row['attachment'] = scope.row['attachment'].filter(item => item === attachmentToRemove)
|
scope.row['attachment'] = scope.row['attachment'].filter(item => item !== attachmentToRemove)
|
||||||
},
|
},
|
||||||
|
|
||||||
handleSupplierMaterialExceed(scope, files, fileList) {
|
handleSupplierMaterialExceed(scope, files, fileList) {
|
||||||
this.$message.warning("当前限制选择只能选择10个文件");
|
this.$message.warning("当前限制选择只能选择10个文件");
|
||||||
scope.row['attachment'] = fileList
|
scope.row['attachment'] = fileList.map(file => ({
|
||||||
|
uri: file.response.data.url,
|
||||||
|
name: file.name
|
||||||
|
}))
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeSupplierMaterialRemove(scope, file, fileList) {
|
beforeSupplierMaterialRemove(scope, file, fileList) {
|
||||||
|
@ -1064,18 +1067,16 @@
|
||||||
|
|
||||||
handleSupplierMaterialFileUploaded(scope, response, file, fileList) {
|
handleSupplierMaterialFileUploaded(scope, response, file, fileList) {
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
let attachments = scope.row['attachment']
|
let attachments = scope.row.attachment
|
||||||
if (isEmpty(attachments)) {
|
if (isEmpty(attachments)) {
|
||||||
attachments = []
|
attachments = []
|
||||||
scope.row['attachment'] = attachments
|
|
||||||
}
|
}
|
||||||
attachments.push({
|
attachments.push({
|
||||||
uri: response.data.url,
|
uri: response.data.url,
|
||||||
name: file.name
|
name: file.name
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(attachments)
|
scope.row.attachment = attachments
|
||||||
console.log(scope.row['attachment'])
|
|
||||||
this.$message.success("上传成功");
|
this.$message.success("上传成功");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1090,6 +1091,7 @@
|
||||||
addSupplierRow() {
|
addSupplierRow() {
|
||||||
this.supplierMaterialsForm.push({
|
this.supplierMaterialsForm.push({
|
||||||
rowKey: this.rowKeyCounter++,
|
rowKey: this.rowKeyCounter++,
|
||||||
|
attachment: []
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1224,6 +1226,16 @@
|
||||||
this.loadProject(processId)
|
this.loadProject(processId)
|
||||||
this.applyDeptSectorOptions = JSON.parse('${applyDeptSectorOptions}')
|
this.applyDeptSectorOptions = JSON.parse('${applyDeptSectorOptions}')
|
||||||
},
|
},
|
||||||
|
|
||||||
|
filters: {
|
||||||
|
ellipsis(value, limit = 40) {
|
||||||
|
if (!value) return ''
|
||||||
|
if (value.length > limit) {
|
||||||
|
return value.slice(0, limit) + '...'
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -367,7 +367,7 @@
|
||||||
<div class="am-u-sm-12 am-u-md-12 supplierChoose" v-if="isProcurementContractMode">
|
<div class="am-u-sm-12 am-u-md-12 supplierChoose" v-if="isProcurementContractMode">
|
||||||
<el-alert title="供应商比选材料" type="success" center :closable="false"></el-alert>
|
<el-alert title="供应商比选材料" type="success" center :closable="false"></el-alert>
|
||||||
|
|
||||||
<el-table style="width: 100%" border :data="supplierMaterialsForm" v-model="supplierMaterialsForm" empty-text="暂无">
|
<el-table style="width: 100%" border :data="supplierMaterialsForm" empty-text="暂无">
|
||||||
<el-table-column type="index" :index="1" label="序号" fixed></el-table-column>
|
<el-table-column type="index" :index="1" label="序号" fixed></el-table-column>
|
||||||
|
|
||||||
<el-table-column prop="companyName" label="公司名称" width="180" align="center">
|
<el-table-column prop="companyName" label="公司名称" width="180" align="center">
|
||||||
|
@ -399,10 +399,6 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="remark" label="备注" align="center">
|
<el-table-column prop="remark" label="备注" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<#--
|
|
||||||
<el-input type="textarea" size="mini" maxlength="100"
|
|
||||||
v-model="scope.row.remark" placeholder="请输入备注(限制100字)" cols="90"></el-input>
|
|
||||||
-->
|
|
||||||
<el-input size="mini" placeholder="请输入备注"
|
<el-input size="mini" placeholder="请输入备注"
|
||||||
v-model="scope.row.remark"></el-input>
|
v-model="scope.row.remark"></el-input>
|
||||||
</template>
|
</template>
|
||||||
|
@ -416,18 +412,19 @@
|
||||||
:before-remove="(file, fileList) => beforeSupplierMaterialRemove(scope, file, fileList)"
|
:before-remove="(file, fileList) => beforeSupplierMaterialRemove(scope, file, fileList)"
|
||||||
:on-success="(response, file, fileList) => handleSupplierMaterialFileUploaded(scope, response, file, fileList)"
|
:on-success="(response, file, fileList) => handleSupplierMaterialFileUploaded(scope, response, file, fileList)"
|
||||||
:on-exceed="(files, fileList) => handleSupplierMaterialExceed(scope, files, fileList)">
|
:on-exceed="(files, fileList) => handleSupplierMaterialExceed(scope, files, fileList)">
|
||||||
<el-popover placement="top-end" title="已经上传的附件" width="200" trigger="hover">
|
<el-popover placement="top-end" title="已经上传的附件" width="380" trigger="hover">
|
||||||
<el-button size="small" type="text" slot="reference">上传附件</el-button>
|
<el-button size="small" type="text" slot="reference">上传附件</el-button>
|
||||||
<#--展示已经上传的文件-->
|
<#--展示已经上传的文件-->
|
||||||
<div v-if="scope.row.attachment">
|
<div>只能上传PDF、excel、word、图片、压缩包,且不超过50MB</div>
|
||||||
|
<div v-if="isNotEmpty(scope.row.attachment)" style="margin-top: 10px">
|
||||||
<el-tag size="small" v-for="attachment in scope.row.attachment" closable :key="attachment.name"
|
<el-tag size="small" v-for="attachment in scope.row.attachment" closable :key="attachment.name"
|
||||||
@close="removeSupplierMaterialAttachment(scope, attachment)">
|
@close="removeSupplierMaterialAttachment(scope, attachment)">
|
||||||
<a :href="attachment.uri" target="_blank">
|
<a :href="attachment.uri" target="_blank">
|
||||||
<i class="el-icon-document"></i> {{attachment.name}}
|
<i class="el-icon-document"></i> {{attachment.name|ellipsis}}
|
||||||
</a>
|
</a>
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
<span v-else>暂未上传</span>
|
<span v-else style="margin-top: 10px;text-align: center"><strong>暂未上传</strong></span>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
|
|
||||||
</el-upload>
|
</el-upload>
|
||||||
|
@ -1220,16 +1217,22 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
handleSupplierMaterialRemove(scope, fileList) {
|
handleSupplierMaterialRemove(scope, fileList) {
|
||||||
scope.row['attachment'] = fileList
|
scope.row['attachment'] = fileList.map(file => ({
|
||||||
|
uri: file.response.data.url,
|
||||||
|
name: file.name
|
||||||
|
}))
|
||||||
},
|
},
|
||||||
|
|
||||||
removeSupplierMaterialAttachment(scope, attachmentToRemove) {
|
removeSupplierMaterialAttachment(scope, attachmentToRemove) {
|
||||||
scope.row['attachment'] = scope.row['attachment'].filter(item => item === attachmentToRemove)
|
scope.row['attachment'] = scope.row['attachment'].filter(item => item !== attachmentToRemove)
|
||||||
},
|
},
|
||||||
|
|
||||||
handleSupplierMaterialExceed(scope, files, fileList) {
|
handleSupplierMaterialExceed(scope, files, fileList) {
|
||||||
this.$message.warning("当前限制选择只能选择10个文件");
|
this.$message.warning("当前限制选择只能选择10个文件");
|
||||||
scope.row['attachment'] = fileList
|
scope.row['attachment'] = fileList.map(file => ({
|
||||||
|
uri: file.response.data.url,
|
||||||
|
name: file.name
|
||||||
|
}))
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeSupplierMaterialRemove(scope, file, fileList) {
|
beforeSupplierMaterialRemove(scope, file, fileList) {
|
||||||
|
@ -1242,19 +1245,16 @@
|
||||||
|
|
||||||
handleSupplierMaterialFileUploaded(scope, response, file, fileList) {
|
handleSupplierMaterialFileUploaded(scope, response, file, fileList) {
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
let attachments = scope.row['attachment']
|
let attachments = scope.row.attachment
|
||||||
if (isEmpty(attachments)) {
|
if (isEmpty(attachments)) {
|
||||||
attachments = []
|
attachments = []
|
||||||
scope.row['attachment'] = attachments
|
|
||||||
}
|
}
|
||||||
attachments.push({
|
attachments.push({
|
||||||
uri: response.data.url,
|
uri: response.data.url,
|
||||||
name: file.name
|
name: file.name
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(attachments)
|
scope.row.attachment = attachments
|
||||||
console.log(scope.row['attachment'])
|
|
||||||
|
|
||||||
this.$message.success("上传成功");
|
this.$message.success("上传成功");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1269,6 +1269,7 @@
|
||||||
addSupplierRow() {
|
addSupplierRow() {
|
||||||
this.supplierMaterialsForm.push({
|
this.supplierMaterialsForm.push({
|
||||||
rowKey: this.rowKeyCounter++,
|
rowKey: this.rowKeyCounter++,
|
||||||
|
attachment: []
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1402,6 +1403,15 @@
|
||||||
// this.handleSelectProject({ id: 135 })
|
// this.handleSelectProject({ id: 135 })
|
||||||
this.applyDeptSectorOptions = JSON.parse('${applyDeptSectorOptions}')
|
this.applyDeptSectorOptions = JSON.parse('${applyDeptSectorOptions}')
|
||||||
},
|
},
|
||||||
|
filters: {
|
||||||
|
ellipsis(value, limit = 40) {
|
||||||
|
if (!value) return ''
|
||||||
|
if (value.length > limit) {
|
||||||
|
return value.slice(0, limit) + '...'
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -222,29 +222,25 @@
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
body: JSON.stringify(form),
|
body: JSON.stringify(form),
|
||||||
}).then(response => {
|
}).then(checkStatus).then(parseJSON).then(data => {
|
||||||
if (response.ok) {
|
// 关闭对话框
|
||||||
// 关闭对话框
|
this.auditFormVisible = false
|
||||||
this.auditFormVisible = false
|
this.queryTable()
|
||||||
this.queryTable()
|
|
||||||
this.$message({
|
|
||||||
showClose: true,
|
|
||||||
message: '撤销成功',
|
|
||||||
type: 'success'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return Promise.reject(response)
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$message({
|
this.$message({
|
||||||
showClose: true,
|
showClose: true,
|
||||||
message: '审核成功',
|
message: '审核成功',
|
||||||
type: 'success'
|
type: 'success'
|
||||||
})
|
})
|
||||||
|
}).catch(({ response }) => {
|
||||||
}).catch(err => {
|
if (response) {
|
||||||
this.$message.error("审核失败");
|
parseJSON(response)
|
||||||
|
.then(json => {
|
||||||
|
this.$message.error(json.message || "审核失败")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.$message.error("审核失败")
|
||||||
|
}
|
||||||
}).finally(() => loading.close())
|
}).finally(() => loading.close())
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue