Forráskód Böngészése

Merge branch 'develop' of http://120.55.44.4:10080/xujunjie/gt_client_pad into develop

Renxy 1 éve
szülő
commit
6aa8671acf

+ 170 - 0
src/pages/EqSelfInspection/components/Detail.js

@@ -147,6 +147,23 @@ function Detail(props) {
           title={<ModuleTitle title="设备自检报告" />}
         ></ReportCom>
 
+        {/* 液位异常 */}
+        <LiquidLevelCom
+          sendMessageToUnity={sendMessageToUnity}
+          select={select}
+          allData={data?.FluidLevelList}
+          key="liquid"
+          type={'liquid'}
+          userList={userList}
+          title={<ModuleTitle title="液位异常" />}
+        />
+        {/* 加药流量校验 */}
+        {/* <FlowCom
+          sendMessageToUnity={sendMessageToUnity}
+          select={select}
+          allData={data?.FluidLevelList}
+          title={<ModuleTitle title="加药流量校验" />}
+        /> */}
         {/* 工艺自检报告"> */}
         <div className={styles.content}>
           <div className={styles.tableStatus}>
@@ -956,6 +973,159 @@ function LiquidLevelCom(props) {
   );
 }
 
+function FlowTable(props) {
+  const { onClickItem, data = {}, items } = props;
+  const columns = [
+    {
+      title: '设备名称',
+      width: '20%',
+      dataIndex: 'device_name',
+    },
+    {
+      title: '实际流量',
+      width: '20%',
+      dataIndex: 'origin_value',
+    },
+    {
+      title: '计量流量',
+      width: '16%',
+      dataIndex: 'value',
+    },
+    {
+      title: '差值',
+      width: '15%',
+      dataIndex: 'value',
+    },
+    {
+      title: '设定值范围',
+      width: '30%',
+      render: (record) => (
+        <ThresholdDetail
+          current={record.value || 0}
+          data={{
+            JsonNumThreshold: record?.json_num_threshold,
+            Type: record.type || 2,
+          }}
+        />
+      ),
+    },
+    {
+      title: '状态',
+      dataIndex: 'status',
+      render: (status) => {
+        switch (status) {
+          case -1:
+          case 0:
+            return (
+              <div>
+                <i
+                  className={styles.iconStatus}
+                  style={{ background: '#12CEB3' }}
+                ></i>
+                正常
+              </div>
+            );
+          case 1:
+            return (
+              <div>
+                <i
+                  className={styles.iconStatus}
+                  style={{ background: '#FFE26D' }}
+                ></i>
+                异常
+              </div>
+            );
+          case 2:
+            return (
+              <div>
+                <i
+                  className={styles.iconStatus}
+                  style={{ background: '#FFE26D' }}
+                ></i>
+                警告
+              </div>
+            );
+        }
+      },
+    },
+  ];
+  const handleClickItem = (data) => {
+    onClickItem(`DeviceTable-${data.device_code}`, {
+      type: data.status,
+      deviceCode: data.device_code,
+    });
+  };
+
+  return (
+    <Table
+      columns={columns}
+      dataSource={items}
+      rowKey="device_code"
+      locale={{
+        emptyText: <Empty />,
+      }}
+      pagination={false}
+    />
+  );
+}
+
+function FlowCom(props) {
+  const { sendMessageToUnity, select, allData = [], type, title } = props;
+  const [activeKey, setActiveKey] = useState('1');
+
+  const errorData = useMemo(() => {
+    const errorData = allData?.filter((item) => item.status);
+    return errorData;
+  }, [allData]);
+
+  const handleTabsChange = (activeKey) => {
+    setActiveKey(activeKey);
+  };
+  return (
+    <div className={styles.detailCard}>
+      <div className={styles.tableTop}>
+        {title}
+        <TabsContent
+          defaultActiveKey="1"
+          onChange={handleTabsChange}
+          small={true}
+          items={[
+            {
+              key: '1',
+              label: `异常/警告(${errorData?.length || 0})`,
+              children: <div></div>,
+            },
+            {
+              key: '2',
+              label: `全部(${allData?.length || 0})`,
+              children: <div></div>,
+            },
+          ]}
+        ></TabsContent>
+      </div>
+
+      {activeKey == '1' && (
+        <FlowTable
+          onClickItem={sendMessageToUnity}
+          select={select}
+          items={errorData}
+          key={type}
+          type={type}
+        />
+      )}
+      {activeKey == '2' && (
+        <FlowTable
+          onClickItem={sendMessageToUnity}
+          select={select}
+          items={allData}
+          key={type}
+          type={type}
+        />
+      )}
+    </div>
+  );
+}
+
 function ReportDumCom(props) {
   const { data = [], title } = props;
   const columns = [

+ 6 - 1
src/services/TaskManage.js

@@ -48,7 +48,12 @@ export async function setTaskAutomation(params, mandate) {
   });
 
   if (mandate.MandateClass === 2) {
-    res = await SetVarValues(mandate.MandateChild[0].Payload);
+    // res = await SetVarValues(mandate.MandateChild[0].Payload);
+    const query = {
+      mandate_id: item.Id,
+      mandate_type: 1
+    }
+    res = await request(`${baseURL}/v1/mandate/do?${stringify(query)}`)
     if (res) {
       return res;
     } else {