w-web-api 1.0.9 → 1.0.12
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.
- package/README.md +7 -2
- package/dist/css/{app.ff30ea93.css → app.5eff8f8a.css} +1 -1
- package/dist/index.html +1 -1
- package/dist/js/app.a2249856.js +2 -0
- package/dist/js/app.a2249856.js.map +1 -0
- package/dist/js/chunk-vendors.36762e7b.js +24 -0
- package/dist/js/chunk-vendors.36762e7b.js.map +1 -0
- package/dist/w-web-api.umd.js +2 -2
- package/dist/w-web-api.umd.js.map +1 -1
- package/docs/WWebApi.html +2 -2
- package/docs/WWebApi.mjs.html +52 -13
- package/docs/index.html +1 -1
- package/g.getSettings.mjs +1 -1
- package/package.json +1 -1
- package/server/WWebApi.mjs +51 -12
- package/server/filePathToCode.mjs +9 -0
- package/server/provideApis.mjs +0 -7
- package/src/App.vue +9 -0
- package/src/components/Layout.vue +44 -31
- package/src/components/LayoutContent.vue +1 -5
- package/src/components/LayoutContentList.vue +57 -41
- package/src/main.js +3 -1
- package/src/plugins/mDataSupport.mjs +50 -62
- package/src/plugins/mShare.mjs +36 -227
- package/src/plugins/mUI.mjs +87 -11
- package/src/schema/tables/apis.mjs +114 -57
- package/src/store/mutations.mjs +10 -1
- package/src/store/types.mjs +1 -0
- package/srv.mjs +6 -1
- package/tableTags-web-api.json +1 -1
- package/dist/js/app.3a02c6c0.js +0 -2
- package/dist/js/app.3a02c6c0.js.map +0 -1
- package/dist/js/chunk-vendors.ea519469.js +0 -28
- package/dist/js/chunk-vendors.ea519469.js.map +0 -1
package/src/plugins/mShare.mjs
CHANGED
|
@@ -1,235 +1,44 @@
|
|
|
1
1
|
//前後端共用函數區
|
|
2
2
|
// import min from 'lodash/min'
|
|
3
|
-
import max from 'lodash/max'
|
|
4
|
-
import trim from 'lodash/trim'
|
|
3
|
+
// import max from 'lodash/max'
|
|
4
|
+
// import trim from 'lodash/trim'
|
|
5
5
|
// import isEqual from 'lodash/isEqual'
|
|
6
|
-
import uniq from 'lodash/uniq'
|
|
7
|
-
import set from 'lodash/set'
|
|
8
|
-
import get from 'lodash/get'
|
|
9
|
-
import map from 'lodash/map'
|
|
10
|
-
import each from 'lodash/each'
|
|
11
|
-
import isNumber from 'lodash/isNumber'
|
|
12
|
-
import sortBy from 'lodash/sortBy'
|
|
13
|
-
import find from 'lodash/find'
|
|
14
|
-
import size from 'lodash/size'
|
|
15
|
-
import filter from 'lodash/filter'
|
|
16
|
-
import last from 'lodash/last'
|
|
17
|
-
import split from 'lodash/split'
|
|
18
|
-
import join from 'lodash/join'
|
|
19
|
-
import cloneDeep from 'lodash/cloneDeep'
|
|
20
|
-
import cstr from 'wsemi/src/cstr.mjs'
|
|
21
|
-
import sep from 'wsemi/src/sep.mjs'
|
|
22
|
-
import isarr from 'wsemi/src/isarr.mjs'
|
|
23
|
-
import isearr from 'wsemi/src/isearr.mjs'
|
|
24
|
-
import isstr from 'wsemi/src/isstr.mjs'
|
|
25
|
-
import isestr from 'wsemi/src/isestr.mjs'
|
|
26
|
-
import isbol from 'wsemi/src/isbol.mjs'
|
|
27
|
-
import iseobj from 'wsemi/src/iseobj.mjs'
|
|
28
|
-
import ispint from 'wsemi/src/ispint.mjs'
|
|
29
|
-
import isnum from 'wsemi/src/isnum.mjs'
|
|
30
|
-
import ispnum from 'wsemi/src/ispnum.mjs'
|
|
31
|
-
import isfun from 'wsemi/src/isfun.mjs'
|
|
32
|
-
import cdbl from 'wsemi/src/cdbl.mjs'
|
|
33
|
-
import cint from 'wsemi/src/cint.mjs'
|
|
34
|
-
import strleft from 'wsemi/src/strleft.mjs'
|
|
35
|
-
import strmid from 'wsemi/src/strmid.mjs'
|
|
36
|
-
import haskey from 'wsemi/src/haskey.mjs'
|
|
37
|
-
import timemsTZ2past from 'wsemi/src/timemsTZ2past.mjs'
|
|
38
|
-
import getFileAccept from 'wsemi/src/getFileAccept.mjs'
|
|
6
|
+
// import uniq from 'lodash/uniq'
|
|
7
|
+
// import set from 'lodash/set'
|
|
8
|
+
// import get from 'lodash/get'
|
|
9
|
+
// import map from 'lodash/map'
|
|
10
|
+
// import each from 'lodash/each'
|
|
11
|
+
// import isNumber from 'lodash/isNumber'
|
|
12
|
+
// import sortBy from 'lodash/sortBy'
|
|
13
|
+
// import find from 'lodash/find'
|
|
14
|
+
// import size from 'lodash/size'
|
|
15
|
+
// import filter from 'lodash/filter'
|
|
16
|
+
// import last from 'lodash/last'
|
|
17
|
+
// import split from 'lodash/split'
|
|
18
|
+
// import join from 'lodash/join'
|
|
19
|
+
// import cloneDeep from 'lodash/cloneDeep'
|
|
20
|
+
// import cstr from 'wsemi/src/cstr.mjs'
|
|
21
|
+
// import sep from 'wsemi/src/sep.mjs'
|
|
22
|
+
// import isarr from 'wsemi/src/isarr.mjs'
|
|
23
|
+
// import isearr from 'wsemi/src/isearr.mjs'
|
|
24
|
+
// import isstr from 'wsemi/src/isstr.mjs'
|
|
25
|
+
// import isestr from 'wsemi/src/isestr.mjs'
|
|
26
|
+
// import isbol from 'wsemi/src/isbol.mjs'
|
|
27
|
+
// import iseobj from 'wsemi/src/iseobj.mjs'
|
|
28
|
+
// import ispint from 'wsemi/src/ispint.mjs'
|
|
29
|
+
// import isnum from 'wsemi/src/isnum.mjs'
|
|
30
|
+
// import ispnum from 'wsemi/src/ispnum.mjs'
|
|
31
|
+
// import isfun from 'wsemi/src/isfun.mjs'
|
|
32
|
+
// import cdbl from 'wsemi/src/cdbl.mjs'
|
|
33
|
+
// import cint from 'wsemi/src/cint.mjs'
|
|
34
|
+
// import strleft from 'wsemi/src/strleft.mjs'
|
|
35
|
+
// import strmid from 'wsemi/src/strmid.mjs'
|
|
36
|
+
// import haskey from 'wsemi/src/haskey.mjs'
|
|
37
|
+
// import timemsTZ2past from 'wsemi/src/timemsTZ2past.mjs'
|
|
38
|
+
// import getFileAccept from 'wsemi/src/getFileAccept.mjs'
|
|
39
39
|
import at from 'wsemi/src/attstr.mjs'
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
function dtAddAndLtdtFind(dt, keyDtSrc, keyDtSave, ltdt, keyLtdt = 'id') {
|
|
43
|
-
|
|
44
|
-
//id
|
|
45
|
-
let id = get(dt, keyDtSrc, '')
|
|
46
|
-
// console.log('id', id)
|
|
47
|
-
|
|
48
|
-
//check
|
|
49
|
-
if (!isestr(id)) {
|
|
50
|
-
return {}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
//find
|
|
54
|
-
let r = find(ltdt, { [keyLtdt]: id })
|
|
55
|
-
// console.log('find r', r)
|
|
56
|
-
|
|
57
|
-
//check
|
|
58
|
-
if (!iseobj(r)) {
|
|
59
|
-
return {}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
//join
|
|
63
|
-
dt[keyDtSave] = r
|
|
64
|
-
// console.log('dt', dt)
|
|
65
|
-
|
|
66
|
-
return dt
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
function gv(o, k, def = '無') {
|
|
71
|
-
let r = get(o, k, '')
|
|
72
|
-
if (!isestr(r)) {
|
|
73
|
-
return def
|
|
74
|
-
}
|
|
75
|
-
return r
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
function parseNameByVersion(name) {
|
|
80
|
-
|
|
81
|
-
//check
|
|
82
|
-
if (name.indexOf('R') < 0) {
|
|
83
|
-
return {
|
|
84
|
-
name,
|
|
85
|
-
version: null,
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
let s = sep(name, 'R')
|
|
90
|
-
let s0 = get(s, 0, '')
|
|
91
|
-
let s1 = get(s, 1, '')
|
|
92
|
-
let nv = size(s1)
|
|
93
|
-
|
|
94
|
-
//check
|
|
95
|
-
if (nv < 5) { //版本號為R00.00, 不包括R需為5位
|
|
96
|
-
return {
|
|
97
|
-
name,
|
|
98
|
-
version: null,
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
else if (nv > 5) { //版本號為R00.00-1091019, 後面可能有其他文字數字
|
|
102
|
-
s1 = strleft(s1, 5)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
//check, 提取出版本號為00.00, 需針對各字元檢查
|
|
106
|
-
let c0 = strmid(s1, 0, 1)
|
|
107
|
-
let c1 = strmid(s1, 1, 1)
|
|
108
|
-
let c2 = strmid(s1, 2, 1)
|
|
109
|
-
let c3 = strmid(s1, 3, 1)
|
|
110
|
-
let c4 = strmid(s1, 4, 1)
|
|
111
|
-
if (!isnum(c0) || !isnum(c1) || !isnum(c3) || !isnum(c4) || (c2 !== '.')) {
|
|
112
|
-
return {
|
|
113
|
-
name,
|
|
114
|
-
version: null,
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
//version
|
|
119
|
-
let version = `R${s1}`
|
|
120
|
-
|
|
121
|
-
return {
|
|
122
|
-
name: s0,
|
|
123
|
-
version,
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
function timeFormaterPast(t) {
|
|
129
|
-
let c = timemsTZ2past(t)
|
|
130
|
-
c = get(c, 'msg', '無')
|
|
131
|
-
return c
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
// function parseSerialNumberByVersion(serialNumber) {
|
|
136
|
-
|
|
137
|
-
// //check
|
|
138
|
-
// if (serialNumber.indexOf('R') < 0) {
|
|
139
|
-
// return {
|
|
140
|
-
// serialNumber,
|
|
141
|
-
// serialNumberBase: serialNumber,
|
|
142
|
-
// version: null,
|
|
143
|
-
// }
|
|
144
|
-
// }
|
|
145
|
-
|
|
146
|
-
// let s = sep(serialNumber, 'R')
|
|
147
|
-
// let s0 = get(s, 0, '')
|
|
148
|
-
// let s1 = get(s, 1, '')
|
|
149
|
-
// let nv = size(s1)
|
|
150
|
-
|
|
151
|
-
// //check
|
|
152
|
-
// if (nv !== 5) { //版本號為R00.00, 不包括R需為5位
|
|
153
|
-
// return {
|
|
154
|
-
// serialNumber,
|
|
155
|
-
// serialNumberBase: serialNumber,
|
|
156
|
-
// version: null,
|
|
157
|
-
// }
|
|
158
|
-
// }
|
|
159
|
-
|
|
160
|
-
// //version
|
|
161
|
-
// let version = `R${s1}`
|
|
162
|
-
|
|
163
|
-
// return {
|
|
164
|
-
// serialNumber,
|
|
165
|
-
// serialNumberBase: s0,
|
|
166
|
-
// version,
|
|
167
|
-
// }
|
|
168
|
-
// }
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
// function isNumOrEng(str) {
|
|
172
|
-
// let regExp = /^[\d|a-zA-Z]+$/
|
|
173
|
-
// if (regExp.test(str)) {
|
|
174
|
-
// return true
|
|
175
|
-
// }
|
|
176
|
-
// else {
|
|
177
|
-
// return false
|
|
178
|
-
// }
|
|
179
|
-
// }
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
// function getKpTableData(rows) {
|
|
183
|
-
// rows = filter(rows, (v) => {
|
|
184
|
-
// return v.isActive === 'y'
|
|
185
|
-
// })
|
|
186
|
-
// let kp = {}
|
|
187
|
-
// each(rows, (v) => {
|
|
188
|
-
// kp[v.id] = v
|
|
189
|
-
// })
|
|
190
|
-
// return kp
|
|
191
|
-
// }
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
// function getItemsByIds(ids, kp) {
|
|
195
|
-
// let ts = atParse(ids)
|
|
196
|
-
// let rs = []
|
|
197
|
-
// each(ts, (v) => {
|
|
198
|
-
// let r = get(kp, v.id)
|
|
199
|
-
// if (iseobj(r)) {
|
|
200
|
-
// rs.push(r)
|
|
201
|
-
// }
|
|
202
|
-
// })
|
|
203
|
-
// return rs
|
|
204
|
-
// }
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
// function extractFileType(fileName, fileType) {
|
|
208
|
-
// let r = ''
|
|
209
|
-
|
|
210
|
-
// //find
|
|
211
|
-
// let ar = getFileAccept()
|
|
212
|
-
// for (let i = 0; i < ar.length; i++) {
|
|
213
|
-
// if (ar[i].acp === fileType) {
|
|
214
|
-
// return ar[i].name
|
|
215
|
-
// }
|
|
216
|
-
// }
|
|
217
|
-
|
|
218
|
-
// //from name ext
|
|
219
|
-
// let s = split(fileName, '.')
|
|
220
|
-
// if (size(s) > 1) {
|
|
221
|
-
// return last(s)
|
|
222
|
-
// }
|
|
223
|
-
|
|
224
|
-
// return r
|
|
225
|
-
// }
|
|
226
|
-
|
|
227
|
-
|
|
228
42
|
export {
|
|
229
|
-
at
|
|
230
|
-
gv,
|
|
231
|
-
parseNameByVersion,
|
|
232
|
-
// parseSerialNumberByVersion,
|
|
233
|
-
dtAddAndLtdtFind,
|
|
234
|
-
timeFormaterPast
|
|
43
|
+
at
|
|
235
44
|
}
|
package/src/plugins/mUI.mjs
CHANGED
|
@@ -41,20 +41,17 @@ import arrInsert from 'wsemi/src/arrInsert.mjs'
|
|
|
41
41
|
import replace from 'wsemi/src/replace.mjs'
|
|
42
42
|
import timemsTZ2past from 'wsemi/src/timemsTZ2past.mjs'
|
|
43
43
|
import convertToTree from 'wsemi/src/convertToTree.mjs'
|
|
44
|
-
import html2picDyn from 'wsemi/src/html2picDyn.mjs'
|
|
45
|
-
import urlParse from 'wsemi/src/urlParse.mjs'
|
|
46
|
-
import domConvertToPicDyn from 'wsemi/src/domConvertToPicDyn.mjs'
|
|
47
|
-
import ltdtkeysheads2mat from 'wsemi/src/ltdtkeysheads2mat.mjs'
|
|
48
|
-
import downloadFileFromB64 from 'wsemi/src/downloadFileFromB64.mjs'
|
|
49
|
-
import downloadExcelFileFromDataDyn from 'wsemi/src/downloadExcelFileFromDataDyn.mjs'
|
|
50
|
-
import getFileAccept from 'wsemi/src/getFileAccept.mjs'
|
|
51
|
-
import downloadFileFromU8Arr from 'wsemi/src/downloadFileFromU8Arr.mjs'
|
|
52
44
|
// import WUiDwload from 'w-ui-dwload/src/WUiDwload.mjs'
|
|
53
45
|
|
|
54
46
|
|
|
55
47
|
let vo = Vue.prototype
|
|
56
48
|
|
|
57
49
|
|
|
50
|
+
function setVo(vObj) {
|
|
51
|
+
vo = vObj
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
58
55
|
function updateConnState(connState) {
|
|
59
56
|
vo.$store.commit(vo.$store.types.UpdateConnState, connState)
|
|
60
57
|
}
|
|
@@ -70,21 +67,92 @@ function updateViewState(viewState) {
|
|
|
70
67
|
}
|
|
71
68
|
|
|
72
69
|
|
|
70
|
+
function forceUpdate() {
|
|
71
|
+
// console.log('call forceUpdate')
|
|
72
|
+
|
|
73
|
+
function broadcast(chs) {
|
|
74
|
+
each(chs, (v) => {
|
|
75
|
+
// console.log(v.$el)
|
|
76
|
+
v.$forceUpdate()
|
|
77
|
+
if (v.$children) {
|
|
78
|
+
broadcast(v.$children)
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
//broadcast, 注意此處需使用更換ui內vo為mounted後的vo, 也就是含元素, 才能使用廣播技術
|
|
84
|
+
broadcast(vo.$children)
|
|
85
|
+
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
function setLang(lang = null) {
|
|
90
|
+
// console.log('call setLang')
|
|
91
|
+
|
|
92
|
+
//check lang, 若有輸入才commit
|
|
93
|
+
if (isestr(lang)) {
|
|
94
|
+
vo.$store.commit(vo.$store.types.UpdateLang, lang)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
//getKpLang, 切換lang得調用getKpLang重算kpText
|
|
98
|
+
getKpLang()
|
|
99
|
+
|
|
100
|
+
//forceUpdate
|
|
101
|
+
forceUpdate()
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
|
|
73
106
|
function getKpLang() {
|
|
107
|
+
// console.log('call getKpLang')
|
|
108
|
+
|
|
109
|
+
//merge keyLangs
|
|
74
110
|
let keyLangs = get(vo, '$store.state.keyLangs')
|
|
75
111
|
let webName = get(vo, '$store.state.webInfor.webName')
|
|
112
|
+
let webDescription = get(vo, '$store.state.webInfor.webDescription')
|
|
76
113
|
let kls = {
|
|
77
114
|
...keyLangs,
|
|
78
115
|
webName: {
|
|
79
116
|
...webName,
|
|
80
117
|
},
|
|
118
|
+
webDescription: {
|
|
119
|
+
...webDescription,
|
|
120
|
+
},
|
|
81
121
|
}
|
|
122
|
+
|
|
123
|
+
//lang
|
|
82
124
|
let lang = get(vo, '$store.state.lang')
|
|
83
|
-
|
|
125
|
+
|
|
126
|
+
//kpText
|
|
127
|
+
let kpText = {}
|
|
84
128
|
each(kls, (v, k) => {
|
|
85
|
-
|
|
129
|
+
kpText[k] = v[lang]
|
|
86
130
|
})
|
|
87
|
-
|
|
131
|
+
|
|
132
|
+
//commit
|
|
133
|
+
vo.$store.commit(vo.$store.types.UpdateKpText, kpText)
|
|
134
|
+
|
|
135
|
+
return kpText
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
function getKpText(key) {
|
|
140
|
+
// console.log('call getKpText')
|
|
141
|
+
let kpText = get(vo, '$store.state.kpText')
|
|
142
|
+
return get(kpText, key, '')
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
function gv(o, k, cv = null) {
|
|
147
|
+
let r = get(o, k, '')
|
|
148
|
+
if (!isestr(r)) {
|
|
149
|
+
let def = getKpText('empty')
|
|
150
|
+
return def
|
|
151
|
+
}
|
|
152
|
+
if (isfun(cv)) {
|
|
153
|
+
r = cv(r)
|
|
154
|
+
}
|
|
155
|
+
return r
|
|
88
156
|
}
|
|
89
157
|
|
|
90
158
|
|
|
@@ -127,10 +195,18 @@ async function waitData(t = 0) {
|
|
|
127
195
|
|
|
128
196
|
let mUI = {
|
|
129
197
|
|
|
198
|
+
setVo,
|
|
199
|
+
|
|
130
200
|
updateConnState,
|
|
131
201
|
updateLoading,
|
|
132
202
|
updateViewState,
|
|
203
|
+
forceUpdate,
|
|
204
|
+
|
|
205
|
+
setLang,
|
|
133
206
|
getKpLang,
|
|
207
|
+
getKpText,
|
|
208
|
+
|
|
209
|
+
gv,
|
|
134
210
|
syncHeight,
|
|
135
211
|
|
|
136
212
|
waitData,
|