<script setup name="coreBusiness">
import { onMounted, ref } from 'vue'
import { storeToRefs } from 'pinia'
import store from '@/store'

const userInfo = storeToRefs(store.userStore).userInfo,
  props = defineProps({
    detailData: {
      type: Object,
      default: () => {}
    }
  }),
  column = [
    {
      label: '序号',
      type: 'index',
      width: 60
    },
    // {
    //   label: '业务编号',
    //   key: 'oid',
    //   prop: 'oid'
    // },
    {
      label: '业务名称',
      key: 'matterName',
      prop: 'matterName'
    },
    {
      label: '所属单位',
      key: 'orgName',
      prop: 'orgName'
    }
  ],
  data = ref([])
onMounted(async () => {
  data.value = props?.detailData?.baseCoreBusinessCode?.split('；')?.map((i, k) => {
    return {
      oid: i,
      matterName: props?.detailData?.baseCoreBusiness?.split('；')[k],
      orgName: userInfo.value.empPosUnitName
    }
  }) || []
})
</script>

<template>
  <el-descriptions :column="2" border>
    <el-descriptions-item label="核心业务">
      <table-list
        :pagination="false"
        style="width: 100%"
        :column="column"
        :data="data"
        :empty-temp="false"
      />
    </el-descriptions-item>
  </el-descriptions>
</template>
