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.
507 lines
16 KiB
507 lines
16 KiB
<script>
|
|
import {uploadFileList} from '@/api/base/baseFunction.js';
|
|
import {deleteDocumentType,getProofDocument} from "@/api/eam/eamProofing.js";
|
|
import {EventBus} from "../../../main";
|
|
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: ''
|
|
},
|
|
noDesc:{
|
|
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: ''
|
|
},
|
|
proofingNo: {
|
|
type: [String,Number],
|
|
default: ''
|
|
},
|
|
projectId: {
|
|
type: [String,Number],
|
|
default: ''
|
|
},
|
|
projectNo: {
|
|
type: [String,Number],
|
|
default: ''
|
|
},
|
|
projectDesc: {
|
|
type: [String,Number],
|
|
default: ''
|
|
},
|
|
customerNo:{
|
|
type: [String,Number],
|
|
default: ''
|
|
},
|
|
customerDesc:{
|
|
type: [String,Number],
|
|
default: ''
|
|
},
|
|
projectPartId:{
|
|
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: ''
|
|
},
|
|
id:{
|
|
type: [String,Number],
|
|
default: ''
|
|
},
|
|
isEditable: Boolean,
|
|
isMassProductionStage: Boolean,
|
|
},
|
|
data () {
|
|
return {
|
|
//fileRemark: '',
|
|
fileName: '',
|
|
noType1: '',
|
|
conclusion: '',
|
|
documentGroupDesc: '',
|
|
conclusionList: [
|
|
{conclusion: '合格'},
|
|
{conclusion: '不合格'},
|
|
{conclusion: '让步接受'},
|
|
{conclusion: 'N/A'}
|
|
],
|
|
//选中当前行
|
|
documentClickRow: {},
|
|
bu : this.site + "-" + this.buNo,
|
|
dataListLoading: false,
|
|
rules: {
|
|
noType: [
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: ['blur']
|
|
}
|
|
],
|
|
conclusion:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: ['blur']
|
|
}
|
|
],
|
|
}
|
|
}
|
|
},
|
|
computed: {
|
|
displayValue() {
|
|
if (this.noType === null || this.noType === undefined) {
|
|
return this.noDesc
|
|
}else {
|
|
return this.noType
|
|
}
|
|
},
|
|
documentGroupDescJudgment() {
|
|
if (this.id !== '-1') {
|
|
return '常规'
|
|
} else {
|
|
return '其他'
|
|
}
|
|
},
|
|
conclusionDefaultValue() {
|
|
if (this.isMassProductionStage) {
|
|
return 'N/A';
|
|
}else {
|
|
return this.isEditable ? 'N/A' : '';
|
|
}
|
|
}
|
|
},
|
|
watch: {
|
|
conclusionDefaultValue(newValue) {
|
|
this.conclusion = newValue;
|
|
}
|
|
},
|
|
created() {
|
|
this.conclusion = this.conclusionDefaultValue;
|
|
},
|
|
beforeDestroy() {
|
|
// 组件销毁前清理数据
|
|
if (this.isMassProductionStage) {
|
|
this.conclusion = 'N/A';
|
|
}else if (this.isEditable) {
|
|
this.conclusion = 'N/A';
|
|
}else {
|
|
this.conclusion = '';
|
|
}
|
|
},
|
|
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", [])
|
|
this.fileName = ''; // 清空文件名称
|
|
this.noType = '';
|
|
if (this.isMassProductionStage) {
|
|
this.conclusion = 'N/A';
|
|
}else if (this.isEditable) {
|
|
this.conclusion = 'N/A';
|
|
}else {
|
|
this.conclusion = '';
|
|
}
|
|
},
|
|
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;
|
|
}
|
|
if (this.noType === null || this.noType === undefined || this.noType === '') {
|
|
this.$message.warning("文件类型不能为空")
|
|
return;
|
|
}
|
|
if (this.conclusion === null || this.conclusion === undefined || this.conclusion === '') {
|
|
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.id);
|
|
data.append("orderRef4", this.projectId);
|
|
data.append("orderRef5", this.projectPartId);
|
|
data.append("documentDesc", this.no);
|
|
data.append("cAdditionalInfo", this.noType);
|
|
data.append("conclusion", this.conclusion);
|
|
data.append("createBy", this.$store.state.user.name);
|
|
data.append("updateBy", 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.fileList = [];
|
|
this.fileName = '';
|
|
this.noType = '';
|
|
EventBus.$emit('updateAgencyMatterForUploads');
|
|
EventBus.$emit('updateProjectPartDocumentInfo');
|
|
// this.$emit('get-document-list');
|
|
// this.$emit('get-proof-document');
|
|
} else {
|
|
this.$alert(data.msg, '错误', {
|
|
confirmButtonText: '确定'
|
|
})
|
|
this.fileList = [];
|
|
this.fileName = '';
|
|
this.noType = '';
|
|
}
|
|
}).catch((error) => {
|
|
this.$message.error(error);
|
|
this.fileList = [];
|
|
this.fileName = '';
|
|
this.noType = '';
|
|
});
|
|
},
|
|
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.$alert(data.msg, '错误', {
|
|
confirmButtonText: '确定'
|
|
})
|
|
}
|
|
})
|
|
}).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
|
|
}
|
|
if (this.totalPage > 0) {
|
|
// 设置选中行
|
|
this.$refs.proofDocumentTable.setCurrentRow(this.proofDocumentList[0])
|
|
// 加载当前的页签的table
|
|
this.refreshCurrentTabTable()
|
|
this.proofDocumentClickRow = this.proofDocumentList[0]
|
|
}
|
|
} else {
|
|
this.proofDocumentList = []
|
|
}
|
|
})
|
|
},
|
|
getCombinedDocumentType(row) {
|
|
// 根据您的需求,组合或拼接需要显示的字段
|
|
if (row.documentType === null || row.documentType === undefined) {
|
|
return row.documentDesc
|
|
}
|
|
return row.documentType
|
|
},
|
|
validateField(fieldName) {
|
|
this.$refs.validateField(fieldName);
|
|
},
|
|
// 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="952px" append-to-body :close-on-click-modal="false">
|
|
<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="projectNo" readonly style="width: 113px;" class="red-text"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="项目名称">
|
|
<el-input v-model="projectDesc" readonly style="width: 173px;" 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-item :label="label" v-if="!isEditable">
|
|
<el-input v-model="no" :readonly="!isEditable" style="width: 113px" class="red-text"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="文档类型" v-if="!isEditable">
|
|
<el-input :value="displayValue" :readonly="!isEditable" style="width: 166px" 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: 113px;" class="red-text"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="料号描述">
|
|
<el-input v-model="partDesc" readonly style="width: 173px;" 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="proofingNo" readonly style="width: 170px;" class="red-text"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-form :inline="true" label-position="top" label-width="80px" :model="this.conclusion" :rules="rules" 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="this.fileName" readonly placeholder="文件名称" style="width: 423px"></el-input>
|
|
<el-form-item label="文档类型" v-if="isEditable" :rules="rules.noType" prop="noType" style="margin-top: -18px;margin-left: 11px;">
|
|
<el-input v-model="noType" :readonly="!isEditable" style="width: 170px" @blur="validateField('noType')" @change="validateField('noType')"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="结论" prop="conclusion" v-if="!isMassProductionStage" :rules="rules.conclusion" style="margin-top: -18px;">
|
|
<el-select v-model="conclusion" placeholder="请选择" clearable style="width: 110px;" @blur="validateField('conclusion')" @change="validateField('conclusion')">
|
|
<el-option
|
|
v-for = "i in conclusionList"
|
|
:key = "i.conclusion"
|
|
:label = "i.conclusion"
|
|
:value = "i.conclusion">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="文档种类" style="margin-top: -18px;" v-if="this.id === '-1'">
|
|
<el-input readonly style="width: 110px;" :value="documentGroupDescJudgment"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="文档种类" style="margin-top: -18px;" v-if="this.id !== '-1'">
|
|
<el-input readonly style="width: 110px;" :value="documentGroupDescJudgment"></el-input>
|
|
</el-form-item>
|
|
<el-button type="primary" @click="upload">上传</el-button>
|
|
<el-upload drag :file-list="fileList"
|
|
ref="uploadFile"
|
|
:on-remove="onRemove" :on-change="onChange"
|
|
:on-close="closeFileUpdate"
|
|
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">
|
|
<el-table-column label="文档类型" align="center">
|
|
<template slot-scope="scope">
|
|
{{ getCombinedDocumentType(scope.row) }}
|
|
</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-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>
|
|
|
|
<!-- <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 @click="$emit('update:uploadDialog',false);this.fileList = [];this.fileName = '';this.conclusion='';this.noType = '';">关闭</el-button>
|
|
</span>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
/deep/ .el-form-item--medium .el-form-item__content{
|
|
height: auto;
|
|
}
|
|
.red-text /deep/ .el-input__inner {
|
|
color: red;
|
|
}
|
|
</style>
|