liukangdong
2025-02-08 b1e21adbd4fccedc31701f2564b01cabe9941a5f
admin/src/views/roomStatus/index.vue
@@ -17,7 +17,8 @@
                    <span class="custom-tree-node" style="width: 100%; display: flex; align-items: center; justify-content: space-between;" slot-scope="{ node, data }">
                      <span>{{ data.name }}</span>
                      <span style="color: #2080f7;" v-if="data.lv === 3">
                        {{data.leaseStatus === 0 ? '待租赁' : data.leaseStatus === 1 ? '已租赁' : data.leaseStatus === 2 ? '未开启租赁' : ''}}
                          <img src="@/assets/icons/ic_key_green.png" style="width: 16px; height: 16px;" v-if="data.leaseStatus === 1" />
<!--                          <img src="@/assets/icons/ic_key_yellow.png" style="width: 16px; height: 16px;" v-else-if="data.leaseStatus === 2" />-->
                      </span>
                    </span>
                </el-tree>
@@ -33,34 +34,30 @@
                    <el-tabs v-model="activeName" @tab-click="handleClick">
                        <el-tab-pane label="项目概况" name="first" v-if="lv === 0">
                            <div class="xm">
                                <el-card>
                                    <div class="xm_one">
                                        <div class="xm_one_row">
                                            <span>在租合同数</span>
                                            <span>{{projectNums.leaseContractAmount}}</span>
                                            <span>在租房源数:{{projectNums.leaseRoomAmount}}</span>
                                        </div>
                                        <div class="xm_one_row">
                                            <span>可招商面积</span>
                                            <span>{{projectNums.investmentArea}}㎡</span>
                                            <span>可招商房源数:{{projectNums.investmentRoomAmount}}</span>
                                        </div>
                                        <div class="xm_one_row">
                                            <span>在租实时均价</span>
                                            <span>{{projectNums.leasePrice}}元/m²·天</span>
                                            <span>在租面积:{{projectNums.leaseArea}}m²</span>
                                        </div>
                                        <div class="xm_one_row">
                                            <span>出租率</span>
                                            <span>{{rentalRate()}}%</span>
                                            <span>待租面积:{{projectNums.investmentArea - projectNums.leaseArea}}m²</span>
                                        </div>
                                <div class="xm_one">
                                    <div class="xm_one_row">
                                        <span>在租合同数</span>
                                        <span>{{projectNums.leaseContractAmount}}</span>
                                        <span>在租房源数:{{projectNums.leaseRoomAmount}}</span>
                                    </div>
                                </el-card>
                                <el-card style="margin-top: 20px;">
                                    <div slot="header" class="clearfix">
                                        <span>项目信息</span>
                                    <div class="xm_one_row">
                                        <span>可招商面积</span>
                                        <span>{{projectNums.investmentArea}}㎡</span>
                                        <span>可招商房源数:{{projectNums.investmentRoomAmount}}</span>
                                    </div>
                                    <div class="xm_one_row">
                                        <span>在租实时均价</span>
                                        <span>{{projectNums.leasePrice}}元/m²·天</span>
                                        <span>在租面积:{{projectNums.leaseArea}}m²</span>
                                    </div>
                                    <div class="xm_one_row">
                                        <span>出租率</span>
                                        <span>{{rentalRate()}}%</span>
                                        <span>待租面积:{{projectNums.investmentArea - projectNums.leaseArea}}m²</span>
                                    </div>
                                </div>
                                <div style="margin-top: 20px;">
                                    <div style="font-size: 16px; color: #000000; font-weight: 500; margin-bottom: 20px;">项目信息</div>
                                    <div class="xm_info">
                                        <div class="xm_info_row" style="width: 25%;">
                                            <span>项目名称</span>
@@ -79,11 +76,9 @@
                                            <span>{{projectInfo.remark}}</span>
                                        </div>
                                    </div>
                                </el-card>
                                <el-card style="margin-top: 20px;">
                                    <div slot="header" class="clearfix">
                                        <span>当前在租合同</span>
                                    </div>
                                </div>
                                <div style="margin-top: 20px;">
                                    <div style="font-size: 16px; color: #000000; font-weight: 500; margin-bottom: 20px;">当前在租合同</div>
                                    <div class="xm_table">
                                        <div style="display: flex; align-items: center; margin-bottom: 15px;">
                                            <el-input v-model="form.code" style="width: 150px; margin-right: 15px;" placeholder="请输入合同编号"></el-input>
@@ -98,7 +93,7 @@
                                            <el-table-column
                                                label="合同编号">
                                                <template slot-scope="{row}">
                                                    <el-button type="text">{{row.code}}</el-button>
                                                    <el-button type="text" @click="$refs.ContractDetailRef.open('合同详情', row.id)">{{row.code}}</el-button>
                                                </template>
                                            </el-table-column>
                                            <el-table-column
@@ -146,7 +141,7 @@
                                            </el-pagination>
                                        </div>
                                    </div>
                                </el-card>
                                </div>
                            </div>
                        </el-tab-pane>
                        <el-tab-pane label="房源信息" name="houseinfo" v-if="[3].includes(lv)">
@@ -217,7 +212,7 @@
                                            <el-table-column
                                                label="合同编号">
                                                <template slot-scope="{row}">
                                                    <el-button type="text">{{row.code}}</el-button>
                                                    <el-button type="text" @click="$refs.ContractDetailRef.open('合同详情', row.id)">{{row.code}}</el-button>
                                                </template>
                                            </el-table-column>
                                            <el-table-column
@@ -293,14 +288,18 @@
                                            </div>
                                        </div>
                                        <div class="xm_house_list_right">
                                            <div class="xm_house_list_right_row" :style="{ width: ifWidth(child.roomRentArea), backgroundColor: ifBackground(child.roomStatus) }" v-for="(child, i) in item.ywRoomStatusDataVOList" :key="i">
                                            <div class="xm_house_list_right_row" :style="{ width: child.width + 'px', backgroundColor: ifBackground(child.roomStatus) }" v-for="(child, i) in item.ywRoomStatusDataVOList" :key="i">
                                                <div class="ft">
                                                    <span>{{child.roomCode}}</span>
                                                    <span>({{child.roomRentArea}}㎡)</span>
                                                </div>
                                                <div class="xm_house_list_right_row_info" v-if="child.roomStatus !== 0">
                                                    <span>{{child.customerName}}</span>
                                                    <span>{{child.overData.substring(0, 10)}}到期</span>
                                                    <div style="display: flex; align-items: center;">
                                                        <span style="margin-right: 5px;">{{child.customerName}}</span>
                                                        <img src="@/assets/icons/ic_key_green.png" style="width: 16px; height: 16px;" v-if="child.roomStatus === 1" />
                                                        <img src="@/assets/icons/ic_key_yellow.png" style="width: 16px; height: 16px;" v-else-if="child.roomStatus === 2" />
                                                    </div>
                                                    <span :style="{ color: returnColor(child.overData.substring(0, 10)) ? 'red' : '' }">{{child.overData.substring(0, 10)}}{{returnColor(child.overData.substring(0, 10)) ? '已' : ''}}到期</span>
                                                </div>
                                                <div class="xm_house_list_right_row_day" v-if="child.roomStatus === 0">未出租|空置{{child.freeDayAmount}}天</div>
                                            </div>
@@ -555,10 +554,14 @@
                            <div class="xm">
                                <div class="xm_chat">
                                    <el-card class="xm_chat_row">
                                        <div id="chat1"></div>
                                        <div class="xm_chat_row_info">
                                            <span>总计</span>
                                            <span>{{amount}}</span>
                                        </div>
                                        <div id="chat1" v-if="activeName === 'third'"></div>
                                    </el-card>
                                    <el-card class="xm_chat_row">
                                        <div id="chat2"></div>
                                        <div id="chat2" v-if="activeName === 'third'"></div>
                                    </el-card>
                                </div>
                                <el-card style="margin-top: 20px;">
@@ -702,7 +705,9 @@
        roomInfo: {},
        loading: false,
        lv: 0,
        leaseStatus: ''
        leaseStatus: '',
        amount: 0,
        project: ''
      }
    },
    created () {
@@ -728,6 +733,7 @@
        if (e.lv === 0) {
          this.activeName = 'first'
          this.form.project = e.id
          this.project = e.id
          this.getProjectByIds()
        } else if (e.lv === 1) {
          this.activeName = 'house'
@@ -743,6 +749,21 @@
          this.leaseStatus = e.leaseStatus
          this.roomDetailByIds()
        }
      },
      returnColor(date) {
        let date1 = Number(date.replace(/-/g, ''))
        let date2 = Number(this.getDay().replace(/-/g, ''))
        return date2 > date1
      },
      getDay() {
        const now = new Date();
        const year = now.getFullYear();
        let month = now.getMonth() + 1; // 月份从0开始,所以要加1
        let day = now.getDate();
        const padZero = (num) => num < 10 ? '0' + num : num;
        month = padZero(month);
        day = padZero(day);
        return `${year}-${month}-${day}`;
      },
      // 搜索树
      filterNode(value, data) {
@@ -800,7 +821,16 @@
          buildingId: this.form.buildingId,
          floor: this.form.floorId
        }).then(res => {
          res.forEach(item => {
            let num = item.ywRoomStatusDataVOList.map(item => item.roomRentArea)
            let total = num.reduce((sum, value) => sum + value, 0)
            item.ywRoomStatusDataVOList.forEach(child => {
              // let percentage = (child.roomRentArea / total) * 100; // 计算每个值的占比
              child.width = (child.roomRentArea / total) * 854
            })
          })
          this.roomStatus = res
          console.log(this.roomStatus)
        })
      },
      // 获取设备状态
@@ -818,6 +848,7 @@
                { value: res.exceptionAmount || 0, name: '异常' },
                { value: res.errAmount || 0, name: '报废' }
              ]
              this.amount = res.amount
              this.reand()
            })
          })
@@ -836,9 +867,10 @@
          })
        })
      },
      handleEdit(row) {
      handleEdit() {
        this.showEdit1 = true
        this.$nextTick(() => {
          this.$refs.EditRef.param.projectId = this.project
          this.$refs.EditRef.isShowModal = true
        })
      },
@@ -975,7 +1007,8 @@
            buildingId: this.form.buildingId,
            floorId: this.form.floorId,
            roomId: this.form.roomId,
            code: this.form.code
            code: this.form.code,
            statusList: [0,1,2,3]
          }
        }).then(res => {
          this.tableData = res.records
@@ -989,6 +1022,7 @@
          .then(res => {
            this.addParamToArray(res)
            this.form.project = res[0].id
            this.project = res[0].id
            this.title = res[0].name
            this.houseList = res
            this.getProjectByIds()
@@ -1023,13 +1057,7 @@
            {
              name: '设备状态',
              type: 'pie',
              radius: ['40%', '80%'],
              label: {
                show: true,
                position: 'center',
                fontWeight: 'bold',
                fontSize: 22
              },
              radius: ['50%', '80%'],
              data: this.deviceList
            }
          ]
@@ -1040,53 +1068,25 @@
        var chartDom = document.getElementById('chat2');
        var myChart = echarts.init(chartDom);
        var option;
        const rawData = [
          [100, 302, 301, 334, 390, 330, 320],
          [320, 132, 101, 134, 90, 230, 210],
          [220, 182, 191, 234, 290, 330, 310],
          [150, 212, 201, 154, 190, 330, 410],
          [820, 832, 901, 934, 1290, 1330, 1320]
        ];
        const totalData = [];
        for (let i = 0; i < rawData[0].length; ++i) {
          let sum = 0;
          for (let j = 0; j < rawData.length; ++j) {
            sum += rawData[j][i];
          }
          totalData.push(sum);
        }
        const series = [
          'Direct',
          'Mail Ad',
          'Affiliate Ad',
          'Video Ad',
          'Search Engine'
        ].map((name, sid) => {
          return {
            name,
            type: 'bar',
            stack: 'total',
            barWidth: '60%',
            data: rawData[sid].map((d, did) =>
              totalData[did] <= 0 ? 0 : d / totalData[did]
            )
          };
        });
        let seriesArr = this.categaryList.map(item => {
          return {
            name: item.cateName,
            type: 'bar',
            stack: 'total',
            barWidth: '60%',
            data: item.ywDeviceCateDataVOList.map((child) =>
              child.deviceAmount
            )
          }
        let seriesArr = []
        this.categaryList.forEach((one, index) => {
          one.ywDeviceCateDataVOList.forEach(two => {
            let data = []
            this.categaryList.forEach(item => {
              data.push(0)
            })
            data[index] = two.deviceAmount
            seriesArr.push({
              name: two.cateName,
              type: 'bar',
              barGap:-1,
              stack: one.cateName,
              data
            })
          })
        })
        let xAxisData = this.categaryList.map(item => item.cateName)
        console.log(series)
        console.log(seriesArr)
        console.log(xAxisData)
        option = {
          title: {
            text: '设备数量分类统计'
@@ -1101,15 +1101,30 @@
            trigger: 'axis',
            axisPointer: {
              type: 'shadow'
            },
            formatter: params => {
              var res = `${params[0].name} <br/>`
              for (const item of params) {
                if (item.value !== 0) {
                  res += `<span style="background: ${item.color}; height:10px; width: 10px; border-radius: 50%;display: inline-block;margin-right:10px;"></span> ${item.seriesName} :${item.value}<br/>`
                }
              }
              return res
            }
          },
          yAxis: {
            type: 'value'
          },
          xAxis: {
            type: 'category',
            data: xAxisData
          },
          xAxis: [
            {
              type: 'category',
              position: 'bottom',
              data: xAxisData
            }
          ],
          yAxis: [
            {
              type: 'value',
              data: Array.from({ length: 100 }, (_, i) => i + 1)
            }
          ],
          series: seriesArr
        };
@@ -1260,6 +1275,7 @@
                                    }
                                }
                                .xm_house_list_right {
                                    width: 854px;
                                    display: flex;
                                    align-items: center;
                                    .xm_house_list_right_row {
@@ -1342,6 +1358,28 @@
                            .xm_chat_row {
                                width: 49%;
                                height: 300px;
                                position: relative;
                                .xm_chat_row_info {
                                    position: absolute;
                                    top: 50%;
                                    left: 50%;
                                    transform: translate(-50%, -50%);
                                    display: flex;
                                    flex-direction: column;
                                    align-items: center;
                                    justify-content: center;
                                    span {
                                        &:nth-child(1) {
                                            font-size: 20px;
                                            color: #222222;
                                        }
                                        &:nth-child(2) {
                                            font-size: 28px;
                                            color: #222222;
                                            font-weight: bold;
                                        }
                                    }
                                }
                                #chat1 {
                                    width: 100%;
                                    height: 260px;
@@ -1359,17 +1397,30 @@
                            justify-content: space-between;
                            .xm_one_row {
                                flex: 1;
                                margin-right: 20px;
                                display: flex;
                                flex-direction: column;
                                justify-content: space-between;
                                height: 120px;
                                background: #F4F7FC;
                                border-radius: 8px;
                                padding: 15px 20px;
                                box-sizing: border-box;
                                &:last-child {
                                    margin: 0;
                                }
                                span {
                                    font-size: 16px;
                                    color: black;
                                    &:nth-child(2) {
                                        font-weight: bold;
                                        margin: 15px 0;
                                        font-weight: 600;
                                        font-size: 24px;
                                        color: #3E80EF;
                                    }
                                    &:nth-child(3) {
                                        color: #666666;
                                        font-weight: 400;
                                        font-size: 14px;
                                        color: #888888;
                                    }
                                }
                            }
@@ -1419,13 +1470,16 @@
                                display: flex;
                                flex-direction: column;
                                span {
                                    font-size: 16px;
                                    &:nth-child(1) {
                                        color: #666666;
                                        font-weight: 400;
                                        font-size: 13px;
                                        color: #888888;
                                    }
                                    &:nth-child(2) {
                                        color: #000000;
                                        margin-top: 15px;
                                        font-weight: 400;
                                        font-size: 14px;
                                        color: #222222;
                                        margin-top: 7px;
                                    }
                                }
                            }