w-ui-v1 1.0.63 → 1.0.64

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "w-ui-v1",
3
- "version": "1.0.63",
3
+ "version": "1.0.64",
4
4
  "description": "w-ui",
5
5
  "author": "wgxshh",
6
6
  "license": "ISC",
package/w-add/w-add.vue CHANGED
@@ -192,55 +192,204 @@ async function getEnumer() {
192
192
  //保存
193
193
  async function handleSubmit() {
194
194
 
195
- form.value[0]
196
- .validate()
197
- .then(async ({ valid, errors }) => {
198
- if (valid) {
199
- toast.loading({
200
- message: '保存中...',
201
- duration: 0
195
+ // form.value[0]
196
+ // .validate()
197
+ // .then(async ({ valid, errors }) => {
198
+ // if (valid) {
199
+ // toast.loading({
200
+ // message: '保存中...',
201
+ // duration: 0
202
+ // })
203
+ // let data = {}
204
+ // pageConf.value.groups?.forEach((item: any) => {
205
+ // if (item.type === 'fieldGroup') {
206
+ // item.fields?.forEach((subItem: any) => {
207
+ // data[subItem.id] = model.value[subItem.id]
208
+ // })
209
+ // }
210
+
211
+ // if (item.type === 'relation') {
212
+ // data[`${item.id}.$$flag$$`] = true
213
+ // model.value[item.id]?.forEach((subItem: any, index: number) => {
214
+ // data[`${item.id}[${index}].$$relation$$`] = item['relationNames'][0]
215
+ // data[`${item.id}[${index}].唯一编码`] = subItem
216
+ // })
217
+ // }
218
+ // })
219
+ // console.log(data,'jjj')
220
+ // try {
221
+ // const res = await addPageDataSave(sourceId.value,mainCode.value, data)
222
+ // if (res.data.status === 'success') {
223
+ // toast.success("保存成功")
224
+ // uni.navigateBack({
225
+ // success: () => {
226
+ // uni.$emit('addDataSAC', { entityCode: res.data.entityCode, sourceId: res.data.sourceId })
227
+ // }
228
+ // })
229
+ // } else {
230
+ // toast.error(res.data.message || '保存失败"')
231
+ // }
232
+
233
+ // } catch (error) {
234
+ // toast.error(error)
235
+ // }
236
+
237
+
238
+ // }
239
+ // })
240
+ // .catch((error) => {
241
+ // console.log(error, 'error')
242
+ // })
243
+ if(form.value){
244
+ if (Array.isArray(form.value)) {
245
+ let promiseArr = form.value.map((item : any) => {
246
+ return item.validate()
202
247
  })
203
- let data = {}
204
- pageConf.value.groups?.forEach((item: any) => {
205
- if (item.type === 'fieldGroup') {
206
- item.fields?.forEach((subItem: any) => {
207
- data[subItem.id] = model.value[subItem.id]
248
+
249
+ Promise.all(promiseArr).then(async (valid) => {
250
+ let isTrue = valid.filter((item : any) => {
251
+ return !item.valid
252
+ })
253
+ if (isTrue.length === 0) {
254
+ toast.loading({
255
+ message: '保存中...',
256
+ duration: 0
208
257
  })
209
- }
210
-
211
- if (item.type === 'relation') {
212
- data[`${item.id}.$$flag$$`] = true
213
- model.value[item.id]?.forEach((subItem: any, index: number) => {
214
- data[`${item.id}[${index}].$$relation$$`] = item['relationNames'][0]
215
- data[`${item.id}[${index}].唯一编码`] = subItem
258
+ let data = {}
259
+ pageConf.value.groups?.forEach((item : any) => {
260
+ if (item.type === 'fieldGroup') {
261
+ item.fields?.forEach((subItem : any) => {
262
+ data[subItem.id] = model.value[subItem.id]
263
+ })
264
+ }
265
+
266
+ if (item.type === 'relation') {
267
+ data[`${item.id}.$$flag$$`] = true
268
+ model.value[item.id]?.forEach((subItem : any, index : number) => {
269
+ data[`${item.id}[${index}].$$relation$$`] = item['relationNames'][0]
270
+ data[`${item.id}[${index}].唯一编码`] = subItem
271
+ })
272
+ }
216
273
  })
274
+
275
+ try {
276
+ const res = await addPageDataSave(sourceId.value, null,data)
277
+ if (res.data.status === 'success') {
278
+ toast.success("保存成功")
279
+ uni.navigateBack({
280
+ success: () => {
281
+
282
+ uni.$emit('addDataSAC', { entityCode: res.data.entityCode, sourceId: res.data.sourceId })
283
+ }
284
+ })
285
+ } else {
286
+ toast.error(res.data.message || '保存失败"')
287
+ }
288
+
289
+ } catch (error) {
290
+ toast.error(error)
291
+ }
292
+
293
+
217
294
  }
218
295
  })
219
- console.log(data,'jjj')
220
- try {
221
- const res = await addPageDataSave(sourceId.value,mainCode.value, data)
222
- if (res.data.status === 'success') {
223
- toast.success("保存成功")
224
- uni.navigateBack({
225
- success: () => {
226
- uni.$emit('addDataSAC', { entityCode: res.data.entityCode, sourceId: res.data.sourceId })
296
+ .catch((error) => {
297
+ console.log(error, 'error')
298
+ })
299
+
300
+
301
+
302
+ } else {
303
+ form.value
304
+ .validate()
305
+ .then(async ({ valid, errors }) => {
306
+ if (valid) {
307
+ toast.loading({
308
+ message: '保存中...',
309
+ duration: 0
310
+ })
311
+ let data = {}
312
+ pageConf.value.groups?.forEach((item : any) => {
313
+ if (item.type === 'fieldGroup') {
314
+ item.fields?.forEach((subItem : any) => {
315
+ data[subItem.id] = model.value[subItem.id]
316
+ })
317
+ }
318
+
319
+ if (item.type === 'relation') {
320
+ data[`${item.id}.$$flag$$`] = true
321
+ model.value[item.id]?.forEach((subItem : any, index : number) => {
322
+ data[`${item.id}[${index}].$$relation$$`] = item['relationNames'][0]
323
+ data[`${item.id}[${index}].唯一编码`] = subItem
324
+ })
325
+ }
326
+ })
327
+
328
+ try {
329
+ const res = await addPageDataSave(sourceId.value, null,data)
330
+ if (res.data.status === 'success') {
331
+ toast.success("保存成功")
332
+ uni.navigateBack({
333
+ success: () => {
334
+
335
+ uni.$emit('addDataSAC', { entityCode: res.data.entityCode, sourceId: res.data.sourceId })
336
+ }
337
+ })
338
+ } else {
339
+ toast.error(res.data.message || '保存失败"')
340
+ }
341
+
342
+ } catch (error) {
343
+ toast.error(error)
227
344
  }
228
- })
229
- } else {
230
- toast.error(res.data.message || '保存失败"')
231
- }
232
-
233
- } catch (error) {
234
- toast.error(error)
345
+
346
+
347
+ }
348
+ })
349
+ .catch((error) => {
350
+ console.log(error, 'error')
351
+ })
352
+ }
353
+ }else{
354
+ toast.loading({
355
+ message: '保存中...',
356
+ duration: 0
357
+ })
358
+ let data = {}
359
+ pageConf.value.groups?.forEach((item : any) => {
360
+ if (item.type === 'fieldGroup') {
361
+ item.fields?.forEach((subItem : any) => {
362
+ data[subItem.id] = model.value[subItem.id]
363
+ })
235
364
  }
236
-
237
-
365
+
366
+ if (item.type === 'relation') {
367
+ data[`${item.id}.$$flag$$`] = true
368
+ model.value[item.id]?.forEach((subItem : any, index : number) => {
369
+ data[`${item.id}[${index}].$$relation$$`] = item['relationNames'][0]
370
+ data[`${item.id}[${index}].唯一编码`] = subItem
371
+ })
372
+ }
373
+ })
374
+
375
+ try {
376
+ const res = await addPageDataSave(sourceId.value, null,data)
377
+ if (res.data.status === 'success') {
378
+ toast.success("保存成功")
379
+ uni.navigateBack({
380
+ success: () => {
381
+
382
+ uni.$emit('addDataSAC', { entityCode: res.data.entityCode, sourceId: res.data.sourceId })
383
+ }
384
+ })
385
+ } else {
386
+ toast.error(res.data.message || '保存失败"')
387
+ }
388
+
389
+ } catch (error) {
390
+ toast.error(error)
238
391
  }
239
- })
240
- .catch((error) => {
241
- console.log(error, 'error')
242
- })
243
-
392
+ }
244
393
  }
245
394
 
246
395
  //跳转勾选页面数据
package/w-card/w-card.vue CHANGED
@@ -141,8 +141,9 @@ function goto(type: string, item: any = {}, subItem: any = {}) {
141
141
  case 'edit':
142
142
  if (props.actionType === 'relation') {
143
143
  emits('edit')
144
+
144
145
  }
145
- if(props.page.classEditConfigs.length>0){
146
+ if(props.page.classEditConfigs?.length>0){
146
147
  let con= props.page.classEditConfigs.find((item:any)=>{
147
148
  return item.preposes[0].defaultValue===props.itemData.fieldMap[item.preposes[0].id]
148
149
  })
package/w-edit/w-edit.vue CHANGED
@@ -220,7 +220,7 @@
220
220
  //保存
221
221
  async function handleSubmit() {
222
222
  if(form.value){
223
- if (isArray(form.value)) {
223
+ if (Array.isArray(form.value)) {
224
224
  let promiseArr = form.value.map((item : any) => {
225
225
  return item.validate()
226
226
  })
@@ -417,6 +417,7 @@
417
417
 
418
418
  //监听添加数据完成事件
419
419
  uni.$on('addDataSAC', function (data : any) {
420
+ console.log(data,'kk')
420
421
  checkboxvalue.value = selectData.value[item.id] ? [...selectData.value[item.id].map((item : any) => {
421
422
  return item.code
422
423
  }), data.entityCode] : [data.entityCode]
@@ -18,6 +18,11 @@
18
18
  :placeholder="subItem.disabled ? '无需输入' : `请选择${subItem.title}`"
19
19
  :rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" :columns="['是','否']"
20
20
  @confirm="(e) => { change(e) }" @clear="clear" />
21
+ <wd-picker v-else-if="subItem.extControlType === 'yes-no-switch'" :readonly="subItem.disabled" :label="subItem.title"
22
+ label-width="100px" :prop="subItem.id" clearable :modelValue="modelValue"
23
+ :placeholder="subItem.disabled ? '无需输入' : `请选择${subItem.title}`"
24
+ :rules="[{ required: subItem.required, message: `请选择${subItem.title}` }]" :columns="['是','否']"
25
+ @confirm="(e) => { change(e) }" @clear="clear" />
21
26
 
22
27
  <wd-select-picker v-else-if="subItem.controlType === 'select'&&subItem.extControlType === 'multiselect'" :readonly="subItem.disabled" :label="subItem.title"
23
28
  label-width="100px" :prop="subItem.id" clearable :modelValue="modelValue"
@@ -212,7 +217,7 @@ const modelValue = computed(() => {
212
217
  }
213
218
 
214
219
  if(props.subItem.extControlType === 'datetime'){
215
- return props.model[props.subItem.id]?dayjs(props.model[props.subItem.id]).valueOf():''
220
+ return props.model[props.subItem.id]?dayjs(props.model[props.subItem.id]).valueOf():null
216
221
  }
217
222
 
218
223