diff --git a/build/config/rules.ts b/build/config/rules.ts
index b65df7a..f2872f0 100644
--- a/build/config/rules.ts
+++ b/build/config/rules.ts
@@ -72,6 +72,12 @@ export default [
},
{
test: ["date"],
+ table: {
+ name: "cl-date",
+ props: {
+ format: "YYYY-MM-DD"
+ }
+ },
form: {
name: "el-date-picker",
props: {
@@ -82,6 +88,12 @@ export default [
},
{
test: ["dates", "dateRange", "dateScope"],
+ table: {
+ name: "cl-date",
+ props: {
+ format: "YYYY-MM-DD"
+ }
+ },
form: {
component: {
name: "el-date-picker",
@@ -109,7 +121,8 @@ export default [
name: "el-date-picker",
props: {
type: "datetimerange",
- valueFormat: "YYYY-MM-DD HH:mm:ss"
+ valueFormat: "YYYY-MM-DD HH:mm:ss",
+ defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 59, 59)]
}
}
}
diff --git a/build/plugins/cool.ts b/build/plugins/cool.ts
index 9d7acb1..b19bdb5 100644
--- a/build/plugins/cool.ts
+++ b/build/plugins/cool.ts
@@ -34,9 +34,6 @@ const colors = [
// 组件处理器
const handler = {
- // 临时变量
- d: {},
-
// 单选
dict({ comment }) {
const [label, ...arr] = comment.split(" ");
@@ -207,7 +204,8 @@ function datetimeMerge({ columns, item }: any) {
name: "el-date-picker",
props: {
type: key == "time" ? "datetimerange" : "daterange",
- valueFormat: "time" ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD 00:00:00"
+ valueFormat: "time" ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD 00:00:00",
+ defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 59, 59)]
}
};
}
diff --git a/src/cool/modules/base/components/date/index.vue b/src/cool/modules/base/components/date/index.vue
new file mode 100644
index 0000000..a6bb0b2
--- /dev/null
+++ b/src/cool/modules/base/components/date/index.vue
@@ -0,0 +1,30 @@
+
+ {{ value }}
+
+
+
diff --git a/src/cool/modules/demo/components/crud/table.vue b/src/cool/modules/demo/components/crud/table.vue
index cff4103..e26dad3 100644
--- a/src/cool/modules/demo/components/crud/table.vue
+++ b/src/cool/modules/demo/components/crud/table.vue
@@ -63,7 +63,13 @@ export default defineComponent({
{
label: "创建时间",
prop: "createTime",
- minWidth: 150
+ minWidth: 150,
+ component: {
+ name: "cl-date",
+ props: {
+ format: "YYYY-MM-DD"
+ }
+ }
},
{
label: "操作",
diff --git a/src/cool/modules/demo/components/crud/upsert.vue b/src/cool/modules/demo/components/crud/upsert.vue
index c92dc0e..389e114 100644
--- a/src/cool/modules/demo/components/crud/upsert.vue
+++ b/src/cool/modules/demo/components/crud/upsert.vue
@@ -48,6 +48,22 @@ export default defineComponent({
component: {
name: "el-switch"
}
+ },
+ {
+ label: "时间",
+ prop: "time",
+ hook: "datetimeRange",
+ component: {
+ name: "el-date-picker",
+ props: {
+ type: "datetimerange",
+ valueFormat: "YYYY-MM-DD HH:mm:ss",
+ defaultTime: [
+ new Date(2000, 1, 1, 0, 0, 0),
+ new Date(2000, 1, 1, 23, 59, 59)
+ ]
+ }
+ }
}
]);
diff --git a/src/cool/modules/demo/utils/service.ts b/src/cool/modules/demo/utils/service.ts
index 716ccff..9165e07 100644
--- a/src/cool/modules/demo/utils/service.ts
+++ b/src/cool/modules/demo/utils/service.ts
@@ -6,41 +6,36 @@ export const UserList = [
{
id: 1,
name: "刘一",
- createTime: "2019年09月02日",
+ createTime: "2019-09-02 12:00:00",
price: 75.99,
status: 1,
- urls: "https://images.quanjing.com/ojo003/thu/pe0082640.jpg,https://images.quanjing.com/rad005/thu/rad600-02347621.jpg",
hook: "1,2"
},
{
id: 2,
name: "陈二",
- createTime: "2019年09月05日",
+ createTime: "2019-09-05",
price: 242.1,
- urls: [
- "https://images.quanjing.com/rad005/thu/rad600-02347621.jpg",
- "https://images.quanjing.com/ojo003/thu/pe0082640.jpg"
- ],
status: 2
},
{
id: 3,
name: "张三",
- createTime: "2019年09月12日",
+ createTime: "2019-09-12",
price: 74.11,
status: 3
},
{
id: 4,
name: "李四",
- createTime: "2019年09月13日",
+ createTime: "2019-09-13",
price: 276.64,
status: 4
},
{
id: 5,
name: "王五",
- createTime: "2019年09月18日",
+ createTime: "2019-09-18",
price: 160.23,
status: 5
}
@@ -92,7 +87,7 @@ export const TestService = {
UserList.push({
...d,
id: id++,
- createTime: dayjs().format("YYYY年MM月DD日")
+ createTime: dayjs().format("YYYY-MM-DD日")
});
return Promise.resolve();
},