154 lines
4.5 KiB
Vue
Raw Normal View History

<template>
2023-09-07 11:27:21 +08:00
<div class="leftTop">
2025-05-13 15:56:20 +08:00
<Card title="项目信息" headerIcon @edit="openDialog">
<div class="projectInfo" v-if="isCustom">
<div v-for="(item, index) in customList" :key="index">
<span>{{ item.name }}</span>
{{ item.content }}
</div>
</div>
<div class="projectInfo" v-else>
2023-10-17 18:13:53 +08:00
<div><span>项目名称</span> {{ projectData.projectName || "" }}</div>
<div :title="projectLocal"><span>项目地址</span> {{ projectLocal }}</div>
2023-10-17 18:13:53 +08:00
<div><span>项目经理</span> {{ projectData.projectManage || "" }}</div>
<div><span>联系电话</span> {{ projectData.projectTel || "" }}</div>
2025-10-28 15:18:17 +08:00
<div v-if="COMPANY == 'gsgs'"><span>桥梁长度(m)</span> {{ projectData.bridgeLength || "" }}</div>
<div v-else><span>建筑面积</span> {{ projectData.projectAcreage || "" }} </div>
2023-10-17 18:13:53 +08:00
<div><span>开工日期</span> {{ projectData.startWorkDate || "" }}</div>
<div><span>项目编号</span> {{ projectData.projectNumber || "" }}</div>
2025-05-13 15:56:20 +08:00
<div>
<span>工程类别</span>
{{
projectData.projectType && projectTypeEnumList.length > 0 ? projectTypeEnumList[projectData.projectType - 1].name : ""
}}
</div>
2023-12-08 18:34:22 +08:00
</div>
<!-- <div class="projectInfo">
<div><span>建设地点</span> 南平市建阳区</div>
<div><span>变电容量</span> 2x50兆伏安</div>
<div><span>间隔名称</span> 110千伏江坑问隔</div>
<div><span>架空线路</span> 67.49公里</div>
<div><span>电缆长度</span> 0.31公里</div>
<div><span>通讯光缆</span> 74.79公里</div>
<div><span>总投资</span> 11762万元</div>
2023-12-08 18:34:22 +08:00
</div> -->
2023-09-07 11:27:21 +08:00
</Card>
2025-05-13 15:56:20 +08:00
<projectInfoDialog ref="projectInfoDialogRef" @refresh="getLargeScreenConfig"></projectInfoDialog>
2023-09-07 11:27:21 +08:00
</div>
</template>
<script setup lang="ts">
2023-09-07 11:27:21 +08:00
import Card from "@/components/card.vue";
import { GlobalStore } from "@/stores";
2025-05-13 15:56:20 +08:00
import { ref, onMounted, watch, computed } from "vue";
2024-04-01 18:54:18 +08:00
import { getStageOption } from "@/api/modules/projectOverview";
2025-05-13 15:56:20 +08:00
import { queryByProject } from "@/api/modules/config";
import projectInfoDialog from "./projectInfoDialog.vue";
2025-10-28 15:18:17 +08:00
import { COMPANY } from "@/config/config";
2025-05-13 15:56:20 +08:00
const customList = computed(() => {
let { list } = JSON.parse(customData.value?.configValue || "{}");
return list;
});
// ts
type Props = {
projectData?: any; // 传入项目信息
};
// withDefaults 定义默认值(传入的数据类型同默认值)
const props = withDefaults(defineProps<Props>(), {
2023-10-17 18:13:53 +08:00
projectData: {}
});
// 项目信息
2023-10-17 18:13:53 +08:00
const projectData = ref({} as any);
2025-05-13 15:56:20 +08:00
const projectInfoDialogRef = ref();
const customData = ref(null);
const isCustom = ref(false as any);
const projectLocal = ref("" as any);
2024-04-01 18:54:18 +08:00
const store = GlobalStore();
2025-05-13 15:56:20 +08:00
const projectTypeEnumList: any = ref([]); //工程类别
2024-04-01 18:54:18 +08:00
// 工程类别字典数据
const projectTypeEnum = async () => {
const res: any = await getStageOption({ dictionaryEncoding: "project_type", projectSn: store.sn });
if (res.result.length > 0) {
let newArray = res.result.map((item: any) => {
return {
name: item.name,
id: Number(item.data)
};
});
2025-05-13 15:56:20 +08:00
projectTypeEnumList.value = newArray;
2024-04-01 18:54:18 +08:00
} else {
2025-05-13 15:56:20 +08:00
projectTypeEnumList.value = [];
}
};
const getLargeScreenConfig = async () => {
const res: any = await queryByProject({ configKey: "project_info", projectSn: store.sn });
console.log(res, "res");
if (res.code === 200) {
const { isCustom: curIsCustom } = JSON.parse(res.result?.configValue || "{}");
isCustom.value = curIsCustom;
customData.value = res.result;
2024-04-01 18:54:18 +08:00
}
};
2025-05-13 15:56:20 +08:00
const openDialog = () => {
projectInfoDialogRef.value.openDialog(customData.value);
};
2024-04-13 11:08:23 +08:00
//将方法暴露给父组件
defineExpose({
projectTypeEnum
2025-05-13 15:56:20 +08:00
});
onMounted(async () => {
2024-04-13 11:08:23 +08:00
await projectTypeEnum();
2025-05-13 15:56:20 +08:00
await getLargeScreenConfig();
});
watch(
() => props.projectData,
newVal => {
// console.log(newVal, "newVal");
if (newVal) {
// props.xData = newVal;
projectData.value = newVal;
projectLocal.value =
projectData.value.provinceName +
projectData.value.cityName +
projectData.value.areaName +
projectData.value.projectAddress;
}
}
);
</script>
2023-09-07 11:27:21 +08:00
<style lang="scss" scoped>
.leftTop {
width: 100%;
height: 100%;
.projectInfo {
width: 100%;
height: 100%;
color: #fff;
padding: 2% 0 0 4%;
2023-09-07 11:27:21 +08:00
div {
width: 95%;
height: 12%;
font-size: 15px;
white-space: nowrap; //单行
overflow: hidden;
text-overflow: ellipsis;
span {
margin-right: 3%;
color: #ccc;
}
2023-09-07 11:27:21 +08:00
}
}
}
::v-deep .h-card .content {
height: 80%;
}
::v-deep .h-card {
position: relative;
}
</style>