1234567891011121314151617181920212223242526272829 |
- import React, { useEffect, useState } from 'react'
- import { getCardList } from '@/services/card'
- import Picker from '@/components/Picker'
-
- export default (props) => {
- const { buildingId } = props
-
- const [dicts, setDicts] = useState([])
-
- useEffect(() => {
- if (buildingId) {
- const params = {
- pageNumber: 1,
- pageSize: 50,
- buildingId,
- }
- getCardList(params).then((res) => {
- const { records } = res
- setDicts(records || [])
- })
- } else {
- setDicts([])
- }
- }, [buildingId])
-
- return (
- <Picker kv={['name', 'id']} dicts={dicts} {...props} />
- )
- }
|