<template>
  <!-- 协议管理 新增、编辑 表单组件 -->
  <div>
    <TableModel
      :columnsList="columnsListDetail"
      :show-btn-crews="false"
      ref="tableRef"
      :send-params="transObj"
      :request-api="queryPurchaseArrivalListInnerApi"
      :show-sel="false"
      :show-operation="false"
    >
<!--      <template slot="handle" slot-scope="{ data }">
        <el-button
          type="primary"
          size="mini"
        >查看</el-button
        >
        <el-button
          type="danger"
          size="mini"
        >上传</el-button
        >
      </template>-->
      <template slot="purchaseNum" slot-scope="{ data }">
        {{ data.purchaseNum / 1000 }}
      </template>
      <template slot="purchasePrice" slot-scope="{ data }">
        {{ data.purchasePrice / 100 }}
      </template>
      <template slot="notaxPrice" slot-scope="{ data }">
        {{ data.notaxPrice / 100 }}
      </template>
      <template slot="supplierId" slot-scope="{ data }">
        {{ data.supplierName }}
      </template>
      <template slot="status" slot-scope="{ data }">
            <span style="color: #D9001B">
              {{ data.statusName }}
            </span>
      </template>
      <template slot="files" slot-scope="{ data }">
        <span
          style="color: #02A7F0; cursor: pointer;"
        >报告管理</span>
      </template>
    </TableModel>
  </div>
</template>

<script>
import { columnsListDetail } from '../config-detail'
import {
  fileUpLoad,
  imgUpLoad
} from '@/api/system/upload'
import {
  queryPurchaseArrivalListInnerApi
} from '@/api/purchase/arrival'
export default {
  name: 'SeeDetail',
  props: {
    editParams: {
      type: Object,
      default: () => null,
    },
  },
  created() {
    this.transObj = { ['taskId']: this.editParams['id'] }
    console.log(this.transObj)
  },
  mounted() {

  },
  data() {
    return {
      columnsListDetail,
      subSort: '', // 提交类型：新增 1 / 修改 2
      // 图片集合
      picList: [],
      // 图片名称集合
      picNameList: [],
      //
      fileList: [],
      transObj: {},
      storageDex: 1000,
      priceDex: 100
    }
  },
  computed: {
    //图片上传1张后，隐藏上传框
    uploadDisabled() {
      return this.picList.length > 1
    },
  },
  methods: {
    queryPurchaseArrivalListInnerApi,
    /** 上传图片/文件 */
    uploadData(param) {
      console.log(param)
      imgUpLoad(param).then(res => {
        console.log(res)
        this.picList.push(res.data.url)
        this.picNameList.push(res.data.name.split('_')[0])
      }).catch(err => {})
    },
    /** 移除文件 */
    handleRemove(file) {
      console.log(file)
      console.log(this.picNameList)
      this.picList = []
      // this.fileList = this.fileList.filter(item => item.uid !== e.uid)
    },
    /** 文件超出1个 */
    fileExceed() {
      this.$modal.msgError('最多上传1张图片！')
    },
    /** 确认按钮 */
    onSubmit() {

    },
  },
}
</script>

<style scoped>
::v-deep .el-select {
  width: 100%;
}
::v-deep .el-form-item__label{
  font-weight: normal;
}
</style>
