123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <template>
- <div class="hc-contract-info-data">
- <hc-card-item title="基础信息">
- 内容区域
- </hc-card-item>
- <hc-card-item class="mt-14px" title="组卷归档默认信息">
- 内容区域
- </hc-card-item>
- <hc-card-item class="mt-14px" title="附加信息">
- 内容区域
- </hc-card-item>
- <hc-card-item class="mt-14px" title="计量信息">
- 内容区域
- </hc-card-item>
- </div>
- </template>
- <script setup>
- import { onMounted, 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: () => ({}),
- },
- })
- //渲染完成
- onMounted(() => {
- getDataApi()
- })
- //监听数据
- const dataInfo = ref(props.data)
- watch(() => props.data, (data) => {
- dataInfo.value = data
- getDataApi()
- }, { deep: true })
- //获取数据
- const getDataApi = async () => {
- const { cid, type } = getObjValue(dataInfo.value)
- 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()
- getStoragePeriodList().then()
- getSecurityLevelList().then()
- }
- //获取项目详情
- const projectInfo = ref({})
- const getProjectDeatil = async () => {
- const { pid } = getObjValue(dataInfo.value)
- contractForm.value = {}
- if (isNullES(pid)) return
- const { data } = await projectApi.detail(pid)
- projectInfo.value = getObjValue(data)
- }
- //获取合同类型
- 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 storagePeriods = ref([])
- const getStoragePeriodList = async () => {
- storagePeriods.value = await getDictionaryData('storage_period', true)
- }
- //获取安全等级
- const securityLevels = ref([])
- const getSecurityLevelList = async () => {
- securityLevels.value = await getDictionaryData('security_level', true)
- }
- </script>
- <style scoped lang="scss">
- </style>
|