index.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * @Author: howie
  3. * @Date: 2022-06-14 10:14:37
  4. * @LastEditors: howie
  5. * @LastEditTime: 2022-07-03 17:47:25
  6. * @FilePath: \supply-front\src\mixin\index.js
  7. * @Description:
  8. *
  9. * Copyright (c) 2022, All Rights Reserved.
  10. */
  11. export default {
  12. data() {
  13. return {
  14. currentPage: 1, // 当前页码
  15. pageSize: 10, // 每页数量
  16. listTotal: 0, // 列表总数
  17. listLoading: false, // 加载
  18. screenForm: {}, // 筛选表单数据
  19. dataList: [], // 表格数据
  20. ids: [], // 多选数据id
  21. dialogVisible: false, // 弹框
  22. conditionList: []
  23. }
  24. },
  25. created() {
  26. this.getList()
  27. },
  28. methods: {
  29. // 提交筛选表单
  30. submitScreenForm() {
  31. this.currentPage = 1
  32. this.getList()
  33. },
  34. // 重置筛选表单
  35. resetScreenForm() {
  36. this.$nextTick(()=>{
  37. this.$refs.screenForm.resetFields()
  38. })
  39. this.currentPage = 1
  40. this.getList()
  41. },
  42. hanlePagination(val) {
  43. // 更改每页数量
  44. this.handleSizeChange(val)
  45. // 更改当前页
  46. this.handleCurrentChange(val)
  47. },
  48. // 更改每页数量
  49. handleSizeChange(val) {
  50. this.pageSize = val
  51. this.currentPage = 1
  52. this.getList()
  53. },
  54. // 更改当前页
  55. handleCurrentChange(val) {
  56. this.currentPage = val
  57. this.getList()
  58. },
  59. // Windows全局打印
  60. hanlePrint() {
  61. window.print()
  62. },
  63. // 筛选全部数据
  64. hanleSelectAll(selection, index) {
  65. this.ids = selection.map(k => {
  66. return k.id || k.updPriceBillId
  67. })
  68. console.log(this.ids)
  69. },
  70. /**
  71. * @description 单条数据删除 或者 全部数据删除
  72. * @author zhou
  73. * @param {*} id 删除单条数据传
  74. * @return {*} Promise.resolve(ids)
  75. */
  76. hanleDeleteAllPromise(id) {
  77. return new Promise((resolve, reject) => {
  78. const ids = id ? [id] : this.ids
  79. if (!ids.length) {
  80. this.$errorMsg('请选择删除内容')
  81. return
  82. }
  83. resolve(ids)
  84. })
  85. }
  86. }
  87. }