@lambo-design/schema-paging-table 1.0.0-beta.42 → 1.0.0-beta.44

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/index.vue +70 -45
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambo-design/schema-paging-table",
3
- "version": "1.0.0-beta.42",
3
+ "version": "1.0.0-beta.44",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "lambo",
@@ -11,10 +11,10 @@
11
11
  },
12
12
  "devDependencies": {
13
13
  "standard-version": "^9.5.0",
14
- "@lambo-design/paging-table": "^1.0.0-beta.82",
15
- "@lambo-design/shared": "^1.0.0-beta.214",
14
+ "@lambo-design/core": "^4.7.1-beta.145",
15
+ "@lambo-design/shared": "^1.0.0-beta.218",
16
16
  "@lambo-design/schema-form": "^1.0.0-beta.71",
17
- "@lambo-design/core": "^4.7.1-beta.144"
17
+ "@lambo-design/paging-table": "^1.0.0-beta.83"
18
18
  },
19
19
  "scripts": {
20
20
  "release": "pnpm release-beta && git push --follow-tags && pnpm re-publish",
package/src/index.vue CHANGED
@@ -83,6 +83,7 @@ export default {
83
83
  selectRows: [],
84
84
  selectedKeys: [],
85
85
  radioSelectIndex: -1,
86
+ selectCondition:''
86
87
  }
87
88
  },
88
89
  props:{
@@ -189,53 +190,59 @@ export default {
189
190
  let dropdownDomsd = [];
190
191
  obj.button.map((item, index) => {
191
192
  const conditionMet = item && typeof item.condition === "function" ? item.condition(param) : true;
193
+ const execConditionMet = item && typeof item.execCondition === "function" ? item.execCondition(param) : true;
192
194
  if(conditionMet){
193
- let doms = operateHref(self, h, param.row, item.name || param.row[obj.key], (vm, currentRow) => {
194
- if (item.clickEvent?.type === "route") {
195
- // self.$Message.info(item.clickEvent.name)
196
- let query = item.clickEvent?.route?.keys?.reduce((acc, sourceItem) => {
197
- return Object.assign(acc, {[sourceItem]: currentRow[sourceItem]})
198
- }, {})
199
- self.$router.push({
200
- path: item.clickEvent?.route?.path,
201
- query
202
- })
203
- } else if (item.clickEvent?.type === "request") {
204
- // self.$Message.info(item.clickEvent.name)
205
- let data = item.clickEvent?.request?.keys?.reduce((acc, sourceItem) => {
206
- return Object.assign(acc, {[sourceItem]: currentRow[sourceItem]})
207
- }, {})
208
- let request = {
209
- url: item.clickEvent.request.url,
210
- method: item.clickEvent.request.method,
211
- param: data,
212
- }
213
- let response = item.clickEvent.response
214
- if (item.clickEvent.tips) {
215
- let tips = item.clickEvent.tips
216
- this.$Modal.confirm({
217
- title: tips.title,
218
- content: '<p>' + tips.content + '</p>',
219
- onOk: () => {
220
- self.fetch(request, response)
221
- }
222
- });
223
- } else {
224
- self.fetch(request, response)
225
- }
226
- } else if (item.clickEvent?.type === "method") {
227
- if(!item.clickEvent?.method?.keys) {
228
- self.$emit(item.clickEvent?.method?.name, param.index);
229
- return ;
195
+ let doms
196
+ if (!execConditionMet) {
197
+ doms = item.name ? item.name : param.row[obj.key]
198
+ } else {
199
+ doms = operateHref(self, h, param.row, item.name || param.row[obj.key], (vm, currentRow) => {
200
+ if (item.clickEvent?.type === "route") {
201
+ // self.$Message.info(item.clickEvent.name)
202
+ let query = item.clickEvent?.route?.keys?.reduce((acc, sourceItem) => {
203
+ return Object.assign(acc, {[sourceItem]: currentRow[sourceItem]})
204
+ }, {})
205
+ self.$router.push({
206
+ path: item.clickEvent?.route?.path,
207
+ query
208
+ })
209
+ } else if (item.clickEvent?.type === "request") {
210
+ // self.$Message.info(item.clickEvent.name)
211
+ let data = item.clickEvent?.request?.keys?.reduce((acc, sourceItem) => {
212
+ return Object.assign(acc, {[sourceItem]: currentRow[sourceItem]})
213
+ }, {})
214
+ let request = {
215
+ url: item.clickEvent.request.url,
216
+ method: item.clickEvent.request.method,
217
+ param: data,
218
+ }
219
+ let response = item.clickEvent.response
220
+ if (item.clickEvent.tips) {
221
+ let tips = item.clickEvent.tips
222
+ this.$Modal.confirm({
223
+ title: tips.title,
224
+ content: '<p>' + tips.content + '</p>',
225
+ onOk: () => {
226
+ self.fetch(request, response)
227
+ }
228
+ });
229
+ } else {
230
+ self.fetch(request, response)
231
+ }
232
+ } else if (item.clickEvent?.type === "method") {
233
+ if(!item.clickEvent?.method?.keys) {
234
+ self.$emit(item.clickEvent?.method?.name, param.index);
235
+ return ;
236
+ }
237
+ let args = item.clickEvent?.method?.keys?.reduce((total, current) => {
238
+ return Object.assign(total, {[current]: currentRow[current]})
239
+ }, {})
240
+ self.$emit(item.clickEvent?.method?.name, args)
241
+ } else if (item.clickEvent?.type === "modal") {
242
+ self.$Message.info(item.clickEvent.name)
230
243
  }
231
- let args = item.clickEvent?.method?.keys?.reduce((total, current) => {
232
- return Object.assign(total, {[current]: currentRow[current]})
233
- }, {})
234
- self.$emit(item.clickEvent?.method?.name, args)
235
- } else if (item.clickEvent?.type === "modal") {
236
- self.$Message.info(item.clickEvent.name)
237
- }
238
- }, item.permission)
244
+ }, item.permission)
245
+ }
239
246
  if (visibleDomsd.length < self.operColumnDropdownNum) {
240
247
  visibleDomsd.push(doms);
241
248
  } else if (visibleDomsd.length === self.operColumnDropdownNum && dropdownDomsd.length === 0){
@@ -254,6 +261,21 @@ export default {
254
261
  dropdownDomsd.length !== 0 ? operateMore(self,h,dropdownDomsd) : null
255
262
  ]);
256
263
  }
264
+ } else if (obj.hasOwnProperty('type') && (obj.type === 'selection'||obj.type === 'single-selection')) {
265
+ this.selectCondition = item.selectCondition ? item.selectCondition : ''
266
+ } else if (item.isFlotTip) {
267
+ obj.render = (h, param) => {
268
+ return h('span', {
269
+ style: {
270
+ display: 'inline-block',
271
+ width: '100%',
272
+ overflow: 'hidden',
273
+ textOverflow: 'ellipsis',
274
+ whiteSpace: 'nowrap'
275
+ },
276
+ domProps: { title: item.name ? item.name : param.row[obj.key] }
277
+ }, item.name ? item.name : param.row[obj.key])
278
+ }
257
279
  }
258
280
  columns.push(item)
259
281
  })
@@ -494,6 +516,9 @@ export default {
494
516
  if (resp.code === 1 || resp.code === "000") {
495
517
  let tableData = resp.data.rows;
496
518
  for (let i = 0; i < tableData.length; i++) {
519
+ if (self.selectCondition && typeof self.selectCondition === "function") {
520
+ tableData[i]._disabled = !self.selectCondition({row:tableData[i]})
521
+ }
497
522
  if (self.selectRows[tableData[i][self.rowKey]]) {
498
523
  self.radioSelectIndex = i
499
524
  tableData[i]._checked = true;