w-ui-v1 1.0.62 → 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.62",
3
+ "version": "1.0.64",
4
4
  "description": "w-ui",
5
5
  "author": "wgxshh",
6
6
  "license": "ISC",
@@ -20,7 +20,7 @@ export function addPageConfig(sourceId: string) {
20
20
  }
21
21
 
22
22
  //新增页面提交保存
23
- export function addPageDataSave(sourceId: string,mainCode: 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',
package/utils/index.ts ADDED
@@ -0,0 +1,18 @@
1
+ import {
2
+ getEnum
3
+ } from './apis/pageConfig'
4
+ export const getEnumer=async(pageData:any)=>{
5
+ let params = []
6
+ pageData.columns.forEach((item: any) => {
7
+ if (item.controlType === 'select') {
8
+ params.push(`mstrucIds=${item.mstrucId}`)
9
+ }
10
+ if (item.controlType === 'multiselect') {
11
+ params.push(`mstrucIds=${item.mstrucId}`)
12
+ }
13
+
14
+ });
15
+ if (!params.length) return
16
+ const res = await getEnum(params.join("&"))
17
+ return res.data?.enumMap || {}
18
+ }
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
-
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
@@ -1,11 +1,4 @@
1
- <script lang="ts">
2
- //在自定义组件中使用 Wot Design Uni 组件时,需开启styleIsolation: 'shared'选项覆盖样式
3
- export default {
4
- options: {
5
- styleIsolation: 'shared'//使css :deep()生效
6
- }
7
- }
8
- </script>
1
+
9
2
  <script setup lang="ts">
10
3
  import WFormMessageBox from '../w-form-message-box/w-form-message-box.vue'
11
4
  import {
@@ -148,8 +141,9 @@ function goto(type: string, item: any = {}, subItem: any = {}) {
148
141
  case 'edit':
149
142
  if (props.actionType === 'relation') {
150
143
  emits('edit')
144
+
151
145
  }
152
- if(props.page.classEditConfigs.length>0){
146
+ if(props.page.classEditConfigs?.length>0){
153
147
  let con= props.page.classEditConfigs.find((item:any)=>{
154
148
  return item.preposes[0].defaultValue===props.itemData.fieldMap[item.preposes[0].id]
155
149
  })
@@ -242,7 +236,10 @@ const getTitleValue = (value: any, title: string) => {
242
236
  <wd-card >
243
237
  <template #title>
244
238
  <view class="card-title-class">
245
- {{getTitleValue(visibleItems.find((item) => item.id === page.primaryColumn?.id), page.primaryColumn?.title) || ' '}}
239
+ <view class="title-icon"></view>
240
+ <view style="flex: 1; word-break:break-all">
241
+ {{getTitleValue(visibleItems.find((item) => item.id === page.primaryColumn?.id), page.primaryColumn?.title) || ' '}}
242
+ </view>
246
243
  </view>
247
244
  </template>
248
245
 
@@ -251,7 +248,7 @@ const getTitleValue = (value: any, title: string) => {
251
248
 
252
249
  <!-- // 标题 -->
253
250
  <view class="lable">
254
- <text>{{ item.title }}:</text>
251
+ <text class="lable">{{ item.title }}:</text>
255
252
  </view>
256
253
 
257
254
  <!-- // 图片 -->
@@ -349,7 +346,7 @@ const getTitleValue = (value: any, title: string) => {
349
346
  padding: 8rpx 10rpx;
350
347
 
351
348
  .lable {
352
- white-space: nowrap;
349
+ white-space: nowrap !important;
353
350
  // font-weight: 600;
354
351
  text-align: left;
355
352
  margin-right: 20rpx;
@@ -397,8 +394,17 @@ const getTitleValue = (value: any, title: string) => {
397
394
 
398
395
 
399
396
  }
400
- :deep(.card-title-class){
401
- font-weight: 700 !important;
397
+ .card-title-class{
398
+ display: flex;
399
+ align-items: center;
400
+ font-weight: 700 ;
401
+ gap: 4px;
402
+ }
403
+ .title-icon{
404
+ width: 8px;
405
+ height: 8px;
406
+ border-radius: 100%;
407
+ background-color: #4d80f0;
402
408
  }
403
409
  .btn {
404
410
  margin-left: 10rpx;
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
  })
@@ -252,7 +252,7 @@
252
252
  })
253
253
  data['唯一编码'] = model.value['唯一编码']
254
254
  try {
255
- const res = await addPageDataSave(sourceId.value, data)
255
+ const res = await addPageDataSave(sourceId.value, null,data)
256
256
  if (res.data.status === 'success') {
257
257
  toast.success("保存成功")
258
258
  uni.navigateBack({
@@ -305,7 +305,7 @@
305
305
  })
306
306
  data['唯一编码'] = model.value['唯一编码']
307
307
  try {
308
- const res = await addPageDataSave(sourceId.value, data)
308
+ const res = await addPageDataSave(sourceId.value, null,data)
309
309
  if (res.data.status === 'success') {
310
310
  toast.success("保存成功")
311
311
  uni.navigateBack({
@@ -352,7 +352,7 @@
352
352
  })
353
353
  data['唯一编码'] = model.value['唯一编码']
354
354
  try {
355
- const res = await addPageDataSave(sourceId.value, data)
355
+ const res = await addPageDataSave(sourceId.value, null,data)
356
356
  if (res.data.status === 'success') {
357
357
  toast.success("保存成功")
358
358
  uni.navigateBack({
@@ -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]