89d12179 by renchao@pashanhoo.com

style:table配置话

1 parent 0d80b7e5
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-27 13:25:25
* @LastEditTime: 2023-03-27 15:43:24
-->
# 安装依赖
npm install
......@@ -22,3 +22,14 @@ npm install --registry=https://registry.npm.taobao.org
## 项目换肤
给html根标签设置一个data-theme属性,然后通过js切换data-theme的属性值,Scss根据此属性来判断使用对应主题变量
## config说明
{
"TITLE": "汉中市数据上报系统",
"THEME": "sb",
"CODE": "BDCJGPT", {"BDCSBPT":上报: "BDCJGPT":监管}
"SERVERAPI": "/bdcsjsb",
"calcHeight": 200, {上报:160 监管:200}
"MANAGEMENTAPI": "http://192.168.2.38:8090/management"
}
\ No newline at end of file
......
......@@ -3,5 +3,6 @@
"THEME": "sb",
"CODE": "BDCJGPT",
"SERVERAPI": "/bdcsjsb",
"calcHeight": 160,
"MANAGEMENTAPI": "http://192.168.2.38:8090/management"
}
\ No newline at end of file
......
......@@ -139,11 +139,25 @@ export default {
let _this = this
if (this.heightNum) {
_this.$nextTick(() => {
if (document.querySelector(".tags-view-container")) {
window.addEventListener('resize', () => {
if (_this.calcHeight == 230) {
_this.tableHeight = _this.calcHeightx(192)
} else {
_this.tableHeight = _this.calcHeightx(_this.calcHeight)
}
});
if (_this.calcHeight == 230) {
_this.tableHeight = _this.calcHeightx(192)
} else {
_this.tableHeight = _this.calcHeightx(_this.calcHeight)
}
} else {
window.addEventListener('resize', () => {
_this.tableHeight = _this.calcHeightx(_this.calcHeight)
});
_this.tableHeight = _this.calcHeightx(_this.calcHeight)
}
})
} else {
_this.tableHeight = window.innerHeight - _this.heightNum
......@@ -158,9 +172,15 @@ export default {
calcHeightx (value, wappered = true) {
//项目自定义的公共header部分的高度,可忽略
let header = document.querySelector(".from-clues-header").offsetHeight;
//value为动态计算table界面高度时,减去的其他空白部分,需自行在调试找到临界值,剩下的就是table表格的高度(包含header+body部分)
value = value == undefined ? 100 : value;
let res = window.innerHeight - parseInt(header) - value;
if (document.querySelector(".tags-view-container")) {
let tagsView = document.querySelector(".tags-view-container").offsetHeight;
var res = window.innerHeight - parseInt(header) - value - parseInt(tagsView);
} else {
var res = window.innerHeight - parseInt(header) - value;
}
if (wappered) {
//通过原生方法,获取dom节点的高度------获取element-ui table表格body的元素
let wapper = window.document.getElementsByClassName('el-table__body-wrapper');
......
......@@ -194,12 +194,12 @@ export default {
@import "~@/styles/_handle.scss";
.tags-view-container {
height: 40px;
height: 50px;
width: 100%;
background: #fff;
border-bottom: 1px solid #d8dce5;
box-sizing: border-box;
padding-top: 2px;
padding-top: 7px;
margin-bottom: 7px;
border-radius: 4px;
......
......@@ -17,7 +17,7 @@
&-header {
width: 100%;
padding: 7px 15px 10px 15px;
padding: 7px 15px 15px 15px;
box-sizing: border-box;
background-size: 100% 100%;
background: #FFFFFF;
......
......@@ -4,7 +4,7 @@
<!-- 头部搜索 -->
<div class="from-clues-header">
<el-form ref="ruleForm" :model="form" label-width="100px">
<el-form-item v-if="BASE_API.THEME=='jg'">
<el-form-item v-if="BASE_API.THEME == 'jg'">
<Breadcrumb />
</el-form-item>
<el-row class="mb-5">
......
......@@ -19,7 +19,7 @@
</el-form>
</div>
<div class="from-clues-content">
<lb-table :pagination="false" :column="tableData.columns" :calcHeight="200" :data="tablelistData" row-key="id"
<lb-table :pagination="false" :column="tableData.columns" :calcHeight="BASE_API.calcHeight" :data="tablelistData" row-key="id"
default-expand-all :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
</lb-table>
......
......@@ -2,7 +2,7 @@
<div class="timedTask from-clues">
<div class="from-clues-header">
<el-form ref="ruleForm" :model="form" label-width="100px">
<el-form-item v-if="BASE_API.THEME=='jg'">
<el-form-item v-if="BASE_API.THEME == 'jg'">
<Breadcrumb />
</el-form-item>
<el-row class="mb-5">
......@@ -19,7 +19,7 @@
</el-form>
</div>
<div class="from-clues-content">
<lb-table :pagination="false" @size-change="handleSizeChange" :calcHeight="200"
<lb-table :pagination="false" @size-change="handleSizeChange" :calcHeight="BASE_API.calcHeight"
@p-current-change="handleCurrentChange" :column="tableData.columns" :data="listdata" :expand-row-keys="keyList"
row-key="dictid">
</lb-table>
......
......@@ -2,7 +2,7 @@
<div class="timedTask from-clues">
<div class="from-clues-header">
<el-form ref="ruleForm" :model="form" label-width="100px">
<el-form-item v-if="BASE_API.THEME=='jg'">
<el-form-item v-if="BASE_API.THEME == 'jg'">
<Breadcrumb />
</el-form-item>
<el-row class="mb-5">
......@@ -31,7 +31,8 @@
</div>
<div class="from-clues-content">
<lb-table :pagination="false" @size-change="handleSizeChange" @p-current-change="handleCurrentChange"
:column="tableData.columns" :calcHeight="200" :data="tableData.data" :expand-row-keys="keyList" row-key="dictid">
:column="tableData.columns" :calcHeight="BASE_API.calcHeight" :data="tableData.data" :expand-row-keys="keyList"
row-key="dictid">
</lb-table>
</div>
<EditDialog ref="dialogForm" v-model="isDialog" @ok="reloadTableData" />
......@@ -408,5 +409,5 @@ export default {
};
</script>
<style scoped lang="scss">
@import "~@/styles/mixin.scss";
@import "~@/styles/mixin.scss";
</style>
......