Browse Source

Merge branch 'master' into kitchenmanage

tmp
zhaoy 11 months ago
parent
commit
d675c6ae43
3 changed files with 199 additions and 57 deletions
  1. +11
    -11
      src/pages/device/deviceVesion/index.jsx
  2. +5
    -5
      src/pages/device/productmanage/components/CreateTopis.jsx
  3. +183
    -41
      src/pages/device/productmanage/index.jsx

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

@@ -136,17 +136,17 @@ const GoodsTypeManage = () => {
dataIndex: 'productName',
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: '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',


+ 5
- 5
src/pages/device/productmanage/components/CreateTopis.jsx View File

@@ -51,7 +51,7 @@ const onChange=(e)=>{
// initialValues={props?.values}
onFinish={()=>{
form.setFieldsValue({
topics:"/"+props.productCode+"/${deviceKey}/use/"+topics
topics:"/"+props.productCode+"/"+props.productVesion+"/${deviceKey}/use/"+topics
})
console.log(form.getFieldsValue())
props?.onFinish(form.getFieldsValue())
@@ -61,20 +61,20 @@ const onChange=(e)=>{
<Input />
</Form.Item>
<Form.Item name="topics" label="Topics类" rules={[{ required: true, max: 64, whitespace: true }]}>
<Input addonBefore={props.productCode+"/${deviceKey}/use/"} onChange={onChange} placeholder="请输入Topics类" />
<Input addonBefore={props.productCode+"/"+props.productVesion+"/${deviceKey}/use/"} onChange={onChange} placeholder="请输入Topics类" />
</Form.Item>
<Form.Item label={'类型'} name="topicsType" rules={[{ required: true }]}>
<Select options={[
{
value: '0',
value: 0,
label: '发布',
},
{
value: '1',
value: 1,
label: '订阅',
},
{
value: '2',
value: 2,
label: '发布和订阅',
},
]}/>


+ 183
- 41
src/pages/device/productmanage/index.jsx View File

@@ -1,5 +1,5 @@
import { DropboxOutlined, PlusOutlined,ArrowLeftOutlined } from '@ant-design/icons';
import { Button, message, Input, Upload, Modal, Popconfirm,Card,Typography } from 'antd';
import { Button, message, Input, Upload, Modal, Popconfirm,Card,Typography,Tabs } from 'antd';
import React, { useState, useRef, useEffect } from 'react';
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
import ProTable from '@ant-design/pro-table';
@@ -73,6 +73,7 @@ const bomtechnology = (props) => {
//绑定
const actionRef = useRef();
const actiontopisRef= useRef();
const actiontopismrRef= useRef();
const [currentRow, setCurrentRow] = useState();
const [currenttopsRow,setcurrenttopsRow] = useState();
//选中的行
@@ -108,7 +109,7 @@ const bomtechnology = (props) => {
// })
GetProduct(props.location.query.values.productId).then((res)=>{
setProduct(res.data)
var params={productId:props.location.query.values.productId,deviceTypeKey:props.location.query.values.productId,current:1,pageSize:10}
var params={productId:props.location.query.values.productId,productVesionId:props.location.query.values.id,isDefault:true,current:1,pageSize:10}
LoadfunData(params)
LoadtopisData(params);
})
@@ -248,6 +249,7 @@ const bomtechnology = (props) => {
title: 'Topics类',
dataIndex: 'topics',
valueType: 'textarea',
with:500,
render: (text) => <Paragraph style={{display:'inline'}} copyable>{text}</Paragraph>,
},
{
@@ -281,7 +283,7 @@ const bomtechnology = (props) => {
dataIndex: 'option',
valueType: 'option',
fixed: 'right',
width: 450,
width: 250,
render: (_, record) => [
<a
key="config"
@@ -311,6 +313,60 @@ const bomtechnology = (props) => {
],
},
]
const topicsmrcolumns=[
{
title: '主键',
dataIndex: 'id',
tip: '规则名称是唯一的 key',
hideInSearch: true,
hideInTable: true,
render: (dom, entity) => {
return (
<a
onClick={() => {
setCurrentRow(entity);
setShowDetail(true);
}}
>
{dom}
</a>
);
},
},
{
title: 'Topics类',
dataIndex: 'topics',
valueType: 'textarea',
with:500,
render: (text) => <Paragraph style={{display:'inline'}} copyable>{text}</Paragraph>,
},
{
title: '类型',
dataIndex: 'topicsType',
valueType: 'select',
ellipsis: true,
search: true,
valueEnum: {
0: {
text: '发布',
},
1: {
text: '订阅',
},
2: {
text: '发布和订阅',
},
},
},
{
title: '描述',
dataIndex: 'description',
valueType: 'textarea',
ellipsis: true,
search: false,
with:350,
},
]
const operationTabList = [
{
key: 'basis',
@@ -438,10 +494,123 @@ const handleRemove = async (ids) => {
// }
// //initGoodsType()
};
const onTabsChange=(key)=> {
console.log(key)
var params={}
if(key=="1"){
params.productId=props.location.query.values.productId
params.productVesionId=props.location.query.values.id
params.isDefault=true;
params.current=1;
params.pageSize=10
LoadtopisData(params)
}else{
//actiontopisRef.current.reload();
params.productId=props.location.query.values.productId
params.productVesionId=props.location.query.values.id
params.isDefault=false;
params.current=1;
params.pageSize=10
LoadtopisData(params)
}
}
const zdytopicslist={
zdy: (
<ProTable
id="table1"
actionRef={actiontopisRef}
rowKey="id"
pagination={{ defaultPageSize: 10,total:total }}
search={{labelWidth: 120}}
columns={topicscolumns}
toolBarRender={() => [
<Button
type="primary"
key="primary"
onClick={() => {
setcreateTopisModalVisible(true);
setcurrenttopsRow({});
}}
>
<PlusOutlined /> 新建
</Button>,
]}
//数据绑定
dataSource={dataSource}
request={async (params) => {
var data = [];
var total = 0;
params.productId=props.location.query.values.productId
params.productVesionId=props.location.query.values.id
params.isDefault=false;
await getproducttopicspage(params).then((r) => {
setdataSource( r.data.data)
data = r.data.data;
total = r.data.total;
});
return {
data: data,
success: true,
total: total,
};
}}
// 每行选择点击事件
rowSelection={{
onChange: (_, selectedRows) => {
setSelectedRows(selectedRows);
},
}}
/>
),
mr:(
<ProTable
id="table3"
actionRef={actiontopismrRef}
rowKey="id"
search={false}
pagination={{ defaultPageSize: 10,total:total }}
columns={topicsmrcolumns}
toolBarRender={false}
//数据绑定
dataSource={dataSource}
request={async (params) => {
var data = [];
var total = 0;
params.productId=props.location.query.values.productId
params.productVesionId=props.location.query.values.id
params.isDefault=true;
await getproducttopicspage(params).then((r) => {
setdataSource( r.data.data)
data = r.data.data;
total = r.data.total;
});
return {
data: data,
success: true,
total: total,
};
}}
/>
)
};
const items=[{
key: '1',
label: '默认topics',
children: zdytopicslist.mr,
},
{
key: '2',
label: '自定义topics',
children: zdytopicslist.zdy
}]
const contentList = {
basis: (
<Card style={{marginBottom: 24}} bordered={false}>
<ProTable
id="table2"
actionRef={actionRef}
rowKey="id"
pagination={{ defaultPageSize: 10 }}
@@ -478,8 +647,8 @@ const handleRemove = async (ids) => {
request={async (params) => {
var data = [];
var total = 0;
params.deviceTypeKey=props.location.query.values.productId
params.productId=props.location.query.values.productId
params.productVesionId=props.location.query.values.id
await getGoodstechnologypage(params).then((r) => {
data = r.data.data;
setdatafunctionSource( r.data.data)
@@ -504,7 +673,6 @@ const handleRemove = async (ids) => {
console.log(value)
value.productId=props.location.query.values.productId
value.deviceVersionKey=props.location.query.values.id;
var success = false;
if (value.id) {
await handleUpdate(value);
} else {
@@ -530,46 +698,21 @@ const handleRemove = async (ids) => {
),
topis: (
<Card style={{marginBottom: 24}} bordered={false}>
<ProTable
id="table1"
actionRef={actiontopisRef}
rowKey="id"
pagination={{ defaultPageSize: 10,total:total }}
search={{labelWidth: 120}}
columns={topicscolumns}
toolBarRender={() => [
<Button
type="primary"
key="primary"
onClick={() => {
setcreateTopisModalVisible(true);
setcurrenttopsRow({});
}}
>
<PlusOutlined /> 新建
</Button>,
<Tabs tabPosition='left' items={items} onChange={onTabsChange}/>
]}
//数据绑定
dataSource={dataSource}
// 每行选择点击事件
rowSelection={{
onChange: (_, selectedRows) => {
setSelectedRows(selectedRows);
},
}}
></ProTable>
<CreateTopis createModalVisible={createTopisModalVisible} productCode={Product.key}
<CreateTopis createModalVisible={createTopisModalVisible} productCode={Product.key} productVesion={props.location.query.values?.vesion}
values={currenttopsRow || {}}
onFinish={async (value) => {
value.productId=props.location.query.values.productId
value.productVesionId=props.location.query.values.id
if (value.id) {
await updateproducttopics(value).then((r)=>{
if (r.data) {
message.success('修改成功');
actiontopisRef.current.reload();
setcreateTopisModalVisible(false)
var params={productId:props.location.query.values.productId,current:1,pageSize:10}
LoadtopisData(params)
//var params={productId:props.location.query.values.productId,current:1,pageSize:10}
//LoadtopisData(params)
} else {
message.error(r.errors);
}
@@ -578,8 +721,9 @@ const handleRemove = async (ids) => {
await addproducttopics(value).then((r)=>{
if (r.data) {
message.success('添加成功');
var params={productId:props.location.query.values.productId,current:1,pageSize:10}
LoadtopisData(params)
actiontopisRef.current.reload();
// var params={productId:props.location.query.values.productId,current:1,pageSize:10}
// LoadtopisData(params)
setcreateTopisModalVisible(false)
} else {
message.error(r.errors);
@@ -597,8 +741,6 @@ const handleRemove = async (ids) => {
),
};
return (
<PageContainer host header={{
title: [<a key="back"


Loading…
Cancel
Save