w-ui-v1 1.0.59 → 1.0.61
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/package.json +1 -1
- package/utils/apis/pageConfig.ts +2 -1
- package/w-add/w-add.vue +7 -1
- package/w-card/w-card.vue +15 -3
- package/w-edit/w-edit.vue +111 -71
- package/w-form-control/w-form-control.vue +3 -2
- package/w-login/w-login.vue +22 -2
- package/w-table/w-table.vue +1 -1
package/package.json
CHANGED
package/utils/apis/pageConfig.ts
CHANGED
|
@@ -20,12 +20,13 @@ export function addPageConfig(sourceId: string) {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
//新增页面提交保存
|
|
23
|
-
export function addPageDataSave(sourceId: string, data: any) {
|
|
23
|
+
export function addPageDataSave(sourceId: string,mainCode: string, data: any) {
|
|
24
24
|
return request({
|
|
25
25
|
url: `/v3/dtmpl/data`,
|
|
26
26
|
method: 'POST',
|
|
27
27
|
data:{
|
|
28
28
|
sourceId,
|
|
29
|
+
mainCode,
|
|
29
30
|
...data
|
|
30
31
|
}
|
|
31
32
|
})
|
package/w-add/w-add.vue
CHANGED
|
@@ -91,8 +91,13 @@ const props = defineProps({
|
|
|
91
91
|
type: String,
|
|
92
92
|
default: ''
|
|
93
93
|
},
|
|
94
|
+
mainCode: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: ''
|
|
97
|
+
},
|
|
94
98
|
|
|
95
99
|
})
|
|
100
|
+
const mainCode=ref('')
|
|
96
101
|
const sourceId = ref('')
|
|
97
102
|
const pageConf = ref({ groups: [] })
|
|
98
103
|
const form = ref()//基本数据表单
|
|
@@ -110,6 +115,7 @@ const Enumcolumn = ref({})
|
|
|
110
115
|
const pointSourceId = ref('')
|
|
111
116
|
onLoad((option: any) => {
|
|
112
117
|
sourceId.value = props.sourceId || option.sourceId
|
|
118
|
+
mainCode.value=props.mainCode || option.mainCode
|
|
113
119
|
getPageConfig()
|
|
114
120
|
})
|
|
115
121
|
|
|
@@ -212,7 +218,7 @@ async function handleSubmit() {
|
|
|
212
218
|
})
|
|
213
219
|
|
|
214
220
|
try {
|
|
215
|
-
const res = await addPageDataSave(sourceId.value, data)
|
|
221
|
+
const res = await addPageDataSave(sourceId.value,mainCode.value, data)
|
|
216
222
|
if (res.data.status === 'success') {
|
|
217
223
|
toast.success("保存成功")
|
|
218
224
|
uni.navigateBack({
|
package/w-card/w-card.vue
CHANGED
|
@@ -149,9 +149,20 @@ function goto(type: string, item: any = {}, subItem: any = {}) {
|
|
|
149
149
|
if (props.actionType === 'relation') {
|
|
150
150
|
emits('edit')
|
|
151
151
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
if(props.page.classEditConfigs.length>0){
|
|
153
|
+
let con= props.page.classEditConfigs.find((item:any)=>{
|
|
154
|
+
return item.preposes[0].defaultValue===props.itemData.fieldMap[item.preposes[0].id]
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
uni.navigateTo({
|
|
158
|
+
url: `/pages/edit/edit?sourceId=${con.id}&code=${props.itemData.code}`,
|
|
159
|
+
})
|
|
160
|
+
}else{
|
|
161
|
+
uni.navigateTo({
|
|
162
|
+
url: `/pages/edit/edit?sourceId=${props.sourceId}&code=${props.itemData.code}`,
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
|
|
155
166
|
break
|
|
156
167
|
case 'openPage':
|
|
157
168
|
uni.navigateTo({
|
|
@@ -192,6 +203,7 @@ const dele = () => {
|
|
|
192
203
|
|
|
193
204
|
//更多按钮点击事件
|
|
194
205
|
const moreBtnsSelect = (item: any) => {
|
|
206
|
+
|
|
195
207
|
switch (item.item.actionType) {
|
|
196
208
|
case 'submit':
|
|
197
209
|
actionBtn(item.item)
|
package/w-edit/w-edit.vue
CHANGED
|
@@ -219,71 +219,17 @@
|
|
|
219
219
|
}
|
|
220
220
|
//保存
|
|
221
221
|
async function handleSubmit() {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
})
|
|
227
|
-
|
|
228
|
-
Promise.all(promiseArr).then(async (valid) => {
|
|
229
|
-
let isTrue = valid.filter((item : any) => {
|
|
230
|
-
return !item.valid
|
|
222
|
+
if(form.value){
|
|
223
|
+
if (isArray(form.value)) {
|
|
224
|
+
let promiseArr = form.value.map((item : any) => {
|
|
225
|
+
return item.validate()
|
|
231
226
|
})
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
})
|
|
237
|
-
let data = {}
|
|
238
|
-
pageConf.value.groups?.forEach((item : any) => {
|
|
239
|
-
if (item.type === 'fieldGroup') {
|
|
240
|
-
item.fields?.forEach((subItem : any) => {
|
|
241
|
-
data[subItem.id] = model.value[subItem.id]
|
|
242
|
-
})
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
if (item.type === 'relation') {
|
|
246
|
-
data[`${item.id}.$$flag$$`] = true
|
|
247
|
-
model.value[item.id]?.forEach((subItem : any, index : number) => {
|
|
248
|
-
data[`${item.id}[${index}].$$relation$$`] = item['relationNames'][0]
|
|
249
|
-
data[`${item.id}[${index}].唯一编码`] = subItem
|
|
250
|
-
})
|
|
251
|
-
}
|
|
227
|
+
|
|
228
|
+
Promise.all(promiseArr).then(async (valid) => {
|
|
229
|
+
let isTrue = valid.filter((item : any) => {
|
|
230
|
+
return !item.valid
|
|
252
231
|
})
|
|
253
|
-
|
|
254
|
-
try {
|
|
255
|
-
const res = await addPageDataSave(sourceId.value, data)
|
|
256
|
-
if (res.data.status === 'success') {
|
|
257
|
-
toast.success("保存成功")
|
|
258
|
-
uni.navigateBack({
|
|
259
|
-
success: () => {
|
|
260
|
-
|
|
261
|
-
uni.$emit('editeDataSAC', { entityCode: res.data.entityCode, sourceId: res.data.sourceId })
|
|
262
|
-
}
|
|
263
|
-
})
|
|
264
|
-
} else {
|
|
265
|
-
toast.error(res.data.message || '保存失败"')
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
} catch (error) {
|
|
269
|
-
toast.error(error)
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
}
|
|
274
|
-
})
|
|
275
|
-
.catch((error) => {
|
|
276
|
-
console.log(error, 'error')
|
|
277
|
-
})
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
} else {
|
|
282
|
-
|
|
283
|
-
form.value
|
|
284
|
-
.validate()
|
|
285
|
-
.then(async ({ valid, errors }) => {
|
|
286
|
-
if (valid) {
|
|
232
|
+
if (isTrue.length === 0) {
|
|
287
233
|
toast.loading({
|
|
288
234
|
message: '保存中...',
|
|
289
235
|
duration: 0
|
|
@@ -295,7 +241,7 @@
|
|
|
295
241
|
data[subItem.id] = model.value[subItem.id]
|
|
296
242
|
})
|
|
297
243
|
}
|
|
298
|
-
|
|
244
|
+
|
|
299
245
|
if (item.type === 'relation') {
|
|
300
246
|
data[`${item.id}.$$flag$$`] = true
|
|
301
247
|
model.value[item.id]?.forEach((subItem : any, index : number) => {
|
|
@@ -311,25 +257,119 @@
|
|
|
311
257
|
toast.success("保存成功")
|
|
312
258
|
uni.navigateBack({
|
|
313
259
|
success: () => {
|
|
314
|
-
|
|
260
|
+
|
|
315
261
|
uni.$emit('editeDataSAC', { entityCode: res.data.entityCode, sourceId: res.data.sourceId })
|
|
316
262
|
}
|
|
317
263
|
})
|
|
318
264
|
} else {
|
|
319
265
|
toast.error(res.data.message || '保存失败"')
|
|
320
266
|
}
|
|
321
|
-
|
|
267
|
+
|
|
322
268
|
} catch (error) {
|
|
323
269
|
toast.error(error)
|
|
324
270
|
}
|
|
325
|
-
|
|
326
|
-
|
|
271
|
+
|
|
272
|
+
|
|
327
273
|
}
|
|
328
274
|
})
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
275
|
+
.catch((error) => {
|
|
276
|
+
console.log(error, 'error')
|
|
277
|
+
})
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
} else {
|
|
282
|
+
form.value
|
|
283
|
+
.validate()
|
|
284
|
+
.then(async ({ valid, errors }) => {
|
|
285
|
+
if (valid) {
|
|
286
|
+
toast.loading({
|
|
287
|
+
message: '保存中...',
|
|
288
|
+
duration: 0
|
|
289
|
+
})
|
|
290
|
+
let data = {}
|
|
291
|
+
pageConf.value.groups?.forEach((item : any) => {
|
|
292
|
+
if (item.type === 'fieldGroup') {
|
|
293
|
+
item.fields?.forEach((subItem : any) => {
|
|
294
|
+
data[subItem.id] = model.value[subItem.id]
|
|
295
|
+
})
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (item.type === 'relation') {
|
|
299
|
+
data[`${item.id}.$$flag$$`] = true
|
|
300
|
+
model.value[item.id]?.forEach((subItem : any, index : number) => {
|
|
301
|
+
data[`${item.id}[${index}].$$relation$$`] = item['relationNames'][0]
|
|
302
|
+
data[`${item.id}[${index}].唯一编码`] = subItem
|
|
303
|
+
})
|
|
304
|
+
}
|
|
305
|
+
})
|
|
306
|
+
data['唯一编码'] = model.value['唯一编码']
|
|
307
|
+
try {
|
|
308
|
+
const res = await addPageDataSave(sourceId.value, data)
|
|
309
|
+
if (res.data.status === 'success') {
|
|
310
|
+
toast.success("保存成功")
|
|
311
|
+
uni.navigateBack({
|
|
312
|
+
success: () => {
|
|
313
|
+
|
|
314
|
+
uni.$emit('editeDataSAC', { entityCode: res.data.entityCode, sourceId: res.data.sourceId })
|
|
315
|
+
}
|
|
316
|
+
})
|
|
317
|
+
} else {
|
|
318
|
+
toast.error(res.data.message || '保存失败"')
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
} catch (error) {
|
|
322
|
+
toast.error(error)
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
}
|
|
327
|
+
})
|
|
328
|
+
.catch((error) => {
|
|
329
|
+
console.log(error, 'error')
|
|
330
|
+
})
|
|
331
|
+
}
|
|
332
|
+
}else{
|
|
333
|
+
toast.loading({
|
|
334
|
+
message: '保存中...',
|
|
335
|
+
duration: 0
|
|
336
|
+
})
|
|
337
|
+
let data = {}
|
|
338
|
+
pageConf.value.groups?.forEach((item : any) => {
|
|
339
|
+
if (item.type === 'fieldGroup') {
|
|
340
|
+
item.fields?.forEach((subItem : any) => {
|
|
341
|
+
data[subItem.id] = model.value[subItem.id]
|
|
342
|
+
})
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
if (item.type === 'relation') {
|
|
346
|
+
data[`${item.id}.$$flag$$`] = true
|
|
347
|
+
model.value[item.id]?.forEach((subItem : any, index : number) => {
|
|
348
|
+
data[`${item.id}[${index}].$$relation$$`] = item['relationNames'][0]
|
|
349
|
+
data[`${item.id}[${index}].唯一编码`] = subItem
|
|
350
|
+
})
|
|
351
|
+
}
|
|
352
|
+
})
|
|
353
|
+
data['唯一编码'] = model.value['唯一编码']
|
|
354
|
+
try {
|
|
355
|
+
const res = await addPageDataSave(sourceId.value, data)
|
|
356
|
+
if (res.data.status === 'success') {
|
|
357
|
+
toast.success("保存成功")
|
|
358
|
+
uni.navigateBack({
|
|
359
|
+
success: () => {
|
|
360
|
+
|
|
361
|
+
uni.$emit('editeDataSAC', { entityCode: res.data.entityCode, sourceId: res.data.sourceId })
|
|
362
|
+
}
|
|
363
|
+
})
|
|
364
|
+
} else {
|
|
365
|
+
toast.error(res.data.message || '保存失败"')
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
} catch (error) {
|
|
369
|
+
toast.error(error)
|
|
370
|
+
}
|
|
332
371
|
}
|
|
372
|
+
|
|
333
373
|
}
|
|
334
374
|
|
|
335
375
|
//选择数据
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
:rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" @confirm="(e) => { change(e) }"
|
|
27
27
|
@clear="clear" />
|
|
28
28
|
|
|
29
|
-
<wd-cell v-else-if="subItem.extControlType === 'relselect'" title-width="100px" :prop="subItem.id"
|
|
29
|
+
<wd-cell v-else-if="subItem.extControlType === 'relselect'||subItem.extControlType === 'table-entity-select'" title-width="100px" :prop="subItem.id"
|
|
30
30
|
:rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" :title="subItem.title">
|
|
31
31
|
<view style="text-align: left">
|
|
32
32
|
<wSelectPicker @confirm="wSelectPickerconfirm" :modelValue="modelValue" :readonly="subItem.disabled"
|
|
@@ -89,7 +89,8 @@ const modelValue = computed(() => {
|
|
|
89
89
|
switch (props.subItem.extControlType) {
|
|
90
90
|
case 'datetime':
|
|
91
91
|
return props.model[props.subItem.id] ? dayjs(props.model[props.subItem.id]).valueOf() : null
|
|
92
|
-
|
|
92
|
+
|
|
93
|
+
case 'table-entity-select':
|
|
93
94
|
case 'relselect':
|
|
94
95
|
if (props.subItem.max === 1) {
|
|
95
96
|
return props.model[props.subItem.id] ? props.model[props.subItem.id].split('@R@')[0] : ''
|
package/w-login/w-login.vue
CHANGED
|
@@ -27,10 +27,14 @@
|
|
|
27
27
|
const model = reactive<{
|
|
28
28
|
username : string
|
|
29
29
|
password : string
|
|
30
|
+
remember:boolean
|
|
30
31
|
}>({
|
|
31
|
-
username: '',
|
|
32
|
-
password: '',
|
|
32
|
+
username:uni.getStorageSync("username") ||'',
|
|
33
|
+
password:uni.getStorageSync("password") ||'',
|
|
34
|
+
remember:uni.getStorageSync("remember")||false
|
|
33
35
|
})
|
|
36
|
+
|
|
37
|
+
|
|
34
38
|
|
|
35
39
|
const form = ref()
|
|
36
40
|
|
|
@@ -43,6 +47,7 @@
|
|
|
43
47
|
|
|
44
48
|
// 登录
|
|
45
49
|
function handleLogin() {
|
|
50
|
+
console.log(model)
|
|
46
51
|
showLoading('登录中...')
|
|
47
52
|
login(model.username, model.password, pKey.value).then(({ data } : any) => {
|
|
48
53
|
if (data.status === 'error') {
|
|
@@ -50,6 +55,18 @@
|
|
|
50
55
|
}
|
|
51
56
|
showSuccess('登录成功')
|
|
52
57
|
uni.setStorageSync('token', data.token)
|
|
58
|
+
// 记住密码
|
|
59
|
+
if(model.remember){
|
|
60
|
+
uni.setStorageSync('remember', model.remember)
|
|
61
|
+
uni.setStorageSync('password', model.password)
|
|
62
|
+
uni.setStorageSync('username', model.username)
|
|
63
|
+
}else{
|
|
64
|
+
// 忘记密码
|
|
65
|
+
uni.removeStorageSync('remember')
|
|
66
|
+
uni.removeStorageSync('password')
|
|
67
|
+
uni.removeStorageSync('username')
|
|
68
|
+
}
|
|
69
|
+
|
|
53
70
|
getUserConfig().then(({ data } : any) => {
|
|
54
71
|
uni.setStorageSync('userInfo', {
|
|
55
72
|
...data.user
|
|
@@ -95,6 +112,9 @@
|
|
|
95
112
|
placeholder="请输入用户名" :rules="[{ required: true, message: '请填写用户名' }]" />
|
|
96
113
|
<wd-input v-model="model.password" label="密码" label-width="100px" prop="password" show-password
|
|
97
114
|
clearable placeholder="请输入密码" :rules="[{ required: true, message: '请填写密码' }]" />
|
|
115
|
+
<view style="padding-left: 15px;">
|
|
116
|
+
<wd-checkbox v-model="model.remember" shape="square">记住密码</wd-checkbox>
|
|
117
|
+
</view>
|
|
98
118
|
</wd-cell-group>
|
|
99
119
|
<view class="footer">
|
|
100
120
|
<wd-button type="primary" block :round="false" @click="handleSubmit">
|
package/w-table/w-table.vue
CHANGED
|
@@ -102,7 +102,7 @@ async function queryList(pageNo: number, pageSize: number) {
|
|
|
102
102
|
// 点击添加按钮
|
|
103
103
|
function add() {
|
|
104
104
|
uni.navigateTo({
|
|
105
|
-
url: `/pages/add/add?sourceId=${sourceId.value}`,
|
|
105
|
+
url: `/pages/add/add?sourceId=${sourceId.value}&mainCode=${mainCode.value}`,
|
|
106
106
|
})
|
|
107
107
|
}
|
|
108
108
|
|