|
@@ -51,7 +51,11 @@
|
|
|
<el-table-column label="录入方式" align="center" prop="enterType"></el-table-column>
|
|
|
<el-table-column label="数值" align="center" prop="numValue"></el-table-column>
|
|
|
<el-table-column label="文字说明" align="center" prop="remark" width="280"></el-table-column>
|
|
|
- <el-table-column label="附件" align="center" prop="fileNames" width="280"></el-table-column>
|
|
|
+ <el-table-column label="附件" align="center" prop="fileNames" width="280">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-link @click="download(scope.row.fileNames)">{{scope.row.fileNames}}</el-link>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="操作" align="center" fixed="right" width="150">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
@@ -113,9 +117,11 @@
|
|
|
class="upload-demo"
|
|
|
ref="upload"
|
|
|
action="#"
|
|
|
- :http-request="httprequest"
|
|
|
:file-list="fileList"
|
|
|
- :auto-upload="true"
|
|
|
+ :auto-upload="false"
|
|
|
+ :on-remove="handleRemove"
|
|
|
+ :on-change="handleChange"
|
|
|
+ :multiple="true"
|
|
|
>
|
|
|
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
|
|
|
</el-upload>
|
|
@@ -143,7 +149,7 @@
|
|
|
import { listQUOTABONDED, getQUOTABONDED, delQUOTABONDED, addQUOTABONDED, updateQUOTABONDED } from "@/api/norm/QUOTABONDED";
|
|
|
import { listQUOTAFEE } from "@/api/norm/QUOTAFEE";
|
|
|
import { listBONDED } from "@/api/portal/BONDED/BONDED.js";
|
|
|
-import { uploadFile } from '@/api/common';
|
|
|
+import { uploadFiles,downloadFiles } from '@/api/common';
|
|
|
import { listDept } from '@/api/system/dept'
|
|
|
|
|
|
export default {
|
|
@@ -312,6 +318,7 @@ export default {
|
|
|
getQUOTABONDED(id).then(response => {
|
|
|
this.form = response.data;
|
|
|
this.form.linkUrls = this.baseURL + response.data.linkUrls;
|
|
|
+ this.fileList = [];
|
|
|
this.fileList.push({
|
|
|
name: response.data.fileNames,
|
|
|
url: response.data.linkUrls,
|
|
@@ -321,7 +328,7 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
|
- submitForm() {
|
|
|
+ async submitForm() {
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
|
if (!(parseInt(this.form.score) == this.form.score)) {
|
|
@@ -345,11 +352,26 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
if (this.form.id != null) {
|
|
|
- updateQUOTABONDED(this.form).then(response => {
|
|
|
- this.$modal.msgSuccess("修改成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
+ let formData = new FormData()
|
|
|
+ if (this.fileList.length < 1) {
|
|
|
+ this.$message.error("请选择文件传输!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.fileList.forEach((item) => {
|
|
|
+ formData.append("file", item.raw);
|
|
|
});
|
|
|
+ uploadFiles(formData).then(res=>{
|
|
|
+ if(res.code == 200){
|
|
|
+ this.form.linkUrls = res.fileNames;
|
|
|
+ this.form.fileNames = res.newFileNames;
|
|
|
+
|
|
|
+ updateQUOTABONDED(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
} else {
|
|
|
addQUOTABONDED(this.form).then(response => {
|
|
|
this.$modal.msgSuccess("新增成功");
|
|
@@ -377,24 +399,21 @@ export default {
|
|
|
}, `QUOTABONDED_${new Date().getTime()}.xlsx`)
|
|
|
},
|
|
|
|
|
|
- httprequest(file) {
|
|
|
- let formData = new FormData()
|
|
|
- formData.append('file',file.file)
|
|
|
- uploadFile(formData).then(res=>{
|
|
|
- if(res.code == 200){
|
|
|
- if(this.form.linkUrls == null) {
|
|
|
- this.form.linkUrls = res.fileName + ",";
|
|
|
- this.form.fileNames = res.newFileName + ",";
|
|
|
- } else {
|
|
|
- this.form.linkUrls += res.fileName + ",";
|
|
|
- this.form.fileNames += res.newFileName + ",";
|
|
|
- }
|
|
|
- this.form.linkUrls = this.form.linkUrls.slice(0,this.form.linkUrls.length-1)
|
|
|
- this.form.fileNames = this.form.fileNames.slice(0,this.form.fileNames.length-1)
|
|
|
- }
|
|
|
+ handleChange(file, fileList) {
|
|
|
+ this.fileList = fileList;
|
|
|
+ },
|
|
|
+ handleRemove(file, fileList) {
|
|
|
+ this.fileList = fileList;
|
|
|
+ },
|
|
|
+ download(resource) {
|
|
|
+ console.log("resource",resource)
|
|
|
+ downloadFiles(resource).then(res=>{
|
|
|
+ if(res.code == 200) {
|
|
|
|
|
|
+
|
|
|
+ }
|
|
|
})
|
|
|
- },
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|