leisure-core 0.7.7 → 0.7.8
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/{PROJECT_GUIDE.md → README.md} +1 -1
- package/license.md +201 -0
- package/package.json +14 -1
- package/index.js +0 -223
- package/le-area/index.js +0 -7
- package/le-area/src/main.vue +0 -112
- package/le-button/index.js +0 -7
- package/le-button/src/main.vue +0 -47
- package/le-button-attach/index.js +0 -6
- package/le-button-attach/src/main.vue +0 -171
- package/le-button-msg/index.js +0 -7
- package/le-button-msg/src/main.vue +0 -65
- package/le-button-qr/index.js +0 -7
- package/le-button-qr/src/main.vue +0 -96
- package/le-date-picker/index.js +0 -7
- package/le-date-picker/src/main.vue +0 -67
- package/le-date-picker-auto/index.js +0 -6
- package/le-date-picker-auto/src/main.vue +0 -131
- package/le-dialog-container/index.js +0 -7
- package/le-dialog-container/src/main.vue +0 -80
- package/le-form/index.js +0 -7
- package/le-form/src/main.vue +0 -13
- package/le-form-item/index.js +0 -7
- package/le-form-item/src/main.vue +0 -13
- package/le-home/index.js +0 -7
- package/le-home/src/LeHeaderMenu.vue +0 -60
- package/le-home/src/main.vue +0 -1315
- package/le-home/src/sub.vue +0 -82
- package/le-image/index.js +0 -7
- package/le-image/src/main.vue +0 -53
- package/le-input/index.js +0 -7
- package/le-input/src/main.vue +0 -15
- package/le-input-advanced/index.js +0 -7
- package/le-input-advanced/src/main.vue +0 -71
- package/le-input-number/index.js +0 -7
- package/le-input-number/src/main.vue +0 -15
- package/le-input-validate/index.js +0 -6
- package/le-input-validate/src/main.vue +0 -469
- package/le-libs/js/drag.js +0 -78
- package/le-libs/js/event.js +0 -3
- package/le-libs/js/hrequest.js +0 -76
- package/le-libs/js/hrequestFile.js +0 -62
- package/le-libs/js/info.js +0 -7
- package/le-libs/js/tokens.js +0 -13
- package/le-libs/mixins/main.js +0 -48
- package/le-list/index.js +0 -7
- package/le-list/src/main.vue +0 -645
- package/le-list-form/index.js +0 -7
- package/le-list-form/src/main.vue +0 -474
- package/le-login/index.js +0 -7
- package/le-login/src/ForgotPassword.vue +0 -613
- package/le-login/src/main.vue +0 -982
- package/le-media/index.js +0 -7
- package/le-media/src/main.vue +0 -298
- package/le-media-list/index.js +0 -7
- package/le-media-list/src/main.vue +0 -178
- package/le-media-upload/index.js +0 -7
- package/le-media-upload/src/main.vue +0 -329
- package/le-menu/index.js +0 -7
- package/le-menu/src/main.vue +0 -248
- package/le-report/index.js +0 -6
- package/le-report/src/main.vue +0 -1747
- package/le-report/src/rmixins.js +0 -30
- package/le-role/index.js +0 -7
- package/le-role/src/main.vue +0 -183
- package/le-role/src/sub.vue +0 -79
- package/le-role-user/index.js +0 -7
- package/le-role-user/src/main.vue +0 -160
- package/le-role-user/src/sub.vue +0 -90
- package/le-select/index.js +0 -7
- package/le-select/src/main.vue +0 -49
- package/le-select-multi/index.js +0 -6
- package/le-select-multi/src/main.vue +0 -816
- package/le-select-option/index.js +0 -7
- package/le-select-option/src/main.vue +0 -69
- package/le-select-search/index.js +0 -7
- package/le-select-search/src/main.vue +0 -46
- package/le-span/index.js +0 -7
- package/le-span/src/main.vue +0 -29
- package/le-table-edit/index.js +0 -6
- package/le-table-edit/src/main.vue +0 -689
- package/le-theme/common/vars.css +0 -131
- package/le-theme/iconfont/iconfont.css +0 -125
- package/le-theme/iconfont/iconfont.ttf +0 -0
- package/le-theme/iconfont/iconfont.woff +0 -0
- package/le-theme/iconfont/iconfont.woff2 +0 -0
- package/le-theme/index.js +0 -189
- package/le-theme/pages/index.css +0 -15
- package/le-upload/index.js +0 -7
- package/le-upload/src/main.vue +0 -134
- package/le-upload-table/index.js +0 -6
- package/le-upload-table/src/main.vue +0 -648
- package/le-url/index.js +0 -7
- package/le-url/src/main.vue +0 -27
- package/le-video/index.js +0 -7
- package/le-video/src/main.vue +0 -42
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="le-button-attach">
|
|
3
|
-
<el-upload
|
|
4
|
-
action=""
|
|
5
|
-
:http-request="uploadFile"
|
|
6
|
-
:before-upload="beforeUpload"
|
|
7
|
-
:show-file-list="false"
|
|
8
|
-
:multiple="multiple"
|
|
9
|
-
:accept="acceptTypes"
|
|
10
|
-
:disabled="disabled"
|
|
11
|
-
:class="{ 'is-disabled': disabled }"
|
|
12
|
-
>
|
|
13
|
-
<el-button
|
|
14
|
-
:type="type"
|
|
15
|
-
:size="size"
|
|
16
|
-
:icon="icon"
|
|
17
|
-
:disabled="disabled"
|
|
18
|
-
:loading="loading"
|
|
19
|
-
v-if="false"
|
|
20
|
-
>
|
|
21
|
-
{{ buttonText }}
|
|
22
|
-
</el-button>
|
|
23
|
-
</el-upload>
|
|
24
|
-
</div>
|
|
25
|
-
</template>
|
|
26
|
-
|
|
27
|
-
<script>
|
|
28
|
-
export default {
|
|
29
|
-
name: "le-button-attach",
|
|
30
|
-
props: {
|
|
31
|
-
// 是否允许多选
|
|
32
|
-
multiple: {
|
|
33
|
-
type: Boolean,
|
|
34
|
-
default: false,
|
|
35
|
-
},
|
|
36
|
-
// 按钮文字
|
|
37
|
-
buttonText: {
|
|
38
|
-
type: String,
|
|
39
|
-
default: "导入Excel",
|
|
40
|
-
},
|
|
41
|
-
// 按钮类型
|
|
42
|
-
type: {
|
|
43
|
-
type: String,
|
|
44
|
-
default: "primary",
|
|
45
|
-
},
|
|
46
|
-
// 按钮尺寸
|
|
47
|
-
size: {
|
|
48
|
-
type: String,
|
|
49
|
-
default: "small",
|
|
50
|
-
},
|
|
51
|
-
// 按钮图标
|
|
52
|
-
icon: {
|
|
53
|
-
type: String,
|
|
54
|
-
default: "el-icon-upload",
|
|
55
|
-
},
|
|
56
|
-
// 是否禁用
|
|
57
|
-
disabled: {
|
|
58
|
-
type: Boolean,
|
|
59
|
-
default: false,
|
|
60
|
-
},
|
|
61
|
-
// 文件大小限制(MB)
|
|
62
|
-
maxSize: {
|
|
63
|
-
type: Number,
|
|
64
|
-
default: 10,
|
|
65
|
-
},
|
|
66
|
-
// 上传函数,接收文件
|
|
67
|
-
uploadFunction: {
|
|
68
|
-
type: Function,
|
|
69
|
-
required: true,
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
data() {
|
|
73
|
-
return {
|
|
74
|
-
// 接受的Excel文件类型
|
|
75
|
-
acceptTypes: ".xlsx, .xls, .csv",
|
|
76
|
-
// 加载状态
|
|
77
|
-
loading: false,
|
|
78
|
-
// 上传中状态
|
|
79
|
-
uploading: false,
|
|
80
|
-
};
|
|
81
|
-
},
|
|
82
|
-
methods: {
|
|
83
|
-
/**
|
|
84
|
-
* 上传前校验
|
|
85
|
-
*/
|
|
86
|
-
beforeUpload(file) {
|
|
87
|
-
// 校验文件类型
|
|
88
|
-
const isExcel = /\.(xlsx|xls|csv)$/i.test(file.name);
|
|
89
|
-
if (!isExcel) {
|
|
90
|
-
this.$message.error("只能上传Excel文件(.xlsx, .xls, .csv)!");
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// 校验文件大小
|
|
95
|
-
const isLt10M = file.size / 1024 / 1024 < this.maxSize;
|
|
96
|
-
if (!isLt10M) {
|
|
97
|
-
this.$message.error(`上传文件大小不能超过 ${this.maxSize}MB!`);
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
this.loading = true;
|
|
102
|
-
|
|
103
|
-
// 触发上传前事件
|
|
104
|
-
this.$emit("before-upload", file);
|
|
105
|
-
|
|
106
|
-
return true;
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* 上传文件
|
|
111
|
-
*/
|
|
112
|
-
async uploadFile(param) {
|
|
113
|
-
if (this.uploading) {
|
|
114
|
-
this.$message.warning("正在上传中,请稍候...");
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
this.uploading = true;
|
|
119
|
-
|
|
120
|
-
try {
|
|
121
|
-
// 调用上传函数,只传入文件
|
|
122
|
-
const res = await this.uploadFunction(param.file);
|
|
123
|
-
|
|
124
|
-
// 上传成功处理
|
|
125
|
-
this.loading = false;
|
|
126
|
-
this.uploading = false;
|
|
127
|
-
|
|
128
|
-
// 触发成功事件
|
|
129
|
-
this.$emit("success", res.data, param.file);
|
|
130
|
-
} catch (error) {
|
|
131
|
-
this.loading = false;
|
|
132
|
-
this.uploading = false;
|
|
133
|
-
|
|
134
|
-
// 上传失败
|
|
135
|
-
const errorMessage =
|
|
136
|
-
error.message ||
|
|
137
|
-
error.response?.data?.info ||
|
|
138
|
-
error.response?.data?.message ||
|
|
139
|
-
"文件上传失败,请重试";
|
|
140
|
-
this.$message.error(errorMessage);
|
|
141
|
-
this.$emit("error", error, param.file);
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* 手动触发上传(用于外部调用)
|
|
147
|
-
*/
|
|
148
|
-
triggerUpload() {
|
|
149
|
-
this.$el.querySelector(".el-upload__input").click();
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
};
|
|
153
|
-
</script>
|
|
154
|
-
|
|
155
|
-
<style lang="scss" scoped>
|
|
156
|
-
.le-button-attach {
|
|
157
|
-
display: inline-block;
|
|
158
|
-
|
|
159
|
-
::v-deep .el-upload {
|
|
160
|
-
display: inline-block;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
&.is-disabled {
|
|
164
|
-
cursor: not-allowed;
|
|
165
|
-
|
|
166
|
-
::v-deep .el-upload {
|
|
167
|
-
cursor: not-allowed;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
</style>
|
package/le-button-msg/index.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-popconfirm
|
|
3
|
-
v-bind="$attrs"
|
|
4
|
-
v-on="$listeners"
|
|
5
|
-
:class="['customClass', $attrs.class]"
|
|
6
|
-
:title="title"
|
|
7
|
-
:id="id"
|
|
8
|
-
@confirm="click"
|
|
9
|
-
:v-permission="permission"
|
|
10
|
-
style="margin-left: 2px; margin-right: 2px"
|
|
11
|
-
v-if="disp"
|
|
12
|
-
>
|
|
13
|
-
<template #reference>
|
|
14
|
-
<le-button :type="type" :size="size" :text="text">
|
|
15
|
-
<slot></slot>
|
|
16
|
-
</le-button>
|
|
17
|
-
</template>
|
|
18
|
-
</el-popconfirm>
|
|
19
|
-
</template>
|
|
20
|
-
<script>
|
|
21
|
-
import LeButton from "../../le-button/index";
|
|
22
|
-
export default {
|
|
23
|
-
name: "le-button-msg",
|
|
24
|
-
components: { LeButton },
|
|
25
|
-
props: {
|
|
26
|
-
id: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: "",
|
|
29
|
-
},
|
|
30
|
-
type: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: "primary",
|
|
33
|
-
},
|
|
34
|
-
size: {
|
|
35
|
-
type: String,
|
|
36
|
-
default: "small",
|
|
37
|
-
},
|
|
38
|
-
permission: {
|
|
39
|
-
type: String,
|
|
40
|
-
default: "$route.params.btns",
|
|
41
|
-
},
|
|
42
|
-
text: {
|
|
43
|
-
type: String,
|
|
44
|
-
default: "",
|
|
45
|
-
},
|
|
46
|
-
title: {
|
|
47
|
-
type: String,
|
|
48
|
-
default: "该操作不可逆,确定删除?",
|
|
49
|
-
},
|
|
50
|
-
isDispSlot: {
|
|
51
|
-
type: Boolean,
|
|
52
|
-
default: false,
|
|
53
|
-
},
|
|
54
|
-
disp: {
|
|
55
|
-
type: Boolean,
|
|
56
|
-
default: true,
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
methods: {
|
|
60
|
-
click(param) {
|
|
61
|
-
this.$emit("click", param);
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
</script>
|
package/le-button-qr/index.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="le-button-qr">
|
|
3
|
-
<le-button text="显示二维码" @click="qrMake(btnAttr)"></le-button>
|
|
4
|
-
<le-dialog-container
|
|
5
|
-
title="二维码"
|
|
6
|
-
width="239px"
|
|
7
|
-
:showDialog="showQrMake"
|
|
8
|
-
:showFooter="true"
|
|
9
|
-
saveBtnText="下 载"
|
|
10
|
-
@close="closeQrMake"
|
|
11
|
-
@saveData="qrDownLoad"
|
|
12
|
-
>
|
|
13
|
-
<div id="qrcodemake" v-if="showQrMake"></div>
|
|
14
|
-
</le-dialog-container>
|
|
15
|
-
</div>
|
|
16
|
-
</template>
|
|
17
|
-
<script>
|
|
18
|
-
import QRCode from "qrcodejs2";
|
|
19
|
-
export default {
|
|
20
|
-
name: "le-button-qr",
|
|
21
|
-
props: {
|
|
22
|
-
qrCodeUrl: {
|
|
23
|
-
type: String,
|
|
24
|
-
default: "",
|
|
25
|
-
},
|
|
26
|
-
fileName: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: "二维码",
|
|
29
|
-
},
|
|
30
|
-
btnAttr: {
|
|
31
|
-
type: Object,
|
|
32
|
-
default: () => {
|
|
33
|
-
return {};
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
data() {
|
|
38
|
-
return {
|
|
39
|
-
showQrMake: false,
|
|
40
|
-
};
|
|
41
|
-
},
|
|
42
|
-
methods: {
|
|
43
|
-
closeQrMake() {
|
|
44
|
-
this.showQrMake = false;
|
|
45
|
-
},
|
|
46
|
-
qrMake() {
|
|
47
|
-
let temp = JSON.stringify(this.btnAttr);
|
|
48
|
-
if (!this.btnAttr || temp == "{}") {
|
|
49
|
-
this.$emit("qrMake", this.qrMakeCallBack);
|
|
50
|
-
} else {
|
|
51
|
-
this.$emit("qrMake", this.btnAttr, this.qrMakeCallBack);
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
qrMakeCallBack(res) {
|
|
55
|
-
if (res && res == "ok") {
|
|
56
|
-
this.showQrMake = true;
|
|
57
|
-
setTimeout(() => {
|
|
58
|
-
this.qrcode("qrcodemake");
|
|
59
|
-
}, 100);
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
qrcode(id) {
|
|
63
|
-
return new Promise((resolve, reject) => {
|
|
64
|
-
try {
|
|
65
|
-
new QRCode(id, {
|
|
66
|
-
width: 200,
|
|
67
|
-
height: 200,
|
|
68
|
-
text: this.qrCodeUrl,
|
|
69
|
-
colorDark: "#000",
|
|
70
|
-
colorLight: "#fff",
|
|
71
|
-
});
|
|
72
|
-
resolve();
|
|
73
|
-
} catch (e) {
|
|
74
|
-
reject("二维码生成错误:" + e);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
},
|
|
78
|
-
qrDownLoad() {
|
|
79
|
-
let myCanvas = document
|
|
80
|
-
.getElementById("qrcodemake")
|
|
81
|
-
.getElementsByTagName("canvas");
|
|
82
|
-
let a = document.createElement("a");
|
|
83
|
-
a.href = myCanvas[0].toDataURL("image/png");
|
|
84
|
-
a.download = this.fileName;
|
|
85
|
-
a.click();
|
|
86
|
-
this.$message.success("正在进行下载保存");
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
|
-
</script>
|
|
91
|
-
<style lang="scss" scoped>
|
|
92
|
-
.le-button-qr {
|
|
93
|
-
margin-right: 2px;
|
|
94
|
-
margin-left: 2px;
|
|
95
|
-
}
|
|
96
|
-
</style>
|
package/le-date-picker/index.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-date-picker
|
|
3
|
-
v-model="internalValue"
|
|
4
|
-
v-bind="$attrs"
|
|
5
|
-
v-on="$listeners"
|
|
6
|
-
:class="['customClass', $attrs.class]"
|
|
7
|
-
:style="$attrs.style"
|
|
8
|
-
:type="type"
|
|
9
|
-
></el-date-picker>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script>
|
|
13
|
-
export default {
|
|
14
|
-
name: "le-date-picker",
|
|
15
|
-
props: {
|
|
16
|
-
value: {
|
|
17
|
-
type: [Number, Date, String], // 可以接收时间戳、Date 对象或日期字符串
|
|
18
|
-
default: null,
|
|
19
|
-
},
|
|
20
|
-
type: {
|
|
21
|
-
type: String,
|
|
22
|
-
default: "date",
|
|
23
|
-
},
|
|
24
|
-
translateDate: {
|
|
25
|
-
type: Boolean,
|
|
26
|
-
default: false,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
data() {
|
|
30
|
-
return {
|
|
31
|
-
internalValue: this.convertValueToInternal(this.value), // 初始化内部值
|
|
32
|
-
};
|
|
33
|
-
},
|
|
34
|
-
watch: {
|
|
35
|
-
// value(newVal) {
|
|
36
|
-
// this.internalValue = this.convertValueToInternal(newVal);
|
|
37
|
-
// },
|
|
38
|
-
// internalValue(newVal) {
|
|
39
|
-
// const outputValue = this.convertValueToOutput(newVal);
|
|
40
|
-
// this.$emit("input", outputValue);
|
|
41
|
-
// },
|
|
42
|
-
},
|
|
43
|
-
methods: {
|
|
44
|
-
convertValueToInternal(value) {
|
|
45
|
-
if (this.translateDate && typeof value === "number") {
|
|
46
|
-
return new Date(value * 1000);
|
|
47
|
-
} else if (value instanceof Date) {
|
|
48
|
-
return value;
|
|
49
|
-
} else if (typeof value === "string" && !isNaN(Date.parse(value))) {
|
|
50
|
-
return new Date(value);
|
|
51
|
-
} else {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
convertValueToOutput(value) {
|
|
56
|
-
if (this.translateDate && value instanceof Date) {
|
|
57
|
-
return Math.floor(value.getTime() / 1000);
|
|
58
|
-
} else {
|
|
59
|
-
return value;
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
mounted() {
|
|
64
|
-
// 如果需要在组件挂载后执行某些操作,可以在这里添加代码。
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
</script>
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-date-picker
|
|
3
|
-
v-model="internalValue"
|
|
4
|
-
v-bind="$attrs"
|
|
5
|
-
v-on="$listeners"
|
|
6
|
-
:class="['customClass', $attrs.class]"
|
|
7
|
-
:style="$attrs.style"
|
|
8
|
-
:type="type"
|
|
9
|
-
></el-date-picker>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script>
|
|
13
|
-
export default {
|
|
14
|
-
name: "le-date-picker-auto",
|
|
15
|
-
props: {
|
|
16
|
-
value: {
|
|
17
|
-
type: [Number, Date, String],
|
|
18
|
-
default: null,
|
|
19
|
-
},
|
|
20
|
-
type: {
|
|
21
|
-
type: String,
|
|
22
|
-
default: "date",
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
data() {
|
|
26
|
-
return {
|
|
27
|
-
internalValue: this.convertValueToInternal(this.value),
|
|
28
|
-
};
|
|
29
|
-
},
|
|
30
|
-
watch: {
|
|
31
|
-
value(newVal) {
|
|
32
|
-
this.internalValue = this.convertValueToInternal(newVal);
|
|
33
|
-
},
|
|
34
|
-
internalValue(newVal) {
|
|
35
|
-
const outputValue = this.convertValueToOutput(newVal);
|
|
36
|
-
this.$emit("input", outputValue);
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
methods: {
|
|
40
|
-
isTimestampInSeconds(value) {
|
|
41
|
-
if (typeof value !== "number") return false;
|
|
42
|
-
|
|
43
|
-
// 秒级时间戳通常是10位数字(当前时间戳约16-17亿)
|
|
44
|
-
// 但为了更准确,我们检查时间戳是否在合理范围内
|
|
45
|
-
const currentSeconds = Math.floor(Date.now() / 1000);
|
|
46
|
-
const minReasonable = 0; // 1970-01-01
|
|
47
|
-
const maxReasonable = currentSeconds + 100 * 365 * 24 * 60 * 60; // 当前时间 + 100年
|
|
48
|
-
|
|
49
|
-
return value >= minReasonable && value <= maxReasonable;
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
isTimestampInMilliseconds(value) {
|
|
53
|
-
if (typeof value !== "number") return false;
|
|
54
|
-
|
|
55
|
-
// 毫秒级时间戳通常是13位数字
|
|
56
|
-
// 检查是否在合理的时间范围内
|
|
57
|
-
const currentMs = Date.now();
|
|
58
|
-
const minReasonable = 0; // 1970-01-01
|
|
59
|
-
const maxReasonable = currentMs + 100 * 365 * 24 * 60 * 60 * 1000; // 当前时间 + 100年
|
|
60
|
-
|
|
61
|
-
return value >= minReasonable && value <= maxReasonable;
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
convertValueToInternal(value) {
|
|
65
|
-
if (value === null || value === undefined || value === "") {
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// 如果是数字时间戳
|
|
70
|
-
if (typeof value === "number") {
|
|
71
|
-
if (this.isTimestampInSeconds(value)) {
|
|
72
|
-
// 确认是秒级时间戳,转换为毫秒
|
|
73
|
-
return new Date(value * 1000);
|
|
74
|
-
} else if (this.isTimestampInMilliseconds(value)) {
|
|
75
|
-
// 如果是毫秒级时间戳,也转换为秒再处理,确保一致性
|
|
76
|
-
const seconds = Math.floor(value / 1000);
|
|
77
|
-
return new Date(seconds * 1000);
|
|
78
|
-
} else {
|
|
79
|
-
// 无法识别的数字,尝试直接作为毫秒处理
|
|
80
|
-
console.warn("无法识别的时间戳格式,将尝试作为毫秒处理:", value);
|
|
81
|
-
return new Date(value);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
// 如果是 Date 对象
|
|
85
|
-
else if (value instanceof Date) {
|
|
86
|
-
return value;
|
|
87
|
-
}
|
|
88
|
-
// 如果是字符串日期
|
|
89
|
-
else if (typeof value === "string") {
|
|
90
|
-
const parsedDate = new Date(value);
|
|
91
|
-
return isNaN(parsedDate.getTime()) ? null : parsedDate;
|
|
92
|
-
}
|
|
93
|
-
// 其他情况返回 null
|
|
94
|
-
else {
|
|
95
|
-
console.warn("无法处理的值类型:", typeof value, value);
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
convertValueToOutput(value) {
|
|
101
|
-
if (value === null || value === undefined || value === "") {
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// 如果是 Date 对象,转换为时间戳(秒)
|
|
106
|
-
if (value instanceof Date) {
|
|
107
|
-
return Math.floor(value.getTime() / 1000);
|
|
108
|
-
}
|
|
109
|
-
// 如果是数字,根据位数判断是否需要转换
|
|
110
|
-
else if (typeof value === "number") {
|
|
111
|
-
if (this.isTimestampInSeconds(value)) {
|
|
112
|
-
return value; // 已经是秒,直接返回
|
|
113
|
-
} else if (this.isTimestampInMilliseconds(value)) {
|
|
114
|
-
return Math.floor(value / 1000); // 毫秒转秒
|
|
115
|
-
} else {
|
|
116
|
-
console.warn("无法识别的时间戳格式,将尝试作为秒处理:", value);
|
|
117
|
-
return value;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
// 其他情况返回 null
|
|
121
|
-
else {
|
|
122
|
-
console.warn("无法输出的值类型:", typeof value, value);
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
mounted() {
|
|
128
|
-
// 如果需要在组件挂载后执行某些操作,可以在这里添加代码。
|
|
129
|
-
},
|
|
130
|
-
};
|
|
131
|
-
</script>
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-dialog :width="width" :title="title" :visible.sync="dialogShow" :close-on-click-modal="closeMode"
|
|
3
|
-
:show-close="showCloseBtnTop" append-to-body @close="closeDialog" v-el-drag-dialog>
|
|
4
|
-
<slot v-if="dialogShow" />
|
|
5
|
-
<div slot="footer" v-if="showFooter" class="dialog-footer">
|
|
6
|
-
<template>
|
|
7
|
-
<slot name="le-footer"></slot>
|
|
8
|
-
<le-button type="primary" v-if="showSaveBtn" @click="saveData">{{
|
|
9
|
-
saveBtnText
|
|
10
|
-
}}</le-button>
|
|
11
|
-
<le-button type="info" v-if="showCloseBtn" @click="closeDialog">关闭</le-button>
|
|
12
|
-
</template>
|
|
13
|
-
</div>
|
|
14
|
-
</el-dialog>
|
|
15
|
-
</template>
|
|
16
|
-
<script>
|
|
17
|
-
export default {
|
|
18
|
-
name: "le-dialog-container",
|
|
19
|
-
props: {
|
|
20
|
-
showDialog: {
|
|
21
|
-
type: Boolean,
|
|
22
|
-
default: false,
|
|
23
|
-
},
|
|
24
|
-
width: {
|
|
25
|
-
type: String,
|
|
26
|
-
default: "60%",
|
|
27
|
-
},
|
|
28
|
-
title: {
|
|
29
|
-
type: String,
|
|
30
|
-
default: "商品详情",
|
|
31
|
-
},
|
|
32
|
-
closeMode: {
|
|
33
|
-
type: Boolean,
|
|
34
|
-
default: false,
|
|
35
|
-
},
|
|
36
|
-
showFooter: {
|
|
37
|
-
type: Boolean,
|
|
38
|
-
default: false,
|
|
39
|
-
},
|
|
40
|
-
showSaveBtn: {
|
|
41
|
-
type: Boolean,
|
|
42
|
-
default: true,
|
|
43
|
-
},
|
|
44
|
-
showCloseBtn: {
|
|
45
|
-
type: Boolean,
|
|
46
|
-
default: true,
|
|
47
|
-
},
|
|
48
|
-
showCloseBtnTop: {
|
|
49
|
-
type: Boolean,
|
|
50
|
-
default: false,
|
|
51
|
-
},
|
|
52
|
-
saveBtnText: {
|
|
53
|
-
type: String,
|
|
54
|
-
default: "确 定",
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
data() {
|
|
58
|
-
return {};
|
|
59
|
-
},
|
|
60
|
-
computed: {
|
|
61
|
-
dialogShow: {
|
|
62
|
-
get() {
|
|
63
|
-
return this.showDialog;
|
|
64
|
-
},
|
|
65
|
-
set(newValue) {
|
|
66
|
-
// this.$emit("close", newValue);
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
mounted() { },
|
|
71
|
-
methods: {
|
|
72
|
-
closeDialog(param) {
|
|
73
|
-
this.$emit("close", param);
|
|
74
|
-
},
|
|
75
|
-
saveData() {
|
|
76
|
-
this.$emit("saveData");
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
</script>
|
package/le-form/index.js
DELETED
package/le-form/src/main.vue
DELETED
package/le-form-item/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<le-form-item v-bind="$attrs" v-on="$listeners" :style="$attrs.style">
|
|
3
|
-
<slot></slot>
|
|
4
|
-
</le-form-item>
|
|
5
|
-
</template>
|
|
6
|
-
<script>
|
|
7
|
-
export default {
|
|
8
|
-
name: "le-form-item",
|
|
9
|
-
inheritAttrs: false,
|
|
10
|
-
props: {},
|
|
11
|
-
methods: {},
|
|
12
|
-
};
|
|
13
|
-
</script>
|