Commit 5d8202d7 by 冒粤蓉

add fence

1 parent 8cc5ee82
var path = require('path')
var webpack = require('webpack')
const { port } = require("../package");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
......@@ -13,6 +14,7 @@ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPl
//localhost:10500
const IS_DEV_MODE = process.env.NODE_ENV !== 'production'
const getPublicPath = IS_DEV_MODE ? '' : '/ots/vue/build/';
const resourcesPath = IS_DEV_MODE ? `//localhost:${port}` : 'http://eshield-perm.test.glsx.com.cn';
module.exports = {
mode: IS_DEV_MODE ? 'development':'production',
......@@ -87,15 +89,16 @@ module.exports = {
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: 'images/[name].[ext]?[hash]'
name: 'images/[name].[ext]?[hash]',
publicPath: resourcesPath
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
query: {
options: {
limit: 10000,
publicPath: '../',
publicPath: resourcesPath,
name: 'fonts/[name].[hash:7].[ext]'
}
}
......
import request from './request'
export default {
/*新虎哥围栏管理*/
getFenceList(params = {}) {
return request(params, '/trialdrive/fence/search', 'get')
},
deleteFence(params = {}) {
return request(params, '/trialdrive/fence/delete', 'get')
},
saveFence(params = {}) {
return request(params, '/trialdrive/fence/add', 'post')
},
updateFence(params = {}) {
return request(params, '/trialdrive/fence/edit', 'post')
},
getFenceDetailById(params = {}) {
return request(params, '/trialdrive/fence/info', 'get')
},
getVehicleSnList(params = {}) {
return request(params, '/trialdrive/vehicle/linksns/search', 'get')
},
/*新虎哥特约店列表*/
getSpecialShopList(params = {}) {
return request(params, '/trialdrive/specialshop/shopusers', 'get')
},
// 旧虎哥
/*车辆监控*/
// getCriteriaTreeList (request = {}) {
......@@ -76,13 +100,5 @@ export default {
// },
// getFenceSnsList(request = {}) {
// return api.get('ecFence/getFenceSnsList', request)
// },
/*新虎哥围栏管理*/
getFenceList(params = {}) {
return request(params, '/trialdrive/fence/search', 'get')
},
deleteFence(params = {}) {
return request(params, '/trialdrive/fence/delete', 'get')
}
// },
}
......@@ -12,6 +12,7 @@
<fence-map
:mapData="mapData"
@onUpdateMapData="updateMapData"
:readonlyStatus="readonlyStatus"
ref="fenceMap"
>
</fence-map>
......@@ -29,36 +30,40 @@
</el-form-item>
</el-col> -->
<el-col :span="12">
<el-form-item label="围栏名称" prop="electricFenceName">
<el-input v-model.trim="form.electricFenceName" maxlength="200"></el-input>
<el-form-item label="围栏名称" prop="fenceName">
<el-input v-model.trim="form.fenceName" maxlength="200" :disabled="readonlyStatus"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="围栏类型" >
<el-radio v-model="form.bizFenceType" :label="0" :disabled="isEditMode">报警型</el-radio>
<el-radio v-model="form.bizFenceType" :label="1" :disabled="isEditMode">试乘试驾型</el-radio>
<el-form-item label="围栏类型" prop="bizFenceType">
<el-radio v-model="form.bizFenceType" label="12" :disabled="readonlyStatus">试驾围栏</el-radio>
<!-- <el-radio v-model="form.bizFenceType" :label="1" :disabled="isEditMode">试乘试驾型</el-radio> -->
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="区域类型" class="is-required">
<el-radio-group v-model="form.shapeType" @change="shapeTypeChange">
<!-- <el-radio-button label="3" value="3" >行政区域</el-radio-button> -->
<el-radio-button label="2" value="2">圆形</el-radio-button>
<el-radio-button label="5" value="5">多边形</el-radio-button>
<el-form-item label="区域类型" prop="shapeType">
<el-radio-group v-model="form.shapeType" @change="shapeTypeChange" >
<!-- <el-radio-button label="4" value="4" >行政区域</el-radio-button> -->
<el-radio-button label="1" value="1" :disabled="readonlyStatus">圆形</el-radio-button>
<el-radio-button label="3" value="3" :disabled="readonlyStatus">多边形</el-radio-button>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item class="special-shop-input" label="特约店" prop="specialShopVal">
<el-select v-model="form.specialShopVal" filterable placeholder="请选择" size="small" style="width:100px;">
<el-option
v-for="item in specialShopOptions"
:key="item.departmentName"
:value="item.departmentName">
</el-option>
</el-select>
<el-form-item class="special-shop-input" label="特约店" prop="specialShop">
<el-cascader
v-model="form.specialShopId"
:value="form.specialShopName"
placeholder="请选择"
:options="specialShopOptions"
:props="specialShopDefaultProps"
filterable
@change="handleSpecialShopChange"
size="small"
:disabled="readonlyStatus"
></el-cascader>
</el-form-item>
</el-col>
</el-row>
......@@ -174,7 +179,7 @@
</el-col> -->
<!-- </div> -->
<!-- <div class="tab-content shape_tip" v-show="form.shapeType==5">*注:地图任意位置,单击新增双击结束绘制。</div> -->
<div class="tab-content shape_tip" v-show="form.shapeType==3">*注:地图任意位置,单击新增双击结束绘制。</div>
<!-- </el-col> -->
<!-- <el-col :span="12">
<el-form-item label="短信通知" prop="msgtel">
......@@ -188,9 +193,9 @@
</el-form>
</div>
</el-tab-pane>
<el-tab-pane label="监控对象" v-loadmore='loadMore'>
<el-tab-pane label="关联对象" v-loadmore='loadMore'>
<div style="float: right;">
<el-button type="primary" @click="userDate" size="small" :loading="submitting">关联用户</el-button>
<el-button v-if="!readonlyStatus" type="primary" @click="userDate" size="small" :loading="submitting">关联用户</el-button>
<!-- <el-button size="small" @click="deleteFenceModel">批量删除</el-button> -->
</div>
<el-table
......@@ -202,17 +207,17 @@
@selection-change="selectChange"
style="width: 100%;margin-bottom:40px">
<el-table-column type="selection" width="40" align="center"></el-table-column>
<el-table-column :disabled="readonlyStatus" type="selection" width="40" align="center"></el-table-column>
<el-table-column fixed type="index" label="序号" :index="getIndex" align="center" width="70"></el-table-column>
<el-table-column fixed prop="name" label="姓名" min-width="80" align="center"></el-table-column>
<el-table-column fixed prop="standno" label="车架号" min-width="160" align="center"></el-table-column>
<el-table-column fixed prop="vin" label="车架号" min-width="160" align="center"></el-table-column>
<el-table-column prop="sn" label="设备号" min-width="160" align="center">
</el-table-column>
<el-table-column prop="time" label="GPS时间" min-width="100" align="center">
<el-table-column prop="gpsTime" label="GPS时间" min-width="100" align="center">
</el-table-column>
<el-table-column prop="address" label="位置" min-width="200" align="center"></el-table-column>
......@@ -223,13 +228,13 @@
</el-table>
</el-tab-pane>
</el-tabs>
<div class="tab_ctrl">
<!-- <div class="tab_ctrl">
<el-button size="small" type="primary" :fenceMapModalVisible="fenceMapModalVisible" @click="changeStatus" style="width: 65px;">展开</el-button>
<i :class="!hideTab?'fa fa-angle-double-up':'fa fa-angle-double-down'" style="position: absolute;top:9px;left:5px;color:#fff;"></i>
</div>
</div> -->
</div>
<div class="fenceModalfooter">
<el-button type="primary" @click="saveFence" size="small" :loading="submitting">{{btnText}}</el-button>
<el-button v-if="!readonlyStatus" type="primary" @click="saveFence" size="small" :loading="submitting">{{btnText}}</el-button>
<el-button @click="cancel" size="small">取消</el-button>
</div>
<user-list
......@@ -259,18 +264,18 @@ export default{
props: ['fenceModalVisible', 'fenceId'],
data(){
let checkFenceName = (rule, vaule, cb)=>{
if(typeof this.restainFenceName != 'undefined' && this.form.electricFenceName === this.restainFenceName){
if(typeof this.restainFenceName != 'undefined' && this.form.fenceName === this.restainFenceName){
cb();
}
MONITOR_SERVICE.checkFenceName({name: this.form.electricFenceName}).then((res)=>{
if(res.returnCode == 0){
if(res.data.isExist == 1){
cb(new Error('该围栏名已存在,请重新输入!'))
}else{
cb();
}
}
})
// MONITOR_SERVICE.checkFenceName({name: this.form.fenceName}).then((res)=>{
// if(res.returnCode == 0){
// if(res.data.isExist == 1){
// cb(new Error('该围栏名已存在,请重新输入!'))
// }else{
// cb();
// }
// }
// })
}
let checkMonitorTime = (rule, vaule, cb)=>{
if(this.form.electricTimeFenceType==""){
......@@ -278,10 +283,18 @@ export default{
}else{
cb();
}
}
}
let checkSpecialShop = (rule, vaule, cb)=>{
if(this.form.specialShopId == ""){
cb(new Error('请选择特约店'))
}else{
cb();
}
}
let checkArea = (rule, vaule, cb)=>{
if(this.form.shapeType == 3 && !this.form.areaCode){
if(this.form.shapeType == 1 && !this.form.areaCode){
cb(new Error('请选择行政区域'))
}else{
cb();
......@@ -385,99 +398,109 @@ export default{
areaCode:null,
btnText: '保存',
specialShopOptions: [],
specialShopDefaultProps: {
children: 'children',
label: 'label',
value: 'id'
},
readonlyStatus: false,
form: {
electricFenceName: '',
fenceName: '',
bizFenceType: '12',
shapeType: 1,
specialShopId: '',
specialShopName: '',
// fenceNo: '',
electricFenceType: 1,
startTime: '',
endTime: '',
des: '',
areaCode: '',
specialShopVal: ''
// fenceNo: '',
// electricFenceName: '',
// electricFenceType: 1,
// startTime: '',
// endTime: '',
// des: '',
// shapeType: 2,
// areaCode: '',
// analysisAddress: '',
// lng: '',
// lat: '',
// radius: 1000,
// status: 1,
// bizFenceType: 0,
// transferError: false,
// timeType:2,
// electricTimeFenceType:'',
// electricTimeFenceTypes: [
// {
// value: 1,
// label: '1个月'
// }, {
// value: 2,
// label: '2个月'
// }, {
// value: 3,
// label: '3个月'
// }, {
// value: 4,
// label: '4个月'
// }, {
// value: 5,
// label: '5个月'
// }, {
// value: 6,
// label: '6个月'
// }
// ],
// dateRange: [],
// msgtel: ''
analysisAddress: '',
lng: '',
lat: '',
radius: 1000,
status: 1,
transferError: false,
timeType:2,
electricTimeFenceType:'',
electricTimeFenceTypes: [
{
value: 1,
label: '1个月'
}, {
value: 2,
label: '2个月'
}, {
value: 3,
label: '3个月'
}, {
value: 4,
label: '4个月'
}, {
value: 5,
label: '5个月'
}, {
value: 6,
label: '6个月'
}
],
dateRange: [],
msgtel: ''
},
restainFenceName: '',
rules: {
fenceNo: [
{required: true, message: '围栏编号不能为空', trigger: 'blur'},
],
electricFenceName: [
// fenceNo: [
// {required: true, message: '围栏编号不能为空', trigger: 'blur'},
// ],
fenceName: [
{required: true, message: '请输入围栏名称', trigger: 'blur'},
{pattern: /^\S{2,200}$/, message: '至少2字', trigger: 'blur' },
{validator: checkFenceName, trigger: 'blur'}
],
electricFenceType: [
{required: true, message: '', trigger: 'blur'}
// {validator: checkFenceName, trigger: 'blur'}
],
electricTimeFenceType:[
{required: true, validator: checkMonitorTime, trigger: 'change'}
bizFenceType: [
{required: true, message: '请选择围栏类型', trigger: 'change'}
],
specialShopVal: [
{required: true, message: '请选择特约店'}
specialShop: [
{required: true, validator: checkSpecialShop, trigger: 'change'}
],
shapeType: [
{required: true}
]
// electricFenceType: [
// {required: true, message: '', trigger: 'blur'}
// ],
// electricTimeFenceType:[
// {required: true, validator: checkMonitorTime, trigger: 'change'}
// ],
/*dateRange: [
{validator: checkMonitorTime, trigger: 'change'}
],*/
area: [
{validator: checkArea, trigger: 'change'}
],
lng: [
{validator: checkLng, trigger: 'blur'}
],
lat: [
{validator: checkLat, trigger: 'blur'}
],
analysisAddress: [
{validator: checkTransferAddr, trigger: 'change'}
],
radius: [
{validator: checkRadius, trigger: 'blur'}
],
daterange: [{validator: checkDaterange}],
timeType:[{required: true, message: '请选择监控时间', trigger: 'change'}],
msgtel: [
{validator: checkMsgtel, trigger: 'blur'}
],
// area: [
// {validator: checkArea, trigger: 'change'}
// ],
// lng: [
// {validator: checkLng, trigger: 'blur'}
// ],
// lat: [
// {validator: checkLat, trigger: 'blur'}
// ],
// analysisAddress: [
// {validator: checkTransferAddr, trigger: 'change'}
// ],
// radius: [
// {validator: checkRadius, trigger: 'blur'}
// ],
// daterange: [{validator: checkDaterange}],
// timeType:[{required: true, message: '请选择监控时间', trigger: 'change'}],
// msgtel: [
// {validator: checkMsgtel, trigger: 'blur'}
// ],
/*map: [
{validator: checkMap, trigger: 'blur'}
]*/
},
transferTimeoutId: undefined,
geocoder: null,
transferFlag: null,
......@@ -518,6 +541,7 @@ export default{
created(){
let _this=this;
//this.getFenceSnsList();
this.getSpecialShopList();
window.Vue.directive('loadmore', {
bind(el, binding) {
const selectWrap = el.querySelector('.el-table__body-wrapper')
......@@ -527,18 +551,31 @@ export default{
if (scrollDistance == sign) {
//binding.value()
//console.log(sign)
_this.currentPage++;
// _this.currentPage++;
_this.getFenceSnsList(_this.fenceId);
// _this.getFenceSnsList(_this.fenceId);
}
})
}
})
},
mounted() {
this.init();
this.listener();
},
methods: {
listener() {
const state = history.state;
if(!state) {
this.init();
return;
}
const { fenceId, readonlyStatus } = state;
if(readonlyStatus) {
this.readonlyStatus = readonlyStatus;
this.fenceId = fenceId;
}
this.init();
},
init(){
const { id, btnText } = this.$route.query;
if(id) {
......@@ -547,7 +584,6 @@ export default{
}
if(typeof this.fenceId != 'undefined'){
this.getFenceDetail(this.fenceId);
this.getFenceSnsList(this.fenceId);
}else{
// 围栏编号无意义 屏蔽
// MONITOR_SERVICE.getNewFenceId().then((res)=>{
......@@ -567,9 +603,17 @@ export default{
this.restainFenceName = undefined;
}
},
getSpecialShopList() {
MONITOR_SERVICE.getSpecialShopList().then(res => {
const { code, data } = res;
if(code == 200) {
this.specialShopOptions = data;
}
})
},
getFenceDetail(id){
MONITOR_SERVICE.getFenceDetailById({id: id}).then((res)=>{
if(res.returnCode == 0){
MONITOR_SERVICE.getFenceDetailById({fenceId: id}).then((res)=>{
if(res.code == 200){
const form = this.form;
const data = res.data;
for(let key in data){
......@@ -577,8 +621,12 @@ export default{
}
this.form.dateRange = [form.startTime, form.endTime];
this.areaCode = form.areaCode
this.restainFenceName = form.electricFenceName;
this.form.msgtel = data.telNumbers
this.restainFenceName = form.fenceName;
this.form.fenceName = form.fenceName;
this.form.msgtel = data.telNumbers;
this.form.specialShopId = data.shopId;
this.form.specialShopName = data.shopName;
this.getFenceSnsList(id, '', data.snList)
if(form.shapeType === 2){
this.mapData = {
......@@ -587,12 +635,12 @@ export default{
lat: form.lat,
radius: form.radius,
}
}else if(form.shapeType === 3){
}else if(form.shapeType === 1){
this.mapData = {
fenceType: 'area',
areaCode: this.form.areaCode
}
}else if(form.shapeType === 5){
}else if(form.shapeType === 3){
if(data.lnglat){
this.polygonPath = data.lnglat.split('|').map((item)=>{
return [item.split(',')[0], item.split(',')[1]]
......@@ -610,47 +658,50 @@ export default{
}
});
},
getFenceSnsList(id,cur){
getFenceSnsList(id, cur, resData){
let params = {};
if(this.currentPage>this.maxPage){
return;
}
if(cur){
params.id=id;
this.tableData = this.tableData.concat(resData);
this.$refs.userList.reset(resData);
// if(this.currentPage>this.maxPage){
// return;
// }
// if(cur){
params.currentPage =cur;
params.pageSize = this.pageSize;
}else{
params.currentPage =this.currentPage;
params.pageSize = this.pageSize;
}
// params.currentPage =cur;
// params.pageSize = this.pageSize;
// }else{
// params.currentPage =this.currentPage;
// params.pageSize = this.pageSize;
// }
params.id=id;
MONITOR_SERVICE.getFenceSnsList(params).then((res)=>{
if(res.draw == 0){
this.tableData = this.tableData.concat(res.data);
this.maxPage = Math.ceil(res.recordsTotal/this.pageSize);
this.$refs.userList.reset(res.data);
}
});
// params.id=id;
// MONITOR_SERVICE.getFenceSnsList(params).then((res)=>{
// if(res.c == 0){
// this.tableData = this.tableData.concat(resData);
// this.maxPage = Math.ceil(resData.recordsTotal/this.pageSize);
// this.$refs.userList.reset(resData);
// }
// });
},
shapeTypeChange(){
//console.log(this.form.shapeType)
if(this.form.shapeType == 3){
if(this.form.shapeType == 4){
//this.$refs.clearArea.rest();
this.$refs.fenceForm.clearValidate();
//this.$refs.fenceMap.updateSeach(this.form.areaCode);
this.$refs.fenceMap.updateFence({
fenceType: 'area'
});
}else if(this.form.shapeType == 2){
}else if(this.form.shapeType == 1){
this.$refs.fenceMap.updateFence({
fenceType: 'circle'
});
}else if(this.form.shapeType == 5){
}else if(this.form.shapeType == 3){
this.$refs.fenceMap.updateFence({
fenceType: 'polygon'
});
......@@ -736,7 +787,7 @@ export default{
}
},
saveFence(){
if(this.form.shapeType == 5){
if(this.form.shapeType == 3){
if(this.polygonPath.length === 0){
this.$message({
message: '请绘制围栏',
......@@ -749,17 +800,16 @@ export default{
if(valid){
this.submitting = true;
if(typeof this.fenceId != 'undefined'){
const params = this.getParams();
params.id = this.fenceId;
MONITOR_SERVICE.updateFence(JSON.stringify(params)).then((res)=>{
if(res.returnCode == 0){
if(res.code == 200){
//this.closeDialog();
this.$message({
message: res.message,
message: '提交成功',
type: 'success'
});
}
......@@ -767,12 +817,12 @@ export default{
this.$router.push({path:"fenceManagement"})
});
}else{
MONITOR_SERVICE.saveFence(JSON.stringify(this.getParams())).then((res)=>{
MONITOR_SERVICE.saveFence(this.getParams()).then((res)=>{
if(res.returnCode == 0){
if(res.code == 200){
//this.closeDialog();
this.$message({
message: res.message,
message: '提交成功',
type: 'success'
});
}
......@@ -794,28 +844,28 @@ export default{
const form = this.form;
const params = {};
params.fenceNo = form.fenceNo;
params.electricFenceName = form.electricFenceName;
params.electricFenceType = form.electricFenceType;
// params.fenceNo = form.fenceNo;
params.fenceName = form.fenceName;
// params.electricFenceType = form.electricFenceType;
//params.electricTimeFenceType = form.electricTimeFenceType
//params.startTime = form.startTime;
//params.endTime = form.endTime;
params.des = form.des;
params.shopId = form.specialShopId;
// params.des = form.des;
params.shapeType = form.shapeType;
params.timeType = form.timeType;
if(params.shapeType == 3){
params.areaCode = form.areaCode;
params.areaString = form.areaString;
}else if(params.shapeType == 2){
params.lng = form.lng;
params.lat = form.lat;
params.lnglat = `${form.lng},${form.lat}`;
params.radius = form.radius;
params.analysisAddress = form.analysisAddress;
}else if(params.shapeType == 5){
}else if(params.shapeType == 3){
params.lnglat = this.polygonPath.join('|')
}
params.bizFenceType = form.bizFenceType
params.status = form.status;
// params.status = form.status;
if(this.tableData){
params.snList = this.tableData
}else{
......@@ -944,6 +994,13 @@ export default{
radius: this.form.radius
});
this.transfer()
},
handleSpecialShopChange(val) {
// 特约店级联选项
if(val && val.length > 1) {
this.form.specialShopId = val[1];
console.log(this.form.specialShopId)
}
}
},
components:{
......
......@@ -390,7 +390,7 @@ export default{
type: 'warning'
}).then(() => {
MONITOR_SERVICE.deleteFence({fenceId: id}).then((res)=>{
if(res.returnCode == 0){
if(res.code == 200){
this.$message({
message: res.message,
type: 'success'
......
......@@ -31,7 +31,7 @@
<div class="map-seacrh-wrap">
<!-- <input type="text" id="fenceMapSearch"> -->
<el-input placeholder="请输入位置" id="fenceMapSearch" size="small" v-model="fenceMapSearch">
<el-input placeholder="请输入位置" id="fenceMapSearch" size="small" v-model="fenceMapSearch" :disabled="readonlyStatus">
<template slot="prepend">搜索</template>
<!-- <el-button slot="append" icon="el-icon-search" @click="search"></el-button> -->
</el-input>
......@@ -57,7 +57,7 @@ const BUSINESS_SERVICE = services.business;
import {CONSTANT} from '../../constant'
export default{
props: ['fenceMapModalVisible', 'init'],
props: ['fenceMapModalVisible', 'init', 'readonlyStatus'],
data(){
return {
fenceMapSearch: '',
......
......@@ -7,17 +7,17 @@
<el-form :model="form" :inline="false" size="mini" class="main-form" label-width="80px">
<el-row>
<el-form-item label="用户查询" class="pull-left">
<el-input placeholder="请输入对应条件值" v-model="form.queryTerm" size="small" class="input-with-select" style="width:340px" maxlength="50" clearable>
<el-select v-model="form.queryType" slot="prepend" style="width:100px;" placeholder="请选择" size="small">
<el-input placeholder="请输入对应条件值" v-model="form.term" size="small" class="input-with-select" style="width:340px" maxlength="50" clearable>
<el-select v-model="form.termType" slot="prepend" style="width:100px;" placeholder="请选择" size="small">
<el-option label="设备号" value="1"></el-option>
<el-option label="车架号" value="2"></el-option>
<el-option label="姓名" value="3"></el-option>
<el-option label="工单号" value="4"></el-option>
<!-- <el-option label="工单号" value="4"></el-option> -->
</el-select>
</el-input>
<el-button type="primary" plain size="small" v-popover:popover>更多条件
<!-- <el-button type="primary" plain size="small" v-popover:popover>更多条件
<i class=" el-icon--right" :class="highSearchVisible?'el-icon-arrow-up':'el-icon-arrow-down'" ></i>
</el-button>
</el-button> -->
<el-button type="primary" size="small" @click="search">查询</el-button>
</el-form-item>
......@@ -98,10 +98,11 @@
<el-col :span="12" class="choose-list-wrap">
<p>结果列表</p>
<ul class="choose-list">
<li v-for="item in resultList" :key="item.standno">
<li v-for="item in resultList" :key="item.vin">
<el-checkbox v-model="item.checked" @change="checkedChange(item)" class="choose-list-checkbox">
<div class="choose-list-content">
<p>{{item.name}}/{{item.standno}}</p>
<!-- {{item.name}}/ -->
<p>{{item.vin}}</p>
<p class="choose-list-group">
<el-tag type="info" size="small" v-for="snItem in item.sns" :key="snItem">{{snItem}}</el-tag>
</p>
......@@ -119,10 +120,10 @@
<el-col :span="12" class="choose-list-wrap">
<p>已选列表</p>
<ul class="choose-list">
<li v-for="item in chosenList" :key="item.standno">
<li v-for="item in chosenList" :key="item.vin">
<el-checkbox v-model="item.checked" @change="checkedChange(item)" class="choose-list-checkbox">
<div class="choose-list-content">
<p>{{item.name}}/{{item.standno}}</p>
<p>{{item.name}}/{{item.vin}}</p>
<p class="choose-list-group">
<el-tag type="info" size="small" v-for="snItem in item.sns" :key="snItem">{{snItem}}</el-tag>
</p>
......@@ -162,8 +163,8 @@ export default{
data(){
return {
form: {
queryTerm: '',
queryType: '1',
term: '',
termType: '1',
sTime: '',
eTime: ''
},
......@@ -197,7 +198,7 @@ export default{
resultItem:'',
highSearchVisible: false,
userImportModalVisible: false,
currentPage: 1,
pageNumber: 1,
pageSize: 10,
total: 0,
maxPage: 1,
......@@ -250,7 +251,7 @@ export default{
if(newVal){
this.resultList.forEach((item)=>{
item.checked = true;
const findItem = this.chosenList.find((o)=>o.standno===item.standno)
const findItem = this.chosenList.find((o)=>o.vin===item.vin)
if(!findItem){
this.chosenList.push(item)
}
......@@ -259,7 +260,7 @@ export default{
}else{
this.resultList.forEach((item)=>{
item.checked = false;
const findItem = this.chosenList.find((o)=>o.standno===item.standno)
const findItem = this.chosenList.find((o)=>o.vin===item.vin)
if(findItem){
this.chosenList.splice(this.chosenList.indexOf(findItem), 1);
}
......@@ -290,7 +291,7 @@ export default{
userdata.push({
sn: obj.sn,
name: obj.name,
standno: obj.standno,
vin: obj.vin,
userTel:obj.userTel,
time:obj.time,
address:obj.address
......@@ -302,7 +303,7 @@ export default{
search(){
this.resultList = [];
//this.chosenList = [];
this.currentPage = 1;
this.pageNumber = 1;
this.needInfinite = false;
this.$nextTick(() => {
this.$refs.infiniteLoading && this.$refs.infiniteLoading.$emit('$InfiniteLoading:reset');
......@@ -310,27 +311,30 @@ export default{
const params = this.params;
delete params.sn;
delete params.standNo;
delete params.vin;
delete params.name;
delete params.workOrderNo;
const queryTerm = this.form.queryTerm.trim();
if(queryTerm){
switch(this.form.queryType){
case '1':
params.sn = queryTerm;
break;
case '2':
params.standNo = queryTerm;
break;
case '3':
params.name = queryTerm;
break;
case '4':
params.workOrderNo = queryTerm;
break;
}
}
let { term, termType } = this.form;
term = term.trim();
params.term = term;
params.termType = termType;
// if(term){
// switch(termType){
// case '1':
// params.sn = term;
// break;
// case '2':
// params.vin = term;
// break;
// case '3':
// params.name = term;
// break;
// case '4':
// params.workOrderNo = term;
// break;
// }
// }
this.needInfinite = true;
},
......@@ -353,7 +357,7 @@ export default{
if(item.checked){
this.resultcheck= item.checked;
this.resultItem = item;
const findItem = this.chosenList.find((o)=>o.standno===item.standno);
const findItem = this.chosenList.find((o)=>o.vin===item.vin);
if(findItem) return;
this.chosenList.push(item);
this.checkedCancel = false;
......@@ -445,38 +449,42 @@ export default{
},
infiniteHandler($state){
if(this.currentPage> this.maxPage){
if(this.pageNumber> this.maxPage){
$state.complete();
return;
}
this.params.currentPage = this.currentPage;
this.params.pageNumber = this.pageNumber;
this.params.pageSize = this.pageSize;
MONITOR_SERVICE.getVehicleSnList(this.params).then((res)=>{
const data = res.data;
if(!res.error && data && data.length){
data.map((obj)=>{
if(obj.sn){
obj.sns = obj.sn.split(',')
}else{
obj.sns = [];
}
});
this.resultList = this.resultList.concat(data);
this.total = res.recordsTotal;
this.maxPage = Math.ceil(this.total/this.pageSize);
this.currentPage++;
$state.loaded()
}else{
const { code, data, message } = res;
if(code == 200) {
const { list } = data;
if(list && list.length > 0) {
list.map((obj)=>{
if(obj.sn){
obj.sns = obj.sn.split(',')
}else{
obj.sns = [];
}
});
this.resultList = this.resultList.concat(list);
this.total = res.recordsTotal;
this.maxPage = Math.ceil(this.total/this.pageSize);
this.pageNumber++;
$state.loaded()
} else {
$state.complete();
}
} else {
$state.complete();
}
})
},
getData(curr=this.currentPage, size=this.pageSize){
getData(curr=this.pageNumber, size=this.pageSize){
this.loading = true;
let params = this.getParams();
params.currentPage = curr;
params.pageNumber = curr;
params.pageSize = size;
BUSINESS_SERVICE.getWorkOrderList(params).then((response)=>{
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!