sumSettings.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805
  1. <!-- 売上集計条件指定 -->
  2. <template>
  3. <div class="app-container">
  4. <div class="form-container">
  5. <!-- 対象区域:使用el-form-item的label属性替代独立标题 -->
  6. <el-form-item
  7. label="対象"
  8. class="section-container"
  9. label-width="100px"
  10. >
  11. <div class="content-group">
  12. <div class="period-selector-vertical">
  13. <!-- 月指定行 -->
  14. <div class="section-monthly">
  15. <div class="date-groups-wrapper">
  16. <div class="date-group">
  17. <el-radio class="common-radio" :value="TARGET_PERIOD_TYPE.MONTHLY" v-model="queryParams.targetPeriodType">
  18. 月指定
  19. </el-radio>
  20. <el-select class="date-select-year" v-model="queryParams.startYear" placeholder=""
  21. :disabled="queryParams.targetPeriodType !== TARGET_PERIOD_TYPE.MONTHLY">
  22. <el-option v-for="year in years" :key="year" :label="year" :value="year"></el-option>
  23. </el-select>
  24. <el-text class="date-label">年</el-text>
  25. </div>
  26. <div class="date-group">
  27. <el-select class="date-select-month" v-model="queryParams.startMonth" placeholder=""
  28. :disabled="queryParams.targetPeriodType !== TARGET_PERIOD_TYPE.MONTHLY">
  29. <el-option v-for="month in months" :key="month" :label="month" :value="month"></el-option>
  30. </el-select>
  31. <el-text class="date-label">月</el-text>
  32. </div>
  33. </div>
  34. </div>
  35. <!-- 年度指定行 -->
  36. <div class="section-annual annual-group">
  37. <el-radio class="common-radio" :value="TARGET_PERIOD_TYPE.ANNUAL" v-model="queryParams.targetPeriodType">
  38. 年度指定
  39. </el-radio>
  40. <div class="date-group">
  41. <el-select class="date-select-year" v-model="queryParams.annual" placeholder=""
  42. :disabled="queryParams.targetPeriodType !== TARGET_PERIOD_TYPE.ANNUAL">
  43. <el-option v-for="year in years" :key="year" :label="year" :value="year"></el-option>
  44. </el-select>
  45. <el-text class="date-label">年度</el-text>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. </el-form-item>
  51. <!-- 集計種別区域:同样使用el-form-item的label属性 -->
  52. <el-form-item
  53. class="section-container"
  54. label="集計種別"
  55. label-width="100px"
  56. >
  57. <div class="content-group"> <!-- 复用content-group,确保内容区域基准一致 -->
  58. <el-radio-group class="aggregation-radio-horizontal" v-model="queryParams.aggregationType">
  59. <!-- 为每个radio添加common-radio类,与“対象”区域的单选框样式统一 -->
  60. <el-radio class="common-radio" :value="AGGREGATION_TYPE.FC">FC別集計</el-radio>
  61. <el-radio class="common-radio" :value="AGGREGATION_TYPE.AREA">エリア別集計</el-radio>
  62. <el-radio class="common-radio" :value="AGGREGATION_TYPE.STORE">店舗別集計</el-radio>
  63. </el-radio-group>
  64. </div>
  65. </el-form-item>
  66. <el-divider class="custom-divider" type="primary"></el-divider>
  67. <div class="section-fc-area">
  68. <PublicRange
  69. v-model="queryParams"
  70. :region-tree="regionTree"
  71. :yamada-fc-brand="yamadaFcBrand"
  72. :yamada-business-type="yamadaBusinessType"
  73. @check-change="handleCheckChange"
  74. :show-fc="true"
  75. :show-business-type="true"
  76. />
  77. </div>
  78. <div class="section-btn">
  79. <el-button class="btn-aggregation" type="primary" @click="handleAggregate" v-hasPermi="['fcbi:sales:sum']">集計</el-button>
  80. <el-button class="btn-reset" type="primary" @click="resetForm" icon="Refresh">リセット</el-button>
  81. </div>
  82. </div>
  83. </div>
  84. </template>
  85. <script name="purchaseSaleSettings" setup>
  86. // 1. 基础依赖导入
  87. import { reactive, ref, onMounted, getCurrentInstance, watch, toRefs } from 'vue';
  88. import { useRouter } from 'vue-router';
  89. import { getRegionTree } from "@/api/fcbi/survey.js";
  90. import PublicRange from '../../../components/PublicRange.vue';
  91. import useSalesStore from '@/store/modules/sales'
  92. // 定数ファイルから集計タイプ(FC / エリア / 店舗別)と対象期間タイプ(年度 / 月指定)の定数をインポート
  93. import { AGGREGATION_TYPE, TARGET_PERIOD_TYPE } from '@/constants';
  94. // 2. 组件实例与状态管理
  95. const { proxy } = getCurrentInstance();
  96. const salesStore = useSalesStore();
  97. const router = useRouter();
  98. // 3. 基础数据与状态定义
  99. const error = ref('');
  100. const regionTree = ref([]); // 地域ツリーデータ
  101. const selectedRegions = ref([]); // 選択された地域コードの配列
  102. // 年月选择器数据
  103. const currentYear = new Date().getFullYear();
  104. const years = Array.from({ length: 11 }, (_, i) => currentYear + i);
  105. const months = Array.from({ length: 12 }, (_, i) => i + 1);
  106. // 4. 数据字典获取
  107. const { yamada_fc_brand: yamadaFcBrand } = proxy.useDict('yamada_fc_brand');
  108. const { yamada_business_type: yamadaBusinessType } = proxy.useDict('yamada_business_type');
  109. // 5. 暴露模板使用的常量
  110. defineExpose({ AGGREGATION_TYPE, TARGET_PERIOD_TYPE });
  111. // フォームの入力データ
  112. const data = reactive({
  113. queryParams: {
  114. targetPeriodType: TARGET_PERIOD_TYPE.MONTHLY,
  115. aggregationType: AGGREGATION_TYPE.FC,
  116. startYear: null, // 指定年
  117. startMonth: null, // 指定月
  118. annual: null, // 指定年度
  119. brandCode: [],
  120. businessTypeCode: [],
  121. regions: []
  122. }
  123. });
  124. const { queryParams } = toRefs(data);
  125. // 6. 初始化与生命周期
  126. onMounted(async () => {
  127. try {
  128. const response = await getRegionTree();
  129. if (response?.success) {
  130. const regions = response.data.regions || [];
  131. regionTree.value = regions;
  132. if (regions.length) {
  133. updateSelectedRegions(regions);
  134. }
  135. } else {
  136. error.value = response?.message || '地域データの取得に失敗しました';
  137. proxy.$message.error(error.value);
  138. console.error('地域データの取得に失敗しました:', response);
  139. }
  140. } catch (err) {
  141. const errorMsg = '地域データの取得中にエラーが発生しました';
  142. proxy.$message.error(errorMsg);
  143. console.error('地域データの取得中にエラーが発生しました:', err);
  144. }
  145. });
  146. // 7. 监听器
  147. /**
  148. * 地域ツリーのデータが更新されたときに、選択された地域を更新します
  149. */
  150. watch(() => regionTree.value, (newVal) => {
  151. if (newVal?.length) {
  152. updateSelectedRegions(newVal);
  153. }
  154. }, { deep: true });
  155. /**
  156. * 対象期間タイプが変更されたときに、関連する日付フィールドをリセットします
  157. * - 月指定の場合は年度指定フィールドをクリア
  158. * - 年度指定の場合は月指定フィールドをクリア
  159. */
  160. watch(
  161. () => queryParams.value.targetPeriodType,
  162. (newVal) => {
  163. if (newVal === TARGET_PERIOD_TYPE.MONTHLY) {
  164. queryParams.value.annual = null;
  165. } else {
  166. queryParams.value.startYear = null;
  167. queryParams.value.startMonth = null;
  168. }
  169. },
  170. { immediate: true }
  171. );
  172. // 8. 地域树处理方法(核心工具方法)
  173. /**
  174. * 指定されたIDを持つ地域ノードをツリーから再帰的に検索します
  175. * @param {Array} nodes - 検索対象の地域ノード配列
  176. * @param {string|number} id - 検索する地域のID
  177. * @returns {Object|null} 見つかった地域ノード(見つからない場合はnull)
  178. */
  179. const findRegionById = (nodes, id) => {
  180. if (!nodes?.length) return null;
  181. for (const node of nodes) {
  182. if (node.id === id) {
  183. return node;
  184. }
  185. if (node.children && node.children.length > 0) {
  186. const found = findRegionById(node.children, id);
  187. if (found) {
  188. return found;
  189. }
  190. }
  191. }
  192. return null;
  193. };
  194. /**
  195. * 地域ツリーから選択された地域を再帰的に収集し、選択状態を更新します
  196. * 親ノードは収集対象外とし、サブノードのみを対象とします
  197. * @param {Array} nodes - 地域ツリーのノード配列
  198. */
  199. const updateSelectedRegions = (nodes) => {
  200. if (!nodes?.length) return;
  201. selectedRegions.value = [];
  202. // 最上位ノードは親ノードとしてマークされ、再帰的に子ノードを処理します
  203. collectSelectedRegions(nodes, true);
  204. queryParams.value.regions = [...selectedRegions.value];
  205. };
  206. /**
  207. * 選択されたサブエリアオブジェクトを再帰的に収集します(親ノードをスキップ)
  208. * @param {Array} nodes - 処理対象の地域ノード配列
  209. * @param {boolean} isParent - 親ノードかどうかを示すフラグ(trueの場合は子ノードのみ処理)
  210. */
  211. const collectSelectedRegions = (nodes, isParent = false) => {
  212. nodes.forEach(node => {
  213. // 親ノード(上位ノード)の場合は、収集をスキップして再帰的に子ノードを処理します
  214. if (isParent) {
  215. if (node.children && node.children.length > 0) {
  216. collectSelectedRegions(node.children, false);
  217. }
  218. return;
  219. }
  220. if (node.checked) {
  221. selectedRegions.value.push({
  222. regionCode: node.regionCode
  223. });
  224. }
  225. if (node.children && node.children.length > 0) {
  226. collectSelectedRegions(node.children, false);
  227. }
  228. });
  229. };
  230. /**
  231. * 地域ツリーのチェック状態を再帰的にリセットします
  232. * すべてのノードのcheckedプロパティをfalseに設定します
  233. * @param {Array} nodes - 地域ツリーのノード配列
  234. */
  235. const resetRegionTreeCheck = (nodes) => {
  236. nodes.forEach(node => {
  237. node.checked = false;
  238. if (node.children?.length) {
  239. resetRegionTreeCheck(node.children);
  240. }
  241. });
  242. };
  243. // 9. 事件处理方法
  244. /**
  245. * 地域のチェック状態が変更されたときのハンドラー関数です
  246. * @param {string|number} regionId - チェック状態が変更された地域のID
  247. * @param {boolean} isChecked - チェック状態(true:チェックされた、false:チェックが外れた)
  248. */
  249. const handleCheckChange = (regionId, isChecked) => {
  250. const region = findRegionById(regionTree.value, regionId);
  251. if (!region) return;
  252. if (isChecked) {
  253. if (!selectedRegions.value.some(r => r.regionCode === region.regionCode)) {
  254. selectedRegions.value.push({ regionCode: region.regionCode });
  255. }
  256. } else {
  257. selectedRegions.value = selectedRegions.value.filter(r => r.regionCode !== region.regionCode);
  258. }
  259. queryParams.value.regions = [...selectedRegions.value];
  260. };
  261. // 10. 表单验证与提交
  262. /**
  263. * 検索条件を検証する関数です
  264. * 必須項目の入力状態を確認し、未入力の場合はエラーメッセージを返します
  265. * @returns {Array} エラーメッセージの配列(検証が通った場合は空配列)
  266. */
  267. const validateForm = () => {
  268. const errors = [];
  269. if (queryParams.value.targetPeriodType === TARGET_PERIOD_TYPE.MONTHLY) {
  270. if (!queryParams.value.startYear) {
  271. errors.push('「対象 月指定」の年を選択してください');
  272. }
  273. if (!queryParams.value.startMonth) {
  274. errors.push('「対象 月指定」の月を選択してください');
  275. }
  276. } else if (queryParams.value.targetPeriodType === TARGET_PERIOD_TYPE.ANNUAL) {
  277. if (!queryParams.value.annual) {
  278. errors.push('「対象 年度指定」の年度を選択してください');
  279. }
  280. }
  281. return errors;
  282. };
  283. /**
  284. * 集計ボタンをクリックしたときの処理関数です
  285. * 1. フォームのバリデーションを実行
  286. * 2. 集計条件に基づいてsalesFlagを設定
  287. * 3. 集計データをストアに保存し、結果画面に遷移
  288. */
  289. const handleAggregate = () => {
  290. const errors = validateForm();
  291. if (errors.length) {
  292. errors.forEach(error => proxy.$message.warning(error));
  293. return;
  294. }
  295. let salesFlag = 0;
  296. const isMonthly = queryParams.value.targetPeriodType === TARGET_PERIOD_TYPE.MONTHLY;
  297. const { aggregationType } = queryParams.value;
  298. switch (aggregationType) {
  299. case AGGREGATION_TYPE.FC:
  300. const hasArea = queryParams.value.regions?.length > 0;
  301. salesFlag = isMonthly ? (hasArea ? 1 : 2) : (hasArea ? 3 : 4);
  302. break;
  303. case AGGREGATION_TYPE.AREA:
  304. salesFlag = isMonthly ? 7 : 8;
  305. break;
  306. case AGGREGATION_TYPE.STORE:
  307. salesFlag = isMonthly ? 5 : 6;
  308. break;
  309. default:
  310. proxy.$message.warning('集計種別を選択してください');
  311. return;
  312. }
  313. const transferData = {
  314. targetPeriodType: queryParams.value.targetPeriodType,
  315. startYear: isMonthly ? queryParams.value.startYear : null,
  316. startMonth: isMonthly ? queryParams.value.startMonth : null,
  317. annual: !isMonthly ? queryParams.value.annual : null,
  318. brandCodes: queryParams.value.brandCode,
  319. regionCodes: queryParams.value.regions.map(r => r.regionCode),
  320. aggregationType: queryParams.value.aggregationType,
  321. salesFlag: salesFlag
  322. };
  323. salesStore.setSalesData(transferData);
  324. router.push({ name: 'salesSumResult' });
  325. };
  326. /**
  327. * リセットボタンをクリックしたときの処理関数です
  328. * フォームのすべての入力値と選択状態を初期状態にリセットします
  329. */
  330. const resetForm = () => {
  331. queryParams.value.targetPeriodType = TARGET_PERIOD_TYPE.MONTHLY;
  332. queryParams.value.aggregationType = AGGREGATION_TYPE.FC;
  333. queryParams.value.startYear = null;
  334. queryParams.value.startMonth = null;
  335. queryParams.value.annual = null;
  336. queryParams.value.brandCode = [];
  337. queryParams.value.regions = [];
  338. selectedRegions.value = [];
  339. if (regionTree.value.length) {
  340. resetRegionTreeCheck(regionTree.value);
  341. }
  342. };
  343. </script>
  344. <style scoped>
  345. /* 基础容器样式 - 最外层布局控制 */
  346. .form-container {
  347. margin-top: 0; /* 清除顶部默认外边距,避免与父容器产生额外间距 */
  348. padding: 0 !important; /* 清除默认内边距,确保布局基准线一致 */
  349. }
  350. /* 布局容器 - 统一标题与内容的排列结构 */
  351. .section-container {
  352. display: flex; /* 使用Flex布局,使标题与内容横向排列 */
  353. align-items: flex-start; /* 顶部对齐,确保各区域垂直基准一致 */
  354. margin-bottom: 10px; /* 区域间垂直间距,区分不同设置项 */
  355. gap: 10px; /* 标题与内容区的固定水平间距 */
  356. margin-left: 0 !important; /* 清除el-form-item默认左间距 */
  357. }
  358. /* 通过深度选择器控制el-form-item的label样式,替代原.form-section */
  359. :deep(.el-form-item__label) {
  360. width: 100px !important; /* 固定宽度,确保标题左侧起点一致 */
  361. font-size: 14px !important; /* 统一字体大小,保持视觉一致性 */
  362. line-height: 1.4 !important; /* 统一行高,确保文字基线对齐 */
  363. padding-left: 15px !important; /* 左对齐标题,节省空间并统一缩进 */
  364. padding-right: 0 !important; /* 清除右侧内边距 */
  365. margin: 0 !important; /* 清除默认外边距,避免布局偏移 */
  366. margin-top: 5px !important; /* 与单选框保持垂直居中对齐 */
  367. text-align: left !important; /* 强制左对齐,统一标题显示方式 */
  368. letter-spacing: normal !important; /* 清除异常字间距,确保文字排列均匀 */
  369. display: inline-block !important; /* 确保宽高计算准确,不影响周围元素 */
  370. box-sizing: border-box !important; /* 宽度计算包含边框和内边距,避免尺寸偏差 */
  371. position: relative !important; /* 建立稳定定位基准,便于子元素定位 */
  372. top: 0 !important; /* 清除定位偏移,确保顶部对齐 */
  373. //color: #606266 !important; /* 标题文字颜色,使用中性色调增强可读性 */
  374. font-weight: 700 !important; /* 标题文字加粗,突出显示设置项类别 */
  375. }
  376. /* 分隔线样式 - 区域间视觉分隔 */
  377. .custom-divider {
  378. background-color: var(--color-primary);
  379. height: 2px; /* 设置分隔线高度,确保视觉效果 */
  380. margin: 12px 0; /* 上下外边距,与周围内容保持距离 */
  381. }
  382. /* 标题首字符样式 - 确保左侧无额外间距 */
  383. :deep(.el-form-item__label)::first-letter {
  384. margin-left: 0 !important; /* 清除首字符可能的默认左间距,确保对齐精确 */
  385. }
  386. /* 公共区域标题样式 - 控制子组件标题对齐 */
  387. :deep(.public-range-title) {
  388. text-align: left !important; /* 强制左对齐,与其他标题保持一致 */
  389. padding-left: 20px; /* 左侧内边距,与其他标题保持对齐 */
  390. }
  391. /* 内容区域容器 - 标题右侧的内容部分 */
  392. .content-group {
  393. flex: 1; /* 占满剩余宽度,自适应不同屏幕尺寸 */
  394. margin: 0 !important; /* 清除element-ui默认外边距,避免布局偏差 */
  395. padding-left: 0 !important; /* 统一内容区左侧缩进,确保对齐一致 */
  396. }
  397. /* 单选组布局 - 垂直排列(月指定/年度指定) */
  398. .period-selector-vertical {
  399. display: flex; /* 使用Flex布局 */
  400. flex-direction: column; /* 垂直排列子元素 */
  401. gap: 5px; /* 月指定与年度指定选项的垂直间距,区分不同选项 */
  402. padding: 0 !important; /* 清除默认内边距 */
  403. margin: 0 !important; /* 清除默认外边距 */
  404. }
  405. /* 单选组布局 - 水平排列(集計種別) */
  406. .aggregation-radio-horizontal {
  407. display: flex; /* 使用Flex布局 */
  408. gap: 20px; /* 集計種別选项间的水平间距,区分不同选项 */
  409. align-items: center; /* 垂直居中对齐选项 */
  410. flex-wrap: wrap; /* 小屏幕下自动折行避免溢出 */
  411. margin: 0 !important; /* 清除默认外边距 */
  412. padding: 0 !important; /* 清除默认内边距 */
  413. }
  414. /* 单选框基础样式 - 统一所有单选框的对齐 */
  415. .common-radio {
  416. width: 100px !important; /* 固定宽度,确保文字左侧起点对齐 */
  417. flex-shrink: 0 !important; /* 禁止压缩,保持宽度稳定 */
  418. margin: 0 !important; /* 清除默认外边距,避免布局偏移 */
  419. padding: 0 0 0 20px !important; /* 左侧预留空间放置单选框圆圈 */
  420. text-align: left !important; /* 文字左对齐,统一显示方式 */
  421. position: relative !important; /* 建立定位基准,便于单选框圆圈定位 */
  422. }
  423. /* 单选框内部圆圈定位 - 核心对齐控制 */
  424. :deep(.common-radio .el-radio__input) {
  425. position: absolute !important; /* 脱离文档流,基于父元素定位 */
  426. left: 0 !important; /* 固定在左侧,所有单选框左对齐 */
  427. top: 50% !important; /* 垂直方向居中定位 */
  428. transform: translateY(-50%) !important; /* 精确垂直居中对齐 */
  429. margin: 0 !important; /* 清除默认外边距,避免定位偏差 */
  430. }
  431. /* 单选框文字样式 - 控制与圆圈的间距 */
  432. :deep(.common-radio .el-radio__label) {
  433. padding-left: 5px !important; /* 文字与圆圈的固定间距,保持一致 */
  434. margin: 0 !important; /* 清除默认外边距 */
  435. }
  436. /* 月指定单选框样式 - 与年度指定保持一致 */
  437. .section-monthly .common-radio {
  438. width: 80px !important; /* 调整宽度,与年度指定单选框保持一致 */
  439. }
  440. /* 月指定区域样式 - 整体布局控制 */
  441. .section-monthly .date-select-year {
  442. width: 100px !important; /* 固定宽度 */
  443. min-width: 100px !important; /* 最小宽度限制 */
  444. max-width: 100px !important; /* 最大宽度限制 */
  445. }
  446. /* 月指定日期组样式 - 清除默认边距 */
  447. .section-monthly .date-group {
  448. margin: 0 !important; /* 清除默认外边距 */
  449. padding: 0 !important; /* 清除默认内边距 */
  450. }
  451. /* 日期选择组合容器 - 年+月的整体布局 */
  452. .date-groups-wrapper {
  453. display: flex; /* 使用Flex布局 */
  454. align-items: center; /* 垂直居中对齐子元素 */
  455. gap: 8px; /* 年和月下拉列表之间的间隔 */
  456. flex-wrap: wrap; /* 小屏幕上自动折行,避免溢出 */
  457. }
  458. /* 日期项容器 - 下拉框+标签的组合 */
  459. .date-group {
  460. display: flex; /* 使用Flex布局 */
  461. align-items: center; /* 垂直居中对齐子元素 */
  462. gap: 0; /* 下拉框与标签的间距 */
  463. white-space: nowrap; /* 防止内部元素折行,保持在同一行 */
  464. }
  465. /* 日期选择器样式 - 年下拉框 */
  466. .date-select-year {
  467. width: 100px !important; /* 固定宽度 */
  468. min-width: 80px !important; /* 最小宽度限制 */
  469. max-width: 120px !important; /* 最大宽度限制 */
  470. padding: 0 8px !important; /* 减少内边距,节省空间 */
  471. }
  472. /* 日期选择器样式 - 月下拉框(略窄) */
  473. .date-select-month {
  474. width: 80px !important; /* 固定宽度,比年下拉框略窄 */
  475. min-width: 60px !important; /* 最小宽度限制 */
  476. max-width: 90px !important; /* 最大宽度限制 */
  477. padding: 0 8px !important; /* 减少内边距,节省空间 */
  478. }
  479. /* 日期标签样式 - "年"、"月"、"年度"文字 */
  480. .date-label {
  481. white-space: nowrap; /* 禁止文字折行,保持在同一行 */
  482. line-height: 1; /* 行高为1,紧凑显示 */
  483. display: inline-flex; /* inline-flex布局,便于对齐 */
  484. align-items: center; /* 垂直居中对齐 */
  485. }
  486. /* 单选按钮与下拉框组合容器 - 确保不折行 */
  487. .section-annual {
  488. display: flex; /* 使用Flex布局 */
  489. align-items: center; /* 垂直居中对齐子元素 */
  490. gap: 8px; /* 子元素间的水平间距 */
  491. width: 100%; /* 占满父容器宽度 */
  492. min-width: 0; /* 允许内容收缩 */
  493. flex-wrap: nowrap; /* 强制不换行,保持选项与输入框在同一行 */
  494. }
  495. /* 年度指定整体容器样式 - 控制不折行 */
  496. .annual-group {
  497. display: flex; /* 使用Flex布局 */
  498. align-items: center; /* 垂直居中对齐子元素 */
  499. gap: 0 !important; /* 强制消除单选框与下拉列表间距 */
  500. width: 100%; /* 占满父容器宽度 */
  501. flex-wrap: nowrap; /* 强制不折行,保持在同一行 */
  502. min-width: 300px; /* 确保有足够宽度容纳内容,避免挤压 */
  503. }
  504. /* 年度指定单选框样式 - 统一宽度 */
  505. .annual-group .common-radio {
  506. width: 80px !important; /* 与其他单选框保持一致 */
  507. min-width: 80px; /* 最小宽度限制 */
  508. flex-shrink: 0; /* 禁止压缩,保持宽度稳定 */
  509. }
  510. /* 年度日期组合容器样式 - 控制内部间距 */
  511. .annual-group .date-group {
  512. flex: 1; /* 继承原annual-row的flex:1属性 */
  513. min-width: 0; /* 继承原annual-row的收缩特性 */
  514. margin: 0;
  515. padding: 2px 0; /* 继承原annual-row的内边距 */
  516. display: flex; /* 使用Flex布局 */
  517. align-items: center; /* 垂直居中对齐子元素 */
  518. gap: 0 !important; /* 强制Flex容器内间距为0 */
  519. }
  520. /* 年度下拉框样式 - 清除右侧边距 */
  521. .annual-group .date-select-year {
  522. width: 100px !important; /* 与月指定的年下拉框宽度一致 */
  523. margin-right: 0 !important; /* 清除下拉框右侧外边距 */
  524. }
  525. /* 年度标签样式 - 调整左侧间距 */
  526. .annual-group .date-label {
  527. margin-left: 4px !important; /* 微调间距,与"年"标签对齐 */
  528. }
  529. /* 公共区域容器 - FC/区域选择部分的布局 */
  530. .section-fc-area {
  531. margin-left: 16px; /* 与其他内容区保持左对齐,统一页面缩进 */
  532. }
  533. /* 按钮区域样式 - 集計和リセット按钮容器 */
  534. .section-btn {
  535. padding-left: calc(15px + 100px + 10px); /* 与标题对齐:15px偏移+100px标题宽度+10px间距 */
  536. margin-top: 25px; /* 顶部外边距,与上方内容保持距离 */
  537. display: flex; /* 使用Flex布局 */
  538. gap: 10px; /* 按钮间距,区分不同按钮 */
  539. align-items: center; /* 垂直居中对齐按钮 */
  540. justify-content: start; /* 子元素左对齐,符合操作习惯 */
  541. flex-wrap: wrap; /* 小屏幕下按钮换行,避免溢出 */
  542. }
  543. /* 操作按钮样式 - 集計按钮 */
  544. .btn-aggregation {
  545. padding: 6px 10px; /* 内边距,控制按钮大小 */
  546. box-sizing: border-box; /* 宽度计算包含内边距和边框 */
  547. margin-left: 0; /* 左侧外边距为0 */
  548. white-space: nowrap; /* 禁止文字折行,保持按钮文字完整 */
  549. width: 120px; /* 固定宽度,与重置按钮保持一致 */
  550. height: 32px; /* 统一高度,保持视觉一致性 */
  551. }
  552. /* 操作按钮样式 - リセット按钮 */
  553. .btn-reset{
  554. padding: 6px 10px; /* 内边距,控制按钮大小 */
  555. box-sizing: border-box; /* 宽度计算包含内边距和边框 */
  556. margin-left: 10px; /* 左侧外边距,与集計按钮保持距离 */
  557. white-space: nowrap; /* 禁止文字折行,保持按钮文字完整 */
  558. width: 120px; /* 固定宽度,与集計按钮保持一致 */
  559. height: 32px; /* 统一高度,保持视觉一致性 */
  560. }
  561. /* 媒体查询 - 大屏幕(≥1024px) */
  562. @media (min-width: 1024px) {
  563. .section-container {
  564. gap: 15px; /* 增大间距提升可读性 */
  565. }
  566. .aggregation-radio-horizontal {
  567. gap: 30px; /* 增大选项间距,提升可读性 */
  568. }
  569. /* 统一年度指定区域布局 */
  570. .annual-group {
  571. gap: 8px !important; /* 与月指定的date-groups-wrapper保持相同间距(8px) */
  572. align-items: center !important; /* 确保垂直居中对齐 */
  573. }
  574. /* 年度下拉框位置调整 */
  575. .annual-group .date-select-year {
  576. vertical-align: middle; /* 垂直居中对齐 */
  577. position: relative !important; /* 相对定位 */
  578. transform: translateX(-8px) !important; /* 水平位移调整,与月指定的年下拉框对齐 */
  579. }
  580. .annual-group .date-group {
  581. gap: 0 !important; /* 覆盖大屏下的可能间距 */
  582. }
  583. /* 日期标签对齐调整 */
  584. .date-group .date-label {
  585. margin-left: 4px !important; /* 统一标签与下拉框的间距 */
  586. }
  587. .annual-group .date-group .date-label {
  588. margin-left: -5px !important; /* 微调年度标签位置,确保与年标签对齐 */
  589. }
  590. }
  591. /* 媒体查询 - 平板端(768px-1023px) */
  592. @media (min-width: 768px) and (max-width: 1023px) {
  593. .date-group {
  594. gap: 4px; /* 缩小间距,适应中等屏幕 */
  595. }
  596. /* 仅调整年度指定行的布局,与月指定对齐 */
  597. .annual-group {
  598. gap: 5px !important; /* 与月指定的section-annual保持相同间距 */
  599. }
  600. /* 年度下拉框容器与月指定的date-group保持一致的左偏移 */
  601. .annual-group .date-group {
  602. margin-left: 0 !important; /* 清除额外左偏移 */
  603. }
  604. /* 确保年度下拉框与年下拉框宽度/位置一致 */
  605. .annual-group .date-select-year {
  606. width: 100px !important; /* 与月指定的年下拉框宽度完全一致 */
  607. margin-left: 0 !important; /* 清除默认左外边距 */
  608. }
  609. .section-btn {
  610. padding-left: calc(15px + 100px + 10px); /* 与标题对齐,动态计算左侧内边距 */
  611. }
  612. /* 保持按钮宽度一致 */
  613. .btn-aggregation, .btn-reset {
  614. width: 120px; /* 统一宽度 */
  615. }
  616. }
  617. /* 响应式样式 - 移动端(<768px) */
  618. @media (max-width: 767px) {
  619. /* 标题样式调整 */
  620. :deep(.el-form-item__label) {
  621. width: 80px !important; /* 保持宽度为80px */
  622. white-space: nowrap !important; /* 禁止换行,确保标题完整显示 */
  623. margin-left: 0 !important; /* 清除左侧外边距干扰 */
  624. padding-left: 20px !important; /* 固定左侧内边距 */
  625. min-width: 80px !important; /* 强制最小宽度 */
  626. max-width: 80px !important; /* 强制最大宽度 */
  627. flex-shrink: 0 !important; /* 禁止宽度被压缩 */
  628. box-sizing: content-box !important; /* 宽度计算不包含内边距 */
  629. }
  630. .date-group {
  631. align-items: center; /* 垂直居中对齐 */
  632. gap: 0; /* 缩小间距 */
  633. }
  634. /* 年度下拉框区域固定宽度,防止被挤压 */
  635. .date-group > .date-select-year:first-child {
  636. width: 100px !important; /* 固定宽度 */
  637. min-width: 100px !important; /* 最小宽度限制 */
  638. max-width: 100px !important; /* 最大宽度限制 */
  639. flex-shrink: 0; /* 禁止压缩 */
  640. }
  641. /* 年标签与年下拉框绑定,不单独折行 */
  642. .date-group > .date-label:nth-child(2) {
  643. margin-right: 8px; /* 右侧外边距 */
  644. flex-shrink: 0; /* 禁止压缩 */
  645. font-size: 14px; /* 日期标签字体微调 */
  646. }
  647. .aggregation-radio-horizontal {
  648. gap: 10px; /* 缩小水平间距,适应小屏幕 */
  649. }
  650. /* 在小屏幕上,让日期组垂直排列 */
  651. .date-groups-wrapper {
  652. flex-direction: column; /* 垂直排列 */
  653. align-items: flex-start; /* 左对齐 */
  654. width: 100%; /* 占满宽度 */
  655. padding-left: 0 !important; /* 清除左内边距 */
  656. }
  657. /* 年度指定整体容器样式 - 增强不折行控制 */
  658. .annual-group {
  659. display: flex; /* Flex布局 */
  660. align-items: center; /* 垂直居中 */
  661. gap: 0 !important; /* 减少年度指定单选框与下拉列表的间隔 */
  662. width: 100%; /* 占满宽度 */
  663. flex-wrap: nowrap; /* 强制不折行 */
  664. min-width: 300px; /* 确保有足够宽度容纳内容 */
  665. overflow-x: auto; /* 内容过宽时显示横向滚动条 */
  666. padding-bottom: 5px; /* 为滚动条预留空间 */
  667. scrollbar-width: thin; /* 优化滚动条样式 */
  668. }
  669. /* 年度下拉框与年下拉框保持完全一致的位置 */
  670. .annual-group .date-group {
  671. margin-left: 0 !important; /* 与月指定的date-group左对齐 */
  672. gap: 0 !important; /* 与月指定的date-group内部间距一致 */
  673. }
  674. /* 年度下拉框宽度/位置与年下拉框完全匹配 */
  675. .annual-group .date-select-year {
  676. width: 100px !important; /* 与月指定的年下拉框宽度相同 */
  677. margin-left: 0 !important; /* 清除默认左外边距 */
  678. }
  679. /* 优化滚动条样式 */
  680. .annual-group::-webkit-scrollbar {
  681. height: 4px; /* 滚动条高度 */
  682. }
  683. /* 调整单选框宽度,为下拉框留出更多空间 */
  684. .annual-group .common-radio {
  685. width: 80px !important; /* 固定宽度 */
  686. min-width: 80px !important; /* 最小宽度限制 */
  687. padding-right: 0 !important; /* 移除右侧内边距 */
  688. }
  689. /* 关键修正:让月指定的年下拉框容器与年度下拉框对齐 */
  690. .section-monthly .date-groups-wrapper {
  691. margin-left: 0 !important; /* 清除可能的默认左偏移 */
  692. padding-left: 0 !important; /* 清除左内边距 */
  693. }
  694. /* 强制月指定的年下拉框与年度下拉框左对齐基准一致 */
  695. .section-monthly .date-group:first-child {
  696. margin-left: 0 !important; /* 与年度下拉框的date-group保持相同左偏移 */
  697. position: relative; /* 相对定位 */
  698. left: 0 !important; /* 消除任何隐性定位偏移 */
  699. }
  700. /* 月下拉列表行与年下拉列表对齐 */
  701. .section-monthly .date-groups-wrapper .date-group:nth-child(2) {
  702. margin-left: 80px !important; /* 匹配"月指定"单选框宽度,确保左对齐 */
  703. margin-top: 8px; /* 添加微小间距,避免拥挤 */
  704. }
  705. .section-btn {
  706. padding-left: 20px; /* 调整左侧内边距,避免溢出 */
  707. justify-content: flex-start; /* 左对齐避免溢出 */
  708. }
  709. /* 保持按钮宽度一致 */
  710. .btn-aggregation, .btn-reset {
  711. width: 120px; /* 保持按钮宽度 */
  712. flex-shrink: 0; /* 禁止按钮宽度被压缩 */
  713. }
  714. }
  715. </style>