多监测点修改

This commit is contained in:
仲么了
2024-02-29 10:31:32 +08:00
parent 0557e71dcb
commit 8175de04bb
4 changed files with 19 additions and 16 deletions

View File

@@ -14,7 +14,7 @@
></el-option>
</el-select>
<div style="flex: 1; overflow: hidden">
<Tree ref="c" :data="tree" style="width: 100%; height: 100%" :canExpand="false" v-bind="$attrs" />
<Tree ref="treeRef" :data="tree" style="width: 100%; height: 100%" :canExpand="false" v-bind="$attrs" />
</div>
</div>
</template>
@@ -37,7 +37,7 @@ const dictData = useDictData()
const config = useConfig()
const classificationData = dictData.getBasicData('Statistical_Type', ['Report_Type'])
const tree = ref()
const treRef = ref()
const treeRef = ref()
const formData = ref({
deptIndex: adminInfo.$state.deptIndex,
monitorFlag: 2,
@@ -48,10 +48,10 @@ const formData = ref({
statisticalType: classificationData[2].id,
scale: null
})
const loadData = (val: string) => {
const loadData = () => {
let obj = classificationData.find(function (i) {
return i.id === formData.value.statisticalType
})
}) || { code: '' }
let form = JSON.parse(JSON.stringify(formData.value))
form.statisticalType = classificationData.find((item: any) => item.id == form.statisticalType)
let nodeKey = ''
@@ -84,6 +84,7 @@ const loadData = (val: string) => {
nodeKey = item5.id
emit('init', item5)
}
item5.alias = `${item.name}>${item2.name}>${item3.name}>${item4.name}>${item5.name}`
item5.icon = 'fa-solid fa-location-dot'
item5.color = config.getColorVal('elementUiPrimary')
if (item5.comFlag === 0) {
@@ -101,8 +102,8 @@ const loadData = (val: string) => {
tree.value = res.data
if (nodeKey) {
nextTick(() => {
treRef.value.treeRef.setCurrentKey(nodeKey)
treRef.value.treeRef.setExpandedKeys(nodeKey)
treeRef.value.treeRef.setCurrentKey(nodeKey)
treeRef.value.treeRef.setExpandedKeys(nodeKey)
})
}
})

View File

@@ -1,6 +1,5 @@
import { reactive } from 'vue'
import { defineStore } from 'pinia'
interface MonitoringPoint {
lineId: string
lineName: string
@@ -21,9 +20,7 @@ export const useMonitoringPoint = defineStore(
state[key] = val
}
const setShowCheckBox = (val: boolean) => {
if (!val) {
state.lineIds = []
} else {
if (val && state.lineIds.length === 0) {
state.lineIds = [state.lineId]
}
state.showCheckBox = val
@@ -31,6 +28,8 @@ export const useMonitoringPoint = defineStore(
return { state, setValue, setShowCheckBox }
},
{
persist: true
persist: {
paths: ['state.lineId', 'state.lineName']
}
}
)

View File

@@ -39,7 +39,9 @@
<Shishishuju />
</el-tab-pane>
</el-tabs>
<div class="monitoring-point">当前位置{{ monitoringPoint.state.lineName }}</div>
<div class="monitoring-point" v-if="!monitoringPoint.state.showCheckBox">
当前位置{{ monitoringPoint.state.lineName }}
</div>
</div>
</pane>
</splitpanes>
@@ -80,11 +82,11 @@ onMounted(() => {
const handleNodeClick = (data: any, node: any) => {
if (data.level === 6) {
monitoringPoint.setValue('lineId', data.id)
monitoringPoint.setValue('lineName', data.alias)
}
}
const handleCheckChange = (data: any, node: any) => {
// let checkNodes = pointTree.value.getCheckedNodes()
// console.log(checkNodes)
console.log(data)
}
watch(
() => router.currentRoute.value.query.lineId,

View File

@@ -2,7 +2,7 @@
<div style="display: flex; flex-direction: column; height: 100%">
<el-form :inline="true">
<el-form-item label="多监测点">
<el-checkbox v-model="checked" @change="checkChange" />
<el-checkbox v-model="checked" @change="checkChange" />
</el-form-item>
<el-form-item label="日期">
<DatePicker ref="datePickerRef"></DatePicker>
@@ -25,7 +25,7 @@ import { getProbabilityDistribution } from '@/api/event-boot/monitor'
const datePickerRef = ref()
const monitoringPoint = useMonitoringPoint()
const checked = ref(false)
const checked = ref(monitoringPoint.state.showCheckBox)
const loading = ref(true)
const formData = reactive({
lineIndex: monitoringPoint.state.lineId,
@@ -38,6 +38,7 @@ const checkChange = () => {
monitoringPoint.setShowCheckBox(true)
} else {
monitoringPoint.setShowCheckBox(false)
init()
}
}
const init = () => {