文件管理

master
xy 1 year ago
parent d503e02182
commit f5366810a7

@ -6,7 +6,7 @@ ENV = 'staging'
# base api
VUE_APP_BASE_API=http://wuxiwuye.ali251.langye.net/
VUE_APP_UPLOAD_API=http://wuxiwuye.ali251.langye.net/api/admin/upload-file
VUE_APP_PREVIEW=http://view.ali251.langye.net:8012/onlinePreview
VUE_APP_PREVIEW=//view.langye.net:8012/onlinePreview
# base api
#VUE_APP_BASE_API=http://192.168.221.31:9001/
#VUE_APP_UPLOAD_API=http://192.168.221.31:9001/api/admin/upload-file

@ -20,6 +20,10 @@ export default {
type: String,
default: "data",
}, //
totalProp: {
type: String,
default: "total"
},
//
auths: {
@ -245,7 +249,7 @@ export default {
})
.then((res) => {
this.listData = this.getByStrkey(res.data, this.resProp);
this.totalData = res.data.total;
this.totalData = this.getByStrkey(res.data, this.totalProp);
this.$emit('loaded')
setTimeout(() => {
this.loading = false;
@ -265,7 +269,7 @@ export default {
},false)
.then((res) => {
this.listData = this.getByStrkey(res, this.resProp);
this.totalData = res.total;
this.totalData = this.getByStrkey(res, this.totalProp);
this.$emit('loaded')
setTimeout(() => {
this.loading = false;

@ -0,0 +1,221 @@
<template>
<div>
<!-- 查询配置 -->
<div>
<div ref="lxHeader">
<LxHeader
:icon="$route.meta.icon"
:text="$route.meta.title"
style="margin-bottom: 10px; border: 0px; margin-top: 15px"
>
<div slot="content"></div>
<slot>
<header-content :auths="auths_auth_mixin">
<template #search>
<div style="display: flex;">
<Input v-model="select.keyword" placeholder="请输入关键词" clearable/>
<Button
style="margin-left: 10px;"
type="primary"
@click="$refs['xyTable'].getTableData()"
>查询</Button>
</div>
</template>
</header-content>
</slot>
</LxHeader>
</div>
</div>
<xy-table
:btn-width="300"
:auths="auths_auth_mixin"
:delay-req="true"
res-prop="list.data"
total-prop="list.total"
ref="xyTable"
:border="true"
:action="getFiles"
:req-opt="select"
:table-item="table"
@detail="
(row) => {
$router.push({
path: $route.path + '/detail/' + row.id
})
}
"
>
</xy-table>
<Modal
:width="76"
transfer
:z-index="6000"
v-model="showModal"
:footer-hide="true"
title="预览"
>
<template>
<iframe
style="width: 100%; height: 57vh"
:src="codeUri"
border="0"
></iframe>
</template>
</Modal>
</div>
</template>
<script>
import { authMixin } from "@/mixin/authMixin";
import { getFiles } from "@/api/common"
import LxHeader from "@/components/LxHeader/index.vue";
import headerContent from "@/components/LxHeader/XyContent.vue";
import { download } from '@/utils/downloadRequest'
export default {
components: {
LxHeader,
headerContent,
},
mixins: [authMixin],
data() {
return {
codeUri: "",
showModal: false,
table: [
{
type: "index",
width: 44
},
{
prop: "original_name",
label: "文件名称",
align: "left",
minWidth: 200
},
{
prop: "asset",
label: "所属资产",
width: 180,
align: "left",
customFn: row => {
return (<span>{ row.land.name ? `[土地]${row.land.name}` : `[房产]${row.house.name}` }</span>)
}
},
{
prop: "created_at",
label: "创建时间",
width: 160
},
{
prop: "operate",
label: "操作",
minWidth: 140,
align: "left",
fixed: "right",
customFn: row => {
return (
<div>
<Button size="small"
type="primary"
on={{
['click']: _ => {
if (row.land.id) {
this.$router.push({
path: '/landDetail/' + row.land.id
})
} else if (row.house.id) {
this.$router.push({
path: '/houseDetail/' + row.house.id
})
} else {}
}
}}>查看资产</Button>
<Button size="small"
type="primary"
icon="md-search"
on={{
["click"]: _ => {
this.open(row.url)
}
}}>查看文件</Button>
<Button size="small"
type="primary"
icon="md-download"
on={{
["click"]: _ => {
this.down(row)
}
}}>下载文件</Button>
</div>
)
}
}
],
select: {
keyword: ""
}
};
},
methods: {
getFiles,
open(url) {
this.codeUri = `${process.env.VUE_APP_PREVIEW}?url=${encodeURIComponent(
new Buffer(url).toString("base64")
)}`;
this.showModal = true;
},
down(e) {
download(e.url, "get", {}, e.original_name);
},
},
computed: {
},
created() {
},
};
</script>
<style scoped lang="scss">
.select {
&__item {
& > p {
display: inline-block;
width: 80px;
text-align: center;
}
& + div {
margin-top: 6px;
}
}
}
.add-btn {
display: flex;
justify-content: center;
align-items: center;
margin-top: 10px;
& > span {
padding: 0 10px;
}
}
a {
color: red;
text-decoration: none;
transition: all 0.2s;
}
a:hover {
color: red;
text-decoration: underline;
}
</style>

@ -295,10 +295,10 @@
</template>
<template>
<div>
<Button size="small" type="success" ghost>资产</Button>
<Button size="small" type="info" ghost>文件</Button>
</div>
<!-- <div>-->
<!-- <Button size="small" type="success" ghost>资产</Button>-->
<!-- <Button size="small" type="info" ghost>文件</Button>-->
<!-- </div>-->
<el-input v-model="searchKeyword" size="mini" style="margin-top: 4px;" placeholder="请输入名称" clearable>
<el-button type="primary" slot="append" icon="el-icon-search" @click="searchFile"></el-button>
</el-input>
@ -306,7 +306,12 @@
<ul class="search-file-list">
<li v-for="(item, index) in searchFiles" :key="item.id">
<div style="display: flex;justify-content: space-between;align-items: center;">
<a :download="item.url">{{index+1}}.{{ item.original_name }}</a>
<a style="flex-basis: 50%;" :download="item.url">{{index+1}}.{{ item.original_name }}</a>
<p style="flex-basis: 25%;flex-shrink: 0;">
{{ item.land.name ? `[土地]${item.land.name}` : `[房产]${item.house.name}` }}
</p>
<div>
<el-button
type="primary"
@ -477,15 +482,15 @@ export default {
searchKeyword: "",
searchFiles: [],
searchFileTotal: 0,
};
},
methods: {
async searchFile () {
try {
const res = await getFiles({ keyword: this.searchKeyword });
this.searchFiles = res.list;
console.log(this.searchFiles)
this.searchFiles = res.list.data;
this.searchFileTotal = res.list.total
} catch (err) {
}

Loading…
Cancel
Save