瀏覽代碼

提交

dev
gwbvipvip 11 月之前
父節點
當前提交
e81af35b79
共有 4 個檔案被更改,包括 164 行新增146 行删除
  1. +1
    -1
      config/proxy.js
  2. +2
    -4
      src/pages/device/deviceVesion/components/CreateForm.jsx
  3. +19
    -5
      src/pages/device/deviceVesion/index.jsx
  4. +142
    -136
      src/pages/goods/newgoods/index.jsx

+ 1
- 1
config/proxy.js 查看文件

@@ -9,7 +9,7 @@
export default {
dev: {
'/kitchen/': {
target: 'http://localhost:5001',
target: 'http://localhost:5000',
changeOrigin: true,
secure: false, //关闭证书验证
pathRewrite: {


+ 2
- 4
src/pages/device/deviceVesion/components/CreateForm.jsx 查看文件

@@ -104,7 +104,7 @@ const CreateForm = (props) => {
})}
</Select>
</Form.Item>
<Form.Item label={"模板路径"} name="templatePath" >
{/* <Form.Item label={"模板路径"} name="templatePath" >
<Input />
</Form.Item>
<Form.Item name="templatePath1" label="模板"
@@ -112,9 +112,7 @@ const CreateForm = (props) => {
<Upload {...uploadProp} >
{<Button icon={<UploadOutlined />}>上传</Button>}
</Upload>
</Form.Item>


</Form.Item> */}
<Form.Item label={'状态'} name="status" rules={[{ required: true }]}>
<Select placeholder="请选择状态">
<OptGroup>


+ 19
- 5
src/pages/device/deviceVesion/index.jsx 查看文件

@@ -1,5 +1,5 @@

import { Modal, Button, message, Form, Upload } from 'antd';
import { Modal, Button, message, Form, Upload, Tag } from 'antd';
import React, { useState, useRef, useEffect } from 'react';
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
import { PlusOutlined } from '@ant-design/icons';
@@ -83,6 +83,7 @@ const GoodsTypeManage = () => {
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) => {
@@ -98,7 +99,7 @@ const GoodsTypeManage = () => {
: Upload.LIST_IGNORE;
},
name: 'file',
data:{"id":currentRow?.id,"deviceClientType":currentRow?.deviceTypeKey,"version":currentRow?.vesion},
data: { "id": currentRow?.id, "deviceClientType": currentRow?.deviceTypeKey, "version": currentRow?.vesion,"isAddGoodsTemplate":isAddGoodsTemplate},
action: '/kitchen/api/goodes/DeviceVersionTemplateImport',
headers: {
Authorization: 'Bearer ' + localStorage.getItem('token')
@@ -107,6 +108,7 @@ const GoodsTypeManage = () => {
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList);
}
setIsAddGoodsTemplate(false);
if (info.file.status === 'done') {
setIsModalOpen(false);
actionRef.current.reload();
@@ -135,9 +137,14 @@ const GoodsTypeManage = () => {
valueType: 'textarea',
},
{
title: '模板地址',
title: '是否存在模板',
dataIndex: 'templatePath',
valueType: 'textarea',
render: (_, record) => [
<div>
<Tag color="#f50" style={{ textAlign: "center", display: (record.templatePath == null||record.templatePath == "") ? "none" : "block" }} >存在模板</Tag>
<Tag style={{ textAlign: "center", display: (record.templatePath == null||record.templatePath == "")? "block" : "none" }} color="#2db7f5">无模板</Tag>
</div>],
},
{
title: '操作',
@@ -156,8 +163,15 @@ const GoodsTypeManage = () => {
onClick={() => {
setCurrentRow(record);
setIsModalOpen(true);
}} > 上传版本工艺模版</a>,

setIsAddGoodsTemplate(false);
}} > 上传设备工艺模型</a>,
<a
key="config"
onClick={() => {
setCurrentRow(record);
setIsModalOpen(true);
setIsAddGoodsTemplate(true);
}} > 上传商品工艺模版</a>,
<a
key="config"
href={record.templatePath}


+ 142
- 136
src/pages/goods/newgoods/index.jsx 查看文件

@@ -1,5 +1,5 @@
import { PlusOutlined, UploadOutlined } from '@ant-design/icons';
import { Button, message, Input, Drawer, Popconfirm, Upload } from 'antd';
import { Button, message, Input, Drawer, Popconfirm, Upload, Spin } from 'antd';
import React, { useState, useRef, useEffect } from 'react';
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
import ProTable from '@ant-design/pro-table';
@@ -124,8 +124,9 @@ const GoodsManage = () => {
const [getGoodsBoms, setGoodsBoms] = useState();
/** 商品配方调整新建/更新窗口的弹窗 */
const [setGoodsBomModalVisible, handleGoodsBomModalVisible] = useState();
/** 国际化配置 */

const [loading, setLoading] = useState(false);
/** 国际化配置 */
useEffect(() => {
function initBom() {

@@ -337,6 +338,7 @@ const GoodsManage = () => {
];
const props = {
beforeUpload: (file) => {
setLoading(true);
if (
file.type !== 'application/vnd.ms-excel' &&
file.type !== 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
@@ -352,15 +354,17 @@ const GoodsManage = () => {
action: '/kitchen/api/goodes/ExportGood',
headers: {
// authorization: 'authorization-text',
Authorization:'Bearer ' + localStorage.getItem('token')
Authorization: 'Bearer ' + localStorage.getItem('token')
},
onChange(info) {
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList);
}
if (info.file.status === 'done') {
setLoading(false);
message.success(`${info.file.name} file uploaded successfully`);
} else if (info.file.status === 'error') {
setLoading(false);
message.error(`${info.file.name}:${info.file.response} `);
}
}
@@ -368,33 +372,34 @@ const GoodsManage = () => {

return (
<PageContainer>
<ProTable
headerTitle=""
actionRef={actionRef}
rowKey="id"
search={{
labelWidth: 120,
}}
toolBarRender={() => [
<Button
type="primary"
key="primary"
onClick={() => {
history.push({
pathname: '/goods/goodsInfo',
query: {
isAdd: true,
values: null,
tabStatus: 'basis'
},
});
}}
>
<PlusOutlined /> 新建
</Button>,
<Button
key="primary"
onClick={async () => {
<Spin spinning={loading} tip="上传中...">
<ProTable
headerTitle=""
actionRef={actionRef}
rowKey="id"
search={{
labelWidth: 120,
}}
toolBarRender={() => [
<Button
type="primary"
key="primary"
onClick={() => {
history.push({
pathname: '/goods/goodsInfo',
query: {
isAdd: true,
values: null,
tabStatus: 'basis'
},
});
}}
>
<PlusOutlined /> 新建
</Button>,
<Button
key="primary"
onClick={async () => {
// const response = await GoodsTemplateExport();
// const blob = new Blob([response]);
// const url = URL.createObjectURL(blob);
@@ -404,94 +409,94 @@ const GoodsManage = () => {
// link.href = url;
// link.click();
const link = document.createElement('a');
link.href = "https://hbl-test-1305371387.cos.ap-chengdu.myqcloud.com//Franchisee/goods/133461572557666278.xlsx";
link.click();
}}
>
<UploadOutlined /> 下载商品导入模板
</Button>,
// <Popconfirm
// type="primary"
// key="primary"
// title="导入后重复数据将被替换"
// okText="是"
// cancelText="否"
// onConfirm={() => {
// handleRemove([record.id]);
// actionRef.current?.reloadAndRest();
// }}
// onCancel={() => {}}
// >
// </Popconfirm>
<Upload {...props}>
<Button icon={<UploadOutlined />}>导入商品</Button>
</Upload>
]}
request={async (params) => {
var goodsData = [];
if (params.goodsTypeId != undefined) {
params.goodsTypeId = goodsTypes[params.goodsTypeId].goodsTypeId;
}
var total = 0;
await goods(params).then((r) => {
goodsData = r.data.data;
console.log(goodsData)
goodsData.forEach((x) => {
if (x.defaultMate != null) {
x.defaultMate = x.defaultMate.split(",");
}
link.href = "https://hbl-test-1305371387.cos.ap-chengdu.myqcloud.com//Franchisee/goods/133463060115739076.xlsx";
link.click();
}}
>
<UploadOutlined /> 下载商品导入模板
</Button>,
// <Popconfirm
// type="primary"
// key="primary"
// title="导入后重复数据将被替换"
// okText="是"
// cancelText="否"
// onConfirm={() => {
// handleRemove([record.id]);
// actionRef.current?.reloadAndRest();
// }}
// onCancel={() => {}}
// >

// </Popconfirm>
<Upload {...props} showUploadList={false} >
<Button icon={<UploadOutlined />} >导入商品</Button>
</Upload>


]}
request={async (params) => {
var goodsData = [];
if (params.goodsTypeId != undefined) {
params.goodsTypeId = goodsTypes[params.goodsTypeId].goodsTypeId;
}
var total = 0;
await goods(params).then((r) => {
goodsData = r.data.data;
console.log(goodsData)
goodsData.forEach((x) => {
if (x.defaultMate != null) {
x.defaultMate = x.defaultMate.split(",");
}

});
console.log(goodsData)
total = r.data.total;
});
console.log(goodsData)
total = r.data.total;
});
return {
data: goodsData,
success: true,
total: total,
};
}}
columns={columns}
rowSelection={{
onChange: (_, selectedRows) => {
setSelectedRows(selectedRows);
},
}}
/>
{selectedRowsState?.length > 0 && (
<FooterToolbar
extra={
<div>
已选择{' '}
<a
style={{
fontWeight: 600,
}}
>
{selectedRowsState.length}
</a>{' '}
项 &nbsp;&nbsp;
{/* <span>
return {
data: goodsData,
success: true,
total: total,
};
}}
columns={columns}
rowSelection={{
onChange: (_, selectedRows) => {
setSelectedRows(selectedRows);
},
}}
/>
{selectedRowsState?.length > 0 && (
<FooterToolbar
extra={
<div>
已选择{' '}
<a
style={{
fontWeight: 600,
}}
>
{selectedRowsState.length}
</a>{' '}
项 &nbsp;&nbsp;
{/* <span>
服务调用次数总计 {selectedRowsState.reduce((pre, item) => pre + item.id, 0)} 万
</span> */}
</div>
}
>
<Button
onClick={async () => {
await handleRemove(selectedRowsState);
setSelectedRows([]);
actionRef.current?.reloadAndRest?.();
}}
</div>
}
>
删除
</Button>
</FooterToolbar>
)}
{/* <CreateForm
<Button
onClick={async () => {
await handleRemove(selectedRowsState);
setSelectedRows([]);
actionRef.current?.reloadAndRest?.();
}}
>
删除
</Button>
</FooterToolbar>
)}
{/* <CreateForm
goodsTypaData={goodsTypes}
onFinish={async (value) => {
var success = false;
@@ -518,29 +523,30 @@ const GoodsManage = () => {
values={currentRow || {}}
/> */}

<Drawer
width={600}
visible={showDetail}
onClose={() => {
setCurrentRow(undefined);
setShowDetail(false);
}}
closable={false}
>
{currentRow?.name && (
<ProDescriptions
column={2}
title={currentRow?.name}
request={async () => ({
data: currentRow || {},
})}
params={{
id: currentRow?.name,
}}
columns={columns}
/>
)}
</Drawer>
<Drawer
width={600}
visible={showDetail}
onClose={() => {
setCurrentRow(undefined);
setShowDetail(false);
}}
closable={false}
>
{currentRow?.name && (
<ProDescriptions
column={2}
title={currentRow?.name}
request={async () => ({
data: currentRow || {},
})}
params={{
id: currentRow?.name,
}}
columns={columns}
/>
)}
</Drawer>
</Spin>
</PageContainer>
);
};


Loading…
取消
儲存