@cgboiler/biz-mobile 1.3.0 → 1.5.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.2.0";
9
+ export const version: "1.4.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.2.0";
3
+ const version = "1.4.0";
4
4
  function install(app) {
5
5
  const components = [
6
6
  OrgPicker,
@@ -1,7 +1,8 @@
1
1
  import { createVNode as _createVNode, createTextVNode as _createTextVNode } from "vue";
2
2
  import "./_atomic.css";
3
- import { defineComponent, ref, computed } from "vue";
4
- import { ActionSheet, Search, List, Image } from "vant";
3
+ import { defineComponent, ref, computed, watch } from "vue";
4
+ import { ActionSheet, Search, List, Image, Empty } from "vant";
5
+ import DeptImg from "./components/deptImg";
5
6
  import { orgPickerProps } from "./types";
6
7
  import { useApi } from "./useApi";
7
8
  import "./index.css";
@@ -14,10 +15,17 @@ var stdin_default = defineComponent({
14
15
  }) {
15
16
  const {
16
17
  orgList,
17
- getOrgList
18
+ getOrgList,
19
+ currentDeptId,
20
+ deptPath,
21
+ searchOrgList
18
22
  } = useApi();
19
23
  getOrgList();
20
24
  const handleSelect = (item) => {
25
+ if (item.type === "dept") {
26
+ getOrgList(item.id);
27
+ return;
28
+ }
21
29
  if (props.multiple) {
22
30
  const currentValue = props.modelValue ? [...Array.isArray(props.modelValue) ? props.modelValue : [props.modelValue]] : [];
23
31
  const index = currentValue.findIndex((selected) => selected.id === item.id);
@@ -38,10 +46,20 @@ var stdin_default = defineComponent({
38
46
  const keyword = ref("");
39
47
  const loading = ref(false);
40
48
  const finished = ref(true);
49
+ watch(keyword, (newKeyword) => {
50
+ if (newKeyword) {
51
+ searchOrgList(newKeyword);
52
+ } else {
53
+ getOrgList(currentDeptId.value);
54
+ }
55
+ });
41
56
  const filteredOrgList = computed(() => {
42
- return orgList.value.filter((item) => {
43
- return item.name.toLowerCase().includes(keyword.value.toLowerCase());
44
- }).slice(0, 300);
57
+ if (keyword.value) {
58
+ return orgList.value;
59
+ }
60
+ const departments = orgList.value.filter((item) => item.type === "dept");
61
+ const personnel = orgList.value.filter((item) => item.type !== "dept");
62
+ return [...personnel, ...departments];
45
63
  });
46
64
  const isSelected = (item) => {
47
65
  var _a;
@@ -70,7 +88,23 @@ var stdin_default = defineComponent({
70
88
  "onUpdate:modelValue": ($event) => keyword.value = $event,
71
89
  "placeholder": "\u641C\u7D22\u4EBA\u5458",
72
90
  "class": "search-bar"
73
- }, null), _createVNode(List, {
91
+ }, null), !keyword.value && _createVNode("div", {
92
+ "class": "breadcrumb-nav"
93
+ }, [deptPath.value.map((dept, index) => _createVNode("span", {
94
+ "key": dept.id
95
+ }, [_createVNode("span", {
96
+ "class": ["dept-name", index === deptPath.value.length - 1 ? "current-dept" : ""],
97
+ "onClick": () => handleSelect({
98
+ id: dept.id,
99
+ type: "dept"
100
+ })
101
+ }, [dept.name]), index < deptPath.value.length - 1 && _createVNode("span", {
102
+ "class": "separator"
103
+ }, [_createTextVNode(" / ")])]))]), _createVNode("div", {
104
+ "class": "feed-list-wrap"
105
+ }, [!keyword.value && filteredOrgList.value.filter((item) => item.type !== "dept").length === 0 ? _createVNode(Empty, {
106
+ "description": "\u8BE5\u90E8\u95E8\u4E0B\u6CA1\u6709\u4EBA\u5458"
107
+ }, null) : _createVNode(List, {
74
108
  "loading": loading.value,
75
109
  "finished": finished.value,
76
110
  "onLoad": onLoad
@@ -78,15 +112,32 @@ var stdin_default = defineComponent({
78
112
  default: () => [filteredOrgList.value.map((item) => _createVNode("div", {
79
113
  "class": ["org-item", isSelected(item) ? "selected" : ""],
80
114
  "onClick": () => handleSelect(item)
115
+ }, [item.type === "dept" ? _createVNode("div", {
116
+ "class": "org-avatar"
117
+ }, [_createVNode(DeptImg, null, null)]) : _createVNode(Image, {
118
+ "class": "org-avatar",
119
+ "src": item.avatar
120
+ }, null), _createVNode("div", {
121
+ "class": "org-name"
122
+ }, [item.name])]))]
123
+ }), keyword.value && _createVNode(List, {
124
+ "loading": loading.value,
125
+ "finished": finished.value,
126
+ "onLoad": onLoad,
127
+ "class": "search-result-list"
128
+ }, {
129
+ default: () => [filteredOrgList.value.filter((item) => item.type !== "dept").map((item) => _createVNode("div", {
130
+ "class": ["org-item", isSelected(item) ? "selected" : ""],
131
+ "onClick": () => handleSelect(item)
81
132
  }, [_createVNode(Image, {
82
133
  "class": "org-avatar",
83
- "width": "40",
84
- "height": "40",
85
134
  "src": item.avatar
86
135
  }, null), _createVNode("div", {
87
136
  "class": "org-name"
88
137
  }, [item.name])]))]
89
- }), props.multiple && _createVNode("div", {
138
+ }), keyword.value && filteredOrgList.value.filter((item) => item.type !== "dept").length === 0 && _createVNode("div", {
139
+ "class": "empty-search-result"
140
+ }, [_createTextVNode("\u672A\u627E\u5230\u76F8\u5173\u4EBA\u5458")])]), props.multiple && _createVNode("div", {
90
141
  "class": "bottom-section"
91
142
  }, [Array.isArray(props.modelValue) && props.modelValue.length > 0 && _createVNode("div", {
92
143
  "class": "selected-items"
@@ -0,0 +1,32 @@
1
+
2
+ .cgx-atm .flex {
3
+ align-items: initial;
4
+ flex-direction: initial;
5
+ justify-content: initial;
6
+ flex-wrap: initial;
7
+ }
8
+ .cgx-atm .flex-row {
9
+ flex-direction: row;
10
+ }
11
+ .cgx-atm .flex-col {
12
+ flex-direction: column;
13
+ }
14
+ .cgx-atm .justify-center {
15
+ justify-content: center;
16
+ }
17
+ .cgx-atm .justify-between {
18
+ justify-content: space-between;
19
+ }
20
+ .cgx-atm .justify-around {
21
+ justify-content: space-around;
22
+ }
23
+ .cgx-atm .justify-end {
24
+ justify-content: flex-end;
25
+ }
26
+ .cgx-atm .items-center {
27
+ align-items: center;
28
+ }
29
+ .cgx-atm .flex-wrap {
30
+ flex-wrap: wrap;
31
+ }
32
+
@@ -0,0 +1,2 @@
1
+ declare const DeptImg: () => import("vue/jsx-runtime").JSX.Element;
2
+ export default DeptImg;
@@ -0,0 +1,18 @@
1
+ import { createVNode as _createVNode } from "vue";
2
+ import "./_atomic.css";
3
+ const DeptImg = () => _createVNode("svg", {
4
+ "style": "width: 100%;height: 100%;",
5
+ "viewBox": "0 0 1204 1024",
6
+ "version": "1.1",
7
+ "xmlns": "http://www.w3.org/2000/svg"
8
+ }, [_createVNode("path", {
9
+ "d": "M561.63235285 164.57352927h335.01838211c27.29779432 0 49.63235285 22.33455854 49.63235366 49.63235284v62.04044147c0 27.29779432-22.33455854 49.63235285-49.63235366 49.63235284H561.63235285c-27.29779432 0-49.63235285-22.33455854-49.63235285-49.63235284v-62.04044147c0-27.29779432 22.33455854-49.63235285 49.63235285-49.63235284z",
10
+ "fill": "#AFFCFE"
11
+ }, null), _createVNode("path", {
12
+ "d": "M983.50735284 933.875H189.38970568c-54.59558862 0-99.26470568-44.66911789-99.26470568-99.26470568V189.38970568c0-54.59558862 44.66911789-99.26470568 99.26470568-99.26470568h285.38602928c68.24448496 18.61213211 54.59558862 53.35477927 99.2647065 99.26470568l31.02021992 49.63235286H983.50735284c54.59558862 0 99.26470568 44.66911789 99.26470569 99.2647065v496.32352928c0 54.59558862-44.66911789 99.26470568-99.26470569 99.26470568z",
13
+ "fill": "#2F77F1"
14
+ }, null)]);
15
+ var stdin_default = DeptImg;
16
+ export {
17
+ stdin_default as default
18
+ };
@@ -1 +1 @@
1
- :root:root{--van-action-sheet-max-height: 100%}.org-list{height:90vh;display:flex;flex-direction:column}.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:35px}.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:32px;height:32px;cursor:pointer;border-radius:4px;overflow:hidden}.org-list .van-list{flex:1;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;border-radius:4px;overflow:hidden}.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:35px}.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}.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}.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}
@@ -2,10 +2,28 @@
2
2
  --van-action-sheet-max-height: 100%;
3
3
  }
4
4
  .org-list {
5
- height: 90vh;
5
+ height: 85vh;
6
6
  display: flex;
7
7
  flex-direction: column;
8
8
 
9
+ .breadcrumb-nav {
10
+ margin-bottom: 4px;
11
+ padding: 2px 16px;
12
+ border-radius: 4px;
13
+ font-size: 12px;
14
+
15
+ .dept-name {
16
+ &.current-dept {
17
+ color: #969799; /* 提示文字颜色 */
18
+ }
19
+ }
20
+
21
+ .separator {
22
+ color: #969799;
23
+ margin: 0 4px;
24
+ }
25
+ }
26
+
9
27
  .search-bar {
10
28
  position: sticky;
11
29
  top: 0;
@@ -33,11 +51,12 @@
33
51
  margin: 0;
34
52
 
35
53
  .tag-avatar {
36
- width: 32px;
37
- height: 32px;
38
- cursor: pointer;
39
- border-radius: 4px;
40
- overflow: hidden;
54
+ width: 36px;
55
+ height: 36px;
56
+ img {
57
+ border-radius: 4px;
58
+ border: 1px solid #eee;
59
+ }
41
60
  }
42
61
  }
43
62
  }
@@ -49,6 +68,25 @@
49
68
  padding: 0 16px;
50
69
  }
51
70
 
71
+ .feed-list-wrap {
72
+ flex: 1;
73
+ display: flex;
74
+ overflow: hidden;
75
+ position: relative;
76
+ justify-content: center;
77
+ }
78
+ .search-result-list {
79
+ position: absolute;
80
+ top: 0; /* Adjust based on search bar and breadcrumb height */
81
+ left: 0;
82
+ right: 0;
83
+ bottom: 0; /* Adjust based on bottom section height if multiple is true */
84
+ z-index: 1;
85
+ background-color: #fff; /* Ensure background is white */
86
+ overflow-y: auto;
87
+ padding: 0 16px;
88
+ }
89
+
52
90
  .org-item {
53
91
  padding: 12px 0;
54
92
  border-bottom: 1px solid #eee;
@@ -63,8 +101,15 @@
63
101
 
64
102
  .org-avatar {
65
103
  flex-shrink: 0;
66
- border-radius: 4px;
67
- overflow: hidden;
104
+ width: 40px;
105
+ height: 40px;
106
+ display: flex;
107
+ align-items: center;
108
+ justify-content: center;
109
+ img {
110
+ border-radius: 4px;
111
+ border: 1px solid #eee;
112
+ }
68
113
  }
69
114
 
70
115
  .org-name {
@@ -2,6 +2,7 @@ import { ExtractPropTypes, PropType } from 'vue';
2
2
  export interface OrgItem {
3
3
  id: string | number;
4
4
  name: string;
5
+ type: string;
5
6
  avatar?: string;
6
7
  }
7
8
  export declare const orgPickerProps: {
@@ -3,11 +3,25 @@ export declare const useApi: () => {
3
3
  orgList: import("vue").Ref<{
4
4
  id: string | number;
5
5
  name: string;
6
+ type: string;
6
7
  avatar?: string | undefined;
7
8
  }[], OrgItem[] | {
8
9
  id: string | number;
9
10
  name: string;
11
+ type: string;
10
12
  avatar?: string | undefined;
11
13
  }[]>;
12
- getOrgList: () => Promise<void>;
14
+ getOrgList: (deptId?: string) => Promise<void>;
15
+ currentDeptId: import("vue").Ref<string, string>;
16
+ deptPath: import("vue").Ref<{
17
+ id: string | number;
18
+ name: string;
19
+ }[], {
20
+ id: string | number;
21
+ name: string;
22
+ }[] | {
23
+ id: string | number;
24
+ name: string;
25
+ }[]>;
26
+ searchOrgList: import("lodash-es").DebouncedFunc<(userName: string) => Promise<void>>;
13
27
  };