info.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <div class="hc-contract-info-data">
  3. <hc-card-item title="基础信息">
  4. 内容区域
  5. </hc-card-item>
  6. <hc-card-item class="mt-14px" title="组卷归档默认信息">
  7. 内容区域
  8. </hc-card-item>
  9. <hc-card-item class="mt-14px" title="附加信息">
  10. 内容区域
  11. </hc-card-item>
  12. <hc-card-item class="mt-14px" title="计量信息">
  13. 内容区域
  14. </hc-card-item>
  15. </div>
  16. </template>
  17. <script setup>
  18. import { onMounted, ref, watch } from 'vue'
  19. import { getObjValue, isNullES } from 'js-fast-way'
  20. import { getDictionaryData } from '~uti/tools'
  21. //请求接口
  22. import mainApi from '~api/project/contract'
  23. import projectApi from '~api/project/project'
  24. const props = defineProps({
  25. data: {
  26. type: Object,
  27. default: () => ({}),
  28. },
  29. })
  30. //渲染完成
  31. onMounted(() => {
  32. getDataApi()
  33. })
  34. //监听数据
  35. const dataInfo = ref(props.data)
  36. watch(() => props.data, (data) => {
  37. dataInfo.value = data
  38. getDataApi()
  39. }, { deep: true })
  40. //获取数据
  41. const getDataApi = async () => {
  42. const { cid, type } = getObjValue(dataInfo.value)
  43. await getContractTypeList()
  44. if (!isNullES(cid)) {
  45. if ([1, 4, 8].includes(type)) {
  46. await getContractInfo()
  47. } else if ([2, 3].includes(type)) {
  48. await getContractInfo2()
  49. await getContractRelation()
  50. }
  51. }
  52. await getProjectDeatil()
  53. getStoragePeriodList().then()
  54. getSecurityLevelList().then()
  55. }
  56. //获取项目详情
  57. const projectInfo = ref({})
  58. const getProjectDeatil = async () => {
  59. const { pid } = getObjValue(dataInfo.value)
  60. contractForm.value = {}
  61. if (isNullES(pid)) return
  62. const { data } = await projectApi.detail(pid)
  63. projectInfo.value = getObjValue(data)
  64. }
  65. //获取合同类型
  66. const contractTypeList = ref([])
  67. const getContractTypeList = async () => {
  68. contractTypeList.value = await getDictionaryData('contract_type')
  69. }
  70. //获取合同段基本信息
  71. const contractForm = ref({})
  72. const getContractInfo = async () => {
  73. const { cid } = getObjValue(dataInfo.value)
  74. contractForm.value = {}
  75. if (isNullES(cid)) return
  76. const { data } = await mainApi.detail(cid)
  77. contractForm.value = getObjValue(data)
  78. }
  79. //获取合同段基本信息
  80. const getContractInfo2 = async () => {
  81. const { cid, type } = getObjValue(dataInfo.value)
  82. contractForm.value = {}
  83. if (isNullES(cid)) return
  84. const { data } = await mainApi.detail2({
  85. id: cid,
  86. contractType: type,
  87. })
  88. contractForm.value = getObjValue(data)
  89. }
  90. //监理、业主关联施工
  91. const getContractRelation = async () => {
  92. const { cid } = getObjValue(dataInfo.value)
  93. if (isNullES(cid)) return
  94. const { data } = await projectApi.getContractRelation(cid)
  95. console.log(data)
  96. }
  97. //获取业务字典
  98. const storagePeriods = ref([])
  99. const getStoragePeriodList = async () => {
  100. storagePeriods.value = await getDictionaryData('storage_period', true)
  101. }
  102. //获取安全等级
  103. const securityLevels = ref([])
  104. const getSecurityLevelList = async () => {
  105. securityLevels.value = await getDictionaryData('security_level', true)
  106. }
  107. </script>
  108. <style scoped lang="scss">
  109. </style>