// 线上审核另需提供文件
<template>
  <div class="otherFile">
    <data-table :handleFlag.sync="handleFlag" :showPage="false" :showSelection='true' :type="'selection'"
                :queryParas="queryParas" :sourceData.sync="sourceData" :selectedRows.sync="selectedRows"
                :loadCount.sync="loadCount" operateBtnLayout="">
      <template slot="headButton">
        <div class="headButton">
          <auth-button type="primary" size="medium" icon="iconfont iconxinzeng" :label="$t('common.create')" @click="add"></auth-button>
          <auth-button type="primary" size="medium" icon="iconfont iconshanchu" :label="$t('common.del')" @click="delBatch"></auth-button>
        </div>
      </template>

      <!-- 文件名称 -->
      <el-table-column :label="$t('taskManage.todoTask.file')" align="center">
        <template slot-scope="scope">
          <el-select v-model="scope.row.file"></el-select>
        </template>
      </el-table-column>

      <!-- 需求份数 -->
      <el-table-column :label="$t('taskManage.todoTask.neededNumber')" align="center">
        <template slot-scope="scope">
          <el-input v-model.number="scope.row.neededNumber" :placeholder="$t('common.input')"></el-input>
        </template>
      </el-table-column>

      <!-- 是否已到 -->
      <el-table-column :label="$t('taskManage.todoTask.arrived')" align="center">
        <span>{{'—'}}</span>
      </el-table-column>

      <!-- 审核意见 -->
      <el-table-column :label="$t('taskManage.todoTask.auditOpinion')" align="center">
        <template slot-scope="scope">
          <el-input v-model="scope.row.opinion" :placeholder="$t('common.input')"></el-input>
        </template>
      </el-table-column>

      <!-- 文件上传 -->
      <el-table-column :label="$t('taskManage.todoTask.fileUpload')" align="center">
        <span>{{'—'}}</span>
      </el-table-column>
    </data-table>
    <div class="footer-div">
      <span>显示第{{endNum && '1' || 0}}至{{this.endNum}}项，共{{this.endNum}}项</span>
    </div>
  </div>
</template>
<script>
import BasePage from '@/pages/basePage.js'
import { DataTable, authButton } from 'newepoch-components'
export default {
  extends: new BasePage(),
  components: {
    DataTable,
    authButton
  },
  prop: {
    form: {
      type: [Object],
      default: function () {
        return {}
      }
    }
  },
  data () {
    return {
      endNum: 1,
      sourceData: [
        {
          file: '',
          neededNumber: '',
          opinion: ''
        }
      ]
    }
  },
  methods: {
    add () {
      this.sourceData.push(
        {
          file: '',
          neededNumber: '',
          opinion: ''
        }
      )
    },
    // 批量删除 todo,逻辑完善
    delBatch () {
      // if (this.selectedRows.length === 0) {
      //   this.warning(`请先勾选要删除的数据`)
      //   return
      // }
      // let arr = this.selectedRows.map(it => {
      //   return it.keyId
      // })
      // let $this = this
      // $this.$confirm('确认要删除选中行的所有数据吗', '警告', {
      //   type: 'warning'
      // }).then(() => {
      //   $this.api.dels({ ids: arr, delType: '1' }).then(res => {
      //     if (res && res.data) {
      //       $this.success(`删除成功`)
      //       $this.handleFilter()
      //     } else {
      //       $this.error(`删除失败`)
      //     }
      //   })
      // })
    }
  }
}
</script>
<style scoped lang="scss" src="@/styles/dataAudit/taskManage/auditList.scss">
</style>
