t20-common-lib 0.7.8 → 0.7.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "t20-common-lib",
3
- "version": "0.7.8",
3
+ "version": "0.7.11",
4
4
  "description": "T20",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
@@ -61,7 +61,8 @@
61
61
  "rimraf": "^3.0.2",
62
62
  "sass-loader": "^8.0.2",
63
63
  "vue-template-compiler": "^2.6.14",
64
- "vuepress": "^1.9.7"
64
+ "vuepress": "^1.9.7",
65
+ "vuepress-plugin-demo-block": "^0.7.2"
65
66
  },
66
67
  "eslintConfig": {
67
68
  "root": true,
@@ -0,0 +1,8 @@
1
+ import PageHeader from './src/main';
2
+
3
+ /* istanbul ignore next */
4
+ PageHeader.install = function(Vue) {
5
+ Vue.component(PageHeader.name, PageHeader);
6
+ };
7
+
8
+ export default PageHeader;
@@ -0,0 +1,94 @@
1
+ <template>
2
+ <div class="t20-page-header">
3
+ <div v-if="!disable" class="page-header__left" @click="$emit('back')">
4
+ <i :class="icon"></i>
5
+ <div class="page-header__title">
6
+ <slot name="title">{{ title }}</slot>
7
+ </div>
8
+ </div>
9
+ <div class="page-header__content">
10
+ <slot name="content">{{ content }}</slot>
11
+ </div>
12
+ <div class="header-btn">
13
+ <slot name="headerButtons"></slot>
14
+ </div>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ export default {
20
+ name: 'PageHeader',
21
+ props: {
22
+ title: {
23
+ type: String,
24
+ default() {
25
+ return ''
26
+ }
27
+ },
28
+ content: {
29
+ type: String,
30
+ default: ''
31
+ },
32
+ disable: {
33
+ type: Boolean,
34
+ default: false
35
+ },
36
+ icon: {
37
+ type: String,
38
+ default: 'n20-icon-yuefenqiehuan-zuoce'
39
+ }
40
+ }
41
+ }
42
+ </script>
43
+
44
+ <style lang="scss" scoped>
45
+ .t20-page-header {
46
+ display: flex;
47
+ line-height: 20px;
48
+ padding-bottom: 2px;
49
+ border-bottom: 1px solid rgba(0, 0, 0, 0.1);
50
+
51
+ .page-header__left {
52
+ display: flex;
53
+ align-items: center;
54
+ cursor: pointer;
55
+ margin-right: 16px;
56
+ position: relative;
57
+ }
58
+
59
+ .page-header__left:hover {
60
+ color: var(--color-primary);
61
+
62
+ .page-header__title {
63
+ color: var(--color-primary);
64
+ }
65
+ }
66
+
67
+ .page-header__left:after {
68
+ content: '';
69
+ position: absolute;
70
+ width: 1px;
71
+ height: 16px;
72
+ right: -8px;
73
+ top: 50%;
74
+ transform: translateY(-50%);
75
+ background-color: #dcdfe6;
76
+ }
77
+
78
+ .page-header__title {
79
+ font-size: 14px;
80
+ line-height: 20px;
81
+ color: #3d4a57;
82
+ }
83
+
84
+ .page-header__content {
85
+ font-size: 14px;
86
+ line-height: 26px;
87
+ color: #3d4a57;
88
+ }
89
+
90
+ .header-btn {
91
+ margin-left: auto;
92
+ }
93
+ }
94
+ </style>
package/src/index.js CHANGED
@@ -2,12 +2,14 @@
2
2
  import fitlers from './filters/index'
3
3
  import repairEl from './utils/repairElementUI'
4
4
  import { getColumnWidth, getCellAlign } from './utils/tableCellUtils'
5
+ import { getExportFileName } from './utils/exportFile'
5
6
  // 导入组件
6
7
  import MainPage from '../packages/main-page/index.js'
7
8
  import TablePage from '../packages/table-page/index.js'
8
9
  import FormPage from '../packages/form-page/index.js'
9
10
  import TabPane from '../packages/tab-pane/index.js'
10
11
  import StatisCard from '../packages/statis-card/index.js'
12
+ import PageHeader from '../packages/page-header/index.js'
11
13
  import CommonCollapse from '../packages/common-collapse/index.js'
12
14
 
13
15
  // 存储组件列表
@@ -17,7 +19,8 @@ const components = [
17
19
  FormPage,
18
20
  TabPane,
19
21
  StatisCard,
20
- CommonCollapse
22
+ CommonCollapse,
23
+ PageHeader
21
24
  ]
22
25
 
23
26
  // 定义 install 方法,接收 Vue 作为参数
@@ -52,7 +55,9 @@ export {
52
55
  StatisCard,
53
56
  CommonCollapse,
54
57
  TabPane,
58
+ PageHeader,
55
59
  repairEl,
56
60
  getColumnWidth,
57
- getCellAlign
61
+ getCellAlign,
62
+ getExportFileName
58
63
  }
@@ -0,0 +1,24 @@
1
+ export function parseDate(date, format) {
2
+ var o = {
3
+ "M+": date.getMonth() + 1,
4
+ "d+": date.getDate(),
5
+ "h+": date.getHours(),
6
+ "m+": date.getMinutes(),
7
+ "s+": date.getSeconds(),
8
+ "q+": Math.floor((date.getMonth() + 3) / 3),
9
+ S: date.getMilliseconds()
10
+ };
11
+ let yearReg = format.match(/(y+)/i);
12
+ if (yearReg) {
13
+ let year = date.getFullYear() + "";
14
+ year = year.substring(4 - yearReg[0].length);
15
+ format = format.replace(yearReg[0], year);
16
+ }
17
+ for (var k in o) {
18
+ let iReg = format.match(new RegExp("(" + k + ")"));
19
+ if (iReg) {
20
+ format = format.replace(iReg[0], iReg[0].length == 1 ? o[k] : ("00" + o[k]).substring(("" + o[k]).length));
21
+ }
22
+ }
23
+ return format;
24
+ }
@@ -0,0 +1,7 @@
1
+ import { parseDate } from './date.js';
2
+
3
+ // 获取导出文件命名
4
+ export function getExportFileName(baseName, fileType) {
5
+ const date = parseDate(new Date(), "yyyyMMdd");
6
+ return `${baseName}-${date}.${fileType}`;
7
+ }