8
0

detail.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <hc-drawer v-model="isShow" to-id="hc-project-list" is-close @close="drawerClose">
  3. <div class="hc-contract-info-drawer relative h-full">
  4. <hc-tab-card :scrollbar="tabsKey === '1'" :tabs="tabsData" :tab-key="tabsKey" is-action-btn @change="tabsChange">
  5. 111111
  6. </hc-tab-card>
  7. </div>
  8. </hc-drawer>
  9. </template>
  10. <script setup>
  11. import { ref, watch } from 'vue'
  12. import { getObjValue, isNullES } from 'js-fast-way'
  13. import { getDictionaryData } from '~uti/tools'
  14. import mainApi from '~api/project/contract'
  15. const props = defineProps({
  16. data: {
  17. type: Object,
  18. default: () => ({}),
  19. },
  20. })
  21. //事件
  22. const emit = defineEmits(['close'])
  23. //双向绑定
  24. const isShow = defineModel('modelValue', {
  25. default: false,
  26. })
  27. //监听数据
  28. const dataInfo = ref(props.data)
  29. watch(() => props.data, (data) => {
  30. dataInfo.value = data
  31. }, { immediate: true, deep: true })
  32. //监听显示
  33. watch(isShow, (val) => {
  34. if (val) getDataApi()
  35. })
  36. //处理相关数据
  37. const tabsKey = ref('1')
  38. const tabsData = ref([])
  39. const getDataApi = async () => {
  40. const { cid, type, tab } = getObjValue(dataInfo.value)
  41. if (isNullES(cid)) {
  42. tabsData.value = [{ key: '1', name: '合同段信息' }]
  43. } else {
  44. tabsData.value = [{ key: '1', name: '合同段信息' }, { key: '2', name: '分配WBS' }, { key: '3', name: '分配项目人员' }]
  45. }
  46. await getContractTypeList()
  47. if (!isNullES(cid)) {
  48. if ([1, 4, 8].includes(type)) {
  49. await getContractInfo()
  50. } else if ([2, 3].includes(type)) {
  51. await getContractInfo2()
  52. await getContractRelation()
  53. }
  54. }
  55. await getProjectDeatil()
  56. if (!isNullES(tab)) {
  57. tabsKey.value = tab
  58. }
  59. getStoragePeriodList()
  60. getSecurityLevelList()
  61. setHeaders()
  62. }
  63. //获取项目详情
  64. const getProjectDeatil = async () => {
  65. //mainApi
  66. }
  67. //获取合同类型
  68. const contractTypeList = ref([])
  69. const getContractTypeList = async () => {
  70. contractTypeList.value = await getDictionaryData('contract_type')
  71. }
  72. //获取合同段基本信息
  73. const contractForm = ref({})
  74. const getContractInfo = async () => {
  75. const { cid } = getObjValue(dataInfo.value)
  76. contractForm.value = {}
  77. if (isNullES(cid)) return
  78. const { data } = await mainApi.detail(cid)
  79. contractForm.value = getObjValue(data)
  80. }
  81. //获取合同段基本信息
  82. const getContractInfo2 = async () => {
  83. }
  84. //监理、业主关联施工
  85. const getContractRelation = async () => {
  86. }
  87. //获取业务字典
  88. const getStoragePeriodList = async () => {
  89. }
  90. //获取安全等级
  91. const getSecurityLevelList = async () => {
  92. }
  93. const setHeaders = async () => {
  94. }
  95. //选项卡
  96. const tabsChange = ({ key }) => {
  97. tabsKey.value = key
  98. }
  99. //关闭抽屉
  100. const drawerClose = () => {
  101. isShow.value = false
  102. tabsKey.value = '1'
  103. emit('close')
  104. }
  105. </script>
  106. <style lang="scss">
  107. .hc-contract-info-drawer {
  108. }
  109. </style>