@zhijiancloud/bpm 0.0.1 → 0.0.3
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/CHANGELOG.md +23 -0
- package/README.md +49 -5
- package/components/.DS_Store +0 -0
- package/components/css/bpmMulFile.less +54 -0
- package/components/css/bpmSelectCheckItem.less +4 -0
- package/components/css/bpmSelectFromForm.less +10 -0
- package/components/css/bpmSelectFromId.less +33 -0
- package/components/css/bpmText.less +49 -0
- package/components/css/demo2.less +3 -0
- package/components/css/index.less +3 -0
- package/components/lib/bpmDateTime/index.js +7 -0
- package/components/lib/bpmDateTime/src/main.vue +82 -0
- package/components/lib/bpmDateTime/src/part/editor.vue +124 -0
- package/components/lib/bpmDateTime/src/part/reader.vue +55 -0
- package/components/lib/bpmField/index.js +7 -0
- package/components/lib/bpmField/src/main.vue +173 -0
- package/components/lib/bpmMulFile/index.js +7 -0
- package/components/lib/bpmMulFile/src/main.vue +86 -0
- package/components/lib/bpmMulFile/src/part/editor.vue +433 -0
- package/components/lib/bpmMulFile/src/part/lib/compressImageUtils.js +226 -0
- package/components/lib/bpmMulFile/src/part/lib/utils.js +281 -0
- package/components/lib/bpmMulFile/src/part/reader.vue +303 -0
- package/components/lib/bpmMulImage/index.js +7 -0
- package/components/lib/bpmMulImage/src/main.vue +87 -0
- package/components/lib/bpmMulImage/src/part/editor.vue +439 -0
- package/components/lib/bpmMulImage/src/part/lib/compressImageUtils.js +226 -0
- package/components/lib/bpmMulImage/src/part/lib/utils.js +281 -0
- package/components/lib/bpmMulImage/src/part/reader.vue +171 -0
- package/components/lib/bpmNumber/index.js +7 -0
- package/components/lib/bpmNumber/src/main.vue +83 -0
- package/components/lib/bpmNumber/src/part/editor.vue +48 -0
- package/components/lib/bpmNumber/src/part/reader.vue +7 -0
- package/components/lib/bpmSelect/index.js +7 -0
- package/components/lib/bpmSelect/src/main.vue +90 -0
- package/components/lib/bpmSelect/src/part/editor.vue +75 -0
- package/components/lib/bpmSelect/src/part/reader.vue +44 -0
- package/components/lib/bpmSelectCheckItem/index.js +7 -0
- package/components/lib/bpmSelectCheckItem/src/main.vue +101 -0
- package/components/lib/bpmSelectCheckItem/src/part/editor.vue +106 -0
- package/components/lib/bpmSelectCheckItem/src/part/reader.vue +7 -0
- package/components/lib/bpmSelectFromField/index.js +7 -0
- package/components/lib/bpmSelectFromField/src/main.vue +97 -0
- package/components/lib/bpmSelectFromField/src/part/editor.vue +82 -0
- package/components/lib/bpmSelectFromField/src/part/reader.vue +7 -0
- package/components/lib/bpmSelectFromForm/index.js +7 -0
- package/components/lib/bpmSelectFromForm/src/main.vue +103 -0
- package/components/lib/bpmSelectFromForm/src/part/editor.vue +181 -0
- package/components/lib/bpmSelectFromForm/src/part/reader.vue +7 -0
- package/components/lib/bpmSelectFromId/index.js +7 -0
- package/components/lib/bpmSelectFromId/src/main.vue +102 -0
- package/components/lib/bpmSelectFromId/src/part/editor.vue +260 -0
- package/components/lib/bpmSelectFromId/src/part/reader.vue +7 -0
- package/components/lib/bpmSubForm/index.js +7 -0
- package/components/lib/bpmSubForm/src/main.vue +181 -0
- package/components/lib/bpmText/index.ts +13 -0
- package/components/lib/bpmText/src/main.vue +87 -0
- package/components/lib/bpmText/src/part/editor.vue +104 -0
- package/components/lib/bpmText/src/part/reader.vue +7 -0
- package/components/lib/bpmTime/index.js +7 -0
- package/components/lib/bpmTime/src/main.vue +83 -0
- package/components/lib/bpmTime/src/part/editor.vue +54 -0
- package/components/lib/bpmTime/src/part/reader.vue +24 -0
- package/components/lib/demo/index.js +7 -0
- package/components/{bpm2/lib → lib}/demo/src/main.vue +1 -1
- package/components/lib/demo2/index.js +7 -0
- package/components/lib/demo2/src/main.vue +11 -0
- package/components/lib/field-const.js +468 -0
- package/components/lib/index.ts +52 -0
- package/components/lib/mixins/RemoteSelectReader.vue +49 -0
- package/components/lib/mixins/TextReader.vue +22 -0
- package/components/lib/net.js +21 -0
- package/components/lib/utils.js +89 -0
- package/components/sfc.d.ts +27 -0
- package/dist/06c52960c6d2c0312a3e.woff +1 -0
- package/dist/0db1520f47986b6c755a.svg +1 -0
- package/dist/1e59d2330b4c6deb84b340635ed36249.ttf +0 -0
- package/dist/20fd1704ea223900efa9fd4e869efb08.woff2 +0 -0
- package/dist/4a2487b5cc6987c4f1de.woff2 +1 -0
- package/dist/4c6f1cd9993ba8a53b8e.ttf +1 -0
- package/dist/8b43027f47b20503057dfbbaa9401fef.eot +0 -0
- package/dist/bpmDateTime.umd.js +1 -0
- package/dist/bpmDateTime.umd.js.LICENSE.txt +38 -0
- package/dist/bpmField.umd.js +2 -0
- package/dist/bpmField.umd.js.LICENSE.txt +9 -0
- package/dist/bpmMulFile.umd.js +2 -0
- package/dist/bpmMulFile.umd.js.LICENSE.txt +9 -0
- package/dist/bpmMulImage.umd.js +2 -0
- package/dist/bpmMulImage.umd.js.LICENSE.txt +9 -0
- package/dist/bpmNumber.umd.js +1 -0
- package/dist/bpmNumber.umd.js.LICENSE.txt +38 -0
- package/dist/bpmSelect.umd.js +1 -0
- package/dist/bpmSelect.umd.js.LICENSE.txt +38 -0
- package/dist/bpmSelectCheckItem.umd.js +1 -0
- package/dist/bpmSelectFromField.umd.js +1 -0
- package/dist/bpmSelectFromForm.umd.js +1 -0
- package/dist/bpmSelectFromId.umd.js +1 -0
- package/dist/bpmSelectUser.umd.js +1 -0
- package/dist/bpmSubForm.umd.js +1 -0
- package/dist/bpmText.umd.js +1 -0
- package/dist/bpmText.umd.js.LICENSE.txt +38 -0
- package/dist/bpmTime.umd.js +1 -0
- package/dist/bpmTime.umd.js.LICENSE.txt +38 -0
- package/dist/c1e38fd9e0e74ba58f7a2b77ef29fdd3.svg +2671 -0
- package/dist/css/bpmMulFile.css +1 -0
- package/dist/css/bpmSelectCheckItem.css +1 -0
- package/dist/css/bpmSelectFromForm.css +1 -0
- package/dist/css/bpmSelectFromId.css +1 -0
- package/dist/css/bpmText.css +1 -0
- package/dist/css/demo2.css +1 -0
- package/dist/css/index.css +1 -0
- package/dist/demo.umd.js +1 -0
- package/dist/demo2.umd.js +1 -0
- package/dist/e5c0c62d732823225aaa.eot +1 -0
- package/dist/f691f37e57f04c152e2315ab7dbad881.woff +0 -0
- package/dist/index.umd.js +2 -0
- package/dist/index.umd.js.LICENSE.txt +9 -0
- package/package.json +66 -16
- package/components/bpm2/.DS_Store +0 -0
- package/components/bpm2/lib/demo/index.js +0 -18
- package/dist/favicon.ico +0 -0
- package/dist/index.html +0 -1
- package/dist/js/chunk-vendors.fad77a0a.js +0 -2
- package/dist/js/chunk-vendors.fad77a0a.js.map +0 -1
- package/dist/js/index.655afe85.js +0 -2
- package/dist/js/index.655afe85.js.map +0 -1
- package/dist/lib.umd.js +0 -1
- /package/components/{bpm2/css → css}/demo.less +0 -0
- /package/dist/css/{index.40a99d5f.css → demo.css} +0 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
## 202311 首次支持表单字段组件
|
|
4
|
+
|
|
5
|
+
表单字段:
|
|
6
|
+
|
|
7
|
+
- bpmField: 表单字段组件,组件内自行判别对应实现
|
|
8
|
+
- bpmText: Text, TextArea, SerialNumber
|
|
9
|
+
- BpmNumber: Number
|
|
10
|
+
- bpmDateTime: Date, DateTime
|
|
11
|
+
- bpmTime: Time
|
|
12
|
+
- bpmSelect: Select, MulSelect, Status
|
|
13
|
+
- bpmSelectCheckItem: SelectCheckItem, MulSelectCheckItem, SelectSort, MulSelectSort
|
|
14
|
+
- bpmSelectFromField: SelectFromField, MulSelectFromField, SelectUser, MulSelectUser, SelectUrUser, MulSelectUrUser, SelectPartner, MulSelectPartner, SelectProject, MulSelectProject, SelectOrg, MulSelectOrg
|
|
15
|
+
- bpmSelectFromForm: SelectFromForm, MulSelectFromForm
|
|
16
|
+
- bpmSelectFromId: SelectFromId, MulSelectFromId
|
|
17
|
+
- bpmMulImage: MulImage, Signature
|
|
18
|
+
- bpmMulFile: MulFile
|
|
19
|
+
- bpmSubForm: SubForm, XSubForm, OrderSubForm
|
|
20
|
+
|
|
21
|
+
consts字段常量,前端使用:
|
|
22
|
+
|
|
23
|
+
- bpmConsts.FORM_FIELDS_MAP
|
package/README.md
CHANGED
|
@@ -1,24 +1,68 @@
|
|
|
1
|
-
#
|
|
1
|
+
# zhijiancloud-ui-bpm
|
|
2
2
|
|
|
3
3
|
## Project setup
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
```bash
|
|
5
6
|
yarn install
|
|
6
7
|
```
|
|
7
8
|
|
|
8
9
|
### Compiles and hot-reloads for development
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
```bash
|
|
10
12
|
yarn serve
|
|
11
13
|
```
|
|
12
14
|
|
|
15
|
+
开发模式默认入口为examples/main.ts, 开发模式走的vue-cli,见package.json
|
|
16
|
+
|
|
13
17
|
### Compiles and minifies for production
|
|
14
|
-
|
|
18
|
+
|
|
19
|
+
```bash
|
|
15
20
|
yarn build
|
|
16
21
|
```
|
|
17
22
|
|
|
23
|
+
build是build组件库,编译走的是webpack和gulp, 见package.json
|
|
24
|
+
|
|
18
25
|
### Lints and fixes files
|
|
19
|
-
|
|
26
|
+
|
|
27
|
+
```bash
|
|
20
28
|
yarn lint
|
|
21
29
|
```
|
|
22
30
|
|
|
31
|
+
### 文档vuepress
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
yarn docs:dev
|
|
35
|
+
yarn docs:build
|
|
36
|
+
```
|
|
37
|
+
|
|
23
38
|
### Customize configuration
|
|
39
|
+
|
|
24
40
|
See [Configuration Reference](https://cli.vuejs.org/config/).
|
|
41
|
+
|
|
42
|
+
## eslint
|
|
43
|
+
|
|
44
|
+
项目已加入了eslint代码检查,具体规则配置在 package.json - eslintConfig, 具体规则要修改,见eslint文档
|
|
45
|
+
|
|
46
|
+
主动执行eslint代码检查:`yarn lint`
|
|
47
|
+
|
|
48
|
+
### 开发时代码检查
|
|
49
|
+
|
|
50
|
+
默认代码保存时不检查,如需要开启,可在vue.config.js修改:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# vue.config.js
|
|
54
|
+
# https://cli.vuejs.org/zh/config/#lintonsave
|
|
55
|
+
# 当前为false
|
|
56
|
+
lintOnSave: true
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 提交代码前检查代码
|
|
60
|
+
|
|
61
|
+
由于并不会每次记得主动运行代码检查,项目中添加了commit代码时自动检查有更改的文件。
|
|
62
|
+
借助vue-cli内置的yorkie, 以及lint-staged实现,具体可见:[git hooks](https://cli.vuejs.org/zh/guide/cli-service.html#git-hook), 相关内容可自行搜索git hooks, husky, yorkie, eslint, lint-stage等内容了解。
|
|
63
|
+
|
|
64
|
+
[lint-stage](https://www.npmjs.com/package/lint-staged), 当前装的版本是13.0.0, 见其版本说明,新版本14,15对node的版本比较高要求,13.0.0则要求node版本至少为:14.13.1, or 16.0.0
|
|
65
|
+
|
|
66
|
+
每次commit代码时,会对有更改的文件跑lint检查,以保证代码的规范性。
|
|
67
|
+
|
|
68
|
+
如极个别特殊情况,需要跳过git hooks检查,可:`git commit -m 'xxx' --no-verify`
|
package/components/.DS_Store
CHANGED
|
Binary file
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
.bpm-mul-file-reader, .bpm-mul-file-edit, .bpm-mul-image-reader, .bpm-mul-image-edit{
|
|
2
|
+
.file-box{
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
margin-top: 10px;
|
|
5
|
+
max-width: 360px;
|
|
6
|
+
padding: 0 6px;
|
|
7
|
+
display: flex;
|
|
8
|
+
&:hover{
|
|
9
|
+
background: #EFF2F7;
|
|
10
|
+
border-radius: 4px;
|
|
11
|
+
}
|
|
12
|
+
&>*{
|
|
13
|
+
float: left;
|
|
14
|
+
}
|
|
15
|
+
.file-content{
|
|
16
|
+
height: 20px;
|
|
17
|
+
margin-top: 5px;
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
.file-link{
|
|
21
|
+
margin-top: 5px;
|
|
22
|
+
margin-left: 5px;
|
|
23
|
+
max-width: 266px;
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
text-overflow: ellipsis;
|
|
26
|
+
white-space: nowrap;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
.file-remove, .operation-box{
|
|
30
|
+
float: right;
|
|
31
|
+
font-weight: 400;
|
|
32
|
+
font-size: 12px;
|
|
33
|
+
color: #246AE3;
|
|
34
|
+
line-height: 14px;
|
|
35
|
+
margin: 10px 0 0 20px;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
.bpm-mul-file-reader, .bpm-mul-image-reader{
|
|
42
|
+
.text-faded{
|
|
43
|
+
margin-top: 4px;
|
|
44
|
+
}
|
|
45
|
+
.file-icon{
|
|
46
|
+
height: 20px;
|
|
47
|
+
margin-top: 4px;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
img{
|
|
51
|
+
display: block;
|
|
52
|
+
height: 100%;
|
|
53
|
+
width: auto;
|
|
54
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
.select-box{
|
|
3
|
+
display: flex;
|
|
4
|
+
.select-box-left{
|
|
5
|
+
width: 200px;
|
|
6
|
+
.title{
|
|
7
|
+
margin-bottom: 10px;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
.select-box-right{
|
|
11
|
+
flex: 1;
|
|
12
|
+
padding-left: 20px;
|
|
13
|
+
.title{
|
|
14
|
+
margin-bottom: 10px;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
.select-app,.select-app-item, .select-form, .select-form-item{
|
|
19
|
+
list-style: none;
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0;
|
|
22
|
+
margin-bottom: 10px;
|
|
23
|
+
}
|
|
24
|
+
.select-app, .select-form{
|
|
25
|
+
padding: 10px;
|
|
26
|
+
.select-app-item{
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.select-app-item.active{
|
|
32
|
+
color: #409EFF;
|
|
33
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
.bpm-text-edit{
|
|
3
|
+
.prefab-words {
|
|
4
|
+
padding-top: 10px;
|
|
5
|
+
ul,
|
|
6
|
+
li {
|
|
7
|
+
margin: 0;
|
|
8
|
+
padding: 0;
|
|
9
|
+
list-style: none;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
ul {
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
margin-top: 5px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
li {
|
|
18
|
+
float: left;
|
|
19
|
+
min-height: 28px;
|
|
20
|
+
line-height: 28px;
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
min-width: 50px;
|
|
23
|
+
font-size: 14px;
|
|
24
|
+
padding: 0 10px;
|
|
25
|
+
margin-right: 10px;
|
|
26
|
+
border: 1px solid #DCDCDC;
|
|
27
|
+
border-radius: 100px;
|
|
28
|
+
color: #666666;
|
|
29
|
+
text-align: center;
|
|
30
|
+
margin-bottom: 5px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
li.active {
|
|
34
|
+
background: #1EAAD0;
|
|
35
|
+
border: 1px solid #1EAAD0;
|
|
36
|
+
color: #fff;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
.bpm-text-view.table-text-view {
|
|
43
|
+
word-break: break-all;
|
|
44
|
+
text-overflow: ellipsis;
|
|
45
|
+
display: -webkit-box;
|
|
46
|
+
-webkit-box-orient: vertical;
|
|
47
|
+
-webkit-line-clamp: 3;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
class="bpm-select"
|
|
4
|
+
v-model="curVal"
|
|
5
|
+
:is="curComponent"
|
|
6
|
+
:fieldConf="fieldConf"
|
|
7
|
+
:row="row"
|
|
8
|
+
:mode="mode"
|
|
9
|
+
:uiType="uiType"
|
|
10
|
+
v-bind="$attrs"
|
|
11
|
+
v-on="$listeners"
|
|
12
|
+
>
|
|
13
|
+
</component>
|
|
14
|
+
</template>
|
|
15
|
+
<script>
|
|
16
|
+
import editorComponent from "./part/editor.vue";
|
|
17
|
+
import readerComponent from "./part/reader.vue";
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
name: "BpmDateTime",
|
|
21
|
+
components: {
|
|
22
|
+
editorComponent,
|
|
23
|
+
readerComponent
|
|
24
|
+
},
|
|
25
|
+
props: {
|
|
26
|
+
value: {
|
|
27
|
+
type: [String, Number],
|
|
28
|
+
|
|
29
|
+
},
|
|
30
|
+
fieldConf: {
|
|
31
|
+
type: Object,
|
|
32
|
+
default() {
|
|
33
|
+
return {};
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
row: {
|
|
37
|
+
type: Object,
|
|
38
|
+
default() {
|
|
39
|
+
return {};
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
mode: {
|
|
43
|
+
type: String,
|
|
44
|
+
default() {
|
|
45
|
+
return "view";
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
uiType: {
|
|
49
|
+
type: String,
|
|
50
|
+
default() {
|
|
51
|
+
return "default";
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
computed: {
|
|
56
|
+
curComponent() {
|
|
57
|
+
if (this.mode == "view") {
|
|
58
|
+
return readerComponent;
|
|
59
|
+
} else {
|
|
60
|
+
return editorComponent;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
data() {
|
|
65
|
+
return {
|
|
66
|
+
curVal: "",
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
watch: {
|
|
70
|
+
curVal(val) {
|
|
71
|
+
this.$emit("input", val);
|
|
72
|
+
this.$emit("change", val);
|
|
73
|
+
},
|
|
74
|
+
value() {
|
|
75
|
+
this.curVal = this.value;
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
mounted() {
|
|
79
|
+
this.curVal = this.value;
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
</script>
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="bpm-date-time-edit">
|
|
3
|
+
<el-date-picker
|
|
4
|
+
v-model="curVal"
|
|
5
|
+
:format="format"
|
|
6
|
+
:picker-options="pickerOptions"
|
|
7
|
+
:value-format="checkFormat"
|
|
8
|
+
:type="type"
|
|
9
|
+
:default-value="defaultVal"
|
|
10
|
+
>
|
|
11
|
+
</el-date-picker>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
import _ from "lodash";
|
|
18
|
+
|
|
19
|
+
import Vue from "vue";
|
|
20
|
+
|
|
21
|
+
import { DatePicker } from "element-ui";
|
|
22
|
+
|
|
23
|
+
Vue.use(DatePicker);
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
data() {
|
|
27
|
+
let that = this;
|
|
28
|
+
return {
|
|
29
|
+
curVal: "",
|
|
30
|
+
pickerOptions: {
|
|
31
|
+
disabledDate(date) {
|
|
32
|
+
return date.getTime() <= that.max && date.getTime() >= that.min;
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
props: ["value", "fieldConf", "row"],
|
|
38
|
+
watch: {
|
|
39
|
+
curVal(val) {
|
|
40
|
+
console.log("val", val, this.checkFormat)
|
|
41
|
+
this.$emit("input", val);
|
|
42
|
+
},
|
|
43
|
+
value(){
|
|
44
|
+
this.curVal = this.value
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
computed: {
|
|
48
|
+
type() {
|
|
49
|
+
let type = _.toLower(_.get(this.fieldConf, "type"));
|
|
50
|
+
return this.isMonth ? "month" : type;
|
|
51
|
+
},
|
|
52
|
+
isMonth() {
|
|
53
|
+
let rangeType = _.get(this.fieldConf, "range_type");
|
|
54
|
+
return rangeType == "C1M";
|
|
55
|
+
},
|
|
56
|
+
format() {
|
|
57
|
+
let format = _.get(this.fieldConf, "view.format")
|
|
58
|
+
if(format){
|
|
59
|
+
format = format.replaceAll('Y', 'y')
|
|
60
|
+
format = format.replaceAll('D', 'd')
|
|
61
|
+
}
|
|
62
|
+
return format
|
|
63
|
+
},
|
|
64
|
+
max() {
|
|
65
|
+
let date = this.analyzeLimit("tmax");
|
|
66
|
+
return date;
|
|
67
|
+
},
|
|
68
|
+
min() {
|
|
69
|
+
let date = this.analyzeLimit("tmin");
|
|
70
|
+
return date;
|
|
71
|
+
},
|
|
72
|
+
checkFormat() {
|
|
73
|
+
let format = _.get(this.fieldConf, "check.format")
|
|
74
|
+
if(format){
|
|
75
|
+
format = format.replaceAll('Y', 'y')
|
|
76
|
+
format = format.replaceAll('D', 'd')
|
|
77
|
+
}
|
|
78
|
+
return format;
|
|
79
|
+
},
|
|
80
|
+
defaultVal() {
|
|
81
|
+
return new Date();
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
mounted() {
|
|
85
|
+
this.curVal = this.value;
|
|
86
|
+
},
|
|
87
|
+
methods: {
|
|
88
|
+
analyzeLimit(type) {
|
|
89
|
+
let data = _.get(this.fieldConf, `check.${type}`);
|
|
90
|
+
if (!data) return;
|
|
91
|
+
let result = null;
|
|
92
|
+
let now = new Date().getTime();
|
|
93
|
+
switch (data.type) {
|
|
94
|
+
case "LimitDateOffset":
|
|
95
|
+
var delta = data.offset_days;
|
|
96
|
+
result = this.deltaToDate(now, delta);
|
|
97
|
+
break;
|
|
98
|
+
case "LimitDateOffsetByField":
|
|
99
|
+
var delta_1 = data.offset_days;
|
|
100
|
+
var value = this.value;
|
|
101
|
+
if (!value) return 0;
|
|
102
|
+
result = this.deltaToDate(value, delta_1);
|
|
103
|
+
break;
|
|
104
|
+
case "LimitDateByValue":
|
|
105
|
+
var date = data.value;
|
|
106
|
+
date = new Date(date).getTime();
|
|
107
|
+
this.deltaToDate(date, 0);
|
|
108
|
+
break;
|
|
109
|
+
default:
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
return result;
|
|
113
|
+
},
|
|
114
|
+
deltaToDate(date, delta) {
|
|
115
|
+
// 获得 和今天的偏差天数对应的 date
|
|
116
|
+
date = new Date(date)
|
|
117
|
+
let days = date.getDate() + delta
|
|
118
|
+
date.setDate(days)
|
|
119
|
+
return date
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
</script>
|
|
124
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span :title="dateTimeStr">{{ dateTimeStr }}</span>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
import _ from "lodash";
|
|
7
|
+
import fecha from "fecha"
|
|
8
|
+
import {isMobile} from "../../../utils"
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
props: ["value", "fieldConf", "row"],
|
|
12
|
+
data() {
|
|
13
|
+
return {
|
|
14
|
+
dateTimeStr: "",
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
computed: {
|
|
18
|
+
format() {
|
|
19
|
+
let format = _.get(this.fieldConf, "view.format")
|
|
20
|
+
return format
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
watch: {
|
|
24
|
+
["value"]() {
|
|
25
|
+
this.dateTimeStr = this.formatViewTime();
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
mounted() {
|
|
29
|
+
this.dateTimeStr = this.formatViewTime();
|
|
30
|
+
},
|
|
31
|
+
methods: {
|
|
32
|
+
formatViewTime() {
|
|
33
|
+
let time = this.value;
|
|
34
|
+
if (!time) return "";
|
|
35
|
+
if (_.isInteger(time)) {
|
|
36
|
+
let timeStr = _.toString(time);
|
|
37
|
+
if (timeStr.length != 13) time = time * 1000;
|
|
38
|
+
}
|
|
39
|
+
let timeStamp;
|
|
40
|
+
if (isMobile()) {
|
|
41
|
+
time = time.replace(/-/g, "/");
|
|
42
|
+
time = time.replace(/T/g, " ");
|
|
43
|
+
time = time.padEnd(10, "/01/01");
|
|
44
|
+
timeStamp = new Date(time).getTime();
|
|
45
|
+
} else {
|
|
46
|
+
timeStamp = new Date(time).getTime();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let formattedString = fecha.format(timeStamp, this.format);
|
|
50
|
+
return formattedString;
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
</script>
|