index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <div class="progress-content">
  3. <!-- <el-form class="progress-header">
  4. <el-form-item :class="isEdit && 'show'" label="应填报日期">
  5. <div class="input-col">
  6. <el-input-number v-model="form.ytbDate" :min="1" :max="28" step-strictly :controls="false"></el-input-number>
  7. <el-button :loading="isSaving" type="primary" @click="submit">保 存</el-button>
  8. <el-button @click="cancel">取 消</el-button>
  9. </div>
  10. <div class="tag-col" @click="isEdit = !isEdit">
  11. <el-tag v-if="form.ytbDate" type="primary" size="large">每月{{ form.ytbDate }}日</el-tag>
  12. <el-tag v-else type="info" size="large">未设置</el-tag>
  13. </div>
  14. </el-form-item>
  15. </el-form> -->
  16. <el-tabs v-model="element">
  17. <el-tab-pane v-for="(label, key) in progressTab" :key="key" :label="label" :name="key"></el-tab-pane>
  18. </el-tabs>
  19. <component :is="allComps[element]"></component>
  20. </div>
  21. </template>
  22. <script>
  23. import API from "@/api/policy/progress";
  24. import allComps from "@/views/progress/component/index";
  25. import { progressTab } from "@/views/progress/main";
  26. export default {
  27. data() {
  28. return {
  29. allComps,
  30. progressTab,
  31. // element: "policy_share",
  32. element: "policy_strive",
  33. isEdit: false,
  34. isSaving: false,
  35. form: {
  36. ytbDate: null
  37. }
  38. }
  39. },
  40. // watch: {
  41. // isEdit(value) {
  42. // if (value) document.body.addEventListener("click", this.close);
  43. // else document.body.removeEventListener("click", this.close);
  44. // }
  45. // },
  46. mounted() {
  47. this.getCondition();
  48. },
  49. methods: {
  50. getCondition() {
  51. API.condition.get().then(res => this.form.ytbDate = res.data || null).catch(() => this.form.ytbDate = null);
  52. },
  53. cancel() {
  54. this.getCondition();
  55. this.isEdit = false;
  56. },
  57. submit() {
  58. if (!this.form.ytbDate) this.cancel();
  59. else {
  60. this.isSaving = true;
  61. API.condition.edit(this.form).then(res => {
  62. this.isSaving = false;
  63. ElMessage.success("操作成功");
  64. this.cancel();
  65. }).catch(() => this.isSaving = false);
  66. }
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. .progress-content {
  73. padding-top: 10px;
  74. background: #fff;
  75. border: 1px solid var(--el-border-color-light);
  76. border-radius: var(--el-border-radius-base);
  77. box-shadow: var(--el-box-shadow-light);
  78. .progress-header {
  79. margin: 20px;
  80. .el-form-item {
  81. margin-bottom: 0;
  82. .input-col {
  83. display: flex;
  84. transition: width 0.2s;
  85. width: 0;
  86. .el-input-number {
  87. display: none;
  88. width: 100px;
  89. :deep(.el-input .el-input__wrapper) {
  90. padding: 1px 11px;
  91. .el-input__inner {
  92. text-align: unset;
  93. }
  94. }
  95. }
  96. .el-input-number + .el-button {
  97. margin-left: 20px;
  98. }
  99. .el-button {
  100. display: none;
  101. }
  102. }
  103. .tag-col {
  104. display: inline-flex;
  105. .el-tag {
  106. cursor: pointer;
  107. }
  108. }
  109. }
  110. .el-form-item.show {
  111. .input-col {
  112. width: fit-content;
  113. .el-input-number,
  114. .el-button {
  115. display: inline-flex;
  116. }
  117. }
  118. .tag-col {
  119. display: none;
  120. }
  121. }
  122. }
  123. .el-tabs {
  124. padding: 0 20px;
  125. :deep(.el-tabs__content) {
  126. display: none;
  127. }
  128. }
  129. }
  130. </style>