serviceGuidePage.vue 14.4 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 196 197 198 199 200 201 202 203 204 205
<template>
  <div class="serviceGuidePage 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 label="网点归属:" v-if="roleId != 3">
            <el-select size="mini" v-model="form.bankId" placeholder="请选择网点归属" filterable clearable @change="Search">
              <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"></el-option>
            </el-select>
          </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-item class="r-float">
            <el-button size="mini" type="primary" v-show="roleId == 3"  class="btn_form_add"  icon="el-icon-plus" @click="addService">&nbsp;&nbsp;&nbsp;</el-button>
            <el-button size="mini" type="primary" v-show="roleId == 3"  class="btn_form_add" @click="handleSort">点击排序</el-button>
          </el-form-item>
        </el-form>
        <div class="scrool">
          <el-table style="width:100%;" ref="multipleTable" :data="tableData">
            <el-table-column prop="name"  width="70">
              <template slot-scope="scope">
                <div class="videoImg">
                  <img :src="scope.row.icon" alt="">
                </div>
              </template>
            </el-table-column>
            <el-table-column show-overflow-tooltip prop="name" label="业务名称" ></el-table-column>

            <el-table-column label="创建人" prop="createEmployee" ></el-table-column>
            <el-table-column label="创建时间" prop="createTime" width="150">
              <template slot-scope="scope">
                {{scope.row.createTime | dateformat('YYYY-MM-DD HH:mm:ss')}}
              </template>
            </el-table-column>
            <el-table-column label="网点归属" prop="bankName" ></el-table-column>
            <el-table-column label="审核人" prop="reviewerName" ></el-table-column>
            <el-table-column label="状态" prop="status" >
              <template slot-scope="scope">
                <div class="statusBox">
                <span class="active"
                      :style="{'backgroundColor':(scope.row.status == 0 ? 'rgba(24,144,255,1)':(scope.row.status == 2 ||scope.row.status == 3 ? 'rgba(250,173,20,1)':(scope.row.status == 1 || scope.row.status == 6 ? 'rgba(245,34,45,1)':(scope.row.status == 4 ? 'rgba(82,196,26,1)':'rgba(0,0,0,0.25)'))))}"></span>
                  <span class="openKey">{{scope.row.status == 0 ? '编辑中':(scope.row.status == 1 ? '上线被驳回':(scope.row.status == 2 ? '上线审核中':(scope.row.status == 3 ? '下线审核中':(scope.row.status == 4 ?'上线中':(scope.row.status == 5 ?'下线中': '下线被驳回')))))}}</span>
                </div>
              </template>
            </el-table-column>
            <el-table-column label="操作" header-align="center" align="center">
              <template slot-scope="scope">
                <el-button-group>
                  <el-button title="编辑" v-if="(scope.row.status == '0' ||scope.row.status == '1') && roleId == 3"
                             size="mini" type="text" @click="openEdit(scope.row)">编辑 |
                  </el-button>
                  <el-button title="申请下线" type="text" size="mini"
                             v-if="(scope.row.status == '4' ||scope.row.status == '6') && roleId == 3"
                             @click="handleLine(scope.row)">申请下线 |
                  </el-button>
                  <el-button title="查看" type="text" size="mini"
                             v-if="roleId != 3 || (roleId == 3 && (scope.row.status == '2' ||scope.row.status == '3' ||scope.row.status == '4' ||scope.row.status == '5' ||scope.row.status == '6'))"
                             @click="openDetails(scope.row)">查看
                  </el-button>
                  <el-button title="删除" type="text" size="mini"
                             v-if="(scope.row.status == '0' ||scope.row.status == '1') && roleId == 3"
                             @click="handleDelete(scope.row)">删除
                  </el-button>
                </el-button-group>
              </template>
            </el-table-column>
          </el-table>
        </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 class="sort-dialog dialog-box">
      <el-dialog title="排序" :visible.sync="dialogVisible" width="48%">
        <span class="tips">Tips:拖动可改变业务列表在app端显示顺序!</span>
        <div class="hidden-box">
          <ul class="list">
            <li class="item" v-for="(item, i) in sortList" :key="item.id"
                v-dragging="{item: item, list: sortList, group: 'item' }">
              <img :src="item.icon" alt="" class="icon">
              <span class="title">{{item.name}}</span>
              <span class="index">{{i+1}}</span>
            </li>
          </ul>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button size="small" @click="dialogVisible = false">取 消</el-button>
          <el-button size="small" type="primary" @click="submitSort">确 定</el-button>
        </span>
      </el-dialog>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        page: {
          currentPage: 1, //当前页
          pageSize: null, //每页条数
          total: null, //总条数
        },
        form: {
          name: '',
          bankId: ''
        },
        options: '',
        tableData: [],
        disabled: true,
        roleId: '',
        userId: '',
        bankBranchId: '',
        dialogVisible: false,
        sortList: [],
      }
    },
    computed: {},
    mounted() {
      this.initData();
    },
    components: {},
    methods: {
      addService() {
        this.$router.push('/newServiceGuide');
      },
      initData() {
        this.roleId = localStorage.getItem('roleId');
        this.userId = localStorage.getItem('userId');
        this.bankBranchId = localStorage.getItem('bankBranchId');
        this.onSearch();
        this.getBranch();
      },
      // 归属网点列表渲染
      getBranch() {
        let _this = this;
        _this.$https({
          method: 'get',
          url: 'bankBranchInfo/getBankBox?action=query&roleId='+_this.roleId+'&bankId='+_this.bankBranchId,
          authType: this.backToken
        }).then((res) => {
            _this.options = res.data;
          }, (error) => {
            console.log(error)
          }
        )
      },
      // 获得数据接口
      getTableData(param) {
        let vm = this;
        vm.$https({
          url: "businessInfo/getList",
          method: 'get',
          authType: this.backToken
        }, param).then((res) => {
          let data = res.data;
          vm.page.pageSize = data.size;
          vm.page.total = data.total;
          vm.tableData = data.records;
        }).catch(function (err) {
          console.log(err);
        })
      },
      // 分页
      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,
          "bankId":  _this.form.bankId,
          "name": _this.form.name,
          'roleId': _this.roleId,
          'userId': _this.userId,
          'currentBankId': _this.bankBranchId
        };
        this.getTableData(searchObj);
      },
      // // 获取当前查询参数
      getSearchQuery() {
        let _this = this;
        let searchObj = {
liqin's avatar
liqin committed
206
          "_index":  _this.page.currentPage,
qzhxx's avatar
qzhxx committed
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
          "_size": _this.page.pageSize,
          'roleId': _this.roleId,
          'userId': _this.userId,
          'currentBankId': _this.bankBranchId
        };
        for (let key in _this.form) {
          if (_this.form[key]) {
            searchObj[key] = _this.form[key];
          }
        }
        return searchObj;
      },
      // 编辑
      openEdit(row) {
        this.$router.push({path: '/newServiceGuide', query: {id: row.id}})
      },
      handleLine(row) {
        let _this = this;
        if (row.status == 4 || row.status == 6) {
          this.$confirm('是否下线当前业务?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning',
          }).then(() => {
            _this.$https({
              method: 'put',
              url: 'businessInfo/disable?id=' + row.id,
              authType: this.backToken
            }).then((res) => {
                _this.onSearch();
                this.$message({
                  type: 'success',
                  message: '下线成功!'
                });
              }, (error) => {
                this.$message({
                  type: 'fail',
                  message: "下线失败!" + error.response.data
                });
              }
            )
          })
        } else {
          this.$confirm('是否上线当前业务?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning',
          }).then(() => {
            _this.$https({
              method: 'put',
              url: 'businessInfo/enable?id=' + row.id,
              authType: this.backToken
            }).then((res) => {
                _this.onSearch();
                this.$message({
                  type: 'success',
                  message: '上线成功!'
                });
              }, (error) => {
                this.$message({
                  type: 'fail',
                  message: "上线失败!" + error.response.data
                });
              }
            )
          })
        }


      },
      // 查看详情
      openDetails(row) {
        this.$router.push({path: '/auditMsg', query: {id: row.id, isTitle: 0}});
      },
      // 删除
      handleDelete(row) {
        let _this = this;
        this.$confirm('此操作将永久删除该信息, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
        }).then(() => {
          _this.$https({
            method: 'delete',
            url: 'businessInfo/delete?id=' + row.id,
            authType: this.backToken
          }).then((res) => {
              this.$message({type: 'success', message: '删除成功!'});
              _this.Search();
            }, (error) => {
              this.$message({
                type: 'fail',
                message: "删除失败!" + error.response.data
              });
            }
          )
        })
      },
      handleSort() {
        this.dialogVisible = true;
        this.getSortList();
      },
      getSortList() {
        let _this = this;
        let params = {
          _size: 100,
          bankId: localStorage.getItem('bankBranchId'),
          roleId: localStorage.getItem('roleId')
        };
        _this.$https({
          method: 'get',
          url: 'businessInfo/getAppBusinessList',
        }, params).then((res) => {
            _this.sortList = res.data.records;
          }, (error) => {
          }
        )
      },
      submitSort() {
        let _this = this;
        let oldList = [];
        _this.sortList.forEach((e) => {
          let obj = {
            id: e.id
          };
          oldList.push(obj)
        });
        let params = {
          bankBranchId: localStorage.getItem('bankBranchId'),
          oldList: oldList
        }
        _this.$https({
          method: 'put',
          url: 'businessInfo/sort',
          authType: this.backToken
        }, params).then((res) => {
            _this.$message({
              type: 'success',
              message: res.data.message
            });
            _this.dialogVisible = false;
          }, (error) => {
          }
        )
      }
    }
  }
</script>

<style lang="less">
  @import '../../style/common';

  .serviceGuidePage {
    .content_box {
      min-width: 870px;
      .input_box {
        width: 100%;
        min-width: 815px;
        margin-bottom: 30px;
        .el-input, .el-select {
          max-width: 272px;
          /*height: 32px;*/
          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;
        }
      }
      .videoImg {
        width: 100%;
        height: 48px;
        img {
          width: 48px;
          height: 48px;
        }
        .item{
          margin: 4px;
        }
        p {
          width: 100px;
          height: 100%;
          float: right;
          line-height: 48px;
          /*overflow: hidden;*/
          /*-webkit-line-clamp: 2;*/
          /*text-overflow: ellipsis;*/
          /*display: -webkit-box;*/
          /*! autoprefixer: off */
          /*-webkit-box-orient: vertical;*/
          /* autoprefixer: on */
        }
      }
      .scrool{
        width: 100%;
        height: calc(100% - 100px);
        overflow-x: hidden;
        overflow-y: scroll;
        .el-table {
          .el-table__header-wrapper {
            .el-table__header {
              .has-gutter tr th {
                background: rgba(250, 250, 250, 1);
              }
            }
          }
          .el-table__body-wrapper {
            width: 100%;
            table tbody tr td {
              padding: 6px 0px;
            }
          }
        }
      }
    }
  }
</style>