<!-- 供应商信息列表 -->
<template>
  <div class="app-container">
    <el-card>
      <el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
        <div class="filter-box">
          <div class="filter-lf">
            <el-form-item label="合同编号">
              <el-input v-model="queryParams.roleName" placeholder="请输入合同编号" clearable @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="供应商名称">
              <el-input v-model="queryParams.roleName" placeholder="请输入供应商名称" clearable @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="签约人员">
              <el-input v-model="queryParams.roleName" placeholder="请输入签约人员" clearable @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item>
              <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
              <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
              <el-button type="primary" size="mini" v-hasPermi="['procurement:payPlan:import']" @click="handleImPort">导入</el-button>
              <el-button type="primary" size="mini" v-hasPermi="['procurement:payPlan:export']" @click="handleExport">导出</el-button>
            </el-form-item>
          </div>
          <div class="filter-rt">
            <el-form-item>
              <el-button type="primary" size="mini" v-hasPermi="['procurement:payPlan:add']" @click="handleAddMsg">新增</el-button>
            </el-form-item>
          </div>
        </div>

      </el-form>
      <el-table stripe border v-loading="loading" v-hasPermi="['procurement:payPlan:list']" :data="tableList" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55" />
        <el-table-column label="合同编号" prop="roleName" />
        <el-table-column label="合同编号" prop="roleName" />
        <el-table-column label="合同名称" prop="roleName" />
        <el-table-column label="客户名称" prop="roleName" />
        <el-table-column label="合同总金额" prop="roleName" />
        <el-table-column label="比例" prop="roleName" />
        <el-table-column label="付款金额" prop="roleName" />
        <el-table-column label="预计付款时间" prop="roleName" />
        <el-table-column label="操作" align="center" width="200">
          <template slot-scope="scope">
            <el-button size="mini" type="text" v-hasPermi="['procurement:payPlan:show']" icon="el-icon-view" @click="handleShow(scope.row,1)">查看
            </el-button>
            <el-button size="mini" type="text" v-hasPermi="['procurement:payPlan:del']" icon="el-icon-delete" @click="handleDelete(scope.row.id)">删除
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getTableList" />
    </el-card>
    <EditForm :isOpen="isOpen" :disabled="disabled" :id="id" @onClose="handleCancel" @onConfirm="handleSave" />
  </div>
</template>

<script>
import { payPlanListApi, importPayPlanApi, exportPayPlanApi } from '@/api/procurement/payPlan'
export default {
  name: 'supplierMsg',
  props: {},
  components: {
    EditForm: () => import('./components/editForm.vue')
  },
  computed: {},
  data() {
    return {
      selectArr: [],
      disabled: false,
      id: null,
      isOpen: false,
      total: 0,
      loading: false,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        roleName: undefined,
      },
      tableList: [
        { roleName: 'roleName' }
      ]
    }
  },
  created() {
    this.getTableList()
  },
  methods: {
    handleImPort() {

    },
    handleExport() {
      if (!this.selectArr.length) {
        this.$fm('请选择要导出的数据！')
      }
    },
    handleShow(row, type) {
      if (type === 1) {
        this.id = null
        this.disabled = true
      } else {
        this.id = 1
        this.disabled = false
      }
      this.isOpen = true
    },
    handleSave() {
      this.isOpen = false
    },
    handleCancel() {
      this.isOpen = false
    },
    handleAddMsg() {
      this.isOpen = true
    },
    handleUpdate() {

    },
    handleDelete(id) {
      this.$confirm('您确定要删除吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$sm('删除成功！')
        this.getTableList()
      })
    },
    getTableList() {

    },
    resetQuery() {

    },
    handleQuery() {

    },
    handleSelectionChange(val) {
      this.selectArr = val
    },
  },



}

</script>
<style lang='scss' scoped>
@import '@/assets/styles/header/index.scss';
@import '@/assets/styles/common/index.scss';
</style>