hd-idevvue3 3.0.7 → 3.0.8

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 (148) hide show
  1. package/package.json +6 -1
  2. package/.env.development +0 -5
  3. package/.env.production +0 -5
  4. package/.eslintrc.js +0 -151
  5. package/index.html +0 -18
  6. package/pnpm-lock.yaml +0 -3541
  7. package/src/App.vue +0 -11
  8. package/src/assets/sound/notify.wav +0 -0
  9. package/src/demo/demo.vue +0 -42
  10. package/src/demo/dropdemo.vue +0 -42
  11. package/src/demo/extsets.vue +0 -208
  12. package/src/demo/formedit.vue +0 -157
  13. package/src/demo/hightquery.vue +0 -366
  14. package/src/demo/inlineedit.vue +0 -182
  15. package/src/demo/selfdrop.vue +0 -58
  16. package/src/demo//350/241/214/345/206/205/347/272/247/350/201/224.txt +0 -2
  17. package/src/directive/el-dragDialog/drag.js +0 -124
  18. package/src/directive/el-dragDialog/index.js +0 -13
  19. package/src/errorLog.js +0 -16
  20. package/src/hdcom/BigGrid.js +0 -179
  21. package/src/hdcom/BillShow.vue +0 -111
  22. package/src/hdcom/BillUpload.vue +0 -311
  23. package/src/hdcom/BtnRight.vue +0 -101
  24. package/src/hdcom/ErrHint.vue +0 -42
  25. package/src/hdcom/ExtendColumn.vue +0 -115
  26. package/src/hdcom/ExtendCommon.js +0 -40
  27. package/src/hdcom/ExtendForm.vue +0 -141
  28. package/src/hdcom/FacePicUpload.vue +0 -80
  29. package/src/hdcom/FaceRecTest.vue +0 -114
  30. package/src/hdcom/GridChart.vue +0 -207
  31. package/src/hdcom/GridExField.vue +0 -375
  32. package/src/hdcom/GridShow.vue +0 -288
  33. package/src/hdcom/HdAside.vue +0 -225
  34. package/src/hdcom/HdBtn.vue +0 -125
  35. package/src/hdcom/HdButton.vue +0 -161
  36. package/src/hdcom/HdComFaceRec.vue +0 -106
  37. package/src/hdcom/HdComGrid.vue +0 -876
  38. package/src/hdcom/HdComQuery.vue +0 -362
  39. package/src/hdcom/HdComQueryDetail.vue +0 -205
  40. package/src/hdcom/HdComSortDetail.vue +0 -161
  41. package/src/hdcom/HdDatePicker.vue +0 -94
  42. package/src/hdcom/HdDialog.vue +0 -81
  43. package/src/hdcom/HdDrop.vue +0 -188
  44. package/src/hdcom/HdFileUpload.vue +0 -167
  45. package/src/hdcom/HdFilterBox.vue +0 -90
  46. package/src/hdcom/HdFooter.vue +0 -182
  47. package/src/hdcom/HdForm.vue +0 -351
  48. package/src/hdcom/HdFormBtn.vue +0 -131
  49. package/src/hdcom/HdFormItem.vue +0 -39
  50. package/src/hdcom/HdGctosGrid +0 -0
  51. package/src/hdcom/HdGrid.vue +0 -1022
  52. package/src/hdcom/HdGridEditBtn.vue +0 -58
  53. package/src/hdcom/HdGridExt.js +0 -250
  54. package/src/hdcom/HdGridSel.vue +0 -257
  55. package/src/hdcom/HdHeader.vue +0 -180
  56. package/src/hdcom/HdHotKey.vue +0 -84
  57. package/src/hdcom/HdInputHint.vue +0 -53
  58. package/src/hdcom/HdMain.vue +0 -41
  59. package/src/hdcom/HdMessage.vue +0 -201
  60. package/src/hdcom/HdNum.vue +0 -79
  61. package/src/hdcom/HdPopSel.vue +0 -80
  62. package/src/hdcom/HdRightMenu.vue +0 -63
  63. package/src/hdcom/HdSel/SelGridFieldcod.vue +0 -54
  64. package/src/hdcom/HdTableColumn.vue +0 -381
  65. package/src/hdcom/HdTempSave.vue +0 -162
  66. package/src/hdcom/HdTree.vue +0 -103
  67. package/src/hdcom/HdTreeTable/eval.js +0 -39
  68. package/src/hdcom/HdTreeTable/index.vue +0 -229
  69. package/src/hdcom/ImportExcel.vue +0 -178
  70. package/src/hdcom/index.js +0 -75
  71. package/src/idev.common.js +0 -79
  72. package/src/index.js +0 -11
  73. package/src/utils/HdQuery.js +0 -65
  74. package/src/utils/comutils.js +0 -120
  75. package/src/utils/gogocodeTransfer.js +0 -59
  76. package/src/utils/utils.js +0 -116
  77. package/src/vendor/Blob.js +0 -187
  78. package/src/vendor/Export2Excel.js +0 -231
  79. package/src/vendor/Export2Zip.js +0 -25
  80. package/src/views/layout/AppMain.vue +0 -34
  81. package/src/views/layout/HdLayout.vue +0 -90
  82. package/src/views/layout/header/ElasticSearch.vue +0 -262
  83. package/src/views/layout/header/HZRecorder.js +0 -259
  84. package/src/views/layout/header/HeaderSearch.vue +0 -218
  85. package/src/views/layout/header/Levelbar.vue +0 -55
  86. package/src/views/layout/header/MainHeader.vue +0 -315
  87. package/src/views/layout/header/Navbar.vue +0 -101
  88. package/src/views/layout/header/ScrollPane.vue +0 -103
  89. package/src/views/layout/header/TagsView.vue +0 -215
  90. package/src/views/layout/header/VocRec.vue +0 -105
  91. package/src/views/layout/header/changepswform.vue +0 -130
  92. package/src/views/layout/index.js +0 -10
  93. package/src/views/layout/menu/Hamburger.vue +0 -63
  94. package/src/views/layout/menu/HdMenu.vue +0 -204
  95. package/src/views/layout/menu/css/menu.css +0 -288
  96. package/src/views/layout/menu/index.vue +0 -27
  97. package/src/views/privilege/commsg/commsg.vue +0 -152
  98. package/src/views/privilege/commsg/commsgOrgn.vue +0 -51
  99. package/src/views/privilege/commsg/commsgRole.vue +0 -220
  100. package/src/views/privilege/commsg/commsgform.vue +0 -184
  101. package/src/views/privilege/commsg/commsgiframe.vue +0 -40
  102. package/src/views/privilege/commsg/commsgto.vue +0 -199
  103. package/src/views/privilege/commsg/commsgtoform.vue +0 -114
  104. package/src/views/privilege/commsg/commsgtrans.vue +0 -227
  105. package/src/views/privilege/exfield/comexcolumn.vue +0 -161
  106. package/src/views/privilege/exfield/comexcolumnform.vue +0 -128
  107. package/src/views/privilege/exfield/comexfield.vue +0 -29
  108. package/src/views/privilege/exfield/comexfieldform.vue +0 -112
  109. package/src/views/privilege/exfield/comexfieldsub.vue +0 -163
  110. package/src/views/privilege/index.js +0 -41
  111. package/src/views/privilege/menu/comMenu.vue +0 -49
  112. package/src/views/privilege/menu/menu.vue +0 -250
  113. package/src/views/privilege/menu/menuinfo.vue +0 -63
  114. package/src/views/privilege/menu/rolelist.vue +0 -92
  115. package/src/views/privilege/menu/userlist.vue +0 -92
  116. package/src/views/privilege/mobile/authmobileupdate.vue +0 -145
  117. package/src/views/privilege/mobile/authmobileupdateform.vue +0 -120
  118. package/src/views/privilege/orgDept/authOrgn.vue +0 -188
  119. package/src/views/privilege/orgDept/authorgnform.vue +0 -157
  120. package/src/views/privilege/orgDept/orgDept.vue +0 -38
  121. package/src/views/privilege/orgDept/orgTree.vue +0 -99
  122. package/src/views/privilege/orgDept/orgnselect.vue +0 -155
  123. package/src/views/privilege/personDept/authuser.vue +0 -229
  124. package/src/views/privilege/personDept/authuserform.vue +0 -206
  125. package/src/views/privilege/personDept/facerec.vue +0 -162
  126. package/src/views/privilege/personDept/orgncascader.vue +0 -144
  127. package/src/views/privilege/personDept/personDept.vue +0 -33
  128. package/src/views/privilege/quartz/comquartzjob.vue +0 -150
  129. package/src/views/privilege/quartz/comquartzjobform.vue +0 -115
  130. package/src/views/privilege/quartz/comquartzlog.vue +0 -143
  131. package/src/views/privilege/role/btnRole.vue +0 -173
  132. package/src/views/privilege/role/menuRole.vue +0 -84
  133. package/src/views/privilege/role/orgnRole.vue +0 -78
  134. package/src/views/privilege/role/role.vue +0 -84
  135. package/src/views/privilege/role/rolelist.vue +0 -136
  136. package/src/views/privilege/role/roleselect.vue +0 -74
  137. package/src/views/privilege/search/comsearch.vue +0 -196
  138. package/src/views/privilege/search/menu.vue +0 -68
  139. package/src/views/privilege/syscode/syscode.vue +0 -191
  140. package/src/views/privilege/syscode/sysfield.vue +0 -119
  141. package/src/views/privilege/syscode/sysfieldframe.vue +0 -30
  142. package/src/views/privilege/syslog/menulog.vue +0 -68
  143. package/src/views/privilege/syslog/syslog.vue +0 -182
  144. package/src/views/privilege/syslog/syslogconfig.vue +0 -128
  145. package/src/views/privilege/syslog/syslogform.vue +0 -85
  146. package/src/views/privilege/syslog/syslogframe.vue +0 -26
  147. package/src/views/privilege/userRole/userRole.vue +0 -220
  148. package/vite.config.js +0 -124
@@ -1,80 +0,0 @@
1
- <template>
2
- <el-input
3
- v-bind="$attrs"
4
- v-on="$listeners"
5
- :placeholder="placeholder ? placeholder : ''"
6
- :model-value="txtVal"
7
- readonly
8
- @focus="$emit('focus')"
9
- :disabled="disabled"
10
- ref="sel"
11
- @mouseenter.native="doMouseEnter"
12
- @mouseleave.native="doMouseLeave"
13
- :clearable="false"
14
- >
15
- <el-icon class="el-input__icon" style="cursor: pointer"
16
- ><el-icon-circle-close
17
- /></el-icon>
18
- <el-icon class="el-input__icon" style="cursor: pointer"
19
- ><el-icon-more
20
- /></el-icon>
21
- </el-input>
22
- </template>
23
-
24
- <script>
25
- import {
26
- CircleClose as ElIconCircleClose,
27
- More as ElIconMore,
28
- } from '@element-plus/icons-vue'
29
- export default {
30
- components: {
31
- ElIconCircleClose,
32
- ElIconMore,
33
- },
34
- name: 'HdPoPSel',
35
- data() {
36
- return {
37
- popShow: this.show,
38
- threePointShow: true,
39
- }
40
- },
41
- inheritAttrs: false,
42
- // 设置value为props属性-必须
43
- props: {
44
- show: Boolean,
45
- txtVal: String,
46
- idVal: String,
47
- placeholder: String,
48
- disabled: Boolean,
49
- },
50
- mounted() {
51
- $(this.$parent.$el).find('.el-popover__reference').removeAttr('tabIndex') // 焦点用
52
- },
53
- methods: {
54
- focus() {
55
- this.$refs.sel.focus()
56
- },
57
- doQuery() {},
58
- doClear() {
59
- this.$emit('clear')
60
- },
61
- doMouseEnter() {
62
- if (this.disabled) {
63
- return false
64
- }
65
- if (this.idVal) {
66
- this.threePointShow = false
67
- }
68
- },
69
- doMouseLeave() {
70
- this.threePointShow = true
71
- },
72
- },
73
- }
74
- </script>
75
-
76
- <style>
77
- .lucencyInput .el-input__inner {
78
- border: 0px;
79
- }
80
- </style>
@@ -1,63 +0,0 @@
1
- <template>
2
- <div class="rightmenu">
3
- <slot name="rightMenu">
4
- <el-button-group>
5
- <ex-button class="rightmenu_button" @click="doAdd" vid="doAdd"
6
- >增加
7
- </ex-button>
8
- <ex-button class="rightmenu_button" @click="doUpdate" vid="doUpdate"
9
- >修改
10
- </ex-button>
11
- <ex-button class="rightmenu_button" @click="doRemove" vid="doRemove"
12
- >删除
13
- </ex-button>
14
- <ex-button class="rightmenu_button" @click="doCopy" vid="doCopy"
15
- >复制
16
- </ex-button>
17
- </el-button-group>
18
- <div style="border: #555 1px solid" v-if="$slots.rightMenuExt"></div>
19
- <el-button-group>
20
- <slot name="rightMenuExt"> </slot>
21
- </el-button-group>
22
- </slot>
23
- </div>
24
- </template>
25
-
26
- <script>
27
- // import BtnRight from './BtnRight'
28
-
29
- export default {
30
- name: 'HdRightMenu',
31
- // mixins: [BtnRight],
32
- props: {
33
- noRoleManage: false,
34
- },
35
- data() {
36
- return {
37
- isFocus: false,
38
- rangeThis: {}, // 快捷键有效区域
39
- }
40
- },
41
- created() {
42
- // if (!this.noRoleManage) {
43
- // if (this.$route && this.$route.meta.btnRoleCheck) { // 角色管理下激活
44
- // this.addBtnMetaToParent()
45
- // }
46
- // }
47
- },
48
- methods: {
49
- doAdd() {
50
- this.$emit('do-add')
51
- },
52
- doRemove() {
53
- this.$emit('do-remove')
54
- },
55
- doUpdate() {
56
- this.$emit('do-update')
57
- },
58
- doCopy() {
59
- this.$emit('do-copy')
60
- },
61
- },
62
- }
63
- </script>
@@ -1,54 +0,0 @@
1
- <template>
2
- <hd-grid-sel
3
- :txtVal="txtVal"
4
- :idVal="idVal"
5
- placeholder="请点击选取"
6
- height="50vh"
7
- width="300px"
8
- :hdQuery="hdQuery"
9
- :disabled="disabled"
10
- url="webresources/login/privilege/SysField/vue/find"
11
- @rowClick="doClick"
12
- :beforeQuery="beforeQuery"
13
- >
14
- <el-table-column
15
- width="120px"
16
- align="left"
17
- header-align="center"
18
- label="代码"
19
- prop="fieldCod"
20
- sortable
21
- ></el-table-column>
22
- <el-table-column
23
- widhth="180px"
24
- align="left"
25
- header-align="center"
26
- label="名称"
27
- prop="fieldName"
28
- sortable
29
- ></el-table-column>
30
- </hd-grid-sel>
31
- </template>
32
-
33
- <script>
34
- export default {
35
- name: 'sel-grid-fieldcode',
36
- components: {},
37
- data() {
38
- return {
39
- hdQuery: new HdQuery(this),
40
- }
41
- },
42
- mounted() {},
43
- props: { txtVal: String, idVal: String, disabled: Boolean }, // 设置value为props属�??-必须
44
- methods: {
45
- beforeQuery(val) {
46
- this.hdQuery.query.anyQuery = val
47
- },
48
- doClick(row) {
49
- this.$emit('update:txtVal', row.fieldName)
50
- this.$emit('update:idVal', row.fieldCod)
51
- },
52
- },
53
- }
54
- </script>
@@ -1,381 +0,0 @@
1
- <template>
2
- <!--改动说明,btnRight 和isShow是该column是否显示,只在fixed:right时使用,-->
3
- <div v-if="!btnRight || !isShow"></div>
4
- <ExTableColumn
5
- :class-name="getClassName($attrs)"
6
- :label="$t($attrs.label)"
7
- :sortable="realSortable"
8
- :width="autoWidth"
9
- :showOverflowTooltip="showOverflowTooltip"
10
- v-bind="$attrs"
11
- v-else-if="!$slots.default"
12
- v-on="$listeners"
13
- :filters="filterData"
14
- :filter-method="isOpenFilter ? () => true : null"
15
- >
16
- <template slot="header" slot-scope="scope">
17
- <slot name="header" :index="scope.$index" :row="scope.row">
18
- {{ $t($attrs.label) }}
19
- </slot>
20
- </template>
21
- <template slot-scope="scope">
22
- <slot :index="scope.$index" :row="scope.row">
23
- <!--noEdit不允许编辑-->
24
- <template v-if="scope.row.isEdit && !noEdit">
25
- <component
26
- :gridRow="scope.row"
27
- :idVal.sync="scope.row[$attrs.idVal]"
28
- :is="input"
29
- :txtVal.sync="scope.row[$attrs.txtVal]"
30
- @blur="checkErr(scope.row)"
31
- @change="
32
- (v) => {
33
- $emit('change', v, scope.row)
34
- }
35
- "
36
- @selItem="
37
- (v) => {
38
- selItem(scope.row, v)
39
- }
40
- "
41
- style="width: 100%"
42
- v-bind="inputProp"
43
- v-model="scope.row[$attrs.prop]"
44
- ></component>
45
- </template>
46
- <template v-else-if="!isHtml">{{
47
- getValueByPath(scope.row, $attrs.prop)
48
- }}</template>
49
- <template v-else>
50
- <div v-html="getValueByPath(scope.row, $attrs.prop)"></div>
51
- </template>
52
- </slot>
53
- <template v-if="scope.row.isEdit && !noEdit">
54
- <ErrHint
55
- :errMsg="scope.row['_err_' + $attrs.prop]"
56
- @checkErr="
57
- (v) => {
58
- checkErr(scope.row, v)
59
- }
60
- "
61
- v-model="scope.row[$attrs.prop]"
62
- ></ErrHint>
63
- </template>
64
- </template>
65
- </ExTableColumn>
66
- <!--复合表头时,但是复合表头里的具体表头依然会进入第一个条件-->
67
- <ExTableColumn
68
- :label="$t($attrs.label)"
69
- :sortable="realSortable"
70
- :width="autoWidth"
71
- :showOverflowTooltip="showOverflowTooltip"
72
- v-bind="$attrs"
73
- v-else-if="$slots.default"
74
- v-on="$listeners"
75
- >
76
- <slot></slot>
77
- </ExTableColumn>
78
- <!--没啥用-->
79
- <ExTableColumn
80
- :label="$t($attrs.label)"
81
- :sortable="realSortable"
82
- :width="autoWidth"
83
- :showOverflowTooltip="showOverflowTooltip"
84
- v-bind="$attrs"
85
- v-else
86
- v-on="$listeners"
87
- >
88
- </ExTableColumn>
89
- </template>
90
-
91
- <script>
92
- import AsyncValidator from 'async-validator'
93
- import BtnRight from './BtnRight'
94
-
95
- /**
96
- *覆盖ElTableColumn 主要增加行内编辑的校验,及增加inputProp input inputFormat selFormat属性(与高级查询配合),在多数情况可以不用写templeate
97
- * @module HdTableColumn
98
- */
99
- export default {
100
- name: 'ElTableColumn',
101
- inheritAttrs: false,
102
- components: {},
103
- mixins: [BtnRight],
104
- /**
105
- * Props input属性对应的自定义组件,行内编辑的特殊性,开发时,可能会使用以下属性和事件
106
- * @prop {Object} gridRow 组件获取当前行数据
107
- * @prop {Event} blur 触发校验
108
- * @prop {String} txtVal 自定义下拉hdgridsel 选择文本内容
109
- * @prop {String} idVal 自定义下拉hdgridsel 选择id值
110
- * @prop {Event} selItem(row, v) 选择时触发selFormat(row, prop,sel)格式化
111
- * @prop {Event} change(v) 对组件的change增加第2参数为当前行 参考onlineunloadform.vue的件重计算
112
- */
113
- /**
114
- * Props 继承ElTableColumn的属性和事件,
115
- * @prop {Object} 或String,可参考demo/hightquery,input 行内编辑或高级查询时,输入区的类型默认ElInput,系统或框架组件,可以直接写字符串,自定义组件需要这样写: :input="require('@/views/comgctos/sel_sbccargokind').default"
116
- * @prop {Object} inputProp input对应的属性
117
- * @prop {Function} inputFormat(value, row, prop) 展示时格式化,value当前值,row当前行,prop属性名
118
- * @prop {Function} selFormat(row, prop,sel) 选择时格式化
119
- * @prop {Boolean} noEdit 行内编辑时是否不编辑
120
- * @prop {Boolean} noQuery 高级查询时,不计入选择
121
- * @prop {event} @change(v,row) 对组件的change增加第2参数为当前行 参考onlineunloadform.vue的件重计算
122
- * @prop {String} width 增加一个auto属性,会根据label自动计算宽度(国际化会自动展开)
123
- * @prop {Boolean} showOverflowTooltip 是否缩进过长内容
124
- */
125
- props: {
126
- input: {
127
- // 输入类型
128
- type: [String, Object],
129
- default: function () {
130
- // updTimFirst是因为会触发HdQuery的排序及查询,默认不让查询
131
- return 'ElInput'
132
- },
133
- },
134
- inputProp: Object, // input的属性
135
- inputFormat: Function, // result, object, prop 展示时格式化
136
- selFormat: Function, // row, prop,sel 选择时格式化
137
- noEdit: {
138
- // 编辑时是否可编辑
139
- type: Boolean,
140
- default: function () {
141
- return false
142
- },
143
- },
144
- noZeroHide: {
145
- type: Boolean,
146
- default: false,
147
- },
148
- noQuery: Boolean, // 不需要高级查询
149
- sortable: {
150
- // 排序只用custom不用前端排序
151
- type: Boolean,
152
- default: function () {
153
- return false
154
- },
155
- },
156
- rules: Array, // 校验
157
- perWidth: {
158
- type: Number,
159
- default: 12,
160
- }, //每个字节的宽度(中文为2个字节)
161
- showOverflowTooltip: {
162
- // 编辑时是否可编辑
163
- type: Boolean,
164
- default: function () {
165
- return true
166
- },
167
- },
168
- openFilter: {
169
- type: Boolean,
170
- default: function () {
171
- return false
172
- },
173
- },
174
- isHtml: {
175
- // 编辑时是否可编辑
176
- type: Boolean,
177
- default: function () {
178
- return false
179
- },
180
- },
181
- },
182
- mounted() {
183
- this.isFixDo()
184
- const comPar = this.getHdComGrid()
185
- if (comPar) {
186
- const allrules = comPar.validate // hdcomgrid的rules
187
- if (allrules && this.rules) {
188
- allrules[this.$attrs.prop] = this.rules
189
- }
190
- if (this.$attrs.prop && !this.noQuery) {
191
- // 高级查询用
192
- comPar.allColumn.push(this)
193
- }
194
- }
195
- const hdPar = this.getHdGrid()
196
- if (hdPar) {
197
- hdPar.colThis.push(this)
198
- }
199
- // this.flushFilterData()
200
- },
201
- data() {
202
- return {
203
- comdata: null,
204
- btnRight: true, // 按钮权限判断 浮动区 隐藏显示
205
- isShow: true, // 是否显示
206
- // filterData: null
207
- }
208
- },
209
- updated() {},
210
- methods: {
211
- isFixDo() {
212
- // 浮动区权限控制
213
- if (this.$attrs.fixed && this.$attrs.fixed == 'right') {
214
- // 剧右的是按钮,左侧的不管
215
- this.addBtnMetaToParent()
216
- this.checkRight()
217
- this.getHdComGrid().columnFlowThis = this
218
- }
219
- },
220
- getName() {
221
- // 按钮权限控制
222
- return this.$t('列表浮动区')
223
- },
224
- selItem(row, data) {
225
- if (this.selFormat) {
226
- // 有format的情况
227
- return this.selFormat(row, this.$attrs.prop, data)
228
- }
229
- },
230
- checkErr(row) {
231
- this.validate(row[this.$attrs.prop], (msg) => {
232
- this.$set(row, '_err_' + this.$attrs.prop, msg)
233
- })
234
- },
235
- getRules() {
236
- const comPar = this.getHdComGrid()
237
- if (comPar) {
238
- const allrules = comPar.validate // hdcomgrid的rules
239
- return allrules
240
- } else {
241
- return false
242
- }
243
- },
244
- getHdComGrid() {
245
- let par = this.$parent
246
- while (par) {
247
- if (par.$options.name == 'HdComGrid') {
248
- return par
249
- }
250
- par = par.$parent
251
- }
252
- return null
253
- },
254
- getHdGrid() {
255
- let par = this.$parent
256
- while (par) {
257
- if (par.$options.name == 'HdGrid') {
258
- return par
259
- }
260
- par = par.$parent
261
- }
262
- return null
263
- },
264
- validate(data, callback) {
265
- var descriptor = {}
266
- const rules = this.getRules()
267
- if (!rules) {
268
- return false
269
- }
270
- const oneRule = rules[this.$attrs.prop]
271
- if (!oneRule) {
272
- return false
273
- }
274
- descriptor[this.$attrs.prop] = oneRule
275
- var validator = new AsyncValidator(descriptor)
276
- var model = {}
277
- model[this.$attrs.prop] = data
278
- validator.validate(model, { firstFields: true }, (errors, fields) => {
279
- callback(errors ? errors[0].message : '')
280
- })
281
- },
282
- getValueByPath(row, prop) {
283
- // 支持多级
284
- prop = prop || ''
285
- const paths = prop.split('.')
286
- let current = row
287
- let result = null
288
- for (let i = 0, j = paths.length; i < j; i++) {
289
- const path = paths[i]
290
- if (!current) break
291
-
292
- if (i === j - 1) {
293
- result = current[path]
294
- break
295
- }
296
- current = current[path]
297
- }
298
- if (this.inputFormat) {
299
- // 有format的情况
300
- return this.inputFormat(result, row, prop)
301
- } else {
302
- if (this.$attrs.txtVal) {
303
- return row[this.$attrs.txtVal]
304
- } else if (result === 0 && !this.noZeroHide) {
305
- return ''
306
- } else {
307
- return result
308
- }
309
- }
310
- },
311
- getRealWidth(str) {
312
- //获取字符长度,中文为2英文为1
313
- let l = str.length
314
- let blen = 0
315
- for (let i = 0; i < l; i++) {
316
- if ((str.charCodeAt(i) & 0xff00) != 0) {
317
- blen++
318
- }
319
- blen++
320
- }
321
- return blen
322
- },
323
- getClassName(attr) {
324
- let c1 = attr['class-name'] ? attr['class-name'] : ''
325
- let c2 = attr.fixed ? `backFF` : ''
326
- return c2 + c1
327
- },
328
- },
329
- computed: {
330
- autoWidth() {
331
- //增加一个auto属性
332
- if (this.$attrs.width == 'auto') {
333
- if (this.$attrs.label) {
334
- return (
335
- this.perWidth * this.getRealWidth(this.$t(this.$attrs.label)) + 17
336
- )
337
- } else {
338
- return 100
339
- }
340
- } else {
341
- return this.$attrs.width
342
- }
343
- },
344
- filterData() {
345
- if (
346
- this.getHdComGrid() &&
347
- this.getHdComGrid().hdResult &&
348
- this.getHdComGrid().hdResult._rows
349
- ) {
350
- let filter = []
351
- let obj = {}
352
-
353
- this.getHdComGrid().hdResult._rows.forEach((row) => {
354
- let value = row[this.$attrs.prop] || null
355
- let text = this.getValueByPath(row, this.$attrs.prop) || ''
356
-
357
- if (!obj[value]) {
358
- obj[value] = { number: 1, text: text }
359
- } else {
360
- obj[value].number++
361
- }
362
- })
363
- this.$nextTick((v) => {
364
- Object.keys(obj).forEach((v) => {
365
- filter.push({ text: `${obj[v].text}(${obj[v].number})`, value: v })
366
- })
367
- })
368
- // console.log('filterData', this.getHdComGrid().hdResult._rows, filter)
369
- return filter
370
- }
371
- },
372
- isOpenFilter() {
373
- return this.openFilter && this.$attrs.label != '操作'
374
- },
375
- realSortable() {
376
- // return this.sortable
377
- return this.sortable ? 'custom' : false
378
- },
379
- },
380
- }
381
- </script>