hd-idevvue3 3.0.0 → 3.0.2

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 (230) hide show
  1. package/.env.development +5 -0
  2. package/.env.production +5 -0
  3. package/README.md +22 -191
  4. package/dist/assets/index.774ef40e.css +1 -0
  5. package/dist/hd-idevvue3.mjs +45697 -0
  6. package/dist/hd-idevvue3.umd.js +153 -0
  7. package/index.html +1 -0
  8. package/npminstall-debug.log +10 -2
  9. package/package.json +35 -40
  10. package/pnpm-lock.yaml +2631 -0
  11. package/src/App.vue +15 -0
  12. package/src/assets/sound/notify.wav +0 -0
  13. package/src/demo/demo.vue +43 -0
  14. package/src/demo/dropdemo.vue +43 -0
  15. package/src/demo/extsets.vue +107 -0
  16. package/src/demo/formedit.vue +145 -0
  17. package/src/demo/hightquery.vue +169 -0
  18. package/src/demo/inlineedit.vue +88 -0
  19. package/src/demo/selfdrop.vue +41 -0
  20. package/src/demo//350/241/214/345/206/205/347/272/247/350/201/224.txt +2 -0
  21. package/src/directive/el-dragDialog/drag.js +124 -0
  22. package/src/directive/el-dragDialog/index.js +13 -0
  23. package/src/errorLog.js +16 -0
  24. package/src/hdcom/BigGrid.js +173 -0
  25. package/src/hdcom/BillShow.vue +90 -0
  26. package/src/hdcom/BillUpload.vue +253 -0
  27. package/src/hdcom/BtnRight.vue +98 -0
  28. package/src/hdcom/ErrHint.vue +30 -0
  29. package/src/hdcom/ExtendColumn.vue +108 -0
  30. package/src/hdcom/ExtendCommon.js +29 -0
  31. package/src/hdcom/ExtendForm.vue +114 -0
  32. package/src/hdcom/FacePicUpload.vue +71 -0
  33. package/src/hdcom/FaceRecTest.vue +104 -0
  34. package/src/hdcom/GridChart.vue +194 -0
  35. package/src/hdcom/GridExField.vue +281 -0
  36. package/src/hdcom/GridShow.vue +238 -0
  37. package/src/hdcom/HdAside.vue +178 -0
  38. package/src/hdcom/HdBtn.vue +113 -0
  39. package/src/hdcom/HdButton.vue +137 -0
  40. package/src/hdcom/HdComFaceRec.vue +58 -0
  41. package/src/hdcom/HdComGrid.vue +776 -0
  42. package/src/hdcom/HdComQuery.vue +273 -0
  43. package/src/hdcom/HdComQueryDetail.vue +161 -0
  44. package/src/hdcom/HdComSortDetail.vue +155 -0
  45. package/src/hdcom/HdDatePicker.vue +78 -0
  46. package/src/hdcom/HdDialog.vue +63 -0
  47. package/src/hdcom/HdDrop.vue +163 -0
  48. package/src/hdcom/HdFileUpload.vue +148 -0
  49. package/src/hdcom/HdFilterBox.vue +90 -0
  50. package/src/hdcom/HdFooter.vue +149 -0
  51. package/src/hdcom/HdForm.vue +278 -0
  52. package/src/hdcom/HdFormBtn.vue +89 -0
  53. package/src/hdcom/HdFormItem.vue +35 -0
  54. package/src/hdcom/HdGctosGrid +0 -0
  55. package/src/hdcom/HdGrid.vue +825 -0
  56. package/src/hdcom/HdGridEditBtn.vue +44 -0
  57. package/src/hdcom/HdGridExt.js +219 -0
  58. package/src/hdcom/HdGridSel.vue +223 -0
  59. package/src/hdcom/HdHeader.vue +148 -0
  60. package/src/hdcom/HdHotKey.vue +81 -0
  61. package/src/hdcom/HdInputHint.vue +49 -0
  62. package/src/hdcom/HdMain.vue +43 -0
  63. package/src/hdcom/HdMessage.vue +192 -0
  64. package/src/hdcom/HdNum.vue +69 -0
  65. package/src/hdcom/HdPopSel.vue +58 -0
  66. package/src/hdcom/HdRightMenu.vue +61 -0
  67. package/src/hdcom/HdSel/SelGridFieldcod.vue +36 -0
  68. package/src/hdcom/HdTableColumn.vue +334 -0
  69. package/src/hdcom/HdTempSave.vue +140 -0
  70. package/src/hdcom/HdTree.vue +86 -0
  71. package/src/hdcom/HdTreeTable/eval.js +34 -0
  72. package/src/hdcom/HdTreeTable/index.vue +174 -0
  73. package/src/hdcom/ImportExcel.vue +143 -0
  74. package/src/hdcom/index.js +80 -0
  75. package/src/idev.common.js +72 -0
  76. package/src/index.js +14 -0
  77. package/src/utils/HdQuery.js +54 -0
  78. package/src/utils/comutils.js +98 -0
  79. package/src/utils/utils.js +105 -0
  80. package/src/vendor/Blob.js +179 -0
  81. package/src/vendor/Export2Excel.js +220 -0
  82. package/src/vendor/Export2Zip.js +22 -0
  83. package/src/views/layout/AppMain.vue +32 -0
  84. package/src/views/layout/HdLayout.vue +78 -0
  85. package/src/views/layout/header/ElasticSearch.vue +225 -0
  86. package/src/views/layout/header/HZRecorder.js +231 -0
  87. package/src/views/layout/header/HeaderSearch.vue +198 -0
  88. package/src/views/layout/header/Levelbar.vue +49 -0
  89. package/src/views/layout/header/MainHeader.vue +271 -0
  90. package/src/views/layout/header/Navbar.vue +105 -0
  91. package/src/views/layout/header/ScrollPane.vue +81 -0
  92. package/src/views/layout/header/TagsView.vue +210 -0
  93. package/src/views/layout/header/VocRec.vue +97 -0
  94. package/src/views/layout/header/changepswform.vue +96 -0
  95. package/src/views/layout/index.js +12 -0
  96. package/src/views/layout/menu/Hamburger.vue +45 -0
  97. package/src/views/layout/menu/HdMenu.vue +167 -0
  98. package/src/views/layout/menu/css/menu.css +288 -0
  99. package/src/views/layout/menu/index.vue +25 -0
  100. package/src/views/privilege/commsg/commsg.vue +78 -0
  101. package/src/views/privilege/commsg/commsgOrgn.vue +42 -0
  102. package/src/views/privilege/commsg/commsgRole.vue +149 -0
  103. package/src/views/privilege/commsg/commsgform.vue +160 -0
  104. package/src/views/privilege/commsg/commsgiframe.vue +33 -0
  105. package/src/views/privilege/commsg/commsgto.vue +120 -0
  106. package/src/views/privilege/commsg/commsgtoform.vue +108 -0
  107. package/src/views/privilege/commsg/commsgtrans.vue +155 -0
  108. package/src/views/privilege/exfield/comexcolumn.vue +71 -0
  109. package/src/views/privilege/exfield/comexcolumnform.vue +101 -0
  110. package/src/views/privilege/exfield/comexfield.vue +31 -0
  111. package/src/views/privilege/exfield/comexfieldform.vue +94 -0
  112. package/src/views/privilege/exfield/comexfieldsub.vue +72 -0
  113. package/src/views/privilege/index.js +42 -0
  114. package/src/views/privilege/menu/comMenu.vue +41 -0
  115. package/src/views/privilege/menu/menu.vue +133 -0
  116. package/src/views/privilege/menu/menuinfo.vue +56 -0
  117. package/src/views/privilege/menu/rolelist.vue +47 -0
  118. package/src/views/privilege/menu/userlist.vue +49 -0
  119. package/src/views/privilege/mobile/authmobileupdate.vue +69 -0
  120. package/src/views/privilege/mobile/authmobileupdateform.vue +90 -0
  121. package/src/views/privilege/orgDept/authOrgn.vue +96 -0
  122. package/src/views/privilege/orgDept/authorgnform.vue +145 -0
  123. package/src/views/privilege/orgDept/orgDept.vue +37 -0
  124. package/src/views/privilege/orgDept/orgTree.vue +88 -0
  125. package/src/views/privilege/orgDept/orgnselect.vue +134 -0
  126. package/src/views/privilege/personDept/authuser.vue +123 -0
  127. package/src/views/privilege/personDept/authuserform.vue +154 -0
  128. package/src/views/privilege/personDept/facerec.vue +117 -0
  129. package/src/views/privilege/personDept/orgncascader.vue +125 -0
  130. package/src/views/privilege/personDept/personDept.vue +31 -0
  131. package/src/views/privilege/quartz/comquartzjob.vue +65 -0
  132. package/src/views/privilege/quartz/comquartzjobform.vue +99 -0
  133. package/src/views/privilege/quartz/comquartzlog.vue +59 -0
  134. package/src/views/privilege/role/btnRole.vue +117 -0
  135. package/src/views/privilege/role/menuRole.vue +64 -0
  136. package/src/views/privilege/role/orgnRole.vue +56 -0
  137. package/src/views/privilege/role/role.vue +67 -0
  138. package/src/views/privilege/role/rolelist.vue +67 -0
  139. package/src/views/privilege/role/roleselect.vue +57 -0
  140. package/src/views/privilege/search/comsearch.vue +105 -0
  141. package/src/views/privilege/search/menu.vue +52 -0
  142. package/src/views/privilege/syscode/syscode.vue +103 -0
  143. package/src/views/privilege/syscode/sysfield.vue +66 -0
  144. package/src/views/privilege/syscode/sysfieldframe.vue +30 -0
  145. package/src/views/privilege/syslog/menulog.vue +52 -0
  146. package/src/views/privilege/syslog/syslog.vue +115 -0
  147. package/src/views/privilege/syslog/syslogconfig.vue +61 -0
  148. package/src/views/privilege/syslog/syslogform.vue +83 -0
  149. package/src/views/privilege/syslog/syslogframe.vue +26 -0
  150. package/src/views/privilege/userRole/userRole.vue +122 -0
  151. package/src/views/privilege.zip +0 -0
  152. package/vite.config.js +93 -0
  153. package/.babelrc +0 -17
  154. package/.editorconfig +0 -14
  155. package/.eslintignore +0 -3
  156. package/.npminstall.done +0 -1
  157. package/.postcssrc.js +0 -8
  158. package/LICENSE +0 -21
  159. package/Listening +0 -28
  160. package/build/build.js +0 -70
  161. package/build/check-versions.js +0 -45
  162. package/build/config.js +0 -81
  163. package/build/dev-client.js +0 -9
  164. package/build/dev-server.js +0 -93
  165. package/build/utils.js +0 -78
  166. package/build/vue-loader.conf.js +0 -12
  167. package/build/webpack.common.js +0 -37
  168. package/build/webpack.component.js +0 -36
  169. package/build/webpack.prod.conf.js +0 -38
  170. package/components.json +0 -8
  171. package/conf.js +0 -42
  172. package/config/dev.env.js +0 -6
  173. package/config/index.js +0 -43
  174. package/config/prod.env.js +0 -6
  175. package/config/sit.env.js +0 -6
  176. package/favicon.ico +0 -0
  177. package/jsdoc-vue.js +0 -12
  178. package/lib/0.index.js +0 -12573
  179. package/lib/1.index.js +0 -6
  180. package/lib/2.index.js +0 -2
  181. package/lib/idev.common.js +0 -1
  182. package/lib/idv8.common.js +0 -1
  183. package/lib/index.js +0 -49170
  184. package/lib/js/ErrHint.js +0 -1
  185. package/lib/js/HdAside.js +0 -1
  186. package/lib/js/HdBtn.js +0 -1
  187. package/lib/js/HdButton.js +0 -1
  188. package/lib/js/HdComFaceRec.js +0 -1
  189. package/lib/js/HdComGrid.js +0 -1
  190. package/lib/js/HdDatePicker.js +0 -1
  191. package/lib/js/HdDialog.js +0 -1
  192. package/lib/js/HdDrop.js +0 -1
  193. package/lib/js/HdFileUpload.js +0 -1
  194. package/lib/js/HdFooter.js +0 -1
  195. package/lib/js/HdForm.js +0 -1
  196. package/lib/js/HdFormBtn.js +0 -1
  197. package/lib/js/HdFormItem.js +0 -1
  198. package/lib/js/HdGrid.js +0 -1
  199. package/lib/js/HdGridEditBtn.js +0 -1
  200. package/lib/js/HdGridSel.js +0 -1
  201. package/lib/js/HdHeader.js +0 -1
  202. package/lib/js/HdHotkey.js +0 -1
  203. package/lib/js/HdLayout.js +0 -1
  204. package/lib/js/HdMain.js +0 -1
  205. package/lib/js/HdMessage.js +0 -1
  206. package/lib/js/HdNum.js +0 -1
  207. package/lib/js/HdPopSel.js +0 -1
  208. package/lib/js/HdSearch.js +0 -1
  209. package/lib/js/HdTableColumn.js +0 -1
  210. package/lib/js/HdTempSave.js +0 -1
  211. package/lib/js/HdTree.js +0 -1
  212. package/lib/js/HdTreeTable.js +0 -1
  213. package/lib/js/authmobileupdate.js +0 -1
  214. package/lib/js/comexfield.js +0 -1
  215. package/lib/js/commsg.js +0 -1
  216. package/lib/js/commsgto.js +0 -1
  217. package/lib/js/comquartzjob.js +0 -1
  218. package/lib/js/comquartzlog.js +0 -1
  219. package/lib/js/comsearch.js +0 -1
  220. package/lib/js/menu.js +0 -1
  221. package/lib/js/menuinfo.js +0 -1
  222. package/lib/js/orgDept.js +0 -1
  223. package/lib/js/orgTree.js +0 -1
  224. package/lib/js/personDept.js +0 -1
  225. package/lib/js/role.js +0 -1
  226. package/lib/js/sysfieldframe.js +0 -1
  227. package/lib/js/syslog.js +0 -1
  228. package/lib/js/syslogframe.js +0 -1
  229. package/lib/js/userRole.js +0 -1
  230. package/ytgvue.rar +0 -0
@@ -0,0 +1,825 @@
1
+ <template>
2
+ <div :style="{width: '100%',height:height}" class="hdgrid" ref="grid">
3
+ <div v-show="queryShow">
4
+ <slot name="query"></slot>
5
+ </div>
6
+ <div style="height: 0px;" v-if="!noSets">
7
+ <el-dropdown @command="extSets"
8
+ style="float:right;height:0;width:20px;position: relative;right:0px;text-align: center;z-index: 100;cursor:pointer;font-size: 25px">
9
+ <span class="el-dropdown-link">
10
+ <i :style="{'font-size':'13px', color: isGridCustom ? 'red !important': ''}" class="fa fa-cogs"></i>
11
+ </span>
12
+ <el-dropdown-menu slot="dropdown">
13
+ <el-dropdown-item command="gridSets">{{$t('自定义展示')}}</el-dropdown-item>
14
+ <el-dropdown-item command="pageExcel">{{$t('导出当页excel')}}
15
+ </el-dropdown-item>
16
+ <el-dropdown-item :disabled="excelAllExporting" command="allExcel">
17
+ {{excelAllExporting ? $t('正在导出') : $t('导出全部excel') }}
18
+ </el-dropdown-item>
19
+ <el-dropdown-item :disabled="pdfAllExporting" command="allPdf">
20
+ {{pdfAllExporting ? $t('正在生成') : $t('pdf打印') }}
21
+ </el-dropdown-item>
22
+ <el-dropdown-item command="queryToggle">{{queryShow ? $t('隐藏查询区') : $t('显示查询区')}}</el-dropdown-item>
23
+ <el-dropdown-item command="exFieldSets" v-if="exField.open">{{$t('添加扩展字段')}}</el-dropdown-item>
24
+ <slot name="extSets"></slot>
25
+ </el-dropdown-menu>
26
+ </el-dropdown>
27
+ <!--<el-button @click="gridSets"-->
28
+ <!--&gt;表格功能-->
29
+ <!--</el-button>-->
30
+ </div>
31
+
32
+ <el-table :data="hdResultComRows" :default-sort="defaultSort" :row-class-name="rowClassName"
33
+ :stripe="$attrs.stripe==undefined?true:$attrs.stripe" @row-click="myrowClick"
34
+ @row-dblclick="myrowDblClick" @row-contextmenu="myrowContextmenu" @selection-change="myselectionChange"
35
+ @sort-change="dodefaultSort" border element-loading-text="加载中..." height="100%" highlight-current-row
36
+ ref="ingrid" v-bind="$attrs" v-if="gridCanReload" v-on="$listeners" @filter-change="filterChange">
37
+
38
+ <template v-if="!visualScroll">
39
+ <ExTableColumn :showOverflowTooltip="false" align="center" class-name="backFF" noEdit noSlot type="selection"
40
+ v-if="!ckHide" width="30" @click.native="selectClick"></ExTableColumn>
41
+ <ex-table-column :showOverflowTooltip="false" align="center" noEdit noSlot type="index" v-if="!indexHide"
42
+ width="40">
43
+ <template slot="header" slot-scope="scope">
44
+ <span>#</span>
45
+ </template>
46
+ </ex-table-column>
47
+ </template>
48
+ <template v-else>
49
+ <ex-table-column :showOverflowTooltip="true" align="center" class-name="checkBox" noEdit noSlot v-if="!ckHide"
50
+ width="30">
51
+ <template slot="header" slot-scope="scope">
52
+ <el-checkbox :indeterminate="isSubChecked" :value="isAllChecked" @change="checkAllChange" />
53
+ </template>
54
+ <template slot-scope="scope">
55
+ <el-checkbox v-model="scope.row._isCK" />
56
+ </template>
57
+ </ex-table-column>
58
+ <ex-table-column :index="getIndex" :showOverflowTooltip="true" align="center" noEdit noSlot type="index"
59
+ v-if="!indexHide" width="40">
60
+ <template slot="header" slot-scope="scope">
61
+ <span>#</span>
62
+ </template>
63
+ <template slot-scope="scope">
64
+ {{scope.$index + startIndex + 1}}
65
+ </template>
66
+ </ex-table-column>
67
+ </template>
68
+
69
+ <slot></slot>
70
+
71
+ <template v-if="exField.gridCode">
72
+ <template v-for="exFieldRow in exFieldRows">
73
+ <ExtendColumn :exFieldRow="exFieldRow"></ExtendColumn>
74
+ </template>
75
+ </template>
76
+
77
+ <template v-if="!recHide">
78
+
79
+ <el-table-column align="left" header-align="center" label="创建人" noEdit prop="recNam" sortable width="auto">
80
+ </el-table-column>
81
+ <el-table-column :inputProp="$date" align="center" input="el-date-picker" label="创建时间" noEdit prop="recTim"
82
+ sortable width="135px">
83
+ </el-table-column>
84
+ <el-table-column align="left" header-align="center" label="更新人" noEdit prop="updNam" sortable width="auto">
85
+ </el-table-column>
86
+ <el-table-column :inputProp="$date" align="center" input="el-date-picker" label="更新时间" noEdit prop="updTim"
87
+ sortable width="135px">
88
+ </el-table-column>
89
+ </template>
90
+ </el-table>
91
+ <!--虚拟滚动条支持1w条 -->
92
+ <div class="pagination-container" ref="pagecon" style="height:26px;overflow: hidden"
93
+ v-if="!pageHide || showBtnTool">
94
+ <div style="float:left" v-if="showBtnTool">
95
+ <slot name="btnTool">
96
+ <hd-btn icon="el-icon-plus" hint="增加" @click="doAdd" vid="doAdd" class="hdBtnTool" v-if="!addHide"
97
+ keyType="add"></hd-btn>
98
+ <hd-btn icon="el-icon-minus" hint="删除" @click="doRemove" class="hdBtnTool" v-if="!delHide" keyType="del">
99
+ </hd-btn>
100
+ <hd-btn icon="el-icon-check" hint="保存" @click="doSave" class="hdBtnTool" v-if="!saveHide" keyType="save">
101
+ </hd-btn>
102
+ </slot>
103
+ <!-- <hd-btn icon="el-icon-copy-document" hint="复制" @click="doCopy" class="hdBtnTool" style="color:#409EFF;"-->
104
+ <!-- v-if="!copyHide" keyType="copy"></hd-btn>-->
105
+ </div>
106
+ <el-pagination :current-page.sync="hdQuery.page" :page-size="hdQuery.rows" :page-sizes="pageSizeArray"
107
+ :total="hdResult.total" @current-change="hdQuery.doCurPageChange" @size-change="rowSizeChg"
108
+ layout=" total, slot, prev, pager, next,sizes" small style="float:right" v-if="!pageHide">
109
+ </el-pagination>
110
+ </div>
111
+ <GridShow @save-ok="gridShow()" ref="gridShow" v-if="gridShowIs"></GridShow>
112
+ <GridExField :columnList="exField.columnList" :gridCode="exField.gridCode" :table="exField.table"
113
+ @save-ok="exFieldShow()" ref="exFieldShow" v-if="exField.open && exFieldShowIs"></GridExField>
114
+ <!-- <GridExFieldBak @save-ok="exFieldShow()" ref="exFieldShow" v-if="exField.open && exFieldShowIs" :table="exField.table"
115
+ :columnList="exField.columnList" :gridCode="exField.gridCode"></GridExFieldBak>
116
+ -->
117
+ <!-- <PdfShow :gening="pdfAllExporting" @close="pdfShowIs=false" ref="pdfshow" v-if="pdfShowIs"></PdfShow> -->
118
+ <hd-right-menu ref="rightMenu" @do-add="doAdd" @do-update="doUpdateOne" @do-remove="doRemoveOne"
119
+ @do-copy="doCopyOne" v-if="rightMenuOpen" v-show="rightMenuVisable">
120
+ <template slot="rightMenu">
121
+ <slot name="rightMenu"></slot>
122
+ </template>
123
+ <template slot="rightMenuExt">
124
+ <slot name="rightMenuExt"></slot>
125
+ </template>
126
+ </hd-right-menu>
127
+ </div>
128
+ </template>
129
+
130
+ <script>
131
+ import GridShow from './GridShow'
132
+ import GridExField from './GridExField'
133
+ import HdGridExt from './HdGridExt.js'
134
+ // import PdfShow from './PdfShow'
135
+ import BigGrid from "./BigGrid.js";
136
+ import ExtendColumn from "./ExtendColumn";
137
+ import HdBtn from './HdBtn'
138
+ import HdRightMenu from "./HdRightMenu";
139
+
140
+ /**
141
+ * 通常不需要直接调用,HdComGrid中已经封装
142
+ * @module HdGrid
143
+ */
144
+ export default {
145
+ name: 'HdGrid',
146
+ components: { HdRightMenu, GridShow, GridExField, ExtendColumn, HdBtn }, // ElTableColumn已被改写,但是select ck不好使,需要有原来的
147
+ mixins: [HdGridExt, BigGrid],
148
+ data() {
149
+ return {
150
+ disCol: [], // 配置的列,包括展示和未展示
151
+ oriCol: [], // 原始列,由column组件赋值
152
+ chiCol: [], // 存在嵌套列时
153
+ colThis: [], // column this对象
154
+ menuId: '',
155
+ gridId: '',//唯一标识
156
+ queryShow: true,
157
+ excelAllExporting: false, // true为正在导出的loading
158
+ pdfAllExporting: false,
159
+ gridShowIs: false,
160
+ exFieldShowIs: false,
161
+ pdfShowIs: false,//pdf组件是否显示,因为不常用直接v-if
162
+ gridCanReload: true,// 组件失效重新生成用的,相当于局部刷新
163
+ isGridCustom: false,
164
+ exFieldRows: [],
165
+ rightMenuVisable: false,
166
+ rightMenuRow: [],
167
+ lastSelectRow: null,
168
+ }
169
+ },
170
+ inheritAttrs: false,
171
+ /**
172
+ * @prop {boolean} noSets: 是否显示列表右上角的按钮(自定义列和导出excel)默认显示
173
+ * @prop {Object} defaultSort 默认{prop: 'updTim', order: 'descending'}
174
+ * @prop {boolean} pageHide: 是否隐藏分页,默认显示
175
+ * @prop {boolean} ckHide: Boolean,是否显示checkbox默认显示
176
+ * @prop {boolean} indexHide: Boolean,是否显示index 默认显示
177
+ * @prop {boolean} recHide: Boolean,是否显示创建人 默认显示
178
+ * @prop {boolean} rowClassName: Function,
179
+ * @prop {Array} noExcelExport:,导出excel时不导出的字段
180
+ * @prop {boolean} excelPropHeader: 导出excel是否包含英文属性头及主键等(适合导入excel当模板使用)
181
+ * @prop {boolean} visualScroll: 开启虚拟滚动条,可大幅度提升页面容量(上万条列表),但是依然推荐写好分页
182
+ * @prop {boolean} pageSizes: 页码默认visualScroll?[20,50,100,200,500,1000]:[20,50,100,200]
183
+ * @prop {Object} exField 是否有扩展字段 open开启,table扩展字段所在表,field扩展字段使用字段
184
+ * @prop {Function} excelFormatter 自定义导出excel
185
+ * @prop {Boolean} rightMenuOpen 是否打开右击菜单,默认关闭
186
+ */
187
+ props: {
188
+ // doallPage是事件,导出全部excel
189
+ hdResult: {
190
+ rows: [],
191
+ total: 0,
192
+ }, // 可能是列表数据,或者导出的excel数据
193
+ hdAllResult: Object, // 可能是列表数据,或者导出的excel数据
194
+ hdQuery: {
195
+ type: Object,
196
+ default: function () { // updTimFirst是因为会触发HdQuery的排序及查询,默认不让查询
197
+ return {}
198
+ }
199
+ },
200
+ height: {
201
+ type: String,
202
+ default: function () { // 默认空对象,防止出错
203
+ return '100%'
204
+ }
205
+ },
206
+ noSets: {// 是否显示自定义列和导出excel,默认显示
207
+ type: Boolean,
208
+ default: function () {
209
+ return false
210
+ }
211
+ },
212
+ defaultSort: {
213
+ type: Object,
214
+ default: function () { // updTimFirst是因为会触发HdQuery的排序及查询,默认不让查询
215
+ return { prop: 'updTim', order: 'descending' }
216
+ }
217
+ },
218
+ pageHide: Boolean,
219
+ ckHide: Boolean, // 是否显示checkbox默认显示
220
+ indexHide: Boolean, // 是否显示index 默认显示
221
+ recHide: Boolean, // 是否显示创建人 默认显示
222
+ rowClassName: Function,
223
+ noExcelExport: [Array], // 导出excel时不处理的字段
224
+ excelPropHeader: Boolean,// 导出excel是否包含属性头,默认false,导入excel如果需要模板,可以开启,并且会导出所有属性
225
+ visualScroll: Boolean,//启动虚拟滚动条,默认false
226
+ pageSizes: [Array],
227
+ exField: {
228
+ type: Object,
229
+ default: function () {
230
+ return {
231
+ open: false,
232
+ table: null,
233
+ columnList: null
234
+ }
235
+ }
236
+ },
237
+ excelFormatter: Function,
238
+ addHide: Boolean,//隐藏grid列表底部的按钮工具栏里的增加按钮
239
+ delHide: Boolean,//隐藏grid列表底部的按钮工具栏里的删除按钮
240
+ saveHide: Boolean,//隐藏grid列表底部的按钮工具栏里的保存按钮
241
+ copyHide: Boolean,//隐藏grid列表底部的按钮工具栏里的复制按钮
242
+ hdBtnTool: {
243
+ type: Boolean,
244
+ default: true
245
+ },//显示、隐藏grid列表底部的整个按钮工具栏
246
+ rightMenuOpen: {
247
+ type: Boolean,
248
+ default: false
249
+ }
250
+ },
251
+ created() {
252
+ //自定义列表展示:vue界面的组件名+parent的组件(调用该组件的组件名+上级组件(如el-main)
253
+ //当vue界面是菜单入口时_componentTag是undefined,此时name替代(name自动注入)
254
+ if (this.$parent.$vnode.context.$options._componentTag) {
255
+ this.gridId = this.$parent.$vnode.context.$options._componentTag + '_' + this.$parent.$parent.$options._componentTag
256
+ } else {
257
+ this.gridId = this.$parent.$vnode.context.$options.name + '_' + this.$parent.$parent.$options._componentTag
258
+ }
259
+ },
260
+ mounted() {
261
+ this.hdQuery.doSort(this.defaultSort, true)
262
+ //每页显示多少条
263
+ let selPageSize = localStorage.getItem('page_' + this.gridId)
264
+ if (selPageSize) {
265
+ this.hdQuery.rows = parseInt(selPageSize)
266
+ } else {
267
+ // this.rowSizeChg(100)
268
+ }
269
+ if (this.pageHide) { // 无分页时
270
+ this.hdQuery.page = null
271
+ this.hdQuery.rows = 2000
272
+ console.log('隐藏分页展示数据,最多展现2000条')
273
+ }
274
+ if (this.visualScroll) {
275
+ this.initVisual();
276
+ }
277
+ // this.disCol.push(1)
278
+ if (this.exField.gridCode) {
279
+ this.initExFieldRows();
280
+ }
281
+ this.$nextTick(function () { // 等渲染完成后执行
282
+ if (!this.noSets) {
283
+ this.gridShow(true)
284
+ }
285
+ })
286
+ },
287
+ methods: {
288
+ doAdd() {
289
+ this.$emit('sel-ok', 'doAdd')
290
+ },
291
+ doRemove() {
292
+ this.$emit('sel-ok', 'doRemove')
293
+ },
294
+ doSave() {
295
+ this.$emit('sel-ok', 'doSave')
296
+ },
297
+ doCopy() {
298
+ this.$emit('sel-ok', 'doCopy')
299
+ },
300
+ doUpdateOne() {
301
+ this.$emit('sel-ok', 'doUpdateOne', this.rightMenuRow)
302
+ },
303
+ doRemoveOne() {
304
+ this.$emit('sel-ok', 'doRemoveOne', this.rightMenuRow)
305
+ },
306
+ doCopyOne() {
307
+ this.$emit('sel-ok', 'doCopyOne', this.rightMenuRow)
308
+ },
309
+ gridShow(notReload) {
310
+ if (!notReload) { //首次不刷新组件.自定义组件,避免再次查询(分页事件)
311
+ this.gridCanReload = false
312
+ // this.isFirstSort = true
313
+ }
314
+ this.$nextTick(function () {
315
+ this.gridCanReload = true
316
+ this.$nextTick(function () {
317
+ if (!notReload && this.visualScroll) {
318
+ this.initVisual();
319
+ this.initTableHeight();
320
+ }
321
+ this.oriCol = this.$refs.ingrid.store.states._columns;// 此处是未进行展示控制的原始数据
322
+ this.menuId = this.$route.name
323
+ const url = '/webresources/login/com/ComGridShow/find?menuId=' + this.menuId + '&gridId=' + this.gridId
324
+ this.$http.post(url).then(response => {
325
+ this.isGridCustom = response.data.length != 0;
326
+ this.disCol = this.gridCompute(this.oriCol, response.data)
327
+
328
+
329
+ this.$refs.ingrid.store.states._columns = this.disCol.filter(v => v.showFlg != '0')
330
+
331
+ console.log('显示序列条数', this.$refs.ingrid.store.states._columns.length);
332
+ // console.log(JSON.stringify(this.$refs.ingrid.store.states._columns));
333
+ this.$refs.ingrid.store.updateColumns()
334
+ this.$nextTick(function () {
335
+ this.$refs.ingrid.doLayout()
336
+ })
337
+ })
338
+ // for (let i = 0; i < this.colThis.length; i++) {
339
+ // this.colThis[i].gridShow(true)
340
+ // }
341
+ })
342
+ })
343
+ },
344
+ exFieldShow() {
345
+ window.location.reload();
346
+ // console.log(this.$store.state.app.selectedView)
347
+ // this.$nextTick(()=>{
348
+ // this.$store.dispatch('refreshView', this.$store.state.app.selectedView);
349
+ // })
350
+ },
351
+ gridSets() {
352
+ this.gridShowIs = true
353
+ this.$nextTick(() => {
354
+ this.$refs.gridShow.show(this.disCol, this.menuId, this.gridId)
355
+ })
356
+ },
357
+ exFieldSets() {
358
+ this.exFieldShowIs = true
359
+ this.$nextTick(() => {
360
+ this.$refs.exFieldShow.show();
361
+ })
362
+ },
363
+ gridCompute(oriCol, setCol) { // 全部设置展示
364
+ let result = [];
365
+ const lastResult = [];
366
+ for (let i = 0; i < oriCol.length; i++) {
367
+ const oneOri = oriCol[i]
368
+ oneOri.showFlg = '1'// 默认展示
369
+ oneOri._ori_label = oneOri.label
370
+ oneOri.label = oneOri._ori_label
371
+ let isFind = false
372
+ if (oneOri && !oneOri.property) { // 没有prop的默认显示,checkbox和index
373
+ if (oneOri.fixed == 'right') { // 隐藏行按钮,单独,否则无法控制
374
+ result.push(oriCol[i])
375
+ } else {
376
+ result.push(oneOri)
377
+ }
378
+ continue
379
+ }
380
+ for (let j = 0; j < setCol.length; j++) { // 后来新增的
381
+ if (oneOri.property == setCol[j].property) {
382
+ isFind = true
383
+ break
384
+ }
385
+ }
386
+ if (!isFind) {
387
+ lastResult.push(oneOri)
388
+ }
389
+ }
390
+ for (let i = 0; i < setCol.length; i++) {
391
+ const oneSet = setCol[i]
392
+ if (result.some(v => {
393
+ return v.property == oneSet.property
394
+ })) {
395
+ console.log('已经重复' + oneSet.property)
396
+ continue;
397
+ }
398
+ for (let j = 0; j < oriCol.length; j++) {
399
+ const oneOri = oriCol[j]
400
+ if (oneOri.className == 'checkBox') {
401
+ this.$set(oneOri, 'fixed', 'left')
402
+ this.$set(oneOri, 'className', 'checkBox backFF')
403
+ }
404
+ if (oneOri.type == 'selection' || oneOri.type == 'index') {//ck和index都要居左
405
+ this.$set(oneOri, 'fixed', 'left')
406
+ this.$set(oneOri, 'className', 'backFF')
407
+ }
408
+ if (oneOri.property && oneSet.property == oneOri.property) {
409
+ this.$set(oneOri, 'showFlg', oneSet.showFlg)
410
+ this.$set(oneOri, 'freezeFlg', oneSet.freezeFlg)
411
+ if (oneSet.freezeFlg == '1') {
412
+ this.$set(oneOri, 'fixed', 'left')
413
+ this.$set(oneOri, 'className', 'backFF' + oneOri.className)
414
+ }
415
+ oneOri.width = oneSet.width
416
+ result.push(oneOri)
417
+ break
418
+ }
419
+ }
420
+ }
421
+ result = [...result, ...lastResult];
422
+ return result
423
+ },
424
+ extSets(command) {
425
+ if (command == 'gridSets') {
426
+ this.gridSets()
427
+ }
428
+ if (command == 'exFieldSets') {
429
+ this.exFieldSets()
430
+ } else if (command == 'pageExcel') {
431
+ this.doPageExcel()
432
+ } else if (command == 'allExcel') {
433
+ this.doAllExcel()
434
+ } else if (command == 'allPdf') {
435
+ this.doAllPdf()
436
+ } else if (command == 'queryToggle') {
437
+ this.queryShow = !this.queryShow
438
+ }
439
+ this.$emit('extSets', command)
440
+ },
441
+ getHdComGrid() {
442
+ let par = this.$parent
443
+ while (par) {
444
+ if (par.$options.name == 'HdComGrid') {
445
+ return par
446
+ }
447
+ par = par.$parent
448
+ }
449
+ return null
450
+ },
451
+ myselectionChange(select) {
452
+ if (this.hdQuery) { //
453
+ this.hdQuery.selObj = select
454
+ }//selection-change事件会触发2次,加个第3参数区分是el-table的还是hdgrid的
455
+ this.$emit('selection-change', select, true)
456
+ },
457
+ // selectRow(select, row) {
458
+ // if (this.$listeners['select']) {
459
+ // return
460
+ // }
461
+ // console.log(select)
462
+ // if (this.lastSelectRow) {
463
+ // // this.selectPart(this.lastSelectRow, row)
464
+ // } else {
465
+ // this.lastSelectRow = row;
466
+ // }
467
+ // //
468
+ // },
469
+ // selectClick(e) {
470
+ // console.log(e)
471
+ // },
472
+ myrowClick(row, column, event) {
473
+ if (event.shiftKey) {
474
+ let index1 = this.hdResult.rows.indexOf(this.hdQuery.selRow);
475
+ let index2 = this.hdResult.rows.indexOf(row);
476
+
477
+ this.selectRowCube(index1, index2, false)
478
+ } else {
479
+ this.hdQuery.selRow = row
480
+ }
481
+ console.log('row-click', row, event, column)
482
+ // this.$emit('row-click', row, event, column);
483
+ },
484
+
485
+ myrowDblClick(row, event, column) {
486
+ if (this.$listeners['row-dblclick']) {
487
+ return
488
+ }
489
+ if (this.$route.path.indexOf('privilege') == 1) {
490
+ return;
491
+ }
492
+ this.$emit('sel-ok', 'doUpdateOne', row)
493
+ if (this.hdQuery) {
494
+ this.hdQuery.selRow = row
495
+ }
496
+ },
497
+ myrowContextmenu(row, column, event) {
498
+ // const menuMinWidth = 105
499
+ // const offsetLeft = this.$el.getBoundingClientRect().left // container margin left
500
+ // const offsetWidth = this.$el.offsetWidth // container width
501
+ // const maxLeft = offsetWidth - menuMinWidth // left boundary
502
+ // const left = e.clientX - offsetLeft + 15 // 15: margin right
503
+ // if (left > maxLeft) {
504
+ // this.left = maxLeft
505
+ // } else {
506
+ // this.left = left
507
+ // }
508
+ // this.top = e.clientY - 40
509
+ // this.visible = true
510
+ // this.$store.state.app.selectedView = tag
511
+ // console.log(this.$store.state.app.selectedView)
512
+
513
+ if (this.hdQuery) {
514
+ this.rightMenuRow = row
515
+ }
516
+ this.rightMenuVisable = false // 先把模态框关死,目的是 第二次或者第n次右键鼠标的时候 它默认的是true
517
+ event.preventDefault() //关闭浏览器右键默认事件
518
+
519
+ if (this.rightMenuOpen) {
520
+ let menu = this.$refs.rightMenu.$el
521
+
522
+
523
+ // if (event.clientX > 900) {
524
+ // menu.style.left = event.clientX - 265 + 'px'
525
+ // } else {
526
+ // menu.style.left = event.clientX - 175 + 'px'
527
+ // }
528
+ document.addEventListener('click', this.foo) // 给整个document新增监听鼠标事件,点击任何位置执行foo方法
529
+ // if (event.clientY > 500) {
530
+ // menu.style.top = event.clientY - 185 + 'px'
531
+ // } else {
532
+ // menu.style.top = event.clientY - 105 + 'px'
533
+ // }
534
+ menu.style.left = event.clientX + 'px'
535
+ menu.style.top = event.clientY + 'px'
536
+ // console.log(menu,event)
537
+ this.rightMenuVisable = true // 显示模态窗口,跳出自定义菜单栏
538
+ }
539
+
540
+ },
541
+
542
+ foo() {
543
+ // 取消鼠标监听事件 菜单栏
544
+ this.rightMenuVisable = false
545
+ document.removeEventListener('click', this.foo) // 关掉监听,
546
+ },
547
+ dodefaultSort(val, v1, v2) {
548
+ let sortProp = val.column.sortable
549
+ if (!sortProp) {
550
+ return
551
+ }
552
+ // if (typeof (sortProp) != 'boolean' && sortProp != '') {
553
+ // console.log('compare hdResult')
554
+ // this.hdResult.rows.sort((a, b) => {
555
+ // if (val.column.order == 'ascending') {
556
+ // return this.localeCompare(a[sortProp], b[sortProp])
557
+ // } else if (val.column.order == 'descending') {
558
+ // return this.localeCompare(b[sortProp], a[sortProp])
559
+ // }
560
+ // })
561
+ // return;
562
+ // }
563
+ let hasAddData = false
564
+ for (let i = 0; i < this.hdResultComRows.length; i++) {
565
+ if (this.hdResultComRows[i].isEdit) {
566
+ hasAddData = true
567
+ break
568
+ }
569
+ }
570
+ // if (!this.defaultSort || !this.defaultSort.prop) { // 没有默认排序时,不会立即执行该方法
571
+ // this.isFirstSort = false
572
+ // }
573
+ // 列表会默认执行此方法,所以需要防止排序调用doquery
574
+ if (hasAddData) {
575
+ this.$confirm(this.$t('存在未保存数据,是否继续?'), this.$t('提示'), {}).then(() => {
576
+ this.hdQuery.doSort(val, false)
577
+ })
578
+ } else {
579
+ this.hdQuery.doSort(val, false)
580
+ }
581
+ },
582
+ localeCompare(a, b) {
583
+ if (!a) {
584
+ return 1
585
+ }
586
+ if (!b) {
587
+ return -1
588
+ }
589
+ return a.localeCompare(b)
590
+ },
591
+ doPageExcel() {
592
+ this.excelExport(this.hdResult.rows)
593
+ },
594
+ doAllExcel() {
595
+ let res = null
596
+ this.$emit('allExcel', function (call) {
597
+ res = call
598
+ })
599
+ this.excelAllExporting = true
600
+ res.then(response => {
601
+ this.excelExport(response.data.rows)
602
+ this.excelAllExporting = false
603
+ // this.downloadLoading = false
604
+ })
605
+ },
606
+ doAllPdf() {
607
+ let res = null
608
+ this.pdfShowIs = true
609
+ this.$emit('allExcel', function (call) {//pdf也是这名字allExcel
610
+ res = call
611
+ })
612
+ this.pdfAllExporting = true
613
+ res.then(response => {
614
+ this.pdfExport(response.data.rows)
615
+ this.pdfAllExporting = false
616
+ // this.downloadLoading = false
617
+ })
618
+ },
619
+ getInputFormat(prop) {
620
+ for (let i = 0; i < this.colThis.length; i++) {
621
+ const one = this.colThis[i]
622
+ if (one.$attrs.prop == prop) {
623
+ return one.getValueByPath//支持多级prop如果有inutFormat会使用inputFormt
624
+ }
625
+ }
626
+ },
627
+ rowSizeChg(val) {
628
+ localStorage.setItem('page_' + this.gridId, val)
629
+ this.hdQuery.doSizeChg(val)
630
+ },
631
+ getCkRows() {
632
+ if (this.visualScroll) {
633
+ return this.hdResult.rows.filter(v => v._isCK == true)
634
+ } else {
635
+ return this.hdQuery.selObj
636
+ }
637
+
638
+ },
639
+ initExFieldRows() {
640
+ let hdFielddQuery = new HdQuery(this);
641
+ hdFielddQuery.query.gridCode = this.exField.gridCode;
642
+ hdFielddQuery.sort = 'sortNo';
643
+ hdFielddQuery.order = 'asc';
644
+ this.$http.post(`/webresources/login/tech/ComExField/detail/find`, hdFielddQuery).then(response => {
645
+ this.exFieldRows = response.data.rows
646
+ this.exFieldRows.forEach(row => {
647
+ row.fieldName = row.columnName.toLowerCase().replace(/\_+[a-zA-Z]/g,
648
+ (str, index) => index ? str.substr(-1).toUpperCase() : str
649
+ )
650
+ })
651
+ this.$nextTick(function () {
652
+ this.$refs.ingrid.doLayout()
653
+ })
654
+ })
655
+ },
656
+ filterChange(filters) {
657
+ // this.hdResult.filterValue.
658
+ this.hdResult.filters = Object.assign(this.hdResult.filters || {}, filters);
659
+
660
+ this.filterHdResult()
661
+ },
662
+ filterHdResult() {
663
+ let keys = Object.keys(this.hdResult.filters || {});
664
+ // console.log(this.$refs.ingrid.store.states._columns, this.hdResult.filters)
665
+ this.hdResult.rows = this.hdResult._rows.filter((row) => {
666
+
667
+ return !keys.some(value => {
668
+ let prop = (this.$refs.ingrid.store.states._columns.find(v => {
669
+ return v.id == value
670
+ }) || '').property
671
+ // console.log(value, prop, row[prop], this.hdResult.filters[value])
672
+ return this.hdResult.filters[value].length > 0 && this.hdResult.filters[value].indexOf(row[prop]) == -1
673
+ });
674
+ });
675
+ },
676
+
677
+ selectPart(e, isUnSelect) {
678
+ let index1 = this.hdResult.rows.indexOf(this.hdQuery.selRow);
679
+ let index2 = this.hdResult.rows.indexOf(this.rightMenuRow);
680
+
681
+ this.selectRowCube(index1, index2, isUnSelect)
682
+ },
683
+ selectRowCube(index1, index2, isUnSelect) {
684
+ if (index1 > index2) {
685
+ let tmpIndex = index1;
686
+ index1 = index2;
687
+ index2 = tmpIndex;
688
+ }
689
+ this.hdResult.rows.forEach((v, i) => {
690
+ if (i >= index1 && i <= index2) {
691
+ this.$refs.ingrid.toggleRowSelection(v, !isUnSelect)
692
+ }
693
+ })
694
+ },
695
+
696
+ unSelectPart(e) {
697
+ this.selectPart(e, true)
698
+ }
699
+ },
700
+ computed: {
701
+ hdResultComRows() {
702
+ if (this.visualScroll) {
703
+ return this.gridDataRows
704
+ } else {
705
+ return this.hdResult.rows
706
+ }
707
+ },
708
+ pageSizeArray() {
709
+ if (this.pageSizes == null) {
710
+ return this.visualScroll ? [20, 50, 100, 200, 500, 1000, 2000] : [20, 50, 100, 200, 500];
711
+ } else {
712
+ return this.pageSizes;
713
+ }
714
+ },
715
+ showBtnTool() {
716
+ return this.hdBtnTool && this.$route.path.indexOf('privilege') != 1;
717
+ },
718
+ },
719
+
720
+ watch: {}
721
+ }
722
+ </script>
723
+ <style rel="stylesheet/scss" lang="scss" scoped>
724
+ .hdgrid {
725
+ display: flex;
726
+ flex-direction: column;
727
+
728
+ :deep(.el-table) {
729
+ //deep内的不会加随机数
730
+ height: 100%;
731
+ width: 100%;
732
+ flex: 1;
733
+
734
+ th.gutter {
735
+ //浏览器缩放,表格错行解决
736
+ display: table-cell !important;
737
+ }
738
+
739
+ .el-table__header-wrapper th {
740
+ //列表标题
741
+ background-color: #f6f6f6;
742
+ }
743
+
744
+ .el-table__fixed-header-wrapper th {
745
+ //固定的列表标题
746
+ background-color: #f6f6f6;
747
+ }
748
+
749
+ td,
750
+ th {
751
+ //列表标题及内容
752
+ padding: 1px 0;
753
+ }
754
+
755
+ .cell,
756
+ .el-table th div,
757
+ .el-table--border th:first-child .cell,
758
+ .el-table--border td:first-child .cell {
759
+ //列表的margin
760
+ padding-left: 4px !important;
761
+ padding-right: 0px !important;
762
+ padding-top: 1.5px !important;
763
+ padding-bottom: 1.5px !important;
764
+ }
765
+
766
+ .el-table__empty-block {
767
+ position: static;
768
+ text-align: center;
769
+ width: 100%;
770
+ height: 80%;
771
+ }
772
+
773
+ .el-table__body {
774
+ //列表下面加了空白
775
+ margin-bottom: 10px;
776
+ }
777
+
778
+ .el-table__body-wrapper {
779
+ height: 100%;
780
+ overflow: auto;
781
+ }
782
+
783
+ .el-input__inner {
784
+ height: 27px;
785
+ margin-bottom: 0px;
786
+ line-height: 27px;
787
+ }
788
+
789
+ .el-input,
790
+ .el-form-item__content,
791
+ .el-form-item__label,
792
+ .el-input__icon {
793
+ line-height: 30px;
794
+ }
795
+
796
+ .el-input__inner {
797
+ padding: 5px;
798
+ }
799
+
800
+ .el-input--prefix .el-input__inner {
801
+ //日期的有logo不一样
802
+ padding-left: 30px;
803
+ }
804
+
805
+ .cell {
806
+ min-width: 20px;
807
+ }
808
+
809
+ .checkBox .cell {
810
+ overflow: inherit;
811
+
812
+ .el-checkbox,
813
+ .el-checkbox__input {
814
+ position: inherit;
815
+ }
816
+ }
817
+ }
818
+ }
819
+
820
+ .hdBtnTool {
821
+ font-weight: bold;
822
+ vertical-align: middle;
823
+ margin-left: 20px;
824
+ }
825
+ </style>