Commit 58c1133e by 张杰

v1.6.0版本需求

1 parent 62cd1a97
import request from './request' import request from './request'
import store from "@/vuex/store";
console.log('store',store)
// 新增围栏 // 新增围栏
export const SAVE_ELECFENCE_INFO = params => { export const SAVE_ELECFENCE_INFO = params => {
...@@ -31,4 +33,9 @@ export const REMOVE_ELECFENCE_LINKEDDEVICES = params => { ...@@ -31,4 +33,9 @@ export const REMOVE_ELECFENCE_LINKEDDEVICES = params => {
} }
//新增、编辑围栏-批量导入关联设备 //新增、编辑围栏-批量导入关联设备
export const IMPORT_ELECFENCE_LINKEDDEVICES = '/trialdrive/elecfence/batchImport'
\ No newline at end of file \ No newline at end of file
export const IMPORT_ELECFENCE_LINKEDDEVICES = `${store.getters.baseURL}/trialdrive/elecfence/batchImport`
//新增、编辑围栏-批量导入模板下载
export const DOWN_ELECFENCE_EXCELTEMPLATE = params => {
return request(params, '/publiccenter/dict/data/type/excelTemplate/batchLinkFenceSns')
}
\ No newline at end of file \ No newline at end of file
import request from './request'
// 轨迹回放-获取轨迹回放位置点
export const GET_DEVICE_LISTTRACKPOINT = params => {
return request(params, '/devicemonitor/monitor/listtrackpoint')
}
\ No newline at end of file \ No newline at end of file
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
<div></div> <div></div>
<div> <div>
<el-button v-if="!readonlyStatus" 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">批量删除</el-button> <el-button size="small" :disabled="!selectedIds || selectedIds.length<=0" @click="batchRemove">批量删除</el-button>
</div> </div>
</div> </div>
<el-table class="el_table" :data="tableData" border height="300" size="small" v-loading="loading" @selection-change="selectChange" style="width: 100%;margin-bottom:40px"> <el-table class="el_table" :data="tableData" border height="300" size="small" v-loading="loading" @selection-change="selectChange" style="width: 100%;margin-bottom:40px">
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
<el-button v-if="!readonlyStatus" type="primary" @click="saveFence" size="small" :loading="submitting">保存</el-button> <el-button v-if="!readonlyStatus" type="primary" @click="saveFence" size="small" :loading="submitting">保存</el-button>
<el-button @click="cancel" size="small">取消</el-button> <el-button @click="cancel" size="small">取消</el-button>
</div> </div>
<user-list :init="userListInit" @onUserListInit="(res)=>userListInit=res" :userData="tableData" @onUpdateUserData="updateUserData" :userListModalVisible="userListModalVisible" :shopId="form.specialShopId" @onUserListModalChange="userListModalChange" ref="userList"> <user-list :init="userListInit" v-if="userListModalVisible" @onUserListInit="(res)=>userListInit=res" :userData="tableData" @onUpdateUserData="updateUserData" :userListModalVisible="userListModalVisible" :shopId="form.specialShopId" @onUserListModalChange="userListModalChange" ref="userList">
</user-list> </user-list>
</div> </div>
</template> </template>
...@@ -98,7 +98,7 @@ import userList from "./fence_userlist.vue"; ...@@ -98,7 +98,7 @@ import userList from "./fence_userlist.vue";
import InfiniteLoading from "vue-infinite-loading"; import InfiniteLoading from "vue-infinite-loading";
import CitySelect from "@/components/area"; import CitySelect from "@/components/area";
const MONITOR_SERVICE = services.monitor; const MONITOR_SERVICE = services.monitor;
import { deepClone, showToast } from "@/utils/utils"; import { deepClone, showToast,showModal } from "@/utils/utils";
import { import {
GET_ELECFENCE_LINKEDDEVICES, GET_ELECFENCE_LINKEDDEVICES,
GET_ELECFENCE_INFO, GET_ELECFENCE_INFO,
...@@ -301,7 +301,7 @@ export default { ...@@ -301,7 +301,7 @@ export default {
if (data.lng && data.lat) { if (data.lng && data.lat) {
this.form.lng = data.lng; this.form.lng = data.lng;
this.form.lat = data.lat; this.form.lat = data.lat;
this.transfer(); //this.transfer();
} }
if (data.polygonPath && data.polygonPath.length) { if (data.polygonPath && data.polygonPath.length) {
...@@ -547,6 +547,19 @@ export default { ...@@ -547,6 +547,19 @@ export default {
_this.$refs.fenceMap.initFence(mapData); _this.$refs.fenceMap.initFence(mapData);
}); });
}, },
// 批量删除
batchRemove(){
showModal({
message:'确认删除选择的关联用户吗?',
showCancelButton:true,
type:'warning',
success:function(){
}
})
}
}, },
}; };
</script> </script>
......
...@@ -98,6 +98,7 @@ import { exportExcel } from "utils"; ...@@ -98,6 +98,7 @@ import { exportExcel } from "utils";
import { CONSTANT } from "../../constant"; import { CONSTANT } from "../../constant";
import InfiniteLoading from "vue-infinite-loading"; import InfiniteLoading from "vue-infinite-loading";
import MapControll from "./MapControll.vue"; import MapControll from "./MapControll.vue";
import { GET_ELECFENCE_INFO } from "@/api/services/fence";
export default { export default {
data() { data() {
...@@ -239,8 +240,12 @@ export default { ...@@ -239,8 +240,12 @@ export default {
//this.bindEvent(); //this.bindEvent();
_this.isInitMap = true; _this.isInitMap = true;
//_this.drawPoi(); //_this.drawPoi();
console.log(_this.fenceId != 'undefined') console.log(_this.fenceId != "undefined");
if (_this.isInitFence && _this.fenceId && _this.fenceId != 'undefined') { if (
_this.isInitFence &&
_this.fenceId &&
_this.fenceId != "undefined"
) {
//_this.drawFence(); //_this.drawFence();
_this.getFence(); _this.getFence();
} }
...@@ -483,8 +488,8 @@ export default { ...@@ -483,8 +488,8 @@ export default {
if (data.length) { if (data.length) {
data.forEach((item, idx) => { data.forEach((item, idx) => {
item.idx = idx; item.idx = idx;
item.standno = _this.standno item.standno = _this.standno;
item.name = _this.name item.name = _this.name;
}); });
this.resultList = data; this.resultList = data;
} }
...@@ -603,6 +608,8 @@ export default { ...@@ -603,6 +608,8 @@ export default {
} }
}); });
}, },
// 行政区域围栏
drawDistrict(areaCode) { drawDistrict(areaCode) {
this._drawDistrictTimeoutId && clearTimeout(this._drawDistrictTimeoutId); this._drawDistrictTimeoutId && clearTimeout(this._drawDistrictTimeoutId);
...@@ -610,6 +617,8 @@ export default { ...@@ -610,6 +617,8 @@ export default {
EventBus.$emit("uiMap.fence.drawDistrict", areaCode); EventBus.$emit("uiMap.fence.drawDistrict", areaCode);
}, 500); }, 500);
}, },
// 多边形围栏
drawPolygon(path) { drawPolygon(path) {
console.log("path"); console.log("path");
EventBus.$emit("uiMap.fence.drawPolygon", { EventBus.$emit("uiMap.fence.drawPolygon", {
...@@ -620,56 +629,38 @@ export default { ...@@ -620,56 +629,38 @@ export default {
// 获取围栏信息-并画围栏 // 获取围栏信息-并画围栏
getFence() { getFence() {
MONITOR_SERVICE.getFenceInfo({ GET_ELECFENCE_INFO({
sn: this.sn, //sn: this.sn,
fenceId: this.fenceId, fenceId: this.fenceId,
}).then((res) => { }).then((res) => {
console.log(res); console.log(res);
let list = res.data || []; let list = res.data || [];
if (res.code != 200) { if (res.code != 200) {
return false; return false;
// const data = res.data || []; }
// if (data) { let obj = res.data || {};
// if (data.shapeType === 2) { // 圆形围栏
// EventBus.$emit("uiMap.fence.createFenceCircle", { if (obj.shapeType == 1) {
// lng: data.lng, EventBus.$emit("uiMap.fence.createFenceCircle", {
// lat: data.lat, lng: obj.lnglat.split(",")[0],
// radius: data.radius, lat: obj.lnglat.split(",")[1],
// isEdit: false, radius: obj.radius,
// }); isEdit: false,
// } else if (data.shapeType === 3) { });
// this.drawDistrict(data.areaCode);
// } else if (data.shapeType === 5) {
// if (data.lnglat) {
// let polygonPath = data.lnglat.split("|").map((item) => {
// return [item.split(",")[0], item.split(",")[1]];
// });
// this.drawPolygon(polygonPath);
// }
// }
// }
} }
// 循环画围栏 // 多边形围栏
list.map((k) => { if (obj.shapeType == 3) {
// 圆形围栏 let polygonPath = obj.lnglat.split("|").map((item) => {
if (k.shapeType == 1) { return [item.split(",")[0], item.split(",")[1]];
EventBus.$emit("uiMap.fence.createFenceCircle", { });
lng: k.lnglat.split(",")[0], this.drawPolygon(polygonPath);
lat: k.lnglat.split(",")[1], }
radius: k.radius,
isEdit: false,
});
}
// 多边形围栏 // 行政区域围栏
if (k.shapeType == 3) { if (obj.shapeType == 4) {
let polygonPath = k.lnglat.split("|").map((item) => { this.drawDistrict([obj.areaCode]);
return [item.split(",")[0], item.split(",")[1]]; }
});
this.drawPolygon(polygonPath);
}
});
}); });
}, },
}, },
......
<template> <template>
<!-- 批量导入弹框 --> <!-- 批量导入弹框 -->
<el-dialog class="import-dialog" title="批量导入" :visible="userImportModalVisible" @open="openDialog" @close="closeDialog" append-to-body width="600px" :close-on-click-modal="false"> <el-dialog class="import-dialog" title="批量导入" :visible="userImportModalVisible" @open="openDialog" @close="closeDialog" append-to-body width="600px" :close-on-click-modal="false">
<el-form ref="form" :model="form" :inline="false" size="mini" v-show="!showResult"> <el-form ref="form" :model="form" :inline="false" size="mini" v-show="!showResult">
<el-upload ref="upload" class="upload-wrap" <el-upload ref="upload" class="upload-wrap" :action="IMPORT_ELECFENCE_LINKEDDEVICES" :data="uploadParams" :headers="uploadHeaders" :on-change="changeFile" :before-upload="beforeUpload" :multiple="false" :show-file-list="false" :on-success="successUpload" :on-error="errorUpload" :auto-upload="false">
:action="IMPORT_ELECFENCE_LINKEDDEVICES"
:on-change="changeFile"
:before-upload="beforeUpload"
:multiple="false"
:show-file-list="false"
:on-success="successUpload"
:on-error="errorUpload"
:auto-upload="false">
<el-input v-model="filename" placeholder="未选取任何文件" class="input-with-select" size="small" > <el-input v-model="filename" placeholder="未选取任何文件" class="input-with-select" size="small">
<el-button slot="append" >浏览</el-button> <el-button slot="append">浏览</el-button>
</el-input> </el-input>
<div slot="tip" class="el-upload__tip">请选择需要导入的工单表格</div> <div slot="tip" class="el-upload__tip">请选择需要导入的工单表格</div>
</el-upload> </el-upload>
</el-form> </el-form>
<el-row v-show="showResult" class="result-row">
<el-col :span="12" class="text-center">
<p><i class="el-icon-success el-alert--success"></i></p>
<p><strong>{{successNum}}</strong><br>成功记录</p>
</el-col>
<el-col :span="12" class="text-center">
<p><i class="el-icon-error el-alert--error"></i></p>
<p><strong>{{errorNum}}</strong><br>失败记录</p>
</el-col>
</el-row>
<div slot="footer" class="dialog-footer"> <el-row v-show="showResult" class="result-row">
<div v-show="!showResult" class="success"> <el-col :span="12" class="text-center">
<el-button type="primary" @click="downloadTpl" size="small" class="pull-left">下载模板</el-button> <p><i class="el-icon-success el-alert--success"></i></p>
<el-button type="primary" @click="submitUpload" size="small" :loading="importing">提交</el-button> <p><strong>{{successNum}}</strong><br>成功记录</p>
<el-button @click="$emit('onUserImportModalChange', false)" size="small">关闭</el-button> </el-col>
</div> <el-col :span="12" class="text-center">
<p><i class="el-icon-error el-alert--error"></i></p>
<div v-show="showResult"> <p><strong>{{errorNum}}</strong><br>失败记录</p>
<el-button :type="errorNum!=0?'primary':'info'" @click="exportErrorResult" size="small" class="pull-left">导出失败结果</el-button> </el-col>
<el-button @click="doneResult" size="small" type="primary">完成</el-button> </el-row>
</div>
</div>
</el-dialog>
</template> <div slot="footer" class="dialog-footer">
<script> <div v-show="!showResult" class="success">
import {exportExcel} from 'utils' <el-button type="primary" @click="downloadTpl" size="small" class="pull-left">下载模板</el-button>
import {IMPORT_ELECFENCE_LINKEDDEVICES} from '@/api/services/fence' <el-button type="primary" @click="submitUpload" size="small" :loading="importing">提交</el-button>
export default{ <el-button @click="$emit('onUserImportModalChange', false)" size="small">关闭</el-button>
props: ['userImportModalVisible'], </div>
data(){
return {
form: {
}, <div v-show="showResult">
showResult: false, <el-button :type="errorNum!=0?'primary':'info'" @click="exportErrorResult" size="small" class="pull-left">导出失败结果</el-button>
successNum: '', <el-button @click="doneResult" size="small" type="primary">完成</el-button>
errorNum: '', </div>
seqNo: '', </div>
importing: false, </el-dialog>
filename: '',
flag:[],
IMPORT_ELECFENCE_LINKEDDEVICES
}
},
methods: {
doneResult(){
this.$emit('onUserImportModalChange', false);
this.$emit('onRefreshList');
this.showResult = false;
this.successNum = '';
this.errorNum = '';
this.seqNo = '';
this.importing = false;
this.filename = '';
}, </template>
exportErrorResult(){ <script>
if(this.errorNum!=0){ import { exportExcel } from "utils";
exportExcel('ecFence/exportFailSn', {seqNo: this.seqNo}) import {
}else{ IMPORT_ELECFENCE_LINKEDDEVICES,
return false; DOWN_ELECFENCE_EXCELTEMPLATE,
} } from "@/api/services/fence";
import { downFileByPath } from "@/utils/utils";
}, export default {
successUpload(res){ props: ["userImportModalVisible"],
this.importing = false; data() {
if(typeof res === 'object'){ return {
if(res.returnCode == 0){ form: {},
const data = res.data; showResult: false,
let returnDate=[]; successNum: "",
if(this.flag.length!=0){ errorNum: "",
function noRepeat(obj1,obj2){ seqNo: "",
for(var key in obj2){ importing: false,
if(obj1[key]){ filename: "",
if(obj1[key].sn!=obj2[key].sn){ flag: [],
returnDate.push(obj2[key]) IMPORT_ELECFENCE_LINKEDDEVICES,
} uploadHeaders: {},
}else{ uploadParams: {},
returnDate.push(obj2[key]) };
} },
} created() {
} let query = this.$route.query;
noRepeat(this.flag,res.data.returnDate) let token = localStorage.getItem("token");
this.uploadHeaders = { Authorization: token };
this.uploadParams = { fenceId: query.id };
},
methods: {
doneResult() {
this.$emit("onUserImportModalChange", false);
this.$emit("onRefreshList");
this.showResult = false;
this.successNum = "";
this.errorNum = "";
this.seqNo = "";
this.importing = false;
this.filename = "";
},
exportErrorResult() {
if (this.errorNum != 0) {
exportExcel("ecFence/exportFailSn", { seqNo: this.seqNo });
} else {
return false;
}
},
successUpload(res) {
this.importing = false;
if (typeof res === "object") {
if (res.returnCode == 0) {
const data = res.data;
let returnDate = [];
if (this.flag.length != 0) {
function noRepeat(obj1, obj2) {
for (var key in obj2) {
if (obj1[key]) {
if (obj1[key].sn != obj2[key].sn) {
returnDate.push(obj2[key]);
}
} else {
returnDate.push(obj2[key]);
}
}
}
noRepeat(this.flag, res.data.returnDate);
this.$emit('exportDate', returnDate); this.$emit("exportDate", returnDate);
this.flag.push(...returnDate); this.flag.push(...returnDate);
//console.log(this.flag)
this.successNum = returnDate.length;
this.errorNum = parseInt(data.fail);
this.seqNo = data.seqNo;
this.$refs.upload.clearFiles();
this.showResult = true;
}else{
this.flag = res.data.returnDate
this.$emit('exportDate', res.data.returnDate)
this.successNum = data.success;
this.errorNum = parseInt(data.fail);
this.seqNo = data.seqNo;
this.$refs.upload.clearFiles(); //console.log(this.flag)
this.showResult = true; this.successNum = returnDate.length;
} this.errorNum = parseInt(data.fail);
this.seqNo = data.seqNo;
} this.$refs.upload.clearFiles();
}else{ this.showResult = true;
window.location.href = '../ots/login'; } else {
} this.flag = res.data.returnDate;
this.$emit("exportDate", res.data.returnDate);
this.successNum = data.success;
this.errorNum = parseInt(data.fail);
this.seqNo = data.seqNo;
this.$refs.upload.clearFiles();
}, this.showResult = true;
submitUpload() { }
this.$refs.upload.submit(); }
}, } else {
changeFile(file, filelist) { //window.location.href = '../ots/login';
this.filename = file.name; }
}, },
beforeUpload(file){ submitUpload() {
if(file.name == this.filename){ this.$refs.upload.submit();
this.importing = true; },
return true changeFile(file, filelist) {
} this.filename = file.name;
},
beforeUpload(file) {
if (file.name == this.filename) {
this.importing = true;
return true;
}
return false return false;
}, },
downloadTpl(){ // 批量导入模板下载
exportExcel('/ecFence/downTemplates') downloadTpl() {
}, DOWN_ELECFENCE_EXCELTEMPLATE().then((res) => {
openDialog(){ let obj = res.data;
this.$emit('onUserImportModalChange', true) if (obj.dictValue) {
}, downFileByPath(obj.dictValue);
closeDialog(){ }
this.$emit('onUserImportModalChange', false); });
},
}, openDialog() {
errorUpload(err){ this.$emit("onUserImportModalChange", true);
//window.location.href = '../ots/login'; },
} closeDialog() {
} this.$emit("onUserImportModalChange", false);
} },
errorUpload(err) {
//window.location.href = '../ots/login';
},
},
};
</script> </script>
<style> <style>
.import-dialog .upload-wrap .el-upload{ .import-dialog .upload-wrap .el-upload {
width: 100%; width: 100%;
} }
.import-dialog .el-icon-success, .import-dialog .el-icon-error{ .import-dialog .el-icon-success,
font-size: 30px; .import-dialog .el-icon-error {
} font-size: 30px;
.import-dialog .result-row .el-col+.el-col{ }
border-left: 1px solid #eee; .import-dialog .result-row .el-col + .el-col {
} border-left: 1px solid #eee;
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -256,6 +256,20 @@ export const Util = { ...@@ -256,6 +256,20 @@ export const Util = {
}, },
} }
// 通过url下载文件
export const downFileByPath = function(url){
if (!url) {
return false;
};
// let link = document.createElement('a')
// link.style.display = 'none'
// link.src = url
// link.target = '_blank'
// document.body.appendChild(link);
// link.click();
window.location.href = url
}
export const showModal = Util.msg export const showModal = Util.msg
export const showToast = Util.Info export const showToast = Util.Info
export const showLoading = Util.loading export const showLoading = Util.loading
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!