Commit aef8515a authored by 郭铭瑶's avatar 郭铭瑶 🤘

根据年份更改数据

parent 9a2581fd
...@@ -30,7 +30,7 @@ export interface GlobalStateProps { ...@@ -30,7 +30,7 @@ export interface GlobalStateProps {
pubulicSafeBuildings: unknown[] pubulicSafeBuildings: unknown[]
pubulicSafePieData: unknown[] pubulicSafePieData: unknown[]
pubulicSafeNewFindNum: { [key: string]: number } pubulicSafeNewFindNum: { [key: string]: number }
pubulicSafeOutHouseWall: unknown[] pubulicSafeOutHouseWall: any[]
} }
export default createStore<GlobalStateProps>({ export default createStore<GlobalStateProps>({
state, state,
......
...@@ -146,12 +146,26 @@ export default defineComponent({ ...@@ -146,12 +146,26 @@ export default defineComponent({
const year = ref('2020') //年份 const year = ref('2020') //年份
const yearOptions = ref(['2020', '2019']) //年份option const yearOptions = ref(['2020', '2019']) //年份option
const houseSum = ref([ const houseSum = ref([
{ name: '检查楼数', value: 0 }, { name: '检查楼数', value: 0 },
{ name: '隐患点数', value: 0 }, { name: '隐患点数', value: 0 },
{ name: '危险点数', value: 0 }, { name: '危险点数', value: 0 },
]) ])
watch(
[() => outHouseWall.value, () => year.value],
([data, year]) => {
if (data.length === 0) return
const { checkNum = 0, hiddenPoint = 0, dangerPoint = 0 } = data.find(
(e: any) => e.year === year
)
houseSum.value = [
{ name: '检查楼数', value: checkNum },
{ name: '隐患点数', value: hiddenPoint },
{ name: '危险点数', value: dangerPoint },
]
},
{ immediate: true }
)
// { name: '检查楼数', value: outHouseWall.value.checkNum }, // { name: '检查楼数', value: outHouseWall.value.checkNum },
// { name: '隐患点数', value: outHouseWall.value.hiddenPoint }, // { name: '隐患点数', value: outHouseWall.value.hiddenPoint },
// { name: '危险点数', value: outHouseWall.value.dangerPoint }, // { name: '危险点数', value: outHouseWall.value.dangerPoint },
...@@ -159,7 +173,6 @@ export default defineComponent({ ...@@ -159,7 +173,6 @@ export default defineComponent({
//切换年份 //切换年份
const changeYear = (value: string) => { const changeYear = (value: string) => {
year.value = value year.value = value
console.log(outHouseWall.value)
// houseSum.value = [ // houseSum.value = [
// { name: '检查楼数', value: outHouseWall.value.checkNum }, // { name: '检查楼数', value: outHouseWall.value.checkNum },
// ] // ]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment