cnhis-design-vue 3.1.42-beta.25 → 3.1.42-beta.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -87
- package/es/components/fabric-chart/src/hooks/useCenter.js +1 -1
- package/es/components/field-set/src/FieldSet.vue.js +1 -1
- package/es/components/form-config/index.d.ts +5 -10
- package/es/components/form-config/src/FormConfig.vue.d.ts +5 -10
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +3 -6
- package/es/components/form-render/src/components/renderer/levelSearchCascader.d.ts +18 -0
- package/es/components/form-render/src/components/renderer/levelSearchCascader.js +1 -1
- package/es/components/form-render/src/components/renderer/radio&checkbox.d.ts +36 -0
- package/es/components/form-render/src/components/renderer/radio_checkbox.js +1 -1
- package/es/components/form-render/src/components/renderer/remoteSearch.d.ts +18 -0
- package/es/components/form-render/src/components/renderer/remoteSearch.js +1 -1
- package/es/components/form-render/src/components/renderer/searchCascade.d.ts +18 -0
- package/es/components/form-render/src/components/renderer/searchCascade.js +1 -1
- package/es/components/form-render/src/components/renderer/select.d.ts +30 -3
- package/es/components/form-render/src/components/renderer/select.js +1 -1
- package/es/components/form-render/src/hooks/useFormRenderOptions.d.ts +13 -8
- package/es/components/form-render/src/hooks/useFormRenderOptions.js +1 -1
- package/es/components/form-render/src/types/fieldItem.d.ts +3 -4
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/index.js +1 -1
- package/es/components/map/index.d.ts +2 -14
- package/es/components/map/src/Map.vue.d.ts +1 -14
- package/es/components/map/src/types/index.d.ts +19 -0
- package/es/components/map/src/types/index.js +1 -0
- package/es/components/recommend-search/index.d.ts +2 -0
- package/es/components/recommend-search/src/RecommendSearch.vue.d.ts +2 -0
- package/es/components/recommend-search/src/RecommendSearch.vue.js +1 -1
- package/es/components/recommend-search/src/components/BaseSearch.js +1 -1
- package/es/components/recommend-search/src/constant/index.d.ts +2 -1
- package/es/components/recommend-search/src/constant/index.js +1 -1
- package/es/components/scale-view/src/ScaleView.vue.js +1 -1
- package/es/components/scale-view/src/hooks/use-component.d.ts +0 -3
- package/es/components/select-label/src/LabelFormContent.vue.js +1 -1
- package/es/components/shortcut-setter/index.d.ts +1 -2
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +1 -2
- package/es/components/vod-chunk-upload/index.d.ts +0 -3
- package/es/components/vod-chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue.d.ts +0 -3
- package/es/components/vod-chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue.js +1 -1
- package/es/env.d.ts +24 -24
- package/package.json +2 -2
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
- package/es/components/fabric-chart/src/utils/index.d.ts +0 -6823
- package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
- 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
|
+
```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as e}from"../utils/index.js";import{drawLine as t,defaultStyle as i,drawPoint as n,drawText as o,drawArrow as l}from"./useDraw.js";import s from"./useGrid.js";import{useShadow as r}from"./useShadow.js";import{TEMPERATURE_MENU as a,PAIN_MENU as u,OVERLAP as p}from"./constant.js";import{cloneDeep as c}from"lodash-es";import{isOneLine as d,getType as f,isValidValue as h,setOtherType as g,isEffectiveNode as v,getIndex as y,deleteProperty as m}from"../utils/utils.js";function x(x,b,w,L,j,k,Y,S,E,$,T){s(x,b);const{getEqualXTypes:P,repeatTip:O,maxLimitTip:M,minLimitTip:I}=T,{createShadowLines:A}=r(),{left:D,xScaleList:R,xCellWidth:C,yCellHeight:X,originX:z,endX:V,originY:F,endY:_,itemList:G,event:H,vitalSignsOriginY:q,painOriginY:W,hospitalizationDate:B,config:J,canvasHeight:K}=b,N=new Set,Q=["xinmai","mai"],U=new Map,Z=new Set,ee=new Set,te=new Set,ie=c(D.yScaleValue);function ne(t){var n;const o=ie.find((e=>"pulse"===e.type));if(o&&(null==(n=o.dataList)?void 0:n.length)&&(N.size&&x.value.remove(...N),N.clear(),U.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=U.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}(function(){const e=[],t=[],i=[];for(const e of U)t.push(e[1]),e[0]===Q[0]&&e[1].forEach((e=>{(U.get(Q[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),a=n[i],u=o[r],p=n[i-1],c=n[i+1],d=o[r-1],f=o[r+1];if(p&&d){if(p[0]!==d[0]){const e=Math.max(p[0],d[0]);l.push([p,d].find((t=>t[0]===e)))}}else p?l.push(p):d&&s.push(d);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const g=Math.max(a[1],u[1]);s.push([a,u].find((e=>e[1]===g)));const v=()=>{const t=[...l,...s.reverse()],[i]=t,n=t.at(-1);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(c&&f){if(c[0]!==f[0]){const e=Math.min(c[0],f[0]);l.push([c,f].find((t=>t[0]===e))),v()}}else c?(l.push(c),v()):f?(s.push(f),v()):v()})),e})().forEach((t=>{var n,l,s,r,a,u;const p=t.map((e=>({x:e[0],y:e[1]}))),c=new e.Polygon(p,{...i,...(null==(n=o.shadow)?void 0:n.style)||{}});if("slash"==(null==(l=o.shadow)?void 0:l.mode)){c.set({fill:"transparent",stroke:(null==(r=null==(s=o.shadow)?void 0:s.style)?void 0:r.stroke)||"#f00"});const e=A(t,null==(a=o.shadow)?void 0:a.style._angle,null==(u=o.shadow)?void 0:u.style.space);e.forEach((e=>{var t;Object.assign(e,{...i,...(null==(t=o.shadow)?void 0:t.style)||{}}),N.add(e)})),x.value.add(...e)}N.add(c),x.value.add(c)}))}}function oe(){var e;const t=ie.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const o=Object.assign({},p,D.overlap||{}),l=[];Z.size&&[...Z].forEach((e=>{[...ee].forEach((t=>{if(t.origin&&e.left===t.left&&e.top===t.top){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...i,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(n(r,{...o[e]||{},...s}))}}}))})),setTimeout((()=>{x.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),te.add(e)}))}))}function le(e,s,r){var a;const{type:u,riseStyle:p={},noRiseStyle:c={},verifiedStyle:f={},reduceStyle:v={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:L={},nonePainPointStyle:k={},dataList:S=[]}=r,$=[],T=[],P=[];null==(a=e.list)||a.forEach(((a,O)=>{const M=d(u)?S.find((e=>e.key===a.key)):e,I=ae(a,r),A={};A.value=function(e,t,i){if(!(null==e?void 0:e.length)||!J.showValue)return;const{lineAttr:n={}}=i,l=e[1]<=q.originY+X?e[1]+X:e[1]-X,s=o([e[0],l],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return P.push(s),{obj:s,top:-X}}(I,a,M),function(e,s,a,d){var g,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(u))return;const{lineAttr:m={}}=a,{value:x}=d;let b,w,L,k,Y,S;if(s.noRise&&c.show)if(c.text)L=o([e[0],e[1]+5],{value:c.text.split("").join("\n"),originY:"top",...c.style||{}}),P.push(L);else{const t=e[1]+2*X;k=l([e[0],e[1],t],c.style||{}),P.push(k)}s.rise&&p.show&&p.text&&(Y=o([e[0],e[1]-(x?X:0)-5],{value:p.text.split("").join("\n"),originY:"bottom",...p.style||{}}),P.push(Y));s.verified&&(S=o([e[0],e[1]-(x?X:0)-5],{value:"v",originX:"center",originY:"bottom",...f}),P.push(S));if(h(s.physicsReduce)||h(s.drugReduce)){const o=j(u,r.list,null!=(g=s.physicsReduce)?g:s.drugReduce);b=t([...e,e[0],o],{...m,...v.line,...i}),w=n((null==(y=null==v?void 0:v.point)?void 0:y.type)||"circle",{left:e[0],top:o,...v.point,...i,originY:o===K?"bottom":"center"}),b&&P.push(b),w&&P.push(w)}Object.assign(d,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:L,top:5},arrowGroup:{obj:k,top:2*X},riseText:{obj:Y,top:(x?-X:0)-5},verifiedText:{obj:S,top:(x?-X:0)-5},reducePoint:{obj:w,type:"reduce"}})}(I,a,M,A),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(u))return;let s,a;const{upArrowShow:p=!1,limitValueShow:c=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*X,i=[e[1]-X/2,t];t<q.originY&&(t=e[1]+2.5*X,i=[t,e[1]+X/2]),s=l([e[0],i[0],i[1]],m,"up"),P.push(s)}if(c){const i={value:t.value,originX:"center",originY:"center",...L};if(+t.value>Math.max(...r.list)){const t=s?e[1]+X/2+s.height:e[1]+X;a=o([e[0],t],i),P.push(a)}+t.value<Math.min(...r.list)&&(a=o([e[0],e[1]-X],i),P.push(a))}Object.assign(n,{upArrow:{obj:s},limitValue:{obj:a,top:-X}})}(I,a,M,A),function(i,o,l,a,p){let c,d;const{pointAttr:f={},lineAttr:h={},title:v="",key:m,type:L="circle"}=a,j=e.list[l+1],S=ae(j,r),P=se(u,e.list[l].value),O=S&&se(u,j.value);!i||!S||o.breakpoint||P||O||i[0]===S[0]||(d=t([...i,...S],{...h}));const M=o.pacemakerShow&&"pulse"==u?y.value:P?0:L,I=T[l-1],A={origin:{data:o,title:v,key:m||"",unit:r.unit,type:u,_type:g(v,u),dataIndex:s,index:l},leftLine:I,rightLine:d,otherObj:p,lockMovementX:!0,...o.pacemakerShow&&"pulse"==u?y.style:f,...b.event,...P?{selectable:!1,evented:!1,...k}:{}};if(I){const e=I.get("y2");c=n(M,{left:I.get("x2"),top:P?e-5:e,...A})}else i&&(A.leftLine=null,c=n(M,{left:i[0],top:P?i[1]-5:i[1],...A}));T.push(d),c&&(v.includes("脉搏")?Z.add(c):ee.add(c),function(e){H.hovered&&(e.on("mouseover",(()=>{re(e)})),e.on("mouseout",(()=>{E.show=!1})));e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?W:q;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):null==i||i.setCoords().set({left:e.left,top:e.top+o}))})),ne(e)}(e),H.hovered&&re(e)})),e.on("mouseup",(t=>{if(E.show=!1,1===t.button){const{type:t}=e.origin,i=Y(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};x.value.discardActiveObject(),w("change",n),pe(n,"change")}}))}(c),$.push(c),te.add(c))}(I,a,O,M,A)})),"pulse"===u&&Q.forEach((e=>{U.set(e,$.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all($).then((e=>{const t=T.filter((e=>e));let i=null;e=e.map((e=>(e&&i&&(i.nextPoint=e,e.prevPoint=i),i=e||i,e))),Promise.all(P).then((i=>{x.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&x.value.remove(e.leftLine),e.rightLine&&x.value.remove(e.rightLine))}}(t,e)}))}))}))}function se(e,t){return"pain"===e&&0==t}function re(e){const{title:t,unit:i,type:n,data:o}=e.origin;E.point={x:e.left,y:e.top},E.list=[function(){const{drugReduce:l,physicsReduce:s}=o||{},r=Y(n,e.top);if(h(l))return`药物降${"pain"==n?"痛":"温"} ${r}—>${l}${i||""}`;if(h(s))return`物理降${"pain"==n?"痛":"温"} ${r}—>${s}${i||""}`;return`${t} ${r}${i||""}`}(),`时间 ${((null==o?void 0:o.time)||k(e.left)).slice(-5)}`],E.show=!0}function ae(e,t){const i="pain"===t.type?W:q;if(v(e)&&function(e){const[t]=R,i=R.at(-1),n=t.start,o=i.end,l=new Date(e).getTime();return l>=n&&l<=o}(e.time)){const n=L(e.time),o=j(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ue(e){const t=new Date,i=`00${t.getMonth()+1}`.slice(-2),n=`00${t.getDate()}`.slice(-2),o=new Date(`${t.getFullYear()}-${i}-${n} 23:59:59`).getTime(),l=new Date(`${k(e)}:00`).getTime();return B&&l<new Date(B).getTime()?(I(),!1):!(l>o)||(M(),!1)}function pe(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ie.find((e=>e.type===i));if("add"===t){const e=d(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=y(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;ce()}function ce(){var e;te.size&&(null==(e=x.value)||e.remove(...function(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),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...te]))),U.clear(),te.clear(),Z.clear(),ee.clear(),ie.forEach((e=>{e.dataList.forEach(((t,i)=>{d(e.type)&&!t.enable||le(t,i,e)}))})),ne(),oe()}return U.clear(),Z.clear(),ee.clear(),ie.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const i=j(e.type,e.list,e.positionLine.value),n=t([z,i,V,i],e.positionLine);x.value.add(n)}(e),e.dataList.forEach(((t,i)=>{d(e.type)&&!t.enable||le(t,i,e)}))})),ne(),oe(),b.event.evented&&x.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=z&&i<=V&&n>=F&&n<=_){$.point={x:i,y:n},$.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&($.list=[...a]),"pain"===o&&($.list=[...u]),$.target=e.target;else{$.target=null,$.list=["新增节点"],G.forEach((t=>{if(!P(i,"_type",C).includes(t.bigType)){const i=["pain"].includes(t.bigType)?W:q;n>=i.originY&&n<=i.endY&&$.list.push({renderItem:S?S(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:f(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ue(i);t&&1!==$.list.length||($.show=!1,1===$.list.length&&t&&O())}}}})),{pointTipProps:E,pointMenuProps:$,clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=m(i,[...a,...u]);s[`${e.type}`]=e.value,d(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};w("change",r),pe(r,"change")}else{const t={data:{time:k(e.pointer.x),value:Y(e.origin.type,e.pointer.y),...d(e.origin.type)?{key:e.origin.key}:{}},...e.origin};w("add",t),pe(t)}},setPopup:re,isAddPoint:ue,updateData:pe,redrawPoints:ce}}export{x as useCenter};
|
|
1
|
+
import{fabric as e}from"../utils/index.js";import{drawLine as t,defaultStyle as i,drawPoint as n,drawText as o,drawArrow as l}from"./useDraw.js";import s from"./useGrid.js";import{useShadow as r}from"./useShadow.js";import{TEMPERATURE_MENU as a,PAIN_MENU as u,OVERLAP as p}from"./constant.js";import{cloneDeep as c}from"lodash-es";import{isOneLine as d,getType as f,isValidValue as h,setOtherType as v,isEffectiveNode as g,getIndex as y,deleteProperty as m}from"../utils/utils.js";function b(b,x,w,L,j,k,Y,S,E,$,T){s(b,x);const{getEqualXTypes:M,repeatTip:P,maxLimitTip:O,minLimitTip:I}=T,{createShadowLines:A}=r(),{left:D,xScaleList:R,xCellWidth:C,yCellHeight:X,originX:z,endX:V,originY:F,endY:_,itemList:G,event:H,vitalSignsOriginY:q,painOriginY:W,hospitalizationDate:B,config:J,canvasHeight:K}=x,N=new Set,Q=["xinmai","mai"],U=new Map,Z=new Set,ee=new Set,te=new Set,ie=c(D.yScaleValue);function ne(t){var n;const o=ie.find((e=>"pulse"===e.type));if(o&&(null==(n=o.dataList)?void 0:n.length)&&(N.size&&b.value.remove(...N),N.clear(),U.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=U.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}(function(){const e=[],t=[],i=[];for(const e of U)t.push(e[1]),e[0]===Q[0]&&e[1].forEach((e=>{(U.get(Q[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),a=n[i],u=o[r],p=n[i-1],c=n[i+1],d=o[r-1],f=o[r+1];if(p&&d){if(p[0]!==d[0]){const e=Math.max(p[0],d[0]);l.push([p,d].find((t=>t[0]===e)))}}else p?l.push(p):d&&s.push(d);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const v=Math.max(a[1],u[1]);s.push([a,u].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=t.at(-1);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(c&&f){if(c[0]!==f[0]){const e=Math.min(c[0],f[0]);l.push([c,f].find((t=>t[0]===e))),g()}}else c?(l.push(c),g()):f?(s.push(f),g()):g()})),e})().forEach((t=>{var n,l,s,r,a,u;const p=t.map((e=>({x:e[0],y:e[1]}))),c=new e.Polygon(p,{...i,...(null==(n=o.shadow)?void 0:n.style)||{}});if("slash"==(null==(l=o.shadow)?void 0:l.mode)){c.set({fill:"transparent",stroke:(null==(r=null==(s=o.shadow)?void 0:s.style)?void 0:r.stroke)||"#f00"});const e=A(t,null==(a=o.shadow)?void 0:a.style._angle,null==(u=o.shadow)?void 0:u.style.space);e.forEach((e=>{var t;Object.assign(e,{...i,...(null==(t=o.shadow)?void 0:t.style)||{}}),N.add(e)})),b.value.add(...e)}N.add(c),b.value.add(c)}))}}function oe(){var e;const t=ie.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const o=Object.assign({},p,D.overlap||{}),l=[];Z.size&&[...Z].forEach((e=>{[...ee].forEach((t=>{if(t.origin&&e.left===t.left&&e.top===t.top){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...i,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(n(r,{...o[e]||{},...s}))}}}))})),setTimeout((()=>{b.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),te.add(e)}))}))}function le(e,s,r){var a;const{type:u,riseStyle:p={},noRiseStyle:c={},verifiedStyle:f={},reduceStyle:g={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:L={},nonePainPointStyle:k={},dataList:S=[]}=r,$=[],T=[],M=[];null==(a=e.list)||a.forEach(((a,P)=>{const O=d(u)?S.find((e=>e.key===a.key)):e,I=ae(a,r),A={};A.value=function(e,t,i){if(!(null==e?void 0:e.length)||!J.showValue)return;const{lineAttr:n={}}=i,l=e[1]<=q.originY+X?e[1]+X:e[1]-X,s=o([e[0],l],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return M.push(s),{obj:s,top:-X}}(I,a,O),function(e,s,a,d){var v,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(u))return;const{lineAttr:m={}}=a,{value:b}=d;let x,w,L,k,Y,S;if(s.noRise&&c.show)if(c.text)L=o([e[0],e[1]+5],{value:c.text.split("").join("\n"),originY:"top",...c.style||{}}),M.push(L);else{const t=e[1]+2*X;k=l([e[0],e[1],t],c.style||{}),M.push(k)}s.rise&&p.show&&p.text&&(Y=o([e[0],e[1]-(b?X:0)-5],{value:p.text.split("").join("\n"),originY:"bottom",...p.style||{}}),M.push(Y));s.verified&&(S=o([e[0],e[1]-(b?X:0)-5],{value:"v",originX:"center",originY:"bottom",...f}),M.push(S));if(h(s.physicsReduce)||h(s.drugReduce)){const o=j(u,r.list,null!=(v=s.physicsReduce)?v:s.drugReduce);x=t([...e,e[0],o],{...m,...g.line,...i}),w=n((null==(y=null==g?void 0:g.point)?void 0:y.type)||"circle",{left:e[0],top:o,...g.point,...i,originY:o===K?"bottom":"center"}),x&&M.push(x),w&&M.push(w)}Object.assign(d,{reduceLine:{obj:x,type:"line"},noRiseText:{obj:L,top:5},arrowGroup:{obj:k,top:2*X},riseText:{obj:Y,top:(b?-X:0)-5},verifiedText:{obj:S,top:(b?-X:0)-5},reducePoint:{obj:w,type:"reduce"}})}(I,a,O,A),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(u))return;let s,a;const{upArrowShow:p=!1,limitValueShow:c=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*X,i=[e[1]-X/2,t];t<q.originY&&(t=e[1]+2.5*X,i=[t,e[1]+X/2]),s=l([e[0],i[0],i[1]],m,"up"),M.push(s)}if(c){const i={value:t.value,originX:"center",originY:"center",...L};if(+t.value>Math.max(...r.list)){const t=s?e[1]+X/2+s.height:e[1]+X;a=o([e[0],t],i),M.push(a)}+t.value<Math.min(...r.list)&&(a=o([e[0],e[1]-X],i),M.push(a))}Object.assign(n,{upArrow:{obj:s},limitValue:{obj:a,top:-X}})}(I,a,O,A),function(i,o,l,a,p){let c,d;const{pointAttr:f={},lineAttr:h={},title:g="",key:m,type:L="circle"}=a,j=e.list[l+1],S=ae(j,r),M=se(u,e.list[l].value),P=S&&se(u,j.value);!i||!S||o.breakpoint||M||P||i[0]===S[0]||(d=t([...i,...S],{...h}));const O=o.pacemakerShow&&"pulse"==u?y.value:M?0:L,I=T[l-1],A={origin:{data:o,title:g,key:m||"",unit:r.unit,type:u,_type:v(g,u),dataIndex:s,index:l},leftLine:I,rightLine:d,otherObj:p,lockMovementX:!0,...o.pacemakerShow&&"pulse"==u?y.style:f,...x.event.hovered?x.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:x.event,...M?{selectable:!1,evented:!1,...k}:{}};if(I){const e=I.get("y2");c=n(O,{left:I.get("x2"),top:M?e-5:e,...A})}else i&&(A.leftLine=null,c=n(O,{left:i[0],top:M?i[1]-5:i[1],...A}));T.push(d),c&&(g.includes("脉搏")?Z.add(c):ee.add(c),function(e){H.hovered&&(e.on("mouseover",(()=>{re(e)})),e.on("mouseout",(()=>{E.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?W:q;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):null==i||i.setCoords().set({left:e.left,top:e.top+o}))})),ne(e)}(e),H.hovered&&re(e)})),e.on("mouseup",(t=>{if(E.show=!1,1===t.button){const{type:t}=e.origin,i=Y(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};b.value.discardActiveObject(),w("change",n),pe(n,"change")}}))}(c),$.push(c),te.add(c))}(I,a,P,O,A)})),"pulse"===u&&Q.forEach((e=>{U.set(e,$.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all($).then((e=>{const t=T.filter((e=>e));let i=null;e=e.map((e=>(e&&i&&(i.nextPoint=e,e.prevPoint=i),i=e||i,e))),Promise.all(M).then((i=>{b.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&b.value.remove(e.leftLine),e.rightLine&&b.value.remove(e.rightLine))}}(t,e)}))}))}))}function se(e,t){return"pain"===e&&0==t}function re(e){const{title:t,unit:i,type:n,data:o}=e.origin;E.point={x:e.left,y:e.top},E.list=[function(){const{drugReduce:l,physicsReduce:s}=o||{},r=Y(n,e.top);if(h(l))return`药物降${"pain"==n?"痛":"温"} ${r}—>${l}${i||""}`;if(h(s))return`物理降${"pain"==n?"痛":"温"} ${r}—>${s}${i||""}`;return`${t} ${r}${i||""}`}(),`时间 ${((null==o?void 0:o.time)||k(e.left)).slice(-5)}`],E.show=!0}function ae(e,t){const i="pain"===t.type?W:q;if(g(e)&&function(e){const[t]=R,i=R.at(-1),n=t.start,o=i.end,l=new Date(e).getTime();return l>=n&&l<=o}(e.time)){const n=L(e.time),o=j(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ue(e){const t=new Date,i=`00${t.getMonth()+1}`.slice(-2),n=`00${t.getDate()}`.slice(-2),o=new Date(`${t.getFullYear()}-${i}-${n} 23:59:59`).getTime(),l=new Date(`${k(e)}:00`).getTime();return B&&l<new Date(B).getTime()?(I(),!1):!(l>o)||(O(),!1)}function pe(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ie.find((e=>e.type===i));if("add"===t){const e=d(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=y(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;ce()}function ce(){var e;te.size&&(null==(e=b.value)||e.remove(...function(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),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...te]))),U.clear(),te.clear(),Z.clear(),ee.clear(),ie.forEach((e=>{e.dataList.forEach(((t,i)=>{d(e.type)&&!t.enable||le(t,i,e)}))})),ne(),oe()}return U.clear(),Z.clear(),ee.clear(),ie.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const i=j(e.type,e.list,e.positionLine.value),n=t([z,i,V,i],e.positionLine);b.value.add(n)}(e),e.dataList.forEach(((t,i)=>{d(e.type)&&!t.enable||le(t,i,e)}))})),ne(),oe(),x.event.evented&&b.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=z&&i<=V&&n>=F&&n<=_){$.point={x:i,y:n},$.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&($.list=[...a]),"pain"===o&&($.list=[...u]),$.target=e.target;else{$.target=null,$.list=["新增节点"],G.forEach((t=>{if(!M(i,"_type",C).includes(t.bigType)){const i=["pain"].includes(t.bigType)?W:q;n>=i.originY&&n<=i.endY&&$.list.push({renderItem:S?S(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:f(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ue(i);t&&1!==$.list.length||($.show=!1,1===$.list.length&&t&&P())}}}})),{pointTipProps:E,pointMenuProps:$,clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=m(i,[...a,...u]);s[`${e.type}`]=e.value,d(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};w("change",r),pe(r,"change")}else{const t={data:{time:k(e.pointer.x),value:Y(e.origin.type,e.pointer.y),...d(e.origin.type)?{key:e.origin.key}:{}},...e.origin};w("add",t),pe(t)}},setPopup:re,isAddPoint:ue,updateData:pe,redrawPoints:ce}}export{b as useCenter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,ref as l,reactive as t,watch as i,onMounted as s,openBlock as d,createElementBlock as a,normalizeStyle as o,createVNode as n,unref as c,withCtx as h,createElementVNode as r,normalizeClass as u,createCommentVNode as p,createBlock as f,createTextVNode as w,toDisplayString as v,withDirectives as k,vShow as y,renderSlot as b}from"vue";import{NSpin as g,NCheckbox as m,NTooltip as U,NSelect as S,NInput as x,NInputNumber as E,NPopconfirm as _,NButton as W}from"naive-ui";import C from"../../../shared/components/VueDraggable/src/vuedraggable.js";import O from"../../../_virtual/plugin-vue_export-helper.js";const F={class:"fields-set-content"},q={class:"fields-table"},D=r("span",{class:"width-show",style:{width:"4%"}},null,-1),N=r("span",{class:"width-large"},"所有字段",-1),P={class:"width-show"},j={key:0,class:"width-show"},R={key:1,class:"width-show"},I={class:"width-show"},L={class:"width-show"},T=r("span",{class:"width-showed"},"默认排序",-1),z=r("span",{class:"width-showed"},"固定",-1),A=r("span",{class:"width-word"},"自定义标题",-1),B=r("span",{class:"width-showed"},"列宽",-1),G=["onClick"],H={class:"width-show drag-icon-wrap"},J=r("span",{class:"iconfont icon-a-menzhenyishengzhanxitongtubiaotuozhuai",style:{color:"#000"}},null,-1),V=r("span",null,"拖拽调整顺序",-1),$=r("span",{style:{width:"14px","margin-right":"6px"}},null,-1),K={class:"width-show"},M={key:0,class:"width-show"},Q={key:1,class:"width-show"},X={class:"width-show"},Y={class:"width-show"},Z={class:"width-showed"},ee={class:"width-showed"},le={class:"width-word"},te={class:"width-showed"},ie={key:0,class:"check-options"},se={class:"btn-operate"};var de=O(e({__name:"FieldSet",props:{fields:{type:Array,default:function(){return[]}},footerFlag:{type:Boolean,default:!0},type:{type:String,default:"old"},isEdit:{type:Boolean,default:!1}},emits:["onSave","onClose","reset"],setup(e,{expose:O,emit:de}){const ae=e,oe={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"},ne=[{label:"不固定",value:"NONE"},{label:"左固定",value:"LEFT"},{label:"右固定",value:"RIGHT"}],ce=[{label:"不排序",value:"NONE"},{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],he=l(null);function re(){const e=ae.fields?JSON.parse(JSON.stringify(ae.fields)):[];return Object.keys(oe).forEach((l=>{e.forEach((e=>{"old"==ae.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[oe[l]]=1==e[l]:e[oe[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)}))})),e}const ue=t({spinning:!1,isCustomSearch:!0,clickItem:{},fields:[],widthShow:"9%",widthLarge:"19%"}),pe=e=>ue.fields.some((l=>Object.prototype.hasOwnProperty.call(l,e))),fe=()=>{if("old"==ae.type){let e=[];return ue.fields.length>0&&ue.fields.forEach(((l,t)=>{e.push({id:l.id,field:l.name,visible:l.show,sequence:t,sortable:l.sort,title:l.alias,fixed:l.fixedWay,minWidth:l.columnWidth,bold:l.bold,sortDirection:l.sortDirection,...ae.isEdit?{required:l.required,editable:l.editable}:{}})})),e}return ue.fields},we=()=>{de("onSave",{tableFields:fe()})},ve=()=>{de("onClose")};function ke(){ue.fields=re(),de("reset")}const ye=e=>!!ue.fields.length&&ue.fields.every((l=>!(Object.prototype.hasOwnProperty.call(l,e)&&!ge(l,e))||l[e])),be=(e,l)=>{const t=e,i=ue.fields.map((e=>(Object.prototype.hasOwnProperty.call(e,l)&&!ge(e,l)&&(e[l]=t),e)));ue.fields=i};function ge(e,l){return["editable","required"].includes(l)&&e[`${l}Disable`]||["sort"].includes(l)&&1==e.notParticipatingSort}return i((()=>ae.fields),(e=>{(null==e?void 0:e.length)>0&&(ue.fields=re())}),{immediate:!0,deep:!0}),s((()=>{var e;null==(e=he.value)||e.style.setProperty("margin","auto"),ae.isEdit&&(ue.widthShow="8%",ue.widthLarge="13%")})),O({getTableFields:fe}),(l,t)=>(d(),a("div",{ref_key:"settingView",ref:he,class:"c-field-set",style:o({"--width-show":ue.widthShow,"--width-large":ue.widthLarge})},[n(c(g),{show:ue.spinning,tip:"...",style:{width:"100%",height:"100%"}},{default:h((()=>[r("div",F,[r("div",q,[r("div",{class:u(["setting-title",{"seting-title-api":!ue.isCustomSearch}])},[D,p(" 字段名称 "),N,p(" 显示 "),r("span",P,[pe("show")?(d(),f(c(m),{key:0,checked:ye("show"),"onUpdate:checked":t[0]||(t[0]=e=>be(e,"show"))},null,8,["checked"])):p("v-if",!0),w(" 显示 ")]),p(" 可编辑 "),e.isEdit?(d(),a("span",j,[pe("editable")?(d(),f(c(m),{key:0,checked:ye("editable"),"onUpdate:checked":t[1]||(t[1]=e=>be(e,"editable"))},null,8,["checked"])):p("v-if",!0),w(" 编辑 ")])):p("v-if",!0),p(" 是否必填 "),e.isEdit?(d(),a("span",R,[pe("required")?(d(),f(c(m),{key:0,checked:ye("required"),"onUpdate:checked":t[2]||(t[2]=e=>be(e,"required"))},null,8,["checked"])):p("v-if",!0),w(" 必填 ")])):p("v-if",!0),p(" 排序 "),r("span",I,[pe("sort")?(d(),f(c(m),{key:0,checked:ye("sort"),"onUpdate:checked":t[3]||(t[3]=e=>be(e,"sort"))},null,8,["checked"])):p("v-if",!0),w(" 排序 ")]),r("span",L,[n(c(m),{checked:ye("bold"),"onUpdate:checked":t[4]||(t[4]=e=>be(e,"bold"))},null,8,["checked"]),w(" 加粗 ")]),p(" 默认排序 "),T,p(" 固定 "),z,p(" 自定义标题 "),A,p(" 列宽 "),B],2),r("div",{ref:"setShow",class:u(["set-show",{"set-show-api":!ue.isCustomSearch}])},[n(c(C),{list:ue.fields,animation:"150","item-key":"id",tag:"ul"},{item:h((({element:l})=>{return[l.hide?p("v-if",!0):(d(),a("li",{key:0,class:"left-style",style:o((t=l,{background:ue.clickItem.id===t.id?"#f2f2f2":void 0})),onClick:e=>{return t=l,void(ue.clickItem=t);var t}},[r("span",H,[n(c(U),{trigger:"hover"},{trigger:h((()=>[J])),default:h((()=>[V])),_:1})]),p(" 字段名称 "),r("span",{class:u(["width-large title-item",{blue:l.extraField}])},[$,r("span",null,v(l.title),1)],2),p(" 显示 "),r("span",K,[k(n(c(m),{checked:l.show,"onUpdate:checked":e=>l.show=e},null,8,["checked","onUpdate:checked"]),[[y,"0001"!=l.id]])]),p(" 是否可编辑 "),e.isEdit?(d(),a("span",M,[k(n(c(m),{disabled:l.editableDisable,checked:l.editable,"onUpdate:checked":e=>l.editable=e},null,8,["disabled","checked","onUpdate:checked"]),[[y,"0001"!=l.id]])])):p("v-if",!0),p(" 是否必填 "),e.isEdit?(d(),a("span",Q,[k(n(c(m),{disabled:l.requiredDisable,checked:l.required,"onUpdate:checked":e=>l.required=e},null,8,["disabled","checked","onUpdate:checked"]),[[y,"0001"!=l.id]])])):p("v-if",!0),p(" 排序 "),r("span",X,[k(n(c(m),{checked:l.sort,"onUpdate:checked":e=>l.sort=e,disabled:1==l.notParticipatingSort},null,8,["checked","onUpdate:checked","disabled"]),[[y,"0001"!=l.id]])]),p(" 加粗 "),r("span",Y,[k(n(c(m),{checked:l.bold,"onUpdate:checked":e=>l.bold=e},null,8,["checked","onUpdate:checked"]),[[y,"0001"!=l.id]])]),p(" 默认排序 "),r("span",Z,[k(n(c(S),{value:l.sortDirection,"onUpdate:value":e=>l.sortDirection=e,options:ce,style:{width:"90%",display:"flex"}},null,8,["value","onUpdate:value"]),[[y,"0001"!=l.id]])]),p(" 固定 "),r("span",ee,[n(c(S),{value:l.fixedWay,"onUpdate:value":e=>l.fixedWay=e,options:ne,style:{width:"90%",display:"flex"}},null,8,["value","onUpdate:value"])]),p(" 自定义标题 "),r("span",le,[k(n(c(x),{value:l.alias,"onUpdate:value":e=>l.alias=e,style:{width:"90%"},clearable:""},null,8,["value","onUpdate:value"]),[[y,"0001"!=l.id]])]),p(" 列宽 "),r("span",te,[n(c(E),{value:l.columnWidth,"onUpdate:value":e=>l.columnWidth=e,clearable:""},null,8,["value","onUpdate:value"])])],12,G))];var t})),_:1},8,["list"])],2)]),ae.footerFlag?(d(),a("div",ie,[r("div",se,[b(l.$slots,"footer",{},(()=>[n(c(_),{onPositiveClick:ke},{trigger:h((()=>[n(c(W),{style:{"margin-right":"8px"}},{default:h((()=>[w("恢复默认设置")])),_:1})])),default:h((()=>[w(" 确认要恢复系统默认设置吗? ")])),_:1}),n(c(W),{style:{"margin-right":"8px"},onClick:ve},{default:h((()=>[w("取消")])),_:1}),n(c(W),{type:"primary",onClick:we},{default:h((()=>[w("保存")])),_:1})]))])])):p("v-if",!0)])])),_:3},8,["show"])],4))}}),[["__file","FieldSet.vue"]]);export{de as default};
|
|
1
|
+
import{defineComponent as e,ref as l,reactive as t,watch as i,onMounted as s,openBlock as d,createElementBlock as a,normalizeStyle as o,createVNode as n,unref as c,withCtx as h,createElementVNode as r,normalizeClass as u,createCommentVNode as p,createBlock as f,createTextVNode as w,toDisplayString as v,withDirectives as k,vShow as y,renderSlot as b}from"vue";import{NSpin as g,NCheckbox as m,NTooltip as U,NSelect as S,NInput as x,NInputNumber as E,NPopconfirm as _,NButton as W}from"naive-ui";import C from"../../../shared/components/VueDraggable/src/vuedraggable.js";import O from"../../../_virtual/plugin-vue_export-helper.js";const F={class:"fields-set-content"},q={class:"fields-table"},D=r("span",{class:"width-show",style:{width:"4%"}},null,-1),N=r("span",{class:"width-large"},"所有字段",-1),P={class:"width-show"},j={key:0,class:"width-show"},R={key:1,class:"width-show"},I={class:"width-show"},L={class:"width-show"},T=r("span",{class:"width-showed"},"默认排序",-1),z=r("span",{class:"width-showed"},"固定",-1),A=r("span",{class:"width-word"},"自定义标题",-1),B=r("span",{class:"width-showed"},"列宽",-1),G=["onClick"],H={class:"width-show drag-icon-wrap"},J=r("span",{class:"iconfont icon-a-menzhenyishengzhanxitongtubiaotuozhuai",style:{color:"#000"}},null,-1),V=r("span",null,"拖拽调整顺序",-1),$=r("span",{style:{width:"14px","margin-right":"6px"}},null,-1),K={class:"width-show"},M={key:0,class:"width-show"},Q={key:1,class:"width-show"},X={class:"width-show"},Y={class:"width-show"},Z={class:"width-showed"},ee={class:"width-showed"},le={class:"width-word"},te={class:"width-showed"},ie={key:0,class:"check-options"},se={class:"btn-operate"};var de=O(e({__name:"FieldSet",props:{fields:{type:Array,default:function(){return[]}},footerFlag:{type:Boolean,default:!0},type:{type:String,default:"old"},isEdit:{type:Boolean,default:!1}},emits:["onSave","onClose","reset"],setup(e,{expose:O,emit:de}){const ae=e,oe={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"},ne=[{label:"不固定",value:"NONE"},{label:"左固定",value:"LEFT"},{label:"右固定",value:"RIGHT"}],ce=[{label:"不排序",value:"NONE"},{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],he=l(null);function re(){const e=ae.fields?JSON.parse(JSON.stringify(ae.fields)):[];return Object.keys(oe).forEach((l=>{e.forEach((e=>{"old"==ae.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[oe[l]]=1==e[l]:e[oe[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)}))})),e}const ue=t({spinning:!1,isCustomSearch:!0,clickItem:{},fields:[],widthShow:"9%",widthLarge:"19%"}),pe=e=>ue.fields.some((l=>Object.prototype.hasOwnProperty.call(l,e))),fe=()=>{if("old"==ae.type){let e=[];return ue.fields.length>0&&ue.fields.forEach(((l,t)=>{e.push({id:l.id,field:l.name,visible:l.show,sequence:t,sortable:l.sort,title:l.alias,fixed:l.fixedWay,minWidth:l.columnWidth,bold:l.bold,sortDirection:l.sortDirection,...ae.isEdit?{required:l.required,editable:l.editable}:{}})})),e}return ue.fields},we=()=>{de("onSave",{tableFields:fe()})},ve=()=>{de("onClose")};function ke(){ue.fields=re(),de("reset")}const ye=e=>!!ue.fields.length&&ue.fields.every((l=>!(Object.prototype.hasOwnProperty.call(l,e)&&!ge(l,e))||l[e])),be=(e,l)=>{const t=e,i=ue.fields.map((e=>(Object.prototype.hasOwnProperty.call(e,l)&&!ge(e,l)&&(e[l]=t),e)));ue.fields=i};function ge(e,l){return["editable","required"].includes(l)&&e[`${l}Disable`]||["sort"].includes(l)&&1==e.notParticipatingSort}return i((()=>ae.fields),(e=>{(null==e?void 0:e.length)>0&&(ue.fields=re())}),{immediate:!0,deep:!0}),s((()=>{var e;null==(e=he.value)||e.style.setProperty("margin","auto"),ae.isEdit&&(ue.widthShow="8%",ue.widthLarge="13%")})),O({getTableFields:fe}),(l,t)=>(d(),a("div",{ref_key:"settingView",ref:he,class:"c-field-set",style:o({"--width-show":ue.widthShow,"--width-large":ue.widthLarge})},[n(c(g),{show:ue.spinning,tip:"...",style:{width:"100%",height:"100%"}},{default:h((()=>[r("div",F,[r("div",q,[r("div",{class:u(["setting-title",{"seting-title-api":!ue.isCustomSearch}])},[D,p(" 字段名称 "),N,p(" 显示 "),r("span",P,[pe("show")?(d(),f(c(m),{key:0,checked:ye("show"),"onUpdate:checked":t[0]||(t[0]=e=>be(e,"show"))},null,8,["checked"])):p("v-if",!0),w(" 显示 ")]),p(" 可编辑 "),e.isEdit?(d(),a("span",j,[pe("editable")?(d(),f(c(m),{key:0,checked:ye("editable"),"onUpdate:checked":t[1]||(t[1]=e=>be(e,"editable"))},null,8,["checked"])):p("v-if",!0),w(" 编辑 ")])):p("v-if",!0),p(" 是否必填 "),e.isEdit?(d(),a("span",R,[pe("required")?(d(),f(c(m),{key:0,checked:ye("required"),"onUpdate:checked":t[2]||(t[2]=e=>be(e,"required"))},null,8,["checked"])):p("v-if",!0),w(" 必填 ")])):p("v-if",!0),p(" 排序 "),r("span",I,[pe("sort")?(d(),f(c(m),{key:0,checked:ye("sort"),"onUpdate:checked":t[3]||(t[3]=e=>be(e,"sort"))},null,8,["checked"])):p("v-if",!0),w(" 排序 ")]),r("span",L,[n(c(m),{checked:ye("bold"),"onUpdate:checked":t[4]||(t[4]=e=>be(e,"bold"))},null,8,["checked"]),w(" 加粗 ")]),p(" 默认排序 "),T,p(" 固定 "),z,p(" 自定义标题 "),A,p(" 列宽 "),B],2),r("div",{ref:"setShow",class:u(["set-show",{"set-show-api":!ue.isCustomSearch}])},[n(c(C),{list:ue.fields,animation:"150","item-key":"id",tag:"ul"},{item:h((({element:l})=>{return[l.hide?p("v-if",!0):(d(),a("li",{key:0,class:"left-style",style:o((t=l,{background:ue.clickItem.id===t.id?"#f2f2f2":void 0})),onClick:e=>{return t=l,void(ue.clickItem=t);var t}},[r("span",H,[n(c(U),{trigger:"hover"},{trigger:h((()=>[J])),default:h((()=>[V])),_:1})]),p(" 字段名称 "),r("span",{class:u(["width-large title-item",{blue:l.extraField}])},[$,r("span",null,v(l.title),1)],2),p(" 显示 "),r("span",K,[k(n(c(m),{checked:l.show,"onUpdate:checked":e=>l.show=e},null,8,["checked","onUpdate:checked"]),[[y,"0001"!=l.id]])]),p(" 是否可编辑 "),e.isEdit?(d(),a("span",M,[k(n(c(m),{disabled:l.editableDisable,checked:l.editable,"onUpdate:checked":e=>l.editable=e},null,8,["disabled","checked","onUpdate:checked"]),[[y,"0001"!=l.id]])])):p("v-if",!0),p(" 是否必填 "),e.isEdit?(d(),a("span",Q,[k(n(c(m),{disabled:l.requiredDisable,checked:l.required,"onUpdate:checked":e=>l.required=e},null,8,["disabled","checked","onUpdate:checked"]),[[y,"0001"!=l.id]])])):p("v-if",!0),p(" 排序 "),r("span",X,[k(n(c(m),{checked:l.sort,"onUpdate:checked":e=>l.sort=e,disabled:1==l.notParticipatingSort},null,8,["checked","onUpdate:checked","disabled"]),[[y,"0001"!=l.id]])]),p(" 加粗 "),r("span",Y,[k(n(c(m),{checked:l.bold,"onUpdate:checked":e=>l.bold=e},null,8,["checked","onUpdate:checked"]),[[y,"0001"!=l.id]])]),p(" 默认排序 "),r("span",Z,[k(n(c(S),{value:l.sortDirection,"onUpdate:value":e=>l.sortDirection=e,options:ce,style:{width:"90%",display:"flex"}},null,8,["value","onUpdate:value"]),[[y,"0001"!=l.id]])]),p(" 固定 "),r("span",ee,[n(c(S),{value:l.fixedWay,"onUpdate:value":e=>l.fixedWay=e,options:ne,style:{width:"90%",display:"flex"}},null,8,["value","onUpdate:value"])]),p(" 自定义标题 "),r("span",le,[k(n(c(x),{value:l.alias,"onUpdate:value":e=>l.alias=e,style:{width:"90%"},clearable:""},null,8,["value","onUpdate:value"]),[[y,"0001"!=l.id]])]),p(" 列宽 "),r("span",te,[n(c(E),{value:l.columnWidth,"onUpdate:value":e=>l.columnWidth=e,clearable:""},null,8,["value","onUpdate:value"])])],12,G))];var t})),_:1},8,["list"])],2)]),ae.footerFlag?(d(),a("div",ie,[r("div",se,[p(" 底部按钮插槽 "),b(l.$slots,"footer",{},(()=>[n(c(_),{onPositiveClick:ke},{trigger:h((()=>[n(c(W),{style:{"margin-right":"8px"}},{default:h((()=>[w("恢复默认设置")])),_:1})])),default:h((()=>[w(" 确认要恢复系统默认设置吗? ")])),_:1}),n(c(W),{style:{"margin-right":"8px"},onClick:ve},{default:h((()=>[w("取消")])),_:1}),n(c(W),{type:"primary",onClick:we},{default:h((()=>[w("保存")])),_:1})]))])])):p("v-if",!0)])])),_:3},8,["show"])],4))}}),[["__file","FieldSet.vue"]]);export{de as default};
|
|
@@ -108,8 +108,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
108
108
|
message?: string | undefined;
|
|
109
109
|
} | undefined;
|
|
110
110
|
option?: {
|
|
111
|
-
|
|
112
|
-
value: any;
|
|
111
|
+
[x: string]: any;
|
|
113
112
|
keyword?: string | undefined;
|
|
114
113
|
disabled?: boolean | undefined;
|
|
115
114
|
children?: any[] | undefined;
|
|
@@ -1802,8 +1801,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
1802
1801
|
message?: string | undefined;
|
|
1803
1802
|
} | undefined;
|
|
1804
1803
|
option?: {
|
|
1805
|
-
|
|
1806
|
-
value: any;
|
|
1804
|
+
[x: string]: any;
|
|
1807
1805
|
keyword?: string | undefined;
|
|
1808
1806
|
disabled?: boolean | undefined;
|
|
1809
1807
|
children?: any[] | undefined;
|
|
@@ -4427,8 +4425,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
4427
4425
|
message?: string | undefined;
|
|
4428
4426
|
} | undefined;
|
|
4429
4427
|
option?: {
|
|
4430
|
-
|
|
4431
|
-
value: any;
|
|
4428
|
+
[x: string]: any;
|
|
4432
4429
|
keyword?: string | undefined;
|
|
4433
4430
|
disabled?: boolean | undefined;
|
|
4434
4431
|
children?: any[] | undefined;
|
|
@@ -6133,8 +6130,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
6133
6130
|
message?: string | undefined;
|
|
6134
6131
|
} | undefined;
|
|
6135
6132
|
option?: {
|
|
6136
|
-
|
|
6137
|
-
value: any;
|
|
6133
|
+
[x: string]: any;
|
|
6138
6134
|
keyword?: string | undefined;
|
|
6139
6135
|
disabled?: boolean | undefined;
|
|
6140
6136
|
children?: any[] | undefined;
|
|
@@ -7811,8 +7807,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
7811
7807
|
message?: string | undefined;
|
|
7812
7808
|
} | undefined;
|
|
7813
7809
|
option?: {
|
|
7814
|
-
|
|
7815
|
-
value: any;
|
|
7810
|
+
[x: string]: any;
|
|
7816
7811
|
keyword?: string | undefined;
|
|
7817
7812
|
disabled?: boolean | undefined;
|
|
7818
7813
|
children?: any[] | undefined;
|
|
@@ -110,8 +110,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
110
110
|
message?: string | undefined;
|
|
111
111
|
} | undefined;
|
|
112
112
|
option?: {
|
|
113
|
-
|
|
114
|
-
value: any;
|
|
113
|
+
[x: string]: any;
|
|
115
114
|
keyword?: string | undefined;
|
|
116
115
|
disabled?: boolean | undefined;
|
|
117
116
|
children?: any[] | undefined;
|
|
@@ -1804,8 +1803,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1804
1803
|
message?: string | undefined;
|
|
1805
1804
|
} | undefined;
|
|
1806
1805
|
option?: {
|
|
1807
|
-
|
|
1808
|
-
value: any;
|
|
1806
|
+
[x: string]: any;
|
|
1809
1807
|
keyword?: string | undefined;
|
|
1810
1808
|
disabled?: boolean | undefined;
|
|
1811
1809
|
children?: any[] | undefined;
|
|
@@ -4429,8 +4427,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
4429
4427
|
message?: string | undefined;
|
|
4430
4428
|
} | undefined;
|
|
4431
4429
|
option?: {
|
|
4432
|
-
|
|
4433
|
-
value: any;
|
|
4430
|
+
[x: string]: any;
|
|
4434
4431
|
keyword?: string | undefined;
|
|
4435
4432
|
disabled?: boolean | undefined;
|
|
4436
4433
|
children?: any[] | undefined;
|
|
@@ -6135,8 +6132,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
6135
6132
|
message?: string | undefined;
|
|
6136
6133
|
} | undefined;
|
|
6137
6134
|
option?: {
|
|
6138
|
-
|
|
6139
|
-
value: any;
|
|
6135
|
+
[x: string]: any;
|
|
6140
6136
|
keyword?: string | undefined;
|
|
6141
6137
|
disabled?: boolean | undefined;
|
|
6142
6138
|
children?: any[] | undefined;
|
|
@@ -7813,8 +7809,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
7813
7809
|
message?: string | undefined;
|
|
7814
7810
|
} | undefined;
|
|
7815
7811
|
option?: {
|
|
7816
|
-
|
|
7817
|
-
value: any;
|
|
7812
|
+
[x: string]: any;
|
|
7818
7813
|
keyword?: string | undefined;
|
|
7819
7814
|
disabled?: boolean | undefined;
|
|
7820
7815
|
children?: any[] | undefined;
|
|
@@ -73,8 +73,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
73
73
|
message?: string | undefined;
|
|
74
74
|
} | undefined;
|
|
75
75
|
option?: {
|
|
76
|
-
|
|
77
|
-
value: any;
|
|
76
|
+
[x: string]: any;
|
|
78
77
|
keyword?: string | undefined;
|
|
79
78
|
disabled?: boolean | undefined;
|
|
80
79
|
children?: any[] | undefined;
|
|
@@ -1779,8 +1778,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1779
1778
|
message?: string | undefined;
|
|
1780
1779
|
} | undefined;
|
|
1781
1780
|
option?: {
|
|
1782
|
-
|
|
1783
|
-
value: any;
|
|
1781
|
+
[x: string]: any;
|
|
1784
1782
|
keyword?: string | undefined;
|
|
1785
1783
|
disabled?: boolean | undefined;
|
|
1786
1784
|
children?: any[] | undefined;
|
|
@@ -3457,8 +3455,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
3457
3455
|
message?: string | undefined;
|
|
3458
3456
|
} | undefined;
|
|
3459
3457
|
option?: {
|
|
3460
|
-
|
|
3461
|
-
value: any;
|
|
3458
|
+
[x: string]: any;
|
|
3462
3459
|
keyword?: string | undefined;
|
|
3463
3460
|
disabled?: boolean | undefined;
|
|
3464
3461
|
children?: any[] | undefined;
|
|
@@ -6,6 +6,14 @@ export declare const LEVEL_SEARCH_CASCADER: import("vue").DefineComponent<{
|
|
|
6
6
|
type: PropType<AnyObject[]>;
|
|
7
7
|
default: () => never[];
|
|
8
8
|
};
|
|
9
|
+
labelField: {
|
|
10
|
+
type: StringConstructor;
|
|
11
|
+
default: string;
|
|
12
|
+
};
|
|
13
|
+
valueField: {
|
|
14
|
+
type: StringConstructor;
|
|
15
|
+
default: string;
|
|
16
|
+
};
|
|
9
17
|
autograph: {
|
|
10
18
|
type: StringConstructor;
|
|
11
19
|
required: true;
|
|
@@ -46,6 +54,14 @@ export declare const LEVEL_SEARCH_CASCADER: import("vue").DefineComponent<{
|
|
|
46
54
|
type: PropType<AnyObject[]>;
|
|
47
55
|
default: () => never[];
|
|
48
56
|
};
|
|
57
|
+
labelField: {
|
|
58
|
+
type: StringConstructor;
|
|
59
|
+
default: string;
|
|
60
|
+
};
|
|
61
|
+
valueField: {
|
|
62
|
+
type: StringConstructor;
|
|
63
|
+
default: string;
|
|
64
|
+
};
|
|
49
65
|
autograph: {
|
|
50
66
|
type: StringConstructor;
|
|
51
67
|
required: true;
|
|
@@ -85,6 +101,8 @@ export declare const LEVEL_SEARCH_CASCADER: import("vue").DefineComponent<{
|
|
|
85
101
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
86
102
|
}, {
|
|
87
103
|
options: AnyObject[];
|
|
104
|
+
labelField: string;
|
|
105
|
+
valueField: string;
|
|
88
106
|
lazyRequest: boolean;
|
|
89
107
|
requestCache: boolean;
|
|
90
108
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,ref as r,computed as
|
|
1
|
+
import{defineComponent as e,ref as r,computed as t,inject as o,watch as a,createVNode as n}from"vue";import{useVModel as u}from"@vueuse/core";import{isEqual as i,isString as l,isEmpty as s,isFunction as c,omit as d}from"lodash-es";import"../../../index.js";import{InjectionAsyncQueue as p}from"../../constants/index.js";import{useCommonInjection as f}from"../../hooks/useCommonInjection.js";import{formRenderLog as m}from"../../utils/index.js";import{connect as y,mapProps as v}from"@formily/vue";import h from"../../../../search-cascader/index.js";import k from"../../../../../shared/components/no-data/NoData.vue.js";import{createVisitedSetter as j,assignUpdateValue as _}from"../../utils/schema.js";import{useFormField as w}from"../../hooks/useFormField.js";import{useFormRequest as b}from"../../hooks/useFormRequest.js";const g=y(e({name:"FormSearchCascade",props:{options:{type:Array,default:()=>[]},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},autograph:{type:String,required:!0},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},wordbook:{type:Object,required:!0},onChange:{},value:{type:[String,Array]}},emits:["update:value"],setup(e,{emit:y}){const v=u(e,"value",y),_=r(!1),g=r([]),{field:F,fieldKey:K}=w(),O=t((()=>{var r,t,o,a;return null!=(a=null!=(o=null==(t=null==(r=e.wordbook)?void 0:r.render_key)?void 0:t[0])?o:e.labelField)?a:"text"})),q=t((()=>{var r,t,o;return null!=(o=null!=(t=null==(r=e.wordbook)?void 0:r.value_key)?t:e.valueField)?o:"value"})),S=t((()=>{var r;return(null==(r=e.wordbook)?void 0:r.level_num)||1/0})),x=o(p),{getSearchRequestInfo:C}=b();async function L(r,t){try{if(r&&!r.__keyword&&r.isLeaf)return o(r);if(null==r?void 0:r.__keyword){if(!l(r.id_link))return Promise.reject();const t=r.id_link.split("_").filter((e=>e)),o=await async function(r){if(!C().primaryKeyUrl)return[];try{return await x.addAsync(t(e.wordbook,e.autograph,r,K.value))}catch(e){l(e)&&m(e)}function t(r,t,o,a){const n=C();return{key:a,params:{autograph:t,tableId:r.id,primaryKeyValue:o.join(","),page:1},...n,url:n.primaryKeyUrl,cache:e.requestCache}}}(t);if(!o)return Promise.reject();const{lastOption:a,options:n}=function(e,r){let t=e[0];return{options:r.reduce(((r,a,n)=>{const u=o(e,a);return 0===n?(t=u,[u]):(Object.assign(u,{parent:t,isLeaf:n+1>=S.value}),t.children=[u],t=u,r)}),[]),lastOption:t};function o(e,r){return e.find((e=>e[q.value]===r))}}(o,t);return await L(a),s(a.children)?(v.value=function(e,r){return r.map((r=>e.find((e=>e[q.value]===r))))}(o,t),_.value=!1,Promise.reject()):(g.value=n,a)}{const n=await x.addAsync(function(r,o,a,n,u){const i={autograph:()=>o,wordbookId:"id",wordbookType:"type",fieldKeys:()=>r.search_key?JSON.stringify(r.search_key):void 0,conObj:()=>JSON.stringify(function(e,r,t){return r?e.conObj||[]:t?[{con:"EQ",is_compare_field:!1,field_key:e.level_key,value:t[q.value]}]:e.conObjFirstLevel||[]}(r,t,n)),primaryKey:"primary_key",levelKey:"level_key",keyword:()=>t,page:()=>1},s=Object.entries(i).reduce(((e,[t,o])=>(e[t]=l(o)?r[o]:c(o)?o():void 0,e)),{});return{...C(),params:s,key:u,cache:e.requestCache}}(e.wordbook,e.autograph,F.value,r,K.value));if(r){if(!n.length)return o(r);r.children=n.map((e=>function(e,r,t){return{...e,parent:r,isLeaf:a(r)+1>=t}}(e,r,S.value)))}else g.value=n.map((e=>function(e,r){return e.__keyword=!!r,e.isLeaf=!!r,e}(e,t)))}}catch(e){l(e)&&m(e)}function o(e){return v.value=function(e){const r=[];let t=e;for(;t;)r.unshift(d(t,["parent","isLeaf","__keyword","children"])),t=t.parent;return r}(e),_.value=!1,Promise.reject()}function a(e){let r=1,t=e.parent;for(;t;)r++,t=t.parent;return r}}a((()=>e.wordbook),((r,t)=>{i(r,t)||(g.value=[],r&&(v.value||!e.lazyRequest)&&L())}),{immediate:!0});const{injectValueValidate:V,injectValueWatchFromEmpty:A,injectValueBindKey:I}=f();A(v,L),V(v);const P=I(v);return()=>n(h,{value:v.value,"onUpdate:value":e=>v.value=e,show:_.value,"onUpdate:show":e=>_.value=e,options:g.value,key:P.value,labelKey:O.value,valueKey:q.value,search:L,onFocus:j(F)},{empty:()=>n(k,null,null)})}}),v({dataSource:"options"},_));export{g as LEVEL_SEARCH_CASCADER};
|
|
@@ -19,6 +19,14 @@ export declare const RADIO: import("vue").DefineComponent<{
|
|
|
19
19
|
type: BooleanConstructor;
|
|
20
20
|
default: boolean;
|
|
21
21
|
};
|
|
22
|
+
labelField: {
|
|
23
|
+
type: StringConstructor;
|
|
24
|
+
default: string;
|
|
25
|
+
};
|
|
26
|
+
valueField: {
|
|
27
|
+
type: StringConstructor;
|
|
28
|
+
default: string;
|
|
29
|
+
};
|
|
22
30
|
wordbook: {
|
|
23
31
|
type: PropType<Partial<{
|
|
24
32
|
level_num: number;
|
|
@@ -61,6 +69,14 @@ export declare const RADIO: import("vue").DefineComponent<{
|
|
|
61
69
|
type: BooleanConstructor;
|
|
62
70
|
default: boolean;
|
|
63
71
|
};
|
|
72
|
+
labelField: {
|
|
73
|
+
type: StringConstructor;
|
|
74
|
+
default: string;
|
|
75
|
+
};
|
|
76
|
+
valueField: {
|
|
77
|
+
type: StringConstructor;
|
|
78
|
+
default: string;
|
|
79
|
+
};
|
|
64
80
|
wordbook: {
|
|
65
81
|
type: PropType<Partial<{
|
|
66
82
|
level_num: number;
|
|
@@ -88,6 +104,8 @@ export declare const RADIO: import("vue").DefineComponent<{
|
|
|
88
104
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
89
105
|
}, {
|
|
90
106
|
options: AnyObject[];
|
|
107
|
+
labelField: string;
|
|
108
|
+
valueField: string;
|
|
91
109
|
lazyRequest: boolean;
|
|
92
110
|
requestCache: boolean;
|
|
93
111
|
vertical: boolean;
|
|
@@ -111,6 +129,14 @@ export declare const CHECKBOX: import("vue").DefineComponent<{
|
|
|
111
129
|
type: BooleanConstructor;
|
|
112
130
|
default: boolean;
|
|
113
131
|
};
|
|
132
|
+
labelField: {
|
|
133
|
+
type: StringConstructor;
|
|
134
|
+
default: string;
|
|
135
|
+
};
|
|
136
|
+
valueField: {
|
|
137
|
+
type: StringConstructor;
|
|
138
|
+
default: string;
|
|
139
|
+
};
|
|
114
140
|
wordbook: {
|
|
115
141
|
type: PropType<Partial<{
|
|
116
142
|
level_num: number;
|
|
@@ -153,6 +179,14 @@ export declare const CHECKBOX: import("vue").DefineComponent<{
|
|
|
153
179
|
type: BooleanConstructor;
|
|
154
180
|
default: boolean;
|
|
155
181
|
};
|
|
182
|
+
labelField: {
|
|
183
|
+
type: StringConstructor;
|
|
184
|
+
default: string;
|
|
185
|
+
};
|
|
186
|
+
valueField: {
|
|
187
|
+
type: StringConstructor;
|
|
188
|
+
default: string;
|
|
189
|
+
};
|
|
156
190
|
wordbook: {
|
|
157
191
|
type: PropType<Partial<{
|
|
158
192
|
level_num: number;
|
|
@@ -180,6 +214,8 @@ export declare const CHECKBOX: import("vue").DefineComponent<{
|
|
|
180
214
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
181
215
|
}, {
|
|
182
216
|
options: AnyObject[];
|
|
217
|
+
labelField: string;
|
|
218
|
+
valueField: string;
|
|
183
219
|
lazyRequest: boolean;
|
|
184
220
|
requestCache: boolean;
|
|
185
221
|
vertical: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,createVNode as
|
|
1
|
+
import{defineComponent as e,createVNode as t,isVNode as o}from"vue";import{connect as a,mapProps as l}from"@formily/vue";import{NSpace as r,NRadio as u,NRadioGroup as i,NCheckbox as n,NCheckboxGroup as p}from"naive-ui";import"../../../index.js";import{useComplexOptions as s}from"../../hooks/useComplexOptions.js";import"../../utils/index.js";import{useAutographOptions as m}from"../../hooks/useFormRenderOptions.js";import{useCommonInjection as v}from"../../hooks/useCommonInjection.js";import{assignUpdateValue as d,createVisitedSetter as c}from"../../utils/schema.js";import{useFormField as f}from"../../hooks/useFormField.js";function y(a,l,u){return e({name:a,props:{value:{type:[String,Number,Object,Array]},options:{type:Array,default:()=>[]},autograph:{type:String},lazyRequest:{type:Boolean,default:!1},requestCache:{type:Boolean,default:!0},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},wordbook:{type:Object},vertical:{type:Boolean,default:!1},onChange:{}},emits:["update:value"],setup(e,{emit:a}){const{field:i}=f(),{renderComplexOption:n,valueRef:p}=s(e,a),{labelKey:d,valueKey:y,fullOptions:j}=m(e,p),{injectValueBindKey:b,injectValueValidate:h}=v();h(p);const k=b(p);return()=>t(l,{key:k.value,value:p.value,"onUpdate:value":e=>p.value=e,onClick:c(i)},{default:()=>[t(r,{vertical:e.vertical,"vertical-space":e.vertical},{default:()=>{var e;return[null==(e=j.value)?void 0:e.map((e=>{let a;return t(u,{key:e[y.value],value:e[y.value],disabled:e.disabled},"function"==typeof(l=a=n({value:p.value,option:e,valueKey:y.value,labelKey:d.value}))||"[object Object]"===Object.prototype.toString.call(l)&&!o(l)?a:{default:()=>[a]});var l}))]}})]})}})}const j=a(y("FormRadio",i,u),l({dataSource:"options"},d)),b=a(y("FormCheckbox",p,n),l({dataSource:"options"},d));export{b as CHECKBOX,j as RADIO};
|
|
@@ -13,6 +13,14 @@ export declare const REMOTE_SEARCH: import("vue").DefineComponent<{
|
|
|
13
13
|
type: PropType<AnyObject[]>;
|
|
14
14
|
default: () => never[];
|
|
15
15
|
};
|
|
16
|
+
labelField: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
valueField: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
default: string;
|
|
23
|
+
};
|
|
16
24
|
urlConfig: {
|
|
17
25
|
type: PropType<UrlConfig>;
|
|
18
26
|
};
|
|
@@ -29,6 +37,14 @@ export declare const REMOTE_SEARCH: import("vue").DefineComponent<{
|
|
|
29
37
|
type: PropType<AnyObject[]>;
|
|
30
38
|
default: () => never[];
|
|
31
39
|
};
|
|
40
|
+
labelField: {
|
|
41
|
+
type: StringConstructor;
|
|
42
|
+
default: string;
|
|
43
|
+
};
|
|
44
|
+
valueField: {
|
|
45
|
+
type: StringConstructor;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
32
48
|
urlConfig: {
|
|
33
49
|
type: PropType<UrlConfig>;
|
|
34
50
|
};
|
|
@@ -37,5 +53,7 @@ export declare const REMOTE_SEARCH: import("vue").DefineComponent<{
|
|
|
37
53
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
38
54
|
}, {
|
|
39
55
|
options: AnyObject[];
|
|
56
|
+
labelField: string;
|
|
57
|
+
valueField: string;
|
|
40
58
|
requestCache: boolean;
|
|
41
59
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,ref as l,computed as
|
|
1
|
+
import{defineComponent as e,ref as l,computed as u,inject as a,watch as o,createVNode as t}from"vue";import{connect as n,mapProps as r}from"@formily/vue";import{useVModel as i,useDebounceFn as s}from"@vueuse/core";import{isString as v,isArray as m,cloneDeep as p,isEqual as d}from"lodash-es";import{NSelect as f}from"naive-ui";import"../../../index.js";import{InjectionAsyncQueue as c,InjectionChangeContextCollector as y,InjectionFormItemDepsCollector as g}from"../../constants/index.js";import{createUrlConfigParams as h,formRenderLog as C}from"../../utils/index.js";import{useCommonInjection as j,useSelectOptionProps as F}from"../../hooks/useCommonInjection.js";import{useFormField as x}from"../../hooks/useFormField.js";import{createVisitedSetter as b,assignUpdateValue as K,assignClearBindVisited as S}from"../../utils/schema.js";const k=n(e({name:"FormRemoteSearch",props:{value:{type:String},requestCache:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},urlConfig:{type:Object},onChange:{}},emits:["update:value"],setup(e,{slots:n,emit:r}){const K=i(e,"value",r),{field:S,fieldKey:k}=x(),w=l(null),V=u((()=>{var l,u,a;return null!=(a=null!=(u=null==(l=e.urlConfig)?void 0:l.nameKey)?u:e.labelField)?a:"text"})),q=u((()=>{var l,u,a;return null!=(a=null!=(u=null==(l=e.urlConfig)?void 0:l.valueKey)?u:e.valueField)?a:"value"})),A=a(c),B=s((async(l="",u="label")=>{if(!e.urlConfig)return w.value=null;try{w.value=await A.addAsync(await h({config:{...e.urlConfig,params:{...e.urlConfig.params,["value"===u?q.value:"keyword"]:l}},cache:e.requestCache,field:S.value}))}catch(e){v(e)&&C(e)}})),O=u((()=>m(w.value)?w.value:m(e.options)?e.options:[])),{injectValueValidate:P,injectValueBindKey:U}=j();P(K);const D=U(K);o(K,(e=>{if(e&&!O.value.find((l=>l[q.value]===e)))return B(e,"value")}));a(y).setContext(k.value,(e=>{return{currentOption:p((l=e,O.value.find((e=>e[q.value]===l))))};var l}));const I=a(g);o((()=>e.urlConfig),((e,l)=>{d(e,l)||(w.value=null,e&&(I.setDeps(k.value,e.dependKey||[],(async()=>{w.value=null,K.value=null})),K.value&&B(K.value,"value")))}),{immediate:!0});const{menuProps:R,nodeProps:z}=F();return()=>t(f,{remote:!0,filterable:!0,key:D.value,value:K.value,"onUpdate:value":e=>K.value=e,labelField:V.value,valueField:q.value,"menu-props":R,"node-props":z,onSearch:B,"onUpdate:show":e=>e&&B(),options:O.value,onFocus:b(S)},n)}}),r(K,S));export{k as REMOTE_SEARCH};
|