<template>
  <p-card>
    <div slot="title" style="display: flex; align-items: center; cursor: pointer" @click="backPage('back')">
      <a-icon type="arrow-left" style="color: #1990ff" class="mr-10" />
      {{title}}
    </div>
    <p-table-edit
      :row-select-type="1"
      dragging
      :rowSelectType="false"
      ref="cardTable"
      :bordered="true"
      rowKey="id"
      auto-width
      :remoteUrl="remoteUrl"
      :remoteData="remoteUrl.params"
      :editor-row-table="false"
      :data-source="list"
      :columns="columns"
    >
      <span slot="action" slot-scope="text, record">
        <div style="display: flex">
          <div>
            <a @click="upLoadChange(text, record)" style="margin-right: 10px">上传</a>
            <imgsUpload v-model="isUpload" :id="uploadId" :isView="lookats"></imgsUpload>
          </div>
          <div>
            <a @click="grid2Main03Table_checkClick(text, record)">查看</a>
          </div>
        </div>
      </span>
    </p-table-edit>
  </p-card>
</template>
<script>
import imgsUpload from '@/blocks/ImgsUpload/index'

export default {
  components: { imgsUpload },
  props: {
    pUrl: {
      type: String,
      default: '/api/oms-std-maindata/pubCertificate/pubCertificateQuery/v1.0'
    },
    params: {
      type: Object,
      default() {
        return {}
      }
    },
    columns: {
      type: Array,
      default() {
        return []
      }
    },
    title: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      remoteUrl: {
        url: this.pUrl,
        params: this.params,
        headers: {
          'Content-Type': 'application/JSON'
        },
        method: 'post',
        timeout: 30000,
      },
      isUpload: false,
      lookats: false,
      uploadId: '',
      list: []
    }
  },
  created() {},
  watch: {
    // params: {
    //   handler(newVal, oldVal) {
    //   },
    //   deep: true,
    //   immediate: true
    // },
  },
  computed: {},
  methods: {
    upLoadChange(text, record) {
      this.uploadId = record.id
      this.isUpload = true
      this.lookats = false
    },
    grid2Main03Table_checkClick(text, record) {
      this.uploadId = record.id
      this.isUpload = true
      this.lookats = true
    },
    backPage() {
      this.$emit('back')
    }
  }
}
</script>
<style lang="less">
.ant-upload-list-text {
  display: none;
}
</style>
