<template>
  <BasicModal v-bind="$attrs" @register="registerModal" width="1200px" :showOkBtn="false">
    <!--引用表格-->
    <BasicTable @register="registerTable">
      <!--插槽:table标题-->
      <!--操作栏-->
      <template #action="{ record }">
        <!-- <TableAction :actions="getTableAction(record)" /> -->
        <TableAction :actions="getTableAction(record)"  />
      </template>
    </BasicTable>

  </BasicModal>

  <BasicModal @register="registeProjectrModal" title="变更联系人" width="1200px" :showOkBtn="false">
      <modifycontacts :projectid="proid"  @exit="close"/>
    </BasicModal>


</template>

<script lang="ts" name="addressProjectinfoComponent" setup>
//ts语法
import { ref } from 'vue';
import { ActionItem, BasicTable, TableAction, useTable } from '@/components/Table';
import modifycontacts from './modifycontacts.vue'
import { BasicModal, useModal,useModalInner } from '@/components/Modal';
import { columns, searchFormSchema } from '../../projectLib/projectInfo/projectInfo.data';
import { projectInfoPageList, isShowByRoles } from '../../projectLib/projectInfo/projectInfo.api';
import { useUserStore } from '@/store/modules/user';

const userStore = useUserStore();
let proid = ref();
let ProjectStage = ref()
let IsModify = ref()
const [registeProjectrModal, { openModal: openModalProjectr,closeModal:closeModalProjectr }] = useModal();//项目详情
const [registerModal, { closeModal }] = useModalInner();

console.log("isShowByRoles", isShowByRoles('manage,sys:admin'))

const [registerTable, { reload, clearSelectedRowKeys }] = useTable({
  title: '项目信息',
  api: projectInfoPageList,
  useSearchForm: true,
  columns: columns,
  rowKey:"id",
  showIndexColumn:false,
  actionColumn: {
    width: 140,
    title: '操作',
    dataIndex: 'action',
    slots: { customRender: 'action' },
  },
  beforeFetch() {
    clearSelectedRowKeys()
  },
  // rowSelection: { type: 'radio' },
  //表单查询项设置
  formConfig: {
    schemas: searchFormSchema,
  }
});

function getTableAction(record): ActionItem[] {
  return [
    {
      label: '变更联系人',
      onClick: handlemodify.bind(null, record),
    }
  ];
}


function handlemodify(record) {
  proid.value = record.id
  9()

}
function close(){
  closeModalProjectr()
  reload()
}

</script>

<style scoped></style> 