index.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. export default {
  2. data() {
  3. return {
  4. currentPage: 1, // 当前页码
  5. pageSize: 10, // 每页数量
  6. listTotal: 0, // 列表总数
  7. listLoading: false, // 加载
  8. screenForm: {}, // 筛选表单数据
  9. dataList: [], // 表格数据
  10. ids: [], // 多选数据id
  11. dialogVisible: false, // 弹框
  12. }
  13. },
  14. created() {
  15. this.getList();
  16. },
  17. methods: {
  18. // 提交筛选表单
  19. submitScreenForm() {
  20. this.currentPage = 1;
  21. this.getList();
  22. },
  23. // 重置筛选表单
  24. resetScreenForm() {
  25. this.$refs.screenForm.resetFields();
  26. this.currentPage = 1;
  27. this.getList();
  28. },
  29. // 更改每页数量
  30. handleSizeChange(val) {
  31. this.pageSize = val;
  32. this.currentPage = 1;
  33. this.getList();
  34. },
  35. // 更改当前页
  36. handleCurrentChange(val) {
  37. this.currentPage = val;
  38. this.getList();
  39. },
  40. // Windows全局打印
  41. hanlePrint() {
  42. window.print()
  43. },
  44. // 筛选全部数据
  45. hanleSelectAll(selection) {
  46. this.ids = selection.map((k) => {
  47. return k.id;
  48. });
  49. console.log(this.ids);
  50. },
  51. /**
  52. * @description 单条数据删除 或者 全部数据删除
  53. * @author zhou
  54. * @param {*} id 删除单条数据传
  55. * @return {*} Promise.resolve(ids)
  56. */
  57. hanleDeleteAllPromise(id) {
  58. return new Promise((resolve, reject) => {
  59. const ids = id ? [id] : this.ids
  60. if (!ids.length) {
  61. this.$errorMsg("请选择删除内容");
  62. return;
  63. }
  64. resolve(ids)
  65. })
  66. }
  67. }
  68. }