<template>
|
<div class="authorityManagement_box">
|
<My-bread
|
:list="[
|
`${$t('dataManage.dataManage')}`,
|
`${$t('dataManage.metadataManage')}`,
|
]"
|
></My-bread>
|
<el-divider />
|
<div class="inquire">
|
<el-form ref="queryForm" :model="queryForm" :inline="true">
|
<el-form-item label="关键字" prop="name">
|
<el-input
|
v-model="queryForm.name"
|
:placeholder="$t('common.pleaseInput')"
|
/>
|
</el-form-item>
|
<el-form-item>
|
<el-button
|
@click="queryInfo()"
|
icon="el-icon-search"
|
type="primary"
|
size="small"
|
>查询</el-button
|
>
|
</el-form-item>
|
<el-form-item>
|
<el-button
|
@click="resetInfo('queryForm')"
|
icon="el-icon-refresh"
|
type="info"
|
size="small"
|
>重置</el-button
|
>
|
</el-form-item>
|
|
<el-form-item v-if="btnStatus.insert">
|
<el-button
|
type="success"
|
size="small"
|
@click="showAddDialog"
|
icon="el-icon-plus"
|
>{{ $t("common.append") }}</el-button
|
>
|
</el-form-item>
|
<el-form-item v-if="btnStatus.delete">
|
<el-button
|
type="danger"
|
size="small"
|
@click="deleteMetaInfo"
|
icon="el-icon-delete"
|
>{{ $t("common.delete") }}</el-button
|
>
|
</el-form-item>
|
<el-form-item v-if="btnStatus.download">
|
<el-button
|
@click="downFormData"
|
icon="el-icon-download"
|
type="success"
|
size="small"
|
>下载</el-button
|
>
|
</el-form-item>
|
</el-form>
|
</div>
|
<div class="bottom">
|
<div class="rightTable">
|
<div class="table_box">
|
<el-table
|
:data="tableData"
|
border
|
style="width: 100%"
|
fit
|
@selection-change="handleSelectionChange"
|
height="99%"
|
>
|
<el-table-column type="selection" width="55" />
|
<el-table-column min-width="150" prop="name" label="名称" />
|
<el-table-column min-width="100" prop="format" label="格式" />
|
<el-table-column min-width="100" prop="sizes" label="大小" />
|
<el-table-column
|
min-width="100"
|
prop="createUser"
|
label="创建人员"
|
/>
|
<el-table-column
|
min-width="100"
|
prop="createTime"
|
label="创建时间"
|
/>
|
<el-table-column min-width="100" prop="cs" label="坐标系统" />
|
<el-table-column min-width="100" prop="scale" label="比例尺" />
|
<el-table-column min-width="100" prop="resolution" label="分辨率" />
|
|
<el-table-column min-width="100" prop="descr" label="描述" />
|
<el-table-column min-width="100" label="操作">
|
<template slot-scope="scope">
|
<el-link @click="showDetail(scope.row)">查看</el-link>
|
<el-link @click="editInfo(scope.row)" style="margin-left: 10px"
|
>修改</el-link
|
>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
<div
|
style="margin-top: 20px; margin-left: 400px"
|
class="pagination_box"
|
>
|
<el-pagination
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
:current-page="currentPage"
|
:page-sizes="[10, 20, 50, 100]"
|
:page-size="10"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="count"
|
>
|
</el-pagination>
|
</div>
|
</div>
|
</div>
|
<div class="infoBox" v-show="showinfoBox">
|
<el-card class="box-card">
|
<div slot="header" class="clearfix">
|
<span>详细信息</span>
|
<div style="float: right; cursor: pointer" @click="closeDetial">
|
<i class="el-icon-close"></i>
|
</div>
|
</div>
|
<div class="contentBox">
|
<p>数据名称:{{ itemdetail.name }}</p>
|
<el-divider></el-divider>
|
<p>数据类型:{{ itemdetail.type }}</p>
|
<el-divider></el-divider>
|
<p>数据格式:{{ itemdetail.format }}</p>
|
<el-divider></el-divider>
|
<p>创建时间:{{ itemdetail.createTime }}</p>
|
<el-divider></el-divider>
|
<p>创建人员:{{ itemdetail.createUser }}</p>
|
<el-divider></el-divider>
|
<p>更新时间:{{ itemdetail.updateTime }}</p>
|
<el-divider></el-divider>
|
<p>更新人员:{{ itemdetail.updateUser }}</p>
|
<el-divider></el-divider>
|
<p>坐标系统:{{ itemdetail.cs }}</p>
|
<el-divider></el-divider>
|
<p>比例尺{{ itemdetail.scale }}</p>
|
<el-divider></el-divider>
|
<p>分辨率{{ itemdetail.resolution }}</p>
|
<el-divider></el-divider>
|
<p>描述:{{ itemdetail.descr }}</p>
|
</div>
|
</el-card>
|
</div>
|
<el-dialog
|
width="510px"
|
top="5vh"
|
:title="behavior"
|
:visible.sync="dialogFormVisible"
|
:before-close="handleClose"
|
>
|
<el-form :model="editForm" ref="editForm">
|
<el-form-item label="数据名称" :label-width="formLabelWidth">
|
<el-input v-model="editForm.name" autocomplete="off"></el-input>
|
</el-form-item>
|
<el-form-item label="数据类型" :label-width="formLabelWidth">
|
<el-input v-model="editForm.type" autocomplete="off"></el-input>
|
</el-form-item>
|
<el-form-item label="数据格式" :label-width="formLabelWidth">
|
<el-input v-model="editForm.format" autocomplete="off"></el-input>
|
</el-form-item>
|
<el-form-item label="坐标系统" :label-width="formLabelWidth">
|
<el-input v-model="editForm.cs" autocomplete="off"></el-input>
|
</el-form-item>
|
<el-form-item label="比例尺" :label-width="formLabelWidth">
|
<el-input v-model="editForm.scale" autocomplete="off"></el-input>
|
</el-form-item>
|
<el-form-item label="分辨率" :label-width="formLabelWidth">
|
<el-input v-model="editForm.resolution" autocomplete="off"></el-input>
|
</el-form-item>
|
<el-form-item label="描述" :label-width="formLabelWidth">
|
<el-input v-model="editForm.descr" autocomplete="off"></el-input>
|
</el-form-item>
|
</el-form>
|
<div v-if="behavior == '修改信息'" slot="footer" class="dialog-footer">
|
<el-button size="medium" @click="cancelEdit()">重置</el-button>
|
<el-button
|
size="medium"
|
type="primary"
|
@click="sendEdit('editForm')"
|
v-loading.fullscreen.lock="fullscreenLoading"
|
>提交</el-button
|
>
|
</div>
|
<div v-else slot="footer" class="dialog-footer">
|
<el-button size="medium" @click="cancelAdd('editForm')">重置</el-button>
|
<el-button
|
size="medium"
|
type="primary"
|
@click="sendAdd('editForm')"
|
v-loading.fullscreen.lock="fullscreenLoading"
|
>提交</el-button
|
>
|
</div>
|
</el-dialog>
|
<div class="downloadBox" v-if="showCodeBox">
|
<h4 style="padding: 20px">请输入下载包密码</h4>
|
<el-form
|
:model="codeForm"
|
:rules="rules"
|
ref="codeForm"
|
label-width="100px"
|
class="codeForm"
|
>
|
<el-form-item label="密码" prop="password">
|
<el-input type="password" v-model="codeForm.password"></el-input>
|
</el-form-item>
|
<el-form-item label="确认密码" prop="repassword">
|
<el-input type="password" v-model="codeForm.repassword"></el-input>
|
</el-form-item>
|
<el-form-item>
|
<el-button type="primary" size="small" @click="download('codeForm')"
|
>确定</el-button
|
>
|
<el-button type="info" size="small" @click="closeDown('codeForm')"
|
>取消</el-button
|
>
|
</el-form-item>
|
</el-form>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import {
|
select_meta_ByPageAndCount,
|
// queryDataCount,
|
updateMeta,
|
deleteMeta,
|
insertMeta,
|
} from "../../api/api";
|
import MyBread from "../../components/MyBread.vue";
|
export default {
|
name: "metadataManage",
|
components: { MyBread },
|
data() {
|
var repasswordValidator = (rule, value, callback) => {
|
if (value === "") {
|
callback(new Error("请再次输入密码"));
|
} else if (value !== this.codeForm.password) {
|
callback(new Error("两次输入密码不一致!"));
|
} else {
|
callback();
|
}
|
};
|
return {
|
showCodeBox: false,
|
value: true,
|
multipleSelection: [],
|
formLabelWidth: "120px",
|
dialogFormVisible: false,
|
editForm: {},
|
showinfoBox: false,
|
fullscreenLoading: false,
|
itemdetail: {},
|
queryForm: {
|
name: "",
|
},
|
behavior: "",
|
initialForm: "",
|
codeForm: {
|
password: "",
|
repassword: "",
|
},
|
rules: {
|
password: [{ required: true, message: "请输入密码", trigger: "blur" }],
|
repassword: [
|
{ required: true, message: "请输入确认密码", trigger: "blur" },
|
{ validator: repasswordValidator, trigger: "blur" },
|
],
|
},
|
tableData: [],
|
count: 0,
|
currentPage: 1,
|
pageSize: 10,
|
pageIndex: 1,
|
btnStatus: {
|
select: false,
|
delete: false,
|
upload: false,
|
download: false,
|
insert: false,
|
update: false,
|
},
|
};
|
},
|
created() {
|
this.getMetaData({
|
pageIndex: 1,
|
pageSize: 10,
|
});
|
this.showPermsBtn();
|
},
|
methods: {
|
//显示权限按钮
|
showPermsBtn() {
|
let currentPerms = this.$store.state.currentPerms;
|
let permsEntity = this.$store.state.permsEntity;
|
permsEntity
|
.filter((item) => item.perms == currentPerms)
|
.map((item) => (this.btnStatus[item.tag.substr(1)] = true));
|
},
|
ShowWindowFly(res) {
|
console.log(res);
|
if (res == "") return;
|
if (res.indexOf(".xls") != -1) {
|
this.showMetadata(res, true);
|
} else if (res.indexOf(".doc") != -1) {
|
this.showMetadata(res, true);
|
} else if (res.indexOf(".png") != -1) {
|
this.showMetadata(res, true);
|
} else if (res.indexOf(".jpg") != -1) {
|
this.showMetadata(res, true);
|
} else if (res.indexOf(".pdf") != -1) {
|
this.showMetadata(res, true);
|
} else if (res.indexOf(".fly") != -1) {
|
this.showMetadata(res, false);
|
} else if (res.indexOf(".mpt") != -1) {
|
this.showMetadata(res, false);
|
}
|
},
|
showMetadata(res, flag) {
|
var metaUrl;
|
if (flag == true) {
|
metaUrl = res;
|
} else if (flag == false) {
|
metaUrl = ifreamUrl + "/LFWeb/MetaPop.html?name=" + res;
|
}
|
window.open(
|
metaUrl,
|
"",
|
"height=800, width=1500, top=150, left=350, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no"
|
);
|
},
|
// 请求数据内容
|
getMetaData(params) {
|
select_meta_ByPageAndCount(params).then((res) => {
|
this.tableData = res.result;
|
this.count = res.count;
|
});
|
},
|
// 查询
|
queryInfo() {
|
let searchData = {
|
name: this.queryForm.name.trim(),
|
pageIndex: this.pageIndex,
|
pageSize: this.pageSize,
|
};
|
select_meta_ByPageAndCount(searchData).then((res) => {
|
if (res.code == 200) {
|
this.tableData = res.result;
|
this.count = res.count;
|
} else {
|
console.log("查询接口报错");
|
this.$notify.error({
|
title: res.code,
|
message: res.result,
|
});
|
}
|
});
|
},
|
// 重置查询
|
resetInfo(formName) {
|
this.$refs[formName].resetFields();
|
},
|
//新增按钮
|
showAddDialog() {
|
this.behavior = "新增用户";
|
this.editForm = {};
|
this.dialogFormVisible = true;
|
},
|
cancelAdd(formName) {
|
this.editForm = {};
|
this.$refs[formName].resetFields();
|
},
|
sendAdd(formName) {
|
this.$refs[formName].validate((valid) => {
|
if (valid) {
|
console.log(this.editForm);
|
this.fullscreenLoading = true;
|
insertMeta(this.editForm)
|
.then((res) => {
|
setTimeout(() => {
|
this.fullscreenLoading = false;
|
if (res.code == 200) {
|
this.getMetaData({ pageIndex: 1, pageSize: 10 });
|
this.$message({
|
message: "添加成功",
|
type: "success",
|
});
|
this.editForm = {};
|
this.dialogFormVisible = false;
|
}
|
}, 500);
|
})
|
.catch((res) => {
|
alert("修改失败,请重试!");
|
this.fullscreenLoading = false;
|
});
|
} else {
|
console.log("error submit!!");
|
return false;
|
}
|
});
|
},
|
// 获取多选选中的对象
|
handleSelectionChange(val) {
|
this.multipleSelection = val;
|
},
|
// 删除多条
|
deleteMetaInfo() {
|
this.$confirm("确定是否删除所选内容?", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning",
|
})
|
.then(() => {
|
var std = [];
|
for (var i in this.multipleSelection) {
|
std.push(this.multipleSelection[i].id);
|
}
|
deleteMeta({ ids: std.toString() }).then((res) => {
|
if (res.code == 200) {
|
this.$message({
|
type: "success",
|
message: "删除成功!",
|
});
|
this.multipleSelection = [];
|
this.getMetaData({ pageIndex: 1, pageSize: 10 });
|
} else {
|
this.$message.error("删除失败");
|
this.multipleSelection = [];
|
}
|
});
|
})
|
.catch(() => {
|
this.$message("已取消删除");
|
});
|
},
|
|
// 查看界面
|
showDetail(row) {
|
// console.log(index, row);
|
this.showinfoBox = true;
|
this.itemdetail = row;
|
},
|
// 关闭查看
|
closeDetial() {
|
this.showinfoBox = false;
|
this.itemdetail = {};
|
},
|
// 修改界面
|
editInfo(row) {
|
// console.log(row);
|
delete row.createTime;
|
delete row.createUser;
|
delete row.updateUser;
|
delete row.updateUser;
|
this.initialForm = JSON.stringify(row); //备份
|
this.behavior = "修改信息";
|
this.editForm = JSON.parse(JSON.stringify(row));
|
this.dialogFormVisible = true;
|
},
|
handleClose(done) {
|
this.$confirm("确认关闭?")
|
.then((_) => {
|
this.editForm = {};
|
done();
|
})
|
.catch((_) => {});
|
},
|
|
// 提交修改
|
sendEdit() {
|
this.$confirm("是否确定编辑?", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning",
|
})
|
.then(() => {
|
this.dialogFormVisible = false;
|
updateMeta(this.editForm).then((res) => {
|
setTimeout(() => {
|
this.fullscreenLoading = false;
|
if (res.code == 200) {
|
this.getMetaData({ pageIndex: 1, pageSize: 10 });
|
this.$message({
|
message: "修改成功",
|
type: "success",
|
});
|
this.editForm = {};
|
this.dialogFormVisible = false;
|
}
|
}, 500);
|
});
|
})
|
.catch(() => {
|
alert("修改失败,请重试!");
|
this.fullscreenLoading = false;
|
});
|
},
|
cancelEdit() {
|
this.$nextTick(() => {
|
this.editForm = JSON.parse(this.initialForm);
|
});
|
},
|
download() {},
|
closeDown() {
|
this.showCodeBox = false;
|
this.codeForm.password = "";
|
this.codeForm.repassword = "";
|
},
|
downFormData() {
|
if (this.multipleSelection.length == 0) {
|
alert("请先选择要下载的文件");
|
return;
|
}
|
this.showCodeBox = true;
|
// this.$prompt("请输入密码", "提示", {
|
// confirmButtonText: "确定",
|
// cancelButtonText: "取消",
|
// inputType: "password",
|
// inputPattern: /^[\s\S]*.*[^\s][\s\S]*$/,
|
// inputErrorMessage: "输入不能为空",
|
// })
|
// .then(() => {
|
// let ids = "";
|
// this.multipleSelection.forEach((e) => {
|
// ids += `id=${e.id}&`;
|
// });
|
// let res = ids.substring(0, ids.length - 1);
|
// console.log(res);
|
// let url = "http://192.168.20.106/LFServer/Meta/Downloads?" + res;
|
// window.open(url);
|
// })
|
// .catch(() => {});
|
},
|
|
handleSizeChange(val) {
|
this.pageSize = val;
|
this.queryInfo();
|
},
|
handleCurrentChange(val) {
|
this.pageIndex = val;
|
this.currentPage = val;
|
this.queryInfo();
|
},
|
},
|
};
|
</script>
|
<style lang="less" scoped>
|
//@import url(); 引入公共css类
|
.authorityManagement_box {
|
background: rgb(240, 242, 245);
|
border-radius: 10px;
|
height: 100%;
|
padding: 10px;
|
box-sizing: border-box;
|
.inquire {
|
position: relative;
|
height: 50px;
|
overflow: auto;
|
padding: 8px;
|
margin-top: 20px;
|
background: #fff;
|
border-radius: 5px;
|
border: 1px solid rgb(202, 201, 204);
|
margin-bottom: 20px;
|
.el-form-item {
|
margin: 5px;
|
}
|
}
|
.bottom {
|
width: 100%;
|
height: 83%;
|
.rightTable {
|
height: 100%;
|
width: 100%;
|
.table_box {
|
width: 100%;
|
height: 93%;
|
margin: 0 auto;
|
overflow: auto;
|
background: #fff;
|
.el-table {
|
height: 100%;
|
// overflow: auto;
|
}
|
.el-table /deep/ .el-table__header-wrapper tr th {
|
background-color: rgb(255, 255, 255) !important;
|
color: rgb(0, 0, 0);
|
}
|
// 修改每行样式:
|
.el-table /deep/ .el-table__row {
|
background-color: rgba(255, 255, 255) !important;
|
color: rgb(0, 0, 0);
|
}
|
.el-table /deep/ .el-table__body tr.current-row > td {
|
background-color: rgb(211, 211, 211) !important;
|
}
|
.el-table /deep/ .el-table__body tr:hover > td {
|
background-color: rgb(211, 211, 211) !important;
|
}
|
// 修改表格每行边框的样式:
|
.el-table /deep/ td,
|
.el-table /deep/ th.is-leaf {
|
border-bottom: 1px solid #eee;
|
border-right: 1px solid #eee;
|
}
|
.el-table /deep/ .el-table__cell {
|
padding: 0;
|
}
|
// 设置表格每行的高度:
|
.el-table /deep/ .el-table__header tr,
|
.el-table /deep/ .el-table__header th {
|
height: 40px;
|
}
|
.el-table__body tr,
|
.el-table__body td {
|
height: 40px;
|
padding: 0;
|
}
|
// 设置表格边框颜色:
|
|
.el-table--border::after,
|
.el-table--group::after {
|
width: 0;
|
}
|
.el-table::before {
|
height: 0;
|
}
|
// a {
|
// color: #000;
|
// }
|
}
|
}
|
}
|
.infoBox {
|
width: 500px;
|
border: 1px solid #eee;
|
position: absolute;
|
z-index: 100;
|
top: 15%;
|
right: 25%;
|
background-color: #fff;
|
.el-card {
|
background-color: transparent;
|
span {
|
font-size: 16px;
|
font-weight: 600;
|
}
|
}
|
.contentBox {
|
margin: 0 aotu 10px;
|
height: 600px;
|
overflow: auto;
|
p {
|
// background-color: #bfa;
|
// margin-bottom: 10px;
|
font-size: 14px;
|
}
|
}
|
}
|
/deep/ .el-dialog {
|
// width: 500px !important;
|
// margin-top: 10vh !important;
|
}
|
|
/deep/.el-dialog .el-input__inner {
|
width: 300px;
|
}
|
/deep/ .el-dialog__body {
|
padding: 0px 30px;
|
}
|
/deep/ .el-dialog__footer {
|
padding-top: 0 !important;
|
width: 200px;
|
display: flex;
|
margin: 0 auto;
|
justify-content: center;
|
}
|
.dotClass {
|
width: 10px;
|
height: 10px;
|
border-radius: 50%;
|
display: block;
|
margin-left: 10px; //这个用于圆点居中
|
}
|
.downloadBox {
|
position: absolute;
|
top: 20%;
|
left: 50%;
|
padding: 20px;
|
background-color: #fff;
|
width: 20%;
|
border: 1px solid #000;
|
border-radius: 10px;
|
}
|
}
|
</style>
|