作者 小范

车辆信息新增出任务功能

@@ -6,6 +6,9 @@ let baseServiceURL = 'wms-server-warehouse' @@ -6,6 +6,9 @@ let baseServiceURL = 'wms-server-warehouse'
6 6
7 //车辆定位 7 //车辆定位
8 export const selectVehicle = params => { return axios.get(`${baseServiceURL}/map/location/lastlocation`, { params: params }); }; 8 export const selectVehicle = params => { return axios.get(`${baseServiceURL}/map/location/lastlocation`, { params: params }); };
  9 +//出任务
  10 +export const insertSelective = params => { return http.post(`${baseServiceURL}/map/location/insertSelective`, params); };
  11 +
9 12
10 //车辆轨迹 13 //车辆轨迹
11 export const historyTrack = params => { return axios.get(`${baseServiceURL}/map/location/historyTrack`, { params: params }); }; 14 export const historyTrack = params => { return axios.get(`${baseServiceURL}/map/location/historyTrack`, { params: params }); };
@@ -4,19 +4,36 @@ @@ -4,19 +4,36 @@
4 <el-card style="background-color: #F5F7FA"> 4 <el-card style="background-color: #F5F7FA">
5 <el-row> 5 <el-row>
6 <el-form :model="queryInfo" :rules="rules" ref="ruleForm"> 6 <el-form :model="queryInfo" :rules="rules" ref="ruleForm">
7 - <el-col :span="5"> 7 + <el-col :span="6">
8 <el-form-item label="" prop="vno"> 8 <el-form-item label="" prop="vno">
9 - <el-input v-model="queryInfo.vno" size="small" style="width: 200px"  
10 - placeholder="车牌号" clearable required>  
11 - <template slot="prepend">车牌号</template>  
12 - </el-input> 9 + <div class="my-text-area">
  10 + <div class="el-input-group__prepend prepand">车牌号</div>
  11 + <el-select v-model="queryInfo.vno"
  12 + @click.native="getCreden"
  13 + default-first-option
  14 + :loading="loading" clearable placeholder="请选择" style="width: 100px">
  15 + <el-option
  16 + v-for="item in vnos"
  17 + :key="item.lisenceNo"
  18 + :label="item.lisenceNo"
  19 + :value="item.lisenceNo"
  20 + :disabled="item.disabled">
  21 + </el-option>
  22 + </el-select>
  23 + </div>
  24 +
  25 +
  26 +<!-- <el-input v-model="queryInfo.vno" size="small" style="width: 200px"-->
  27 +<!-- placeholder="车牌号" clearable required>-->
  28 +<!-- <template slot="prepend">车牌号</template>-->
  29 +<!-- </el-input>-->
13 </el-form-item> 30 </el-form-item>
14 </el-col> 31 </el-col>
15 - <el-col :offset="1" :span="5"> 32 + <el-col :span="6">
16 <el-form-item label="" prop="vnocolor"> 33 <el-form-item label="" prop="vnocolor">
17 <div class="my-text-area"> 34 <div class="my-text-area">
18 <div class="el-input-group__prepend prepand">车牌类型</div> 35 <div class="el-input-group__prepend prepand">车牌类型</div>
19 - <el-select required v-model="queryInfo.vnocolor" placeholder="车牌类型" style="width: 80px"> 36 + <el-select required v-model="queryInfo.vnocolor" placeholder="车牌类型" style="width: 100px">
20 <el-option label="蓝牌" value="1"></el-option> 37 <el-option label="蓝牌" value="1"></el-option>
21 <el-option label="黄牌" value="2"></el-option> 38 <el-option label="黄牌" value="2"></el-option>
22 <el-option label="绿牌" value="3"></el-option> 39 <el-option label="绿牌" value="3"></el-option>
@@ -38,7 +55,8 @@ @@ -38,7 +55,8 @@
38 </template> 55 </template>
39 <script> 56 <script>
40 import AMapLoader from '@amap/amap-jsapi-loader'; 57 import AMapLoader from '@amap/amap-jsapi-loader';
41 - import { selectVehicle } from '../../api/consigner/vehicle'; 58 + import { selectVehicle,selectNameList } from '../../api/consigner/vehicle';
  59 + import {loginedUserInfo} from "../../api/user";
42 60
43 export default { 61 export default {
44 name: 'MapComponent', 62 name: 'MapComponent',
@@ -49,6 +67,8 @@ @@ -49,6 +67,8 @@
49 vno: '', 67 vno: '',
50 vnocolor: '2' 68 vnocolor: '2'
51 }, 69 },
  70 + vnos:[],
  71 + loading:false,
52 rules: { 72 rules: {
53 vno: [ 73 vno: [
54 { required: true, message: '请输入车牌号', trigger: 'blur' }, 74 { required: true, message: '请输入车牌号', trigger: 'blur' },
@@ -61,6 +81,25 @@ @@ -61,6 +81,25 @@
61 }; 81 };
62 }, 82 },
63 methods: { 83 methods: {
  84 + //获取车牌号
  85 + getCreden(){
  86 + this.vnos=[];
  87 + //let params={};
  88 + this.loading = true;
  89 + console.log(loginedUserInfo().username)
  90 + selectNameList({'username':loginedUserInfo().username}).then(res =>{
  91 + console.log(res)
  92 + if (res!=null) {
  93 + console.log(res.data.data)
  94 + setTimeout(() => {
  95 + this.loading = false;
  96 + this.vnos=res.data.data;
  97 + }, 200);
  98 + } else {
  99 + this.vnos = [];
  100 + }
  101 + });
  102 + },
64 getList() { 103 getList() {
65 this.$refs.ruleForm.validate(valid => { 104 this.$refs.ruleForm.validate(valid => {
66 if (!valid) return; 105 if (!valid) return;
@@ -82,7 +82,7 @@ @@ -82,7 +82,7 @@
82 <el-table-column label="操作" align="center" width="240" fixed="right"> 82 <el-table-column label="操作" align="center" width="240" fixed="right">
83 <!-- v-if="isAdmin"--> 83 <!-- v-if="isAdmin"-->
84 <template slot-scope="scope"> 84 <template slot-scope="scope">
85 - <el-button type="warning" size="mini" >出任务</el-button> 85 + <el-button type="warning" size="mini" @click="handlOut(scope.$index, scope.row)">出任务</el-button>
86 <el-button type="success" size="mini" @click="handlEdit(scope.$index, scope.row)">编辑</el-button> 86 <el-button type="success" size="mini" @click="handlEdit(scope.$index, scope.row)">编辑</el-button>
87 <el-button type="danger" size="mini" @click="handleDel(scope.$index, scope.row)">删除</el-button> 87 <el-button type="danger" size="mini" @click="handleDel(scope.$index, scope.row)">删除</el-button>
88 </template> 88 </template>
@@ -286,6 +286,47 @@ @@ -286,6 +286,47 @@
286 @click="dialogStatus ==='save'? addSubmit():editSubmit()" v-loading="addloading">保存</el-button> 286 @click="dialogStatus ==='save'? addSubmit():editSubmit()" v-loading="addloading">保存</el-button>
287 </div> 287 </div>
288 </el-dialog> 288 </el-dialog>
  289 +<!-- //出任务-->
  290 + <el-dialog title="出任务" :visible.sync="dialogVisible">
  291 + <el-form :model="form">
  292 + <el-form-item label="" :label-width="formLabelWidth">
  293 + <el-col :span="15">
  294 + <el-input v-model="form.lisenceNo" autocomplete="off" disabled>
  295 + <template slot="prepend">车牌号</template>
  296 + </el-input>
  297 + </el-col>
  298 + </el-form-item>
  299 + <el-form-item label="" :label-width="formLabelWidth">
  300 + <div class="my-text-area">
  301 + <div class="el-input-group__prepend prepand">用户名</div>
  302 + <el-col :span="14">
  303 + <el-select v-model="form.username"
  304 + @click.native="getUsers"
  305 + default-first-option
  306 + :loading="loading" clearable placeholder="请选择">
  307 + <el-option
  308 + v-for="item in usernames"
  309 + :key="item.username"
  310 + :label="item.username"
  311 + :value="item.username"
  312 + :disabled="item.disabled">
  313 + </el-option>
  314 + </el-select>
  315 + </el-col>
  316 + </div>
  317 + </el-form-item>
  318 + <el-form-item label="" :label-width="formLabelWidth">
  319 + <el-col :span="14">
  320 + <el-tag v-if="lisenceNoSatus=false" type="success">在线</el-tag>
  321 + <el-tag v-else type="info">离线</el-tag>
  322 + </el-col>
  323 + </el-form-item>
  324 + </el-form>
  325 + <div slot="footer" class="dialog-footer">
  326 + <el-button @click="dialogVisible = false">取 消</el-button>
  327 + <el-button @click="saveOut()">确 定</el-button>
  328 + </div>
  329 + </el-dialog>
289 </el-card> 330 </el-card>
290 </el-main> 331 </el-main>
291 </el-container> 332 </el-container>
@@ -298,6 +339,8 @@ @@ -298,6 +339,8 @@
298 import {isAdmin, loginedUserInfo} from "../../api/user"; 339 import {isAdmin, loginedUserInfo} from "../../api/user";
299 //获取关锁列表 340 //获取关锁列表
300 // import {list as lockList} from "../../api/lock_info/lock_info"; 341 // import {list as lockList} from "../../api/lock_info/lock_info";
  342 + import { getUserList } from '../../api/user';
  343 + import {selectVehicle, insertSelective, selectHistroy} from '../../api/consigner/vehicle';
301 344
302 export default { 345 export default {
303 346
@@ -419,7 +462,22 @@ @@ -419,7 +462,22 @@
419 veState: [ 462 veState: [
420 { required: true, message: '请选择备案状态', trigger: 'blur' } 463 { required: true, message: '请选择备案状态', trigger: 'blur' }
421 ] 464 ]
422 - } 465 + },
  466 + dialogVisible:false,
  467 + form: {
  468 + lisenceNo: '',
  469 + username: '',
  470 + id:'',
  471 + starttime:''
  472 + },
  473 + usernames:[],
  474 + queryInfo: {
  475 + vno: '',
  476 + vnocolor: '2'
  477 + },
  478 + lisenceNoSatus:'',
  479 + formLabelWidth: '120px',
  480 + loading:false,
423 } 481 }
424 }, 482 },
425 mounted() { 483 mounted() {
@@ -427,6 +485,56 @@ @@ -427,6 +485,56 @@
427 this.getReCord(); 485 this.getReCord();
428 }, 486 },
429 methods: { 487 methods: {
  488 + //出任务
  489 + handlOut(index,row){
  490 + this.dialogVisible=true;
  491 + this.form.lisenceNo=row.domesticLisenceNo;
  492 + this.getUsers();
  493 + this.getLisenceNoStatus(row.domesticLisenceNo)
  494 + },
  495 + //确定出任务
  496 + saveOut() {
  497 + const _this = this
  498 + insertSelective(this.form).then((response) => {
  499 + const res = response.data
  500 + if (res.code !== '200') {
  501 + return _this.$message.error('出任务,失败!')
  502 + }
  503 + _this.$message.success('出任务,成功!')
  504 + this.dialogVisible=false;
  505 + this.$router.push(
  506 + {
  507 + path:'conveyance'
  508 + }
  509 + )
  510 + }).catch(error => {
  511 + // 关闭加载
  512 + _this.$message.warning('车辆已出任务')
  513 + })
  514 + },
  515 + //获取用户名
  516 + getUsers:function() {
  517 + let para = {};
  518 + this.listLoading = true;
  519 + getUserList(para).then((res) => {
  520 + let response = res.data.data;
  521 + console.log(response)
  522 + this.usernames=res.data.data.list;
  523 + }).catch((error) => {
  524 + this.$message.error(error.toString());
  525 + });
  526 +
  527 + },
  528 + //车辆状态
  529 + getLisenceNoStatus(lisenceNo){
  530 + this.queryInfo.vno=lisenceNo;
  531 + selectVehicle(this.queryInfo).then((response) => {
  532 + const res = response.data;
  533 + this.lisenceNoSatus=res.data.data.firstVcl.offlineState;
  534 + }).catch(error => {
  535 + this.$message.error('获取车辆状态失败:' + error.toString());
  536 + });
  537 + },
430 //获取备案列表 538 //获取备案列表
431 getReCord(val) { 539 getReCord(val) {
432 let pageSize = this.pageSize; 540 let pageSize = this.pageSize;