Browse Source

产品物模型调整

tmp
zhaoy 10 months ago
parent
commit
50950c11b5
20 changed files with 1100 additions and 1175 deletions
  1. +7
    -0
      config/routes.js
  2. +0
    -57
      src/pages/database/goods/goodstechnology/components/CreateForm.jsx
  3. +0
    -292
      src/pages/database/goods/goodstechnology/index.jsx
  4. +6
    -24
      src/pages/device/deviceInfo/components/CreateForm.jsx
  5. +38
    -29
      src/pages/device/deviceInfo/index.jsx
  6. +2
    -2
      src/pages/device/deviceInfo/services.js
  7. +2
    -2
      src/pages/device/deviceVesion/components/CreateForm.jsx
  8. +14
    -3
      src/pages/device/deviceVesion/index.jsx
  9. +0
    -239
      src/pages/device/devicetechnology/components/ActionForm.jsx
  10. +0
    -245
      src/pages/device/devicetechnology/components/CreateAction.jsx
  11. +0
    -89
      src/pages/device/devicetechnology/components/CreateForm.jsx
  12. +0
    -61
      src/pages/device/devicetechnology/services.js
  13. +4
    -1
      src/pages/device/product/components/CreateForm.jsx
  14. +36
    -4
      src/pages/device/product/index.jsx
  15. +10
    -10
      src/pages/device/productmanage/components/ActionForm.jsx
  16. +10
    -10
      src/pages/device/productmanage/components/CreateAction.jsx
  17. +232
    -0
      src/pages/device/productmanage/components/CreateForm.jsx
  18. +194
    -99
      src/pages/device/productmanage/index.jsx
  19. +14
    -8
      src/pages/device/productmanage/services.js
  20. +531
    -0
      src/pages/device/productmanage/unit.js

+ 7
- 0
config/routes.js View File

@@ -183,6 +183,13 @@ export default [
component: './device/deviceVesion',
access: 'k14',
},
{
name: '产品功能',
icon: 'smile',
path: '/device/productmanage',
component: './device/productmanage',
access: 'k14',
},
// {
// name: '设备工艺信息',
// icon: 'smile',


+ 0
- 57
src/pages/database/goods/goodstechnology/components/CreateForm.jsx View File

@@ -1,57 +0,0 @@
import React, { useState } from 'react';
import { Modal, Form, Input, Button, Select } from 'antd';
const CreateForm = (props) => {
const { Option, OptGroup } = Select;
return (
<Modal
title={props?.values?.id ? '编辑' : '新建'}
width={640}
visible={props?.createModalVisible}
bodyStyle={{ padding: '32px 40px 48px' }}
footer={null}
onCancel={() => {
props?.onCancel();
}}
destroyOnClose
maskClosable={false}
>
<Form
layout="vertical"
preserve={false}
initialValues={props?.values}
onFinish={props?.onFinish}
>
<Form.Item name="id" hidden={true}>
<Input />
</Form.Item>
<Form.Item name="name" label="工艺名称" rules={[{ required: true, max: 64, whitespace: true }]}>
<Input placeholder="请输入工艺名称" />
</Form.Item>
<Form.Item name="foreignKeyRe" label="关联外键" rules={[{ required: false }]}>
<Input placeholder="请输入关联外键" />
</Form.Item>
<Form.Item
name="status"
label="状态"
defaultValue={props?.values?.status}
rules={[{ required: true, message: '请选择状态' }]}
>
<Select placeholder="请选择状态">
<Option value="0">正常</Option>
<Option value="1">停用</Option>
</Select>
</Form.Item>
<Form.Item>
<Button htmlType="button" style={{float:'right',left:10}} onClick={props.onCancel} >
取消
</Button>
<Button type="primary" htmlType="submit" style={{float:'right'}} >
保存
</Button>
</Form.Item>
</Form>
</Modal>
);
};

export default CreateForm;

+ 0
- 292
src/pages/database/goods/goodstechnology/index.jsx View File

@@ -1,292 +0,0 @@
import { DropboxOutlined, PlusOutlined } from '@ant-design/icons';
import { Button, message, Input, Drawer, Modal, Popconfirm } from 'antd';
import React, { useState, useRef, useEffect } from 'react';
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
import ProTable from '@ant-design/pro-table';
import ProDescriptions from '@ant-design/pro-descriptions';
import CreateForm from './components/CreateForm';
import ActionForm from './components/ActionForm';
import {
getGoodstechnologypage,
addgoodstechnology,
updategoodstechnology,
deletegoodstechnology,
} from './services';

//页面 相当于 class
/**
* 添加节点
*
* @param fields
*/
const handleAdd = async (fields) => {
try {
await addgoodstechnology(JSON.stringify(fields)).then((r) => {
if (r.data) {
message.success('添加成功');
} else {
message.error(r.errors);
}
});
return true;
} catch (error) {
message.error('添加失败请重试!');
return false;
}
};
/**
* 批量删除节点
*
* @param selectedRows
*/
const handleRemove = async (ids) => {
try {
deletegoodstechnology(ids).then((r) => {
if (r.data) {
message.success('删除成功');
} else {
message.error(r.errors);
}
});
return true;
} catch (error) {
message.error('删除失败,请重试');
}
};

/**
* 更新节点
*
* @param fields
*/

const handleUpdate = async (fields) => {
try {
updategoodstechnology(fields).then((r) => {
if (r.data) {
message.success('修改成功');
} else {
message.error(r.errors);
}
});
return true;
} catch (error) {
message.error('修改失败请重试!');
return false;
}
};
//页面 相当于 class
const bomtechnology = () => {
/** 新建/更新窗口的弹窗 */
const [createModalVisible, handleModalVisible] = useState(false);
/** 分布更新窗口的弹窗 */
const [actionFormModalVisible, setactionFormModalVisible] = useState(false);
const [showDetail, setShowDetail] = useState(false);
//绑定
const actionRef = useRef();
const [currentRow, setCurrentRow] = useState();
//选中的行
const [selectedRowsState, setSelectedRows] = useState([]);

/** 国际化配置 */

const columns = [
{
title: '主键',
dataIndex: 'id',
tip: '规则名称是唯一的 key',
hideInSearch: true,
hideInTable: true,
render: (dom, entity) => {
return (
<a
onClick={() => {
setCurrentRow(entity);
setShowDetail(true);
}}
>
{dom}
</a>
);
},
},
{
title: '名称',
dataIndex: 'name',
valueType: 'textarea',
ellipsis: true,
search: true,
},
{
title: '关联外键',
dataIndex: 'foreignKeyRe',
valueType: 'textarea',
ellipsis: true,
search: true,
},
{
title: '状态',
dataIndex: 'status',
hideInForm: true,
search: true,
valueEnum: {
0: {
text: '正常',
status: 'Processing',
},
1: {
text: '停用',
status: 'Success',
},
},
},
{
title: '创建时间',
dataIndex: 'createAt',
valueType: 'date',
hideInSearch: true,
},
{
title: '操作',
dataIndex: 'option',
valueType: 'option',
render: (_, record) => [
<a
key="state"
onClick={async () => {
let a = 0;
if (record.status == 0) {
a = 1;
}
setCurrentRow((record.status = a));

await handleUpdate(record).then((r) => {
if (r) {
actionRef.current.reload();
} else {
message.error('配置失败请重试!');
}
});
}}
>
{record.status == 0 ? '停用' : '使用'}
</a>,
<a
key="config"
onClick={() => {
handleModalVisible(true);
setCurrentRow(record);
actionRef.current?.reloadAndRest?.();
}}
>
更新
</a>,
<a
key="config"
onClick={() => {
setactionFormModalVisible(true);
setCurrentRow(record);
actionRef.current?.reloadAndRest?.();
}}
>
模型配置
</a>,
<Popconfirm
type="primary"
key="primary"
title="确认删除吗?"
okText="是"
cancelText="否"
onConfirm={() => {
handleRemove([record.id]);
actionRef.current?.reloadAndRest();
}}
onCancel={() => {}}
>
<a href="#">删除</a>
</Popconfirm>,
],
},
];

return (
<PageContainer>
<ProTable
headerTitle="工艺"
actionRef={actionRef}
rowKey="id"
search={{
labelWidth: 120,
}}
columns={columns}
toolBarRender={() => [
<Button
type="primary"
key="primary"
onClick={() => {
handleModalVisible(true);
setCurrentRow({});
}}
>
<PlusOutlined /> 新建
</Button>,
]}
//数据绑定
request={async (params) => {
var data = [];
var total = 0;
await getGoodstechnologypage(params).then((r) => {
data = r.data.data;
data.forEach((x) => {
x.status = x.status.toString();
});
total = r.data.total;
});
return {
data: data,
success: true,
total: total,
};
}}
// 每行选择点击事件
rowSelection={{
onChange: (_, selectedRows) => {
setSelectedRows(selectedRows);
},
}}
></ProTable>
<CreateForm
onFinish={async (value) => {
var success = false;
if (value.id) {
success = await handleUpdate(value);
} else {
success = await handleAdd(value);
}
if (success) {
handleModalVisible(false);
if (actionRef.current) {
actionRef.current.reload();
}
}
}}
onCancel={() => {
setCurrentRow(undefined);
handleModalVisible(false);
}}
createModalVisible={createModalVisible}
values={currentRow || {}}
/>
<ActionForm actionFormModalVisible={actionFormModalVisible}
values={currentRow || {} }
onCancel={() => {
setCurrentRow(undefined);
setactionFormModalVisible(false);
}}
/>
</PageContainer>
);
};

export default bomtechnology;

+ 6
- 24
src/pages/device/deviceInfo/components/CreateForm.jsx View File

@@ -13,7 +13,7 @@ const CreateForm = (props) => {
useEffect(() => {
console.log(props.values)
if(Object.keys(props.values).length>0){
GetDeviceVesion(props.values.deviceTypeKey).then((res)=>{
GetDeviceVesion(props.values.productId).then((res)=>{
setDeviceVesionData(res.data)
})
}
@@ -70,18 +70,18 @@ const CreateForm = (props) => {
<Input />
</Form.Item>

<Form.Item label={'设备类型'} name="deviceTypeKey" rules={[{ required: true }]}>
<Select onChange={handleChange}>
<Form.Item label={'所属产品'} name="productId" rules={[{ required: true }]}>
<Select onChange={handleChange}>
{props.dicData.map((item, index) => {
return (
<Select.Option index={index} value={item.label} key={item.id}>
<Select.Option index={index} value={item.id} key={item.id}>
{item.label}
</Select.Option>
);
})}
</Select>
</Form.Item>
<Form.Item label={'设备版本'} name="deviceVersionKey" rules={[{ required: true }]}>
<Form.Item label={'产品版本'} name="productVersionId" rules={[{ required: true }]}>
<Select>
{DeviceVesionData.map((item, index) => {
return (
@@ -92,25 +92,7 @@ const CreateForm = (props) => {
})}
</Select>
</Form.Item>
{/* <Form.Item name="orgId" label="归属门店" rules={[{ required: true }]}>
<TreeSelect
style={{ width: '100%' }}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
treeData={props.OrgData}
placeholder="归属门店"
treeDefaultExpandAll
/>
</Form.Item> */}
<Form.Item label={'设备标签'} name="deviceTypeId" rules={[{ required: false }]}>
{/* <Select>
{props.storeType.map((item, index) => {
return (
<Select.Option index={index} value={item.id} key={item.id}>
{item.text}
</Select.Option>
);
})}
</Select> */}
<Select
style={{width: '100%'}}
placeholder="请选设备标签"
@@ -135,7 +117,7 @@ const CreateForm = (props) => {
)}
/>
</Form.Item>
<Form.Item label={'数据支持'} name="technologyOrBom" rules={[{ required: true }]}>
<Form.Item label={'支持功能'} name="technologyOrBom" rules={[{ required: true }]}>
<Radio.Group onChange={onChange} value={value}>
<Radio value={0}>工艺</Radio>
<Radio value={1}>配方</Radio>


+ 38
- 29
src/pages/device/deviceInfo/index.jsx View File

@@ -142,7 +142,7 @@ const GoodsTypeManage = () => {
if (r.succeeded) {
var list = [];
arr.forEach((item) => {
data[item.code] = { text: item.code };
data[item.name] = { text: item.name };
list.push({
id: item.id,
label: item.name,
@@ -165,7 +165,7 @@ const GoodsTypeManage = () => {
list2.push({
label: item.name,
text:item.name,
id: item.id,
value: item.id,
});
list[item.id] = { text: item.name };
});
@@ -204,16 +204,25 @@ const GoodsTypeManage = () => {
valueType: 'textarea',
},
{
title: '设备类型',
dataIndex: 'deviceTypeKey',
title: '所属产品',
dataIndex: 'productName',
valueEnum: dicDataAny,
hideInSearch: true,
},
{
title: '设备版本',
dataIndex: 'deviceVersionName',
title: '产品版本',
dataIndex: 'productVersionName',
search: false,
},
{
title: '支持功能',
dataIndex: 'technologyOrBom',
search: false,
valueEnum: {
0: { text: '工艺', },
1: { text: '配方',},
},
},
// {
// title: '归属门店',
// dataIndex: 'orgId',
@@ -230,8 +239,8 @@ const GoodsTypeManage = () => {
title: '状态',
dataIndex: 'status',
valueEnum: {
0: { text: '正常', status: 'Processing' },
1: { text: '用', status: 'Success' },
0: { text: '启用', status: 'Processing' },
1: { text: '用', status: 'Success' },
},
hideInSearch: true,
},
@@ -278,27 +287,27 @@ const GoodsTypeManage = () => {
>
{record.status == 0 ? '停用' : '正常'}
</a>,
<a
key="copy"
onClick={() => {
CopyDevice({ id: record.id }).then((r) => {
if (r.data) {
actionRef.current.reload();
}
});
}}
>
复制
</a>,
<a
key="upload-goods"
onClick={() => {
setCurrentRow(record);
setDeviceFoodModal(true);
}}
>
绑定商品
</a>,
// <a
// key="copy"
// onClick={() => {
// CopyDevice({ id: record.id }).then((r) => {
// if (r.data) {
// actionRef.current.reload();
// }
// });
// }}
// >
// 复制
// </a>,
// <a
// key="upload-goods"
// onClick={() => {
// setCurrentRow(record);
// setDeviceFoodModal(true);
// }}
// >
// 绑定商品
// </a>,
<a
key="add"
onClick={() => {


+ 2
- 2
src/pages/device/deviceInfo/services.js View File

@@ -202,13 +202,13 @@ export async function CheckStockAdjust(data) {
});
}
export async function GetDeviceVesion(TypeCode) {
return request(`/saasbase/api/DeviceVesion/GetDeviceVesion?Code=${TypeCode}`, {
return request(`/saasbase/api/DeviceVesion/GetDeviceVesion?productId=${TypeCode}`, {
method: 'Get',
});
}

export async function TechnologyTemplateExport(data) {
return request(`/saasbase/api/goodes/TechnologyTemplateExport?deviceId=${data}`, {
return request(`/saasbase/api/goods/TechnologyTemplateExport?deviceId=${data}`, {
method: 'post',
// responseType: 'blob'
});


+ 2
- 2
src/pages/device/deviceVesion/components/CreateForm.jsx View File

@@ -93,11 +93,11 @@ const CreateForm = (props) => {
<Form.Item label={"版本号"} name="vesion" rules={[{ required: true,max:50}]} >
<Input />
</Form.Item>
<Form.Item label={"设备类型"} name="deviceTypeKey" rules={[{ required: true,max:50}]} >
<Form.Item label={"所属产品"} name="productId" rules={[{ required: true,max:50}]} >
<Select>
{props.dicData.map((item, index) => {
return (
<Select.Option index={index} value={item.label} key={item.label}>
<Select.Option index={index} value={item.id} key={item.id}>
{item.label}
</Select.Option>
);


+ 14
- 3
src/pages/device/deviceVesion/index.jsx View File

@@ -132,10 +132,19 @@ const GoodsTypeManage = () => {
valueType: 'textarea',
},
{
title: '设备类型',
dataIndex: 'deviceTypeKey',
title: '所属产品',
dataIndex: 'productName',
valueType: 'textarea',
},
{
title: '状态',
dataIndex: 'status',
valueEnum: {
0: { text: '启用', status: 'Processing' },
1: { text: '禁用', status: 'Success' },
},
hideInSearch: true,
},
{
title: '是否存在模板',
dataIndex: 'templatePath',
@@ -150,6 +159,8 @@ const GoodsTypeManage = () => {
title: '操作',
dataIndex: 'option',
valueType: 'option',
fixed: 'right',
width: 700,
render: (_, record) => [
<a
key="config"
@@ -208,7 +219,7 @@ const GoodsTypeManage = () => {
data[item.code] = { text: item.code };
list.push({
label: item.name,
text:item,
text:item.name,
id: item.id,
});
});


+ 0
- 239
src/pages/device/devicetechnology/components/ActionForm.jsx View File

@@ -1,239 +0,0 @@
import ProTable from '@ant-design/pro-table';
import { Modal,Space, Form,Button,Select,message,Popconfirm} from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import React, { useState,useRef } from 'react';
import CreateAction from './CreateAction';
import {
gettechnologyactionList,
addtechnologyaction,
updatetechnologyaction,
deletetechnologyaction
} from '../services';
const { Option, OptGroup } = Select;

const ActionForm = (props) => {
const [currentRow , setcurrentRow ] = useState([]);;
const [dataSource, setDataSource] = useState([]);
const actionRef = useRef();
const [form] = Form.useForm();
const [actionValueName,setactionValueName]=useState();
const [createModalVisible, handleModalVisible] = useState(false);
const options = {
text:{value:'text',text: `文本框`},
select:{ value: `select`, text: `下拉框`},
// money:{ value: `money`, text: `金额输入`},
textarea:{ value: `textarea`, text: `文本域`},
// date:{ value: `date`, text: `日期`},
// dateTime:{ value: `dateTime`, text: `日期时间`},
// radio:{ value: `radio`, text: `单选框`},
// radioButton:{ value: `radioButton`, text: `按钮单选框`},
digit:{ value: `digit`, text: `数字输入框`},
switch:{ value: `switch`, text: `开关`},
}
const columns= [
{
title: '模型名称',
dataIndex: 'actionName',
width: '15%',
},
{
title: '输入类型',
key: 'actionType',
dataIndex: 'actionType',
valueType: 'select',
width: '15%',
valueEnum:options,
},
// {
// title: '类型值',
// dataIndex: 'actionValue',
// width: '15%',
// valueType:'select',
// valueEnum: {
// text:{
// text: '文本框',
// status: 'text',
// },
// select:{
// text: '下拉框',
// status: 'select',
// }
// }
// },
// {
// title: '单位',
// dataIndex: 'unit',
// width: '8%',
// },
// {
// title: '是否绑定物料',
// dataIndex: 'isBatch',
// width: '15%',
// valueEnum: {
// true:{
// text: '是',
// status: 'Success',
// },
// false:{
// text: '否',
// status: 'Processing',
// }
// }
// },
{
title: '排序',
dataIndex: 'sort',
valueType:'digit',
width: '8%',
},
{
title: '操作',
valueType: 'option',
width: 200,
render: (text, record, _, action) => [
<a
key="editable"
onClick={() => {
handleModalVisible(true);
setcurrentRow(record);
}}
>
编辑
</a>,
<Popconfirm
type="primary"
key="primary"
title="确认删除吗?"
okText="是"
cancelText="否"
onConfirm={() => {
handleRemove([record.id]);
actionRef.current?.reloadAndRest();
}}
onCancel={() => { }}
>
<a href="#">删除</a>
</Popconfirm>,,
],
},
]
const onFinish= async (fields) => {
console.log(fields)
await addtechnologyaction(JSON.stringify(fields)).then((r) => {
if (r.data) {
message.success('添加成功');
} else {
message.error(r.errors);
}
});
return true;
}
const handleUpdate=async (fields) => {
await updatetechnologyaction(JSON.stringify(fields)).then((r) => {
if (r.data) {
message.success('修改成功');
} else {
message.error(r.errors);
}
});
return true;
}
const handleRemove = async (ids) => {

try {
deletetechnologyaction(ids).then((r) => {
if (r.data) {
message.success('删除成功');
actionRef.current.reload();
} else {
message.error(r.errors);
}
});
return true;
} catch (error) {
message.error('删除失败,请重试');
}
}
return (
<>
<Modal
title={'模型配置'}
width={1140}
visible={props?.actionFormModalVisible}
bodyStyle={{ padding: '32px 40px 1px 48px' }}
footer={null}
onCancel={() => {
props?.onCancel();
}}
destroyOnClose
maskClosable={false}
>
<ProTable rowKey="id"
headerTitle="模型配置列表"
actionRef={actionRef}
pagination={false}
search={false}
toolBarRender={() => [
<Button
type="primary"
key="primary"
onClick={() => {
handleModalVisible(true);
setcurrentRow({});
}}
>
<PlusOutlined /> 新建
</Button>,
]}
columns={columns}
request={async () => {
var data = [];
console.log(props.values.id)
await gettechnologyactionList(props.values.id).then((r) => {
data = r.data;
});
return {
data: data,
success: true,
};
}}
>
</ProTable>
<CreateAction
onFinish={async (value) => {
var success = false;
console.log(value)
console.log(value.actionValue)
value.goodstechnologyId=props.values.id;
if (value.id) {
success = await handleUpdate(value);
} else {
success = await onFinish(value);
}
if (success) {
handleModalVisible(false);
if (actionRef.current) {
actionRef.current.reload();
}
}
}}
onCancel={() => {
setcurrentRow(undefined);
handleModalVisible(false);
}}
createModalVisible={createModalVisible}
actionValueName={actionValueName}
values={currentRow || {}}
/>
</Modal>
</>
);
};
export default ActionForm;

+ 0
- 245
src/pages/device/devicetechnology/components/CreateAction.jsx View File

@@ -1,245 +0,0 @@
import { Modal,Input, Form,Button,Select,message,Switch,Divider,Space,progress,percent} from 'antd';
import { BetaSchemaForm, ProFormSelect,ProFormDependency } from '@ant-design/pro-form';
import React, { useState,useEffect } from 'react';
import { PlusOutlined } from '@ant-design/icons';
const CreateAction = (props) => {
const [form] = Form.useForm();
const formRef = React.useRef(null);
const [valueType, setValueType] = useState('text');
const [layoutType, setLayoutType] = useState('Form');
const [optionitem,setoptionitem]=useState([])
const [modalVisit, setModalVisit] = useState(false);
const [shuUpdate, setshuUpdate] = useState(false);
useEffect(() => {
formRef.current?.setFieldsValue(props.values);
if(props.createModalVisible){
if(props.values.actionType==null){
formRef.current?.setFieldsValue({
actionType: 'text',
});
props.values.actionType="text";
setValueType("text");
setLayoutType('Form');
setoptionitem([]);
}else{
formRef.current?.setFieldsValue({
actionType: props.values.actionType,
});
setValueType(props.values.actionType)
if(props.values.actionType=="select"){
setLayoutType('ModalForm');
let ary=[];
let op=JSON.parse(props.values.actionValue)
for (let t = 0; t < op.length; t++) {
ary.push({actionValueName:op[t].actionValueName})
}
setoptionitem(ary);
}else{
setValueType(props.values.actionType);
setLayoutType('Form');
setoptionitem([]);
}
}
}
}, [props.createModalVisible]);
const handleChange=(value)=>{
console.log(JSON.stringify(value))
if(value){
formRef.current?.setFieldsValue({
actionValue:JSON.stringify(value)
})
}
setModalVisit(false);
message.success("保存成功")
}
const options = [
{value:'text',label: `文本框`},
{ value: `select`, label: `下拉框`},
// { value: `money`, label: `金额输入`},
{ value: `textarea`, label: `文本域`},
// { value: `date`, label: `日期`},
// { value: `dateTime`, label: `日期时间`},
// { value: `radio`, label: `单选框`},
// { value: `radioButton`, label: `按钮单选框`},
{ value: `digit`, label: `数字输入框`},
{ value: `switch`, label: `开关`},
]
const columns=[
{
dataIndex: 'actionValue',
valueType:'dependency',
name: ['valueType'],
columns: ({ actionType }) => {
console.log(valueType)
switch(valueType)
{
case 'select':
return [
{
dataIndex: 'list',
valueType: 'formList',
initialValue:optionitem,
columns: [
{
valueType: 'group',
columns: [
{
title: '选项名称',
dataIndex: 'actionValueName',
width: 'md',
formItemProps: {
rules: [
{
required: true,
message: '此项为必填项',
},
],
},
}
]
}
],
},
{
renderFormItem: (schema,config,form) => {
return [
<div style={{float:'right'}}>
<Button
type="primary"
style={{'margin-left':'5px'}}
onClick={() => {
handleChange(form?.formRef?.current?.getFieldValue("list"));
return true;
}}>
保存
</Button>
</div>
];
},
}
];
case 'text':
return [
{
dataIndex: 'actionValue',
valueType: 'text',
renderFormItem: () => <Input placeholder="输入类型值" disabled />
},
];
default:
return [{
dataIndex: 'actionValue',
valueType: valueType,
fieldProps:{
disabled:true
}
}];
}
}
},
]
// const handleChange=(value)=>{

// }
// const onNameChange = (event) => {
// settypename(event.target.value);
// };
// const addItem = async (e) => {
// e.preventDefault();
// setItems([...items, {label:typename,value:index++} || `New item ${index++}`]);
// settypename('');
// setTimeout(() => {
// inputRef.current?.focus();
// }, 0);
// console.log(items)
// }
return (
<>
<Modal
title={'动作配置'}
width={640}
ref={formRef}
visible={props?.createModalVisible}
bodyStyle={{ padding: '32px 40px 1px 48px' }}
footer={null}
onCancel={() => {
props?.onCancel();
}}
destroyOnClose
maskClosable={false}
>
<Form
layout="vertical"
preserve={false}
// form={form}
initialValues={props?.values}
onFinish={props?.onFinish}
ref={formRef}
>
<Form.Item name="id" hidden={true}>
<Input />
</Form.Item>
<Form.Item>
<Form.Item name="actionName" label="模型名称" rules={[{ required: true, max: 64, whitespace: true }]}>
<Input placeholder="请输入模型名称" />
</Form.Item>
<Form.Item name="actionType" label="输入类型" rules={[{ required: true, max: 64, whitespace: true }]}>
<ProFormSelect options={options} fieldProps={{
value: valueType,
onChange: (e) => {
if(e=='select'){
setLayoutType('ModalForm');
}else{
setLayoutType('Form')
}
setValueType(e);
},
}}/>
</Form.Item>
<Form.Item name="actionValue" label="输入类型控件">
<BetaSchemaForm
trigger={<a onClick={()=>setModalVisit(true)}>添加选项</a>}
columns={columns}
layoutType={layoutType}
visible={modalVisit}
modalProps={{
forceRender: true,//切换显示模式后强制渲染其他模式表单
onCancel:()=>setModalVisit(false)
}}
onVisibleChange={(vis)=>{
setshuUpdate(vis)
}}
width={420}
shouldUpdate={shuUpdate}
submitter={false}
style={{padding:'40px 10px 1px 10px;' }}
/>
</Form.Item>
{/* <Form.Item name="unit" label="单位">
<Input placeholder="请输入单位" />
</Form.Item>
<Form.Item name="isBatch" label="是否绑定物料" valuePropName="checked">
<Switch checkedChildren="是" unCheckedChildren="否"/>
</Form.Item> */}
<Form.Item name="sort" label="排序">
<Input placeholder="请输入排序" />
</Form.Item>
<Button htmlType="button" style={{float:'right',left:10}} onClick={props.onCancel} >
取消
</Button>
<Button type="primary" htmlType="submit" style={{float:'right'}} >
保存
</Button>
</Form.Item>
</Form>
</Modal>
</>
)
}
export default CreateAction;

+ 0
- 89
src/pages/device/devicetechnology/components/CreateForm.jsx View File

@@ -1,89 +0,0 @@
import React, { useState } from 'react';
import { Modal, Form, Input, Button, Select } from 'antd';
import {
GetDeviceVesion
} from '../services';
const CreateForm = (props) => {
const { Option, OptGroup } = Select;
const [DeviceVesionData, setDeviceVesionData] = useState([]);
const handleChange=(value)=>{
GetDeviceVesion(value).then((res)=>{
setDeviceVesionData(res.data)
})
}
return (
<Modal
title={props?.values?.id ? '编辑' : '新建'}
width={640}
visible={props?.createModalVisible}
bodyStyle={{ padding: '32px 40px 48px' }}
footer={null}
onCancel={() => {
props?.onCancel();
}}
destroyOnClose
maskClosable={false}
>
<Form
layout="vertical"
preserve={false}
initialValues={props?.values}
onFinish={props?.onFinish}
>
<Form.Item name="id" hidden={true}>
<Input />
</Form.Item>
<Form.Item name="name" label="工艺名称" rules={[{ required: true, max: 64, whitespace: true }]}>
<Input placeholder="请输入工艺名称" />
</Form.Item>
<Form.Item label={"设备类型"} name="deviceType" rules={[{ required: true,max:50}]} >
<Select onChange={handleChange}>
{props.dicData.map((item, index) => {
return (
<Select.Option index={index} value={item.code} key={item.code}>
{item.value}
</Select.Option>
);
})}
</Select>
</Form.Item>
<Form.Item label={'设备版本'} name="deviceVersionKey" rules={[{ required: true }]}>
<Select>
{DeviceVesionData.map((item, index) => {
return (
<Select.Option index={index} value={item.id} key={item.id}>
{item.vesion}
</Select.Option>
);
})}
</Select>
</Form.Item>
<Form.Item
name="status"
label="状态"
defaultValue={props?.values?.status}
rules={[{ required: true, message: '请选择状态' }]}
>
<Select placeholder="请选择状态">
<Option value="0">正常</Option>
<Option value="1">停用</Option>
</Select>
</Form.Item>
<Form.Item name="foreignKeyRe" label="关联外键" rules={[{ required: false }]}>
<Input placeholder="请输入关联外键" />
</Form.Item>
<Form.Item>
<Button htmlType="button" style={{float:'right',left:10}} onClick={props.onCancel} >
取消
</Button>
<Button type="primary" htmlType="submit" style={{float:'right'}} >
保存
</Button>
</Form.Item>
</Form>
</Modal>
);
};

export default CreateForm;

+ 0
- 61
src/pages/device/devicetechnology/services.js View File

@@ -1,61 +0,0 @@
import { request } from 'umi';

//获取分页数据
export async function getGoodstechnologypage(data) {
return request(`/saasbase/api/goodstechnology/getGoodstechnologypage`, {
method: 'Post',
data: data,
});
}
export async function addgoodstechnology(data) {
return request(`/saasbase/api/goodstechnology/addgoodstechnology`, {
method: 'Post',
data: data,
});
}
export async function updategoodstechnology(data) {
return request(`/saasbase/api/goodstechnology/updategoodstechnology`, {
method: 'Post',
data: data,
});
}
export async function deletegoodstechnology(data) {
return request(`/saasbase/api/goodstechnology/deletegoodstechnology`, {
method: 'Post',
data: data,
});
}
export async function gettechnologyactionList(data) {
return request(`/saasbase/api/goodstechnology/gettechnologyactionList?GoodstechnologyId=`+data, {
method: 'Get',
});
}
export async function addtechnologyaction(data) {
return request(`/saasbase/api/goodstechnology/addtechnologyaction`, {
method: 'Post',
data: data,
});
}
export async function updatetechnologyaction(data) {
return request(`/saasbase/api/goodstechnology/updatetechnologyaction`, {
method: 'Post',
data: data,
});
}
export async function deletetechnologyaction(data) {
return request(`/saasbase/api/goodstechnology/deletetechnologyaction`, {
method: 'Post',
data: data,
});
}
/**获取设备类型 */
export async function GetDicList(TypeCode) {
return request(`/saasbase/api/dict-data/dic-list/${TypeCode}`, {
method: 'Get',
});
}
export async function GetDeviceVesion(TypeCode) {
return request(`/saasbase/api/DeviceVesion/GetDeviceVesion?Code=${TypeCode}`, {
method: 'Get',
});
}

+ 4
- 1
src/pages/device/product/components/CreateForm.jsx View File

@@ -26,7 +26,10 @@ const CreateForm = (props) => {
<Form.Item label={"产品名称"} name="name" rules={[{ required: true,max:50}]} >
<Input />
</Form.Item>
<Form.Item label={"备注"} name="remark" rules={[{ required: true,max:50}]} >
<Form.Item label={"产品标签"} name="code" rules={[{ required: true,max:50}]} >
<Input />
</Form.Item>
<Form.Item label={"备注"} name="remark" rules={[{ required: false,max:50}]} >
<Input />
</Form.Item>
<Form.Item>


+ 36
- 4
src/pages/device/product/index.jsx View File

@@ -6,7 +6,7 @@ import { PlusOutlined } from '@ant-design/icons';
import ProTable from '@ant-design/pro-table';
import CreateForm from './components/CreateForm';
import { GetProductPage, AddProduct, DelProduct, UpdateProduct,UpdateStatus } from "./services"
import { history } from 'umi';
const key = 'message';
const GoodsTypeManage = () => {
const [createModalVisible, handleModalVisible] = useState(false);
@@ -26,6 +26,11 @@ const GoodsTypeManage = () => {
dataIndex: 'name',
valueType: 'textarea',
},
{
title: '产品标签',
dataIndex: 'code',
valueType: 'textarea',
},
{
title: '产品key',
dataIndex: 'key',
@@ -37,6 +42,22 @@ const GoodsTypeManage = () => {
valueType: 'textarea',
width: 450,
},
{
title: '状态',
dataIndex: 'status',
hideInForm: true,
search: true,
valueEnum: {
0: {
text: '启用',
status: 'Processing',
},
1: {
text: '禁用',
status: 'Success',
},
},
},
{
title: '操作',
dataIndex: 'option',
@@ -65,7 +86,7 @@ const GoodsTypeManage = () => {
});
}}
>
{record.status == 0 ? '用' : '启用'}
{record.status == 0 ? '用' : '启用'}
</a>,
<Popconfirm
type="primary"
@@ -84,6 +105,18 @@ const GoodsTypeManage = () => {
>
<a href="#">删除</a>
</Popconfirm>,
<a
key="config"
onClick={() => {
history.push({
pathname: '/device/productmanage',
query: {
isAdd: false,
values: record,
tabStatus: 'basis'
},
});
}} > 管理</a>,
],
},
];
@@ -161,8 +194,7 @@ const GoodsTypeManage = () => {
breadcrumb: {},
}}>
<ProTable
headerTitle="设备分类"
actionRef={actionRef}
rowKey="id"
pagination={{ defaultPageSize: 10 }}
search={{


src/pages/database/goods/goodstechnology/components/ActionForm.jsx → src/pages/device/productmanage/components/ActionForm.jsx View File

@@ -20,26 +20,26 @@ const ActionForm = (props) => {
const [actionValueName,setactionValueName]=useState();
const [createModalVisible, handleModalVisible] = useState(false);
const options = {
text:{value:'text',text: `文本框`},
select:{ value: `select`, text: `下拉框`},
text:{value:'text',text: `text(字符串)`},
select:{ value: `select`, text: `enum(枚举)`},
// money:{ value: `money`, text: `金额输入`},
textarea:{ value: `textarea`, text: `文本域`},
textarea:{ value: `textarea`, text: `text(文本域)`},
// date:{ value: `date`, text: `日期`},
// dateTime:{ value: `dateTime`, text: `日期时间`},
// radio:{ value: `radio`, text: `单选框`},
// radioButton:{ value: `radioButton`, text: `按钮单选框`},
digit:{ value: `digit`, text: `数字输入框`},
switch:{ value: `switch`, text: `开关`},
digit:{ value: `digit`, text: `int32(整型)`},
switch:{ value: `switch`, text: `bool(布尔型)`},
}
const columns= [
{
title: '模型名称',
title: '参数名称',
dataIndex: 'actionName',
width: '15%',
},
{
title: '输入类型',
title: '数据类型',
key: 'actionType',
dataIndex: 'actionType',
valueType: 'select',
@@ -162,7 +162,7 @@ const ActionForm = (props) => {
return (
<>
<Modal
title={'模型配置'}
title={'参数配置'}
width={1140}
visible={props?.actionFormModalVisible}
bodyStyle={{ padding: '32px 40px 1px 48px' }}
@@ -174,7 +174,7 @@ const ActionForm = (props) => {
maskClosable={false}
>
<ProTable rowKey="id"
headerTitle="模型配置列表"
headerTitle="参数配置列表"
actionRef={actionRef}
pagination={false}
search={false}
@@ -210,7 +210,7 @@ const ActionForm = (props) => {
var success = false;
console.log(value)
console.log(value.actionValue)
value.goodstechnologyId=props.values.id;
value.productFunctionId=props.values.id;
if (value.id) {
success = await handleUpdate(value);

src/pages/database/goods/goodstechnology/components/CreateAction.jsx → src/pages/device/productmanage/components/CreateAction.jsx View File

@@ -54,16 +54,16 @@ const handleChange=(value)=>{
message.success("保存成功")
}
const options = [
{value:'text',label: `文本框`},
{ value: `select`, label: `下拉框`},
{value:'text',label: `text(字符串)`},
{ value: `select`, label: `enum(枚举)`},
// { value: `money`, label: `金额输入`},
{ value: `textarea`, label: `文本域`},
{ value: `textarea`, label: `text(文本域)`},
// { value: `date`, label: `日期`},
// { value: `dateTime`, label: `日期时间`},
// { value: `radio`, label: `单选框`},
// { value: `radioButton`, label: `按钮单选框`},
{ value: `digit`, label: `数字输入框`},
{ value: `switch`, label: `开关`},
{ value: `digit`, label: `int32(整型)`},
{ value: `switch`, label: `bool(布尔型)`},
]
const columns=[
{
@@ -85,7 +85,7 @@ const handleChange=(value)=>{
valueType: 'group',
columns: [
{
title: '选项名称',
title: '枚举名称',
dataIndex: 'actionValueName',
width: 'md',
formItemProps: {
@@ -159,7 +159,7 @@ const handleChange=(value)=>{
return (
<>
<Modal
title={'动作配置'}
title={'新增参数'}
width={640}
ref={formRef}
visible={props?.createModalVisible}
@@ -184,10 +184,10 @@ const handleChange=(value)=>{
</Form.Item>
<Form.Item>
<Form.Item name="actionName" label="模型名称" rules={[{ required: true, max: 64, whitespace: true }]}>
<Form.Item name="actionName" label="参数名称" rules={[{ required: true, max: 64, whitespace: true }]}>
<Input placeholder="请输入模型名称" />
</Form.Item>
<Form.Item name="actionType" label="输入类型" rules={[{ required: true, max: 64, whitespace: true }]}>
<Form.Item name="actionType" label="数据类型" rules={[{ required: true, max: 64, whitespace: true }]}>
<ProFormSelect options={options} fieldProps={{
value: valueType,
onChange: (e) => {
@@ -203,7 +203,7 @@ const handleChange=(value)=>{
</Form.Item>
<Form.Item name="actionValue" label="输入类型控件">
<BetaSchemaForm
trigger={<a onClick={()=>setModalVisit(true)}>添加选项</a>}
trigger={<a onClick={()=>setModalVisit(true)}>添加枚举</a>}
columns={columns}
layoutType={layoutType}
visible={modalVisit}

+ 232
- 0
src/pages/device/productmanage/components/CreateForm.jsx View File

@@ -0,0 +1,232 @@
import React, { useState,useEffect } from 'react';
import { CloseOutlined} from '@ant-design/icons';
import { Modal, Form, Input, Button, Select,Radio,InputNumber, message,Space } from 'antd';
import unitoption from '../unit'
const CreateForm = (props) => {
const { Option, OptGroup } = Select;
const [display,setdisplay]=useState('block');
const [arttue,setarttue]=useState(0);
const [disabled, setDisabled] = useState(false);
const [disanumbled, setdisanumbled] = useState('block');
const [disaenumbled, setdisaenumbled] = useState('none');
const [minnumber, setminnumber] = useState(0);
const [maxnumber, setmaxnumber] = useState(1);
const [form] = Form.useForm();
const options = [
{ value: `digit`, label: `int32(整型)`},
{value:'text',label: `text(字符串)`},
{ value: `select`, label: `enum(枚举)`},
// { value: `money`, label: `金额输入`},
{ value: `textarea`, label: `text(文本域)`},
// { value: `date`, label: `日期`},
// { value: `dateTime`, label: `日期时间`},
// { value: `radio`, label: `单选框`},
// { value: `radioButton`, label: `按钮单选框`},
{ value: `switch`, label: `bool(布尔型)`},
]
useEffect(() => {
if(props?.values?.id){
console.log(JSON.parse(props?.values?.enumValue))
setDisabled(true);
setarttue(props?.values?.type)
if(props?.values?.type==1){
setdisplay("none")
}else if(props?.values?.type==0){
setdisplay("block")
}
if(props?.values?.dataType=="select"){
setdisaenumbled('block')
setdisanumbled('none')
}else if(props?.values?.dataType=="digit"){
setdisaenumbled('none')
setdisanumbled('block')
}
var enumvaluelist=[];
enumvaluelist=JSON.parse(props?.values?.enumValue);
form.setFieldsValue({
id: props?.values?.id,
type: props?.values?.type,
deviceVersionKey: props?.values?.deviceVersionKey,
name: props?.values?.name,
dataType: props?.values?.dataType,
dataRange: props?.values?.dataRange,
stepSize: props?.values?.stepSize,
unit: props?.values?.unit,
foreignKeyRe: props?.values?.foreignKeyRe,
enumvaluelist:enumvaluelist
});
if(props?.values?.dataRange){
var num=props?.values?.dataRange.split('-')
setminnumber(num[0]);
setmaxnumber(num[1])
}
}else{
console.log("xinjian")
setDisabled(false);
setdisplay("block")
setminnumber(0);
setmaxnumber(1)
form.resetFields();
setarttue(0)
form.setFieldsValue({
type: 0
});
}
},[props?.values])
const onchagetype=(e)=>{
console.log(e)
setarttue(e.target.value)
form.setFieldsValue({
type: e.target.value
});
if(e.target.value==1){
setdisplay("none")
}else if(e.target.value==0){
setdisplay("block")
}
}
const onChangemix=(value)=>{
setminnumber(value)
}
const onChangemax=(value)=>{
if(minnumber>value){
message.error("最大值不能小于最小值")
}else{
setmaxnumber(value)
form.setFieldsValue({
dataRange: minnumber+"-"+value
});
}
}
const onChangedataType=(value)=>{
console.log(value)
if(value=="digit"){
setdisanumbled('block')
setdisaenumbled('none')
}else if(value=="select"){
setdisaenumbled('block')
setdisanumbled('none')
}else{
setdisaenumbled('none')
setdisanumbled('none')
}
}
return (
<Modal
title={props?.values?.id ? '编辑' : '新建'}
width={640}
visible={props?.createModalVisible}
bodyStyle={{ padding: '32px 40px 48px' }}
footer={null}
onCancel={() => {
props?.onCancel();
}}
destroyOnClose
maskClosable={false}
>
<Form
layout="vertical"
preserve={false}
form={form}
// initialValues={props?.values}
onFinish={props?.onFinish}
>
<Form.Item name="id" hidden={true}>
<Input />
</Form.Item>
<Form.Item name="type" label="功能类型">
<Radio.Group name="type" defaultValue={0} value={arttue} onChange={onchagetype} disabled={disabled}>
<Radio.Button value={0}>属性</Radio.Button>
<Radio.Button value={1}>服务</Radio.Button>
</Radio.Group>
</Form.Item>
<Form.Item label={'产品版本'} name="deviceVersionKey" rules={[{ required: true }]}>
<Select>
{props.DeviceVesionData.map((item, index) => {
return (
<Select.Option index={index} value={item.id} key={item.id}>
{item.vesion}
</Select.Option>
);
})}
</Select>
</Form.Item>
<Form.Item name="name" label="功能名称" rules={[{ required: true, max: 64, whitespace: true }]}>
<Input placeholder="请输入功能名称" />
</Form.Item>
<Form.Item style={{display:display}} label={'数据类型'} name="dataType" rules={[{ required: false }]}>
<Select onChange={onChangedataType} defaultValue="digit">
{options.map((item, index) => {
return (
<Select.Option index={index} value={item.value} key={item.value}>
{item.label}
</Select.Option>
);
})}
</Select>
</Form.Item>
<Form.Item style={{display:disaenumbled}} label={'枚举项'} name="enumValue" rules={[{ required: false }]}>
<Form.List name='enumvaluelist'>
{(subFields, subOpt) => (
<div style={{ display: 'flex', flexDirection: 'column', rowGap: 16 }}>
{subFields.map((subField) => (
<Space key={subField.key}>
<Form.Item name={[subField.name, 'enumvalue']}>
<Input placeholder="参数值" />
</Form.Item>
<Form.Item name={[subField.name, 'enumlabel']}>
<Input placeholder="参数描述" />
</Form.Item>
<CloseOutlined
onClick={() => {
subOpt.remove(subField.name);
}}
/>
</Space>
))}
<Button type="dashed" onClick={() =>{
console.log(JSON.stringify(form.getFieldsValue(), null, 2))
console.log(subFields)
console.log(subOpt)
subOpt.add()
}} block>
+ 添加枚举
</Button>
</div>
)}
</Form.List>
</Form.Item>
<Form.Item style={{display:disanumbled}} label={'取值范围'} name="dataRange" rules={[{ required: false }]}>
<InputNumber placeholder="最小值" style={{width:'49%'}} value={minnumber} onChange={onChangemix}/>~<InputNumber value={maxnumber} placeholder="最大值" onChange={onChangemax} style={{width:'49%'}} />
</Form.Item>
<Form.Item style={{display:disanumbled}} label="步长" name="stepSize" rules={[{ required: false }]}>
<InputNumber placeholder="请输入步长" style={{width:'100%'}}/>
</Form.Item>
<Form.Item style={{display:disanumbled}} label={'单位'} name="unit" rules={[{ required: false }]}>
<Select allowClear showSearch optionFilterProp="Name" filterOption={(input, option) => (option?.label ?? '').includes(input)}
filterSort={(optionA, optionB) =>
(optionA?.label ?? '').localeCompare((optionB?.label ?? ''))
} options={unitoption}/>
</Form.Item>
<Form.Item name="foreignKeyRe" label="关联外键" rules={[{ required: false }]}>
<Input placeholder="请输入关联外键" />
</Form.Item>
<Form.Item>
<Button htmlType="button" style={{float:'right',left:10}} onClick={props.onCancel} >
取消
</Button>
<Button type="primary" htmlType="submit" style={{float:'right'}} >
保存
</Button>
</Form.Item>
</Form>
</Modal>
);
};

export default CreateForm;

src/pages/device/devicetechnology/index.jsx → src/pages/device/productmanage/index.jsx View File

@@ -1,5 +1,5 @@
import { DropboxOutlined, PlusOutlined,UploadOutlined } from '@ant-design/icons';
import { Button, message, Input, Upload, Modal, Popconfirm } from 'antd';
import { DropboxOutlined, PlusOutlined,ArrowLeftOutlined } from '@ant-design/icons';
import { Button, message, Input, Upload, Modal, Popconfirm,Card } from 'antd';
import React, { useState, useRef, useEffect } from 'react';
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
import ProTable from '@ant-design/pro-table';
@@ -11,9 +11,9 @@ import {
addgoodstechnology,
updategoodstechnology,
deletegoodstechnology,
GetDicList
GetDeviceVesion
} from './services';
import { history } from 'umi';
//页面 相当于 class
/**
* 添加节点
@@ -22,6 +22,15 @@ import {
*/
const handleAdd = async (fields) => {
try {
console.log(fields)
//var parm=JSON.stringify(fields)
if(fields.dataType=="select"){
if(fields.enumvaluelist.length==0){
message.error('请添加枚举值');
}else{
fields.enumValue=JSON.stringify(fields.enumvaluelist)
}
}
await addgoodstechnology(JSON.stringify(fields)).then((r) => {
if (r.data) {
message.success('添加成功');
@@ -93,6 +102,13 @@ const props = {

const handleUpdate = async (fields) => {
try {
if(fields.dataType=="select"){
if(fields.enumvaluelist.length==0){
message.error('请添加枚举值');
}else{
fields.enumValue=JSON.stringify(fields.enumvaluelist)
}
}
updategoodstechnology(fields).then((r) => {
if (r.data) {
message.success('修改成功');
@@ -107,11 +123,11 @@ const handleUpdate = async (fields) => {
}
};
//页面 相当于 class
const bomtechnology = () => {
const bomtechnology = (props) => {
/** 新建/更新窗口的弹窗 */
const [createModalVisible, handleModalVisible] = useState(false);
/** 分布更新窗口的弹窗 */
const [currTabKey, SetCurrTabKey] = useState("basis")
const [actionFormModalVisible, setactionFormModalVisible] = useState(false);
const [showDetail, setShowDetail] = useState(false);
//绑定
@@ -119,9 +135,79 @@ const bomtechnology = () => {
const [currentRow, setCurrentRow] = useState();
//选中的行
const [selectedRowsState, setSelectedRows] = useState([]);
const [DeviceVesionData, setDeviceVesionData] = useState([]);
const [DeviceVesionEnum, setDeviceVesionEnum] = useState({});
/** 国际化配置 */
const [DictData, setDictData] = useState([]);
const [tabStatus, seTabStatus] = useState({
operationKey: props.location.query.tabStatus ? props.location.query.tabStatus : 'basis',
tabActiveKey: props.location.query.tabStatus ? props.location.query.tabStatus : 'basis',
});
const Btn = (record) => {
var arr = [];
if (record.type == 1) {
arr.push(<a
key="config"
onClick={() => {
setactionFormModalVisible(true);
setCurrentRow(record);
actionRef.current?.reloadAndRest?.();
}}
>
参数配置
</a>);
}
arr.push(
<a
key="config"
onClick={() => {
handleModalVisible(true);
setCurrentRow(record);
actionRef.current?.reloadAndRest?.();
}}
>
更新
</a>
)
arr.push(
<Popconfirm
type="primary"
key="primary"
title="确认删除吗?"
okText="是"
cancelText="否"
onConfirm={() => {
handleRemove([record.id]);
actionRef.current?.reloadAndRest();
}}
onCancel={() => {}}
>
<a href="#">删除</a>
</Popconfirm>);

arr.push(<a
key="state"
onClick={async () => {
let a = 0;
if (record.status == 0) {
a = 1;
}
setCurrentRow((record.status = a));

await handleUpdate(record).then((r) => {
if (r) {
actionRef.current.reload();
} else {
message.error('配置失败请重试!');
}
});
}}
>
{record.status == 0 ? '禁用' : '启用'}
</a>);
return arr;
}
const columns = [
{
title: '主键',
@@ -143,32 +229,34 @@ const bomtechnology = () => {
},
},
{
title: '名称',
title: '功能名称',
dataIndex: 'name',
valueType: 'textarea',
ellipsis: true,
search: true,
},
{
title: '关联外键',
dataIndex: 'foreignKeyRe',
valueType: 'textarea',
ellipsis: true,
search: true,
},
{
title: '设备类型',
dataIndex: 'deviceTypeKey',
valueType: 'textarea',
title: '功能类型',
dataIndex: 'type',
valueType: 'select',
ellipsis: true,
search: true,
valueEnum: {
0: {
text: '属性',
},
1: {
text: '服务',
},
},
},
{
title: '版本',
dataIndex: 'vesion',
valueType: 'textarea',
valueType: 'select',
ellipsis: true,
search: true,
valueEnum:DeviceVesionEnum
},
{
title: '状态',
@@ -177,15 +265,22 @@ const bomtechnology = () => {
search: true,
valueEnum: {
0: {
text: '正常',
text: '启用',
status: 'Processing',
},
1: {
text: '用',
text: '用',
status: 'Success',
},
},
},
{
title: '关联外键',
dataIndex: 'foreignKeyRe',
valueType: 'textarea',
ellipsis: true,
search: false,
},
{
title: '创建时间',
dataIndex: 'createAt',
@@ -196,88 +291,34 @@ const bomtechnology = () => {
title: '操作',
dataIndex: 'option',
valueType: 'option',
render: (_, record) => [
<a
key="state"
onClick={async () => {
let a = 0;
if (record.status == 0) {
a = 1;
}
setCurrentRow((record.status = a));

await handleUpdate(record).then((r) => {
if (r) {
actionRef.current.reload();
} else {
message.error('配置失败请重试!');
}
});
}}
>
{record.status == 0 ? '停用' : '使用'}
</a>,
<a
key="config"
onClick={() => {
handleModalVisible(true);
setCurrentRow(record);
actionRef.current?.reloadAndRest?.();
}}
>
更新
</a>,
<a
key="config"
onClick={() => {
setactionFormModalVisible(true);
setCurrentRow(record);
actionRef.current?.reloadAndRest?.();
}}
>
模型配置
</a>,
<Popconfirm
type="primary"
key="primary"
title="确认删除吗?"
okText="是"
cancelText="否"
onConfirm={() => {
handleRemove([record.id]);
actionRef.current?.reloadAndRest();
}}
onCancel={() => {}}
>
<a href="#">删除</a>
</Popconfirm>,
],
fixed: 'right',
width: 400,
render: (_, record) =>Btn(record),
},
];
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,
});
});
//setDicDataAny(data);
setDictData(list);
}
});
}, [])
return (
<PageContainer>
<ProTable
headerTitle="工艺"
const operationTabList = [
{
key: 'basis',
tab: '功能',
},
{
key: 'topis',
tab: 'topis类列表',
},
];
const contentList = {
basis: (
<Card
style={{
marginBottom: 24,
}}
bordered={false}
>
<ProTable
actionRef={actionRef}
rowKey="id"
pagination={{ defaultPageSize: 10 }}
search={{
labelWidth: 120,
}}
@@ -312,6 +353,8 @@ const bomtechnology = () => {
request={async (params) => {
var data = [];
var total = 0;
params.deviceTypeKey=props.location.query.values.id
await getGoodstechnologypage(params).then((r) => {
data = r.data.data;
data.forEach((x) => {
@@ -334,6 +377,7 @@ const bomtechnology = () => {
></ProTable>
<CreateForm
onFinish={async (value) => {
console.log("jnlaile ")
var success = false;
if (value.id) {
success = await handleUpdate(value);
@@ -353,7 +397,7 @@ const bomtechnology = () => {
}}
createModalVisible={createModalVisible}
values={currentRow || {}}
dicData={DictData}
DeviceVesionData={DeviceVesionData}
/>
<ActionForm actionFormModalVisible={actionFormModalVisible}
values={currentRow || {} }
@@ -362,6 +406,57 @@ const bomtechnology = () => {
setactionFormModalVisible(false);
}}
/>
</Card>
),
topis: (
<Card
style={{
marginBottom: 24,
}}
bordered={false}
>
</Card>
),
};
useEffect(() => {
console.log("props.location",props.location)
GetDeviceVesion(props.location.query.values.id).then((res)=>{
let list = {};
res.data.forEach((item) => {
list[item.id] = { text: item.vesion };
});
setDeviceVesionData(res.data)
setDeviceVesionEnum(list)
})
}, [])
const onTabChange = (key) => {
// if (currentGoodsProp === 1) {
// message.info('套餐不能设置配方');
// return;
// }
seTabStatus({ operationKey: key, tabActiveKey: key });
//initGoodsType()
};
return (
<PageContainer host header={{
title: [<a key="back"
onClick={() => {
history.push({
pathname: '/device/product',
});
}}><ArrowLeftOutlined />返回</a>],
breadcrumb: {},
}}
title={props.location.query.isAdd ? '商品新增' : '详情'}
tabActiveKey={currTabKey}
onTabChange={onTabChange}
tabList={operationTabList}
>
{contentList[tabStatus.operationKey]}
</PageContainer>
);
};

src/pages/database/goods/goodstechnology/services.js → src/pages/device/productmanage/services.js View File

@@ -2,49 +2,55 @@ import { request } from 'umi';

//获取分页数据
export async function getGoodstechnologypage(data) {
return request(`/saasbase/api/goodstechnology/getGoodstechnologypage`, {
return request(`/saasbase/api/productfunction/page`, {
method: 'Post',
data: data,
});
}
export async function addgoodstechnology(data) {
return request(`/saasbase/api/goodstechnology/addgoodstechnology`, {
return request(`/saasbase/api/productfunction/add`, {
method: 'Post',
data: data,
});
}
export async function updategoodstechnology(data) {
return request(`/saasbase/api/goodstechnology/updategoodstechnology`, {
return request(`/saasbase/api/productfunction/update`, {
method: 'Post',
data: data,
});
}
export async function deletegoodstechnology(data) {
return request(`/saasbase/api/goodstechnology/deletegoodstechnology`, {
return request(`/saasbase/api/productfunction/delete`, {
method: 'Post',
data: data,
});
}
export async function gettechnologyactionList(data) {
return request(`/saasbase/api/goodstechnology/gettechnologyactionList?GoodstechnologyId=`+data, {
return request(`/saasbase/api/productfunction/getproductfunctionaction?productFunctionId=`+data, {
method: 'Get',
});
}
export async function addtechnologyaction(data) {
return request(`/saasbase/api/goodstechnology/addtechnologyaction`, {
return request(`/saasbase/api/productfunction/addproductfunctionaction`, {
method: 'Post',
data: data,
});
}
export async function updatetechnologyaction(data) {
return request(`/saasbase/api/goodstechnology/updatetechnologyaction`, {
return request(`/saasbase/api/productfunction/updateproductfunctionaction`, {
method: 'Post',
data: data,
});
}
export async function deletetechnologyaction(data) {
return request(`/saasbase/api/goodstechnology/deletetechnologyaction`, {
return request(`/saasbase/api/productfunction/delproductfunctionaction`, {
method: 'Post',
data: data,
});
}

export async function GetDeviceVesion(TypeCode) {
return request(`/saasbase/api/devicevesion/getdevicevesion?productId=${TypeCode}`, {
method: 'Get',
});
}

+ 531
- 0
src/pages/device/productmanage/unit.js View File

@@ -0,0 +1,531 @@
export default
[
{
value: "L/min",
label: "升/每分钟"
},
{
value: "mg/kg",
label: "毫克/每千克"
},
{
value: "NTU",
label: "浊度"
},
{
value: "pH",
label: "PH值"
},
{
value: "dS/m",
label: "土壤EC值"
},
{
value: "W/㎡",
label: "太阳总辐射"
},
{
value: "mm/hour",
label: "降雨量"
},
{
value: "var",
label: "乏"
},
{
value: "cP",
label: "厘泊"
},
{
value: "aw",
label: "饱和度"
},
{
value: "pcs",
label: "个"
},
{
value: "cst",
label: "厘斯"
},
{
value: "bar",
label: "巴"
},
{
value: "ppt",
label: "纳克/每升"
},
{
value: "ppb",
label: "微克/每升"
},
{
value: "uS/cm",
label: "微西/每厘米"
},
{
value: "N/C",
label: "牛顿/每库仑"
},
{
value: "V/m",
label: "伏特/每米"
},
{
value: "ml/min",
label: "滴速"
},
{
value: "mmHg",
label: "毫米汞柱"
},
{
value: "mmol/L",
label: "血糖"
},
{
value: "mm/s",
label: "毫米/每秒"
},
{
value: "turn/m",
label: "转每/分钟"
},
{
value: "count",
label: "次"
},
{
value: "gear",
label: "档"
},
{
value: "stepCount",
label: "步"
},
{
value: "Nm3/h",
label: "标准立方米/每小时"
},
{
value: "kV",
label: "千伏"
},
{
value: "kVA",
label: "千伏安"
},
{
value: "kVar",
label: "千乏"
},
{
value: "uw/cm2",
label: "微瓦/每平方厘米"
},
{
value: "只",
label: "只"
},
{
value: "%RH",
label: "相对湿度"
},
{
value: "m³/s",
label: "立方米每秒"
},
{
value: "kg/s",
label: "公斤/每秒"
},
{
value: "r/min",
label: "转/每分钟"
},
{
value: "t/h",
label: "吨/每小时"
},
{
value: "KCL/h",
label: "千卡/每小时"
},
{
value: "L/s",
label: "升每秒"
},
{
value: "Mpa",
label: "兆帕"
},
{
value: "m³/h",
label: "立方米/每小时"
},
{
value: "kvarh",
label: "千乏时"
},
{
value: "μg/L",
label: "微克/每升"
},
{
value: "kcal",
label: "千卡路里"
},
{
value: "GB",
label: "吉字节"
},
{
value: "MB",
label: "兆字节"
},
{
value: "KB",
label: "千字节"
},
{
value: "B",
label: "字节"
},
{
value: "μg/(d㎡·d)",
label: "微克/每平方分米/每天"
},
{
value: "",
label: "无"
},
{
value: "ppm",
label: "百万分率"
},
{
value: "pixel",
label: "像素"
},
{
value: "Lux",
label: "照度"
},
{
value: "grav",
label: "重力加速度"
},
{
value: "dB",
label: "分贝"
},
{
value: "%",
label: "百分比"
},
{
value: "lm",
label: "流明"
},
{
value: "bit",
label: "比特"
},
{
value: "g/mL",
label: "克/每毫升"
},
{
value: "g/L",
label: "克/每升"
},
{
value: "mg/L",
label: "毫克/每升"
},
{
value: "μg/m³",
label: "微克/每立方米"
},
{
value: "mg/m³",
label: "毫克/每立方米"
},
{
value: "g/m³",
label: "克/每立方米"
},
{
value: "kg/m³",
label: "千克/每立方米"
},
{
value: "nF",
label: "纳法"
},
{
value: "pF",
label: "皮法"
},
{
value: "μF",
label: "微法"
},
{
value: "F",
label: "法拉"
},
{
value: "Ω",
label: "欧姆"
},
{
value: "μA",
label: "微安"
},
{
value: "mA",
label: "毫安"
},
{
value: "kA",
label: "千安"
},
{
value: "A",
label: "安培"
},
{
value: "mV",
label: "毫伏"
},
{
value: "V",
label: "伏特"
},
{
value: "ms",
label: "毫秒"
},
{
value: "s",
label: "秒"
},
{
value: "min",
label: "分钟"
},
{
value: "h",
label: "小时"
},
{
value: "day",
label: "日"
},
{
value: "week",
label: "周"
},
{
value: "month",
label: "月"
},
{
value: "year",
label: "年"
},
{
value: "kn",
label: "节"
},
{
value: "km/h",
label: "千米/每小时"
},
{
value: "m/s",
label: "米/每秒"
},
{
value: "″",
label: "秒"
},
{
value: "′",
label: "分"
},
{
value: "°",
label: "度"
},
{
value: "rad",
label: "弧度"
},
{
value: "Hz",
label: "赫兹"
},
{
value: "μW",
label: "微瓦"
},
{
value: "mW",
label: "毫瓦"
},
{
value: "kW",
label: "千瓦特"
},
{
value: "W",
label: "瓦特"
},
{
value: "cal",
label: "卡路里"
},
{
value: "kW·h",
label: "千瓦时"
},
{
value: "Wh",
label: "瓦时"
},
{
value: "eV",
label: "电子伏"
},
{
value: "kJ",
label: "千焦"
},
{
value: "J",
label: "焦耳"
},
{
value: "℉",
label: "华氏度"
},
{
value: "K",
label: "开尔文"
},
{
value: "t",
label: "吨"
},
{
value: "°C",
label: "摄氏度"
},
{
value: "mPa",
label: "毫帕"
},
{
value: "hPa",
label: "百帕"
},
{
value: "kPa",
label: "千帕"
},
{
value: "Pa",
label: "帕斯卡"
},
{
value: "mg",
label: "毫克"
},
{
value: "g",
label: "克"
},
{
value: "kg",
label: "千克"
},
{
value: "N",
label: "牛"
},
{
value: "mL",
label: "毫升"
},
{
value: "L",
label: "升"
},
{
value: "mm³",
label: "立方毫米"
},
{
value: "cm³",
label: "立方厘米"
},
{
value: "km³",
label: "立方千米"
},
{
value: "m³",
label: "立方米"
},
{
value: "h㎡",
label: "公顷"
},
{
value: "c㎡",
label: "平方厘米"
},
{
value: "m㎡",
label: "平方毫米"
},
{
value: "k㎡",
label: "平方千米"
},
{
value: "㎡",
label: "平方米"
},
{
value: "nm",
label: "纳米"
},
{
value: "μm",
label: "微米"
},
{
value: "mm",
label: "毫米"
},
{
value: "cm",
label: "厘米"
},
{
value: "dm",
label: "分米"
},
{
value: "km",
label: "千米"
},
{
value: "m",
label: "米"
}
]

Loading…
Cancel
Save