vue2-client 1.6.59-single → 1.6.60-single

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/CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Change Log
2
2
  > 所有关于本项目的变化都在该文档里。
3
3
 
4
+ **1.6.60 -2023-08-08 @江超**
5
+ - XTable优化编辑数据的方法
6
+
4
7
  **1.6.59 -2023-08-08 @江超**
5
8
  - XTable增加按钮组左侧扩展操作slot
6
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.6.59-single",
3
+ "version": "1.6.60-single",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
@@ -284,9 +284,19 @@ export default {
284
284
  this.$emit('afterQuery', result, requestParameters.conditionParams)
285
285
  return result
286
286
  },
287
+ /**
288
+ * 操作列事件
289
+ * @param record 本条数据
290
+ * @param actionType 操作类型
291
+ */
287
292
  action (record, actionType) {
288
293
  this.$emit('action', record, record[this.getPrimaryKeyName()], actionType)
289
294
  },
295
+ /**
296
+ * 选择列事件
297
+ * @param selectedRowKeys 被选择的列Key集合
298
+ * @param selectedRows 被选择的列集合
299
+ */
290
300
  onSelectChange (selectedRowKeys, selectedRows) {
291
301
  this.selectedRowKeys = selectedRowKeys
292
302
  this.selectedRows = selectedRows
@@ -314,12 +324,14 @@ export default {
314
324
  refresh (bool) {
315
325
  this.$refs.table.refresh(bool)
316
326
  },
327
+ /**
328
+ * 格式化日期
329
+ * @param date 日期字符串
330
+ * @param format 格式化方式
331
+ */
317
332
  format (date, format) {
318
333
  return formatDate(date, format)
319
334
  },
320
- showDrawer () {
321
- this.visible = true
322
- },
323
335
  /**
324
336
  * 获取主键列名称
325
337
  */
@@ -336,8 +348,7 @@ export default {
336
348
  } else {
337
349
  exportData = this.$refs.table.localDataSource
338
350
  }
339
- const data = this.formatJson(filterVal, exportData)
340
- exportJson(tHeader, data, this.title + `数据_${new Date().toLocaleString()}`)
351
+ exportJson(tHeader, exportData.map(v => filterVal.map(j => v[j])), this.title + `数据_${new Date().toLocaleString()}`)
341
352
  },
342
353
  // 导出符合条件的数据
343
354
  handleExportByQuery () {
@@ -365,7 +376,13 @@ export default {
365
376
  // 编辑业务
366
377
  edit (id) {
367
378
  this.editLoading = true
368
- // 组织被编辑数据
379
+ this.getEditData(id).then(modifyModelData => {
380
+ this.$emit('edit', modifyModelData)
381
+ this.editLoading = false
382
+ })
383
+ },
384
+ // 获取被编辑的数据
385
+ getEditData (id) {
369
386
  const requestParameters = {
370
387
  queryParamsName: this.queryParamsName,
371
388
  queryParams: this.queryParams,
@@ -385,13 +402,11 @@ export default {
385
402
  this.$emit('tempTableEdit', requestParameters)
386
403
  return
387
404
  }
388
- queryWithResource(requestParameters, this.serviceName).then(res => {
405
+ return queryWithResource(requestParameters, this.serviceName).then(res => {
389
406
  // 将更新需要的主键值加入到primaryKeyData中
390
407
  const primaryKeyData = {}
391
408
  primaryKeyData[primaryKeyName] = this.selectId
392
- const modifyModelData = { data: res.data[0], primaryKeyData: primaryKeyData, images: res.images, files: res.files }
393
- this.$emit('edit', modifyModelData)
394
- this.editLoading = false
409
+ return { data: res.data[0], primaryKeyData: primaryKeyData, images: res.images, files: res.files }
395
410
  })
396
411
  },
397
412
  // 删除业务
@@ -429,9 +444,6 @@ export default {
429
444
  importData () {
430
445
  this.$refs.importExcel.importExcelHandleOpen()
431
446
  },
432
- formatJson (filterVal, jsonData) {
433
- return jsonData.map(v => filterVal.map(j => v[j]))
434
- },
435
447
  // 初始化临时表
436
448
  async initTempTable (json) {
437
449
  await this.createTempTable(this.queryParamsJson)