doway-coms 1.1.52 → 1.1.55

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 (52) hide show
  1. package/lib/doway-coms.common.js +1506 -53
  2. package/lib/doway-coms.umd.js +1506 -53
  3. package/node_modules/vxe-table/package.json +1 -1
  4. package/package.json +13 -4
  5. package/packages/BaseCheckbox/index.js +8 -0
  6. package/packages/BaseCheckbox/src/index.vue +123 -0
  7. package/packages/BaseDate/index.js +8 -0
  8. package/packages/BaseDate/src/index.vue +145 -0
  9. package/packages/BaseDateWeek/index.js +8 -0
  10. package/packages/BaseDateWeek/src/index.vue +115 -0
  11. package/packages/BaseDatetime/index.js +8 -0
  12. package/packages/BaseDatetime/src/index.vue +143 -0
  13. package/packages/BaseForm/index.js +8 -0
  14. package/packages/BaseForm/src/index.vue +631 -0
  15. package/packages/BaseGrid/index.js +10 -0
  16. package/packages/BaseGrid/src/index.vue +2375 -0
  17. package/packages/BaseInput/index.js +8 -0
  18. package/packages/BaseInput/src/index.vue +122 -0
  19. package/packages/BaseIntervalInput/index.js +8 -0
  20. package/packages/BaseIntervalInput/src/index.vue +275 -0
  21. package/packages/BaseNumberInput/index.js +8 -0
  22. package/packages/BaseNumberInput/src/index.vue +216 -0
  23. package/packages/BasePagination/index.js +8 -0
  24. package/packages/BasePagination/src/index.vue +74 -0
  25. package/packages/BasePictureCard/index.js +8 -0
  26. package/packages/BasePictureCard/src/index.vue +580 -0
  27. package/packages/BasePulldown/index.js +8 -0
  28. package/packages/BasePulldown/src/index.vue +817 -0
  29. package/packages/BaseSelect/index.js +8 -0
  30. package/packages/BaseSelect/src/index.vue +141 -0
  31. package/packages/BaseSelectMulti/index.js +8 -0
  32. package/packages/BaseSelectMulti/src/index.vue +135 -0
  33. package/packages/BaseTextArea/index.js +8 -0
  34. package/packages/BaseTextArea/src/index.vue +138 -0
  35. package/packages/BaseTime/index.js +8 -0
  36. package/packages/BaseTime/src/index.vue +117 -0
  37. package/packages/BaseTool/index.js +8 -0
  38. package/packages/BaseTool/src/index.vue +350 -0
  39. package/packages/BaseToolStatus/index.js +8 -0
  40. package/packages/BaseToolStatus/src/index.vue +384 -0
  41. package/packages/index.js +138 -0
  42. package/packages/styles/default.less +79 -0
  43. package/packages/utils/api.js +35 -0
  44. package/packages/utils/auth.js +38 -0
  45. package/packages/utils/common.js +259 -0
  46. package/packages/utils/dom.js +181 -0
  47. package/packages/utils/enum.js +81 -0
  48. package/packages/utils/filters.js +459 -0
  49. package/packages/utils/msg.js +17 -0
  50. package/packages/utils/patchFiles.js +45 -0
  51. package/packages/utils/request.js +80 -0
  52. package/packages/utils/store.js +117 -0
@@ -0,0 +1,259 @@
1
+ import {notification } from 'ant-design-vue'
2
+ import store from './store'
3
+ /**
4
+ * 替换掩码参数字符串
5
+ * @param {参数字符串} paramString
6
+ * @param {当前页面数据集} formData
7
+ */
8
+ export function replaceParamString(
9
+ paramString,
10
+ formData,
11
+ currentModuleSelectInfo
12
+ ) {
13
+ // hh添加
14
+ let tempStr = paramString
15
+ while (true) {
16
+ if (tempStr.indexOf('@Fn(') < 0) {
17
+ break
18
+ }
19
+ let tempReplaceParam = tempStr.substr(tempStr.indexOf('@Fn('))
20
+ tempReplaceParam = tempReplaceParam.substr(
21
+ 0,
22
+ tempReplaceParam.indexOf(')') + 1
23
+ ) // 查找掩码参数
24
+ let tempDataFields = tempReplaceParam
25
+ .substr(0, tempReplaceParam.length - 1)
26
+ .substr(4)
27
+ .split('.')
28
+ let tempReplaceValue = null
29
+ if (tempDataFields[0] === '') {
30
+ // 取主表数据
31
+ tempReplaceValue = formData[tempDataFields[1]]
32
+ } else {
33
+ if (formData[tempDataFields[0]] instanceof Array) {
34
+ let tempSelectItemInfo = currentModuleSelectInfo.filter(filterItem => {
35
+ return filterItem.attrDataName === tempDataFields[0]
36
+ })
37
+ if (tempSelectItemInfo.length > 0) {
38
+ let tempKeyFieldValue =
39
+ tempSelectItemInfo[0].selectItem[tempSelectItemInfo[0].keyField]
40
+ let tempActualRow = formData[tempDataFields[0]].filter(filterItem => {
41
+ return (
42
+ filterItem[tempSelectItemInfo[0].keyField] === tempKeyFieldValue
43
+ )
44
+ })
45
+ if (tempActualRow.length > 0) {
46
+ tempReplaceValue = tempActualRow[0][tempDataFields[1]]
47
+ }
48
+ }
49
+ } else {
50
+ tempReplaceValue = formData[tempDataFields[0]][tempDataFields[1]]
51
+ }
52
+ }
53
+ //刘松嗣临时处理
54
+ if (tempReplaceValue == undefined) {
55
+ tempReplaceValue = '0'
56
+ }
57
+ tempStr = tempStr.substr(
58
+ tempStr.indexOf(tempReplaceParam) + tempReplaceParam.length
59
+ )
60
+
61
+ if (typeof tempReplaceValue === 'string') {
62
+ paramString = paramString.replace(
63
+ tempReplaceParam,
64
+ '"' + tempReplaceValue + '"'
65
+ )
66
+ tempStr = tempStr.replace(tempReplaceParam, '"' + tempReplaceValue + '"')
67
+ } else {
68
+ paramString = paramString.replace(tempReplaceParam, tempReplaceValue)
69
+ tempStr = tempStr.replace(tempReplaceParam, tempReplaceValue)
70
+ }
71
+ }
72
+ return paramString
73
+ }
74
+
75
+ /**
76
+ * 替换掩码参数字符串
77
+ * @param {参数字符串} paramString
78
+ * @param {当前页面数据集} formData
79
+ */
80
+ export function replaceParam(paramString, formData) {
81
+ let tempStr = paramString
82
+ while (true) {
83
+ if (tempStr.indexOf('@Fn(') < 0) {
84
+ break
85
+ }
86
+ let tempReplaceParam = tempStr.substr(tempStr.indexOf('@Fn('))
87
+ tempReplaceParam = tempReplaceParam.substr(
88
+ 0,
89
+ tempReplaceParam.indexOf(')') + 1
90
+ ) // 查找掩码参数
91
+ let tempDataFields = tempReplaceParam
92
+ .substr(0, tempReplaceParam.length - 1)
93
+ .substr(4)
94
+ .split('.')
95
+ let tempReplaceValue = null
96
+ if (tempDataFields[0] === '') {
97
+ // 取主表数据
98
+ tempReplaceValue = formData[tempDataFields[1]]
99
+ } else {
100
+ tempReplaceValue = formData[tempDataFields[0]][tempDataFields[1]]
101
+ }
102
+ tempStr = tempStr.substr(
103
+ tempStr.indexOf(tempReplaceParam) + tempReplaceParam.length
104
+ )
105
+
106
+ // if (typeof tempReplaceValue === 'string') {
107
+ // paramString = paramString.replace(
108
+ // tempReplaceParam,
109
+ // '"' + tempReplaceValue + '"'
110
+ // )
111
+ // tempStr = tempStr.replace(tempReplaceParam, '"' + tempReplaceValue + '"')
112
+ // } else {
113
+ paramString = paramString.replace(tempReplaceParam, tempReplaceValue)
114
+ tempStr = tempStr.replace(tempReplaceParam, tempReplaceValue)
115
+ // }
116
+ }
117
+ return paramString
118
+ }
119
+
120
+ export function setFrameColState(formCols, formState, formStatus) {
121
+ for (let prop in formCols) {
122
+ if (formCols[prop].editStates instanceof Array) {
123
+ let exists = formCols[prop].editStates.filter(item => {
124
+ //editState:['add','edit']
125
+ return item === formState // view === add|edit formState :view|add|edit
126
+ }) //[]
127
+ if (exists.length > 0) {
128
+ formCols[prop].edit = true
129
+ } else {
130
+ formCols[prop].edit = false
131
+ }
132
+ }
133
+ // 单据状态控制
134
+ if (
135
+ formStatus &&
136
+ formCols[prop].editStatuss instanceof Array &&
137
+ formCols[prop].editStatuss.length > 0 &&
138
+ formCols[prop].edit === true
139
+ ) {
140
+ let formStatusExists = formCols[prop].editStatuss.filter(item => {
141
+ //editStatuss:[,'publish',]
142
+ return item === formStatus // formStatus:'draft'
143
+ })
144
+ if (formStatusExists.length > 0) {
145
+ formCols[prop].edit = true
146
+ } else {
147
+ formCols[prop].edit = false
148
+ }
149
+ }
150
+ // Vue.set(formCols, i, formCols[i])
151
+ }
152
+ }
153
+ export function setFrameToolBtnState(toolBars, formState, formStatus) {
154
+ for (let i = 0; i < toolBars.length; i++) {
155
+ toolBars[i].visible = false
156
+ toolBars[i].isPrimary = false
157
+ if (
158
+ toolBars[i].visibleStates &&
159
+ toolBars[i].visibleStates.indexOf(formState) >= 0
160
+ ) {
161
+ toolBars[i].visible = true
162
+ }
163
+ if (formStatus && toolBars[i].visibleStatuss && toolBars[i].visible) {
164
+ toolBars[i].visible = toolBars[i].visibleStatuss.indexOf(formStatus) >= 0
165
+ }
166
+ }
167
+ // 查找优先级最大的并且显示的设置按钮强调色
168
+ let visibleBtns = toolBars.filter(filterItem => {
169
+ return filterItem.visible === true
170
+ })
171
+ //循环数组查找出小于自身的priority优先级 优先级高设置按钮强调色
172
+ for (let i = 0; i < visibleBtns.length; i++) {
173
+ let tempPriority = visibleBtns[i].priority
174
+ let tempBtns = visibleBtns.filter(filterItem => {
175
+ return filterItem.priority < tempPriority
176
+ })
177
+ //如果找到小于自身优先级的数量>0就说明还有更小的跳出本次不设置true继续查找
178
+ if (tempBtns.length > 0) {
179
+ continue
180
+ }
181
+ visibleBtns[i].isPrimary = true
182
+ }
183
+ }
184
+ export function showErrors(errs) {
185
+ let errors = ''
186
+ for (let i = 0; i < errs.length; i++) {
187
+ errors = errors + errs[i] + '\n'
188
+ }
189
+ notification.error({
190
+ style: {
191
+ whiteSpace: 'pre-wrap'
192
+ },
193
+ message: '错误',
194
+ description: errors,
195
+ placement: 'topRight'
196
+ })
197
+ }
198
+ export function getUuid() {
199
+ let d = new Date().getTime()
200
+ let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(
201
+ c
202
+ ) {
203
+ let r = (d + Math.random() * 16) % 16 | 0
204
+ d = Math.floor(d / 16)
205
+ return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16)
206
+ })
207
+ return uuid
208
+ }
209
+ export async function getFormValidErrors(formView) {
210
+ let formErrors = []
211
+ const validFormError = await formView.validate().catch(errMap => errMap)
212
+ if (validFormError === false) {
213
+ for (let errorProp in formView.errors) {
214
+ for (let x = 0; x < formView.errors[errorProp].length; x++) {
215
+ formErrors.push(errorProp + ':' + formView.errors[errorProp][x])
216
+ }
217
+ }
218
+ }
219
+ return formErrors
220
+ }
221
+ export function stringUrlQuery(obj) {
222
+ let strUrlQuery = ''
223
+ for (let prop in obj) {
224
+ strUrlQuery = strUrlQuery + prop + '=' + obj[prop] + '&'
225
+ }
226
+ if (strUrlQuery.length > 0) {
227
+ strUrlQuery = strUrlQuery.substring(0, strUrlQuery.length - 1)
228
+ }
229
+ return strUrlQuery
230
+ }
231
+ export function getRouteFullPath(route) {
232
+ let fullPath = route.path + '?' + stringUrlQuery(route.query)
233
+ return fullPath
234
+ }
235
+ export async function getGridValidErrors(gridView) {
236
+ const gridErrors = await gridView.fullValidate()
237
+ return gridErrors
238
+ }
239
+
240
+ export function routeBeforeEach(to, from, next){
241
+ if(to.params.aliveCacheKey){
242
+ to.meta['aliveCacheKey'] = to.params.aliveCacheKey
243
+ }
244
+ if(!to.meta.aliveCacheKey){
245
+ alert('防呆,子应用没有路由缓存键')
246
+ }
247
+ if (to.meta.moduleCode && !store.getters.moduleViewInfo[to.meta.moduleCode]) {
248
+ store
249
+ .dispatch('moduleLoadViewInfo', { moduleCode: to.meta.moduleCode })
250
+ .then(() => {
251
+ next()
252
+ })
253
+ .catch((err) => {
254
+ console.debug(err)
255
+ })
256
+ } else {
257
+ next()
258
+ }
259
+ }
@@ -0,0 +1,181 @@
1
+ import XEUtils from 'xe-utils'
2
+
3
+ export const browse = XEUtils.browse()
4
+ const reClsMap = {}
5
+
6
+ function getClsRE (cls) {
7
+ if (!reClsMap[cls]) {
8
+ reClsMap[cls] = new RegExp(`(?:^|\\s)${cls}(?!\\S)`, 'g')
9
+ }
10
+ return reClsMap[cls]
11
+ }
12
+
13
+ function getNodeOffset (elem, container, rest) {
14
+ if (elem) {
15
+ const parentElem = elem.parentNode
16
+ rest.top += elem.offsetTop
17
+ rest.left += elem.offsetLeft
18
+ if (parentElem && parentElem !== document.documentElement && parentElem !== document.body) {
19
+ rest.top -= parentElem.scrollTop
20
+ rest.left -= parentElem.scrollLeft
21
+ }
22
+ if (container && (elem === container || elem.offsetParent === container) ? 0 : elem.offsetParent) {
23
+ return getNodeOffset(elem.offsetParent, container, rest)
24
+ }
25
+ }
26
+ return rest
27
+ }
28
+
29
+ function isScale (val) {
30
+ return val && /^\d+%$/.test(val)
31
+ }
32
+
33
+ function hasClass (elem, cls) {
34
+ return elem && elem.className && elem.className.match && elem.className.match(getClsRE(cls))
35
+ }
36
+
37
+ function removeClass (elem, cls) {
38
+ if (elem && hasClass(elem, cls)) {
39
+ elem.className = elem.className.replace(getClsRE(cls), '')
40
+ }
41
+ }
42
+
43
+ function getDomNode () {
44
+ const documentElement = document.documentElement
45
+ const bodyElem = document.body
46
+ return {
47
+ scrollTop: documentElement.scrollTop || bodyElem.scrollTop,
48
+ scrollLeft: documentElement.scrollLeft || bodyElem.scrollLeft,
49
+ visibleHeight: documentElement.clientHeight || bodyElem.clientHeight,
50
+ visibleWidth: documentElement.clientWidth || bodyElem.clientWidth
51
+ }
52
+ }
53
+
54
+ export function getOffsetHeight (elem) {
55
+ return elem ? elem.offsetHeight : 0
56
+ }
57
+
58
+ export function getPaddingTopBottomSize (elem) {
59
+ if (elem) {
60
+ const computedStyle = getComputedStyle(elem)
61
+ const paddingTop = XEUtils.toNumber(computedStyle.paddingTop)
62
+ const paddingBottom = XEUtils.toNumber(computedStyle.paddingBottom)
63
+ return paddingTop + paddingBottom
64
+ }
65
+ return 0
66
+ }
67
+
68
+ export function setScrollTop (elem, scrollTop) {
69
+ if (elem) {
70
+ elem.scrollTop = scrollTop
71
+ }
72
+ }
73
+
74
+ export function setScrollLeft (elem, scrollLeft) {
75
+ if (elem) {
76
+ elem.scrollLeft = scrollLeft
77
+ }
78
+ }
79
+
80
+ // export function setScrollLeftAndTop (elem, scrollLeft, scrollTop) {
81
+ // if (elem) {
82
+ // elem.scrollLeft = scrollLeft
83
+ // elem.scrollTop = scrollTop
84
+ // }
85
+ // }
86
+
87
+ function isNodeElement (elem) {
88
+ return elem && elem.nodeType === 1
89
+ }
90
+
91
+ export const DomTools = {
92
+ browse,
93
+ isPx (val) {
94
+ return val && /^\d+(px)?$/.test(val)
95
+ },
96
+ isScale,
97
+ hasClass,
98
+ removeClass,
99
+ addClass (elem, cls) {
100
+ if (elem && !hasClass(elem, cls)) {
101
+ removeClass(elem, cls)
102
+ elem.className = `${elem.className} ${cls}`
103
+ }
104
+ },
105
+ updateCellTitle (overflowElem, column) {
106
+ const content = column.type === 'html' ? overflowElem.innerText : overflowElem.textContent
107
+ if (overflowElem.getAttribute('title') !== content) {
108
+ overflowElem.setAttribute('title', content)
109
+ }
110
+ },
111
+ getDomNode,
112
+ /**
113
+ * 检查触发源是否属于目标节点
114
+ */
115
+ getEventTargetNode (evnt, container, queryCls, queryMethod) {
116
+ let targetElem
117
+ let target =
118
+ evnt.target.shadowRoot && evnt.composed
119
+ ? evnt.composedPath()[0] || evnt.target
120
+ : evnt.target
121
+ while (target && target.nodeType && target !== document) {
122
+ if (queryCls && hasClass(target, queryCls) && (!queryMethod || queryMethod(target))) {
123
+ targetElem = target
124
+ } else if (target === container) {
125
+ return { flag: queryCls ? !!targetElem : true, container, targetElem: targetElem }
126
+ }
127
+ target = target.parentNode
128
+ }
129
+ return { flag: false }
130
+ },
131
+ /**
132
+ * 获取元素相对于 document 的位置
133
+ */
134
+ getOffsetPos (elem, container) {
135
+ return getNodeOffset(elem, container, { left: 0, top: 0 })
136
+ },
137
+ getAbsolutePos (elem) {
138
+ const bounding = elem.getBoundingClientRect()
139
+ const boundingTop = bounding.top
140
+ const boundingLeft = bounding.left
141
+ const { scrollTop, scrollLeft, visibleHeight, visibleWidth } = getDomNode()
142
+ return { boundingTop, top: scrollTop + boundingTop, boundingLeft, left: scrollLeft + boundingLeft, visibleHeight, visibleWidth }
143
+ },
144
+ scrollToView (elem) {
145
+ const scrollIntoViewIfNeeded = 'scrollIntoViewIfNeeded'
146
+ const scrollIntoView = 'scrollIntoView'
147
+ if (elem) {
148
+ if (elem[scrollIntoViewIfNeeded]) {
149
+ elem[scrollIntoViewIfNeeded]()
150
+ } else if (elem[scrollIntoView]) {
151
+ elem[scrollIntoView]()
152
+ }
153
+ }
154
+ },
155
+ triggerEvent (targetElem, type) {
156
+ if (targetElem) {
157
+ targetElem.dispatchEvent(new Event(type))
158
+ }
159
+ },
160
+ calcHeight ($xetable, key) {
161
+ const val = $xetable[key]
162
+ let num = 0
163
+ if (val) {
164
+ if (val === 'auto') {
165
+ num = $xetable.parentHeight
166
+ } else {
167
+ const excludeHeight = $xetable.getExcludeHeight()
168
+ if (isScale(val)) {
169
+ num = Math.floor((XEUtils.toInteger(val) || 1) / 100 * $xetable.parentHeight)
170
+ } else {
171
+ num = XEUtils.toNumber(val)
172
+ }
173
+ num = Math.max(40, num - excludeHeight)
174
+ }
175
+ }
176
+ return num
177
+ },
178
+ isNodeElement
179
+ }
180
+
181
+ export default DomTools
@@ -0,0 +1,81 @@
1
+ export const sysRowState = {
2
+ view: 0,
3
+ add: 1,
4
+ update: 2,
5
+ delete: 3
6
+ }
7
+ export const sysFormState = {
8
+ add: 'add',
9
+ edit: 'edit',
10
+ view: 'view',
11
+ done: 10000
12
+ }
13
+ export const calendarViewType = {
14
+ day: 'day',
15
+ week: 'week',
16
+ month: 'month'
17
+ }
18
+ export const controlType = {
19
+ text: 'text',
20
+ number: 'number', // 数字输入
21
+ textarea: 'textarea',
22
+ numberrange: 'numberrange',
23
+ drop: 'drop',
24
+ popup: 'popup',
25
+ date: 'date',
26
+ datetime: 'datetime',
27
+ timeFrame: 'timeFrame',
28
+ time: 'time',
29
+ longtime: 'longtime',
30
+ checkbox: 'checkbox',
31
+ dropmulti: 'dropmulti',
32
+ tabledelete: 'tabledelete',
33
+ tableadd: 'tableadd',
34
+ searchfilter: 'searchfilter',
35
+ max: 'max',
36
+ min: 'min',
37
+ sum: 'sum',
38
+ svg: 'svg',
39
+ dropdict: 'dropdict',
40
+ dropobjectstatus: 'dropobjectstatus',
41
+ dropmultidict: 'dropmultidict',
42
+ dropmultiobjectstatus: 'dropmultiobjectstatus',
43
+ daterange: 'daterange',
44
+ image: 'image',
45
+ pulldown: 'pulldown',
46
+ operation: 'operation',
47
+ custombutton: 'custombutton',
48
+ pagerbutton: 'pagerbutton',
49
+ select: 'select',
50
+ customCell: 'customCell',
51
+ remotedropmulti: 'remotedropmulti',
52
+ interval: 'interval',
53
+ customRadio: 'customRadio',
54
+ operationDefault: 'operationDefault',
55
+ dateweek: 'dateweek',
56
+ x_axis: 'x_axis',
57
+ y_axis: 'y_axis',
58
+ series: 'series'
59
+ }
60
+ export const dataType = {
61
+ frame: 'frame',
62
+ grid: 'grid',
63
+ gridselect: 'gridselect',
64
+ piccard: 'piccard'
65
+ }
66
+ export const sysActionType = {
67
+ matSale: '200',
68
+ flutTypMat: '201',
69
+ artMat: '300',
70
+ docNumInventoryTrans: '310' // 订单号跳转库存事务查询
71
+ }
72
+
73
+ export const moduleCodeEnum = {
74
+ custMatViewInfo: 'custMatViewInfo' //客户物料详情
75
+ }
76
+ export const dictCodeEnum = {
77
+ UOM: 'UOM', //单位
78
+ MaterialType: 'MaterialType', //物料类型
79
+ TaxRate: 'TaxRate' //税率
80
+ }
81
+