浏览代码

fix: 状态不统一

wzyyy 3 年之前
父节点
当前提交
68d7aa1912

+ 1 - 1
src/components/ProTableCard/CardItems/AccessConfig/index.tsx

@@ -25,7 +25,7 @@ export default (props: AccessConfigCardProps) => {
       status={props.state.value}
       statusText={props.state.text}
       statusNames={{
-        enabled: StatusColorEnum.processing,
+        enabled: StatusColorEnum.success,
         disabled: StatusColorEnum.error,
       }}
       showTool={props.showTool}

+ 1 - 1
src/components/ProTableCard/CardItems/networkCard.tsx

@@ -50,7 +50,7 @@ export default (props: NoticeCardProps) => {
       statusText={props.state.text}
       statusNames={{
         disabled: StatusColorEnum.error,
-        enabled: StatusColorEnum.processing,
+        enabled: StatusColorEnum.success,
       }}
       showMask={false}
     >

+ 3 - 3
src/components/ProTableCard/CardItems/product.tsx

@@ -113,12 +113,12 @@ export default (props: ProductCardProps) => {
       actions={props.actions}
       status={props.state}
       statusText={intl.formatMessage({
-        id: `pages.system.tenant.assetInformation.${props.state ? 'published' : 'unpublished'}`,
-        defaultMessage: '已发布',
+        id: `pages.device.product.status.${props.state ? 'enabled' : 'disabled'}`,
+        defaultMessage: '正常',
       })}
       statusNames={{
         0: StatusColorEnum.error,
-        1: StatusColorEnum.processing,
+        1: StatusColorEnum.success,
       }}
     >
       <div className={'pro-table-card-item'}>

+ 2 - 2
src/components/ProTableCard/CardItems/protocol.tsx

@@ -20,9 +20,9 @@ export default (props: ProcotolCardProps) => {
       showMask={false}
       actions={props.actions}
       status={props.state === 1 ? 'enabled' : 'disabled'}
-      statusText={props.state === 1 ? '已发布' : '未发布'}
+      statusText={props.state === 1 ? '正常' : '禁用'}
       statusNames={{
-        enabled: StatusColorEnum.processing,
+        enabled: StatusColorEnum.success,
         disabled: StatusColorEnum.error,
       }}
     >

+ 1 - 1
src/components/ProTableCard/CardItems/scene.tsx

@@ -26,7 +26,7 @@ export default (props: DeviceCardProps) => {
       status={props.state.value}
       statusText={props.state.text}
       statusNames={{
-        started: StatusColorEnum.processing,
+        started: StatusColorEnum.success,
         disable: StatusColorEnum.error,
         notActive: StatusColorEnum.warning,
       }}

+ 3 - 1
src/locales/zh-CN/pages.ts

@@ -192,6 +192,8 @@ export default {
   'pages.device.product.deviceClass': '设备分类',
   'pages.device.product.status.published': '已发布',
   'pages.device.product.status.unpublished': '未发布',
+  'pages.device.product.status.enabled': '正常',
+  'pages.device.product.status.disabled': '禁用',
   'pages.device.product.status.all': '全部',
   'pages.device.productDetail': '产品详情',
   'pages.device.productDetail.id': '产品ID',
@@ -238,7 +240,7 @@ export default {
   'pages.device.productDetail.setting': '应用配置',
   'pages.device.productDetail.disable': '停用',
   'pages.device.productDetail.enabled': '启用',
-  'pages.device.productDetail.deleteTip': '已发布的产品不能进行删除操作',
+  'pages.device.productDetail.deleteTip': '已启用的产品不能进行删除操作',
 
   // 设备管理-设备分类
   'pages.device.type.device': '直连设备',

+ 10 - 10
src/pages/device/Instance/Detail/Diagnose/Status/index.tsx

@@ -47,13 +47,13 @@ const Status = observer((props: Props) => {
       key: 'product',
       name: '产品状态',
       data: 'product',
-      desc: '诊断产品状态是否已发布,未发布的状态将导致连接失败',
+      desc: '诊断产品状态是否正常,禁用状态将导致连接失败',
     },
     {
       key: 'device',
       name: '设备状态',
       data: 'device',
-      desc: '诊断设备状态是否已启用,未启用的状态将导致连接失败',
+      desc: '诊断设备状态是否正常,禁用状态将导致连接失败。',
     },
     {
       key: 'device-access',
@@ -207,7 +207,7 @@ const Status = observer((props: Props) => {
                                 text={
                                   networkPermission.action ? (
                                     <span>
-                                      网络组件未启用, 请
+                                      网络组件已禁用, 请
                                       <Popconfirm
                                         title="确认启用"
                                         onConfirm={async () => {
@@ -229,7 +229,7 @@ const Status = observer((props: Props) => {
                                       网络组件
                                     </span>
                                   ) : (
-                                    '网络组件未启用,请联系管理员'
+                                    '网络组件已禁用,请联系管理员'
                                   )
                                 }
                               />
@@ -327,9 +327,9 @@ const Status = observer((props: Props) => {
                   text={
                     productPermission.action ? (
                       <span>
-                        产品未发布,请
+                        产品已禁用,请
                         <Popconfirm
-                          title="确认发布"
+                          title="确认启用"
                           onConfirm={async () => {
                             const resp = await service.deployProduct(
                               InstanceModel.detail?.productId || '',
@@ -345,12 +345,12 @@ const Status = observer((props: Props) => {
                             }
                           }}
                         >
-                          <a>发布</a>
+                          <a>启用</a>
                         </Popconfirm>
                         产品
                       </span>
                     ) : (
-                      '无产品发布权限时:产品未发布,请联系管理员处理'
+                      '无产品发布权限时:产品已禁用,请联系管理员处理'
                     )
                   }
                 />
@@ -383,7 +383,7 @@ const Status = observer((props: Props) => {
                 text={
                   devicePermission.action ? (
                     <span>
-                      设备未启用,请
+                      设备已禁用,请
                       <Popconfirm
                         title="确认启用"
                         onConfirm={async () => {
@@ -405,7 +405,7 @@ const Status = observer((props: Props) => {
                       设备
                     </span>
                   ) : (
-                    '设备未启用,请联系管理员处理'
+                    '设备已禁用,请联系管理员处理'
                   )
                 }
               />

+ 2 - 2
src/pages/device/Product/Detail/Access/AccessConfig/index.tsx

@@ -59,11 +59,11 @@ const AccessConfig = (props: Props) => {
       valueType: 'select',
       valueEnum: {
         disabled: {
-          text: '已停止',
+          text: '禁用',
           status: 'disabled',
         },
         enabled: {
-          text: '已启动',
+          text: '正常',
           status: 'enabled',
         },
       },

+ 6 - 6
src/pages/device/Product/Detail/index.tsx

@@ -264,7 +264,7 @@ const ProductDetail = observer(() => {
       subTitle={
         permission.update ? (
           <Popconfirm
-            title={productModel.current?.state === 1 ? '确认取消发布' : '确认发布'}
+            title={productModel.current?.state === 1 ? '确认禁用' : '确认启用'}
             onConfirm={() => {
               changeDeploy(statusMap[productModel.current?.state || 0].action);
             }}
@@ -272,8 +272,8 @@ const ProductDetail = observer(() => {
             <Switch
               key={2}
               checked={productModel.current?.state === 1}
-              checkedChildren="已发布"
-              unCheckedChildren="未发布"
+              checkedChildren="正常"
+              unCheckedChildren="禁用"
             />
           </Popconfirm>
         ) : (
@@ -287,8 +287,8 @@ const ProductDetail = observer(() => {
               key={2}
               disabled
               checked={productModel.current?.state === 1}
-              checkedChildren="已发布"
-              unCheckedChildren="未发布"
+              checkedChildren="正常"
+              unCheckedChildren="禁用"
             />
           </Tooltip>
         )
@@ -304,7 +304,7 @@ const ProductDetail = observer(() => {
               changeDeploy('deploy');
             },
           }}
-          tooltip={productModel.current?.state === 0 ? { title: '请先发布产品' } : undefined}
+          tooltip={productModel.current?.state === 0 ? { title: '请先启用产品' } : undefined}
           isPermission={permission.update}
           disabled={productModel.current?.state === 0}
         >

+ 12 - 12
src/pages/device/Product/index.tsx

@@ -30,8 +30,8 @@ import useLocation from '@/hooks/route/useLocation';
 
 export const service = new Service('device-product');
 export const statusMap = {
-  1: <Badge status="processing" text="已发布" />,
-  0: <Badge status="error" text="未发布" />,
+  1: <Badge status="success" text="正常" />,
+  0: <Badge status="error" text="禁用" />,
 };
 export const productModel = model<{
   current: ProductItem | undefined;
@@ -62,10 +62,10 @@ const Product = observer(() => {
   const status = {
     1: (
       <Badge
-        status="processing"
+        status="success"
         text={intl.formatMessage({
-          id: 'pages.system.tenant.assetInformation.published',
-          defaultMessage: '已发布',
+          id: 'pages.device.product.status.enabled',
+          defaultMessage: '正常',
         })}
       />
     ),
@@ -73,8 +73,8 @@ const Product = observer(() => {
       <Badge
         status="error"
         text={intl.formatMessage({
-          id: 'pages.system.tenant.assetInformation.unpublished',
-          defaultMessage: '未发布',
+          id: 'pages.device.product.status.disabled',
+          defaultMessage: '禁用',
         })}
       />
     ),
@@ -298,15 +298,15 @@ const Product = observer(() => {
         // },
         0: {
           text: intl.formatMessage({
-            id: 'pages.device.product.status.unpublished',
-            defaultMessage: '未发布',
+            id: 'pages.device.product.status.disabled',
+            defaultMessage: '禁用',
           }),
           status: 0,
         },
         1: {
           text: intl.formatMessage({
-            id: 'pages.device.product.status.published',
-            defaultMessage: '已发布',
+            id: 'pages.device.product.status.enabled',
+            defaultMessage: '正常',
           }),
           status: 1,
         },
@@ -582,7 +582,7 @@ const Product = observer(() => {
                     ? {
                         title: intl.formatMessage({
                           id: 'pages.device.productDetail.deleteTip',
-                          defaultMessage: '已发布的产品不能进行删除操作',
+                          defaultMessage: '已启用的产品不能进行删除操作',
                         }),
                       }
                     : undefined

+ 2 - 2
src/pages/link/AccessConfig/index.tsx

@@ -31,11 +31,11 @@ const AccessConfig = () => {
       valueType: 'select',
       valueEnum: {
         disabled: {
-          text: '已停止',
+          text: '禁用',
           status: 'disabled',
         },
         enabled: {
-          text: '已启动',
+          text: '正常',
           status: 'enabled',
         },
       },

+ 2 - 2
src/pages/link/Channel/Opcua/index.tsx

@@ -71,8 +71,8 @@ const Opcua = () => {
         },
         enabled: {
           text: intl.formatMessage({
-            id: 'pages.data.option.enabled',
-            defaultMessage: '启用',
+            id: 'pages.device.product.status.enabled',
+            defaultMessage: '正常',
           }),
           status: 'enabled',
         },

+ 14 - 3
src/pages/link/Protocol/index.tsx

@@ -73,8 +73,19 @@ const Protocol = () => {
     {
       dataIndex: 'state',
       title: '状态',
+      valueType: 'select',
+      valueEnum: {
+        0: {
+          text: '禁用',
+          status: 0,
+        },
+        1: {
+          text: '正常',
+          status: 1,
+        },
+      },
       renderText: (text) => (
-        <Badge color={text !== 1 ? 'red' : 'green'} text={text !== 1 ? '未发布' : '已发布'} />
+        <Badge color={text !== 1 ? 'red' : 'green'} text={text !== 1 ? '禁用' : '正常'} />
       ),
     },
     {
@@ -114,10 +125,10 @@ const Protocol = () => {
           type={'link'}
           style={{ padding: 0 }}
           tooltip={{
-            title: record.state === 1 ? '撤销' : '发布',
+            title: record.state === 1 ? '禁用' : '启用',
           }}
           popConfirm={{
-            title: `确认${record.state === 1 ? '撤销' : '发布'}`,
+            title: `确认${record.state === 1 ? '禁用' : '启用'}`,
             onConfirm: () => {
               if (record.state === 1) {
                 modifyState(record.id, 'un-deploy');

+ 14 - 14
src/pages/link/Protocol/save/index.tsx

@@ -242,20 +242,20 @@ const Save = (props: Props) => {
         >
           保存
         </Button>,
-        <Button
-          key={3}
-          type="primary"
-          onClick={() => {
-            save(true);
-          }}
-          disabled={
-            props.data?.id
-              ? !permission.update && !permission.action
-              : !permission.add && !permission.action
-          }
-        >
-          保存并发布
-        </Button>,
+        // <Button
+        //   key={3}
+        //   type="primary"
+        //   onClick={() => {
+        //     save(true);
+        //   }}
+        //   disabled={
+        //     props.data?.id
+        //       ? !permission.update && !permission.action
+        //       : !permission.add && !permission.action
+        //   }
+        // >
+        //   保存并发布
+        // </Button>,
       ]}
     >
       <Form form={form} layout="vertical">

+ 3 - 3
src/pages/link/Type/index.tsx

@@ -126,17 +126,17 @@ const Network = () => {
       valueType: 'select',
       valueEnum: {
         disabled: {
-          text: '已停止',
+          text: '禁用',
           status: 'disabled',
         },
         enabled: {
-          text: '已启动',
+          text: '正常',
           status: 'enabled',
         },
       },
       render: (text, record) => {
         if (record.state.value === 'enabled') {
-          return <Badge color="lime" text="正常" />;
+          return <Badge color="#52c41a" text="正常" />;
         }
         return <Badge color="red" text="禁用" />;
       },