serviceDirectoryPage.vue 13.8 KB
Newer Older
qzhxx's avatar
qzhxx committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
<template>
  <div class="serviceDirectoryPage H100">
    <div class="head_box">
      <h6>内容管理 / 网点服务地图</h6>
      <h4>网点服务地图</h4>
    </div>
    <div class="content_box">
      <div class="form_box h778px">
        <el-form :inline="true" :model="form" class="search-form" onsubmit="return false;">
          <el-form-item label="网点名称:">
            <el-input size="mini" placeholder="请输入网点名称" v-model="form.name" @keyup.enter.native="Search"
                      clearable></el-input>
          </el-form-item>
          <el-form-item>
            <el-button size="mini" type="primary" class="btn_form_search" @click="Search">查询</el-button>
          </el-form-item>
        </el-form>
        <div class="scrool">
          <div class="directory_box">
            <el-row :gutter="36">
              <p style="text-align: center;color: #909399" v-show="page.total == 0 || !noCard">暂无数据</p>
              <el-col :md="8" :lg="6" :xl="6" v-show="noCard" v-for="(item,index) in mapGroup" :key="index"
                      :body-style="{ padding: '0px' }">
                <div class="el-card">
                  <img :src="item.headImage" class="image">
                  <div class="warper W100">
                    <p class="W100"><span class="l-float">{{item.name}}</span>
                      <span class="r-float">
                      <div class="statusBox">
                        <span class="active"
                              :style="{'backgroundColor':(item.isShow == 0 ? 'rgba(24,144,255,1)':(item.isShow == 2 ||item.isShow == 3 ? 'rgba(250,173,20,1)':(item.isShow == 1 || item.isShow == 6 ? 'rgba(245,34,45,1)':(item.isShow == 4 ? 'rgba(82,196,26,1)':'rgba(0,0,0,0.25)'))))}"></span>
                        <span class="openKey">{{item.isShow == 0 ? '编辑中':(item.isShow == 1 ? '上线被驳回':(item.isShow == 2 ? '上线审核中':(item.isShow == 3 ? '下线审核中':(item.isShow == 4 ?'上线中':(item.isShow == 5 ?'下线中': '下线被驳回')))))}}</span>
                      </div>
                    </span>
                    </p>
                    <p class="W100"><span class="l-float">{{updaTime(item.updateTime)}}</span><span class="r-float">{{item.creatorName}}</span>
                    </p>
                  </div>
                  <div class="button_line W100">
                    <el-button type="text" size="mini"
                               v-show="roleId != 3 || (roleId == 3 && (item.isShow == '2' ||item.isShow == '3' || item.isShow == '4' || item.isShow == '6'))"
                               @click="openDetails(item)">查看详情
                    </el-button>
                    <el-button type="text" size="mini" v-show="(item.isShow == '4' ||item.isShow == '6') && roleId == 3"
                               @click="handleLine(item)">申请下线
                    </el-button>
                    <el-button type="text"
                               v-show="(item.isShow == '0' ||item.isShow == '1' ||item.isShow == '5') && roleId == 3"
                               size="mini" @click="editHotSpot(item)">编辑热点
                    </el-button>
                  </div>
                </div>
              </el-col>
            </el-row>
          </div>
        </div>
        <el-pagination
          small background
          @current-change="handleCurrentChange"
          :current-page="page.currentPage"
          :page-size="page.pageSize"
          layout="prev, pager, next"
          :total="page.total">
        </el-pagination>
      </div>
    </div>
  </div>
</template>
<script>
  export default {
    data() {
      return {
        page: {
          currentPage: 1, //当前页
          pageSize: 8, //每页条数
          total: null, //总条数
        },
        value: '',
        form: {
          name: '',
        },
        mapGroup: [
          {headImage: "", name: "",},
        ],
        roleId: '',
        bankBranchId: '',
        noCard: true

      }
    },
    computed: {},
    mounted() {
      this.initData();
    },
    created() {
    },
    components: {},
    methods: {
      initData() {
        this.roleId = localStorage.getItem('roleId');
        this.bankBranchId = localStorage.getItem('bankBranchId');
        this.onSearch();
      },
      // 获得数据接口
      getTableData(param) {
        let vm = this;
        vm.$https({
          url: "bankBranchInfo/getList?query=map",
          method: 'get',
          authType: this.backToken
        }, param).then((res) => {
          if (res.status == 200) {
            let data = res.data;
            vm.page.pageSize = data.size;
            vm.page.total = data.total;
            vm.mapGroup = data.records;
            vm.mapGroup.forEach((e, i) => {
              let Time = e.updateTime;
              vm.updaTime(Time);
              if (e.headImage == "") {
                e.headImage = "./static/images/pic/mapbg.png";
              }
            })
          } else {
            console.log(res);
            vm.noCard = false;
          }

        }).catch(function (err) {
          console.log(err);
        })
      },
      updaTime(Time) {
        let date1 = Time;
        if (date1 == '') {
          date1 = '-';
        } else {
          date1 = this.computingTime(date1);
        }
        return date1;
      },
      // 计算时间
      computingTime(date1) {
        var time = '';
        var date2 = new Date();    //当前系统时间
        var date3 = date2.getTime() - new Date(date1).getTime();   //时间差的毫秒数

        var hours = Math.floor(date3 / (3600 * 1000)); //相差小时
        if (hours > 0) {
          time = hours + '小时前更新'
          if (hours > 24) {//如果小时大于24,计算出天和小时
            var day = parseInt(hours / 24);
            hours %= 24;//算出有多分钟
            time = day + '天' + hours + '小时前更新'
          }
        } else {
          //计算相差分钟数
          var leave2 = date3 % (3600 * 1000);      //计算小时数后剩余的毫秒数
          var minutes = Math.floor(leave2 / (60 * 1000));
          if (minutes > 0) {
            time = minutes + '分钟前更新';
          } else {
            time = '刚刚更新';
          }
        }
        return time;
      },

      // 分页
      handleCurrentChange(val) {
        let _this = this;
        this.page.currentPage = val;
        _this.onSearch();
      },
      onSearch() {
        let _this = this;
        let param = _this.getSearchQuery();
        _this.getTableData(param)
      },
      Search() {
        let _this = this;
        _this.page.currentPage = 1;
        let searchObj = {
          "_index": 1,
          "_size": _this.page.pageSize,
          "name": _this.form.name,
          "roleId": _this.roleId,
          "currentBankId": _this.bankBranchId
        };
        this.getTableData(searchObj);
      },
      // // 获取当前查询参数
      getSearchQuery() {
        let _this = this;
        let searchObj = {
liqin's avatar
liqin committed
196
          "_index":  _this.page.currentPage,
qzhxx's avatar
qzhxx committed
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472
          "_size": _this.page.pageSize,
          "roleId": _this.roleId,
          "currentBankId": _this.bankBranchId
        };
        for (let key in _this.form) {
          if (_this.form[key]) {
            searchObj[key] = _this.form[key];
          }
        }
        return searchObj;
      },
      openDetails(item) {
        this.$router.push({path: '/auditMap', query: {id: item.id, isTitle: 0}});
      },
      handleLine(item) {
        let _this = this;
        if (item.isShow == 4 || item.isShow == 6) {
          this.$confirm('是否申请下线当前业务?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning',
          }).then(() => {
            _this.$https({
              method: 'put',
              url: 'bankBranchInfo/applyOffline?id=' + item.id,
              authType: this.backToken
            }).then((res) => {
                _this.onSearch();
                if (res.data.status == 201) {
                  this.$message({
                    type: 'success',
                    message: res.data.message
                  });
                }
              }, (error) => {
                this.$message({
                  type: 'fail',
                  message: res.data.message
                });
              }
            )
          })
        } else {
          this.$confirm('是否上线当前业务?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning',
          }).then(() => {
            _this.$https({
              method: 'put',
              url: 'bankBranchInfo/applyOnline?id=' + item.id,
              authType: this.backToken
            }).then((res) => {
                _this.onSearch();
                if (res.data.status == 201) {
                  this.$message({
                    type: 'success',
                    message: res.data.message
                  });
                }
              }, (error) => {
                this.$message({
                  type: 'fail',
                  message: res.data.message
                });
              }
            )
          })
        }

      },

      //编辑地图中的热点区域
      editHotSpot(item) {
        this.$router.push({path: 'hotSpotManage', query: {pId: item.id}});
      }
    }
  }
</script>

<style lang="less">
  .serviceDirectoryPage {
    .dialogeditor {
      .el-form-item {
        margin-bottom: 10px;
        .el-form-item__error {
          padding-top: 0px;
        }
      }
    }
    .el-upload__input {
      display: none !important;
    }
    .avatar-uploader .el-upload {
      border: 1px dashed #999;
      border-radius: 6px;
      cursor: pointer;
      position: relative;
      overflow: hidden;
    }
    .avatar-uploader .el-upload:hover {
      border-color: #20a0ff;
    }
    //列表中的图
    .avatar-uploader-icon {
      font-size: 28px;
      color: #8c939d;
      width: 100px;
      height: 100px;
      line-height: 100px;
      text-align: center;
    }
    .avatar {
      width: 100px;
      height: 100px;
      display: block;
    }
    //头图
    .avatarpic-uploader-icon {
      font-size: 36px;
      color: #8c939d;
      width: 360px;
      height: 197px;
      line-height: 197px;
      text-align: center;
    }
    .avatarpic {
      width: 360px;
      height: 197px;
      display: block;
    }
    .content_box {
      .input_box {
        width: 100%;
        min-width: 790px;
        margin-bottom: 30px;
        .el-input, .el-select {
          max-width: 272px;
          background: rgba(255, 255, 255, 1);
          border-radius: 4px;
          .el-input__inner {
            height: 32px;
          }
          .el-input__suffix {
            height: 110%;
          }
        }
        .btn_form_search, .btn_form_add {
          height: 32px;
          text-align: center;
          padding: 0 15px;
        }
      }
      .scrool {
        width: 100%;
        height: calc(100% - 100px);
        overflow-x: hidden;
        overflow-y: scroll;
        .directory_box {
          .el-row {
            width: 100%;
            max-width: 1540px;
            margin: 0 auto !important;
            .el-col {
              margin-bottom: 32px;
              .el-card {
                max-height: 310px;
                overflow: hidden;
                border: 1px dotted #333;
              }
              .image {
                width: 100%;
                height: 190px;
              }
              span.l-float {
                display: inline-block;
                overflow: hidden;
                white-space: nowrap;
                max-width: 61%;
                text-overflow: ellipsis;
              }
              .warper {
                height: 30%;
                padding: 8px 0 14px;
                p {
                  height: 30px;
                  padding: 8px 20px 0px;
                }
                p:nth-child(1) {
                  font-size: 16px;
                  font-weight: 500;
                  color: rgba(0, 0, 0, 0.85);

                }
                p:nth-child(2) {
                  font-size: 12px;
                  font-weight: 400;
                  color: rgba(0, 0, 0, 0.25);
                }
              }
              .button_line {
                height: 15%;
                background: #F7F9FA;
                display: flex;
                flex-direction: row;
                justify-content: space-around;

                .line {
                  width: 1px;
                  height: 50%;
                  background: #BFBFC5;
                  margin: auto 0;
                }
              }
            }
          }
        }
      }

    }
    .edit {
      .el-dialog {
        height: 70%;
        .el-dialog__header {
          border-bottom: 1px solid rgba(0, 0, 0, 0.09);
        }
        .el-dialog__body {
          padding: 15px 0px;
          .form_box {
            .el-form .el-form-item .el-form-item__content .el-input {
              width: 60%;
            }
            .dialog-footer {
              width: 100%;
              height: 15%;
              border-top: 1px solid rgba(0, 0, 0, 0.09);
              padding-top: 8px;
              .el-button {
                margin-right: 10px;
              }
            }
          }
        }
      }

    }

    .qr {
      .el-dialog {
        height: 450px;
        width: 30%;
        .el-dialog__body {
          padding: 10px 20px;
          .form_box .el-form {
            height: 91%;
            #qrcode {
              /*div{*/
              /*position: relative;*/
              /*}*/
              /*.logo{*/
              /*width: 10%;*/
              /*height: 10%;*/
              /*position: absolute;*/
              /*top: 33%;*/
              /*left: 42%;*/
              /*}*/
            }
          }
        }

      }
    }
  }


</style>