From 047808a2d34b40cc9ad2be83e5141bcc3a07d91f Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期一, 16 六月 2025 10:39:47 +0800
Subject: [PATCH] 提交

---
 admin/src/views/platform/LogisticsRecord/subscribe.vue |  205 +++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 149 insertions(+), 56 deletions(-)

diff --git a/admin/src/views/platform/LogisticsRecord/subscribe.vue b/admin/src/views/platform/LogisticsRecord/subscribe.vue
index 4c2a070..8644181 100644
--- a/admin/src/views/platform/LogisticsRecord/subscribe.vue
+++ b/admin/src/views/platform/LogisticsRecord/subscribe.vue
@@ -1,12 +1,9 @@
 <template>
   <div class="main_app">
-    <QueryForm v-model="filters" :query-form-config="queryFormConfig" @changeForm='changeForm' @handleQuery="getList(1)" @clear="clear">
+    <QueryForm v-model="filters" :query-form-config="queryFormConfig" @changeForm='changeForm' @handleQuery="getList(1)"
+      @clear="clear">
       <template #fastdate>
-        <el-radio-group
-          v-model="filters.fastdate"
-          size="small"
-          @input="changeRadio"
-        >
+        <el-radio-group v-model="filters.fastdate" size="small" @input="changeRadio">
           <el-radio-button label="0">褰撳ぉ</el-radio-button>
           <el-radio-button label="6">杩�7澶�</el-radio-button>
           <el-radio-button label="29">杩�30澶�</el-radio-button>
@@ -16,17 +13,26 @@
     <div class="pt16">
       <el-button type="primary" @click="handleEdit" icon="el-icon-plus"
         v-permissions="['business:platformbooks:create']">鏂板缓</el-button>
-      <el-button :loading="exLoading" @click="handleEx" v-permissions="['business:platformbooks:exportExcel']">瀵煎嚭</el-button>
+      <el-button type="primary" @click="complete(ids)">瀹屾垚浣滀笟</el-button>
+      <el-button :loading="exLoading" @click="handleEx"
+        v-permissions="['business:platformbooks:exportExcel']">瀵煎嚭</el-button>
     </div>
-    <el-table class="mb20" v-loading="loading" :data="list" stripe>
-      <el-table-column prop="contractNum" label="鍚堝悓鍗曞彿" min-width="100" show-overflow-tooltip />
+    <el-table :height="tableHeightNew" v-loading="loading" :data="list" @selection-change="handleSelectionChange" stripe>
+      <el-table-column type="selection" width="55"></el-table-column>
+      <el-table-column prop="contractNum" label="鍚堝悓/鍗曟嵁缂栧彿" min-width="100" show-overflow-tooltip />
       <el-table-column prop="inReason" label="鍏ュ洯鍘熷洜" min-width="100" show-overflow-tooltip />
       <el-table-column prop="totalNum" label="鎬讳綔涓氶噺(涓囨敮)" min-width="100" show-overflow-tooltip />
       <el-table-column prop="carCodeFront" label="杞︾墝鍓嶇収鍙�" min-width="100" show-overflow-tooltip />
       <el-table-column prop="carCodeBack" label="杞︾墝鍚庣収鍙�" min-width="100" show-overflow-tooltip />
       <el-table-column prop="driverName" label="椹鹃┒鍛�" min-width="100" show-overflow-tooltip />
       <el-table-column prop="driverPhone" label="鑱旂郴鏂瑰紡" min-width="100" show-overflow-tooltip />
-      <el-table-column prop="inTypeTemp" label="鍏ュ簱绫诲瀷" min-width="100" show-overflow-tooltip />
+      <el-table-column prop="inTypeTemp" label="浣滀笟绫诲瀷" min-width="100" show-overflow-tooltip />
+      <el-table-column label="浣滀笟鐘舵��" min-width="100" show-overflow-tooltip>
+        <template v-slot="scope">
+          <span v-if="[2,3,4].includes(scope.row.status)">{{ statusMap[scope.row.jobStatus] || '' }}</span>
+          <span v-else>-</span>
+        </template>
+      </el-table-column>
       <el-table-column prop="arriveDate" label="棰勭害鍒板満鏃堕棿" min-width="150" show-overflow-tooltip />
       <el-table-column label="瀹℃壒缁撴灉" min-width="100" show-overflow-tooltip>
         <template v-slot="scope">
@@ -39,10 +45,14 @@
       </el-table-column>
       <el-table-column prop="auditName" label="褰撳墠瀹℃壒浜�" min-width="100" show-overflow-tooltip />
       <el-table-column prop="editDate" label="鎿嶄綔鏃堕棿" min-width="150" show-overflow-tooltip />
-      <el-table-column prop="name" label="鎿嶄綔" min-width="120" align="center" fixed="right" show-overflow-tooltip>
+      <el-table-column prop="editUserName" label="鏈�鍚庢搷浣滀汉鍛�" min-width="150" show-overflow-tooltip />
+      <el-table-column prop="name" label="鎿嶄綔" min-width="170" align="center" fixed="right" show-overflow-tooltip>
         <template v-slot="scope">
           <el-button type="text" v-permissions="['business:platformbooks:detail']"
             @click="handleDetail(scope.row)">棰勭害璇︽儏</el-button>
+          <el-button type="text" @click="complete([scope.row.jobId])" v-if="[0,1,2].includes(scope.row.jobStatus)">瀹屾垚浣滀笟</el-button>
+          <el-button type="text" class="red" v-permissions="['business:platformbooks:delete']"
+            @click="handleDel(scope.row)">鍒犻櫎</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -58,25 +68,26 @@
             </el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="鍚堝悓鍙�" prop="contractNum">
-          <el-input v-model="param.contractNum" class="w300" placeholder="璇疯緭鍏ュ悎鍚屽彿"></el-input>
+        <el-form-item label="鍚堝悓/鍗曟嵁缂栧彿" prop="contractNum">
+          <el-input v-model="param.contractNum" class="w300" placeholder="璇疯緭鍏ュ悎鍚�/鍗曟嵁缂栧彿"></el-input>
         </el-form-item>
         <el-form-item label="鍒板満鏃堕棿" prop="arriveDate">
-          <el-date-picker v-model="param.arriveDate" @change="checkSurplus" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" class="w300"
-            placeholder="璇烽�夋嫨">
+          <el-date-picker v-model="param.arriveDate" @change="checkSurplus" value-format="yyyy-MM-dd HH:mm:ss"
+            type="datetime" class="w300" placeholder="璇烽�夋嫨">
           </el-date-picker>
         </el-form-item>
-        <el-form-item label="鍏ュ簱绫诲瀷" prop="inType">
+        <el-form-item label="浣滀笟绫诲瀷" prop="inType">
           <div>
             <el-radio v-model="param.inType" :label="0">鏁翠欢鐩�</el-radio>
             <el-radio v-model="param.inType" :label="1">浠剁儫</el-radio>
           </div>
         </el-form-item>
         <el-form-item label="鎬昏繍杈撻噺" prop="totalNum">
-          <el-input @blur="checkSurplus" oninput="value=value.replace(/^(0+)|[^\d]+/g, '').slice(0, 10)" v-model="param.totalNum" placeholder="璇疯緭鍏�" class="w300"></el-input>
+          <el-input @blur="checkSurplus" oninput="value=value.replace(/^(0+)|[^\d]+/g, '').slice(0, 10)"
+            v-model="param.totalNum" placeholder="璇疯緭鍏�" class="w300"></el-input>
           <span class="ml10">涓囨敮</span>
         </el-form-item>
-        <el-form-item label="鍑嗚繍璇佺収鐗�" prop="transportImg">
+        <el-form-item label="鍑嗚繍璇�/杩愬崟鐓х墖" prop="transportImg">
           <UploadAvatarImage :file="{ 'imgurlfull': param.transportImgFull, 'imgurl': param.transportImg }"
             :uploadData="{ folder: 'platform' }" @uploadSuccess="uploadSuccess" @uploadEnd="isUploading = false"
             @uploadBegin="isUploading = true" />
@@ -86,7 +97,8 @@
           <el-input v-model="param.driverName" placeholder="璇疯緭鍏�" class="w300"></el-input>
         </el-form-item>
         <el-form-item label="鍙告満鎵嬫満鍙�" prop="driverPhone">
-          <el-input oninput="value=value.replace(/^(0+)|[^\d]+/g, '').slice(0, 11)" v-model="param.driverPhone" placeholder="璇疯緭鍏�" class="w300"></el-input>
+          <el-input oninput="value=value.replace(/^(0+)|[^\d]+/g, '').slice(0, 11)" v-model="param.driverPhone"
+            placeholder="璇疯緭鍏�" class="w300"></el-input>
         </el-form-item>
         <el-form-item label="杞﹀墠鐗岀収鍙�" prop="carCodeFront">
           <el-input v-model="param.carCodeFront" placeholder="璇疯緭鍏�" class="w300"></el-input>
@@ -104,14 +116,17 @@
 <script>
 import Pagination from '@/components/common/Pagination'
 import QueryForm from '@/components/common/QueryForm'
-import { platformBooksPage, platformReasonList, platformBooksApply, platformBooksExport } from '@/api'
-import { checkSurplusNum } from '@/api/platform/platform' 
-import DriverDetail from "@/views/task/driverDetail"
+import { platformBooksPage, platformReasonList, platformBooksApply, platformBooksExport, dealJobFinish } from '@/api'
+import { checkSurplusNum, deletebooksById } from '@/api/platform/platform'
+import DriverDetail from '@/views/task/driverDetail'
 import GlobalWindow from '@/components/common/GlobalWindow'
 import UploadAvatarImage from '@/components/common/UploadAvatarImage'
 import { Message } from 'element-ui'
+import { statusMap } from '../config'
 import dayjs from 'dayjs'
+import BaseComputHeight from "@/components/base/BaseComputHeight"
 export default {
+  extends: BaseComputHeight,
   components: {
     Pagination,
     QueryForm,
@@ -121,6 +136,7 @@
   },
   data() {
     return {
+      statusMap,
       isShowDriver: false,
       exLoading: false,
       loading: false,
@@ -130,7 +146,8 @@
         total: 0
       },
       filters: {
-        selDate: [],
+        arriveDateStart: '',
+        arriveDateEnd: '',
         fastdate: 0
       },
       list: [],
@@ -144,7 +161,6 @@
       rules: {
         contractNum: [{ required: true, message: '璇疯緭鍏�', trigger: 'blur' }],
         totalNum: [{ required: true, message: '璇疯緭鍏�', trigger: 'blur' }],
-        driverName: [{ required: true, message: '璇疯緭鍏�', trigger: 'blur' }],
         driverPhone: [{ required: true, message: '璇疯緭鍏�', trigger: 'blur' }],
         carCodeFront: [{ required: true, message: '璇疯緭鍏�', trigger: 'blur' }],
         carCodeBack: [{ required: true, message: '璇疯緭鍏�', trigger: 'blur' }],
@@ -153,7 +169,7 @@
         reasonId: [{ required: true, message: '璇烽�夋嫨', trigger: 'blur' }],
         arriveDate: [{ required: true, message: '璇烽�夋嫨', trigger: 'blur' }],
         inType: [{ required: true, message: '璇烽�夋嫨', trigger: 'blur' }],
-        driverName: [{ required: true, message: '璇烽�夋嫨', trigger: 'blur' }],
+        driverName: [{ required: true, message: '璇烽�夋嫨', trigger: 'blur' }]
       },
       queryFormConfig: {
         formItems: [
@@ -173,6 +189,26 @@
             label: '鍚堝悓鍗曞彿'
           },
           {
+            filed: 'jobStatus',
+            type: 'select',
+            label: '浣滀笟鐘舵��',
+            options: [
+              { value: 0, label: '寰呯‘璁�' },
+              { value: 1, label: '寰呯鍒�' },
+              { value: 2, label: '绛夊緟鍙彿' },
+              { value: 3, label: '鍏ュ洯绛夊緟' },
+              { value: 4, label: '鏈堝彴绛夊緟' },
+              { value: 5, label: '浣滀笟涓�' },
+              { value: 6, label: '浣滀笟瀹屾垚' },
+              { value: 7, label: '杞Щ涓�' },
+              { value: 8, label: '寮傚父鎸傝捣' },
+              { value: 9, label: '宸叉巿鏉冪鍥�' },
+              // { value: 10, label: '宸茬鍥�' },
+              { value: 11, label: '宸茶繃鍙�' },
+              { value: 12, label: '宸插彇娑�' },
+            ]
+          },
+          {
             filed: 'status',
             type: 'select',
             label: '瀹℃壒缁撴灉',
@@ -181,14 +217,20 @@
               { value: 1, label: '瀹℃壒涓�' },
               { value: 2, label: '瀹℃壒閫氳繃' },
               { value: 3, label: '瀹℃壒椹冲洖' },
-              { value: 4, label: '宸插彇娑�' },
+              { value: 4, label: '宸插彇娑�' }
             ]
           },
           {
-            filed: 'selDate',
-            type: 'datetimerange',
-            label: '鎿嶄綔鏃堕棿',
-            pickerOptions: {}
+            filed: 'reasonId',
+            type: 'select',
+            label: '鍏ュ洯鍘熷洜',
+            options: []
+          },
+          {
+            filed1: 'arriveDateStart',
+            filed2: 'arriveDateEnd',
+            type: 'datetime',
+            label: '棰勭害鍒板満鏃堕棿'
           },
           {
             type: 'slot',
@@ -198,50 +240,71 @@
         ],
         online: true
       },
+      ids: []
     }
   },
   created() {
     this.changeRadio('0')
-    this.getList()
+    this.getplatformReasons()
+    // this.getList()
   },
   methods: {
+    handleSelectionChange(ids) {
+      this.ids = ids.map(item => item.jobId)
+    },
+    complete(ids) {
+      var that = this;
+      if (ids.length === 0) {
+        return this.$message.warning('鑷冲皯閫夋嫨涓�椤瑰唴瀹�')
+      }
+      this.$confirm('鏄惁纭瀹屾垚浣滀笟锛�, 鏄惁纭?', '鎻愮ず', {
+        confirmButtonText: '纭',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        dealJobFinish(ids)
+          .then(res => {
+            that.getList()
+          })
+      }).catch(() => {
+
+      });
+    },
     checkSurplus() {
       const { arriveDate, reasonId, totalNum } = this.param
-      if(!arriveDate || !reasonId || !totalNum) return
+      if (!arriveDate || !reasonId || !totalNum) return
       checkSurplusNum({
         arriveDate,
         reasonId,
         totalNum
       }).then(res => {
-        console.log('res', res);
-        
-        if( res == 0 ||  res < Number(totalNum)){
+        if (res == 0 || res < Number(totalNum)) {
           Message.error(`褰撴棩鍓╀綑鍙绾︿綔涓氶噺${res}涓囨敮涓嶈冻璇烽�夋嫨鍏朵粬鍒板満鏃ユ湡`)
         }
       })
     },
-    changeRadio (day) {
+    changeRadio(day) {
       const arr = [dayjs().subtract(day, 'day').format('YYYY-MM-DD') + ' 00:00:00', dayjs().format('YYYY-MM-DD') + ' 23:59:59']
-      this.$set(this.filters, 'selDate', arr)
-      this.getList()
+      this.filters.arriveDateStart = arr[0]
+      this.filters.arriveDateEnd = arr[1]
+      this.getList(1)
     },
-    changeForm (str) {
-      if (str === 'selDate') {
-        this.$set(this.filters, 'fastdate', null)
-        this.getList()
+    changeForm(str) {
+      if (this.filters.arriveDateStart > this.filters.arriveDateEnd) {
+        this.filters.arriveDateStart = this.filters.arriveDateEnd
+        return this.$message.error('寮�濮嬫椂闂翠笉鑳藉ぇ浜庣粨鏉熸椂闂�')
       }
+      this.getList()
     },
     getList(page) {
       const { pagination, filters } = this
       this.loading = true
       platformBooksPage({
         model: {
-          ...filters,
-          arriveDateStart: filters.selDate && filters.selDate.length > 0 ? filters.selDate[0] : null,
-          arriveDateEnd: filters.selDate && filters.selDate.length > 0 ? filters.selDate[1] : null,
+          ...filters
         },
         capacity: pagination.pageSize,
-        page: page || pagination.page,
+        page: page || pagination.page
       }).then(res => {
         this.loading = false
         this.list = res.records || []
@@ -256,11 +319,14 @@
     handleEx() {
       this.$dialog.exportConfirm('纭瀵煎嚭鍚楋紵')
         .then(() => {
+          const { filters } = this
           this.exLoading = true
           platformBooksExport({
             page: this.pagination.page,
             capacity: 1000000,
-            model: this.filters
+            model: {
+              ...filters
+            }
           })
             .then(response => {
               this.download(response)
@@ -274,13 +340,17 @@
         })
     },
     onSubmit() {
-      this.$refs['ruleForm'].validate((valid) => {
+      this.$refs.ruleForm.validate((valid) => {
         const param = this.param
         param.inReason = this.reasonList.find(item => param.reasonId == item.id).reason
         if (valid) {
+          this.subLoading = true
           platformBooksApply({ ...param }).then(res => {
             this.getList()
+            this.subLoading = false
             this.isShowEdit = false
+          }, () => {
+            this.subLoading = false
           })
         }
       })
@@ -295,7 +365,7 @@
         inType: 0
       }
       this.$nextTick(() => {
-        this.$refs['ruleForm'].clearValidate()
+        this.$refs.ruleForm.clearValidate()
       })
       this.$set(this.param, 'arriveDate', dayjs().format('YYYY-MM-DD HH:mm:ss'))
       this.getplatformReason()
@@ -303,6 +373,16 @@
     getplatformReason() {
       platformReasonList().then(res => {
         this.reasonList = res || []
+      })
+    },
+    getplatformReasons() {
+      platformReasonList().then(res => {
+        this.queryFormConfig.formItems[5].options = (res || []).map(item => {
+          return {
+            value: item.id,
+            label: item.reason
+          }
+        })
       })
     },
     handleSub() {
@@ -314,11 +394,9 @@
     },
     clear() {
       this.pagination.page = 1
-      this.filters = {
-        selDate: [],
-        fastdate: 0,
-      }
-      this.changeRadio('0')
+      this.filters = {}
+      this.getList()
+      // this.changeRadio('0')
     },
     handleDetail(row) {
       this.isShowDriver = true
@@ -329,9 +407,24 @@
         this.$refs.DriverDetailRef.isShowModal = true
       })
     },
-    handleDel() { },
+    handleDel(row) {
+      this.$confirm('纭畾鍒犻櫎璇ヨ褰曞悧, 鏄惁缁х画?', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        deletebooksById(row.id)
+          .then(res => {
+            this.$message.success('鎿嶄綔鎴愬姛')
+            this.page = 1
+            this.getList()
+          })
+      }).catch(() => {
+      })
+    },
     handleSizeChange(capacity) {
       this.pagination.pageSize = capacity
+      this.getList(1)
     }
   }
 }
@@ -343,4 +436,4 @@
   color: #000000;
   margin-bottom: 15px;
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3