CommentAbility.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <div class="comment-ability">
  3. <el-table ref="TableList" :data="dataList">
  4. <el-table-column
  5. prop="levelCode"
  6. label="等级"
  7. width="60"
  8. ></el-table-column>
  9. <el-table-column label="划分规划" width="300">
  10. <div
  11. slot-scope="scope"
  12. :class="[
  13. 'rate-input',
  14. { 'rate-input-offset-left': scope.$index === 0 }
  15. ]"
  16. >
  17. <el-input-number
  18. v-if="scope.$index !== 0"
  19. v-model="scope.row.startRate"
  20. placeholder="请输入"
  21. :min="0"
  22. :max="100"
  23. :step="1"
  24. step-strictly
  25. size="small"
  26. :controls="false"
  27. @change="rateChange"
  28. ></el-input-number>
  29. <span v-if="scope.$index !== 0">≤</span>
  30. <span>百分位等级TOP</span>
  31. <span>≤</span>
  32. <el-input-number
  33. v-model="scope.row.endRate"
  34. placeholder="请输入"
  35. :min="0"
  36. :max="100"
  37. :step="1"
  38. step-strictly
  39. size="small"
  40. :controls="false"
  41. @change="rateChange"
  42. ></el-input-number>
  43. </div>
  44. </el-table-column>
  45. <el-table-column
  46. prop="levelName"
  47. label="水平层次"
  48. width="140"
  49. ></el-table-column>
  50. <el-table-column prop="result" label="诊断结果"></el-table-column>
  51. <el-table-column prop="advice" label="学习建议"></el-table-column>
  52. <el-table-column
  53. class-name="action-column"
  54. label="操作"
  55. width="80px"
  56. align="center"
  57. >
  58. <template slot-scope="scope">
  59. <el-button class="btn-primary" type="text" @click="toEdit(scope.row)"
  60. >编辑</el-button
  61. >
  62. </template>
  63. </el-table-column>
  64. </el-table>
  65. <!-- ModifyAbilityComment -->
  66. <modify-ability-comment
  67. ref="ModifyAbilityComment"
  68. :instance="curRow"
  69. :modified="modified"
  70. ></modify-ability-comment>
  71. </div>
  72. </template>
  73. <script>
  74. import ModifyAbilityComment from "./ModifyAbilityComment.vue";
  75. export default {
  76. name: "comment-ability",
  77. components: { ModifyAbilityComment },
  78. props: {
  79. rates: {
  80. type: Array,
  81. default() {
  82. return [];
  83. }
  84. }
  85. },
  86. data() {
  87. return {
  88. dataList: [],
  89. curRow: {},
  90. errorMsg: ""
  91. };
  92. },
  93. mounted() {
  94. this.dataList = this.rates.map(item => {
  95. return { ...item };
  96. });
  97. },
  98. methods: {
  99. toEdit(row) {
  100. this.curRow = row;
  101. this.$refs.ModifyAbilityComment.open();
  102. },
  103. modified(data) {
  104. const ind = this.dataList.findIndex(item => item.level === data.level);
  105. this.dataList[ind] = this.$objAssign(this.dataList[ind], data);
  106. },
  107. rateChange() {
  108. this.$emit("data-change", this.dataList);
  109. }
  110. }
  111. };
  112. </script>