You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
356 lines
11 KiB
356 lines
11 KiB
<script>
|
|
import {uploadFileList} from '@/api/base/baseFunction.js';
|
|
import {deleteDocumentType,getProofDocument} from "@/api/eam/eamProofing.js";
|
|
export default {
|
|
name: "uploadFileList",
|
|
props: {
|
|
uploadDialog: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
title: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
label: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
no: {
|
|
type: [String],
|
|
default: ''
|
|
},
|
|
noType:{
|
|
type: [String,Number],
|
|
default: ''
|
|
},
|
|
path: {
|
|
type: String,
|
|
request: true,
|
|
},
|
|
uploadFlag: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
fileList: {
|
|
type: Array,
|
|
default:() => [],
|
|
},
|
|
folder: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
proofingId: {
|
|
type: [String,Number],
|
|
default: ''
|
|
},
|
|
projectId: {
|
|
type: [String,Number],
|
|
default: ''
|
|
},
|
|
projectDesc: {
|
|
type: [String,Number],
|
|
default: ''
|
|
},
|
|
customerNo:{
|
|
type: [String,Number],
|
|
default: ''
|
|
},
|
|
customerDesc:{
|
|
type: [String,Number],
|
|
default: ''
|
|
},
|
|
testPartNo:{
|
|
type: [String,Number],
|
|
default: ''
|
|
},
|
|
partDesc:{
|
|
type: [String,Number],
|
|
default: ''
|
|
},
|
|
columnFileContentArray: {
|
|
type: Array,
|
|
default: () => []
|
|
},
|
|
proofDocumentList: {
|
|
type: Array,
|
|
default: () => []
|
|
},
|
|
site:{
|
|
type: [String,Number],
|
|
default: ''
|
|
},
|
|
bu:{
|
|
type: [String,Number],
|
|
default: ''
|
|
},
|
|
isEditable: Boolean,
|
|
},
|
|
data () {
|
|
return {
|
|
//fileRemark: '',
|
|
fileName: '',
|
|
//选中当前行
|
|
documentClickRow: {},
|
|
bu : this.props.site + "-" + this.props.buNo,
|
|
dataListLoading: false,
|
|
}
|
|
},
|
|
methods: {
|
|
triggerUpload() {
|
|
this.fileName = ''; // 清空文件名称
|
|
this.$refs.uploadFile.clearFiles(); // 清空上传文件列表
|
|
this.$emit("update:fileList", []); // 清空文件列表
|
|
this.$refs.uploadFile.$el.querySelector('input').click()
|
|
},
|
|
closeFileUpdate() {
|
|
this.$emit('update:uploadDialog', false)
|
|
//this.fileRemark = ''
|
|
this.$refs.uploadFile.clearFiles()
|
|
this.$emit("update:fileList", [])
|
|
},
|
|
onRemove(file, fileList) {
|
|
this.$emit("update:fileList", fileList)
|
|
if (fileList.length === 0) {
|
|
this.fileName = ''; // 清空文件名称
|
|
}
|
|
},
|
|
onChange(file, fileList) {
|
|
this.$emit("update:fileList", fileList)
|
|
if (fileList.length > 0) {
|
|
this.fileName = fileList[0].name; // 设置文件名称
|
|
}
|
|
},
|
|
upload() {
|
|
if (this.fileList.length === 0) {
|
|
this.$message.warning("未选择需要上传的文件")
|
|
return;
|
|
}
|
|
let data = new FormData();
|
|
data.append("file", this.fileList[0].raw);
|
|
data.append("orderRef1", this.$store.state.user.site);
|
|
data.append("orderRef2", this.proofingId);
|
|
data.append("orderRef3", this.no);
|
|
data.append("orderRef4", this.projectId);
|
|
data.append("documentDesc", this.noType);
|
|
data.append("createBy", this.$store.state.user.name);
|
|
data.append("folder", this.folder);
|
|
uploadFileList(this.path, data).then(({data}) => {
|
|
if (data && data.code === 0) {
|
|
this.$emit('update:uploadDialog', false);
|
|
this.$message.success(data.msg);
|
|
// this.$emit('get-document-list');
|
|
// this.$emit('get-proof-document');
|
|
} else {
|
|
this.$message.warning(data.msg);
|
|
}
|
|
}).catch((error) => {
|
|
this.$message.error(error);
|
|
});
|
|
},
|
|
changeCurrentRow1 (row, oldRow) {
|
|
// 判断是否是获取焦点的事件
|
|
if (row) {
|
|
this.documentClickRow = JSON.parse(JSON.stringify(row))
|
|
}
|
|
},
|
|
uploadDocumentClickRow(row) {
|
|
this.documentClickRow = JSON.parse(JSON.stringify(row))
|
|
},
|
|
DeleteDocumentType(row) {
|
|
this.$confirm('是否删除该文档清单?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
deleteDocumentType(row).then(({data}) => {
|
|
if (data && data.code === 0) {
|
|
this.$message({
|
|
message: '删除成功',
|
|
type: 'success'
|
|
})
|
|
//刷新表格
|
|
this.getProofDocument();
|
|
// this.$emit('get-document-list');
|
|
// this.$emit('get-proof-document');
|
|
} else {
|
|
this.$message({
|
|
message: '删除失败',
|
|
type: 'error'
|
|
})
|
|
}
|
|
})
|
|
}).catch(() => {
|
|
this.$message({
|
|
type: 'info',
|
|
message: '已取消删除'
|
|
});
|
|
});
|
|
},
|
|
getProofDocument() {
|
|
let tempData = {
|
|
site: this.$store.state.user.site,
|
|
username: this.$store.state.user.name,
|
|
buNo: this.bu,
|
|
proofingId: this.proofingId,
|
|
projectId: this.projectId,
|
|
projectDesc: this.projectDesc,
|
|
customerId: this.customerNo,
|
|
customerDesc: this.customerDesc,
|
|
testPartNo: this.testPartNo,
|
|
partDesc: this.partDesc,
|
|
page: 1,
|
|
limit: 1000
|
|
}
|
|
getProofDocument(tempData).then(({data}) => {
|
|
if (data && data.code === 0) {
|
|
this.proofDocumentList = data.page.list
|
|
for (let i = 0; i < this.proofDocumentList.length; i++) {
|
|
this.proofDocumentList[i].buNo = this.proofDocumenCurrentRow.buNo
|
|
}
|
|
console.log(this.proofDocumentList)
|
|
if (this.totalPage > 0) {
|
|
// 设置选中行
|
|
this.$refs.proofDocumentTable.setCurrentRow(this.proofDocumentList[0])
|
|
// 加载当前的页签的table
|
|
this.refreshCurrentTabTable()
|
|
this.proofDocumentClickRow = this.proofDocumentList[0]
|
|
}
|
|
} else {
|
|
this.proofDocumentList = []
|
|
}
|
|
})
|
|
},
|
|
// getDocumentList() {
|
|
// getDocumentList(this.modalData).then(({data}) => {
|
|
// if (data && data.code === 0) {
|
|
// this.documentManifestDefinitionList = data.page.list
|
|
// } else {
|
|
// this.documentManifestDefinitionList = []
|
|
// }
|
|
// })
|
|
// },
|
|
|
|
// rowStyle ({row}) {
|
|
// if (this.documentClickRow.documentTypeId === row.documentTypeId) {
|
|
// return { 'background-color': '#E8F7F6', cursor: 'pointer' };
|
|
// }
|
|
// },
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<div>
|
|
<el-dialog :title="title" v-drag @close="closeFileUpdate" :visible="uploadDialog" width="35%" append-to-body>
|
|
<el-form :inline="true" label-position="top" label-width="80px" style="margin-left: 7px;margin-top: -5px;">
|
|
<el-form-item label="项目编码">
|
|
<el-input v-model="projectId" readonly style="width: 110px;" class="red-text"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="项目名称">
|
|
<el-input v-model="projectDesc" readonly style="width: 170px;" class="red-text"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="客户编码">
|
|
<el-input v-model="customerNo" readonly style="width: 110px;" class="red-text"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="客户名称">
|
|
<el-input v-model="customerDesc" readonly style="width: 170px;" class="red-text"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-form :inline="true" label-position="top" label-width="80px" style="margin-left: 7px;margin-top: -5px;">
|
|
<el-form-item label="项目料号">
|
|
<el-input v-model="testPartNo" readonly style="width: 110px;" class="red-text"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="料号描述">
|
|
<el-input v-model="partDesc" readonly style="width: 170px;" class="red-text"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="BU">
|
|
<el-input v-model="this.$props.site + '-' + this.$props.bu" readonly style="width: 110px;" class="red-text"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="打样单号">
|
|
<el-input v-model="proofingId" readonly style="width: 170px;" class="red-text"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-form :inline="true" label-position="top" label-width="80px" style="margin-left: 7px;margin-top: -5px;">
|
|
<el-form-item :label="label" >
|
|
<el-input v-model="no" :readonly="!isEditable" style="width: 110px"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="文件类型">
|
|
<el-input v-model="noType" :readonly="!isEditable" style="width: 170px"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-form :inline="true" label-position="top" label-width="80px" style="margin-left: 7px;margin-top: -5px;">
|
|
<el-form-item label=" ">
|
|
<a href="javascript:void(0);" @click="triggerUpload">点击选择文件</a>
|
|
<tr></tr>
|
|
<el-input v-model="fileName" readonly placeholder="文件名称" style="width: 200px"></el-input>
|
|
<el-button type="primary" @click="upload">上传</el-button>
|
|
<el-upload drag :file-list="fileList"
|
|
ref="uploadFile"
|
|
:on-remove="onRemove" :on-change="onChange"
|
|
multiple :auto-upload="false"
|
|
:show-file-list="true"
|
|
:limit="1"
|
|
style="text-align: left;display: none;">
|
|
</el-upload>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-form>
|
|
<el-table
|
|
:data="proofDocumentList"
|
|
border
|
|
style="width: 100%;margin-top: 5px;"
|
|
height="252"
|
|
ref="proofDocumentTable"
|
|
@row-click="uploadDocumentClickRow"
|
|
@current-change="changeCurrentRow1"
|
|
:row-style="rowStyle"
|
|
v-loading="dataListLoading">
|
|
<el-table-column
|
|
header-align="center"
|
|
align="center"
|
|
width="100"
|
|
fixed="right"
|
|
label="操作">
|
|
<template slot-scope="scope">
|
|
<a type="text" size="small" @click="DeleteDocumentType(scope.row)">删除</a>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
v-for="(item,index) in columnFileContentArray" :key="index"
|
|
:sortable="item.columnSortable"
|
|
:prop="item.columnProp"
|
|
:header-align="item.headerAlign"
|
|
:show-overflow-tooltip="item.showOverflowTooltip"
|
|
:align="item.align"
|
|
:fixed="item.fixed==''?false:item.fixed"
|
|
:min-width="item.columnWidth"
|
|
:label="item.columnLabel">
|
|
<template slot-scope="scope">
|
|
<span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
|
|
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
|
|
style="width: 100px; height: 80px"/></span>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
<!-- <el-form-item label="备注:">-->
|
|
<!-- <el-input type="textarea" placeholder="请输入内容" v-model="fileRemark"></el-input>-->
|
|
<!-- </el-form-item>-->
|
|
</el-form>
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button type="primary" @click="$emit('update:uploadDialog',false)">关闭</el-button>
|
|
</span>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
/deep/ .el-form-item--medium .el-form-item__content{
|
|
height: auto;
|
|
}
|
|
.red-text .el-input__inner {
|
|
color: red;
|
|
}
|
|
</style>
|