cnhis-design-vue 3.1.50-beta.0 → 3.1.50-beta.10

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 (65) hide show
  1. package/es/components/card-reader-sdk/src/cardReaderSDK.d.ts +1 -0
  2. package/es/components/card-reader-sdk/src/cardReaderSDK.js +1 -1
  3. package/es/components/card-reader-sdk/src/insuranceSDK.js +1 -1
  4. package/es/components/card-reader-sdk/src/types/index.d.ts +1 -1
  5. package/es/components/card-reader-sdk/src/utils/index.d.ts +0 -3
  6. package/es/components/card-reader-sdk/src/utils/index.js +1 -1
  7. package/es/components/classification/index.d.ts +3 -1
  8. package/es/components/classification/src/components/search-filter/index.vue.d.ts +3 -1
  9. package/es/components/classification/src/components/set-classification/index.vue.d.ts +3 -1
  10. package/es/components/classification/src/index.vue.d.ts +3 -1
  11. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
  12. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.d.ts +1 -1
  13. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
  14. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
  15. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
  16. package/es/components/field-set/src/FieldSet.vue2.js +1 -1
  17. package/es/components/form-config/index.d.ts +55 -48
  18. package/es/components/form-config/src/FormConfig.vue.d.ts +55 -48
  19. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +15 -15
  20. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +27 -24
  21. package/es/components/form-render/index.d.ts +15 -15
  22. package/es/components/form-render/src/FormRender.vue.d.ts +15 -15
  23. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +15 -15
  24. package/es/components/form-render/src/components/renderer/levelSearchCascader.js +1 -1
  25. package/es/components/form-render/src/components/renderer/searchCascade.d.ts +1 -1
  26. package/es/components/form-render/src/components/renderer/searchCascade.js +1 -1
  27. package/es/components/form-render/src/components/renderer/select.d.ts +9 -0
  28. package/es/components/form-render/src/components/renderer/select.js +1 -1
  29. package/es/components/form-render/src/hooks/useFormAsyncQueue.d.ts +2 -2
  30. package/es/components/form-render/src/hooks/useFormAsyncQueue.js +1 -1
  31. package/es/components/form-render/src/hooks/useFormContext.js +1 -1
  32. package/es/components/form-render/src/hooks/useFormRenderLifeCycle.d.ts +6 -6
  33. package/es/components/form-render/src/hooks/useFormRenderOptions.js +1 -1
  34. package/es/components/form-render/src/types/fieldItem.d.ts +1 -0
  35. package/es/components/form-render/src/types/index.d.ts +4 -3
  36. package/es/components/form-render/style/index.css +1 -1
  37. package/es/components/iho-table/index.js +1 -1
  38. package/es/components/iho-table/src/plugins/filterRenderPlugin/index.js +1 -1
  39. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/inputRendererPlugin.js +1 -1
  40. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/numberRendererPlugin.js +1 -1
  41. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
  42. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/index.js +1 -1
  43. package/es/components/iho-table/src/types/index.d.ts +13 -4
  44. package/es/components/iho-table/src/utils/index.d.ts +1 -1
  45. package/es/components/iho-table/src/utils/index.js +1 -1
  46. package/es/components/iho-table/src/utils/separateMap.d.ts +5 -0
  47. package/es/components/iho-table/src/utils/separateMap.js +1 -0
  48. package/es/components/iho-table/style/index.css +1 -1
  49. package/es/components/index.css +1 -1
  50. package/es/components/info-header/index.d.ts +42 -42
  51. package/es/components/info-header/src/InfoHeader.vue.d.ts +42 -42
  52. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +15 -15
  53. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +15 -15
  54. package/es/components/shortcut-setter/index.d.ts +16 -15
  55. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +16 -15
  56. package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue.d.ts +2 -0
  57. package/es/components/table-filter/src/components/classify-filter/components/Date.vue.d.ts +1 -0
  58. package/es/components/table-filter/src/components/classify-filter/components/Date.vue2.js +1 -1
  59. package/es/components/table-filter/src/components/classify-filter/components/DateRange.vue.d.ts +1 -0
  60. package/es/components/table-filter/src/components/classify-filter/components/DateRange.vue2.js +1 -1
  61. package/es/components/table-filter/src/components/classify-filter/components/index.d.ts +2 -0
  62. package/es/components/table-filter/src/components/classify-filter/index.vue.d.ts +3 -1
  63. package/es/components/table-filter/src/components/classify-filter/index.vue2.js +1 -1
  64. package/es/shared/package.json.js +1 -1
  65. package/package.json +2 -2
@@ -12,6 +12,7 @@ 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;
15
16
  destroy(): void;
16
17
  private createParams;
17
18
  private checkLoading;
@@ -1 +1 @@
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
+ 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 +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,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
+ 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};
@@ -28,7 +28,7 @@ export declare namespace InsuranceType {
28
28
  export type CardReadParams = Partial<{
29
29
  operatorname: string;
30
30
  operatorcode: string;
31
- location: '0' | '1' | '2' | '';
31
+ location: string | number;
32
32
  needLogin: boolean;
33
33
  interfaceid: number | string;
34
34
  transtime: string;
@@ -1,9 +1,6 @@
1
- import { AnyObject } from '../../../../../es/shared/types';
2
- import { CONFIG_MAP } from '../constants';
3
1
  export declare function getSerialNumber(): string;
4
2
  export declare function getTranstime(): string;
5
3
  export declare function pad2(n: number): string | number;
6
4
  export declare function generateTimeRequestNumber(): string;
7
5
  export declare function insuranceLog(...messages: any[]): any;
8
6
  export declare function getErrorMessageByType(code?: number): string;
9
- export declare function getDataMessageByData(_data: string | AnyObject, configMap?: typeof CONFIG_MAP): any;
@@ -1 +1 @@
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};
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};
@@ -684,7 +684,7 @@ declare const CClassification: SFCWithInstall<import("vue").DefineComponent<{
684
684
  value: any;
685
685
  unit: any;
686
686
  }[];
687
- findConditionByDisplayCategory: (displayCategory: string) => unknown;
687
+ findConditionByDisplayCategory: (sid: string) => unknown;
688
688
  handleDisplayCategorySelectProxy: (item: import("..").ICategoryItemType) => void;
689
689
  clearFormData: () => void;
690
690
  handleInitConditions: () => Promise<void>;
@@ -784,6 +784,7 @@ declare const CClassification: SFCWithInstall<import("vue").DefineComponent<{
784
784
  label: string;
785
785
  value: string;
786
786
  }[]>;
787
+ initMounted: () => void;
787
788
  isDateDisabled: (ts: number) => boolean;
788
789
  timeDisabled: (ts: number) => {
789
790
  isHourDisabled(hour: number): boolean | undefined;
@@ -1335,6 +1336,7 @@ declare const CClassification: SFCWithInstall<import("vue").DefineComponent<{
1335
1336
  value: string;
1336
1337
  }[]>;
1337
1338
  presetValCp: import("vue").WritableComputedRef<string>;
1339
+ initMounted: () => void;
1338
1340
  handleChange: (val: any, type: "end" | "start") => void;
1339
1341
  isStartDateDisabled: (ts: number) => boolean;
1340
1342
  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: (displayCategory: string) => unknown;
164
+ findConditionByDisplayCategory: (sid: string) => unknown;
165
165
  handleDisplayCategorySelectProxy: (item: import("../../../..").ICategoryItemType) => void;
166
166
  clearFormData: () => void;
167
167
  handleInitConditions: () => Promise<void>;
@@ -261,6 +261,7 @@ declare const _default: import("vue").DefineComponent<{
261
261
  label: string;
262
262
  value: string;
263
263
  }[]>;
264
+ initMounted: () => void;
264
265
  isDateDisabled: (ts: number) => boolean;
265
266
  timeDisabled: (ts: number) => {
266
267
  isHourDisabled(hour: number): boolean | undefined;
@@ -812,6 +813,7 @@ declare const _default: import("vue").DefineComponent<{
812
813
  value: string;
813
814
  }[]>;
814
815
  presetValCp: import("vue").WritableComputedRef<string>;
816
+ initMounted: () => void;
815
817
  handleChange: (val: any, type: "end" | "start") => void;
816
818
  isStartDateDisabled: (ts: number) => boolean;
817
819
  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: (displayCategory: string) => unknown;
474
+ findConditionByDisplayCategory: (sid: 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,6 +571,7 @@ declare const _default: import("vue").DefineComponent<{
571
571
  label: string;
572
572
  value: string;
573
573
  }[]>;
574
+ initMounted: () => void;
574
575
  isDateDisabled: (ts: number) => boolean;
575
576
  timeDisabled: (ts: number) => {
576
577
  isHourDisabled(hour: number): boolean | undefined;
@@ -1122,6 +1123,7 @@ declare const _default: import("vue").DefineComponent<{
1122
1123
  value: string;
1123
1124
  }[]>;
1124
1125
  presetValCp: import("vue").WritableComputedRef<string>;
1126
+ initMounted: () => void;
1125
1127
  handleChange: (val: any, type: "end" | "start") => void;
1126
1128
  isStartDateDisabled: (ts: number) => boolean;
1127
1129
  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: (displayCategory: string) => unknown;
688
+ findConditionByDisplayCategory: (sid: 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,6 +785,7 @@ declare const _default: import("vue").DefineComponent<{
785
785
  label: string;
786
786
  value: string;
787
787
  }[]>;
788
+ initMounted: () => void;
788
789
  isDateDisabled: (ts: number) => boolean;
789
790
  timeDisabled: (ts: number) => {
790
791
  isHourDisabled(hour: number): boolean | undefined;
@@ -1336,6 +1337,7 @@ declare const _default: import("vue").DefineComponent<{
1336
1337
  value: string;
1337
1338
  }[]>;
1338
1339
  presetValCp: import("vue").WritableComputedRef<string>;
1340
+ initMounted: () => void;
1339
1341
  handleChange: (val: any, type: "end" | "start") => void;
1340
1342
  isStartDateDisabled: (ts: number) => boolean;
1341
1343
  timeStartDisabled: (ts: number) => {
@@ -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(){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,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,V=c(T);let Y=[],_=null;i(p,d);const{getEqualXTypes:D,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||{},{max:l={},min:r={}}=e.diffValue||{};function a({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)}a(o),a(i),a(l),a(r)}(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===Y.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(Y.every((e=>e.left!==o))){const t=x(o),n=L(l.type,i);Y.push({data:{time:t,value:n},left:o,top:i}),q(e,[...e.prevPointer,o,i])}Y.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=Y.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=Y.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=Y[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)},Y.splice(l,0,a),q(e,[s.left,s.top,a.left,a.top])}}l++}}(e,r)}if(Y.length>0&&o<Y[Y.length-1].left){for(const e of S)e.left>o&&(e.leftLine&&p.value.remove(e.leftLine),p.value.remove(e));if(Y=Y.filter((e=>e.left<=o)),0===Y.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(Y.length>0){const t=Y.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(),Y.length>0){const e=Y.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=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}}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(),Y=[],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};
@@ -2,7 +2,7 @@ import { Ref } from 'vue';
2
2
  import { fabric } from '../../../../../../es/shared/utils/fabricjs';
3
3
  import { IPointTipProps, IPointMenuProps } from '../../../../../../es/components/fabric-chart/src/interface';
4
4
  import { AnyObject } from '../../../../../../es/shared/types';
5
- export declare function useOther(canvas: Ref<fabric.Canvas>, propItems: AnyObject, emits: Function, pointTipProps: IPointTipProps, pointMenuProps: IPointMenuProps): {
5
+ export declare function useOther(canvas: Ref<fabric.Canvas>, propItems: AnyObject, emits: Function, pointTipProps: IPointTipProps, pointMenuProps: IPointMenuProps, moveLimit: Function): {
6
6
  clickMenu: ({ item, target }: {
7
7
  item: AnyObject;
8
8
  target: any;
@@ -1 +1 @@
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
+ 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 l}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import{OTHER_MENU as a}from"../../constants/index.js";import"naive-ui";function s(s,d,f,u,c,h){const{cumputedX:m,getXValue:g}=o(d),{getEqualXTypes:p,handleAddPrevent:v,isGridLimit:x}=n(s,f,d),{other:k,yCellHeight:y,xCellWidth:X,endX:P,originX:b,originY:w,endY:A,markHeight:E,event:j,topGridYCellHeight:C}=d,z=new Map,L=l(k);function S(){var o;if(!(null==(o=null==L?void 0:L.horizontal)?void 0:o.length))return;const n="horizontal";z.set(n,[]);const{horizontal:r}=L;let l=w+y/2;r.forEach(((o,r)=>{const{title:a,type:d,pointAttr:f={},textStyle:u={},data:c}=o;let h=null;c.forEach(((o,c)=>{const{time:g,value:p}=o,v=m(g);if(!V(v))return;const x=e(d,{...f,left:v,top:l}),k=v+x.width/2+2,y=i([k,l],{value:p,...u,originX:"left"}),X=new t.Group([x,y],{lockMovementY:!0,objectCaching:!1,hasControls:!1,hasBorders:!1,hoverCursor:"pointer"});Object.assign(X,{originLeft:v,iconHalfWidth:x.width/2,origin:{type:"other",key:n,dataIndex:r,index:c,data:o,title:a},limitX:{x1:b,x2:P-X.width}}),h&&(X.limitX.x1=h.left,h.limitX.x2=X.left,X.prevPoint=h,h.nextPoint=X),h=X,Y(X),z.get(n).push(X),s.value.add(X)})),l+=y}))}function H(){var t;if(!(null==(t=null==L?void 0:L.vertical)?void 0:t.length))return;const i="vertical";z.set(i,[]);const{vertical:o}=L;o.forEach(((t,o)=>{const{textStyle:n={},data:r,time:l}=t,a=m(l);if(!V(a))return;let d=w+y/2;r.forEach(((t,r)=>{const l=e(String(t),{...n,lockMovementY:!0,left:a,originX:"left",top:d,origin:{type:"other",key:i,dataIndex:o,index:r,data:{value:t}}});d+=y,Y(l),z.get(i).push(l),s.value.add(l)})),z.get(i).filter((t=>t.origin.dataIndex===o)).forEach(((t,e,i)=>{t.siblingPoints=i.filter((e=>e.origin.index!==t.origin.index))}))}))}function I(t,e="add"){const{dataIndex:i,data:o,index:n,key:l}=t,a=L[l],d=["mark"].includes(l)?a.dataList[i]:a[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":H();break;case"mark":M()}}(t)}function M(){if(!(null==k?void 0:k.mark)||!E)return;const{title:t,titleStyle:o,pointAttr:n,dataList:r}=k.mark,l=i([b-5,A+E/2],{value:t,...o,originX:"right"});s.value.add(l);const a=A+E,d=[];r.forEach((t=>{const{time:i,list:o=[]}=t,r=m(i);if(!V(r))return;let l=A;o.forEach((t=>{let i=!1;const o=e("circleAndText",{...n,text:t.text,left:r,top:l,origin:{data:t,key:"mark",type:"other"}}),f=o.height;l+f<=a&&l>=A?(o.set("top",l+f/2),l+=f):(i||(l=A,i=!0),o.set("top",l-f/2),l-=f),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:P};e(t)?(r.x2=o.left,t.otherPoints=n):(r.x1=i.left,t.startPoint=i),t.limitX=r}))}(d)}function Y(t){if(j.hovered&&(t.on("mouseover",(()=>{T(t)})),t.on("mouseout",(()=>{u.show=!1}))),!j.evented)return;const{key:e}=t.origin,i=["mark","horizontal"].includes(e),o=["mark","vertical"].includes(e);t.on("moving",(()=>{i?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);if("mark"===t.origin.key){t.top<w&&t.set("top",w);const e=A+E-t.height/2;t.top>e&&t.set("top",e)}t.originLeft&&t.iconHalfWidth&&(t.originLeft=t.left+t.iconHalfWidth)}(t):(h(t),function(t){var e;if(!(null==(e=t.siblingPoints)?void 0:e.length))return;t.siblingPoints.forEach((e=>e.setCoords().set("left",t.left)))}(t)),j.hovered&&T(t)})),t.on("mouseup",(n=>{var r;if(u.show=!1,1===n.button){i&&function(t){var e,i;if("mark"===t.origin.key){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}return}t.prevPoint&&(t.prevPoint.limitX.x2=t.left);t.nextPoint&&(t.nextPoint.limitX.x1=t.left)}(t);const e=g(null!=(r=t.originLeft)?r:t.left),n={...t.origin,...o?{time:e}:{data:{...t.origin.data,time:e}}};s.value.discardActiveObject(),f("change",n)}3===n.button&&["horizontal","vertical"].includes(e)&&(c.point={x:t.left,y:t.top},c.show=!0,c.target=t,c.list=a.map((t=>({...t,renderItem:()=>t.label}))))}))}function T(t){var e;u.point={x:t.left,y:"mark"===t.origin.key?t.top:t.top+C/2},u.list=[`时间 ${g(null!=(e=t.originLeft)?e:t.left).slice(-5)}`],"mark"===t.origin.key&&u.list.unshift(t.origin.data.name+" "),u.show=!0}function V(t){return t>=b&&t<=P}return function(){var t;if(!(null==(t=null==L?void 0:L.horizontal)?void 0:t.length))return;const{horizontal:i}=L,o=b-5;let n=w+y/2;i.forEach(((t,i)=>{const{title:r,titleStyle:l={},defaultAddValue:a}=t,d=r&&e(r,{...l,originX:"right",left:o,top:n,origin:{defaultAddValue:a,dataIndex:i,type:"other",key:"horizontal",title:r},originLeft:o,originTop:n});var c;(c=d).on("moving",(()=>{c.set("originX","center"),x(c)?T(c):u.show=!1})),c.on("mouseup:before",(t=>{if(u.show=!1,0===t.e.button&&x(c))if(p(z.get("horizontal"),c.left,"key",X).includes(c.origin.key))v("repeat");else{const t={data:{time:g(c.left),value:c.origin.defaultAddValue},...c.origin};f("add",t),I(t)}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(c)})),s.value.add(d),n+=y}))}(),S(),H(),M(),{clickMenu:function({item:t,target:e}){if(!e)return;const{type:i}=t,o={...e.origin,type:"other"};f(i,o),"remove"===i&&I(o,i)}}}export{s 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(),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,a);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 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,defaultRectStyle as n,drawTextGroup as o,drawLine as l,drawPoint as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as a}from"../useCumputedPoint.js";import"vue";import{cloneDeep as f}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function c(c,u,d,m,h){const{cumputedX:p,getXValue:v}=a(u),{originX:x,endX:g,xCellWidth:L,originYXAxis:X,top:C,canvasWidth:y,borderStyle:w,treeData:S,xAxis:Y,topGridYNumber:j,topGridOriginY:b,topGridYCellHeight:k,topGridEndY:G,event:I}=u,z=new Set;function A(t,e,i){let n;const{content:o}=t.value||{};if(o){const{lineStyle:l,textStyle:s,totalStyle:a}=C.data||{},{startLine:f,centerLine:c,endLine:u}=e;n=r(o,{fontSize:12,...s,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const d=M(n,e,i);n&&(n.set(d),n.origin={data:t},E(n),f&&(f.text=n),u&&(u.text=n))}return n}function M(t,e,i){const n=t.width+1,{startLine:o,centerLine:l,endLine:r}=e,s={top:i,originX:"center",originY:"center"};return l&&n<=l.width?s.left=l.x1+l.width/2:r&&n<=r.limitX.x2-r.left?(s.originX="left",s.left=r.left+1):o&&!r&&n<=o.limitX.x2-o.left?(s.originX="left",s.left=o.left+(o.isCustomIcon?5:1)):o&&n<=o.left-o.limitX.x1?(s.originX="right",s.left=o.left-(o.isCustomIcon?5:1)):l?(s.originY="top",s.left=l.x1+l.width/2,s.top=i+1,s.fontSize=10):o&&(s.originX="left",s.originY="top",s.fontSize=10,s.left=o.left,s.top=i+1),s}function $(e,{isCustomIcon:i,isContinue:n,isLeft:o}){const{x:s,y1:a,y2:f,halfY:c}=e;if(!s||s<x||s>g)return;const{lineStyle:u}=C.data||{};let d;const m={left:s,top:c};d=i?r("circle",{fill:u.stroke,...m}):n?r(">",{fill:u.stroke,...m,fontSize:18}):l([s,a,s,c],u);const h=new t.Rect({width:L,height:k,fill:"transparent",left:s-L/2,top:a}),p=new t.Group([d,h],{originX:"center",originY:"center",hasControls:!1,hasBorders:!1,objectCaching:!1,hoverCursor:"pointer",lockMovementY:!0});return p.isLeft=o,p.isCustomIcon=i,E(p),p}function E(t){I.hovered&&(t.on("mouseover",(()=>{D(t,"hover")})),t.on("mouseout",(()=>{m.show=!1}))),t.lockMovementX&&t.lockMovementY||(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),function(t){if(t.centerLine){const e=t.isLeft?{x1:t.left}:{x2:t.left};t.centerLine.setCoords().set(e)}if(t.text){const e=M(t.text,{startLine:t.isLeft?t:t.nearLine,centerLine:t.centerLine,endLine:t.isLeft?t.nearLine:t},t.top);t.text.setCoords().set(e)}}(t),I.hovered&&D(t)})),t.on("mouseup",(e=>{if(1===e.button){!function(t){t.isLeft?(t.prevLine&&(t.prevLine.limitX.x2=t.left),t.nearLine&&(t.nearLine.limitX.x1=t.left)):(t.nextLine&&(t.nextLine.limitX.x1=t.left),t.nearLine&&(t.nearLine.limitX.x2=t.left))}(t);const e={type:"tree",...t.origin};d("change",e)}})))}function D(t,e="moving"){var i,n,o;const{data:l}=t.origin;m.point={x:t.left,y:t.top};let[r="",s=""]=l.time||[];if("moving"===e){const e=v(t.left);t.isLeft?r=e:s=e,l.time=[r,s],t.text&&(t.text.origin.data.time=[r,s])}m.list=[`开始时间 ${r}`,`结束时间 ${s}`,`流速 ${(null==(i=l.value)?void 0:i.currentSpeed)||""}`,`浓度 ${(null==(n=l.value)?void 0:n.consistence)||""}`,`总量 ${(null==(o=l.value)?void 0:o.total)||""}`],m.show=!0}s(c,{...u,gridYNumber:j,originY:b,yCellHeight:k,endY:G}),function(){var o;const{height:l,list:r,left:s,spaceValue:a}=Y;if(!l)return;const f=[],u=X+l/2;r.forEach(((t,i)=>{const n=s+i*L*a;f.push(e([n,u],{value:t.slice(11,16)}))}));const d=f.length>0?new t.Group([...f],{...i,objectCaching:!1}):null;d&&c.value.add(d);const m=new t.Rect({width:y,height:l,left:0,top:X,...n,originX:"left",originY:"top",...w}),h=e([g+(y-g)/2,u],{value:"总量",...null==(o=C.data)?void 0:o.totalStyle});c.value.add(m,h)}(),function(){var n;const r=(null==(n=null==C?void 0:C.tree)?void 0:n.textStyle)||{},s=[];!function t(i){i.forEach((i=>{var n;const{width:a,height:u,left:d,top:m,title:h=""}=i,v={value:h,...r};(null==(n=i.children)?void 0:n.length)?(v.value=h.split("").join("\n"),t(i.children)):(v.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e,textStyle:i,totalStyle:n}=C.data||{},o=t.top,r=o+k,s=r-k/2,a={y1:o,y2:r,halfY:s},c=[],u=f(t);delete u.data,t.data.forEach(((t,i,n)=>{const{time:o,continue:r}=t,[f,d]=o,m=f&&p(f),h=d&&p(d),v=$({...a,x:m},{isCustomIcon:!h&&!r,isContinue:!1,isLeft:!0}),L=$({...a,x:h},{isCustomIcon:!1,isContinue:!!r});let X,C,y;if((v||m<x)&&(L||h>g)){X=l([v?m:x,s,L?h:g,s],e)}c.push({startLine:v,centerLine:X,endLine:L}),function(t,e,i){const{startLine:n,centerLine:o,endLine:l}=e[t],{startLine:r,endLine:s}=e[t-1]||{};if(n){n.origin=i;const t={x1:x,x2:l?l.left:g};s?(t.x1=s.left,s.limitX.x2=n.left,n.prevLine=s,s.nextLine=n):r&&(t.x1=r.left,r.limitX.x2=n.left,n.prevLine=r,r.nextLine=n),n.limitX=t,o&&(n.centerLine=o)}if(l){l.origin=i;const t={x1:n?n.left:x,x2:g};l.limitX=t,o&&(l.centerLine=o)}n&&l&&(n.nearLine=l,l.nearLine=n)}(i,c,Object.assign({},u,{data:t,index:i})),n[i-1]&&(C=A(n[i-1],c[i-1],s)),i===n.length-1&&(y=A(t,c[i],s)),X&&z.add(X),v&&z.add(v),L&&z.add(L),C&&z.add(C),y&&z.add(y)}))}(i),function(t){var i;if(!(null==t?void 0:t.total))return;const n=t.top+k/2,o=e([g+(y-g)/2,n],{value:t.total,...null==(i=C.data)?void 0:i.totalStyle});o&&c.value.add(o)}(i)),s.push(o({width:a,height:u,...w},v,{left:d,top:m},!0))}))}(S);const a=s.length>0?new t.Group([...s],{...i,objectCaching:!1}):null;a&&c.value.add(a),z.size&&c.value.add(...z)}()}export{c as useTop};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawText as e,defaultStyle as i,defaultRectStyle as n,drawTextGroup as o,drawLine as l,drawPoint as r}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as a}from"../useCumputedPoint.js";import"vue";import{cloneDeep as f}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";function c(c,u,d,m,h){const{cumputedX:p,getXValue:v}=a(u),{originX:x,endX:g,xCellWidth:L,originYXAxis:X,top:C,canvasWidth:w,borderStyle:Y,treeData:y,xAxis:S,topGridYNumber:j,topGridOriginY:b,topGridYCellHeight:k,topGridEndY:G,event:I}=u,z=new Set;function A(t,e,i){let n;const{content:o}=t.value||{};if(o){const{textStyle:l}=C.data||{},{startLine:s,endLine:a}=e;n=r(o,{fontSize:12,...l,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const f=M(n,e,i);n&&(n.set(f),n.origin={data:t},E(n),s&&(s.text=n),a&&(a.text=n))}return n}function M(t,e,i){const n=t.width+1,{startLine:o,centerLine:l,endLine:r}=e,s={top:i,originX:"center",originY:"center"};return l&&n<=l.width?s.left=l.x1+l.width/2:r&&n<=r.limitX.x2-r.left?(s.originX="left",s.left=r.left+1):o&&!r&&n<=o.limitX.x2-o.left?(s.originX="left",s.left=o.left+(o.isCustomIcon?5:1)):o&&n<=o.left-o.limitX.x1?(s.originX="right",s.left=o.left-(o.isCustomIcon?5:1)):l?(s.originY="top",s.left=l.x1+l.width/2,s.top=i+1,s.fontSize=10):o&&(s.originX="left",s.originY="top",s.fontSize=10,s.left=o.left,s.top=i+1),s}function $(e,{isCustomIcon:i,isContinue:n,isLeft:o}){const{x:s,y1:a,y2:f,halfY:c}=e;if(!s||s<x||s>g)return;const{lineStyle:u}=C.data||{};let d;const m={left:s,top:c};d=i?r("circle",{fill:u.stroke,...m}):n?r(">",{fill:u.stroke,...m,fontSize:18}):l([s,a,s,c],u);const h=new t.Rect({width:L,height:k,fill:"transparent",left:s-L/2,top:a}),p=new t.Group([d,h],{originX:"center",originY:"center",hasControls:!1,hasBorders:!1,objectCaching:!1,hoverCursor:"pointer",lockMovementY:!0});return p.isLeft=o,p.isCustomIcon=i,E(p),p}function E(t){I.hovered&&(t.on("mouseover",(()=>{D(t,"hover")})),t.on("mouseout",(()=>{m.show=!1}))),t.lockMovementX&&t.lockMovementY||(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),function(t){if(t.centerLine){const e=t.isLeft?{x1:t.left}:{x2:t.left};t.centerLine.setCoords().set(e)}if(t.text){const e=M(t.text,{startLine:t.isLeft?t:t.nearLine,centerLine:t.centerLine,endLine:t.isLeft?t.nearLine:t},t.top);t.text.setCoords().set(e)}}(t),I.hovered&&D(t)})),t.on("mouseup",(e=>{if(1===e.button){!function(t){t.isLeft?(t.prevLine&&(t.prevLine.limitX.x2=t.left),t.nearLine&&(t.nearLine.limitX.x1=t.left)):(t.nextLine&&(t.nextLine.limitX.x1=t.left),t.nearLine&&(t.nearLine.limitX.x2=t.left))}(t);const e={type:"tree",...t.origin};d("change",e)}})))}function D(t,e="moving"){var i,n,o;const{data:l}=t.origin;m.point={x:t.left,y:t.top};let[r="",s=""]=l.time||[];if("moving"===e){const e=v(t.left);t.isLeft?r=e:s=e,l.time=[r,s],t.text&&(t.text.origin.data.time=[r,s])}m.list=[`开始时间 ${r}`,`结束时间 ${s}`,`流速 ${(null==(i=l.value)?void 0:i.currentSpeed)||""}`,`浓度 ${(null==(n=l.value)?void 0:n.consistence)||""}`,`总量 ${(null==(o=l.value)?void 0:o.total)||""}`],m.show=!0}s(c,{...u,gridYNumber:j,originY:b,yCellHeight:k,endY:G}),function(){var o;const{height:l,list:r,left:s,spaceValue:a}=S;if(!l)return;const f=[],u=X+l/2;r.forEach(((t,i)=>{const n=s+i*L*a;f.push(e([n,u],{value:t.slice(11,16)}))}));const d=f.length>0?new t.Group([...f],{...i,objectCaching:!1}):null;d&&c.value.add(d);const m=new t.Rect({width:w,height:l,left:0,top:X,...n,originX:"left",originY:"top",...Y}),h=e([g+(w-g)/2,u],{value:"总量",...null==(o=C.data)?void 0:o.totalStyle});c.value.add(m,h)}(),function(){var n;const r=(null==(n=null==C?void 0:C.tree)?void 0:n.textStyle)||{},s=[];!function t(i){i.forEach((i=>{var n;const{width:a,height:u,left:d,top:m,title:h=""}=i,v={value:h,...r};(null==(n=i.children)?void 0:n.length)?(v.value=h.split("").join("\n"),t(i.children)):(v.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e}=C.data||{},i=t.top,n=i+k,o=n-k/2,r={y1:i,y2:n,halfY:o};let s=null;const a=f(t);delete a.data,t.data.forEach(((t,i,n)=>{const{time:f,continue:c}=t,[u,d]=f,m=u&&p(u),h=d&&p(d),v=$({...r,x:m},{isCustomIcon:!h&&!c,isContinue:!1,isLeft:!0}),L=$({...r,x:h},{isCustomIcon:!1,isContinue:!!c});let X;if((v||m<x)&&(L||h>g)){X=l([v?m:x,o,L?h:g,o],e)}const C={startLine:v,centerLine:X,endLine:L};let w,Y;!function(t,e,i){const{startLine:n,centerLine:o,endLine:l}=e,{startLine:r,endLine:s}=t||{};if(n){n.origin=i;const t={x1:x,x2:l?l.left:g};s?(t.x1=s.left,s.limitX.x2=n.left,n.prevLine=s,s.nextLine=n):r&&(t.x1=r.left,r.limitX.x2=n.left,n.prevLine=r,r.nextLine=n),n.limitX=t,o&&(n.centerLine=o)}if(l){l.origin=i;const t={x1:n?n.left:x,x2:g};l.limitX=t,o&&(l.centerLine=o)}n&&l&&(n.nearLine=l,l.nearLine=n)}(s,C,Object.assign({},a,{data:t,index:i})),s&&(w=A(n[i-1],s,o)),i===n.length-1&&(Y=A(t,C,o)),s=C,X&&z.add(X),v&&z.add(v),L&&z.add(L),w&&z.add(w),Y&&z.add(Y)}))}(i),function(t){var i;if(!(null==t?void 0:t.total))return;const n=t.top+k/2,o=e([g+(w-g)/2,n],{value:t.total,...null==(i=C.data)?void 0:i.totalStyle});o&&c.value.add(o)}(i)),s.push(o({width:a,height:u,...Y},v,{left:d,top:m},!0))}))}(y);const a=s.length>0?new t.Group([...s],{...i,objectCaching:!1}):null;a&&c.value.add(a),z.size&&c.value.add(...z)}()}export{c as useTop};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as l,computed as t,reactive as i,watch as o,openBlock as d,createElementBlock as a,normalizeStyle as s,createBlock as n,unref as r,withKeys as u,withModifiers as c,createCommentVNode as f,createElementVNode as h,Fragment as p,renderList as m,withCtx as v,createTextVNode as y,toDisplayString as b,createVNode as k,mergeProps as g,renderSlot as x}from"vue";import{useThemeVars as w,NInput as A,NCheckbox as _,NTooltip as S,NIcon as C,NPopconfirm as W,NButton as E}from"naive-ui";import q from"../../../shared/components/VueDraggable/src/vuedraggable.js";import F from"./components/Row.vue.js";import{isArray as N,cloneDeep as R,isString as j,omit as B}from"lodash-es";import{isDisable as I,setStyle as U,getGroupTree as D}from"./utils/index.js";import{uuidGenerator as O}from"../../../shared/utils/index.js";import{HelpCircleSharp as T}from"@vicons/ionicons5";const V={class:"c-field-set__table-header"},P=h("span",null,"数值越小,优先级越高",-1),K=["tabindex"],L={key:1,class:"c-field-set__table-footer"};var G=e({__name:"FieldSet",props:{fields:{type:Array,default:()=>[]},footerFlag:{type:Boolean,default:!0},type:{type:String,default:"old"},isEdit:{type:Boolean,default:!1},showColumnNames:{type:Array},groupSetting:{type:Object},customColumns:{type:Array,default:()=>[]},showSeq:{type:Boolean,default:!1},showSearch:{type:Boolean,default:!1}},emits:["save","close","reset"],setup(e,{expose:G,emit:H}){const M=e,$={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"},z=l(w().value.primaryColor),J=l(""),Q=l(),X=l([]),Y=l([{title:"所有字段",type:"text",field:"title"},{title:"显示",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"show"},{title:"编辑",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"editable"},{title:"必填",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"required"},{title:"排序",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"sort"},{title:"加粗",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"bold"},{title:"默认排序",type:"select",field:"sortDirection"},{title:"固定",type:"select",field:"fixedWay"},{title:"自定义标题",type:"input",field:"alias"},{title:"列宽",type:"inputNumber",field:"columnWidth"}]),Z=t((()=>X.value.flat())),ee=i({columns:Y.value,fieldList:Z.value,onUpdateChecked:function({checked:e,column:l}){const t=!e||ue(l.field);l.checkedAll=!t}}),le={keyword:J.value,idx:0,startIdx:0},te=()=>{H("save",{tableFields:ae()})},ie=()=>{H("close")};function oe(){X.value=de(),re(),H("reset")}function de(){const e=R(M.fields).map((e=>({...e,uuid:O()})));return Object.keys($).forEach((l=>{e.forEach((e=>{"old"==M.type&&Reflect.has(e,l)&&("isFixed"==l?e.fixedWay=1==e[l]?"LEFT":2==e[l]?"RIGHT":"NONE":["isShow","isSort"].includes(l)&&"boolean"!=typeof l?e[$[l]]=1==e[l]:e[$[l]]=e[l],Reflect.deleteProperty(e,l)),e.columnWidth=+e.columnWidth||null,Reflect.has(e,"alias")||(e.alias=""),Reflect.has(e,"bold")||(e.bold=!1)}))})),function(e){if(M.groupSetting){return D(M.groupSetting,e).reduce(((t,i)=>{const o=j(i)?e.find((e=>e.name===i)):l(i.children);return o&&t.push(o),t}),[])}return e;function l(t){const i=[];return t.forEach((t=>{if(t.children)i.push(...l(t.children));else{const l=e.find((e=>e.name===t));l&&i.push(l)}})),i}}(e)}function ae(){let e=[];return e="old"==M.type?Z.value.map(((e,l)=>({id:e.id,field:e.name,visible:e.show,sequence:l,sortable:e.sort,title:e.alias,fixed:e.fixedWay,minWidth:e.columnWidth,bold:e.bold,sortDirection:e.sortDirection,...M.isEdit?{required:e.required,editable:e.editable}:{}}))):Z.value,e.map((e=>B(e,["uuid"])))}function se(){const e=le.keyword!==J.value;let l=J.value?Z.value.findIndex(((l,t)=>{var i;if(null==(i=l.title)?void 0:i.includes(J.value))return!!e||t>le.idx})):0;-1!==l||e||(l=le.startIdx),Q.value.scrollTop=52*l,Object.assign(le,{keyword:J.value,idx:l},e?{startIdx:l}:{})}function ne(e){var l;return!!J.value&&(null==(l=e.title)?void 0:l.includes(J.value))}function re(){var e,l;(null==(e=M.showColumnNames)?void 0:e.length)&&(Y.value=Y.value.filter((e=>{var l,t;return"title"===e.field||(null==(t=null==(l=M.showColumnNames)?void 0:l.includes)?void 0:t.call(l,e.field))}))),(null==(l=M.customColumns)?void 0:l.length)&&Y.value.push(...M.customColumns),M.showSeq&&Y.value.splice(1,0,{title:"排序",type:"text",field:"seq"}),Y.value.forEach((e=>{if(function(e){const l=["editable","required"].includes(e.field);return l&&M.isEdit||!l}(e)&&(e.isShow=!0),"checkbox"===e.type){const l=X.value.flat().every((l=>!Reflect.has(l,e.field)));e.checkedAll=!ue(e.field)&&!l}}))}function ue(e){return X.value.flat().some((l=>!I(l,e)&&!l[e]&&"0001"!=l.id))}return o([()=>M.fields,()=>{var e;return null==(e=M.showColumnNames)?void 0:e.length}],(([e,l])=>{e.length>0&&(X.value=de(),re())}),{immediate:!0,deep:!0}),G({getTableFields:ae}),(l,t)=>(d(),a("div",{class:"c-field-set",style:s({"--row-height":"52px","--primary-color":z.value})},[e.showSearch?(d(),n(r(A),{key:0,class:"c-field-set__search-wrapper",value:J.value,"onUpdate:value":t[0]||(t[0]=e=>J.value=e),valueModifiers:{trim:!0},placeholder:"请输入字段标题",onKeydown:u(c(se,["prevent"]),["enter"])},null,8,["value","onKeydown"])):f("v-if",!0),h("div",V,[(d(!0),a(p,null,m(Y.value,((e,l)=>(d(),a(p,{key:l},[e.isShow?(d(),a("span",{key:0,class:"table-cell",style:s(r(U)(e))},["checkbox"===e.type?(d(),n(r(_),{key:0,checked:e.checkedAll,"onUpdate:checked":[l=>e.checkedAll=l,l=>{return t=l,i=e.field,void Z.value.forEach((e=>{I(e,i)||(e[i]=t)}));var t,i}],disabled:e.disabledAll},{default:v((()=>[y(b(e.title),1)])),_:2},1032,["checked","onUpdate:checked","disabled"])):f("v-if",!0),y(" "+b("checkbox"!==e.type?e.title:"")+" ",1),"sortPriority"===e.field?(d(),n(r(S),{key:1,trigger:"hover"},{trigger:v((()=>[k(r(C),{component:r(T),style:{top:"2px"}},null,8,["component"])])),default:v((()=>[P])),_:1})):f("v-if",!0)],4)):f("v-if",!0)],64)))),128))]),h("div",{class:"c-field-set__table-body",ref_key:"tableBodyRef",ref:Q},[k(r(q),{modelValue:X.value,"onUpdate:modelValue":t[1]||(t[1]=e=>X.value=e),animation:"150","item-key":"id",draggable:".item"},{item:v((({element:e,index:l})=>[e.hide?f("v-if",!0):(d(),a("div",{key:0,class:"item",tabindex:l},[r(N)(e)?(d(!0),a(p,{key:0},m(e,((e,t)=>(d(),n(F,g(ee,{key:t,element:e,idx:l+1,"is-highlight":ne(e)}),null,16,["element","idx","is-highlight"])))),128)):(d(),n(F,g({key:1},ee,{element:e,idx:l+1,"is-highlight":ne(e)}),null,16,["element","idx","is-highlight"]))],8,K))])),_:1},8,["modelValue"])],512),e.footerFlag?(d(),a("div",L,[f(" 底部按钮插槽 "),x(l.$slots,"footer",{},(()=>[k(r(W),{onPositiveClick:oe},{trigger:v((()=>[k(r(E),{style:{"margin-right":"8px"}},{default:v((()=>[y("恢复默认设置")])),_:1})])),default:v((()=>[y(" 确认要恢复系统默认设置吗? ")])),_:1}),k(r(E),{style:{"margin-right":"8px"},onClick:ie},{default:v((()=>[y("取消")])),_:1}),k(r(E),{type:"primary",onClick:te},{default:v((()=>[y("保存")])),_:1})]))])):f("v-if",!0)],4))}});export{G as default};
1
+ import{defineComponent as e,ref as l,computed as t,reactive as i,watch as o,openBlock as d,createElementBlock as a,normalizeStyle as s,createBlock as n,unref as r,withKeys as u,withModifiers as c,createCommentVNode as f,createElementVNode as h,Fragment as p,renderList as m,withCtx as v,createTextVNode as y,toDisplayString as b,createVNode as k,mergeProps as g,renderSlot as x}from"vue";import{useThemeVars as w,NInput as A,NCheckbox as _,NTooltip as S,NIcon as C,NPopconfirm as W,NButton as E}from"naive-ui";import q from"../../../shared/components/VueDraggable/src/vuedraggable.js";import F from"./components/Row.vue.js";import{isArray as N,cloneDeep as R,isString as j,omit as B}from"lodash-es";import{isDisable as I,setStyle as U,getGroupTree as D}from"./utils/index.js";import{uuidGenerator as O}from"../../../shared/utils/index.js";import{HelpCircleSharp as T}from"@vicons/ionicons5";const V={class:"c-field-set__table-header"},P=h("span",null,"数值越小,优先级越高",-1),K=["tabindex"],L={key:1,class:"c-field-set__table-footer"};var G=e({__name:"FieldSet",props:{fields:{type:Array,default:()=>[]},footerFlag:{type:Boolean,default:!0},type:{type:String,default:"old"},isEdit:{type:Boolean,default:!1},showColumnNames:{type:Array},groupSetting:{type:Object},customColumns:{type:Array,default:()=>[]},showSeq:{type:Boolean,default:!1},showSearch:{type:Boolean,default:!1}},emits:["save","close","reset"],setup(e,{expose:G,emit:H}){const M=e,$={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"},z=l(w().value.primaryColor),J=l(""),Q=l(),X=l([]),Y=l([{title:"所有字段",type:"text",field:"title"},{title:"显示",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"show"},{title:"编辑",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"editable"},{title:"必填",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"required"},{title:"排序",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"sort"},{title:"加粗",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"bold"},{title:"默认排序",type:"select",field:"sortDirection"},{title:"固定",type:"select",field:"fixedWay"},{title:"自定义标题",type:"input",field:"alias"},{title:"列宽",type:"inputNumber",field:"columnWidth"}]),Z=t((()=>X.value.flat())),ee=i({columns:Y,fieldList:Z,onUpdateChecked:function({checked:e,column:l}){const t=!e||ue(l.field);l.checkedAll=!t}}),le={keyword:J.value,idx:0,startIdx:0},te=()=>{H("save",{tableFields:ae()})},ie=()=>{H("close")};function oe(){X.value=de(),re(),H("reset")}function de(){const e=R(M.fields).map((e=>({...e,uuid:O()})));return Object.keys($).forEach((l=>{e.forEach((e=>{"old"==M.type&&Reflect.has(e,l)&&("isFixed"==l?e.fixedWay=1==e[l]?"LEFT":2==e[l]?"RIGHT":"NONE":["isShow","isSort"].includes(l)&&"boolean"!=typeof l?e[$[l]]=1==e[l]:e[$[l]]=e[l],Reflect.deleteProperty(e,l)),e.columnWidth=+e.columnWidth||null,Reflect.has(e,"alias")||(e.alias=""),Reflect.has(e,"bold")||(e.bold=!1)}))})),function(e){if(M.groupSetting){return D(M.groupSetting,e).reduce(((t,i)=>{const o=j(i)?e.find((e=>e.name===i)):l(i.children);return o&&t.push(o),t}),[])}return e;function l(t){const i=[];return t.forEach((t=>{if(t.children)i.push(...l(t.children));else{const l=e.find((e=>e.name===t));l&&i.push(l)}})),i}}(e)}function ae(){let e=[];return e="old"==M.type?Z.value.map(((e,l)=>({id:e.id,field:e.name,visible:e.show,sequence:l,sortable:e.sort,title:e.alias,fixed:e.fixedWay,minWidth:e.columnWidth,bold:e.bold,sortDirection:e.sortDirection,...M.isEdit?{required:e.required,editable:e.editable}:{}}))):Z.value,e.map((e=>B(e,["uuid"])))}function se(){const e=le.keyword!==J.value;let l=J.value?Z.value.findIndex(((l,t)=>{var i;if(null==(i=l.title)?void 0:i.includes(J.value))return!!e||t>le.idx})):0;-1!==l||e||(l=le.startIdx),Q.value.scrollTop=52*l,Object.assign(le,{keyword:J.value,idx:l},e?{startIdx:l}:{})}function ne(e){var l;return!!J.value&&(null==(l=e.title)?void 0:l.includes(J.value))}function re(){var e,l;(null==(e=M.showColumnNames)?void 0:e.length)&&(Y.value=Y.value.filter((e=>{var l,t;return"title"===e.field||(null==(t=null==(l=M.showColumnNames)?void 0:l.includes)?void 0:t.call(l,e.field))}))),(null==(l=M.customColumns)?void 0:l.length)&&Y.value.push(...M.customColumns),M.showSeq&&Y.value.splice(1,0,{title:"排序",type:"text",field:"seq"}),Y.value.forEach((e=>{if(function(e){const l=["editable","required"].includes(e.field);return l&&M.isEdit||!l}(e)&&(e.isShow=!0),"checkbox"===e.type){const l=X.value.flat().every((l=>!Reflect.has(l,e.field)));e.checkedAll=!ue(e.field)&&!l}}))}function ue(e){return X.value.flat().some((l=>!I(l,e)&&!l[e]&&"0001"!=l.id))}return o([()=>M.fields,()=>{var e;return null==(e=M.showColumnNames)?void 0:e.length}],(([e,l])=>{e.length>0&&(X.value=de(),re())}),{immediate:!0,deep:!0}),G({getTableFields:ae}),(l,t)=>(d(),a("div",{class:"c-field-set",style:s({"--row-height":"52px","--primary-color":z.value})},[e.showSearch?(d(),n(r(A),{key:0,class:"c-field-set__search-wrapper",value:J.value,"onUpdate:value":t[0]||(t[0]=e=>J.value=e),valueModifiers:{trim:!0},placeholder:"请输入字段标题",onKeydown:u(c(se,["prevent"]),["enter"])},null,8,["value","onKeydown"])):f("v-if",!0),h("div",V,[(d(!0),a(p,null,m(Y.value,((e,l)=>(d(),a(p,{key:l},[e.isShow?(d(),a("span",{key:0,class:"table-cell",style:s(r(U)(e))},["checkbox"===e.type?(d(),n(r(_),{key:0,checked:e.checkedAll,"onUpdate:checked":[l=>e.checkedAll=l,l=>{return t=l,i=e.field,void Z.value.forEach((e=>{I(e,i)||(e[i]=t)}));var t,i}],disabled:e.disabledAll},{default:v((()=>[y(b(e.title),1)])),_:2},1032,["checked","onUpdate:checked","disabled"])):f("v-if",!0),y(" "+b("checkbox"!==e.type?e.title:"")+" ",1),"sortPriority"===e.field?(d(),n(r(S),{key:1,trigger:"hover"},{trigger:v((()=>[k(r(C),{component:r(T),style:{top:"2px"}},null,8,["component"])])),default:v((()=>[P])),_:1})):f("v-if",!0)],4)):f("v-if",!0)],64)))),128))]),h("div",{class:"c-field-set__table-body",ref_key:"tableBodyRef",ref:Q},[k(r(q),{modelValue:X.value,"onUpdate:modelValue":t[1]||(t[1]=e=>X.value=e),animation:"150","item-key":"id",draggable:".item"},{item:v((({element:e,index:l})=>[e.hide?f("v-if",!0):(d(),a("div",{key:0,class:"item",tabindex:l},[r(N)(e)?(d(!0),a(p,{key:0},m(e,((e,t)=>(d(),n(F,g(ee,{key:t,element:e,idx:l+1,"is-highlight":ne(e)}),null,16,["element","idx","is-highlight"])))),128)):(d(),n(F,g({key:1},ee,{element:e,idx:l+1,"is-highlight":ne(e)}),null,16,["element","idx","is-highlight"]))],8,K))])),_:1},8,["modelValue"])],512),e.footerFlag?(d(),a("div",L,[f(" 底部按钮插槽 "),x(l.$slots,"footer",{},(()=>[k(r(W),{onPositiveClick:oe},{trigger:v((()=>[k(r(E),{style:{"margin-right":"8px"}},{default:v((()=>[y("恢复默认设置")])),_:1})])),default:v((()=>[y(" 确认要恢复系统默认设置吗? ")])),_:1}),k(r(E),{style:{"margin-right":"8px"},onClick:ie},{default:v((()=>[y("取消")])),_:1}),k(r(E),{type:"primary",onClick:te},{default:v((()=>[y("保存")])),_:1})]))])):f("v-if",!0)],4))}});export{G as default};