123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- /**
- *@author:Guoxiaohuan
- *@date:2020.05.29
- *@info:图例展示状态
- */
- <template>
- <div class='views'>
- <div v-if='systemName=="土建系统"'>
- <el-table
- ref='dataTable'
- :data='scpzTable'
- tooltip-effect='dark'
- style='width:100%;'
- :header-cell-style='{background:"rgba(2,91,170,0.1)",fontFamily:"PingFangSC-Medium,PingFang SC;",color:"rgba(0,0,0,0.85);",fontSize:"12px"}'
- >
- <el-table-column prop label='说明'>
- <template slot-scope='{row}' v-if='row.Properties && row.Properties.ItemExplain'>
- <span>{{row.Properties.ItemExplain}}</span>
- </template>
- </el-table-column>
- <el-table-column prop label='图例' width='60' align='center'>
- <template slot-scope='{row}' v-if='row.Properties && row.Properties.ItemExplain'>
- <div class='scpz-img' :style='`background:${row.Properties.FillColor};border:1px solid ${row.Properties.StrokeColor}`'></div>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div v-else>
- <el-table
- ref='dataTable'
- v-if='legendTable.length>=0'
- :data='legendTable'
- tooltip-effect='dark'
- style='width:100%;'
- @selection-change='handleSelectionChange'
- :header-cell-style='{background:"rgba(2,91,170,0.1)",fontFamily:"PingFangSC-Medium,PingFang SC;",color:"rgba(0,0,0,0.85);",fontSize:"12px"}'
- >
- <el-table-column type='selection' :selectable='checkSelectable' width='45' align='center'></el-table-column>
- <el-table-column prop='Name' :show-overflow-tooltip='true' label='项目' width='100'>
- <template slot-scope='{row}'>{{row.Name||'--'}}</template>
- </el-table-column>
- <el-table-column prop='Num' label='数量'>
- <template slot-scope='{row}'>
- <span v-if='row.Num || row.Num==0'>{{row.Num}}</span>
- <span v-else-if='row.Num==null'></span>
- <span v-else>{{'--'}}</span>
- </template>
- </el-table-column>
- <el-table-column prop='Unit' label='单位' width='70'>
- <template slot-scope='{row}'>{{row.Unit||'--'}}</template>
- </el-table-column>
- <el-table-column prop='Url' label='图例' width='55' align='center'>
- <template slot-scope='{row}'>
- <div v-if='row.Url' class='Url-img'>
- <img :src='`/serve/topology-wanda/Picture/query/${row.Url}`' alt />
- </div>
- <div v-else>{{'--'}}</div>
- </template>
- </el-table-column>
- </el-table>
- <div class='swich'>
- <el-switch v-model='swich' @change='handleSwich(swich)'></el-switch>
- <span>隐藏数量为0的项目</span>
- </div>
- <div class='remark' v-if='remarksText'>
- <span class='remark-title'>注:</span>
- <div :key='key' v-html='remarksText' class='remark-text'></div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import bus from '@/utils/bus.js'
- import { mapGetters } from 'vuex'
- export default {
- props: ['loading', 'systemName'],
- data() {
- return {
- swich: true,
- multipleSelection: [],
- key: 0
- }
- },
- methods: {
- // 所属分类 非图例 默认不能勾选
- checkSelectable(row, index) {
- let flag = false
- if (row.Type != 'None') {
- flag = true
- }
- return flag
- },
- handleSelectionChange(val) {
- this.multipleSelection = val
- const tempArr = val.map(t => {
- return t.GraphElementId
- })
- bus.$emit('changeShow', tempArr)
- },
- handleSwich(val) {
- this.$emit('changeSwitch', val)
- },
- setSelected() {
- this.legendTable.forEach(t => {
- this.$refs.dataTable.toggleRowSelection(t, t.Type != 'None')
- })
- }
- },
- computed: {
- ...mapGetters(['scpzTable', 'legendTable', 'remarksText'])
- },
- mounted() {},
- watch: {
- '$store.state.remarksText': {
- handler(oVal, nVal) {
- if (oVal != nVal) {
- this.key++
- }
- },
- deep: true
- }
- }
- }
- </script>
- <style lang="less" scoped>
- .views {
- .swich {
- display: flex;
- justify-content: flex-end;
- align-items: center;
- margin-top: 8px;
- margin-right: 4px;
- margin-bottom: 12px;
- span {
- margin-left: 8px;
- }
- }
- .scpz-img {
- width: 32px;
- height: 16px;
- }
- .remark {
- font-size: 12px;
- font-family: MicrosoftYaHeiSemibold;
- color: rgba(31, 35, 41, 1);
- line-height: 16px;
- display: flex;
- .remark-title {
- font-weight: bold;
- }
- .remark-text {
- white-space: normal;
- word-break: break-all;
- p {
- padding: 0;
- }
- }
- }
- .Url-img {
- width: 20px;
- height: 22px;
- line-height: 20px;
- margin: 0 auto;
- img {
- display: block;
- max-width: 100%;
- max-height: 100%;
- margin: 0 auto;
- }
- }
- }
- </style>
- <style lang="less">
- .views {
- .el-input--mini .el-input__inner {
- width: 50px;
- }
- .el-input__inner {
- padding: 0 5px;
- }
- /deep/ .legend-container .el-table td,
- .legend-container .el-table th {
- padding: 3px 0 !important;
- }
- .nullData {
- .el-input__inner {
- color: #ccc !important;
- }
- }
- .redData {
- .el-input__inner {
- border: 1px solid rgba(255, 77, 79, 0.5) !important;
- }
- }
- }
- </style>
|