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,334 @@
1
+ <template>
2
+ <!--改动说明,btnRight 和isShow是该column是否显示,只在fixed:right时使用,-->
3
+ <div v-if="!btnRight||!isShow"></div>
4
+ <ExTableColumn :class-name="getClassName($attrs)" :label="$t($attrs.label)" :sortable="realSortable"
5
+ :width="autoWidth" :showOverflowTooltip="showOverflowTooltip" v-bind="$attrs" v-else-if="!$slots.default"
6
+ v-on="$listeners" :filters="filterData" :filter-method="isOpenFilter ? ()=>true : null">
7
+ <template slot="header" slot-scope="scope">
8
+ <slot name="header" :index="scope.$index" :row="scope.row">
9
+ {{$t($attrs.label)}}
10
+ </slot>
11
+ </template>
12
+ <template slot-scope="scope">
13
+ <slot :index="scope.$index" :row="scope.row">
14
+ <!--noEdit不允许编辑-->
15
+ <template v-if="scope.row.isEdit&&!noEdit">
16
+ <component :gridRow="scope.row" :idVal.sync="scope.row[$attrs.idVal]" :is="input"
17
+ :txtVal.sync="scope.row[$attrs.txtVal]" @blur="checkErr(scope.row)"
18
+ @change="(v)=>{$emit('change',v,scope.row)}" @selItem="(v)=>{selItem(scope.row,v)}" style="width: 100%;"
19
+ v-bind="inputProp" v-model="scope.row[$attrs.prop]"></component>
20
+ </template>
21
+ <template v-else-if="!isHtml">{{getValueByPath(scope.row, $attrs.prop)}}</template>
22
+ <template v-else>
23
+ <div v-html="getValueByPath(scope.row, $attrs.prop)"></div>
24
+ </template>
25
+ </slot>
26
+ <template v-if="scope.row.isEdit&&!noEdit">
27
+ <ErrHint :errMsg="scope.row['_err_'+$attrs.prop]" @checkErr="(v)=>{checkErr(scope.row,v)}"
28
+ v-model="scope.row[$attrs.prop]"></ErrHint>
29
+ </template>
30
+ </template>
31
+ </ExTableColumn>
32
+ <!--复合表头时,但是复合表头里的具体表头依然会进入第一个条件-->
33
+ <ExTableColumn :label="$t($attrs.label)" :sortable="realSortable" :width="autoWidth"
34
+ :showOverflowTooltip="showOverflowTooltip" v-bind="$attrs" v-else-if="$slots.default" v-on="$listeners">
35
+ <slot></slot>
36
+ </ExTableColumn>
37
+ <!--没啥用-->
38
+ <ExTableColumn :label="$t($attrs.label)" :sortable="realSortable" :width="autoWidth"
39
+ :showOverflowTooltip="showOverflowTooltip" v-bind="$attrs" v-else v-on="$listeners">
40
+ </ExTableColumn>
41
+ </template>
42
+ <script>
43
+ import AsyncValidator from "async-validator";
44
+ import BtnRight from "./BtnRight";
45
+
46
+ /**
47
+ *覆盖ElTableColumn 主要增加行内编辑的校验,及增加inputProp input inputFormat selFormat属性(与高级查询配合),在多数情况可以不用写templeate
48
+ * @module HdTableColumn
49
+ */
50
+ export default {
51
+ name: "ElTableColumn",
52
+ inheritAttrs: false,
53
+ components: {},
54
+ mixins: [BtnRight],
55
+ /**
56
+ * Props input属性对应的自定义组件,行内编辑的特殊性,开发时,可能会使用以下属性和事件
57
+ * @prop {Object} gridRow 组件获取当前行数据
58
+ * @prop {Event} blur 触发校验
59
+ * @prop {String} txtVal 自定义下拉hdgridsel 选择文本内容
60
+ * @prop {String} idVal 自定义下拉hdgridsel 选择id值
61
+ * @prop {Event} selItem(row, v) 选择时触发selFormat(row, prop,sel)格式化
62
+ * @prop {Event} change(v) 对组件的change增加第2参数为当前行 参考onlineunloadform.vue的件重计算
63
+ */
64
+ /**
65
+ * Props 继承ElTableColumn的属性和事件,
66
+ * @prop {Object} 或String,可参考demo/hightquery,input 行内编辑或高级查询时,输入区的类型默认ElInput,系统或框架组件,可以直接写字符串,自定义组件需要这样写: :input="require('@/views/comgctos/sel_sbccargokind').default"
67
+ * @prop {Object} inputProp input对应的属性
68
+ * @prop {Function} inputFormat(value, row, prop) 展示时格式化,value当前值,row当前行,prop属性名
69
+ * @prop {Function} selFormat(row, prop,sel) 选择时格式化
70
+ * @prop {Boolean} noEdit 行内编辑时是否不编辑
71
+ * @prop {Boolean} noQuery 高级查询时,不计入选择
72
+ * @prop {event} @change(v,row) 对组件的change增加第2参数为当前行 参考onlineunloadform.vue的件重计算
73
+ * @prop {String} width 增加一个auto属性,会根据label自动计算宽度(国际化会自动展开)
74
+ * @prop {Boolean} showOverflowTooltip 是否缩进过长内容
75
+ */
76
+ props: {
77
+ input: {
78
+ // 输入类型
79
+ type: [String, Object],
80
+ default: function () {
81
+ // updTimFirst是因为会触发HdQuery的排序及查询,默认不让查询
82
+ return "ElInput";
83
+ },
84
+ },
85
+ inputProp: Object, // input的属性
86
+ inputFormat: Function, // result, object, prop 展示时格式化
87
+ selFormat: Function, // row, prop,sel 选择时格式化
88
+ noEdit: {
89
+ // 编辑时是否可编辑
90
+ type: Boolean,
91
+ default: function () {
92
+ return false;
93
+ },
94
+ },
95
+ noZeroHide: {
96
+ type: Boolean,
97
+ default: false,
98
+ },
99
+ noQuery: Boolean, // 不需要高级查询
100
+ sortable: {
101
+ // 排序只用custom不用前端排序
102
+ type: Boolean,
103
+ default: function () {
104
+ return false;
105
+ },
106
+ },
107
+ rules: Array, // 校验
108
+ perWidth: {
109
+ type: Number,
110
+ default: 12,
111
+ }, //每个字节的宽度(中文为2个字节)
112
+ showOverflowTooltip: {
113
+ // 编辑时是否可编辑
114
+ type: Boolean,
115
+ default: function () {
116
+ return true;
117
+ },
118
+ },
119
+ openFilter: {
120
+ type: Boolean,
121
+ default: function () {
122
+ return false;
123
+ },
124
+ },
125
+ isHtml: {
126
+ // 编辑时是否可编辑
127
+ type: Boolean,
128
+ default: function () {
129
+ return false;
130
+ },
131
+ },
132
+ },
133
+ mounted() {
134
+ this.isFixDo();
135
+ const comPar = this.getHdComGrid();
136
+ if (comPar) {
137
+ const allrules = comPar.validate; // hdcomgrid的rules
138
+ if (allrules && this.rules) {
139
+ allrules[this.$attrs.prop] = this.rules;
140
+ }
141
+ if (this.$attrs.prop && !this.noQuery) {
142
+ // 高级查询用
143
+ comPar.allColumn.push(this);
144
+ }
145
+ }
146
+ const hdPar = this.getHdGrid();
147
+ if (hdPar) {
148
+ hdPar.colThis.push(this);
149
+ }
150
+ // this.flushFilterData()
151
+ },
152
+ data() {
153
+ return {
154
+ comdata: null,
155
+ btnRight: true, // 按钮权限判断 浮动区 隐藏显示
156
+ isShow: true, // 是否显示
157
+ // filterData: null
158
+ };
159
+ },
160
+ updated() {},
161
+ methods: {
162
+ isFixDo() {
163
+ // 浮动区权限控制
164
+ if (this.$attrs.fixed && this.$attrs.fixed == "right") {
165
+ // 剧右的是按钮,左侧的不管
166
+ this.addBtnMetaToParent();
167
+ this.checkRight();
168
+ this.getHdComGrid().columnFlowThis = this;
169
+ }
170
+ },
171
+ getName() {
172
+ // 按钮权限控制
173
+ return this.$t("列表浮动区");
174
+ },
175
+ selItem(row, data) {
176
+ if (this.selFormat) {
177
+ // 有format的情况
178
+ return this.selFormat(row, this.$attrs.prop, data);
179
+ }
180
+ },
181
+ checkErr(row) {
182
+ this.validate(row[this.$attrs.prop], (msg) => {
183
+ this.$set(row, "_err_" + this.$attrs.prop, msg);
184
+ });
185
+ },
186
+ getRules() {
187
+ const comPar = this.getHdComGrid();
188
+ if (comPar) {
189
+ const allrules = comPar.validate; // hdcomgrid的rules
190
+ return allrules;
191
+ } else {
192
+ return false;
193
+ }
194
+ },
195
+ getHdComGrid() {
196
+ let par = this.$parent;
197
+ while (par) {
198
+ if (par.$options.name == "HdComGrid") {
199
+ return par;
200
+ }
201
+ par = par.$parent;
202
+ }
203
+ return null;
204
+ },
205
+ getHdGrid() {
206
+ let par = this.$parent;
207
+ while (par) {
208
+ if (par.$options.name == "HdGrid") {
209
+ return par;
210
+ }
211
+ par = par.$parent;
212
+ }
213
+ return null;
214
+ },
215
+ validate(data, callback) {
216
+ var descriptor = {};
217
+ const rules = this.getRules();
218
+ if (!rules) {
219
+ return false;
220
+ }
221
+ const oneRule = rules[this.$attrs.prop];
222
+ if (!oneRule) {
223
+ return false;
224
+ }
225
+ descriptor[this.$attrs.prop] = oneRule;
226
+ var validator = new AsyncValidator(descriptor);
227
+ var model = {};
228
+ model[this.$attrs.prop] = data;
229
+ validator.validate(model, { firstFields: true }, (errors, fields) => {
230
+ callback(errors ? errors[0].message : "");
231
+ });
232
+ },
233
+ getValueByPath(row, prop) {
234
+ // 支持多级
235
+ prop = prop || "";
236
+ const paths = prop.split(".");
237
+ let current = row;
238
+ let result = null;
239
+ for (let i = 0, j = paths.length; i < j; i++) {
240
+ const path = paths[i];
241
+ if (!current) break;
242
+
243
+ if (i === j - 1) {
244
+ result = current[path];
245
+ break;
246
+ }
247
+ current = current[path];
248
+ }
249
+ if (this.inputFormat) {
250
+ // 有format的情况
251
+ return this.inputFormat(result, row, prop);
252
+ } else {
253
+ if (this.$attrs.txtVal) {
254
+ return row[this.$attrs.txtVal];
255
+ } else if (result === 0 && !this.noZeroHide) {
256
+ return "";
257
+ } else {
258
+ return result;
259
+ }
260
+ }
261
+ },
262
+ getRealWidth(str) {
263
+ //获取字符长度,中文为2英文为1
264
+ let l = str.length;
265
+ let blen = 0;
266
+ for (let i = 0; i < l; i++) {
267
+ if ((str.charCodeAt(i) & 0xff00) != 0) {
268
+ blen++;
269
+ }
270
+ blen++;
271
+ }
272
+ return blen;
273
+ },
274
+ getClassName(attr) {
275
+ let c1 = attr["class-name"] ? attr["class-name"] : "";
276
+ let c2 = attr.fixed ? `backFF` : "";
277
+ return c2 + c1;
278
+ },
279
+ },
280
+ computed: {
281
+ autoWidth() {
282
+ //增加一个auto属性
283
+ if (this.$attrs.width == "auto") {
284
+ if (this.$attrs.label) {
285
+ return (
286
+ this.perWidth * this.getRealWidth(this.$t(this.$attrs.label)) + 17
287
+ );
288
+ } else {
289
+ return 100;
290
+ }
291
+ } else {
292
+ return this.$attrs.width;
293
+ }
294
+ },
295
+ filterData() {
296
+ if (
297
+ this.getHdComGrid() &&
298
+ this.getHdComGrid().hdResult &&
299
+ this.getHdComGrid().hdResult._rows
300
+ ) {
301
+ let filter = [];
302
+ let obj = {};
303
+
304
+ this.getHdComGrid().hdResult._rows.forEach((row) => {
305
+ let value = row[this.$attrs.prop] || null;
306
+ let text = this.getValueByPath(row, this.$attrs.prop) || "";
307
+
308
+ if (!obj[value]) {
309
+ obj[value] = { number: 1, text: text };
310
+ } else {
311
+ obj[value].number++;
312
+ }
313
+ });
314
+ this.$nextTick((v) => {
315
+ Object.keys(obj).forEach((v) => {
316
+ filter.push({ text: `${obj[v].text}(${obj[v].number})`, value: v });
317
+ });
318
+ });
319
+ // console.log('filterData', this.getHdComGrid().hdResult._rows, filter)
320
+ return filter;
321
+ }
322
+ },
323
+ isOpenFilter() {
324
+ return this.openFilter && this.$attrs.label != "操作";
325
+ },
326
+ realSortable() {
327
+ // return this.sortable
328
+ return this.sortable ? "custom" : false;
329
+ },
330
+ },
331
+ };
332
+ </script>
333
+
334
+
@@ -0,0 +1,140 @@
1
+ <template>
2
+ <span>
3
+
4
+ <el-dropdown @command="handleCommand">
5
+ <span class="el-dropdown-link">
6
+ <a @click="save">{{$t('存盘')}}</a>
7
+ <i class="el-icon-arrow-down el-icon--right"></i></span>
8
+ <el-dropdown-menu slot="dropdown" style="max-height: 400px;overflow: auto">
9
+ <el-dropdown-item :command="lastAuto" v-if="lastAuto">{{lastAuto.title}}</el-dropdown-item>
10
+ <el-dropdown-item divided></el-dropdown-item>
11
+ <el-dropdown-item v-for="(item, key, index) in allTemp" :key="item.id" :command="item">
12
+ <div v-if="!item.isEdit">
13
+ {{item.title}} &nbsp;&nbsp;<i class="el-icon-edit" @click.stop="rename(item)"></i>
14
+ &nbsp; <i class="el-icon-delete" @click.stop="remove(item)"></i>
15
+ </div>
16
+ </el-dropdown-item>
17
+ </el-dropdown-menu>
18
+ </el-dropdown>
19
+ </span>
20
+ </template>
21
+
22
+ <script>
23
+ /**
24
+ * 页面暂存,实现模板和定时save,由于有定时任务,在页面关闭时需要写v-if,触发关闭定时任务
25
+ * @module HdTempSave
26
+ */
27
+ export default {
28
+ name: 'HdTempSave',
29
+ data() {
30
+ return {
31
+ allTemp: [],
32
+ lastAuto: {},
33
+ timeInterval: null
34
+ }
35
+ },
36
+ inheritAttrs: false,
37
+ /**
38
+ * Props
39
+ * @prop {Function} saveFun 备份时的存储
40
+ * @prop {event} reload 还原时的触发事件
41
+ * @prop {boolean} auto true会自动保存(5秒),弹窗必须加v-if 来关闭定时
42
+ */
43
+ props: ['saveFun', 'auto'],
44
+ mounted() {
45
+ this.find()
46
+ this.findAuto()
47
+ },
48
+ beforeDestroy() {
49
+ console.info("close")
50
+ this.close()
51
+ },
52
+ methods: {
53
+ save() {
54
+ let ts = new Date().getTime()
55
+ //id是唯一标识,disName是当前页面区分
56
+ let obj = {id: ts, disName: this.$route.name, title: new Date().format("MM-dd HH:mm"), result: this.saveFun()}
57
+ let tempStore = localStorage.getItem('HdTempStore')
58
+ let storeObj = []
59
+ if (tempStore) {
60
+ storeObj = JSON.parse(tempStore)
61
+ }
62
+ storeObj.unshift(obj)
63
+ localStorage.setItem('HdTempStore', JSON.stringify(storeObj))
64
+ this.find()
65
+ },
66
+ saveForAuto() {
67
+ let ts = new Date().getTime()
68
+ //id是唯一标识,disName是当前页面区分
69
+ let obj = {
70
+ id: ts,
71
+ disName: this.$route.name,
72
+ title: this.$t('自动存盘') + new Date().format("MM-dd HH:mm"),
73
+ result: this.saveFun()
74
+ }
75
+ localStorage.setItem('HdTempAutoStore' + this.$route.name, JSON.stringify(obj))
76
+ },
77
+ find() {
78
+ let tempStore = localStorage.getItem('HdTempStore')
79
+ if (!tempStore) {
80
+ return;
81
+ }
82
+ let storeObj = JSON.parse(tempStore)
83
+ this.allTemp = storeObj.filter(v => v.disName == this.$route.name)
84
+ },
85
+ findAuto() {
86
+ let tempStore = localStorage.getItem('HdTempAutoStore' + this.$route.name)
87
+ this.lastAuto = JSON.parse(tempStore)
88
+ },
89
+ remove(item) {
90
+ let tempStore = localStorage.getItem('HdTempStore')
91
+ let storeObj = JSON.parse(tempStore)
92
+ let newSt = storeObj.filter(v => v.id != item.id)
93
+ localStorage.setItem('HdTempStore', JSON.stringify(newSt))
94
+ this.find()
95
+ },
96
+ rename(item) {
97
+ this.$prompt(this.$t('请输入名称'), this.$t('提示'), {}).then(({value}) => {
98
+ let tempStore = localStorage.getItem('HdTempStore')
99
+ let storeObj = JSON.parse(tempStore)
100
+ let newSt = storeObj.map(v => {
101
+ if (v.id == item.id) {
102
+ v.title = value
103
+ }
104
+ return v
105
+ })
106
+ localStorage.setItem('HdTempStore', JSON.stringify(newSt))
107
+ this.find()
108
+ }).catch(() => {
109
+ })
110
+ },
111
+ autoSave() {
112
+ this.timeInterval = setInterval(() => {
113
+ this.saveForAuto()
114
+ }, 5000)
115
+ },
116
+ close() {
117
+ if (this.timeInterval)
118
+ clearInterval(this.timeInterval)
119
+ this.timeInterval = null
120
+ },
121
+ handleCommand(cmd) {
122
+ if (cmd && cmd.result)
123
+ this.$emit('reload', cmd.result)
124
+ }
125
+ },
126
+ watch: {
127
+ 'auto': {//定时执行
128
+ immediate: true,
129
+ handler(newVal) {
130
+ if (newVal) {
131
+ this.autoSave()
132
+ } else {
133
+ this.close()
134
+ }
135
+ }
136
+ }
137
+ }
138
+ }
139
+
140
+ </script>
@@ -0,0 +1,86 @@
1
+ <template>
2
+ <div style="height: 100%;overflow: auto">
3
+ <el-tree :expand-on-click-node="false" :renderContent="myrenderContent" highlight-current node-key="id" ref="eltree"
4
+ v-bind="$attrs" v-on="$listeners">
5
+ </el-tree>
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ /**
11
+ * HdTree 对 ElTree 封装了一些样式 idev8请使用EzTreeBean,能控制到展示与伸缩 可参考orgTree和orgnselect(下拉树)
12
+ * @module HdNum
13
+ */
14
+ export default {
15
+ name: 'HdTree',
16
+ data() {
17
+ return {}
18
+ },
19
+ inheritAttrs: false,
20
+ updated() {
21
+ const treeData = this.$attrs.data
22
+ const rs = []
23
+ this.initChecked(treeData, rs)
24
+ if (rs) {
25
+ this.$refs.eltree.setCheckedNodes(rs)
26
+ }
27
+ },
28
+ methods: {
29
+ getCheckedNodes(onlyLeaf = true) {
30
+ return this.$refs.eltree.getCheckedNodes(onlyLeaf)
31
+ },
32
+ initChecked(treeData, rs) {
33
+ if (!treeData) {
34
+ return false
35
+ }
36
+ for (let i = 0; i < treeData.length; i++) {
37
+ const one = treeData[i]
38
+ if (one.checked == 'Y') {
39
+ rs.push(one)
40
+ }
41
+ if (one.children) {
42
+ this.initChecked(one.children, rs)
43
+ }
44
+ }
45
+ },
46
+ myrenderContent(h, {node, data, store}) {
47
+ if (data.state == 'open') {
48
+ node.expanded = true
49
+ }
50
+ // if (data.checked == 'Y') {
51
+ //
52
+ // //node.checked = true
53
+ // // let par = node.parent
54
+ // // while (par) {
55
+ // // if (par.checked) {
56
+ // // break;
57
+ // // }
58
+ // // par.indeterminate = true
59
+ // // par = par.parent
60
+ // // }
61
+ // }
62
+ return h('span', {
63
+ 'class': {
64
+ 'el-tree-node__label': true
65
+ },
66
+ style: {
67
+ 'width': 'auto',
68
+ 'padding-right': '10px'
69
+ }
70
+ }, [h('i', {
71
+ 'class': {
72
+ 'el-icon-star-off': true
73
+ },
74
+ style: {
75
+ 'paddingRight': '4px'
76
+ }
77
+ }), h('span', {
78
+ 'class': {
79
+ 'el-tree-node__label': true
80
+ }
81
+ }, data.text)])
82
+ }
83
+ }
84
+ }
85
+
86
+ </script>
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @Author: jianglei
3
+ * @Date: 2017-10-12 12:06:49
4
+ */
5
+ 'use strict'
6
+ import Vue from 'vue'
7
+ export default function treeToArray(data, expandAll, parent = null, level = null) {
8
+ let tmp = []
9
+ Array.from(data).forEach(function(record) {
10
+ if (record.state === 'open') {
11
+ record._expanded = true
12
+ }
13
+ if (record._expanded === undefined) {
14
+ Vue.set(record, '_expanded', expandAll)
15
+ }
16
+ let _level = 1
17
+ if (level !== undefined && level !== null) {
18
+ _level = level + 1
19
+ }
20
+ Vue.set(record, '_level', _level)
21
+ // 如果有父元素
22
+ if (parent) {
23
+ Vue.set(record, 'parent', parent)
24
+ }
25
+ tmp.push(record)
26
+ if (record.children && record.children.length > 0) {
27
+ const children = treeToArray(record.children, expandAll, record, _level)
28
+ tmp = tmp.concat(children)
29
+ }
30
+ })
31
+ return tmp
32
+ }