From 3123290239d2389bf62513ef240b112a23f5a51b Mon Sep 17 00:00:00 2001 From: zhaoy <137053305@qq.com> Date: Fri, 19 Jan 2024 11:36:08 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E8=AE=BE=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.jsx | 2 +- src/pages/device/deviceInfo/index.jsx | 137 ++++++++++++-------------- 2 files changed, 62 insertions(+), 77 deletions(-) diff --git a/src/app.jsx b/src/app.jsx index 015d852..8cbc297 100644 --- a/src/app.jsx +++ b/src/app.jsx @@ -262,7 +262,7 @@ export async function getInitialState() { var tempMenu = await queryMenuData(); //创建菜单 //await syncMenus(tempMenu); - if (!isDev) { + if (isDev) { var data = await dymicMenus(currentUser.data.id); tempMenu = data.data; } diff --git a/src/pages/device/deviceInfo/index.jsx b/src/pages/device/deviceInfo/index.jsx index dc8cd81..cc20dc0 100644 --- a/src/pages/device/deviceInfo/index.jsx +++ b/src/pages/device/deviceInfo/index.jsx @@ -22,68 +22,6 @@ import StockMaterial from './components/StockMaterial'; import { values } from 'lodash'; const key = 'message'; -//添加 -const handleAdd = async (fields) => { - try { - message.loading('正在添加', key); - await AddDeviceInfo(JSON.stringify(fields)).then((r) => { - message.destroy(key); - if (r.data) { - message.success('添加成功'); - return true; - } else { - //message.error('添加失败'); - message.success('添加成功'); - return false; - } - }); - } catch (error) { - message.error('添加失败请重试!'); - return false; - } -}; -//修改 -const handleUpdate = async (fields) => { - try { - message.loading('正在修改', key); - await UpdateDeviceInfo(JSON.stringify(fields)).then((r) => { - message.destroy(key); - if (r.data) { - message.success('修改成功'); - return true; - } else { - message.success('修改失败'); - return false; - } - }); - } catch (error) { - message.error('修改失败请重试!'); - return false; - } -}; - -//删除 -const handleRemove = async (selectedRows) => { - try { - message.loading('正在删除'); - let ids = []; - selectedRows.forEach((item) => { - ids.push(item.id); - }); - await DelDeviceInfo(ids).then((r) => { - if (r.data) { - message.success('删除成功'); - return true; - } else { - message.success('删除失败'); - return false; - } - }); - } catch (error) { - message.error('删除失败请重试!'); - return false; - } -}; const GoodsTypeManage = () => { const [storeType, setStoreType] = useState(); @@ -99,6 +37,12 @@ const GoodsTypeManage = () => { const [deviceFoodModal, setDeviceFoodModal] = useState(); // 是否显示 库存物料弹窗 const [stockModal, setStockModal] = useState(false); + /** 新建/更新窗口的弹窗 */ + const [createModalVisible, handleModalVisible] = useState(false); + /** 分布更新窗口的弹窗 */ + const actionRef = useRef(); + const [currentRow, setCurrentRow] = useState(); + const [selectedRowsState, setSelectedRows] = useState([]); //初始化数据 useEffect(() => { @@ -182,12 +126,6 @@ const GoodsTypeManage = () => { } }; - /** 新建/更新窗口的弹窗 */ - const [createModalVisible, handleModalVisible] = useState(false); - /** 分布更新窗口的弹窗 */ - const actionRef = useRef(); - const [currentRow, setCurrentRow] = useState(); - const [selectedRowsState, setSelectedRows] = useState([]); /** 国际化配置 */ const columns = [ @@ -343,6 +281,59 @@ const GoodsTypeManage = () => { }, ]; +//添加 +const handleAdd = async (fields) => { + + await AddDeviceInfo(JSON.stringify(fields)).then((r) => { + + if (r.succeeded) { + message.success('添加成功'); + handleModalVisible(false); + actionRef.current.reload(); + } else { + message.error(r.errors) + return false; + } + }); + +}; +//修改 +const handleUpdate = async (fields) => { + await UpdateDeviceInfo(JSON.stringify(fields)).then((r) => { + if (r.succeeded) { + message.success('添加成功'); + handleModalVisible(false); + actionRef.current.reload(); + } else { + message.error(r.errors) + return false; + } + }); + +}; + +//删除 +const handleRemove = async (selectedRows) => { + try { + message.loading('正在删除'); + let ids = []; + selectedRows.forEach((item) => { + ids.push(item.id); + }); + await DelDeviceInfo(ids).then((r) => { + if (r.data) { + message.success('删除成功'); + return true; + } else { + message.success('删除失败'); + return false; + } + }); + } catch (error) { + message.error('删除失败请重试!'); + return false; + } +}; return ( { dicData={dicData} initDeviceType={initDeviceType} onFinish={async (value) => { - var success = false; if (value.id) { - success = handleUpdate(value); + handleUpdate(value); } else { - success = handleAdd(value); - } - if (success) { - handleModalVisible(false); - setCurrentRow(undefined); - actionRef.current.reload(); + handleAdd(value); } }} onCancel={() => { From 526d3d3688902ad19edd45aaaa4f0e9c06eab878 Mon Sep 17 00:00:00 2001 From: zhaoy <137053305@qq.com> Date: Fri, 19 Jan 2024 14:03:52 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/sys/menus/index.jsx | 77 +++++++++++++---------------------- 1 file changed, 29 insertions(+), 48 deletions(-) diff --git a/src/pages/sys/menus/index.jsx b/src/pages/sys/menus/index.jsx index 67dfdaf..5dbf35b 100644 --- a/src/pages/sys/menus/index.jsx +++ b/src/pages/sys/menus/index.jsx @@ -28,23 +28,17 @@ const menuManager = () => { */ const handleAdd = async (fields) => { - const hide = message.loading('正在添加'); - try { + fields.type=3 await api.add({ ...fields }).then((r) => { - if (r.succeeded) { - hide(); message.success('添加成功'); + actionRef.current.reload(); handleModalVisible(false); }else{ message.error(r.errors); } }); - } catch (error) { - hide(); - message.error('添加失败请重试!'); - return false; - } + }; /** * 更新节点 @@ -53,43 +47,15 @@ const menuManager = () => { */ const handleUpdate = async (fields) => { - const hide = message.loading('正在配置'); - try { api.update(fields).then((r) => { if (r.succeeded) { - hide(); message.success('更新成功'); + actionRef.current.reload(); handleModalVisible(false); }else{ message.error(r.errors); } }); - } catch (error) { - hide(); - message.error('更新失败请重试!'); - return false; - } -}; -/** - * 删除节点 - * - * @param selectedRows - */ - -const handleRemove = async (selectedRows) => { - const hide = message.loading('正在删除'); - if (!selectedRows) return true; - - try { - await api.remove(selectedRows.map((row) => row.id)); - hide(); - message.success('删除成功,即将刷新'); - return true; - } catch (error) { - hide(); - message.error('删除失败,请重试'); - return false; - } }; const InitTree = async () => { await api.trees().then((r) => { @@ -115,7 +81,12 @@ const handleRemove = async (selectedRows) => { arr.push( { api.enable(record.id).then((r) => { - actionRef.current.reload(); + if (r.succeeded) { + message.success('操作成功'); + actionRef.current.reload(); + }else{ + message.error(r.errors); + } }); }} > @@ -126,7 +97,12 @@ const handleRemove = async (selectedRows) => { arr.push( { api.disable(record.id).then((r) => { - actionRef.current.reload(); + if (r.succeeded) { + message.success('操作成功'); + actionRef.current.reload(); + }else{ + message.error(r.errors); + } }); }} > @@ -151,7 +127,12 @@ const handleRemove = async (selectedRows) => { cancelText="否" onConfirm={() => { api.remove([record.id]).then((r) => { - actionRef.current.reload(); + if (r.succeeded) { + message.success('操作成功'); + actionRef.current.reload(); + }else{ + message.error(r.errors); + } }); }} onCancel={() => { }} @@ -181,6 +162,11 @@ const handleRemove = async (selectedRows) => { dataIndex: 'code', ellipsis:true, }, + { + title: '排序', + dataIndex: 'sort', + ellipsis:true, + }, { title: '菜单图标', dataIndex: 'icon', @@ -284,15 +270,10 @@ const handleRemove = async (selectedRows) => { treeDatas={treeData} dictData={handlData} onFinish={async (value) => { - var success = false; if (value.id) { - success = await handleUpdate(value); + await handleUpdate(value); } else { - success = await handleAdd(value); - } - if (success) { - handleModalVisible(false); - actionRef.current.reload(); + await handleAdd(value); } }} onCancel={() => { From f606bb6fb86f5ac7b033959320ba91774e0c7afa Mon Sep 17 00:00:00 2001 From: zhaoy <137053305@qq.com> Date: Fri, 19 Jan 2024 14:14:41 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/database/goods/goodsInfo/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/database/goods/goodsInfo/index.jsx b/src/pages/database/goods/goodsInfo/index.jsx index 2fa0eb8..6fbabe7 100644 --- a/src/pages/database/goods/goodsInfo/index.jsx +++ b/src/pages/database/goods/goodsInfo/index.jsx @@ -134,7 +134,7 @@ const Advanced = (props) => { tabActiveKey: props.location.query.tabStatus ? props.location.query.tabStatus : 'basis', }); useEffect(() => { - if(!props.location.query.values.id){ + if(!props.location?.query?.values?.id){ history.push({ pathname: '/database/goods/newgoods', }); From 06bd9d1d44f6603de762939db423e1a510bea19a Mon Sep 17 00:00:00 2001 From: zhaoy <137053305@qq.com> Date: Fri, 19 Jan 2024 14:21:55 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/database/goods/goodsInfo/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/database/goods/goodsInfo/index.jsx b/src/pages/database/goods/goodsInfo/index.jsx index 6fbabe7..a50ee6c 100644 --- a/src/pages/database/goods/goodsInfo/index.jsx +++ b/src/pages/database/goods/goodsInfo/index.jsx @@ -134,7 +134,7 @@ const Advanced = (props) => { tabActiveKey: props.location.query.tabStatus ? props.location.query.tabStatus : 'basis', }); useEffect(() => { - if(!props.location?.query?.values?.id){ + if(!props.location?.query?.isAdd){ history.push({ pathname: '/database/goods/newgoods', }); From 9803e4d3dae14f83194eb064bf2c4a1f3f5e3358 Mon Sep 17 00:00:00 2001 From: zhaoy <137053305@qq.com> Date: Fri, 19 Jan 2024 14:45:03 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E5=95=86=E5=93=81=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/database/goods/goodsInfo/index.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pages/database/goods/goodsInfo/index.jsx b/src/pages/database/goods/goodsInfo/index.jsx index a50ee6c..89d0894 100644 --- a/src/pages/database/goods/goodsInfo/index.jsx +++ b/src/pages/database/goods/goodsInfo/index.jsx @@ -134,17 +134,17 @@ const Advanced = (props) => { tabActiveKey: props.location.query.tabStatus ? props.location.query.tabStatus : 'basis', }); useEffect(() => { - if(!props.location?.query?.isAdd){ - history.push({ - pathname: '/database/goods/newgoods', - }); - }else{ + // if(!props.location?.query?.values){ + // history.push({ + // pathname: '/database/goods/newgoods', + // }); + // }else{ SetCurrTabKey(tabStatus.tabActiveKey); initGoodsUnit(); initGoodsType(); initGetbomType(); intBatching(); - } + //} }, [tabStatus]) const onTabChange = (key) => { From 45696505af87a3d8669df03aeeae8912ffd630d0 Mon Sep 17 00:00:00 2001 From: zhaoy <137053305@qq.com> Date: Fri, 19 Jan 2024 16:15:10 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/device/devicepush/index.jsx | 0 src/pages/device/devicepush/services.js | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/pages/device/devicepush/index.jsx create mode 100644 src/pages/device/devicepush/services.js diff --git a/src/pages/device/devicepush/index.jsx b/src/pages/device/devicepush/index.jsx new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/device/devicepush/services.js b/src/pages/device/devicepush/services.js new file mode 100644 index 0000000..e69de29