PortalMeetingRoomManager.vue 27.7 KB
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 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 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956
<template>
  <div class="fullheight">
    <el-container>
      <el-header style="height:135px;">
        <fieldset class="fieldset">
          <legend>基本信息</legend>
          <el-form v-form data-vv-scope="PortalMeetingConfigForm">
            <!--             <ht-form-item label="申请绑定流程">
              <el-checkbox
                v-model="PortalMeetingConfig.bindFlow"
                :true-label="1"
                :false-label="0"
              ></el-checkbox>
              <span
                v-if="PortalMeetingConfig.bindFlow"
                style="margin-right:10px;margin-left:10px;"
                >{{ flowObj.flowName }}</span
              >
              <el-button
                v-if="PortalMeetingConfig.bindFlow"
                type="primary"
                size="mini"
                icon="el-icon-search"
                @click="showFlowDialog()"
                >选择</el-button
              >
              <el-button
                v-if="PortalMeetingConfig.bindFlow && flowObj.flowKey"
                type="danger"
                size="mini"
                icon="el-icon-delete"
                @click="clearFlow()"
                >清除</el-button
              >
              <el-button
                v-if="PortalMeetingConfig.bindFlow && flowObj.flowKey"
                type="primary"
                size="mini"
                icon="el-icon-search"
                @click="showMappingDialog()"
                >关键字段映射</el-button
              >
              <eip-flow-dialog
                ref="eipFlowDialog"
                :single="true"
                name="eipFlowDialog"
                @onConfirm="dialogOnConfirm"
                append-to-body
              />
            </ht-form-item> -->
            <ht-form-item label="发布到日程">
              <el-checkbox
                v-model="PortalMeetingConfig.publishSchedule"
                :true-label="1"
                :false-label="0"
              ></el-checkbox>
            </ht-form-item>
            <!-- <ht-form-item label="绑定设备字典">
                 <div class="customQuery-inputs">
                  <el-select
                    @visible-change="dicClick"
                    clearable
                    v-model="PortalMeetingConfig.dicCode"
                    placeholder="请选择数据字典"
                    ref="dicSelect"
                    @clear="clearDic"
                  >
                    <el-option
                      :value="PortalMeetingConfig.dicCode"
                      :label="PortalMeetingConfig.dicName"
                      style="width: 100%;height:100%;overflow: auto;background-color:#fff">
                      <el-tree :data="dicData" :props="dicDefaultProps" @node-click="dicNodeClick"></el-tree>
                    </el-option>
                  </el-select>
                </div>
              </ht-form-item> -->
          </el-form>
          <div slot="footer" style="text-align: center">
            <el-button @click="beforeSaveDataConfigForm" type="primary">{{
              $t('eip.common.save')
            }}</el-button>
            <el-button @click="releaseColumn" type="success"
              >发布为栏目</el-button
            >
          </div>
        </fieldset>
      </el-header>
      <el-main style="height: calc(100% - 135px)!important;">
        <fieldset
          class="fieldset"
          style="height: calc(100% - 20px);    min-height: 300px;"
        >
          <legend>会议室资料</legend>
          <ht-table
            @load="loadData"
            :data="data"
            :pageResult="pageResult"
            :selection="true"
            quick-search-props="id"
            :show-export="false"
            :show-custom-column="false"
            @selection-change="handleSelectionChange"
            :custom-table-height="height"
            ref="htTable"
            class="mainTable"
          >
            <template v-slot:toolbar>
              <el-button-group>
                <el-button
                  size="small"
                  type="primary"
                  @click="showDialog()"
                  icon="el-icon-plus"
                  >添加</el-button
                >
                <ht-delete-button
                  :url="removeUrl"
                  :disabled="isDisabled"
                  :htTable="$refs.htTable"
                  >删除</ht-delete-button
                >
              </el-button-group>
            </template>
            <template>
              <ht-table-column
                type="index"
                width="50"
                align="center"
                label="序号"
              />
              <ht-table-column
                prop="name"
                label="会议室名称"
                :sortable="true"
                :show-overflow-tooltip="true"
              >
                <template v-slot="{row}">
                  <el-link
                    type="primary"
                    @click="showDialog(row.id)"
                    title="查看详情"
                    >{{ row.name }}</el-link
                  >
                </template>
              </ht-table-column>
              <ht-table-column
                prop="alias"
                label="别名"
                :sortable="true"
                :show-overflow-tooltip="true"
              >
              </ht-table-column>
              <ht-table-column
                prop="type"
                label="类型"
                :sortable="true"
                :show-overflow-tooltip="true"
              >
              </ht-table-column>
              <ht-table-column
                prop="capacity"
                label="容量(人)"
                :sortable="true"
                :show-overflow-tooltip="true"
              >
              </ht-table-column>
              <ht-table-column
                prop="floorRoomNumber"
                label="楼层房间号"
                :sortable="true"
                :show-overflow-tooltip="true"
              >
              </ht-table-column>
              <ht-table-column
                prop="status"
                label="状态"
                :filters="[
                  {text: '启用', value: 'enable'},
                  {text: '禁用', value: 'disable'}
                ]"
              >
                <template v-slot="{row}">
                  <el-tag type="success" v-if="row.status == 'enable'"
                    >启用</el-tag
                  >
                  <el-tag type="danger" v-else>禁用</el-tag>
                </template>
              </ht-table-column>
              <ht-table-column
                prop="createTime"
                label="创建时间"
                :sortable="true"
                :show-overflow-tooltip="true"
              >
              </ht-table-column>
              <ht-table-column
                prop="updateTime"
                label="更新时间"
                :sortable="true"
                :show-overflow-tooltip="true"
              >
              </ht-table-column>
            </template>
          </ht-table>
        </fieldset>
      </el-main>
    </el-container>
    <ht-sidebar-dialog
      width="32%"
      title="会议室管理"
      class="sp-manager__dialog"
      :visible="dialogVisible"
      :before-close="beforeCloseDialog"
    >
      <el-form v-form data-vv-scope="PortalMeetingRoomForm">
        <ht-form-item label="会议室名称">
          <ht-input
            v-model="PortalMeetingRoom.name"
            validate="required"
            :maxlength="20"
            :showWordLimit="true"
          />
        </ht-form-item>
        <ht-form-item prop="alias" label="会议室别名">
          <ht-input
            v-model="PortalMeetingRoom.alias"
            v-pinyin="PortalMeetingRoom.name"
            autocomplete="off"
            :validate="{
              required: true,
              alpha_dash: true,
              regex: {
                exp: '^[\\s\\S]{1,30}$',
                message: '内容超出输入限制'
              }
            }"
            placeholder="请输入别名"
            :disabled="PortalMeetingRoom.id ? true : false"
            :maxlength="20"
            :showWordLimit="true"
          />
        </ht-form-item>
        <ht-form-item label="会议室类型">
          <ht-input
            v-model="PortalMeetingRoom.type"
            validate="required"
            :maxlength="50"
            :showWordLimit="true"
          />
        </ht-form-item>
        <ht-form-item label="会议室容量">
          <ht-input
            type="number"
            v-model="PortalMeetingRoom.capacity"
            :min="0"
            :precision="0"
            :max="2147483647"
            size="small"
            style="width: 250px;"
            :validate="{
              required: true
            }"
          ></ht-input>
          <!--  <ht-input
            v-model.number="PortalMeetingRoom.capacity"
            :validate="{
              required: true,
              alpha_dash: true,
              regex: {
                exp: '^[0-9]*$',
                message: '请输入数字'
              }
            }"
            :maxlength="20"
            :showWordLimit="true"
          /> -->
        </ht-form-item>
        <ht-form-item label="会议室地址">
          <ht-input
            v-model="PortalMeetingRoom.address"
            validate="required"
            :maxlength="50"
            :showWordLimit="true"
          />
        </ht-form-item>
        <ht-form-item label="楼层房间号">
          <ht-input
            v-model="PortalMeetingRoom.floorRoomNumber"
            validate="required"
            :maxlength="20"
            :showWordLimit="true"
          />
        </ht-form-item>
        <ht-form-item label="包含设备">
          <el-button class="button-new-tag" size="small" @click="showEqInput"
            >+ 设备</el-button
          >
          <ul class="ul-box" v-if="equipmentTags.length > 0">
            <li
              class="li-item"
              v-for="(item, index) in equipmentTags"
              :key="index"
            >
              <ht-input
                class="input-new-tag"
                v-model="item.value"
                size="small"
                :maxlength="10"
                :showWordLimit="true"
              >
              </ht-input>
              <el-button
                class="button-new-tag"
                size="small"
                type="text"
                @click="handleEqClose(index)"
                >删除</el-button
              >
            </li>
          </ul>
        </ht-form-item>
        <ht-form-item label="会议室状态" label-width="100px">
          <ht-select
            v-model="PortalMeetingRoom.status"
            :options="[
              {key: 'enable', value: '启用'},
              {key: 'disable', value: '禁用'}
            ]"
            :validate="{required: true}"
          />
        </ht-form-item>
        <ht-form-item label="会议室描述">
          <ht-input
            type="textarea"
            :autosize="{minRows: 4, maxRows: 8}"
            v-model="PortalMeetingRoom.desc"
            :maxlength="200"
            :showWordLimit="true"
          />
        </ht-form-item>
      </el-form>
      <div slot="footer" style="text-align: right">
        <el-button @click="beforeCloseDialog">{{
          $t('eip.common.cancel')
        }}</el-button>
        <ht-submit-button
          :url="saveUrl"
          :model="PortalMeetingRoom"
          :request-method="saveMethod"
          scope-name="PortalMeetingRoomForm"
          @before-save-data="beforeSaveData"
          @after-save-data="afterSaveData"
          >{{ $t('eip.common.save') }}</ht-submit-button
        >
      </div>
    </ht-sidebar-dialog>
    <ht-sidebar-dialog
      width="32%"
      title="关键字段映射"
      class="sp-manager__dialog"
      :visible="mappingDialogVisible"
      v-if="mappingDialogVisible"
      :before-close="beforeCloseMappingDialog"
    >
      <el-form v-form data-vv-scope="PortalMeetingMappingForm">
        <ht-form-item
          v-if="boDefData && boDefData.length > 1"
          label="选择BO定义"
        >
          <ht-select
            filterable
            clearable
            v-model="selectBoAlias"
            :options="boDefData"
            @change="boDefDataChange"
            :props="{key: 'boDefAlias', value: 'desc'}"
          ></ht-select>
        </ht-form-item>

        <ht-form-item label="会议主题">
          <ht-select
            filterable
            clearable
            v-model="formFieldMap.subject"
            :options="boFields"
            :props="{key: 'boPath', value: 'desc'}"
          ></ht-select>
        </ht-form-item>
        <ht-form-item label="开始时间">
          <ht-select
            filterable
            clearable
            v-model="formFieldMap.startTime"
            :options="boFields"
            :props="{key: 'boPath', value: 'desc'}"
          ></ht-select>
        </ht-form-item>
        <ht-form-item label="结束时间">
          <ht-select
            filterable
            clearable
            v-model="formFieldMap.endTime"
            :options="boFields"
            :props="{key: 'boPath', value: 'desc'}"
          ></ht-select>
        </ht-form-item>

        <ht-form-item label="申请人">
          <ht-select
            filterable
            clearable
            v-model="formFieldMap.meetingOwner"
            :options="boFields"
            :props="{key: 'boPath', value: 'desc'}"
          ></ht-select>
        </ht-form-item>

        <ht-form-item label="申请人id">
          <ht-select
            filterable
            clearable
            v-model="formFieldMap.ownerOwnerId"
            :options="boFields"
            :props="{key: 'boPath', value: 'desc'}"
          ></ht-select>
        </ht-form-item>

        <ht-form-item label="参会人员">
          <ht-select
            filterable
            clearable
            v-model="formFieldMap.participants"
            :options="boFields"
            :props="{key: 'boPath', value: 'desc'}"
          ></ht-select>
        </ht-form-item>
        <ht-form-item label="参会人员id">
          <ht-select
            filterable
            clearable
            v-model="formFieldMap.participantsId"
            :options="boFields"
            :props="{key: 'boPath', value: 'desc'}"
          ></ht-select>
        </ht-form-item>

        <ht-form-item label="会议室名称">
          <ht-select
            filterable
            clearable
            v-model="formFieldMap.meetingName"
            :options="boFields"
            :props="{key: 'boPath', value: 'desc'}"
          ></ht-select>
        </ht-form-item>

        <ht-form-item label="会议室编码">
          <ht-select
            filterable
            clearable
            v-model="formFieldMap.alias"
            :options="boFields"
            :props="{key: 'boPath', value: 'desc'}"
          ></ht-select>
        </ht-form-item>

        <ht-form-item label="会议室设备">
          <ht-select
            filterable
            clearable
            v-model="formFieldMap.equipment"
            :options="boFields"
            :props="{key: 'boPath', value: 'desc'}"
          ></ht-select>
        </ht-form-item>

        <ht-form-item label="会议室地址">
          <ht-select
            filterable
            clearable
            v-model="formFieldMap.address"
            :options="boFields"
            :props="{key: 'boPath', value: 'desc'}"
          ></ht-select>
        </ht-form-item>
      </el-form>
      <div slot="footer" style="text-align: right">
        <el-button @click="beforeCloseMappingDialog">{{
          $t('eip.common.cancel')
        }}</el-button>
        <el-button type="primary" @click="saveMapping">{{
          $t('eip.common.save')
        }}</el-button>
      </div>
    </ht-sidebar-dialog>
  </div>
</template>
<script>
import utils from '@/hotent-ui-util.js'
import form from '@/api/form.js'
const eipFlowDialog = () => import('@/components/dialog/EipFlowDialog.vue')
import req from '@/request'
export default {
  components: {
    eipFlowDialog
  },
  data() {
    return {
      isSubmit: false,
      saveUrl: form.saveUrl,
      removeUrl: form.removeUrl,
      releaseUrl: form.releaseUrl,
      dialogVisible: false,
      mappingDialogVisible: false,
      data: [],
      pageResult: {
        page: 1,
        pageSize: 50,
        total: 0
      },
      PortalMeetingRoom: {},
      PortalMeetingConfig: {},
      flowObj: {
        flowKey: '',
        flowName: ''
      },
      saveMethod: 'POST',
      tagList: [],
      eqInputVisible: false,
      eqInputValue: '',
      equipmentTags: [],
      boDefData: [], //表单中bo定义
      selectBoAlias: '', //选中bo定义
      dicDefaultProps: {
        children: 'children',
        label: 'name'
      },
      dicData: [], //数据字典数据
      formFieldMap: {
        //流程表单字段映射关系数据
        subject: '',
        startTime: '',
        endTime: '',
        meetingOwner: '',
        ownerOwnerId: '',
        participants: '',
        participantsId: '',
        meetingName: '',
        alias: '',
        equipment: '',
        address: ''
      },
      boFields: [], //映射表单bo字段列表
      formFields: [
        {key: 'subject', name: '会议主题'},
        {key: 'startTime', name: '开始时间'},
        {key: 'endTime', name: '结束时间'},
        {key: 'meetingOwner', name: '申请人'},
        {key: 'ownerOwnerId', name: '申请人id'},
        {key: 'participants', name: '参会人员'},
        {key: 'participantsId', name: '参会人员id'},
        {key: 'meetingName', name: '会议室名称'},
        {key: 'alias', name: '会议室编码'},
        {key: 'equipment', name: '会议室设备'},
        {key: 'address', name: '会议室地址'}
      ],
      selectedList: [],
      isDisabled: true
    }
  },
  watch: {
    selectedList: {
      handler(val) {
        this.isDisabled = val.length < 1 ? true : false
      },
      deep: true
    }
  },
  computed: {
    height() {
      return this.$baseTableHeight()
    }
  },
  mounted() {
    this.$validator = this.$root.$validator
    this.getConfig()
    this.getTagList()
  },
  methods: {
    getConfig() {
      form.getMeetingConfig().then(
        resp => {
          this.PortalMeetingConfig = resp
          this.flowObj.flowKey = resp.flowKey
          this.flowObj.flowName = resp.flowName
        },
        error => {
          reject(error)
        }
      )
    },
    clearFlow() {
      this.$set(this.flowObj, 'flowKey', '')
      this.$set(this.flowObj, 'flowName', '')
    },
    //显示流程选择器
    showFlowDialog() {
      let select = []
      if (this.PortalMeetingConfig.flowKey) {
        select.push({
          defKey: this.PortalMeetingConfig.flowKey,
          name: this.PortalMeetingConfig.flowName
        })
      }
      this.$refs.eipFlowDialog.showDialog([])
    },
    dialogOnConfirm(data) {
      if (data && data.length > 0) {
        this.$set(this.flowObj, 'flowKey', data[0].defKey)
        this.$set(this.flowObj, 'flowName', data[0].name)
      } else {
        this.$set(this.flowObj, 'flowKey', '')
        this.$set(this.flowObj, 'flowName', '')
      }
    },
    showMappingDialog() {
      this.mappingDialogVisible = true
      this.getBoDefData()
    },
    beforeCloseMappingDialog() {
      this.mappingDialogVisible = false
    },
    releaseColumn() {
      form.releaseMeetingConfig(this.PortalMeetingConfig.id).then(resp => {
        if (resp.state) {
          this.getConfig()
          this.$message({
            message: '操作成功!',
            type: 'success'
          })
        }
      })
    },
    getBoDefData(boDefId) {
      let _this = this
      form.getBOTreeByFlowKey(this.flowObj.flowKey).then(response => {
        _this.boDefData = response.children
        if (_this.boDefData && _this.boDefData.length == 1) {
          _this.selectBoAlias = _this.boDefData[0].boDefAlias
          _this.boFields = _this.boDefData[0].children
          _this.addBoPath()
        }
        if (this.PortalMeetingConfig.fieldMapping) {
          const mapping = JSON.parse(this.PortalMeetingConfig.fieldMapping)
          if (this.boDefData.length > 1) {
            //存在多个bo时根据已选择的bo回填
            Object.keys(mapping).forEach(function(key) {
              if (mapping[key]) {
                _this.boDefDataChange(mapping[key].split('.')[0])
                return
              }
            })
          }
          if (this.PortalMeetingConfig.flowKey == this.flowObj.flowKey) {
            this.formFieldMap = {...this.formFieldMap, ...mapping}
          } else {
            this.formFieldMap = {
              //流程表单字段映射关系数据
              subject: '',
              startTime: '',
              endTime: '',
              meetingOwner: '',
              ownerOwnerId: '',
              participants: '',
              participantsId: '',
              meetingName: '',
              alias: '',
              equipment: '',
              address: ''
            }
          }
        }
      })
    },
    addBoPath() {
      //添加字段路径
      if (this.boFields && this.boFields.length > 0) {
        this.boFields.forEach(item => {
          item.boPath = item.path + '.' + item.name
        })
      }
    },
    dicClick(visible) {
      if (this.dicData && this.dicData.length > 0) return
      form.getCategory('DIC', data => {
        this.dicData = data.data
      })
    },
    dicNodeClick(data) {
      this.$set(this.PortalMeetingConfig, 'dicCode', data.typeKey)
      this.$set(this.PortalMeetingConfig, 'dicName', data.name)
      this.$refs.dicSelect.blur()
    },
    clearDic() {
      this.$set(this.PortalMeetingConfig, 'dicCode', '')
      this.$set(this.PortalMeetingConfig, 'dicName', '')
    },
    boDefDataChange(select) {
      this.selectBoAlias = select
      for (let i = 0; i < this.boDefData.length; i++) {
        if (select == this.boDefData[i].boDefAlias) {
          this.boFields = this.boDefData[i].children
          this.addBoPath()
          break
        }
      }
    },
    saveMapping() {
      let _this = this
      this.PortalMeetingConfig.fieldMapping = JSON.stringify(this.formFieldMap)
      this.PortalMeetingConfig = {...this.PortalMeetingConfig, ...this.flowObj}
      form.portalMeetingSave(this.PortalMeetingConfig).then(
        resp => {
          if (resp.state) {
            _this.getConfig()
            _this.$message.success('保存成功!')
            _this.mappingDialogVisible = false
          } else {
            this.$message.error(resp.data.message)
          }
        },
        error => {
          reject(error)
        }
      )
    },
    showDialog(id) {
      this.equipmentTags = []
      if (id) {
        this.saveMethod = 'PUT'
        form.getPortalMeetingRoom(id).then(
          resp => {
            this.PortalMeetingRoom = resp
            if (this.PortalMeetingRoom.equipment) {
              this.equipmentTags = this.PortalMeetingRoom.equipment
                .split(',')
                .map(item => {
                  return {value: item}
                })
            }
            this.dialogVisible = true
          },
          error => {
            reject(error)
          }
        )
      } else {
        this.saveMethod = 'POST'
        this.dialogVisible = true
        this.PortalMeetingRoom = {name: '', alias: '', status: 'enable'}
      }
    },
    beforeCloseDialog() {
      this.PortalMeetingRoom = {}
      this.dialogVisible = false
    },
    loadData(param, cb) {
      form
        .portalMeetingRoomQuery(param)
        .then(
          resp => {
            let response = resp
            this.data = response.rows
            this.pageResult = {
              page: response.page,
              pageSize: response.pageSize,
              total: response.total
            }
          },
          error => {
            reject(error)
          }
        )
        .finally(() => cb())
    },
    afterSaveData() {
      setTimeout(() => {
        this.beforeCloseDialog()
        this.$refs.htTable.load()
      }, 500)
    },
    beforeSaveData() {
      if (this.equipmentTags) {
        this.PortalMeetingRoom.equipment = this.equipmentTags
          .map(item => item.value)
          .toString()
      } else {
        this.PortalMeetingRoom.equipment = ''
      }
    },
    beforeSaveDataConfigForm() {
      if (this.PortalMeetingConfig.bindFlow) {
        if (!this.flowObj.flowKey) {
          this.$message.error('请选择绑定流程!')
          return
        }
      }
      this.$validator.validateAll('PortalMeetingConfigForm').then(result => {
        if (result) {
          form.getMeetingConfig().then(
            resp => {
              const publishSchedule =this.PortalMeetingConfig.publishSchedule
              this.PortalMeetingConfig = resp
              this.PortalMeetingConfig.publishSchedule=publishSchedule
              this.flowObj.flowKey = resp.flowKey
              this.flowObj.flowName = resp.flowName
              req
                .post(this.releaseUrl, this.PortalMeetingConfig)
                .then(response => {
                  this.getConfig()
                  this.$message.success('保存成功!')
                })
            },
            error => {
              reject(error)
            }
          )
        } else {
          let arr = this.$validator.errors.items.filter(
            item => item.scope == 'PortalMeetingConfigForm'
          )
          let errorLength = arr.length
          this.$message({
            showClose: true,
            message: `有${errorLength}个字段未通过校验,请正确填写表单内容。`,
            type: 'warning'
          })
        }
      })
    },
    getTagList() {
      form.getPortalNewsTag().then(
        resp => {
          this.tagList = resp
        },
        error => {
          reject(error)
        }
      )
    },
    handleEqClose(index) {
      this.equipmentTags.splice(index, 1)
    },

    showEqInput() {
      // this.eqInputVisible = true
      // this.$nextTick(_ => {
      //   this.$refs.saveTagInput.$refs.input.focus()
      // })
      this.equipmentTags.push({value: ''})
    },

    handleEqInputConfirm() {
      let inputValue = this.PortalMeetingRoom.equipment
      if (inputValue) {
        this.equipmentTags.push(inputValue)
      }
      this.eqInputVisible = false
      this.PortalMeetingRoom.equipment = ''
    },
    handleSelectionChange(selection) {
      this.selectedList = selection
    }
  }
}
</script>

<style lang="scss" scoped>
.sp-manager__dialog /deep/ > .el-dialog > .el-dialog__body {
  height: calc(100% - 190px);
}
.el-tag + .el-tag {
  margin-left: 10px;
}
.ul-box {
  margin-top: 10px;
  li {
    width: 194px;
    display: flex;
    justify-content: space-between;
    background: #f5f7fa;
    margin-bottom: 8px;
    padding: 6px 14px;
  }
}
.button-new-tag {
  margin-left: 10px;
  height: 32px;
  line-height: 30px;
  padding-top: 0;
  padding-bottom: 0;
}
.input-new-tag {
  width: 150px;
  // margin-left: 10px;
  vertical-align: bottom;
}
.el-container {
  height: 100%;
}

/deep/ .fieldset {
  border: 2px solid #ebeef5 !important;
}

.fieldset >>> .el-form {
  /*  margin: 20px; */
}
.main-body {
  ::v-deep {
    .el-table {
      .el-table__body-wrapper {
        max-height: 178px !important;
      }
    }
  }
  .ht-table-panel {
    overflow: auto;
  }
}

.fieldset >>> .ht-table-panel {
  margin: 10px;
}

.customQuery-inputs >>> .inputs,
.customQuery-inputs >>> .inputs .el-select {
  width: 100%;
}
.mainTable {
  height: 99% !important;
  ::v-deep .el-table {
    // min-height: 50px !important;

    height: calc(100% - 142px) !important;
    overflow-y: auto;

    .el-table__body-wrapper {
      height: calc(100% - 42px);
    }
  }

  height: calc(100% - 190px);
  width: calc(100vw - 390px);
}
</style>