<template>
  <div>
    <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"
    >
      <el-table-column label="序号" align="center">
        <template scope="scope">
          <span>{{ scope.$index + 1 }}</span>
        </template>
      </el-table-column>
      <el-table-column align="center" :label="getLabelName" width="200" prop="name">
        <template slot-scope="scope">
          {{ scope.row[listType]?.name }}
        </template>
      </el-table-column>
      <el-table-column align="center" label="规格" width="180" prop="model">
        <template slot-scope="scope">
          {{ scope.row[listType]?.model }}
        </template>
      </el-table-column>
      <el-table-column align="center" label="编码" width="180" prop="code">
        <template slot-scope="scope">
          {{ scope.row[listType]?.code }}
        </template>
      </el-table-column>
      <el-table-column align="center" label="数量" width="180" prop="itemCount"/>
      <el-table-column align="center" label="单位" width="180" prop="unit">
        <template slot-scope="scope">
          <dict-tag :type="DICT_TYPE.REPAIR_UNIT" v-model="scope.row[listType].unit"/>
        </template>
      </el-table-column>
      <el-table-column align="center" label="单价" width="180" prop="itemPrice"/>
      <el-table-column align="center" label="折扣" width="180" prop="itemDiscount"/>
      <el-table-column align="center" label="金额" width="180" prop="itemMoney"/>
      <el-table-column align="center" label="施工人员" width="180" prop="repairName"/>
      <el-table-column align="center" label="销售人员" width="180" prop="saleName"/>
      <el-table-column align="center" label="备注" width="180" prop="remark"/>
    </el-table>
  </div>
</template>

<script>
export default {
  name: "TicketItemShow",
  props: {
    list: {
      type: Array,
      default: () => {
        return []
      }
    },
    listType: {
      type: String,
      default: null
    }
  },
  data() {
    return {
      loading: !(this.list && this.list.length),
    }
  },
  computed: {
    getLabelName() {
      switch (this.listType) {
        case "project":
          return "维修项目";
        case "ware":
          return "维修配件";
        case "other":
          return "附加费用";
        default:
          return '';
      }
    }
  },
  methods: {}
}
</script>

<style scoped lang="scss">

</style>
