@cgboiler/biz-mobile 1.10.0 → 1.12.0

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.
package/es/index.d.ts CHANGED
@@ -6,7 +6,7 @@ declare namespace _default {
6
6
  }
7
7
  export default _default;
8
8
  export function install(app: any): void;
9
- export const version: "1.9.0";
9
+ export const version: "1.11.0";
10
10
  import OrgPicker from './org-picker';
11
11
  import ProjectSelect from './project-select';
12
12
  export { OrgPicker, ProjectSelect };
package/es/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import OrgPicker from "./org-picker";
2
2
  import ProjectSelect from "./project-select";
3
- const version = "1.9.0";
3
+ const version = "1.11.0";
4
4
  function install(app) {
5
5
  const components = [
6
6
  OrgPicker,
@@ -17,10 +17,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
17
17
  default: boolean;
18
18
  };
19
19
  'onUpdate:modelValue': {
20
- type: import("vue").PropType<(val: (string | number)[] | null) => void>;
20
+ type: FunctionConstructor;
21
21
  };
22
22
  'onUpdate:show': {
23
- type: import("vue").PropType<(val: boolean) => void>;
23
+ type: FunctionConstructor;
24
24
  };
25
25
  }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:show" | "update:modelValue")[], "update:show" | "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
26
26
  modelValue: {
@@ -40,10 +40,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
40
40
  default: boolean;
41
41
  };
42
42
  'onUpdate:modelValue': {
43
- type: import("vue").PropType<(val: (string | number)[] | null) => void>;
43
+ type: FunctionConstructor;
44
44
  };
45
45
  'onUpdate:show': {
46
- type: import("vue").PropType<(val: boolean) => void>;
46
+ type: FunctionConstructor;
47
47
  };
48
48
  }>> & Readonly<{
49
49
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
@@ -22,7 +22,7 @@ import { createVNode as _createVNode, createTextVNode as _createTextVNode } from
22
22
  import "./_atomic.css";
23
23
  import { defineComponent, ref, computed, watch, nextTick } from "vue";
24
24
  import { ActionSheet, Search, List, Image, Empty } from "vant";
25
- import DeptImg from "./components/deptImg";
25
+ import DeptImg from "./components/DeptImg";
26
26
  import { orgPickerProps } from "./types";
27
27
  import { useApi } from "./useApi";
28
28
  import "./index.css";
@@ -44,18 +44,16 @@ var stdin_default = defineComponent({
44
44
  getOrgList();
45
45
  const selectedItems = ref([]);
46
46
  watch(() => props.modelValue, (newValue) => {
47
+ var _a;
47
48
  if (!newValue) {
48
49
  selectedItems.value = [];
49
50
  return;
50
51
  }
51
- setTimeout(() => {
52
- var _a;
53
- if ((_a = userList.value) == null ? void 0 : _a.length) {
54
- selectedItems.value = newValue.map((id) => {
55
- return userList.value.find((item) => item.id === id);
56
- });
57
- }
58
- }, 500);
52
+ if ((_a = userList.value) == null ? void 0 : _a.length) {
53
+ selectedItems.value = newValue.map((id) => {
54
+ return userList.value.find((item) => item.id === id);
55
+ });
56
+ }
59
57
  }, {
60
58
  immediate: true
61
59
  });
@@ -65,13 +63,10 @@ var stdin_default = defineComponent({
65
63
  return;
66
64
  }
67
65
  if (props.multiple) {
68
- const currentValue = props.modelValue ? [...props.modelValue] : [];
69
- const index = currentValue.indexOf(item.id);
66
+ const index = selectedItems.value.findIndex((s) => s.id === item.id);
70
67
  if (index > -1) {
71
- currentValue.splice(index, 1);
72
- selectedItems.value = selectedItems.value.filter((selected) => selected.id !== item.id);
68
+ selectedItems.value.splice(index, 1);
73
69
  } else {
74
- currentValue.push(item.id);
75
70
  selectedItems.value.push(item);
76
71
  }
77
72
  } else {
@@ -89,12 +84,10 @@ var stdin_default = defineComponent({
89
84
  const finished = ref(true);
90
85
  const searchRef = ref();
91
86
  watch(() => props.show, (newVal) => __async(this, null, function* () {
87
+ var _a;
92
88
  if (newVal && props.autoFocus) {
93
89
  yield nextTick();
94
- setTimeout(() => {
95
- var _a;
96
- (_a = searchRef.value) == null ? void 0 : _a.focus();
97
- }, 300);
90
+ (_a = searchRef.value) == null ? void 0 : _a.focus();
98
91
  }
99
92
  }));
100
93
  watch(keyword, (newKeyword) => {
@@ -113,9 +106,7 @@ var stdin_default = defineComponent({
113
106
  return [...personnel, ...departments];
114
107
  });
115
108
  const isSelected = (item) => {
116
- if (!props.modelValue)
117
- return false;
118
- return props.modelValue.includes(item.id);
109
+ return selectedItems.value.some((s) => s.id === item.id);
119
110
  };
120
111
  const onLoad = () => {
121
112
  finished.value = true;
@@ -148,8 +139,8 @@ var stdin_default = defineComponent({
148
139
  "class": "separator"
149
140
  }, [_createTextVNode(" / ")])]))]), _createVNode("div", {
150
141
  "class": "feed-list-wrap"
151
- }, [!keyword.value && filteredOrgList.value.filter((item) => item.type !== "dept").length === 0 ? _createVNode(Empty, {
152
- "description": "\u8BE5\u90E8\u95E8\u4E0B\u6CA1\u6709\u4EBA\u5458"
142
+ }, [filteredOrgList.value.length === 0 ? _createVNode(Empty, {
143
+ "description": keyword.value ? "\u672A\u627E\u5230\u76F8\u5173\u4EBA\u5458" : "\u8BE5\u90E8\u95E8\u4E0B\u6CA1\u6709\u4EBA\u5458"
153
144
  }, null) : _createVNode(List, {
154
145
  "loading": loading.value,
155
146
  "finished": finished.value,
@@ -158,7 +149,7 @@ var stdin_default = defineComponent({
158
149
  default: () => [filteredOrgList.value.map((item) => _createVNode("div", {
159
150
  "class": ["org-item", isSelected(item) ? "selected" : ""],
160
151
  "onClick": () => handleSelect(item)
161
- }, [item.type === "dept" ? _createVNode("div", {
152
+ }, [item.type === "dept" && !keyword.value ? _createVNode("div", {
162
153
  "class": "org-avatar"
163
154
  }, [_createVNode(DeptImg, null, null)]) : _createVNode(Image, {
164
155
  "class": "org-avatar",
@@ -166,24 +157,7 @@ var stdin_default = defineComponent({
166
157
  }, null), _createVNode("div", {
167
158
  "class": "org-name"
168
159
  }, [item.name])]))]
169
- }), keyword.value && _createVNode(List, {
170
- "loading": loading.value,
171
- "finished": finished.value,
172
- "onLoad": onLoad,
173
- "class": "search-result-list"
174
- }, {
175
- default: () => [filteredOrgList.value.filter((item) => item.type !== "dept").map((item) => _createVNode("div", {
176
- "class": ["org-item", isSelected(item) ? "selected" : ""],
177
- "onClick": () => handleSelect(item)
178
- }, [_createVNode(Image, {
179
- "class": "org-avatar",
180
- "src": item.avatar
181
- }, null), _createVNode("div", {
182
- "class": "org-name"
183
- }, [item.name])]))]
184
- }), keyword.value && filteredOrgList.value.filter((item) => item.type !== "dept").length === 0 && _createVNode("div", {
185
- "class": "empty-search-result"
186
- }, [_createTextVNode("\u672A\u627E\u5230\u76F8\u5173\u4EBA\u5458")])]), props.multiple && _createVNode("div", {
160
+ })]), props.multiple && _createVNode("div", {
187
161
  "class": "bottom-section"
188
162
  }, [selectedItems.value.length > 0 && _createVNode("div", {
189
163
  "class": "selected-items"
@@ -1 +1 @@
1
- :root:root{--van-action-sheet-max-height: 100%}.org-list{height:85vh;display:flex;flex-direction:column}.org-list .breadcrumb-nav{margin-bottom:4px;padding:2px 16px;border-radius:4px;font-size:12px}.org-list .breadcrumb-nav .dept-name.current-dept{color:#969799}.org-list .breadcrumb-nav .separator{color:#969799;margin:0 4px}.org-list .search-bar{position:-webkit-sticky;position:-webkit-sticky;position:sticky;top:0;z-index:1}.org-list .bottom-section{border-top:1px solid #eee;background-color:#fff}.org-list .bottom-section .selected-items{display:flex;flex-wrap:nowrap;padding:12px 16px;gap:12px;background-color:#fff;overflow-x:auto}.org-list .bottom-section .selected-items .selected-tag{flex-shrink:0;background:none;border:none;padding:0;margin:0}.org-list .bottom-section .selected-items .selected-tag .tag-avatar{width:36px;height:36px}.org-list .bottom-section .selected-items .selected-tag .tag-avatar img{border-radius:4px;border:1px solid #eee;object-fit:contain}.org-list .van-list{flex:1;overflow-y:auto;padding:0 16px}.org-list .feed-list-wrap{flex:1;display:flex;overflow:hidden;position:relative;justify-content:center}.org-list .search-result-list{position:absolute;top:0;left:0;right:0;bottom:0;z-index:1;background-color:#fff;overflow-y:auto;padding:0 16px}.org-list .org-item{padding:12px 0;border-bottom:1px solid #eee;cursor:pointer;display:flex;align-items:center;gap:12px}.org-list .org-item.selected{color:var(--van-primary-color)}.org-list .org-item .org-avatar{flex-shrink:0;width:40px;height:40px;display:flex;align-items:center;justify-content:center}.org-list .org-item .org-avatar img{border-radius:4px;border:1px solid #eee;object-fit:contain}.org-list .org-item .org-name{font-size:14px;flex:1}.org-list .org-item:last-child{border-bottom:none}.org-list .action-buttons{padding:16px;display:flex;justify-content:center;border-top:1px solid #eee}.org-list .action-buttons .confirm-button{background-color:var(--van-primary-color);color:#fff;padding:10px 0;border-radius:4px;text-align:center;width:100%;font-size:14px}
1
+ :root:root{--van-action-sheet-max-height: 100%}.org-list{height:85vh;display:flex;flex-direction:column}.org-list .breadcrumb-nav{margin-bottom:4px;padding:2px 16px;border-radius:4px;font-size:12px}.org-list .breadcrumb-nav .dept-name.current-dept{color:#969799}.org-list .breadcrumb-nav .separator{color:#969799;margin:0 4px}.org-list .search-bar{position:-webkit-sticky;position:-webkit-sticky;position:sticky;top:0;z-index:1}.org-list .bottom-section{border-top:1px solid #eee;background-color:#fff}.org-list .bottom-section .selected-items{display:flex;flex-wrap:nowrap;padding:12px 16px;gap:12px;background-color:#fff;overflow-x:auto;height:63px}.org-list .bottom-section .selected-items .selected-tag{flex-shrink:0;background:none;border:none;padding:0;margin:0}.org-list .bottom-section .selected-items .selected-tag .tag-avatar{width:36px;height:36px}.org-list .bottom-section .selected-items .selected-tag .tag-avatar img{border-radius:4px;border:1px solid #eee;object-fit:contain}.org-list .van-list{flex:1;overflow-y:auto;padding:0 16px}.org-list .feed-list-wrap{flex:1;display:flex;overflow:hidden;position:relative;justify-content:center}.org-list .search-result-list{position:absolute;top:0;left:0;right:0;bottom:0;z-index:1;background-color:#fff;overflow-y:auto;padding:0 16px}.org-list .org-item{padding:12px 0;border-bottom:1px solid #eee;cursor:pointer;display:flex;align-items:center;gap:12px}.org-list .org-item.selected{color:var(--van-primary-color)}.org-list .org-item .org-avatar{flex-shrink:0;width:40px;height:40px;display:flex;align-items:center;justify-content:center}.org-list .org-item .org-avatar img{border-radius:4px;border:1px solid #eee;object-fit:contain}.org-list .org-item .org-name{font-size:14px;flex:1}.org-list .org-item:last-child{border-bottom:none}.org-list .action-buttons{padding:16px;display:flex;justify-content:center;border-top:1px solid #eee}.org-list .action-buttons .confirm-button{background-color:var(--van-primary-color);color:#fff;padding:10px 0;border-radius:4px;text-align:center;width:100%;font-size:14px}
@@ -41,6 +41,7 @@
41
41
  gap: 12px;
42
42
  background-color: #fff;
43
43
  overflow-x: auto;
44
+ height: 63px;
44
45
 
45
46
  .selected-tag {
46
47
  flex-shrink: 0;
@@ -4,6 +4,7 @@ export interface OrgItem {
4
4
  name: string;
5
5
  type: string;
6
6
  avatar?: string;
7
+ [x: string]: any;
7
8
  }
8
9
  export declare const orgPickerProps: {
9
10
  modelValue: {
@@ -23,10 +24,10 @@ export declare const orgPickerProps: {
23
24
  default: boolean;
24
25
  };
25
26
  'onUpdate:modelValue': {
26
- type: PropType<(val: (string | number)[] | null) => void>;
27
+ type: FunctionConstructor;
27
28
  };
28
29
  'onUpdate:show': {
29
- type: PropType<(val: boolean) => void>;
30
+ type: FunctionConstructor;
30
31
  };
31
32
  };
32
33
  export type OrgPickerProps = ExtractPropTypes<typeof orgPickerProps>;
@@ -1,12 +1,26 @@
1
1
  import { type OrgItem } from './types';
2
2
  export declare const useApi: () => {
3
- userList: import("vue").Ref<never[], never[]>;
3
+ userList: import("vue").Ref<{
4
+ [x: string]: any;
5
+ id: string | number;
6
+ name: string;
7
+ type: string;
8
+ avatar?: string | undefined;
9
+ }[], OrgItem[] | {
10
+ [x: string]: any;
11
+ id: string | number;
12
+ name: string;
13
+ type: string;
14
+ avatar?: string | undefined;
15
+ }[]>;
4
16
  orgList: import("vue").Ref<{
17
+ [x: string]: any;
5
18
  id: string | number;
6
19
  name: string;
7
20
  type: string;
8
21
  avatar?: string | undefined;
9
22
  }[], OrgItem[] | {
23
+ [x: string]: any;
10
24
  id: string | number;
11
25
  name: string;
12
26
  type: string;
@@ -19,30 +19,30 @@ var __async = (__this, __arguments, generator) => {
19
19
  });
20
20
  };
21
21
  import { ref } from "vue";
22
- import { useFetch } from "@cgboiler/core";
22
+ import { useFetch, getUserList } from "@cgboiler/core";
23
23
  import { debounce } from "lodash-es";
24
24
  const orgListCache = /* @__PURE__ */ new Map();
25
- const fetchOrgList = (deptId) => __async(void 0, null, function* () {
26
- if (orgListCache.has(deptId || "")) {
27
- return orgListCache.get(deptId || "");
25
+ const fetchData = (url, cacheKey) => __async(void 0, null, function* () {
26
+ if (cacheKey && orgListCache.has(cacheKey)) {
27
+ return orgListCache.get(cacheKey);
28
+ }
29
+ const res = (yield useFetch(url, { method: "GET" })) || [];
30
+ if (cacheKey) {
31
+ orgListCache.set(cacheKey, res);
28
32
  }
29
- const res = (yield useFetch(
30
- `https://wflow.cgboiler.com/v1/oa/org/tree/cloud?deptId=${deptId}&type=user`,
31
- {
32
- method: "GET"
33
- }
34
- )) || [];
35
- orgListCache.set(deptId || "", res);
36
33
  return res;
37
34
  });
38
- const userList = ref([]);
39
- const fetchUserList = () => __async(void 0, null, function* () {
40
- const res = (yield useFetch(`https://wflow.cgboiler.com/v1/oa/org/alluserbycompanyid`, {
41
- method: "GET"
42
- })) || [];
43
- userList.value = res;
35
+ const fetchOrgList = (deptId) => __async(void 0, null, function* () {
36
+ const url = `https://wflow.cgboiler.com/v1/oa/org/tree/cloud?deptId=${deptId}&type=user`;
37
+ return fetchData(url, deptId || "");
44
38
  });
45
- fetchUserList();
39
+ const userList = ref([]);
40
+ function initUserList() {
41
+ return __async(this, null, function* () {
42
+ userList.value = yield getUserList();
43
+ });
44
+ }
45
+ initUserList();
46
46
  const useApi = () => {
47
47
  const orgList = ref([]);
48
48
  const currentDeptId = ref("1");
@@ -68,13 +68,8 @@ const useApi = () => {
68
68
  orgList.value = [];
69
69
  return;
70
70
  }
71
- const res = yield useFetch(
72
- `https://wflow.cgboiler.com/v1/oa/org/tree/user/search/cloud?userName=${userName}`,
73
- {
74
- method: "GET"
75
- }
76
- );
77
- orgList.value = res || [];
71
+ const url = `https://wflow.cgboiler.com/v1/oa/org/tree/user/search/cloud?userName=${userName}`;
72
+ orgList.value = yield fetchData(url);
78
73
  }), 300);
79
74
  return {
80
75
  userList,
package/lib/index.d.ts CHANGED
@@ -6,7 +6,7 @@ declare namespace _default {
6
6
  }
7
7
  export default _default;
8
8
  export function install(app: any): void;
9
- export const version: "1.9.0";
9
+ export const version: "1.11.0";
10
10
  import OrgPicker from './org-picker';
11
11
  import ProjectSelect from './project-select';
12
12
  export { OrgPicker, ProjectSelect };
package/lib/index.js CHANGED
@@ -39,7 +39,7 @@ var import_org_picker = __toESM(require("./org-picker"));
39
39
  var import_project_select = __toESM(require("./project-select"));
40
40
  __reExport(stdin_exports, require("./org-picker"), module.exports);
41
41
  __reExport(stdin_exports, require("./project-select"), module.exports);
42
- const version = "1.9.0";
42
+ const version = "1.11.0";
43
43
  function install(app) {
44
44
  const components = [
45
45
  import_org_picker.default,
@@ -17,10 +17,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
17
17
  default: boolean;
18
18
  };
19
19
  'onUpdate:modelValue': {
20
- type: import("vue").PropType<(val: (string | number)[] | null) => void>;
20
+ type: FunctionConstructor;
21
21
  };
22
22
  'onUpdate:show': {
23
- type: import("vue").PropType<(val: boolean) => void>;
23
+ type: FunctionConstructor;
24
24
  };
25
25
  }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:show" | "update:modelValue")[], "update:show" | "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
26
26
  modelValue: {
@@ -40,10 +40,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
40
40
  default: boolean;
41
41
  };
42
42
  'onUpdate:modelValue': {
43
- type: import("vue").PropType<(val: (string | number)[] | null) => void>;
43
+ type: FunctionConstructor;
44
44
  };
45
45
  'onUpdate:show': {
46
- type: import("vue").PropType<(val: boolean) => void>;
46
+ type: FunctionConstructor;
47
47
  };
48
48
  }>> & Readonly<{
49
49
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
@@ -54,7 +54,7 @@ var import_vue = require("vue");
54
54
  var import_atomic = require("./_atomic.css");
55
55
  var import_vue2 = require("vue");
56
56
  var import_vant = require("vant");
57
- var import_deptImg = __toESM(require("./components/deptImg"));
57
+ var import_DeptImg = __toESM(require("./components/DeptImg"));
58
58
  var import_types = require("./types");
59
59
  var import_useApi = require("./useApi");
60
60
  var import_index = require("./index.css");
@@ -76,18 +76,16 @@ var stdin_default = (0, import_vue2.defineComponent)({
76
76
  getOrgList();
77
77
  const selectedItems = (0, import_vue2.ref)([]);
78
78
  (0, import_vue2.watch)(() => props.modelValue, (newValue) => {
79
+ var _a;
79
80
  if (!newValue) {
80
81
  selectedItems.value = [];
81
82
  return;
82
83
  }
83
- setTimeout(() => {
84
- var _a;
85
- if ((_a = userList.value) == null ? void 0 : _a.length) {
86
- selectedItems.value = newValue.map((id) => {
87
- return userList.value.find((item) => item.id === id);
88
- });
89
- }
90
- }, 500);
84
+ if ((_a = userList.value) == null ? void 0 : _a.length) {
85
+ selectedItems.value = newValue.map((id) => {
86
+ return userList.value.find((item) => item.id === id);
87
+ });
88
+ }
91
89
  }, {
92
90
  immediate: true
93
91
  });
@@ -97,13 +95,10 @@ var stdin_default = (0, import_vue2.defineComponent)({
97
95
  return;
98
96
  }
99
97
  if (props.multiple) {
100
- const currentValue = props.modelValue ? [...props.modelValue] : [];
101
- const index = currentValue.indexOf(item.id);
98
+ const index = selectedItems.value.findIndex((s) => s.id === item.id);
102
99
  if (index > -1) {
103
- currentValue.splice(index, 1);
104
- selectedItems.value = selectedItems.value.filter((selected) => selected.id !== item.id);
100
+ selectedItems.value.splice(index, 1);
105
101
  } else {
106
- currentValue.push(item.id);
107
102
  selectedItems.value.push(item);
108
103
  }
109
104
  } else {
@@ -121,12 +116,10 @@ var stdin_default = (0, import_vue2.defineComponent)({
121
116
  const finished = (0, import_vue2.ref)(true);
122
117
  const searchRef = (0, import_vue2.ref)();
123
118
  (0, import_vue2.watch)(() => props.show, (newVal) => __async(this, null, function* () {
119
+ var _a;
124
120
  if (newVal && props.autoFocus) {
125
121
  yield (0, import_vue2.nextTick)();
126
- setTimeout(() => {
127
- var _a;
128
- (_a = searchRef.value) == null ? void 0 : _a.focus();
129
- }, 300);
122
+ (_a = searchRef.value) == null ? void 0 : _a.focus();
130
123
  }
131
124
  }));
132
125
  (0, import_vue2.watch)(keyword, (newKeyword) => {
@@ -145,9 +138,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
145
138
  return [...personnel, ...departments];
146
139
  });
147
140
  const isSelected = (item) => {
148
- if (!props.modelValue)
149
- return false;
150
- return props.modelValue.includes(item.id);
141
+ return selectedItems.value.some((s) => s.id === item.id);
151
142
  };
152
143
  const onLoad = () => {
153
144
  finished.value = true;
@@ -180,8 +171,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
180
171
  "class": "separator"
181
172
  }, [(0, import_vue.createTextVNode)(" / ")])]))]), (0, import_vue.createVNode)("div", {
182
173
  "class": "feed-list-wrap"
183
- }, [!keyword.value && filteredOrgList.value.filter((item) => item.type !== "dept").length === 0 ? (0, import_vue.createVNode)(import_vant.Empty, {
184
- "description": "\u8BE5\u90E8\u95E8\u4E0B\u6CA1\u6709\u4EBA\u5458"
174
+ }, [filteredOrgList.value.length === 0 ? (0, import_vue.createVNode)(import_vant.Empty, {
175
+ "description": keyword.value ? "\u672A\u627E\u5230\u76F8\u5173\u4EBA\u5458" : "\u8BE5\u90E8\u95E8\u4E0B\u6CA1\u6709\u4EBA\u5458"
185
176
  }, null) : (0, import_vue.createVNode)(import_vant.List, {
186
177
  "loading": loading.value,
187
178
  "finished": finished.value,
@@ -190,32 +181,15 @@ var stdin_default = (0, import_vue2.defineComponent)({
190
181
  default: () => [filteredOrgList.value.map((item) => (0, import_vue.createVNode)("div", {
191
182
  "class": ["org-item", isSelected(item) ? "selected" : ""],
192
183
  "onClick": () => handleSelect(item)
193
- }, [item.type === "dept" ? (0, import_vue.createVNode)("div", {
184
+ }, [item.type === "dept" && !keyword.value ? (0, import_vue.createVNode)("div", {
194
185
  "class": "org-avatar"
195
- }, [(0, import_vue.createVNode)(import_deptImg.default, null, null)]) : (0, import_vue.createVNode)(import_vant.Image, {
196
- "class": "org-avatar",
197
- "src": item.avatar
198
- }, null), (0, import_vue.createVNode)("div", {
199
- "class": "org-name"
200
- }, [item.name])]))]
201
- }), keyword.value && (0, import_vue.createVNode)(import_vant.List, {
202
- "loading": loading.value,
203
- "finished": finished.value,
204
- "onLoad": onLoad,
205
- "class": "search-result-list"
206
- }, {
207
- default: () => [filteredOrgList.value.filter((item) => item.type !== "dept").map((item) => (0, import_vue.createVNode)("div", {
208
- "class": ["org-item", isSelected(item) ? "selected" : ""],
209
- "onClick": () => handleSelect(item)
210
- }, [(0, import_vue.createVNode)(import_vant.Image, {
186
+ }, [(0, import_vue.createVNode)(import_DeptImg.default, null, null)]) : (0, import_vue.createVNode)(import_vant.Image, {
211
187
  "class": "org-avatar",
212
188
  "src": item.avatar
213
189
  }, null), (0, import_vue.createVNode)("div", {
214
190
  "class": "org-name"
215
191
  }, [item.name])]))]
216
- }), keyword.value && filteredOrgList.value.filter((item) => item.type !== "dept").length === 0 && (0, import_vue.createVNode)("div", {
217
- "class": "empty-search-result"
218
- }, [(0, import_vue.createTextVNode)("\u672A\u627E\u5230\u76F8\u5173\u4EBA\u5458")])]), props.multiple && (0, import_vue.createVNode)("div", {
192
+ })]), props.multiple && (0, import_vue.createVNode)("div", {
219
193
  "class": "bottom-section"
220
194
  }, [selectedItems.value.length > 0 && (0, import_vue.createVNode)("div", {
221
195
  "class": "selected-items"
@@ -1 +1 @@
1
- :root:root{--van-action-sheet-max-height: 100%}.org-list{height:85vh;display:flex;flex-direction:column}.org-list .breadcrumb-nav{margin-bottom:4px;padding:2px 16px;border-radius:4px;font-size:12px}.org-list .breadcrumb-nav .dept-name.current-dept{color:#969799}.org-list .breadcrumb-nav .separator{color:#969799;margin:0 4px}.org-list .search-bar{position:-webkit-sticky;position:-webkit-sticky;position:sticky;top:0;z-index:1}.org-list .bottom-section{border-top:1px solid #eee;background-color:#fff}.org-list .bottom-section .selected-items{display:flex;flex-wrap:nowrap;padding:12px 16px;gap:12px;background-color:#fff;overflow-x:auto}.org-list .bottom-section .selected-items .selected-tag{flex-shrink:0;background:none;border:none;padding:0;margin:0}.org-list .bottom-section .selected-items .selected-tag .tag-avatar{width:36px;height:36px}.org-list .bottom-section .selected-items .selected-tag .tag-avatar img{border-radius:4px;border:1px solid #eee;object-fit:contain}.org-list .van-list{flex:1;overflow-y:auto;padding:0 16px}.org-list .feed-list-wrap{flex:1;display:flex;overflow:hidden;position:relative;justify-content:center}.org-list .search-result-list{position:absolute;top:0;left:0;right:0;bottom:0;z-index:1;background-color:#fff;overflow-y:auto;padding:0 16px}.org-list .org-item{padding:12px 0;border-bottom:1px solid #eee;cursor:pointer;display:flex;align-items:center;gap:12px}.org-list .org-item.selected{color:var(--van-primary-color)}.org-list .org-item .org-avatar{flex-shrink:0;width:40px;height:40px;display:flex;align-items:center;justify-content:center}.org-list .org-item .org-avatar img{border-radius:4px;border:1px solid #eee;object-fit:contain}.org-list .org-item .org-name{font-size:14px;flex:1}.org-list .org-item:last-child{border-bottom:none}.org-list .action-buttons{padding:16px;display:flex;justify-content:center;border-top:1px solid #eee}.org-list .action-buttons .confirm-button{background-color:var(--van-primary-color);color:#fff;padding:10px 0;border-radius:4px;text-align:center;width:100%;font-size:14px}
1
+ :root:root{--van-action-sheet-max-height: 100%}.org-list{height:85vh;display:flex;flex-direction:column}.org-list .breadcrumb-nav{margin-bottom:4px;padding:2px 16px;border-radius:4px;font-size:12px}.org-list .breadcrumb-nav .dept-name.current-dept{color:#969799}.org-list .breadcrumb-nav .separator{color:#969799;margin:0 4px}.org-list .search-bar{position:-webkit-sticky;position:-webkit-sticky;position:sticky;top:0;z-index:1}.org-list .bottom-section{border-top:1px solid #eee;background-color:#fff}.org-list .bottom-section .selected-items{display:flex;flex-wrap:nowrap;padding:12px 16px;gap:12px;background-color:#fff;overflow-x:auto;height:63px}.org-list .bottom-section .selected-items .selected-tag{flex-shrink:0;background:none;border:none;padding:0;margin:0}.org-list .bottom-section .selected-items .selected-tag .tag-avatar{width:36px;height:36px}.org-list .bottom-section .selected-items .selected-tag .tag-avatar img{border-radius:4px;border:1px solid #eee;object-fit:contain}.org-list .van-list{flex:1;overflow-y:auto;padding:0 16px}.org-list .feed-list-wrap{flex:1;display:flex;overflow:hidden;position:relative;justify-content:center}.org-list .search-result-list{position:absolute;top:0;left:0;right:0;bottom:0;z-index:1;background-color:#fff;overflow-y:auto;padding:0 16px}.org-list .org-item{padding:12px 0;border-bottom:1px solid #eee;cursor:pointer;display:flex;align-items:center;gap:12px}.org-list .org-item.selected{color:var(--van-primary-color)}.org-list .org-item .org-avatar{flex-shrink:0;width:40px;height:40px;display:flex;align-items:center;justify-content:center}.org-list .org-item .org-avatar img{border-radius:4px;border:1px solid #eee;object-fit:contain}.org-list .org-item .org-name{font-size:14px;flex:1}.org-list .org-item:last-child{border-bottom:none}.org-list .action-buttons{padding:16px;display:flex;justify-content:center;border-top:1px solid #eee}.org-list .action-buttons .confirm-button{background-color:var(--van-primary-color);color:#fff;padding:10px 0;border-radius:4px;text-align:center;width:100%;font-size:14px}
@@ -41,6 +41,7 @@
41
41
  gap: 12px;
42
42
  background-color: #fff;
43
43
  overflow-x: auto;
44
+ height: 63px;
44
45
 
45
46
  .selected-tag {
46
47
  flex-shrink: 0;
@@ -4,6 +4,7 @@ export interface OrgItem {
4
4
  name: string;
5
5
  type: string;
6
6
  avatar?: string;
7
+ [x: string]: any;
7
8
  }
8
9
  export declare const orgPickerProps: {
9
10
  modelValue: {
@@ -23,10 +24,10 @@ export declare const orgPickerProps: {
23
24
  default: boolean;
24
25
  };
25
26
  'onUpdate:modelValue': {
26
- type: PropType<(val: (string | number)[] | null) => void>;
27
+ type: FunctionConstructor;
27
28
  };
28
29
  'onUpdate:show': {
29
- type: PropType<(val: boolean) => void>;
30
+ type: FunctionConstructor;
30
31
  };
31
32
  };
32
33
  export type OrgPickerProps = ExtractPropTypes<typeof orgPickerProps>;
@@ -1,12 +1,26 @@
1
1
  import { type OrgItem } from './types';
2
2
  export declare const useApi: () => {
3
- userList: import("vue").Ref<never[], never[]>;
3
+ userList: import("vue").Ref<{
4
+ [x: string]: any;
5
+ id: string | number;
6
+ name: string;
7
+ type: string;
8
+ avatar?: string | undefined;
9
+ }[], OrgItem[] | {
10
+ [x: string]: any;
11
+ id: string | number;
12
+ name: string;
13
+ type: string;
14
+ avatar?: string | undefined;
15
+ }[]>;
4
16
  orgList: import("vue").Ref<{
17
+ [x: string]: any;
5
18
  id: string | number;
6
19
  name: string;
7
20
  type: string;
8
21
  avatar?: string | undefined;
9
22
  }[], OrgItem[] | {
23
+ [x: string]: any;
10
24
  id: string | number;
11
25
  name: string;
12
26
  type: string;
@@ -44,27 +44,27 @@ var import_vue = require("vue");
44
44
  var import_core = require("@cgboiler/core");
45
45
  var import_lodash_es = require("lodash-es");
46
46
  const orgListCache = /* @__PURE__ */ new Map();
47
- const fetchOrgList = (deptId) => __async(void 0, null, function* () {
48
- if (orgListCache.has(deptId || "")) {
49
- return orgListCache.get(deptId || "");
47
+ const fetchData = (url, cacheKey) => __async(void 0, null, function* () {
48
+ if (cacheKey && orgListCache.has(cacheKey)) {
49
+ return orgListCache.get(cacheKey);
50
+ }
51
+ const res = (yield (0, import_core.useFetch)(url, { method: "GET" })) || [];
52
+ if (cacheKey) {
53
+ orgListCache.set(cacheKey, res);
50
54
  }
51
- const res = (yield (0, import_core.useFetch)(
52
- `https://wflow.cgboiler.com/v1/oa/org/tree/cloud?deptId=${deptId}&type=user`,
53
- {
54
- method: "GET"
55
- }
56
- )) || [];
57
- orgListCache.set(deptId || "", res);
58
55
  return res;
59
56
  });
60
- const userList = (0, import_vue.ref)([]);
61
- const fetchUserList = () => __async(void 0, null, function* () {
62
- const res = (yield (0, import_core.useFetch)(`https://wflow.cgboiler.com/v1/oa/org/alluserbycompanyid`, {
63
- method: "GET"
64
- })) || [];
65
- userList.value = res;
57
+ const fetchOrgList = (deptId) => __async(void 0, null, function* () {
58
+ const url = `https://wflow.cgboiler.com/v1/oa/org/tree/cloud?deptId=${deptId}&type=user`;
59
+ return fetchData(url, deptId || "");
66
60
  });
67
- fetchUserList();
61
+ const userList = (0, import_vue.ref)([]);
62
+ function initUserList() {
63
+ return __async(this, null, function* () {
64
+ userList.value = yield (0, import_core.getUserList)();
65
+ });
66
+ }
67
+ initUserList();
68
68
  const useApi = () => {
69
69
  const orgList = (0, import_vue.ref)([]);
70
70
  const currentDeptId = (0, import_vue.ref)("1");
@@ -90,13 +90,8 @@ const useApi = () => {
90
90
  orgList.value = [];
91
91
  return;
92
92
  }
93
- const res = yield (0, import_core.useFetch)(
94
- `https://wflow.cgboiler.com/v1/oa/org/tree/user/search/cloud?userName=${userName}`,
95
- {
96
- method: "GET"
97
- }
98
- );
99
- orgList.value = res || [];
93
+ const url = `https://wflow.cgboiler.com/v1/oa/org/tree/user/search/cloud?userName=${userName}`;
94
+ orgList.value = yield fetchData(url);
100
95
  }), 300);
101
96
  return {
102
97
  userList,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cgboiler/biz-mobile",
3
- "version": "1.10.0",
3
+ "version": "1.12.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -44,7 +44,7 @@
44
44
  "dependencies": {
45
45
  "lodash-es": "^4.17.21",
46
46
  "vant": "^4.9.19",
47
- "@cgboiler/core": "1.1.0"
47
+ "@cgboiler/core": "1.2.0"
48
48
  },
49
49
  "scripts": {
50
50
  "dev": "cg-cli dev",