Kaynağa Gözat

feat(department): search style

Lind 3 yıl önce
ebeveyn
işleme
58506e8fc4

+ 1 - 1
src/components/SearchComponent/index.tsx

@@ -463,7 +463,7 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
     );
   };
   return (
-    <Card style={{ marginBottom: '20px' }}>
+    <Card bordered={false} style={{ marginBottom: '20px', borderBottom: '1px solid #f0f0f0' }}>
       <Form form={form} className={styles.form} labelCol={4} wrapperCol={18}>
         {pattern === 'advance' ? renderAdvance() : renderSimple()}
       </Form>

+ 0 - 6
src/pages/system/Department/Assets/deivce/bind.tsx

@@ -35,9 +35,6 @@ const Bind = observer((props: Props) => {
         id: 'pages.table.name',
         defaultMessage: '名称',
       }),
-      search: {
-        transform: (value) => ({ name$LIKE: value }),
-      },
     },
     {
       title: intl.formatMessage({
@@ -48,7 +45,6 @@ const Bind = observer((props: Props) => {
       render: (_, row) => {
         return row.productName;
       },
-      search: false,
     },
     {
       title: intl.formatMessage({
@@ -56,7 +52,6 @@ const Bind = observer((props: Props) => {
         defaultMessage: '注册时间',
       }),
       dataIndex: 'registryTime',
-      search: false,
     },
     {
       title: intl.formatMessage({
@@ -65,7 +60,6 @@ const Bind = observer((props: Props) => {
       }),
       dataIndex: 'state',
       render: (_, row) => <DeviceBadge type={row.state.value} text={row.state.text} />,
-      search: false,
     },
   ];
 

+ 3 - 7
src/pages/system/Department/Assets/deivce/index.tsx

@@ -74,9 +74,6 @@ export default observer(() => {
         id: 'pages.table.name',
         defaultMessage: '名称',
       }),
-      search: {
-        transform: (value) => ({ name$LIKE: value }),
-      },
     },
     {
       title: intl.formatMessage({
@@ -87,7 +84,6 @@ export default observer(() => {
       render: (_, row) => {
         return row.productName;
       },
-      search: false,
     },
     {
       title: intl.formatMessage({
@@ -95,7 +91,6 @@ export default observer(() => {
         defaultMessage: '注册时间',
       }),
       dataIndex: 'registryTime',
-      search: false,
     },
     {
       title: intl.formatMessage({
@@ -103,8 +98,8 @@ export default observer(() => {
         defaultMessage: '状态',
       }),
       dataIndex: 'state',
-      filters: true,
-      onFilter: true,
+      // filters: true,
+      // onFilter: true,
       valueType: 'select',
       valueEnum: {
         all: {
@@ -187,6 +182,7 @@ export default observer(() => {
       />
       <SearchComponent<DeviceItem>
         field={columns}
+        pattern={'simple'}
         defaultParam={[
           {
             column: 'id',

+ 1 - 0
src/pages/system/Department/Assets/product/index.tsx

@@ -123,6 +123,7 @@ export default observer(() => {
       />
       <SearchComponent<ProductItem>
         field={columns}
+        pattern={'simple'}
         defaultParam={[
           {
             column: 'id',

+ 1 - 0
src/pages/system/Department/Assets/productCategory/index.tsx

@@ -141,6 +141,7 @@ export default observer(() => {
       />
       <SearchComponent<ProductCategoryItem>
         field={columns}
+        pattern="simple"
         defaultParam={[
           {
             column: 'id',

+ 11 - 13
src/pages/system/Department/Member/index.tsx

@@ -3,7 +3,7 @@ import { PageContainer } from '@ant-design/pro-layout';
 import ProTable from '@jetlinks/pro-table';
 import type { ActionType, ProColumns } from '@jetlinks/pro-table';
 import { useIntl } from '@@/plugin-locale/localeExports';
-import { Badge, Button, Card, Divider, message, Popconfirm, Tooltip } from 'antd';
+import { Badge, Button, message, Popconfirm, Tooltip } from 'antd';
 import { useRef, useState } from 'react';
 import { useParams } from 'umi';
 import { observer } from '@formily/react';
@@ -154,18 +154,16 @@ const Member = observer(() => {
         onCancel={closeModal}
         reload={() => actionRef.current?.reload()}
       />
-      <Card>
-        <SearchComponent<MemberItem>
-          field={columns}
-          defaultParam={[{ column: 'id$in-dimension$org', value: param.id, termType: 'eq' }]}
-          onSearch={async (data) => {
-            actionRef.current?.reset?.();
-            setSearchParam(data);
-          }}
-          target="department-user"
-        />
-      </Card>
-      <Divider />
+      <SearchComponent<MemberItem>
+        pattern={'simple'}
+        field={columns}
+        defaultParam={[{ column: 'id$in-dimension$org', value: param.id, termType: 'eq' }]}
+        onSearch={async (data) => {
+          actionRef.current?.reset?.();
+          setSearchParam(data);
+        }}
+        target="department-user"
+      />
       <ProTable<MemberItem>
         actionRef={actionRef}
         columns={columns}

+ 2 - 2
src/pages/system/Permission/index.tsx

@@ -4,7 +4,7 @@ import {
   EditOutlined,
   CloseCircleOutlined,
   PlayCircleOutlined,
-  MinusOutlined,
+  DeleteOutlined,
 } from '@ant-design/icons';
 import { Menu, Tooltip, Popconfirm, message, Button, Upload } from 'antd';
 import type { ProColumns, ActionType } from '@jetlinks/pro-table';
@@ -246,7 +246,7 @@ const Permission: React.FC = observer(() => {
                 defaultMessage: '删除',
               })}
             >
-              <MinusOutlined />
+              <DeleteOutlined />
             </Tooltip>
           </Popconfirm>
         </a>,

+ 2 - 2
src/pages/system/Role/index.tsx

@@ -1,6 +1,6 @@
 import { PageContainer } from '@ant-design/pro-layout';
 import React, { useEffect, useRef } from 'react';
-import { EditOutlined, MinusOutlined } from '@ant-design/icons';
+import { DeleteOutlined, EditOutlined } from '@ant-design/icons';
 import { message, Popconfirm, Tooltip } from 'antd';
 import type { ProColumns, ActionType } from '@jetlinks/pro-table';
 import BaseCrud from '@/components/BaseCrud';
@@ -116,7 +116,7 @@ const Role: React.FC = observer(() => {
                 defaultMessage: '删除',
               })}
             >
-              <MinusOutlined />
+              <DeleteOutlined />
             </Tooltip>
           </Popconfirm>
         </a>,

+ 16 - 13
src/pages/system/User/index.tsx

@@ -3,7 +3,7 @@ import { PageContainer } from '@ant-design/pro-layout';
 import SearchComponent from '@/components/SearchComponent';
 import type { ActionType, ProColumns } from '@jetlinks/pro-table';
 import ProTable from '@jetlinks/pro-table';
-import { Button, message, Popconfirm, Tooltip } from 'antd';
+import { Badge, Button, message, Popconfirm, Tooltip } from 'antd';
 import {
   CloseCircleOutlined,
   DeleteOutlined,
@@ -108,6 +108,9 @@ const User = observer(() => {
           status: 0,
         },
       },
+      render: (text, record) => (
+        <Badge status={record.status === 1 ? 'success' : 'error'} text={text} />
+      ),
     },
     {
       title: intl.formatMessage({
@@ -158,19 +161,19 @@ const User = observer(() => {
             </Tooltip>
           </Popconfirm>
         </a>,
-        <a key="delete">
-          <Popconfirm
-            onConfirm={async () => {
-              await service.remove(record.id);
-              actionRef.current?.reload();
-            }}
-            title="确认删除?"
-          >
-            <Tooltip title="删除">
+        <Tooltip title={record.status === 0 ? '删除' : '请先禁用该用户,再删除。'} key="delete">
+          <Button type="link" style={{ padding: 0 }} disabled={record.status === 1}>
+            <Popconfirm
+              onConfirm={async () => {
+                await service.remove(record.id);
+                actionRef.current?.reload();
+              }}
+              title="确认删除?"
+            >
               <DeleteOutlined />
-            </Tooltip>
-          </Popconfirm>
-        </a>,
+            </Popconfirm>
+          </Button>
+        </Tooltip>,
       ],
     },
   ];