ReviewAssets.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <schema-table :schema="schema">
  3. <div
  4. v-if="more"
  5. class="l-flex__none l-flex--row has-top-padding"
  6. >
  7. <div class="l-flex__auto" />
  8. <button
  9. class="l-flex__none c-sibling-item o-button"
  10. @click="onNext"
  11. >
  12. {{ btnMsg }}
  13. </button>
  14. </div>
  15. <preview-dialog ref="previewDialog" />
  16. </schema-table>
  17. </template>
  18. <script>
  19. import {
  20. State,
  21. AssetType
  22. } from '@/constant'
  23. import {
  24. parseByte,
  25. parseDuration
  26. } from '@/utils'
  27. import mixin from './mixin'
  28. export default {
  29. name: 'WorkflowReviewAssets',
  30. mixins: [mixin],
  31. data () {
  32. return {
  33. type: 'minio'
  34. }
  35. },
  36. computed: {
  37. schema () {
  38. return {
  39. condition: { pageSize: this.list.length },
  40. list: this.getList,
  41. cols: [
  42. { prop: 'typeName', label: '类型', align: 'center', width: 80 },
  43. { prop: 'file', type: 'asset', on: this.onViewAsset },
  44. { prop: 'originalName', label: '' },
  45. { prop: 'duration', label: '时长' },
  46. { prop: 'size', label: '文件大小' },
  47. { prop: 'ai', label: 'AI审核', type: 'tag', width: 100 },
  48. ...this.reviewCol
  49. ]
  50. }
  51. }
  52. },
  53. created () {
  54. this.list = this.transform(this.workflow.minios)
  55. if (!this.list.some(({ pass }) => !pass)) {
  56. this.$emit('next')
  57. }
  58. },
  59. methods: {
  60. transform (arr) {
  61. return arr.map(this.transformItem).sort((a, b) => {
  62. if (a.file.type === b.file.type) {
  63. return a.status - b.status
  64. }
  65. return a.file.type - b.file.type
  66. })
  67. },
  68. transformItem (asset) {
  69. let thumbnail
  70. if (asset.type === AssetType.IMAGE) {
  71. thumbnail = asset.keyName
  72. } else if (asset.type === AssetType.VIDEO && asset.screenshot !== 'analyzing') {
  73. thumbnail = asset.screenshot
  74. }
  75. return {
  76. pass: asset.status !== State.SUBMITTED,
  77. id: asset.keyName,
  78. typeName: [null, '图片', '视频', '音频', 'PPT', 'PDF'][asset.type],
  79. file: {
  80. type: asset.type,
  81. url: asset.keyName,
  82. thumbnail,
  83. files: (asset.childrenData || []).map(({ type, keyName }) => {
  84. return { type, url: keyName }
  85. })
  86. },
  87. duration: parseDuration(asset.duration),
  88. size: parseByte(asset.size),
  89. ai: this.getAIState(asset),
  90. status: asset.status
  91. }
  92. },
  93. getAIState ({ aiAuditState: status, aiAuditMsg: msg }) {
  94. switch (status) {
  95. case 1:
  96. return {
  97. type: 'danger',
  98. label: '不合规'
  99. }
  100. case 2:
  101. return {
  102. type: 'warning',
  103. label: '疑似',
  104. msg
  105. }
  106. case 3:
  107. return {
  108. type: 'info',
  109. label: '审核失败',
  110. msg
  111. }
  112. case 4:
  113. case 5:
  114. case 6:
  115. return {
  116. type: 'primmary',
  117. label: '审核中'
  118. }
  119. case 7:
  120. return {
  121. type: 'success',
  122. label: '通过'
  123. }
  124. case 8:
  125. return {
  126. type: 'info',
  127. label: '无法审核',
  128. msg
  129. }
  130. case 9:
  131. return {
  132. type: 'info',
  133. label: '未开启'
  134. }
  135. default:
  136. return null
  137. }
  138. },
  139. onViewAsset (asset) {
  140. this.$refs.previewDialog.show(asset)
  141. },
  142. onView ({ file }) {
  143. this.onViewAsset(file)
  144. }
  145. }
  146. }
  147. </script>