8a253254 by weimo934

feat(fjcl):对接获取列表接口,下载文件接口

1 parent a88ab7fa
......@@ -89,7 +89,7 @@ export function getTreeByZrzbsm(zrzbsm) {
/**x
*修改 宗地,自然幢,户的权属状态
*/
export function updateQsztByBsm(data){
export function updateQsztByBsm(data) {
return request({
url: '/gz/updateByBsm',
method: 'post',
......@@ -100,24 +100,25 @@ export function updateQsztByBsm(data){
/**x
*修改 宗地,自然幢,户的权属状态
*/
export function copyZdjbxx(data){
export function copyZdjbxx(data) {
return request({
url: '/bg/fwsxbg/copyZdjbxx',
method: 'post',
data: data
})
}
/**
* 提交表单信息
* glbsm 关联标识码,自然幢,多幢等标识码 ,
* status 状态
* type 类型,zrz,dz,zd等信息,首字母缩写
*/
export function submit (data) {
export function submit(data) {
return request({
url: '/system/submit/submitInfo',
method: 'post',
data:data
data: data
})
}
......@@ -126,8 +127,21 @@ export function submit (data) {
*/
export function insertFile(data) {
return request({
url:'/file',
method:'post',
data:data
url: '/file',
method: 'post',
data: data
})
}
/**
* 获取文件
*/
export function getFileLis(glbsm) {
return request({
url: '/file/list',
method: 'get',
params: {
glbsm
}
})
}
......
......@@ -16,17 +16,22 @@
</el-upload>
<table border="2">
<tr>
<th>序号</th>
<th>文件名称</th>
<th>文件类型</th>
<th>操作</th>
<th class="xh">序号</th>
<th class="mc">文件名称</th>
<th class="lx">文件类型</th>
<th class="cz">操作</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>
<tr v-if="list.length==0">
<td colspan="4" class="noData" >
<span>暂无数据</span>
</td>
</tr>
<tr v-else v-for="(item,index) in list" :key="index" >
<td class="xh">{{index+1}}</td>
<td class="mc">{{item.filename}}</td>
<td class="lx">{{item.filepostfix}}</td>
<td class="cz">
<span @click="downloadFile(item.fileurl)">下载</span>
<span>预览</span>
</td>
</tr>
......@@ -35,35 +40,21 @@
</template>
<script>
import {insertFile} from "./../../../api/common"
import {insertFile, getFileLis, downloadFile} 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: ''
},
filename: '调查文档1',
filepostfix: 'doc',
fileurl: ''
}
],
filesData:{
filesData: {
dylx: "",
glbsm: "",
list: [
......@@ -76,31 +67,45 @@
},
}
},
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
}
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
}
this.getFileList(this.filesData.glbsm)
},
methods: {
uploadError(err,file,fileList){
console.log("上传文件失败",err)
downloadFile(url) {
window.open(`/api/file/download?url=`+url);
},
getFileList(bsm) {
getFileLis(bsm).then(res => {
if (res.success) {
this.list = res.result;
} else {
}
})
},
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=>{
console.log(res, "res=========")
insertFile(this.filesData).then(res => {
if (res.success) {
Message.warning("上传成功")
}else {
this.getFileList(this.filesData.glbsm)
} else {
Message.error(res.message)
}
})
......@@ -119,8 +124,7 @@
return this.$confirm(`确定移除 ${ file.name }?`);
}
},
watch:{
}
watch: {}
}
</script>
......@@ -134,6 +138,7 @@
table {
margin-top: 10px;
cursor: pointer;
background-color: #fff;
font-size: 14px;
width: 100%;
......@@ -142,6 +147,28 @@
height: 36px;
min-width: 50px;
}
td span {
color: blue;
}
.cz span:hover {
color: blue;
text-decoration: underline;
}
.xh{
width: 100px;
}
.mc{
width: 300px;
}
.lx{
width: 120px;
}
.cz{
width: 150px;
}
.noData span{
color: #BBB;
}
}
......