diff --git a/config/routes.js b/config/routes.js
index d2ceac2..eea84bc 100644
--- a/config/routes.js
+++ b/config/routes.js
@@ -234,6 +234,34 @@ export default [
},
],
},
+ {
+ name: '设备数据下发',
+ icon: 'BankFilled',
+ path: '/push',
+ routes: [
+ {
+ name: '商品数据下发',
+ icon: 'smile',
+ path: '/push/goodspush',
+ component: './push/goodspush',
+ access: 'k12',
+ },
+ {
+ name: '物料数据下发',
+ icon: 'smile',
+ path: '/push/batchingpush',
+ component: './push/batchingpush',
+ access: 'k14',
+ },
+ {
+ name: '配方数据下发',
+ icon: 'smile',
+ path: '/push/bompush',
+ component: './push/bompush',
+ access: 'k14',
+ },
+ ],
+ },
{
name: '订单管理',
icon: 'BankFilled',
diff --git a/src/pages/push/batchingpush/index.jsx b/src/pages/push/batchingpush/index.jsx
new file mode 100644
index 0000000..e69de29
diff --git a/src/pages/push/bompush/index.jsx b/src/pages/push/bompush/index.jsx
new file mode 100644
index 0000000..e69de29
diff --git a/src/pages/push/goodspush/components/PushFrom.jsx b/src/pages/push/goodspush/components/PushFrom.jsx
new file mode 100644
index 0000000..3065322
--- /dev/null
+++ b/src/pages/push/goodspush/components/PushFrom.jsx
@@ -0,0 +1,132 @@
+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 actionRef = useRef();
+ useEffect(() => {
+ console.log(props.values)
+ GetDeviceList().then((r)=>{
+ 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 (
+ {
+ console.log(selectedRowsState)
+ console.log(DeviceIds)
+ }}
+ onCancel={() => {
+ props.onCancel();
+ }}
+ destroyOnClose
+ >
+
+
+ 选择设备:
+
+
+
+
+
+
+ 选择数据:
+ {
+ // 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);
+ },
+ }}
+ >
+
+
+
+
+ );
+};
+
+export default PushFrom;
diff --git a/src/pages/push/goodspush/index.jsx b/src/pages/push/goodspush/index.jsx
new file mode 100644
index 0000000..6365da4
--- /dev/null
+++ b/src/pages/push/goodspush/index.jsx
@@ -0,0 +1,254 @@
+import { PlusOutlined } from '@ant-design/icons';
+import { Button, message, Input, Drawer, Popconfirm } from 'antd';
+import React, { useState, useRef, useEffect } from 'react';
+import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
+import ProTable from '@ant-design/pro-table';
+import ProDescriptions from '@ant-design/pro-descriptions';
+import PushFrom from './components/PushFrom';
+
+import {
+ GetDevicePushRecodePage,
+ DevicePushRecodeDelete
+} from './services';
+
+
+
+const goodspush = () => {
+ /** 新建/更新窗口的弹窗 */
+ const [createModalVisible, handleModalVisible] = useState(false);
+ /** 分布更新窗口的弹窗 */
+ const [showDetail, setShowDetail] = useState(false);
+ const actionRef = useRef();
+ const [currentRow, setCurrentRow] = useState();
+ const [selectedRowsState, setSelectedRows] = useState([]);
+ /** 国际化修改 */
+ useEffect(() => {
+
+
+ }, []);
+
+ /**
+ * 批量删除
+ *
+ * @param selectedRows
+ */
+
+ const handleRemove = async (selectedRows) => {
+ const hide = message.loading('正在删除');
+ if (!selectedRows) return true;
+ await DevicePushRecodeDelete(selectedRows.map((row) => row.id)).then((r) => {
+ if (r.succeeded) {
+ message.success('删除成功');
+ actionRef.current.reload();
+ } else {
+ message.error(r.errors);
+ }
+ });
+ hide();
+ return true;
+ };
+ const columns = [
+ {
+ title: '主键',
+ dataIndex: 'id',
+ hideInSearch: true,
+ hideInTable: true,
+ tip: '规则名称是唯一的 key',
+ render: (dom, entity) => {
+ return (
+ {
+ setCurrentRow(entity);
+ setShowDetail(true);
+ }}
+ >
+ {dom}
+
+ );
+ },
+ },
+ {
+ title: '下发设备',
+ dataIndex: 'deviceName',
+ valueType: 'textarea',
+ ellipsis: true,
+ },
+
+ {
+ title: '下发数据',
+ dataIndex: 'type',
+ ellipsis: true,
+ valueEnum: {
+ 1: {
+ text: '商品',
+ },
+ 2: {
+ text: '物料',
+ },
+ 3: {
+ text: '工艺',
+ },
+ 4: {
+ text: '配方',
+ },
+ },
+ },
+ {
+ title: '下发时间',
+ dataIndex: 'ceateAt',
+ hideInSearch: true,
+ },
+ {
+ title: '操作',
+ dataIndex: 'option',
+ valueType: 'option',
+ render: (_, record) => [
+ {
+ handleModalVisible(true);
+ setCurrentRow(record);
+ }}
+ >
+ 下发详情
+ ,
+ {
+ await DeleteGoodsType(record.id).then((r) => {
+ if (r.succeeded) {
+ message.success('删除成功');
+ actionRef.current.reload();
+ } else {
+ message.error(r.errors);
+ }
+ });
+ }}
+ onCancel={() => {}}
+ >
+ 删除
+ ,
+ ],
+ },
+ ];
+
+ return (
+
+ [
+ ,
+ ]}
+ request={async (params) => {
+ var goodsData = [];
+ var total = 0;
+ await GetDevicePushRecodePage(params).then((r) => {
+ goodsData = r.data.data;
+ total = r.data.total;
+ });
+ return {
+ data: goodsData,
+ success: true,
+ total: total,
+ };
+ }}
+ columns={columns}
+ rowSelection={{
+ onChange: (_, selectedRows) => {
+ setSelectedRows(selectedRows);
+ },
+ }}
+ />
+ {selectedRowsState?.length > 0 && (
+
+ 已选择{' '}
+
+ {selectedRowsState.length}
+ {' '}
+ 项
+ {/*
+ 服务调用次数总计 {selectedRowsState.reduce((pre, item) => pre + item.id, 0)} 万
+ */}
+
+ }
+ >
+
+ {/* */}
+
+ )}
+
+ {
+
+ }}
+ onCancel={() => {
+ handleModalVisible(false);
+ setCurrentRow(undefined);
+ }}
+ createModalVisible={createModalVisible}
+ values={currentRow || {}}
+ />
+
+ {
+ setCurrentRow(undefined);
+ setShowDetail(false);
+ }}
+ closable={false}
+ >
+ {currentRow?.name && (
+ ({
+ data: currentRow || {},
+ })}
+ params={{
+ id: currentRow?.name,
+ }}
+ columns={columns}
+ />
+ )}
+
+
+ );
+};
+
+export default goodspush;
diff --git a/src/pages/push/goodspush/services.js b/src/pages/push/goodspush/services.js
new file mode 100644
index 0000000..4af60f4
--- /dev/null
+++ b/src/pages/push/goodspush/services.js
@@ -0,0 +1,46 @@
+import { request } from 'umi';
+export async function GetDevicePushRecodePage(data) {
+ return request(`/saasstore/api/devicepushrecode/page`, {
+ method: 'POST',
+ data: data,
+ });
+ }
+ export async function DevicePushRecodeAdd(data) {
+ return request(`/saasstore/api/devicepushrecode/add`, {
+ method: 'POST',
+ data: data,
+ });
+ }
+ export async function DevicePushRecodeUpdate(data) {
+ return request(`/saasstore/api/devicepushrecode/update`, {
+ method: 'POST',
+ data: data,
+ });
+ }
+ export async function DevicePushRecodeDelete(data) {
+ return request(`/saasstore/api/devicepushrecode/delete`, {
+ method: 'POST',
+ data: data,
+ });
+ }
+ export async function GetDeviceList() {
+ return request(`/saasbase/api/device/list`, {
+ method: 'GET',
+ });
+ }
+ export async function GetGoodsTypeTree(params) {
+ return request('/saasbase/api/goodstype/tree', {
+ method: 'GET',
+ data: {
+ ...params,
+ },
+ });
+ }
+ export async function GetGoodsPage(data) {
+ return request(`/saasbase/api/goods/page`, {
+ method: 'Post',
+ data: data,
+ // params: { ...params },
+ // ...(options || {}),
+ });
+ }