index.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <template>
  2. <view class="report-page">
  3. <view class="filter-bar">
  4. <view class="filter-main">
  5. <text class="filter-label">统计日期</text>
  6. <uni-datetime-picker
  7. v-model="selectedDate"
  8. class="date-picker"
  9. type="date"
  10. return-type="string"
  11. :clear-icon="false"
  12. :border="false"
  13. @change="handleDateChange"
  14. />
  15. </view>
  16. <button
  17. class="filter-button"
  18. type="primary"
  19. size="mini"
  20. @click="loadList"
  21. >
  22. 查询
  23. </button>
  24. </view>
  25. <view class="filter-tip">查询范围:{{ queryRangeText }}</view>
  26. <scroll-view class="report-scroll" scroll-y>
  27. <view v-if="loading" class="state-card">
  28. <text class="state-text">数据加载中...</text>
  29. </view>
  30. <view v-else-if="!dataList.length" class="state-card empty">
  31. <text class="state-text">当前日期暂无数据</text>
  32. </view>
  33. <view v-else class="report-list">
  34. <view
  35. v-for="item in sortedList"
  36. :key="item.projectDeptId"
  37. class="report-card"
  38. >
  39. <view class="card-header">
  40. <view>
  41. <view class="dept-name">{{ item.projectDeptName || "--" }}</view>
  42. <view class="dept-meta">排序 {{ item.sort ?? "--" }}</view>
  43. </view>
  44. <view class="rate-badge">
  45. {{ formatPercent(item.utilizationRate) }}
  46. </view>
  47. </view>
  48. <view class="metrics-grid">
  49. <view class="metric-item">
  50. <text class="metric-label">队伍总数</text>
  51. <text class="metric-value">{{
  52. formatNumber(item.teamCount)
  53. }}</text>
  54. </view>
  55. <view class="metric-item">
  56. <text class="metric-label">施工队伍</text>
  57. <text class="metric-value">{{
  58. formatNumber(item.sgTeamCount)
  59. }}</text>
  60. </view>
  61. <view class="metric-item">
  62. <text class="metric-label">值班队伍</text>
  63. <text class="metric-value">{{
  64. formatNumber(item.zbTeamCount)
  65. }}</text>
  66. </view>
  67. <view class="metric-item">
  68. <text class="metric-label">待命队伍</text>
  69. <text class="metric-value">{{
  70. formatNumber(item.dmTeamCount)
  71. }}</text>
  72. </view>
  73. <view class="metric-item">
  74. <text class="metric-label">累计天数</text>
  75. <text class="metric-value">{{
  76. formatNumber(item.cumulativeDays)
  77. }}</text>
  78. </view>
  79. <view class="metric-item">
  80. <text class="metric-label">施工天数</text>
  81. <text class="metric-value">{{
  82. formatNumber(item.constructionDays)
  83. }}</text>
  84. </view>
  85. </view>
  86. <view class="summary-panel">
  87. <view class="summary-row">
  88. <text class="summary-label">小时利用率</text>
  89. <text class="summary-value">
  90. {{ formatPercent(item.hourUtilizationRate) }}
  91. </text>
  92. </view>
  93. <view class="summary-row">
  94. <text class="summary-label">年小时利用率</text>
  95. <text class="summary-value">
  96. {{ formatPercent(item.yearHourUtilizationRate) }}
  97. </text>
  98. </view>
  99. <view class="summary-row">
  100. <text class="summary-label">注水量</text>
  101. <text class="summary-value">
  102. {{ formatDecimal(item.waterInjection) }}
  103. </text>
  104. </view>
  105. <view class="summary-row">
  106. <text class="summary-label">年注水量</text>
  107. <text class="summary-value">
  108. {{ formatDecimal(item.yearWaterInjection) }}
  109. </text>
  110. </view>
  111. <view class="summary-row">
  112. <text class="summary-label">注气量</text>
  113. <text class="summary-value">
  114. {{ formatDecimal(item.gasInjection) }}
  115. </text>
  116. </view>
  117. <view class="summary-row">
  118. <text class="summary-label">年注气量</text>
  119. <text class="summary-value">
  120. {{ formatDecimal(item.yearGasInjection) }}
  121. </text>
  122. </view>
  123. </view>
  124. <view class="desc-panel">
  125. <view class="desc-title">生产情况</view>
  126. <text class="desc-text">
  127. {{ item.productionSummary || "暂无生产情况说明" }}
  128. </text>
  129. </view>
  130. </view>
  131. </view>
  132. </scroll-view>
  133. </view>
  134. </template>
  135. <script setup>
  136. import { computed, ref } from "vue";
  137. import { onMounted } from "vue";
  138. import dayjs from "dayjs";
  139. import { getRhRate } from "@/api/ruiHengReport";
  140. const selectedDate = ref(dayjs().subtract(1, "day").format("YYYY-MM-DD"));
  141. const dataList = ref([]);
  142. const loading = ref(false);
  143. const buildQueryParams = () => {
  144. const baseDate = selectedDate.value
  145. ? dayjs(selectedDate.value)
  146. : dayjs().subtract(1, "day");
  147. return {
  148. createTime: [
  149. baseDate.startOf("day").format("YYYY-MM-DD HH:mm:ss"),
  150. baseDate.endOf("day").format("YYYY-MM-DD HH:mm:ss"),
  151. ],
  152. };
  153. };
  154. const queryRangeText = computed(() => {
  155. const [startTime, endTime] = buildQueryParams().createTime;
  156. return `${startTime} - ${endTime}`;
  157. });
  158. const sortedList = computed(() =>
  159. [...dataList.value].sort((a, b) => (a.sort ?? 999999) - (b.sort ?? 999999)),
  160. );
  161. const loadList = async () => {
  162. loading.value = true;
  163. try {
  164. const response = await getRhRate(buildQueryParams());
  165. dataList.value = Array.isArray(response?.data) ? response.data : [];
  166. } catch (error) {
  167. dataList.value = [];
  168. uni.showToast({
  169. title: "数据加载失败",
  170. icon: "none",
  171. });
  172. } finally {
  173. loading.value = false;
  174. }
  175. };
  176. const handleDateChange = () => {
  177. loadList();
  178. };
  179. const formatNumber = (value) => {
  180. if (value === null || value === undefined || value === "") return "--";
  181. return value;
  182. };
  183. const formatDecimal = (value) => {
  184. if (value === null || value === undefined || value === "") return "--";
  185. return Number(value).toFixed(2);
  186. };
  187. const formatPercent = (value) => {
  188. if (value === null || value === undefined || value === "") return "--";
  189. return `${(Number(value) * 100).toFixed(2)}%`;
  190. };
  191. onMounted(() => {
  192. loadList();
  193. });
  194. </script>
  195. <style lang="scss" scoped>
  196. .report-page {
  197. min-height: 100vh;
  198. padding: 12px;
  199. box-sizing: border-box;
  200. background:
  201. radial-gradient(
  202. circle at top left,
  203. rgba(0, 64, 152, 0.14),
  204. transparent 28%
  205. ),
  206. linear-gradient(180deg, #f4f7fb 0%, #eef2f8 100%);
  207. }
  208. .filter-bar {
  209. display: flex;
  210. align-items: center;
  211. gap: 10px;
  212. padding: 14px;
  213. border-radius: 18px;
  214. background: rgba(255, 255, 255, 0.94);
  215. box-shadow: 0 14px 32px rgba(25, 56, 104, 0.08);
  216. backdrop-filter: blur(10px);
  217. }
  218. .filter-main {
  219. flex: 1;
  220. min-width: 0;
  221. }
  222. .filter-label {
  223. display: block;
  224. margin-bottom: 8px;
  225. color: #5f6f87;
  226. font-size: 12px;
  227. letter-spacing: 1px;
  228. }
  229. .date-picker {
  230. padding: 0 12px;
  231. border: 1px solid rgba(0, 64, 152, 0.1);
  232. border-radius: 12px;
  233. background: #f8fbff;
  234. }
  235. .filter-button {
  236. width: 76px;
  237. height: 40px;
  238. line-height: 40px;
  239. margin: 20px 0 0;
  240. border-radius: 12px;
  241. background: linear-gradient(135deg, #004098 0%, #1f68d8 100%);
  242. font-size: 14px;
  243. box-shadow: 0 10px 22px rgba(0, 64, 152, 0.22);
  244. }
  245. .filter-tip {
  246. margin: 10px 4px 0;
  247. color: #6d7c91;
  248. font-size: 12px;
  249. }
  250. .report-scroll {
  251. height: calc(100vh - 110px);
  252. padding-top: 12px;
  253. box-sizing: border-box;
  254. }
  255. .report-list {
  256. display: flex;
  257. flex-direction: column;
  258. gap: 14px;
  259. padding-bottom: 18px;
  260. }
  261. .report-card {
  262. padding: 16px;
  263. border: 1px solid rgba(0, 64, 152, 0.08);
  264. border-radius: 20px;
  265. background: rgba(255, 255, 255, 0.96);
  266. box-shadow: 0 18px 38px rgba(31, 57, 90, 0.08);
  267. }
  268. .card-header {
  269. display: flex;
  270. align-items: flex-start;
  271. justify-content: space-between;
  272. gap: 12px;
  273. margin-bottom: 14px;
  274. }
  275. .dept-name {
  276. color: #122033;
  277. font-size: 18px;
  278. font-weight: 700;
  279. line-height: 26px;
  280. }
  281. .dept-meta {
  282. margin-top: 4px;
  283. color: #7f8ca0;
  284. font-size: 12px;
  285. }
  286. .rate-badge {
  287. flex-shrink: 0;
  288. min-width: 84px;
  289. padding: 8px 12px;
  290. border-radius: 999px;
  291. background: linear-gradient(135deg, #e6f0ff 0%, #d8e7ff 100%);
  292. color: #004098;
  293. font-size: 14px;
  294. font-weight: 700;
  295. text-align: center;
  296. }
  297. .metrics-grid {
  298. display: grid;
  299. grid-template-columns: repeat(2, minmax(0, 1fr));
  300. gap: 10px;
  301. margin-bottom: 14px;
  302. }
  303. .metric-item {
  304. padding: 12px;
  305. border-radius: 14px;
  306. background: #f6f9fd;
  307. }
  308. .metric-label {
  309. display: block;
  310. color: #6e7e95;
  311. font-size: 12px;
  312. }
  313. .metric-value {
  314. display: block;
  315. margin-top: 6px;
  316. color: #18273b;
  317. font-size: 20px;
  318. font-weight: 700;
  319. }
  320. .summary-panel {
  321. display: grid;
  322. grid-template-columns: repeat(2, minmax(0, 1fr));
  323. gap: 8px 14px;
  324. padding: 14px 0;
  325. border-top: 1px solid #edf2f7;
  326. border-bottom: 1px solid #edf2f7;
  327. }
  328. .summary-row {
  329. display: flex;
  330. align-items: center;
  331. justify-content: space-between;
  332. gap: 10px;
  333. }
  334. .summary-label {
  335. color: #6d7c91;
  336. font-size: 12px;
  337. }
  338. .summary-value {
  339. color: #17253a;
  340. font-size: 13px;
  341. font-weight: 600;
  342. }
  343. .desc-panel {
  344. padding-top: 14px;
  345. }
  346. .desc-title {
  347. margin-bottom: 8px;
  348. color: #1f2f46;
  349. font-size: 14px;
  350. font-weight: 700;
  351. }
  352. .desc-text {
  353. color: #5f6f87;
  354. font-size: 13px;
  355. line-height: 22px;
  356. white-space: pre-wrap;
  357. }
  358. .state-card {
  359. margin-top: 18px;
  360. padding: 40px 20px;
  361. border-radius: 18px;
  362. background: rgba(255, 255, 255, 0.92);
  363. text-align: center;
  364. box-shadow: 0 12px 28px rgba(30, 54, 88, 0.06);
  365. }
  366. .state-card.empty {
  367. border: 1px dashed rgba(0, 64, 152, 0.16);
  368. }
  369. .state-text {
  370. color: #73839a;
  371. font-size: 14px;
  372. }
  373. </style>