CompareTime.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <div class="CompareTime">
  3. <template v-if="type == '句子'">
  4. <table>
  5. <tr>
  6. <th style="width: 280px">句子</th>
  7. <th style="width: 200px">开始时间</th>
  8. <th style="width: 200px">结束时间</th>
  9. </tr>
  10. <tr v-for="(item, index) in data" :key="index + 'sen'">
  11. <td>{{ item.onebest }}</td>
  12. <td>
  13. <input v-model="item.bg" type="text" maxlength="200" show-word-limit @change="changeTime(item, 'bg')" />
  14. </td>
  15. <td>
  16. <input v-model="item.ed" type="text" maxlength="200" show-word-limit @change="changeTime(item, 'ed')" />
  17. </td>
  18. </tr>
  19. </table>
  20. </template>
  21. <template v-else>
  22. <table>
  23. <tr>
  24. <th style="width: 280px">句子</th>
  25. <th style="width: 200px">操作</th>
  26. </tr>
  27. <tr v-for="(item, index) in data" :key="index + 'sen'">
  28. <td>{{ item.onebest }}</td>
  29. <td>
  30. <el-button type="primary" size="medium" @click="compareOneHZ(index)">校对文字字幕时间</el-button>
  31. </td>
  32. </tr>
  33. </table>
  34. </template>
  35. <template v-if="wordData">
  36. <el-dialog
  37. title="校对字母时间"
  38. :visible.sync="oneHZshow"
  39. width="60%"
  40. :before-close="handleClose"
  41. :modal="false"
  42. top="0"
  43. >
  44. <table>
  45. <tr>
  46. <th style="width: 250px">文字</th>
  47. <th style="width: 200px">开始时间</th>
  48. <th style="width: 200px">结束时间</th>
  49. </tr>
  50. <tr v-for="(item, index) in wordData" :key="index + 'wordsResul'">
  51. <td>{{ item.wordsName ? item.wordsName : item.onebest }}</td>
  52. <td>
  53. <input
  54. v-model="item.wordBg"
  55. type="text"
  56. maxlength="200"
  57. show-word-limit
  58. @change="changeTime(item, 'wordBg')"
  59. />
  60. </td>
  61. <td>
  62. <input
  63. v-model="item.wordEd"
  64. type="text"
  65. maxlength="200"
  66. show-word-limit
  67. @change="changeTime(item, 'wordEd')"
  68. />
  69. </td>
  70. </tr>
  71. </table>
  72. <span slot="footer" class="dialog-footer">
  73. <el-button @click="handleClose">取 消</el-button>
  74. <el-button :loading="compareloading" type="primary" @click="savehz">确 定</el-button>
  75. </span>
  76. </el-dialog>
  77. </template>
  78. </div>
  79. </template>
  80. <script>
  81. // 这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  82. // 例如:import 《组件名称》from ‘《组件路径》';
  83. export default {
  84. // import引入的组件需要注入到对象中才能使用
  85. components: {},
  86. props: ['data', 'type', 'changewordsResultList', 'openCheckSubtitles'],
  87. data() {
  88. // 这里存放数据
  89. return {
  90. oneHZshow: false,
  91. compareloading: false,
  92. wordData: null,
  93. index: null,
  94. };
  95. },
  96. // 计算属性 类似于data概念
  97. computed: {},
  98. // 监控data中数据变化
  99. watch: {},
  100. // 生命周期 - 创建完成(可以访问当前this实例)
  101. created() {},
  102. // 生命周期 - 挂载完成(可以访问DOM元素)
  103. mounted() {},
  104. // 生命周期-挂载之前
  105. beforeMount() {},
  106. // 生命周期-更新之后
  107. updated() {},
  108. // 如果页面有keep-alive缓存功能,这个函数会触发
  109. activated() {},
  110. // 方法集合
  111. methods: {
  112. changeTime(item, type) {
  113. item[type] = Number(item[type]);
  114. if (type == 'bg' || type == 'en') {
  115. item.adjust = '1';
  116. }
  117. },
  118. compareOneHZ(index) {
  119. // this.index = index;
  120. // this.wordData = JSON.parse(JSON.stringify(this.data[index].wordsResultList));
  121. // this.oneHZshow = true;
  122. this.openCheckSubtitles('文字', index);
  123. },
  124. savehz() {
  125. this.data[this.index].wordsResultList = JSON.parse(JSON.stringify(this.wordData));
  126. this.changewordsResultList(this.index, this.wordData);
  127. this.$message.success('保存成功');
  128. },
  129. handleClose() {
  130. this.index = null;
  131. this.wordData = null;
  132. this.oneHZshow = false;
  133. },
  134. },
  135. // 生命周期-创建之前
  136. beforeCreated() {},
  137. // 生命周期-更新之前
  138. beforUpdate() {},
  139. // 生命周期-销毁之前
  140. beforeDestory() {},
  141. // 生命周期-销毁完成
  142. destoryed() {},
  143. };
  144. </script>
  145. <style lang="scss" scoped>
  146. /* @import url(); 引入css类 */
  147. .CompareTime {
  148. .sentence {
  149. // display: flex;
  150. // align-items: center;
  151. margin-top: 15px;
  152. .time {
  153. margin-top: 15px;
  154. }
  155. }
  156. table {
  157. border-collapse: collapse;
  158. tr {
  159. > :nth-child(2) {
  160. text-align: center;
  161. }
  162. > :nth-child(3) {
  163. text-align: center;
  164. }
  165. td {
  166. height: 50px;
  167. border: 1px solid black;
  168. input {
  169. border: none;
  170. outline: none;
  171. }
  172. }
  173. th {
  174. height: 50px;
  175. border: 1px solid black;
  176. }
  177. }
  178. }
  179. }
  180. </style>