| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787 |
- <!--
- * @Title:
- * @Description:
- * @Author: swp
- * @Date: 2022-08-24 10:49:21
- * @LastEditors:
- * @LastEditTime: 2022-08-24 10:49:21
- -->
- <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" :page.sync="page"
- :before-open="beforeOpen" ref="crud" v-model="form" :permission="permissionList" @row-del="rowDel"
- @row-update="rowUpdate" @row-save="rowSave" @search-change="searchChange"
- @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
- @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"
- @before-open="beforeOpen" @select-change="selectChange">
- <template slot-scope="scope" slot="menuLeft">
- <el-button v-if="permissionList.importBtn" type="primary" icon="el-icon-upload2" size="small"
- @click="toRtuImpoartHandler">导入测站</el-button>
- <el-button v-if="permissionList.importBtn" type="primary" icon="el-icon-finished" size="small"
- @click="toRtuImportHistoryHandler">测站导入历史</el-button>
- <el-button v-if="permissionList.importBtn" type="primary" icon="el-icon-download" size="small"
- @click="downloadTemplate">测站信息模板下载</el-button>
- <!-- <el-button v-if="permissionList.videoSiteAdd" type="primary" icon="el-icon-plus" size="small"
- @click="toAddVideoSite">添加视频站</el-button> -->
- </template>
- </avue-crud>
- </basic-container>
- </el-col>
- </el-row>
- <el-drawer :visible.sync="rtuImportHistoryDialog" v-if="rtuImportHistoryDialog" title="测站导入操作记录" direction="rtl"
- size="60%" append-to-body="true">
- <rtuImportHistoryView ref="rtuImportHistoryView"></rtuImportHistoryView>
- </el-drawer>
- <el-dialog title="测站导入向导" :visible.sync="rtuImportDialog" width="60%" height="60%" :close-on-click-modal="false"
- append-to-body :v-loading="importLoading" v-if="rtuImportDialog">
- <rtuImportView :importLoading="importLoading" :visible.sync="rtuImportDialog" ref="rtuImportView">
- </rtuImportView>
- </el-dialog>
- <!-- <el-dialog title="添加视频站" :visible.sync="videoSiteAddDialog" width="60%" height="60%" :close-on-click-modal="false"
- append-to-body :v-loading="importLoading" v-if="videoSiteAddDialog">
- <videositeadd :importLoading="importLoading" :visible.sync="videoSiteAddDialog" ref="videositeadd"
- @fevent="update_table">
- </videositeadd>
- </el-dialog> -->
- </div>
- </template>
- <script>
- import { getPage, getDetail, add, update, remove } from "@/api/baseinfo/rtu.js";
- import { getTree } from "@/api/baseinfo/region.js";
- import { mapGetters } from "vuex";
- import rtuImportHistoryView from './rtuimport.vue';
- import rtuImportView from './rtuImportProcess.vue';
- import videositeadd from './videositeadd.vue';
- export default {
- components: {
- rtuImportView,
- rtuImportHistoryView,
- videositeadd
- },
- data() {
- return {
- importLoading: false,
- rtuImportDialog: false,
- rtuImportHistoryDialog: false,
- videoSiteAddDialog: false,
- id: "",
- form: {},
- selectionList: [],
- query: {},
- loading: true,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- },
- treeCode: '',
- treeParentCode: '',
- treeData: [],
- treeOption: {
- nodeKey: "id",
- defaultExpandedKeys: [],
- lazy: false,
- // treeLoad: function (node, resolve) {
- // const parentCode = (node.level === 0) ? "00" : node.data.value;
- // getLazyTree(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: 80,
- align: "center",
- headerAlign: "center",
- lazy: false,
- tip: false,
- simplePage: true,
- searchShow: true,
- searchMenuSpan: 6,
- tree: true,
- border: true,
- index: true,
- selection: false,
- viewBtn: true,
- viewTitle: "测站信息",
- editBtn: true,
- delBtn: true,
- addBtn: true,
- addBtnText: "添加测站",
- menuWidth: 220,
- dialogType: "drawer",
- dialogClickModal: false,
- columnBtn: false,
- column: [
- {
- label: "站点编码",
- prop: "rtuCode",
- search: true,
- span: 24,
- width: 120,
- // tip: '*编码仅支持字母+数字的编码组合,长度为20个字符',
- rules: [
- {
- required: true,
- message: "请录入站点编码",
- trigger: "click",
- },
- ],
- },
- {
- label: "站点名称",
- prop: "rtuName",
- search: true,
- span: 24,
- rules: [
- {
- required: true,
- message: "请录入站点名称",
- trigger: "click",
- },
- ],
- },
- {
- label: "测站类型",
- prop: "rtuKindDesc",
- span: 24,
- editDisplay: false,
- addDisplay: false,
- display: false,
- },
- {
- label: '测站类型',
- prop: 'rtuKind',
- type: 'select',
- hide: true,
- editDisplay: false,
- addDisplay: false,
- display: false,
- search: true,
- props: {
- label: 'name',
- value: 'code'
- },
- span: 6,
- dicData: [{
- name: '雨量站',
- code: 1
- }, {
- name: '水位站',
- code: 2
- }, {
- name: '墒情站',
- code: 3
- }, {
- name: '视频站',
- code: 4
- }],
- },
- {
- label: '测站类型',
- prop: 'siteKind',
- type: 'checkbox',
- hide: true,
- props: {
- label: 'name',
- value: 'code'
- },
- span: 24,
- dicData: [{
- name: '雨量站',
- code: "1"
- }, {
- name: '水位站',
- code: "2"
- }, {
- name: '墒情站',
- code: "3"
- }, {
- name: '视频站',
- code: "4"
- }],
- rules: [
- {
- message: "请选择站点类型",
- trigger: "click",
- required: true,
- },
- ],
- },
- {
- label: "盟市",
- prop: "adCity",
- span: 24,
- editDisplay: false,
- addDisplay: false,
- },
- {
- label: "盟市",
- prop: "adCityCode",
- span: 24,
- hide: true,
- type: 'select',
- props: {
- label: 'adnm',
- value: 'adcd'
- },
- cascader: ['adCode'],
- dicUrl: `api/galaxy-business/baseinfo/region/children/list`,
- rules: [
- {
- required: true,
- message: "请录入盟市名称",
- trigger: "click",
- },
- ],
- },
- {
- label: "旗县区",
- prop: "adDist",
- span: 24,
- editDisplay: false,
- addDisplay: false,
- },
- {
- label: "旗县区",
- prop: "adCode",
- span: 24,
- hide: true,
- type: 'select',
- props: {
- label: 'adnm',
- value: 'adcd'
- },
- dicUrl: `api/galaxy-business/baseinfo/region/children/list/{{adCityCode}}`,
- rules: [
- {
- required: true,
- message: "请录入旗县区",
- trigger: "click",
- },
- ],
- },
- {
- label: "运维单位",
- prop: "manageCompany",
- span: 24,
- },
- {
- label: "经度",
- prop: "lng",
- span: 12,
- hide: true,
- },
- {
- label: "纬度",
- prop: "lat",
- span: 12,
- hide: true,
- },
- {
- label: "测站位置",
- prop: "locationDesc",
- span: 24,
- overHidden: true,
- hide: true,
- },
- // {
- // label: "是否雨量站",
- // prop: "isRain",
- // span: 8,
- // hide: true,
- // editDisplay: false,
- // addDisplay: false
- // },
- // {
- // label: "是否河道站",
- // prop: "isRiver",
- // span: 8,
- // hide: true,
- // editDisplay: false,
- // addDisplay: false
- // },
- // {
- // label: "是否水库站",
- // prop: "isRes",
- // span: 8,
- // hide: true,
- // editDisplay: false,
- // addDisplay: false
- // },
- // {
- // label: "是否墒情站",
- // prop: "isGround",
- // span: 8,
- // hide: true,
- // editDisplay: false,
- // addDisplay: false
- // },
- // {
- // label: "是否视频站",
- // prop: "isVideo",
- // span: 8,
- // hide: true,
- // editDisplay: false,
- // addDisplay: false
- // },
- {
- label: "RTU品牌",
- prop: "rtuBrand",
- span: 24,
- hide: true,
- },
- {
- label: "RTU型号",
- prop: "rtuModel",
- span: 24,
- hide: true,
- },
- {
- label: "RTU更换时间",
- prop: "rtuReplaceDate",
- span: 24,
- hide: true,
- type: "date",
- valueFormat: 'yyyy-MM-dd',
- },
- {
- label: "雨量传感器品牌",
- prop: "rainSensorBrand",
- span: 24,
- hide: true,
- },
- {
- label: "雨量传感器型号",
- prop: "rainSensorModel",
- span: 24,
- hide: true,
- },
- {
- label: "雨量传感器更换时间",
- prop: "rainSensorReplaceDate",
- span: 24,
- hide: true,
- type: "date",
- valueFormat: 'yyyy-MM-dd',
- },
- {
- label: "水位计传感器品牌",
- prop: "waterSensorBrand",
- span: 24,
- hide: true,
- },
- {
- label: "水位计传感器型号",
- prop: "waterSensorModel",
- span: 24,
- hide: true,
- },
- {
- label: "水位计传感器类型",
- prop: "waterSensorType",
- span: 24,
- hide: true,
- type: 'radio',
- // dicData: [{
- // label: '雷达',
- // value: 1
- // }, {
- // label: '超声波',
- // value: 2
- // }],
- props: {
- label: 'dictValue',
- value: 'id'
- },
- dicUrl: '/api/galaxy-system/dict-biz/dictionary?code=water_level_sensor_type',
- },
- {
- label: "水位计传感器更换时间",
- prop: "waterSensorReplaceDate",
- span: 24,
- hide: true,
- type: "date",
- valueFormat: 'yyyy-MM-dd',
- },
- {
- label: "墒情传感器品牌",
- prop: "groundSensorBrand",
- span: 24,
- hide: true,
- },
- {
- label: "墒情传感器型号",
- prop: "groundSensorModel",
- span: 24,
- hide: true,
- },
- {
- label: "墒情传感器类型",
- prop: "groundSensorType",
- span: 24,
- hide: true,
- type: 'radio',
- // dicData: [{
- // label: '插针式',
- // value: 1
- // }, {
- // label: '导管式',
- // value: 2
- // }],
- props: {
- label: 'dictValue',
- value: 'id'
- },
- dicUrl: '/api/galaxy-system/dict-biz/dictionary?code=ground_water_sensor_type',
- },
- {
- label: "墒情传感器更换时间",
- prop: "groundSensorReplaceDate",
- span: 24,
- hide: true,
- type: "date",
- valueFormat: 'yyyy-MM-dd',
- },
- {
- label: "供电系统电池型号",
- prop: "batteryModel",
- span: 24,
- hide: true,
- },
- {
- label: "供电系统电池更换时间",
- prop: "batteryReplaceDate",
- span: 24,
- hide: true,
- type: "date",
- valueFormat: 'yyyy-MM-dd',
- },
- {
- label: "太阳能板型号",
- prop: "sunPowerModel",
- span: 24,
- hide: true,
- },
- {
- label: "太阳能控制器品牌",
- prop: "sunPowerControllerBrand",
- span: 24,
- hide: true,
- },
- {
- label: "太阳能控制器型号",
- prop: "sunPowerControllerModel",
- span: 24,
- hide: true,
- },
- {
- label: "SIN卡号",
- prop: "networkSimId",
- span: 24,
- hide: true,
- },
- {
- label: "开卡单位",
- prop: "networkPayer",
- span: 24,
- hide: true,
- },
- {
- label: "缴费截止时间",
- prop: "networkPayEndDate",
- span: 24,
- hide: true,
- type: "date",
- valueFormat: 'yyyy-MM-dd',
- },
- {
- label: "是否北斗通信",
- prop: "isSatellite",
- span: 24,
- hide: true,
- type: 'radio',
- dicData: [{
- label: '否',
- value: 0
- }, {
- label: '是',
- value: 1
- }],
- },
- {
- label: "北斗通讯类型",
- prop: "satelliteModel",
- span: 24,
- hide: true,
- type: 'radio',
- // dicData: [{
- // label: '北斗2代',
- // value: 1
- // }, {
- // label: '北斗3代',
- // value: 2
- // }],
- props: {
- label: 'dictValue',
- value: 'id'
- },
- dicUrl: '/api/galaxy-system/dict-biz/dictionary?code=satellite_model',
- },
- {
- label: "备注说明",
- prop: "remark",
- span: 24,
- type: "textarea",
- hide: true
- },
- ],
- },
- data: [],
- };
- },
- computed: {
- ...mapGetters(["userInfo", "permission"]),
- permissionList() {
- return {
- addBtn: this.vaildData(this.permission.rtu_add, false),
- viewBtn: this.vaildData(this.permission.rtu_view, false),
- delBtn: this.vaildData(this.permission.rtu_del, false),
- editBtn: this.vaildData(this.permission.rtu_edit, false),
- importBtn: this.vaildData(this.permission.rtu_import, false),
- videoSiteAdd: this.vaildData(this.permission.video_site_add, false),
- };
- },
- },
- created() {
- this.initTree();
- },
- beforeDestroy() {
- },
- 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;
- });
- },
- update_table() {
- this.onLoad(this.page, this.query);
- },
- toRtuImpoartHandler() {
- this.rtuImportDialog = true;
- },
- toRtuImportHistoryHandler() {
- this.rtuImportHistoryDialog = true;
- },
- toAddVideoSite() {
- this.videoSiteAddDialog = true;
- this.$nextTick(() => {
- this.$refs["videositeadd"].init();
- });
- },
- downloadTemplate() {
- window.open('/file/download/template/站点信息记录表模板.xlsx')
- },
- nodeClick(data) {
- this.treeCode = data.id;
- this.treeParentCode = data.parentId;
- this.query = {};
- this.query['adCode'] = this.treeCode;
- this.page.currentPage = 1;
- var params = {};
- this.onLoad(this.page, params);
- },
- searchReset() {
- this.query = {};
- this.query['adCode'] = this.treeCode;
- this.page.currentPage = 1;
- this.onLoad(this.page);
- },
- searchChange(params, done) {
- this.query = params;
- this.query['adCode'] = this.treeCode;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
- },
- currentChange(currentPage) {
- console.log("currentPage " + currentPage);
- this.page.currentPage = currentPage;
- },
- sizeChange(pageSize) {
- this.page.pageSize = pageSize;
- },
- refreshChange() {
- var params = {};
- this.onLoad(this.page, params);
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- selectChange(item) {
- console.log(JSON.stringify(item));
- },
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
- },
- rowSave(row, done, loading) {
- console.log(JSON.stringify(row))
- add(row).then(
- () => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!",
- });
- done();
- },
- (error) => {
- window.console.log(error);
- loading();
- }
- );
- },
- rowUpdate(row, index, done, loading) {
- update(row).then(
- () => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!",
- });
- done();
- },
- (error) => {
- window.console.log(error);
- loading();
- }
- );
- },
- rowDel(row) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- return remove(row.id);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!",
- });
- });
- },
- handleDelete() {
- if (this.selectionList.length === 0) {
- this.$message.warning("请选择至少一条数据");
- return;
- }
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- return remove(this.ids);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!",
- });
- this.$refs.crud.toggleSelection();
- });
- },
- beforeOpen(done, type) {
- if (["edit", "view"].includes(type)) {
- getDetail(this.form.id).then((res) => {
- this.form = res.data.data;
- });
- }
- done();
- },
- 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>
- .box {
- height: 800px;
- }
- .el-scrollbar {
- height: 100%;
- }
- .box .el-scrollbar__wrap {
- overflow: scroll;
- }
- </style>
|