jmash-core-mp 0.1.30 → 0.1.31

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,5 +1,5 @@
1
1
  import { ResponseData } from "../../api/types";
2
- import { EnumRes, DictEntryReq, DictEntryList } from "./types";
2
+ import { EnumRes, DictEntryReq, DictEntryList, DictEntryLayList } from "./types";
3
3
  declare class DictApiImpl {
4
4
  /**
5
5
  * 枚举
@@ -13,6 +13,12 @@ declare class DictApiImpl {
13
13
  * @returns 返回Promise<Entry[]>的对象
14
14
  */
15
15
  dictEntryApi(data: DictEntryReq): Promise<ResponseData<DictEntryList>>;
16
+ /**
17
+ * 带子集字典
18
+ * @param data 查询条件
19
+ * @returns 返回Promise<DictEntryLayList>的对象
20
+ */
21
+ dictLayEntryApi(data: DictEntryReq): Promise<ResponseData<DictEntryLayList>>;
16
22
  }
17
23
  declare const dictApi: DictApiImpl;
18
24
  export { dictApi };
@@ -29,6 +29,22 @@ class DictApiImpl {
29
29
  data,
30
30
  });
31
31
  }
32
+ /**
33
+ * 带子集字典
34
+ * @param data 查询条件
35
+ * @returns 返回Promise<DictEntryLayList>的对象
36
+ */
37
+ dictLayEntryApi(data) {
38
+ if (data) {
39
+ data.hasEnable = data.enable !== undefined;
40
+ }
41
+ const config = getApp().globalData.config;
42
+ return mpx.xfetch.fetch({
43
+ url: "/v1/dict/dict_lay_entry/list/" + config.tenant,
44
+ method: "GET",
45
+ data,
46
+ });
47
+ }
32
48
  }
33
49
  const dictApi = new DictApiImpl();
34
50
  export { dictApi };
@@ -26,3 +26,15 @@ export interface DictEntryReq {
26
26
  hasEnable?: boolean;
27
27
  enable?: boolean;
28
28
  }
29
+ export interface DictEntryLayModel {
30
+ typeCode?: string;
31
+ dictCode?: string;
32
+ dictName?: string;
33
+ listOrder?: number;
34
+ enable?: boolean;
35
+ description?: string;
36
+ children?: Array<DictEntryLayModel>;
37
+ }
38
+ export interface DictEntryLayList {
39
+ results: Array<DictEntryLayModel>;
40
+ }
@@ -1,4 +1,4 @@
1
- import { Entry, DictEntryModel } from "./dict/types";
1
+ import { Entry, DictEntryModel, DictEntryLayModel } from "./dict/types";
2
2
  export declare class EnumDict {
3
3
  module: string;
4
4
  enumClass: string;
@@ -16,3 +16,11 @@ export declare class EntryDict {
16
16
  useDictValues(): Promise<DictEntryModel[]>;
17
17
  getDictValue(key: string): string;
18
18
  }
19
+ export declare class EntryLayDict {
20
+ typeCode: string;
21
+ enable?: boolean;
22
+ values: DictEntryLayModel[];
23
+ constructor(typeCode: string, enable?: boolean);
24
+ useDictValues(): Promise<DictEntryLayModel[]>;
25
+ getDictValue(key: string): string;
26
+ }
package/lib/api/dicts.js CHANGED
@@ -65,3 +65,34 @@ export class EntryDict {
65
65
  return entry?.dictName ? entry.dictName : "";
66
66
  }
67
67
  }
68
+ // 带子集字典类
69
+ export class EntryLayDict {
70
+ typeCode;
71
+ enable;
72
+ values = [];
73
+ constructor(typeCode, enable = true) {
74
+ // 字典类型编码
75
+ this.typeCode = typeCode;
76
+ // 是否启用
77
+ this.enable = enable;
78
+ }
79
+ // 加载数据字典
80
+ useDictValues() {
81
+ return new Promise((resolve) => {
82
+ const req = {
83
+ typeCode: this.typeCode,
84
+ enable: this.enable,
85
+ };
86
+ dictApi.dictLayEntryApi(req).then(({ data }) => {
87
+ this.values.length = 0;
88
+ this.values.push(...data.results);
89
+ resolve(this.values);
90
+ });
91
+ });
92
+ }
93
+ //获取字典值
94
+ getDictValue(key) {
95
+ const entry = this.values.find((entrys) => entrys.dictCode === key);
96
+ return entry?.dictName ? entry.dictName : "";
97
+ }
98
+ }
package/lib/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export type { AppConfig, ResponseData, ValidateData, EventBase, EventTarget, CanvasResponse, } from "./api/types";
2
2
  export type { LoginReq, LoginRes, RolesPerms, WebLoginReq, TokenModel, PhoneRegisterReq, PhoneReplaceReq, UpdateUserReq, UserInfoReq, UserInfo, } from "./api/auth/types";
3
3
  export type { CmsSiteList, CmsChannelReq, CmsChannelList, CmsContentInfoReq, CmsContentInfoModel, CmsInfoModel, CmsInfoContentModel, CmsChannelModel, } from "./api/cms/types";
4
- export type { Entry, DictEntryModel } from "./api/dict/types";
5
- export { EntryDict, EnumDict } from "./api/dicts";
4
+ export type { Entry, DictEntryModel, DictEntryLayModel } from "./api/dict/types";
5
+ export { EntryDict, EnumDict, EntryLayDict } from "./api/dicts";
6
6
  export type { FileInfo, FileBase64Req, FileDownInfo, FileWebReq, } from "./api/files/types";
7
7
  export type { DictRegionList, DictRegionReq, DictRegionModel, } from "./api/region/types";
8
8
  export type { StorageOrganInfoReq, StorageOrganInfoList, StorageOrganInfoModel, ShopBrowserUserList, ShopBrowserUserModel, StorageOrganBrowserUpdateReq, StorageOrganBrowserModel, } from "./api/storage/types";
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { EntryDict, EnumDict } from "./api/dicts";
1
+ export { EntryDict, EnumDict, EntryLayDict } from "./api/dicts";
2
2
  export { mpxFetch } from "./utils/request";
3
3
  export { config, initConfig, setConfig } from "./utils/config";
4
4
  export { grpc } from "./utils/grpc";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmash-core-mp",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
4
4
  "private": false,
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,5 +1,5 @@
1
1
  import { ResponseData, AppConfig } from "../../api/types";
2
- import { EnumEntryReq, EnumRes, DictEntryReq, DictEntryList } from "./types";
2
+ import { EnumEntryReq, EnumRes, DictEntryReq, DictEntryList, DictEntryLayList } from "./types";
3
3
  import mpx from "@mpxjs/core";
4
4
 
5
5
  class DictApiImpl {
@@ -37,6 +37,23 @@ class DictApiImpl {
37
37
  data,
38
38
  });
39
39
  }
40
+
41
+ /**
42
+ * 带子集字典
43
+ * @param data 查询条件
44
+ * @returns 返回Promise<DictEntryLayList>的对象
45
+ */
46
+ dictLayEntryApi(data: DictEntryReq): Promise<ResponseData<DictEntryLayList>> {
47
+ if (data) {
48
+ data.hasEnable = data.enable !== undefined;
49
+ }
50
+ const config = getApp().globalData.config;
51
+ return mpx.xfetch.fetch({
52
+ url: "/v1/dict/dict_lay_entry/list/" + config.tenant,
53
+ method: "GET",
54
+ data,
55
+ });
56
+ }
40
57
  }
41
58
 
42
59
  const dictApi = new DictApiImpl();
@@ -47,4 +47,28 @@ export interface DictEntryReq {
47
47
  hasEnable?: boolean;
48
48
  // 是否启用
49
49
  enable?: boolean;
50
+ }
51
+
52
+ // 带子集字典实体
53
+ export interface DictEntryLayModel {
54
+ // 字典类型编码
55
+ typeCode?: string;
56
+ // 字典编码
57
+ dictCode?: string;
58
+ // 字典名称
59
+ dictName?: string;
60
+ // 排序
61
+ listOrder?: number;
62
+ // 是否启用
63
+ enable?: boolean;
64
+ // 描述
65
+ description?: string;
66
+ // 子集
67
+ children?: Array<DictEntryLayModel>;
68
+ }
69
+
70
+ // 带子集字典列表
71
+ export interface DictEntryLayList {
72
+ // 内容
73
+ results: Array<DictEntryLayModel>;
50
74
  }
package/src/api/dicts.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Entry, DictEntryModel, DictEntryReq } from "./dict/types";
1
+ import { Entry, DictEntryModel, DictEntryReq, DictEntryLayModel } from "./dict/types";
2
2
  import { dictApi } from "./dict/index";
3
3
  //枚举字典类.
4
4
  export class EnumDict {
@@ -70,3 +70,36 @@ export class EntryDict {
70
70
  return entry?.dictName ? entry.dictName : "";
71
71
  }
72
72
  }
73
+
74
+ // 带子集字典类
75
+ export class EntryLayDict {
76
+ typeCode: string;
77
+ enable?: boolean;
78
+ values: DictEntryLayModel[] = [];
79
+ constructor(typeCode: string, enable: boolean = true) {
80
+ // 字典类型编码
81
+ this.typeCode = typeCode;
82
+ // 是否启用
83
+ this.enable = enable;
84
+ }
85
+ // 加载数据字典
86
+ useDictValues(): Promise<DictEntryLayModel[]> {
87
+ return new Promise((resolve) => {
88
+ const req = {
89
+ typeCode: this.typeCode,
90
+ enable: this.enable,
91
+ } as DictEntryReq;
92
+ dictApi.dictLayEntryApi(req).then(({ data }) => {
93
+ this.values.length = 0;
94
+ this.values.push(...data.results);
95
+ resolve(this.values);
96
+ });
97
+ });
98
+ }
99
+
100
+ //获取字典值
101
+ getDictValue(key: string): string {
102
+ const entry = this.values.find((entrys) => entrys.dictCode === key);
103
+ return entry?.dictName ? entry.dictName : "";
104
+ }
105
+ }
@@ -57,6 +57,8 @@ createComponent({
57
57
  handleConfirm(e: EventBase) {
58
58
  const selectedOptions = e.detail;
59
59
  this.triggerEvent("cascaderValue", selectedOptions.selectedText);
60
+ const lastCode = selectedOptions.selectedVal?.[selectedOptions.selectedVal.length - 1] || "";
61
+ this.triggerEvent("cascaderCode", lastCode);
60
62
  // 关闭弹框
61
63
  this.handleRegionClose();
62
64
  },
@@ -91,7 +93,7 @@ createComponent({
91
93
  if (!regionId) {
92
94
  this.regionOption = [...this.regionOption, ...regionData];
93
95
  }
94
- console.log("级联地区数组==>", this.regionOption);
96
+ // console.log("级联地区数组==>", this.regionOption);
95
97
  return regionData;
96
98
  } catch (error) {
97
99
  return [];
@@ -30,6 +30,11 @@ createComponent({
30
30
  type: String,
31
31
  value: "暂无数据"
32
32
  },
33
+ // 文本颜色
34
+ contentColor: {
35
+ type: String,
36
+ value: "#b6b6b6"
37
+ },
33
38
  // 图片的宽
34
39
  imgWidth: {
35
40
  type: String,
@@ -45,10 +50,6 @@ createComponent({
45
50
  type: String,
46
51
  value: "/components/contacts_nomore2x.png"
47
52
  },
48
- contentColor: {
49
- type: String,
50
- value: "#b6b6b6"
51
- }
52
53
  },
53
54
  setup() {
54
55
  let config = getApp().globalData.config;
@@ -1,8 +1,9 @@
1
1
  <template>
2
- <cube-popup wx:if="{{ show }}" wx:ref="popup" zIndex="999999" position="bottom" transition="move-up"
3
- maskClosable="{{ true }}" styleConfig="{{ popupStyle }}" bind:maskClick="closePopup">
2
+ <cube-popup wx:if="{{ show }}" wx:ref="popup" zIndex="999999" position="{{ position }}"
3
+ transition="{{ transition }}" maskClosable="{{ true }}" styleConfig="{{ popupStyle }}"
4
+ bind:maskClick="closePopup">
4
5
  <view class="auth-mask-popup"
5
- style="height: {{ height }}; background-color: {{ backColor }};border-top-left-radius: {{ borderRadius }};border-top-right-radius: {{ borderRadius }};width: 100%;">
6
+ style="width: {{ width }}; height: {{ height }}; background-color: {{ backColor }};border-top-left-radius: {{ borderRadius }};border-top-right-radius: {{ borderRadius }};">
6
7
  <view class="popup-title" wx:if="{{ titleShow }}">
7
8
  {{ title }}
8
9
  <image class="close-icon" src="{{ resourceUrl + 'close_circle2x.png' }}" mode="aspectFit"
@@ -39,7 +40,12 @@ createComponent({
39
40
  type: Boolean,
40
41
  value: true
41
42
  },
42
- //
43
+ // 宽度
44
+ width: {
45
+ type: String,
46
+ value: "92%"
47
+ },
48
+ // 高度
43
49
  height: {
44
50
  type: String,
45
51
  value: ""
@@ -54,6 +60,16 @@ createComponent({
54
60
  type: String,
55
61
  value: "50rpx"
56
62
  },
63
+ // 位置
64
+ position: {
65
+ type: String,
66
+ value: "bottom"
67
+ },
68
+ // 过渡动画
69
+ transition: {
70
+ type: String,
71
+ value: "move-up"
72
+ },
57
73
  // 层级
58
74
  zIndex: {
59
75
  type: Number,
@@ -111,7 +127,6 @@ createComponent({
111
127
  position: fixed;
112
128
  bottom: 0;
113
129
  left: 0;
114
- width: 92%;
115
130
  padding: 0 30rpx env(safe-area-inset-bottom);
116
131
  box-sizing: border-box;
117
132
  z-index: $z-index;
package/src/index.ts CHANGED
@@ -28,8 +28,8 @@ export type {
28
28
  CmsInfoContentModel,
29
29
  CmsChannelModel,
30
30
  } from "./api/cms/types";
31
- export type { Entry, DictEntryModel } from "./api/dict/types";
32
- export { EntryDict, EnumDict } from "./api/dicts";
31
+ export type { Entry, DictEntryModel, DictEntryLayModel } from "./api/dict/types";
32
+ export { EntryDict, EnumDict, EntryLayDict } from "./api/dicts";
33
33
  export type {
34
34
  FileInfo,
35
35
  FileBase64Req,
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};