companyShareholderTable.vue 3.62 KB
<template>
  <div>
    <a-card title="企业股东信息" :bordered="false">
      <a-button v-if="!disableSubmit" 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 => record.id" @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 { deleteCusEnterpriseStockholder } from '@/api/configApi'
export default {
  name: 'companyShareholderTable',
  mixins: [JeecgListMixin],
  props: {
    userType: {
      type: Number,
      default: '',
    },
    stockholders: {
      type: Array,
      default: () => {
        return [];
      }
    },
    customerNo: {
      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.customerNo)
      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 }
      deleteCusEnterpriseStockholder(_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>