tab-reform.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <HcCard>
  3. <template #extra>
  4. <HcNewSwitch :datas="tabData" :keys="tabKey" @change="tabChange"/>
  5. </template>
  6. <HcTable ref="tableRef" :column="tableColumn" :datas="tableData" :loading="tableLoading"/>
  7. <template #action>
  8. <HcPages :pages="searchForm" @change="pageChange"/>
  9. </template>
  10. </HcCard>
  11. </template>
  12. <script setup>
  13. import {ref, nextTick, watch} from "vue";
  14. //参数
  15. const props = defineProps({
  16. projectId: {
  17. type: [String,Number],
  18. default: ''
  19. },
  20. contractId: {
  21. type: [String,Number],
  22. default: ''
  23. },
  24. treeData: {
  25. type: Object,
  26. default: () => ({})
  27. }
  28. })
  29. //变量
  30. const projectId = ref(props.projectId);
  31. const contractId = ref(props.contractId);
  32. const nodeData = ref(props.treeData);
  33. //监听
  34. watch(() => [
  35. props.treeData
  36. ], ([treeData]) => {
  37. nodeData.value = treeData;
  38. setQueryData(treeData)
  39. })
  40. //渲染完成
  41. nextTick(() => {
  42. setQueryData(props.treeData)
  43. })
  44. //获取相关数据
  45. const setQueryData = (data) => {
  46. /*const cid = data?.contractIdRelation || ''
  47. const wbsId = data['contractIdRelation'] ? data['id'] : data['primaryKeyId']
  48. if (wbsId) {
  49. searchInternalForm.value.contractId = cid ? cid : contractId.value;
  50. searchInternalForm.value.contractIdRelation = data['contractIdRelation']
  51. searchInternalForm.value.wbsIds = [wbsId]
  52. searchInternalClick()
  53. }*/
  54. }
  55. //搜索表单
  56. const searchForm = ref({
  57. current: 1, size: 20, total: 0
  58. })
  59. //tab数据和相关处理
  60. const tabKey = ref('tab1')
  61. const tabData = ref([
  62. {key:'tab1', name: '需要整改的文件'},
  63. {key:'tab2', name: '已整改记录'}
  64. ]);
  65. const tabChange = (item) => {
  66. tabKey.value = item?.key;
  67. }
  68. //分页被点击
  69. const pageChange = ({current, size}) => {
  70. searchForm.value.current = current
  71. searchForm.value.size = size
  72. getTableData()
  73. }
  74. //内业台账表头
  75. const tableRef = ref(null)
  76. const tableColumn = ref([
  77. {key:'key1', name: '所属案卷'},
  78. {key:'key2', name: '具体文件'},
  79. {key:'key3', name: '问题描述'}
  80. ])
  81. const tableData = ref([])
  82. //获取数据
  83. const tableLoading = ref(false)
  84. const getTableData = async () => {
  85. /*tableInternalLoading.value = true
  86. const {error, code, data} = await internalApi.queryInternalPage({
  87. ...searchInternalForm.value,
  88. projectId: projectId.value,
  89. })
  90. //判断状态
  91. tableInternalLoading.value = false
  92. if (!error && code === 200) {
  93. tableInternalData.value = getArrValue(data['records'])
  94. searchInternalForm.value.total = data['total'] || 0
  95. } else {
  96. tableInternalData.value = []
  97. searchInternalForm.value.total = 0
  98. }*/
  99. }
  100. </script>