imatrix-ui 2.9.14-dw → 2.9.15-dw

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": "imatrix-ui",
3
- "version": "2.9.14-dw",
3
+ "version": "2.9.15-dw",
4
4
  "description": "前端组件库:表格、表单、组织结构树等",
5
5
  "main": "lib/super-ui.umd.min.js",
6
6
  "private": false,
@@ -7,11 +7,9 @@
7
7
  <el-autocomplete
8
8
  v-model="filterText"
9
9
  size="small"
10
- select-when-unmatched
11
10
  class="inline-input inline-input-custom"
12
11
  :fetch-suggestions="querySearch"
13
12
  :placeholder="$t('departmentTreeInline.pleaseEnterDepartmentName')"
14
- :trigger-on-focus="false"
15
13
  @keyup.enter.native="clickSearch"
16
14
  @select="handleSelect"
17
15
  >
@@ -74,6 +72,7 @@ import localStorage from '../../../src/utils/local-storage'
74
72
  import utils from '../../utils/utils'
75
73
  import departmentTreeService from './department-tree-service'
76
74
  import UserResult from './search-result.vue'
75
+ import memoryCacheUtils from '../../utils/memory-cache-utils'
77
76
  export default {
78
77
  name: 'InlineDepartmentMultiTree',
79
78
  components: {
@@ -137,7 +136,10 @@ export default {
137
136
  tenantInfo: {}, // 公司根节点信息
138
137
  searchResult: [],
139
138
  selectResult: [],
140
- isloading: false // 控制右侧选择区的loading状态
139
+ isloading: false, // 控制右侧选择区的loading状态
140
+ multiple: true,
141
+ memoryCacheKey: 'DEPARTMENT_MEMORY_KEY',
142
+ memoryCacheData: [] // 记忆选择数据, 搜索框获得焦点后,下拉显示最近选中的10个人,倒序排列,最后选中的在最上面显示。
141
143
  }
142
144
  },
143
145
  computed: {
@@ -171,10 +173,12 @@ export default {
171
173
  } else {
172
174
  this.restaurants = []
173
175
  }
176
+ this.getMemoryCacheData('department')
174
177
  },
175
178
  methods: {
176
179
  ...utils,
177
180
  ...departmentTreeService,
181
+ ...memoryCacheUtils,
178
182
  filterNode(value, data, node) {
179
183
  if (!value) {
180
184
  return true
@@ -290,7 +294,7 @@ export default {
290
294
  // 不存在该用户则放到结果集合中,去掉重复使用
291
295
  leafSelectNodeInfo.ids.push(userData.id)
292
296
  leafSelectNodeInfo.codes.push(userData.code)
293
- if(userData.enName) {
297
+ if (userData.enName) {
294
298
  leafSelectNodeInfo.enNames.push(userData.enName)
295
299
  } else {
296
300
  leafSelectNodeInfo.enNames.push('')
@@ -300,7 +304,7 @@ export default {
300
304
  } else {
301
305
  leafSelectNodeInfo.departments.push(userData)
302
306
  }
303
- let name = userData.showName
307
+ const name = userData.showName
304
308
  leafSelectNodeInfo.names.push(name)
305
309
  leafSelectNodeInfo.zhNames.push(userData.name)
306
310
  }
@@ -351,6 +355,8 @@ export default {
351
355
  dept.tenantCode = this.tenantInfo.code
352
356
  dept.tenantName = this.tenantInfo.tenantName
353
357
  this.selectResult.push(dept)
358
+ // 搜索选中记忆
359
+ this.setMemoryCacheData(dept, 'department')
354
360
  }
355
361
  // } else {
356
362
  // this.alertByAllUser()
@@ -5,11 +5,9 @@
5
5
  <el-autocomplete
6
6
  v-model="filterText"
7
7
  size="small"
8
- select-when-unmatched
9
8
  class="inline-input inline-input-custom"
10
9
  :fetch-suggestions="querySearch"
11
10
  :placeholder="$t('departmentTreeInline.pleaseEnterDepartmentName')"
12
- :trigger-on-focus="false"
13
11
  @keyup.enter.native="clickSearch"
14
12
  @select="handleSelect"
15
13
  >
@@ -53,6 +51,7 @@
53
51
  import localStorage from '../../../src/utils/local-storage'
54
52
  import utils from '../../utils/utils'
55
53
  import departmentTreeService from './department-tree-service'
54
+ import memoryCacheUtils from '../../utils/memory-cache-utils'
56
55
  import UserResult from './search-result.vue'
57
56
  export default {
58
57
  name: 'InlineDepartmentSingleTree',
@@ -111,7 +110,9 @@ export default {
111
110
  searchStoreKey: 'searchDepartment',
112
111
  selectNodeInfo: null, // 单选时,选择的部门信息
113
112
  tenantInfo: {}, // 公司根节点信息
114
- searchResult: []
113
+ searchResult: [],
114
+ memoryCacheKey: 'DEPARTMENT_MEMORY_KEY',
115
+ memoryCacheData: [] // 记忆选择数据, 搜索框获得焦点后,下拉显示最近选中的10个人,倒序排列,最后选中的在最上面显示。
115
116
  }
116
117
  },
117
118
  computed: {
@@ -138,10 +139,12 @@ export default {
138
139
  } else {
139
140
  this.restaurants = []
140
141
  }
142
+ this.getMemoryCacheData('department')
141
143
  },
142
144
  methods: {
143
145
  ...utils,
144
146
  ...departmentTreeService,
147
+ ...memoryCacheUtils,
145
148
  filterNode(value, data, node) {
146
149
  if (!value) {
147
150
  return true
@@ -193,6 +196,7 @@ export default {
193
196
  // 点击的是部门节点,并且是单选树时,点击部门节点直接关闭弹框
194
197
  const department = JSON.parse(data.data)
195
198
  this.packageSelectResult(department)
199
+ this.setMemoryCacheData(department, 'department')
196
200
  // if (this.selectNodeInfo && isClickOkBtn === true) {
197
201
  // // 点击确定按钮时才需要调result回调事件,关闭弹框
198
202
  // this.$emit('result', this.selectNodeInfo)
@@ -273,6 +277,8 @@ export default {
273
277
  // this.selectUser = selectUser
274
278
  // true参数表示是否是勾选单选框,是勾选单选框时不关闭弹框
275
279
  this.packageSelectResult(selectUser)
280
+ // 搜索选中记忆
281
+ this.setMemoryCacheData(selectUser, 'department')
276
282
  },
277
283
  resultRowDblclick(user) {
278
284
  this.packageSelectResult(user)
@@ -45,11 +45,38 @@ const departmentTreeService = {
45
45
  this.filterAppendNodes(value)
46
46
  },
47
47
  handleSelect(item) {
48
- this.handleSelectUtil(item, localStorage)
48
+ // this.handleSelectUtil(item, localStorage)
49
+ // 查询最新部门信息替换,缓存为历史数据 数据库可能发生变化
50
+ this.$http.get(Vue.prototype.baseAPI + '/api/departments?departmentCode=' + item.code).then(departmentDTO => {
51
+ if (departmentDTO !== null) {
52
+ for (const dtoKey in departmentDTO) {
53
+ if (item.hasOwnProperty(dtoKey)) {
54
+ item[dtoKey] = departmentDTO[dtoKey]
55
+ }
56
+ }
57
+ }
58
+ this.filterText = ''
59
+ this.searchValue = ''
60
+ this.setMemoryCacheData(item, 'department')
61
+ if (this.multiple) {
62
+ const index = this.selectResult.findIndex(selectEntity => selectEntity.code === item.code)
63
+ if (index < 0) {
64
+ this.selectResult.push(item)
65
+ }
66
+ } else {
67
+ this.packageSelectResult(item)
68
+ // 关闭弹窗
69
+ this.$emit('result', this.selectNodeInfo)
70
+ }
71
+ })
49
72
  },
50
73
  querySearch(queryString, cb) {
51
- this.search(this.filterText)
52
- cb([])
74
+ if (!this.filterText && this.filterText.length === 0) {
75
+ this.memorySearch(queryString, cb)
76
+ } else {
77
+ this.search(this.filterText)
78
+ cb([])
79
+ }
53
80
  },
54
81
  // 点击查询按钮调用的方法
55
82
  clickSearch() {
@@ -86,6 +113,7 @@ const departmentTreeService = {
86
113
  // 表示当前选中的节点是部门
87
114
  const department = JSON.parse(data.data)
88
115
  this.selectUser(null, department)
116
+ this.isloading = false
89
117
  }
90
118
  if (data.childDepartments) {
91
119
  // 如果已展开,不需要再走后台获得其子节点。只需要选中已有子节点
@@ -99,7 +127,7 @@ const departmentTreeService = {
99
127
  if (!data.leaf) {
100
128
  // 不是叶子节点,并且没有加载过该父节点的子节点时,需要走后台展开子节点
101
129
  this.$http.get(Vue.prototype.baseAPI + '/component/organization-trees/departments/' + data.id).then(result => {
102
- // 更新当前点击的节点的子节点
130
+ // 更新当前点击的节点的子节点
103
131
  this.$refs.deparmentTree.updateKeyChildren(data.id, result)
104
132
  // 展开当前选中的节点
105
133
  this.$refs.deparmentTree.store.nodesMap[data.id].expanded = true
@@ -8,10 +8,8 @@
8
8
  v-model="filterText"
9
9
  :fetch-suggestions="querySearch"
10
10
  :placeholder="$t('departmentUserTree.pleaseEnterUserInformation')"
11
- :trigger-on-focus="false"
12
11
  size="small"
13
- select-when-unmatched
14
- class="inline-input inline-input-custom"
12
+ class="inline-input inline-input-custom searchDepartmentUser"
15
13
  @keyup.enter.native="clickSearch"
16
14
  @select="handleSelect"
17
15
  >
@@ -35,7 +33,7 @@
35
33
  <!-- @node-click="handleNodeClick" 移除节点点击,不然会造成节点不可选择时,点击也会选择节点 -->
36
34
  </div>
37
35
 
38
- <div v-if="searchValue && searchValue.length > 0" style="height:100%;overflow: hidden;">
36
+ <div v-if="searchValue && searchValue.length > 0 || selectResult.length > 0" style="height:100%;overflow: hidden;">
39
37
  <user-result :grid-data="searchResult" :select-result="selectResult" :height="height" :contain-branch="containBranch" :multiple="true" :is-search-result="true" @addUser="selectUser" />
40
38
  </div>
41
39
  </el-main>
@@ -68,12 +66,16 @@
68
66
  .inline-input-custom {
69
67
  width : 98%
70
68
  }
69
+ .searchDepartmentUser {
70
+ width: 250px
71
+ }
71
72
  </style>
72
73
  <script>
73
74
  import localStorage from '../../../src/utils/local-storage'
74
75
  import UserResult from './search-result'
75
76
  import utils from '../../utils/utils'
76
77
  import departmentUserTreeMultiService from './department-user-tree-multi-service'
78
+ import memoryCacheUtils from '../../utils/memory-cache-utils'
77
79
 
78
80
  export default {
79
81
  name: 'InlineDepartmentUserMultiTree',
@@ -138,7 +140,9 @@ export default {
138
140
  searchResult: [], // 用户的查询结果
139
141
  selectResult: [], // 已选用户结果
140
142
  searchStoreKey: 'searchDepartmentUser',
141
- tenantInfo: {} // 公司根节点信息
143
+ tenantInfo: {}, // 公司根节点信息
144
+ memoryCacheKey: 'DEPARTMENT_USER_MEMORY_KEY',
145
+ memoryCacheData: [] // 记忆选择数据, 搜索框获得焦点后,下拉显示最近选中的10个人,倒序排列,最后选中的在最上面显示。
142
146
  }
143
147
  },
144
148
  computed: {
@@ -172,10 +176,12 @@ export default {
172
176
  } else {
173
177
  this.restaurants = []
174
178
  }
179
+ this.getMemoryCacheData('departmentUser')
175
180
  },
176
181
  methods: {
177
182
  ...utils,
178
183
  ...departmentUserTreeMultiService,
184
+ ...memoryCacheUtils,
179
185
  // 将查询结果中指定用户添加到已选择用户集合中
180
186
  selectUser(index, user) {
181
187
  if (!this.isContainAllUser()) {
@@ -186,6 +192,8 @@ export default {
186
192
  user.tenantCode = this.tenantInfo.code
187
193
  user.tenantName = this.tenantInfo.tenantName
188
194
  this.selectResult.push(user)
195
+ // 搜索选中记忆
196
+ this.setMemoryCacheData(user, 'departmentUser')
189
197
  }
190
198
  } else {
191
199
  this.alertByAllUser()
@@ -228,9 +236,9 @@ export default {
228
236
  return (userId === queryUser.id + '')
229
237
  }
230
238
  },
231
- handleSelect(item) {
232
- this.handleSelectUtil(item, localStorage)
233
- },
239
+ // handleSelect(item) {
240
+ // this.handleSelectUtil(item, localStorage)
241
+ // },
234
242
  search(value) {
235
243
  this.searchValue = value
236
244
  let mySearchValue = value
@@ -258,6 +266,8 @@ export default {
258
266
  const selectUser = this.packageSelectUser(user)
259
267
  if (selectUser) {
260
268
  this.selectResult.push(selectUser)
269
+ // 搜索选中记忆
270
+ this.setMemoryCacheData(user, 'departmentUser')
261
271
  }
262
272
  }
263
273
  }
@@ -6,21 +6,11 @@
6
6
  v-model="filterText"
7
7
  :fetch-suggestions="querySearch"
8
8
  :placeholder="$t('departmentUserTree.pleaseEnterUserInformation')"
9
- :trigger-on-focus="false"
10
9
  size="small"
11
- select-when-unmatched
12
- class="inline-input"
10
+ class="inline-input searchDepartmentUser"
13
11
  @keyup.enter.native="clickSearch"
14
12
  @select="handleSelect"
15
13
  >
16
- <!-- <el-select slot="prepend" v-model="searchField" class="inline-select-custom">
17
- <el-option
18
- v-for="item in searchFields"
19
- :key="item.value"
20
- :label="item.label"
21
- :value="item.value"
22
- />
23
- </el-select> -->
24
14
  <el-button slot="append" icon="el-icon-search" @click="clickSearch" />
25
15
  </el-autocomplete>
26
16
  </el-header>
@@ -53,12 +43,16 @@
53
43
  .inline-input-custom {
54
44
  width : 98%
55
45
  }
46
+ .searchDepartmentUser {
47
+ width: 250px
48
+ }
56
49
  </style>
57
50
  <script>
58
51
  import localStorage from '../../../src/utils/local-storage'
59
52
  import UserResult from './search-result'
60
53
  import utils from '../../utils/utils'
61
54
  import departmentUserTreeSingleService from './department-user-tree-single-service'
55
+ import memoryCacheUtils from '../../utils/memory-cache-utils'
62
56
  export default {
63
57
  name: 'InlineDepartmentUserSingleTree',
64
58
  components: {
@@ -109,7 +103,9 @@ export default {
109
103
  selectUser: null, // 选择的用户原信息
110
104
  selectNodeInfo: null, // 封装后的用户信息,即用户结果
111
105
  notMultipleClickNum: null, // 节点没有双击事件,手动实现双击事件,参数用来记录次数
112
- notMultipleClickNode: null // 节点没有双击事件,手动实现双击事件,参数用来记录节点
106
+ notMultipleClickNode: null, // 节点没有双击事件,手动实现双击事件,参数用来记录节点
107
+ memoryCacheKey: 'DEPARTMENT_USER_MEMORY_KEY',
108
+ memoryCacheData: [] // 记忆选择数据, 搜索框获得焦点后,下拉显示最近选中的10个人,倒序排列,最后选中的在最上面显示。
113
109
  }
114
110
  },
115
111
  computed: {
@@ -139,10 +135,12 @@ export default {
139
135
  } else {
140
136
  this.restaurants = []
141
137
  }
138
+ this.getMemoryCacheData('departmentUser')
142
139
  },
143
140
  methods: {
144
141
  ...utils,
145
142
  ...departmentUserTreeSingleService,
143
+ ...memoryCacheUtils,
146
144
  // selectUser(row, column, event) {
147
145
  // this.packageSelectResult(row)
148
146
  // },
@@ -151,6 +149,8 @@ export default {
151
149
  const user = JSON.parse(data.data)
152
150
  user.tenantName = this.tenantInfo.tenantName
153
151
  user.tenantCode = this.tenantInfo.code
152
+ // 搜索选中记忆
153
+ this.setMemoryCacheData(user, 'departmentUser')
154
154
  // 点击的是用户节点,并且是单选树时,点击部门节点直接关闭弹框
155
155
  this.packageSelectResult(user)
156
156
  if (this.notMultipleClickNode && this.notMultipleClickNode.id === node.id) {
@@ -257,6 +257,8 @@ export default {
257
257
  getSelectUser(selectUser) {
258
258
  // console.log('getSelectUser==', selectUser)
259
259
  this.selectUser = selectUser
260
+ // 搜索选中记忆
261
+ this.setMemoryCacheData(selectUser, 'departmentUser')
260
262
  // true参数表示是否是勾选单选框,是勾选单选框时不关闭弹框
261
263
  this.packageSelectResult(selectUser)
262
264
  },
@@ -1,6 +1,6 @@
1
1
  import Vue from 'vue'
2
- import { getI18n } from '../../../src/utils/util'
3
2
  import localStorage from '../../../src/utils/local-storage'
3
+ import { getI18n } from '../../../src/utils/util'
4
4
  const departmentUserTreeMultiService = {
5
5
  // 后台查询部门,并拼接树节点
6
6
  filterAppendNodes(value) {
@@ -29,11 +29,29 @@ const departmentUserTreeMultiService = {
29
29
  })
30
30
  },
31
31
  querySearch(queryString, cb) {
32
- this.search(this.filterText)
33
- cb([])
32
+ if (!this.filterText && this.filterText.length === 0) {
33
+ this.memorySearch(queryString, cb)
34
+ } else {
35
+ this.search(this.filterText)
36
+ cb([])
37
+ }
34
38
  },
35
39
  handleSelect(item) {
36
- this.handleSelectUtil(item, localStorage)
40
+ // this.handleSelectUtil(item, localStorage)
41
+ // 查询最新用户信息替换,缓存为历史数据 数据库可能发生变化
42
+ this.$http.get(Vue.prototype.baseAPI + '/api/users?loginName=' + item.loginName).then(userDTO => {
43
+ if (userDTO !== null) {
44
+ for (const dtoKey in userDTO) {
45
+ if (item.hasOwnProperty(dtoKey)) {
46
+ item[dtoKey] = userDTO[dtoKey]
47
+ }
48
+ }
49
+ }
50
+ this.filterText = ''
51
+ this.searchValue = ''
52
+ this.selectUser(-1, item)
53
+ this.setMemoryCacheData(item, 'departmentUser')
54
+ })
37
55
  },
38
56
  search(value) {
39
57
  this.searchValue = value
@@ -83,7 +101,7 @@ const departmentUserTreeMultiService = {
83
101
  this.checkedChildrenUserNodes(node.data, node.data.children)
84
102
  }
85
103
  } else {
86
- // 表示没有加载过该父节点的子节点集合时
104
+ // 表示没有加载过该父节点的子节点集合时
87
105
  const param = {
88
106
  parentId: parentId,
89
107
  needVirtualUser: this.isNeedVirtualUser
@@ -96,15 +114,15 @@ const departmentUserTreeMultiService = {
96
114
  // 更新当前点击的节点的子节点,必须加该方法,否则会导致子节点无法选中
97
115
  this.$refs.deparmentUserTree.updateKeyChildren(parentNodeId, data)
98
116
  if (parentId === 0) {
99
- // 初始化树时,展开公司节点
117
+ // 初始化树时,展开公司节点
100
118
  const tenantData = data[0].data
101
119
  this.tenantInfo = JSON.parse(tenantData)
102
120
  this.containBranch = data[0].containBranch
103
121
  if (this.departmentInfo && this.departmentInfo.length > 0) {
104
- // 加载指定部门时,展开公司节点
122
+ // 加载指定部门时,展开公司节点
105
123
  this.loadPointDepartments()
106
124
  } else {
107
- // 加载整个组织结构树时,展开公司节点
125
+ // 加载整个组织结构树时,展开公司节点
108
126
  this.loadDepartment(this.tenantNodeId, this.tenantNodeId + '')
109
127
  }
110
128
  }
@@ -1,6 +1,6 @@
1
1
  import Vue from 'vue'
2
- import { getI18n } from '../../../src/utils/util'
3
2
  import localStorage from '../../../src/utils/local-storage'
3
+ import { getI18n } from '../../../src/utils/util'
4
4
  const departmentUserTreeSingleService = {
5
5
  // 后台查询部门,并拼接树节点
6
6
  filterAppendNodes(value) {
@@ -30,11 +30,31 @@ const departmentUserTreeSingleService = {
30
30
  })
31
31
  },
32
32
  querySearch(queryString, cb) {
33
- this.search(this.filterText)
34
- cb([])
33
+ if (!this.filterText && this.filterText.length === 0) {
34
+ this.memorySearch(queryString, cb)
35
+ } else {
36
+ this.search(this.filterText)
37
+ cb([])
38
+ }
35
39
  },
36
40
  handleSelect(item) {
37
- this.handleSelectUtil(item, localStorage)
41
+ // this.handleSelectUtil(item, localStorage)
42
+ // 查询最新用户信息替换,缓存为历史数据 数据库可能发生变化
43
+ this.$http.get(Vue.prototype.baseAPI + '/api/users?loginName=' + item.loginName).then(userDTO => {
44
+ if (userDTO !== null) {
45
+ for (const dtoKey in userDTO) {
46
+ if (item.hasOwnProperty(dtoKey)) {
47
+ item[dtoKey] = userDTO[dtoKey]
48
+ }
49
+ }
50
+ }
51
+ this.filterText = ''
52
+ this.searchValue = ''
53
+ this.packageSelectResult(item)
54
+ this.setMemoryCacheData(item, 'departmentUser')
55
+ // 关闭弹窗
56
+ this.$emit('result', this.selectNodeInfo)
57
+ })
38
58
  },
39
59
  search(value) {
40
60
  this.searchValue = value
@@ -70,7 +90,7 @@ const departmentUserTreeSingleService = {
70
90
  this.checkedChildrenUserNodes(node.data, node.data.children)
71
91
  }
72
92
  } else {
73
- // 表示没有加载过该父节点的子节点集合时
93
+ // 表示没有加载过该父节点的子节点集合时
74
94
  const param = {
75
95
  parentId: parentId,
76
96
  needVirtualUser: this.isNeedVirtualUser
@@ -83,15 +103,15 @@ const departmentUserTreeSingleService = {
83
103
  // 更新当前点击的节点的子节点,必须加该方法,否则会导致子节点无法选中
84
104
  this.$refs.deparmentUserTree.updateKeyChildren(parentNodeId, data)
85
105
  if (parentId === 0) {
86
- // 初始化树时,展开公司节点
106
+ // 初始化树时,展开公司节点
87
107
  const tenantData = data[0].data
88
108
  this.tenantInfo = JSON.parse(tenantData)
89
109
  this.containBranch = data[0].containBranch
90
110
  if (this.departmentInfo && this.departmentInfo.length > 0) {
91
- // 加载指定部门时,展开公司节点
111
+ // 加载指定部门时,展开公司节点
92
112
  this.loadPointDepartments(this)
93
113
  } else {
94
- // 加载整个组织结构树时,展开公司节点
114
+ // 加载整个组织结构树时,展开公司节点
95
115
  this.loadDepartment(this.tenantNodeId, this.tenantNodeId + '')
96
116
  }
97
117
  }
@@ -15,6 +15,7 @@ import {
15
15
  getPropValue
16
16
  } from '../../../src/utils/util'
17
17
  import eventBus from './eventBus'
18
+ import { isPromise } from '../../../src/utils/common-util'
18
19
  const apis = {
19
20
  // 刷新列表数据
20
21
  refresh(parentRowIds, isLineEdit, toolbarFieldParam, isDeleteSubTableData) {
@@ -356,29 +357,40 @@ const apis = {
356
357
  pageSize
357
358
  })
358
359
  }
359
- if (canEdit === undefined || canEdit === true) {
360
- // 取消上一行的编辑状态
361
- if (typeof (gridParams.$rowIndex) !== 'undefined' && gridParams.$rowIndex !== null &&
362
- gridParams.$rowIndex < gridParams.gridData.length) {
363
- const lastEditRow = gridParams.gridData[gridParams.$rowIndex]
364
- setEntityFieldValue(lastEditRow, '$editing', false)
365
- // Vue.set(lastEditRow, '$editing', false)
366
- gridParams.isEditRow = false
367
- }
368
- // 使指定行变为编辑状态
369
- const row = gridParams.gridData[rowIndex]
370
- setEntityFieldValue(row, '$editing', true)
371
- // Vue.set(row, '$editing', true)
372
- gridParams.$lastSaveRowIndex = null
373
- gridParams.$rowIndex = rowIndex
374
- gridParams.isEditRow = true
375
- // 使指定行变为编辑状态,触发获得焦点
376
- if (gridParams.lineEdit.editingCell) {
377
- gridParams.lineEdit.editingCell.row = rowIndex
360
+ if (isPromise(canEdit)) {
361
+ canEdit.then((result) => {
362
+ if (result === undefined || result === true) {
363
+ this.doEditRow(gridParams, rowIndex)
364
+ }
365
+ })
366
+ } else {
367
+ if (canEdit === undefined || canEdit === true) {
368
+ this.doEditRow(gridParams, rowIndex)
378
369
  }
379
370
  }
380
371
  }
381
372
  },
373
+ doEditRow(gridParams, rowIndex) {
374
+ // 取消上一行的编辑状态
375
+ if (typeof (gridParams.$rowIndex) !== 'undefined' && gridParams.$rowIndex !== null &&
376
+ gridParams.$rowIndex < gridParams.gridData.length) {
377
+ const lastEditRow = gridParams.gridData[gridParams.$rowIndex]
378
+ setEntityFieldValue(lastEditRow, '$editing', false)
379
+ // Vue.set(lastEditRow, '$editing', false)
380
+ gridParams.isEditRow = false
381
+ }
382
+ // 使指定行变为编辑状态
383
+ const row = gridParams.gridData[rowIndex]
384
+ setEntityFieldValue(row, '$editing', true)
385
+ // Vue.set(row, '$editing', true)
386
+ gridParams.$lastSaveRowIndex = null
387
+ gridParams.$rowIndex = rowIndex
388
+ gridParams.isEditRow = true
389
+ // 使指定行变为编辑状态,触发获得焦点
390
+ if (gridParams.lineEdit.editingCell) {
391
+ gridParams.lineEdit.editingCell.row = rowIndex
392
+ }
393
+ },
382
394
  saveRow(rowIndex, listCode) {
383
395
  return new Promise((resolve, reject) => {
384
396
  const vm = this
@@ -10,6 +10,7 @@ import {
10
10
  import {
11
11
  analysisFileSetObj, otherFilesToStandard
12
12
  } from './utils'
13
+ import { isPromise } from '../../../src/utils/common-util'
13
14
  const customFormatter = {
14
15
  /**
15
16
  * 自定义格式化值
@@ -225,26 +226,53 @@ const customFormatter = {
225
226
  }
226
227
  if (jumpPageJson && jumpPageJson !== '') {
227
228
  // 解析是否需要显示该超链接
229
+ let canClick = true
228
230
  const gridParams = store.get(listCode)
229
- let parentFormData = null
230
- if (gridParams.options.extraParam && gridParams.options.extraParam.entityMap) {
231
- parentFormData = gridParams.options.extraParam.entityMap
232
- }
233
- console.log('ridParams.options.extraParam.entityMap', gridParams.options.extraParam)
234
- jumpToPage(JSON.parse(jumpPageJson), gridParams.system, row.id ? row.id : row.ID, row, gridParams.additionalParamMap, null, null, parentFormData).then((openPageParams) => {
235
- console.log('clickHyperLink--openPageParams===', openPageParams)
236
- if (openPageParams) {
237
- // 点击列表组件中某元素弹出的页面
238
- openPageParams._position = 'list'
239
- openPageParams._listCode = listCode
240
- openPageParams._rowIndex = rowIndex
241
- // 行编辑的记录
242
- openPageParams.row = row
243
- // 通知父页面弹出页面
244
- this.$emit('open-page', openPageParams)
231
+ const jumpPageSetting = JSON.parse(jumpPageJson)
232
+ console.log('gupre-grid---clickHyperLink--jumpPageSetting=', jumpPageSetting)
233
+ if (jumpPageSetting.beforeClick) {
234
+ const funName = jumpPageSetting.beforeClick
235
+ console.log('gupre-grid---clickHyperLink--jumpPageSetting.beforeClick=', funName)
236
+ console.log('gupre-grid---clickHyperLink--gridParams.options[eventCallBack]=', gridParams.options['eventCallBack'])
237
+ if (gridParams.options && gridParams.options['eventCallBack'] &&
238
+ gridParams.options['eventCallBack'][funName] && typeof (gridParams.options['eventCallBack'][funName]) === 'function') {
239
+ const param = {
240
+ row: row,
241
+ column: column,
242
+ rowIndex: rowIndex,
243
+ listCode
244
+ }
245
+ canClick = gridParams.options['eventCallBack'][funName].call(this, param)
245
246
  }
246
- })
247
+ }
248
+ if (isPromise(canClick)) {
249
+ canClick.then((result) => {
250
+ this.doClickHyperLink(row, listCode, rowIndex, jumpPageSetting, gridParams)
251
+ })
252
+ } else {
253
+ this.doClickHyperLink(row, listCode, rowIndex, jumpPageSetting, gridParams)
254
+ }
255
+ }
256
+ },
257
+ doClickHyperLink(row, listCode, rowIndex, jumpPageSetting, gridParams) {
258
+ let parentFormData = null
259
+ if (gridParams.options.extraParam && gridParams.options.extraParam.entityMap) {
260
+ parentFormData = gridParams.options.extraParam.entityMap
247
261
  }
262
+ console.log('ridParams.options.extraParam.entityMap', gridParams.options.extraParam)
263
+ jumpToPage(jumpPageSetting, gridParams.system, row.id ? row.id : row.ID, row, gridParams.additionalParamMap, null, null, parentFormData).then((openPageParams) => {
264
+ console.log('clickHyperLink--openPageParams===', openPageParams)
265
+ if (openPageParams) {
266
+ // 点击列表组件中某元素弹出的页面
267
+ openPageParams._position = 'list'
268
+ openPageParams._listCode = listCode
269
+ openPageParams._rowIndex = rowIndex
270
+ // 行编辑的记录
271
+ openPageParams.row = row
272
+ // 通知父页面弹出页面
273
+ this.$emit('open-page', openPageParams)
274
+ }
275
+ })
248
276
  }
249
277
  }
250
278
  export default customFormatter
@@ -351,7 +351,7 @@
351
351
  :models="row"
352
352
  :check-strictly="isCheckStrictly"
353
353
  :multiple="isMultiTree"
354
- :tree-type="deptManTree?'DeptUserTree':deptTree?'DeptTree':wgManTree?'WgTree':wgTree?'WgUserTree':null"
354
+ :tree-type="deptManTree?'DeptUserTree':deptTree?'DeptTree':wgManTree?'WgUserTree':wgTree?'WgTree':null"
355
355
  :disabled="disabled"
356
356
  :table-name="tableName"
357
357
  :department-info="departmentInfo"