commonTextTable.vue 3.83 KB
<template>
  <div>
    <a-card title="自定义文本信息" :bordered="false">
      <!-- <a-button style="margin-bottom:10px;float:right;position:relative;z-index:10;" @click="handleAddModal(title)" type="primary" icon="plus">新增</a-button> -->
      <a-table ref="table" size="middle" bordered  :columns="textData" :dataSource="collCusExtObjDataList" :pagination="false" :loading="loading" :rowKey="record => record.id" @change="handleTableChange">
        <span slot="action" slot-scope="text, record">
          <a @click="handleTextLook(record)">查看</a>
          <!-- <a-divider type="vertical" />
          <a @click="handleEditModal(title,record)">修改</a>
          <a-divider type="vertical" />
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record)">
            <a>删除</a>
          </a-popconfirm> -->
        </span>
      </a-table>
    </a-card>
    <common-text-modal ref="commonTextModal" @ok="commonTextModalOk"></common-text-modal>
  </div>
</template>

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

export default {
  name: 'commonTextTable',
  mixins: [JeecgListMixin],
  components: {
    commonTextModal
  },
  props: {
    userType: {
      type: Number,
      default: null,
    },
    collCusExtObjDataList:{
      type:Array,
      default:()=>{
        return [];
      }
    },
    applyNo:{
      type:String,
      default:''
    }
  },
  data () {
    return {
      title:'',
      textData: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          align: 'center',
          width: 60,
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '信息名称',
          align: 'center',
          dataIndex: 'name'
        },
        {
          title: '信息内容',
          align: 'center',
          dataIndex: 'objectData'
        },
        {
          title: '备注',
          align: 'center',
          dataIndex: 'remark'
        },
        {
          title: '操作',
          dataIndex: 'action',
          scopedSlots: { customRender: 'action' },
          align: 'center',
          width: 150,
          fixed: 'right'
        }
      ],
      disableMixinCreated:true,
    }
  },
  created () {
    console.log(this.userType)
    switch(this.userType){
      case 1:
        this.title = '个人自定义文本信息'
        break;
      case 2:
        this.title = '企业自定义文本信息'
        break;
      case 3:
        this.title = '企业法人自定义文本信息'
        break;
    }
  },
  methods: {
    handleAddModal (title) {
      this.$refs.commonTextModal.add(this.applyNo)
      this.$refs.commonTextModal.title = title ? title : '新增'
      this.$refs.commonTextModal.disableSubmit = false
    },
    // 自定义附件信息查看
    handleTextLook (record) {
      this.$refs.commonTextModal.edit(record)
      this.$refs.commonTextModal.title = '查看'
      this.$refs.commonTextModal.disableSubmit = true
      this.$refs.commonTextModal.onlyread = true
    },
    handleEditModal(title,record){
      this.$refs.commonTextModal.edit(record)
      this.$refs.commonTextModal.title = title ? title : '修改'
      this.$refs.commonTextModal.disableSubmit = false
    },
    handleDelete(record){
      console.log(record)
      let _p = {'id':record.id}
      deleteCollCusExtObjData(_p).then(res=>{
        if (res.status.statusCode == 0) {
          this.$emit('editReload');
          this.$message.success(res.status.statusReason)
        } else {
          this.$message.warning(res.status.statusReason)
        }
      })
    },
    commonTextModalOk () {
      this.$emit('editReload');
    },
  }
}
</script>
<style>
</style>