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