e0480c6f by 杨威
2 parents 2254e166 017d8d44
...@@ -119,4 +119,15 @@ export function submit (data) { ...@@ -119,4 +119,15 @@ export function submit (data) {
119 method: 'post', 119 method: 'post',
120 data:data 120 data:data
121 }) 121 })
122 }
...\ No newline at end of file ...\ No newline at end of file
122 }
123
124 /**
125 * 添加附件
126 */
127 export function insertFile(data) {
128 return request({
129 url:'/file',
130 method:'post',
131 data:data
132 })
133 }
......
1 <template>
2 <div class="main">
3 <el-upload
4 class="upload-demo"
5 action="/api/file/uploadList"
6 :on-preview="handlePreview"
7 :on-remove="handleRemove"
8 :before-remove="beforeRemove"
9 :on-success="uploadSuccess"
10 :on-error="uploadError"
11 multiple
12 :limit="3"
13 :on-exceed="handleExceed"
14 >
15 <el-button size="small" type="primary">上传</el-button>
16 </el-upload>
17 <table border="2">
18 <tr>
19 <th>序号</th>
20 <th>文件名称</th>
21 <th>文件类型</th>
22 <th>操作</th>
23 </tr>
24 <tr v-for="(item,index) in list" :key="index">
25 <td>{{index+1}}</td>
26 <td>{{item.wjmc}}</td>
27 <td>{{item.wjlx}}</td>
28 <td>
29 <span>下载</span>
30 <span>预览</span>
31 </td>
32 </tr>
33 </table>
34 </div>
35 </template>
36
37 <script>
38 import {insertFile} from "./../../../api/common"
39 import {Message} from "element-ui"
40 export default {
41 name: "fjcl",
42 data() {
43 return {
44 list: [
45 {
46 wjmc: '调查文档1',
47 wjlx: 'doc',
48 url: ''
49 },
50 {
51 wjmc: '调查文档2',
52 wjlx: 'doc',
53 url: ''
54 },
55 {
56 wjmc: '调查文档3',
57 wjlx: 'doc',
58 url: ''
59 },
60 {
61 wjmc: '调查文档4',
62 wjlx: 'doc',
63 url: ''
64 },
65 ],
66 filesData:{
67 dylx: "",
68 glbsm: "",
69 list: [
70 {
71 filename: "",
72 filepostfix: "",
73 fileurl: ""
74 }
75 ]
76 },
77 }
78 },
79 mounted(){
80 switch (this.$route.name) {
81 case "宗地":
82 this.filesData.dylx='zd';
83 this.filesData.glbsm=this.$store.state.zdbsm
84 break;
85 case "自然幢":
86 this.filesData.dylx='zrz';
87 this.filesData.glbsm=this.$store.state.zrzbsm
88 break
89 default:
90 break
91 }
92 },
93 methods: {
94 uploadError(err,file,fileList){
95 console.log("上传文件失败",err)
96 },
97 uploadSuccess(res, file, fileList) {
98 this.filesData.list = res.result;
99 console.log(res,"res=========")
100 insertFile(this.filesData).then(res=>{
101 if (res.success) {
102 Message.warning("上传成功")
103 }else {
104 Message.error(res.message)
105 }
106 })
107 },
108 handleRemove(file, fileList) {
109 console.log(file, fileList);
110 },
111 handlePreview(file) {
112 console.log(file);
113 },
114 handleExceed(files, fileList) {
115 console.log(fileList)
116 this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
117 },
118 beforeRemove(file, fileList) {
119 return this.$confirm(`确定移除 ${ file.name }?`);
120 }
121 },
122 watch:{
123 }
124 }
125 </script>
126
127 <style scoped lang="less">
128 .main {
129 box-sizing: border-box;
130 padding: 18px;
131 height: auto;
132 width: 80%;
133 }
134
135 table {
136 margin-top: 10px;
137 background-color: #fff;
138 font-size: 14px;
139 width: 100%;
140 td, th {
141 text-align: center;
142 height: 36px;
143 min-width: 50px;
144 }
145 }
146
147
148 </style>
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
7 <el-tab-pane label="界址线" name="jzx"><jzx></jzx></el-tab-pane> 7 <el-tab-pane label="界址线" name="jzx"><jzx></jzx></el-tab-pane>
8 <el-tab-pane label="登记簿" name="djb"><djb></djb></el-tab-pane> 8 <el-tab-pane label="登记簿" name="djb"><djb></djb></el-tab-pane>
9 <el-tab-pane label="历史回溯" name="lshs"><lshs></lshs></el-tab-pane> 9 <el-tab-pane label="历史回溯" name="lshs"><lshs></lshs></el-tab-pane>
10 <el-tab-pane label="附件材料" name="fjcl"><fjcl></fjcl></el-tab-pane>
10 </el-tabs> 11 </el-tabs>
11 </div> 12 </div>
12 </template> 13 </template>
...@@ -18,10 +19,11 @@ import jzd from "./jzd"; ...@@ -18,10 +19,11 @@ import jzd from "./jzd";
18 import jzx from "./jzx"; 19 import jzx from "./jzx";
19 import djb from "./djb"; 20 import djb from "./djb";
20 import lshs from "./lshs"; 21 import lshs from "./lshs";
22 import fjcl from "./fjcl/fjcl"
21 export default { 23 export default {
22 name: "", 24 name: "",
23 components: { 25 components: {
24 zddcb,mjftb,jzd,jzx,djb,lshs 26 zddcb,mjftb,jzd,jzx,djb,lshs,fjcl
25 }, 27 },
26 props: {}, 28 props: {},
27 data() { 29 data() {
......