123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <template>
- <hc-drawer v-model="isShow" to-id="hc-project-list" is-close @close="drawerClose">
- <div class="hc-contract-info-drawer relative h-full">
- <hc-tab-card :scrollbar="tabsKey === '1'" :tabs="tabsData" :tab-key="tabsKey" is-action-btn @change="tabsChange">
- 111111
- </hc-tab-card>
- </div>
- </hc-drawer>
- </template>
- <script setup>
- import { ref, watch } from 'vue'
- import { getObjValue, isNullES } from 'js-fast-way'
- import { getDictionaryData } from '~uti/tools'
- import mainApi from '~api/project/contract'
- import projectApi from '~api/project/project'
- const props = defineProps({
- data: {
- type: Object,
- default: () => ({}),
- },
- })
- //事件
- const emit = defineEmits(['close'])
- //双向绑定
- const isShow = defineModel('modelValue', {
- default: false,
- })
- //监听数据
- const dataInfo = ref(props.data)
- watch(() => props.data, (data) => {
- dataInfo.value = data
- }, { immediate: true, deep: true })
- //监听显示
- watch(isShow, (val) => {
- if (val) getDataApi()
- })
- //处理相关数据
- const tabsKey = ref('1')
- const tabsData = ref([])
- const getDataApi = async () => {
- const { cid, type, tab } = getObjValue(dataInfo.value)
- if (isNullES(cid)) {
- tabsData.value = [{ key: '1', name: '合同段信息' }]
- } else {
- tabsData.value = [{ key: '1', name: '合同段信息' }, { key: '2', name: '分配WBS' }, { key: '3', name: '分配项目人员' }]
- }
- await getContractTypeList()
- if (!isNullES(cid)) {
- if ([1, 4, 8].includes(type)) {
- await getContractInfo()
- } else if ([2, 3].includes(type)) {
- await getContractInfo2()
- await getContractRelation()
- }
- }
- await getProjectDeatil()
- if (!isNullES(tab)) {
- tabsKey.value = tab
- }
- getStoragePeriodList()
- getSecurityLevelList()
- setHeaders()
- }
- //获取项目详情
- const getProjectDeatil = async () => {
- //mainApi
- }
- //获取合同类型
- const contractTypeList = ref([])
- const getContractTypeList = async () => {
- contractTypeList.value = await getDictionaryData('contract_type')
- }
- //获取合同段基本信息
- const contractForm = ref({})
- const getContractInfo = async () => {
- const { cid } = getObjValue(dataInfo.value)
- contractForm.value = {}
- if (isNullES(cid)) return
- const { data } = await mainApi.detail(cid)
- contractForm.value = getObjValue(data)
- }
- //获取合同段基本信息
- const getContractInfo2 = async () => {
- const { cid, type } = getObjValue(dataInfo.value)
- contractForm.value = {}
- if (isNullES(cid)) return
- const { data } = await mainApi.detail2({
- id: cid,
- contractType: type,
- })
- contractForm.value = getObjValue(data)
- }
- //监理、业主关联施工
- const getContractRelation = async () => {
- const { cid } = getObjValue(dataInfo.value)
- if (isNullES(cid)) return
- const { data } = await projectApi.getContractRelation(cid)
- console.log(data)
- }
- //获取业务字典
- const getStoragePeriodList = async () => {
- }
- //获取安全等级
- const getSecurityLevelList = async () => {
- }
- const setHeaders = async () => {
- }
- //选项卡
- const tabsChange = ({ key }) => {
- tabsKey.value = key
- }
- //关闭抽屉
- const drawerClose = () => {
- isShow.value = false
- tabsKey.value = '1'
- emit('close')
- }
- </script>
- <style lang="scss">
- .hc-contract-info-drawer {
- }
- </style>
|