材料上传

pg_adapter
dshclm 6 months ago
parent 9fb4d78021
commit 7f4af28066

@ -13,12 +13,15 @@
.el-select{ .el-select{
width: 100%; width: 100%;
} }
.el-upload__input{
display: none !important;
}
</style> </style>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="app"> <div class="wrapper wrapper-content animated fadeInRight ibox-content" id="app">
<div class="app-container"> <div class="app-container">
<el-form ref="postForm" :model="postForm" :rules="rules" label-position="right" label-width="150px"> <el-form ref="postForm" :model="postForm" :rules="rules" label-position="right" label-width="150px">
<el-card> <el-card style="height: 300px;">
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="检查人员:" prop="adduser"> <el-form-item label="检查人员:" prop="adduser">
@ -119,13 +122,13 @@
<el-table-column <el-table-column
label="自查项" label="自查项"
prop="checkItems" prop="checkItems"
width="200" width="150"
> >
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="自查内容" label="自查内容"
prop="typeContent" prop="typeContent"
width="500" width="400"
> >
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -162,10 +165,28 @@
</el-input> </el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
label="材料上传"
width="300">
<template v-slot="scope">
<el-upload
:disabled="scope.row.ifstarts"
class="upload-demo"
action="/common/upload"
:multiple="false"
:limit="1"
:on-success="handleUploadSuccess(scope.row)"
:on-error="handleUploadError"
:on-exceed="handleExceed"
>
<el-button slot="trigger" :disabled="scope.row.ifstarts" size="small" type="primary">上传文件</el-button>
</el-upload>
</template>
</el-table-column>
<el-table-column <el-table-column
label="扣分标准" label="扣分标准"
prop="deductionCriteria" prop="deductionCriteria"
width="500"> width="350">
</el-table-column> </el-table-column>
</el-table> </el-table>
</template> </template>
@ -271,6 +292,22 @@
// callback(); // callback();
// } // }
}, },
handleUploadSuccess(row) {
return (response, file,fileList) => {
if (response.code == web_status.SUCCESS) {
row.fileName = response.originalFilename;
row.fileUrl = response.url;
row.fileList = fileList
$.modal.msgSuccess("文件上传成功");
}
};
},
handleUploadError(){
$.modal.msgError('上传失败');
},
handleExceed(){
$.modal.msgWarning('超出个数限制,最多只能上传一个文件!');
},
handleChange(row, expandedRows){ handleChange(row, expandedRows){
this.loading = true; this.loading = true;
if (expandedRows.length > 0) { if (expandedRows.length > 0) {

@ -13,12 +13,15 @@
.el-select{ .el-select{
width: 100%; width: 100%;
} }
.el-upload__input{
display: none !important;
}
</style> </style>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="app"> <div class="wrapper wrapper-content animated fadeInRight ibox-content" id="app">
<div class="app-container"> <div class="app-container">
<el-form ref="postForm" :model="postForm" :rules="rules" label-position="right" label-width="150px"> <el-form ref="postForm" :model="postForm" :rules="rules" label-position="right" label-width="150px">
<el-card> <el-card style="height: 300px;">
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="检查人员:" prop="adduser"> <el-form-item label="检查人员:" prop="adduser">
@ -121,13 +124,13 @@
<el-table-column <el-table-column
label="自查项" label="自查项"
prop="checkItems" prop="checkItems"
width="200" width="150"
> >
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="自查内容" label="自查内容"
prop="typeContent" prop="typeContent"
width="500" width="400"
> >
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -165,10 +168,35 @@
</el-input> </el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
label="材料上传"
width="300">
<template v-slot="scope">
<el-upload
disabled
class="upload-demo"
action="/common/upload"
:multiple="false"
:limit="1"
:file-list="scope.row.fileName ? [
{
name: scope.row.fileName,
url: scope.row.fileUrl
}
] : fileList"
:on-success="handleUploadSuccess(scope.row)"
:on-error="handleUploadError"
:on-exceed="handleExceed"
:on-remove="handleRemove(scope.row)"
>
<el-button slot="trigger" disabled size="small" type="primary">上传文件</el-button>
</el-upload>
</template>
</el-table-column>
<el-table-column <el-table-column
label="扣分标准" label="扣分标准"
prop="deductionCriteria" prop="deductionCriteria"
width="500"> width="350">
</el-table-column> </el-table-column>
</el-table> </el-table>
</template> </template>
@ -227,6 +255,7 @@
tempData:{}, tempData:{},
startsArry:[], startsArry:[],
editcheckTypeDTOS:[], editcheckTypeDTOS:[],
fileList:[],
rules: { rules: {
adduser: [ adduser: [
{ required: true, message: '报告人员不能为空!' } { required: true, message: '报告人员不能为空!' }
@ -295,6 +324,28 @@
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}, },
handleUploadSuccess(row) {
return (response, file) => {
if (response.code == web_status.SUCCESS) {
row.fileName = response.originalFilename;
row.fileUrl = response.url;
$.modal.msgSuccess("文件上传成功");
}
};
},
handleRemove(row){
return () => {
row.fileName = '';
row.fileUrl = '';
$.modal.msgSuccess("删除成功");
};
},
handleUploadError(){
$.modal.msgError('上传失败');
},
handleExceed(){
$.modal.msgWarning('超出个数限制,最多只能上传一个文件!');
},
validateEndTime(rule, value, callback) { validateEndTime(rule, value, callback) {
// if (value && this.postForm.checkStartTime && new Date(value).getTime() < new Date(this.postForm.checkStartTime).getTime()) { // if (value && this.postForm.checkStartTime && new Date(value).getTime() < new Date(this.postForm.checkStartTime).getTime()) {
// callback(new Error('结束日期不能早于开始日期')); // callback(new Error('结束日期不能早于开始日期'));

@ -13,12 +13,15 @@
.el-select{ .el-select{
width: 100%; width: 100%;
} }
.el-upload__input{
display: none !important;
}
</style> </style>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="app"> <div class="wrapper wrapper-content animated fadeInRight ibox-content" id="app">
<div class="app-container"> <div class="app-container">
<el-form ref="postForm" :model="postForm" :rules="rules" label-position="right" label-width="150px"> <el-form ref="postForm" :model="postForm" :rules="rules" label-position="right" label-width="150px">
<el-card> <el-card style="height: 300px;">
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="检查人员:" prop="adduser"> <el-form-item label="检查人员:" prop="adduser">
@ -119,13 +122,13 @@
<el-table-column <el-table-column
label="自查项" label="自查项"
prop="checkItems" prop="checkItems"
width="200" width="150"
> >
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="自查内容" label="自查内容"
prop="typeContent" prop="typeContent"
width="500" width="400"
> >
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -162,10 +165,35 @@
</el-input> </el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
label="材料上传"
width="300">
<template v-slot="scope">
<el-upload
:disabled="scope.row.ifstarts"
class="upload-demo"
action="/common/upload"
:multiple="false"
:limit="1"
:file-list="scope.row.fileName ? [
{
name: scope.row.fileName,
url: scope.row.fileUrl
}
] : fileList"
:on-success="handleUploadSuccess(scope.row)"
:on-error="handleUploadError"
:on-exceed="handleExceed"
:on-remove="handleRemove(scope.row)"
>
<el-button slot="trigger" :disabled="scope.row.ifstarts" size="small" type="primary">上传文件</el-button>
</el-upload>
</template>
</el-table-column>
<el-table-column <el-table-column
label="扣分标准" label="扣分标准"
prop="deductionCriteria" prop="deductionCriteria"
width="500"> width="350">
</el-table-column> </el-table-column>
</el-table> </el-table>
</template> </template>
@ -229,6 +257,7 @@
tempData:{}, tempData:{},
startsArry:[], startsArry:[],
editcheckTypeDTOS:[], editcheckTypeDTOS:[],
fileList:[],
rules: { rules: {
adduser: [ adduser: [
{ required: true, message: '报告人员不能为空!' } { required: true, message: '报告人员不能为空!' }
@ -306,6 +335,28 @@
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}, },
handleUploadSuccess(row) {
return (response, file) => {
if (response.code == web_status.SUCCESS) {
row.fileName = response.originalFilename;
row.fileUrl = response.url;
$.modal.msgSuccess("文件上传成功");
}
};
},
handleRemove(row){
return () => {
row.fileName = '';
row.fileUrl = '';
$.modal.msgSuccess("删除成功");
};
},
handleUploadError(){
$.modal.msgError('上传失败');
},
handleExceed(){
$.modal.msgWarning('超出个数限制,最多只能上传一个文件!');
},
validateEndTime(rule, value, callback) { validateEndTime(rule, value, callback) {
// if (value && this.postForm.checkStartTime && new Date(value).getTime() < new Date(this.postForm.checkStartTime).getTime()) { // if (value && this.postForm.checkStartTime && new Date(value).getTime() < new Date(this.postForm.checkStartTime).getTime()) {
// callback(new Error('结束日期不能早于开始日期')); // callback(new Error('结束日期不能早于开始日期'));
@ -366,7 +417,6 @@
// } // }
// this.calculateTotalScore('totalScore') // this.calculateTotalScore('totalScore')
}else{ }else{
debugger
row.ifstarts = true row.ifstarts = true
let totalScore = parseFloat(this.postForm.totalScore) let totalScore = parseFloat(this.postForm.totalScore)
let score = parseFloat(row.score) let score = parseFloat(row.score)

Loading…
Cancel
Save