zhaoy 8 meses atrás
pai
commit
bde16c1fea
4 arquivos alterados com 338 adições e 1 exclusões
  1. +7
    -0
      config/routes.js
  2. +1
    -1
      src/pages/database/goods/goodsbom/components/CreateBom.jsx
  3. +312
    -0
      src/pages/device/technology/index.jsx
  4. +18
    -0
      src/pages/device/technology/services.js

+ 7
- 0
config/routes.js Ver arquivo

@@ -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',


+ 1
- 1
src/pages/database/goods/goodsbom/components/CreateBom.jsx Ver arquivo

@@ -71,7 +71,7 @@ const GoodsbomFrom = (props) => {
setEditableRowKeys(soredata.map((item) => item.id))
setDataSource(soredata);
}
},[props])
},[])
const columns=[
{
title: '物料名称',


+ 312
- 0
src/pages/device/technology/index.jsx Ver arquivo

@@ -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) => [
// <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: '操作',
dataIndex: 'option',
valueType: 'option',
fixed: 'right',
width: 700,
render: (_, record) => [
<a
key="config"
onClick={() => {
handleModalVisible(true);
setCurrentRow(record);
// form.setFielsValue(record)
}} > 详情</a>,
<a
key="config"
onClick={() => {
handleModalVisible(true);
setCurrentRow(record);
// form.setFielsValue(record)
}} > 下载</a>,
<Popconfirm
type="primary"
key="primary11"
title="确认删除吗?"
okText="是"
cancelText="否"
onConfirm={() => {
DelDeviceVesion([record.id]).then((r) => {

if (r.data) {
message.success('删除成功');
actionRef.current.reload();
} else {
message.error(r.errors);
}
});
}}
onCancel={() => { }}
>
<a href="#">删除</a>
</Popconfirm>,
// <a
// key="config"
// onClick={() => {
// setCurrentRow(record);
// setIsModalOpen(true);
// setIsAddGoodsTemplate(false);
// }} > 上传设备工艺模型</a>,
// <a
// key="config"
// onClick={() => {
// setCurrentRow(record);
// setIsModalOpen(true);
// setIsAddGoodsTemplate(true);
// }} > 上传商品工艺模版</a>,
// <a
// key="config"
// href={record.templatePath}

// > 下载工艺模板</a>,
<a
key="config"
onClick={() => {
history.push({
pathname: '/device/productmanage',
query: {
isAdd: false,
values: record,
tabStatus: 'basis'
},
});
}} > 管理</a>,
],
},
];
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 (
<PageContainer host header={{
title: '',
breadcrumb: {},
}}>
<ProTable
headerTitle="设备版本"
actionRef={actionRef}
rowKey="id"
pagination={{ defaultPageSize: 10 }}
search={{
labelWidth: 120,
}}
toolBarRender={() => [
<Button
type="primary"
key="primary"
onClick={() => {
// form.setFielsValue(currentRow)
setIsModalOpen(true);
}} >
<PlusOutlined /> 导入工艺模版
</Button>,
]}
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 && (
<FooterToolbar
extra={
<div>
已选择{' '}
<a
style={{
fontWeight: 600,
}}
>
{selectedRowsState.length}
</a>{' '}
项 &nbsp;&nbsp;
</div>
}
>
<Button
onClick={async () => {
await handleRemove(selectedRowsState);
setSelectedRows([]);
actionRef.current?.reloadAndRest?.();
}}
>
删除
</Button>
</FooterToolbar>
)}
<Modal title="上传工艺模版" open={isModalOpen} footer={null} maskClosable={false}
destroyOnClose onCancel={() => { setIsModalOpen(false) }}>
<div style={{marginBottom:10}}>
<span style={{marginRight:10}}>选择产品</span>
<Select style={{width: '60%'}} onChange={handleChange}>
{DictData.map((item, index) => {
return (
<Select.Option index={index} value={item.id} key={item.id}>
{item.label}
</Select.Option>
);
})}
</Select>
</div>
<div style={{marginBottom:10}}>
<span style={{marginRight:10}}>选择版本</span>
<Select style={{width: '60%'}} onChange={handleVisChange}>
{DeviceVesionData.map((item, index) => {
return (
<Select.Option index={index} value={item.id} key={item.id}>
{item.label}
</Select.Option>
);
})}
</Select>
</div>
<Upload {...props} maxCount={1}>
<Button style={{marginLeft:'55%'}}>导入工艺模版</Button>
</Upload>
</Modal>

</PageContainer>
);
};

export default GoodsTypeManage;

+ 18
- 0
src/pages/device/technology/services.js Ver arquivo

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

Carregando…
Cancelar
Salvar