123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437 |
- <template>
- <div class="container">
- <div class="header">
- <el-menu
- :default-active="activeIndex"
- class="el-menu-demo"
- mode="horizontal"
- @select="handleSelect"
- >
- <el-menu-item
- v-for="(item, index) in indexList"
- :key="index"
- :index="item.id+''"
- >
- <el-button round>{{item.name}}</el-button>
- </el-menu-item>
- </el-menu>
- </div>
- <div class="left-pane">
- <el-input
- placeholder="请输入关键字"
- suffix-icon="el-icon-search"
- v-model="filterText"
- ></el-input>
- <div class="tree_container">
- <el-tree
- ref="tree"
- :data="indexSecondList"
- :props="defaultProps"
- node-key="id"
- default-expand-all
- :filter-node-method="filterNode"
- @node-click="handleNodeClick"
- >
- <span slot-scope="{node}">
- <span style="padding-left: 10px; vertical-align: text-bottom;">{{ node.label }}</span>
- </span>
- </el-tree>
- </div>
- </div>
- <div
- class="right-pane"
- v-if="tableData.length!=0"
- >
- <div>
- <p class="info">{{selectedIndexItem.name}}</p>
- <!-- <el-button class="new_button">新建</el-button> -->
- </div>
- <el-table
- ref="multipleTable"
- :data="tableData"
- tooltip-effect="dark"
- :header-cell-style="{ textAlign: 'center' }"
- :cell-style="{ textAlign: 'center' }"
- style="width: 100%"
- >
- <!-- @selection-change="handleSelectionChange" -->
- <!-- <el-table-column
- type="selection"
- width="50"
- >
- </el-table-column> -->
- <el-table-column
- prop="name"
- label="指标名称"
- >
- </el-table-column>
- <!-- <el-table-column
- prop="indexUnit"
- label="指标单位"
- >
- </el-table-column> -->
- <el-table-column
- prop="defaultValue"
- label="默认值"
- >
- </el-table-column>
- <el-table-column
- prop="compare"
- label="比较值"
- >
- </el-table-column>
- <el-table-column
- prop="rule"
- label="计算规则"
- >
- </el-table-column>
- <el-table-column
- prop="operation"
- label="操作"
- >
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- @click="edit(scope.row)"
- >编辑</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="bottom">
- <page
- class="page"
- :paginationData="paginationData"
- ></page>
- </div>
- <editDialog
- ref="editDialog"
- v-bind="{
- update:getSecondListAfterUpdate,
- beforeFrom:selectedSingleIndex
- }"
- ></editDialog>
- </div>
- </template>
- <script>
- import page from "@/components/pagination/index";
- // import dropdown from "@/components/Dropdown/index";
- import editDialog from "./dialog/editDialog.vue";
- import api from "@/api/systemConfig/api";
- export default {
- components: {
- editDialog,
- page,
- // dropdown,
- },
- data() {
- return {
- total: 0,
- filterText: "",
- show: true,
- value: "test",
- activeIndex: "1",
- indexList: [],
- indexSecondList: [],
- defaultProps: {
- children: "children",
- label: "name",
- },
- selectedIndexItem: null,
- tableData: [],
- selectedSingleIndex: null,
- paginationData: {
- pageSize: 10,
- pagerCount: 5,
- currentPage: 1,
- pageSizes: [5, 10, 20, 30],
- total: 0,
- currentChange: (val) => {
- this.handlePageChange(val);
- },
- handleSizeChange: (val) => {
- this.handleSizeChange(val);
- },
- },
- };
- },
- mounted() {
- this.getIndexList();
- },
- watch: {
- filterText(val) {
- this.$refs.tree.filter(val);
- },
- },
- methods: {
- filterNode(value, data) {
- if (!value) return true;
- return data.name.indexOf(value) !== -1;
- },
- handleSelect(key, keyPath) {
- this.activeIndex = key;
- this.indexSecondList =
- this.indexList[Number(this.activeIndex) - 1].children;
- },
- handleNodeClick(data, node) {
- this.selectedIndexItem = data;
- this.resetPageConfig();
- this.handlePageChange(1);
- },
- handlePageChange(val) {
- this.paginationData.currentPage = val;
- this.getSecondList({
- parent_id: this.selectedIndexItem.id,
- page_size: this.paginationData.pageSize,
- page: val,
- })
- .then((result) => {})
- .catch((err) => {});
- },
- handleSizeChange(val) {
- this.paginationData.pageSize = val;
- this.getSecondList({
- parent_id: this.selectedIndexItem.id,
- page_size: val,
- page: this.paginationData.currentPage,
- })
- .then((result) => {})
- .catch((err) => {});
- },
- resetPageConfig(obj) {
- let t = {
- pageSize: 10,
- pagerCount: 5,
- currentPage: 1,
- pageSizes: [5, 10, 20, 30],
- total: 30,
- currentChange: (val) => {
- this.handlePageChange(val);
- },
- handleSizeChange: (val) => {
- this.handleSizeChange(val);
- },
- };
- if (obj != null || obj != undefined) {
- for (const key in obj) {
- t[key] = obj[key];
- }
- this.paginationData = t;
- }
- },
- getIndexList() {
- let that = this;
- return new Promise((resolve, reject) => {
- api
- .getIndexList({ id: -1 })
- .then((result) => {
- that.indexList = result.data.data.data;
- that.indexSecondList =
- that.indexList[Number(that.activeIndex) - 1].children;
- resolve();
- })
- .catch((err) => {});
- });
- },
- getSecondList(param) {
- let that = this;
- return new Promise((resolve, reject) => {
- api
- .getIndexSecondList(param)
- .then((result) => {
- that.tableData = result.data.data.data.list;
- that.paginationData.total = result.data.data.data.total
- // "compare": null,
- // "defaultValue": "0",
- // "id": 4,
- // "isDel": 0,
- // "name": "\u4eca\u65e5\u79bb\u5f00\u5927\u697c(\u4eba)",
- // "parentId": 7,
- // "remark": null,
- // "rule": null,
- // "units": "",
- // "useSite": null
- })
- .catch((err) => {});
- });
- },
- getSecondListAfterUpdate() {
- this.resetPageConfig({
- currentPage: 1,
- });
- this.handlePageChange(1);
- },
- edit(data) {
- this.$refs.editDialog.dialogVisible = true;
- this.selectedSingleIndex = data;
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .container {
- position: relative;
- width: 100%;
- height: 100%;
- line-height: 20px;
- background-color: rgba(255, 255, 255, 1);
- color: rgba(16, 16, 16, 1);
- font-size: 14px;
- .header {
- .el-menu-item {
- font-size: 16px;
- }
- .el-menu.el-menu--horizontal {
- border-bottom: 0px solid #e6e6e6;
- .el-menu-item {
- border-bottom: 0px;
- padding-left: 10px;
- padding-right: 10px;
- .el-button {
- color: #606266;
- border-color: #ebebeb;
- border: 1px solid #ebebeb;
- }
- }
- > .el-menu-item.is-active {
- border-bottom: 0px;
- .el-button {
- color: #ffffff;
- border-color: #2ea8e6;
- background-color: #2ea8e6;
- }
- }
- }
- }
- .left-pane {
- width: 300px;
- padding: 15px;
- height: calc(100% - 90px);
- display: inline-block;
- .tree_container {
- height: calc(100% - 45px);
- margin-top: 10px;
- margin-bottom: 10px;
- overflow: hidden;
- overflow-y: auto;
- .el-tree {
- height: 100%;
- background-color: #fafafa;
- /deep/.el-tree-node__content {
- align-items: center;
- height: 30px;
- cursor: pointer;
- font-size: 16px;
- position: relative;
- color: #999999;
- padding-top: 10px;
- padding-left: 30px !important;
- .operate_btns {
- position: absolute;
- right: 20px;
- display: none;
- }
- &:hover,
- :focus-within {
- background-color: #f7fbff;
- .operate_btns {
- display: inline;
- }
- }
- }
- /deep/.el-tree-node__children {
- .el-tree-node__content {
- padding-left: 60px !important;
- }
- }
- }
- }
- }
- .right-pane {
- box-sizing: border-box;
- padding: 15px;
- width: calc(100% - 330px);
- height: calc(100% - 120px);
- display: inline-block;
- vertical-align: top;
- .info {
- text-align: left;
- padding: 10px;
- font-size: 25px;
- }
- .new_button {
- padding: 5px;
- width: 100px;
- position: relative;
- left: 42%;
- text-align: center;
- font-size: 16px;
- color: #fff;
- background: #3da0d6;
- }
- .el-table {
- margin-top: 10px;
- }
- .el-select {
- width: 80px;
- margin-right: 20px;
- }
- }
- .bottom {
- position: absolute;
- left: 345px;
- right: 16px;
- bottom: 30px;
- height: 50px;
- line-height: 20px;
- text-align: center;
- .checkbox {
- position: absolute;
- left: 30px;
- top: 15px;
- font-size: 14px;
- }
- .check-cancel {
- position: absolute;
- // line-height: 20px;
- font-size: 14px;
- text-align: center;
- left: 140px;
- top: 10px;
- }
- }
- }
- </style>
|