From bde16c1fea2bf2376785025b0b37d382128ec28a Mon Sep 17 00:00:00 2001 From: zhaoy <137053305@qq.com> Date: Tue, 20 Feb 2024 11:22:53 +0800 Subject: [PATCH] z --- config/routes.js | 7 + .../goods/goodsbom/components/CreateBom.jsx | 2 +- src/pages/device/technology/index.jsx | 312 ++++++++++++++++++ src/pages/device/technology/services.js | 18 + 4 files changed, 338 insertions(+), 1 deletion(-) create mode 100644 src/pages/device/technology/index.jsx create mode 100644 src/pages/device/technology/services.js diff --git a/config/routes.js b/config/routes.js index 81023dc..c7a2bfc 100644 --- a/config/routes.js +++ b/config/routes.js @@ -210,6 +210,13 @@ export default [ component: './device/productmanage', access: 'k14', }, + { + name: '设备工艺', + icon: 'smile', + path: '/device/technology', + component: './device/technology', + access: 'k14', + }, // { // name: '设备工艺信息', // icon: 'smile', diff --git a/src/pages/database/goods/goodsbom/components/CreateBom.jsx b/src/pages/database/goods/goodsbom/components/CreateBom.jsx index 81d7f06..93392d6 100644 --- a/src/pages/database/goods/goodsbom/components/CreateBom.jsx +++ b/src/pages/database/goods/goodsbom/components/CreateBom.jsx @@ -71,7 +71,7 @@ const GoodsbomFrom = (props) => { setEditableRowKeys(soredata.map((item) => item.id)) setDataSource(soredata); } - },[props]) + },[]) const columns=[ { title: '物料名称', diff --git a/src/pages/device/technology/index.jsx b/src/pages/device/technology/index.jsx new file mode 100644 index 0000000..3550e15 --- /dev/null +++ b/src/pages/device/technology/index.jsx @@ -0,0 +1,312 @@ + +import { Modal, Button, message, Form, Upload, Select ,Popconfirm} from 'antd'; +import React, { useState, useRef, useEffect } from 'react'; +import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; +import { PlusOutlined } from '@ant-design/icons'; +import ProTable from '@ant-design/pro-table'; +import {GetTechnologyPage,GetProductList,GetDeviceVesionList } from "./services" +import { history } from 'umi'; +const key = 'message'; + + + + +const GoodsTypeManage = () => { + const [createModalVisible, handleModalVisible] = useState(false); + const actionRef = useRef(); + const [DictData, setDictData] = useState([]); + const [DeviceVesionData, setDeviceVesionData] = useState([]); + const [currentRow, setCurrentRow] = useState(); + const [selectedRowsState, setSelectedRows] = useState([]); + const [isModalOpen, setIsModalOpen] = useState(false); + const [isAddGoodsTemplate,setIsAddGoodsTemplate]=useState(false); + const [form] = Form.useForm(); + const props = { + beforeUpload: (file) => { + if ( + file.type !== 'application/vnd.ms-excel' && + file.type !== 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + ) { + message.error(`${file.name} 不是 exelce 文件`); + } + return file.type == 'application/vnd.ms-excel' || + file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + ? true + : Upload.LIST_IGNORE; + }, + name: 'file', + data: { "id": currentRow?.id, "deviceClientType": currentRow?.deviceTypeKey, "version": currentRow?.vesion,"isAddGoodsTemplate":isAddGoodsTemplate}, + action: '/saasbase/api/goods/goodstemplateexport', + headers: { + Authorization: 'Bearer ' + localStorage.getItem('token') + }, + onChange(info) { + if (info.file.status !== 'uploading') { + console.log(info.file, info.fileList); + } + setIsAddGoodsTemplate(false); + if (info.file.status === 'done') { + setIsModalOpen(false); + actionRef.current.reload(); + message.success(`${info.file.name} 文件上传成功.`); + } else if (info.file.status === 'error') { + message.error(`${info.file.name} 文件上载失败.`); + } + } + }; + const columns = [ + { + title: '主键', + dataIndex: 'id', + hideInSearch: true, + hideInTable: true, + tip: '规则名称是唯一的 key' + }, + { + title: '所属产品', + dataIndex: 'productName', + valueType: 'textarea', + }, + { + title: '版本号', + dataIndex: 'vesion', + valueType: 'textarea', + }, + { + title: '时间', + dataIndex: 'createTime', + valueType: 'textarea', + }, + // { + // title: '是否存在模板', + // dataIndex: 'templatePath', + // valueType: 'textarea', + // hideInSearch: true, + // render: (_, record) => [ + //
+ // 存在模板 + // 无模板 + //
], + // }, + { + title: '操作', + dataIndex: 'option', + valueType: 'option', + fixed: 'right', + width: 700, + render: (_, record) => [ + { + handleModalVisible(true); + setCurrentRow(record); + // form.setFielsValue(record) + }} > 详情, + { + handleModalVisible(true); + setCurrentRow(record); + // form.setFielsValue(record) + }} > 下载, + { + DelDeviceVesion([record.id]).then((r) => { + + if (r.data) { + message.success('删除成功'); + actionRef.current.reload(); + } else { + message.error(r.errors); + } + + }); + }} + onCancel={() => { }} + > + 删除 + , + // { + // setCurrentRow(record); + // setIsModalOpen(true); + // setIsAddGoodsTemplate(false); + // }} > 上传设备工艺模型, + // { + // setCurrentRow(record); + // setIsModalOpen(true); + // setIsAddGoodsTemplate(true); + // }} > 上传商品工艺模版, + // 下载工艺模板, + { + history.push({ + pathname: '/device/productmanage', + query: { + isAdd: false, + values: record, + tabStatus: 'basis' + }, + }); + }} > 管理, + ], + }, + ]; + useEffect(() => { + GetProductList().then((r) => { + var arr = r.data; + if (r.succeeded) { + var list = []; + arr.forEach((item) => { + list.push({ + label: item.name, + text:item.name, + id: item.id, + }); + }); + //setDicDataAny(data); + setDictData(list); + } + }); + }, []) + const handleChange = (value) => { + console.log(`selected ${value}`); + GetDeviceVesionList(value).then((r)=>{ + var arr = r.data; + if (r.succeeded) { + var list = []; + arr.forEach((item) => { + list.push({ + label: item.vesion, + text:item.vesion, + id: item.id, + }); + }); + //setDicDataAny(data); + setDeviceVesionData(list); + } + }) + }; + const handleVisChange=(value)=>{ + console.log(`selected ${value}`); + } + return ( + + [ + , + ]} + request={async (params) => { + var data = []; + var total = 0; + await GetTechnologyPage(params).then((r) => { + data = r.data.data; + total = r.data.total; + }); + return { + data: data, + success: true, + total: total, + }; + }} + columns={columns} + rowSelection={{ + onChange: (_, selectedRows) => { + setSelectedRows(selectedRows); + }, + }} + /> + {selectedRowsState?.length > 0 && ( + + 已选择{' '} + + {selectedRowsState.length} + {' '} + 项    + + } + > + + + )} + { setIsModalOpen(false) }}> +
+ 选择产品 + +
+
+ 选择版本 + +
+ + + +
+ +
+ ); +}; + +export default GoodsTypeManage; diff --git a/src/pages/device/technology/services.js b/src/pages/device/technology/services.js new file mode 100644 index 0000000..2fe9f05 --- /dev/null +++ b/src/pages/device/technology/services.js @@ -0,0 +1,18 @@ +import { request } from 'umi'; +import { getDataBaseUrl } from '@/global_data'; +export async function GetTechnologyPage(data) { + return request(getDataBaseUrl()+`/api/technology/page`, { + method: 'POST', + data: data, + }); + } + export async function GetProductList() { + return request(getDataBaseUrl()+`/api/product/list`, { + method: 'Get', + }); + } + export async function GetDeviceVesionList(data) { + return request(getDataBaseUrl()+`/api/devicevesion/getdevicevesion?productId=`+data, { + method: 'Get', + }); + } \ No newline at end of file