import React from 'react'
import GrentReducer from './grent'
import Upload from '../../components/Upload'
import styles from './index.module.css'


export default function TerrainList({ className }: any) {
  const { referData, Element, models } = GrentReducer({
    delUrl: '/cesium/dem/remove/',
    getUrl: '/cesium/dem/list',
    sectionUrl: '/cesium/dem/slice/',
    transferUrl: '/cesium/dem/publish',
  })

  for (let i = 0; i < models.length; i++) {
    let model = models[i] as Model
    if (model.status !== 6) continue
    setTimeout(() => referData(), 1000)
    break;
  }

  return (
    <div className={className}>
      <div className={styles.uplayer} >
        <Upload api='/cesium/dem/upload' multiple upHandle={referData} className={styles.inputitem} />
      </div>
      {Element}
    </div>
  )
}