Commit 46af6280 authored by 杨帆's avatar 杨帆

Merge branch 'dev-yf'' into 'develop'

Dev yf'

See merge request !32
parents 341c3c2f 3fc1d71e
......@@ -18,7 +18,7 @@
> -->
<van-checkbox
style="margin: 0px 10px;"
v-for="(item, index) in listdata"
v-for="(item, index) in listDataCopy"
:name="item.dictLabel"
:key="index"
@click="selData(item)"
......@@ -68,7 +68,10 @@ export default {
components: {
// LHeader
},
created() {},
created() {
this.listDataCopy = this.listdata;
},
data() {
return {
text: "选择人员",
......@@ -80,6 +83,7 @@ export default {
loading: false,
finished: false,
projectList: [],
listDataCopy: [],
itemSel: {}
};
},
......@@ -90,7 +94,10 @@ export default {
this.pageNum = 1;
this.finished = false;
this.loading = true;
this.getInsideUser();
// this.getInsideUser();
this.listDataCopy = this.listdata.filter(item => {
return item.dictLabel.indexOf(this.searchVal) > -1;
});
}, 800),
selData(e) {
......
......@@ -122,7 +122,8 @@
<script>
import { GridLayout, GridItem } from "vue-grid-layout";
import screenfull from "screenfull";
import { Toast } from "vant";
import { Toast, Dialog } from "vant";
import { debounce } from "@/utils/common.js";
import { getFun, postFun } from "@/service/table.js";
// 动态添加/删除
export default {
......@@ -134,6 +135,7 @@ export default {
data() {
return {
text: "房间位置绘制工具",
isabled: true,
layout: [
// { x: 0, y: 0, w: 2, h: 3, i: "1",name: "办公室1",c:'#FF4433',isDraggable:false,isResizable:false,},
// { x: 2, y: 0, w: 2, h: 3, i: "2",name: "办公室2",c:'#FF9800',isDraggable:false,isResizable:false},
......@@ -159,7 +161,8 @@ export default {
isBase: false,
baseName: "",
baseArr: [],
layoutData: []
layoutData: [],
layoutDataStr: []
};
},
props: {
......@@ -267,6 +270,7 @@ export default {
if (res.code == 200) {
this.layout = [];
this.layoutData = res.data;
this.layoutDataStr = JSON.stringify(this.layoutData);
res.data.forEach(item => {
item.position = JSON.parse(item.position);
item.position.i = item.id;
......@@ -275,24 +279,10 @@ export default {
item.position.isDraggable = false;
item.position.isResizable = false;
}
if (!this.isViews ) {
if (!this.isViews) {
//添加页面不显示颜色
item.position.c = "#e6e5e5";
} else {
/**
* 根据风险评分来匹配相应的颜色
* score 风险评分字段
*/
// item.score = Number(item.score)
// if (item.score>=21 && item.score <= 27) { //优
// item.position.c = this.colorList[3]
// }else if(item.score>=14 && item.score <=20){ //良
// item.position.c = this.colorList[2]
// }else if (item.score>=7&& item.score <= 13) { //中
// item.position.c = this.colorList[1]
// }else if (item.score>=0 && item.score <= 6) { //差
// item.position.c = this.colorList[0]
// }
item.position.c = item.color;
}
this.layout.push(item.position);
......@@ -317,14 +307,6 @@ export default {
},
// 增加
addItem() {
if (this.layout.find(item => item.i == "")) {
Toast.fail({
title: "提示",
forbidClick: true,
message: "请先点击确定,保存当前房间信息"
});
return;
}
this.roomType = "";
this.roomName = "";
this.title = "创建房间";
......@@ -334,14 +316,6 @@ export default {
},
// 添加其他
addOther() {
if (this.layout.find(item => item.i == "")) {
Toast.fail({
title: "提示",
forbidClick: true,
message: "请先点击确定,保存当前房间信息"
});
return;
}
this.isRoom = false;
this.isBase = false;
this.roomType = "";
......@@ -351,27 +325,25 @@ export default {
},
// 删除
removeItem(val) {
if (val == "") {
const index = this.layout.map(item => item.i).indexOf(val);
this.layout.splice(index, 1);
return;
}
this.$dialog
.confirm({
title: "提示",
message: "是否删除"
})
.then(() => {
postFun("/ledger/room/delete/" + val)
.then(res => {
if (res.code == 200) {
Toast.success("删除成功");
this.getRoomInfo();
}
})
.catch(err => {
console.log("err==>>", err);
});
console.log(this.layout, val);
const index = this.layout.map(item => item.i).indexOf(val);
this.layout.splice(index, 1);
this.layoutData.splice(index, 1);
// postFun("/ledger/room/delete/" + val)
// .then(res => {
// if (res.code == 200) {
// Toast.success("删除成功");
// this.getRoomInfo();
// }
// })
// .catch(err => {
// });
})
.catch(() => {
// on cancel
......@@ -379,14 +351,6 @@ export default {
},
//添加基础设施
addBase() {
if (this.layout.find(item => item.i == "")) {
Toast.fail({
title: "提示",
forbidClick: true,
message: "请先点击确定,保存当前房间信息"
});
return;
}
this.roomType = "";
this.roomName = "";
this.title = "添加基础设备";
......@@ -396,37 +360,72 @@ export default {
},
// 移动后的事件
movedEvent(i, newX, newY) {
this.layOutItem.x = newX;
this.layOutItem.y = newY;
// console.log(this.layOutItem, "movedEvent");
// this.layOutItem.x = newX;
// this.layOutItem.y = newY;
// console.log('layOutItem==>>',this.layOutItem)
// console.log('this.layout==>>',this.layout)
},
// 调整大小后的事件
resizedEvent: function(i, newH, newW) {
this.layOutItem.w = newW;
this.layOutItem.h = newH;
// console.log(this.layOutItem, "resizedEvent");
// this.layOutItem.w = newW;
// this.layOutItem.h = newH;
// console.log('layOutItem==>>',this.layOutItem)
// console.log('this.layout==>>',this.layout)
},
//关闭
close() {
history.go(-1);
this.layoutData.forEach(item => {
if (
typeof item.position == "object" &&
Object.prototype.toString.call(item.position) === "[object Object]"
) {
item.position = JSON.stringify(item.position);
}
});
this.$dialog
.confirm({
title: "提示",
message: "是否保存已修改内容?"
})
.then(() => {
this.confim();
history.go(-1);
// on confirm
})
.catch(() => {
history.go(-1);
// on cancel
});
},
//edger/room/update/batch
// 确定 执行批量编辑保存
confim() {
// if (this.roomName == '') {
// Toast.fail({
// title: '提示',
// forbidClick: true,
// message: '请先添加房间!',
// })
// return
// }
confim: debounce(function() {
this.$toast.loading({
message: "处理中...",
forbidClick: true,
loadingType: "spinner",
duration: 3
});
//修改房间后返回清掉房间的值
var inherenForm = JSON.parse(sessionStorage.getItem("inherenForm"));
if (inherenForm) {
inherenForm.roomName = "";
inherenForm.roomId = "";
sessionStorage.setItem("inherenForm", JSON.stringify(inherenForm));
}
//保存
let data = this.layoutData;
this.layoutData.forEach(item => {
item.position = JSON.stringify(item.position);
data.forEach(item => {
if (
typeof item.position == "object" &&
Object.prototype.toString.call(item.position) === "[object Object]"
) {
item.position = JSON.stringify(item.position);
}
});
console.log("data==>>", data);
postFun("/ledger/room/update/batch", data)
.then(res => {
if (res.code == 200) {
......@@ -437,9 +436,10 @@ export default {
.catch(err => {
console.log("err==>>", err);
});
},
}),
//保存房间名称
saveRoomName() {
// this.confim();
if (this.roomName == "") {
Toast.fail({
title: "提示",
......@@ -448,13 +448,23 @@ export default {
});
return;
}
console.log(this.layout);
var i =
this.layout && this.layout.length > 0
? Math.max.apply(
Math,
this.layout.map(item => {
return item.id;
})
) + 1
: 1;
this.layOutItem = {
x: (this.layout.length * 2) % (this.colNum || 12),
y: this.layout.length + (this.colNum / 2 || 12),
w: 2,
h: 3,
i: "",
i: i,
id: i,
name: this.roomName,
c: "#e6e5e5",
type: this.isRoom
......@@ -466,29 +476,30 @@ export default {
isResizable: true
};
this.layout.push(this.layOutItem);
// console.log('layOutItem==>>',this.layOutItem)
let data = {
floorId: this.$route.params.floorId ? this.$route.params.floorId : "18",
name: this.roomName,
position: JSON.stringify(this.layOutItem),
position: this.layOutItem,
roomType: this.isRoom
? this.roomType
: this.isBase
? "基础设施"
: "9999"
};
postFun("/ledger/room/save", data)
.then(res => {
if (res.code == 200) {
// Toast.success('保存成功');
this.getRoomInfo();
this.roomType = "";
this.roomName = "";
}
})
.catch(err => {
console.log("err==>>", err);
});
this.layoutData.push(data);
console.log(this.layoutData, this.layout, "111111111111");
// postFun("/ledger/room/save", data)
// .then(res => {
// if (res.code == 200) {
// // Toast.success('保存成功');
// this.getRoomInfo();
// this.roomType = "";
// this.roomName = "";
// }
// })
// .catch(err => {
// });
},
cancelDialog() {
this.roomType = "";
......
......@@ -586,6 +586,7 @@
:style="{ height: '100%' }"
>
<selectFloor
v-if="ShowfloorList"
:listdata="floorSource"
@closeSlect="closeSlectfloor"
@saveSlect="saveSlectfloor"
......@@ -595,6 +596,7 @@
<!-- 单选弹出层 -->
<van-popup v-model="showSelect" position="bottom">
<van-picker
v-if="showSelect"
show-toolbar
value-key="dictValue"
:columns="columnsData"
......@@ -609,6 +611,7 @@
:style="{ height: '100%' }"
>
<selectList
v-if="showCheckSelect"
:listdata="columnsCheckData"
@closeSlect="showCheckSelect = false"
@saveSlect="saveCheckSelect"
......@@ -618,6 +621,7 @@
<!-- 房间弹出层 -->
<van-popup v-model="showSource" position="bottom">
<van-picker
v-if="showSource"
show-toolbar
value-key="name"
:columns="columnsSource"
......@@ -655,7 +659,10 @@
</button>
</div>
<div style="display:flex;margin-top: 44px;">
<selectDept @changeDept="changeDept"></selectDept>
<selectDept
v-if="measuresDept"
@changeDept="changeDept"
></selectDept>
</div>
</van-popup>
<!-- 管控责任人 -->
......
......@@ -595,6 +595,7 @@
:style="{ height: '100%' }"
>
<selectList
v-if="showCheckSelect"
:listdata="columnsCheckData"
@closeSlect="showCheckSelect = false"
@saveSlect="saveCheckSelect"
......@@ -603,7 +604,7 @@
<!-- 房间弹出层 -->
<van-popup v-model="showSource" position="bottom">
<van-picker
<van-picker v-if="showSource"
show-toolbar
value-key="name"
:columns="columnsSource"
......@@ -966,6 +967,13 @@ export default {
this.userPrefix = name;
},
seletRoom(name) {
if (!this.form.floorId) {
this.$toast({
title: "提示",
message: "请选择所属楼层!"
});
return false;
}
this.$toast.loading({
message: "加载中...",
forbidClick: true,
......@@ -1257,6 +1265,13 @@ export default {
},
//添加房间
tjfjClcik() {
if (!this.form.floorId) {
this.$toast({
title: "提示",
message: "请选择所属楼层!"
});
return false;
}
this.$router.push({
name: "riskView",
params: {
......
......@@ -447,6 +447,7 @@
:style="{ height: '100%' }"
>
<selectFloor
v-if="ShowfloorList"
:listdata="floorSource"
@closeSlect="closeSlectfloor"
@saveSlect="saveSlectfloor"
......@@ -456,6 +457,7 @@
<!-- 单选弹出层 -->
<van-popup v-model="showSelect" position="bottom">
<van-picker
v-if="showSelect"
show-toolbar
value-key="dictValue"
:columns="columnsData"
......@@ -470,6 +472,7 @@
:style="{ height: '100%' }"
>
<selectList
v-if="showCheckSelect"
:listdata="columnsCheckData"
@closeSlect="showCheckSelect = false"
@saveSlect="saveCheckSelect"
......@@ -479,6 +482,7 @@
<!-- 房间弹出层 -->
<van-popup v-model="showSource" position="bottom">
<van-picker
v-if="showSource"
show-toolbar
value-key="name"
:columns="columnsSource"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment