n20-common-lib 1.1.98

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.
Files changed (196) hide show
  1. package/README.md +27 -0
  2. package/package.json +87 -0
  3. package/src/_qiankun/index.js +113 -0
  4. package/src/_qiankun/postMessage.js +48 -0
  5. package/src/assets/css/_coreLib.scss +35 -0
  6. package/src/assets/css/cl-anchor.scss +24 -0
  7. package/src/assets/css/cl-approve-card.scss +58 -0
  8. package/src/assets/css/cl-dialog.scss +99 -0
  9. package/src/assets/css/cl-drag-list.scss +22 -0
  10. package/src/assets/css/cl-empty.scss +10 -0
  11. package/src/assets/css/cl-expandable-pane.scss +25 -0
  12. package/src/assets/css/cl-expandable.scss +23 -0
  13. package/src/assets/css/cl-file-upload-table.scss +11 -0
  14. package/src/assets/css/cl-filter.scss +4 -0
  15. package/src/assets/css/cl-flow-step.scss +186 -0
  16. package/src/assets/css/cl-footer-box.scss +10 -0
  17. package/src/assets/css/cl-form-item.scss +322 -0
  18. package/src/assets/css/cl-general-card.scss +12 -0
  19. package/src/assets/css/cl-layout-aside.scss +88 -0
  20. package/src/assets/css/cl-layout-content.scss +16 -0
  21. package/src/assets/css/cl-layout-header.scss +73 -0
  22. package/src/assets/css/cl-layout-tabs.scss +87 -0
  23. package/src/assets/css/cl-layout.scss +97 -0
  24. package/src/assets/css/cl-login-temporary.scss +37 -0
  25. package/src/assets/css/cl-message.scss +75 -0
  26. package/src/assets/css/cl-more-tab.scss +98 -0
  27. package/src/assets/css/cl-nav-menu.scss +5 -0
  28. package/src/assets/css/cl-pagination.scss +65 -0
  29. package/src/assets/css/cl-secondary-tab.scss +39 -0
  30. package/src/assets/css/cl-showcolumn.scss +23 -0
  31. package/src/assets/css/cl-sifting.scss +51 -0
  32. package/src/assets/css/cl-statis.scss +42 -0
  33. package/src/assets/css/cl-step.scss +73 -0
  34. package/src/assets/css/cl-suspend.scss +19 -0
  35. package/src/assets/css/cl-tertiary-tab.scss +9 -0
  36. package/src/assets/css/cl-upload.scss +41 -0
  37. package/src/assets/css/cl-worn-pagination.scss +50 -0
  38. package/src/assets/css/el-button.scss +169 -0
  39. package/src/assets/css/el-table.scss +79 -0
  40. package/src/assets/css/element-variables.scss +1061 -0
  41. package/src/assets/css/element.dev.scss +21 -0
  42. package/src/assets/css/font-icon.scss +26 -0
  43. package/src/assets/css/index.dev.scss +4 -0
  44. package/src/assets/css/index.scss +11 -0
  45. package/src/assets/css/normalize.scss +723 -0
  46. package/src/assets/css/rootvar.scss +139 -0
  47. package/src/assets/css/select.scss +26 -0
  48. package/src/assets/css/title-pop.scss +4 -0
  49. package/src/assets/getJsonc.js +50 -0
  50. package/src/assets/realUrl.js +12 -0
  51. package/src/components/Anchor/AnchorItem.vue +30 -0
  52. package/src/components/Anchor/index.vue +185 -0
  53. package/src/components/ApprovalButtons/index.vue +232 -0
  54. package/src/components/ApprovalCard/index.vue +128 -0
  55. package/src/components/ApprovalRecord/approvalImg.vue +39 -0
  56. package/src/components/ApprovalRecord/index.vue +59 -0
  57. package/src/components/Button/button-group.vue +150 -0
  58. package/src/components/Button/icon-group-button.vue +61 -0
  59. package/src/components/Button/index.vue +56 -0
  60. package/src/components/ContentLoading/index.vue +41 -0
  61. package/src/components/ContentNull/index.vue +19 -0
  62. package/src/components/DatePicker/index.vue +27 -0
  63. package/src/components/DatePicker/por.vue +169 -0
  64. package/src/components/Dialog/index.vue +26 -0
  65. package/src/components/Dialog/indexO.vue +116 -0
  66. package/src/components/DragList/index.vue +68 -0
  67. package/src/components/Empty/img/404.png +0 -0
  68. package/src/components/Empty/img/abnormal.svg +109 -0
  69. package/src/components/Empty/img/dispose.svg +72 -0
  70. package/src/components/Empty/img/empty.svg +58 -0
  71. package/src/components/Empty/img/general.svg +59 -0
  72. package/src/components/Empty/img/lock.svg +58 -0
  73. package/src/components/Empty/img/network.svg +60 -0
  74. package/src/components/Empty/img/relevant.svg +69 -0
  75. package/src/components/Empty/img/search.svg +73 -0
  76. package/src/components/Empty/index.vue +92 -0
  77. package/src/components/Expandable/index.vue +49 -0
  78. package/src/components/Expandable/main.vue +52 -0
  79. package/src/components/FileUploadTable/index.vue +484 -0
  80. package/src/components/Filters/index.vue +358 -0
  81. package/src/components/Filters/indexO.vue +104 -0
  82. package/src/components/FlowStep/index.vue +69 -0
  83. package/src/components/FooterBox/index.vue +21 -0
  84. package/src/components/GeneralCard/index.vue +15 -0
  85. package/src/components/InputNumber/index.vue +153 -0
  86. package/src/components/InputNumber/numberRange.vue +47 -0
  87. package/src/components/InputSearch/index.vue +75 -0
  88. package/src/components/Layout/AsideNav/index.vue +144 -0
  89. package/src/components/Layout/HeaderWrap/changePwd.vue +215 -0
  90. package/src/components/Layout/HeaderWrap/index.vue +336 -0
  91. package/src/components/Layout/HeaderWrap/noticePop.vue +300 -0
  92. package/src/components/Layout/SubContent/index.vue +131 -0
  93. package/src/components/Layout/TabsNav/index.vue +170 -0
  94. package/src/components/Layout/index.vue +529 -0
  95. package/src/components/Layout/utils.js +12 -0
  96. package/src/components/LoginTemporary/form.vue +511 -0
  97. package/src/components/LoginTemporary/index.vue +122 -0
  98. package/src/components/LoginTemporary/qr.png +0 -0
  99. package/src/components/LoginTemporary/qrcode.vue +90 -0
  100. package/src/components/LoginTemporary/qrt.png +0 -0
  101. package/src/components/LoginTemporary/retrievePw.vue +28 -0
  102. package/src/components/LoginTemporary/utils.js +73 -0
  103. package/src/components/MicroApp/index.js +67 -0
  104. package/src/components/MicroFrame/index.vue +95 -0
  105. package/src/components/MoreTab/index.vue +232 -0
  106. package/src/components/NavMenu/index.vue +60 -0
  107. package/src/components/NstcG6Components/NstcApprovel/NstcApprovel.vue +13 -0
  108. package/src/components/NstcG6Components/NstcDialog/NstcDialog.vue +185 -0
  109. package/src/components/NstcG6Components/Progress/progress.vue +134 -0
  110. package/src/components/PageLayout/page.vue +15 -0
  111. package/src/components/Pagination/index.vue +96 -0
  112. package/src/components/SecondaryTab/index.vue +58 -0
  113. package/src/components/SelectLazy/index.vue +75 -0
  114. package/src/components/SelectTree/SelectTreeLazy.vue +241 -0
  115. package/src/components/SelectTree/index.vue +208 -0
  116. package/src/components/ShowColumn/index.vue +188 -0
  117. package/src/components/Sifting/index.vue +99 -0
  118. package/src/components/Statis/index.vue +97 -0
  119. package/src/components/Statis/statisItem.vue +54 -0
  120. package/src/components/Statis/statisPopover.vue +55 -0
  121. package/src/components/Step/index.vue +38 -0
  122. package/src/components/Suspend/index.vue +72 -0
  123. package/src/components/Table/index.vue +131 -0
  124. package/src/components/Table/indexO.vue +149 -0
  125. package/src/components/Task/index.vue +26 -0
  126. package/src/components/TertiaryTab/index.vue +53 -0
  127. package/src/components/TimePicker/index.vue +28 -0
  128. package/src/components/Upload/index.vue +242 -0
  129. package/src/components/WornPagination/index.vue +73 -0
  130. package/src/directives/VClickOutside/index.js +19 -0
  131. package/src/directives/VDrag/index.js +72 -0
  132. package/src/directives/VHas/index.js +27 -0
  133. package/src/directives/VMove/index.js +42 -0
  134. package/src/directives/VTitle/index.js +56 -0
  135. package/src/directives/VTitle/tooltip.vue +21 -0
  136. package/src/index.js +225 -0
  137. package/src/plugins/CompatibleOld/index.js +57 -0
  138. package/src/plugins/Print/index.js +4 -0
  139. package/src/plugins/Print/print-js/.babelrc +12 -0
  140. package/src/plugins/Print/print-js/LICENSE +21 -0
  141. package/src/plugins/Print/print-js/README.md +98 -0
  142. package/src/plugins/Print/print-js/dist/print.css +97 -0
  143. package/src/plugins/Print/print-js/dist/print.js +991 -0
  144. package/src/plugins/Print/print-js/dist/print.map +1 -0
  145. package/src/plugins/Print/print-js/package.json +60 -0
  146. package/src/plugins/Print/print-js/src/index.d.ts +45 -0
  147. package/src/plugins/Print/print-js/src/index.js +10 -0
  148. package/src/plugins/Print/print-js/src/js/browser.js +33 -0
  149. package/src/plugins/Print/print-js/src/js/functions.js +103 -0
  150. package/src/plugins/Print/print-js/src/js/html.js +70 -0
  151. package/src/plugins/Print/print-js/src/js/image.js +48 -0
  152. package/src/plugins/Print/print-js/src/js/init.js +168 -0
  153. package/src/plugins/Print/print-js/src/js/json.js +109 -0
  154. package/src/plugins/Print/print-js/src/js/modal.js +62 -0
  155. package/src/plugins/Print/print-js/src/js/pdf.js +62 -0
  156. package/src/plugins/Print/print-js/src/js/print.js +102 -0
  157. package/src/plugins/Print/print-js/src/js/raw-html.js +15 -0
  158. package/src/plugins/Print/print-js/src/sass/index.scss +14 -0
  159. package/src/plugins/Print/print-js/src/sass/modules/_colors.scss +10 -0
  160. package/src/plugins/Print/print-js/src/sass/partials/_modal.scss +41 -0
  161. package/src/plugins/Print/print-js/src/sass/partials/_spinner.scss +46 -0
  162. package/src/plugins/Print/print.js +2 -0
  163. package/src/plugins/Print/print.scss +1 -0
  164. package/src/plugins/SetMenuTree/index.vue +41 -0
  165. package/src/plugins/SetMenuTree/logoIcon.vue +37 -0
  166. package/src/plugins/SetMenuTree/setmenutree.vue +427 -0
  167. package/src/plugins/SetMenuTree/utils.js +74 -0
  168. package/src/plugins/Sign/InfosecNetSignCNGAgent.min.js +2000 -0
  169. package/src/plugins/Sign/index.js +65 -0
  170. package/src/plugins/Sign/sign.js +1 -0
  171. package/src/plugins/setTabsForSub.js +2 -0
  172. package/src/utils/auth.js +53 -0
  173. package/src/utils/axios.js +203 -0
  174. package/src/utils/downloadBlob.js +19 -0
  175. package/src/utils/forEachs.js +16 -0
  176. package/src/utils/getScrollContainer.js +43 -0
  177. package/src/utils/i18n/cn2hk.json +1270 -0
  178. package/src/utils/i18n/index.js +54 -0
  179. package/src/utils/list2tree.js +36 -0
  180. package/src/utils/msgboxPor.js +26 -0
  181. package/src/utils/print.js +161 -0
  182. package/src/utils/relaNo.js +35 -0
  183. package/src/utils/repairElementUI.js +66 -0
  184. package/src/utils/urlToGo.js +82 -0
  185. package/style/css/normalize.scss +723 -0
  186. package/style/fonts/element-icons.535877f5.woff +0 -0
  187. package/style/fonts/element-icons.732389de.ttf +0 -0
  188. package/style/index.css +3 -0
  189. package/style/index.css.map +1 -0
  190. package/style/index.umd.min.js +2 -0
  191. package/style/index.umd.min.js.map +1 -0
  192. package/style/pageDemo/demo-1.vue +130 -0
  193. package/style/pageDemo/demo-2.vue +35 -0
  194. package/style/pageDemo/demo-3.vue +22 -0
  195. package/style/pageDemo/seeCode.js +20 -0
  196. package/style/server-config.jsonc +663 -0
@@ -0,0 +1,99 @@
1
+ <template>
2
+ <cl-dialog
3
+ class="p-t-0 p-b-0"
4
+ :title="title"
5
+ :width="50"
6
+ :dialog-visible="dialogVisible"
7
+ :before-close="beforeClose"
8
+ >
9
+ <div class="n20-sifting-box">
10
+ <div class="n20-sifting-left">
11
+ <!--top-->
12
+ <div class="n20-sifting-left-top">
13
+ <div class="n20-sifting-left-top-left">
14
+ <span class="n20-sifting-left-top-title">{{ title }}</span>
15
+ <span class="n20-sifting-opt-text">已选 </span>
16
+ <span class="n20-sifting-opt">4</span>
17
+ </div>
18
+ <span
19
+ class="n20-sifting-opt n20-sifting-cursor"
20
+ @click="handleCheckAll"
21
+ >全部选中</span
22
+ >
23
+ </div>
24
+ <!--end-->
25
+ <!--content-->
26
+ <div v-for="item in list" :key="item.title">
27
+ <span class="n20-sifting-group-title">{{ item.title }}</span>
28
+ <el-checkbox-group
29
+ v-model="checkedCities"
30
+ @change="handleCheckedCitiesChange"
31
+ >
32
+ <el-checkbox
33
+ v-for="(city, index) in item.children"
34
+ :key="index"
35
+ class="el-checkbox-class"
36
+ :label="city.name"
37
+ >{{ city.name }}</el-checkbox
38
+ >
39
+ </el-checkbox-group>
40
+ </div>
41
+ <!--end-->
42
+ </div>
43
+ <div class="n20-sifting-right">
44
+ <cl-drag-list :list="checkedCities" />
45
+ </div>
46
+ </div>
47
+ <div slot="footerBtn" class="n20-sifting-footer">
48
+ <el-button @click="beforeClose">取消</el-button>
49
+ <el-button type="primary" @click="handlAffirm">确认</el-button>
50
+ </div>
51
+ </cl-dialog>
52
+ </template>
53
+
54
+ <script>
55
+ export default {
56
+ name: 'Sifting',
57
+ props: {
58
+ title: {
59
+ type: String,
60
+ default: ''
61
+ },
62
+ dialogVisible: {
63
+ type: Boolean,
64
+ default: false
65
+ },
66
+ beforeClose: {
67
+ type: Function,
68
+ default: () => {}
69
+ },
70
+ list: {
71
+ type: Array,
72
+ default: () => []
73
+ }
74
+ },
75
+ data() {
76
+ return {
77
+ checkedCities: []
78
+ }
79
+ },
80
+ methods: {
81
+ handleCheckAll() {
82
+ this.checkedCities = this.list
83
+ .map((c) => c.children)
84
+ .flat()
85
+ .map((r) => r.name)
86
+ console.log(this.checkedCities)
87
+ },
88
+ handlAffirm() {
89
+ this.$emit('Affirm', this.checkedCities)
90
+ },
91
+ handleCheckedCitiesChange(val) {
92
+ console.log(val)
93
+ }
94
+ }
95
+ }
96
+ </script>
97
+
98
+ <style scoped>
99
+ </style>
@@ -0,0 +1,97 @@
1
+ <template>
2
+ <div>
3
+ <div v-if="size !== 'mini'" class="flex-box p-t-s p-b-s">
4
+ <statisItem type="当页合计" :list="pageList" :show-w="showW" />
5
+ <statisItem type="全部合计" :list="totalList" :show-w="showW" />
6
+ </div>
7
+ <div v-else class="n20-statis p-t-s p-b-s">
8
+ <span class="m-r">
9
+ 当页:<span class="n20-primary">{{ pageSum }}</span
10
+ >条
11
+ </span>
12
+ <span class="m-r">
13
+ 全部:<span class="n20-primary">{{ totalSun }}</span
14
+ >条
15
+ </span>
16
+ </div>
17
+ </div>
18
+ </template>
19
+
20
+ <script>
21
+ import statisItem from './statisItem.vue'
22
+ export default {
23
+ name: 'Statis',
24
+ components: {
25
+ statisItem
26
+ },
27
+ props: {
28
+ pageSum: {
29
+ type: Number,
30
+ default: 0
31
+ },
32
+ pageAmount: {
33
+ type: Number,
34
+ default: undefined
35
+ },
36
+ totalSun: {
37
+ type: Number,
38
+ default: 0
39
+ },
40
+ totalAmount: {
41
+ type: Number,
42
+ default: undefined
43
+ },
44
+ showW: {
45
+ type: Boolean,
46
+ default: false
47
+ },
48
+ showU: {
49
+ type: [Boolean, String],
50
+ default: false
51
+ },
52
+ size: {
53
+ type: String,
54
+ default: undefined
55
+ }
56
+ },
57
+ computed: {
58
+ unitAs() {
59
+ if (!this.showU) {
60
+ return undefined
61
+ } else if (this.showU === true) {
62
+ return '元'
63
+ } else {
64
+ return this.showU
65
+ }
66
+ },
67
+ pageList() {
68
+ if (this.pageAmount !== undefined) {
69
+ return [
70
+ { label: '笔数', value: this.pageSum },
71
+ {
72
+ label: '金额',
73
+ value: this.pageAmount,
74
+ unit: this.unitAs
75
+ }
76
+ ]
77
+ } else {
78
+ return [{ label: '笔数', value: this.pageSum }]
79
+ }
80
+ },
81
+ totalList() {
82
+ if (this.totalAmount !== undefined) {
83
+ return [
84
+ { label: '笔数', value: this.totalSun },
85
+ {
86
+ label: '金额',
87
+ value: this.totalAmount,
88
+ unit: this.unitAs
89
+ }
90
+ ]
91
+ } else {
92
+ return [{ label: '笔数', value: this.totalSun }]
93
+ }
94
+ }
95
+ }
96
+ }
97
+ </script>
@@ -0,0 +1,54 @@
1
+ <template>
2
+ <div class="n20-statis">
3
+ <span v-if="title" class="p-r text-r stati-item-cell">{{ title }}</span
4
+ ><span class="stati-type stati-item-cell">{{ type }}</span
5
+ ><span class="n20-statis-division p-l-s p-r-s stati-item-cell">|</span
6
+ ><span v-for="(item, i) in list" :key="i" class="p-r stati-item-cell"
7
+ >{{ item.label }}:<span class="n20-primary">{{
8
+ item | numerify('0,0.00', showW)
9
+ }}</span></span
10
+ >
11
+ </div>
12
+ </template>
13
+
14
+ <script>
15
+ import numerify from 'numerify'
16
+ const n = 10000
17
+
18
+ export default {
19
+ name: 'StatisItem',
20
+ filters: {
21
+ numerify({ label, value, unit = '' }, f, w) {
22
+ if (label === '笔数') {
23
+ return value
24
+ } else if (!w) {
25
+ return numerify(value, f) + unit
26
+ } else {
27
+ if (value > n) {
28
+ return numerify(value / n, f) + '万' + unit
29
+ } else {
30
+ return numerify(value, f) + unit
31
+ }
32
+ }
33
+ }
34
+ },
35
+ props: {
36
+ title: {
37
+ type: String,
38
+ default: undefined
39
+ },
40
+ type: {
41
+ type: String,
42
+ default: undefined
43
+ },
44
+ list: {
45
+ type: Array,
46
+ default: () => []
47
+ },
48
+ showW: {
49
+ type: Boolean,
50
+ default: false
51
+ }
52
+ }
53
+ }
54
+ </script>
@@ -0,0 +1,55 @@
1
+ <template>
2
+ <div v-if="lists.length == 1" class="flex-box p-t-s p-b-s">
3
+ <statisItem
4
+ v-for="(item, i) in lists[0]['statis']"
5
+ :key="i"
6
+ :title="i === 0 ? lists[0].title : undefined"
7
+ :type="item.type"
8
+ :list="item.list"
9
+ />
10
+ </div>
11
+
12
+ <el-popover
13
+ v-else-if="lists.length > 1"
14
+ trigger="hover"
15
+ placement="bottom-start"
16
+ :visible-arrow="false"
17
+ popper-class="n20-statis-pop"
18
+ >
19
+ <div slot="reference" class="flex-box p-t-s p-b-s">
20
+ <statisItem
21
+ v-for="(item, i) in lists[0]['statis']"
22
+ :key="i"
23
+ :title="i === 0 ? lists[0].title : undefined"
24
+ :type="item.type"
25
+ :list="item.list"
26
+ />
27
+ </div>
28
+
29
+ <div>
30
+ <div v-for="(group, j) in lists" :key="j" class="n20-statis-group">
31
+ <statisItem
32
+ v-for="(item, i) in group['statis']"
33
+ :key="i"
34
+ :title="i === 0 ? group.title : undefined"
35
+ :type="item.type"
36
+ :list="item.list"
37
+ />
38
+ </div>
39
+ </div>
40
+ </el-popover>
41
+ </template>
42
+
43
+ <script>
44
+ import statisItem from './statisItem.vue'
45
+ export default {
46
+ name: 'StatisPopover',
47
+ components: { statisItem },
48
+ props: {
49
+ lists: {
50
+ type: Array,
51
+ default: () => []
52
+ }
53
+ }
54
+ }
55
+ </script>
@@ -0,0 +1,38 @@
1
+
2
+ <template>
3
+ <el-steps
4
+ :direction="direction"
5
+ :align-center="direction === 'horizontal' ? true : undefined"
6
+ :active="active"
7
+ v-bind="$attrs"
8
+ >
9
+ <el-step
10
+ v-for="(item, i) of dataSource"
11
+ :key="i"
12
+ :icon="item.icon"
13
+ :title="item.title"
14
+ :description="item.description"
15
+ @click.native="$emit('click', i)"
16
+ />
17
+ </el-steps>
18
+ </template>
19
+
20
+ <script>
21
+ export default {
22
+ name: 'Step',
23
+ props: {
24
+ direction: {
25
+ type: String,
26
+ default: 'horizontal'
27
+ },
28
+ active: {
29
+ type: Number,
30
+ default: 1
31
+ },
32
+ dataSource: {
33
+ type: Array,
34
+ default: () => []
35
+ }
36
+ }
37
+ }
38
+ </script>
@@ -0,0 +1,72 @@
1
+ <template>
2
+ <div v-move="moveFn" class="n20-suspend" :style="{ top: topAs }">
3
+ <el-tooltip
4
+ effect="dark"
5
+ :content="text"
6
+ placement="top-end"
7
+ offset="20"
8
+ :disabled="!text"
9
+ >
10
+ <div>
11
+ <i
12
+ class="n20-icon-liucheng m-r-ss color-primary"
13
+ @click="(ev) => $emit('click', ev)"
14
+ ></i>
15
+ <span class="n20-suspend-text" @click="(ev) => $emit('click', ev)">
16
+ <slot></slot>
17
+ </span>
18
+ </div>
19
+ </el-tooltip>
20
+ </div>
21
+ </template>
22
+ <script>
23
+ export default {
24
+ name: 'Suspend',
25
+ props: {
26
+ text: {
27
+ type: String,
28
+ default: ''
29
+ },
30
+ top: {
31
+ type: Number,
32
+ default: 15
33
+ },
34
+ icon: {
35
+ type: String,
36
+ default: undefined
37
+ }
38
+ },
39
+ data() {
40
+ return {
41
+ winH: 1080,
42
+ moveY: 0
43
+ }
44
+ },
45
+ computed: {
46
+ topAs() {
47
+ let top = this.top * this.winH * 0.01 + this.moveY
48
+ if (top <= 0) {
49
+ return 0
50
+ } else if (top >= document.documentElement.clientHeight - 46) {
51
+ return document.documentElement.clientHeight - 46 + 'px'
52
+ }
53
+ return top + 'px'
54
+ }
55
+ },
56
+ mounted() {
57
+ this.resizeFn()
58
+ window.addEventListener('resize', this.resizeFn)
59
+ },
60
+ beforeDestroy() {
61
+ window.removeEventListener('resize', this.resizeFn)
62
+ },
63
+ methods: {
64
+ resizeFn() {
65
+ this.winH = document.documentElement.clientHeight
66
+ },
67
+ moveFn(ev) {
68
+ this.moveY = this.moveY + ev.pageYc
69
+ }
70
+ }
71
+ }
72
+ </script>
@@ -0,0 +1,131 @@
1
+ <template>
2
+ <el-table
3
+ v-if="!pageObj"
4
+ ref="el-table"
5
+ :header-cell-style="{ 'text-align': 'center' }"
6
+ :data="data"
7
+ :height="height"
8
+ v-bind="$attrs"
9
+ v-on="$listeners"
10
+ >
11
+ <template v-for="(item, i) in columns">
12
+ <slot v-if="item.slotName" :name="item.slotName"></slot>
13
+ <el-table-column
14
+ v-else-if="item.render"
15
+ :key="'cl-table-' + i"
16
+ v-bind="item"
17
+ >
18
+ <columnRender slot-scope="{ row }" :c-render="item.render" :row="row" />
19
+ </el-table-column>
20
+ <el-table-column v-else :key="'cl-table-' + i" v-bind="item" />
21
+ </template>
22
+ </el-table>
23
+
24
+ <div v-else :style="{ height: heightW }">
25
+ <el-table
26
+ ref="el-table"
27
+ :header-cell-style="{ 'text-align': 'center' }"
28
+ style="width: 100%"
29
+ :data="data"
30
+ v-bind="$attrs"
31
+ :height="heightC"
32
+ v-on="$listeners"
33
+ >
34
+ <template v-for="(item, i) in columns">
35
+ <slot v-if="item.slotName" :name="item.slotName"></slot>
36
+ <el-table-column
37
+ v-else-if="item.render"
38
+ :key="'cl-table-' + i"
39
+ v-bind="item"
40
+ >
41
+ <columnRender
42
+ slot-scope="{ row }"
43
+ :c-render="item.render"
44
+ :row="row"
45
+ />
46
+ </el-table-column>
47
+ <el-table-column v-else :key="'cl-table-' + i" v-bind="item" />
48
+ </template>
49
+ </el-table>
50
+ <div v-if="pageObj" class="flex-box flex-r m-t-s">
51
+ <Pagination
52
+ :page-obj="pageObj"
53
+ :page-key="pageKey"
54
+ @change="(obj) => $emit('pageChange', obj)"
55
+ />
56
+ </div>
57
+ </div>
58
+ </template>
59
+
60
+ <script>
61
+ import Pagination from '../Pagination/index.vue'
62
+
63
+ const columnRender = {
64
+ props: {
65
+ cRender: {
66
+ type: Function
67
+ },
68
+ row: {
69
+ type: Object
70
+ }
71
+ },
72
+ render(h) {
73
+ return this.cRender(h, this.row)
74
+ }
75
+ }
76
+
77
+ export default {
78
+ name: 'Table',
79
+ components: {
80
+ Pagination,
81
+ columnRender
82
+ },
83
+ props: {
84
+ column: {
85
+ type: Boolean,
86
+ default: false
87
+ },
88
+ data: {
89
+ type: Array,
90
+ default: undefined
91
+ },
92
+ columns: {
93
+ type: Array,
94
+ require: true,
95
+ default: () => []
96
+ },
97
+ pageObj: {
98
+ type: Object,
99
+ default: undefined
100
+ },
101
+ pageKey: {
102
+ type: Object,
103
+ default: undefined
104
+ },
105
+ height: {
106
+ type: [String, Number],
107
+ default: undefined
108
+ }
109
+ },
110
+ computed: {
111
+ heightW() {
112
+ if (this.height === undefined) {
113
+ return undefined
114
+ }
115
+ if (/\D/.test(this.height)) {
116
+ return this.height
117
+ } else {
118
+ return this.height + 'px'
119
+ }
120
+ },
121
+ heightC() {
122
+ return this.pageObj ? 'calc(100% - 38px)' : '100%'
123
+ }
124
+ },
125
+ created() {
126
+ if (this.column) {
127
+ console.warn('调整列顺序,请使用ShowColumn组件')
128
+ }
129
+ }
130
+ }
131
+ </script>
@@ -0,0 +1,149 @@
1
+ <template>
2
+ <el-table
3
+ v-if="!pagination"
4
+ ref="el-table"
5
+ :header-cell-style="{ 'text-align': 'center' }"
6
+ :data="data"
7
+ :height="height"
8
+ v-bind="$attrs"
9
+ v-on="$listeners"
10
+ >
11
+ <template v-for="(item, i) in columns">
12
+ <slot v-if="item.slotName" :name="item.slotName"></slot>
13
+ <el-table-column
14
+ v-else-if="item.render"
15
+ :key="'cl-table-' + i"
16
+ v-bind="item"
17
+ >
18
+ <columnRender slot-scope="{ row }" :c-render="item.render" :row="row" />
19
+ </el-table-column>
20
+ <el-table-column v-else :key="'cl-table-' + i" v-bind="item" />
21
+ </template>
22
+ </el-table>
23
+
24
+ <div v-else :style="{ height: heightW }">
25
+ <el-table
26
+ ref="el-table"
27
+ :header-cell-style="{ 'text-align': 'center' }"
28
+ style="width: 100%"
29
+ :data="data"
30
+ v-bind="$attrs"
31
+ :height="heightC"
32
+ v-on="$listeners"
33
+ >
34
+ <template v-for="(item, i) in columns">
35
+ <slot v-if="item.slotName" :name="item.slotName"></slot>
36
+ <el-table-column
37
+ v-else-if="item.render"
38
+ :key="'cl-table-' + i"
39
+ v-bind="item"
40
+ >
41
+ <columnRender
42
+ slot-scope="{ row }"
43
+ :c-render="item.render"
44
+ :row="row"
45
+ />
46
+ </el-table-column>
47
+ <el-table-column v-else :key="'cl-table-' + i" v-bind="item" />
48
+ </template>
49
+ </el-table>
50
+ <div v-if="pagination" class="flex-box flex-r m-t-s">
51
+ <Pagination
52
+ :page-obj="paginationOption"
53
+ :page-key="{ no: 'page', size: 'pageSize', total: 'total' }"
54
+ />
55
+ </div>
56
+ </div>
57
+ </template>
58
+
59
+ <script>
60
+ import Pagination from '../Pagination/index.vue'
61
+ const columnRender = {
62
+ props: {
63
+ cRender: {
64
+ type: Function
65
+ },
66
+ row: {
67
+ type: Object
68
+ }
69
+ },
70
+ render(h) {
71
+ return this.cRender(h, this.row)
72
+ }
73
+ }
74
+
75
+ export default {
76
+ name: 'TableO',
77
+ components: {
78
+ Pagination,
79
+ columnRender
80
+ },
81
+ props: {
82
+ column: {
83
+ type: Boolean,
84
+ default: false
85
+ },
86
+ data: {
87
+ type: Array,
88
+ default: undefined
89
+ },
90
+ columns: {
91
+ type: Array,
92
+ require: true,
93
+ default: () => []
94
+ },
95
+ pagination: {
96
+ type: Boolean,
97
+ default: false
98
+ },
99
+ paginationOption: {
100
+ type: Object,
101
+ default: () => ({
102
+ page: 1,
103
+ total: 0,
104
+ pageSize: 20
105
+ })
106
+ },
107
+ height: {
108
+ type: [String, Number],
109
+ default: undefined
110
+ }
111
+ },
112
+ computed: {
113
+ heightW() {
114
+ if (this.height === undefined) {
115
+ return undefined
116
+ }
117
+ if (/\D/.test(this.height)) {
118
+ return this.height
119
+ } else {
120
+ return this.height + 'px'
121
+ }
122
+ },
123
+ heightC() {
124
+ return this.pageObj ? 'calc(100% - 38px)' : '100%'
125
+ }
126
+ },
127
+ watch: {
128
+ 'paginationOption.page': {
129
+ handler(val) {
130
+ if (this.pagination) {
131
+ this.$emit('changePage', val)
132
+ }
133
+ }
134
+ },
135
+ 'paginationOption.pageSize': {
136
+ handler(val) {
137
+ if (this.pagination) {
138
+ this.$emit('changePageSize', val)
139
+ }
140
+ }
141
+ }
142
+ },
143
+ created() {
144
+ if (this.column) {
145
+ console.warn('调整列顺序,请使用ShowColumn组件')
146
+ }
147
+ }
148
+ }
149
+ </script>