Browse Source

提交

dev
gwbvipvip 9 months ago
parent
commit
4056c3f7e4
3 changed files with 70 additions and 24 deletions
  1. +1
    -1
      config/proxy.js
  2. +67
    -21
      src/pages/device/deviceVesion/index.jsx
  3. +2
    -2
      src/pages/goods/newgoods/index.jsx

+ 1
- 1
config/proxy.js View File

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


+ 67
- 21
src/pages/device/deviceVesion/index.jsx View File

@@ -1,11 +1,11 @@

import { Modal,Button, message,Form } from 'antd';
import React, { useState, useRef,useEffect } from 'react';
import { Modal, Button, message, Form, Upload } 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 CreateForm from './components/CreateForm';
import { GetDeviceVesionPage, AddDeviceVesion, DelDeviceVesion, UpdateDeviceVesion, GetDicList} from "./services"
import { GetDeviceVesionPage, AddDeviceVesion, DelDeviceVesion, UpdateDeviceVesion, GetDicList } from "./services"

const key = 'message';

@@ -75,13 +75,47 @@ const handleRemove = async (selectedRows) => {
}
};


const GoodsTypeManage = () => {
const [createModalVisible, handleModalVisible] = useState(false);
const actionRef = useRef();
const [DictData, setDictData] = useState([]);
const [currentRow, setCurrentRow] = useState();
const [selectedRowsState, setSelectedRows] = useState([]);
const [isModalOpen, setIsModalOpen] = 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},
action: '/kitchen/api/goodes/DeviceVersionTemplateImport',
headers: {
Authorization: 'Bearer ' + localStorage.getItem('token')
},
onChange(info) {
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList);
}
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: '主键',
@@ -117,33 +151,39 @@ const GoodsTypeManage = () => {
setCurrentRow(record);
// form.setFielsValue(record)
}} > 更新</a>,
<a
key="config"
onClick={() => {
setCurrentRow(record);
setIsModalOpen(true);
}} > 上传版本工艺模版</a>,

<a
key="config"
<a
key="config"
href={record.templatePath}
> 下载工艺模板</a>
> 下载工艺模板</a>

],
},
];
useEffect(() => {
GetDicList('DeviceClientType').then((r) => {
var arr = r.data;
let data = {};
if (r.succeeded) {
var list = [];
arr.forEach((item) => {
data[item.code] = { text: item.code };
list.push({
code: item.code,
value: item.code,
});
var arr = r.data;
let data = {};
if (r.succeeded) {
var list = [];
arr.forEach((item) => {
data[item.code] = { text: item.code };
list.push({
code: item.code,
value: item.code,
});
//setDicDataAny(data);
setDictData(list);
}
});
});
//setDicDataAny(data);
setDictData(list);
}
});
}, [])
return (
<PageContainer>
@@ -236,6 +276,12 @@ const GoodsTypeManage = () => {
form={form}
dicData={DictData}
/>
<Modal title="上传工艺模版" open={isModalOpen} footer={null} onCancel={() => { setIsModalOpen(false) }}>
<Upload {...props} maxCount={1}>
<Button >导入工艺模版</Button>
</Upload>
</Modal>

</PageContainer>
);
};


+ 2
- 2
src/pages/goods/newgoods/index.jsx View File

@@ -361,7 +361,7 @@ const GoodsManage = () => {
if (info.file.status === 'done') {
message.success(`${info.file.name} file uploaded successfully`);
} else if (info.file.status === 'error') {
message.error(`${info.file.name} file upload failed.`);
message.error(`${info.file.name}:${info.file.response} `);
}
}
};
@@ -404,7 +404,7 @@ const GoodsManage = () => {
// link.href = url;
// link.click();
const link = document.createElement('a');
link.href = "https://hbl-test-1305371387.cos.ap-chengdu.myqcloud.com//Franchisee/gzaxn@163.com/goods/133459074056631972.xlsx";
link.href = "https://hbl-test-1305371387.cos.ap-chengdu.myqcloud.com//Franchisee/goods/133461572557666278.xlsx";
link.click();
}}
>


Loading…
Cancel
Save