Browse Source

菜单全权限

master
zhaoy 11 months ago
parent
commit
982488f565
3 changed files with 141 additions and 0 deletions
  1. +137
    -0
      src/pages/push/goodspush/components/PushFrom.jsx
  2. +1
    -0
      src/pages/sys/menus/components/CreateForm.jsx
  3. +3
    -0
      src/pages/sys/menus/index.jsx

+ 137
- 0
src/pages/push/goodspush/components/PushFrom.jsx View File

@@ -0,0 +1,137 @@
import React, { useState, useEffect,useRef } from 'react';
import { Modal, Row, Col, Checkbox, Select} from 'antd';
import ProTable from '@ant-design/pro-table';
import {
GetDeviceList,
GetGoodsPage,
GetGoodsTypeTree
} from '../services';
const PushFrom = (props) => {
const [deviceData, setdeviceData] = useState([]);
const [selectedRowsState, setSelectedRows] = useState([]);
const [dataSource,setdataSource]= useState([]);
const [treeData, setTreeData] = useState();
const [DeviceIds, setDeviceIds] = useState([]);
const [DeviceInfo, setDeviceInfo] = useState([]);
const actionRef = useRef();
useEffect(() => {
console.log(props.values)
GetDeviceList().then((r)=>{
setDeviceInfo(r.data);
var data=r.data.map(x=>{
return {value:x.id,label:x.name}
})
setdeviceData(data)
})
GetGoodsTypeTree().then((r) => {
setTreeData(r.data);
});
var params={current:1,pageSize:10}
GetGoodsPage(params).then((r) => {
setdataSource(r.data.data);
//console.log(goodsData)
//total = r.data.total;
});
},[props.values])
const handleChange=(value)=>{
setDeviceIds(value)
}
const columns=[
{
title: '编码',
dataIndex: 'code',
valueType: 'textarea',
hideInTable: true,
hideInSearch: true,
},
{
title: '名称',
dataIndex: 'name',
valueType: 'textarea',
},
{
title: '商品类型',
dataIndex: 'goodsTypeName',
valueType: 'treeSelect',
fieldProps: {
showSearch:true,
allowClear:true,
options: treeData
},
},
]
return (
<Modal
title={'下发数据'}
width={1040}
visible={props.createModalVisible}
bodyStyle={{ padding: '32px 40px 1px 48px' }}
okText="确定"
cancelText="取消"
onOk={() => {
console.log(selectedRowsState)
console.log(DeviceIds)
if(DeviceIds.length>0){
}
}}
onCancel={() => {
props.onCancel();
}}
destroyOnClose
>
<Row gutter={26}>
<Col lg={24} md={24} sm={24}>
选择设备:
<Select
mode="multiple"
allowClear
style={{width: '60%'}}
placeholder="请选择要下发设备"
onChange={handleChange}
options={deviceData}
/>
</Col>
</Row>
<Row gutter={26}>
<Col span={24}>
选择数据:
<ProTable
headerTitle=""
actionRef={actionRef}
rowKey="id"
pagination={{ defaultPageSize: 10 }}
search={{
labelWidth: 120,
}}
dataSource={dataSource}
// request={async (params) => {
// var goodsData = [];
// var total = 0;
// await goods(params).then((r) => {
// goodsData = r.data.data;
// console.log(goodsData)
// total = r.data.total;
// });
// return {
// data: goodsData,
// success: true,
// total: total,
// };
// }}
columns={columns}
rowSelection={{
onChange: (_, selectedRows) => {
setSelectedRows(selectedRows);
},
}}
>
</ProTable>
</Col>
</Row>
</Modal>
);
};

export default PushFrom;

+ 1
- 0
src/pages/sys/menus/components/CreateForm.jsx View File

@@ -11,6 +11,7 @@ const CreateForm = (props) => {
visible={props.modalVisible}
bodyStyle={{ padding: '32px 40px 1px 48px' }}
footer={null}
maskClosable={false}
onCancel={() => {
props.onCancel();
}}


+ 3
- 0
src/pages/sys/menus/index.jsx View File

@@ -73,7 +73,10 @@ const handleUpdate = async (fields) => {
onClick={() => {
InitTree();
handleModalVisible(true);
console.log("record.type",record.type)
if(!Array.isArray(record.type)){
record.type=record.type.split(',');
}
setStepFormValues(record);
}}
>


Loading…
Cancel
Save