columnSetting.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import request from '@/utils/request'
  2. // 列显示隐藏配置
  3. export function columnSetting(data) {
  4. return request({
  5. url: '/sc-service/ownColumnsetting',
  6. method: 'post',
  7. data: data
  8. })
  9. }
  10. //查询
  11. export function columnQuery(query) {
  12. return request({
  13. url: '/sc-service/ownColumnsetting/list',
  14. method: 'get',
  15. params: query
  16. })
  17. }
  18. //控制隐藏显示的函数
  19. export function columnfilter(selfDom){
  20. if (selfDom.firstSet && selfDom.checkList.length == 0) {
  21. selfDom.$message.warning("配置显示列不能为空!");
  22. return;
  23. }
  24. selfDom.firstSet = true;
  25. //初始化数据
  26. if (selfDom.checkList.length == 0) {
  27. for (let index in selfDom.tableList) {
  28. let table = selfDom.tableList[index];
  29. selfDom.checkList.push(table.label);
  30. }
  31. }
  32. for (let index in selfDom.tableList) {
  33. let table = selfDom.tableList[index];
  34. selfDom.uncheckList[table.label] = true;
  35. }
  36. //数据准备
  37. for (let item in selfDom.uncheckList) {
  38. selfDom.uncheckList[item] = false;
  39. }
  40. //数据处理
  41. for (let index in selfDom.checkList) {
  42. let name = selfDom.checkList[index];
  43. if (name in selfDom.uncheckList) {
  44. selfDom.uncheckList[name] = true;
  45. }
  46. }
  47. selfDom.$forceUpdate();
  48. }