liusheng
2 天以前 bbbc478129f72b26e2ec4a2e981ed8698a96880c
src/views/Satisfaction/sfstatistics/components/ChartsPanel.vue
@@ -21,6 +21,18 @@
          <el-radio-button label="month">按月</el-radio-button>
          <el-radio-button label="year">按年</el-radio-button>
        </el-radio-group>
        <span class="filter-label">满意度类型:</span>
        <el-select
          v-model="satisfactionScope"
          size="small"
          clearable
          placeholder="默认离院"
          class="filter-scope"
          @change="refreshAll"
        >
          <el-option label="离院满意度" value="leave" />
          <el-option label="在院满意度" value="hospital" />
        </el-select>
        <span class="filter-label">统计维度:</span>
        <el-radio-group v-model="queryParams.dimension" size="small" @change="onDimensionChange">
          <el-radio-button label="ward">按病区统计</el-radio-button>
@@ -170,6 +182,8 @@
  dicts: ['dimensionality_type'],
  data() {
    return {
      // 满意度类型:leave=离院满意度(离院科室/病区),hospital=在院满意度(在院科室/病区)
      satisfactionScope: 'leave',
      queryParams: {
        dateRange: [],
        interval: 'month',
@@ -226,6 +240,10 @@
    },
    defaultWardCodes() {
      return Array.from(new Set(this.wardCodeList.map((w) => w.districtCode)));
    },
    // 是否按「在院满意度」口径查询(清空下拉时按默认的离院口径)
    isInHospitalSatisfaction() {
      return this.satisfactionScope === 'hospital';
    },
    intervalLabel() {
      return { day: '按天', week: '按周', month: '按月', year: '按年' }[this.queryParams.interval] || '按月';
@@ -426,12 +444,17 @@
          questionContent: this.singleQuestionContent,
        };
        const sel = this.singleDeptWards || [];
        // 科室/病区条件随「满意度类型」切换:在院 => deptcodes/hospitaldistrictcodes,离院 => leaveldeptcodes/leavehospitaldistrictcodes
        if (this.queryParams.dimension === 'dept') {
          const names = sel.map((s) => String(s).replace(/^dept:/, ''));
          payload.leaveldeptcodes = names.length ? this.mapDeptNames(names) : this.defaultDeptCodes;
          const codes = names.length ? this.mapDeptNames(names) : this.defaultDeptCodes;
          if (this.isInHospitalSatisfaction) payload.deptcodes = codes;
          else payload.leaveldeptcodes = codes;
        } else {
          const names = sel.map((s) => String(s).replace(/^ward:/, ''));
          payload.leavehospitaldistrictcodes = names.length ? this.mapWardNames(names) : this.defaultWardCodes;
          const codes = names.length ? this.mapWardNames(names) : this.defaultWardCodes;
          if (this.isInHospitalSatisfaction) payload.hospitaldistrictcodes = codes;
          else payload.leavehospitaldistrictcodes = codes;
        }
        const res = await sltdMydTotalByScore(payload);
        console.log('[sltdMydTotalByScore 单题] code=', res && res.code, 'data=', JSON.stringify(res && res.data).slice(0, 1500));
@@ -875,7 +898,7 @@
<style lang="scss" scoped>
.export-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; .filter-label { font-size: 13px; color: #606266; } .filter-date { width: 260px; } }
.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; .filter-label { font-size: 13px; color: #606266; } .filter-date { width: 260px; } .filter-scope { width: 140px; } }
.chart-card { margin-bottom: 0; }
.chart-box { width: 100%; height: 360px; }
.chart-wrap { position: relative; width: 100%; }