detail.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 mainApi from '~api/project/project'
  13. import { getObjValue, isNullES } from 'js-fast-way'
  14. import { getDictionaryData } from '~uti/tools'
  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 basicForm = ref({ pid: '' })
  40. const getDataApi = async () => {
  41. const { pid, cid, type } = getObjValue(dataInfo.value)
  42. if (isNullES(cid)) {
  43. tabsData.value = [{ key: '1', name: '合同段信息' }]
  44. } else {
  45. tabsData.value = [{ key: '1', name: '合同段信息' }, { key: '2', name: '分配WBS' }, { key: '3', name: '分配项目人员' }]
  46. }
  47. await getContractTypeList()
  48. if (isNullES(cid)) {
  49. basicForm.value.pid = pid
  50. } else {
  51. console.log(type)
  52. }
  53. console.log(basicForm.value)
  54. }
  55. //获取合同类型
  56. const contractTypeList = ref([])
  57. const getContractTypeList = async () => {
  58. contractTypeList.value = await getDictionaryData('contract_type')
  59. }
  60. //选项卡
  61. const tabsChange = ({ key }) => {
  62. tabsKey.value = key
  63. }
  64. //关闭抽屉
  65. const drawerClose = () => {
  66. isShow.value = false
  67. emit('close')
  68. }
  69. </script>
  70. <style lang="scss">
  71. .hc-contract-info-drawer {
  72. }
  73. </style>