@idooel/components 0.0.2-beta.16 → 0.0.2-beta.18

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": "@idooel/components",
3
- "version": "0.0.2-beta.16",
3
+ "version": "0.0.2-beta.18",
4
4
  "description": "",
5
5
  "private": false,
6
6
  "main": "dist/@idooel/components.umd.js",
@@ -18,7 +18,7 @@
18
18
  您可以请点击上方按钮查看任务进度或关闭弹框
19
19
  </div>
20
20
  </div>
21
- <div v-if="!isFileEmpty && statusList.length > 0 && mode === 'sync'" class="ele-modal-import__errors">
21
+ <div v-if="!isFileEmpty && mode === 'sync'" class="ele-modal-import__errors">
22
22
  <template v-if="statusList.length > 0">
23
23
  <div v-for="(value, idx) in statusList" :key="idx">
24
24
  {{ value.message }}
@@ -126,8 +126,8 @@ export default {
126
126
  const ctx = { _route: this.$route.query, route: this.$route, ...payloads }
127
127
  return parseFieldMap(fieldMap, ctx)
128
128
  },
129
- buildErrorList (dataSrouce = []) {
130
- const ret = dataSrouce.map(item => {
129
+ buildErrorList (dataSource = []) {
130
+ const ret = dataSource.map(item => {
131
131
  if (type.isStr(item)) {
132
132
  return {
133
133
  statusCode: '0',
@@ -154,7 +154,7 @@ export default {
154
154
  net[requestType.toLowerCase()](url, formData , { headers: { 'Content-Type': 'multipart/form-data' } }).then(resp => {
155
155
  const { code, data } = resp
156
156
  if (code !== '2000') {
157
- this.innerErrorList = this.buildErrorList(data)
157
+ this.innerErrorList = this.buildErrorList(data || [])
158
158
  } else {
159
159
  this.innerErrorList = []
160
160
  }
@@ -388,6 +388,7 @@ export default {
388
388
  }
389
389
  },
390
390
  async created () {
391
+ // onSearch会初始化请求表格数据,所以不需要在这里请求表格数据
391
392
  // 确保全局数据池已初始化
392
393
  if (!window.__idooel_data_pool__) {
393
394
  console.error('Global data pool not initialized. Please check if runtime-context/globalDataPool.js is properly imported.')
@@ -430,21 +431,20 @@ export default {
430
431
  this.defaultExpandedKeys = [defaultTreeNode[this.mapFields.key]]
431
432
  this.defaultSelectedKeys = [defaultTreeNode[this.mapFields.key]]
432
433
  this.currentTreeNodeData = defaultTreeNode
433
- }
434
-
435
- const { params = {}, fieldMap = {}, overrideInit = false } = this.tableMeta
436
- const currentRowData = this.getCurrentRowData()
437
- const ctx = {
438
- ...this.currentTreeNodeData,
439
- _route: this.$route.query,
440
- currentRowData: currentRowData
441
- }
442
-
443
- const initQuerys = Object.assign({}, params, parseFieldMap(fieldMap, ctx))
444
- if (overrideInit) {
445
- this.$emit(RESERVE_EVENT_NAMES.INIT, { ...this.exposed })
446
- } else {
447
- this.tableData = await this.requestTableData(initQuerys)
434
+ const { params = {}, fieldMap = {}, overrideInit = false } = this.tableMeta
435
+ const currentRowData = this.getCurrentRowData()
436
+ const ctx = {
437
+ ...this.currentTreeNodeData,
438
+ _route: this.$route.query,
439
+ currentRowData: currentRowData
440
+ }
441
+
442
+ const initQuerys = Object.assign({}, params, parseFieldMap(fieldMap, ctx))
443
+ if (overrideInit) {
444
+ this.$emit(RESERVE_EVENT_NAMES.INIT, { ...this.exposed })
445
+ } else {
446
+ this.tableData = await this.requestTableData(initQuerys)
447
+ }
448
448
  }
449
449
  },
450
450
  methods: {
@@ -639,6 +639,7 @@ export default {
639
639
  if (overrideInit) {
640
640
  this.$emit(RESERVE_EVENT_NAMES.TREE_CHANGE, { ...this.exposed })
641
641
  } else {
642
+ if (this.showTree) return
642
643
  this.tableData = await this.requestTableData()
643
644
  }
644
645
  },
@@ -671,8 +672,7 @@ export default {
671
672
  },
672
673
  async requestTableData (props = {}) {
673
674
  const { url, requestType = 'GET', page = {} } = this.tableMeta
674
- const { pageSize = 10 } = page
675
- this.tableQuerys = Object.assign(this.tableQuerys, { currentPage: 1, pageSize }, props)
675
+ this.tableQuerys = Object.assign(this.tableQuerys, { currentPage: this.tableQuerys.currentPage || 1, pageSize: this.tableQuerys.pageSize || 10 }, props)
676
676
  this.$emit(RESERVE_EVENT_NAMES.WATCH, { ...this.exposed })
677
677
  this.loading = true
678
678
  const ret = await net[requestType.toLowerCase()](
@@ -706,6 +706,24 @@ export default {
706
706
  const modelTableContainerRef = this.$refs[this.modelTableContainerRef]
707
707
  const { height } = modelTableContainerRef.getBoundingClientRect()
708
708
  this.treeWrapperHeight = height
709
+ },
710
+ async keepAliveRefresh () {
711
+ // 重新计算表格高度(应对窗口大小变化)
712
+ this.$nextTick(() => {
713
+ this.calculateTableHeight()
714
+ if (this.showTree) {
715
+ this.calculateTreeHeight()
716
+ }
717
+ })
718
+ // 刷新列表数据
719
+ const { overrideInit = false } = this.tableMeta
720
+ if (overrideInit) {
721
+ // 如果使用自定义初始化模式,触发 INIT 事件
722
+ this.$emit(RESERVE_EVENT_NAMES.INIT, { ...this.exposed })
723
+ } else {
724
+ // 使用当前查询参数刷新表格数据
725
+ await this.requestTableData(this.tableQuerys)
726
+ }
709
727
  }
710
728
  },
711
729
  mounted () {
@@ -739,23 +757,7 @@ export default {
739
757
  }
740
758
  },
741
759
  async activated () {
742
- // 重新计算表格高度(应对窗口大小变化)
743
- this.$nextTick(() => {
744
- this.calculateTableHeight()
745
- if (this.showTree) {
746
- this.calculateTreeHeight()
747
- }
748
- })
749
-
750
- // 刷新列表数据
751
- const { overrideInit = false } = this.tableMeta
752
- if (overrideInit) {
753
- // 如果使用自定义初始化模式,触发 INIT 事件
754
- this.$emit(RESERVE_EVENT_NAMES.INIT, { ...this.exposed })
755
- } else {
756
- // 使用当前查询参数刷新表格数据
757
- await this.requestTableData()
758
- }
760
+ await this.keepAliveRefresh()
759
761
  }
760
762
  }
761
763
  </script>