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", {
// lng: data.lng,
// lat: data.lat,
// radius: data.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 (k.shapeType == 1) { if (obj.shapeType == 1) {
EventBus.$emit("uiMap.fence.createFenceCircle", { EventBus.$emit("uiMap.fence.createFenceCircle", {
lng: k.lnglat.split(",")[0], lng: obj.lnglat.split(",")[0],
lat: k.lnglat.split(",")[1], lat: obj.lnglat.split(",")[1],
radius: k.radius, radius: obj.radius,
isEdit: false, isEdit: false,
}); });
} }
// 多边形围栏 // 多边形围栏
if (k.shapeType == 3) { if (obj.shapeType == 3) {
let polygonPath = k.lnglat.split("|").map((item) => { let polygonPath = obj.lnglat.split("|").map((item) => {
return [item.split(",")[0], item.split(",")[1]]; return [item.split(",")[0], item.split(",")[1]];
}); });
this.drawPolygon(polygonPath); this.drawPolygon(polygonPath);
} }
});
// 行政区域围栏
if (obj.shapeType == 4) {
this.drawDistrict([obj.areaCode]);
}
}); });
}, },
}, },
......
...@@ -3,18 +3,10 @@ ...@@ -3,18 +3,10 @@
<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>
...@@ -48,66 +40,74 @@ ...@@ -48,66 +40,74 @@
</template> </template>
<script> <script>
import {exportExcel} from 'utils' import { exportExcel } from "utils";
import {IMPORT_ELECFENCE_LINKEDDEVICES} from '@/api/services/fence' import {
export default{ IMPORT_ELECFENCE_LINKEDDEVICES,
props: ['userImportModalVisible'], DOWN_ELECFENCE_EXCELTEMPLATE,
data(){ } from "@/api/services/fence";
import { downFileByPath } from "@/utils/utils";
export default {
props: ["userImportModalVisible"],
data() {
return { return {
form: { form: {},
},
showResult: false, showResult: false,
successNum: '', successNum: "",
errorNum: '', errorNum: "",
seqNo: '', seqNo: "",
importing: false, importing: false,
filename: '', filename: "",
flag:[], flag: [],
IMPORT_ELECFENCE_LINKEDDEVICES IMPORT_ELECFENCE_LINKEDDEVICES,
} uploadHeaders: {},
uploadParams: {},
};
},
created() {
let query = this.$route.query;
let token = localStorage.getItem("token");
this.uploadHeaders = { Authorization: token };
this.uploadParams = { fenceId: query.id };
}, },
methods: { methods: {
doneResult(){ doneResult() {
this.$emit('onUserImportModalChange', false); this.$emit("onUserImportModalChange", false);
this.$emit('onRefreshList'); this.$emit("onRefreshList");
this.showResult = false; this.showResult = false;
this.successNum = ''; this.successNum = "";
this.errorNum = ''; this.errorNum = "";
this.seqNo = ''; this.seqNo = "";
this.importing = false; this.importing = false;
this.filename = ''; this.filename = "";
}, },
exportErrorResult(){ exportErrorResult() {
if(this.errorNum!=0){ if (this.errorNum != 0) {
exportExcel('ecFence/exportFailSn', {seqNo: this.seqNo}) exportExcel("ecFence/exportFailSn", { seqNo: this.seqNo });
}else{ } else {
return false; return false;
} }
}, },
successUpload(res){ successUpload(res) {
this.importing = false; this.importing = false;
if(typeof res === 'object'){ if (typeof res === "object") {
if(res.returnCode == 0){ if (res.returnCode == 0) {
const data = res.data; const data = res.data;
let returnDate=[]; let returnDate = [];
if(this.flag.length!=0){ if (this.flag.length != 0) {
function noRepeat(obj1,obj2){ function noRepeat(obj1, obj2) {
for(var key in obj2){ for (var key in obj2) {
if(obj1[key]){ if (obj1[key]) {
if(obj1[key].sn!=obj2[key].sn){ if (obj1[key].sn != obj2[key].sn) {
returnDate.push(obj2[key]) returnDate.push(obj2[key]);
} }
}else{ } else {
returnDate.push(obj2[key]) returnDate.push(obj2[key]);
} }
} }
} }
noRepeat(this.flag,res.data.returnDate) 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) //console.log(this.flag)
...@@ -116,10 +116,9 @@ ...@@ -116,10 +116,9 @@
this.seqNo = data.seqNo; this.seqNo = data.seqNo;
this.$refs.upload.clearFiles(); this.$refs.upload.clearFiles();
this.showResult = true; this.showResult = true;
} else {
}else{ this.flag = res.data.returnDate;
this.flag = res.data.returnDate this.$emit("exportDate", res.data.returnDate);
this.$emit('exportDate', res.data.returnDate)
this.successNum = data.success; this.successNum = data.success;
this.errorNum = parseInt(data.fail); this.errorNum = parseInt(data.fail);
this.seqNo = data.seqNo; this.seqNo = data.seqNo;
...@@ -127,13 +126,10 @@ ...@@ -127,13 +126,10 @@
this.$refs.upload.clearFiles(); this.$refs.upload.clearFiles();
this.showResult = true; this.showResult = true;
} }
} }
}else{ } else {
window.location.href = '../ots/login'; //window.location.href = '../ots/login';
} }
}, },
submitUpload() { submitUpload() {
this.$refs.upload.submit(); this.$refs.upload.submit();
...@@ -141,39 +137,45 @@ ...@@ -141,39 +137,45 @@
changeFile(file, filelist) { changeFile(file, filelist) {
this.filename = file.name; this.filename = file.name;
}, },
beforeUpload(file){ beforeUpload(file) {
if(file.name == this.filename){ if (file.name == this.filename) {
this.importing = true; this.importing = true;
return true return true;
} }
return false return false;
}, },
downloadTpl(){ // 批量导入模板下载
exportExcel('/ecFence/downTemplates') downloadTpl() {
DOWN_ELECFENCE_EXCELTEMPLATE().then((res) => {
let obj = res.data;
if (obj.dictValue) {
downFileByPath(obj.dictValue);
}
});
}, },
openDialog(){ openDialog() {
this.$emit('onUserImportModalChange', true) this.$emit("onUserImportModalChange", true);
}, },
closeDialog(){ closeDialog() {
this.$emit('onUserImportModalChange', false); this.$emit("onUserImportModalChange", false);
}, },
errorUpload(err){ errorUpload(err) {
//window.location.href = '../ots/login'; //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,
.import-dialog .el-icon-error {
font-size: 30px; font-size: 30px;
} }
.import-dialog .result-row .el-col+.el-col{ .import-dialog .result-row .el-col + .el-col {
border-left: 1px solid #eee; 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!