From 50950c11b5c0fab87e422b44b2f7a92aeb7efa32 Mon Sep 17 00:00:00 2001
From: zhaoy <137053305@qq.com>
Date: Sat, 13 Jan 2024 17:55:28 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81=E7=89=A9=E6=A8=A1=E5=9E=8B?=
=?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/routes.js | 7 +
.../goodstechnology/components/CreateForm.jsx | 57 --
.../database/goods/goodstechnology/index.jsx | 292 ----------
.../deviceInfo/components/CreateForm.jsx | 30 +-
src/pages/device/deviceInfo/index.jsx | 67 ++-
src/pages/device/deviceInfo/services.js | 4 +-
.../deviceVesion/components/CreateForm.jsx | 4 +-
src/pages/device/deviceVesion/index.jsx | 17 +-
.../components/ActionForm.jsx | 239 --------
.../components/CreateAction.jsx | 245 --------
.../components/CreateForm.jsx | 89 ---
src/pages/device/devicetechnology/services.js | 61 --
.../device/product/components/CreateForm.jsx | 5 +-
src/pages/device/product/index.jsx | 40 +-
.../productmanage}/components/ActionForm.jsx | 20 +-
.../components/CreateAction.jsx | 20 +-
.../productmanage/components/CreateForm.jsx | 232 ++++++++
.../index.jsx | 293 ++++++----
.../productmanage}/services.js | 22 +-
src/pages/device/productmanage/unit.js | 531 ++++++++++++++++++
20 files changed, 1100 insertions(+), 1175 deletions(-)
delete mode 100644 src/pages/database/goods/goodstechnology/components/CreateForm.jsx
delete mode 100644 src/pages/database/goods/goodstechnology/index.jsx
delete mode 100644 src/pages/device/devicetechnology/components/ActionForm.jsx
delete mode 100644 src/pages/device/devicetechnology/components/CreateAction.jsx
delete mode 100644 src/pages/device/devicetechnology/components/CreateForm.jsx
delete mode 100644 src/pages/device/devicetechnology/services.js
rename src/pages/{database/goods/goodstechnology => device/productmanage}/components/ActionForm.jsx (92%)
rename src/pages/{database/goods/goodstechnology => device/productmanage}/components/CreateAction.jsx (93%)
create mode 100644 src/pages/device/productmanage/components/CreateForm.jsx
rename src/pages/device/{devicetechnology => productmanage}/index.jsx (65%)
rename src/pages/{database/goods/goodstechnology => device/productmanage}/services.js (53%)
create mode 100644 src/pages/device/productmanage/unit.js
diff --git a/config/routes.js b/config/routes.js
index ee270aa..69d52e5 100644
--- a/config/routes.js
+++ b/config/routes.js
@@ -183,6 +183,13 @@ export default [
component: './device/deviceVesion',
access: 'k14',
},
+ {
+ name: '产品功能',
+ icon: 'smile',
+ path: '/device/productmanage',
+ component: './device/productmanage',
+ access: 'k14',
+ },
// {
// name: '设备工艺信息',
// icon: 'smile',
diff --git a/src/pages/database/goods/goodstechnology/components/CreateForm.jsx b/src/pages/database/goods/goodstechnology/components/CreateForm.jsx
deleted file mode 100644
index 03c2829..0000000
--- a/src/pages/database/goods/goodstechnology/components/CreateForm.jsx
+++ /dev/null
@@ -1,57 +0,0 @@
-import React, { useState } from 'react';
-import { Modal, Form, Input, Button, Select } from 'antd';
-const CreateForm = (props) => {
- const { Option, OptGroup } = Select;
- return (
- {
- props?.onCancel();
- }}
- destroyOnClose
- maskClosable={false}
- >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- );
-};
-
-export default CreateForm;
diff --git a/src/pages/database/goods/goodstechnology/index.jsx b/src/pages/database/goods/goodstechnology/index.jsx
deleted file mode 100644
index 8c2419c..0000000
--- a/src/pages/database/goods/goodstechnology/index.jsx
+++ /dev/null
@@ -1,292 +0,0 @@
-import { DropboxOutlined, PlusOutlined } from '@ant-design/icons';
-import { Button, message, Input, Drawer, Modal, 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 CreateForm from './components/CreateForm';
-import ActionForm from './components/ActionForm';
-import {
- getGoodstechnologypage,
- addgoodstechnology,
- updategoodstechnology,
- deletegoodstechnology,
-} from './services';
-
-//页面 相当于 class
-/**
- * 添加节点
- *
- * @param fields
- */
-const handleAdd = async (fields) => {
- try {
- await addgoodstechnology(JSON.stringify(fields)).then((r) => {
- if (r.data) {
- message.success('添加成功');
- } else {
- message.error(r.errors);
- }
- });
- return true;
- } catch (error) {
- message.error('添加失败请重试!');
- return false;
- }
-};
-/**
- * 批量删除节点
- *
- * @param selectedRows
- */
-const handleRemove = async (ids) => {
- try {
- deletegoodstechnology(ids).then((r) => {
- if (r.data) {
- message.success('删除成功');
- } else {
- message.error(r.errors);
- }
- });
- return true;
- } catch (error) {
- message.error('删除失败,请重试');
- }
-};
-
-/**
- * 更新节点
- *
- * @param fields
- */
-
-const handleUpdate = async (fields) => {
- try {
- updategoodstechnology(fields).then((r) => {
- if (r.data) {
- message.success('修改成功');
- } else {
- message.error(r.errors);
- }
- });
- return true;
- } catch (error) {
- message.error('修改失败请重试!');
- return false;
- }
-};
-//页面 相当于 class
-const bomtechnology = () => {
- /** 新建/更新窗口的弹窗 */
- const [createModalVisible, handleModalVisible] = useState(false);
- /** 分布更新窗口的弹窗 */
-
- const [actionFormModalVisible, setactionFormModalVisible] = useState(false);
- const [showDetail, setShowDetail] = useState(false);
- //绑定
- const actionRef = useRef();
- const [currentRow, setCurrentRow] = useState();
- //选中的行
- const [selectedRowsState, setSelectedRows] = useState([]);
-
- /** 国际化配置 */
-
- const columns = [
- {
- title: '主键',
- dataIndex: 'id',
- tip: '规则名称是唯一的 key',
- hideInSearch: true,
- hideInTable: true,
- render: (dom, entity) => {
- return (
- {
- setCurrentRow(entity);
- setShowDetail(true);
- }}
- >
- {dom}
-
- );
- },
- },
- {
- title: '名称',
- dataIndex: 'name',
- valueType: 'textarea',
- ellipsis: true,
- search: true,
- },
- {
- title: '关联外键',
- dataIndex: 'foreignKeyRe',
- valueType: 'textarea',
- ellipsis: true,
- search: true,
- },
- {
- title: '状态',
- dataIndex: 'status',
- hideInForm: true,
- search: true,
- valueEnum: {
- 0: {
- text: '正常',
- status: 'Processing',
- },
- 1: {
- text: '停用',
- status: 'Success',
- },
- },
- },
- {
- title: '创建时间',
- dataIndex: 'createAt',
- valueType: 'date',
- hideInSearch: true,
- },
- {
- title: '操作',
- dataIndex: 'option',
- valueType: 'option',
- render: (_, record) => [
- {
- let a = 0;
- if (record.status == 0) {
- a = 1;
- }
- setCurrentRow((record.status = a));
-
- await handleUpdate(record).then((r) => {
- if (r) {
- actionRef.current.reload();
- } else {
- message.error('配置失败请重试!');
- }
- });
- }}
- >
- {record.status == 0 ? '停用' : '使用'}
- ,
- {
- handleModalVisible(true);
- setCurrentRow(record);
- actionRef.current?.reloadAndRest?.();
- }}
- >
- 更新
- ,
- {
- setactionFormModalVisible(true);
- setCurrentRow(record);
- actionRef.current?.reloadAndRest?.();
- }}
- >
- 模型配置
- ,
- {
- handleRemove([record.id]);
- actionRef.current?.reloadAndRest();
- }}
- onCancel={() => {}}
- >
- 删除
- ,
- ],
- },
- ];
-
- return (
-
- [
- ,
- ]}
- //数据绑定
- request={async (params) => {
- var data = [];
- var total = 0;
- await getGoodstechnologypage(params).then((r) => {
- data = r.data.data;
- data.forEach((x) => {
- x.status = x.status.toString();
- });
- total = r.data.total;
- });
- return {
- data: data,
- success: true,
- total: total,
- };
- }}
- // 每行选择点击事件
- rowSelection={{
- onChange: (_, selectedRows) => {
- setSelectedRows(selectedRows);
- },
- }}
- >
- {
- var success = false;
- if (value.id) {
- success = await handleUpdate(value);
- } else {
- success = await handleAdd(value);
- }
- if (success) {
- handleModalVisible(false);
- if (actionRef.current) {
- actionRef.current.reload();
- }
- }
- }}
- onCancel={() => {
- setCurrentRow(undefined);
- handleModalVisible(false);
- }}
- createModalVisible={createModalVisible}
- values={currentRow || {}}
- />
- {
- setCurrentRow(undefined);
- setactionFormModalVisible(false);
- }}
- />
-
- );
-};
-
-export default bomtechnology;
diff --git a/src/pages/device/deviceInfo/components/CreateForm.jsx b/src/pages/device/deviceInfo/components/CreateForm.jsx
index e958d6b..56c2790 100644
--- a/src/pages/device/deviceInfo/components/CreateForm.jsx
+++ b/src/pages/device/deviceInfo/components/CreateForm.jsx
@@ -13,7 +13,7 @@ const CreateForm = (props) => {
useEffect(() => {
console.log(props.values)
if(Object.keys(props.values).length>0){
- GetDeviceVesion(props.values.deviceTypeKey).then((res)=>{
+ GetDeviceVesion(props.values.productId).then((res)=>{
setDeviceVesionData(res.data)
})
}
@@ -70,18 +70,18 @@ const CreateForm = (props) => {
-
-