| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <!-- è®¾å¤æ»è§ --> |
| | | <style scoped> |
| | | .title { |
| | | height: 60px; |
| | | line-height: 60px; |
| | | } |
| | | |
| | | .search { |
| | | background-color: #fff; |
| | | height: 50px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .search_thing { |
| | | width: 350px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .search_label { |
| | | width: 110px; |
| | | font-size: 14px; |
| | | text-align: left; |
| | | } |
| | | |
| | | .search_input { |
| | | width: calc(100% - 110px); |
| | | } |
| | | |
| | | .table { |
| | | background-color: #fff; |
| | | width: calc(100% - 40px); |
| | | height: calc(100vh - 17em); |
| | | /* padding: 10px; */ |
| | | overflow-y: auto; |
| | | } |
| | | |
| | | .card { |
| | | list-style-type: none; |
| | | display: grid; |
| | | grid-template-columns: repeat(auto-fit, 380px); |
| | | justify-content: start; |
| | | grid-gap: 16px; |
| | | min-height: 300px; |
| | | } |
| | | |
| | | .card li { |
| | | width: 380px; |
| | | height: 165px; |
| | | border-radius: 8px 8px 8px 8px; |
| | | border: 1px solid #EEEEEE; |
| | | margin: 0 !important; |
| | | display: flex; |
| | | align-items: center; |
| | | box-sizing: border-box; |
| | | padding: 16px; |
| | | font-size: 14px; |
| | | color: #666666; |
| | | position: relative; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .card li .img { |
| | | width: 114px; |
| | | height: 114px; |
| | | border-radius: 16px; |
| | | margin-right: 24px; |
| | | } |
| | | |
| | | .list-left .list-left-info { |
| | | line-height: 36px; |
| | | display: flex; |
| | | } |
| | | |
| | | .text-truncate { |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap |
| | | } |
| | | |
| | | .circles { |
| | | position: absolute; |
| | | width: 70px; |
| | | height: 70px; |
| | | right: 0; |
| | | top: 0; |
| | | z-index: 0; |
| | | } |
| | | |
| | | .circles .circle { |
| | | border-radius: 50%; |
| | | opacity: 0.2; |
| | | } |
| | | |
| | | .circle0, |
| | | .circle1, |
| | | .circle2 { |
| | | width: 60px; |
| | | height: 60px; |
| | | position: absolute; |
| | | } |
| | | |
| | | .circle3 { |
| | | width: 16px; |
| | | height: 16px; |
| | | position: absolute; |
| | | } |
| | | |
| | | .circle0 { |
| | | bottom: 6px; |
| | | left: 0; |
| | | } |
| | | |
| | | .circle1 { |
| | | bottom: 0; |
| | | right: -30px; |
| | | } |
| | | |
| | | .circle2 { |
| | | left: 0; |
| | | top: -30px; |
| | | } |
| | | |
| | | .circle3 { |
| | | top: 0; |
| | | right: 0; |
| | | } |
| | | |
| | | .success .circle { |
| | | background: #34BD66; |
| | | } |
| | | |
| | | .danger .circle { |
| | | background: #FF3838; |
| | | } |
| | | |
| | | .warning .circle { |
| | | background: #FBB247; |
| | | } |
| | | .info .circle { |
| | | background: #909399; |
| | | } |
| | | </style> |
| | | |
| | | <template> |
| | | <div class="role_manage"> |
| | | <div style="margin-top: 10px"> |
| | | <el-form :model="entity" inline label-position="right"> |
| | | <el-form-item label="ç¶æ:"> |
| | | <el-select v-model="entity.deviceStatus" placeholder="å
¨é¨" size="small" clearable> |
| | | <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="设å¤åç§°:"> |
| | | <el-input size="small" placeholder="请è¾å
¥" clearable v-model="entity.deviceName"></el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button size="small" @click="refresh()">é ç½®</el-button> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button size="small" type="primary" |
| | | @click="currentPage = 1, keyMap = {}, list = [], finishLoding = false, refreshTable()">æ¥ è¯¢</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="table" v-loading="loading"> |
| | | <scroll-pagination @load="refreshTable()" :finishLoding="finishLoding" :list="list" |
| | | v-if="list.length > 0 || loading"> |
| | | <ul class="card"> |
| | | <li v-for="(m, i) in list" :key="i"> |
| | | <el-image class="img" :src="javaApi + '/img/' + m.imageUpload"> |
| | | <div slot="error" class="image-error" style="width: 112px; |
| | | height: 112px; |
| | | border-radius: 16px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | border: 1px solid #EEEEEE;"> |
| | | <i class="el-icon-picture-outline" style="font-size:30px;color:#666666;"></i> |
| | | </div> |
| | | </el-image> |
| | | <div class="list-left"> |
| | | <div class="list-left-info"> |
| | | <span class="label">设å¤åç§°ï¼</span> |
| | | <span style="color:#3A7BFA; |
| | | font-size: 16px; |
| | | display: inline-block; |
| | | width: 129px; |
| | | word-break: break-all;" class="text-truncate" :title="m.deviceName">{{ m.deviceName ? m.deviceName : 'æ ' }}</span> |
| | | </div> |
| | | <div class="list-left-info"> |
| | | <span class="label">è§æ ¼åå·ï¼</span> |
| | | <span style="color:#333333;font-size: 16px;">{{ m.specificationModel ? m.specificationModel : 'æ ' |
| | | }}</span> |
| | | </div> |
| | | <div class="list-left-info"> |
| | | <span class="label">ç¶æï¼</span> |
| | | <el-tag :type="m.type" v-if="m.deviceStatusName">{{ m.deviceStatusName }}</el-tag> |
| | | <span v-else style="color:#333333;font-size: 16px;">æ </span> |
| | | </div> |
| | | </div> |
| | | <div class="circles" :class="m.type"> |
| | | <div class="circle0 circle"></div> |
| | | <div class="circle1 circle"></div> |
| | | <div class="circle2 circle"></div> |
| | | <div class="circle3 circle"></div> |
| | | </div> |
| | | </li> |
| | | </ul> |
| | | </scroll-pagination> |
| | | <div v-if="list.length < 1 && !loading" style="color:#909399;font-size:14px;text-align: center;margin-top:200px"> |
| | | ææ æ°æ® |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import ScrollPagination from '@/components/index/scroll-paging.vue' |
| | | import {selectDeviceParameter} from "@/api/cnas/resourceDemand/device"; |
| | | export default { |
| | | props: { |
| | | clickNodeVal: { |
| | | type: Object, |
| | | default: () => { |
| | | return {}; |
| | | } |
| | | } |
| | | }, |
| | | components: { |
| | | ScrollPagination |
| | | }, |
| | | data() { |
| | | return { |
| | | entity: { |
| | | deviceStatus: null, |
| | | deviceName: null, |
| | | }, |
| | | options: [], |
| | | list: [], |
| | | currentPage: 1, // å½å页 |
| | | pageSize: 16, // ä¸é¡µ16æ¡ |
| | | total: '', |
| | | loading: true, // ç»ä»¶loadingçå±ç¤º,é»è®¤ä¸ºtrue |
| | | finishLoding: false, // å è½½å®æï¼æ¾ç¤ºå·²ç»æ²¡ææ´å¤äº |
| | | keyMap: {}, |
| | | laboratoryNameIsNull: false, |
| | | } |
| | | }, |
| | | created() { |
| | | this.selectEnumByCategory() |
| | | this.keyMap = {}; |
| | | this.currentPage = 1; |
| | | this.list = []; |
| | | this.clickSidebar(this.clickNodeVal) |
| | | }, |
| | | methods: { |
| | | refreshTable() { |
| | | const key = `_${this.currentPage}` |
| | | const value = this.keyMap[key] |
| | | // 妿valueåå¨ï¼è¡¨ç¤ºç¼åæå¼ï¼é£ä¹é»æ¢è¯·æ± |
| | | if (value) { |
| | | return |
| | | } |
| | | // valueä¸åå¨ï¼è¡¨ç¤ºç¬¬ä¸æ¬¡è¯·æ±,设置å ä½ |
| | | this.keyMap[key] = 'temp' |
| | | if (this.currentPage == 1) { |
| | | this.loading = true |
| | | } |
| | | if(this.list.length==0){ |
| | | this.finishLoding = false; |
| | | } |
| | | selectDeviceParameter({ |
| | | laboratoryNameIsNull: this.laboratoryNameIsNull, |
| | | current: this.currentPage, |
| | | size: this.pageSize, |
| | | ...this.entity |
| | | }).then(res => { |
| | | if (res.code == 200) { |
| | | this.total = res.data.total |
| | | let list = res.data.records.map(m => { |
| | | switch (m.deviceStatus) { |
| | | case 0: |
| | | // æ£å¸¸ |
| | | m.type = 'success' |
| | | break; |
| | | case 1: |
| | | // ç»´ä¿® |
| | | m.type = 'warning' |
| | | break; |
| | | case 2: |
| | | // åç¨ |
| | | m.type = 'danger' |
| | | break; |
| | | case 3: |
| | | // æ¥åº |
| | | m.type = 'info' |
| | | break; |
| | | } |
| | | this.options.forEach(j => { |
| | | if (m.deviceStatus == j.value) { |
| | | m.deviceStatusName = j.label |
| | | } |
| | | }) |
| | | return m; |
| | | }) |
| | | if (list.length == 0) { |
| | | this.finishLoding = true; |
| | | } else { |
| | | if (list.length < this.pageSize) { |
| | | this.finishLoding = true; |
| | | } |
| | | this.list = this.list.concat(list) |
| | | if (this.total == this.list.length) { |
| | | this.finishLoding = true; |
| | | } |
| | | this.currentPage++; |
| | | } |
| | | } |
| | | this.loading = false |
| | | }).catch(err => { |
| | | this.loading = false |
| | | }) |
| | | }, |
| | | refresh() { |
| | | this.keyMap = {}; |
| | | this.currentPage = 1; |
| | | this.list = []; |
| | | this.finishLoding = false; |
| | | this.entity = { |
| | | deviceStatus: null, |
| | | deviceName: null, |
| | | orderBy: { field: "id", order: "asc" } |
| | | }; |
| | | this.refreshTable() |
| | | }, |
| | | // è·ååå
¸ |
| | | selectEnumByCategory() { |
| | | // 设å¤ç¶æ |
| | | this.getDicts("device_status").then((response) => { |
| | | this.options = this.dictToValue(response.data); |
| | | }); |
| | | }, |
| | | // ç¹å»ä¾§è¾¹æ å·æ° |
| | | clickSidebar(clickNodeVal) { |
| | | this.laboratoryNameIsNull = false |
| | | // æ¯å¦åå¨valueï¼åå¨value代表为ä¸çº§ |
| | | if (!clickNodeVal.value) { |
| | | this.finishLoding = false; |
| | | this.keyMap = {}; |
| | | this.currentPage = 1; |
| | | this.list = []; |
| | | this.entity.laboratoryName = null |
| | | this.entity.storagePoint = null |
| | | // çäº1代表为æ çä¸çº§ï¼label为é¨é¨ |
| | | if (clickNodeVal.label == 'å
¶ä»') { |
| | | this.laboratoryNameIsNull = true |
| | | this.refreshTable(); |
| | | return |
| | | } |
| | | if (clickNodeVal.level == 1) { |
| | | this.entity.laboratoryName = clickNodeVal.label |
| | | // çäºäºçº§ãlabel为åå¨å°ç¹ |
| | | } else if (clickNodeVal.level == 2) { |
| | | // å
¶ä»è¡¨ç¤ºæ²¡æé
ç½®å®éªå®¤ï¼åªé
ç½®äºå°ç¹ |
| | | if (clickNodeVal.parent.label == 'å
¶ä»') { |
| | | this.laboratoryNameIsNull = true |
| | | } else { |
| | | this.entity.laboratoryName = clickNodeVal.parent.label |
| | | } |
| | | this.entity.storagePoint = clickNodeVal.label |
| | | } |
| | | this.refreshTable(); |
| | | } |
| | | } |
| | | }, |
| | | watch: { |
| | | // çå¬ç¹å»el-treeçæ°æ®ï¼è¿è¡æ°æ®å·æ° |
| | | clickNodeVal(newVal) { |
| | | this.clickSidebar(newVal) |
| | | } |
| | | } |
| | | } |
| | | </script> |