董国庆
2025-05-23 d5fe7d75fa3367696348b243d6c77977c1bf37b9
Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/H5/threeSide
2个文件已修改
65 ■■■■ 已修改文件
H5/pages/statistics/index.vue 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
management/src/pages/statistics/index.jsx 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
H5/pages/statistics/index.vue
@@ -877,6 +877,16 @@
      // 如果第一层是街道
      if (this.regionTree[this.regionTree.length - 1]?.tier === 3) {
        const streets = this.regionTree.slice(1).map(item => ({
          name: item.name,
          id: item.id,
          tier: item.tier,
          children: item.children || []
        }));
        return [{ name: "全部", id: "all", tier: 3, children: [] }, ...streets];
      }
      // 如果第一层是社区
      else if (this.regionTree[this.regionTree.length - 1]?.tier === 4) {
        return this.regionTree.slice(1).map(item => ({
          name: item.name,
          id: item.id,
@@ -884,9 +894,8 @@
          children: item.children || []
        }));
      }
      // 如果当前选中的是区县
      if (county.tier === 2) {
      else if (county.tier === 2) {
        const streets = county.children.filter((c) => c && c.tier === 3);
        return streets.length
          ? [{ name: "全部", id: "all", tier: 3, children: [] }, ...streets]
@@ -906,9 +915,17 @@
        const communities = street.children?.filter(c => c && c.tier === 4) || [];
        return communities.length ? [{ name: "全部", id: "all", tier: 4 }, ...communities] : [];
      }
      // 如果第一层是社区
      else if (this.regionTree[this.regionTree.length - 1]?.tier === 4) {
        return this.regionTree.slice(1).map(item => ({
          name: item.name,
          id: item.id,
          tier: item.tier,
          children: item.children || []
        }));
      }
      // 如果当前选中的是区县
      if (county.tier === 2) {
      else if (county.tier === 2) {
        // 区县下直接有社区
        const communities = county.children.filter((c) => c && c.tier === 4);
        if (communities.length)
management/src/pages/statistics/index.jsx
@@ -199,8 +199,17 @@
  const handleSearch = async (values) => {
    setLoading(true);
    let time = '';
    if (dateRange && dateRange.length === 2) {
      time = `${dateRange[0].format('YYYY-MM-DD')} - ${dateRange[1].format('YYYY-MM-DD')}`;
    let range = dateRange;
    if (!range || range.length !== 2) {
      // 没选时间时默认近7天
      const end = moment().endOf('day');
      const start = moment().subtract(6, 'days').startOf('day');
      range = [start, end];
      setDateRange(range);
      form.setFieldsValue({ time: range });
    }
    if (range && range.length === 2) {
      time = `${range[0].format('YYYY-MM-DD')} - ${range[1].format('YYYY-MM-DD')}`;
    }
    const params = {
      cityCode: values.cityCode,
@@ -273,6 +282,17 @@
    });
  }, [adminLevel]);
  useEffect(() => {
    // 页面初始默认近7天
    const end = moment().endOf('day');
    const start = moment().subtract(6, 'days').startOf('day');
    const dates = [start, end];
    setDateRange(dates);
    form.setFieldsValue({ time: dates });
    form.submit();
    // eslint-disable-next-line
  }, []);
  // 处理区县选择
  const handleDistrictChange = async (value) => {
    if (!value) {
@@ -310,7 +330,7 @@
          options={communityOptions} 
          placeholder="请选择社区" 
          fieldNames={{ label: 'name', value: 'communityId' }}
          disabled={adminLevel <= 1 && !form.getFieldValue('districtId')}
          disabled={adminLevel <= 2 && !form.getFieldValue('streetId')}
        />,
      },
    ];
@@ -380,6 +400,12 @@
                  form.resetFields();
                  setStreetOptions([]);
                  setCommunityOptions([]);
                  const end = moment().endOf('day');
                  const start = moment().subtract(6, 'days').startOf('day');
                  const dates = [start, end];
                  setDateRange(dates);
                  form.setFieldsValue({ time: dates });
                  form.submit();
                }}>
                  重置
                </Button>
@@ -480,16 +506,16 @@
              }} 
            />
            <Button onClick={() => {
              const end = moment();
              const start = moment().subtract(7, 'days');
              const end = moment().endOf('day');
              const start = moment().subtract(6, 'days').startOf('day');
              const dates = [start, end];
              setDateRange(dates);
              form.setFieldsValue({ time: dates });
              form.submit();
            }}>近7天</Button>
            <Button onClick={() => {
              const end = moment();
              const start = moment().subtract(30, 'days');
              const end = moment().endOf('day');
              const start = moment().subtract(29, 'days').startOf('day');
              const dates = [start, end];
              setDateRange(dates);
              form.setFieldsValue({ time: dates });