| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 |
- <template>
- <el-row class="el-row-container" style="height: 100%" v-loading="loading">
- <el-col
- :span="4"
- style="height:100%;padding-bottom:32px;"
- >
- <el-card style="margin:16px;height: 100%; overflow-y: auto">
- <data-report-left
- @setCurrentData="setCurrentData"
- :treeData="treeData"
- ></data-report-left>
- </el-card>
- </el-col>
- <el-col
- :span="20"
- style="padding: 16px 16px 16px 0; height: 100%"
- >
- <el-card style="height: 100%; overflow-y: auto">
- <el-col :span="24" class="elrow-main__col-top">
- <div>
- <el-input
- v-model="waterKeyword"
- style="width: 250px"
- placeholder="请输入机井编号/机井名称"
- clearable
- />
- <el-select
- placeholder="在线状态"
- style="margin: 0 10px"
- v-model="tmnstatusRunstatus"
- >
- <el-option
- v-for="item in tmnstatusList"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- <el-button
- type="primary"
- size="small"
- @click="handleSearch"
- >查询</el-button
- >
- </div>
- </el-col>
- <el-col :span="24" class="elrow-main__col-bottom">
- <b-table
- ref="tableRef"
- :args="{ 'highlight-current-row': true }"
- :data="loadData"
- :columns="columns"
- isShowIndex
- >
- <template #status="scope">
- <span style="display:flex;align-items:center;justify-content:center">
- <span class="status nowork" v-if="scope.row.tmnstatusRunstatusContent == '空闲中'"></span>
- <span class="status work" v-if="scope.row.tmnstatusRunstatusContent == '工作中'"></span>
- <span class="status error" v-if="scope.row.tmnstatusRunstatusContent == '故障'"></span>
- <span class="status nolive" v-if="scope.row.tmnstatusRunstatusContent == '离线'"></span>
- {{ scope.row.tmnstatusRunstatusContent }}
- </span>
- </template>
- <template #operate="scope">
- <el-link
- size="small"
- :underline="false"
- type="primary"
- style="margin-right: 10px;color:rgb(219, 162, 28)"
- @click="irrigationShowHistory(scope.row)"
- >参数设置</el-link
- >
- <!-- <el-link
- size="small"
- :underline="false"
- type="primary"
- style="margin-right: 10px"
- @click="download(scope.row)"
- >修改</el-link> -->
- </template>
- </b-table>
- </el-col>
- </el-card>
- </el-col>
- <set-preferencs
- :visible.sync="associationManageShow"
- />
- </el-row>
- </template>
- <script>
- import { getBaseList } from '@/api/tmn/index.js'
- import { getTree } from '@/api/tree.js'
- import BTable from '@/components/Table/index.vue';
- import DataReportLeft from '@/components/DataReportLeft/index.vue'
- import setPreferencs from './components/setPreferenc.vue'
- import { assign, omit } from 'lodash-es';
- export default {
- name: 'deviceSetup',
- components: { BTable,DataReportLeft,setPreferencs },
- data() {
- return {
- tmnstatusRunstatus:'I',
- treeData: [],
- waterKeyword: '',
- tmnstatusList: [{
- label: '空闲中',
- value: 'I'
- }, {
- label: '工作中',
- value: 'W'
- }, {
- label: '故障',
- value: 'E'
- }, {
- label: '离线',
- value: 'O'
- }],
- loading: false,
- associationManageShow: false,
- currentClickId: '',
- areaId: '',
- columns: [
- {
- label: '水电双计编号',
- prop: 'tmnBizcode',
- customRender: '',
- align: 'center'
- },
- {
- label: '设备名称',
- prop: 'tmnName',
- customRender: '',
- align: 'center'
- },
- {
- label: '水源名称',
- prop: 'waterName',
- customRender: '',
- align: 'center'
- },
- {
- label: '设备状态',
- prop: 'tmnstatusRunstatusContent',
- customRender: 'status',
- align: 'center'
- },{
- label: '累计用水量',
- prop: 'waterNumTotal',
- customRender: '',
- align: 'center'
- },{
- label: '累计用电量',
- prop: 'elecNumTotal',
- customRender: '',
- align: 'center'
- }
- , {
- label: '更新时间',
- prop: 'tmnstatusUpdateddate',
- customRender: '',
- align: 'center'
- }
- ]
- };
- },
- methods: {
- async searchHandler(farmerName, areaId) {
- const res = await getFarmerList({
- farmerName,
- areaId
- })
- this.userList = res.data
- },
- setCurrentData(areaId) {
- this.currentClickId = areaId
- this.areaId = areaId
- this.$refs.tableRef.refresh(false);
- },
- irrigationShowHistory(row) {
- this.setEdit = row
- this.associationManageShow = true
- },
- async loadData(parameter) {
- if (!this.currentClickId) {
- const treeList = this.$store.state.tree.treeList
- let res = []
- if (treeList.code === '000000') {
- res = treeList
- } else {
- res = await getTree()
- this.$store.dispatch('tree/setTree', res)
- }
- this.treeData = res?.data
- this.currentClick = res?.data[0]
- this.currentClickId = this.currentClick?.cusareaId
- this.areaId = this.currentClickId
- }
- const params = {
- areaId: this.areaId,
- waterKeyword: this.waterKeyword,
- tmnstatusRunstatus: this.tmnstatusRunstatus
- }
- const payload = omit(assign({}, parameter, params), []);
- return this.getTableData(payload);
- },
- getTableData(payload) {
- return getBaseList(payload)
- },
- handleSearch() {
- this.$refs.tableRef.refresh(true);
- },
- goDetail(row) {
- this.$refs.sourceCodeDetail.open(row.tarcecodeapplyBatchno)
- },
- download(row) {
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .el-row-container{
- height: 100%;
- }
- .elrow-main__col-top {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 15px;
- .top-left {
- height: 100%;
- display: flex;
- align-items: center;
- i {
- background-color: #40d5ec;
- height: 45%;
- width: 5px;
- margin-right: 5px;
- }
- }
- }
- .status{
- display: inline-block;
- width: 8px;
- height: 8px;
- border-radius: 50%;
- margin-right: 8px;
- }
- .nowork{
- background: #14A478;
- }
- .work{
- background: #1890FF;
- }
- .error{
- background: #F4A72F;
- }
- .nolive{
- background: rgba(0, 0, 0, 0.26);
- }
- </style>
|