123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328 |
- <template>
- <div class="device-management">
- <!-- 设备管理 -->
- <div class="box">
- <div class="box_item" v-for="item in boxList" :key="item.id">
- <p>{{item.name}}</p>
- <p>{{item.value}}</p>
- </div>
- </div>
- <!-- 查询条件 -->
- <div class="conditions">
- <el-form inline :model="searchForm" size="mini">
- <el-form-item label="注册时间:">
- <el-input v-model="searchForm.registerTime" placeholder=""></el-input>
- </el-form-item>
- <el-form-item label="设备编码:">
- <el-input v-model="searchForm.deviceCode" placeholder=""></el-input>
- </el-form-item>
- <el-form-item label="地县:">
- <el-input v-model="searchForm.county" placeholder="地县/编码"></el-input>
- </el-form-item>
- <el-form-item label="牧场:">
- <el-input v-model="searchForm.farm" placeholder="牧场名/牧场编号"></el-input>
- </el-form-item>
- <el-form-item label="栋舍:">
- <el-input v-model="searchForm.pigsty" placeholder=""></el-input>
- </el-form-item>
- <el-form-item label="状态:">
- <el-input v-model="searchForm.status" placeholder="正常/异常"></el-input>
- </el-form-item>
- <el-form-item style="margin-left: 20px">
- <el-button plain @click="init">查询</el-button>
- </el-form-item>
- </el-form>
- </div>
- <!-- 按钮栏 -->
- <div class="title">
- <div class="title-left">
- <i class="el-icon-s-unfold"></i>
- <span>设备列表</span>
- <el-button plain size="mini" class="button-margin">批量上传</el-button>
- <el-button type="primary" plain size="mini">新增设备</el-button>
- </div>
- </div>
- <!-- 表格 -->
- <el-table
- :data="tableData"
- style="width: 100%"
- height="700"
- border
- stripe
- :default-sort="{prop: 'date', order: 'descending'}"
- size="mini"
- v-loading="dataListLoading">
- <el-table-column
- type="selection"
- width="50"
- align="center">
- </el-table-column>
- <el-table-column
- prop="id"
- label="注册ID"
- width="70"
- align="center">
- </el-table-column>
- <el-table-column
- prop="registerTime"
- label="注册时间"
- width="100"
- align="center">
- </el-table-column>
- <el-table-column
- prop="deviceCode"
- label="设备编码"
- width="80"
- align="center">
- </el-table-column>
- <el-table-column
- prop="countyName"
- label="省市县"
- align="center">
- </el-table-column>
- <el-table-column
- prop="countyCode"
- label="省市县编码"
- align="center">
- </el-table-column>
- <el-table-column
- prop="farmName"
- label="牧场名称"
- width="90"
- align="center">
- </el-table-column>
- <el-table-column
- prop="farmCode"
- label="牧场编码"
- width="90"
- align="center">
- </el-table-column>
- <el-table-column
- prop="stage"
- label="阶段"
- sortable
- width="80"
- align="center">
- </el-table-column>
- <el-table-column
- prop="pigpenName"
- label="栋舍"
- align="center">
- </el-table-column>
- <el-table-column
- prop="serverIp"
- label="上传服务器地址"
- width="120"
- align="center">
- </el-table-column>
- <el-table-column
- prop="port"
- label="端口"
- width="70"
- align="center">
- </el-table-column>
- <el-table-column
- prop="lastTime"
- label="最后上传时间"
- sortable
- align="center">
- </el-table-column>
- <!-- 这里需要修改 -->
- <el-table-column
- prop="delStatus"
- label="状态"
- width="70"
- align="center">
- </el-table-column>
- <el-table-column
- label="操作"
- align="center">
- <template slot-scope="scope">
- <el-button type="text" size="small">查看</el-button>
- <el-button type="text" size="small" @click="handleEdit(scope.row)">编辑</el-button>
- <el-button type="text" size="small">注销</el-button>
- <el-button type="text" size="small">删除</el-button>
- </template>
- <!-- TODO: 按钮 -->
- </el-table-column>
- </el-table>
- <table-footer
- :totals="totalPages"
- :size="pageSize"
- @sizeChange="sizeChange"
- @pageChange="pageChange">
- </table-footer>
- </div>
- </template>
- <script>
- import TableFooter from "../../components/TableFooter";
- import {mapState} from 'vuex';
- export default {
- name: "deviceAdmin",
- data() {
- return {
- boxList: [
- {
- id: 1,
- name: '采集设备总数',
- value: 2500,
- },
- {
- id: 2,
- name: '正常设备总数',
- value: 2498
- },
- {
- id: 3,
- name: '异常设备总数',
- value: 1
- },
- {
- id: 4,
- name: '注销设备总数',
- value: 1
- }
- ],
- searchForm: {
- farmCode: '',
- registerStartTime: '',
- registerEndTime: '',
- deviceCode: '',
- countyName: '',
- farmName: '',
- acqStatus: '',
- sortord: ''
- },
- pageSizeList: [ // 表格显示条数
- {
- value: 0,
- label: '显示条数'
- },
- {
- value: 10,
- label: '10条/页'
- },
- {
- value: 20,
- label: '20条/页'
- },
- {
- value: 50,
- label: '50条/页'
- }
- ],
- pageSize: 20, // 表格显示条数
- tableData: [], // 表格数据
- totalPages: 0, // 共 n 条数据
- pageIndex: 1, // 表格当前页数
- dataListLoading: true
- }
- },
- components: {
- TableFooter
- },
- computed: {
- ...mapState(['baseUrl'])
- },
- methods: {
- // 初始化
- init () {
- this.$http({
- url: this.$http.adornUrl(`${this.baseUrl}/manager/collectorregister/list`),
- method: 'get',
- params: this.$http.adornParams({
- 'page': this.pageIndex,
- 'limit': this.pageSize,
- 'farmCode': this.searchForm.farmCode || undefined,
- 'registerStartTime': this.searchForm.registerStartTime || undefined,
- 'registerEndTime': this.searchForm.registerEndTime || undefined,
- 'deviceCode': this.searchForm.deviceCode || undefined,
- 'countyName': this.searchForm.countyName || undefined,
- 'farmName': this.searchForm.farmName || undefined,
- 'acqStatus': this.searchForm.acqStatus || undefined,
- 'sortord': this.searchForm.sortord || undefined
- }, false)
- }).then(async({data}) => {
- console.log(data);
- this.tableData = data.page.list
- this.totalPages = data.page.totalPage
- this.dataListLoading = false
- })
- },
- // 显示条数改变
- sizeChange (val) {
- this.pageSize = val
- },
- // 页数改变
- pageChange (val) {
- this.pageIndex = val
- },
- handleEdit (row) {
- console.log(row);
- // 编辑
- }
- },
- mounted() {
- this.init()
- }
- }
- </script>
- <style scoped>
- .box{
- width: 100%;
- height: 140px;
- background-color: #F9F9F9;
- display: flex;
- justify-content: space-around;
- align-items: center;
- margin-bottom: 10px;
- }
- .box_item {
- width: 198px;
- height: 78px;
- border: 1px solid #ddd;
- text-align: center;
- }
- .box_item p {
- height: 39px;
- line-height: 39px;
- margin: 0;
- }
- /** 选择条件 */
- .conditions {
- width: 100%;
- background-color: #fff;
- margin: 30px 0px 10px;
- border: 1px solid #ddd;
- padding: 20px;
- padding-bottom: 10px;
- }
- /** 设备列表 */
- .title {
- background-color: rgba(243, 243, 243, 1);
- height: 50px;
- line-height: 50px;
- font-size: 14px;
- border: 1px solid #ddd;
- font-size: 12px;
- }
- .title-left {
- margin-left: 20px;
- display: inline-block;
- width: 300px;
- }
- .title-left span {
- margin-left: 2px;
- }
- .button-margin {
- margin: 0 5px 0 20px;
- }
- .title-right {
- float: right;
- }
- </style>
|