<template>
  <BasicModal v-bind="$attrs" @register="registerModal" :title="title" width="70%">
    <BasicForm @register="registerForm"> </BasicForm>
    <template #footer>
      <a-space wrap>
        <a-button type="primary" @click="closeModal()">取消</a-button>
      </a-space>
    </template>
  </BasicModal>
</template>

<script lang="ts" setup>
  import { ref } from 'vue';
  import { FormSchema } from '/@/components/Table';
  import { BasicModal, useModalInner } from '/@/components/Modal';
  import { BasicForm, useForm } from '/@/components/Form/index';
  //   import { dktc } from '@/api/common/api';
  // Emits声明

  const emit = defineEmits(['register', 'success']);

  const AdviceFormSchema: FormSchema[] = [
    { label: '污染地块ID', field: 'wrdkid', component: 'Input', show: false },

    {
      label: '市',
      field: 'cityName',
      component: 'Input',
      componentProps: {
        disabled: true,
      },
    },
    {
      label: '区县',
      field: 'countryName',
      component: 'Input',
      componentProps: {
        disabled: true,
      },
    },
    {
      label: '地块名称',
      field: 'wrdkmc',
      component: 'Input',
      componentProps: {
        disabled: true,
      },
    },
    {
      label: '地块编码',
      field: 'wrdkbm',
      component: 'Input',
      componentProps: {
        disabled: true,
      },
    },
    {
      label: '行业',
      field: 'hylb',
      component: 'Input',
      componentProps: {
        disabled: true,
      },
    },
    {
      label: '地块面积',
      field: 'zdmj',
      component: 'Input',
      componentProps: {
        disabled: true,
      },
    },
    {
      label: '修复或管控面积',
      field: 'wrmj',
      component: 'Input',
      componentProps: {
        disabled: true,
      },
    },
    {
      label: '土壤污染',
      field: 'trwrw',
      component: 'Input',
      componentProps: {
        disabled: true,
      },
    },
    {
      label: '地下水污染',
      field: 'dxswrw',
      component: 'Input',
      componentProps: {
        disabled: true,
      },
    },
    {
      label: '土壤/地下水风险管控修复措施',
      field: 'gkxflx',
      component: 'Input',
      componentProps: {
        disabled: true,
      },
    },
    {
      label: '是否后期监测',
      field: 'hylb',
      component: 'Select',
      componentProps: {
        disabled: true,
        options: [
          {
            label: '是',
            value: '1',
          },
          {
            label: '否',
            value: '0',
          },
        ],
      },
    },
    {
      label: '后期管理类型',
      field: 'hqgllx',
      component: 'Input',
      componentProps: {
        disabled: true,
      },
    },
    {
      label: '后期监管具体要求',
      field: 'hqjgjtyq',
      component: 'Input',
      componentProps: {
        disabled: true,
      },
    },
    {
      label: '地块规划用途',
      field: 'dkghytlx',
      component: 'Input',
      componentProps: {
        disabled: true,
      },
    },
    {
      label: '移除风险管控和修复名录时间',
      field: 'ycsj',
      component: 'Input',
      componentProps: {
        disabled: true,
      },
    },
    {
      label: '后期管理责任主题',
      field: 'hqglzrzt',
      component: 'Input',
      componentProps: {
        disabled: true,
      },
    },
    {
      label: '风险管控和修复指标',
      field: 'fxgkhxfjb',
      component: 'Input',
      componentProps: {
        disabled: true,
      },
    },
    {
      label: '监测时限要求',
      field: 'jcsxyq',
      component: 'Input',
      componentProps: {
        disabled: true,
      },
    },
    {
      label: '省下达的风险管控要求',
      field: 'clyj',
      component: 'Input',
      componentProps: {
        disabled: true,
      },
    },
  ];
  //表单配置
  const [registerForm, { resetFields, setFieldsValue }] = useForm({
    labelWidth: 220,
    schemas: AdviceFormSchema,
    showActionButtonGroup: false,
    baseColProps: { span: 12 },
  });
  //表单赋值
  const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
    //重置表单
    await resetFields();
    setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
    //表单赋值
    await setFieldsValue({
      ...data.record,
    });
  });
  //设置标题
  const title = ref('查看详情');
</script>

<style lang="less" scoped></style>
