companyShareholderTable.vue 3.6 KB
<template>
  <div>
    <a-card v-if="!disableSubmit" title="企业股东信息" :bordered="false">
      <a-button style="margin-bottom:10px;float:right;position:relative;z-index:10;" @click="handleAddModal('企业股东信息')" type="primary" icon="plus">增加企业股东信息</a-button>
      <a-table ref="table" size="middle" bordered :columns="shareholderInfoData" :dataSource="stockholders" :pagination="false" :loading="loading" :rowKey="(record, index) => index" @change="handleTableChange">
        <span v-if="!disableSubmit" slot="action" slot-scope="text, record">
          <a @click="handleEditModal('企业股东信息',record)">修改</a>
          <a-divider type="vertical" />
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record)">
            <a>删除</a>
          </a-popconfirm>
        </span>
      </a-table>
    </a-card>
    <company-shareholder-modal ref="companyShareholderModal" @ok="companyShareholderModalOk"></company-shareholder-modal>
  </div>
</template>

<script>
import { JeecgListMixin } from '@/mixins/CoreListMixin'
import companyShareholderModal from './companyShareholderModal'
import { deleteStockholders } from '@/api/configApi'

export default {
  name: 'companyShareholderTable',
  mixins: [JeecgListMixin],
  props: {
    userType: {
      type: Number,
      default: null,
    },
    stockholders: {
      type: Array,
      default: () => {
        return [];
      }
    },
    applyNo: {
      type: String,
      default: ''
    },
    disableSubmit: {
      type: Boolean,
      default: false
    }
  },
  components: {
    companyShareholderModal,
  },
  data () {
    return {
      shareholderInfoData: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          align: 'center',
          width: 60,
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '股东名称',
          align: 'center',
          width: '100px',
          dataIndex: 'stockholderName'
        },
        {
          title: '持股比例',
          align: 'center',
          dataIndex: 'shareholdingRatio'
        },
        {
          title: '认缴出资额(万元)',
          align: 'center',
          dataIndex: 'capitalContributions'
        },
        {
          title: '认缴日期',
          align: 'center',
          dataIndex: 'subscriptionDate'
        },
        {
          title: '操作',
          dataIndex: 'action',
          scopedSlots: { customRender: 'action' },
          align: 'center',
          width: 120,
          fixed: 'right'
        }
      ],
      disableMixinCreated: true,
    }
  },
  methods: {
    handleAddModal (title) {
      this.$refs.companyShareholderModal.add(this.applyNo)
      this.$refs.companyShareholderModal.title = title ? title : '新增'
      this.$refs.companyShareholderModal.disableSubmit = false
    },
    handleEditModal (title, record) {
      this.$refs.companyShareholderModal.edit(record)
      this.$refs.companyShareholderModal.title = title ? title : '修改'
      this.$refs.companyShareholderModal.disableSubmit = false
    },
    companyShareholderModalOk () {
      this.$emit('editReload');
    },
    handleDelete (record) {
      console.log(record)
      let _p = { 'id': record.id }
      deleteStockholders(_p).then(res => {
        if (res.status.statusCode == 0) {
          this.$emit('editReload');
          this.$message.success(res.status.statusReason)
        } else {
          this.$message.warning(res.status.statusReason)
        }
      })
    },
  }
}
</script>
<style>
</style>