TemplatePreview.vue 15.2 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
<template>
  <div :class="{ 'ht-amis-page': aliasName }">
    <ht-template-preview
      v-if="!aliasName"
      ref="httemplate"
      :template-key="key"
      :single="single"
      :task-type="taskType"
      :def-key="defKey"
      :data-view="dataView"
      :is-join-flow="isJoinFlow"
      :table-height="tableHeight"
      :parameterq-querys="querys"
    ></ht-template-preview>
    <amis v-else :alias="aliasName" :locals="{ meta: $route.meta }" />
    <el-dialog
      v-if="amisDialogVisible"
      :visible.sync="amisDialogVisible"
      v-bind="amisDialogParams"
      append-to-body
    >
      <amis
        v-if="amisDialogVisible"
        :alias="amisDialogAlias"
        :locals="amisData"
      />
      <span slot="footer">
        <el-button @click="amisDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="amisDialogVisible = false">
          确 定
        </el-button>
      </span>
    </el-dialog>
    <stock-audit-dialog
      ref="stockAuditDialog"
      @handleRefresh="handleRefresh"
    ></stock-audit-dialog>
    <!-- 分配补货员dialog -->
    <distributionDialog
      ref="distributionDialog"
      @handleRefresh="handleRefresh"
    />
    <!-- 绑定货柜dialog -->
    <bindingContainersDialog
      ref="bindingContainersDialog"
      @handleRefresh="handleRefresh"
    />
    <!-- 商品库存-查看货物流水明细 -->
    <streamDialog ref="streamDialog"></streamDialog>
    <!-- 项目招标 -->
    <bidPageDialog
      ref="bidPageDialog"
      @handleRefresh="handleRefreshSupplier"
    ></bidPageDialog>
    <supplierTableDilog
      ref="supplierTableDilog"
      @handleRefresh="handleRefreshSupplier"
    ></supplierTableDilog>
    <initSupplierTableDilog
      ref="initSupplierTableDilog"
      @handleRefresh="handleRefreshSupplier"
    ></initSupplierTableDilog>
    <selectSupplierDilog
      ref="selectSupplierDilog"
      @handleRefresh="handleRefreshSupplier"
    ></selectSupplierDilog>
    <place-order-dialog ref="placeOrderDialog" @handleRefresh="handleRefresh"></place-order-dialog>
    <member-info-dialog ref="memberInfoDialog" @handleRefresh="handleRefresh"></member-info-dialog>
    <gas-cylinder-archives-dialog ref="gascylinderarchivesdialog"></gas-cylinder-archives-dialog>
  </div>
</template>

<script>
  import placeOrderDialog from "@/components/dialog/placeOrderDialog";
  import MemberInfoDialog from "@/components/dialog/memberInfoDialog";
  import GasCylinderArchivesDialog from "@/components/dialog/gasCylinderArchivesDialog";
  var _that = this
  export default {
    name: 'TemplatePreview',
    components: {
      // StockAuditDialog,
      // distributionDialog,
      // streamDialog,
      // bindingContainersDialog,
      // bidPageDialog,
      // supplierTableDilog,
      // initSupplierTableDilog,
      // selectSupplierDilog,
      placeOrderDialog,
      MemberInfoDialog,
      GasCylinderArchivesDialog
    },
    props: {
      templateKey: {
        type: String,
        default: '',
      },
      parameterqQuerys: {
        type: String,
        default: '',
      },
      single: {
        type: String,
        default: '',
      },
      taskType: {
        type: String,
        default: '',
      },
      defKey: {
        type: String,
        default: '',
      },
      dataView: {
        type: Object,
        default: function () {
          return null
        },
      },
      isJoinFlow: {
        type: Boolean,
        default: false,
      },
    },
    data() {
      return {
        key: this.templateKey,
        querys: this.parameterqQuerys,
        amisDialogVisible: false,
        amisDialogParams: {
          title: 'AMIS弹框',
          width: '50%',
        },
        amisDialogPage: {},
        amisData: {},
        aliasName: '',
        amisDialogAlias: '',
      }
    },
    computed: {
      tableHeight() {
        let iframeURL =
          parent.document.getElementById('template-iframe-dialog_iframe') &&
          parent.document.getElementById('template-iframe-dialog_iframe')
            .contentWindow.location.href
        let isDialog = false
        if (iframeURL) {
          isDialog = this.getparameterFromURL(iframeURL, 'isDialog')[1] || false
        }
        return this.$baseTableHeight(30, isDialog)
      },
    },
    created() {
      if (!this.key && this.$route.meta.templateKey) {
        this.key = this.$route.meta.templateKey
      }
      if (!this.parameterqQuerys && this.$route.params.parameterqQuerys) {
        this.querys = this.$route.params.parameterqQuerys
      }
      this.init()
    },
    methods: {
      init() {
        this.aliasName = this.$route.meta.pageType === 'amis' ? this.key : ''
      },
      //商品入库审核对话框
      handleAudit(_this, row) {
        this.$refs.stockAuditDialog.showDialog(row)
      },
      showBidPage(row, action, _this) {
        _that = _this
        this.$refs.bidPageDialog.show(row, action)
      },
      handleRefreshSupplier() {
        _that.search()
      },
      //刷新列表页
      handleRefresh() {
        setTimeout(() => {
          this.$refs.httemplate.init()
        }, 300)
        this.$forceUpdate()
      },
      showSelectSupplier(row, action, _this) {
        _that = _this
        this.$refs.selectSupplierDilog.show(row, action)
      },
      showDistributionDialog(row) {
        this.$refs.distributionDialog.open(row)
      },
      showBindingContainersDialog(row) {
        this.$refs.bindingContainersDialog.open(row)
      },
      showSupplierList(row, _this) {
        _that = _this
        this.$refs.initSupplierTableDilog.show(row)
      },
      showBidPagePool(row, _this) {
        _that = _this
        this.$refs.supplierTableDilog.show(row, _this)
      },
      getparameterFromURL(url, para) {
        var reg = new RegExp('[?&]' + para + '=([^&]+)', 'g')
        var matcher = reg.exec(url)
        if (matcher != null) {
          return matcher
        }
        return ''
      },
      // 展示商品库存-流水明细弹窗
      showDialog(row) {
        this.$refs.streamDialog.open(row.id_)
      },
      showGasCylinderArchivesDialog(type,row){
        this.$refs.gascylinderarchivesdialog.open(type,row);
      },
      showMemberInfoDialog(row){
        console.log('打印row', row);
        this.$refs.memberInfoDialog.open(row);
      },
      showPlaceOrderDialog(row){
        this.$refs.placeOrderDialog.open(row);
      },
      // 显示amis页面
      async showAMIS(aliasName, type, data, dialogParams) {
        if (data) {
          this.amisData = data
        }
        if (aliasName) {
          this.amisDialogAlias = aliasName
          // 传给弹框amis页面的参数
          this.amisData = {}
          this.amisDialogVisible = type === 'dialog'
          dialogParams && Object.assign(this.amisDialogParams, dialogParams)
          if (type === 'page') {
            // 如果是页面则aliasName传对应页面的路径
            this.$router.push(aliasName)
          }
        }
      },
    },
  }
</script>
<style lang="scss">
  .summary-table {
    padding: 10px 24px 24px 24px;

    .project-column {
      .cell {
        font-size: 16px;
        color: #333;
        font-weight: bold;
      }
    }

    .summary-num {
      .summary-table-field {
        font-size: 18px;
        color: #4ba232;
        font-weight: bold;
      }
    }
  }

  .custom-summary {
    padding: 10px 24px 24px 24px;
  }

  .data_view {
    .table-main {
      flex: unset;
      // height: 100%;
    }

    .top_btn_col {
      .data-form-list__top-btn {
        margin-left: 10px;
        margin-bottom: 10px;

        &:first-child {
          margin-left: 0;
        }
      }
    }
  }

  .import-log-dialog {
    .ht-table-panel {
      padding: 0 48px 13px 48px;
    }
  }

  .failure-reason-dialog {
    .el-dialog__body {
      padding: 32px 48px 48px 48px;

      .error-info {
        padding: 16px;
        color: #e55555;
        background: rgba(249, 249, 249, 0.39);
      }
    }
  }

  .template-preview {
    .top_btn_col > .el-button {
      &:first-child {
        border: var(--themeColor);
        background-color: var(--themeColor);
        color: #fff;
      }
    }
  }

  @media print {
    body {
      height: auto !important;
    }

    .notprint {
      display: none;
    }

    .el-table__fixed {
      display: none;
    }

    .el-table_1_column_1 {
      display: none;
    }

    .el-table__body-wrapper {
      overflow: hidden;
      position: relative;
      max-height: fit-content !important;
      height: auto;
      width: 100% !important;
    }

    .ht-table-panel {
      width: 100%;
      max-height: fit-content !important;
      height: auto !important;
    }

    // .el-table__cell {
    //   border: 2px solid #ebeef5 !important;
    // }

    .ht-table-panel {
      padding: 0;
      height: auto;
      overflow: hidden;
    }

    .top_btn_col {
      display: flex;
      align-items: center;

      .el-button {
        margin-right: 10px;
      }
    }

    tr {
      page-break-inside: avoid !important;
    }

    .el-table .cell {
      white-space: pre-wrap !important;
      text-overflow: unset !important;
      width: 100% !important;
    }

    // .el-table {
    //   max-height: fit-content !important;
    //   height: auto !important;
    //   width: 100%;
    //   .el-table__header-wrapper table,
    //   .el-table__body-wrapper table {
    //     width: 100% !important;
    //     table-layout: auto !important;
    //   }
    //   .el-table__body,
    //   .el-table__footer,
    //   .el-table__header {
    //     table-layout: auto !important;
    //   }
    // }
    // @page {
    //   /* 纵向展示(高度展示内容更多) */ /* size: portrait;*/ /* 横向(宽度展示内容更大) */
    //   size: landscape; /* 打印的边距 上右下左 */
    //   margin: 1cm 2cm 1cm 2cm;
    // }
    .el-table thead.is-group th {
      text-align: center;
    }

    // tbody {
    //   text-align: center;
    //   border: 1px solid #000;
    // }
    // // tr,
    // th {
    //   border: 1px solid #000;
    // }
    // .el-table th.el-table__cell.is-leaf,
    // .el-table td.el-table__cell,
    // .el-table td.el-table__cell,
    // td {
    //   border: 1px solid #000;
    // }
    tbody > tr > th,
    tbody > tr > td,
    tfoot > tr > td,
    thead > tr > th {
      border: 1px solid rgb(238, 235, 235) !important;
    }

    .el-table__header {
      border: 1px solid rgb(238, 235, 235) !important;
    }

    .el-table__header > tbody > tr > th,
    .el-table__header > tbody > tr > td,
    .el-table__header > tfoot > tr > td,
    .el-table__header > thead > tr > th {
      border: 1px solid rgb(238, 235, 235) !important;
    }

    .el-table__body > tbody > tr > th,
    .el-table__body > tbody > tr > td,
    .el-table__body > tfoot > tr > td,
    .el-table__body > thead > tr > th {
      border: 1px solid rgb(238, 235, 235) !important;
    }

    /*减小单元格间距*/
    .el-table th,
    .el-table td {
      padding: 0 0;
    }

    /*显示底部边框 估计打印时伪元素把border覆盖了 height设为0隐藏伪元素*/
    .el-table::before {
      height: 0;
    }

    /*显示右边框*/
    .el-table--group::after,
    .el-table--border::after {
      width: 0;
    }

    table,
    tbody,
    thead {
      width: 100% !important;
    }

    colgroup {
      position: absolute;
      width: 100% !important;
    }

    table {
      width: 100% !important;
    }

    .cell > span {
      white-space: pre-wrap !important;
    }

    .el-table {
      height: 100% !important;
      max-height: fit-content !important;
      width: 100% !important;
    }

    .el-table__body-wrapper {
      height: 100% !important;
      max-height: fit-content !important;
      width: 100% !important;
    }

    .table_layout_wrap {
      margin: 0 !important;
    }

    // .el-table__fixed,
    // .el-table__fixed-right,
    // .el-table__fixed-right-patch
    // {
    //   display: none !important;
    // }
    .dropdown-upload__btn {
      .el-button-group {
        .el-button {
          &:first-child {
            height: 28px !important;
            line-height: 28px;

            span {
              display: flex;
              align-items: center;
              margin-top: -8px;
            }
          }
        }
      }
    }
  }
  // 高级搜索字体高度不满问题
  .search-field-label {
    line-height: normal !important;
  }

  .ht-table-panel {
    .search-panel {
      background-color: #fff !important;
      position: relative;
      padding: 0 0 16px !important;
      &:after {
        content: '';
        position: absolute;
        left: -20px;
        right: -20px;
        height: 16px;
        bottom: -16px;
        background-color: var(--containerBgColor);
      }
      .el-form {
        display: flex;
        .search-panel__container {
          flex: 1;
          flex-shrink: 0;
          .search-panel__row {
            min-width: inherit;
          }
        }
      }
      .search-field__container {
        display: flex;
        height: 36px;
        margin-bottom: 0;
        .field-label-panel {
          flex-shrink: 0;
          position: relative;
          top: 2px;
        }
        .field-input-panel {
          flex: 1;
          width: inherit !important;
        }
        &:nth-of-type(n + 4) {
          margin-top: 16px;
        }
      }
      .search-btn__wrap {
        display: inline-flex;
        gap: 8px;
        flex-flow: row-reverse;
        height: 36px;
      }
      .el-input__inner {
        height: 36px !important ;
        line-height: 36px !important;
        border-radius: 4px !important;
      }
      .el-range-editor--mini {
        .el-range-input {
          position: relative;
          top: 2px;
        }
        .el-range__icon,
        .el-range__close-icon,
        .el-range-separator {
          line-height: 32px;
        }
      }
    }
  }

  .data_view {
    .button-container [plain] {
      color: var(--themeColor) !important;
    }
    .el-dropdown-menu__item[name='删除'] {
      color: red !important;
    }
    .el-button {
      border-radius: 4px;
    }
    .table-main {
      padding: 0;
      .toolbar-container {
        padding-top: 16px;
      }
      .ht-table-panel {
        padding: 16px;
      }
    }
    .top_btn_col {
      .el-button {
        background-color: var(--themeColor);
        border-color: var(--themeColor);
        color: #fff !important;
        height: 36px;
        &:hover {
          background-color: var(--themeColor) !important;
          border-color: var(--themeColor) !important;
        }
      }
    }
    .el-pagination {
      .el-pager li,
      .btn-prev,
      .btn-next {
        background-color: transparent;
        border: 1px solid #d9d9d9;
        border-radius: 4px;
      }
      .el-input__inner {
        border-color: #d9d9d9;
        border-radius: 4px;
      }
    }
    .data-preview-wrap {
      gap: 16px;
      background-color: transparent;
      .el-aside {
        border-right-color: transparent !important;
        background-color: #fff;
      }
      .el-scrollbar,
      .el-container {
        height: $base-app-main-height;
      }
    }
    .el-tree-node__expand-icon {
      font-size: 16px;
    }
  }
  .base-main {
    .form-container {
      padding-top: 16px;
    }
  }
  .ht-amis-page {
    .cxd-Page-body {
      padding: 0;
    }
  }
</style>