From 9b343de810b0753f1b8d9b3c1504a5b1a2823678 Mon Sep 17 00:00:00 2001
From: zhaoy <137053305@qq.com>
Date: Fri, 2 Feb 2024 15:42:23 +0800
Subject: [PATCH] z
---
src/pages/device/deviceVesion/index.jsx | 22 +-
.../productmanage/components/CreateTopis.jsx | 10 +-
src/pages/device/productmanage/index.jsx | 224 ++++++++++++++----
3 files changed, 199 insertions(+), 57 deletions(-)
diff --git a/src/pages/device/deviceVesion/index.jsx b/src/pages/device/deviceVesion/index.jsx
index 1380ee5..78fe8e2 100644
--- a/src/pages/device/deviceVesion/index.jsx
+++ b/src/pages/device/deviceVesion/index.jsx
@@ -136,17 +136,17 @@ const GoodsTypeManage = () => {
dataIndex: 'productName',
valueType: 'textarea',
},
- {
- title: '是否存在模板',
- dataIndex: 'templatePath',
- valueType: 'textarea',
- hideInSearch: true,
- render: (_, record) => [
-
- 存在模板
- 无模板
-
],
- },
+ // {
+ // title: '是否存在模板',
+ // dataIndex: 'templatePath',
+ // valueType: 'textarea',
+ // hideInSearch: true,
+ // render: (_, record) => [
+ //
+ // 存在模板
+ // 无模板
+ //
],
+ // },
{
title: '操作',
dataIndex: 'option',
diff --git a/src/pages/device/productmanage/components/CreateTopis.jsx b/src/pages/device/productmanage/components/CreateTopis.jsx
index 2a39da9..94ca18f 100644
--- a/src/pages/device/productmanage/components/CreateTopis.jsx
+++ b/src/pages/device/productmanage/components/CreateTopis.jsx
@@ -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)=>{
-
+
diff --git a/src/pages/device/productmanage/index.jsx b/src/pages/device/productmanage/index.jsx
index 7b9916e..6d75788 100644
--- a/src/pages/device/productmanage/index.jsx
+++ b/src/pages/device/productmanage/index.jsx
@@ -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) => {text},
},
{
@@ -281,7 +283,7 @@ const bomtechnology = (props) => {
dataIndex: 'option',
valueType: 'option',
fixed: 'right',
- width: 450,
+ width: 250,
render: (_, record) => [
{
],
},
]
+ const topicsmrcolumns=[
+ {
+ title: '主键',
+ dataIndex: 'id',
+ tip: '规则名称是唯一的 key',
+ hideInSearch: true,
+ hideInTable: true,
+ render: (dom, entity) => {
+ return (
+ {
+ setCurrentRow(entity);
+ setShowDetail(true);
+ }}
+ >
+ {dom}
+
+ );
+ },
+ },
+ {
+ title: 'Topics类',
+ dataIndex: 'topics',
+ valueType: 'textarea',
+ with:500,
+ render: (text) => {text},
+ },
+ {
+ 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: (
+ [
+ ,
+
+ ]}
+ //数据绑定
+ 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:(
+ {
+ 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: (
{
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: (
- [
- ,
+
- ]}
- //数据绑定
- dataSource={dataSource}
- // 每行选择点击事件
- rowSelection={{
- onChange: (_, selectedRows) => {
- setSelectedRows(selectedRows);
- },
- }}
- >
- {
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 (