index.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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.$refs.screenForm.resetFields()
  37. this.currentPage = 1
  38. this.getList()
  39. },
  40. hanlePagination(val) {
  41. // 更改每页数量
  42. this.handleSizeChange(val)
  43. // 更改当前页
  44. this.handleCurrentChange(val)
  45. },
  46. // 更改每页数量
  47. handleSizeChange(val) {
  48. this.pageSize = val
  49. this.currentPage = 1
  50. this.getList()
  51. },
  52. // 更改当前页
  53. handleCurrentChange(val) {
  54. this.currentPage = val
  55. this.getList()
  56. },
  57. // Windows全局打印
  58. hanlePrint() {
  59. window.print()
  60. },
  61. // 筛选全部数据
  62. hanleSelectAll(selection, index) {
  63. this.ids = selection.map(k => {
  64. return k.id || k.updPriceBillId
  65. })
  66. console.log(this.ids)
  67. },
  68. /**
  69. * @description 单条数据删除 或者 全部数据删除
  70. * @author zhou
  71. * @param {*} id 删除单条数据传
  72. * @return {*} Promise.resolve(ids)
  73. */
  74. hanleDeleteAllPromise(id) {
  75. return new Promise((resolve, reject) => {
  76. const ids = id ? [id] : this.ids
  77. if (!ids.length) {
  78. this.$errorMsg('请选择删除内容')
  79. return
  80. }
  81. resolve(ids)
  82. })
  83. }
  84. }
  85. }