record.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <div class="">
  3. <el-dialog
  4. v-model="show"
  5. :title="$t(prefix + 'dialog_title_record')"
  6. :close-on-click-modal="false"
  7. :close-on-press-escape="false"
  8. :before-close="close"
  9. width="550px"
  10. >
  11. <el-table
  12. v-loading="loading"
  13. :data="record"
  14. >
  15. <el-table-column
  16. width="180"
  17. :label="$t(prefix + 'label_audit_time')"
  18. prop="create_time"
  19. ></el-table-column>
  20. <el-table-column
  21. :label="$t(prefix + 'label_audit_operator')"
  22. prop="admin_name"
  23. ></el-table-column>
  24. <el-table-column :label="$t(prefix + 'label_audit_result')">
  25. <template #default="scope">
  26. <div>{{ getStatusLabel(scope.row.status) }}</div>
  27. </template>
  28. </el-table-column>
  29. <el-table-column
  30. :label="$t(prefix + 'label_feedback')"
  31. prop="feedback"
  32. ></el-table-column>
  33. </el-table>
  34. </el-dialog>
  35. </div>
  36. </template>
  37. <script lang="ts" setup>
  38. import { defineComponent, ref, watch } from 'vue'
  39. import { ElDialog, ElTable, ElTableColumn } from 'element-plus'
  40. import { getExamineRecord } from '@/api/supplier'
  41. import { $t } from '@/i18n/index'
  42. defineComponent({
  43. name: 'DialogExamineRecord',
  44. })
  45. const {
  46. visible = false,
  47. id = '',
  48. statusList = [],
  49. } = defineProps<{
  50. visible: boolean
  51. id: number | string
  52. statusList: any[]
  53. }>()
  54. const $emit = defineEmits(['update:visible'])
  55. let show = ref(false)
  56. let loading = ref(false)
  57. let record = ref([] as any[])
  58. const prefix = 'order.product.'
  59. watch(
  60. () => visible,
  61. () => {
  62. show.value = visible
  63. if (show.value) getRecord()
  64. },
  65. )
  66. const getStatusLabel = (value: any) => {
  67. const temp: any[] = statusList.filter((i: any) => i.value === value)
  68. return temp.length ? temp[0].label : '-'
  69. }
  70. const getRecord = () => {
  71. loading.value = true
  72. getExamineRecord({ supplier_id: id })
  73. .then((res: any) => {
  74. if (res.code !== 1) {
  75. return
  76. }
  77. if (Array.isArray(res.result)) {
  78. record.value = res.result
  79. }
  80. })
  81. .finally(() => {
  82. loading.value = false
  83. })
  84. }
  85. let close = (done = {} as any) => {
  86. $emit('update:visible', false)
  87. if (typeof done === 'function') done()
  88. }
  89. </script>