hd-idevvue3 3.0.0 → 3.0.1

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 (226) hide show
  1. package/README.md +22 -191
  2. package/dist/index.html +17 -0
  3. package/package.json +13 -9
  4. package/pnpm-lock.yaml +5593 -0
  5. package/src/App.vue +15 -0
  6. package/src/assets/sound/notify.wav +0 -0
  7. package/src/demo/demo.vue +43 -0
  8. package/src/demo/dropdemo.vue +43 -0
  9. package/src/demo/extsets.vue +107 -0
  10. package/src/demo/formedit.vue +145 -0
  11. package/src/demo/hightquery.vue +169 -0
  12. package/src/demo/inlineedit.vue +88 -0
  13. package/src/demo/selfdrop.vue +41 -0
  14. package/src/demo//350/241/214/345/206/205/347/272/247/350/201/224.txt +2 -0
  15. package/src/directive/el-dragDialog/drag.js +124 -0
  16. package/src/directive/el-dragDialog/index.js +13 -0
  17. package/src/errorLog.js +14 -0
  18. package/src/hdcom/BigGrid.js +173 -0
  19. package/src/hdcom/BillShow.vue +90 -0
  20. package/src/hdcom/BillUpload.vue +253 -0
  21. package/src/hdcom/BtnRight.vue +98 -0
  22. package/src/hdcom/ErrHint.vue +30 -0
  23. package/src/hdcom/ExtendColumn.vue +108 -0
  24. package/src/hdcom/ExtendCommon.js +29 -0
  25. package/src/hdcom/ExtendForm.vue +114 -0
  26. package/src/hdcom/FacePicUpload.vue +71 -0
  27. package/src/hdcom/FaceRecTest.vue +104 -0
  28. package/src/hdcom/GridChart.vue +194 -0
  29. package/src/hdcom/GridExField.vue +281 -0
  30. package/src/hdcom/GridShow.vue +238 -0
  31. package/src/hdcom/HdAside.vue +178 -0
  32. package/src/hdcom/HdBtn.vue +113 -0
  33. package/src/hdcom/HdButton.vue +137 -0
  34. package/src/hdcom/HdComFaceRec.vue +58 -0
  35. package/src/hdcom/HdComGrid.vue +776 -0
  36. package/src/hdcom/HdComQuery.vue +273 -0
  37. package/src/hdcom/HdComQueryDetail.vue +161 -0
  38. package/src/hdcom/HdComSortDetail.vue +155 -0
  39. package/src/hdcom/HdDatePicker.vue +78 -0
  40. package/src/hdcom/HdDialog.vue +63 -0
  41. package/src/hdcom/HdDrop.vue +163 -0
  42. package/src/hdcom/HdFileUpload.vue +148 -0
  43. package/src/hdcom/HdFilterBox.vue +90 -0
  44. package/src/hdcom/HdFooter.vue +149 -0
  45. package/src/hdcom/HdForm.vue +278 -0
  46. package/src/hdcom/HdFormBtn.vue +89 -0
  47. package/src/hdcom/HdFormItem.vue +35 -0
  48. package/src/hdcom/HdGctosGrid +0 -0
  49. package/src/hdcom/HdGrid.vue +825 -0
  50. package/src/hdcom/HdGridEditBtn.vue +44 -0
  51. package/src/hdcom/HdGridExt.js +219 -0
  52. package/src/hdcom/HdGridSel.vue +223 -0
  53. package/src/hdcom/HdHeader.vue +148 -0
  54. package/src/hdcom/HdHotKey.vue +81 -0
  55. package/src/hdcom/HdInputHint.vue +49 -0
  56. package/src/hdcom/HdMain.vue +43 -0
  57. package/src/hdcom/HdMessage.vue +192 -0
  58. package/src/hdcom/HdNum.vue +69 -0
  59. package/src/hdcom/HdPopSel.vue +58 -0
  60. package/src/hdcom/HdRightMenu.vue +61 -0
  61. package/src/hdcom/HdSel/SelGridFieldcod.vue +36 -0
  62. package/src/hdcom/HdTableColumn.vue +334 -0
  63. package/src/hdcom/HdTempSave.vue +140 -0
  64. package/src/hdcom/HdTree.vue +86 -0
  65. package/src/hdcom/HdTreeTable/eval.js +32 -0
  66. package/src/hdcom/HdTreeTable/index.vue +174 -0
  67. package/src/hdcom/ImportExcel.vue +143 -0
  68. package/src/hdcom/PdfShow.vue +266 -0
  69. package/src/hdcom/index.js +80 -0
  70. package/src/idev.common.js +72 -0
  71. package/src/index.js +13 -0
  72. package/src/utils/HdQuery.js +54 -0
  73. package/src/utils/comutils.js +98 -0
  74. package/src/utils/utils.js +105 -0
  75. package/src/vendor/Blob.js +179 -0
  76. package/src/vendor/Export2Excel.js +220 -0
  77. package/src/vendor/Export2Zip.js +22 -0
  78. package/src/views/layout/AppMain.vue +32 -0
  79. package/src/views/layout/HdLayout.vue +78 -0
  80. package/src/views/layout/header/ElasticSearch.vue +225 -0
  81. package/src/views/layout/header/HZRecorder.js +231 -0
  82. package/src/views/layout/header/HeaderSearch.vue +198 -0
  83. package/src/views/layout/header/Levelbar.vue +49 -0
  84. package/src/views/layout/header/MainHeader.vue +271 -0
  85. package/src/views/layout/header/Navbar.vue +105 -0
  86. package/src/views/layout/header/ScrollPane.vue +81 -0
  87. package/src/views/layout/header/TagsView.vue +210 -0
  88. package/src/views/layout/header/VocRec.vue +97 -0
  89. package/src/views/layout/header/changepswform.vue +96 -0
  90. package/src/views/layout/index.js +12 -0
  91. package/src/views/layout/menu/Hamburger.vue +45 -0
  92. package/src/views/layout/menu/HdMenu.vue +167 -0
  93. package/src/views/layout/menu/css/menu.css +288 -0
  94. package/src/views/layout/menu/index.vue +25 -0
  95. package/src/views/privilege/commsg/commsg.vue +78 -0
  96. package/src/views/privilege/commsg/commsgOrgn.vue +42 -0
  97. package/src/views/privilege/commsg/commsgRole.vue +149 -0
  98. package/src/views/privilege/commsg/commsgform.vue +160 -0
  99. package/src/views/privilege/commsg/commsgiframe.vue +33 -0
  100. package/src/views/privilege/commsg/commsgto.vue +120 -0
  101. package/src/views/privilege/commsg/commsgtoform.vue +108 -0
  102. package/src/views/privilege/commsg/commsgtrans.vue +155 -0
  103. package/src/views/privilege/exfield/comexcolumn.vue +71 -0
  104. package/src/views/privilege/exfield/comexcolumnform.vue +101 -0
  105. package/src/views/privilege/exfield/comexfield.vue +31 -0
  106. package/src/views/privilege/exfield/comexfieldform.vue +94 -0
  107. package/src/views/privilege/exfield/comexfieldsub.vue +72 -0
  108. package/src/views/privilege/index.js +42 -0
  109. package/src/views/privilege/menu/comMenu.vue +41 -0
  110. package/src/views/privilege/menu/menu.vue +133 -0
  111. package/src/views/privilege/menu/menuinfo.vue +56 -0
  112. package/src/views/privilege/menu/rolelist.vue +47 -0
  113. package/src/views/privilege/menu/userlist.vue +49 -0
  114. package/src/views/privilege/mobile/authmobileupdate.vue +69 -0
  115. package/src/views/privilege/mobile/authmobileupdateform.vue +90 -0
  116. package/src/views/privilege/orgDept/authOrgn.vue +96 -0
  117. package/src/views/privilege/orgDept/authorgnform.vue +145 -0
  118. package/src/views/privilege/orgDept/orgDept.vue +37 -0
  119. package/src/views/privilege/orgDept/orgTree.vue +88 -0
  120. package/src/views/privilege/orgDept/orgnselect.vue +134 -0
  121. package/src/views/privilege/personDept/authuser.vue +123 -0
  122. package/src/views/privilege/personDept/authuserform.vue +154 -0
  123. package/src/views/privilege/personDept/facerec.vue +117 -0
  124. package/src/views/privilege/personDept/orgncascader.vue +125 -0
  125. package/src/views/privilege/personDept/personDept.vue +31 -0
  126. package/src/views/privilege/quartz/comquartzjob.vue +65 -0
  127. package/src/views/privilege/quartz/comquartzjobform.vue +99 -0
  128. package/src/views/privilege/quartz/comquartzlog.vue +59 -0
  129. package/src/views/privilege/role/btnRole.vue +117 -0
  130. package/src/views/privilege/role/menuRole.vue +64 -0
  131. package/src/views/privilege/role/orgnRole.vue +56 -0
  132. package/src/views/privilege/role/role.vue +67 -0
  133. package/src/views/privilege/role/rolelist.vue +67 -0
  134. package/src/views/privilege/role/roleselect.vue +57 -0
  135. package/src/views/privilege/search/comsearch.vue +105 -0
  136. package/src/views/privilege/search/menu.vue +52 -0
  137. package/src/views/privilege/syscode/syscode.vue +103 -0
  138. package/src/views/privilege/syscode/sysfield.vue +66 -0
  139. package/src/views/privilege/syscode/sysfieldframe.vue +30 -0
  140. package/src/views/privilege/syslog/menulog.vue +52 -0
  141. package/src/views/privilege/syslog/syslog.vue +115 -0
  142. package/src/views/privilege/syslog/syslogconfig.vue +61 -0
  143. package/src/views/privilege/syslog/syslogform.vue +83 -0
  144. package/src/views/privilege/syslog/syslogframe.vue +26 -0
  145. package/src/views/privilege/userRole/userRole.vue +122 -0
  146. package/src/views/privilege.zip +0 -0
  147. package/vite.config.js +118 -0
  148. package/.babelrc +0 -17
  149. package/.editorconfig +0 -14
  150. package/.eslintignore +0 -3
  151. package/.npminstall.done +0 -1
  152. package/.postcssrc.js +0 -8
  153. package/LICENSE +0 -21
  154. package/Listening +0 -28
  155. package/build/build.js +0 -70
  156. package/build/check-versions.js +0 -45
  157. package/build/config.js +0 -81
  158. package/build/dev-client.js +0 -9
  159. package/build/dev-server.js +0 -93
  160. package/build/utils.js +0 -78
  161. package/build/vue-loader.conf.js +0 -12
  162. package/build/webpack.common.js +0 -37
  163. package/build/webpack.component.js +0 -36
  164. package/build/webpack.prod.conf.js +0 -38
  165. package/components.json +0 -8
  166. package/conf.js +0 -42
  167. package/config/dev.env.js +0 -6
  168. package/config/index.js +0 -43
  169. package/config/prod.env.js +0 -6
  170. package/config/sit.env.js +0 -6
  171. package/favicon.ico +0 -0
  172. package/jsdoc-vue.js +0 -12
  173. package/lib/0.index.js +0 -12573
  174. package/lib/1.index.js +0 -6
  175. package/lib/2.index.js +0 -2
  176. package/lib/idev.common.js +0 -1
  177. package/lib/idv8.common.js +0 -1
  178. package/lib/index.js +0 -49170
  179. package/lib/js/ErrHint.js +0 -1
  180. package/lib/js/HdAside.js +0 -1
  181. package/lib/js/HdBtn.js +0 -1
  182. package/lib/js/HdButton.js +0 -1
  183. package/lib/js/HdComFaceRec.js +0 -1
  184. package/lib/js/HdComGrid.js +0 -1
  185. package/lib/js/HdDatePicker.js +0 -1
  186. package/lib/js/HdDialog.js +0 -1
  187. package/lib/js/HdDrop.js +0 -1
  188. package/lib/js/HdFileUpload.js +0 -1
  189. package/lib/js/HdFooter.js +0 -1
  190. package/lib/js/HdForm.js +0 -1
  191. package/lib/js/HdFormBtn.js +0 -1
  192. package/lib/js/HdFormItem.js +0 -1
  193. package/lib/js/HdGrid.js +0 -1
  194. package/lib/js/HdGridEditBtn.js +0 -1
  195. package/lib/js/HdGridSel.js +0 -1
  196. package/lib/js/HdHeader.js +0 -1
  197. package/lib/js/HdHotkey.js +0 -1
  198. package/lib/js/HdLayout.js +0 -1
  199. package/lib/js/HdMain.js +0 -1
  200. package/lib/js/HdMessage.js +0 -1
  201. package/lib/js/HdNum.js +0 -1
  202. package/lib/js/HdPopSel.js +0 -1
  203. package/lib/js/HdSearch.js +0 -1
  204. package/lib/js/HdTableColumn.js +0 -1
  205. package/lib/js/HdTempSave.js +0 -1
  206. package/lib/js/HdTree.js +0 -1
  207. package/lib/js/HdTreeTable.js +0 -1
  208. package/lib/js/authmobileupdate.js +0 -1
  209. package/lib/js/comexfield.js +0 -1
  210. package/lib/js/commsg.js +0 -1
  211. package/lib/js/commsgto.js +0 -1
  212. package/lib/js/comquartzjob.js +0 -1
  213. package/lib/js/comquartzlog.js +0 -1
  214. package/lib/js/comsearch.js +0 -1
  215. package/lib/js/menu.js +0 -1
  216. package/lib/js/menuinfo.js +0 -1
  217. package/lib/js/orgDept.js +0 -1
  218. package/lib/js/orgTree.js +0 -1
  219. package/lib/js/personDept.js +0 -1
  220. package/lib/js/role.js +0 -1
  221. package/lib/js/sysfieldframe.js +0 -1
  222. package/lib/js/syslog.js +0 -1
  223. package/lib/js/syslogframe.js +0 -1
  224. package/lib/js/userRole.js +0 -1
  225. package/npminstall-debug.log +0 -200
  226. package/ytgvue.rar +0 -0
@@ -0,0 +1,776 @@
1
+ <template>
2
+ <div style="height: 100%;">
3
+ <hd-com-query :allColumn="allColumn" :hdQuery="hdQuery" ref="comQuery"></hd-com-query>
4
+ <ImportExcel @on-selected-file='doImportExcel' ref="imExcel" v-if="imExcelIs"></ImportExcel>
5
+ <GridChart :allColumn="allColumn" :hdQuery="hdQuery" :url="chartUrl" ref="gridChart" v-if="gridChartIs"></GridChart>
6
+ <HdGrid :hdQuery="hdQuery" :hdResult="hdResult" @allExcel="doAllExcel" @extSets="extSets" ref="hdgrid"
7
+ @sel-ok="operaData" v-bind="$attrs" v-loading="listLoading" v-on="$listeners">
8
+ <template slot="extSets">
9
+ <el-dropdown-item command="flowHide">{{columnFlowThis.isShow ? $t('隐藏行按钮') : $t('显示行按钮')}}</el-dropdown-item>
10
+ <template v-if="!noAdQuery">
11
+ <el-dropdown-item command="comQuery" v-if="adQueryTemplateNameList.length>0">
12
+ <el-popover placement="left" width="160" v-model="visible" trigger="hover">
13
+ <div class="adquery" v-for="item in adQueryTemplateNameList" :key="item.queryId"
14
+ @click="adQueryTemplateClick(item.queryId)">{{item.name}} </div>
15
+
16
+ <span slot="reference">{{$t('高级查询')}}<i class="el-icon-arrow-down el-icon--right"></i></span>
17
+ </el-popover>
18
+ </el-dropdown-item>
19
+ <el-dropdown-item command="comQuery" v-else>{{$t('高级查询')}}</el-dropdown-item>
20
+ </template>
21
+ <el-dropdown-item command="gridChart" v-if="genChart">{{$t('图表统计')}}</el-dropdown-item>
22
+ <el-dropdown-item command="imExcel" v-if="imExcel">{{$t('导入excel')}}</el-dropdown-item>
23
+ <!-- <el-dropdown-item command="autoFilter" v-if="autoFilterVisable">{{autoFilterOpen ? $t('隐藏高级筛选') : $t('高级筛选')}}</el-dropdown-item>-->
24
+ <!-- <el-dropdown-item command="customeTree" v-if="customeTreeVisable">{{$t('自定义树')}}</el-dropdown-item>-->
25
+ <slot name="extSets"></slot>
26
+ </template>
27
+ <template slot="query">
28
+ <slot name="query"></slot>
29
+ </template>
30
+ <slot></slot>
31
+ <template slot="rightMenu">
32
+ <slot name="rightMenu"></slot>
33
+ </template>
34
+ <template slot="rightMenuExt">
35
+ <slot name="rightMenuExt"></slot>
36
+ </template>
37
+ <template slot="btnTool">
38
+ <slot name="btnTool"></slot>
39
+ </template>
40
+ </HdGrid>
41
+ </div>
42
+ </template>
43
+
44
+ <script>
45
+ import HdComQuery from './HdComQuery'
46
+ import ImportExcel from './ImportExcel'
47
+ import GridChart from './GridChart'
48
+ import HdGrid from './HdGrid'
49
+
50
+ /**
51
+ * 封装了增删改查,导入导出excel,高级查询,列表展示设置等功能的列表
52
+ * @module HdComGrid
53
+ */
54
+ export default {
55
+ name: 'HdComGrid',
56
+ components: { HdComQuery, ImportExcel, GridChart, HdGrid },
57
+ data() {
58
+ return {
59
+ hdResult: {
60
+ rows: [],
61
+ total: 0,
62
+ },
63
+ listLoading: false,
64
+ visible: false,
65
+ allColumn: [], // 高级查询用,有prop的column
66
+ columnFlowThis: {}, // 浮动区隐藏显示
67
+ imExcelIs: false,// 提升效率
68
+ gridChartIs: false,// 提升效率
69
+ saveIng: false,//保存时,使点击失效
70
+ autoFilterOpen: false,
71
+ adQueryTemplateNameList: [],
72
+ }
73
+ },
74
+ inheritAttrs: false,
75
+ /**
76
+ * Props 继承ElTable的属性和事件
77
+ * @prop {Boolean} imExcel 是否可以导入excel 默认false
78
+ * @prop {Object} hdQuery 查询条件的封装对象,多以hdQuery.query.xx=xx调用
79
+ * @prop {Boolean} notInit 不立即执行查询,默认立即查询
80
+ * @prop {String} url url前缀
81
+ * @prop {String} findUrl url前缀,遵循命名规范,后面的*url均可省略
82
+ * @prop {String} findoneUrl url后缀 默认为 url/findone ,非默认值才需要写
83
+ * @prop {String} saveoneUrl 同上
84
+ * @prop {String} saveAllUrl 同上
85
+ * @prop {String} removeUrl 同上
86
+ * @prop {String} imExcelUrl 同上,导入导出excel特别说明:导出如果TableColumn有inputFormat(function),会先调用inputFormat格式导出的值
87
+ * @prop {Array} noExcelExport 继承HdGrid,不导出excel属性['xxId','xx']
88
+ * @prop {String} height 继承HdGrid,高度,不建议用,请直接在布局文件的高度
89
+ * @prop {Object} hdQuery 继承HdGrid,查询的封装,一列表必须一个hdQuery,不能共享否则分页失效
90
+ * @prop {Boolean} noSets 继承HdGrid,不显示右上角的设置
91
+ * @prop {Object} defaultSort (重要)继承HdGrid和ELementUi的Eltable,
92
+ * 排序默认按照updTim降序,demo:修改为sorter排序:defaultSort="{prop: 'sorter', order: 'ascending'}" ,
93
+ * 后端jpql(禁止直接拼jpql的order by,否则会影响表头排序): hdQuery.getSorts().addParam("sequence", SortParam.SORT_ASC, "a");(在前端排序之后)最后效果 order by sort asc,sequence asc
94
+ * @prop {boolean} pageHide 继承HdGrid 是否隐藏分页
95
+ * @prop {boolean} ckHide 继承HdGrid 是否隐藏checkbox
96
+ * @prop {boolean} indexHide 继承HdGrid 是否隐藏 序号
97
+ * @prop {boolean} recHide 继承HdGrid 是否隐藏创建人4字段
98
+ * @prop {boolean} genChart 是否开启图表生成,在EltableColumn增加chartNum属性可以实现,统计值的下拉扩展
99
+ * @prop {String} chartUrl 默认genChart,需要genChart=true
100
+ * 导入excel依赖导出的模板,上传后,后台直接获取excel中的实体,参考authuser
101
+ * @prop {String} pageSizes 每页分页,写法:pageSizes="[100,500,1000,5000,10000]"
102
+ * @prop {Object} exField 是否有扩展字段 open开启,table扩展字段所在表,field扩展字段使用字段
103
+ */
104
+ props: {
105
+ imExcel: Boolean, // 是否开启导入excel
106
+ hdQuery: {// 查询list
107
+ type: Object,
108
+ default: function () {
109
+ return new HdQuery(this)
110
+ }
111
+ },
112
+ notInit: Boolean, // 不立即显示,通过调用doQuery显示或者queryUrl变更触发
113
+ validate: {// 校验
114
+ type: Object,
115
+ default: function () {
116
+ return {}
117
+ }
118
+ }, // 校验
119
+ url: String, // 默认url,通常用代码生成器,后面的url不需要改
120
+ findUrl: {// 查询list
121
+ type: String,
122
+ default: function () {
123
+ return this.url + '/find'
124
+ }
125
+ },
126
+ findoneUrl: {// 单值查询 doEdit
127
+ type: String,
128
+ default: function () {
129
+ return this.url + '/findone'
130
+ }
131
+ },
132
+ saveoneUrl: {// 保存
133
+ type: String,
134
+ default: function () {
135
+ return this.url + '/saveone'
136
+ }
137
+ }, // 保存list
138
+ saveAllUrl: {// 保存
139
+ type: String,
140
+ default: function () {
141
+ return this.url + '/saveAll'
142
+ }
143
+ },
144
+ removeUrl: {// 单条删
145
+ type: String,
146
+ default: function () {
147
+ return this.url + '/remove'
148
+ }
149
+ },
150
+ removeAllUrl: {
151
+ type: String,
152
+ default: function () {
153
+ return this.url + '/removeAll'
154
+ }
155
+ },
156
+ imExcelUrl: {
157
+ type: String,
158
+ default: function () {
159
+ return this.url + '/imExcel'
160
+ }
161
+ },
162
+ genChart: Boolean, // 是否开启图表生成,后台需要写
163
+ chartUrl: {
164
+ type: String,
165
+ default: function () {
166
+ return this.url + '/genChart'
167
+ }
168
+ },
169
+ noCopy: [Array, String],// 不拷贝的主键,请确保第一位是主键 //:noCopy="['codeId']"或者noCopy="codeId"
170
+ addWay: Function, //底部按钮工具栏的自定义增加方法传入
171
+ saveWay: Function,//底部按钮工具栏的自定义保存方法传入
172
+ autoFilterVisable: {
173
+ type: Boolean,
174
+ default: false,
175
+ },
176
+ customeTreeVisable: Boolean,
177
+ isNotDbEdit: {
178
+ type: Boolean,
179
+ default: false,
180
+ },
181
+ noAdQuery: {
182
+ type: Boolean,
183
+ default: false
184
+ }
185
+ },
186
+
187
+ mounted() {
188
+ this.hdQuery.setThis(this) // 切换this指向,主要是因为doQuery已经封装
189
+ if (!this.notInit) {
190
+ this.doQuery()
191
+ }
192
+ this.flushAdQueryTemplate()
193
+ },
194
+ /**
195
+ * @function 调用el-table 的方法 需要 this.$refs.当前grid.$refs.hdgrid.$refs.ingrid.method()
196
+ * */
197
+ methods: {
198
+ /**
199
+ * @function extSets
200
+ * @param {String} command 设置项的执行,可通过slot=extSets扩展自己的设置
201
+ * 触发事件extSets(command)
202
+ */
203
+ extSets(command) {
204
+ if (command == 'comQuery') {
205
+ this.$nextTick(() => {
206
+ this.$refs.comQuery.show()
207
+ })
208
+ } else if (command == 'flowHide') {
209
+ this.columnFlowThis.isShow = !this.columnFlowThis.isShow
210
+ } else if (command == 'imExcel') {
211
+ this.imExcelIs = true
212
+ this.$nextTick(() => {
213
+ this.$refs.imExcel.show()
214
+ })
215
+ } else if (command == 'gridChart') {
216
+ this.gridChartIs = true
217
+ this.$nextTick(() => {
218
+ this.$refs.gridChart.show()
219
+ })
220
+ } else if (command == 'autoFilter') {
221
+ this.autoFilterOpen = !this.autoFilterOpen;
222
+ // this.$refs.hdgrid.$refs.ingrid.states._columns.forEach(v=>console.log('v',v))
223
+ } else {
224
+ this.$emit('extSets', command)
225
+ }
226
+ },
227
+ /**
228
+ * @function doQuery 查询
229
+ *
230
+ * @param {data} data!=null,直接赋值,不走后台
231
+ * return promise 用于在查询后执行的事件
232
+ */
233
+ doQuery(data) { // 存在data时,直接赋值,不走后台
234
+ if (data) {
235
+ this.hdResult = data
236
+ return true
237
+ }
238
+ this.hdQuery.selRow = null // 查询时,清除选中行
239
+ if (!this.hdQuery._noLoadingOnce) { // form翻页时,会触发列表的loading出现闪屏
240
+ this.listLoading = true
241
+ } else { // 只当前一次
242
+ this.hdQuery._noLoadingOnce = false
243
+ }
244
+ const promise = new Promise((resolve, reject) => {
245
+ this.$nextTick(() => {
246
+ this.$http.post(this.findUrl, this.hdQuery).then(response => {
247
+ this.listLoading = false
248
+
249
+ // let grid = this.$refs.hdgrid.$refs.ingrid
250
+ // grid.$refs.tableHeader ? grid.$refs.tableHeader.filterPanels = {} : '';
251
+ // grid.$refs.fixedTableHeader ? grid.fixedTableHeader.tableHeader.filterPanels = {} : '';
252
+ // grid.$refs.rightFixedTableHeader ? grid.$refs.rightFixedTableHeader.filterPanels = {} : '';
253
+
254
+ this.hdResult = response.data
255
+ // this.hdResult = Object.assign(response.data, {filters: this.hdResult.filters || []})
256
+ // this.hdResult._rows = this.hdResult.rows
257
+
258
+ // this.$nextTick(() => {
259
+ // this.$refs.hdgrid.filterHdResult();
260
+ // })
261
+ //选第一个
262
+ // if (this.hdResult.rows.length > 0) {
263
+ // this.$set(this.hdResult.rows[0], '_isCk', true)
264
+ // this.$nextTick(() => {
265
+ // this.$refs.hdgrid.$refs.ingrid.toggleRowSelection(this.hdResult.rows[0], true)
266
+ // this.$refs.hdgrid.setCurrentRow(0, true)
267
+ // })
268
+ // }
269
+ resolve(response.data)
270
+ }).catch(response => {
271
+ this.listLoading = false
272
+ })
273
+ })
274
+ })
275
+ return promise
276
+ },
277
+
278
+ doAllExcel(call) {//pdf也用了这个函数
279
+ const excelQuery = new HdQuery(this)
280
+ Object.assign(excelQuery, this.hdQuery)
281
+ excelQuery.rows = 2000;
282
+ console.log('导出全部excel,最多导出2000条')
283
+ call(this.$http.post(this.findUrl, excelQuery))
284
+ },
285
+
286
+ /**
287
+ * @function doEdit 行内编辑开始
288
+ * @param {row} row==''或null为增加,会从findoneUrl走后台查询,有值时,直接使用当前row
289
+ *
290
+ * */
291
+ doEdit(row, rowData) { // 增加或编辑
292
+ this.$nextTick(() => {
293
+ if (!row) { // 空:增加
294
+ this.$http.post(this.findoneUrl, this.hdQuery).then(response => {
295
+ this.$set(response.data, 'isEdit', true)
296
+ this.$set(response.data, '_add', new Date().getTime() + Math.random())
297
+ let row = Object.assign(response.data, rowData);
298
+ this.hdResult.rows.unshift(row)// 从开头增加
299
+ this.$refs.hdgrid.$refs.ingrid.$refs.bodyWrapper.scrollTop = 0;
300
+ this.doVaild(row);
301
+ })
302
+ } else { // 编辑,不走后台
303
+ this.$set(row, 'isEdit', true)
304
+ row._oriData = {}
305
+ //$.extend( row._oriData, row)
306
+ row._oriData = Object.assign({}, row) //Object.assign(row._oriData, row)会无限递归
307
+ this.doVaild(row);
308
+ }
309
+
310
+ this.resetCurHightRow()
311
+ })
312
+ },
313
+ /**
314
+ * @function doCancel 行内编辑取消
315
+ * */
316
+ doCancel(row, index) { // 撤销时\
317
+ this.clearValiHint(row)
318
+ if (row._add) { // 没有保存的
319
+ for (let i = 0; i < this.hdResult.rows.length; i++) {
320
+ if (this.hdResult.rows[i]._add == row._add) {
321
+ this.hdResult.rows.splice(i, 1)
322
+ this.resetCurHightRow()
323
+ return false
324
+ }
325
+ }
326
+ }
327
+ Object.assign(row, row._oriData)
328
+ this.$set(row, 'isEdit', false)
329
+ this.resetCurHightRow()
330
+ },
331
+
332
+ /**
333
+ * @function doRemove 行内删除,有promise(data)回调 回调可参考authorgn
334
+ * */
335
+ doRemove(row) {
336
+ const promise = new Promise((resolve, reject) => {
337
+ this.$confirm(this.$t('确定删除本数据?'), this.$t('提示'), {}).then(() => {
338
+ this.$http.post(this.removeUrl, row).then(response => {
339
+ const data = response.data
340
+ this.$message({
341
+ type: data.code == '-1' ? 'error' : 'success',
342
+ showClose: true,
343
+ duration: data.code == '-1' ? 6000 : 1500,
344
+ message: data.message
345
+ })
346
+ if (data.code == '-1') {
347
+ reject(data)
348
+ return
349
+ }
350
+ resolve(data)
351
+ this.hdResult.rows.remove(row)
352
+ // this.doQuery()
353
+ })
354
+ }).catch((e) => {
355
+ })
356
+ })
357
+ promise.catch(function (error) {
358
+ })
359
+ this.resetCurHightRow()
360
+ return promise
361
+ },
362
+
363
+ /**
364
+ * @function doRemoveAll 根据ck选中的删除,有promise(data)回调
365
+ * */
366
+ doRemoveAll() {
367
+ let ckRows = this.$refs.hdgrid.getCkRows()
368
+ if (!ckRows || ckRows.length == 0) {
369
+ this.$message({
370
+ type: 'error',
371
+ message: this.$t('请选择数据'),
372
+ showClose: true,
373
+ duration: 1500
374
+ })
375
+ return false
376
+ }
377
+ const promise = new Promise((resolve, reject) => {
378
+ this.$confirm(this.$t('确定删除选中数据?'), this.$t('提示'), {}).then(() => { // 有删除提示,所以不需要nextTrick
379
+ this.$http.post(this.removeAllUrl, ckRows).then(response => {
380
+ const data = response.data
381
+ this.$message({
382
+ type: data.code === '-1' ? 'error' : 'success',
383
+ showClose: true,
384
+ duration: data.code == '-1' ? 6000 : 1500,
385
+ message: data.message
386
+ })
387
+ if (data.code === '-1') {
388
+ reject(data)
389
+ return
390
+ }
391
+ resolve(data)
392
+ this.hdResult.rows.remove(ckRows)
393
+ // this.doQuery()
394
+ })
395
+ }).catch(() => {
396
+ })
397
+ })
398
+ promise.catch(function (error) {
399
+ })
400
+ this.resetCurHightRow()
401
+ return promise
402
+ },
403
+
404
+ saveCheck() {
405
+ const validator = new schema(this.validate)
406
+ return validator
407
+ },
408
+
409
+ /**
410
+ * @function doSave 行内编辑保存,有promise(data)回调
411
+ * */
412
+ doSave(row) {
413
+ this.clearValiHint(row)
414
+ const promise = new Promise((resolve, reject) => {
415
+ this.saveCheck().validate(row, (errors, fields) => {
416
+ if (errors) { // 错误的提醒
417
+
418
+ errors.forEach((err, index) => {
419
+ console.info(err.field + '--' + err.message)
420
+ this.$set(row, '_err_' + err.field, err.message)
421
+ })
422
+ this.$message({
423
+ type: 'error',
424
+ message: this.$t('填写有误'),
425
+ showClose: true,
426
+ duration: 1500
427
+ })
428
+ } else {
429
+ this.$nextTick(() => {
430
+ if (this.saveIng) {
431
+ reject(false)
432
+ return false
433
+ }
434
+ this.saveIng = true
435
+ this.$http.post(this.saveoneUrl, row).then(response => {
436
+ this.saveIng = false
437
+ const data = response.data
438
+ this.$message({
439
+ type: data.code == '-1' ? 'error' : 'success',
440
+ message: data.message,
441
+ showClose: true,
442
+ duration: data.code == '-1' ? 6000 : 1500,
443
+ })
444
+ if (data.code == '-1') {
445
+ reject(data)
446
+ return
447
+ }
448
+ resolve(data)
449
+ Object.assign(row, data.data) // 对象重新赋值
450
+ row._add = null
451
+ this.$set(row, 'isEdit', false)
452
+ }).catch(response => {
453
+ this.saveIng = false
454
+ })
455
+ })
456
+ }
457
+ })
458
+ })
459
+ promise.catch(function (error) {
460
+ })
461
+ this.resetCurHightRow()
462
+ return promise
463
+ },
464
+
465
+ clearValiHint(row) {
466
+ for (const p in row) {
467
+ if (p.indexOf('_err_') == 0) {
468
+ row[p] = ''
469
+ }
470
+ }
471
+ },
472
+
473
+ /**
474
+ * @function doCopy 支持深度复制(对象中嵌套对象)
475
+ * */
476
+ doCopy() {
477
+ let ckRows = this.$refs.hdgrid.getCkRows()
478
+ if (!ckRows || ckRows.length == 0) {
479
+ this.$message({
480
+ type: 'error',
481
+ message: this.$t('请勾选数据')
482
+ })
483
+ return false
484
+ }
485
+ for (let i = 0; i < ckRows.length; i++) {
486
+ this.doCopyOne(ckRows[i], i);
487
+ }
488
+ this.resetCurHightRow()
489
+ },
490
+ doCopyOne(row, i) {
491
+ let nowTime = new Date().getTime()
492
+
493
+ const one = JSON.parse(JSON.stringify(row))// 深度复制
494
+ one._add = nowTime + i//复制都是新增的
495
+ let noCpLs = ['recNam', 'recTim', 'updNam', 'updNam', 'updTim', 'idevVersionUse']
496
+ if (this.noCopy) {
497
+ if (typeof this.noCopy == 'string') { // 可以是字符串或者数组
498
+ noCpLs.push(this.noCopy)
499
+ } else {
500
+ noCpLs = noCpLs.concat(this.noCopy)
501
+ }
502
+ for (let j = 0; j < noCpLs.length; j++) { // 不需要复制的属性给null
503
+ eval('one.' + noCpLs[j] + ' = null')// eval是为了支持深度
504
+ }
505
+ }
506
+ this.$set(one, 'isEdit', true)
507
+ this.$set(one, '_isCK', false)
508
+ this.$set(row, '_isCK', false)
509
+ // console.log(row)
510
+ this.doVaild(one)
511
+ this.hdResult.rows.unshift(one)// 从开头增加
512
+ },
513
+ /**
514
+ * @function doSaveAll 所有编辑状态的一起保存,有promise(data)回调
515
+ * */
516
+ doSaveAll() { // 批量保存
517
+ const promise = new Promise((resolve, reject) => {
518
+ const allEditRow = this.hdResult.rows.filter(v => {
519
+ this.clearValiHint(v)
520
+ return v.isEdit// 只看编辑的
521
+ })
522
+ if (allEditRow.length == 0) {
523
+ this.$message({
524
+ type: 'error',
525
+ message: this.$t('无数据保存'),
526
+ showClose: true,
527
+ duration: 1500
528
+ })
529
+ return false
530
+ }
531
+ this.$nextTick(() => {
532
+ this.checkAllRow(allEditRow, 0, false, this.callSaveAll, { resolve, reject })
533
+ })
534
+ })
535
+ promise.catch(function (error) {
536
+ })
537
+ return promise
538
+ },
539
+
540
+ checkAllRow(rows, index, hasError, call, { resolve, reject }) {
541
+ if (rows.length == index) {
542
+ call(hasError, { resolve, reject })
543
+ return true
544
+ }
545
+ this.saveCheck().validate(rows[index], (errors, fields) => {
546
+ if (errors) { // 错误的提醒
547
+ errors.forEach((err, i) => {
548
+ this.$set(rows[index], '_err_' + err.field, err.message)
549
+ })
550
+ hasError = true
551
+ }
552
+ this.checkAllRow(rows, ++index, hasError, call, { resolve, reject })
553
+ })
554
+ },
555
+
556
+ callSaveAll(hasError, { resolve, reject }) {
557
+ if (hasError) {
558
+ this.$message({
559
+ type: 'error',
560
+ message: this.$t('填写有误'),
561
+ showClose: true,
562
+ duration: 1500
563
+ })
564
+ } else {
565
+ const allEditRow = this.hdResult.rows.filter(v => {
566
+ return v.isEdit
567
+ })
568
+ this.$http.post(this.saveAllUrl, allEditRow).then(response => {
569
+ const data = response.data
570
+ this.$message({
571
+ type: data.code == '-1' ? 'error' : 'success',
572
+ message: data.message,
573
+ showClose: true,
574
+ duration: data.code == '-1' ? 6000 : 1500,
575
+ })
576
+ if (data.code == '-1') {
577
+ reject(data)
578
+ return
579
+ }
580
+ if (data.data) {
581
+ for (let i = 0; i < data.data.length; i++) {
582
+ const newData = data.data[i]
583
+ const oldData = allEditRow[i]
584
+ Object.assign(oldData, newData) // 对象重新赋值
585
+ this.$set(oldData, 'isEdit', false)
586
+ oldData._add = null
587
+ }
588
+ }
589
+ resolve(data)
590
+ })
591
+ }
592
+ },
593
+ resetCurHightRow() {
594
+ this.$refs.hdgrid.$refs.ingrid.setCurrentRow()
595
+ if (this.hdQuery && this.hdQuery.selRow) {
596
+ setTimeout(() => {
597
+ this.$refs.hdgrid.$refs.ingrid.setCurrentRow(this.hdQuery.selRow)
598
+ }, 300)
599
+ return true
600
+ }
601
+ },
602
+
603
+ /**
604
+ * @function addHotKey 快捷键 上下选择 左右翻页,下拉列表会用到
605
+ * */
606
+ addHotKey() { // 使用快捷键
607
+ this.$refs.hdgrid.addHotKey()
608
+ },
609
+
610
+ /**
611
+ * @function removeHotKey 移除快捷键
612
+ * */
613
+ removeHotKey() { // 移除快捷键
614
+ this.$refs.hdgrid.removeHotKey()
615
+ },
616
+
617
+ /**
618
+ * @function doImportExcel 导入excel 设置 触发,有promise(data)回调
619
+ * */
620
+ doImportExcel(data) {
621
+ // console.info(data)
622
+ if (!data || data.results.length <= 0) { // 第一行为中文,不需要
623
+ this.$message({
624
+ type: 'error',
625
+ message: this.$t('Excel模板解析错误'),
626
+ showClose: true,
627
+ duration: 1500
628
+ })
629
+ return false
630
+ }
631
+ const nwData = data.results
632
+ const promise = new Promise((resolve, reject) => {
633
+ this.$confirm(this.$t('本次上传数据为') + nwData.length + this.$t('行,是否继续?'), this.$t('提示'), {}).then(() => {
634
+ this.$http.post(this.imExcelUrl, nwData).then(response => {
635
+ const data = response.data
636
+ this.$message({
637
+ type: data.code == '-1' ? 'error' : 'success',
638
+ showClose: true,
639
+ duration: data.code == '-1' ? 6000 : 1500,
640
+ message: data.message
641
+ })
642
+ if (data.code == '-1') {
643
+ reject(data)
644
+ return
645
+ }
646
+ this.imExcelIs = false
647
+ resolve(data)
648
+ this.$emit("success-import", data)
649
+ this.doQuery()
650
+ })
651
+ }).catch((e) => {
652
+ })
653
+ })
654
+ promise.catch(function (error) {
655
+ })
656
+ this.resetCurHightRow()
657
+ return promise
658
+ },
659
+ /**
660
+ * @function getCkRows 获取ck选中的行
661
+ * */
662
+ getCkRows() {
663
+ return this.$refs.hdgrid.getCkRows()
664
+ },
665
+ getSelRow() {
666
+ return this.hdQuery.selRow
667
+ },
668
+ /**
669
+ * @function beforeAdd 增加前的校验
670
+ * */
671
+ beforeAdd() {
672
+
673
+ },
674
+ /**
675
+ * @function beforeSave 保存前的校验
676
+ * */
677
+ beforeSave() {
678
+
679
+ },
680
+ /**
681
+ * @function operaData 增加、删除、保存、复制 数据
682
+ * */
683
+ operaData(command, row) {
684
+ /*let wayArr=[]
685
+ if (this.noDefWay){
686
+ if (typeof this.noCopy == 'string'){//字符串
687
+ wayArr.push(this.noDefWay)
688
+ }else{//数组
689
+ wayArr = wayArr.concat(this.noDefWay)
690
+ }
691
+ }*/
692
+ if (command == 'doAdd') {
693
+ if (this.addWay) {
694
+ this.addWay()
695
+ } else {
696
+ this.doEdit('')
697
+ }
698
+ //this.$emit('doAdd')
699
+ } else if (command == 'doRemove') {
700
+ this.doRemoveAll()
701
+ //this.$emit('doRemoveAll')
702
+ } else if (command == 'doSave') {
703
+ if (this.saveWay) {
704
+ this.saveWay()
705
+ } else {
706
+ this.doSaveAll()
707
+ }
708
+ //this.$emit('doSaveAll')
709
+ } else if (command == 'doCopy') {
710
+ this.doCopy()
711
+ //this.$emit('doCopy')
712
+ } else if (command == 'doUpdateOne') {
713
+ if (!this.isNotDbEdit) {
714
+ this.doEdit(row)
715
+ }
716
+ } else if (command == 'doRemoveOne') {
717
+ this.doRemove(row)
718
+ //this.$emit('doCopy')
719
+ } else if (command == 'doCopyOne') {
720
+ this.doCopyOne(row, 0)
721
+ this.resetCurHightRow()
722
+ //this.$emit('doCopy')
723
+ }
724
+
725
+ },
726
+ doVaild(row) {
727
+ this.saveCheck().validate(row, (errors, fields) => {
728
+ // console.log(row, errors)
729
+ if (errors) { // 错误的提醒
730
+
731
+ errors.forEach((err, index) => {
732
+ console.info(err.field + '--' + err.message)
733
+ this.$set(row, '_err_' + err.field, err.message)
734
+ })
735
+ }
736
+ })
737
+ },
738
+ flushAdQueryTemplate() {
739
+ this.adQueryTemplateNameList = []
740
+ const innHdQuery = { query: {} }
741
+ innHdQuery.query.menuId = this.$route.name
742
+ innHdQuery.query.gridId = this.$refs.hdgrid.gridId
743
+ this.$http.post('/webresources/login/com/ComQuery/find/', innHdQuery).then(response => {
744
+ this.adQueryTemplateNameList = response.data
745
+ })
746
+ },
747
+ adQueryTemplateClick(queryId) {
748
+ if (!this.$refs.comQuery) {
749
+ return
750
+ }
751
+ this.$http.post('/webresources/login/com/ComQuery/findDetail?queryId=' + queryId).then(response => {
752
+ const data = response.data
753
+ this.hdQuery.vueleftQueryLs = []
754
+ this.hdQuery.vuerightQueryLs = []
755
+ this.$refs.comQuery.addToHdQuery(this.hdQuery.vueleftQueryLs, this.$refs.comQuery.listInit(data[0]))
756
+ this.hdQuery.vueGroupRel = 'or'
757
+ this.$refs.comQuery.addToHdQuery(this.hdQuery.vuerightQueryLs, this.$refs.comQuery.listInit(data[1]))
758
+ this.hdQuery.sorts = { params: this.$refs.comQuery.sortInit(data[2]) }
759
+ this.hdQuery.sort = ''
760
+ this.doQuery()
761
+ })
762
+ },
763
+ selectPart(e) {
764
+ this.$refs.hdgrid.selectPart(e);
765
+ },
766
+ unSelectPart(e) {
767
+ this.$refs.hdgrid.selectPart(e, true)
768
+ }
769
+ },
770
+
771
+ watch: {}
772
+
773
+ }
774
+ </script>
775
+ <style scoped>
776
+ </style>