|
|
@@ -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> |
|
|
|
); |
|
|
|
}; |
|
|
|