detailsPage.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList">返回列表
  7. </el-button>
  8. </div>
  9. </div>
  10. <div class="customer-main">
  11. <trade-card title="基础明细">
  12. <avue-crud ref="crud" :data="data" :option="tableOption" @saveColumn="saveColumn" @resetColumn="resetColumn"
  13. :cell-style="cellStyle">
  14. </avue-crud>
  15. </trade-card>
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. import tableOption from "./config/customerContact.json";
  21. export default {
  22. name: "detailsPageEdit",
  23. data() {
  24. return {
  25. show: true,
  26. treeStyle: "height:" + (window.innerHeight - 315) + "px",
  27. disabled: false,
  28. tableOption: {},
  29. data: [],
  30. };
  31. },
  32. props: {
  33. detailData: {
  34. type: Object
  35. }
  36. },
  37. async created() {
  38. if (this.detailData.id) {
  39. this.getDetail(this.detailData.id);
  40. }
  41. this.tableOption = await this.getColumnData(
  42. this.getColumnName(179.1),
  43. tableOption
  44. );
  45. },
  46. methods: {
  47. cellStyle() {
  48. return "padding:0;height:40px;";
  49. },
  50. getDetail(id) {
  51. this.loading = true;
  52. this.pageLoading = true;
  53. },
  54. //返回列表
  55. backToList() {
  56. this.$emit("goBack");
  57. },
  58. openEdit() {
  59. this.detailData.status = 2;
  60. this.option = this.$options.data().option;
  61. this.$refs.crud.refreshTable();
  62. },
  63. async saveColumn() {
  64. const inSave = await this.saveColumnData(
  65. this.getColumnName(179.1),
  66. this.tableOption
  67. );
  68. if (inSave) {
  69. this.$nextTick(() => {
  70. this.$refs.crud.doLayout();
  71. });
  72. this.$message.success("保存成功");
  73. //关闭窗口
  74. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  75. }
  76. },
  77. async resetColumn() {
  78. this.tableOption = tableOption;
  79. const inSave = await this.delColumnData(
  80. this.getColumnName(179.1),
  81. tableOption
  82. );
  83. if (inSave) {
  84. this.$nextTick(() => {
  85. this.$refs.crud.doLayout();
  86. });
  87. this.$message.success("重置成功");
  88. //关闭窗口
  89. setTimeout(() => {
  90. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  91. }, 1000);
  92. }
  93. }
  94. },
  95. watch: {
  96. }
  97. };
  98. </script>
  99. <style lang="scss" scoped>
  100. .trading-form ::v-deep .el-form-item {
  101. margin-bottom: 8px !important;
  102. }
  103. ::v-deep .el-form-item__error {
  104. display: none !important;
  105. }
  106. ::v-deep .select-component {
  107. display: flex !important;
  108. }
  109. </style>