lichao 3 éve
szülő
commit
98c5de243f

+ 8 - 0
src/api/kaihe/containerNews/boxInformation.js

@@ -121,3 +121,11 @@ export function downloadBox() {
     method: 'get'
   })
 }
+// 退租起租
+export function updateHire(data) {
+  return request({
+    url: '/shipping/cntrno/updateHire',
+    method: 'post',
+    data: data
+  })
+}

+ 59 - 51
src/views/kaihe/containerNews/boxInformation/index.vue

@@ -108,9 +108,9 @@
             </el-form-item>
           </el-col>
           <el-col :span="6">
-            <el-form-item label="起租日期" prop="fRentTime">
+            <el-form-item label="启租日期" prop="onHireStartList">
               <el-date-picker
-                v-model="queryParams.fRentTime"
+                v-model="queryParams.onHireStartList"
                 type="daterange"
                 value-format="yyyy-MM-dd"
                 range-separator="至"
@@ -123,9 +123,9 @@
             </el-form-item>
           </el-col>
           <el-col :span="6">
-            <el-form-item label="退租日期" prop="fReturnTime">
+            <el-form-item label="退租日期" prop="onHireEnfList">
               <el-date-picker
-                v-model="queryParams.fReturnTime"
+                v-model="queryParams.onHireEnfList"
                 type="daterange"
                 value-format="yyyy-MM-dd"
                 range-separator="至"
@@ -138,16 +138,16 @@
             </el-form-item>
           </el-col>
           <el-col :span="6">
-            <el-form-item label="状态" prop="fRentState">
+            <el-form-item label="状态" prop="fStatus">
               <el-select
-                v-model="queryParams.fRentState"
+                v-model="queryParams.fStatus"
                 style="width: 200px"
                 placeholder="请选择状态"
                 clearable
                 size="small"
               >
-                <el-option label="启用" value="1"></el-option>
-                <el-option label="停用" value="2"></el-option>
+                <el-option label="启用" value="T"></el-option>
+                <el-option label="停用" value="F"></el-option>
               </el-select>
             </el-form-item>
           </el-col>
@@ -248,10 +248,10 @@
 <!--        <el-button size="mini" type="primary" icon="el-icon-download" @click="downloadBoxTemplate">下载箱动态模板</el-button>-->
 <!--      </el-col>-->
       <el-col :span="1.5">
-        <el-button size="mini" type="primary" @click="handleIsEnabel(1)">启用</el-button>
+        <el-button size="mini" type="primary" :disabled="multiple" @click="handleIsEnabel(1)" icon="el-icon-video-pause">启用</el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button size="mini" type="primary" @click="handleIsEnabel(0)">退租</el-button>
+        <el-button size="mini" type="primary" :disabled="multiple" @click="handleIsEnabel(0)" icon="el-icon-video-play">退租</el-button>
       </el-col>
       <el-col style="position: absolute;left:70%" :span="5">
         <el-button size="small" @click="queryParamsHidden ? (queryParamsHidden = false) : (queryParamsHidden = true)">
@@ -601,10 +601,10 @@
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="启用日期" prop="fRentTime">
+            <el-form-item label="启租日期" prop="onHireStart">
               <el-date-picker
                 style="width: 80%"
-                v-model="form.fRentTime"
+                v-model="form.onHireStart"
                 type="date"
                 :disabled="doNot"
                 value-format="yyyy-MM-dd"
@@ -885,10 +885,10 @@
       >
         <el-row>
           <el-col :span="12" v-if="!isEnable">
-            <el-form-item label="退租日期" prop="fReturnTime">
+            <el-form-item label="退租日期" prop="onHireEnd">
               <el-date-picker
                 style="width: 80%"
-                v-model="boxStateForm.fReturnTime"
+                v-model="boxStateForm.onHireEnd"
                 type="date"
                 value-format="yyyy-MM-dd"
                 placeholder="选择日期">
@@ -896,10 +896,10 @@
             </el-form-item>
           </el-col>
           <el-col :span="12" v-if="isEnable">
-            <el-form-item label="启用日期" prop="fRentTime">
+            <el-form-item label="启租日期" prop="onHireStart">
               <el-date-picker
                 style="width: 80%"
-                v-model="boxStateForm.fRentTime"
+                v-model="boxStateForm.onHireStart"
                 type="date"
                 value-format="yyyy-MM-dd"
                 placeholder="选择日期">
@@ -982,7 +982,8 @@ import {
   getDown,
   batch,
   downloadBox,
-  leadingIn
+  leadingIn,
+  updateHire
 } from '@/api/kaihe/containerNews/boxInformation'
 import draggable from 'vuedraggable'
 import Vue from 'vue'
@@ -1207,19 +1208,19 @@ export default {
           width: 120
         },{
           surface: '19',
-          label: 'fRentTime',
-          name: '租日期',
+          label: 'onHireStart',
+          name: '租日期',
           checked: 0,
           width: 120
         },{
           surface: '20',
-          label: 'fReturnTime',
+          label: 'onHireEnd',
           name: '退租日期',
           checked: 0,
           width: 120
         },{
           surface: '21',
-          label: 'fRentState',
+          label: 'fStatusName',
           name: '状态',
           checked: 0,
           width: 120
@@ -1334,18 +1335,20 @@ export default {
       boxStateTitle: '',
       boxStateOpen: false,
       boxStateForm: {
-        fRentTime: null,
-        fReturnTime: null,
+        onHireEnd: null,
+        onHireStart: null,
         fOpctnstatus: null,
         fUpdateaddress: null,
         remark: null,
         fMblno: null,
+        fStatus: null,
+        cntrnoList: [],
       },
       boxStateRules: {
-        fRentTime: [
+        onHireEnd: [
           { required: true, message: ' ', trigger: 'blur' }
         ],
-        fReturnTime: [
+        onHireStart: [
           { required: true, message: ' ', trigger: 'blur' }
         ],
         fOpctnstatus: [
@@ -1682,15 +1685,10 @@ export default {
     /** 重置按钮操作 */
     resetQuery() {
       this.queryParams = {
-        fNo: null,
-        fTypeid: null,
-        fCntrstatus: null,
-        fOwner: null,
-        createBy: null,
-        cLoadDate: null,
-        remark: null
-      },
-        this.resetForm('queryForm')
+        pageNum: 1,
+        pageSize: 10,
+      }
+      this.resetForm('queryForm')
       this.handleQuery()
     },
     // 多选框选中数据
@@ -1771,34 +1769,37 @@ export default {
     handleIsEnabel(state) {
       // 清除默认
       this.boxStateForm = {
-        fRentTime: null,
-        fReturnTime: null,
+        onHireEnd: null,
+        onHireStart: null,
         fOpctnstatus: null,
         fUpdateaddress: null,
         remark: null,
-        fMblno: null
+        fMblno: null,
+        fStatus: null,
+        cntrnoList: []
       }
+      this.selection.map(item => {
+        this.boxStateForm.cntrnoList.push(item.fId)
+      })
       // state = 0 退 1启
       if (state == 0) {
-        this.selection.forEach((item, index) => {
-          if (item.fRentState == 0) {
-            return this.$message.error('选中的第' + index + 1 + '条数据箱状态为停用')
-          }
-        })
+        for (let i = 0;i < this.selection.length; i++) {
+          if (this.selection[i].fStatus == 'F') return this.$message.error('选中的第' + (i + 1) + '条数据箱状态已为停用')
+        }
         this.boxStateTitle = '退租';
         this.isEnable = false;
         this.boxStateForm.fOpctnstatus = '0';
         this.boxStateOpen = true;
       } else {
-        this.selection.forEach((item, index) => {
-          if (item.fRentState == 1) {
-            return this.$message.error('选中的第' + index + 1 + '条数据箱状态为启用')
-          }
+        for (let i = 0;i < this.selection.length; i++) {
+          if (this.selection[i].fStatus == 'T') return this.$message.error('选中的第' + (i + 1) + '条数据箱状态已为启用')
+        }
+        this.$nextTick(() => {
+          this.boxStateTitle = '启用';
+          this.isEnable = true;
+          this.boxStateForm.fOpctnstatus = '4';
+          this.boxStateOpen = true;
         })
-        this.boxStateTitle = '启用';
-        this.isEnable = true;
-        this.boxStateForm.fOpctnstatus = '4';
-        this.boxStateOpen = true;
       }
     },
     boxStateCancel() {
@@ -1810,7 +1811,14 @@ export default {
         if (valid) {
           // isEnable TRUE:启 FALSE:禁
           if (this.isEnable) {
-          } else {}
+            this.boxStateForm.fStatus = 'T'
+          } else {
+            this.boxStateForm.fStatus = 'F'
+          }
+          updateHire({...this.boxStateForm}).then(res => {
+            console.log(res)
+            this.getList()
+          })
           this.boxStateOpen = false;
         }
       })