| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- <template>
- <div>
- <el-row>
- <el-col :span="4">
- <div class="box">
- <el-scrollbar>
- <basic-container>
- <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick">
- <span class="el-tree-node__label" slot-scope="{ node, data }">
- <span>
- <i class="el-icon-office-building"></i>
- {{ (node || {}).label }}
- </span>
- </span>
- </avue-tree>
- </basic-container>
- </el-scrollbar>
- </div>
- </el-col>
- <el-col :span="20">
- <basic-container>
- <avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="form"
- :page.sync="page" :permission="permissionList" @search-change="searchChange"
- @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
- @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
- <template slot-scope="scope" slot="menu">
- <el-button type="text" icon="el-icon-view" size="small"
- @click.stop="handlePreview(scope.row)">查看年报
- </el-button>
- </template>
- </avue-crud>
- </basic-container>
- </el-col>
- </el-row>
- <el-drawer :visible.sync="monthCounDialog" v-if="monthCounDialog" title="年报" direction="rtl" size="60%"
- append-to-body="true">
- <consumerwaterflowyearcountdetailVue ref="consumerwaterflowyearcountdetail" :wiuCd="wiuCd">
- </consumerwaterflowyearcountdetailVue>
- </el-drawer>
- </div>
- </template>
- <script>
- import { getPage } from "@/api/baseinfo/wateruseconsumer.js";
- import { getTree } from "@/api/baseinfo/org";
- import { mapGetters } from "vuex";
- import consumerwaterflowyearcountdetailVue from './consumerwaterflowyearcountdetail.vue'
- export default {
- components: {
- consumerwaterflowyearcountdetailVue
- },
- data() {
- return {
- form: {},
- selectionList: [],
- query: {},
- loading: true,
- monthCounDialog: false,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- wiuCd: '',
- treeCode: '',
- treeParentCode: '',
- treeData: [],
- treeOption: {
- nodeKey: "id",
- defaultExpandedKeys: [],
- lazy: false,
- // treeLoad: function (node, resolve) {
- // const parentCode = (node.level === 0) ? "" : node.data.id;
- // getLazyDeptTree(parentCode, {}).then(res => {
- // resolve(res.data.data.map(item => {
- // return {
- // ...item,
- // leaf: !item.hasChildren
- // }
- // }))
- // });
- // },
- addBtn: false,
- menu: true,
- size: "small",
- props: {
- labelText: "标题",
- label: "title",
- value: "value",
- children: "children",
- },
- },
- option: {
- labelWidth: 140,
- viewLabelWidth: 140,
- searchLabelWidth: 140,
- height: 'auto',
- calcHeight: 30,
- tip: false,
- searchShow: true,
- searchMenuSpan: 6,
- border: true,
- index: true,
- selection: true,
- viewBtn: false,
- menu: true,
- dialogClickModal: false,
- column: [
- {
- label: "取用水户代码",
- prop: "wiuCd",
- search: true,
- span: 24,
- },
- {
- label: "取用水户名称",
- prop: "wiuNm",
- search: true,
- span: 24,
- },
- {
- label: "行政区",
- prop: "orgName",
- span: 24,
- },
- {
- label: "法人代表",
- prop: "lrNm",
- span: 24,
- },
- ]
- },
- data: []
- };
- },
- computed: {
- ...mapGetters(["userInfo", "permission"]),
- permissionList() {
- return {
- addBtn: false,
- viewBtn: false,
- delBtn: false,
- editBtn: false
- };
- },
- ids() {
- let ids = [];
- this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(",");
- }
- },
- created() {
- this.initTree();
- },
- methods: {
- initTree() {
- this.treeData = [];
- getTree().then(res => {
- this.treeData = res.data.data.map(item => {
- return {
- ...item,
- leaf: !item.hasChildren
- }
- })
- this.treeOption.defaultExpandedKeys.push(this.treeData[0].id);
- this.treeCode = this.treeData[0].id;
- this.query = {};
- this.query['orgId'] = this.treeCode;
- });
- },
- nodeClick(data) {
- this.treeCode = data.id;
- this.excludeCode = data.exclude;
- this.treeParentCode = data.parentId;
- this.query = {};
- this.query['orgId'] = this.treeCode;
- this.page.currentPage = 1;
- var params = {};
- this.onLoad(this.page, params);
- },
- handlePreview(row) {
- this.wiuCd = row.wiuCd;
- this.monthCounDialog = true;
- this.$nextTick(() => {
- this.$refs["consumerwaterflowyearcountdetail"].init();
- });
- },
- searchReset() {
- this.query = {};
- this.onLoad(this.page);
- },
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
- },
- currentChange(currentPage) {
- this.page.currentPage = currentPage;
- },
- sizeChange(pageSize) {
- this.page.pageSize = pageSize;
- },
- refreshChange() {
- this.onLoad(this.page, this.query);
- },
- onLoad(page, params = {}) {
- this.loading = true;
- getPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
- const data = res.data.data;
- this.page.total = data.total;
- this.data = data.records;
- this.loading = false;
- this.selectionClear();
- });
- }
- }
- };
- </script>
- <style></style>
|