table-opinion.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <HcTable ui="no-border" is-new :index-style="{ width: 60 }" :column="tableColumn" :datas="tableData" :loading="tableLoading">
  3. <template #opinion="{ row }">
  4. <span class="text-blue text-hover" @click="opinionClick(row)">{{ row.opinion }}</span>
  5. </template>
  6. </HcTable>
  7. </template>
  8. <script setup>
  9. import { onMounted, ref, watch } from 'vue'
  10. import { getArrValue } from 'js-fast-way'
  11. import initialgApi from '~api/initial/initial'
  12. //参数
  13. const props = defineProps({
  14. projectId: {
  15. type: [String, Number],
  16. default: '',
  17. },
  18. contractId: {
  19. type: [String, Number],
  20. default: '',
  21. },
  22. currentId:{
  23. type: [String, Number],
  24. default: '',
  25. },
  26. })
  27. //事件
  28. const emit = defineEmits(['opinionTap'])
  29. //变量
  30. const projectId = ref(props.projectId)
  31. const contractId = ref(props.contractId)
  32. const currentId = ref(props.currentId)
  33. //渲染完成
  34. onMounted(() => {
  35. getTableData()
  36. })
  37. //监听
  38. watch(() => [
  39. props.currentId,
  40. ], ([cuId]) => {
  41. currentId.value = cuId
  42. })
  43. //表格数据
  44. const tableColumn = ref([
  45. { key:'expertName', name: '专家', width: 80 },
  46. { key:'unitName', name: '抽检所属', width: 100 },
  47. { key:'opinion', name: '抽检意见' },
  48. ])
  49. const tableData = ref([])
  50. const tableLoading = ref(false)
  51. const getTableData = async () => {
  52. tableLoading.value = true
  53. const { error, code, data } = await initialgApi.getUserInspectInfo2({
  54. current:1,
  55. size:10000,
  56. projectId: projectId.value,
  57. conclusionId:currentId.value,
  58. })
  59. tableLoading.value = false
  60. if (!error && code === 200) {
  61. tableData.value = getArrValue(data['records'])
  62. } else {
  63. tableData.value = []
  64. }
  65. }
  66. //编辑
  67. const editClick = (row) => {
  68. row.isEdit = true
  69. }
  70. //保存
  71. const saveClick = (row) => {
  72. row.isEdit = false
  73. }
  74. //删除
  75. const delClick = (row) => {
  76. }
  77. //查看意见
  78. const opinionClick = (row) => {
  79. emit('opinionTap', row)
  80. }
  81. </script>
  82. <style lang="scss" scoped>
  83. </style>