cnhis-design-vue 3.1.50-beta.9 → 3.1.50-release.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.
Files changed (72) hide show
  1. package/README.md +87 -87
  2. package/es/components/card-reader-sdk/src/cardReaderSDK.d.ts +0 -1
  3. package/es/components/card-reader-sdk/src/cardReaderSDK.js +1 -1
  4. package/es/components/card-reader-sdk/src/insuranceSDK.js +1 -1
  5. package/es/components/card-reader-sdk/src/utils/index.d.ts +3 -0
  6. package/es/components/card-reader-sdk/src/utils/index.js +1 -1
  7. package/es/components/classification/index.d.ts +1 -3
  8. package/es/components/classification/src/components/search-filter/index.vue.d.ts +1 -3
  9. package/es/components/classification/src/components/set-classification/index.vue.d.ts +1 -3
  10. package/es/components/classification/src/index.vue.d.ts +1 -3
  11. package/es/components/expand-field/src/components/form.vue2.js +1 -1
  12. package/es/components/expand-field/src/index.vue2.js +1 -1
  13. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
  14. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
  15. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
  16. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
  17. package/es/components/field-set/src/FieldSet.vue2.js +1 -1
  18. package/es/components/form-render/src/components/renderer/radio_checkbox.js +1 -1
  19. package/es/components/form-render/src/components/renderer/select.d.ts +0 -9
  20. package/es/components/form-render/src/components/renderer/select.js +1 -1
  21. package/es/components/form-render/style/index.css +1 -1
  22. package/es/components/iho-table/index.js +1 -1
  23. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue.d.ts +3 -297
  24. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue2.js +1 -1
  25. package/es/components/iho-table/src/plugins/filterRenderPlugin/index.js +1 -1
  26. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/inputRendererPlugin.js +1 -1
  27. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/numberRendererPlugin.js +1 -1
  28. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
  29. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/index.js +1 -1
  30. package/es/components/iho-table/src/types/index.d.ts +4 -13
  31. package/es/components/iho-table/src/utils/index.d.ts +1 -1
  32. package/es/components/iho-table/src/utils/index.js +1 -1
  33. package/es/components/iho-table/style/index.css +1 -1
  34. package/es/components/index.css +1 -1
  35. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  36. package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
  37. package/es/components/select-person/src/SearchMultiple.vue.d.ts +6 -0
  38. package/es/components/table-export-field/src/components/ExportModal.vue.d.ts +0 -3
  39. package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue.d.ts +0 -2
  40. package/es/components/table-filter/src/components/classify-filter/components/Date.vue.d.ts +0 -1
  41. package/es/components/table-filter/src/components/classify-filter/components/Date.vue2.js +1 -1
  42. package/es/components/table-filter/src/components/classify-filter/components/DateRange.vue.d.ts +0 -1
  43. package/es/components/table-filter/src/components/classify-filter/components/DateRange.vue2.js +1 -1
  44. package/es/components/table-filter/src/components/classify-filter/components/index.d.ts +0 -2
  45. package/es/components/table-filter/src/components/classify-filter/index.vue.d.ts +1 -3
  46. package/es/components/table-filter/src/components/classify-filter/index.vue2.js +1 -1
  47. package/es/env.d.ts +25 -25
  48. package/es/shared/assets/img/failure.png.js +1 -1
  49. package/es/shared/assets/img/no-permission.png.js +1 -1
  50. package/es/shared/assets/img/nodata.png.js +1 -1
  51. package/es/shared/assets/img/notfound.png.js +1 -1
  52. package/es/shared/assets/img/qr.png.js +1 -1
  53. package/es/shared/assets/img/success.png.js +1 -1
  54. package/es/shared/assets/img/video.png.js +1 -1
  55. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  56. package/es/shared/assets/img/xb_big.png.js +1 -1
  57. package/es/shared/assets/img/xb_small.png.js +1 -1
  58. package/es/shared/package.json.js +1 -1
  59. package/package.json +2 -2
  60. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  61. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  62. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  63. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  64. package/es/components/iho-table/src/utils/separateMap.d.ts +0 -5
  65. package/es/components/iho-table/src/utils/separateMap.js +0 -1
  66. package/es/shared/components/CancelRadio/CancelRadio.d.ts +0 -10
  67. package/es/shared/components/CancelRadio/CancelRadio.js +0 -1
  68. package/es/shared/components/CancelRadio/index.d.ts +0 -2
  69. package/es/shared/components/CancelRadio/index.js +0 -1
  70. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  71. package/es/shared/utils/fabricjs/index.d.ts +0 -6823
  72. package/es/shared/utils/tapable/index.d.ts +0 -139
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
+ ```
@@ -12,7 +12,6 @@ export default class CardReaderSDK {
12
12
  constructor(options: InsuranceType.CardReadOptions);
13
13
  private get basicParamsRes();
14
14
  static create(options?: InsuranceType.CardReadOptions): CardReaderSDK;
15
- static destroy(): void;
16
15
  destroy(): void;
17
16
  private createParams;
18
17
  private checkLoading;
@@ -1 +1 @@
1
- import{isFunction as a}from"lodash-es";import{TRANS_CMD as t}from"./constants/index.js";import e from"./insuranceSDK.js";import{ReadHealthCard as r}from"./utils/readHealthCard.js";let s=null;const n=class{constructor(a){if(this.options=a,this.loading=!1,this.readHealthCardDialog=new r,s)return s;s=this,this.insurance=new e}get basicParamsRes(){return a(this.options.basicParams)?this.options.basicParams():this.options.basicParams}static create(a={}){return new n(a)}static destroy(){null==s||s.destroy(),s=null}destroy(){this.insurance.destroy()}createParams(a,t,e){var r,s;const{operatorname:n,operatorcode:i,...o}=this.basicParamsRes||{};return{transcmd:a,operatorname:null!=(r=t.operatorname)?r:n,operatorcode:null!=(s=t.operatorcode)?s:i,...o,...e}}checkLoading(){if(this.loading)return Promise.reject("请勿重复操作")}async checkResCodeAndLoading(a){try{this.loading=!0;const t=await a;return 3===t.returncode||"3"===t.returncode?Promise.reject(`${t.returnmsg||"操作失败"}`):t.returndata}finally{this.loading=!1}}async readHealthCard(a,t){return await this.checkLoading(),this.readHealthCardDialog.show({instance:a,...t})}async readIdCard(a={}){await this.checkLoading();const e=this.createParams(t.ID_CARD_READ,a,{transtype:"IDCARD",interfaceid:"0",...a,transdata:{readtype:"2",...a.transdata}});return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(e))}async readMemberCard(a={}){await this.checkLoading();const e=this.createParams(t.MEMBER_CARD_READ,a,{transsystem:"10",transtype:"IDCARD",interfaceid:"0",...a,transdata:{readtype:"1",...a.transdata}});return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(e))}async writeMemberCard(a={}){await this.checkLoading();const e=this.createParams(t.MEMBER_CARD_WRITE,a,{transsystem:"10",transtype:"IDCARD",interfaceid:"0",...a,transdata:{readtype:"1",...a.transdata}});return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(e))}async readInsuranceCard(a={}){var e,r;await this.checkLoading();const s=this.createParams(t.NS_GETPERSONALINFO,a,{transchannel:"101",interfaceid:a.interfaceid,transtype:"YB0000",transdata:{...a.transdata,iar1:{...(null==(e=a.transdata)?void 0:e.iar1)||{acf01:"0",iak22:"0"}},personinfo:{...(null==(r=a.transdata)?void 0:r.personinfo)||{location:0,ownpay:"0"}}}});return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(s))}async generalRequest(a={}){await this.checkLoading();const e=this.createParams(t.NS_GETPERSONALINFO,a);return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(e))}};let i=n;i.version=1,i.TRANS_CMD=t;export{i as default};
1
+ import{isFunction as a}from"lodash-es";import{TRANS_CMD as e}from"./constants/index.js";import t from"./insuranceSDK.js";import{ReadHealthCard as r}from"./utils/readHealthCard.js";let s=null;const n=class{constructor(a){if(this.options=a,this.loading=!1,this.readHealthCardDialog=new r,s)return s;s=this,this.insurance=new t}get basicParamsRes(){return a(this.options.basicParams)?this.options.basicParams():this.options.basicParams}static create(a={}){return new n(a)}destroy(){this.insurance.destroy()}createParams(a,e,t){var r,s;const{operatorname:n,operatorcode:i,...o}=this.basicParamsRes||{};return{transcmd:a,operatorname:null!=(r=e.operatorname)?r:n,operatorcode:null!=(s=e.operatorcode)?s:i,...o,...t}}checkLoading(){if(this.loading)return Promise.reject("请勿重复操作")}async checkResCodeAndLoading(a){try{this.loading=!0;const e=await a;return 3===e.returncode||"3"===e.returncode?Promise.reject(`${e.returnmsg||"操作失败"}`):e.returndata}finally{this.loading=!1}}async readHealthCard(a,e){return await this.checkLoading(),this.readHealthCardDialog.show({instance:a,...e})}async readIdCard(a={}){await this.checkLoading();const t=this.createParams(e.ID_CARD_READ,a,{transtype:"IDCARD",interfaceid:"0",...a,transdata:{readtype:"2",...a.transdata}});return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(t))}async readMemberCard(a={}){await this.checkLoading();const t=this.createParams(e.MEMBER_CARD_READ,a,{transsystem:"10",transtype:"IDCARD",interfaceid:"0",...a,transdata:{readtype:"1",...a.transdata}});return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(t))}async writeMemberCard(a={}){await this.checkLoading();const t=this.createParams(e.MEMBER_CARD_WRITE,a,{transsystem:"10",transtype:"IDCARD",interfaceid:"0",...a,transdata:{readtype:"1",...a.transdata}});return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(t))}async readInsuranceCard(a={}){var t,r;await this.checkLoading();const s=this.createParams(e.NS_GETPERSONALINFO,a,{transchannel:"101",interfaceid:a.interfaceid,transtype:"YB0000",transdata:{...a.transdata,iar1:{...(null==(t=a.transdata)?void 0:t.iar1)||{acf01:"0",iak22:"0"}},personinfo:{...(null==(r=a.transdata)?void 0:r.personinfo)||{location:0,ownpay:"0"}}}});return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(s))}async generalRequest(a={}){await this.checkLoading();const t=this.createParams(e.NS_GETPERSONALINFO,a);return this.checkResCodeAndLoading(this.insurance.getInsuranceInfoPromise(t))}};let i=n;i.version=1,i.TRANS_CMD=e;export{i as default};
@@ -1 +1 @@
1
- import{jsonParse as e}from"../../../shared/utils/index.js";import s from"axios";import{isString as t,omit as r}from"lodash-es";import{INSURANCE_URL as i,CONFIG_MAP as n,TRANS_CMD as a}from"./constants/index.js";import{insuranceLog as o,getErrorMessageByType as l,getTranstime as d,getSerialNumber as u}from"./utils/index.js";var c;class m{constructor(e){var s,t;this.webview=null==(c=window.chrome)?void 0:c.webview,this.requestParams=null,this.currentMessageHandler=null,this.messageHandlerQueue=[],(null==e?void 0:e.selfWindow)&&(this.webview=null==(t=null==(s=null==e?void 0:e.selfWindow)?void 0:s.chrome)?void 0:t.webview),this.webview&&(this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler))}messageHandler(s){const r=this.messageHandlerQueue.shift();if(!r)return Promise.reject(o("当前回执",s,"没有可用的handler"));const{resolve:i,reject:n,transcmd:a}=r,l=t(s.data)?e(s.data)||{}:s.data;if(!l||!["hisyb","login"].includes(l.exec))return n(o("当前回执不是hisyb消息"));const{transcmd:d}=l.res||{};if(a&&d&&`${a}`!=`${d}`)return n(o("交易命令不相等,当前transcmd",a,"返回transcmd",d));i(l)}async postMessage(s){return this.webview&&s?new Promise(((t,r)=>{var i;this.messageHandlerQueue.push({resolve:t,reject:r,transcmd:null==(i=e(s.data))?void 0:i.transcmd}),this.webview.postMessage(s)})).then((e=>e&&e.result&&e.exec===s.exec?e:Promise.reject())):Promise.reject()}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=null)}login(){var e,s;return this.postMessage({exec:"login",data:null!=(s=null==(e=this.requestParams)?void 0:e.loginCode)?s:"7777"})}async HOInterfaceSvr(e){const{transcmd:t,needLogin:n}=this.requestParams||{};try{if(this.webview){n&&await this.login();return(await this.postMessage({exec:"hisyb",data:JSON.stringify(r(e,["needLogin"]))})).res}return(await s.post(i,JSON.stringify(r(e,["needLogin"])))).data}catch(e){return Promise.reject(l(t))}}initConfig(e){this.requestParams=Object.assign({},n,e)}initParams(){var e,s;return{...this.requestParams,transcmd:null!=(s=null==(e=this.requestParams)?void 0:e.transcmd)?s:a.NS_GETPERSONALINFO,transtime:d(),serialnumber:u()}}getInsuranceInfoPromise(e){return this.initConfig(e),this.HOInterfaceSvr(this.initParams())}}export{m as default};
1
+ import{jsonParse as e}from"../../../shared/utils/index.js";import s from"axios";import{isString as t,omit as r}from"lodash-es";import{INSURANCE_URL as i,CONFIG_MAP as n,TRANS_CMD as a}from"./constants/index.js";import{insuranceLog as o,getDataMessageByData as l,getErrorMessageByType as d,getTranstime as u,getSerialNumber as c}from"./utils/index.js";var m;class h{constructor(e){var s,t;this.webview=null==(m=window.chrome)?void 0:m.webview,this.requestParams=null,this.currentMessageHandler=null,this.messageHandlerQueue=[],(null==e?void 0:e.selfWindow)&&(this.webview=null==(t=null==(s=null==e?void 0:e.selfWindow)?void 0:s.chrome)?void 0:t.webview),this.webview&&(this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler))}messageHandler(s){const r=this.messageHandlerQueue.shift();if(!r)return Promise.reject(o("当前回执",s,"没有可用的handler"));const{resolve:i,reject:n,transcmd:a}=r,l=t(s.data)?e(s.data)||{}:s.data;if(!l||!["hisyb","login"].includes(l.exec))return n(o("当前回执不是hisyb消息"));const{transcmd:d}=l.res||{};if(a&&d&&`${a}`!=`${d}`)return n(o("交易命令不相等,当前transcmd",a,"返回transcmd",d));i(l)}async postMessage(s){return this.webview&&s?new Promise(((t,r)=>{var i;this.messageHandlerQueue.push({resolve:t,reject:r,transcmd:null==(i=e(s.data))?void 0:i.transcmd}),this.webview.postMessage(s)})).then((e=>e&&e.result&&e.exec===s.exec?e:Promise.reject())):Promise.reject()}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=null)}login(){var e,s;return this.postMessage({exec:"login",data:null!=(s=null==(e=this.requestParams)?void 0:e.loginCode)?s:"7777"})}async HOInterfaceSvr(e){const{transcmd:t,needLogin:n}=this.requestParams||{};try{if(this.webview){n&&await this.login();return(await this.postMessage({exec:"hisyb",data:JSON.stringify(r(e,["needLogin"]))})).res}const t=await s.post(i,JSON.stringify(r(e,["needLogin"])));return l(t.data)}catch(e){return Promise.reject(d(t))}}initConfig(e){this.requestParams=Object.assign({},n,e)}initParams(){var e,s;return{...this.requestParams,transcmd:null!=(s=null==(e=this.requestParams)?void 0:e.transcmd)?s:a.NS_GETPERSONALINFO,transtime:u(),serialnumber:c()}}getInsuranceInfoPromise(e){return this.initConfig(e),this.HOInterfaceSvr(this.initParams())}}export{h as default};
@@ -1,6 +1,9 @@
1
+ import { AnyObject } from '../../../../../es/shared/types';
2
+ import { CONFIG_MAP } from '../constants';
1
3
  export declare function getSerialNumber(): string;
2
4
  export declare function getTranstime(): string;
3
5
  export declare function pad2(n: number): string | number;
4
6
  export declare function generateTimeRequestNumber(): string;
5
7
  export declare function insuranceLog(...messages: any[]): any;
6
8
  export declare function getErrorMessageByType(code?: number): string;
9
+ export declare function getDataMessageByData(_data: string | AnyObject, configMap?: typeof CONFIG_MAP): any;
@@ -1 +1 @@
1
- import{TRANS_CMD as t}from"../constants/index.js";function n(){function t(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}function e(){return o()+parseInt(1e3*Math.random()+"")}function r(t){return t<10?"0"+t:t}function o(){const t=new Date;return t.getFullYear().toString()+r(t.getMonth()+1)+r(t.getDate())+r(t.getHours())+r(t.getMinutes())+r(t.getSeconds())}function u(...t){return console.log("[INSURANCE-SDK]: ",...t),t.reduce(((t,n)=>t+n))}const c={[t.ID_CARD_READ]:"身份证读卡接口服务异常",[t.MEMBER_CARD_READ]:"会员读卡接口服务异常",[t.FAST_REPORT_OR_POS]:"打印或pos接口服务异常"};function i(t){return t&&c[t]||"请检查医保服务是否正常"}export{o as generateTimeRequestNumber,i as getErrorMessageByType,n as getSerialNumber,e as getTranstime,u as insuranceLog,r as pad2};
1
+ import{jsonParse as e}from"../../../../shared/utils/index.js";import{isString as t}from"lodash-es";import{TRANS_CMD as n}from"../constants/index.js";function r(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}function o(){return d()+parseInt(1e3*Math.random()+"")}function a(e){return e<10?"0"+e:e}function d(){const e=new Date;return e.getFullYear().toString()+a(e.getMonth()+1)+a(e.getDate())+a(e.getHours())+a(e.getMinutes())+a(e.getSeconds())}function i(...e){return console.log("[INSURANCE-SDK]: ",...e),e.reduce(((e,t)=>e+t))}const s={[n.ID_CARD_READ]:"身份证读卡接口服务异常",[n.MEMBER_CARD_READ]:"会员读卡接口服务异常",[n.FAST_REPORT_OR_POS]:"打印或pos接口服务异常"};function u(e){return e&&s[e]||"请检查医保服务是否正常"}function c(r,o){var a;t(r)&&(r=JSON.parse(r));const d=r,{transcmd:i=n.NS_GETPERSONALINFO}=o||{};if(["0","1"].includes(null!=(a=d.returncode)?a:"")){if(i===n.NS_GETPERSONALINFO)return d.returndata.cardinfo&&d.returndata.cardinfo.cardno?d.returndata.cardinfo:Promise.reject("未获取到卡号");if(i===n.ID_CARD_READ){const n=t(d.returndata)?e(d.returndata).cardinfo:d.returndata.cardinfo;return Object.assign(n,{Sex:n.sex,Sex_Code:n.sex_code,Name:n.name,Age:n.age,Age_Code:n.age_code,Age_Name:n.age_name,BirthDate:n.birthdate,Nation_Name:n.nation_name,Nation_Code:n.nation_code,Address:n.address,CardNo:n.cardno,HasPhoto:n.hasphoto}),n}return d}return Promise.reject(d.returnmsg)}export{d as generateTimeRequestNumber,c as getDataMessageByData,u as getErrorMessageByType,r as getSerialNumber,o as getTranstime,i as insuranceLog,a as pad2};
@@ -684,7 +684,7 @@ declare const CClassification: SFCWithInstall<import("vue").DefineComponent<{
684
684
  value: any;
685
685
  unit: any;
686
686
  }[];
687
- findConditionByDisplayCategory: (sid: string) => unknown;
687
+ findConditionByDisplayCategory: (displayCategory: string) => unknown;
688
688
  handleDisplayCategorySelectProxy: (item: import("..").ICategoryItemType) => void;
689
689
  clearFormData: () => void;
690
690
  handleInitConditions: () => Promise<void>;
@@ -784,7 +784,6 @@ declare const CClassification: SFCWithInstall<import("vue").DefineComponent<{
784
784
  label: string;
785
785
  value: string;
786
786
  }[]>;
787
- initMounted: () => void;
788
787
  isDateDisabled: (ts: number) => boolean;
789
788
  timeDisabled: (ts: number) => {
790
789
  isHourDisabled(hour: number): boolean | undefined;
@@ -1336,7 +1335,6 @@ declare const CClassification: SFCWithInstall<import("vue").DefineComponent<{
1336
1335
  value: string;
1337
1336
  }[]>;
1338
1337
  presetValCp: import("vue").WritableComputedRef<string>;
1339
- initMounted: () => void;
1340
1338
  handleChange: (val: any, type: "end" | "start") => void;
1341
1339
  isStartDateDisabled: (ts: number) => boolean;
1342
1340
  timeStartDisabled: (ts: number) => {
@@ -161,7 +161,7 @@ declare const _default: import("vue").DefineComponent<{
161
161
  value: any;
162
162
  unit: any;
163
163
  }[];
164
- findConditionByDisplayCategory: (sid: string) => unknown;
164
+ findConditionByDisplayCategory: (displayCategory: string) => unknown;
165
165
  handleDisplayCategorySelectProxy: (item: import("../../../..").ICategoryItemType) => void;
166
166
  clearFormData: () => void;
167
167
  handleInitConditions: () => Promise<void>;
@@ -261,7 +261,6 @@ declare const _default: import("vue").DefineComponent<{
261
261
  label: string;
262
262
  value: string;
263
263
  }[]>;
264
- initMounted: () => void;
265
264
  isDateDisabled: (ts: number) => boolean;
266
265
  timeDisabled: (ts: number) => {
267
266
  isHourDisabled(hour: number): boolean | undefined;
@@ -813,7 +812,6 @@ declare const _default: import("vue").DefineComponent<{
813
812
  value: string;
814
813
  }[]>;
815
814
  presetValCp: import("vue").WritableComputedRef<string>;
816
- initMounted: () => void;
817
815
  handleChange: (val: any, type: "end" | "start") => void;
818
816
  isStartDateDisabled: (ts: number) => boolean;
819
817
  timeStartDisabled: (ts: number) => {
@@ -471,7 +471,7 @@ declare const _default: import("vue").DefineComponent<{
471
471
  value: any;
472
472
  unit: any;
473
473
  }[];
474
- findConditionByDisplayCategory: (sid: string) => unknown;
474
+ findConditionByDisplayCategory: (displayCategory: string) => unknown;
475
475
  handleDisplayCategorySelectProxy: (item: import("../../../../../../es/components/table-filter/src/types").ICategoryItemType) => void;
476
476
  clearFormData: () => void;
477
477
  handleInitConditions: () => Promise<void>;
@@ -571,7 +571,6 @@ declare const _default: import("vue").DefineComponent<{
571
571
  label: string;
572
572
  value: string;
573
573
  }[]>;
574
- initMounted: () => void;
575
574
  isDateDisabled: (ts: number) => boolean;
576
575
  timeDisabled: (ts: number) => {
577
576
  isHourDisabled(hour: number): boolean | undefined;
@@ -1123,7 +1122,6 @@ declare const _default: import("vue").DefineComponent<{
1123
1122
  value: string;
1124
1123
  }[]>;
1125
1124
  presetValCp: import("vue").WritableComputedRef<string>;
1126
- initMounted: () => void;
1127
1125
  handleChange: (val: any, type: "end" | "start") => void;
1128
1126
  isStartDateDisabled: (ts: number) => boolean;
1129
1127
  timeStartDisabled: (ts: number) => {
@@ -685,7 +685,7 @@ declare const _default: import("vue").DefineComponent<{
685
685
  value: any;
686
686
  unit: any;
687
687
  }[];
688
- findConditionByDisplayCategory: (sid: string) => unknown;
688
+ findConditionByDisplayCategory: (displayCategory: string) => unknown;
689
689
  handleDisplayCategorySelectProxy: (item: import("../../../../es/components/table-filter/src/types").ICategoryItemType) => void;
690
690
  clearFormData: () => void;
691
691
  handleInitConditions: () => Promise<void>;
@@ -785,7 +785,6 @@ declare const _default: import("vue").DefineComponent<{
785
785
  label: string;
786
786
  value: string;
787
787
  }[]>;
788
- initMounted: () => void;
789
788
  isDateDisabled: (ts: number) => boolean;
790
789
  timeDisabled: (ts: number) => {
791
790
  isHourDisabled(hour: number): boolean | undefined;
@@ -1337,7 +1336,6 @@ declare const _default: import("vue").DefineComponent<{
1337
1336
  value: string;
1338
1337
  }[]>;
1339
1338
  presetValCp: import("vue").WritableComputedRef<string>;
1340
- initMounted: () => void;
1341
1339
  handleChange: (val: any, type: "end" | "start") => void;
1342
1340
  isStartDateDisabled: (ts: number) => boolean;
1343
1341
  timeStartDisabled: (ts: number) => {
@@ -1 +1 @@
1
- import{defineComponent as e,ref as l,inject as a,computed as t,watch as u,openBlock as n,createBlock as i,unref as o,normalizeClass as v,isRef as d,withCtx as r,createVNode as s,normalizeStyle as p,createElementVNode as f,createTextVNode as m,createCommentVNode as c,createElementBlock as y,Fragment as h,renderList as _,withDirectives as g,withKeys as b,withModifiers as x,vShow as k,toDisplayString as M}from"vue";import{useMessage as w,NModal as H,NCard as C,NButton as U,NForm as S,NFormItem as j,NInput as O,NTooltip as I,NSelect as z,NGrid as T,NGridItem as N,NIcon as Y,NInputNumber as $,NPopover as L,NDatePicker as V,NTimePicker as B,NSwitch as D}from"naive-ui";import{isMulti as F,isShowOptions as P,isNumber as q,isDate as A,isCandidate as E,isTextarea as J}from"../utils/index.js";import K from"moment";import{InjectionExpandFieldApiConfig as R}from"../constants/index.js";import W from"../hooks/useAsyncData.js";import{HtmlTypeList as X}from"../utils/constant.js";import{isJSON as G,isValidDate as Q}from"../utils/tool.js";import Z from"./FormBatchOptionsModal.vue.js";import ee from"./FormItemPerson.vue.js";const le={class:"svg-wrap"},ae={class:"flex_right"},te={class:"options-title"},ue=f("span",null,"字段键名",-1),ne=f("i",{class:"iconfont-expand-field icon-expand-field-help"},null,-1),ie={class:"options-title"},oe=f("span",null,"字段问号提示",-1),ve=f("i",{class:"iconfont-expand-field icon-expand-field-help"},null,-1),de={class:"options-title"},re=f("span",null,"选项值",-1),se=f("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 32 32"},[f("path",{d:"M12 12h2v12h-2z",fill:"currentColor"}),f("path",{d:"M18 12h2v12h-2z",fill:"currentColor"}),f("path",{d:"M4 6v2h2v20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8h2V6zm4 22V8h16v20z",fill:"currentColor"}),f("path",{d:"M12 2h8v2h-8z",fill:"currentColor"})],-1),pe={class:"options-title"},fe=f("span",null,"默认值",-1),me=f("i",{class:"iconfont-expand-field icon-expand-field-help"},null,-1),ce={style:{display:"flex","align-items":"center"}},ye=f("span",null,"选择",-1),he={style:{width:"100%"}},_e={key:0,class:"validate_tip"};var ge=e({__name:"form",props:{visible:{type:Boolean,default:!1},formOntype:{type:String,default:"add"},formItemData:{type:Object,default:()=>({})},id:{type:String,default:""},orgId:{type:String,default:""},conditionList:{type:Array,default:()=>[]},searchFieldList:{type:Array,default:()=>[]}},emits:["cancelModal"],setup(e,{emit:ge}){const be=e,xe=w(),ke="请输入默认值",Me={name:[{required:!0,message:"请输入字段标题",trigger:["input","blur"]}],html_type:[{required:!0,message:"请选择字段类型",trigger:["input","blur"]}]},we=[{value:"yyyy-MM-dd HH:mm:ss",label:"年-月-日 时:分:秒"},{value:"yyyy-MM-dd HH:mm",label:"年-月-日 时:分"},{value:"yyyy-MM-dd",label:"年-月-日"},{value:"yyyy-MM",label:"年-月"},{value:"MM-dd HH:mm",label:"月-日 时:分"},{value:"MM-dd",label:"月-日"},{value:"HH:mm:ss",label:"时:分:秒"},{value:"HH:mm",label:"时:分"}],He=[{value:"12",label:"整行"},{value:"6",label:"半行"},{value:"4",label:"1/3行"},{value:"8",label:"2/3行"},{value:"3",label:"1/4行"},{value:"9",label:"3/4行"},{value:"2",label:"1/6行"},{value:"10",label:"5/6行"},{value:"1.5",label:"1/8行"},{value:"10.5",label:"7/8行"}],Ce=l(!1),Ue=l("860px");let Se=l({maxHeight:"496px",height:"496px"});const{saveOrUpdateExtendField:je}=W(),Oe=a(R),Ie=l(null),ze=l({name:void 0,remark:void 0,is_edit:"1",is_null:"1",is_show:"1",key:"",val_key:void 0,validate:{},html_type:"INPUT",name_i18n:void 0,elem_width:"12",default_val:void 0,label_type:void 0,isMultiSelect:"0",decimal_length:void 0,date_format:""}),Te=l([{text:void 0,value:void 0}]),Ne=l({format:"yyyy-MM-dd HH:mm:ss",dateType:"date",mode:"date",value:null,showTime:!0,open:!1,componentType:"datetime"}),Ye=l({obj_type:"",vali_obj:"",event_obj:"",max_length:"",min_length:"",min_value:"",max_value:""}),$e=l({value_key:"",levelSetting:[],search_key:[],level_num:void 0,render_key:[],name:"",level_key:"",id:"",type:"",primary_key:"",sqlExpression:"",conObj:"",add_btn:"",setting:{cascading:[]}}),Le=l(!1),Ve=l(!1),Be=l(void 0),De=l(!1),Fe=l(!1);l(!1);const Pe=l(!1),qe=l(""),Ae=t((()=>"edit"===be.formOntype)),Ee=t((()=>ze.value.html_type||""));t((()=>"TEXTAREA"===Ee.value?1e3:255));const Je=t((()=>Te.value.filter((e=>e.value&&e.text)))),Ke=t((()=>F(Ee.value))),Re=t((()=>"date"===Ne.value.dateType));function We(e){Pe.value=e}function Xe(e){let l=e;"string"!=typeof e&&(l=JSON.stringify(e)),ze.value.default_val=l}function Ge(e){Ne.value.value=null,ze.value.default_val=void 0,il(e)}function Qe(){Ce.value=!Ce.value;let e=document.body.clientHeight;"860px"===Ue.value?(Ue.value="100%",Se.value.maxHeight=`${e}px`,Se.value.height=`${e}px`):(Ue.value="860px",Se.value.maxHeight="496px",Se.value.height="")}function Ze(e){return["HH:mm:ss","HH:mm"].includes(e)}function el(e,l){switch(e){case"isNull":Le.value=l,ze.value.is_null=l?"0":"1";break;case"isMultiSelect":Ve.value=l,ze.value.isMultiSelect=l?"1":"0"}}function ll(){if("add"===be.formOntype)return;let e=Object.assign({},be.formItemData),l=e.setting;l&&G(l)&&(l=JSON.parse(l),delete e.setting,Object.assign(e,{...l})),e.key=e.code,delete e.code,A(e.html_type)&&function(e){il(e.date_format);let l=e.default_val;l&&!l.startsWith("${")&&(Ze(e.date_format)&&(l=`${K().format("YYYY-MM-dd")} ${l}`),Q(new Date(l))&&(Ne.value.value=K(l)))}(e),F(e.html_type)&&(e.default_val=function(e){let l=e.default_val;return l?l.split(",").filter(Boolean):[]}(e)),Le.value="0"==e.is_null,Ve.value="1"==e.isMultiSelect,Ye.value=Object.assign(Ye.value,e.validate||{}),$e.value=Object.assign($e.value,e.wordbook||{}),ze.value=Object.assign(ze.value,e||{}),P(e.html_type)&&function(e){let l=(null==e?void 0:e.optionValue)||[];l.length||l.push({text:void 0,value:void 0}),Te.value=[...l],delete e.optionValue}(e)}function al(e){ze.value.html_type=e,Te.value=[{text:void 0,value:void 0}];let l=function(){if(F(Ee.value))return[]}();ze.value.default_val=l,A(e)?ze.value.date_format="yyyy-MM-dd HH:mm:ss":ze.value.date_format=""}function tl(){Te.value.push({value:"",text:""})}function ul(e){let l=e;(e<0||0===e)&&(l=0),e>5&&(l=5),Be.value=0===l?l:l||void 0}function nl(e){Te.value=e}function il(e){let l=e||"yyyy-MM-dd HH:mm:ss",a=Ze(l)?"time":"date",t="yyyy-MM"===l?"month":"date";let u=function(e){return["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd HH:mm","MM-dd HH:mm"].includes(e)}(l),n="";["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd HH:mm","MM-dd HH:mm"].includes(e)&&(n="datetime"),["yyyy-MM-dd","MM-dd"].includes(e)&&(n="date"),Object.assign(Ne.value,{format:l,dateType:a,mode:t,showTime:u,componentType:n})}function ol(e,l){if(e)return l&&(l.includes("yyyy")&&(l=l.replace("yyyy","YYYY")),l.includes("dd")&&(l=l.replace("dd","DD"))),K(e).format(l)}function vl(){Ne.value.open=!Ne.value.open}function dl(e){let l=ol(e,Ne.value.format);ze.value.default_val=l}function rl(e){let l=ol(e,Ne.value.format);ze.value.default_val=l,Ne.value.format.includes("HH:mm")||vl()}function sl(e){let l=ol(e,Ne.value.format);ze.value.default_val=l}function pl(){ge("cancelModal"),Ue.value="860px",Se.value={height:"496px",maxHeight:"496px"},Ce.value=!1,ze.value={name:void 0,remark:void 0,is_edit:"1",is_null:"1",is_show:"1",key:"",val_key:void 0,validate:{},html_type:"INPUT",name_i18n:void 0,elem_width:"12",default_val:void 0,label_type:void 0,isMultiSelect:"0",decimal_length:void 0,date_format:""}}function fl(){var e;null==(e=Ie.value)||e.validate((async e=>{if(e)return;let l=Object.assign({},ze.value);if(l.validate={...Ye.value},l.extendId=be.id,P(Ee.value)){let e=function(){let e={validate:!1,message:"请完善选项配置"};if(!Te.value||!Te.value.length)return e;let l,a,t,u=0,n=Te.value.length,i=!1;for(;u<n;u++){if(l=Te.value[u],a=l.value?l.value.trim():l.value,t=l.text?l.text.trim():l.text,!a||!t){i=!0;break}l.value=a,l.text=t}return[...new Set(Te.value.map((e=>e.value)))].length!==Te.value.length?(e.message="选项值不能重复",e):(!i&&(e.validate=!0),e)}();if(!e.validate)return De.value=!0,void xe.warning(e.message);De.value=!1,l.option=[...Te.value]}if(q(Ee.value)?l.default_val=function(e){let l=e.default_val;if(void 0===Be.value)return l;if(!l)return l;let a=String(l).split(".")[1];return a&&a.length!==Be.value?Number(l.toFixed(Be.value)):l}(l):F(Ee.value)&&(l.default_val=l.default_val.join(",")),!E(Ee.value)||function(e){let{default_val:l}=e;qe.value="",l&&G(l)&&(l=JSON.parse(l));let a=function(e,l){if(!e)return;if("string"!=typeof e)return;if(!(e=e.trim()))return!0;if(!e.startsWith("${"))return ml(l,"请输入有效系统变量"),"error";let a=/\${sys.(.*?)\}/g.exec(e);if(!a||!a[1])return ml(l,"请输入有效系统变量"),"error";return!0}(l,e);if(a)return"error"!==a;if(console.log("saveOjb.isMultiSelect>>>",e.isMultiSelect),console.log("default_val?.length>>>",null==l?void 0:l.length),"0"===e.isMultiSelect&&(null==l?void 0:l.length)>1)return console.log("进入到判断里面了>>>>>"),ml(e,"选人组件为单选"),!1;return!0}(l)){for(let e in l){let a=l[e];"string"==typeof a&&(l[e]=null==a?void 0:a.trim())}console.log("saveOjb>>>",l),await async function(e={}){Fe.value=!0;try{const l=await je(e,Oe);if(Fe.value=!1,"SUCCESS"!==(null==l?void 0:l.result))return void xe.error((null==l?void 0:l.resultMsg)||"保存失败");pl()}catch(e){Fe.value=!1}}(l)}}))}function ml(e,l){qe.value=l}return u((()=>be.visible),(e=>{e&&ll()})),(l,a)=>(n(),i(o(H),{class:v(["expand-field-modal-block",{"modal-screen":Ce.value}]),show:e.visible,"onUpdate:show":a[22]||(a[22]=e=>d(visible)?visible.value=e:null),maskClosable:!1,width:Ue.value,bodyStyle:o(Se),closable:!1,centered:"",onPositiveClick:fl,onNegativeClick:pl},{default:r((()=>[s(o(C),{style:p({width:Ue.value,...o(Se)}),title:"add"===be.formOntype?"新增拓展字段":"编辑拓展字段",bordered:!1,size:"huge",role:"dialog","aria-modal":"true"},{"header-extra":r((()=>[f("div",le,[f("i",{onClick:Qe,class:v(["iconfont-expand-field",Ce.value?"icon-expand-field-menzhenyishengzhanxitongtubiaozuixiaohua2":"icon-expand-field-menzhenyishengzhanxitongtubiaozuidahua"])},null,2),f("i",{onClick:pl,class:"iconfont-expand-field icon-expand-field-menzhenyishengzhanxitongtubiaoguanbi"})])])),footer:r((()=>[f("div",ae,[s(o(U),{onClick:pl},{default:r((()=>[m("取消")])),_:1}),s(o(U),{type:"info",onClick:fl},{default:r((()=>[m("保存")])),_:1})])])),default:r((()=>[s(o(S),{ref_key:"formRef",ref:Ie,model:ze.value,rules:Me},{default:r((()=>[s(o(j),{path:"name",label:"字段标题","require-mark-placement":"left"},{default:r((()=>[s(o(O),{value:ze.value.name,"onUpdate:value":a[0]||(a[0]=e=>ze.value.name=e),maxlength:100,clearable:"",placeholder:"请输入"},null,8,["value"])])),_:1}),s(o(j),{path:"key"},{label:r((()=>[f("div",te,[ue,s(o(I),{duration:0},{trigger:r((()=>[ne])),default:r((()=>[m(" 数据库字段键名,不填写时由系统生成,填写则以填写为准 ")])),_:1})])])),default:r((()=>[s(o(O),{value:ze.value.key,"onUpdate:value":a[1]||(a[1]=e=>ze.value.key=e),maxlength:32,disabled:o(Ae),clearable:"",placeholder:"数据库字段键名,不填写时由系统生成,填写则以填写为准"},null,8,["value","disabled"])])),_:1}),s(o(j),{path:"html_type",label:"字段类型","require-mark-placement":"left"},{default:r((()=>[s(o(z),{value:ze.value.html_type,"onUpdate:value":[a[2]||(a[2]=e=>ze.value.html_type=e),al],placeholder:"请选择字段类型",clearable:"",filterable:"",options:o(X)},null,8,["value","options"])])),_:1}),s(o(j),{path:"remark",label:"字段问号提示"},{label:r((()=>[f("div",ie,[oe,s(o(I),{duration:0},{trigger:r((()=>[ve])),default:r((()=>[m(" 设置后该字段旁会有问号图标,鼠标悬浮展示“问号提示”内容,常用于告诉用户该字段的含义 ")])),_:1})])])),default:r((()=>[s(o(O),{value:ze.value.remark,"onUpdate:value":a[3]||(a[3]=e=>ze.value.remark=e),placeholder:"请输入",type:"textarea",clearable:"",maxlength:255,rows:3},null,8,["value"])])),_:1}),c(" 选项值>>>>>类型对应关系 "),o(P)(o(Ee))?(n(),i(o(j),{key:0},{label:r((()=>[f("div",de,[re,f("span",{class:"batch-span",onClick:tl},"添加选项"),f("span",{class:"batch-span",onClick:a[4]||(a[4]=()=>We(!0))},"批量编辑")])])),default:r((()=>[f("div",{class:v(["options-item",{"options-item-err":De.value}])},[(n(!0),y(h,null,_(Te.value,((e,l)=>(n(),i(o(T),{class:"mgb-10",key:l,cols:24,"x-gap":8,"y-gap":8},{default:r((()=>[s(o(N),{span:11},{default:r((()=>[s(o(O),{value:e.value,"onUpdate:value":l=>e.value=l,maxLength:100,allowClear:"",placeholder:"选项值"},null,8,["value","onUpdate:value"])])),_:2},1024),s(o(N),{span:11},{default:r((()=>[s(o(O),{value:e.text,"onUpdate:value":l=>e.text=l,maxLength:100,allowClear:"",placeholder:"选项文本"},null,8,["value","onUpdate:value"])])),_:2},1024),s(o(N),{span:2,class:"flex-center"},{default:r((()=>[Te.value.length>1?(n(),i(o(Y),{key:0,onClick:a=>function(e,l){Te.value.splice(l,1);let a=ze.value.default_val;if(F(Ee.value)){if(!a||!a.length)return;let l=a.findIndex((l=>l===e.value));l||a.splice(l,1)}else{if(!a)return;a===e.value&&(a=void 0)}ze.value.default_val=a}(e,l)},{default:r((()=>[se])),_:2},1032,["onClick"])):c("v-if",!0)])),_:2},1024)])),_:2},1024)))),128))],2)])),_:1})):c("v-if",!0),o(q)(o(Ee))?(n(),i(o(j),{key:1,path:"decimal_length",label:"小数位"},{default:r((()=>[s(o($),{style:{width:"100%"},min:0,max:5,placeholder:"请输入",precision:0,clearable:"",value:ze.value.decimal_length,"onUpdate:value":[a[5]||(a[5]=e=>ze.value.decimal_length=e),ul]},null,8,["value"])])),_:1})):c("v-if",!0),o(A)(o(Ee))?(n(),i(o(j),{key:2,path:"date_format",label:"日期格式"},{default:r((()=>[s(o(z),{style:{width:"100%"},value:ze.value.date_format,"onUpdate:value":[a[6]||(a[6]=e=>ze.value.date_format=e),Ge],placeholder:"请选择",options:we},null,8,["value"])])),_:1})):c("v-if",!0),c(" 默认值>>>>>类型对应关系 "),s(o(j),{path:"default_val",label:"默认值"},{label:r((()=>[f("div",pe,[fe,o(E)(o(Ee))?(n(),i(o(I),{key:0,duration:0},{trigger:r((()=>[me])),default:r((()=>[m(" 支持输入系统变量当前操作人${sys.userId},也支持选择一个人 ")])),_:1})):c("v-if",!0)])])),default:r((()=>[o(J)(o(Ee))?(n(),i(o(O),{key:0,value:ze.value.default_val,"onUpdate:value":a[7]||(a[7]=e=>ze.value.default_val=e),placeholder:ke,type:"textarea",clearable:"",maxlength:1e3,rows:3},null,8,["value"])):o(q)(o(Ee))?(n(),y(h,{key:1},[c(" 数字框 "),s(o($),{style:{width:"100%"},clearable:"",placeholder:ke,precision:Be.value,value:ze.value.default_val,"onUpdate:value":a[8]||(a[8]=e=>ze.value.default_val=e)},null,8,["precision","value"])],2112)):o(P)(o(Ee))?(n(),y(h,{key:2},[c(" 下拉框、横向单选、纵向单选、横向多选、纵向多选、下拉多选框 "),s(o(z),{style:{width:"100%"},multiple:o(Ke),clearable:"",value:ze.value.default_val,"onUpdate:value":a[9]||(a[9]=e=>ze.value.default_val=e),"label-field":"text",placeholder:ke,options:o(Je)},null,8,["multiple","value","options"])],2112)):o(A)(o(Ee))?(n(),y(h,{key:3},[c(" 日期 "),f("div",ce,[s(o(O),{clearable:"",maxLength:255,value:ze.value.default_val,"onUpdate:value":a[10]||(a[10]=e=>ze.value.default_val=e),placeholder:ke},null,8,["value"]),o(Re)?(n(),y(h,{key:0},["month"===Ne.value.mode?(n(),i(o(L),{key:0,trigger:"click",show:Ne.value.open},{trigger:r((()=>[s(o(U),{type:"info",onClick:vl},{default:r((()=>[m("选择")])),_:1})])),default:r((()=>[s(o(V),{panel:"",value:Ne.value.value,"onUpdate:value":[a[11]||(a[11]=e=>Ne.value.value=e),dl],type:"month","input-readonly":"",clearable:"",onConfirm:vl},null,8,["value"])])),_:1},8,["show"])):(n(),i(o(L),{key:1,trigger:"click",show:Ne.value.open},{trigger:r((()=>[s(o(U),{type:"info",onClick:vl},{default:r((()=>[m("选择")])),_:1})])),default:r((()=>[s(o(V),{panel:"",value:Ne.value.value,"onUpdate:value":[a[12]||(a[12]=e=>Ne.value.value=e),rl],format:Ne.value.format,type:Ne.value.componentType,"input-readonly":"",clearable:"",onConfirm:vl},null,8,["value","format","type"])])),_:1},8,["show"]))],64)):(n(),y(h,{key:1},[c(' <n-input\n allowClear\n :maxLength="255"\n v-model:value="dateInfo.value"\n @keydown.enter.prevent\n :placeholder="defaultPlaceholder"\n /> '),s(o(U),{type:"info",class:"date-time-button"},{default:r((()=>[ye,s(o(B),{value:Ne.value.value,"onUpdate:value":[a[13]||(a[13]=e=>Ne.value.value=e),sl],format:Ne.value.format,"input-readonly":"",clearable:""},null,8,["value","format"])])),_:1}),c(' <n-popover trigger="click">\n <template #trigger>\n <n-button type="info">选择</n-button>\n </template>\n <n-time-picker\n panel\n v-model:value="dateInfo.value"\n :format="dateInfo.format"\n input-readonly\n clearable\n @update:value="timeChange"\n >\n <template v-slot:icon>111</template>\n\n </n-time-picker>\n </n-popover> ')],64))])],2112)):o(E)(o(Ee))?(n(),y(h,{key:4},[c(" 选人组件(增加一个选人组件) "),f("div",he,[g(s(o(O),{allowClear:"",maxLength:255,value:ze.value.default_val,"onUpdate:value":a[14]||(a[14]=e=>ze.value.default_val=e),onKeydown:a[15]||(a[15]=b(x((()=>{}),["prevent"]),["enter"])),placeholder:ke},null,8,["value"]),[[k,!1]]),c(' 点击弹出选人组件弹窗 :mainForm="this" '),s(ee,{orgId:e.orgId,defaultValue:ze.value.default_val,onCheckPerson:Xe},null,8,["orgId","defaultValue"]),qe.value?(n(),y("span",_e,M(qe.value),1)):c("v-if",!0),c(' <n-button type="info">选择</n-button> ')])],2112)):(n(),y(h,{key:5},[c(" 其他 "),s(o(O),{value:ze.value.default_val,"onUpdate:value":a[16]||(a[16]=e=>ze.value.default_val=e),onKeydown:a[17]||(a[17]=b(x((()=>{}),["prevent"]),["enter"])),placeholder:"请输入默认值"},null,8,["value"])],2112))])),_:1}),s(o(j),{path:"elem_width",label:"宽度"},{default:r((()=>[s(o(z),{value:ze.value.elem_width,"onUpdate:value":a[18]||(a[18]=e=>ze.value.elem_width=e),placeholder:"请选择宽度",options:He},null,8,["value"])])),_:1}),s(o(j),{path:"isNull",label:"是否必填","label-placement":"left"},{default:r((()=>[s(o(D),{value:Le.value,"onUpdate:value":[a[19]||(a[19]=e=>Le.value=e),a[20]||(a[20]=e=>el("isNull",e))]},null,8,["value"])])),_:1}),o(E)(o(Ee))?(n(),i(o(j),{key:3,"label-placement":"left",path:"isMultiSelect",label:"是否多选"},{default:r((()=>[s(o(D),{value:Ve.value,"onUpdate:value":a[21]||(a[21]=e=>el("isMultiSelect",e))},null,8,["value"])])),_:1})):c("v-if",!0)])),_:1},8,["model"]),s(Z,{visible:Pe.value,options:Te.value,onHandleSaveBatch:nl,onTriggerBatch:We},null,8,["visible","options"])])),_:1},8,["style","title"])])),_:1},8,["class","show","width","bodyStyle"]))}});export{ge as default};
1
+ import{defineComponent as e,ref as l,inject as a,computed as t,watch as u,openBlock as n,createBlock as i,unref as o,normalizeClass as v,isRef as d,withCtx as r,createVNode as s,normalizeStyle as p,createElementVNode as f,createTextVNode as m,createCommentVNode as c,createElementBlock as y,Fragment as h,renderList as _,withDirectives as g,withKeys as b,withModifiers as x,vShow as k,toDisplayString as M}from"vue";import{useMessage as w,NModal as H,NCard as C,NButton as U,NForm as S,NFormItem as j,NInput as O,NTooltip as I,NSelect as z,NGrid as T,NGridItem as N,NIcon as Y,NInputNumber as $,NPopover as L,NDatePicker as V,NTimePicker as B,NSwitch as D}from"naive-ui";import{isMulti as F,isShowOptions as P,isNumber as q,isDate as A,isCandidate as E,isTextarea as J}from"../utils/index.js";import K from"moment";import{InjectionExpandFieldApiConfig as R}from"../constants/index.js";import W from"../hooks/useAsyncData.js";import{HtmlTypeList as X}from"../utils/constant.js";import{isJSON as G,isValidDate as Q}from"../utils/tool.js";import Z from"./FormBatchOptionsModal.vue.js";import ee from"./FormItemPerson.vue.js";const le={class:"svg-wrap"},ae={class:"flex_right"},te={class:"options-title"},ue=f("span",null,"字段键名",-1),ne=f("i",{class:"iconfont-expand-field icon-expand-field-help"},null,-1),ie={class:"options-title"},oe=f("span",null,"字段问号提示",-1),ve=f("i",{class:"iconfont-expand-field icon-expand-field-help"},null,-1),de={class:"options-title"},re=f("span",null,"选项值",-1),se=f("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 32 32"},[f("path",{d:"M12 12h2v12h-2z",fill:"currentColor"}),f("path",{d:"M18 12h2v12h-2z",fill:"currentColor"}),f("path",{d:"M4 6v2h2v20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8h2V6zm4 22V8h16v20z",fill:"currentColor"}),f("path",{d:"M12 2h8v2h-8z",fill:"currentColor"})],-1),pe={class:"options-title"},fe=f("span",null,"默认值",-1),me=f("i",{class:"iconfont-expand-field icon-expand-field-help"},null,-1),ce={style:{display:"flex","align-items":"center"}},ye=f("span",null,"选择",-1),he={style:{width:"100%"}},_e={key:0,class:"validate_tip"};var ge=e({__name:"form",props:{visible:{type:Boolean,default:!1},formOntype:{type:String,default:"add"},formItemData:{type:Object,default:()=>({})},id:{type:String,default:""},orgId:{type:String,default:""},conditionList:{type:Array,default:()=>[]},searchFieldList:{type:Array,default:()=>[]}},emits:["cancelModal"],setup(e,{emit:ge}){const be=e,xe=w(),ke="请输入默认值",Me={name:[{required:!0,message:"请输入字段标题",trigger:["input","blur"]}],html_type:[{required:!0,message:"请选择字段类型",trigger:["input","blur"]}]},we=[{value:"yyyy-MM-dd HH:mm:ss",label:"年-月-日 时:分:秒"},{value:"yyyy-MM-dd HH:mm",label:"年-月-日 时:分"},{value:"yyyy-MM-dd",label:"年-月-日"},{value:"yyyy-MM",label:"年-月"},{value:"MM-dd HH:mm",label:"月-日 时:分"},{value:"MM-dd",label:"月-日"},{value:"HH:mm:ss",label:"时:分:秒"},{value:"HH:mm",label:"时:分"}],He=[{value:"12",label:"整行"},{value:"6",label:"半行"},{value:"4",label:"1/3行"},{value:"8",label:"2/3行"},{value:"3",label:"1/4行"},{value:"9",label:"3/4行"},{value:"2",label:"1/6行"},{value:"10",label:"5/6行"},{value:"1.5",label:"1/8行"},{value:"10.5",label:"7/8行"}],Ce=l(!1),Ue=l("860px");let Se=l({maxHeight:"496px",height:"496px"});const{saveOrUpdateExtendField:je}=W(),Oe=a(R),Ie=l(null),ze=l({name:void 0,remark:void 0,is_edit:"1",is_null:"1",is_show:"1",key:"",val_key:void 0,validate:{},html_type:"INPUT",name_i18n:void 0,elem_width:"12",default_val:void 0,label_type:void 0,isMultiSelect:"0",decimal_length:void 0,date_format:""}),Te=l([{text:void 0,value:void 0}]),Ne=l({format:"yyyy-MM-dd HH:mm:ss",dateType:"date",mode:"date",value:null,showTime:!0,open:!1,componentType:"datetime"}),Ye=l({obj_type:"",vali_obj:"",event_obj:"",max_length:"",min_length:"",min_value:"",max_value:""}),$e=l({value_key:"",levelSetting:[],search_key:[],level_num:void 0,render_key:[],name:"",level_key:"",id:"",type:"",primary_key:"",sqlExpression:"",conObj:"",add_btn:"",setting:{cascading:[]}}),Le=l(!1),Ve=l(!1),Be=l(void 0),De=l(!1),Fe=l(!1);l(!1);const Pe=l(!1),qe=l(""),Ae=t((()=>"edit"===be.formOntype)),Ee=t((()=>ze.value.html_type||""));t((()=>"TEXTAREA"===Ee.value?1e3:255));const Je=t((()=>Te.value.filter((e=>e.value&&e.text)))),Ke=t((()=>F(Ee.value))),Re=t((()=>"date"===Ne.value.dateType));function We(e){Pe.value=e}function Xe(e){let l=e;"string"!=typeof e&&(l=JSON.stringify(e)),ze.value.default_val=l}function Ge(e){Ne.value.value=null,ze.value.default_val=void 0,il(e)}function Qe(){Ce.value=!Ce.value;let e=document.body.clientHeight;"860px"===Ue.value?(Ue.value="100%",Se.value.maxHeight=`${e}px`,Se.value.height=`${e}px`):(Ue.value="860px",Se.value.maxHeight="496px",Se.value.height="")}function Ze(e){return["HH:mm:ss","HH:mm"].includes(e)}function el(e,l){switch(e){case"isNull":Le.value=l,ze.value.is_null=l?"0":"1";break;case"isMultiSelect":Ve.value=l,ze.value.isMultiSelect=l?"1":"0"}}function ll(){if("add"===be.formOntype)return;let e=Object.assign({},be.formItemData),l=e.setting;l&&G(l)&&(l=JSON.parse(l),delete e.setting,Object.assign(e,{...l})),e.key=e.code,delete e.code,A(e.html_type)&&function(e){il(e.date_format);let l=e.default_val;l&&!l.startsWith("${")&&(Ze(e.date_format)&&(l=`${K().format("YYYY-MM-dd")} ${l}`),Q(new Date(l))&&(Ne.value.value=K(l)))}(e),F(e.html_type)&&(e.default_val=function(e){let l=e.default_val;return l?l.split(",").filter(Boolean):[]}(e)),Le.value="0"==e.is_null,Ve.value="1"==e.isMultiSelect,Ye.value=Object.assign(Ye.value,e.validate||{}),$e.value=Object.assign($e.value,e.wordbook||{}),ze.value=Object.assign(ze.value,e||{}),P(e.html_type)&&function(e){let l=(null==e?void 0:e.optionValue)||[];l.length||l.push({text:void 0,value:void 0}),Te.value=[...l],delete e.optionValue}(e)}function al(e){ze.value.html_type=e,Te.value=[{text:void 0,value:void 0}];let l=function(){if(F(Ee.value))return[]}();ze.value.default_val=l,A(e)?ze.value.date_format="yyyy-MM-dd HH:mm:ss":ze.value.date_format=""}function tl(){Te.value.push({value:"",text:""})}function ul(e){let l=e;(e<0||0===e)&&(l=0),e>5&&(l=5),Be.value=0===l?l:l||void 0}function nl(e){Te.value=e}function il(e){let l=e||"yyyy-MM-dd HH:mm:ss",a=Ze(l)?"time":"date",t="yyyy-MM"===l?"month":"date";let u=function(e){return["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd HH:mm","MM-dd HH:mm"].includes(e)}(l),n="";["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd HH:mm","MM-dd HH:mm"].includes(e)&&(n="datetime"),["yyyy-MM-dd","MM-dd"].includes(e)&&(n="date"),Object.assign(Ne.value,{format:l,dateType:a,mode:t,showTime:u,componentType:n})}function ol(e,l){if(e)return l&&(l.includes("yyyy")&&(l=l.replace("yyyy","YYYY")),l.includes("dd")&&(l=l.replace("dd","DD"))),K(e).format(l)}function vl(){Ne.value.open=!Ne.value.open}function dl(e){let l=ol(e,Ne.value.format);ze.value.default_val=l}function rl(e){let l=ol(e,Ne.value.format);ze.value.default_val=l,Ne.value.format.includes("HH:mm")||vl()}function sl(e){let l=ol(e,Ne.value.format);ze.value.default_val=l}function pl(){ge("cancelModal"),Ue.value="860px",Se.value={height:"496px",maxHeight:"496px"},Ce.value=!1,ze.value={name:void 0,remark:void 0,is_edit:"1",is_null:"1",is_show:"1",key:"",val_key:void 0,validate:{},html_type:"INPUT",name_i18n:void 0,elem_width:"12",default_val:void 0,label_type:void 0,isMultiSelect:"0",decimal_length:void 0,date_format:""}}function fl(){var e;null==(e=Ie.value)||e.validate((async e=>{if(e)return;let l=Object.assign({},ze.value);if(l.validate={...Ye.value},l.extendId=be.id,P(Ee.value)){let e=function(){let e={validate:!1,message:"请完善选项配置"};if(!Te.value||!Te.value.length)return e;let l,a,t,u=0,n=Te.value.length,i=!1;for(;u<n;u++){if(l=Te.value[u],a=l.value?l.value.trim():l.value,t=l.text?l.text.trim():l.text,!a||!t){i=!0;break}l.value=a,l.text=t}return[...new Set(Te.value.map((e=>e.value)))].length!==Te.value.length?(e.message="选项值不能重复",e):(!i&&(e.validate=!0),e)}();if(!e.validate)return De.value=!0,void xe.warning(e.message);De.value=!1,l.option=[...Te.value]}if(q(Ee.value)?l.default_val=function(e){let l=e.default_val;if(void 0===Be.value)return l;if(!l)return l;let a=String(l).split(".")[1];return a&&a.length!==Be.value?Number(l.toFixed(Be.value)):l}(l):F(Ee.value)&&(l.default_val=l.default_val.join(",")),!E(Ee.value)||function(e){let{default_val:l}=e;qe.value="",l&&G(l)&&(l=JSON.parse(l));let a=function(e,l){if(!e)return;if("string"!=typeof e)return;if(!(e=e.trim()))return!0;if(!e.startsWith("${"))return ml(l,"请输入有效系统变量"),"error";let a=/\${sys.(.*?)\}/g.exec(e);if(!a||!a[1])return ml(l,"请输入有效系统变量"),"error";return!0}(l,e);if(a)return"error"!==a;if(console.log("saveOjb.isMultiSelect>>>",e.isMultiSelect),console.log("default_val?.length>>>",null==l?void 0:l.length),"0"===e.isMultiSelect&&(null==l?void 0:l.length)>1)return console.log("进入到判断里面了>>>>>"),ml(e,"选人组件为单选"),!1;return!0}(l)){for(let e in l){let a=l[e];"string"==typeof a&&(l[e]=null==a?void 0:a.trim())}console.log("saveOjb>>>",l),await async function(e={}){Fe.value=!0;try{const l=await je(e,Oe);if(Fe.value=!1,"SUCCESS"!==(null==l?void 0:l.result))return void xe.error((null==l?void 0:l.resultMsg)||"保存失败");pl()}catch(e){Fe.value=!1}}(l)}}))}function ml(e,l){qe.value=l}return u((()=>be.visible),(e=>{e&&ll()})),(l,a)=>(n(),i(o(H),{class:v(["expand-field-modal-block",{"modal-screen":Ce.value}]),show:e.visible,"onUpdate:show":a[22]||(a[22]=e=>d(visible)?visible.value=e:null),maskClosable:!1,width:Ue.value,bodyStyle:o(Se),closable:!1,centered:"",onPositiveClick:fl,onNegativeClick:pl},{default:r((()=>[s(o(C),{style:p({width:Ue.value,...o(Se)}),title:"add"===be.formOntype?"新增拓展字段":"编辑拓展字段",bordered:!1,size:"huge",role:"dialog","aria-modal":"true"},{"header-extra":r((()=>[f("div",le,[f("i",{onClick:Qe,class:v(["iconfont-expand-field",Ce.value?"icon-expand-field-menzhenyishengzhanxitongtubiaozuixiaohua2":"icon-expand-field-menzhenyishengzhanxitongtubiaozuidahua"])},null,2),f("i",{onClick:pl,class:"iconfont-expand-field icon-expand-field-menzhenyishengzhanxitongtubiaoguanbi"})])])),footer:r((()=>[f("div",ae,[s(o(U),{onClick:pl},{default:r((()=>[m("取消")])),_:1}),s(o(U),{type:"info",onClick:fl},{default:r((()=>[m("保存")])),_:1})])])),default:r((()=>[s(o(S),{ref_key:"formRef",ref:Ie,model:ze.value,rules:Me},{default:r((()=>[s(o(j),{path:"name",label:"字段标题","require-mark-placement":"left"},{default:r((()=>[s(o(O),{value:ze.value.name,"onUpdate:value":a[0]||(a[0]=e=>ze.value.name=e),maxlength:100,clearable:"",placeholder:"请输入"},null,8,["value"])])),_:1}),s(o(j),{path:"key"},{label:r((()=>[f("div",te,[ue,s(o(I),{duration:0},{trigger:r((()=>[ne])),default:r((()=>[m(" 数据库字段键名,不填写时由系统生成,填写则以填写为准 ")])),_:1})])])),default:r((()=>[s(o(O),{value:ze.value.key,"onUpdate:value":a[1]||(a[1]=e=>ze.value.key=e),maxlength:32,disabled:o(Ae),clearable:"",placeholder:"数据库字段键名,不填写时由系统生成,填写则以填写为准"},null,8,["value","disabled"])])),_:1}),s(o(j),{path:"html_type",label:"字段类型","require-mark-placement":"left"},{default:r((()=>[s(o(z),{value:ze.value.html_type,"onUpdate:value":[a[2]||(a[2]=e=>ze.value.html_type=e),al],placeholder:"请选择字段类型",clearable:"",filterable:"",options:o(X)},null,8,["value","options"])])),_:1}),s(o(j),{path:"remark",label:"字段问号提示"},{label:r((()=>[f("div",ie,[oe,s(o(I),{duration:0},{trigger:r((()=>[ve])),default:r((()=>[m(" 设置后该字段旁会有问号图标,鼠标悬浮展示“问号提示”内容,常用于告诉用户该字段的含义 ")])),_:1})])])),default:r((()=>[s(o(O),{value:ze.value.remark,"onUpdate:value":a[3]||(a[3]=e=>ze.value.remark=e),placeholder:"请输入",type:"textarea",clearable:"",maxlength:255,rows:3},null,8,["value"])])),_:1}),c(" 选项值>>>>>类型对应关系 "),o(P)(o(Ee))?(n(),i(o(j),{key:0},{label:r((()=>[f("div",de,[re,f("span",{class:"batch-span",onClick:tl},"添加选项"),f("span",{class:"batch-span",onClick:a[4]||(a[4]=()=>We(!0))},"批量编辑")])])),default:r((()=>[f("div",{class:v(["options-item",{"options-item-err":De.value}])},[(n(!0),y(h,null,_(Te.value,((e,l)=>(n(),i(o(T),{class:"mgb-10",key:l,cols:24,"x-gap":8,"y-gap":8},{default:r((()=>[s(o(N),{span:11},{default:r((()=>[s(o(O),{value:e.value,"onUpdate:value":l=>e.value=l,maxLength:100,allowClear:"",placeholder:"选项值"},null,8,["value","onUpdate:value"])])),_:2},1024),s(o(N),{span:11},{default:r((()=>[s(o(O),{value:e.text,"onUpdate:value":l=>e.text=l,maxLength:100,allowClear:"",placeholder:"选项文本"},null,8,["value","onUpdate:value"])])),_:2},1024),s(o(N),{span:2,class:"flex-center"},{default:r((()=>[Te.value.length>1?(n(),i(o(Y),{key:0,onClick:a=>function(e,l){Te.value.splice(l,1);let a=ze.value.default_val;if(F(Ee.value)){if(!a||!a.length)return;let l=a.findIndex((l=>l===e.value));l||a.splice(l,1)}else{if(!a)return;a===e.value&&(a=void 0)}ze.value.default_val=a}(e,l)},{default:r((()=>[se])),_:2},1032,["onClick"])):c("v-if",!0)])),_:2},1024)])),_:2},1024)))),128))],2)])),_:1})):c("v-if",!0),o(q)(o(Ee))?(n(),i(o(j),{key:1,path:"decimal_length",label:"小数位"},{default:r((()=>[s(o($),{style:{width:"100%"},min:0,max:5,placeholder:"请输入",precision:0,clearable:"",value:ze.value.decimal_length,"onUpdate:value":[a[5]||(a[5]=e=>ze.value.decimal_length=e),ul]},null,8,["value"])])),_:1})):c("v-if",!0),o(A)(o(Ee))?(n(),i(o(j),{key:2,path:"date_format",label:"日期格式"},{default:r((()=>[s(o(z),{style:{width:"100%"},value:ze.value.date_format,"onUpdate:value":[a[6]||(a[6]=e=>ze.value.date_format=e),Ge],placeholder:"请选择",options:we},null,8,["value"])])),_:1})):c("v-if",!0),c(" 默认值>>>>>类型对应关系 "),s(o(j),{path:"default_val",label:"默认值"},{label:r((()=>[f("div",pe,[fe,o(E)(o(Ee))?(n(),i(o(I),{key:0,duration:0},{trigger:r((()=>[me])),default:r((()=>[m(" 支持输入系统变量当前操作人${sys.userId},也支持选择一个人 ")])),_:1})):c("v-if",!0)])])),default:r((()=>[o(J)(o(Ee))?(n(),i(o(O),{key:0,value:ze.value.default_val,"onUpdate:value":a[7]||(a[7]=e=>ze.value.default_val=e),placeholder:ke,type:"textarea",clearable:"",maxlength:1e3,rows:3},null,8,["value"])):o(q)(o(Ee))?(n(),y(h,{key:1},[c(" 数字框 "),s(o($),{style:{width:"100%"},clearable:"",placeholder:ke,precision:Be.value,value:ze.value.default_val,"onUpdate:value":a[8]||(a[8]=e=>ze.value.default_val=e)},null,8,["precision","value"])],2112)):o(P)(o(Ee))?(n(),y(h,{key:2},[c(" 下拉框、横向单选、纵向单选、横向多选、纵向多选、下拉多选框 "),s(o(z),{style:{width:"100%"},multiple:o(Ke),clearable:"",value:ze.value.default_val,"onUpdate:value":a[9]||(a[9]=e=>ze.value.default_val=e),"label-field":"text",placeholder:ke,options:o(Je)},null,8,["multiple","value","options"])],2112)):o(A)(o(Ee))?(n(),y(h,{key:3},[c(" 日期 "),f("div",ce,[s(o(O),{clearable:"",maxLength:255,value:ze.value.default_val,"onUpdate:value":a[10]||(a[10]=e=>ze.value.default_val=e),placeholder:ke},null,8,["value"]),o(Re)?(n(),y(h,{key:0},["month"===Ne.value.mode?(n(),i(o(L),{key:0,trigger:"click",show:Ne.value.open},{trigger:r((()=>[s(o(U),{type:"info",onClick:vl},{default:r((()=>[m("选择")])),_:1})])),default:r((()=>[s(o(V),{panel:"",value:Ne.value.value,"onUpdate:value":[a[11]||(a[11]=e=>Ne.value.value=e),dl],type:"month","input-readonly":"",clearable:"",onConfirm:vl},null,8,["value"])])),_:1},8,["show"])):(n(),i(o(L),{key:1,trigger:"click",show:Ne.value.open},{trigger:r((()=>[s(o(U),{type:"info",onClick:vl},{default:r((()=>[m("选择")])),_:1})])),default:r((()=>[s(o(V),{panel:"",value:Ne.value.value,"onUpdate:value":[a[12]||(a[12]=e=>Ne.value.value=e),rl],format:Ne.value.format,type:Ne.value.componentType,"input-readonly":"",clearable:"",onConfirm:vl},null,8,["value","format","type"])])),_:1},8,["show"]))],64)):(n(),y(h,{key:1},[c(' <n-input\r\n allowClear\r\n :maxLength="255"\r\n v-model:value="dateInfo.value"\r\n @keydown.enter.prevent\r\n :placeholder="defaultPlaceholder"\r\n /> '),s(o(U),{type:"info",class:"date-time-button"},{default:r((()=>[ye,s(o(B),{value:Ne.value.value,"onUpdate:value":[a[13]||(a[13]=e=>Ne.value.value=e),sl],format:Ne.value.format,"input-readonly":"",clearable:""},null,8,["value","format"])])),_:1}),c(' <n-popover trigger="click">\r\n <template #trigger>\r\n <n-button type="info">选择</n-button>\r\n </template>\r\n <n-time-picker\r\n panel\r\n v-model:value="dateInfo.value"\r\n :format="dateInfo.format"\r\n input-readonly\r\n clearable\r\n @update:value="timeChange"\r\n >\r\n <template v-slot:icon>111</template>\r\n\r\n </n-time-picker>\r\n </n-popover> ')],64))])],2112)):o(E)(o(Ee))?(n(),y(h,{key:4},[c(" 选人组件(增加一个选人组件) "),f("div",he,[g(s(o(O),{allowClear:"",maxLength:255,value:ze.value.default_val,"onUpdate:value":a[14]||(a[14]=e=>ze.value.default_val=e),onKeydown:a[15]||(a[15]=b(x((()=>{}),["prevent"]),["enter"])),placeholder:ke},null,8,["value"]),[[k,!1]]),c(' 点击弹出选人组件弹窗 :mainForm="this" '),s(ee,{orgId:e.orgId,defaultValue:ze.value.default_val,onCheckPerson:Xe},null,8,["orgId","defaultValue"]),qe.value?(n(),y("span",_e,M(qe.value),1)):c("v-if",!0),c(' <n-button type="info">选择</n-button> ')])],2112)):(n(),y(h,{key:5},[c(" 其他 "),s(o(O),{value:ze.value.default_val,"onUpdate:value":a[16]||(a[16]=e=>ze.value.default_val=e),onKeydown:a[17]||(a[17]=b(x((()=>{}),["prevent"]),["enter"])),placeholder:"请输入默认值"},null,8,["value"])],2112))])),_:1}),s(o(j),{path:"elem_width",label:"宽度"},{default:r((()=>[s(o(z),{value:ze.value.elem_width,"onUpdate:value":a[18]||(a[18]=e=>ze.value.elem_width=e),placeholder:"请选择宽度",options:He},null,8,["value"])])),_:1}),s(o(j),{path:"isNull",label:"是否必填","label-placement":"left"},{default:r((()=>[s(o(D),{value:Le.value,"onUpdate:value":[a[19]||(a[19]=e=>Le.value=e),a[20]||(a[20]=e=>el("isNull",e))]},null,8,["value"])])),_:1}),o(E)(o(Ee))?(n(),i(o(j),{key:3,"label-placement":"left",path:"isMultiSelect",label:"是否多选"},{default:r((()=>[s(o(D),{value:Ve.value,"onUpdate:value":a[21]||(a[21]=e=>el("isMultiSelect",e))},null,8,["value"])])),_:1})):c("v-if",!0)])),_:1},8,["model"]),s(Z,{visible:Pe.value,options:Te.value,onHandleSaveBatch:nl,onTriggerBatch:We},null,8,["visible","options"])])),_:1},8,["style","title"])])),_:1},8,["class","show","width","bodyStyle"]))}});export{ge as default};
@@ -1 +1 @@
1
- import{defineComponent as t,provide as e,ref as l,openBlock as a,createElementBlock as i,createElementVNode as n,createCommentVNode as o,createVNode as s,unref as d,withCtx as r,Fragment as c,renderList as u,createTextVNode as m,toDisplayString as p,createBlock as f,withModifiers as v}from"vue";import{useMessage as h,NGrid as _,NGridItem as g,NTooltip as y,NIcon as k,NPopconfirm as C,NButton as x}from"naive-ui";import{Brush as D}from"@vicons/ionicons5";import w from"./components/form.vue.js";import I from"./hooks/useAsyncData.js";import{InjectionExpandFieldApiConfig as N}from"./constants/index.js";const b={class:"tableset-expand-field"},M={class:"list"},z={class:"table-modal-list"},A={class:"list-content"},S=n("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 32 32"},[n("path",{d:"M12 12h2v12h-2z",fill:"currentColor"}),n("path",{d:"M18 12h2v12h-2z",fill:"currentColor"}),n("path",{d:"M4 6v2h2v20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8h2V6zm4 22V8h16v20z",fill:"currentColor"}),n("path",{d:"M12 2h8v2h-8z",fill:"currentColor"})],-1),j={class:"footer"};var F=t({__name:"index",props:{id:{type:String,default:""},expandFieldApiConfig:{type:Object},tableData:{type:Array,default:()=>[]},orgId:{type:String,default:""}},emits:["closeModal"],setup(t,{emit:F}){const O=t,V=h(),{deleteExtendFieldById:B}=I();e(N,O.expandFieldApiConfig);const E=[{title:"字段标题",columnName:"name",span:3},{title:"字段键名",columnName:"code",span:3},{title:"字段类型",columnName:"html_type",span:3},{title:"问号提示",columnName:"remark",span:4},{title:"创建时间",columnName:"createdDate",span:4},{title:"修改时间",columnName:"updatedDate",span:4},{title:"操作",columnName:"operator",span:3}],P=l(!1),L=l("add"),U=l({});function q(){F("closeModal")}function G(){P.value=!0,L.value="add",U.value={}}function H(){P.value=!1}return(e,l)=>(a(),i("div",b,[n("div",M,[n("div",z,[o(' <div class="list-title">\n\t\t\t\t\t<span class="list-title-item" v-for="titleItem in filedList" :key="titleItem.columnName">\n\t\t\t\t\t\t{{ titleItem.title }}\n\t\t\t\t\t</span>\n\t\t\t\t</div> '),s(d(_),{cols:24,class:"list-title"},{default:r((()=>[(a(),i(c,null,u(E,(t=>s(d(g),{span:t.span,class:"list-title-item",key:t.columnName},{default:r((()=>[m(p(t.title),1)])),_:2},1032,["span"]))),64))])),_:1}),n("div",A,[(a(!0),i(c,null,u(t.tableData,((t,e)=>(a(),f(d(_),{key:e,class:"list-content-block"},{default:r((()=>[s(d(g),{span:3,title:t.name,class:"list-content-item"},{default:r((()=>[m(p(t.name),1)])),_:2},1032,["title"]),s(d(g),{span:3,title:t.code,class:"list-content-item"},{default:r((()=>[m(p(t.code),1)])),_:2},1032,["title"]),s(d(g),{span:3,title:t.html_type,class:"list-content-item"},{default:r((()=>[m(p(t.html_type),1)])),_:2},1032,["title"]),s(d(g),{span:4,title:t.remark,class:"list-content-item"},{default:r((()=>[m(p(t.remark),1)])),_:2},1032,["title"]),s(d(g),{span:4,title:t.createdDate,class:"list-content-item"},{default:r((()=>[m(p(t.createdDate),1)])),_:2},1032,["title"]),s(d(g),{span:4,title:t.updatedDate,class:"list-content-item"},{default:r((()=>[m(p(t.updatedDate),1)])),_:2},1032,["title"]),s(d(g),{span:3,class:"list-content-item"},{default:r((()=>[s(d(y),{duration:0},{trigger:r((()=>[s(d(k),{component:d(D),onClick:v((e=>{return l=t,P.value=!0,L.value="edit",void(U.value={...l});var l}),["prevent","stop"])},null,8,["component","onClick"])])),default:r((()=>[m(" 编辑 ")])),_:2},1024),s(d(y),{duration:0},{trigger:r((()=>[s(d(C),{onPositiveClick:e=>async function(t){try{const e=await B(t,O.expandFieldApiConfig);if("SUCCESS"!==(null==e?void 0:e.result))return void V.error((null==e?void 0:e.resultMsg)||"删除失败");V.success("删除成功")}catch(t){V.error(t)}}(t)},{trigger:r((()=>[s(d(k),null,{default:r((()=>[S])),_:1})])),default:r((()=>[m(" 是否确认删除? ")])),_:2},1032,["onPositiveClick"])])),default:r((()=>[m(" 删除 ")])),_:2},1024)])),_:2},1024)])),_:2},1024)))),128))])]),n("div",j,[s(d(x),{onClick:q},{default:r((()=>[m("取消")])),_:1}),s(d(x),{type:"info",onClick:G},{default:r((()=>[m("增加字段")])),_:1})])]),s(w,{visible:P.value,formItemData:U.value,formOntype:L.value,id:t.id,orgId:t.orgId,onCancelModal:H},null,8,["visible","formItemData","formOntype","id","orgId"])]))}});export{F as default};
1
+ import{defineComponent as t,provide as e,ref as l,openBlock as a,createElementBlock as i,createElementVNode as n,createCommentVNode as o,createVNode as s,unref as r,withCtx as d,Fragment as c,renderList as u,createTextVNode as m,toDisplayString as p,createBlock as f,withModifiers as v}from"vue";import{useMessage as h,NGrid as _,NGridItem as g,NTooltip as y,NIcon as k,NPopconfirm as C,NButton as x}from"naive-ui";import{Brush as D}from"@vicons/ionicons5";import w from"./components/form.vue.js";import I from"./hooks/useAsyncData.js";import{InjectionExpandFieldApiConfig as N}from"./constants/index.js";const b={class:"tableset-expand-field"},M={class:"list"},z={class:"table-modal-list"},A={class:"list-content"},S=n("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 32 32"},[n("path",{d:"M12 12h2v12h-2z",fill:"currentColor"}),n("path",{d:"M18 12h2v12h-2z",fill:"currentColor"}),n("path",{d:"M4 6v2h2v20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8h2V6zm4 22V8h16v20z",fill:"currentColor"}),n("path",{d:"M12 2h8v2h-8z",fill:"currentColor"})],-1),j={class:"footer"};var F=t({__name:"index",props:{id:{type:String,default:""},expandFieldApiConfig:{type:Object},tableData:{type:Array,default:()=>[]},orgId:{type:String,default:""}},emits:["closeModal"],setup(t,{emit:F}){const O=t,V=h(),{deleteExtendFieldById:B}=I();e(N,O.expandFieldApiConfig);const E=[{title:"字段标题",columnName:"name",span:3},{title:"字段键名",columnName:"code",span:3},{title:"字段类型",columnName:"html_type",span:3},{title:"问号提示",columnName:"remark",span:4},{title:"创建时间",columnName:"createdDate",span:4},{title:"修改时间",columnName:"updatedDate",span:4},{title:"操作",columnName:"operator",span:3}],P=l(!1),L=l("add"),U=l({});function q(){F("closeModal")}function G(){P.value=!0,L.value="add",U.value={}}function H(){P.value=!1}return(e,l)=>(a(),i("div",b,[n("div",M,[n("div",z,[o(' <div class="list-title">\r\n\t\t\t\t\t<span class="list-title-item" v-for="titleItem in filedList" :key="titleItem.columnName">\r\n\t\t\t\t\t\t{{ titleItem.title }}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t</div> '),s(r(_),{cols:24,class:"list-title"},{default:d((()=>[(a(),i(c,null,u(E,(t=>s(r(g),{span:t.span,class:"list-title-item",key:t.columnName},{default:d((()=>[m(p(t.title),1)])),_:2},1032,["span"]))),64))])),_:1}),n("div",A,[(a(!0),i(c,null,u(t.tableData,((t,e)=>(a(),f(r(_),{key:e,class:"list-content-block"},{default:d((()=>[s(r(g),{span:3,title:t.name,class:"list-content-item"},{default:d((()=>[m(p(t.name),1)])),_:2},1032,["title"]),s(r(g),{span:3,title:t.code,class:"list-content-item"},{default:d((()=>[m(p(t.code),1)])),_:2},1032,["title"]),s(r(g),{span:3,title:t.html_type,class:"list-content-item"},{default:d((()=>[m(p(t.html_type),1)])),_:2},1032,["title"]),s(r(g),{span:4,title:t.remark,class:"list-content-item"},{default:d((()=>[m(p(t.remark),1)])),_:2},1032,["title"]),s(r(g),{span:4,title:t.createdDate,class:"list-content-item"},{default:d((()=>[m(p(t.createdDate),1)])),_:2},1032,["title"]),s(r(g),{span:4,title:t.updatedDate,class:"list-content-item"},{default:d((()=>[m(p(t.updatedDate),1)])),_:2},1032,["title"]),s(r(g),{span:3,class:"list-content-item"},{default:d((()=>[s(r(y),{duration:0},{trigger:d((()=>[s(r(k),{component:r(D),onClick:v((e=>{return l=t,P.value=!0,L.value="edit",void(U.value={...l});var l}),["prevent","stop"])},null,8,["component","onClick"])])),default:d((()=>[m(" 编辑 ")])),_:2},1024),s(r(y),{duration:0},{trigger:d((()=>[s(r(C),{onPositiveClick:e=>async function(t){try{const e=await B(t,O.expandFieldApiConfig);if("SUCCESS"!==(null==e?void 0:e.result))return void V.error((null==e?void 0:e.resultMsg)||"删除失败");V.success("删除成功")}catch(t){V.error(t)}}(t)},{trigger:d((()=>[s(r(k),null,{default:d((()=>[S])),_:1})])),default:d((()=>[m(" 是否确认删除? ")])),_:2},1032,["onPositiveClick"])])),default:d((()=>[m(" 删除 ")])),_:2},1024)])),_:2},1024)])),_:2},1024)))),128))])]),n("div",j,[s(r(x),{onClick:q},{default:d((()=>[m("取消")])),_:1}),s(r(x),{type:"info",onClick:G},{default:d((()=>[m("增加字段")])),_:1})])]),s(w,{visible:P.value,formItemData:U.value,formOntype:L.value,id:t.id,orgId:t.orgId,onCancelModal:H},null,8,["visible","formItemData","formOntype","id","orgId"])]))}});export{F as default};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as t,drawLine as n,drawPoint as o}from"../useDraw.js";import{useGrid as i}from"../useGrid.js";import{useBirthProcessCumputedPoint as l}from"../useCumputedPoint.js";import{useCommon as r}from"../useCommon.js";import"vue";import{getPointRange as a,getIndex as s,isEffectiveNode as u,getTime as f}from"../../utils/index.js";import{cloneDeep as c}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function p(p,d,m,v,g){const{cumputedX:h,cumputedY:y,getXValue:x,getYValue:L}=l(d),{xCellWidth:k,pointSelectionStyle:P,originX:w,endX:b,originY:A,endY:C,event:j,scaleValues:T,xAxis:M,startTime:X,timeXCell:E,itemList:I,dialog:$}=d,O=new Map,S=new Set,Y=c(T);let V=[],_=null;i(p,d);const{getEqualXTypes:D,handleAddPrevent:N}=r(p,m,d);function z(){Y.forEach((e=>{e.dataList.forEach(((t,o)=>{t.show&&(!function(e,t){const{max:o={},min:i={}}=e.panicValue||{};function l({show:e=!1,value:o,name:i,lineStyle:l}){if(!e||!o)return;const r=y(t.type,t.range,o),a=n([w,r,b,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});j.hovered&&i&&(a.on("mousemove",(({pointer:e})=>{v.point={...e||{x:a.left,y:a.top}},v.list=[`${i} ${o}${t.unit||""}`],v.show=!0})),a.on("mouseout",(()=>{v.show=!1}))),p.value.add(a)}l(o),l(i)}(t,e),J(t,o,e))}))}))}function G(){_&&p.value.remove(_),_=null}function J(e,t,i){var l;const{type:r,unit:a,dataList:s=[]}=i,u=[];O.set(e.key,[]),null==(l=e.list)||l.forEach(((l,s)=>{!function(e,l,s,f){var c;let g,h;const{pointAttr:y={},lineAttr:P={},title:w="",key:b,type:A="circle"}=f,C=K(f.list[s+1],i);e&&C&&!l.breakpoint&&e[0]!==C[0]&&(h=n([...e,...C],P));const T=u[s-1],M={origin:{data:l,title:w,key:b||"",unit:a,type:r,dataIndex:t,index:s,lineAttr:P},__type:"main",leftLine:T,rightLine:h,...y,...d.event.hovered?d.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:d.event};T?g=o(A,{left:T.get("x2"),top:T.get("y2"),...M}):e&&(M.leftLine=null,g=o(A,{left:e[0],top:e[1],...M}));u.push(h),g&&(g.originLeft=g.left,g.originTop=g.top,function(e){j.hovered&&(e.on("mouseover",(()=>{B(e,"hover")})),e.on("mouseout",(()=>{v.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{H(e),function(e){var t,n;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top})}(e),j.hovered&&B(e),function(e){const{originLeft:t,originTop:n,left:o,top:i,origin:l}=e,r=~~((o-t)/k);if(o>t+k&&!e.nextPoint){if(0===V.length){q(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[t,n],t,n]),e.leftLine&&e.leftLine.set({stroke:"transparent"})}const o=t+k*r;if(V.every((e=>e.left!==o))){const t=x(o),n=L(l.type,i);V.push({data:{time:t,value:n},left:o,top:i}),q(e,[...e.prevPointer,o,i])}V.length<r&&function(e,t){const{originLeft:n,originTop:o,origin:i}=e;let l=1;for(;l<=t;){const t=n+k*l,r=V.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=V.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=V[l-1]||{left:n,top:o},u=~~((r.left-(t-k))/k),f=(r.top-s.top)/u;a.top=s.top+f,a.left=t,a.data={time:x(t),value:L(i.type,a.top)},V.splice(l,0,a),q(e,[s.left,s.top,a.left,a.top])}}l++}}(e,r)}if(V.length>0&&o<V[V.length-1].left){for(const e of S)e.left>o&&(e.leftLine&&p.value.remove(e.leftLine),p.value.remove(e));if(V=V.filter((e=>e.left<=o)),0===V.length){e.leftLine&&e.leftLine.set(e.origin.lineAttr);for(const e of S)e.leftLine&&p.value.remove(e.leftLine),p.value.remove(e)}if(V.length>0){const t=V.at(-1);e.prevPointer=[t.left,t.top]}}}(e)})),e.on("mouseup",(t=>{if(v.show=!1,1===t.button){const{key:t,type:n}=e.origin,o={...e.origin,data:{...e.origin.data,time:x(e.left),value:L(n,e.top)}};if(p.value.discardActiveObject(),V.length>0){const e=V.map((e=>e.data));m("add",{...o,data:e}),F({...o,data:e})}else m("change",o),F(o,"change")}}))}(g),null==(c=O.get(b))||c.push(g))}(K(l,i),l,s,e)})),Promise.all(O.get(e.key)).then((e=>{const t=u.filter((e=>e));let n=null;e=e.map((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),p.value.add(...t,...e)}))}function q(e,t){const[o,i,l,r]=t;e.clone((o=>{o.set({left:l,top:r}),e.prevPointer=[l,r];const i=n(t,e.origin.lineAttr);o.leftLine=i,S.add(o),p.value.add(i,o)}))}function F(e,t="add",n=1){const{dataIndex:o,data:i,index:l,key:r,type:a}=e,u=Y.find((e=>e.type===a)),f=u.dataList.find((e=>e.key===r));switch(t){case"remove":f.list.splice(l,n);break;case"change":f.list[l]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=s(e,f.list),n=Array.isArray(i)?i:[i];f.list.splice(t,0,...n);break}}R({dataIndex:o,scaleValue:u})}function R(e){var t,n,o;if(S.size&&(null==(t=p.value)||t.remove(...W([...S]))),S.clear(),V=[],e){const{dataIndex:t,scaleValue:o}=e,i=o.dataList[t];null==(n=p.value)||n.remove(...W(O.get(i.key))),O.delete(i.key),J(i,t,o)}else O.size&&(null==(o=p.value)||o.remove(...W(Q()))),O.clear(),z()}function W(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine)})),t}function B(e,t="moving"){const{title:n,type:o,data:i,unit:l}=e.origin;v.point={x:e.left,y:e.top};const r=`${"hover"===t?i.value:L(o,e.top)}`;v.list=[`${n} ${r}${l||""}`,`时间 ${x(e.left).slice(-5)}`],v.show=!0}function H(e){e.setCoords();const t=6e4/E,n=e.prevPoint?e.prevPoint.left+t:w,o=e.nextPoint?e.nextPoint.left-t:b;e.top<A&&e.set("top",A),e.top>C&&e.set("top",C),e.left<n&&e.set("left",n),e.left>o&&e.set("left",o)}function K(e,t){if(u(e)&&function(e){const t=Date.parse(M.list.at(-1)),n=f(e);return n>=X&&n<=t}(e.time)){const n=h(e.time),o=y(t.type,t.range,e.value);return[n,o<A?A:o>C?C:o]}}function Q(){return Array.from(O.values()).flat()}return z(),function(){if(!j.evented)return;let n=!1,o={x:0,y:0};p.value.on("mouse:up",(e=>{if(3===e.button&&function(e){const{x:t=0,y:n=0}=e.pointer||{};if(t>=w&&t<=b&&n>=A&&n<=C)if(e.target){if("main"!==e.target.__type)return;o(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:i,maxTop:l}=a(e.target);Q().forEach((o=>{"main"===o.__type&&o.left>t&&o.left<n&&o.top>i&&o.top<l&&g.list.push({renderItem:()=>o.origin.title,origin:{...o.origin},mode:"remove",pointer:e.pointer})})),1===g.list.length&&(g.show=!1,console.log("当前时间段内无可删除节点"))}else o(e.pointer,null,["新增节点"]),I.forEach((n=>{D(Q(),t,"key",2*k).includes(n.key)||g.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key},pointer:e.pointer})})),1===g.list.length&&(g.show=!1,N("repeat"),console.log("当前时间段内无可新增节点"));function o(e,t,n){Object.assign(g,{point:e,show:!0,target:t,list:n})}}(e),1===e.button&&n){n=!1;const e=function(){if(!(null==_?void 0:_.areaPos))return[];const{startPos:e,endPos:t}=_.areaPos,[n,o]=[e.x,t.x].sort(((e,t)=>e-t)),[i,l]=[e.y,t.y].sort(((e,t)=>e-t));return Q().filter((e=>e.left>=n&&e.left<=o&&e.top>=i&&e.top<=l))}();e.length>0?$.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{const t=function(e){const t=e.reduce(((e,t)=>{const{key:n}=t.origin;return e[n]=e[n]?e[n].concat(t.origin):[t.origin],e}),{});return Object.keys(t).map((e=>{const n=t[e].sort(((e,t)=>Date.parse(e.data.time)-Date.parse(t.data.time)));return F(n[0],"remove",n.length),n}))}(e);m("remove",t),G()},onNegativeClick:()=>G(),onClose:()=>G()}):G()}})),p.value.on("mouse:down",(e=>{1!==e.button||e.target||(n=!0,o=e.pointer)})),p.value.on("mouse:move",(i=>{if(!n)return;const{x:l,y:r}=o,{x:a,y:s}=i.pointer;_&&p.value.remove(_),_=new e.Rect({...t,fill:"#CAF982",opacity:.4,...P,left:l,top:r,width:a-l,height:s-r,objectCaching:!0}),_.areaPos={startPos:o,endPos:i.pointer},p.value.add(_)}))}(),{redrawPoints:R,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(m("remove",n),F(n,"remove")):(Object.assign(n,{data:{time:x(e.pointer.x),value:L(e.origin.type,e.pointer.y)}}),m("add",n),F(n))},moveLimit:H,setPopup:B,updateData:F,getGridPoints:Q}}export{p as useCenter};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as t,drawLine as n,drawPoint as o}from"../useDraw.js";import{useGrid as i}from"../useGrid.js";import{useBirthProcessCumputedPoint as l}from"../useCumputedPoint.js";import{useCommon as r}from"../useCommon.js";import"vue";import{getPointRange as a,getIndex as s,isEffectiveNode as u,getTime as f}from"../../utils/index.js";import{cloneDeep as c}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function p(p,d,m,v,g){const{cumputedX:h,cumputedY:y,getXValue:x,getYValue:L}=l(d),{xCellWidth:k,yCellHeight:P,originX:w,endX:b,originY:C,endY:A,event:j,scaleValues:T,xAxis:M,startTime:X,timeXCell:E,itemList:I,dialog:$}=d,O=new Map,Y=new Set,V=c(T);let _=[],D=null;i(p,d);const{getEqualXTypes:S,handleAddPrevent:N}=r(p,m,d);function z(){V.forEach((e=>{e.dataList.forEach(((t,o)=>{t.show&&(!function(e,t){const{max:o={},min:i={}}=e.panicValue||{};function l({show:e=!1,value:o,name:i,lineStyle:l}){if(!e||!o)return;const r=y(t.type,t.range,o),a=n([w,r,b,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});j.hovered&&i&&(a.on("mousemove",(({pointer:e})=>{v.point={...e||{x:a.left,y:a.top}},v.list=[`${i} ${o}${t.unit||""}`],v.show=!0})),a.on("mouseout",(()=>{v.show=!1}))),p.value.add(a)}l(o),l(i)}(t,e),J(t,o,e))}))}))}function G(){D&&p.value.remove(D),D=null}function J(e,t,i){var l;const{type:r,unit:a,dataList:s=[]}=i,u=[];O.set(e.key,[]),null==(l=e.list)||l.forEach(((l,s)=>{!function(e,l,s,f){var c;let g,h;const{pointAttr:y={},lineAttr:P={},title:w="",key:b,type:C="circle"}=f,A=K(f.list[s+1],i);e&&A&&!l.breakpoint&&e[0]!==A[0]&&(h=n([...e,...A],P));const T=u[s-1],M={origin:{data:l,title:w,key:b||"",unit:a,type:r,dataIndex:t,index:s,lineAttr:P},__type:"main",leftLine:T,rightLine:h,...y,...d.event.hovered?d.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:d.event};T?g=o(C,{left:T.get("x2"),top:T.get("y2"),...M}):e&&(M.leftLine=null,g=o(C,{left:e[0],top:e[1],...M}));u.push(h),g&&(g.originLeft=g.left,g.originTop=g.top,function(e){j.hovered&&(e.on("mouseover",(()=>{W(e,"hover")})),e.on("mouseout",(()=>{v.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{B(e),function(e){var t,n;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top})}(e),j.hovered&&W(e),function(e){const{originLeft:t,originTop:n,left:o,top:i,origin:l}=e,r=~~((o-t)/k);if(o>t+k&&!e.nextPoint){if(0===_.length){q(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[t,n],t,n]),e.leftLine&&e.leftLine.set({stroke:"transparent"})}const o=t+k*r;if(_.every((e=>e.left!==o))){const t=x(o),n=L(l.type,i);_.push({data:{time:t,value:n},left:o,top:i}),q(e,[...e.prevPointer,o,i])}_.length<r&&function(e,t){const{originLeft:n,originTop:o,origin:i}=e;let l=1;for(;l<=t;){const t=n+k*l,r=_.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=_.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=_[l-1]||{left:n,top:o},u=~~((r.left-(t-k))/k),f=(r.top-s.top)/u;a.top=s.top+f,a.left=t,a.data={time:x(t),value:L(i.type,a.top)},_.splice(l,0,a),q(e,[s.left,s.top,a.left,a.top])}}l++}}(e,r)}if(_.length>0&&o<_[_.length-1].left){for(const e of Y)e.left>o&&(e.leftLine&&p.value.remove(e.leftLine),p.value.remove(e));if(_=_.filter((e=>e.left<=o)),0===_.length){e.leftLine&&e.leftLine.set(e.origin.lineAttr);for(const e of Y)e.leftLine&&p.value.remove(e.leftLine),p.value.remove(e)}if(_.length>0){const t=_.at(-1);e.prevPointer=[t.left,t.top]}}}(e)})),e.on("mouseup",(t=>{if(v.show=!1,1===t.button){const{key:t,type:n}=e.origin,o={...e.origin,data:{...e.origin.data,time:x(e.left),value:L(n,e.top)}};if(p.value.discardActiveObject(),_.length>0){const e=_.map((e=>e.data));m("add",{...o,data:e}),F({...o,data:e})}else m("change",o),F(o,"change")}}))}(g),null==(c=O.get(b))||c.push(g))}(K(l,i),l,s,e)})),Promise.all(O.get(e.key)).then((e=>{const t=u.filter((e=>e));let n=null;e=e.map((e=>(e&&n&&(n.nextPoint=e,e.prevPoint=n),n=e||n,e))),p.value.add(...t,...e)}))}function q(e,t){const[o,i,l,r]=t;e.clone((o=>{o.set({left:l,top:r}),e.prevPointer=[l,r];const i=n(t,e.origin.lineAttr);o.leftLine=i,Y.add(o),p.value.add(i,o)}))}function F(e,t="add",n=1){const{dataIndex:o,data:i,index:l,key:r,type:a}=e,u=V.find((e=>e.type===a)),f=u.dataList.find((e=>e.key===r));switch(t){case"remove":f.list.splice(l,n);break;case"change":f.list[l]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=s(e,f.list),n=Array.isArray(i)?i:[i];f.list.splice(t,0,...n);break}}H({dataIndex:o,scaleValue:u})}function H(e){var t,n,o;if(Y.size&&(null==(t=p.value)||t.remove(...R([...Y]))),Y.clear(),_=[],e){const{dataIndex:t,scaleValue:o}=e,i=o.dataList[t];null==(n=p.value)||n.remove(...R(O.get(i.key))),O.delete(i.key),J(i,t,o)}else O.size&&(null==(o=p.value)||o.remove(...R(Q()))),O.clear(),z()}function R(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine)})),t}function W(e,t="moving"){const{title:n,type:o,data:i,unit:l}=e.origin;v.point={x:e.left,y:e.top};const r=`${"hover"===t?i.value:L(o,e.top)}`;v.list=[`${n} ${r}${l||""}`,`时间 ${x(e.left).slice(-5)}`],v.show=!0}function B(e){e.setCoords();const t=6e4/E,n=e.prevPoint?e.prevPoint.left+t:w,o=e.nextPoint?e.nextPoint.left-t:b;e.top<C&&e.set("top",C),e.top>A&&e.set("top",A),e.left<n&&e.set("left",n),e.left>o&&e.set("left",o)}function K(e,t){if(u(e)&&function(e){const t=Date.parse(M.list.at(-1)),n=f(e);return n>=X&&n<=t}(e.time)){const n=h(e.time),o=y(t.type,t.range,e.value);return[n,o<C?C:o>A?A:o]}}function Q(){return Array.from(O.values()).flat()}return z(),function(){if(!j.evented)return;let n=!1,o={x:0,y:0};p.value.on("mouse:up",(e=>{3===e.button&&function(e){const{x:t=0,y:n=0}=e.pointer||{};if(t>=w&&t<=b&&n>=C&&n<=A)if(e.target){if("main"!==e.target.__type)return;o(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:i,maxTop:l}=a(e.target);Q().forEach((o=>{"main"===o.__type&&o.left>t&&o.left<n&&o.top>i&&o.top<l&&g.list.push({renderItem:()=>o.origin.title,origin:{...o.origin},mode:"remove",pointer:e.pointer})})),1===g.list.length&&(g.show=!1,console.log("当前时间段内无可删除节点"))}else o(e.pointer,null,["新增节点"]),I.forEach((n=>{S(Q(),t,"key",2*k).includes(n.key)||g.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key},pointer:e.pointer})})),1===g.list.length&&(g.show=!1,N("repeat"),console.log("当前时间段内无可新增节点"));function o(e,t,n){Object.assign(g,{point:e,show:!0,target:t,list:n})}}(e),1===e.button&&n&&(n=!1,$.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{const e=function(){const{startPos:e,endPos:t}=D.areaPos,[n,o]=[e.x,t.x].sort(((e,t)=>e-t)),[i,l]=[e.y,t.y].sort(((e,t)=>e-t)),r=Q().filter((e=>e.left>=n&&e.left<=o&&e.top>=i&&e.top<=l)).reduce(((e,t)=>{const{key:n}=t.origin;return e[n]=e[n]?e[n].concat(t.origin):[t.origin],e}),{});return Object.keys(r).map((e=>{const t=r[e].sort(((e,t)=>Date.parse(e.data.time)-Date.parse(t.data.time)));return F(t[0],"remove",t.length),t}))}();m("remove",e),G()},onNegativeClick:()=>G(),onClose:()=>G()}))})),p.value.on("mouse:down",(e=>{1!==e.button||e.target||(n=!0,o=e.pointer)})),p.value.on("mouse:move",(i=>{if(!n)return;const{x:l,y:r}=o,{x:a,y:s}=i.pointer;D&&p.value.remove(D),D=new e.Rect({...t,fill:"#CAF982",opacity:.4,left:l,top:r,width:a-l,height:s-r,objectCaching:!0}),D.areaPos={startPos:o,endPos:i.pointer},p.value.add(D)}))}(),{redrawPoints:H,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(m("remove",n),F(n,"remove")):(Object.assign(n,{data:{time:x(e.pointer.x),value:L(e.origin.type,e.pointer.y)}}),m("add",n),F(n))},moveLimit:B,setPopup:W,updateData:F,getGridPoints:Q}}export{p as useCenter};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as i}from"../useDraw.js";import{useBirthProcessCumputedPoint as o}from"../useCumputedPoint.js";import{useCommon as n}from"../useCommon.js";import"vue";import{getIndex as r}from"../../utils/index.js";import{cloneDeep as a}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as l}from"../../constants/index.js";import"naive-ui";function s(s,d,u,c,f){const{cumputedX:h,getXValue:m}=o(d),{getEqualXTypes:p,handleAddPrevent:v,isGridLimit:g}=n(s,u,d),{other:y,yCellHeight:k,xCellWidth:x,endX:X,originX:b,originY:w,endY:A,markHeight:j,event:C,topGridYCellHeight:E}=d,z=new Map,P=a(y);function S(){var o;if(!(null==(o=null==P?void 0:P.horizontal)?void 0:o.length))return;const n="horizontal";z.set(n,[]);const{horizontal:r}=P;let a=w+k/2;r.forEach(((o,r)=>{const{title:l,type:d,pointAttr:u={},textStyle:c={},data:f}=o;f.forEach(((o,f)=>{const{time:m,value:p}=o,v=h(m);if(!V(v))return;const g=e(d,{...u,left:v,top:a}),y=v+g.width/2+2,k=i([y,a],{value:p,...c,originX:"left"}),x=new t.Group([g,k],{lockMovementX:!0,lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer"});x.originLeft=v,x.origin={type:"other",key:n,dataIndex:r,index:f,data:o,title:l},Y(x),z.get(n).push(x),s.value.add(x)})),a+=k}))}function L(){var t;if(!(null==(t=null==P?void 0:P.vertical)?void 0:t.length))return;const i="vertical";z.set(i,[]);const{vertical:o}=P;o.forEach(((t,o)=>{const{textStyle:n={},data:r,time:a}=t,l=h(a);if(!V(l))return;let d=w+k/2;r.forEach(((t,r)=>{const u=e(String(t),{...n,lockMovementX:!0,lockMovementY:!0,left:l,originX:"left",top:d,origin:{type:"other",key:i,dataIndex:o,index:r,data:{time:a,value:t}}});d+=k,Y(u),z.get(i).push(u),s.value.add(u)}))}))}function M(t,e="add"){const{dataIndex:i,data:o,index:n,key:a}=t,l=P[a],d=["mark"].includes(a)?l.dataList[i]:l[i];switch(e){case"remove":d.data.splice(n,1);break;case"change":d.data[n]=o;break;default:{const t=Array.isArray(o)?o[0].time:o.time,e=r(t,d.data),i=Array.isArray(o)?o:[o];d.data.splice(e,0,...i);break}}!function(t){var e;const{key:i}=t;switch(null==(e=s.value)||e.remove(...z.get(i)),z.delete(i),i){case"horizontal":S();break;case"vertical":L();break;case"mark":I()}}(t)}function I(){if(!(null==y?void 0:y.mark)||!j)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=y.mark,a=i([b-5,A+j/2],{value:t,...o,originX:"right"});s.value.add(a);const l=A+j,d=[];r.forEach((t=>{const{time:i,list:o=[]}=t,r=h(i);if(!V(r))return;let a=A;o.forEach((t=>{let i=!1;const o=e("circleAndText",{...n,text:t.text,left:r,top:a,origin:{data:t,key:"mark",type:"other"}}),u=o.height;a+u<=l&&a>=A?(o.set("top",a+u/2),a+=u):(i||(a=A,i=!0),o.set("top",a-u/2),a-=u),d.push(o),Y(o),s.value.add(o)}))})),function(t){const e=t=>{var e,i;return null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart},i=t.find((t=>e(t))),o=t.find((t=>!e(t)&&t.left>i.left)),n=t.filter((t=>!e(t)));t.forEach((t=>{const r={x1:b,x2:X};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(d)}function Y(t){if(C.hovered&&(t.on("mouseover",(()=>{T(t)})),t.on("mouseout",(()=>{c.show=!1}))),!C.evented)return;const{key:e}=t.origin;"mark"===e&&t.on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2);t.top<w&&t.set("top",w);const e=A+j-t.height/2;t.top>e&&t.set("top",e)}(t),C.hovered&&T(t)})),t.on("mouseup",(i=>{if(c.show=!1,1===i.button&&["mark"].includes(e)){!function(t){var e,i;if((null==(i=null==(e=t.origin)?void 0:e.data)?void 0:i.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left)),i=Math.min(...e);t.startPoint.limitX.x2=i}}(t);const e={...t.origin,time:m(t.left),data:t.origin.data};s.value.discardActiveObject(),u("change",e)}3===i.button&&["horizontal","vertical"].includes(e)&&(f.point={x:t.left,y:t.top},f.show=!0,f.target=t,f.list=l.map((t=>({...t,renderItem:()=>t.label}))))}))}function T(t){var e,i,o;c.point={x:t.left,y:"mark"===(null==(e=t.origin)?void 0:e.type)?t.top:t.top+E/2},c.list=[`时间 ${m(null!=(i=t.originLeft)?i:t.left).slice(-5)}`],"mark"===(null==(o=t.origin)?void 0:o.type)&&c.list.unshift(t.origin.name+" "),c.show=!0}function V(t){return t>=b&&t<=X}return function(){var t;if(!(null==(t=null==P?void 0:P.horizontal)?void 0:t.length))return;const{horizontal:i}=P,o=b-5;let n=w+k/2;i.forEach(((t,i)=>{const{title:r,titleStyle:a={},defaultAddValue:l}=t,d=r&&e(r,{...a,originX:"right",left:o,top:n,origin:{defaultAddValue:l,dataIndex:i,type:"other",key:"horizontal",title:r},originLeft:o,originTop:n});var f;(f=d).on("moving",(()=>{f.set("originX","center"),g(f)?T(f):c.show=!1})),f.on("mouseup:before",(t=>{if(c.show=!1,0===t.e.button&&g(f))if(p(z.get("horizontal"),f.left,"key",x).includes(f.origin.key))v("repeat");else{const t={data:{time:m(f.left),value:f.origin.defaultAddValue},...f.origin};u("add",t),M(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(f)})),s.value.add(d),n+=k}))}(),S(),L(),I(),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i}=t,o={...e.origin,type:"other"};u(i,o),"remove"===i&&M(o,i)}}}export{s as useOther};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawPoint as e,drawText as o}from"../useDraw.js";import{useBirthProcessCumputedPoint as i}from"../useCumputedPoint.js";import"vue";import{cloneDeep as n}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as r}from"../../constants/index.js";import"naive-ui";function a(a,l,s,u,c){const{cumputedX:d,getXValue:f}=i(l),{other:m,yCellHeight:h,endX:v,originX:p,originY:g,endY:x,markHeight:k,event:y,topGridYCellHeight:X}=l,w=new Map,_=n(m);function S(){var i;if(!(null==(i=null==_?void 0:_.horizontal)?void 0:i.length))return;const n="horizontal";w.set(n,[]);const{horizontal:r}=_,l=p-5;let s=g+h/2;r.forEach(((i,r)=>{const{title:u,titleStyle:c={},type:f,pointAttr:m={},textStyle:v={},data:p}=i,g=u&&e(u,{...c,originX:"right",left:l,top:s});a.value.add(g),p.forEach(((i,l)=>{const{time:c,value:h}=i,p=d(c);if(!P(p))return;const g=e(f,{...m,left:p,top:s}),x=p+g.width/2+2,k=o([x,s],{value:h,...v,originX:"left"}),y=new t.Group([g,k],{lockMovementX:!0,lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer"});y.__type="other",y.origin={__type:"other",key:n,dataIndex:r,index:l,data:i,title:u},M(y),w.get(n).push(y),a.value.add(y)})),s+=h}))}function b(){var t;if(!(null==(t=null==_?void 0:_.vertical)?void 0:t.length))return;const o="vertical";w.set(o,[]);const{vertical:i}=_;i.forEach(((t,i)=>{const{textStyle:n={},data:r,time:l}=t,s=d(l);if(!P(s))return;let u=g+h/2;r.forEach(((t,r)=>{const c=e(String(t),{...n,lockMovementX:!0,lockMovementY:!0,left:s,originX:"left",top:u,__type:"other",origin:{key:o,dataIndex:i,index:r,data:{time:l,value:t}}});u+=h,M(c),w.get(o).push(c),a.value.add(c)}))}))}function M(t){y.hovered&&(t.on("mouseover",(()=>{E(t)})),t.on("mouseout",(()=>{u.show=!1}))),y.evented&&t.on("mouseup",(e=>{u.show=!1,3===e.button&&(c.point={x:t.left,y:t.top},c.show=!0,c.target=t,c.list=r.map((t=>({...t,renderItem:()=>t.label}))))}))}function j(){if(!(null==m?void 0:m.mark)||!k)return;const{title:t,titleStyle:i,pointAttr:n,dataList:r}=m.mark,l=o([p-5,x+k/2],{value:t,...i,originX:"right"});a.value.add(l);const c=x+k,h=[];r.forEach((t=>{const{time:o,list:i=[]}=t,r=d(o);if(!P(r))return;let l=x;i.forEach((t=>{let o=!1;const i=e("circleAndText",{...n,text:t.text,left:r,top:l,origin:{...t,key:"mark"},__type:"mark"}),d=i.height;l+d<=c&&l>=x?(i.set("top",l+d/2),l+=d):(o||(l=x,o=!0),i.set("top",l-d/2),l-=d),h.push(i),function(t){y.hovered&&(t.on("mouseover",(()=>{E(t)})),t.on("mouseout",(()=>{u.show=!1})));if(t.lockMovementX&&t.lockMovementY)return;t.on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2);t.top<g&&t.set("top",g);const e=x+k-t.height/2;t.top>e&&t.set("top",e)}(t),y.hovered&&E(t)})),t.on("mouseup",(e=>{if(u.show=!1,1===e.button){!function(t){var e;if((null==(e=t.origin)?void 0:e.isStart)&&t.otherPoints)t.otherPoints.forEach((e=>{e.limitX.x1=t.left}));else{const e=t.startPoint.otherPoints.map((t=>t.left)),o=Math.min(...e);t.startPoint.limitX.x2=o}}(t);const e={type:"mark",time:f(t.left),data:t.origin};a.value.discardActiveObject(),s("change",e)}}))}(i),a.value.add(i)}))})),function(t){const e=t.find((t=>{var e;return null==(e=t.origin)?void 0:e.isStart})),o=t.find((t=>{var o;return!(null==(o=t.origin)?void 0:o.isStart)&&t.left>e.left})),i=t.filter((t=>{var e;return!(null==(e=t.origin)?void 0:e.isStart)}));t.forEach((t=>{var n;const r={x1:p,x2:v};(null==(n=t.origin)?void 0:n.isStart)?(r.x2=o.left,t.otherPoints=i):(r.x1=e.left,t.startPoint=e),t.limitX=r}))}(h)}function E(t){u.point={x:t.left,y:"mark"===t.__type?t.top:t.top+X/2},u.list=[`时间 ${f(t.left).slice(-5)}`],"mark"===t.__type&&u.list.unshift(t.origin.name+" "),u.show=!0}function P(t){return t>=p&&t<=v}return S(),b(),j(),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:o}=t,i={...e.origin,type:"other"};s(o,i),"remove"===o&&function(t,e="add"){const{dataIndex:o,data:i,index:n,key:r}=t,l=_[r],s=["mark"].includes(r)?l.dataList[o]:l[o];switch(e){case"remove":s.data.splice(n,1);break;case"change":s.data[n]=i}!function(t){var e;const{key:o}=t;switch(null==(e=a.value)||e.remove(...w.get(o)),w.delete(o),o){case"horizontal":S();break;case"vertical":b();break;case"mark":j()}}(t)}(i,o)}}}export{a as useOther};
@@ -1 +1 @@
1
- import{ref as e,computed as t,reactive as a,unref as r,onMounted as i,nextTick as l}from"vue";import{useDialog as n}from"naive-ui";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as o}from"date-fns";import{getChildrenSize as s}from"../../utils/index.js";import{cloneDeep as d,range as c}from"lodash-es";import"../temperature/useShadow.js";import{OTHER_MENU as p}from"../../constants/index.js";import{useTop as m}from"./useTop.js";import{useLeft as v}from"./useLeft.js";import{useCenter as h}from"./useCenter.js";import{useOther as f}from"./useOther.js";function g(g,y,x,w,b,j){const Y=n(),C=e(),H=e(),S=e(),D=t((()=>y.data.layout||{top:"drug",center:"xAxis",bottom:"intraoperatively"})),A=t((()=>{var e;return null!=(e=y.data.left.width)?e:0})),M=t((()=>{const{grid:e}=y.data;return e.mainXCell*e.subXCell})),T=t((()=>{const{grid:e}=y.data;return e.mainYCell*e.subYCell})),X=t((()=>s(y.data.top.treeData))),G=t((()=>y.data.top.tree.cellHeight)),V=t((()=>G.value*X.value)),k=t((()=>ee($("drug")||"top"))),L=t((()=>k.value+V.value)),N=t((()=>{var e;return Date.parse((null==(e=y.data.xAxis)?void 0:e.startTime)||o(new Date,"yyyy-MM-dd HH:mm:ss"))})),O=t((()=>{const e=d(y.data.xAxis),{spaceValue:t,spaceTimeStamp:a}=e,r=c(M.value/t+1).map((r=>0===r?e.startTime:o(new Date(N.value+r*t*a),"yyyy-MM-dd HH:mm:ss")));return{...e,list:r,left:A.value}})),P=function(){const e=d(y.data.top.treeData);let t=0;const{cellWidth:a,cellHeight:r}=y.data.top.tree;return function e(i,l=0){i.forEach((i=>{var n;const u={top:t*r+k.value,left:l*a,width:a,height:r};if(t++,null==(n=i.children)?void 0:n.length){t--;const a=s(i.children);u.height=a*r,e(i.children,l+1)}else u.width=A.value-u.left;Object.assign(i,u)}))}(e),e}(),W=t((()=>ee($("xAxis")||"center"))),E=t((()=>{var e;const{width:t,right:a}=y.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),I=t((()=>ee($("intraoperatively")||"bottom"))),q=t((()=>{var e;const{show:t=!0,height:a}=(null==(e=y.data.other)?void 0:e.mark)||{};return t&&a?a:0})),z=t((()=>I.value+(y.data.height-V.value-O.value.height-q.value))),B=t((()=>(E.value-A.value)/M.value)),F=t((()=>(z.value-I.value)/T.value)),J=t((()=>O.value.spaceTimeStamp/B.value)),K=t((()=>{const{scaleValues:e}=y.data;return e.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:e.type,unit:e.unit,dataIndex:a}))))).flat()})),Q=t((()=>te("pulse"))),R=t((()=>te("temperature"))),U=t((()=>{var e;return(null==(e=y.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),Z=a({canvasWidth:y.data.width,canvasHeight:y.data.height,borderStyle:{...u,...y.data.borderStyle},pointSelectionStyle:y.data.pointSelectionStyle||{},grid:y.data.grid,top:y.data.top,left:y.data.left,other:y.data.other,topGridYNumber:r(X),topGridYCellHeight:r(G),topGridOriginY:r(k),topGridEndY:r(L),treeData:P,xAxis:r(O),originYXAxis:r(W),startTime:r(N),timeXCell:r(J),gridXNumber:r(M),gridYNumber:r(T),xCellWidth:r(B),yCellHeight:r(F),originX:r(A),endX:r(E),originY:r(I),endY:r(z),markHeight:r(q),itemList:r(K),scaleValues:y.data.scaleValues,pulseYCell:r(Q),temperatureYCell:r(R),event:r(U),dialog:Y});function $(e){let t="";return Object.entries(D.value).some((([a,r])=>{if(r===e)return t=a,!0})),t}function _(e){const t=D.value[e],a=O.value.height;switch(t){case"drug":return V.value;case"xAxis":return a;default:return y.data.height-V.value-a}}function ee(e){switch(e){case"top":return 0;case"center":return _("top");default:return _("top")+_("center")}}function te(e){const{scaleValues:t}=y.data,a=t.find((t=>t.type===e));return F.value*(a.spaceGridNumber||1)/(a.spaceValue||1)}return i((async()=>{await l(),m(g,Z,x,b);const{redrawPoints:e,clickMenu:t,moveLimit:a,setPopup:r,updateData:i,getGridPoints:n}=h(g,Z,x,b,j);v(g,Z,x,b,a,r,i,n);const{clickMenu:u}=f(g,Z,x,b,j);H.value=e,S.value=e=>{const{item:a}=e;a.type&&p.map((e=>e.type)).includes(a.type)?u(e):t(e)}})),{propItems:Z,redrawPoints:H,select:C,clickMenu:S}}export{g as useSurgicalAnesthesiaChart};
1
+ import{ref as e,computed as t,reactive as a,unref as r,onMounted as i,nextTick as l}from"vue";import{useDialog as n}from"naive-ui";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{format as o}from"date-fns";import{getChildrenSize as s}from"../../utils/index.js";import{cloneDeep as d,range as c}from"lodash-es";import"../temperature/useShadow.js";import{OTHER_MENU as p}from"../../constants/index.js";import{useTop as m}from"./useTop.js";import{useLeft as v}from"./useLeft.js";import{useCenter as h}from"./useCenter.js";import{useOther as f}from"./useOther.js";function g(g,y,x,w,b,j){const Y=n(),C=e(),H=e(),D=e(),A=t((()=>y.data.layout||{top:"drug",center:"xAxis",bottom:"intraoperatively"})),M=t((()=>{var e;return null!=(e=y.data.left.width)?e:0})),T=t((()=>{const{grid:e}=y.data;return e.mainXCell*e.subXCell})),X=t((()=>{const{grid:e}=y.data;return e.mainYCell*e.subYCell})),G=t((()=>s(y.data.top.treeData))),V=t((()=>y.data.top.tree.cellHeight)),k=t((()=>V.value*G.value)),S=t((()=>ee($("drug")||"top"))),L=t((()=>S.value+k.value)),N=t((()=>{var e;return Date.parse((null==(e=y.data.xAxis)?void 0:e.startTime)||o(new Date,"yyyy-MM-dd HH:mm:ss"))})),O=t((()=>{const e=d(y.data.xAxis),{spaceValue:t,spaceTimeStamp:a}=e,r=c(T.value/t+1).map((r=>0===r?e.startTime:o(new Date(N.value+r*t*a),"yyyy-MM-dd HH:mm:ss")));return{...e,list:r,left:M.value}})),P=function(){const e=d(y.data.top.treeData);let t=0;const{cellWidth:a,cellHeight:r}=y.data.top.tree;return function e(i,l=0){i.forEach((i=>{var n;const u={top:t*r+S.value,left:l*a,width:a,height:r};if(t++,null==(n=i.children)?void 0:n.length){t--;const a=s(i.children);u.height=a*r,e(i.children,l+1)}else u.width=M.value-u.left;Object.assign(i,u)}))}(e),e}(),W=t((()=>ee($("xAxis")||"center"))),E=t((()=>{var e;const{width:t,right:a}=y.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),I=t((()=>ee($("intraoperatively")||"bottom"))),q=t((()=>{var e;const{show:t=!0,height:a}=(null==(e=y.data.other)?void 0:e.mark)||{};return t&&a?a:0})),z=t((()=>I.value+(y.data.height-k.value-O.value.height-q.value))),B=t((()=>(E.value-M.value)/T.value)),F=t((()=>(z.value-I.value)/X.value)),J=t((()=>O.value.spaceTimeStamp/B.value)),K=t((()=>{const{scaleValues:e}=y.data;return e.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:e.type,unit:e.unit,dataIndex:a}))))).flat()})),Q=t((()=>te("pulse"))),R=t((()=>te("temperature"))),U=t((()=>{var e;return(null==(e=y.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),Z=a({canvasWidth:y.data.width,canvasHeight:y.data.height,borderStyle:{...u,...y.data.borderStyle||{}},grid:y.data.grid,top:y.data.top,left:y.data.left,other:y.data.other,topGridYNumber:r(G),topGridYCellHeight:r(V),topGridOriginY:r(S),topGridEndY:r(L),treeData:P,xAxis:r(O),originYXAxis:r(W),startTime:r(N),timeXCell:r(J),gridXNumber:r(T),gridYNumber:r(X),xCellWidth:r(B),yCellHeight:r(F),originX:r(M),endX:r(E),originY:r(I),endY:r(z),markHeight:r(q),itemList:r(K),scaleValues:y.data.scaleValues,pulseYCell:r(Q),temperatureYCell:r(R),event:r(U),dialog:Y});function $(e){let t="";return Object.entries(A.value).some((([a,r])=>{if(r===e)return t=a,!0})),t}function _(e){const t=A.value[e],a=O.value.height;switch(t){case"drug":return k.value;case"xAxis":return a;default:return y.data.height-k.value-a}}function ee(e){switch(e){case"top":return 0;case"center":return _("top");default:return _("top")+_("center")}}function te(e){const{scaleValues:t}=y.data,a=t.find((t=>t.type===e));return F.value*(a.spaceGridNumber||1)/(a.spaceValue||1)}return i((async()=>{await l(),m(g,Z,x,b);const{redrawPoints:e,clickMenu:t,moveLimit:a,setPopup:r,updateData:i,getGridPoints:n}=h(g,Z,x,b,j);v(g,Z,x,b,a,r,i,n);const{clickMenu:u}=f(g,Z,x,b,j);H.value=e,D.value=e=>{const{item:a}=e;a.type&&p.map((e=>e.type)).includes(a.type)?u(e):t(e)}})),{propItems:Z,redrawPoints:H,select:C,clickMenu:D}}export{g as useSurgicalAnesthesiaChart};