diff --git a/src/pages/store/storeStaff/components/CreateForm.jsx b/src/pages/store/storeStaff/components/CreateForm.jsx index 8ed115a..cac36ac 100644 --- a/src/pages/store/storeStaff/components/CreateForm.jsx +++ b/src/pages/store/storeStaff/components/CreateForm.jsx @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react'; -import { Modal, Form, Input, Button, Select } from 'antd'; +import { Modal, Form, Input, Button, Select,TreeSelect } from 'antd'; const CreateForm = (props) => { const { Option, OptGroup } = Select; @@ -31,7 +31,15 @@ const CreateForm = (props) => { - + + + diff --git a/src/pages/store/storeStaff/index.jsx b/src/pages/store/storeStaff/index.jsx index fadae4a..f8b1c6d 100644 --- a/src/pages/store/storeStaff/index.jsx +++ b/src/pages/store/storeStaff/index.jsx @@ -1,13 +1,13 @@ import { PlusOutlined } from '@ant-design/icons'; import { Modal,Button, message, Input, Drawer } from 'antd'; -import React, { useState, useRef } from 'react'; +import React, { useState, useRef,useEffect } from 'react'; import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; import ProTable from '@ant-design/pro-table'; import QRCode from 'qrcode.react'; import ProDescriptions from '@ant-design/pro-descriptions'; import CreateForm from './components/CreateForm'; import { Getstorestaffpage, Addstorestaff, Updatestorestaff, Delstorestaff, } from "./services" - +import { gettree } from '../../sys/org/service'; const key = 'message'; //添加 @@ -85,8 +85,47 @@ const GoodsTypeManage = () => { const actionRef = useRef(); const [currentRow, setCurrentRow] = useState(); const [selectedRowsState, setSelectedRows] = useState([]); + const [OrgList, setOrgList] = useState([]); + const [OrgListArray, setOrgListArray] = useState([]); /** 国际化配置 */ + //初始化数据 + useEffect(() => { + + function initOrgList() { + gettree().then((r) => { + inittree(r.data); + function inittree(datas) { + for (var i in datas) { + if( datas[i]['type']==2|| datas[i]['type']==3){ + datas[i]['disabled']=false; + }else{ + datas[i]['disabled']=true; + } + + if (datas[i].children) { + inittree(datas[i].children); + } + } + } + setOrgList(r.data); + let list = {}; + formateData(r.data); + function formateData(datas) { + for (var i in datas) { + list[datas[i]['disabled']]=true; + list[datas[i]['value']] = { text: datas[i]['title'] }; + if (datas[i].children) { + formateData(datas[i].children); + } + } + } + setOrgListArray(list); + }); + } + initOrgList(); + }, []); + const columns = [ { title: '主键', @@ -114,6 +153,12 @@ const GoodsTypeManage = () => { valueType: 'textarea', search: false, }, + { + title: '归属门店', + dataIndex: 'shopId', + search: false, + valueEnum: OrgListArray, + }, { title: '状态', dataIndex: 'status', @@ -237,6 +282,7 @@ const GoodsTypeManage = () => { setCurrentRow(undefined); }} createModalVisible={createModalVisible} + OrgData={OrgList} values={currentRow || {}} />