Pārlūkot izejas kodu

Merge branch 'runData' into dev

huoyi 1 mēnesi atpakaļ
vecāks
revīzija
bb808a8836

+ 15 - 24
src/views/runData/collectWaitingAreaData/index.vue

@@ -7,9 +7,11 @@
7 7
           style="width: 200px" />
8 8
       </el-form-item>
9 9
       <el-form-item label="时间段" prop="timeSlot">
10
-        <el-time-picker v-model="queryParams.timeSlot" is-range range-separator="-" start-placeholder="开始时间"
11
-          end-placeholder="结束时间" value-format="HH:mm" format="HH:mm" placeholder="请选择时间段" clearable
12
-          style="width: 200px" />
10
+        <el-select v-model="queryParams.timeSlot" placeholder="请选择时间段" clearable style="width: 200px">
11
+          <el-option label="00:00-08:00" value="00:00-08:00" />
12
+          <el-option label="08:00-17:00" value="08:00-17:00" />
13
+          <el-option label="17:00-24:00" value="17:00-24:00" />
14
+        </el-select>
13 15
       </el-form-item>
14 16
       <el-form-item>
15 17
         <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
@@ -89,8 +91,11 @@
89 91
           </el-col>
90 92
           <el-col :span="12">
91 93
             <el-form-item label="时间段" prop="timeSlot">
92
-              <el-time-picker v-model="form.timeSlot" is-range range-separator="至" start-placeholder="开始时间"
93
-                end-placeholder="结束时间" value-format="HH:mm" format="HH:mm" placeholder="请选择时间段" style="width: 100%" />
94
+              <el-select v-model="form.timeSlot" placeholder="请选择时间段" style="width: 100%">
95
+                <el-option label="00:00-08:00" value="00:00-08:00" />
96
+                <el-option label="08:00-17:00" value="08:00-17:00" />
97
+                <el-option label="17:00-24:00" value="17:00-24:00" />
98
+              </el-select>
94 99
             </el-form-item>
95 100
           </el-col>
96 101
         </el-row>
@@ -304,11 +309,7 @@ const { queryParams, form, rules } = toRefs(data)
304 309
 /** 查询候检区数据列表 */
305 310
 function getList() {
306 311
   loading.value = true
307
-  const params = { ...queryParams.value }
308
-  if (params.timeSlot && Array.isArray(params.timeSlot)) {
309
-    params.timeSlot = params.timeSlot.join('-')
310
-  }
311
-  listCollectWaitingAreaData(params).then(response => {
312
+  listCollectWaitingAreaData(queryParams.value).then(response => {
312 313
     collectWaitingAreaDataList.value = response.rows
313 314
     total.value = response.total
314 315
     loading.value = false
@@ -379,12 +380,7 @@ function handleUpdate(row) {
379 380
   reset()
380 381
   const _id = row.id || ids.value
381 382
   getCollectWaitingAreaData(_id).then(response => {
382
-    const data = response.data
383
-    // 转换时间段字符串为数组格式
384
-    if (data.timeSlot && typeof data.timeSlot === 'string' && data.timeSlot.includes('-')) {
385
-      data.timeSlot = data.timeSlot.split('-')
386
-    }
387
-    form.value = data
383
+    form.value = response.data
388 384
     open.value = true
389 385
     title.value = "修改候检区数据"
390 386
   })
@@ -394,19 +390,14 @@ function handleUpdate(row) {
394 390
 function submitForm() {
395 391
   proxy.$refs["collectWaitingAreaDataRef"].validate(valid => {
396 392
     if (valid) {
397
-      const submitData = { ...form.value }
398
-      // 转换时间段为字符串格式 08:00-17:00
399
-      if (submitData.timeSlot && Array.isArray(submitData.timeSlot)) {
400
-        submitData.timeSlot = submitData.timeSlot.join('-')
401
-      }
402
-      if (submitData.id != null) {
403
-        updateCollectWaitingAreaData(submitData).then(response => {
393
+      if (form.value.id != null) {
394
+        updateCollectWaitingAreaData(form.value).then(response => {
404 395
           proxy.$modal.msgSuccess("修改成功")
405 396
           open.value = false
406 397
           getList()
407 398
         })
408 399
       } else {
409
-        addCollectWaitingAreaData(submitData).then(response => {
400
+        addCollectWaitingAreaData(form.value).then(response => {
410 401
           proxy.$modal.msgSuccess("新增成功")
411 402
           open.value = false
412 403
           getList()

+ 54 - 4
src/views/runData/runScreen/index.vue

@@ -2,7 +2,24 @@
2 2
   <div class="run-screen-container">
3 3
     <!-- 页面标题 -->
4 4
     <div class="page-title">
5
-      <h1>盛世鹰眸质控系统[生产运行](安检站)</h1>
5
+      <h1>盛世鹰眸质控系统[生产运行]</h1>
6
+    </div>
7
+
8
+    <!-- 查询条件 -->
9
+    <div class="filter-container">
10
+      
11
+        <span style="margin-right: 10px;">日期</span>
12
+        <el-date-picker
13
+          v-model="dateRange"
14
+          type="daterange"
15
+          range-separator="-"
16
+          start-placeholder="开始日期"
17
+          end-placeholder="结束日期"
18
+          value-format="YYYY-MM-DD"
19
+          style="width: 250px;"
20
+          @change="handleDateChange"
21
+        />
22
+     
6 23
     </div>
7 24
 
8 25
     <!-- 模块一:运行数据 -->
@@ -169,8 +186,19 @@
169 186
 </template>
170 187
 
171 188
 <script setup name="RunScreen">
172
-import { ref, onMounted, onUnmounted, nextTick } from 'vue'
173
-import * as echarts from 'echarts'
189
+import { ref, reactive, onMounted, onUnmounted, nextTick } from 'vue'
190
+
191
+// 日期范围
192
+const currentYear = new Date().getFullYear()
193
+const defaultStartDate = `${currentYear}-01-01`
194
+const defaultEndDate = new Date().toISOString().split('T')[0]
195
+const dateRange = ref([defaultStartDate, defaultEndDate])
196
+const queryParams = reactive({
197
+  startDate: defaultStartDate,
198
+  endDate: defaultEndDate
199
+})
200
+
201
+// 图表引用
174 202
 import {
175 203
   getOperationSummary,
176 204
   getT1PassengerTrend,
@@ -229,9 +257,21 @@ const brigadeSeizureData = ref([])
229 257
 const powerBankData = ref({})
230 258
 const pendingConfiscateData = ref({})
231 259
 
260
+// 日期范围变化
261
+function handleDateChange(val) {
262
+  if (val && val.length === 2) {
263
+    queryParams.startDate = val[0]
264
+    queryParams.endDate = val[1]
265
+  } else {
266
+    queryParams.startDate = defaultStartDate
267
+    queryParams.endDate = defaultEndDate
268
+  }
269
+  loadData()
270
+}
271
+
232 272
 async function loadData() {
233 273
   try {
234
-    const query = {}
274
+    const query = { ...queryParams }
235 275
     
236 276
     const [
237 277
       summaryRes,
@@ -724,6 +764,16 @@ onUnmounted(() => {
724 764
   margin: 0;
725 765
 }
726 766
 
767
+.filter-container {
768
+  width: 100%;
769
+  background: #fff;
770
+  padding: 15px;
771
+  border-radius: 4px;
772
+  margin-bottom: 20px;
773
+}
774
+
775
+
776
+
727 777
 .module-title-wrapper {
728 778
   text-align: center;
729 779
   width: 100%;

+ 1 - 50
src/views/runData/seizeData/index.vue

@@ -170,13 +170,6 @@
170 170
             </el-form-item>
171 171
           </el-col>
172 172
         </el-row>
173
-        <el-row :gutter="20">
174
-          <el-col :span="8">
175
-            <el-form-item label="T1总数" prop="t1Total">
176
-              <el-input v-model="form.t1Total" placeholder="自动计算" readonly style="width: 100%" />
177
-            </el-form-item>
178
-          </el-col>
179
-        </el-row>
180 173
         
181 174
         <!-- T2区域 -->
182 175
         <el-divider content-position="left">T2区域数据</el-divider>
@@ -224,18 +217,6 @@
224 217
             </el-form-item>
225 218
           </el-col>
226 219
         </el-row>
227
-        <el-row :gutter="20">
228
-          <el-col :span="8">
229
-            <el-form-item label="T2总数" prop="t2Total">
230
-              <el-input v-model="form.t2Total" placeholder="自动计算" readonly style="width: 100%" />
231
-            </el-form-item>
232
-          </el-col>
233
-          <el-col :span="8">
234
-            <el-form-item label="T1总数+T2总数" prop="grandTotal">
235
-              <el-input v-model="form.grandTotal" placeholder="自动计算" readonly style="width: 100%" />
236
-            </el-form-item>
237
-          </el-col>
238
-        </el-row>
239 220
       </el-form>
240 221
       <template #footer>
241 222
         <div class="dialog-footer">
@@ -410,30 +391,6 @@ const data = reactive({
410 391
 
411 392
 const { queryParams, form, rules } = toRefs(data)
412 393
 
413
-/** 计算总数 */
414
-function calculateTotals() {
415
-  // 计算T1总数
416
-  const t1Fields = ['t1FireSource', 't1Knife', 't1PoliceWeapon', 't1Firework', 't1LiveAnimal', 
417
-                   't1Corrosive', 't1FakeId', 't1Explosive', 't1Tool', 't1GunAmmo', 
418
-                   't1Illegal', 't1Other']
419
-  const t1Total = t1Fields.reduce((sum, field) => {
420
-    return sum + (form.value[field] || 0)
421
-  }, 0)
422
-  form.value.t1Total = t1Total
423
-  
424
-  // 计算T2总数
425
-  const t2Fields = ['t2FireSource', 't2Knife', 't2PoliceWeapon', 't2Firework', 't2LiveAnimal', 
426
-                   't2Corrosive', 't2FakeId', 't2Explosive', 't2Tool', 't2GunAmmo', 
427
-                   't2Illegal', 't2Other']
428
-  const t2Total = t2Fields.reduce((sum, field) => {
429
-    return sum + (form.value[field] || 0)
430
-  }, 0)
431
-  form.value.t2Total = t2Total
432
-  
433
-  // 计算总总数
434
-  form.value.total = t1Total + t2Total
435
-}
436
-
437 394
 /** 查询查获数据列表 */
438 395
 function getList() {
439 396
   loading.value = true
@@ -471,7 +428,6 @@ function reset() {
471 428
     t1GunAmmo: null,
472 429
     t1Illegal: null,
473 430
     t1Other: null,
474
-    t1Total: null,
475 431
     // T2区域数据
476 432
     t2FireSource: null,
477 433
     t2Knife: null,
@@ -484,9 +440,7 @@ function reset() {
484 440
     t2Tool: null,
485 441
     t2GunAmmo: null,
486 442
     t2Illegal: null,
487
-    t2Other: null,
488
-    t2Total: null,
489
-    grandTotal: null
443
+    t2Other: null
490 444
   }
491 445
   proxy.resetForm("seizeDataRef")
492 446
 }
@@ -532,9 +486,6 @@ function handleUpdate(row) {
532 486
 function submitForm() {
533 487
   proxy.$refs["seizeDataRef"].validate(valid => {
534 488
     if (valid) {
535
-      // 提交前重新计算总数
536
-      calculateTotals()
537
-      
538 489
       if (form.value.id != null) {
539 490
         updateSeizeData(form.value).then(response => {
540 491
           proxy.$modal.msgSuccess("修改成功")