e0480c6f by 杨威
2 parents 2254e166 017d8d44
......@@ -119,4 +119,15 @@ export function submit (data) {
method: 'post',
data:data
})
}
\ No newline at end of file
}
/**
* 添加附件
*/
export function insertFile(data) {
return request({
url:'/file',
method:'post',
data:data
})
}
......
<template>
<div class="main">
<el-upload
class="upload-demo"
action="/api/file/uploadList"
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
:on-success="uploadSuccess"
:on-error="uploadError"
multiple
:limit="3"
:on-exceed="handleExceed"
>
<el-button size="small" type="primary">上传</el-button>
</el-upload>
<table border="2">
<tr>
<th>序号</th>
<th>文件名称</th>
<th>文件类型</th>
<th>操作</th>
</tr>
<tr v-for="(item,index) in list" :key="index">
<td>{{index+1}}</td>
<td>{{item.wjmc}}</td>
<td>{{item.wjlx}}</td>
<td>
<span>下载</span>
<span>预览</span>
</td>
</tr>
</table>
</div>
</template>
<script>
import {insertFile} from "./../../../api/common"
import {Message} from "element-ui"
export default {
name: "fjcl",
data() {
return {
list: [
{
wjmc: '调查文档1',
wjlx: 'doc',
url: ''
},
{
wjmc: '调查文档2',
wjlx: 'doc',
url: ''
},
{
wjmc: '调查文档3',
wjlx: 'doc',
url: ''
},
{
wjmc: '调查文档4',
wjlx: 'doc',
url: ''
},
],
filesData:{
dylx: "",
glbsm: "",
list: [
{
filename: "",
filepostfix: "",
fileurl: ""
}
]
},
}
},
mounted(){
switch (this.$route.name) {
case "宗地":
this.filesData.dylx='zd';
this.filesData.glbsm=this.$store.state.zdbsm
break;
case "自然幢":
this.filesData.dylx='zrz';
this.filesData.glbsm=this.$store.state.zrzbsm
break
default:
break
}
},
methods: {
uploadError(err,file,fileList){
console.log("上传文件失败",err)
},
uploadSuccess(res, file, fileList) {
this.filesData.list = res.result;
console.log(res,"res=========")
insertFile(this.filesData).then(res=>{
if (res.success) {
Message.warning("上传成功")
}else {
Message.error(res.message)
}
})
},
handleRemove(file, fileList) {
console.log(file, fileList);
},
handlePreview(file) {
console.log(file);
},
handleExceed(files, fileList) {
console.log(fileList)
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${ file.name }?`);
}
},
watch:{
}
}
</script>
<style scoped lang="less">
.main {
box-sizing: border-box;
padding: 18px;
height: auto;
width: 80%;
}
table {
margin-top: 10px;
background-color: #fff;
font-size: 14px;
width: 100%;
td, th {
text-align: center;
height: 36px;
min-width: 50px;
}
}
</style>
......@@ -7,6 +7,7 @@
<el-tab-pane label="界址线" name="jzx"><jzx></jzx></el-tab-pane>
<el-tab-pane label="登记簿" name="djb"><djb></djb></el-tab-pane>
<el-tab-pane label="历史回溯" name="lshs"><lshs></lshs></el-tab-pane>
<el-tab-pane label="附件材料" name="fjcl"><fjcl></fjcl></el-tab-pane>
</el-tabs>
</div>
</template>
......@@ -18,10 +19,11 @@ import jzd from "./jzd";
import jzx from "./jzx";
import djb from "./djb";
import lshs from "./lshs";
import fjcl from "./fjcl/fjcl"
export default {
name: "",
components: {
zddcb,mjftb,jzd,jzx,djb,lshs
zddcb,mjftb,jzd,jzx,djb,lshs,fjcl
},
props: {},
data() {
......