proofread_errors.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <div class="errorList">
  3. <div v-for="(item, index) in list || []" :key="index">
  4. <template v-for="(v, i) in item.htmlWords" :key="'son' + i">
  5. <div v-if="tabSelect[item.um_error_level - 1]">
  6. <div
  7. class="searchEnd"
  8. :style="{
  9. borderColor: getTypeError(item.um_error_level, 'rgb'),
  10. backgroundColor:
  11. lastAtom === item.colorPosition
  12. ? getTypeError(item.um_error_level, 'rgba')
  13. : '',
  14. }"
  15. @click.stop="() => changeselect(item)"
  16. >
  17. <el-row :gutter="32">
  18. <el-col :span="12">
  19. <p
  20. v-text="v.word"
  21. :style="{
  22. color: getTypeError(item.um_error_level, 'rgb'),
  23. }"
  24. ></p>
  25. </el-col>
  26. <el-col :span="12">
  27. <p
  28. v-text="item.suggest[i]"
  29. style="color: #2dc76d; text-align: right"
  30. ></p>
  31. </el-col>
  32. </el-row>
  33. <el-row>
  34. <el-col :span="24">
  35. <p style="line-height: 1.5em">
  36. 错误原因:{{ item.youmeiWordName }}
  37. </p>
  38. </el-col>
  39. </el-row>
  40. <el-row>
  41. <el-col :span="24">
  42. <p style="line-height: 1.5em">修改建议:{{ item.explanation }}</p>
  43. </el-col>
  44. </el-row>
  45. <p style="text-align: right">
  46. <span
  47. class="btn"
  48. v-if="listName == 'untreatedError' && item.suggest[i]"
  49. @click.stop="() => replaceText(item, i, index)"
  50. >
  51. 替换
  52. </span>
  53. <span
  54. class="btn"
  55. v-if="
  56. listName == 'untreatedError' &&
  57. !item.suggest[i] &&
  58. isDel(item.type.belongId)
  59. "
  60. @click.stop="() => deleteItem(item, i, index)"
  61. >
  62. 删除
  63. </span>
  64. <span
  65. class="btn"
  66. v-if="listName == 'untreatedError'"
  67. @click.stop="() => ignoreText(item, i, index)"
  68. >
  69. 忽略
  70. </span>
  71. <span
  72. class="btn"
  73. v-if="listName !== 'untreatedError'"
  74. @click.stop="() => resumeText(item, i, index)"
  75. >
  76. 恢复
  77. </span>
  78. </p>
  79. </div>
  80. </div>
  81. </template>
  82. </div>
  83. <el-empty description="所选类型下暂无信息" v-if="!list || !list.length" />
  84. </div>
  85. </template>
  86. <script setup>
  87. import { defineProps, defineEmits } from 'vue';
  88. import errType from '../../../../config/errtype';
  89. const props = defineProps({
  90. list: Array,
  91. lastAtom: Number,
  92. listName: String,
  93. tabSelect: Array,
  94. });
  95. const emit = defineEmits([
  96. 'selectErrorFunc',
  97. 'replaceText',
  98. 'ignoreText',
  99. 'deleteText',
  100. 'resumeText',
  101. ]);
  102. function isDel(id) {
  103. const Del = {
  104. 105: true,
  105. 108: true,
  106. 112: true,
  107. 111: true,
  108. 201: true,
  109. };
  110. return Del[id];
  111. }
  112. function getTypeError(key, type) {
  113. if (type == 'rgb') return type + '(' + errType[key] + ')';
  114. if (type == 'rgba') return type + '(' + errType[key] + ', 0.1)';
  115. return '';
  116. }
  117. function changeselect(item) {
  118. emit('selectErrorFunc', {
  119. colorPosition: item.colorPosition,
  120. um_error_level: item.um_error_level,
  121. });
  122. }
  123. function replaceText(item, index, pindex) {
  124. emit('replaceText', {
  125. item,
  126. index,
  127. pindex,
  128. name: props.listName,
  129. });
  130. }
  131. function ignoreText(item, index, pindex) {
  132. emit('ignoreText', {
  133. item,
  134. index,
  135. pindex,
  136. name: props.listName,
  137. });
  138. }
  139. function deleteItem(item, index, pindex) {
  140. emit('deleteText', {
  141. item,
  142. index,
  143. pindex,
  144. name: props.listName,
  145. });
  146. }
  147. function resumeText(item, index, pindex) {
  148. emit('resumeText', {
  149. item,
  150. index,
  151. pindex,
  152. name: props.listName,
  153. });
  154. }
  155. </script>
  156. <style scoped>
  157. .errorList {
  158. padding: 0 5px;
  159. overflow-y: auto;
  160. height: calc(100vh - 256px);
  161. }
  162. .searchEnd {
  163. border-left: 6px solid;
  164. margin-bottom: 1em;
  165. padding: 5px 35px 5px 15px;
  166. font-size: 16px;
  167. line-height: 1.5em;
  168. background-color: #f9fafc;
  169. }
  170. .btn {
  171. display: inline-block;
  172. background: rgba(41, 116, 255, 0.1);
  173. color: #2974ff;
  174. padding: 0 15px;
  175. height: 1.5em;
  176. line-height: 1.5em;
  177. margin-left: 0.3em;
  178. cursor: pointer;
  179. }
  180. .wenhao {
  181. display: inline-block;
  182. border: 1px solid #5e5e5e;
  183. border-radius: 50%;
  184. width: 1.2em;
  185. height: 1.2em;
  186. line-height: 1.2em;
  187. text-align: center;
  188. color: #5e5e5e;
  189. }
  190. .change {
  191. float: right;
  192. margin-right: -32px;
  193. cursor: pointer;
  194. }
  195. </style>