bulkOperationMixin.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import {
  2. deteleModel
  3. } from '@/api/apply/visualDev'
  4. export default {
  5. data() {
  6. return {
  7. slide: '',
  8. slide2: '',
  9. checkedAll: false,
  10. ids: [],
  11. showTop: false,
  12. }
  13. },
  14. methods: {
  15. /* 批量删除 */
  16. batchDelete() {
  17. uni.showModal({
  18. title: '提示',
  19. content: '删除后数据无法恢复',
  20. success: (res) => {
  21. if (res.confirm) {
  22. const uniqueIds = new Set();
  23. this.selectItems.forEach(item => {
  24. uniqueIds.add(item.id);
  25. });
  26. const ids = [...uniqueIds];
  27. let data = {
  28. flowId: this.config.flowId,
  29. ids
  30. };
  31. deteleModel(data, this.modelId).then(res => {
  32. this.selectItems = [];
  33. this.$u.toast(res.msg)
  34. this.mescroll.resetUpScroll()
  35. })
  36. }
  37. }
  38. })
  39. },
  40. openBatchOperate() {
  41. this.showTop = !this.showTop
  42. if (this.showTop) {
  43. this.slide = 'slide-up'
  44. this.slide2 = 'slide-up2'
  45. }
  46. },
  47. checkAll() {
  48. this.checkedAll = !this.checkedAll
  49. this.list = this.list.map(o => ({
  50. ...o,
  51. checked: false
  52. }))
  53. if (this.checkedAll) {
  54. this.list = this.list.map(o => ({
  55. ...o,
  56. checked: true
  57. }))
  58. }
  59. },
  60. cancel() {
  61. this.list = this.list.map(o => ({
  62. ...o,
  63. checked: false
  64. }))
  65. this.showTop = false
  66. this.checkedAll = false
  67. this.$nextTick(() => {
  68. this.$refs.list.handleCheckAll()
  69. })
  70. }
  71. }
  72. }