123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- <template>
- <div class="communicate">
- <div class="comTop">
- <div class="comTopLeft">
- <el-input
- placeholder="搜索设备或编号"
- v-model="filterText"
- class="comTopLeftInput"
- >
- <template #suffix>
- <i class="el-icon-search el-input__icon"></i>
- </template>
- </el-input>
- <el-button
- class="search-button"
- icon="el-icon-plus"
- type="success"
- @click="Insert()"
- >
- 新增
- </el-button>
- </div>
- <div class="comRight">
- <el-button type="primary">导入</el-button>
- <el-button type="primary">导出</el-button>
- </div>
- </div>
- <div class="comContent">
- <el-table
- :data="
- tableData.filter(
- (data) =>
- !filterText ||
- data.deviceName
- .toLowerCase()
- .includes(filterText.toLowerCase()) ||
- data.deviceCode.toLowerCase().includes(filterText.toLowerCase())
- )
- "
- border
- stripe
- :header-cell-style="headClass"
- :height="Height"
- >
- <el-table-column prop="stationStatus" label="状态" width="50">
- <template #default="scope">
- <el-avatar
- class="status"
- :style="
- scope.row.stationStatus == 0
- ? 'background-color:red'
- : 'background-color:#04F21C'
- "
- ></el-avatar>
- </template>
- </el-table-column>
- <el-table-column
- prop="deviceName"
- label="通信设备名称"
- width="150"
- ></el-table-column>
- <el-table-column
- prop="deviceCode"
- label="设备编号"
- width=""
- ></el-table-column>
- <el-table-column
- prop="deviceSite"
- label="所属站点"
- width=""
- ></el-table-column>
- <el-table-column
- prop="offlineTime"
- label="上次离线时间"
- width=""
- ></el-table-column>
- <el-table-column
- prop="onlineTime"
- label="上次在线时间"
- width=""
- ></el-table-column>
- <el-table-column
- prop="offlineDuration"
- label="离线时长"
- width=""
- ></el-table-column>
- <el-table-column
- prop="onlineDuration"
- label="在线时长"
- width=""
- ></el-table-column>
- <el-table-column
- prop="deviceAdd"
- label="设备地址"
- width=""
- ></el-table-column>
- <el-table-column label="操作" width="150">
- <template #default="scope">
- <el-button
- type="text"
- size="small"
- style="color: #409eff"
- @click.prevent="Update(scope.row)"
- >
- 编辑
- </el-button>
- <el-button
- @click="Delete(scope.$index, scope.row)"
- type="text"
- size="small"
- style="color: red"
- >
- 删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <div class="listPagination">
- <el-pagination
- v-model:currentPage="currentPage"
- :page-sizes="[15, 20, 25, 30]"
- :page-size="15"
- layout="total, sizes, prev, pager, next, jumper"
- :total="tableData.length"
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- background
- ></el-pagination>
- </div>
- </div>
- <div></div>
- </div>
- </template>
- <script>
- import { defineComponent, ref } from 'vue'
- export default defineComponent({
- name: 'powerEquip',
- components: {},
- props: {
- Height: String,
- },
- data() {
- return {
- deviceNumData: [],
- tableData: [
- {
- stationStatus: 0,
- deviceName: '测试设备',
- deviceCode: 'cssb1',
- deviceSite: '站点1',
- offlineTime: '2021-1-1 00:00:00',
- onlineTime: '2021-2-1 00:00:00',
- offlineDuration: '180天',
- onlineDuration: '180天',
- deviceAdd: '徐乐路208号',
- },
- {
- stationStatus: 1,
- deviceName: '测试设备',
- deviceCode: 'cssb1',
- deviceSite: '站点1',
- offlineTime: '2021-1-1 00:00:00',
- onlineTime: '2021-2-1 00:00:00',
- offlineDuration: '180天',
- onlineDuration: '180天',
- deviceAdd: '徐乐路208号',
- },
- ],
- activeName: 'powerEquip',
- filterText: '',
- currentPage: ref(15),
- }
- },
- methods: {
- //新增
- Insert() {
- console.log('')
- },
- // 表头样式设置
- headClass() {
- return 'background:#FAFAFA !important;color: black;'
- },
- //修改
- Update(row) {
- console.log(row)
- },
- //删除
- Delete(ind, row) {
- console.log(ind, row)
- },
- handleSizeChange(val) {
- console.log(`${val} items per page`)
- },
- handleCurrentChange(val) {
- console.log(`current page: ${val}`)
- },
- },
- })
- </script>
- <style lang="scss" scoped>
- //first样式
- .communicate {
- margin: 15px;
- //顶部左侧样式
- .comTop {
- display: flex;
- height: 32px;
- line-height: 32px;
- .comTopLeft {
- width: 70%;
- .goBack {
- margin-right: 15px;
- }
- .comTopLeftTitle {
- font-size: 14px;
- margin-right: 10px;
- }
- .comTopLeftInput {
- width: 15rem;
- }
- .el-input__icon {
- color: #409eff;
- }
- .el-input__inner:hover {
- border-color: #409eff;
- }
- .el-input__inner:focus {
- border-color: #409eff;
- }
- .search-button {
- margin-left: 1rem;
- }
- }
- //顶部右侧样式
- .comRight {
- width: 30%;
- button {
- margin-left: 1rem;
- float: right;
- }
- }
- }
- .comContent {
- margin-top: 15px;
- }
- }
- .listPagination {
- margin-top: 15px;
- float: right;
- }
- </style>
|