Commit 58c1133e by 张杰

v1.6.0版本需求

1 parent 62cd1a97
import request from './request'
import store from "@/vuex/store";
console.log('store',store)
// 新增围栏
export const SAVE_ELECFENCE_INFO = 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
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
import request from './request'
// 轨迹回放-获取轨迹回放位置点
export const GET_DEVICE_LISTTRACKPOINT = params => {
return request(params, '/devicemonitor/monitor/listtrackpoint')
}
\ No newline at end of file
......@@ -68,7 +68,7 @@
<div></div>
<div>
<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>
<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 @@
<el-button v-if="!readonlyStatus" type="primary" @click="saveFence" size="small" :loading="submitting">保存</el-button>
<el-button @click="cancel" size="small">取消</el-button>
</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>
</div>
</template>
......@@ -98,7 +98,7 @@ import userList from "./fence_userlist.vue";
import InfiniteLoading from "vue-infinite-loading";
import CitySelect from "@/components/area";
const MONITOR_SERVICE = services.monitor;
import { deepClone, showToast } from "@/utils/utils";
import { deepClone, showToast,showModal } from "@/utils/utils";
import {
GET_ELECFENCE_LINKEDDEVICES,
GET_ELECFENCE_INFO,
......@@ -301,7 +301,7 @@ export default {
if (data.lng && data.lat) {
this.form.lng = data.lng;
this.form.lat = data.lat;
this.transfer();
//this.transfer();
}
if (data.polygonPath && data.polygonPath.length) {
......@@ -547,6 +547,19 @@ export default {
_this.$refs.fenceMap.initFence(mapData);
});
},
// 批量删除
batchRemove(){
showModal({
message:'确认删除选择的关联用户吗?',
showCancelButton:true,
type:'warning',
success:function(){
}
})
}
},
};
</script>
......
......@@ -98,6 +98,7 @@ import { exportExcel } from "utils";
import { CONSTANT } from "../../constant";
import InfiniteLoading from "vue-infinite-loading";
import MapControll from "./MapControll.vue";
import { GET_ELECFENCE_INFO } from "@/api/services/fence";
export default {
data() {
......@@ -239,8 +240,12 @@ export default {
//this.bindEvent();
_this.isInitMap = true;
//_this.drawPoi();
console.log(_this.fenceId != 'undefined')
if (_this.isInitFence && _this.fenceId && _this.fenceId != 'undefined') {
console.log(_this.fenceId != "undefined");
if (
_this.isInitFence &&
_this.fenceId &&
_this.fenceId != "undefined"
) {
//_this.drawFence();
_this.getFence();
}
......@@ -483,8 +488,8 @@ export default {
if (data.length) {
data.forEach((item, idx) => {
item.idx = idx;
item.standno = _this.standno
item.name = _this.name
item.standno = _this.standno;
item.name = _this.name;
});
this.resultList = data;
}
......@@ -603,6 +608,8 @@ export default {
}
});
},
// 行政区域围栏
drawDistrict(areaCode) {
this._drawDistrictTimeoutId && clearTimeout(this._drawDistrictTimeoutId);
......@@ -610,6 +617,8 @@ export default {
EventBus.$emit("uiMap.fence.drawDistrict", areaCode);
}, 500);
},
// 多边形围栏
drawPolygon(path) {
console.log("path");
EventBus.$emit("uiMap.fence.drawPolygon", {
......@@ -620,56 +629,38 @@ export default {
// 获取围栏信息-并画围栏
getFence() {
MONITOR_SERVICE.getFenceInfo({
sn: this.sn,
GET_ELECFENCE_INFO({
//sn: this.sn,
fenceId: this.fenceId,
}).then((res) => {
console.log(res);
let list = res.data || [];
if (res.code != 200) {
return false;
// const data = res.data || [];
// if (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) => {
}
let obj = res.data || {};
// 圆形围栏
if (k.shapeType == 1) {
if (obj.shapeType == 1) {
EventBus.$emit("uiMap.fence.createFenceCircle", {
lng: k.lnglat.split(",")[0],
lat: k.lnglat.split(",")[1],
radius: k.radius,
lng: obj.lnglat.split(",")[0],
lat: obj.lnglat.split(",")[1],
radius: obj.radius,
isEdit: false,
});
}
// 多边形围栏
if (k.shapeType == 3) {
let polygonPath = k.lnglat.split("|").map((item) => {
if (obj.shapeType == 3) {
let polygonPath = obj.lnglat.split("|").map((item) => {
return [item.split(",")[0], item.split(",")[1]];
});
this.drawPolygon(polygonPath);
}
});
// 行政区域围栏
if (obj.shapeType == 4) {
this.drawDistrict([obj.areaCode]);
}
});
},
},
......
......@@ -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-form ref="form" :model="form" :inline="false" size="mini" v-show="!showResult">
<el-upload ref="upload" class="upload-wrap"
: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-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">
<el-input v-model="filename" placeholder="未选取任何文件" class="input-with-select" size="small" >
<el-button slot="append" >浏览</el-button>
<el-input v-model="filename" placeholder="未选取任何文件" class="input-with-select" size="small">
<el-button slot="append">浏览</el-button>
</el-input>
<div slot="tip" class="el-upload__tip">请选择需要导入的工单表格</div>
......@@ -48,66 +40,74 @@
</template>
<script>
import {exportExcel} from 'utils'
import {IMPORT_ELECFENCE_LINKEDDEVICES} from '@/api/services/fence'
export default{
props: ['userImportModalVisible'],
data(){
import { exportExcel } from "utils";
import {
IMPORT_ELECFENCE_LINKEDDEVICES,
DOWN_ELECFENCE_EXCELTEMPLATE,
} from "@/api/services/fence";
import { downFileByPath } from "@/utils/utils";
export default {
props: ["userImportModalVisible"],
data() {
return {
form: {
},
form: {},
showResult: false,
successNum: '',
errorNum: '',
seqNo: '',
successNum: "",
errorNum: "",
seqNo: "",
importing: false,
filename: '',
flag:[],
IMPORT_ELECFENCE_LINKEDDEVICES
}
filename: "",
flag: [],
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: {
doneResult(){
this.$emit('onUserImportModalChange', false);
this.$emit('onRefreshList');
doneResult() {
this.$emit("onUserImportModalChange", false);
this.$emit("onRefreshList");
this.showResult = false;
this.successNum = '';
this.errorNum = '';
this.seqNo = '';
this.successNum = "";
this.errorNum = "";
this.seqNo = "";
this.importing = false;
this.filename = '';
this.filename = "";
},
exportErrorResult(){
if(this.errorNum!=0){
exportExcel('ecFence/exportFailSn', {seqNo: this.seqNo})
}else{
exportErrorResult() {
if (this.errorNum != 0) {
exportExcel("ecFence/exportFailSn", { seqNo: this.seqNo });
} else {
return false;
}
},
successUpload(res){
successUpload(res) {
this.importing = false;
if(typeof res === 'object'){
if(res.returnCode == 0){
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])
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])
} else {
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);
//console.log(this.flag)
......@@ -116,10 +116,9 @@
this.seqNo = data.seqNo;
this.$refs.upload.clearFiles();
this.showResult = true;
}else{
this.flag = res.data.returnDate
this.$emit('exportDate', res.data.returnDate)
} 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;
......@@ -127,13 +126,10 @@
this.$refs.upload.clearFiles();
this.showResult = true;
}
}
}else{
window.location.href = '../ots/login';
} else {
//window.location.href = '../ots/login';
}
},
submitUpload() {
this.$refs.upload.submit();
......@@ -141,39 +137,45 @@
changeFile(file, filelist) {
this.filename = file.name;
},
beforeUpload(file){
if(file.name == this.filename){
beforeUpload(file) {
if (file.name == this.filename) {
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(){
this.$emit('onUserImportModalChange', true)
openDialog() {
this.$emit("onUserImportModalChange", true);
},
closeDialog(){
this.$emit('onUserImportModalChange', false);
closeDialog() {
this.$emit("onUserImportModalChange", false);
},
errorUpload(err){
errorUpload(err) {
//window.location.href = '../ots/login';
}
}
}
},
},
};
</script>
<style>
.import-dialog .upload-wrap .el-upload{
.import-dialog .upload-wrap .el-upload {
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;
}
.import-dialog .result-row .el-col+.el-col{
}
.import-dialog .result-row .el-col + .el-col {
border-left: 1px solid #eee;
}
}
</style>
\ No newline at end of file
......@@ -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 showToast = Util.Info
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!