@das-fed/ui 1.1.4 → 6.3.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/global/icons/index.local.js +1 -1
- package/global/style/index.css +1 -1
- package/global/style/scrollbar.css +22 -22
- package/global/theme/index.js +12 -12
- package/global/theme/module/color.js +31 -31
- package/global/theme/module/fontSize.js +5 -5
- package/global/theme/module/scrollbar.js +6 -6
- package/package.json +13 -7
- package/packages/business-components/app-container/index.js +154 -147
- package/packages/business-components/change-enterprises/index.css +1 -0
- package/packages/business-components/change-enterprises/index.js +241 -0
- package/packages/business-components/change-pwd/index.css +1 -0
- package/packages/business-components/change-pwd/index.js +330 -0
- package/packages/business-components/currency-page/index.css +1 -0
- package/packages/business-components/currency-page/index.js +99 -0
- package/packages/business-components/device-panel/index.css +1 -0
- package/packages/business-components/device-panel/index.js +115939 -0
- package/packages/business-components/echarts/index.js +93 -122
- package/packages/business-components/export-button/index.js +73 -66
- package/packages/business-components/import-button/index.js +213 -170
- package/packages/business-components/index.js +8 -1
- package/packages/business-components/layout-breadcrumb/index.js +82 -66
- package/packages/business-components/model-table-dialog/index.js +299 -289
- package/packages/business-components/process-configuration/index.css +1 -0
- package/packages/business-components/process-configuration/index.js +612 -0
- package/packages/business-components/process-form/index.css +1 -0
- package/packages/business-components/process-form/index.js +524 -0
- package/packages/business-components/process-search-form/index.js +73 -315
- package/packages/business-components/process-table/index.css +1 -1
- package/packages/business-components/process-table/index.js +186 -152
- package/packages/business-components/urgent-panel/index.css +1 -0
- package/packages/business-components/urgent-panel/index.js +3914 -0
- package/packages/business-components/user-org-dialog/index.js +466 -375
- package/packages/business-components/video-dialog/index.css +1 -0
- package/packages/business-components/video-dialog/index.js +1041 -0
- package/packages/business.js +1 -2
- package/packages/components/alert/index.js +449 -633
- package/packages/components/audio-video/index.css +1 -1
- package/packages/components/audio-video/index.js +312 -126
- package/packages/components/autocomplete/index.css +1 -1
- package/packages/components/autocomplete/index.js +312 -2923
- package/packages/components/breadcrumb/index.js +97 -82
- package/packages/components/button/index.css +1 -1
- package/packages/components/button/index.js +646 -787
- package/packages/components/calendar/index.css +1 -1
- package/packages/components/calendar/index.js +655 -3879
- package/packages/components/cascader/index.js +209 -203
- package/packages/components/checkbox/index.css +1 -1
- package/packages/components/checkbox/index.js +710 -872
- package/packages/components/collapse-panel/index.css +1 -1
- package/packages/components/collapse-panel/index.js +419 -601
- package/packages/components/collapse-transition/index.js +23 -21
- package/packages/components/collaspe/index.css +1 -1
- package/packages/components/collaspe/index.js +413 -595
- package/packages/components/color-picker/index.css +1 -1
- package/packages/components/color-picker/index.js +176 -133
- package/packages/components/custom-search-item/index.js +43 -37
- package/packages/components/date-picker/index.js +1338 -1459
- package/packages/components/dialog/index.js +441 -241
- package/packages/components/dimple-layout/index.css +1 -1
- package/packages/components/dimple-layout/index.js +1298 -1794
- package/packages/components/drawer/index.js +116 -101
- package/packages/components/dropdown/index.js +129 -109
- package/packages/components/edit-table/index.css +1 -1
- package/packages/components/edit-table/index.js +868 -752
- package/packages/components/empty/index.js +83 -78
- package/packages/components/form/index.js +22 -15
- package/packages/components/form-item/index.css +1 -1
- package/packages/components/form-item/index.js +601 -440
- package/packages/components/icon/index.css +1 -1
- package/packages/components/icon/index.js +38 -22
- package/packages/components/image-preview/index.css +1 -0
- package/packages/components/image-preview/index.js +2714 -0
- package/packages/components/image-upload/index.js +601 -765
- package/packages/components/image-viewer/index.css +1 -1
- package/packages/components/image-viewer/index.js +909 -990
- package/packages/components/index.js +2 -2
- package/packages/components/input/index.css +1 -1
- package/packages/components/input/index.js +284 -256
- package/packages/components/input-dialog-select/index.css +1 -1
- package/packages/components/input-dialog-select/index.js +179 -156
- package/packages/components/input-number/index.css +1 -1
- package/packages/components/input-number/index.js +157 -170
- package/packages/components/live-player/index.css +1 -0
- package/packages/components/live-player/index.js +170 -0
- package/packages/components/loading/index.js +17 -26
- package/packages/components/map/index.css +1 -1
- package/packages/components/map/index.js +18913 -461
- package/packages/components/menu-aside/index.css +1 -1
- package/packages/components/menu-aside/index.js +648 -713
- package/packages/components/menu-header/index.js +446 -629
- package/packages/components/message/index.js +25 -16
- package/packages/components/notification/index.js +386 -575
- package/packages/components/overlay/index.js +112 -103
- package/packages/components/pagination/index.js +260 -330
- package/packages/components/popover/index.js +104 -93
- package/packages/components/popup-mask/index.css +1 -1
- package/packages/components/popup-mask/index.js +77 -72
- package/packages/components/preview/index.js +33 -28
- package/packages/components/progress/index.js +214 -221
- package/packages/components/radio/index.css +1 -1
- package/packages/components/radio/index.js +699 -862
- package/packages/components/radio-tabs/index.js +144 -107
- package/packages/components/rich-editor/index.css +1 -1
- package/packages/components/rich-editor/index.js +105 -106
- package/packages/components/scrollbar/index.css +3 -2
- package/packages/components/scrollbar/index.js +2262 -1201
- package/packages/components/search/index.js +500 -664
- package/packages/components/search-form/index.css +1 -1
- package/packages/components/search-form/index.js +724 -626
- package/packages/components/select/index.css +1 -1
- package/packages/components/select/index.js +1052 -950
- package/packages/components/select-input/index.js +63 -53
- package/packages/components/select-list/index.css +1 -1
- package/packages/components/select-list/index.js +258 -235
- package/packages/components/special-range-picker-month/index.css +1 -1
- package/packages/components/special-range-picker-month/index.js +3068 -72555
- package/packages/components/special-range-picker-year/index.css +1 -1
- package/packages/components/special-range-picker-year/index.js +345 -339
- package/packages/components/spin/index.js +415 -594
- package/packages/components/split-panel/index.css +1 -1
- package/packages/components/split-panel/index.js +146 -127
- package/packages/components/step/index.js +414 -597
- package/packages/components/steps/index.js +407 -590
- package/packages/components/switch/index.js +23 -23
- package/packages/components/table/index.css +1 -1
- package/packages/components/table/index.js +80813 -27734
- package/packages/components/tabs/index.css +1 -1
- package/packages/components/tabs/index.js +620 -813
- package/packages/components/tag/index.js +63 -63
- package/packages/components/text-tooltip/index.css +9 -0
- package/packages/components/text-tooltip/index.js +2739 -33
- package/packages/components/time-line/index.js +464 -643
- package/packages/components/tooltip/index.css +1 -1
- package/packages/components/tooltip/index.js +108 -79
- package/packages/components/tree/index.css +1 -1
- package/packages/components/tree/index.js +840 -809
- package/packages/components/tree-select/index.js +271 -303
- package/packages/components/tree-table/index.js +461 -352
- package/packages/components/upload/index.js +682 -858
- package/packages/components/virtual-tree/index.css +1 -1
- package/packages/components/virtual-tree/index.js +144 -126
- package/packages/index.d.ts +1 -0
- package/packages/index.js +2 -2
- package/style/business.css +11 -4
- package/style/index.css +55 -45
- package/packages/business-components/low-code/index.css +0 -1
- package/packages/business-components/low-code/index.js +0 -60
- package/packages/components/audio-video-player/index.css +0 -1
- package/packages/components/audio-video-player/index.js +0 -83
- package/packages/components/table-column/index.css +0 -1
- package/packages/components/table-column/index.js +0 -82021
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
import { withInstall } from '@das-fed/utils';
|
|
2
|
+
import { ref, defineComponent, onMounted, openBlock, createElementBlock, Fragment, renderList, createBlock, withCtx, createTextVNode, toDisplayString, createCommentVNode, withDirectives, resolveDynamicComponent } from 'vue';
|
|
3
|
+
import { DasFormRef, DasForm, DasButton, vOverlay } from '@das-fed/ui';
|
|
4
|
+
import { createService } from '@das-fed/utils/api-services';
|
|
5
|
+
|
|
6
|
+
const version = "v1";
|
|
7
|
+
const workFlowFormService = createService(`/workflow/form/form/${version}`);
|
|
8
|
+
const workFlowFormDefService = createService(`/workflow/form/formDef/${version}`);
|
|
9
|
+
createService(`/workflow/api/user/${version}`);
|
|
10
|
+
const extendService = createService(`/workflow/api/extend/${version}`);
|
|
11
|
+
const flowService = createService(`/workflow/flow/def/${version}`);
|
|
12
|
+
const customQueryService = createService(`/workflow/form/customQuery/${version}`);
|
|
13
|
+
const permissionService = createService(`/api/enterpriseright/permission/${version}`);
|
|
14
|
+
const spaceService = createService(`/api/space-manage/space-tree/${version}`);
|
|
15
|
+
|
|
16
|
+
const getFormDesign = workFlowFormService.get(`/formDesign`);
|
|
17
|
+
const getFormStructure = workFlowFormDefService.get(`/get`);
|
|
18
|
+
const getBtnSetting = extendService.get(`/report-config`);
|
|
19
|
+
extendService.get(`/application-report`);
|
|
20
|
+
const getFormIdApi = flowService.get(`/getBindRelationByDefKey`);
|
|
21
|
+
customQueryService.get(`/getByAlias`);
|
|
22
|
+
permissionService.get(`/organization/authTree`);
|
|
23
|
+
permissionService.post(`/user/list`);
|
|
24
|
+
permissionService.post(`/data/user-query`);
|
|
25
|
+
permissionService.get(`/role/list`);
|
|
26
|
+
permissionService.post(`/data/role-ids`);
|
|
27
|
+
permissionService.get(`/organization/organizationpage`);
|
|
28
|
+
permissionService.get(`/station/list`);
|
|
29
|
+
permissionService.get(`/position/list`);
|
|
30
|
+
permissionService.post(`/organization/detailbyids`);
|
|
31
|
+
spaceService.get(`/controller/area-children`);
|
|
32
|
+
spaceService.get(`/controller/fuzzy-tree-all`);
|
|
33
|
+
spaceService.get(`/controller/space`);
|
|
34
|
+
|
|
35
|
+
const boKey = ref("");
|
|
36
|
+
const useForm = (props, emits, store) => {
|
|
37
|
+
const { setDetailData, getFormData, setFormData, formRule } = store;
|
|
38
|
+
const btnList = ref([]);
|
|
39
|
+
const btnCollecton = ref([]);
|
|
40
|
+
const formJsonList = ref([]);
|
|
41
|
+
const isShowPage = ref(false);
|
|
42
|
+
const formRef = DasFormRef();
|
|
43
|
+
const isEmpty = (obj) => {
|
|
44
|
+
return Object.keys(obj).length === 0;
|
|
45
|
+
};
|
|
46
|
+
const getForm = async (id) => {
|
|
47
|
+
const [err, data] = await getFormDesign({ formId: id }).run();
|
|
48
|
+
if (err) return;
|
|
49
|
+
const bos = JSON.parse(data.bos);
|
|
50
|
+
boKey.value = bos[0].alias;
|
|
51
|
+
if (btnCollecton.value.length) {
|
|
52
|
+
btnCollecton.value.forEach((item) => {
|
|
53
|
+
if (item.formKey === data.formKey) setFormData(data.formKey, boKey.value, item.id);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const [error, structureData] = await getFormStructure({ formDefId: data.defId }).run();
|
|
57
|
+
formJsonList.value = JSON.parse(structureData.value.expand).list;
|
|
58
|
+
if (!btnCollecton.value.length) setFormData(data.formKey, boKey.value);
|
|
59
|
+
if (isEmpty(props.data)) isShowPage.value = true;
|
|
60
|
+
if (!isEmpty(props.data)) {
|
|
61
|
+
setDetailData(props.data);
|
|
62
|
+
if (props.flowKey) {
|
|
63
|
+
btnList.value = props.data.button_list ? JSON.parse(props.data.button_list) : [];
|
|
64
|
+
}
|
|
65
|
+
isShowPage.value = true;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const getBtnSet = async () => {
|
|
69
|
+
if (props.formConfigurationId) {
|
|
70
|
+
const [err, data] = await getBtnSetting({ id: props.formConfigurationId }).run();
|
|
71
|
+
if (err) return;
|
|
72
|
+
btnCollecton.value = data.reports;
|
|
73
|
+
btnList.value = data.reports[0].buttons.filter((item) => {
|
|
74
|
+
return !(props.isView && item.event !== "LINK");
|
|
75
|
+
});
|
|
76
|
+
getForm(data.reports[0].formId);
|
|
77
|
+
}
|
|
78
|
+
if (props.flowKey) {
|
|
79
|
+
const [err, data] = await getFormIdApi({ flowKey: props.flowKey }).run();
|
|
80
|
+
if (err) return;
|
|
81
|
+
getForm(data.pcForm.pcFormId);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const handleClick = (item) => {
|
|
85
|
+
formRef.value?.validate(async (valid) => {
|
|
86
|
+
if (valid) {
|
|
87
|
+
emits("handleClick", item, getFormData());
|
|
88
|
+
if (item.event === "LINK") {
|
|
89
|
+
btnCollecton.value.forEach((ele) => {
|
|
90
|
+
if (item.eventTarget === ele.formKey) {
|
|
91
|
+
btnList.value = ele.buttons.filter((item2) => {
|
|
92
|
+
return !(props.isView && item2.event !== "LINK");
|
|
93
|
+
});
|
|
94
|
+
isShowPage.value = false;
|
|
95
|
+
formRule.value = {};
|
|
96
|
+
getForm(ele.formId);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
const validateFormData = () => {
|
|
104
|
+
return new Promise((resolve, reject) => {
|
|
105
|
+
formRef.value?.validate((valid) => {
|
|
106
|
+
const formData = getFormData();
|
|
107
|
+
resolve({
|
|
108
|
+
result: valid,
|
|
109
|
+
data: formData
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
return {
|
|
115
|
+
isShowPage,
|
|
116
|
+
formJsonList,
|
|
117
|
+
btnList,
|
|
118
|
+
formRef,
|
|
119
|
+
getForm,
|
|
120
|
+
getBtnSet,
|
|
121
|
+
handleClick,
|
|
122
|
+
validateFormData
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const componentList = import.meta.glob("./**/*.vue", { eager: true });
|
|
127
|
+
const baseList = import.meta.glob("./base/*.vue", { eager: true });
|
|
128
|
+
const seniorList = import.meta.glob("./senior/*.vue", { eager: true });
|
|
129
|
+
const layoutList = import.meta.glob("./layout/*.vue", { eager: true });
|
|
130
|
+
const widgets = {};
|
|
131
|
+
const baseWidgets = {};
|
|
132
|
+
const seniorWidgets = {};
|
|
133
|
+
const layoutWidgets = {};
|
|
134
|
+
Object.keys(baseList).map((item) => baseWidgets[baseList[item].default.name] = baseList[item].default);
|
|
135
|
+
Object.keys(seniorList).map((item) => seniorWidgets[seniorList[item].default.name] = seniorList[item].default);
|
|
136
|
+
Object.keys(layoutList).map((item) => layoutWidgets[layoutList[item].default.name] = layoutList[item].default);
|
|
137
|
+
Object.keys(componentList).map((item) => widgets[componentList[item].default.name] = componentList[item].default);
|
|
138
|
+
|
|
139
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
140
|
+
|
|
141
|
+
var dayjs_min = {exports: {}};
|
|
142
|
+
|
|
143
|
+
(function (module, exports) {
|
|
144
|
+
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
145
|
+
} (dayjs_min));
|
|
146
|
+
|
|
147
|
+
const TEST_TEXT = "---------\u6D4B\u8BD5\u9A8C\u8BC1\u89C4\u5219\u4F20\u53C2-----------";
|
|
148
|
+
const validateRequired = (rule, value, callback, data) => {
|
|
149
|
+
if ((!value || value.toString() === "") && parseInt(value) !== 0) {
|
|
150
|
+
callback(new Error(`${data.name}`));
|
|
151
|
+
} else {
|
|
152
|
+
callback();
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
const validateMaxLength = (rule, value, callback, data) => {
|
|
156
|
+
if (value !== "" && value.length > parseInt(data.value)) {
|
|
157
|
+
callback(new Error(`${data.name}\u4E0D\u80FD\u8D85\u8FC7${data.value}`));
|
|
158
|
+
} else {
|
|
159
|
+
callback();
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
const validateMinLength = (rule, value, callback, data) => {
|
|
163
|
+
if (value !== "" && value.length < parseInt(data.value)) {
|
|
164
|
+
callback(new Error(`${data.name}\u4E0D\u80FD\u5C11\u4E8E${data.value}`));
|
|
165
|
+
} else {
|
|
166
|
+
callback();
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
const validateMlobiePhone = (rule, value, callback, data) => {
|
|
170
|
+
if (value !== "" && !/^1[3456789]\d{9}$/.test(value)) {
|
|
171
|
+
callback(new Error("\u624B\u673A\u53F7\u7801\u683C\u5F0F\u4E0D\u6B63\u786E\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165"));
|
|
172
|
+
return false;
|
|
173
|
+
} else {
|
|
174
|
+
callback();
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
const validateEmail = (rule, value, callback) => {
|
|
178
|
+
const regEmail = /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
|
|
179
|
+
if (value !== "" && !regEmail.test(value)) {
|
|
180
|
+
callback(new Error("\u7535\u5B50\u90AE\u7BB1\u683C\u5F0F\u4E0D\u6B63\u786E\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165"));
|
|
181
|
+
return false;
|
|
182
|
+
} else {
|
|
183
|
+
callback();
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
const validateNumeric = (rule, value, callback) => {
|
|
187
|
+
const regNumeric = /^-?\d+$/;
|
|
188
|
+
if (value !== "" && !regNumeric.test(value)) {
|
|
189
|
+
callback(new Error("\u8BF7\u8F93\u5165\u6574\u6570"));
|
|
190
|
+
return false;
|
|
191
|
+
} else {
|
|
192
|
+
callback();
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
const validateConfirmed = (rule, value, callback, data) => {
|
|
196
|
+
console.log(TEST_TEXT);
|
|
197
|
+
console.log(data.value);
|
|
198
|
+
console.log(value);
|
|
199
|
+
if (value !== "" && value != data.value) {
|
|
200
|
+
callback(new Error("\u8BF7\u8F93\u5165\u76F8\u540C\u7684\u503C"));
|
|
201
|
+
return false;
|
|
202
|
+
} else {
|
|
203
|
+
callback();
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
const validateMinNumLength = (rule, value, callback, data) => {
|
|
207
|
+
const regNumeric = /^[+-]?\d*\.?\d*$/;
|
|
208
|
+
if (value === "") {
|
|
209
|
+
callback();
|
|
210
|
+
} else {
|
|
211
|
+
if (regNumeric.test(value)) {
|
|
212
|
+
if (value < parseFloat(data.value)) {
|
|
213
|
+
callback(new Error(`${data.name}\u4E0D\u80FD\u5C0F\u4E8E${data.value}`));
|
|
214
|
+
} else {
|
|
215
|
+
callback();
|
|
216
|
+
}
|
|
217
|
+
} else {
|
|
218
|
+
callback(new Error("\u8BF7\u8F93\u5165\u6570\u5B57"));
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
const validateMaxNumLength = (rule, value, callback, data) => {
|
|
223
|
+
const regNumeric = /^[+-]?\d*\.?\d*$/;
|
|
224
|
+
if (value === "") {
|
|
225
|
+
callback();
|
|
226
|
+
} else {
|
|
227
|
+
if (regNumeric.test(value)) {
|
|
228
|
+
if (value > parseFloat(data.value)) {
|
|
229
|
+
callback(new Error(`${data.name}\u4E0D\u80FD\u5927\u4E8E${data.value}`));
|
|
230
|
+
} else {
|
|
231
|
+
callback();
|
|
232
|
+
}
|
|
233
|
+
} else {
|
|
234
|
+
callback(new Error("\u8BF7\u8F93\u5165\u6570\u5B57"));
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
const validateBetweenNum = (rule, value, callback, data) => {
|
|
239
|
+
const regFloat = /^[+-]?(\d*\.\d+([eE]?[+-]?\d+)?|\d+[eE][+-]?\d+)$/;
|
|
240
|
+
const regNum = /^-?\d+$/;
|
|
241
|
+
if (value === "") {
|
|
242
|
+
callback();
|
|
243
|
+
} else {
|
|
244
|
+
if (regFloat.test(value) || regNum.test(value)) {
|
|
245
|
+
if (value >= parseFloat(data.start) && value <= parseFloat(data.end)) {
|
|
246
|
+
callback();
|
|
247
|
+
} else {
|
|
248
|
+
callback(new Error(`\u53EA\u80FD\u8F93\u5165\u6307\u5B9A\u6570\u5B57\u8303\u56F4${data.start}-${data.end}`));
|
|
249
|
+
}
|
|
250
|
+
} else {
|
|
251
|
+
callback(new Error("\u8BF7\u8F93\u5165\u6570\u5B57"));
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
const validateIsNum = (rule, value, callback, data) => {
|
|
256
|
+
if (value === "" || parseFloat(value) === parseFloat(data.value)) {
|
|
257
|
+
callback();
|
|
258
|
+
} else {
|
|
259
|
+
callback(new Error(`\u53EA\u80FD\u8F93\u5165\u6307\u5B9A\u7684\u503C${data.value}`));
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
const validateDigits = (rule, value, callback, data) => {
|
|
263
|
+
const regNum = /^-?\d+$/;
|
|
264
|
+
if (value === "") {
|
|
265
|
+
callback();
|
|
266
|
+
} else {
|
|
267
|
+
if (regNum.test(value)) {
|
|
268
|
+
if (Math.abs(value).toString().length === parseInt(data.value)) {
|
|
269
|
+
callback();
|
|
270
|
+
} else {
|
|
271
|
+
callback(new Error(`\u53EA\u80FD\u8F93\u5165${data.value}\u4F4D\u6570\u6570\u5B57`));
|
|
272
|
+
}
|
|
273
|
+
} else {
|
|
274
|
+
callback(new Error("\u8BF7\u8F93\u5165\u6574\u6570"));
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
const validateAlpha = (rule, value, callback) => {
|
|
279
|
+
const regAlpha = /^[a-zA-Z]{1,}$/;
|
|
280
|
+
if (value !== "" && !regAlpha.test(value)) {
|
|
281
|
+
callback(new Error("\u53EA\u80FD\u8F93\u5165\u5B57\u6BCD"));
|
|
282
|
+
return false;
|
|
283
|
+
} else {
|
|
284
|
+
callback();
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
const validateAlphaSpaces = (rule, value, callback) => {
|
|
288
|
+
const regAlpha = /^[a-zA-Z ]{1,}$/;
|
|
289
|
+
if (value !== "" && !regAlpha.test(value)) {
|
|
290
|
+
callback(new Error("\u53EA\u80FD\u8F93\u5165\u5B57\u6BCD\u7A7A\u683C"));
|
|
291
|
+
return false;
|
|
292
|
+
} else {
|
|
293
|
+
callback();
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
const validateAlphaDash = (rule, value, callback) => {
|
|
297
|
+
const regAlpha = /^[0-9a-zA-Z_-]{1,}$/;
|
|
298
|
+
if (value !== "" && !regAlpha.test(value)) {
|
|
299
|
+
callback(new Error("\u53EA\u80FD\u8F93\u5165\u5B57\u6BCD\u6570\u5B57\u6A2A\u7EBF\u4E0B\u5212\u7EBF"));
|
|
300
|
+
return false;
|
|
301
|
+
} else {
|
|
302
|
+
callback();
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
const validateAlphaNum = (rule, value, callback) => {
|
|
306
|
+
const regAlpha = /^[0-9a-zA-Z]{1,}$/;
|
|
307
|
+
if (value !== "" && !regAlpha.test(value)) {
|
|
308
|
+
callback(new Error("\u53EA\u80FD\u8F93\u5165\u5B57\u6BCD\u6570\u5B57"));
|
|
309
|
+
return false;
|
|
310
|
+
} else {
|
|
311
|
+
callback();
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
const validateRegex = (rule, value, callback, data) => {
|
|
315
|
+
const reg = new RegExp(data.value);
|
|
316
|
+
if (value !== "" && !reg.test(value)) {
|
|
317
|
+
callback(new Error("\u6821\u9A8C\u5931\u8D25"));
|
|
318
|
+
return false;
|
|
319
|
+
} else {
|
|
320
|
+
callback();
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
const ruleMap = {
|
|
324
|
+
required: validateRequired,
|
|
325
|
+
min: validateMinLength,
|
|
326
|
+
max: validateMaxLength,
|
|
327
|
+
email: validateEmail,
|
|
328
|
+
min_value: validateMinNumLength,
|
|
329
|
+
max_value: validateMaxNumLength,
|
|
330
|
+
confirmed: validateConfirmed,
|
|
331
|
+
numeric: validateNumeric,
|
|
332
|
+
between: validateBetweenNum,
|
|
333
|
+
is: validateIsNum,
|
|
334
|
+
digits: validateDigits,
|
|
335
|
+
mobile: validateMlobiePhone,
|
|
336
|
+
alpha: validateAlpha,
|
|
337
|
+
alpha_spaces: validateAlphaSpaces,
|
|
338
|
+
alpha_dash: validateAlphaDash,
|
|
339
|
+
alpha_num: validateAlphaNum,
|
|
340
|
+
regex: validateRegex
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
const useStore = () => {
|
|
344
|
+
const data = ref({});
|
|
345
|
+
const formData = ref([]);
|
|
346
|
+
const keyList = ref([]);
|
|
347
|
+
const currentFormKey = ref("");
|
|
348
|
+
const formRule = ref({});
|
|
349
|
+
const setData = (key, val) => {
|
|
350
|
+
formData.value.forEach((item) => {
|
|
351
|
+
if (item.formKey === currentFormKey.value) {
|
|
352
|
+
item.data[key] = val;
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
};
|
|
356
|
+
const setDetailData = (val) => {
|
|
357
|
+
data.value = val;
|
|
358
|
+
formData.value.forEach((item) => {
|
|
359
|
+
if (item.formKey === currentFormKey.value) {
|
|
360
|
+
item.data = val;
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
};
|
|
364
|
+
const getData = (key) => {
|
|
365
|
+
return data.value[key];
|
|
366
|
+
};
|
|
367
|
+
const setFormData = (formKey, boKey, reportId) => {
|
|
368
|
+
currentFormKey.value = formKey;
|
|
369
|
+
if (!keyList.value.includes(formKey)) {
|
|
370
|
+
keyList.value.push(formKey);
|
|
371
|
+
formData.value.push({
|
|
372
|
+
formKey,
|
|
373
|
+
boKey,
|
|
374
|
+
reportId: reportId || null,
|
|
375
|
+
data: {}
|
|
376
|
+
});
|
|
377
|
+
} else {
|
|
378
|
+
formData.value.forEach((item) => {
|
|
379
|
+
if (item.formKey === formKey) data.value = item.data;
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
const getFormData = () => {
|
|
384
|
+
return formData.value;
|
|
385
|
+
};
|
|
386
|
+
const setFormRule = (key, ruleArr) => {
|
|
387
|
+
formRule.value[key] = [];
|
|
388
|
+
ruleArr.forEach((item) => {
|
|
389
|
+
formRule.value[key].push({
|
|
390
|
+
validator: (rule, value, callback) => ruleMap[item.key](rule, value, callback, item)
|
|
391
|
+
});
|
|
392
|
+
});
|
|
393
|
+
};
|
|
394
|
+
const clearData = () => {
|
|
395
|
+
data.value = {};
|
|
396
|
+
formData.value = [];
|
|
397
|
+
keyList.value = [];
|
|
398
|
+
formRule.value = {};
|
|
399
|
+
};
|
|
400
|
+
return { data, formData, formRule, setData, setDetailData, getData, setFormData, getFormData, setFormRule, clearData };
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
404
|
+
__name: "App",
|
|
405
|
+
props: {
|
|
406
|
+
formConfigurationId: { type: String, required: false },
|
|
407
|
+
flowKey: { type: String, required: false },
|
|
408
|
+
isView: { type: Boolean, required: false, default: false },
|
|
409
|
+
data: { type: null, required: false }
|
|
410
|
+
},
|
|
411
|
+
emits: ["handleClick"],
|
|
412
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
413
|
+
const formStore = useStore();
|
|
414
|
+
const { clearData } = formStore;
|
|
415
|
+
const props = __props;
|
|
416
|
+
const emits = __emit;
|
|
417
|
+
const { formJsonList, isShowPage, btnList, formRef, getForm, getBtnSet, handleClick, validateFormData } = useForm(
|
|
418
|
+
props,
|
|
419
|
+
emits,
|
|
420
|
+
formStore
|
|
421
|
+
);
|
|
422
|
+
onMounted(async () => {
|
|
423
|
+
getBtnSet();
|
|
424
|
+
});
|
|
425
|
+
__expose({
|
|
426
|
+
validateFormData,
|
|
427
|
+
clearData
|
|
428
|
+
});
|
|
429
|
+
const __returned__ = { formStore, clearData, props, emits, formJsonList, isShowPage, btnList, formRef, getForm, getBtnSet, handleClick, validateFormData, get DasForm() {
|
|
430
|
+
return DasForm;
|
|
431
|
+
}, get DasButton() {
|
|
432
|
+
return DasButton;
|
|
433
|
+
}, get vOverlay() {
|
|
434
|
+
return vOverlay;
|
|
435
|
+
}, get widgets() {
|
|
436
|
+
return widgets;
|
|
437
|
+
} };
|
|
438
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
439
|
+
return __returned__;
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
var _export_sfc = (sfc, props) => {
|
|
444
|
+
const target = sfc.__vccOpts || sfc;
|
|
445
|
+
for (const [key, val] of props) {
|
|
446
|
+
target[key] = val;
|
|
447
|
+
}
|
|
448
|
+
return target;
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
const _hoisted_1 = { class: "custom-page" };
|
|
452
|
+
const _hoisted_2 = {
|
|
453
|
+
key: 0,
|
|
454
|
+
class: "btn-box"
|
|
455
|
+
};
|
|
456
|
+
const _hoisted_3 = { class: "content-box" };
|
|
457
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
458
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
459
|
+
$setup.btnList.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
460
|
+
(openBlock(true), createElementBlock(
|
|
461
|
+
Fragment,
|
|
462
|
+
null,
|
|
463
|
+
renderList($setup.btnList, (item) => {
|
|
464
|
+
return openBlock(), createBlock($setup["DasButton"], {
|
|
465
|
+
key: item.id,
|
|
466
|
+
style: { "margin-right": "20px" },
|
|
467
|
+
"btn-type": "primary",
|
|
468
|
+
onClick: ($event) => $setup.handleClick(item)
|
|
469
|
+
}, {
|
|
470
|
+
default: withCtx(() => [
|
|
471
|
+
createTextVNode(
|
|
472
|
+
toDisplayString(item.name),
|
|
473
|
+
1
|
|
474
|
+
/* TEXT */
|
|
475
|
+
)
|
|
476
|
+
]),
|
|
477
|
+
_: 2
|
|
478
|
+
/* DYNAMIC */
|
|
479
|
+
}, 1032, ["onClick"]);
|
|
480
|
+
}),
|
|
481
|
+
128
|
|
482
|
+
/* KEYED_FRAGMENT */
|
|
483
|
+
))
|
|
484
|
+
])) : createCommentVNode("v-if", true),
|
|
485
|
+
withDirectives((openBlock(), createElementBlock("div", _hoisted_3, [
|
|
486
|
+
$setup.isShowPage ? (openBlock(), createBlock($setup["DasForm"], {
|
|
487
|
+
key: 0,
|
|
488
|
+
ref: "formRef",
|
|
489
|
+
cols: 24,
|
|
490
|
+
"margin-right": "80px",
|
|
491
|
+
rules: $setup.formStore.formRule,
|
|
492
|
+
form: $setup.formStore.data,
|
|
493
|
+
class: "form-preview-page",
|
|
494
|
+
alignType: "horizontal"
|
|
495
|
+
}, {
|
|
496
|
+
default: withCtx(() => [
|
|
497
|
+
(openBlock(true), createElementBlock(
|
|
498
|
+
Fragment,
|
|
499
|
+
null,
|
|
500
|
+
renderList($setup.formJsonList, (item) => {
|
|
501
|
+
return openBlock(), createBlock(resolveDynamicComponent($setup.widgets[item.ctrlType]), {
|
|
502
|
+
key: item.name,
|
|
503
|
+
setting: item,
|
|
504
|
+
isView: $setup.props.isView,
|
|
505
|
+
store: $setup.formStore
|
|
506
|
+
}, null, 8, ["setting", "isView", "store"]);
|
|
507
|
+
}),
|
|
508
|
+
128
|
|
509
|
+
/* KEYED_FRAGMENT */
|
|
510
|
+
))
|
|
511
|
+
]),
|
|
512
|
+
_: 1
|
|
513
|
+
/* STABLE */
|
|
514
|
+
}, 8, ["rules", "form"])) : createCommentVNode("v-if", true)
|
|
515
|
+
])), [
|
|
516
|
+
[$setup["vOverlay"]]
|
|
517
|
+
])
|
|
518
|
+
]);
|
|
519
|
+
}
|
|
520
|
+
var dasProcessForm = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-668036fc"], ["__file", "/Users/xiecp/das/das-fe/framework/packages/das-ui/packages/business-components/process-form/App.vue"]]);
|
|
521
|
+
|
|
522
|
+
const DasProcessForm = withInstall(dasProcessForm);
|
|
523
|
+
|
|
524
|
+
export { DasProcessForm, DasProcessForm as default };
|