columnSetting.vue 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <el-tooltip class="item" effect="dark" content="表头设置" placement="top">
  3. <el-popover
  4. placement="right"
  5. title="表头设置"
  6. trigger="click"
  7. v-model="visible"
  8. @show="show">
  9. <!-- v-model="visible" 点击关闭 -->
  10. <el-container style="height: 250px">
  11. <el-main style="height: 200px;margin-top:15px">
  12. <el-checkbox-group v-model="checkListTemp" @change="filter">
  13. <el-row v-for="(item,index) in tableListTemp" :key="index" >
  14. <el-checkbox :label="item.label">{{item.value}}</el-checkbox>
  15. </el-row>
  16. </el-checkbox-group>
  17. </el-main>
  18. </el-container>
  19. <!-- el-icon-arrow-down el-icon-menu -->
  20. <img slot="reference" class="zap-icon-setting" src="../../assets/images/components/icon_setting.png" alt="">
  21. <div class="dialog-footer">
  22. <el-button size="small" type="success" @click="saveSet" >保存设置</el-button>
  23. </div>
  24. </el-popover>
  25. </el-tooltip>
  26. </template>
  27. <script>
  28. import { columnSetting } from "@/api/common/columnSetting";
  29. export default {
  30. /* 名称 */
  31. name: "columnSetting",
  32. /*需要引用的页面传过来的参数 */
  33. props: ["checkList", "tableList", "selfDom", "tableId"],
  34. data() {
  35. return {
  36. checkListTemp: [],
  37. tableListTemp: [],
  38. visible:false //点击关闭
  39. };
  40. },
  41. mounted() {},
  42. methods: {
  43. filter() {
  44. this.selfDom.filter(this.checkListTemp);
  45. },
  46. saveSet() {
  47. //获取文件路径
  48. var psfPagePath = window.location.pathname; //用请求后台的url作为唯一标识
  49. var psfTableName = this.tableId;
  50. var settingForm = {};
  51. settingForm.psfPagePath = psfPagePath;
  52. settingForm.psfTableName = psfTableName;
  53. settingForm.psfShowData = this.checkListTemp;
  54. columnSetting(settingForm)
  55. .then(response => {
  56. this.msgSuccess("设置成功");
  57. this.selfDom.columnQuery();
  58. this.visible = false //点击关闭
  59. })
  60. .catch(() => {
  61. this.$message({
  62. type: "warning",
  63. message: "设置失败"
  64. });
  65. });
  66. },
  67. show() {
  68. //因为子元素不能修改父元素的值,复制之后再修改
  69. this.checkListTemp = eval("(" + JSON.stringify(this.checkList) + ")");
  70. this.tableListTemp = eval("(" + JSON.stringify(this.tableList) + ")");
  71. }
  72. }
  73. };
  74. </script>
  75. <style lang="scss">
  76. .zap-icon-setting{
  77. width: 21px;
  78. height: 20px;
  79. line-height: 32px;
  80. vertical-align: middle;
  81. }
  82. </style>