yootd 0.2.51 → 0.2.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,20 +1,21 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["showSearch"];
3
+ var _excluded = ["deptId", "showSearch"];
4
4
  import { useQuery } from '@tanstack/react-query';
5
5
  import React, { useMemo } from 'react';
6
6
  import { Select } from "./..";
7
7
  import { useRequest } from "../hooks/useRequest";
8
8
  export var JobTitle = function JobTitle(_ref) {
9
- var _ref$showSearch = _ref.showSearch,
9
+ var deptId = _ref.deptId,
10
+ _ref$showSearch = _ref.showSearch,
10
11
  showSearch = _ref$showSearch === void 0 ? true : _ref$showSearch,
11
12
  rest = _objectWithoutProperties(_ref, _excluded);
12
13
  var request = useRequest();
13
14
  // 查询所有职务
14
15
  var _useQuery = useQuery({
15
- queryKey: ['jobTitleData'],
16
+ queryKey: ['jobTitleData', deptId],
16
17
  queryFn: function queryFn() {
17
- return request('/v1/titles/all');
18
+ return request(deptId != null ? "/v1/titles/all?dept_id=".concat(deptId) : '/v1/titles/all');
18
19
  }
19
20
  }),
20
21
  jobTitleData = _useQuery.data;
@@ -14,4 +14,6 @@ export interface IjobTitleItem {
14
14
  titleId: number;
15
15
  titleName: string;
16
16
  }
17
- export type JobTitleProps = SelectProps;
17
+ export type JobTitleProps = SelectProps & {
18
+ deptId?: number;
19
+ };
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- var _excluded = ["placeholder", "label", "connectors", "showSearch"];
4
+ var _excluded = ["placeholder", "label", "connectors", "showSearch", "deptId", "titleId"];
5
5
  import { useQuery } from '@tanstack/react-query';
6
6
  import React, { useMemo } from 'react';
7
7
  import { Select } from "./..";
@@ -10,18 +10,20 @@ export var Teacher = function Teacher(_ref) {
10
10
  var _ref$placeholder = _ref.placeholder,
11
11
  placeholder = _ref$placeholder === void 0 ? '请选择教师' : _ref$placeholder,
12
12
  _ref$label = _ref.label,
13
- label = _ref$label === void 0 ? ['personalName', 'genderName', 'uniqueNumber'] : _ref$label,
13
+ label = _ref$label === void 0 ? ['personalName', 'genderName', 'uniqueNumber', 'deptName', 'titleName'] : _ref$label,
14
14
  _ref$connectors = _ref.connectors,
15
15
  connectors = _ref$connectors === void 0 ? '~' : _ref$connectors,
16
16
  _ref$showSearch = _ref.showSearch,
17
17
  showSearch = _ref$showSearch === void 0 ? true : _ref$showSearch,
18
+ deptId = _ref.deptId,
19
+ titleId = _ref.titleId,
18
20
  rest = _objectWithoutProperties(_ref, _excluded);
19
21
  var request = useRequest();
20
22
  // 查询所有老师
21
23
  var _useQuery = useQuery({
22
- queryKey: ['teacherData'],
24
+ queryKey: ['teacherData', deptId, titleId],
23
25
  queryFn: function queryFn() {
24
- return request('/v1/users/teachers');
26
+ return request(deptId != null && titleId != null ? "/v1/users/teachers?dept_id=".concat(deptId, "&title_id=").concat(titleId) : '/v1/users/teachers');
25
27
  }
26
28
  }),
27
29
  teacherData = _useQuery.data;
@@ -19,6 +19,8 @@ export interface IteacherItem {
19
19
  nationName?: string; // 民族
20
20
  gender?: number; // 性别
21
21
  personalEmail?: string; // 邮箱
22
+ deptName?: string;
23
+ titleName?: string;
22
24
  }
23
25
  type LabelOptions =
24
26
  | 'personalName'
@@ -26,8 +28,12 @@ type LabelOptions =
26
28
  | 'personalMobile'
27
29
  | 'nationName'
28
30
  | 'genderName'
29
- | 'personalEmail';
31
+ | 'personalEmail'
32
+ | 'deptName'
33
+ | 'titleName';
30
34
  export type TeacherProps = SelectProps & {
31
35
  label?: LabelOptions[];
32
36
  connectors?: string;
37
+ deptId?: number;
38
+ titleId?: number;
33
39
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yootd",
3
- "version": "0.2.51",
3
+ "version": "0.2.53",
4
4
  "description": "基于 Antd 二次开发的组件库",
5
5
  "license": "MIT",
6
6
  "sideEffects": [