Browse Source

提交

master
gwbvipvip 8 months ago
parent
commit
5b5fcdd41b
1 changed files with 47 additions and 43 deletions
  1. +47
    -43
      src/pages/device/deviceVesion/index.jsx

+ 47
- 43
src/pages/device/deviceVesion/index.jsx View File

@@ -9,6 +9,50 @@ import { GetDeviceVesionPage, AddDeviceVesion, DelDeviceVesion, UpdateDeviceVesi
import { history } from 'umi';
const key = 'message';


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 [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 handleAdd = async (fields) => {
try {
@@ -17,6 +61,7 @@ const handleAdd = async (fields) => {
message.destroy(key);
if (r.data) {
message.success('添加成功');
actionRef.current?.reloadAndRest?.();
return true;
} else {
message.error('添加失败');
@@ -39,6 +84,7 @@ const handleUpdate = async (fields) => {
message.destroy(key);
if (r.data) {
message.success('修改成功',);
actionRef.current?.reloadAndRest?.();
return true;
} else {
message.success('修改失败');
@@ -63,6 +109,7 @@ const handleRemove = async (selectedRows) => {
await DelDeviceVesion(ids).then((r) => {
if (r.data) {
message.success('删除成功');
actionRef.current?.reloadAndRest?.();
return true;
} else {
message.error(r.errors);
@@ -75,49 +122,6 @@ 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 [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: '主键',


Loading…
Cancel
Save