xieyonghong il y a 3 ans
Parent
commit
a1936c7fad

+ 4 - 5
src/components/Player/ScreenPlayer.tsx

@@ -1,17 +1,16 @@
-import { useState, useEffect, useCallback, useRef } from 'react';
+import { useCallback, useEffect, useRef, useState } from 'react';
 import classNames from 'classnames';
 import LivePlayer from './index';
 import { Radio } from 'antd';
 import { useFullscreen } from 'ahooks';
 import './index.less';
 import {
-  CaretLeftOutlined,
-  CaretUpOutlined,
   CaretDownOutlined,
+  CaretLeftOutlined,
   CaretRightOutlined,
-  PlusOutlined,
+  CaretUpOutlined,
   MinusOutlined,
-  // AudioOutlined,
+  PlusOutlined,
 } from '@ant-design/icons';
 
 type Player = {

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

@@ -46,7 +46,7 @@
       }
 
       .ant-formily-item {
-        margin-bottom: 0;
+        margin-bottom: -24px;
       }
     }
   }

+ 48 - 7
src/components/SearchComponent/index.tsx

@@ -14,7 +14,7 @@ import {
   Space,
 } from '@formily/antd';
 import type { Field, FieldDataSource } from '@formily/core';
-import { createForm, onFieldReact } from '@formily/core';
+import { createForm, onFieldReact, onFormInit } from '@formily/core';
 import GroupNameControl from '@/components/SearchComponent/GroupNameControl';
 import {
   DeleteOutlined,
@@ -80,13 +80,13 @@ const termType = [
   { label: '=', value: 'eq' },
   { label: '!=', value: 'not' },
   { label: '包含', value: 'like' },
-  { label: '不包含', value: 'not like' },
+  { label: '不包含', value: 'nlike' },
   { label: '>', value: 'gt' },
   { label: '>=', value: 'gte' },
   { label: '<', value: 'lt' },
   { label: '<=', value: 'lte' },
   { label: '属于', value: 'in' },
-  { label: '不属于', value: 'not in' },
+  { label: '不属于', value: 'nin' },
 ];
 
 const service = new Service();
@@ -107,6 +107,30 @@ const SchemaField = createSchemaField({
   },
 });
 
+const sortField = (field: ProColumns[]) => {
+  let _temp = false;
+  field.forEach((item) => {
+    if (item.index) {
+      _temp = true;
+      return;
+    }
+  });
+
+  if (!_temp) {
+    // 如果没有index 就默认name字段最第一个
+    field.map((item) => {
+      if (item.dataIndex === 'name') {
+        item.index = 0;
+        return item;
+      } else {
+        return item;
+      }
+    });
+  }
+  // index排序
+  return _.sortBy(field, (i) => i.index);
+};
+
 const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
   const { field, target, onSearch, defaultParam, enableSave = true } = props;
   const intl = useIntl();
@@ -123,6 +147,13 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
         validateFirst: true,
         initialValues: initParams,
         effects() {
+          onFormInit((form1) => {
+            if (expand) {
+              form1.setValues({
+                terms1: [{ column: sortField(field)[0]?.dataIndex, termType: 'like' }],
+              });
+            }
+          });
           onFieldReact('*.*.column', async (typeFiled, f) => {
             const _column = (typeFiled as Field).value;
             const _field = field.find((item) => item.dataIndex === _column);
@@ -288,11 +319,21 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
 
   const handleExpand = () => {
     const value = form.values;
+    const _field = sortField(field);
+
     if (expand) {
-      value.terms1.push(initTerm, initTerm);
-      value.terms2?.push(initTerm, initTerm, initTerm);
+      value.terms1 = [0, 1, 2].map((i) => ({
+        termType: 'like',
+        column: (_field[i]?.dataIndex as string) || null,
+        type: 'or',
+      }));
+      value.terms2 = [3, 4, 5].map((i) => ({
+        termType: 'like',
+        column: (_field[i]?.dataIndex as string) || null,
+        type: 'or',
+      }));
     } else {
-      value.terms1.splice(1, 2);
+      value.terms1 = [{ termType: 'like', column: (_field[0].dataIndex as string) || null }];
       value.terms2 = [];
     }
     setInitParams(value);
@@ -492,7 +533,7 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
       <Form form={form} className={styles.form} labelCol={4} wrapperCol={18}>
         <div className={expand && styles.simple}>
           <SchemaField schema={expand ? simpleSchema : schema} />
-          <div className={styles.action}>
+          <div className={styles.action} style={{ marginTop: expand ? 0 : -12 }}>
             <Space>
               {enableSave ? SearchBtn.advance : SearchBtn.simple}
               {enableSave && SaveBtn}

+ 11 - 0
src/global.less

@@ -34,6 +34,7 @@ ul,
 ol {
   list-style: none;
 }
+
 // 菜单图标
 .ant-pro-menu-item {
   display: flex;
@@ -98,3 +99,13 @@ ol {
 .ant-formily-item-colon {
   display: none;
 }
+
+.ant-page-header-heading {
+  display: none;
+}
+
+.page-title-show {
+  .ant-page-header-heading {
+    display: flex;
+  }
+}

+ 1 - 1
src/pages/device/Category/Save/index.tsx

@@ -142,7 +142,7 @@ const Save = (props: Props) => {
       onCancel={() => props.close()}
       onOk={save}
     >
-      <Form form={form} labelCol={5} wrapperCol={16}>
+      <Form layout={'vertical'} form={form}>
         <SchemaField schema={schema} />
       </Form>
     </Modal>

+ 1 - 0
src/pages/device/Instance/Detail/index.tsx

@@ -173,6 +173,7 @@ const InstanceDetail = observer(() => {
 
   return (
     <PageContainer
+      className={'page-title-show'}
       onBack={history.goBack}
       onTabChange={setTab}
       tabList={list}

+ 1 - 0
src/pages/device/Product/Detail/index.tsx

@@ -150,6 +150,7 @@ const ProductDetail = observer(() => {
 
   return (
     <PageContainer
+      className={'page-title-show'}
       onBack={() => history.goBack()}
       extraContent={<Space size={24} />}
       content={

+ 1 - 1
src/pages/link/AccessConfig/Detail/index.tsx

@@ -14,7 +14,7 @@ const Detail = () => {
   const [data, setData] = useState<any>({});
 
   return (
-    <PageContainer>
+    <PageContainer className={'page-title-show'}>
       {visible ? (
         <Provider
           change={(param: any) => {

+ 3 - 0
src/pages/media/Stream/index.less

@@ -4,6 +4,7 @@
     align-items: center;
     justify-content: space-between;
     width: 100%;
+
     .title {
       width: 50%;
       overflow: hidden;
@@ -11,6 +12,7 @@
       white-space: nowrap;
       text-overflow: ellipsis;
     }
+
     .title::before {
       margin-right: 10px;
       background-color: #2810ff;
@@ -23,6 +25,7 @@
     justify-content: space-between;
     width: 100%;
     margin-top: 10px;
+
     .item {
       display: flex;
       flex-direction: column;

+ 1 - 1
src/pages/notice/Config/index.tsx

@@ -290,7 +290,7 @@ const Config = observer(() => {
     });
 
   return (
-    <PageContainer>
+    <PageContainer className={'page-title-show'}>
       <BaseCrud
         columns={columns}
         service={service}

+ 1 - 1
src/pages/notice/Template/index.tsx

@@ -604,7 +604,7 @@ const Template = () => {
 
   const [param, setParam] = useState({});
   return (
-    <PageContainer>
+    <PageContainer className={'page-title-show'}>
       <SearchComponent
         field={columns}
         onSearch={(data) => {

+ 1 - 0
src/pages/system/Menu/Detail/index.tsx

@@ -47,6 +47,7 @@ export default () => {
 
   return (
     <PageContainer
+      className={'page-title-show'}
       tabList={[
         {
           tab: intl.formatMessage({

+ 1 - 0
src/pages/system/Menu/index.tsx

@@ -116,6 +116,7 @@ export default observer(() => {
         defaultMessage: '创建时间',
       }),
       width: 180,
+      valueType: 'dateTime',
       dataIndex: 'createTime',
       render: (_, record) => {
         return record.createTime ? moment(record.createTime).format('YYYY-MM-DD HH:mm:ss') : '-';

+ 6 - 1
src/pages/system/Role/Detail/index.tsx

@@ -30,7 +30,12 @@ const RoleEdit = observer(() => {
   ];
 
   return (
-    <PageContainer onBack={history.goBack} tabList={list} onTabChange={setTab}>
+    <PageContainer
+      className={'page-title-show'}
+      onBack={history.goBack}
+      tabList={list}
+      onTabChange={setTab}
+    >
       {list.find((k) => k.key === tab)?.component}
     </PageContainer>
   );