cnhis-design-vue 3.3.3-beta.17 → 3.3.3-beta.18

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.
Files changed (27) hide show
  1. package/README.md +87 -87
  2. package/es/components/audio-sdk/index.d.ts +13 -11
  3. package/es/components/audio-sdk/src/Index.vue.d.ts +13 -11
  4. package/es/components/audio-sdk/src/Index.vue2.js +36 -4
  5. package/es/components/audio-sdk/src/components/recording-modal.vue.d.ts +1 -1
  6. package/es/components/audio-sdk/src/components/recording.vue.d.ts +1 -1
  7. package/es/components/audio-sdk/src/components/recording.vue2.js +1 -1
  8. package/es/components/button-print/src/components/NewPrintComponent.vue2.js +0 -42
  9. package/es/components/classification/src/components/table-modal/index.vue.d.ts +3 -0
  10. package/es/components/field-set/src/FieldColor.vue.d.ts +4 -4
  11. package/es/components/field-set/src/FieldFilter.vue.d.ts +4 -4
  12. package/es/components/field-set/src/FieldSet.vue.d.ts +5 -5
  13. package/es/components/field-set/src/components/table-row.vue.d.ts +4 -4
  14. package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
  15. package/es/components/scale-view/index.d.ts +41 -2
  16. package/es/components/scale-view/src/ScaleView.vue.d.ts +44 -4
  17. package/es/components/scale-view/src/ScaleView.vue2.js +71 -3
  18. package/es/components/scale-view/src/hooks/scaleview-props.d.ts +8 -0
  19. package/es/components/scale-view/src/hooks/scaleview-props.js +8 -0
  20. package/es/components/scale-view/src/hooks/scaleview-submit.d.ts +2 -1
  21. package/es/components/scale-view/src/utils/judge-types.d.ts +2 -1
  22. package/es/components/scale-view/src/utils/judge-types.js +10 -10
  23. package/es/components/scale-view/src/utils/watch-form-change.d.ts +13 -0
  24. package/es/components/scale-view/src/utils/watch-form-change.js +71 -0
  25. package/es/env.d.ts +25 -25
  26. package/es/shared/package.json.js +1 -1
  27. package/package.json +2 -2
package/README.md CHANGED
@@ -1,87 +1,87 @@
1
- # 安装
2
-
3
- ```shell
4
- npm i cnhis-design-vue@[版本号]
5
- # or
6
- yarn add cnhis-design-vue@[版本号] #推荐
7
- ```
8
-
9
- ## 1.全局引入
10
-
11
- ```typescript
12
- // main.ts
13
- import { createApp } from 'vue';
14
- import App from './App.vue';
15
- import 'cnhis-design-vue/es/packages/index.css';
16
- import cui from 'cnhis-design-vue';
17
-
18
- const app = createApp(App);
19
- app.use(cui).mount('#app');
20
- ```
21
-
22
- ## 2. 按需引入
23
-
24
- 组件现在支持了自动按需引入, 但是样式文件需要额外的处理
25
-
26
- ### 2.1 样式处理方式1 (按需引入样式)
27
-
28
- ```shell
29
- # 安装自动导入样式的插件
30
- npm i -d vite-plugin-style-import
31
- ```
32
-
33
- ```typescript
34
- // vite.config.ts
35
- import { defineConfig } from 'vite';
36
- import { createStyleImportPlugin } from 'vite-plugin-style-import';
37
-
38
- export default defineConfig({
39
- plugins: [
40
- // ...otherPlugins
41
- createStyleImportPlugin({
42
- libs: [
43
- {
44
- libraryName: 'cnhis-design-vue',
45
- esModule: true,
46
- ensureStyleFile: true,
47
- resolveStyle: name => {
48
- return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
49
- }
50
- }
51
- ]
52
- })
53
- ]
54
- });
55
- ```
56
-
57
- ### 2.2 样式处理方式2 (全局引入样式)
58
-
59
- ```typescript
60
- // main.ts
61
- import 'cnhis-design-vue/es/components/index.css';
62
- ```
63
-
64
- ## 3.FAQ
65
-
66
- ### 3.1 项目打包后样式丢失
67
-
68
- 处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
69
-
70
- ```typescript
71
- // vite.config.ts
72
- import { defineConfig } from 'vite';
73
-
74
- export default defineConfig({
75
- build: {
76
- rollupOptions: {
77
- // ..otherOptions
78
- output: {
79
- dir: './dist',
80
- manualChunks: {
81
- 'cnhis-vendor': ['cnhis-design-vue']
82
- }
83
- }
84
- }
85
- }
86
- });
87
- ```
1
+ # 安装
2
+
3
+ ```shell
4
+ npm i cnhis-design-vue@[版本号]
5
+ # or
6
+ yarn add cnhis-design-vue@[版本号] #推荐
7
+ ```
8
+
9
+ ## 1.全局引入
10
+
11
+ ```typescript
12
+ // main.ts
13
+ import { createApp } from 'vue';
14
+ import App from './App.vue';
15
+ import 'cnhis-design-vue/es/packages/index.css';
16
+ import cui from 'cnhis-design-vue';
17
+
18
+ const app = createApp(App);
19
+ app.use(cui).mount('#app');
20
+ ```
21
+
22
+ ## 2. 按需引入
23
+
24
+ 组件现在支持了自动按需引入, 但是样式文件需要额外的处理
25
+
26
+ ### 2.1 样式处理方式1 (按需引入样式)
27
+
28
+ ```shell
29
+ # 安装自动导入样式的插件
30
+ npm i -d vite-plugin-style-import
31
+ ```
32
+
33
+ ```typescript
34
+ // vite.config.ts
35
+ import { defineConfig } from 'vite';
36
+ import { createStyleImportPlugin } from 'vite-plugin-style-import';
37
+
38
+ export default defineConfig({
39
+ plugins: [
40
+ // ...otherPlugins
41
+ createStyleImportPlugin({
42
+ libs: [
43
+ {
44
+ libraryName: 'cnhis-design-vue',
45
+ esModule: true,
46
+ ensureStyleFile: true,
47
+ resolveStyle: name => {
48
+ return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
49
+ }
50
+ }
51
+ ]
52
+ })
53
+ ]
54
+ });
55
+ ```
56
+
57
+ ### 2.2 样式处理方式2 (全局引入样式)
58
+
59
+ ```typescript
60
+ // main.ts
61
+ import 'cnhis-design-vue/es/components/index.css';
62
+ ```
63
+
64
+ ## 3.FAQ
65
+
66
+ ### 3.1 项目打包后样式丢失
67
+
68
+ 处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
69
+
70
+ ```typescript
71
+ // vite.config.ts
72
+ import { defineConfig } from 'vite';
73
+
74
+ export default defineConfig({
75
+ build: {
76
+ rollupOptions: {
77
+ // ..otherOptions
78
+ output: {
79
+ dir: './dist',
80
+ manualChunks: {
81
+ 'cnhis-vendor': ['cnhis-design-vue']
82
+ }
83
+ }
84
+ }
85
+ }
86
+ });
87
+ ```
@@ -8,9 +8,6 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
8
8
  type: NumberConstructor;
9
9
  default: number;
10
10
  };
11
- realTimeRecognition: {
12
- type: BooleanConstructor;
13
- };
14
11
  allowPunctuationMark: {
15
12
  type: BooleanConstructor;
16
13
  default: boolean;
@@ -32,8 +29,12 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
32
29
  type: StringConstructor;
33
30
  default: string;
34
31
  };
32
+ appCode: {
33
+ type: StringConstructor;
34
+ };
35
35
  }, {
36
36
  consultationRecordUrl: string;
37
+ chatBoxinit: string;
37
38
  cssVars: import("vue").ComputedRef<import("../../shared/types").AnyObject>;
38
39
  audioSdk: AudioSDK;
39
40
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -41,9 +42,6 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
41
42
  type: NumberConstructor;
42
43
  default: number;
43
44
  };
44
- realTimeRecognition: {
45
- type: BooleanConstructor;
46
- };
47
45
  allowPunctuationMark: {
48
46
  type: BooleanConstructor;
49
47
  default: boolean;
@@ -65,6 +63,9 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
65
63
  type: StringConstructor;
66
64
  default: string;
67
65
  };
66
+ appCode: {
67
+ type: StringConstructor;
68
+ };
68
69
  }>> & {
69
70
  onSuccess?: ((...args: any[]) => any) | undefined;
70
71
  onClose?: ((...args: any[]) => any) | undefined;
@@ -79,6 +80,7 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
79
80
  recordingRef: import("vue").Ref<any>;
80
81
  isRecording: import("vue").Ref<boolean>;
81
82
  loading: import("vue").Ref<boolean>;
83
+ audioType: import("vue").Ref<"websocket" | "http" | undefined>;
82
84
  content: any;
83
85
  wsConnected: import("vue").ComputedRef<boolean | undefined>;
84
86
  recorderStatus: import("vue").ComputedRef<"" | "fail">;
@@ -101,6 +103,7 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
101
103
  onPause: () => void;
102
104
  onResume: () => void;
103
105
  handleToAnalyzing: (obj?: import("../../shared/types").AnyObject) => Promise<void>;
106
+ getAudioType: () => Promise<void>;
104
107
  createMedicalRecord: () => Promise<void>;
105
108
  CRecording: import("vue").DefineComponent<{
106
109
  content: {
@@ -204,8 +207,8 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
204
207
  audioChartRef: import("vue").Ref<HTMLDivElement | undefined>;
205
208
  audioChartSamllRef: import("vue").Ref<HTMLDivElement | undefined>;
206
209
  contentScrollRef: import("vue").Ref<HTMLDivElement | undefined>;
207
- isActive: import("vue").Ref<boolean>;
208
210
  isWarning: import("vue").Ref<boolean>;
211
+ isActive: import("vue").Ref<boolean>;
209
212
  formattedTime: import("vue").ComputedRef<string>;
210
213
  isCountFinished: import("vue").Ref<boolean>;
211
214
  isCountActive: import("vue").Ref<boolean>;
@@ -343,9 +346,6 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
343
346
  type: NumberConstructor;
344
347
  default: number;
345
348
  };
346
- realTimeRecognition: {
347
- type: BooleanConstructor;
348
- };
349
349
  allowPunctuationMark: {
350
350
  type: BooleanConstructor;
351
351
  default: boolean;
@@ -367,6 +367,9 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
367
367
  type: StringConstructor;
368
368
  default: string;
369
369
  };
370
+ appCode: {
371
+ type: StringConstructor;
372
+ };
370
373
  }>> & {
371
374
  onSuccess?: ((...args: any[]) => any) | undefined;
372
375
  onClose?: ((...args: any[]) => any) | undefined;
@@ -374,7 +377,6 @@ declare const AudioSdk: SFCWithInstall<import("vue").DefineComponent<{
374
377
  onRecordingHeightChange?: ((...args: any[]) => any) | undefined;
375
378
  }, {
376
379
  timed: number;
377
- realTimeRecognition: boolean;
378
380
  allowPunctuationMark: boolean;
379
381
  useSource: string;
380
382
  textPrefix: string;
@@ -6,9 +6,6 @@ declare const _default: import("vue").DefineComponent<{
6
6
  type: NumberConstructor;
7
7
  default: number;
8
8
  };
9
- realTimeRecognition: {
10
- type: BooleanConstructor;
11
- };
12
9
  allowPunctuationMark: {
13
10
  type: BooleanConstructor;
14
11
  default: boolean;
@@ -30,8 +27,12 @@ declare const _default: import("vue").DefineComponent<{
30
27
  type: StringConstructor;
31
28
  default: string;
32
29
  };
30
+ appCode: {
31
+ type: StringConstructor;
32
+ };
33
33
  }, {
34
34
  consultationRecordUrl: string;
35
+ chatBoxinit: string;
35
36
  cssVars: import("vue").ComputedRef<AnyObject>;
36
37
  audioSdk: AudioSDK;
37
38
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -39,9 +40,6 @@ declare const _default: import("vue").DefineComponent<{
39
40
  type: NumberConstructor;
40
41
  default: number;
41
42
  };
42
- realTimeRecognition: {
43
- type: BooleanConstructor;
44
- };
45
43
  allowPunctuationMark: {
46
44
  type: BooleanConstructor;
47
45
  default: boolean;
@@ -63,6 +61,9 @@ declare const _default: import("vue").DefineComponent<{
63
61
  type: StringConstructor;
64
62
  default: string;
65
63
  };
64
+ appCode: {
65
+ type: StringConstructor;
66
+ };
66
67
  }>> & {
67
68
  onSuccess?: ((...args: any[]) => any) | undefined;
68
69
  onClose?: ((...args: any[]) => any) | undefined;
@@ -77,6 +78,7 @@ declare const _default: import("vue").DefineComponent<{
77
78
  recordingRef: import("vue").Ref<any>;
78
79
  isRecording: import("vue").Ref<boolean>;
79
80
  loading: import("vue").Ref<boolean>;
81
+ audioType: import("vue").Ref<"websocket" | "http" | undefined>;
80
82
  content: any;
81
83
  wsConnected: import("vue").ComputedRef<boolean | undefined>;
82
84
  recorderStatus: import("vue").ComputedRef<"" | "fail">;
@@ -99,6 +101,7 @@ declare const _default: import("vue").DefineComponent<{
99
101
  onPause: () => void;
100
102
  onResume: () => void;
101
103
  handleToAnalyzing: (obj?: AnyObject) => Promise<void>;
104
+ getAudioType: () => Promise<void>;
102
105
  createMedicalRecord: () => Promise<void>;
103
106
  CRecording: import("vue").DefineComponent<{
104
107
  content: {
@@ -202,8 +205,8 @@ declare const _default: import("vue").DefineComponent<{
202
205
  audioChartRef: import("vue").Ref<HTMLDivElement | undefined>;
203
206
  audioChartSamllRef: import("vue").Ref<HTMLDivElement | undefined>;
204
207
  contentScrollRef: import("vue").Ref<HTMLDivElement | undefined>;
205
- isActive: import("vue").Ref<boolean>;
206
208
  isWarning: import("vue").Ref<boolean>;
209
+ isActive: import("vue").Ref<boolean>;
207
210
  formattedTime: import("vue").ComputedRef<string>;
208
211
  isCountFinished: import("vue").Ref<boolean>;
209
212
  isCountActive: import("vue").Ref<boolean>;
@@ -341,9 +344,6 @@ declare const _default: import("vue").DefineComponent<{
341
344
  type: NumberConstructor;
342
345
  default: number;
343
346
  };
344
- realTimeRecognition: {
345
- type: BooleanConstructor;
346
- };
347
347
  allowPunctuationMark: {
348
348
  type: BooleanConstructor;
349
349
  default: boolean;
@@ -365,6 +365,9 @@ declare const _default: import("vue").DefineComponent<{
365
365
  type: StringConstructor;
366
366
  default: string;
367
367
  };
368
+ appCode: {
369
+ type: StringConstructor;
370
+ };
368
371
  }>> & {
369
372
  onSuccess?: ((...args: any[]) => any) | undefined;
370
373
  onClose?: ((...args: any[]) => any) | undefined;
@@ -372,7 +375,6 @@ declare const _default: import("vue").DefineComponent<{
372
375
  onRecordingHeightChange?: ((...args: any[]) => any) | undefined;
373
376
  }, {
374
377
  timed: number;
375
- realTimeRecognition: boolean;
376
378
  allowPunctuationMark: boolean;
377
379
  useSource: string;
378
380
  textPrefix: string;
@@ -21,9 +21,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
21
21
  type: Number,
22
22
  default: 5
23
23
  },
24
- realTimeRecognition: {
25
- type: Boolean
26
- },
27
24
  allowPunctuationMark: {
28
25
  type: Boolean,
29
26
  default: true
@@ -44,6 +41,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
44
41
  textPrefix: {
45
42
  type: String,
46
43
  default: ""
44
+ },
45
+ appCode: {
46
+ type: String
47
47
  }
48
48
  },
49
49
  emits: ["close", "success", "fail", "recordingHeightChange"],
@@ -53,6 +53,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
53
53
  }) {
54
54
  const props = __props;
55
55
  const consultationRecordUrl = "/flow/openApi/consultationRecord";
56
+ const chatBoxinit = "/flow/ai/api/chatBoxInit";
56
57
  const cssVars = useTheme();
57
58
  const audioSdk = AudioSDK.create();
58
59
  const attrs = useAttrs();
@@ -60,10 +61,15 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
60
61
  const recordingRef = ref();
61
62
  const isRecording = ref(false);
62
63
  const loading = ref(false);
64
+ const audioType = ref();
63
65
  const content = computed(() => {
64
66
  return audioSdk.contentRef.value;
65
67
  });
66
- const wsConnected = computed(() => audioSdk.wsConnected.value);
68
+ const wsConnected = computed(() => {
69
+ if (audioType.value === "http")
70
+ return true;
71
+ return audioSdk.wsConnected.value;
72
+ });
67
73
  const recorderStatus = computed(() => audioSdk.recorderStatus.value);
68
74
  const recordingProps = computed(() => {
69
75
  return {
@@ -157,10 +163,36 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
157
163
  isRecording.value = false;
158
164
  }
159
165
  };
166
+ const getAudioType = async () => {
167
+ if (!props.appCode || !props.token)
168
+ return;
169
+ try {
170
+ const {
171
+ data
172
+ } = await axios.post(chatBoxinit, {
173
+ appCode: props.appCode,
174
+ configs: props.configs || {}
175
+ }, {
176
+ headers: {
177
+ authorization: props.token
178
+ }
179
+ });
180
+ if (!(data == null ? void 0 : data.success))
181
+ return;
182
+ if (Reflect.has((data == null ? void 0 : data.data) || {}, "voiceStreamFlag")) {
183
+ audioType.value = data.data.voiceStreamFlag ? "websocket" : "http";
184
+ }
185
+ } catch (error) {
186
+ }
187
+ };
160
188
  const createMedicalRecord = async () => {
189
+ var _a;
161
190
  isRecording.value = true;
162
191
  try {
192
+ if (!audioType.value)
193
+ await getAudioType();
163
194
  const res = await audioSdk.start({
195
+ type: (_a = audioType.value) != null ? _a : "websocket",
164
196
  ...props,
165
197
  ...attrs
166
198
  });
@@ -114,8 +114,8 @@ declare const _default: import("vue").DefineComponent<{
114
114
  audioChartRef: import("vue").Ref<HTMLDivElement | undefined>;
115
115
  audioChartSamllRef: import("vue").Ref<HTMLDivElement | undefined>;
116
116
  contentScrollRef: import("vue").Ref<HTMLDivElement | undefined>;
117
- isActive: import("vue").Ref<boolean>;
118
117
  isWarning: import("vue").Ref<boolean>;
118
+ isActive: import("vue").Ref<boolean>;
119
119
  formattedTime: import("vue").ComputedRef<string>;
120
120
  isCountFinished: import("vue").Ref<boolean>;
121
121
  isCountActive: import("vue").Ref<boolean>;
@@ -102,8 +102,8 @@ declare const _default: import("vue").DefineComponent<{
102
102
  audioChartRef: import("vue").Ref<HTMLDivElement | undefined>;
103
103
  audioChartSamllRef: import("vue").Ref<HTMLDivElement | undefined>;
104
104
  contentScrollRef: import("vue").Ref<HTMLDivElement | undefined>;
105
- isActive: import("vue").Ref<boolean>;
106
105
  isWarning: import("vue").Ref<boolean>;
106
+ isActive: import("vue").Ref<boolean>;
107
107
  formattedTime: import("vue").ComputedRef<string>;
108
108
  isCountFinished: import("vue").Ref<boolean>;
109
109
  isCountActive: import("vue").Ref<boolean>;
@@ -127,9 +127,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
127
127
  const audioChartRef = ref();
128
128
  const audioChartSamllRef = ref();
129
129
  const contentScrollRef = ref();
130
+ const isWarning = ref(false);
130
131
  const {
131
132
  isActive,
132
- isWarning,
133
133
  formattedTime,
134
134
  isCountFinished,
135
135
  isCountActive,
@@ -551,18 +551,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
551
551
  const templateNumbers = Object.keys(state.printParams);
552
552
  state.isClickOuterPrint = false;
553
553
  const originParamsClone = state.originParams;
554
- encapBrowserLog({
555
- type: "\u8FDB\u5165\u6253\u5370\u5168\u90E8\u65B9\u6CD5",
556
- res: {
557
- printParams: state.printParams,
558
- originParams: state.originParams,
559
- options: options.value,
560
- printAllFormatIds: printAllFormatIds.value,
561
- isPrintAllType: isPrintAllType.value,
562
- formatList: state.formatList,
563
- outerPrintItems: outerPrintItems.value
564
- }
565
- }, "PRINT-SDK");
566
554
  if (((_a = Object.keys(printAllFormatIds.value)) == null ? void 0 : _a.length) > 0) {
567
555
  options.value.forEach((optItem) => {
568
556
  if (printAllFormatIds.value.includes(optItem.key)) {
@@ -1037,39 +1025,16 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
1037
1025
  state.templateParams = mergeTemplateList(formatListResult.obj);
1038
1026
  state.printParams = formatSomeTypeParams(state.templateParams, props.params);
1039
1027
  state.originParams = formatSomeOriginParams(state.templateParams, props.params);
1040
- encapBrowserLog({
1041
- type: "\u53C2\u6570\u6253\u5370",
1042
- res: {
1043
- options: options.value,
1044
- innerPrintItems: innerPrintItems.value,
1045
- outerPrintItems: outerPrintItems.value,
1046
- formatList: state.formatList,
1047
- number: state.number,
1048
- templateParams: state.templateParams,
1049
- printParams: state.printParams,
1050
- originParams: state.originParams
1051
- }
1052
- }, "PRINT-SDK");
1053
1028
  registerShort();
1054
1029
  };
1055
1030
  const init = async () => {
1056
1031
  var _a;
1057
- encapBrowserLog({
1058
- type: "\u521D\u59CB\u5316\u6253\u5370\u65B9\u6CD5",
1059
- res: {
1060
- isInited: state.isInited
1061
- }
1062
- }, "PRINT-SDK");
1063
1032
  if (state.isInited)
1064
1033
  return true;
1065
1034
  state.isInited = true;
1066
1035
  state.spinning = true;
1067
1036
  instantiatePrintSDK();
1068
1037
  const formatListResult = await props.queryPrintFormatByNumber();
1069
- encapBrowserLog({
1070
- type: "\u83B7\u53D6\u683C\u5F0F\u6570\u636E",
1071
- formatListResult
1072
- }, "PRINT-SDK");
1073
1038
  await initCRM(formatListResult);
1074
1039
  if (((_a = formatListResult.obj) == null ? void 0 : _a.length) > 0)
1075
1040
  authorizationKey.value = formatListResult.obj[0].authorizationKey || "";
@@ -1118,13 +1083,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
1118
1083
  };
1119
1084
  const handleClickBtn = async (visible = true) => {
1120
1085
  const status = await props.clickPrevFn();
1121
- encapBrowserLog({
1122
- type: "\u5C55\u5F00\u6253\u5370\u83DC\u5355",
1123
- res: {
1124
- status,
1125
- visible: state.visible
1126
- }
1127
- }, "PRINT-SDK");
1128
1086
  if (!status)
1129
1087
  return;
1130
1088
  if (!state.visible) {
@@ -175,6 +175,9 @@ declare const _default: import("vue").DefineComponent<{
175
175
  modelValue: unknown[];
176
176
  componentData: Record<string, any>;
177
177
  } & {
178
+ /**
179
+ * 改变弹窗大小
180
+ */
178
181
  itemKey?: string | Function | undefined;
179
182
  }>, {
180
183
  move: Function;
@@ -534,12 +534,12 @@ declare const _default: import("vue").DefineComponent<{
534
534
  }>;
535
535
  developMode: boolean;
536
536
  draggable: boolean;
537
- fieldDescribeMode: "column" | "tooltip";
538
- isFieldSet: boolean;
539
- hideExpressionOption: AnyObject[];
537
+ isHighlightRow: boolean;
540
538
  idx: number;
541
539
  isHighlight: boolean;
542
- isHighlightRow: boolean;
540
+ isFieldSet: boolean;
541
+ fieldDescribeMode: "column" | "tooltip";
542
+ hideExpressionOption: AnyObject[];
543
543
  }>;
544
544
  EditDialog: import("vue").DefineComponent<{
545
545
  visible: {
@@ -563,12 +563,12 @@ declare const _default: import("vue").DefineComponent<{
563
563
  }>;
564
564
  developMode: boolean;
565
565
  draggable: boolean;
566
- fieldDescribeMode: "column" | "tooltip";
567
- isFieldSet: boolean;
568
- hideExpressionOption: AnyObject[];
566
+ isHighlightRow: boolean;
569
567
  idx: number;
570
568
  isHighlight: boolean;
571
- isHighlightRow: boolean;
569
+ isFieldSet: boolean;
570
+ fieldDescribeMode: "column" | "tooltip";
571
+ hideExpressionOption: AnyObject[];
572
572
  }>;
573
573
  setStyle: typeof setStyle;
574
574
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "save" | "reset")[], "close" | "save" | "reset", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -754,12 +754,12 @@ declare const _default: import("vue").DefineComponent<{
754
754
  }>;
755
755
  developMode: boolean;
756
756
  draggable: boolean;
757
- fieldDescribeMode: "column" | "tooltip";
758
- isFieldSet: boolean;
759
- hideExpressionOption: AnyObject[];
757
+ isHighlightRow: boolean;
760
758
  idx: number;
761
759
  isHighlight: boolean;
762
- isHighlightRow: boolean;
760
+ isFieldSet: boolean;
761
+ fieldDescribeMode: "column" | "tooltip";
762
+ hideExpressionOption: AnyObject[];
763
763
  }>;
764
764
  isArray: {
765
765
  (value?: any): value is any[];
@@ -898,9 +898,9 @@ declare const _default: import("vue").DefineComponent<{
898
898
  showSeq: boolean;
899
899
  developMode: boolean;
900
900
  footerFlag: boolean;
901
+ fieldDescribeMode: "column" | "tooltip";
901
902
  customColumns: FieldSetColumnItem[];
902
903
  showSortPriority: boolean;
903
904
  showHeadFilter: boolean;
904
- fieldDescribeMode: "column" | "tooltip";
905
905
  }>;
906
906
  export default _default;
@@ -383,11 +383,11 @@ declare const _default: import("vue").DefineComponent<{
383
383
  }>;
384
384
  developMode: boolean;
385
385
  draggable: boolean;
386
- fieldDescribeMode: "column" | "tooltip";
387
- isFieldSet: boolean;
388
- hideExpressionOption: AnyObject[];
386
+ isHighlightRow: boolean;
389
387
  idx: number;
390
388
  isHighlight: boolean;
391
- isHighlightRow: boolean;
389
+ isFieldSet: boolean;
390
+ fieldDescribeMode: "column" | "tooltip";
391
+ hideExpressionOption: AnyObject[];
392
392
  }>;
393
393
  export default _default;
@@ -225,7 +225,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
225
225
  round: "",
226
226
  size: 100,
227
227
  onClickCapture: _cache[0] || (_cache[0] = ($event) => showLargeAvatar.value = true)
228
- }, null, 8, ["src"]), createCommentVNode(' <n-upload abstract accept="image/*" @change="onChange">\n <n-upload-trigger #="{ handleClick }" abstract>\n <n-button\n circle\n secondary\n class="edit-avatar"\n v-show="userDetail.id === state.userInfo.id"\n @click="handleClick"\n >\n <template #icon>\n <n-icon size="16" color="#666666" :component="Camera" />\n </template>\n </n-button>\n </n-upload-trigger>\n </n-upload> '), createElementVNode("div", _hoisted_4, [createElementVNode("h4", null, [createElementVNode("label", _hoisted_5, toDisplayString(userDetail.name), 1), withDirectives(createElementVNode("label", {
228
+ }, null, 8, ["src"]), createCommentVNode(' <n-upload abstract accept="image/*" @change="onChange">\r\n <n-upload-trigger #="{ handleClick }" abstract>\r\n <n-button\r\n circle\r\n secondary\r\n class="edit-avatar"\r\n v-show="userDetail.id === state.userInfo.id"\r\n @click="handleClick"\r\n >\r\n <template #icon>\r\n <n-icon size="16" color="#666666" :component="Camera" />\r\n </template>\r\n </n-button>\r\n </n-upload-trigger>\r\n </n-upload> '), createElementVNode("div", _hoisted_4, [createElementVNode("h4", null, [createElementVNode("label", _hoisted_5, toDisplayString(userDetail.name), 1), withDirectives(createElementVNode("label", {
229
229
  class: normalizeClass(["iho-chatRole", unref(isDoctorRole)(userDetail.roleInfo) ? "isDoctor" : ""])
230
230
  }, toDisplayString(unref(getRoleName)(userDetail.roleInfo)), 3), [[vShow, unref(getRoleName)(userDetail.roleInfo)]])]), createElementVNode("p", null, toDisplayString(userDetail.orgName), 1)]), createVNode(unref(NButton), {
231
231
  strong: "",
@@ -121,7 +121,16 @@ declare const CScaleView: SFCWithInstall<import("vue").DefineComponent<{
121
121
  type: ObjectConstructor;
122
122
  default: () => {};
123
123
  };
124
+ closeConfirm: {
125
+ type: BooleanConstructor;
126
+ default: boolean;
127
+ };
128
+ closeConfirmText: {
129
+ type: StringConstructor;
130
+ default: string;
131
+ };
124
132
  }, {
133
+ dialog: import("naive-ui").DialogApi;
125
134
  ScaleViewState: {
126
135
  other: string;
127
136
  form: {};
@@ -276,6 +285,14 @@ declare const CScaleView: SFCWithInstall<import("vue").DefineComponent<{
276
285
  type: ObjectConstructor;
277
286
  default: () => {};
278
287
  };
288
+ closeConfirm: {
289
+ type: BooleanConstructor;
290
+ default: boolean;
291
+ };
292
+ closeConfirmText: {
293
+ type: StringConstructor;
294
+ default: string;
295
+ };
279
296
  }>> & {
280
297
  onOnCloseSetting?: ((...args: any[]) => any) | undefined;
281
298
  onSubmitNoRequest?: ((...args: any[]) => any) | undefined;
@@ -283,6 +300,15 @@ declare const CScaleView: SFCWithInstall<import("vue").DefineComponent<{
283
300
  onStartWriteScale?: ((...args: any[]) => any) | undefined;
284
301
  }>>;
285
302
  state: any;
303
+ formChecker: {
304
+ setInitialSnapshot: (formData: Record<string, any>) => void;
305
+ checkFormChange: (newFormData?: Record<string, any> | null) => boolean;
306
+ getInitialSnapshot: () => Record<string, any> | null;
307
+ getFormDiff: (newFormData?: Record<string, any> | null) => Record<string, {
308
+ old: any;
309
+ new: any;
310
+ }> | null;
311
+ };
286
312
  emit: (event: "onCloseSetting" | "submitNoRequest" | "onSubmit" | "startWriteScale", ...args: any[]) => void;
287
313
  scaleViewDom: any;
288
314
  countdownDom: any;
@@ -352,7 +378,7 @@ declare const CScaleView: SFCWithInstall<import("vue").DefineComponent<{
352
378
  };
353
379
  onSubmitData: () => void;
354
380
  onSubmitForm: () => Promise<unknown>;
355
- handleScoreJson: () => {};
381
+ handleScoreJson: () => import("../../shared/types").AnyObject;
356
382
  nextLogicEvent: (choiceValue: any, formItem: any, formArray?: any[], isInit?: boolean | undefined) => void;
357
383
  handleDynamicDataRelation: (list: any[], formItem: any, formArray: any[]) => void;
358
384
  scaleChange: (val: any, item: any, config?: any) => void;
@@ -364,8 +390,11 @@ declare const CScaleView: SFCWithInstall<import("vue").DefineComponent<{
364
390
  handleQuery: () => void;
365
391
  init: (configData: any) => Promise<void>;
366
392
  onSubmitDataDebounce: (this: unknown, ...args: any[]) => any;
367
- cancel: () => void;
393
+ getFormChanged: () => boolean;
394
+ beforeCloseFn: () => Promise<unknown>;
395
+ cancel: () => Promise<void>;
368
396
  getScaleData: () => any;
397
+ batchInjectFormNew: (data: import("../../shared/types").AnyObject, skipValid?: boolean) => Promise<void>;
369
398
  isCollection: (e: string) => boolean;
370
399
  NoData: import("vue").DefineComponent<{
371
400
  noDataTip: {
@@ -914,6 +943,14 @@ declare const CScaleView: SFCWithInstall<import("vue").DefineComponent<{
914
943
  type: ObjectConstructor;
915
944
  default: () => {};
916
945
  };
946
+ closeConfirm: {
947
+ type: BooleanConstructor;
948
+ default: boolean;
949
+ };
950
+ closeConfirmText: {
951
+ type: StringConstructor;
952
+ default: string;
953
+ };
917
954
  }>> & {
918
955
  onOnCloseSetting?: ((...args: any[]) => any) | undefined;
919
956
  onSubmitNoRequest?: ((...args: any[]) => any) | undefined;
@@ -947,6 +984,8 @@ declare const CScaleView: SFCWithInstall<import("vue").DefineComponent<{
947
984
  isGeneratePrintPdf: boolean;
948
985
  combinationParmas: Record<string, any>;
949
986
  allQuery: Record<string, any>;
987
+ closeConfirm: boolean;
988
+ closeConfirmText: string;
950
989
  }>>;
951
990
  declare const CRadio: SFCWithInstall<import("vue").DefineComponent<{
952
991
  form: {
@@ -1,3 +1,4 @@
1
+ import { AnyObject } from '../../../shared/types';
1
2
  declare const _default: import("vue").DefineComponent<{
2
3
  guageData: {
3
4
  type: ObjectConstructor;
@@ -119,7 +120,16 @@ declare const _default: import("vue").DefineComponent<{
119
120
  type: ObjectConstructor;
120
121
  default: () => {};
121
122
  };
123
+ closeConfirm: {
124
+ type: BooleanConstructor;
125
+ default: boolean;
126
+ };
127
+ closeConfirmText: {
128
+ type: StringConstructor;
129
+ default: string;
130
+ };
122
131
  }, {
132
+ dialog: import("naive-ui").DialogApi;
123
133
  ScaleViewState: {
124
134
  other: string;
125
135
  form: {};
@@ -274,6 +284,14 @@ declare const _default: import("vue").DefineComponent<{
274
284
  type: ObjectConstructor;
275
285
  default: () => {};
276
286
  };
287
+ closeConfirm: {
288
+ type: BooleanConstructor;
289
+ default: boolean;
290
+ };
291
+ closeConfirmText: {
292
+ type: StringConstructor;
293
+ default: string;
294
+ };
277
295
  }>> & {
278
296
  onOnCloseSetting?: ((...args: any[]) => any) | undefined;
279
297
  onSubmitNoRequest?: ((...args: any[]) => any) | undefined;
@@ -281,6 +299,15 @@ declare const _default: import("vue").DefineComponent<{
281
299
  onStartWriteScale?: ((...args: any[]) => any) | undefined;
282
300
  }>>;
283
301
  state: any;
302
+ formChecker: {
303
+ setInitialSnapshot: (formData: Record<string, any>) => void;
304
+ checkFormChange: (newFormData?: Record<string, any> | null) => boolean;
305
+ getInitialSnapshot: () => Record<string, any> | null;
306
+ getFormDiff: (newFormData?: Record<string, any> | null) => Record<string, {
307
+ old: any;
308
+ new: any;
309
+ }> | null;
310
+ };
284
311
  emit: (event: "onCloseSetting" | "submitNoRequest" | "onSubmit" | "startWriteScale", ...args: any[]) => void;
285
312
  scaleViewDom: any;
286
313
  countdownDom: any;
@@ -341,8 +368,8 @@ declare const _default: import("vue").DefineComponent<{
341
368
  desStart: import("vue").ComputedRef<boolean>;
342
369
  desEnd: import("vue").ComputedRef<boolean>;
343
370
  desContent: import("vue").ComputedRef<any>;
344
- initForm: (data: import("../../../shared/types").AnyObject) => Promise<void> | undefined;
345
- batchInjectForm: (data: import("../../../shared/types").AnyObject, skipValid?: boolean) => Promise<boolean>;
371
+ initForm: (data: AnyObject) => Promise<void> | undefined;
372
+ batchInjectForm: (data: AnyObject, skipValid?: boolean) => Promise<boolean>;
346
373
  submitMethod: () => {
347
374
  params: any;
348
375
  hasCallbackItem: any;
@@ -350,7 +377,7 @@ declare const _default: import("vue").DefineComponent<{
350
377
  };
351
378
  onSubmitData: () => void;
352
379
  onSubmitForm: () => Promise<unknown>;
353
- handleScoreJson: () => {};
380
+ handleScoreJson: () => AnyObject;
354
381
  nextLogicEvent: (choiceValue: any, formItem: any, formArray?: any[], isInit?: boolean | undefined) => void;
355
382
  handleDynamicDataRelation: (list: any[], formItem: any, formArray: any[]) => void;
356
383
  scaleChange: (val: any, item: any, config?: any) => void;
@@ -362,8 +389,11 @@ declare const _default: import("vue").DefineComponent<{
362
389
  handleQuery: () => void;
363
390
  init: (configData: any) => Promise<void>;
364
391
  onSubmitDataDebounce: (this: unknown, ...args: any[]) => any;
365
- cancel: () => void;
392
+ getFormChanged: () => boolean;
393
+ beforeCloseFn: () => Promise<unknown>;
394
+ cancel: () => Promise<void>;
366
395
  getScaleData: () => any;
396
+ batchInjectFormNew: (data: AnyObject, skipValid?: boolean) => Promise<void>;
367
397
  isCollection: (e: string) => boolean;
368
398
  NoData: import("vue").DefineComponent<{
369
399
  noDataTip: {
@@ -912,6 +942,14 @@ declare const _default: import("vue").DefineComponent<{
912
942
  type: ObjectConstructor;
913
943
  default: () => {};
914
944
  };
945
+ closeConfirm: {
946
+ type: BooleanConstructor;
947
+ default: boolean;
948
+ };
949
+ closeConfirmText: {
950
+ type: StringConstructor;
951
+ default: string;
952
+ };
915
953
  }>> & {
916
954
  onOnCloseSetting?: ((...args: any[]) => any) | undefined;
917
955
  onSubmitNoRequest?: ((...args: any[]) => any) | undefined;
@@ -945,5 +983,7 @@ declare const _default: import("vue").DefineComponent<{
945
983
  isGeneratePrintPdf: boolean;
946
984
  combinationParmas: Record<string, any>;
947
985
  allQuery: Record<string, any>;
986
+ closeConfirm: boolean;
987
+ closeConfirmText: string;
948
988
  }>;
949
989
  export default _default;
@@ -17,7 +17,8 @@ import EvaluatePage from './components/EvaluatePage.vue.js';
17
17
  import AnswerParse from './components/AnswerParse.vue.js';
18
18
  import ScaleScore from './components/ScaleScore.js';
19
19
  import DescribeContent from './components/DescribeContent.vue.js';
20
- import { NForm, NFormItem, NButton } from 'naive-ui';
20
+ import { useDialog, NForm, NFormItem, NButton } from 'naive-ui';
21
+ import { useFormChangeWatcher } from './utils/watch-form-change.js';
21
22
 
22
23
  const _hoisted_1 = ["innerHTML"];
23
24
  const _hoisted_2 = {
@@ -50,10 +51,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
50
51
  emit
51
52
  }) {
52
53
  const props = __props;
54
+ const dialog = useDialog();
53
55
  const {
54
56
  ScaleViewState
55
57
  } = getScaleViewState();
56
58
  const state = reactive(ScaleViewState);
59
+ const formChecker = useFormChangeWatcher();
57
60
  const scaleViewDom = ref(null);
58
61
  const countdownDom = ref(null);
59
62
  const formRef = ref(null);
@@ -134,6 +137,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
134
137
  id && (state.shareId = id);
135
138
  };
136
139
  const init = async (configData) => {
140
+ window._beforeCloseFn = null;
137
141
  handleQuery();
138
142
  try {
139
143
  resetNodata();
@@ -144,6 +148,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
144
148
  state.hasFrontAddress = false;
145
149
  setNoData(true, error == null ? void 0 : error.resultMsg, error == null ? void 0 : error.result);
146
150
  }
151
+ if (!props.closeConfirm)
152
+ return;
153
+ formChecker.setInitialSnapshot(state.form);
154
+ window._beforeCloseFn = beforeCloseFn;
147
155
  };
148
156
  watch(() => props.ids, (newVal, oldVal) => {
149
157
  if (oldVal) {
@@ -172,7 +180,58 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
172
180
  immediate: true
173
181
  });
174
182
  const onSubmitDataDebounce = vexutilsExpand.debounce(onSubmitData, 300);
175
- const cancel = () => {
183
+ const getFormChanged = () => {
184
+ return formChecker.checkFormChange(state.form);
185
+ };
186
+ const beforeCloseFn = () => {
187
+ const isChange = getFormChanged();
188
+ if (!isChange)
189
+ return Promise.resolve(true);
190
+ const tips = props.closeConfirmText || "\u786E\u8BA4\u8981\u5173\u95ED\u5F53\u524D\u9875\u9762\u5417\uFF1F";
191
+ return new Promise((resolve) => {
192
+ dialog.warning({
193
+ title: function() {
194
+ var _a, _b, _c;
195
+ try {
196
+ return ((_a = window.getLanguageByCode) == null ? void 0 : _a.call(window, "10010.1.589")) || ((_c = (_b = window.top) == null ? void 0 : _b.getLanguageByCode) == null ? void 0 : _c.call(_b, "10010.1.589")) || "\u63D0\u793A";
197
+ } catch (e) {
198
+ return "\u63D0\u793A";
199
+ }
200
+ }(),
201
+ content: tips,
202
+ positiveText: function() {
203
+ var _a, _b, _c;
204
+ try {
205
+ return ((_a = window.getLanguageByCode) == null ? void 0 : _a.call(window, "10010.1.27")) || ((_c = (_b = window.top) == null ? void 0 : _b.getLanguageByCode) == null ? void 0 : _c.call(_b, "10010.1.27")) || "\u786E\u5B9A";
206
+ } catch (e) {
207
+ return "\u786E\u5B9A";
208
+ }
209
+ }(),
210
+ negativeText: function() {
211
+ var _a, _b, _c;
212
+ try {
213
+ return ((_a = window.getLanguageByCode) == null ? void 0 : _a.call(window, "10010.1.28")) || ((_c = (_b = window.top) == null ? void 0 : _b.getLanguageByCode) == null ? void 0 : _c.call(_b, "10010.1.28")) || "\u53D6\u6D88";
214
+ } catch (e) {
215
+ return "\u53D6\u6D88";
216
+ }
217
+ }(),
218
+ onPositiveClick: () => {
219
+ resolve(true);
220
+ },
221
+ onNegativeClick: () => {
222
+ resolve(false);
223
+ }
224
+ });
225
+ });
226
+ };
227
+ const cancel = async () => {
228
+ if (!props.closeConfirm) {
229
+ emit("onCloseSetting");
230
+ return;
231
+ }
232
+ const closeStatus = await beforeCloseFn();
233
+ if (!closeStatus)
234
+ return;
176
235
  emit("onCloseSetting");
177
236
  };
178
237
  const getScaleData = () => {
@@ -180,11 +239,20 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
180
239
  ...state
181
240
  };
182
241
  };
242
+ const batchInjectFormNew = async (data, skipValid = false) => {
243
+ window._beforeCloseFn = null;
244
+ await batchInjectForm(data, skipValid);
245
+ if (!skipValid || !props.closeConfirm)
246
+ return;
247
+ formChecker.setInitialSnapshot(state.form);
248
+ window._beforeCloseFn = beforeCloseFn;
249
+ };
183
250
  expose({
184
251
  getScaleData,
185
252
  onSubmitForm,
186
253
  cancel,
187
- batchInjectForm
254
+ batchInjectForm: batchInjectFormNew,
255
+ getFormChanged
188
256
  });
189
257
  return (_ctx, _cache) => {
190
258
  return openBlock(), createElementBlock("div", {
@@ -119,4 +119,12 @@ export declare const ScaleViewProps: {
119
119
  type: ObjectConstructor;
120
120
  default: () => {};
121
121
  };
122
+ closeConfirm: {
123
+ type: BooleanConstructor;
124
+ default: boolean;
125
+ };
126
+ closeConfirmText: {
127
+ type: StringConstructor;
128
+ default: string;
129
+ };
122
130
  };
@@ -118,6 +118,14 @@ const ScaleViewProps = {
118
118
  allQuery: {
119
119
  type: Object,
120
120
  default: () => ({})
121
+ },
122
+ closeConfirm: {
123
+ type: Boolean,
124
+ default: false
125
+ },
126
+ closeConfirmText: {
127
+ type: String,
128
+ default: ""
121
129
  }
122
130
  };
123
131
 
@@ -1,3 +1,4 @@
1
+ import { AnyObject } from '../../../../shared/types';
1
2
  export declare const ScaleViewSubmit: (props: any, state: any, emit: any, config: any) => {
2
3
  submitMethod: () => {
3
4
  params: any;
@@ -7,5 +8,5 @@ export declare const ScaleViewSubmit: (props: any, state: any, emit: any, config
7
8
  confirmSubmit: (message: any) => void;
8
9
  onSubmitForm: () => Promise<unknown>;
9
10
  onSubmitData: () => void;
10
- handleScoreJson: () => {};
11
+ handleScoreJson: () => AnyObject;
11
12
  };
@@ -1,8 +1,9 @@
1
+ import { AnyObject } from '../../../../shared/types';
1
2
  export declare const isOnlyOptions: (e: string) => boolean;
2
3
  export declare const isSortItem: (item: any) => any;
3
4
  export declare const isCollection: (e: string) => boolean;
4
5
  export declare const isEvaluation: (e: string) => boolean;
5
- export declare const handleQueryParams: () => {};
6
+ export declare const handleQueryParams: () => AnyObject;
6
7
  export declare const getQueryVariable: (variable: any, state: any, params: any) => any;
7
8
  export declare const formatMap: {
8
9
  datetime: string;
@@ -49,18 +49,18 @@ const getQueryVariable = (variable, state, params) => {
49
49
  return query[variable] || false;
50
50
  };
51
51
  const formatMap = {
52
- "datetime": "yyyy-MM-dd HH:mm:ss",
53
- "datehour": "yyyy-MM-dd HH:mm",
54
- "date": "yyyy-MM-dd",
55
- "time": "HH:mm:ss",
56
- "hour": "HH:mm"
52
+ datetime: "yyyy-MM-dd HH:mm:ss",
53
+ datehour: "yyyy-MM-dd HH:mm",
54
+ date: "yyyy-MM-dd",
55
+ time: "HH:mm:ss",
56
+ hour: "HH:mm"
57
57
  };
58
58
  const valueReg = {
59
- "datetime": /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,
60
- "datehour": /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2})$/,
61
- "date": /^(\d{4})-(\d{2})-(\d{2})$/,
62
- "time": /^(\d{2}):(\d{2}):(\d{2})$/,
63
- "hour": /^(\d{2}):(\d{2})$/
59
+ datetime: /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/,
60
+ datehour: /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2})$/,
61
+ date: /^(\d{4})-(\d{2})-(\d{2})$/,
62
+ time: /^(\d{2}):(\d{2}):(\d{2})$/,
63
+ hour: /^(\d{2}):(\d{2})$/
64
64
  };
65
65
  const transDbvalueFormat = /* @__PURE__ */ new Map([["datetime", ["datetime", "datehour", "date", "time", "hour"]], ["datehour", ["datetime", "datehour", "date", "time", "hour"]], ["date", ["date"]], ["time", ["time", "hour"]], ["hour", ["time", "hour"]]]);
66
66
 
@@ -0,0 +1,13 @@
1
+ /**
2
+ * 表单变更检查器
3
+ * 用于手动检查表单对象是否发生实际变更
4
+ */
5
+ export declare function useFormChangeWatcher<T extends Record<string, any>>(): {
6
+ setInitialSnapshot: (formData: T) => void;
7
+ checkFormChange: (newFormData?: T | null) => boolean;
8
+ getInitialSnapshot: () => T | null;
9
+ getFormDiff: (newFormData?: T | null) => Record<string, {
10
+ old: any;
11
+ new: any;
12
+ }> | null;
13
+ };
@@ -0,0 +1,71 @@
1
+ import { cloneDeep, isEqual } from 'lodash-es';
2
+
3
+ function customIsEqual(newValue, oldValue) {
4
+ if (isArrayEmpty(newValue) && (isArrayEmpty(oldValue) || oldValue === "")) {
5
+ return true;
6
+ }
7
+ if (typeof newValue === "object" && typeof oldValue === "object" && newValue !== null && oldValue !== null) {
8
+ if (Array.isArray(newValue) && Array.isArray(oldValue)) {
9
+ return isEqual(newValue, oldValue);
10
+ } else if (!Array.isArray(newValue) && !Array.isArray(oldValue)) {
11
+ const newKeys = Object.keys(newValue);
12
+ const oldKeys = Object.keys(oldValue);
13
+ if (newKeys.length !== oldKeys.length) {
14
+ return false;
15
+ }
16
+ for (const key of newKeys) {
17
+ if (!oldKeys.includes(key) || !customIsEqual(newValue[key], oldValue[key])) {
18
+ return false;
19
+ }
20
+ }
21
+ return true;
22
+ }
23
+ }
24
+ return isEqual(newValue, oldValue);
25
+ }
26
+ function isArrayEmpty(value) {
27
+ return value === null || Array.isArray(value) && value.length === 0;
28
+ }
29
+ function useFormChangeWatcher() {
30
+ let initialSnapshot = null;
31
+ const setInitialSnapshot = (formData) => {
32
+ initialSnapshot = cloneDeep(formData);
33
+ };
34
+ const checkFormChange = (newFormData = null) => {
35
+ if (!initialSnapshot) {
36
+ return false;
37
+ }
38
+ return !customIsEqual(newFormData, initialSnapshot);
39
+ };
40
+ const getInitialSnapshot = () => {
41
+ return initialSnapshot ? cloneDeep(initialSnapshot) : null;
42
+ };
43
+ const getFormDiff = (newFormData = null) => {
44
+ if (!initialSnapshot)
45
+ return null;
46
+ if (!newFormData)
47
+ return null;
48
+ const current = newFormData;
49
+ const diff = {};
50
+ const allKeys = /* @__PURE__ */ new Set([...Object.keys(initialSnapshot), ...Object.keys(current)]);
51
+ allKeys.forEach((key) => {
52
+ const oldValue = initialSnapshot[key];
53
+ const newValue = current[key];
54
+ if (!customIsEqual(oldValue, newValue)) {
55
+ diff[key] = {
56
+ old: oldValue,
57
+ new: newValue
58
+ };
59
+ }
60
+ });
61
+ return Object.keys(diff).length > 0 ? diff : null;
62
+ };
63
+ return {
64
+ setInitialSnapshot,
65
+ checkFormChange,
66
+ getInitialSnapshot,
67
+ getFormDiff
68
+ };
69
+ }
70
+
71
+ export { useFormChangeWatcher };
package/es/env.d.ts CHANGED
@@ -1,25 +1,25 @@
1
- /// <reference types="vite/client" />
2
-
3
- interface ImportMetaEnv {
4
- readonly VITE_APP_TYPE: string;
5
- // 更多环境变量...
6
- }
7
-
8
- interface ImportMeta {
9
- readonly env: ImportMetaEnv;
10
- }
11
-
12
- declare module '*.vue' {
13
- // @ts-ignore
14
- import type { App, defineComponent } from 'vue';
15
- // // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
16
- // // const component: DefineComponent<{}, {}, any>
17
- const component: ReturnType<typeof defineComponent> & {
18
- install(app: App): void;
19
- };
20
- // @ts-ignore
21
- export default component;
22
- }
23
-
24
- declare module '*.js';
25
-
1
+ /// <reference types="vite/client" />
2
+
3
+ interface ImportMetaEnv {
4
+ readonly VITE_APP_TYPE: string;
5
+ // 更多环境变量...
6
+ }
7
+
8
+ interface ImportMeta {
9
+ readonly env: ImportMetaEnv;
10
+ }
11
+
12
+ declare module '*.vue' {
13
+ // @ts-ignore
14
+ import type { App, defineComponent } from 'vue';
15
+ // // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
16
+ // // const component: DefineComponent<{}, {}, any>
17
+ const component: ReturnType<typeof defineComponent> & {
18
+ install(app: App): void;
19
+ };
20
+ // @ts-ignore
21
+ export default component;
22
+ }
23
+
24
+ declare module '*.js';
25
+
@@ -1,5 +1,5 @@
1
1
  var name = "@cnhis-design-vue/shared";
2
- var version = "3.3.3-beta.17";
2
+ var version = "3.3.3-beta.18";
3
3
  var main = "index.ts";
4
4
  var peerDependencies = {
5
5
  "naive-ui": "^2.30.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.3.3-beta.17",
3
+ "version": "3.3.3-beta.18",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -73,5 +73,5 @@
73
73
  "iOS 7",
74
74
  "last 3 iOS versions"
75
75
  ],
76
- "gitHead": "0d880d0cf4e8c9cd7b840848e4e01d8caaf48efd"
76
+ "gitHead": "60b93bcb3be0dacf681ca0a670b049a8eb767539"
77
77
  }