w-web-api 1.0.38 → 1.0.40
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 +4 -4
- package/db/wapis/apis/data.mdb +0 -0
- package/db/wapis/apis/lock.mdb +0 -0
- package/dist/css/{app.99a58617.css → app.02bbf3c6.css} +1 -1
- package/dist/index.tmp +2 -2
- package/dist/js/app-legacy.d2226e7d.js +2 -0
- package/dist/js/app-legacy.d2226e7d.js.map +1 -0
- package/dist/js/app.d2226e7d.js +2 -0
- package/dist/js/app.d2226e7d.js.map +1 -0
- package/dist/js/{chunk-vendors.767ef893.js → chunk-vendors-legacy.10dbc55a.js} +3 -3
- package/dist/js/chunk-vendors-legacy.10dbc55a.js.map +1 -0
- package/dist/js/{chunk-vendors-legacy.767ef893.js → chunk-vendors.10dbc55a.js} +3 -3
- package/dist/js/chunk-vendors.10dbc55a.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 +6 -6
- package/docs/WWebApi.mjs.html +120 -34
- package/docs/index.html +1 -1
- package/g.getSettings.mjs +6 -4
- package/g.mOrm.mjs +2 -2
- package/package.json +7 -7
- package/public/index.html +1 -1
- package/script.txt +0 -1
- package/server/WWebApi.mjs +119 -33
- package/src/App.vue +25 -4
- package/src/components/Layout.vue +56 -26
- package/src/components/LayoutContent.vue +51 -37
- package/src/components/LayoutState.vue +20 -8
- package/src/main.js +17 -20
- package/src/plugins/mLang.mjs +250 -0
- package/src/plugins/mUI.mjs +140 -51
- package/src/schema/tables/apis.mjs +6 -8
- package/src/store/mutations.mjs +8 -102
- package/src/store/types.mjs +1 -1
- package/srv.mjs +6 -6
- package/tableTags.json +1 -1
- package/dist/js/app-legacy.f7e293ef.js +0 -2
- package/dist/js/app-legacy.f7e293ef.js.map +0 -1
- package/dist/js/app.f7e293ef.js +0 -2
- package/dist/js/app.f7e293ef.js.map +0 -1
- package/dist/js/chunk-vendors-legacy.767ef893.js.map +0 -1
- package/dist/js/chunk-vendors.767ef893.js.map +0 -1
- package/src/plugins/mDataSupport.mjs +0 -66
|
@@ -3,37 +3,49 @@
|
|
|
3
3
|
:style="`position:absolute; top:0px; left:0px; width:100%; height:100%; transition:all 0.5s linear; display:flex; align-items:center; justify-content:center;`"
|
|
4
4
|
>
|
|
5
5
|
|
|
6
|
-
<template v-if="connState==='
|
|
6
|
+
<template v-if="connState==='csIng'">
|
|
7
7
|
|
|
8
8
|
<img style="width:100px; height:100px;" :src="img_connection">
|
|
9
9
|
|
|
10
10
|
<div style="margin-left:10px;">
|
|
11
11
|
<div style="color:#aaa;">
|
|
12
|
-
{{
|
|
12
|
+
{{$t('csIng')}}
|
|
13
13
|
</div>
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
16
|
</template>
|
|
17
17
|
|
|
18
|
-
<template v-else-if="connState==='
|
|
18
|
+
<template v-else-if="connState==='csLogin'">
|
|
19
|
+
|
|
20
|
+
<img style="width:100px; height:100px;" :src="img_connection">
|
|
21
|
+
|
|
22
|
+
<div style="margin-left:10px;">
|
|
23
|
+
<div style="color:#aaa;">
|
|
24
|
+
{{$t('csLogin')}}
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<template v-else-if="connState==='csLogout'">
|
|
19
31
|
|
|
20
32
|
<img style="width:75px; height:75px;" :src="img_logout">
|
|
21
33
|
|
|
22
34
|
<div style="margin-left:10px;">
|
|
23
35
|
<div style="color:#aaa;">
|
|
24
|
-
{{
|
|
36
|
+
{{$t('csLogout')}}
|
|
25
37
|
</div>
|
|
26
38
|
</div>
|
|
27
39
|
|
|
28
40
|
</template>
|
|
29
41
|
|
|
30
|
-
<template v-else-if="connState==='
|
|
42
|
+
<template v-else-if="connState==='csErrConn'">
|
|
31
43
|
|
|
32
44
|
<img style="width:75px; height:75px;" :src="img_dissconnection">
|
|
33
45
|
|
|
34
46
|
<div style="margin-left:10px;">
|
|
35
47
|
<div style="color:#aaa;">
|
|
36
|
-
{{
|
|
48
|
+
{{$t('csErrConn')}}
|
|
37
49
|
</div>
|
|
38
50
|
</div>
|
|
39
51
|
|
|
@@ -45,7 +57,7 @@
|
|
|
45
57
|
|
|
46
58
|
<div style="margin-left:10px;">
|
|
47
59
|
<div style="color:#aaa;">
|
|
48
|
-
{{
|
|
60
|
+
{{$t('csErrLogin')}}
|
|
49
61
|
</div>
|
|
50
62
|
</div>
|
|
51
63
|
|
|
@@ -55,7 +67,7 @@
|
|
|
55
67
|
</template>
|
|
56
68
|
|
|
57
69
|
<script>
|
|
58
|
-
import get from 'lodash-es/get.js'
|
|
70
|
+
import get from 'lodash-es/get.js'
|
|
59
71
|
|
|
60
72
|
|
|
61
73
|
export default {
|
package/src/main.js
CHANGED
|
@@ -13,7 +13,6 @@ import App from './App.vue'
|
|
|
13
13
|
import store from './store/index.mjs'
|
|
14
14
|
import ui from './plugins/mUI.mjs'
|
|
15
15
|
import mDataSelectorSchema from './plugins/mDataSelectorSchema.mjs'
|
|
16
|
-
import mDataSupport from './plugins/mDataSupport.mjs'
|
|
17
16
|
import * as s from './plugins/mShare.mjs'
|
|
18
17
|
import ds from './schema/index.mjs'
|
|
19
18
|
// console.log('globalState', globalState)
|
|
@@ -35,16 +34,12 @@ Vue.prototype.$alert = function() {
|
|
|
35
34
|
//dssm
|
|
36
35
|
let dssm = mDataSelectorSchema(ds)
|
|
37
36
|
|
|
38
|
-
//dspt
|
|
39
|
-
let dspt = mDataSupport(Vue.prototype)
|
|
40
|
-
|
|
41
37
|
//prototype
|
|
42
38
|
Vue.prototype.$ui = ui
|
|
43
39
|
Vue.prototype.$t = ui.getKpText
|
|
44
40
|
Vue.prototype.$s = s
|
|
45
41
|
Vue.prototype.$dssm = dssm
|
|
46
|
-
Vue.prototype.$
|
|
47
|
-
// Vue.prototype.$ds = ds
|
|
42
|
+
Vue.prototype.$ds = ds
|
|
48
43
|
Vue.prototype.$dg = {}
|
|
49
44
|
|
|
50
45
|
//directive
|
|
@@ -53,43 +48,45 @@ Vue.directive('dommutation', domMutation())
|
|
|
53
48
|
Vue.directive('domdragdrop', domDragDrop())
|
|
54
49
|
|
|
55
50
|
//WServHapiClient
|
|
56
|
-
let bFirstSync = false
|
|
51
|
+
// let bFirstSync = false //不需要bFirstSync, 由getWebInfor結束代表第1次完成同步
|
|
57
52
|
WServHapiClient({
|
|
58
53
|
showLog: false,
|
|
59
54
|
url: window.location.origin + window.location.pathname,
|
|
60
55
|
useWaitToken: true,
|
|
61
56
|
apiName: 'api',
|
|
57
|
+
tokenType: 'Bearer',
|
|
62
58
|
getToken: () => {
|
|
63
59
|
let token = get(Vue.prototype, `$store.state.userToken`, '')
|
|
64
60
|
// console.log('getToken', token)
|
|
65
61
|
return token
|
|
66
62
|
},
|
|
67
63
|
getServerMethods: (_fapi) => {
|
|
68
|
-
console.log('$fapi', _fapi)
|
|
64
|
+
// console.log('$fapi', _fapi)
|
|
65
|
+
|
|
66
|
+
//save $fapi
|
|
69
67
|
Vue.prototype.$fapi = _fapi
|
|
68
|
+
|
|
69
|
+
//getWebInfor
|
|
70
70
|
_fapi.getWebInfor() //已有fapi時優先取得web資訊
|
|
71
71
|
.then((wi) => {
|
|
72
|
-
console.log('$fapi getWebInfor', wi)
|
|
72
|
+
// console.log('$fapi getWebInfor', wi)
|
|
73
|
+
|
|
73
74
|
Vue.prototype.$store.commit(Vue.prototype.$store.types.UpdateWebInfor, wi)
|
|
74
|
-
ui.setLang() //因更新webInfor得要重刷語系才能依照語言取得顯示文字
|
|
75
|
+
ui.setLang(null, 'get webInfor') //因更新webInfor可取得webName與webDescription, 得要重刷語系才能依照語言取得顯示文字
|
|
76
|
+
|
|
77
|
+
//commit syncState
|
|
78
|
+
Vue.prototype.$store.commit(Vue.prototype.$store.types.UpdateSyncState, true)
|
|
79
|
+
|
|
75
80
|
})
|
|
76
81
|
.catch((err) => {
|
|
77
82
|
console.log(err)
|
|
78
83
|
})
|
|
84
|
+
|
|
79
85
|
},
|
|
80
86
|
recvData: (r) => {
|
|
81
|
-
console.log('sync data', r.tableName, r.data)
|
|
87
|
+
// console.log('sync data', r.tableName, r.data)
|
|
82
88
|
Vue.prototype.$store.commit(Vue.prototype.$store.types.UpdateTableData, r)
|
|
83
89
|
},
|
|
84
|
-
getAfterUpdateTableTags: (r) => {
|
|
85
|
-
// console.log('getAfterUpdateTableTags', r, 'needToRefresh', JSON.stringify(r.oldTableTags) !== JSON.stringify(r.newTableTags))
|
|
86
|
-
if (bFirstSync) {
|
|
87
|
-
return
|
|
88
|
-
}
|
|
89
|
-
bFirstSync = true
|
|
90
|
-
console.log('first-sync')
|
|
91
|
-
Vue.prototype.$store.commit(Vue.prototype.$store.types.UpdateSyncState, true)
|
|
92
|
-
},
|
|
93
90
|
})
|
|
94
91
|
|
|
95
92
|
//new
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
let kpLang = {
|
|
4
|
+
|
|
5
|
+
csIng: {
|
|
6
|
+
eng: 'Connecting...',
|
|
7
|
+
cht: '連線中...',
|
|
8
|
+
},
|
|
9
|
+
csLogin: {
|
|
10
|
+
eng: 'Logged in',
|
|
11
|
+
cht: '已登入',
|
|
12
|
+
},
|
|
13
|
+
csLogout: {
|
|
14
|
+
eng: 'Logged out',
|
|
15
|
+
cht: '已登出',
|
|
16
|
+
},
|
|
17
|
+
csErrConn: {
|
|
18
|
+
eng: 'Unable to connect',
|
|
19
|
+
cht: '無法連線',
|
|
20
|
+
},
|
|
21
|
+
csErrLogin: {
|
|
22
|
+
eng: 'Login denied',
|
|
23
|
+
cht: '拒絕登入',
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
aggridLanguage: {
|
|
27
|
+
eng: 'en',
|
|
28
|
+
cht: 'zh-tw',
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
systemMessage: {
|
|
32
|
+
eng: 'System message',
|
|
33
|
+
cht: '系統確認訊息',
|
|
34
|
+
},
|
|
35
|
+
ok: {
|
|
36
|
+
eng: 'OK',
|
|
37
|
+
cht: '確認',
|
|
38
|
+
},
|
|
39
|
+
no: {
|
|
40
|
+
eng: 'No',
|
|
41
|
+
cht: '取消',
|
|
42
|
+
},
|
|
43
|
+
yes: {
|
|
44
|
+
eng: 'Yes',
|
|
45
|
+
cht: '確定',
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
empty: {
|
|
49
|
+
eng: 'Empty',
|
|
50
|
+
cht: '無',
|
|
51
|
+
},
|
|
52
|
+
waitingData: {
|
|
53
|
+
eng: 'Waiting data...',
|
|
54
|
+
cht: '等待數據中...',
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
isEditabled: {
|
|
58
|
+
eng: 'Editable',
|
|
59
|
+
cht: '是否編輯',
|
|
60
|
+
},
|
|
61
|
+
saveChanges: {
|
|
62
|
+
eng: `Save changes`,
|
|
63
|
+
cht: `儲存變更`,
|
|
64
|
+
},
|
|
65
|
+
id: {
|
|
66
|
+
eng: `Id`,
|
|
67
|
+
cht: `主鍵`,
|
|
68
|
+
},
|
|
69
|
+
from: {
|
|
70
|
+
eng: `From`,
|
|
71
|
+
cht: `來源`,
|
|
72
|
+
},
|
|
73
|
+
save: {
|
|
74
|
+
eng: `Save`,
|
|
75
|
+
cht: `儲存`,
|
|
76
|
+
},
|
|
77
|
+
close: {
|
|
78
|
+
eng: `Close`,
|
|
79
|
+
cht: `關閉`,
|
|
80
|
+
},
|
|
81
|
+
delete: {
|
|
82
|
+
eng: `Delete`,
|
|
83
|
+
cht: `刪除`,
|
|
84
|
+
},
|
|
85
|
+
cancel: {
|
|
86
|
+
eng: `Cancel`,
|
|
87
|
+
cht: `取消`,
|
|
88
|
+
},
|
|
89
|
+
screenFull: {
|
|
90
|
+
eng: `Max size`,
|
|
91
|
+
cht: `最大化尺寸`,
|
|
92
|
+
},
|
|
93
|
+
screenNormal: {
|
|
94
|
+
eng: `Normal size`,
|
|
95
|
+
cht: `預設尺寸`,
|
|
96
|
+
},
|
|
97
|
+
checkAllYes: {
|
|
98
|
+
eng: `Check all`,
|
|
99
|
+
cht: `全選使用`,
|
|
100
|
+
},
|
|
101
|
+
checkAllNo: {
|
|
102
|
+
eng: `Uncheck all`,
|
|
103
|
+
cht: `全不選使用`,
|
|
104
|
+
},
|
|
105
|
+
checkAllInv: {
|
|
106
|
+
eng: `Reverse all`,
|
|
107
|
+
cht: `全反選使用`,
|
|
108
|
+
},
|
|
109
|
+
operMode: {
|
|
110
|
+
eng: `Enable`,
|
|
111
|
+
cht: `是否使用`,
|
|
112
|
+
},
|
|
113
|
+
operPemiEnable: {
|
|
114
|
+
eng: `Operator`,
|
|
115
|
+
cht: `合併權限模式`,
|
|
116
|
+
},
|
|
117
|
+
operGrupEnable: {
|
|
118
|
+
eng: `Operator`,
|
|
119
|
+
cht: `合併權限群組模式`,
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
processing: {
|
|
123
|
+
eng: `Processing...`,
|
|
124
|
+
cht: `處理中請稍後...`,
|
|
125
|
+
},
|
|
126
|
+
anUnexpectedErrorOccurred: {
|
|
127
|
+
eng: `An unexpected error occurred, please contact the administrator`,
|
|
128
|
+
cht: `發生非預期錯誤,請洽管理員`,
|
|
129
|
+
},
|
|
130
|
+
unknow: {
|
|
131
|
+
eng: `Unknow`,
|
|
132
|
+
cht: `未知`,
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
username: {
|
|
136
|
+
eng: `Username`,
|
|
137
|
+
cht: `使用者姓名`,
|
|
138
|
+
},
|
|
139
|
+
email: {
|
|
140
|
+
eng: `Email`,
|
|
141
|
+
cht: `電子郵件`,
|
|
142
|
+
},
|
|
143
|
+
name: {
|
|
144
|
+
eng: `Name`,
|
|
145
|
+
cht: `名稱`,
|
|
146
|
+
},
|
|
147
|
+
description: {
|
|
148
|
+
eng: `Description`,
|
|
149
|
+
cht: `說明`,
|
|
150
|
+
},
|
|
151
|
+
// noDescription: {
|
|
152
|
+
// eng: `No description`,
|
|
153
|
+
// cht: `無說明`,
|
|
154
|
+
// },
|
|
155
|
+
modeEdit: {
|
|
156
|
+
eng: `Edit mode`,
|
|
157
|
+
cht: `編輯模式`,
|
|
158
|
+
},
|
|
159
|
+
showTabCols: {
|
|
160
|
+
eng: `Show columns`,
|
|
161
|
+
cht: `顯示欄位`,
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
menuTreeShow: {
|
|
165
|
+
eng: 'Show API list',
|
|
166
|
+
cht: '顯示API清單',
|
|
167
|
+
},
|
|
168
|
+
menuTreeHide: {
|
|
169
|
+
eng: 'Hide API list',
|
|
170
|
+
cht: '隱藏API清單',
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
noSelectApi: {
|
|
174
|
+
eng: 'No Select',
|
|
175
|
+
cht: '尚未選擇API',
|
|
176
|
+
},
|
|
177
|
+
tokens: {
|
|
178
|
+
eng: 'Tokens',
|
|
179
|
+
cht: '授權金鑰',
|
|
180
|
+
},
|
|
181
|
+
apiUrl: {
|
|
182
|
+
eng: 'API url',
|
|
183
|
+
cht: 'API網址',
|
|
184
|
+
},
|
|
185
|
+
version: {
|
|
186
|
+
eng: 'Version',
|
|
187
|
+
cht: '版本',
|
|
188
|
+
},
|
|
189
|
+
levels: {
|
|
190
|
+
eng: 'Levels',
|
|
191
|
+
cht: '所屬階層',
|
|
192
|
+
},
|
|
193
|
+
keywords: {
|
|
194
|
+
eng: 'Keywords',
|
|
195
|
+
cht: '關鍵字',
|
|
196
|
+
},
|
|
197
|
+
state: {
|
|
198
|
+
eng: 'State',
|
|
199
|
+
cht: '狀態',
|
|
200
|
+
},
|
|
201
|
+
timeCreate: {
|
|
202
|
+
eng: 'Create time',
|
|
203
|
+
cht: '創建時間',
|
|
204
|
+
},
|
|
205
|
+
timeUpdate: {
|
|
206
|
+
eng: 'Update time',
|
|
207
|
+
cht: '更新時間',
|
|
208
|
+
},
|
|
209
|
+
creator: {
|
|
210
|
+
eng: 'Creator',
|
|
211
|
+
cht: 'API創建者',
|
|
212
|
+
},
|
|
213
|
+
dataSource: {
|
|
214
|
+
eng: 'Source',
|
|
215
|
+
cht: '資料提供者',
|
|
216
|
+
},
|
|
217
|
+
isActive: {
|
|
218
|
+
eng: 'Active',
|
|
219
|
+
cht: '有效',
|
|
220
|
+
},
|
|
221
|
+
mdInputParams: {
|
|
222
|
+
eng: 'Input',
|
|
223
|
+
cht: '輸入參數資訊或結構',
|
|
224
|
+
},
|
|
225
|
+
inputExample: {
|
|
226
|
+
eng: 'Input example',
|
|
227
|
+
cht: '輸入範例',
|
|
228
|
+
},
|
|
229
|
+
mdOutputParams: {
|
|
230
|
+
eng: 'Output',
|
|
231
|
+
cht: '回傳數據結構',
|
|
232
|
+
},
|
|
233
|
+
outputExample: {
|
|
234
|
+
eng: 'Output example',
|
|
235
|
+
cht: '回傳數據範例',
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
outputMenuTree: {
|
|
239
|
+
eng: 'Tree',
|
|
240
|
+
cht: '樹狀組件',
|
|
241
|
+
},
|
|
242
|
+
outputMenuRaw: {
|
|
243
|
+
eng: 'Raw',
|
|
244
|
+
cht: '原始數據',
|
|
245
|
+
},
|
|
246
|
+
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
export default kpLang
|
package/src/plugins/mUI.mjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import Vue from 'vue'
|
|
2
|
-
import min from 'lodash-es/min.js'
|
|
3
|
-
import size from 'lodash-es/size.js'
|
|
4
|
-
import take from 'lodash-es/take.js'
|
|
5
|
-
import isEqual from 'lodash-es/isEqual.js'
|
|
6
|
-
import uniq from 'lodash-es/uniq.js'
|
|
7
|
-
import set from 'lodash-es/set.js'
|
|
8
|
-
import get from 'lodash-es/get.js'
|
|
9
|
-
import each from 'lodash-es/each.js'
|
|
10
|
-
import map from 'lodash-es/map.js'
|
|
11
|
-
import filter from 'lodash-es/filter.js'
|
|
12
|
-
import last from 'lodash-es/last.js'
|
|
13
|
-
import split from 'lodash-es/split.js'
|
|
14
|
-
import join from 'lodash-es/join.js'
|
|
15
|
-
import drop from 'lodash-es/drop.js'
|
|
16
|
-
import dropRight from 'lodash-es/dropRight.js'
|
|
17
|
-
import groupBy from 'lodash-es/groupBy.js'
|
|
18
|
-
import sortBy from 'lodash-es/sortBy.js'
|
|
19
|
-
import cloneDeep from 'lodash-es/cloneDeep.js'
|
|
2
|
+
import min from 'lodash-es/min.js'
|
|
3
|
+
import size from 'lodash-es/size.js'
|
|
4
|
+
import take from 'lodash-es/take.js'
|
|
5
|
+
import isEqual from 'lodash-es/isEqual.js'
|
|
6
|
+
import uniq from 'lodash-es/uniq.js'
|
|
7
|
+
import set from 'lodash-es/set.js'
|
|
8
|
+
import get from 'lodash-es/get.js'
|
|
9
|
+
import each from 'lodash-es/each.js'
|
|
10
|
+
import map from 'lodash-es/map.js'
|
|
11
|
+
import filter from 'lodash-es/filter.js'
|
|
12
|
+
import last from 'lodash-es/last.js'
|
|
13
|
+
import split from 'lodash-es/split.js'
|
|
14
|
+
import join from 'lodash-es/join.js'
|
|
15
|
+
import drop from 'lodash-es/drop.js'
|
|
16
|
+
import dropRight from 'lodash-es/dropRight.js'
|
|
17
|
+
import groupBy from 'lodash-es/groupBy.js'
|
|
18
|
+
import sortBy from 'lodash-es/sortBy.js'
|
|
19
|
+
import cloneDeep from 'lodash-es/cloneDeep.js'
|
|
20
20
|
import cint from 'wsemi/src/cint.mjs'
|
|
21
21
|
import delay from 'wsemi/src/delay.mjs'
|
|
22
22
|
import isarr from 'wsemi/src/isarr.mjs'
|
|
@@ -42,6 +42,7 @@ 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
44
|
// import WUiDwload from 'w-ui-dwload/src/WUiDwload.mjs'
|
|
45
|
+
import kpLang from './mLang.mjs'
|
|
45
46
|
|
|
46
47
|
|
|
47
48
|
let vo = Vue.prototype
|
|
@@ -62,9 +63,9 @@ function updateLoading(loading) {
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
|
|
65
|
-
function updateViewState(viewState) {
|
|
66
|
-
|
|
67
|
-
}
|
|
66
|
+
// function updateViewState(viewState) {
|
|
67
|
+
// vo.$store.commit(vo.$store.types.UpdateViewState, viewState)
|
|
68
|
+
// }
|
|
68
69
|
|
|
69
70
|
|
|
70
71
|
function updateUserToken(userToken) {
|
|
@@ -78,7 +79,7 @@ function updateUserSelf(userSelf) {
|
|
|
78
79
|
|
|
79
80
|
|
|
80
81
|
function forceUpdate() {
|
|
81
|
-
// console.log('
|
|
82
|
+
// console.log('forceUpdate')
|
|
82
83
|
|
|
83
84
|
function broadcast(chs) {
|
|
84
85
|
each(chs, (v) => {
|
|
@@ -96,16 +97,67 @@ function forceUpdate() {
|
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
|
|
99
|
-
function
|
|
100
|
-
|
|
100
|
+
function validLang(lang) {
|
|
101
|
+
if (lang !== 'eng' && lang !== 'cht') {
|
|
102
|
+
// console.log(`invalid lang[${lang}]`)
|
|
103
|
+
lang = 'eng'
|
|
104
|
+
}
|
|
105
|
+
return lang
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
function getLang() {
|
|
110
|
+
let lang = ''
|
|
111
|
+
|
|
112
|
+
//from window
|
|
113
|
+
if (!isestr(lang)) {
|
|
114
|
+
let _lang = get(window, '___pmwperm___.language', '')
|
|
115
|
+
// console.log('_lang(from window)', _lang)
|
|
116
|
+
if (isestr(_lang)) {
|
|
117
|
+
lang = validLang(_lang) //有可能取到未取代前模板符號
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
//from store
|
|
122
|
+
if (!isestr(lang)) {
|
|
123
|
+
let _lang = get(vo, '$store.state.lang', '')
|
|
124
|
+
// console.log('_lang(from store)', _lang)
|
|
125
|
+
if (isestr(_lang)) {
|
|
126
|
+
lang = validLang(_lang) //有可能給予非預期lang
|
|
127
|
+
}
|
|
128
|
+
}
|
|
101
129
|
|
|
102
|
-
//
|
|
103
|
-
if (isestr(lang)) {
|
|
104
|
-
|
|
130
|
+
//return
|
|
131
|
+
if (!isestr(lang)) {
|
|
132
|
+
return 'eng'
|
|
105
133
|
}
|
|
134
|
+
return lang
|
|
135
|
+
}
|
|
136
|
+
|
|
106
137
|
|
|
107
|
-
|
|
108
|
-
|
|
138
|
+
function setLang(lang = null, from = '') {
|
|
139
|
+
// console.log('setLang', lang, from)
|
|
140
|
+
|
|
141
|
+
//check
|
|
142
|
+
if (!isestr(lang)) {
|
|
143
|
+
lang = getLang()
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
lang = validLang(lang)
|
|
147
|
+
}
|
|
148
|
+
// console.log('get lang', lang)
|
|
149
|
+
|
|
150
|
+
//check, 若有變更才commit
|
|
151
|
+
if (true) {
|
|
152
|
+
let _lang = get(vo, '$store.state.lang')
|
|
153
|
+
if (lang !== _lang) {
|
|
154
|
+
vo.$store.commit(vo.$store.types.UpdateLang, lang)
|
|
155
|
+
// console.log('commit lang', lang)
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
//genKpText, 切換lang得調用getKpLang重算kpText
|
|
160
|
+
genKpText(lang)
|
|
109
161
|
|
|
110
162
|
//forceUpdate
|
|
111
163
|
forceUpdate()
|
|
@@ -113,43 +165,81 @@ function setLang(lang = null) {
|
|
|
113
165
|
}
|
|
114
166
|
|
|
115
167
|
|
|
116
|
-
function
|
|
117
|
-
// console.log('
|
|
168
|
+
function genKpText(lang) {
|
|
169
|
+
// console.log('genKpText', lang)
|
|
118
170
|
|
|
119
|
-
//
|
|
120
|
-
let
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
...
|
|
125
|
-
|
|
126
|
-
...webName,
|
|
127
|
-
},
|
|
128
|
-
webDescription: {
|
|
129
|
-
...webDescription,
|
|
130
|
-
},
|
|
171
|
+
//kp
|
|
172
|
+
let kp = {}
|
|
173
|
+
|
|
174
|
+
//kpLang
|
|
175
|
+
kp = {
|
|
176
|
+
...kp,
|
|
177
|
+
...kpLang,
|
|
131
178
|
}
|
|
132
179
|
|
|
133
|
-
//
|
|
134
|
-
let
|
|
180
|
+
//kpLangExt
|
|
181
|
+
let kpLangExt = get(vo, '$store.state.webInfor.kpLangExt', {})
|
|
182
|
+
// console.log('kpLangExt', kpLangExt)
|
|
183
|
+
if (iseobj(kpLangExt)) {
|
|
184
|
+
kp = {
|
|
185
|
+
...kp,
|
|
186
|
+
...kpLangExt,
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
//webName
|
|
191
|
+
let webName = get(vo, '$store.state.webInfor.webName', {})
|
|
192
|
+
// console.log('webName', webName)
|
|
193
|
+
if (iseobj(webName)) {
|
|
194
|
+
kp = {
|
|
195
|
+
...kp,
|
|
196
|
+
webName: {
|
|
197
|
+
...webName,
|
|
198
|
+
},
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
//webDescription
|
|
203
|
+
let webDescription = get(vo, '$store.state.webInfor.webDescription', {})
|
|
204
|
+
// console.log('webDescription', webDescription)
|
|
205
|
+
if (iseobj(webDescription)) {
|
|
206
|
+
kp = {
|
|
207
|
+
...kp,
|
|
208
|
+
webDescription: {
|
|
209
|
+
...webDescription,
|
|
210
|
+
},
|
|
211
|
+
}
|
|
212
|
+
}
|
|
135
213
|
|
|
136
214
|
//kpText
|
|
137
215
|
let kpText = {}
|
|
138
|
-
each(
|
|
216
|
+
each(kp, (v, k) => {
|
|
139
217
|
kpText[k] = v[lang]
|
|
140
218
|
})
|
|
219
|
+
// console.log('kp', kp)
|
|
220
|
+
// console.log('kpText', kpText)
|
|
141
221
|
|
|
142
222
|
//commit
|
|
143
223
|
vo.$store.commit(vo.$store.types.UpdateKpText, kpText)
|
|
224
|
+
// console.log('commit kpText', kpText)
|
|
144
225
|
|
|
145
|
-
return kpText
|
|
146
226
|
}
|
|
147
227
|
|
|
148
228
|
|
|
149
229
|
function getKpText(key) {
|
|
150
|
-
// console.log('
|
|
230
|
+
// console.log('getKpText', key)
|
|
231
|
+
|
|
232
|
+
//kpText
|
|
151
233
|
let kpText = get(vo, '$store.state.kpText')
|
|
152
|
-
|
|
234
|
+
// console.log('kpText', cloneDeep(kpText))
|
|
235
|
+
|
|
236
|
+
//t
|
|
237
|
+
let t = get(kpText, key, '')
|
|
238
|
+
if (!isestr(t)) {
|
|
239
|
+
t = key
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return t
|
|
153
243
|
}
|
|
154
244
|
|
|
155
245
|
|
|
@@ -209,13 +299,12 @@ let mUI = {
|
|
|
209
299
|
|
|
210
300
|
updateConnState,
|
|
211
301
|
updateLoading,
|
|
212
|
-
updateViewState,
|
|
302
|
+
// updateViewState,
|
|
213
303
|
updateUserToken,
|
|
214
304
|
updateUserSelf,
|
|
215
305
|
forceUpdate,
|
|
216
306
|
|
|
217
307
|
setLang,
|
|
218
|
-
getKpLang,
|
|
219
308
|
getKpText,
|
|
220
309
|
|
|
221
310
|
gv,
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import map from 'lodash-es/map.js'
|
|
2
|
-
import keys from 'lodash-es/keys.js'
|
|
3
|
-
|
|
4
|
-
import genID from 'wsemi/src/genID.mjs'
|
|
1
|
+
import map from 'lodash-es/map.js'
|
|
2
|
+
import keys from 'lodash-es/keys.js'
|
|
3
|
+
import genIDSeq from 'wsemi/src/genIDSeq.mjs'
|
|
5
4
|
import dtmapping from 'wsemi/src/dtmapping.mjs'
|
|
6
5
|
import dtpick from 'wsemi/src/dtpick.mjs'
|
|
7
6
|
import nowms2str from 'wsemi/src/nowms2str.mjs'
|
|
8
|
-
import
|
|
9
|
-
import isestr from 'wsemi/src/isestr.mjs'
|
|
7
|
+
import isestr from 'wsemi/src/isestr.mjs'
|
|
10
8
|
import filePathToCode from '../../../server/filePathToCode.mjs'
|
|
11
9
|
|
|
12
10
|
|
|
@@ -104,7 +102,7 @@ let settings = {
|
|
|
104
102
|
|
|
105
103
|
let funNew = (ndata = {}) => {
|
|
106
104
|
let o = dtmapping(ndata, keys(settings))
|
|
107
|
-
o.id = `${
|
|
105
|
+
o.id = `${genIDSeq()}`
|
|
108
106
|
o.timeCreate = nowms2str()
|
|
109
107
|
o.timeUpdate = o.timeCreate
|
|
110
108
|
o.isActive = 'y'
|
|
@@ -969,7 +967,7 @@ let funTest = () => {
|
|
|
969
967
|
},
|
|
970
968
|
], (item, k) => {
|
|
971
969
|
let v = funNew({ ...item, order: k })
|
|
972
|
-
v.id = item.id
|
|
970
|
+
// v.id = item.id
|
|
973
971
|
if (isestr(item.timeUpdate)) {
|
|
974
972
|
v.timeUpdate = item.timeUpdate
|
|
975
973
|
}
|