index.vue 6.63 KB
<!-- 车辆台账 -->
<template>
  <d2-container class="container">
    <div
      class="header"
      slot="header"
    >
      <d2-search
        ref="showSearch"
        class="show-search"
        :search-form="searchForm"
        :form-data="showFormData"
        label-width="150px"
      >
      </d2-search>
      <div class="up-btns">
        <el-button
          :id="tableParams.btnId"
          size="small"
          type="primary"
          handle
        >
          查询
        </el-button>
        <el-button
          size="small"
          @click="handleReset"
        > 重置 </el-button>
      </div>
    </div>
    <div class="d2-container-content">
      <d2-table-header>
        <auth-button
          category="Button"
          :show-btn-ids="['9200701']"
        />
      </d2-table-header>
      <d2-table
        ref="quitAndHandoverTable"
        :search-form="{
          t: searchFormSearch
        }"
        :table-params="tableParams"
        :get-list-api="getListApi"
        :before-search-fn="beforeSearchFn"
        :hasNum="false"
      >
        <template #auth-button="scope">
          <auth-button
            :data="scope.scope"
            :show-btn-ids="['9200702']"
          />
        </template>
      </d2-table>
    </div>
    <detail
      :visible.sync="detailVisible"
      :params-obj="detailParams"
    />
    <addHandover
      :visible.sync="addHandoverVisible"
      @refresh="refreshTable"
    />
  </d2-container>
</template>

<script>
import { deepClone } from "@/common/util"
import { getStaffHandover } from "@api/usedCarManagement"
import detail from './components/detail.vue'
import addHandover from './components/addHandover/index.vue'
// import {
// } from "./contant"
import dayjs from "dayjs"

// import reportTrackPageMixin from "@/mixins/reportTrackPageMixin"

export default {
  name: "quitAndHandover",
  components: {
    detail,
    addHandover
  },
  // mixins: [reportTrackPageMixin],
  data () {
    return {
      noDataUrl: require("@/assets/noData.png"),
      statusEnum: {},
      searchForm: {
        name: "",
        dateValue: ''
      },
      showFormData: [
        {
          label: "原责任人/新接收人",
          name: "name",
          type: "input",
          isClear: true,
          maxlength: 20
        },
        {
          label: "交接时间",
          name: "dateValue",
          type: "datePicker",
          dateType: "datetimerange",
          isClear: true,
          defaultTime: ["00:00:00", "23:59:59"]
        },
      ],
      tableSearchForm: {},
      getListApi: getStaffHandover,
      searchFormSearch: {},
      tableParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: "records",
        tableOption: {
          width: "96"
        },
        tableColumns: [
          {
            label: "交接批次号",
            prop: "handoverBatchNo",
            minWidth: 156
          },
          {
            label: "交接时间",
            prop: "handoverTime",
            minWidth: 121
          },
          {
            label: "原责任人 (离职)",
            prop: "originalUserName",
            minWidth: 176,
            formatter: (cellValue) => {
              return `${cellValue.originalUserName || '-'}/${cellValue.originalMerchantName || '-'}`
            }
          },
          {
            label: "新接收人",
            prop: "newUserName",
            minWidth: 176,
            formatter: (cellValue) => {
              return `${cellValue.newUserName || '-'}/${cellValue.newMerchantName || '-'}`
            }
          },
          {
            label: "交接资产数/辆",
            prop: "assetCount",
            minWidth: 176
          },
          {
            label: "交接类型",
            prop: "handoverType",
            minWidth: 168,
            formatter: (cellValue) => {
              return {
                1: "普通交接",
                2: "实物交接"
              }[cellValue.handoverType] || '-'
            }
          },
        ]
      },
      detailVisible: false,
      detailParams: {},
      addHandoverVisible: false
    }
  },
  computed: {
  },
  mounted () {
  },

  methods: {
    handleReset () {
      this.searchForm = this.$options.data.call(this).searchForm
      this.$refs.quitAndHandoverTable.refreshTable(true, true)
    },
    beforeSearchFn () {
      return new Promise((resolve) => {
        this.searchFormSearch = this.getParams()
        resolve()
      })
    },
    getParams () {
      const params = deepClone(this.searchForm)
      if (params.dateValue) {
        const [srart, end] = params.dateValue
        params.startTime = dayjs(srart).format("YYYY-MM-DD HH:mm:ss")
        params.endTime = dayjs(end).format("YYYY-MM-DD HH:mm:ss")
      }
      delete params.dateValue
      return params
    },
    handleDetail (e) {
      this.detailVisible = true
      this.detailParams = e
    },
    handleAddHandover () {
      this.addHandoverVisible = true
    },
    refreshTable () {
      this.$refs.quitAndHandoverTable.refreshTable(true, true)
    }
  }
}
</script>
<style scoped lang="scss">
.merchant-num {
  color: #185efe;
}

.circle {
  display: inline-block;
  border-radius: 50%;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  vertical-align: middle;
}

.merchant-wrap {
  max-height: 400px;
  overflow-y: auto;
}

.img-block {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;

  // ::v-deep .el-image__preview {
  //   cursor: zoom-in;
  // }
  .img {
    width: 100%;
    height: 100%;
  }

  .mask {
    background: #00000066;
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    transition: all 0.1s;
    z-index: 2;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
  }

  &:hover {
    .mask {
      opacity: 1;
    }
  }
}
.select-date-picker {
  display: flex;
  align-items: center;
  .select {
    height: 32px !important;
    width: 130px !important;
    ::v-deep .el-input__inner {
      border-radius: 4px 0 0 4px !important;
    }
  }
  .date-picker {
    width: calc(100% - 130px) !important;
    border-left-color: transparent;
    border-radius: 0 4px 4px 0 !important;
  }
  ::v-deep .el-range-editor.is-active,
  ::v-deep .el-range-editor.is-active:hover {
    border-left-color: #2a58ad;
  }
}
</style>