tsg-app/pages/skInfo/detail/tzcs.vue

250 lines
7.1 KiB
Vue
Raw Normal View History

2024-11-15 10:03:41 +08:00
<template>
<view class="basic-box">
<view class="basic-data-select">
2024-11-15 16:40:47 +08:00
<uni-data-select v-model="selectValue" :localdata="range" @change="selectChage" :clear="false">
</uni-data-select>
2024-11-15 10:03:41 +08:00
</view>
<view class="project-des">
2024-11-15 16:40:47 +08:00
<view v-for="(item,index) in tableData" :key="index" :style="index % 2 == 0 ? 'width:50%;':'width:50%;'">
2024-11-15 10:03:41 +08:00
<view style="display:flex;align-items:center;margin:15px 0px;">
<view class="circle-dot"></view>
<view class="label-name">
<text style="opacity:0.5;text-align: center;">{{item.name}}</text>
<text>{{item.value||"-"}}</text>
</view>
2024-11-13 09:42:42 +08:00
</view>
</view>
</view>
2024-11-15 10:03:41 +08:00
</view>
2024-11-13 09:42:42 +08:00
</template>
<script>
2024-11-15 16:40:47 +08:00
import selectData from "../../staticData"
const gmObj = {
"1": "大 (1)型",
"2": "大 (2)型",
"3": "中型",
"4": "小 (1)型",
"5": "小 (2)型",
"9": "其他",
}
const qdObj = {
1: "",
2: "Ⅱ",
3: "Ⅲ",
4: "Ⅳ",
5: "VI ",
}
2024-11-15 10:03:41 +08:00
export default {
props: {
skInfo: {
type: Object,
default: {}
2024-11-22 17:44:00 +08:00
},
value:{
type: String,
default:''
2024-11-15 10:03:41 +08:00
}
},
data() {
return {
list: selectData[0],
range: [{
value: 0,
text: "水库"
},
{
value: 1,
text: "主坝"
},
{
value: 2,
text: "副坝"
},
{
value: 3,
text: "溢洪道"
},
{
value: 4,
text: "灌溉发电洞"
},
{
value: 5,
text: "放空洞"
},
{
value: 6,
text: "拦洪坝"
},
{
value: 7,
text: "防汛道路"
}
],
2024-11-15 16:40:47 +08:00
selectValue: 0,
keyObj: {}
2024-11-15 10:03:41 +08:00
}
},
methods: {
selectChage(e) {
2024-11-15 16:40:47 +08:00
console.log("e",e);
this.selectValue = e
2024-11-15 10:03:41 +08:00
this.list = selectData[e]
2024-11-15 16:40:47 +08:00
if (e == 0) {
this.keyObj = this.skInfo;
2025-04-18 13:53:13 +08:00
}else{
this.getOtherData()
}
// else if (e == 1 || e == 2 || e == 6) {
// this.getDbData(e)
// } else if (e == 3) {
// this.getyhdData()
// } else if (e == 4 || e == 5) {
// this.getfdData(e)
// } else {
// this.getfxdData(e)
// }
},
async getOtherData() {
try {
const {
data
} = await uni.$http.get('/gunshiApp/tsg/attResBuilding/info')
if (data.code == 200) {
this.keyObj = data.data
}
} catch (error) {
2024-11-15 16:40:47 +08:00
}
},
2025-04-18 13:53:13 +08:00
2024-11-15 16:40:47 +08:00
// 主坝,副坝,拦洪坝
async getDbData(e) {
try {
const {
data
} = await uni.$http.post('/gunshiApp/tsg/attDamBase/list')
if (data.code == 200) {
if (e == 1) {
this.keyObj = data.data.find(item => item.isMain == 1)
} else if (e == 2) {
this.keyObj = data.data.find(item => item.isMain == 0)
} else {
this.keyObj = data.data.find(item => item.isMain == 2)
}
}
} catch (error) {
}
},
// 溢洪道
async getyhdData(e) {
try {
const {
data
} = await uni.$http.post('/gunshiApp/tsg/attSpillwayBase/list')
if (data.code == 200) {
this.keyObj = data.data[0]
}
} catch (error) {
}
},
// 灌溉发电洞 放空洞
async getfdData(e) {
try {
const params = e == 5 ? 1 : 2;
const {
data
} = await uni.$http.get('/gunshiApp/tsg/resTunnel/list',{type:params})
if (data.code == 200) {
this.keyObj = data.data[0]
}
} catch (error) {
}
},
// 防汛道路
async getfxdData(e) {
try {
const {
data
} = await uni.$http.post('/gunshiApp/tsg/resFloodRoad/list')
if (data.code == 200) {
this.keyObj = data.data[0]
}
} catch (error) {
}
2024-11-15 10:03:41 +08:00
}
},
computed: {
tableData() {
return this.list.map(item => {
2024-11-15 16:40:47 +08:00
if (item.key == "engScal") {
this.keyObj[item.key] = gmObj[this.skInfo[item.key]]
}
if (item.key == "seismicIntensity") {
this.keyObj[item.key] = qdObj[this.skInfo[item.key]]
}
2024-11-15 10:03:41 +08:00
return {
name: item.name,
2024-11-15 16:40:47 +08:00
value: this.keyObj[item.key]
2024-11-15 10:03:41 +08:00
}
})
}
},
2024-11-15 16:40:47 +08:00
mounted() {
2024-11-22 17:44:00 +08:00
this.keyObj = this.skInfo;
if(this.value){
this.selectChage(this.value - 0)
}
2024-11-15 16:40:47 +08:00
},
2024-11-13 09:42:42 +08:00
}
</script>
<style lang="scss">
2024-11-15 10:03:41 +08:00
.basic-box {
display: flex;
flex-direction: column;
}
.basic-data-select {
width: 40%;
margin-top: 10px;
margin-left: auto;
margin-bottom: 10px;
margin-right: 10px;
}
.project-des {
display: flex;
flex-wrap: wrap;
border: 1px solid #f2f2f2;
background-color: #ffffff;
padding: 0 10px;
max-height: calc(100vh - 190px);
overflow: auto;
.circle-dot {
width: 10px;
height: 10px;
border-radius: 50%;
background-color: #409eff;
margin-left: 10px;
}
.label-name {
2024-11-13 09:42:42 +08:00
display: flex;
2024-11-15 10:03:41 +08:00
flex-direction: column;
align-items: center;
flex: 1
2024-11-13 09:42:42 +08:00
}
2024-11-15 10:03:41 +08:00
}
2024-11-13 09:42:42 +08:00
</style>