mrxy-yk 0.0.1-beta.9
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/LICENSE +21 -0
- package/README.md +34 -0
- package/dist/@type/components/a-map-canvas/index.d.ts +1 -0
- package/dist/@type/components/adaptive-box/AdaptiveBox.d.ts +42 -0
- package/dist/@type/components/coordinate-pickup/CoordinatePickup.d.ts +29 -0
- package/dist/@type/components/drag-drop-box/DragDropBox.d.ts +33 -0
- package/dist/@type/components/drag-drop-container/DragDropContainer.d.ts +39 -0
- package/dist/@type/components/drag-drop-container/type.d.ts +3 -0
- package/dist/@type/components/echarts-canvas/EChartsCanvas.d.ts +21 -0
- package/dist/@type/components/in-body/InBody.d.ts +22 -0
- package/dist/@type/components/index.d.ts +12 -0
- package/dist/@type/components/position-anchor/PositionAnchor.d.ts +23 -0
- package/dist/@type/components/progress-bar/ProgressBar.d.ts +35 -0
- package/dist/@type/components/progress-bar/type.d.ts +5 -0
- package/dist/@type/components/progress-ring/ProgressRing.d.ts +22 -0
- package/dist/@type/components/scroll-container/ScrollContainer.d.ts +35 -0
- package/dist/@type/components/show-log/ShowLog.d.ts +25 -0
- package/dist/@type/components/ys-video/@type/index.d.ts +151 -0
- package/dist/@type/components/ys-video/YsVideo.d.ts +18 -0
- package/dist/@type/components/ys-video/components/BtnLineRec.d.ts +7 -0
- package/dist/@type/components/ys-video/type.d.ts +9 -0
- package/dist/@type/config/index.d.ts +26 -0
- package/dist/@type/directive/index.d.ts +1 -0
- package/dist/@type/directive/ref-height/index.d.ts +3 -0
- package/dist/@type/directive/ref-height/type.d.ts +11 -0
- package/dist/@type/directive/table-scroll-carousel/index.d.ts +3 -0
- package/dist/@type/element-plus/components/attrs.d.ts +2 -0
- package/dist/@type/element-plus/components/date-picker/DatePicker.d.ts +16 -0
- package/dist/@type/element-plus/components/date-picker/index.d.ts +22 -0
- package/dist/@type/element-plus/components/date-picker/type.d.ts +17 -0
- package/dist/@type/element-plus/components/empty/Empty.d.ts +31 -0
- package/dist/@type/element-plus/components/empty/config.d.ts +24 -0
- package/dist/@type/element-plus/components/empty/hooks/index.d.ts +2 -0
- package/dist/@type/element-plus/components/empty/hooks/type.d.ts +12 -0
- package/dist/@type/element-plus/components/empty/type.d.ts +9 -0
- package/dist/@type/element-plus/components/form-dialog/FormDialog.d.ts +400 -0
- package/dist/@type/element-plus/components/form-dialog/type.d.ts +4 -0
- package/dist/@type/element-plus/components/images/Images.d.ts +16 -0
- package/dist/@type/element-plus/components/images/index.d.ts +9 -0
- package/dist/@type/element-plus/components/index.d.ts +9 -0
- package/dist/@type/element-plus/components/pagination/Pagination.d.ts +18 -0
- package/dist/@type/element-plus/components/table-column/TableColumn.d.ts +27 -0
- package/dist/@type/element-plus/components/upload/accept/index.d.ts +1 -0
- package/dist/@type/element-plus/components/upload/index.d.ts +42 -0
- package/dist/@type/element-plus/components/upload/select-file/SelectFile.d.ts +822 -0
- package/dist/@type/element-plus/components/upload/upload-files/UploadFiles.d.ts +844 -0
- package/dist/@type/element-plus/components/upload/upload-images/UploadImages.d.ts +842 -0
- package/dist/@type/element-plus/hooks/dialog/index.d.ts +2 -0
- package/dist/@type/element-plus/hooks/dialog/type.d.ts +20 -0
- package/dist/@type/element-plus/hooks/form/index.d.ts +2 -0
- package/dist/@type/element-plus/hooks/form/type.d.ts +45 -0
- package/dist/@type/element-plus/hooks/form-dialog/index.d.ts +2 -0
- package/dist/@type/element-plus/hooks/form-dialog/type.d.ts +70 -0
- package/dist/@type/element-plus/hooks/index.d.ts +5 -0
- package/dist/@type/element-plus/hooks/table-sort/index.d.ts +20 -0
- package/dist/@type/element-plus/hooks/table-sort/type.d.ts +21 -0
- package/dist/@type/element-plus/index.d.ts +3 -0
- package/dist/@type/element-plus/type.d.ts +15 -0
- package/dist/@type/element-plus/utils/form-rule/index.d.ts +4 -0
- package/dist/@type/element-plus/utils/form-rule/rule.d.ts +22 -0
- package/dist/@type/element-plus/utils/form-rule/type.d.ts +14 -0
- package/dist/@type/element-plus/utils/index.d.ts +2 -0
- package/dist/@type/element-plus/utils/table-util/index.d.ts +25 -0
- package/dist/@type/entity/BigFloat.d.ts +48 -0
- package/dist/@type/entity/Pages.d.ts +9 -0
- package/dist/@type/entity/RejectError.d.ts +24 -0
- package/dist/@type/entity/index.d.ts +3 -0
- package/dist/@type/hooks/index.d.ts +1 -0
- package/dist/@type/hooks/table-search/index.d.ts +3 -0
- package/dist/@type/hooks/table-search/type.d.ts +54 -0
- package/dist/@type/icons/index.d.ts +2 -0
- package/dist/@type/index.d.ts +14 -0
- package/dist/@type/resolver/index.d.ts +3 -0
- package/dist/@type/type.d.ts +11 -0
- package/dist/@type/typings.d.ts +20 -0
- package/dist/@type/utils/amap/@type/AMap.d.ts +24 -0
- package/dist/@type/utils/amap/@type/Bounds.d.ts +18 -0
- package/dist/@type/utils/amap/@type/Control.d.ts +19 -0
- package/dist/@type/utils/amap/@type/Event.d.ts +11 -0
- package/dist/@type/utils/amap/@type/Icon.d.ts +12 -0
- package/dist/@type/utils/amap/@type/InfoWindow.d.ts +40 -0
- package/dist/@type/utils/amap/@type/LngLat.d.ts +34 -0
- package/dist/@type/utils/amap/@type/Map.d.ts +218 -0
- package/dist/@type/utils/amap/@type/Marker.d.ts +137 -0
- package/dist/@type/utils/amap/@type/MarkerCluster.d.ts +65 -0
- package/dist/@type/utils/amap/@type/MoveAnimation.d.ts +33 -0
- package/dist/@type/utils/amap/@type/Pixel.d.ts +11 -0
- package/dist/@type/utils/amap/@type/Polyline.d.ts +80 -0
- package/dist/@type/utils/amap/@type/Size.d.ts +9 -0
- package/dist/@type/utils/amap/@type/index.d.ts +23 -0
- package/dist/@type/utils/amap/@type/other.d.ts +11 -0
- package/dist/@type/utils/amap/index.d.ts +3 -0
- package/dist/@type/utils/amap/type.d.ts +21 -0
- package/dist/@type/utils/amap/utils/coordinates.d.ts +24 -0
- package/dist/@type/utils/amap/utils/index.d.ts +12 -0
- package/dist/@type/utils/amap/utils/type.d.ts +4 -0
- package/dist/@type/utils/echarts/hooks/index.d.ts +76 -0
- package/dist/@type/utils/echarts/index.d.ts +3 -0
- package/dist/@type/utils/echarts/modules/coordinate/basic.d.ts +27 -0
- package/dist/@type/utils/echarts/modules/coordinate/cartesian.d.ts +25 -0
- package/dist/@type/utils/echarts/modules/coordinate/polar.d.ts +14 -0
- package/dist/@type/utils/echarts/modules/index.d.ts +5 -0
- package/dist/@type/utils/echarts/modules/series/bar.d.ts +16 -0
- package/dist/@type/utils/echarts/modules/series/line.d.ts +16 -0
- package/dist/@type/utils/echarts/modules/series/pie.d.ts +28 -0
- package/dist/@type/utils/echarts/modules/type.d.ts +83 -0
- package/dist/@type/utils/echarts/type.d.ts +8 -0
- package/dist/@type/utils/echarts/utils/assignOption.d.ts +7 -0
- package/dist/@type/utils/echarts/utils/index.d.ts +27 -0
- package/dist/@type/utils/fn-periodically/FnBatchPeriodically.d.ts +32 -0
- package/dist/@type/utils/fn-periodically/FnPeriodically.d.ts +37 -0
- package/dist/@type/utils/fn-periodically/index.d.ts +2 -0
- package/dist/@type/utils/fn-periodically/type.d.ts +30 -0
- package/dist/@type/utils/index.d.ts +6 -0
- package/dist/@type/utils/match-unit/dataset.d.ts +8 -0
- package/dist/@type/utils/match-unit/index.d.ts +10 -0
- package/dist/@type/utils/match-unit/type.d.ts +39 -0
- package/dist/@type/utils/mitt/hooks/inject-events/index.d.ts +7 -0
- package/dist/@type/utils/mitt/hooks/inject-events/type.d.ts +9 -0
- package/dist/@type/utils/prototype/index.d.ts +5 -0
- package/dist/@type/utils/prototype/lib/ArrayUtil.d.ts +87 -0
- package/dist/@type/utils/prototype/lib/ComponentUtil.d.ts +18 -0
- package/dist/@type/utils/prototype/lib/FileUtil.d.ts +19 -0
- package/dist/@type/utils/prototype/lib/NumberUtil.d.ts +9 -0
- package/dist/@type/utils/prototype/lib/ObjectUtil.d.ts +152 -0
- package/dist/@type/utils/prototype/lib/PromiseUtil.d.ts +7 -0
- package/dist/@type/utils/prototype/type.d.ts +28 -0
- package/dist/@type/utils/sandbox/Sandbox.d.ts +25 -0
- package/dist/@type/utils/transition-fade/index.d.ts +32 -0
- package/dist/@type/utils/transition-fade/type.d.ts +6 -0
- package/dist/_virtual/_plugin-vue_export-helper.es.js +10 -0
- package/dist/components/adaptive-box/AdaptiveBox.vue.es.js +7 -0
- package/dist/components/adaptive-box/AdaptiveBox.vue.es2.js +170 -0
- package/dist/components/coordinate-pickup/CoordinatePickup.vue.es.js +10 -0
- package/dist/components/coordinate-pickup/CoordinatePickup.vue.es2.js +302 -0
- package/dist/components/drag-drop-box/DragDropBox.vue.es.js +7 -0
- package/dist/components/drag-drop-box/DragDropBox.vue.es2.js +59 -0
- package/dist/components/drag-drop-container/DragDropContainer.vue.es.js +7 -0
- package/dist/components/drag-drop-container/DragDropContainer.vue.es2.js +113 -0
- package/dist/components/echarts-canvas/EChartsCanvas.vue.es.js +7 -0
- package/dist/components/echarts-canvas/EChartsCanvas.vue.es2.js +73 -0
- package/dist/components/in-body/InBody.vue.es.js +24 -0
- package/dist/components/in-body/InBody.vue.es2.js +4 -0
- package/dist/components/index.es.js +26 -0
- package/dist/components/position-anchor/PositionAnchor.vue.es.js +7 -0
- package/dist/components/position-anchor/PositionAnchor.vue.es2.js +22 -0
- package/dist/components/progress-bar/ProgressBar.vue.es.js +7 -0
- package/dist/components/progress-bar/ProgressBar.vue.es2.js +126 -0
- package/dist/components/progress-ring/ProgressRing.vue.es.js +7 -0
- package/dist/components/progress-ring/ProgressRing.vue.es2.js +87 -0
- package/dist/components/scroll-container/ScrollContainer.vue.es.js +7 -0
- package/dist/components/scroll-container/ScrollContainer.vue.es2.js +89 -0
- package/dist/components/show-log/ShowLog.vue.es.js +7 -0
- package/dist/components/show-log/ShowLog.vue.es2.js +61 -0
- package/dist/components/ys-video/YsVideo.vue.es.js +7 -0
- package/dist/components/ys-video/YsVideo.vue.es2.js +122 -0
- package/dist/components/ys-video/components/BtnLineRec.vue.es.js +7 -0
- package/dist/components/ys-video/components/BtnLineRec.vue.es2.js +57 -0
- package/dist/components/ys-video/images/btn-play.png.es.js +4 -0
- package/dist/config/index.es.js +20 -0
- package/dist/directive/index.es.js +4 -0
- package/dist/directive/ref-height/index.es.js +49 -0
- package/dist/element-plus/components/date-picker/DatePicker.vue.es.js +107 -0
- package/dist/element-plus/components/date-picker/DatePicker.vue.es2.js +4 -0
- package/dist/element-plus/components/date-picker/index.es.js +213 -0
- package/dist/element-plus/components/empty/Empty.vue.es.js +92 -0
- package/dist/element-plus/components/empty/Empty.vue.es3.js +5 -0
- package/dist/element-plus/components/empty/config.es.js +10 -0
- package/dist/element-plus/components/empty/hooks/index.es.js +24 -0
- package/dist/element-plus/components/form-dialog/FormDialog.vue.es.js +135 -0
- package/dist/element-plus/components/form-dialog/FormDialog.vue.es2.js +4 -0
- package/dist/element-plus/components/images/Images.vue.es.js +7 -0
- package/dist/element-plus/components/images/Images.vue.es2.js +93 -0
- package/dist/element-plus/components/images/index.es.js +10 -0
- package/dist/element-plus/components/index.es.js +21 -0
- package/dist/element-plus/components/pagination/Pagination.vue.es.js +7 -0
- package/dist/element-plus/components/pagination/Pagination.vue.es2.js +66 -0
- package/dist/element-plus/components/table-column/TableColumn.vue.es.js +34 -0
- package/dist/element-plus/components/table-column/TableColumn.vue.es2.js +4 -0
- package/dist/element-plus/components/upload/accept/index.es.js +12 -0
- package/dist/element-plus/components/upload/index.es.js +35 -0
- package/dist/element-plus/components/upload/select-file/SelectFile.vue.es.js +7 -0
- package/dist/element-plus/components/upload/select-file/SelectFile.vue.es2.js +66 -0
- package/dist/element-plus/components/upload/upload-files/UploadFiles.vue.es.js +7 -0
- package/dist/element-plus/components/upload/upload-files/UploadFiles.vue.es2.js +204 -0
- package/dist/element-plus/components/upload/upload-images/UploadImages.vue.es.js +7 -0
- package/dist/element-plus/components/upload/upload-images/UploadImages.vue.es2.js +211 -0
- package/dist/element-plus/hooks/dialog/index.es.js +44 -0
- package/dist/element-plus/hooks/form/index.es.js +45 -0
- package/dist/element-plus/hooks/form-dialog/index.es.js +53 -0
- package/dist/element-plus/hooks/table-sort/index.es.js +30 -0
- package/dist/element-plus/index.es.js +70 -0
- package/dist/element-plus/utils/form-rule/rule.es.js +107 -0
- package/dist/element-plus/utils/table-util/index.es.js +56 -0
- package/dist/entity/BigFloat.es.js +102 -0
- package/dist/entity/Pages.es.js +11 -0
- package/dist/entity/RejectError.es.js +35 -0
- package/dist/entity/index.es.js +8 -0
- package/dist/hooks/index.es.js +4 -0
- package/dist/hooks/table-search/index.es.js +72 -0
- package/dist/icons/images/Image.svg.es.js +4 -0
- package/dist/icons/images/ImageError.svg.es.js +4 -0
- package/dist/icons/index.es.js +12 -0
- package/dist/index.es.js +156 -0
- package/dist/resolver/index.es.js +21 -0
- package/dist/styles/index.css +1 -0
- package/dist/styles/plugins/colors/index.scss +52 -0
- package/dist/styles/plugins/colors/var.scss +77 -0
- package/dist/styles/plugins/template.scss +37 -0
- package/dist/utils/amap/index.es.js +21 -0
- package/dist/utils/amap/utils/coordinates.es.js +61 -0
- package/dist/utils/amap/utils/index.es.js +39 -0
- package/dist/utils/echarts/hooks/index.es.js +32 -0
- package/dist/utils/echarts/modules/coordinate/basic.es.js +103 -0
- package/dist/utils/echarts/modules/coordinate/cartesian.es.js +79 -0
- package/dist/utils/echarts/modules/series/bar.es.js +43 -0
- package/dist/utils/echarts/modules/series/line.es.js +47 -0
- package/dist/utils/echarts/modules/series/pie.es.js +126 -0
- package/dist/utils/echarts/utils/assignOption.es.js +40 -0
- package/dist/utils/echarts/utils/index.es.js +99 -0
- package/dist/utils/fn-periodically/FnBatchPeriodically.es.js +70 -0
- package/dist/utils/fn-periodically/FnPeriodically.es.js +85 -0
- package/dist/utils/index.es.js +49 -0
- package/dist/utils/match-unit/dataset.es.js +143 -0
- package/dist/utils/match-unit/index.es.js +56 -0
- package/dist/utils/mitt/hooks/inject-events/index.es.js +27 -0
- package/dist/utils/prototype/lib/ArrayUtil.es.js +115 -0
- package/dist/utils/prototype/lib/ComponentUtil.es.js +45 -0
- package/dist/utils/prototype/lib/NumberUtil.es.js +17 -0
- package/dist/utils/prototype/lib/ObjectUtil.es.js +277 -0
- package/dist/utils/prototype/lib/PromiseUtil.es.js +18 -0
- package/dist/utils/transition-fade/index.es.js +79 -0
- package/global.d.ts +33 -0
- package/package.json +117 -0
- package/web-types.json +902 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { ElIcon, ElImageViewer } from "element-plus/es";
|
|
2
|
+
import { defineComponent, getCurrentInstance, ref, inject, shallowRef, onMounted, onBeforeUnmount, computed, watch, createElementBlock, openBlock, normalizeStyle, normalizeClass, createVNode, createBlock, createCommentVNode, unref, withCtx, renderSlot, nextTick } from "vue";
|
|
3
|
+
import { Plus } from "@element-plus/icons-vue";
|
|
4
|
+
import { ElUpload } from "element-plus";
|
|
5
|
+
import { acceptMIMELib } from "../accept/index.es.js";
|
|
6
|
+
import { YkElUploadImages, YkElUpload } from "../index.es.js";
|
|
7
|
+
import { useInjectEventsHooks } from "../../../../utils/mitt/hooks/inject-events/index.es.js";
|
|
8
|
+
import { MatchUnit } from "../../../../utils/match-unit/index.es.js";
|
|
9
|
+
import { PromiseUtil } from "../../../../utils/prototype/lib/PromiseUtil.es.js";
|
|
10
|
+
import { ArrayUtil } from "../../../../utils/prototype/lib/ArrayUtil.es.js";
|
|
11
|
+
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
|
+
__name: "UploadImages",
|
|
13
|
+
props: {
|
|
14
|
+
modelValue: {},
|
|
15
|
+
isJoin: { type: Boolean, default: true },
|
|
16
|
+
uploadClass: { default: "" },
|
|
17
|
+
accept: { default: "png,jpg,jpeg" },
|
|
18
|
+
width: { default: "248px" },
|
|
19
|
+
height: { default: "148px" },
|
|
20
|
+
maxSize: { default: Infinity },
|
|
21
|
+
limit: { default: Infinity },
|
|
22
|
+
getUrlMethod: {},
|
|
23
|
+
uploadMethod: {}
|
|
24
|
+
},
|
|
25
|
+
emits: ["update:modelValue", "change", "error"],
|
|
26
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
27
|
+
const props = __props;
|
|
28
|
+
const emits = __emit;
|
|
29
|
+
const instance = getCurrentInstance();
|
|
30
|
+
const uploadRef = ref();
|
|
31
|
+
const formDialogInject = inject("/YkElFormDialog");
|
|
32
|
+
const formDialogInjectEvent = shallowRef();
|
|
33
|
+
onMounted(() => {
|
|
34
|
+
if (!formDialogInject) return;
|
|
35
|
+
formDialogInjectEvent.value = useInjectEventsHooks({ mittEvent: formDialogInject.eventBus });
|
|
36
|
+
formDialogInjectEvent.value.on("resetFields", clearFiles);
|
|
37
|
+
formDialogInjectEvent.value.on("getUploadHandle", () => {
|
|
38
|
+
formDialogInjectEventEmit("uploadHandleResult", {
|
|
39
|
+
count: uploadUserFile.value.filter((item) => item.raw).length,
|
|
40
|
+
handle: uploadHandle
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
function formDialogInjectEventEmit(type, data) {
|
|
45
|
+
if (formDialogInjectEvent.value) {
|
|
46
|
+
formDialogInjectEvent.value.emit(type, data);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const uploadGroup = inject("YkUploadGroup");
|
|
50
|
+
onMounted(() => {
|
|
51
|
+
if (uploadGroup) {
|
|
52
|
+
uploadGroup.register(instance);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
onBeforeUnmount(() => {
|
|
56
|
+
if (uploadGroup) {
|
|
57
|
+
uploadGroup.unregister(instance);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const uploadImageStyle = computed(() => ({
|
|
61
|
+
"--upload-size-w": props.width,
|
|
62
|
+
"--upload-size-h": props.height
|
|
63
|
+
}));
|
|
64
|
+
const getUrlMethod = props.getUrlMethod || YkElUploadImages.props.getUrlMethod.default || YkElUpload.props.getUrlMethod.default || function(url) {
|
|
65
|
+
return url;
|
|
66
|
+
};
|
|
67
|
+
const uploadMethod = props.uploadMethod || YkElUploadImages.props.uploadMethod.default || YkElUpload.props.uploadMethod.default;
|
|
68
|
+
const imageViewerState = ref(false);
|
|
69
|
+
const imageViewerUrlList = shallowRef([]);
|
|
70
|
+
const initialIndex = ref(0);
|
|
71
|
+
function showImageViewer(e) {
|
|
72
|
+
initialIndex.value = uploadUserFile.value.indexOf(e);
|
|
73
|
+
imageViewerState.value = true;
|
|
74
|
+
}
|
|
75
|
+
function hideImageViewer() {
|
|
76
|
+
imageViewerState.value = false;
|
|
77
|
+
}
|
|
78
|
+
const uploadUserFile = ref([]);
|
|
79
|
+
const uploadUserFileUrlDic = computed(() => ArrayUtil.createStrDic(uploadUserFile.value, "url"));
|
|
80
|
+
const modelFileListCustomer = computed({
|
|
81
|
+
get() {
|
|
82
|
+
return uploadUserFile.value;
|
|
83
|
+
},
|
|
84
|
+
set(val) {
|
|
85
|
+
uploadUserFile.value = val;
|
|
86
|
+
imageViewerUrlList.value = uploadUserFile.value.map((item) => item.url);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
watch(() => props.modelValue, () => {
|
|
90
|
+
let urls = typeof props.modelValue === "string" ? props.modelValue.split(",") : props.modelValue || [];
|
|
91
|
+
urls = urls.filter(Boolean);
|
|
92
|
+
uploadUserFile.value = urls.map((url) => {
|
|
93
|
+
if (uploadUserFileUrlDic.value[url]?.raw) {
|
|
94
|
+
return uploadUserFileUrlDic.value[url];
|
|
95
|
+
} else {
|
|
96
|
+
const file = uploadUserFile.value.find((item) => item._url === url);
|
|
97
|
+
return file || {
|
|
98
|
+
url: /^https?:\/\/.*$/.test(url) ? url : getUrlMethod(url),
|
|
99
|
+
status: "success",
|
|
100
|
+
_url: url
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
imageViewerUrlList.value = uploadUserFile.value.map((item) => item.url);
|
|
105
|
+
}, { immediate: true });
|
|
106
|
+
function reverseSync() {
|
|
107
|
+
const urls = uploadUserFile.value.map((item) => {
|
|
108
|
+
return item.status === "success" ? item._url : item.url;
|
|
109
|
+
});
|
|
110
|
+
emits("update:modelValue", urls.join(","));
|
|
111
|
+
}
|
|
112
|
+
function onFileChange(file) {
|
|
113
|
+
let error = null;
|
|
114
|
+
if (!verifyFileType(file.raw)) {
|
|
115
|
+
error = new Error("文件类型应为" + props.accept);
|
|
116
|
+
} else if (file.size > props.maxSize) {
|
|
117
|
+
const unitVal = MatchUnit.matchMaxNum({
|
|
118
|
+
value: props.maxSize,
|
|
119
|
+
unit: "bit",
|
|
120
|
+
fractionDigits: 2,
|
|
121
|
+
carryNumber: 1024
|
|
122
|
+
});
|
|
123
|
+
error = new Error("文件大小不能超过" + unitVal.value + unitVal.unit);
|
|
124
|
+
}
|
|
125
|
+
if (error) {
|
|
126
|
+
uploadRef.value.handleRemove(file.raw);
|
|
127
|
+
emits("error", error);
|
|
128
|
+
} else {
|
|
129
|
+
nextTick(() => {
|
|
130
|
+
reverseSync();
|
|
131
|
+
emits("change", file);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function onFileRemove() {
|
|
136
|
+
nextTick(() => {
|
|
137
|
+
reverseSync();
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
async function uploadHandle() {
|
|
141
|
+
const retUrl = [];
|
|
142
|
+
for (let i = 0; i < uploadUserFile.value.length; i++) {
|
|
143
|
+
const file = uploadUserFile.value[i];
|
|
144
|
+
if (file.status !== "success" && file.raw) {
|
|
145
|
+
const [res] = await PromiseUtil.safe(uploadMethod(file.raw));
|
|
146
|
+
retUrl.push(res);
|
|
147
|
+
formDialogInjectEventEmit("uploadSuccess");
|
|
148
|
+
} else {
|
|
149
|
+
retUrl.push(file._url);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const ret = props.isJoin ? retUrl.join(",") : retUrl;
|
|
153
|
+
emits("update:modelValue", ret);
|
|
154
|
+
return ret;
|
|
155
|
+
}
|
|
156
|
+
function clearFiles() {
|
|
157
|
+
uploadRef.value.clearFiles();
|
|
158
|
+
imageViewerUrlList.value = [];
|
|
159
|
+
}
|
|
160
|
+
const uploadAccept = computed(() => props.accept.split(",").map((key) => acceptMIMELib[key]).join(","));
|
|
161
|
+
function verifyFileType(file) {
|
|
162
|
+
return props.accept.split(",").includes(file.name.replace(/^.*\.(\w*)$/, "$1"));
|
|
163
|
+
}
|
|
164
|
+
__expose({ upload: uploadHandle, clearFiles });
|
|
165
|
+
return (_ctx, _cache) => {
|
|
166
|
+
const _component_ElIcon = ElIcon;
|
|
167
|
+
const _component_ElImageViewer = ElImageViewer;
|
|
168
|
+
return openBlock(), createElementBlock("div", {
|
|
169
|
+
class: normalizeClass(["upload-image", { "limit_is-max": uploadUserFile.value?.length >= props.limit }]),
|
|
170
|
+
style: normalizeStyle(uploadImageStyle.value)
|
|
171
|
+
}, [
|
|
172
|
+
createVNode(unref(ElUpload), {
|
|
173
|
+
ref_key: "uploadRef",
|
|
174
|
+
ref: uploadRef,
|
|
175
|
+
"file-list": modelFileListCustomer.value,
|
|
176
|
+
"onUpdate:fileList": _cache[0] || (_cache[0] = ($event) => modelFileListCustomer.value = $event),
|
|
177
|
+
"auto-upload": false,
|
|
178
|
+
accept: uploadAccept.value,
|
|
179
|
+
limit: props.limit,
|
|
180
|
+
multiple: "",
|
|
181
|
+
"list-type": "picture-card",
|
|
182
|
+
"on-preview": showImageViewer,
|
|
183
|
+
class: normalizeClass([__props.uploadClass]),
|
|
184
|
+
onChange: onFileChange,
|
|
185
|
+
onRemove: onFileRemove
|
|
186
|
+
}, {
|
|
187
|
+
default: withCtx(() => [
|
|
188
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
189
|
+
createVNode(_component_ElIcon, null, {
|
|
190
|
+
default: withCtx(() => [
|
|
191
|
+
createVNode(unref(Plus))
|
|
192
|
+
]),
|
|
193
|
+
_: 1
|
|
194
|
+
})
|
|
195
|
+
], true)
|
|
196
|
+
]),
|
|
197
|
+
_: 3
|
|
198
|
+
}, 8, ["file-list", "accept", "limit", "class"]),
|
|
199
|
+
imageViewerState.value ? (openBlock(), createBlock(_component_ElImageViewer, {
|
|
200
|
+
key: 0,
|
|
201
|
+
"url-list": unref(imageViewerUrlList),
|
|
202
|
+
"initial-index": initialIndex.value,
|
|
203
|
+
onClose: hideImageViewer
|
|
204
|
+
}, null, 8, ["url-list", "initial-index"])) : createCommentVNode("", true)
|
|
205
|
+
], 6);
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
export {
|
|
210
|
+
_sfc_main as default
|
|
211
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ref, nextTick } from "vue";
|
|
2
|
+
function useElDialogHooks(options) {
|
|
3
|
+
const ops = Object.assign({
|
|
4
|
+
show: null,
|
|
5
|
+
close: null
|
|
6
|
+
}, options);
|
|
7
|
+
const model = ref(false);
|
|
8
|
+
async function show(...args) {
|
|
9
|
+
if (ops.beforeShow) {
|
|
10
|
+
const result = await ops.beforeShow(...args);
|
|
11
|
+
if (result !== false) {
|
|
12
|
+
model.value = true;
|
|
13
|
+
}
|
|
14
|
+
} else {
|
|
15
|
+
model.value = true;
|
|
16
|
+
}
|
|
17
|
+
if (ops.show) {
|
|
18
|
+
await nextTick(() => {
|
|
19
|
+
ops.show(...args);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return model.value;
|
|
23
|
+
}
|
|
24
|
+
async function close(...args) {
|
|
25
|
+
if (ops.beforeClose) {
|
|
26
|
+
const result = await ops.beforeClose(...args);
|
|
27
|
+
if (result !== false) {
|
|
28
|
+
model.value = false;
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
model.value = false;
|
|
32
|
+
}
|
|
33
|
+
if (ops.close) {
|
|
34
|
+
await nextTick(() => {
|
|
35
|
+
ops.close(...args);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return !model.value;
|
|
39
|
+
}
|
|
40
|
+
return { show, close, model };
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
useElDialogHooks
|
|
44
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { isRef, ref, shallowRef, useTemplateRef } from "vue";
|
|
2
|
+
import { ObjectUtil } from "../../../utils/prototype/lib/ObjectUtil.es.js";
|
|
3
|
+
import { PromiseUtil } from "../../../utils/prototype/lib/PromiseUtil.es.js";
|
|
4
|
+
function useElFormHooks(options) {
|
|
5
|
+
const ops = Object.assign({
|
|
6
|
+
form: {},
|
|
7
|
+
rules: []
|
|
8
|
+
}, options);
|
|
9
|
+
const form = isRef(ops.form) ? ops.form : ref(ops.form);
|
|
10
|
+
const formSnapshot = ObjectUtil.toJSON(form.value);
|
|
11
|
+
let formRef = shallowRef();
|
|
12
|
+
if (typeof ops.ref === "string") {
|
|
13
|
+
formRef = useTemplateRef(ops.ref);
|
|
14
|
+
} else if (ops.ref) {
|
|
15
|
+
formRef = ops.ref;
|
|
16
|
+
}
|
|
17
|
+
async function submitHandle(...args) {
|
|
18
|
+
let result = true;
|
|
19
|
+
if (formRef.value) {
|
|
20
|
+
const _result = await PromiseUtil.safe(formRef.value.validate());
|
|
21
|
+
result = _result[0];
|
|
22
|
+
}
|
|
23
|
+
if (result && ops.submit) {
|
|
24
|
+
if (ops.beforeSubmit) {
|
|
25
|
+
await ops.beforeSubmit();
|
|
26
|
+
}
|
|
27
|
+
await ops.submit(...args);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function resetFields() {
|
|
31
|
+
form.value = ObjectUtil.toJSON(formSnapshot);
|
|
32
|
+
formRef.value?.clearValidate();
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
ref: formRef,
|
|
36
|
+
form,
|
|
37
|
+
rules: ops.rules,
|
|
38
|
+
submit: submitHandle,
|
|
39
|
+
resetFields,
|
|
40
|
+
_option: ops
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
useElFormHooks
|
|
45
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useElFormHooks } from "../form/index.es.js";
|
|
2
|
+
import { useElDialogHooks } from "../dialog/index.es.js";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
function useElFormDialogHooks(options) {
|
|
5
|
+
const ops = Object.assign({
|
|
6
|
+
closeResetFields: true,
|
|
7
|
+
submitAutoUploadFile: true,
|
|
8
|
+
title: ""
|
|
9
|
+
}, options);
|
|
10
|
+
const submit = ops.submit;
|
|
11
|
+
ops.submit = async (...args) => {
|
|
12
|
+
if (submit) {
|
|
13
|
+
const submitResult = submit(...args);
|
|
14
|
+
if (submitResult instanceof Promise) {
|
|
15
|
+
await submitResult;
|
|
16
|
+
if (ops.submitAutoClose !== false) await dialogHook.close(...[]);
|
|
17
|
+
} else {
|
|
18
|
+
if (ops.submitAutoClose === true) await dialogHook.close(...[]);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const formHook = useElFormHooks(ops);
|
|
23
|
+
const dialogHook = useElDialogHooks(ops);
|
|
24
|
+
const title = computed(() => {
|
|
25
|
+
const form = formHook.form.value;
|
|
26
|
+
return (form.id ? "编辑" : "添加") + ops.title;
|
|
27
|
+
});
|
|
28
|
+
async function show(...args) {
|
|
29
|
+
const result = await dialogHook.show(...args);
|
|
30
|
+
if (result) formHook.resetFields();
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
async function close(...args) {
|
|
34
|
+
const result = await dialogHook.close(...args);
|
|
35
|
+
if (result) closed();
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
function closed() {
|
|
39
|
+
if (ops.closeResetFields) formHook.resetFields();
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
...formHook,
|
|
43
|
+
...dialogHook,
|
|
44
|
+
show,
|
|
45
|
+
close,
|
|
46
|
+
title,
|
|
47
|
+
_formHook: formHook,
|
|
48
|
+
_options: ops
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
useElFormDialogHooks
|
|
53
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ref, watch } from "vue";
|
|
2
|
+
function useElTableSortHooks(options) {
|
|
3
|
+
const tableData = options.data;
|
|
4
|
+
const isEnable = ref(false);
|
|
5
|
+
const sortValue = ref([]);
|
|
6
|
+
watch(() => tableData.value.length, () => {
|
|
7
|
+
if (isEnable.value) updateSortValue();
|
|
8
|
+
}, { deep: false });
|
|
9
|
+
function updateSortValue() {
|
|
10
|
+
const length = tableData.value.length;
|
|
11
|
+
sortValue.value = Array.from({ length }, (_, i) => i + 1);
|
|
12
|
+
}
|
|
13
|
+
function enable() {
|
|
14
|
+
isEnable.value = true;
|
|
15
|
+
updateSortValue();
|
|
16
|
+
}
|
|
17
|
+
function disable() {
|
|
18
|
+
isEnable.value = false;
|
|
19
|
+
sortValue.value = [];
|
|
20
|
+
}
|
|
21
|
+
function sort(index) {
|
|
22
|
+
const tableItem = tableData.value.splice(index, 1);
|
|
23
|
+
tableData.value.splice(sortValue.value[index] - 1, 0, ...tableItem);
|
|
24
|
+
updateSortValue();
|
|
25
|
+
}
|
|
26
|
+
return { isEnable, enable, disable, sort, sortValue };
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
useElTableSortHooks
|
|
30
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ElLoading } from "element-plus";
|
|
2
|
+
import { default as default2 } from "./components/date-picker/DatePicker.vue.es.js";
|
|
3
|
+
import { default as default3 } from "./components/form-dialog/FormDialog.vue.es.js";
|
|
4
|
+
import { default as default4 } from "./components/table-column/TableColumn.vue.es.js";
|
|
5
|
+
import { default as default5 } from "./components/empty/Empty.vue.es.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
import { useElDialogHooks } from "./hooks/dialog/index.es.js";
|
|
8
|
+
import { useElFormHooks } from "./hooks/form/index.es.js";
|
|
9
|
+
import { useElTableSortHooks } from "./hooks/table-sort/index.es.js";
|
|
10
|
+
import { useElFormDialogHooks } from "./hooks/form-dialog/index.es.js";
|
|
11
|
+
import { useElEmptyHooks } from "./components/empty/hooks/index.es.js";
|
|
12
|
+
import { TableUtil } from "./utils/table-util/index.es.js";
|
|
13
|
+
import { integerRule, integerTag, ipRule, ipTag, numberRule, numberTag, passwordRule, passwordTag, phoneRule, phoneTag, positionRule, positionTag, positiveIntegerRule, positiveIntegerTag, positiveNumberRule, positiveNumberTag, required, usernameRule, usernameTag, validator } from "./utils/form-rule/rule.es.js";
|
|
14
|
+
import { default as default6 } from "./components/pagination/Pagination.vue.es.js";
|
|
15
|
+
import { default as default7 } from "./components/upload/upload-images/UploadImages.vue.es.js";
|
|
16
|
+
import { default as default8 } from "./components/upload/upload-files/UploadFiles.vue.es.js";
|
|
17
|
+
import { default as default9 } from "./components/upload/select-file/SelectFile.vue.es.js";
|
|
18
|
+
import { default as default10 } from "./components/images/Images.vue.es.js";
|
|
19
|
+
const elLoadingService = ElLoading.service;
|
|
20
|
+
let showServiceCount = 0;
|
|
21
|
+
ElLoading.service = function(options) {
|
|
22
|
+
const instance = elLoadingService(options);
|
|
23
|
+
showServiceCount++;
|
|
24
|
+
const instanceClose = instance.close;
|
|
25
|
+
instance.close = function() {
|
|
26
|
+
showServiceCount--;
|
|
27
|
+
if (showServiceCount <= 0) {
|
|
28
|
+
showServiceCount = 0;
|
|
29
|
+
instanceClose();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
return instance;
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
TableUtil,
|
|
36
|
+
default2 as YkElDatePicker,
|
|
37
|
+
default5 as YkElEmpty,
|
|
38
|
+
default3 as YkElFormDialog,
|
|
39
|
+
default10 as YkElImages,
|
|
40
|
+
default6 as YkElPagination,
|
|
41
|
+
default9 as YkElSelectFile,
|
|
42
|
+
default4 as YkElTableColumn,
|
|
43
|
+
default8 as YkElUploadFiles,
|
|
44
|
+
default7 as YkElUploadImages,
|
|
45
|
+
integerRule,
|
|
46
|
+
integerTag,
|
|
47
|
+
ipRule,
|
|
48
|
+
ipTag,
|
|
49
|
+
numberRule,
|
|
50
|
+
numberTag,
|
|
51
|
+
passwordRule,
|
|
52
|
+
passwordTag,
|
|
53
|
+
phoneRule,
|
|
54
|
+
phoneTag,
|
|
55
|
+
positionRule,
|
|
56
|
+
positionTag,
|
|
57
|
+
positiveIntegerRule,
|
|
58
|
+
positiveIntegerTag,
|
|
59
|
+
positiveNumberRule,
|
|
60
|
+
positiveNumberTag,
|
|
61
|
+
required,
|
|
62
|
+
useElDialogHooks,
|
|
63
|
+
useElEmptyHooks,
|
|
64
|
+
useElFormDialogHooks,
|
|
65
|
+
useElFormHooks,
|
|
66
|
+
useElTableSortHooks,
|
|
67
|
+
usernameRule,
|
|
68
|
+
usernameTag,
|
|
69
|
+
validator
|
|
70
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { ObjectUtil } from "../../../utils/prototype/lib/ObjectUtil.es.js";
|
|
2
|
+
const required = function(message = "此项为必填项", trigger = "blur") {
|
|
3
|
+
return { required: true, message, trigger };
|
|
4
|
+
};
|
|
5
|
+
["blur", "change"].forEach((trigger) => {
|
|
6
|
+
required[trigger] = (message) => required(message, trigger);
|
|
7
|
+
});
|
|
8
|
+
const validator = function(fn, ops = {}) {
|
|
9
|
+
return { validator: fn, trigger: "blur", ...ops };
|
|
10
|
+
};
|
|
11
|
+
["blur", "change"].forEach((trigger) => {
|
|
12
|
+
validator[trigger] = (fn, ops = {}) => validator(fn, {
|
|
13
|
+
trigger,
|
|
14
|
+
...ops
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
function phoneTag(value) {
|
|
18
|
+
return /^1\d{10}$/.test(value) ? void 0 : new Error("手机号格式不正确");
|
|
19
|
+
}
|
|
20
|
+
const phoneRule = validator.blur((rule, value, callback) => {
|
|
21
|
+
callback(ObjectUtil.isNotEmpty(value) ? phoneTag(value) : void 0);
|
|
22
|
+
});
|
|
23
|
+
function usernameTag(value) {
|
|
24
|
+
const username = /^\w{8,16}$/;
|
|
25
|
+
return username.test(value) ? void 0 : new Error("账号为8 ~ 16位字母、数字");
|
|
26
|
+
}
|
|
27
|
+
const usernameRule = validator.blur((rule, value, callback) => {
|
|
28
|
+
callback(ObjectUtil.isNotEmpty(value) ? usernameTag(value) : void 0);
|
|
29
|
+
});
|
|
30
|
+
function passwordTag(value) {
|
|
31
|
+
if (ObjectUtil.isEmpty(value)) return;
|
|
32
|
+
const password = /^(?=.*[A-Za-z])(?=.*\d)[\w\-+.@#$%^&*!]{8,16}$/;
|
|
33
|
+
const passwordTwo = /^[\w\-+.]{8,16}$/;
|
|
34
|
+
if (password.test(value)) {
|
|
35
|
+
return;
|
|
36
|
+
} else if (passwordTwo.test(value)) {
|
|
37
|
+
return new Error("密码至少包含1位字母或数字");
|
|
38
|
+
} else {
|
|
39
|
+
return new Error("密码为8 ~ 16位字母、数字");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const passwordRule = validator.blur((rule, value, callback) => {
|
|
43
|
+
callback(ObjectUtil.isNotEmpty(value) ? passwordTag(value) : void 0);
|
|
44
|
+
});
|
|
45
|
+
function positionTag(value) {
|
|
46
|
+
const position = /^((-?180)|(-?1[0-7]\d)|(-?[1-9]\d)|(-?[1-9])|0)(\.\d+)?,((-?90)|(-?[1-8]\d)|(-?[1-9])|0)(\.\d+)?$/;
|
|
47
|
+
return position.test(value) ? void 0 : new Error("坐标格式为(±180,±90)");
|
|
48
|
+
}
|
|
49
|
+
const positionRule = validator.blur((rule, value, callback) => {
|
|
50
|
+
callback(ObjectUtil.isNotEmpty(value) ? positionTag(value) : void 0);
|
|
51
|
+
});
|
|
52
|
+
function ipTag(value) {
|
|
53
|
+
const tag = /^(1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9]?[0-9])(\.(1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9]?[0-9])){3}$/;
|
|
54
|
+
return tag.test(value) ? void 0 : new Error("Ip格式为(192.168.1.1)");
|
|
55
|
+
}
|
|
56
|
+
const ipRule = validator.blur((rule, value, callback) => {
|
|
57
|
+
callback(ObjectUtil.isNotEmpty(value) ? ipTag(value) : void 0);
|
|
58
|
+
});
|
|
59
|
+
function numberTag(value) {
|
|
60
|
+
return ObjectUtil.isEmpty(value) || !Number.isNaN(Number(value)) ? void 0 : new Error("此项应为正整数");
|
|
61
|
+
}
|
|
62
|
+
const numberRule = validator.blur((rule, value, callback) => {
|
|
63
|
+
callback(ObjectUtil.isNotEmpty(value) ? numberTag(value) : void 0);
|
|
64
|
+
});
|
|
65
|
+
function positiveNumberTag(value) {
|
|
66
|
+
const isNumber = !Number.isNaN(Number(value));
|
|
67
|
+
return ObjectUtil.isEmpty(value) || isNumber && Number(value) > 0 ? void 0 : new Error("此项应为正数数字");
|
|
68
|
+
}
|
|
69
|
+
const positiveNumberRule = validator.blur((rule, value, callback) => {
|
|
70
|
+
callback(ObjectUtil.isNotEmpty(value) ? positiveNumberTag(value) : void 0);
|
|
71
|
+
});
|
|
72
|
+
function integerTag(value) {
|
|
73
|
+
const tag = /^-?\d+$/;
|
|
74
|
+
return ObjectUtil.isEmpty(value) || tag.test(value.toString()) ? void 0 : new Error("此项应为正整数");
|
|
75
|
+
}
|
|
76
|
+
const integerRule = validator.blur((rule, value, callback) => {
|
|
77
|
+
callback(ObjectUtil.isNotEmpty(value) ? integerTag(value) : void 0);
|
|
78
|
+
});
|
|
79
|
+
function positiveIntegerTag(value) {
|
|
80
|
+
const tag = /^\d+$/;
|
|
81
|
+
return ObjectUtil.isEmpty(value) || tag.test(value.toString()) ? void 0 : new Error("此项应为正整数");
|
|
82
|
+
}
|
|
83
|
+
const positiveIntegerRule = validator.blur((rule, value, callback) => {
|
|
84
|
+
callback(ObjectUtil.isNotEmpty(value) ? positiveIntegerTag(value) : void 0);
|
|
85
|
+
});
|
|
86
|
+
export {
|
|
87
|
+
integerRule,
|
|
88
|
+
integerTag,
|
|
89
|
+
ipRule,
|
|
90
|
+
ipTag,
|
|
91
|
+
numberRule,
|
|
92
|
+
numberTag,
|
|
93
|
+
passwordRule,
|
|
94
|
+
passwordTag,
|
|
95
|
+
phoneRule,
|
|
96
|
+
phoneTag,
|
|
97
|
+
positionRule,
|
|
98
|
+
positionTag,
|
|
99
|
+
positiveIntegerRule,
|
|
100
|
+
positiveIntegerTag,
|
|
101
|
+
positiveNumberRule,
|
|
102
|
+
positiveNumberTag,
|
|
103
|
+
required,
|
|
104
|
+
usernameRule,
|
|
105
|
+
usernameTag,
|
|
106
|
+
validator
|
|
107
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import "element-plus";
|
|
2
|
+
import "vue";
|
|
3
|
+
const TableUtil = {
|
|
4
|
+
/**
|
|
5
|
+
* 计算表格序号
|
|
6
|
+
* @param pages
|
|
7
|
+
*/
|
|
8
|
+
indexMethod(pages) {
|
|
9
|
+
return (index) => pages.pageSize * (pages.pageNum - 1) + index + 1;
|
|
10
|
+
},
|
|
11
|
+
/**
|
|
12
|
+
* 前端分页
|
|
13
|
+
* @param tableData
|
|
14
|
+
* @param pages
|
|
15
|
+
*/
|
|
16
|
+
paging(tableData, pages) {
|
|
17
|
+
if (tableData.length === 0) {
|
|
18
|
+
pages.pageNum = 1;
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
let start = pages.pageSize * (pages.pageNum - 1);
|
|
22
|
+
let end = start + pages.pageSize;
|
|
23
|
+
if (tableData.length < start) {
|
|
24
|
+
pages.pageNum = Math.ceil(tableData.length / pages.pageSize);
|
|
25
|
+
start = pages.pageSize * pages.pageNum;
|
|
26
|
+
end = start + pages.pageSize;
|
|
27
|
+
}
|
|
28
|
+
if (end > tableData.length) {
|
|
29
|
+
end = tableData.length;
|
|
30
|
+
}
|
|
31
|
+
const retData = [];
|
|
32
|
+
for (; start < end; start++) {
|
|
33
|
+
retData.push(tableData[start]);
|
|
34
|
+
}
|
|
35
|
+
return retData;
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* 高亮某一行
|
|
39
|
+
* @param ref
|
|
40
|
+
* @param index
|
|
41
|
+
* @param timeout
|
|
42
|
+
*/
|
|
43
|
+
highlightRow(ref, index, timeout = 12e3) {
|
|
44
|
+
const trs = ref.$el.querySelectorAll(".el-table__body tbody tr") || [];
|
|
45
|
+
const row = trs[index];
|
|
46
|
+
if (row) {
|
|
47
|
+
row.classList.add("elc-highlight-row");
|
|
48
|
+
setTimeout(() => {
|
|
49
|
+
row.classList.remove("elc-highlight-row");
|
|
50
|
+
}, timeout);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
TableUtil
|
|
56
|
+
};
|