Commit 79dccba4 authored by p-wanping.song's avatar p-wanping.song

Merge branch 'dev-swp' into develop

parents c868da59 73570bae
...@@ -26,7 +26,7 @@ import tabBar from "@/components/TabBar"; ...@@ -26,7 +26,7 @@ import tabBar from "@/components/TabBar";
export default { export default {
components: { components: {
tabBar tabBar,
}, },
data() { data() {
return { return {
...@@ -64,7 +64,11 @@ export default { ...@@ -64,7 +64,11 @@ export default {
"riskApprove", "riskApprove",
"taskList", "taskList",
"taskDetail", "taskDetail",
"modelResult" "modelResult",
"inherent-template-detail",
"inherent-template",
"my-sign",
"sign-recode",
], ],
// cachePage预先定义的缓存页面 // cachePage预先定义的缓存页面
otherCache: [], otherCache: [],
...@@ -80,8 +84,8 @@ export default { ...@@ -80,8 +84,8 @@ export default {
"my-delay", "my-delay",
"risk-account", "risk-account",
"risk-confirme", "risk-confirme",
"my-delay" "my-delay",
] ],
// 'report-return', 'risk-return', 风险和隐患的上报退回不需要缓存 // 'report-return', 'risk-return', 风险和隐患的上报退回不需要缓存
}; };
}, },
...@@ -104,26 +108,26 @@ export default { ...@@ -104,26 +108,26 @@ export default {
computed: { computed: {
showTab() { showTab() {
return !this.noTab.includes(this.$route.name); return !this.noTab.includes(this.$route.name);
} },
}, },
methods: { methods: {
// 处理缓存的方法 // 处理缓存的方法
handleCache(roterFromName, roterToName, markRoterName) { handleCache(roterFromName, roterToName, markRoterName) {
if (roterToName == markRoterName) { if (roterToName == markRoterName) {
// 从定义缓存列表中移除 // 从定义缓存列表中移除
if (this.cachePage.findIndex(item => item == roterFromName) != -1) { if (this.cachePage.findIndex((item) => item == roterFromName) != -1) {
this.cachePage.splice( this.cachePage.splice(
this.cachePage.findIndex(item => item == roterFromName), this.cachePage.findIndex((item) => item == roterFromName),
1 1
); );
} }
} else { } else {
// 判断有无路由 加入缓存 // 判断有无路由 加入缓存
if (this.cachePage.findIndex(item => item == roterFromName) == -1) { if (this.cachePage.findIndex((item) => item == roterFromName) == -1) {
this.cachePage.push(roterFromName); this.cachePage.push(roterFromName);
} }
} }
} },
}, },
watch: { watch: {
$route(to, from) { $route(to, from) {
...@@ -169,8 +173,8 @@ export default { ...@@ -169,8 +173,8 @@ export default {
} else { } else {
this.transitionName = ""; //同级无过渡效果 this.transitionName = ""; //同级无过渡效果
} }
} },
} },
}; };
</script> </script>
......
...@@ -9,76 +9,79 @@ ...@@ -9,76 +9,79 @@
--> -->
<template> <template>
<div> <div>
<van-sticky> <van-sticky>
<header class="header"> <header class="header">
<van-icon @click="to" name="arrow-left" class="iconColorLeft"/> <div class="iconColorLeft">
<span>{{text}}</span> <van-icon @click="to" name="arrow-left" />
<!-- <van-icon name="bars" class="iconColorRight"/> --> </div>
</header> <span>{{ text }}</span>
</van-sticky> <!-- <van-icon name="bars" class="iconColorRight" /> -->
</div> <div class="iconColorRight">
<slot name="right"></slot>
</div>
</header>
</van-sticky>
</div>
</template> </template>
<script> <script>
export default { export default {
props:{ props: {
text:{ text: {
default:"未知", default: "未知",
type:String type: String,
},
customBack:{
type:Function,
}
}, },
data() { customBack: {
return { type: Function,
}
}, },
mounted() { },
data() {
return {};
},
mounted() {},
methods: {
/* 左侧图标跳转方法 */
to() {
if (this.customBack) {
this.customBack();
} else {
history.go(-1);
}
}, },
methods: { },
/* 左侧图标跳转方法 */ };
to(){
if(this.customBack){
this.customBack()
}else{
history.go(-1)
}
}
}
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.header{ .header {
width:100%; width: 100%;
height:1.5rem; height: 1.5rem;
background:#2980F7; background: #2980f7;
text-align: center; text-align: center;
line-height: 1.5rem; line-height: 1.5rem;
} }
.iconColorLeft{ .iconColorLeft {
color: white; color: white;
transform: scale(2); position: absolute;
float: left; top: 0%;
position: relative; left: 5%;
top: 40%; .van-icon {
left: 5%; transform: scale(2);
} vertical-align: middle;
.header span{ }
color: white; }
font-size: 16px; .header span {
margin: auto; color: white;
font-family: 'Microsoft YaHei'; font-size: 16px;
} margin: auto;
.header .iconColorRight{ font-family: "Microsoft YaHei";
color: white; }
float: right; .header .iconColorRight {
position: relative; color: white;
top: 40%; position: absolute;
right: 5%; right: 5%;
transform: scale(2); top: 0;
} font-size: 12px;
vertical-align: middle;
}
</style> </style>
...@@ -35,6 +35,22 @@ const routes = [ ...@@ -35,6 +35,22 @@ const routes = [
}, },
component: () => import("@/views/my/resetPas"), component: () => import("@/views/my/resetPas"),
}, },
{
path: "/my-sign",
name: "my-sign",
meta: {
title: "我的签到",
},
component: () => import("@/views/my/sign"),
},
{
path: "/sign-recode",
name: "sign-recode",
meta: {
title: "我的签到",
},
component: () => import("@/views/my/signRecode"),
},
// 安全工作台页面 // 安全工作台页面
{ {
path: "/save-workbench", path: "/save-workbench",
...@@ -150,6 +166,18 @@ const routes = [ ...@@ -150,6 +166,18 @@ const routes = [
name: "riskInherent", name: "riskInherent",
component: () => import("../views/riskProject/add/inherentRisks.vue"), component: () => import("../views/riskProject/add/inherentRisks.vue"),
}, },
//固有风险模板详情
{
path: "/inherent/template/detail",
name: "inherent-template-detail",
component: () => import("../views/riskProject/add/inherentTemplate/detail.vue"),
},
//固有风险模板列表
{
path: "/inherent/template",
name: "inherent-template",
component: () => import("../views/riskProject/add/inherentTemplate/list.vue"),
},
//新增固有风险 //新增固有风险
{ {
path: "/addInherent", path: "/addInherent",
......
...@@ -9,11 +9,12 @@ export function getFun(url, params) { ...@@ -9,11 +9,12 @@ export function getFun(url, params) {
}); });
} }
/* post请求 */ /* post请求 */
export function postFun(url, data) { export function postFun(url, data, rest) {
return request({ return request({
url: url, url: url,
method: "post", method: "post",
data data,
...rest
}); });
} }
/* delete请求 */ /* delete请求 */
......
...@@ -12,6 +12,7 @@ export default new Vuex.Store({ ...@@ -12,6 +12,7 @@ export default new Vuex.Store({
actions, actions,
modules: {}, modules: {},
getters: { getters: {
present: state => key => state.present[key] present: state => key => state.present[key],
inherentTemp: state => state.inherentTemplate,
} }
}); });
...@@ -35,4 +35,9 @@ export default { ...@@ -35,4 +35,9 @@ export default {
SET_ASSESS_RESULT(state, data) { SET_ASSESS_RESULT(state, data) {
state.assessModel.result = data; state.assessModel.result = data;
}, },
// 固有风险模板
SET_INHERENT_TEMPLATE(state, data) {
state.inherentTemplate = data;
}
}; };
...@@ -12,4 +12,7 @@ export default { ...@@ -12,4 +12,7 @@ export default {
score: "", score: "",
}, },
}, },
// 固有风险模板
inherentTemplate: {
}
}; };
import axios from 'axios' import axios from 'axios'
import router from '../router' import router from '../router'
import { Toast } from 'vant'; import { Toast } from 'vant';
import { Notify } from 'vant'; import { Notify } from 'vant';
import { Dialog } from 'vant'; import { Dialog } from 'vant';
import { getToken ,removeToken} from '@/utils/auth' // get token from cookie import { getToken, removeToken } from '@/utils/auth' // get token from cookie
const service = axios.create({ const service = axios.create({
// baseURL: '/aqpt/app-api', //前缀路径 // baseURL: '/aqpt/app-api', //前缀路径
baseURL: '/app-api', //前缀路径 baseURL: '/app-api', //前缀路径
headers: {//请求头部 headers: {//请求头部
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", // "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"content-type": "application/json", "content-type": "application/json",
"data-type": "json" "data-type": "json"
} }
}) })
//拦截接口请求 //拦截接口请求
service.interceptors.request.use(config => { service.interceptors.request.use(config => {
if (getToken()) { if (getToken()) {
config.headers['Authorization'] = getToken() config.headers['Authorization'] = getToken()
} }
return config return config
},error => { }, error => {
return Promise.reject(error) return Promise.reject(error)
}) })
service.interceptors.response.use(response => { service.interceptors.response.use(response => {
Toast.clear(); // 关闭之前的弹出信息 Toast.clear(); // 关闭之前的弹出信息
const code = response.status//获取请求响应码 const code = response.status//获取请求响应码
const res = response.data//获取请求返回数据 const res = response.data//获取请求返回数据
if(code == 200) {//请求响应码200 代表已经请求到接口 if (code == 200) {//请求响应码200 代表已经请求到接口
if (res.code !== 0 && res.code !== 200 && res.code !== 402 && res.code !== 403&&res.code !== undefined) { if (res.code !== 0 && res.code !== 200 && res.code !== 402 && res.code !== 403 && res.code !== undefined) {
if(res.code === 500 && res.msg == "运行时异常:token已过期,请重新登录"){ if (res.code === 500 && res.msg == "运行时异常:token已过期,请重新登录") {
Dialog.alert({ Dialog.alert({
title: '提示', title: '提示',
message: res.msg, message: res.msg,
...@@ -37,7 +37,7 @@ service.interceptors.response.use(response => { ...@@ -37,7 +37,7 @@ service.interceptors.response.use(response => {
removeToken() removeToken()
location.reload() location.reload()
}); });
} else if(res.code === 401 && res.errorMessage == "图片类型错误"){ } else if (res.code === 401 && res.errorMessage == "图片类型错误") {
Dialog.alert({ Dialog.alert({
title: '提示', title: '提示',
message: res.errorMessage, message: res.errorMessage,
...@@ -45,37 +45,36 @@ service.interceptors.response.use(response => { ...@@ -45,37 +45,36 @@ service.interceptors.response.use(response => {
}).then(() => { }).then(() => {
router.go(-1); router.go(-1);
}); });
}else if(res.code === 401){ } else if (res.code === 401) {
Dialog.alert({ Dialog.alert({
title: '提示', title: '提示',
message: '登录过期,请重新登录!', message: '登录过期,请重新登录!',
theme: 'round-button', theme: 'round-button',
}).then(() => { }).then(() => {
removeToken() removeToken()
location.href="/login" location.href = "/login"
}); });
} else{ } else {
Toast.fail({ Toast.fail({
title: '提示', title: '提示',
forbidClick: true, forbidClick: true,
message: res.msg ||'数据异常请稍后再试', message: res.msg || '数据异常请稍后再试',
}) })
} }
return Promise.reject(res); return Promise.reject(res);
} else { } else {
return res; return res;
} }
}else{ } else {
Toast.fail({ Toast.fail({
title: '提示', title: '提示',
forbidClick: true, forbidClick: true,
message: '接口请求失败', message: '接口请求失败',
}) })
} }
},err=>{ }, err => {
Toast.fail('接口请求失败'); Toast.fail('接口请求失败');
return Promise.reject(err) return Promise.reject(err)
}) })
export default service export default service
\ No newline at end of file
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
@click.native="changeName(item)" @click.native="changeName(item)"
:style="{ :style="{
backgroundColor: item.c, backgroundColor: item.c,
border: item.type == 'thorough' ? 'none !important' : '' border: item.type == 'thorough' ? 'none !important' : '',
}" }"
> >
<span class="text" :class="item.w > item.h * 5 ? '' : 'rowText'">{{ <span class="text" :class="item.w > item.h * 5 ? '' : 'rowText'">{{
...@@ -58,6 +58,9 @@ ...@@ -58,6 +58,9 @@
<van-button @click="addBase" type="info" size="mini" v-if="!isViews" <van-button @click="addBase" type="info" size="mini" v-if="!isViews"
>添加基础设施</van-button >添加基础设施</van-button
> >
<van-button @click="toCopyRoom" type="info" size="mini" v-if="!isViews"
>复制房间</van-button
>
<!-- <van-button @click="editItem" type="info" size="mini" v-if="!isViews">修改</van-button> --> <!-- <van-button @click="editItem" type="info" size="mini" v-if="!isViews">修改</van-button> -->
<van-grid <van-grid
direction="horizontal" direction="horizontal"
...@@ -104,18 +107,58 @@ ...@@ -104,18 +107,58 @@
@click="showPicker = true" @click="showPicker = true"
/> />
</van-cell-group> </van-cell-group>
<van-cell-group v-else-if="copyRoom.isCopy">
<van-field
readonly
clickable
label="楼层"
:value="copyRoom.floor.name"
placeholder="选择楼层"
@click="getFloor"
/>
<van-field
readonly
clickable
label="房间"
:value="copyRoom.room.name"
placeholder="选择房间"
@click="seletRoom"
/>
<van-field
v-model="roomName"
label="房间名称"
placeholder="请输入房间名称"
/>
<van-field
readonly
clickable
label="房间类型"
:value="copyRoom.type.dictLabel"
placeholder="选择房间类型"
@click="selectType"
/>
</van-cell-group>
<van-cell-group v-else> <van-cell-group v-else>
<van-field v-model="roomName" label="名称" placeholder="请输入名称" /> <van-field v-model="roomName" label="名称" placeholder="请输入名称" />
</van-cell-group> </van-cell-group>
</van-dialog> </van-dialog>
<van-popup v-model="showPicker" round position="bottom"> <van-popup v-model="showPicker" round position="bottom">
<van-picker <van-picker
v-if="!copyRoom.isCopy"
show-toolbar show-toolbar
:columns="isRoom ? roomArr : baseArr" :columns="isRoom ? roomArr : baseArr"
@cancel="showPicker = false" @cancel="showPicker = false"
@confirm="onConfirm" @confirm="onConfirm"
value-key="dictLabel" value-key="dictLabel"
/> />
<van-picker
v-else
show-toolbar
:columns="copyRoom.copyArr"
@cancel="showPicker = false"
@confirm="onConfirm"
:value-key="copyRoom.type != 'type' ? 'name' : 'dictLabel'"
/>
</van-popup> </van-popup>
</div> </div>
</template> </template>
...@@ -131,7 +174,7 @@ export default { ...@@ -131,7 +174,7 @@ export default {
name: "riskView", name: "riskView",
components: { components: {
GridLayout, GridLayout,
GridItem GridItem,
}, },
data() { data() {
return { return {
...@@ -163,22 +206,33 @@ export default { ...@@ -163,22 +206,33 @@ export default {
baseName: "", baseName: "",
baseArr: [], baseArr: [],
layoutData: [], layoutData: [],
editItem:null, editItem: null,
layoutDataStr: [] layoutDataStr: [],
copyRoom: {
isCopy: false,
floor: {},
room: {},
type: {},
floorData: [],
roomData: [],
typeData: [],
copyArr: [],
buildingId: "",
},
}; };
}, },
props: { props: {
isView: { isView: {
type: Boolean, type: Boolean,
default: false default: false,
} },
}, },
mounted() { mounted() {
// screenfull.toggle(this.$refs.mapbox); // screenfull.toggle(this.$refs.mapbox);
// this.$nextTick(() => { // this.$nextTick(() => {
// this.rotateBox(); // this.rotateBox();
// }); // });
console.log("floorId==>>", this.$route.params.floorId); this.copyRoom.buildingId = this.$route.params.buildingId;
if (this._props.isView) { if (this._props.isView) {
console.log("作为组件传值==>>"); console.log("作为组件传值==>>");
this.isViews = true; this.isViews = true;
...@@ -196,6 +250,60 @@ export default { ...@@ -196,6 +250,60 @@ export default {
this.getRoomInfo(); this.getRoomInfo();
}, },
methods: { methods: {
// 选择楼层
getFloor() {
this.copyRoom.type = "floor";
this.showPicker = true;
this.copyRoom.roomData = [];
if (this.copyRoom.floorData.length) {
this.copyRoom.copyArr = this.copyRoom.floorData;
return;
}
return getFun(`/risk/plan/floor/list/${this.copyRoom.buildingId}`)
.then((res) => {
this.copyRoom.floorData = res.data;
this.copyRoom.copyArr = this.copyRoom.floorData;
})
.catch(() => {
this.$toast.fail("加载失败,请稍后再试");
});
},
// 选择房间
seletRoom(name) {
this.copyRoom.type = "room";
this.showPicker = true;
if (!this.copyRoom.floor) {
this.$toast.fail("先选择楼层");
return;
}
if (this.copyRoom.roomData.length) {
this.copyRoom.copyArr = this.copyRoom.roomData;
return;
}
getFun(`/risk/plan/room/list/${this.copyRoom.floor.id}`)
.then((res) => {
this.copyRoom.roomData = res.data;
this.copyRoom.copyArr = this.copyRoom.roomData;
})
.catch(() => {
this.$toast.fail("加载失败,请稍后再试");
});
},
selectType() {
// selectType
this.copyRoom.type = "type";
this.showPicker = true;
if (this.copyRoom.typeData.length) {
this.copyRoom.copyArr = this.copyRoom.typeData;
return;
}
getFun("/risk/plan/dict/data/list", {
dictType: "risk_plan_base_room",
}).then((res) => {
this.copyRoom.typeData = res.data;
this.copyRoom.copyArr = this.copyRoom.typeData;
});
},
orientationChange() { orientationChange() {
if (window.orientation === 180 || window.orientation === 0) { if (window.orientation === 180 || window.orientation === 0) {
console.log("竖屏状态!"); console.log("竖屏状态!");
...@@ -265,15 +373,15 @@ export default { ...@@ -265,15 +373,15 @@ export default {
}, },
getRoomInfo() { getRoomInfo() {
let data = { let data = {
floorId: this.$route.params.floorId ? this.$route.params.floorId : "18" floorId: this.$route.params.floorId ? this.$route.params.floorId : "18",
}; };
getFun("/ledger/room/list", data) getFun("/ledger/room/list", data)
.then(res => { .then((res) => {
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); 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;
item.position.id = item.id; item.position.id = item.id;
...@@ -292,49 +400,61 @@ export default { ...@@ -292,49 +400,61 @@ export default {
// console.log('layout==>>',this.layout) // console.log('layout==>>',this.layout)
} }
}) })
.catch(err => { .catch((err) => {
console.log("err==>>", err); console.log("err==>>", err);
}); });
getFun("/risk/plan/dict/data/list", { getFun("/risk/plan/dict/data/list", {
dictType: "risk_plan_room_type" dictType: "risk_plan_room_type",
}).then(res => { }).then((res) => {
this.roomArr = res.data; this.roomArr = res.data;
}); });
getFun("/risk/plan/dict/data/list", { getFun("/risk/plan/dict/data/list", {
dictType: "risk_plan_base_room" dictType: "risk_plan_base_room",
}).then(res => { }).then((res) => {
this.baseArr = res.data; this.baseArr = res.data;
}); });
}, },
// 增加 // 增加
addItem() { addItem() {
this.roomType = ""; this.roomType = "";
this.roomName =""; this.roomName = "";
this.title ="创建房间"; this.title = "创建房间";
this.isRoom = true; this.isRoom = true;
this.show = true; this.show = true;
this.isBase = false; this.isBase = false;
this.copyRoom.isCopy = false;
}, },
// 添加其他 // 添加其他
addOther() { addOther() {
this.isRoom = false; this.isRoom = false;
this.isBase = false; this.isBase = false;
this.copyRoom.isCopy = false;
this.roomType = ""; this.roomType = "";
this.roomName = ""; this.roomName = "";
this.title = "创建其他"; this.title = "创建其他";
this.show = true; this.show = true;
}, },
// 复制房间
toCopyRoom() {
this.roomType = "";
this.roomName = "";
this.title = "复制房间";
this.show = true;
this.copyRoom.isCopy = true;
this.isBase = false;
this.isRoom = false;
},
// 删除 // 删除
removeItem(val) { removeItem(val) {
this.$dialog this.$dialog
.confirm({ .confirm({
title: "提示", title: "提示",
message: "是否删除" message: "是否删除",
}) })
.then(() => { .then(() => {
console.log(this.layout, val); console.log(this.layout, val);
const index = this.layout.map(item => item.i).indexOf(val); const index = this.layout.map((item) => item.i).indexOf(val);
this.layout.splice(index, 1); this.layout.splice(index, 1);
this.layoutData.splice(index, 1); this.layoutData.splice(index, 1);
// postFun("/ledger/room/delete/" + val) // postFun("/ledger/room/delete/" + val)
...@@ -352,21 +472,20 @@ export default { ...@@ -352,21 +472,20 @@ export default {
}); });
}, },
// 修改名称 // 修改名称
changeName(item){ changeName(item) {
debugger
this.editItem = item; this.editItem = item;
switch(item.type){ switch (item.type) {
case '基础设施': case "基础设施":
this.addBase(); this.addBase();
break; break;
case 'thorough': case "thorough":
this.addOther(); this.addOther();
break; break;
default : default:
this.addItem() this.addItem();
this.roomType = item.type; this.roomType = item.type;
} }
this.title ="编辑"; this.title = "编辑";
this.roomName = item.name; this.roomName = item.name;
}, },
//添加基础设施 //添加基础设施
...@@ -387,7 +506,7 @@ export default { ...@@ -387,7 +506,7 @@ export default {
// console.log('this.layout==>>',this.layout) // console.log('this.layout==>>',this.layout)
}, },
// 调整大小后的事件 // 调整大小后的事件
resizedEvent: function(i, newH, newW) { resizedEvent: function (i, newH, newW) {
// console.log(this.layOutItem, "resizedEvent"); // console.log(this.layOutItem, "resizedEvent");
// this.layOutItem.w = newW; // this.layOutItem.w = newW;
// this.layOutItem.h = newH; // this.layOutItem.h = newH;
...@@ -396,7 +515,7 @@ export default { ...@@ -396,7 +515,7 @@ export default {
}, },
//关闭 //关闭
async close() { async close() {
this.layoutData.forEach(item => { this.layoutData.forEach((item) => {
if ( if (
typeof item.position == "object" && typeof item.position == "object" &&
Object.prototype.toString.call(item.position) === "[object Object]" Object.prototype.toString.call(item.position) === "[object Object]"
...@@ -407,7 +526,7 @@ export default { ...@@ -407,7 +526,7 @@ export default {
this.$dialog this.$dialog
.confirm({ .confirm({
title: "提示", title: "提示",
message: "是否保存已修改内容?" message: "是否保存已修改内容?",
}) })
.then(() => { .then(() => {
this.confim(); this.confim();
...@@ -422,12 +541,12 @@ export default { ...@@ -422,12 +541,12 @@ export default {
}); });
}, },
// 确定 执行批量编辑保存 // 确定 执行批量编辑保存
confim: debounce(function() { confim: debounce(function () {
this.$toast.loading({ this.$toast.loading({
message: "处理中...", message: "处理中...",
forbidClick: true, forbidClick: true,
loadingType: "spinner", loadingType: "spinner",
duration: 3 duration: 3,
}); });
//修改房间后返回清掉房间的值 //修改房间后返回清掉房间的值
...@@ -439,7 +558,7 @@ export default { ...@@ -439,7 +558,7 @@ export default {
} }
//保存 //保存
let data = this.layoutData; let data = this.layoutData;
data.forEach(item => { data.forEach((item) => {
if ( if (
typeof item.position == "object" && typeof item.position == "object" &&
Object.prototype.toString.call(item.position) === "[object Object]" Object.prototype.toString.call(item.position) === "[object Object]"
...@@ -452,46 +571,51 @@ export default { ...@@ -452,46 +571,51 @@ export default {
"/ledger/room/update/batch?floorId=" + this.$route.params.floorId, "/ledger/room/update/batch?floorId=" + this.$route.params.floorId,
data data
) )
.then(res => { .then((res) => {
if (res.code == 200) { if (res.code == 200) {
Toast.success("保存成功"); Toast.success("保存成功");
this.getRoomInfo(); this.getRoomInfo();
} }
}) })
.catch(err => { .catch((err) => {
console.log("err==>>", err); console.log("err==>>", err);
}); });
}), }),
//保存房间名称 //保存房间名称
saveRoomName() { saveRoomName() {
// this.confim(); if (this.copyRoom.isCopy) {
// return;
this.saveCopy();
}
if (this.roomName == "") { if (this.roomName == "") {
Toast.fail({ Toast.fail({
title: "提示", title: "提示",
forbidClick: true, forbidClick: true,
message: "请输入名称!" message: "请输入名称!",
}); });
return; return;
} }
if(this.editItem){ if (this.editItem) {
const editItem = this.layout.find(x=>x.i==this.editItem.i); const editItem = this.layout.find((x) => x.i == this.editItem.i);
const layoutData = this.layoutData.find(x=>x.position.id==editItem.i); const layoutData = this.layoutData.find(
if(layoutData){ (x) => x.position.id == editItem.i
layoutData.name = this.roomName );
} if (layoutData) {
if(editItem){ layoutData.name = this.roomName;
editItem.name = this.roomName; }
editItem.type = this.roomType; if (editItem) {
this.editItem = {}; editItem.name = this.roomName;
return editItem.type = this.roomType;
}
this.editItem = {}; this.editItem = {};
return;
}
this.editItem = {};
} }
var i = var i =
this.layout && this.layout.length > 0 this.layout && this.layout.length > 0
? Math.max.apply( ? Math.max.apply(
Math, Math,
this.layout.map(item => { this.layout.map((item) => {
return item.id; return item.id;
}) })
) + 1 ) + 1
...@@ -511,7 +635,7 @@ export default { ...@@ -511,7 +635,7 @@ export default {
? "基础设施" ? "基础设施"
: "thorough", : "thorough",
isDraggable: true, isDraggable: true,
isResizable: true isResizable: true,
}; };
this.layout.push(this.layOutItem); this.layout.push(this.layOutItem);
...@@ -523,7 +647,7 @@ export default { ...@@ -523,7 +647,7 @@ export default {
? this.roomType ? this.roomType
: this.isBase : this.isBase
? "基础设施" ? "基础设施"
: "9999" : "9999",
}; };
this.layoutData.push(data); this.layoutData.push(data);
// postFun("/ledger/room/save", data) // postFun("/ledger/room/save", data)
...@@ -538,20 +662,53 @@ export default { ...@@ -538,20 +662,53 @@ export default {
// .catch(err => { // .catch(err => {
// }); // });
}, },
// saveCopy
saveCopy() {
const planId = sessionStorage.getItem("planId");
postFun(`/risk/plan/copy/room/${planId}`, {
id: this.copyRoom.room.id,
floorId: this.$route.params.floorId,
name: this.roomName,
roomType: this.copyRoom.type.dictType,
}).then((res) => {
// this.copyRoom.isCopy = false;
this.copyRoom = {
isCopy: false,
floor: {},
room: {},
type: {},
copyArr: [],
};
});
},
cancelDialog() { cancelDialog() {
this.roomType = ""; this.roomType = "";
this.roomName = ""; this.roomName = "";
this.editItem = null this.editItem = null;
}, },
onConfirm(value) { onConfirm(value) {
if (this.isRoom) { if (this.isRoom) {
this.roomType = value.dictValue; this.roomType = value.dictValue;
} else if (this.copyRoom.isCopy) {
if (this.copyRoom.type == "floor") {
this.copyRoom.floorData.forEach((val) => {
if (val.name == value[0]) {
this.copyRoom.floor = val.children.find(
(x) => x.name === value[1]
);
}
});
} else if (this.copyRoom.type == "room") {
this.copyRoom.room = value;
} else {
this.copyRoom.type = value;
}
} else { } else {
this.roomName = value.dictValue; this.roomName = value.dictValue;
} }
this.showPicker = false; this.showPicker = false;
} },
} },
}; };
</script> </script>
......
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
<div> <div>
<!-- 头部标签 --> <!-- 头部标签 -->
<van-sticky> <van-sticky>
<header class="header-wrap"> <header class="header-wrap">我的</header>
我的
</header>
</van-sticky> </van-sticky>
<!-- 内容 --> <!-- 内容 -->
...@@ -49,28 +47,26 @@ ...@@ -49,28 +47,26 @@
</div> </div>
</van-cell-group> --> </van-cell-group> -->
<van-cell-group inset class="my-cell-group"> <van-cell-group inset class="my-cell-group">
<div <div
class="set-wrap" class="set-wrap"
v-for="(item, key) in menus" v-for="(item, key) in menus"
:key="key" :key="key"
@click="$router.push({ name: item['name'] })" @click="$router.push({ name: item['name'] })"
> >
<van-image <van-image
width="0.613rem" width="0.613rem"
height="0.613rem" height="0.613rem"
fit="fill" fit="fill"
:src="item['img']" :src="item['img']"
/> />
<span>{{ item["title"] }}</span> <span>{{ item["title"] }}</span>
</div> </div>
</van-cell-group> </van-cell-group>
</div> </div>
<!-- 退出系统 --> <!-- 退出系统 -->
<footer class="sign-out"> <footer class="sign-out">
<van-button type="info" block @click="logout">退出系统</van-button> <van-button type="info" block @click="logout">退出系统</van-button>
</footer> </footer>
<!-- tanBar --> <!-- tanBar -->
<tab-bar :index="2"></tab-bar> <tab-bar :index="2"></tab-bar>
...@@ -79,45 +75,54 @@ ...@@ -79,45 +75,54 @@
<script> <script>
import tabBar from "@/components/TabBar"; import tabBar from "@/components/TabBar";
import { removeToken } from '@/utils/auth' // get token from cookie import { removeToken } from "@/utils/auth"; // get token from cookie
import { getUserInfo,removeLocalUserInfo,removeUserInfo} from '@/utils/userInfo' import {
getUserInfo,
removeLocalUserInfo,
removeUserInfo,
} from "@/utils/userInfo";
export default { export default {
components: { components: {
tabBar tabBar,
}, },
data() { data() {
return { return {
menus: [ menus: [
// 菜单 // 菜单
{ {
title: "我的权限", title: "我的权限",
img:require("@/assets/myTerritory/role.png"), img: require("@/assets/myTerritory/role.png"),
name: "my-role", name: "my-role",
}, },
{ {
title: "修改密码", title: "修改密码",
img: require("@/assets/myTerritory/set.png"), img: require("@/assets/myTerritory/set.png"),
name: "my-reset-pas", name: "my-reset-pas",
}, },
], {
title: "签到",
img: require("@/assets/myTerritory/set.png"),
name: "my-sign",
},
],
userInfo: { userInfo: {
portrait: require("@/assets/myTerritory/touxiang.png"), portrait: require("@/assets/myTerritory/touxiang.png"),
name: getUserInfo()?getUserInfo().userName:"xxx", name: getUserInfo() ? getUserInfo().userName : "xxx",
position: getUserInfo()?getUserInfo().deptName:"xxx部", position: getUserInfo() ? getUserInfo().deptName : "xxx部",
} },
}; };
}, },
mounted() {}, mounted() {},
methods: { methods: {
logout() { logout() {
removeToken() removeToken();
// removeLocalUserInfo() // removeLocalUserInfo()
removeUserInfo() removeUserInfo();
sessionStorage.clear() sessionStorage.clear();
this.$router.push("/login"); this.$router.push("/login");
// location.reload(); // location.reload();
} },
} },
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
...@@ -136,7 +141,7 @@ export default { ...@@ -136,7 +141,7 @@ export default {
padding: 10px 0 50px 0; padding: 10px 0 50px 0;
background-color: #f0f1f5; background-color: #f0f1f5;
position: relative; position: relative;
.user-box{ .user-box {
display: flex; display: flex;
align-items: center; align-items: center;
} }
...@@ -172,22 +177,22 @@ export default { ...@@ -172,22 +177,22 @@ export default {
// } // }
// } // }
.my-cell-group { .my-cell-group {
padding: 10px 10px !important; padding: 10px 10px !important;
.set-wrap { .set-wrap {
height: 1.1rem; height: 1.1rem;
display: flex; display: flex;
align-items: center; align-items: center;
border-bottom: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8;
&:last-child { &:last-child {
border-bottom: none; border-bottom: none;
} }
span { span {
margin-left: 0.2666rem; margin-left: 0.2666rem;
font-size: 13px; font-size: 13px;
font-weight: none; font-weight: none;
} }
}
} }
}
} }
.sign-out { .sign-out {
......
<template>
<div>
<LHeader :text="$route.meta.title">
<span slot="right" @click="() => this.$router.push('sign-recode')"
>签到记录</span
>
</LHeader>
<van-form
ref="signForm"
label-width="4.5em"
validate-trigger="onSubmit"
:colon="true"
>
<van-field
readonly
name="userName"
:value="userName"
label="用户名"
placeholder="请输入"
:rules="[{ required: true, message: '用户名不能为空' }]"
/>
<van-field
readonly
name="userName"
label="签定时间"
placeholder="请输入"
key="nowTime"
:value="form.signTime"
>
<!-- <template #input>
<div>{{ form.signTime }}</div>
</template> -->
</van-field>
<van-field
required
name="remark"
v-model="form.remark"
label="备注"
placeholder="请输入"
type="textarea"
:rules="[{ required: true, message: '备注不能为空' }]"
>
</van-field>
<van-field
readonly
required
name="file"
label="照片"
:rules="[{ required: true, message: '照片不能为空' }]"
>
<template #input>
<van-uploader v-model="form.file" :after-read="afterRead">
</van-uploader>
</template>
</van-field>
<div class="submit-btns">
<van-button round block type="info" @click="toSign(true)"
>签到</van-button
>
<van-button round block type="warning" @click="toSign(false)"
>签退</van-button
>
</div>
</van-form>
</div>
</template>
<script>
import LHeader from "@/components/header.vue";
import { getUserInfo } from "@/utils/userInfo";
import { getFun, postFun } from "@/service/table.js";
export default {
components: {
LHeader,
},
data() {
return {
timer: "",
userName: "用户名",
form: {
signTime: this.getTime(),
file: [],
remark: "",
userId: "",
},
};
},
mounted() {
this.getRealTime();
this.toGetUserInfo();
},
beforeDestroy() {
clearInterval(this.timer);
},
methods: {
toGetUserInfo() {
this.userName = getUserInfo().userName;
this.form.userId = getUserInfo().userId;
},
// 获取当前时间
getTime() {
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
let hours = date.getHours();
let minutes = date.getMinutes();
let seconds = date.getSeconds();
let time =
year +
"-" +
this.formatTime(month) +
"-" +
this.formatTime(day) +
" " +
this.formatTime(hours) +
":" +
this.formatTime(minutes) +
":" +
this.formatTime(seconds);
return time;
},
// 时间小于10添加0
formatTime(time) {
if (time < 10) {
return "0" + time;
}
return time;
},
// 获取实时时间并更新
getRealTime() {
this.timer = setInterval(() => {
this.form.signTime = this.getTime();
}, 1000);
},
toSign(type) {
this.$refs.signForm.validate().then(() => {
const formData = new FormData();
this.form.file.forEach((item) => {
formData.append("file[]", item.file);
});
formData.append("userId", this.form.userId);
formData.append("type", type);
formData.append("remark", this.form.remark);
postFun("/risk/plan/sign", formData).then((res) => {
if (res.code == 200) {
this.$message({
message: "签到成功",
type: "success",
});
}
});
});
},
},
};
</script>
<style lang="less" scoped>
.submit-btns {
display: flex;
padding: 20px 0 20px 20px;
> .van-button {
margin-right: 20px;
}
}
</style>
<template>
<div>
<LHeader text="签到记录"> </LHeader>
<div>
<van-cell
v-for="item in list"
:key="item.id"
:title="item.type ? '签到' : '签退'"
:value="item.createTime"
>
<template #label>
<div>备注:{{ item.remark }}</div>
<div>照片:<img src="" alt="" /></div>
</template>
</van-cell>
</div>
</div>
</template>
<script>
import LHeader from "@/components/header.vue";
import { getFun } from "@/service/table.js";
export default {
components: { LHeader },
data() {
return {
list: [],
};
},
mounted() {
this.getList();
},
methods: {
getList() {
getFun("/risk/plan/sign/list").then((res) => {
if (res.code == 200) {
this.list = res.rows;
}
});
},
},
};
</script>
<style lang="scss" scoped></style>
...@@ -10,12 +10,17 @@ ...@@ -10,12 +10,17 @@
validate-trigger="onSubmit" validate-trigger="onSubmit"
> >
<div <div
style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" style="
height: 1rem;
font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';
font-weight: 700;
line-height: 1rem;
"
> >
<img <img
src="@/assets/accidentIcon/bookmark.svg" src="@/assets/accidentIcon/bookmark.svg"
alt="" alt=""
style="position: relative;top: 32%;transform: translateY(-50%);" style="position: relative; top: 32%; transform: translateY(-50%)"
/> />
固有风险信息 固有风险信息
</div> </div>
...@@ -44,7 +49,7 @@ ...@@ -44,7 +49,7 @@
placeholder="请输入 " placeholder="请输入 "
/> />
<div style="display: flex;"> <div style="display: flex">
<van-field <van-field
required required
clickable clickable
...@@ -56,14 +61,14 @@ ...@@ -56,14 +61,14 @@
:rules="[{ required: true, message: '所属楼层不能为空' }]" :rules="[{ required: true, message: '所属楼层不能为空' }]"
/> />
<van-button <van-button
style="color: #cccc;background-color: #f0f1f5;" style="color: #cccc; background-color: #f0f1f5"
icon="plus" icon="plus"
type="info" type="info"
native-type="button" native-type="button"
@click="createFloor" @click="createFloor"
/> />
</div> </div>
<div style="display: flex;"> <div style="display: flex">
<van-field <van-field
readonly readonly
required required
...@@ -75,7 +80,7 @@ ...@@ -75,7 +80,7 @@
:rules="[{ required: true, message: '所属房间不能为空' }]" :rules="[{ required: true, message: '所属房间不能为空' }]"
/> />
<van-button <van-button
style="color: #cccc;background-color: #f0f1f5;" style="color: #cccc; background-color: #f0f1f5"
icon="plus" icon="plus"
type="info" type="info"
native-type="button" native-type="button"
...@@ -110,13 +115,13 @@ ...@@ -110,13 +115,13 @@
v-show="form.pointType == '设备设施类'" v-show="form.pointType == '设备设施类'"
> >
<template #input> <template #input>
<span style="margin-right: 10px;color: red;"></span> <span style="margin-right: 10px; color: red"></span>
<van-switch <van-switch
v-model="form.specialEquipment" v-model="form.specialEquipment"
size="20" size="20"
name="specialEquipment" name="specialEquipment"
/> />
<span style="margin-left: 10px;color: green;"></span> <span style="margin-left: 10px; color: green"></span>
</template> </template>
</van-field> </van-field>
<!-- 多选 --> <!-- 多选 -->
...@@ -175,12 +180,17 @@ ...@@ -175,12 +180,17 @@
/> />
<div <div
style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" style="
height: 1rem;
font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';
font-weight: 700;
line-height: 1rem;
"
> >
<img <img
src="@/assets/accidentIcon/bookmark.svg" src="@/assets/accidentIcon/bookmark.svg"
alt="" alt=""
style="position: relative;top: 32%;transform: translateY(-50%);" style="position: relative; top: 32%; transform: translateY(-50%)"
/> />
风险图片 风险图片
</div> </div>
...@@ -197,14 +207,14 @@ ...@@ -197,14 +207,14 @@
<!-- 11111111111 --> <!-- 11111111111 -->
<div <div
style=" style="
width: 2.13333rem; width: 2.13333rem;
height: 2.13333rem; height: 2.13333rem;
background: #f7f8fa; background: #f7f8fa;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
" "
> >
<img <img
src="@/assets/upload/pic.png" src="@/assets/upload/pic.png"
...@@ -218,12 +228,17 @@ ...@@ -218,12 +228,17 @@
</template> </template>
</van-field> </van-field>
<div <div
style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" style="
height: 1rem;
font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';
font-weight: 700;
line-height: 1rem;
"
> >
<img <img
src="@/assets/accidentIcon/bookmark.svg" src="@/assets/accidentIcon/bookmark.svg"
alt="" alt=""
style="position: relative;top: 32%;transform: translateY(-50%);" style="position: relative; top: 32%; transform: translateY(-50%)"
/> />
应采取的管控措施 应采取的管控措施
</div> </div>
...@@ -237,7 +252,7 @@ ...@@ -237,7 +252,7 @@
rows="3" rows="3"
autosize autosize
placeholder="请输入" placeholder="请输入"
style="padding-left: 0;padding-top: 0;" style="padding-left: 0; padding-top: 0"
/> />
</template> </template>
</van-field> </van-field>
...@@ -254,14 +269,14 @@ ...@@ -254,14 +269,14 @@
<template slot="default"> <template slot="default">
<div <div
style=" style="
width: 2.13333rem; width: 2.13333rem;
height: 2.13333rem; height: 2.13333rem;
background: #f7f8fa; background: #f7f8fa;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
" "
> >
<img <img
src="@/assets/upload/file.png" src="@/assets/upload/file.png"
...@@ -284,7 +299,7 @@ ...@@ -284,7 +299,7 @@
rows="3" rows="3"
autosize autosize
placeholder="请输入" placeholder="请输入"
style="padding-left: 0;padding-top: 0;" style="padding-left: 0; padding-top: 0"
/> />
</template> </template>
</van-field> </van-field>
...@@ -301,14 +316,14 @@ ...@@ -301,14 +316,14 @@
<template slot="default"> <template slot="default">
<div <div
style=" style="
width: 2.13333rem; width: 2.13333rem;
height: 2.13333rem; height: 2.13333rem;
background: #f7f8fa; background: #f7f8fa;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
" "
> >
<img <img
src="@/assets/upload/file.png" src="@/assets/upload/file.png"
...@@ -331,7 +346,7 @@ ...@@ -331,7 +346,7 @@
rows="3" rows="3"
autosize autosize
placeholder="请输入" placeholder="请输入"
style="padding-left: 0;padding-top: 0;" style="padding-left: 0; padding-top: 0"
/> />
</template> </template>
</van-field> </van-field>
...@@ -349,14 +364,14 @@ ...@@ -349,14 +364,14 @@
<!-- 11111111111 --> <!-- 11111111111 -->
<div <div
style=" style="
width: 2.13333rem; width: 2.13333rem;
height: 2.13333rem; height: 2.13333rem;
background: #f7f8fa; background: #f7f8fa;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
" "
> >
<img <img
src="@/assets/upload/file.png" src="@/assets/upload/file.png"
...@@ -418,21 +433,26 @@ ...@@ -418,21 +433,26 @@
/> />
<div <div
style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" style="
height: 1rem;
font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';
font-weight: 700;
line-height: 1rem;
"
> >
<img <img
src="@/assets/accidentIcon/bookmark.svg" src="@/assets/accidentIcon/bookmark.svg"
alt="" alt=""
style="position: relative;top: 32%;transform: translateY(-50%);" style="position: relative; top: 32%; transform: translateY(-50%)"
/> />
重大危险源管理 重大危险源管理
</div> </div>
<van-field name="majorHazardSource" label="是否为重大危险源"> <van-field name="majorHazardSource" label="是否为重大危险源">
<template #input> <template #input>
<span style="margin-right: 10px;color: red;"></span> <span style="margin-right: 10px; color: red"></span>
<van-switch v-model="form.majorHazardSource" size="20" /> <van-switch v-model="form.majorHazardSource" size="20" />
<span style="margin-left: 10px;color: green;"></span> <span style="margin-left: 10px; color: green"></span>
</template> </template>
</van-field> </van-field>
<van-field <van-field
...@@ -472,7 +492,7 @@ ...@@ -472,7 +492,7 @@
? [{ required: true, message: '重大危险源描述不能为空' }] ? [{ required: true, message: '重大危险源描述不能为空' }]
: [] : []
" "
style="padding-left: 0;padding-top: 0;" style="padding-left: 0; padding-top: 0"
/> />
</template> </template>
</van-field> </van-field>
...@@ -564,7 +584,7 @@ ...@@ -564,7 +584,7 @@
</van-popover> </van-popover>
</van-collapse-item> </van-collapse-item>
</van-collapse> </van-collapse>
<van-row type="flex" justify="center" style="margin-top:10px"> <van-row type="flex" justify="center" style="margin-top: 10px">
<van-col span="6" <van-col span="6"
><van-button ><van-button
size="small" size="small"
...@@ -645,7 +665,7 @@ ...@@ -645,7 +665,7 @@
> >
<div <div
class="van-picker__toolbar" class="van-picker__toolbar"
style="position: absolute;width: 100%;top: 0;" style="position: absolute; width: 100%; top: 0"
> >
<button <button
type="button" type="button"
...@@ -666,7 +686,7 @@ ...@@ -666,7 +686,7 @@
确认 确认
</button> </button>
</div> </div>
<div style="display:flex;margin-top: 44px;"> <div style="display: flex; margin-top: 44px">
<selectDept <selectDept
v-if="measuresDept" v-if="measuresDept"
@changeDept="changeDept" @changeDept="changeDept"
...@@ -683,15 +703,15 @@ ...@@ -683,15 +703,15 @@
@cancel="showTrouble = false" @cancel="showTrouble = false"
/> />
</van-popup> </van-popup>
<div style="margin: 16px 16px 0"> <div style="margin: 16px 16px 0">
<van-button <van-button
round round
block block
type="info" type="info"
@click="onSubmit('save',$event)" @click="onSubmit('save', $event)"
>保存</van-button >保存</van-button
> >
</div> </div>
<div style="margin: 16px 16px 0"> <div style="margin: 16px 16px 0">
<van-button <van-button
:loading="loadingStatus" :loading="loadingStatus"
...@@ -718,7 +738,7 @@ ...@@ -718,7 +738,7 @@
@click="touchstart(index, item)" @click="touchstart(index, item)"
:key="item.id" :key="item.id"
> >
<div style="font-size: 0.45rem;padding: 5px 0;"> <div style="font-size: 0.45rem; padding: 5px 0">
{{ item.name }} {{ item.name }}
</div> </div>
<van-row gutter=""> <van-row gutter="">
...@@ -771,21 +791,23 @@ ...@@ -771,21 +791,23 @@
<div <div
v-if="active != 0" v-if="active != 0"
style="display: flex; style="
justify-content: space-around; display: flex;
background-color: #fff; justify-content: space-around;
border-top: 1px solid #e3e3e3; background-color: #fff;
height: 1.5rem; border-top: 1px solid #e3e3e3;
width: 100%; height: 1.5rem;
text-align: center; width: 100%;
position: fixed; text-align: center;
bottom: 0;" position: fixed;
bottom: 0;
"
> >
<div <div
@click="performTasks" @click="performTasks"
style="color: #4bced0;font-size: 14px;font-weight: 600;" style="color: #4bced0; font-size: 14px; font-weight: 600"
> >
<div style="font-size: 22px;"><van-icon name="plus" /></div> <div style="font-size: 22px"><van-icon name="plus" /></div>
<div>新增现状风险</div> <div>新增现状风险</div>
</div> </div>
</div> </div>
...@@ -819,7 +841,7 @@ ...@@ -819,7 +841,7 @@
:style="{ height: '100%' }" :style="{ height: '100%' }"
> >
<selectList <selectList
v-if="showCheckSelect" v-if="showCheckSelect"
:listdata="columnsCheckData" :listdata="columnsCheckData"
@closeSlect="showCheckSelect = false" @closeSlect="showCheckSelect = false"
@saveSlect="saveCheckSelect" @saveSlect="saveCheckSelect"
...@@ -844,7 +866,7 @@ ...@@ -844,7 +866,7 @@
> >
<div <div
class="van-picker__toolbar" class="van-picker__toolbar"
style="position: absolute;width: 100%;top: 0;" style="position: absolute; width: 100%; top: 0"
> >
<button <button
type="button" type="button"
...@@ -861,12 +883,12 @@ ...@@ -861,12 +883,12 @@
确认 确认
</button> </button>
</div> </div>
<div style="display:flex;margin-top: 44px;"> <div style="display: flex; margin-top: 44px">
<selectDept @changeDept="changeDept"></selectDept> <selectDept @changeDept="changeDept"></selectDept>
</div> </div>
</van-popup> </van-popup>
<div v-if="isFloor"> <div v-if="isFloor">
<addFloor @close="closeFloor" :buildingId="form.buildingId"/> <addFloor @close="closeFloor" :buildingId="form.buildingId" />
</div> </div>
<!-- 管控责任人 --> <!-- 管控责任人 -->
<van-popup v-model="showTrouble" position="bottom"> <van-popup v-model="showTrouble" position="bottom">
...@@ -890,7 +912,7 @@ import selectFloor from "@/components/selectFloor.vue"; ...@@ -890,7 +912,7 @@ import selectFloor from "@/components/selectFloor.vue";
import { getUserInfo, getLocalUserInfo } from "@/utils/userInfo"; import { getUserInfo, getLocalUserInfo } from "@/utils/userInfo";
import { getFun, postFun } from "@/service/table.js"; import { getFun, postFun } from "@/service/table.js";
import { timestampToTime, generateId } from "@/utils/format"; import { timestampToTime, generateId } from "@/utils/format";
import addFloor from './addFloor' import addFloor from "./addFloor";
export default { export default {
name: "addCurrent", name: "addCurrent",
...@@ -899,12 +921,12 @@ export default { ...@@ -899,12 +921,12 @@ export default {
selectDept, selectDept,
SelectList, SelectList,
selectFloor, selectFloor,
addFloor addFloor,
}, },
activated() { activated() {
this.showSetRank = false; // 再次关闭弹出层 以防万一 this.showSetRank = false; // 再次关闭弹出层 以防万一
this.getList(); this.getList();
this.$bus.$on("riskLevelBus", res => { this.$bus.$on("riskLevelBus", (res) => {
this.showSetRank = false; // 再次关闭弹出层 以防万一 this.showSetRank = false; // 再次关闭弹出层 以防万一
console.log(Boolean(res)); console.log(Boolean(res));
if (res) { if (res) {
...@@ -931,7 +953,7 @@ export default { ...@@ -931,7 +953,7 @@ export default {
}, },
data() { data() {
return { return {
isFloor:false, isFloor: false,
loadingStatus: false, loadingStatus: false,
loadingText: "提交...", loadingText: "提交...",
measureNameList: [], measureNameList: [],
...@@ -1018,7 +1040,7 @@ export default { ...@@ -1018,7 +1040,7 @@ export default {
severityScore: 0, severityScore: 0,
messageList: [], messageList: [],
inherentId: 0, inherentId: 0,
buildingIds: "" buildingIds: "",
}; };
}, },
created() { created() {
...@@ -1037,28 +1059,30 @@ export default { ...@@ -1037,28 +1059,30 @@ export default {
} }
}, },
methods: { methods: {
createFloor(){ createFloor() {
this.isFloor = true; this.isFloor = true;
}, },
closeFloor(data){ closeFloor(data) {
if(data){ if (data) {
this.getFloor().then(()=>{ this.getFloor().then(() => {
const floors=[].concat(this.floorSource.map(x=>x.children).flat()); const floors = [].concat(
const currentFloor = floors.find(x=>x.id===data) this.floorSource.map((x) => x.children).flat()
console.log(floors,currentFloor); );
if(currentFloor){ const currentFloor = floors.find((x) => x.id === data);
this.saveSlectfloor(currentFloor); console.log(floors, currentFloor);
} if (currentFloor) {
}) this.saveSlectfloor(currentFloor);
}
});
} }
this.isFloor = false this.isFloor = false;
}, },
measuresUserNameChange(e) { measuresUserNameChange(e) {
getFun( getFun(
`/risk/plan/inherent/getResponsibilityPersons?personName=${e}&projectId=${this.form.projectId}` `/risk/plan/inherent/getResponsibilityPersons?personName=${e}&projectId=${this.form.projectId}`
).then(res => { ).then((res) => {
this.measureNameList = res.data; this.measureNameList = res.data;
this.measureNameList.forEach(item => { this.measureNameList.forEach((item) => {
if (item.measuresUserName == e) if (item.measuresUserName == e)
this.form.measuresUserPhone = item.measuresUserPhone; this.form.measuresUserPhone = item.measuresUserPhone;
}); });
...@@ -1068,7 +1092,7 @@ export default { ...@@ -1068,7 +1092,7 @@ export default {
measuresDeptNameChange(e) { measuresDeptNameChange(e) {
getFun( getFun(
`/risk/plan/inherent/getResponsibilityUnits?unitName=${e}&projectId=${this.form.projectId}` `/risk/plan/inherent/getResponsibilityUnits?unitName=${e}&projectId=${this.form.projectId}`
).then(res => { ).then((res) => {
this.measureDeptList = res.data; this.measureDeptList = res.data;
}); });
}, },
...@@ -1082,8 +1106,8 @@ export default { ...@@ -1082,8 +1106,8 @@ export default {
params: { params: {
inherentId: this.inherentId, inherentId: this.inherentId,
existingId: data.id, existingId: data.id,
isEdit: true isEdit: true,
} },
}); });
this.showIndex = null; this.showIndex = null;
}, },
...@@ -1091,11 +1115,11 @@ export default { ...@@ -1091,11 +1115,11 @@ export default {
delInherent(item) { delInherent(item) {
Dialog.confirm({ Dialog.confirm({
title: "删除现有风险", title: "删除现有风险",
message: "是否确认删除?" message: "是否确认删除?",
}) })
.then(() => { .then(() => {
// on confirm // on confirm
getFun(`/risk/plan/existing/delete/${item.id}`).then(res => { getFun(`/risk/plan/existing/delete/${item.id}`).then((res) => {
this.$toast.success(res.msg); this.$toast.success(res.msg);
this.getList(); this.getList();
// }); // });
...@@ -1134,7 +1158,7 @@ export default { ...@@ -1134,7 +1158,7 @@ export default {
// 请求表单数据 // 请求表单数据
getList() { getList() {
getFun(`/risk/plan/existing/list/${this.inherentId}`) getFun(`/risk/plan/existing/list/${this.inherentId}`)
.then(res => { .then((res) => {
console.log( console.log(
"%c [ res ]-670", "%c [ res ]-670",
"font-size:13px; background:pink; color:#bf2c9f;", "font-size:13px; background:pink; color:#bf2c9f;",
...@@ -1152,40 +1176,40 @@ export default { ...@@ -1152,40 +1176,40 @@ export default {
message: "加载中...", message: "加载中...",
forbidClick: true, forbidClick: true,
loadingType: "spinner", loadingType: "spinner",
duration: 0 duration: 0,
}); });
getFun(`/risk/plan/inherent/details/${this.inherentId}`) getFun(`/risk/plan/inherent/details/${this.inherentId}`)
.then(res => { .then((res) => {
this.form = res.data; this.form = res.data;
this.getFloor(); this.getFloor();
this.uploaderImg = (res.data.pictureFile || []).map(item => { this.uploaderImg = (res.data.pictureFile || []).map((item) => {
return { return {
...item, ...item,
url: item.filePath url: item.filePath,
}; };
}); });
this.measuresProjectFile = (res.data.measuresProjectFile || []).map( this.measuresProjectFile = (res.data.measuresProjectFile || []).map(
item => { (item) => {
return { return {
...item, ...item,
url: item.filePath url: item.filePath,
}; };
} }
); );
this.measuresAdministrationFile = ( this.measuresAdministrationFile = (
res.data.measuresAdministrationFile || [] res.data.measuresAdministrationFile || []
).map(item => { ).map((item) => {
return { return {
...item, ...item,
url: item.filePath url: item.filePath,
}; };
}); });
this.measuresEmergencyFile = ( this.measuresEmergencyFile = (
res.data.measuresEmergencyFile || [] res.data.measuresEmergencyFile || []
).map(item => { ).map((item) => {
return { return {
...item, ...item,
url: item.filePath url: item.filePath,
}; };
}); });
}) })
...@@ -1208,7 +1232,7 @@ export default { ...@@ -1208,7 +1232,7 @@ export default {
if (!this.form.measuresDeptId) { if (!this.form.measuresDeptId) {
this.$toast({ this.$toast({
title: "提示", title: "提示",
message: "请选择管控责任单位!" message: "请选择管控责任单位!",
}); });
return false; return false;
} }
...@@ -1216,9 +1240,9 @@ export default { ...@@ -1216,9 +1240,9 @@ export default {
message: "加载中...", message: "加载中...",
forbidClick: true, forbidClick: true,
loadingType: "spinner", loadingType: "spinner",
duration: 0 duration: 0,
}); });
getFun(`/risk/plan/user/list/${this.form.measuresDeptId}`).then(res => { getFun(`/risk/plan/user/list/${this.form.measuresDeptId}`).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.columnsTrouble = res.data; this.columnsTrouble = res.data;
// 对数据进行赋值 // 对数据进行赋值
...@@ -1241,7 +1265,7 @@ export default { ...@@ -1241,7 +1265,7 @@ export default {
getFun( getFun(
`/risk/plan/dict/data/list?dictType=risk_plan_${dataName.toLowerCase()}` `/risk/plan/dict/data/list?dictType=risk_plan_${dataName.toLowerCase()}`
) )
.then(res => { .then((res) => {
if (isSinge) { if (isSinge) {
this.columnsData = res.data; this.columnsData = res.data;
this.showSelect = true; this.showSelect = true;
...@@ -1264,7 +1288,7 @@ export default { ...@@ -1264,7 +1288,7 @@ export default {
this.showCheckSelect = false; this.showCheckSelect = false;
}, },
renameKeyInTree(data, oldKey, newKey) { renameKeyInTree(data, oldKey, newKey) {
let arr = data.map(item => { let arr = data.map((item) => {
const newItem = { ...item }; const newItem = { ...item };
if (item.hasOwnProperty(oldKey)) { if (item.hasOwnProperty(oldKey)) {
...@@ -1286,7 +1310,7 @@ export default { ...@@ -1286,7 +1310,7 @@ export default {
}, },
getFloor() { getFloor() {
return getFun(`/risk/plan/floor/list/${this.form.buildingId}`) return getFun(`/risk/plan/floor/list/${this.form.buildingId}`)
.then(res => { .then((res) => {
// this.$toast.clear(); // this.$toast.clear();
// this.showSource = true; // this.showSource = true;
...@@ -1306,11 +1330,11 @@ export default { ...@@ -1306,11 +1330,11 @@ export default {
message: "加载中...", message: "加载中...",
forbidClick: true, forbidClick: true,
loadingType: "spinner", loadingType: "spinner",
duration: 0 duration: 0,
}); });
this.userPrefix = name; this.userPrefix = name;
getFun(`/risk/plan/room/list/${this.form.floorId}`) getFun(`/risk/plan/room/list/${this.form.floorId}`)
.then(res => { .then((res) => {
this.$toast.clear(); this.$toast.clear();
this.showSource = true; this.showSource = true;
this.columnsSource = res.data; this.columnsSource = res.data;
...@@ -1329,14 +1353,14 @@ export default { ...@@ -1329,14 +1353,14 @@ export default {
//风险模型配置 //风险模型配置
getGradeList(type) { getGradeList(type) {
// possibility 可能性 severity 严重性 // possibility 可能性 severity 严重性
getFun(`/risk/plan/matrix/${type}/list`).then(res => { getFun(`/risk/plan/matrix/${type}/list`).then((res) => {
let arr = []; let arr = [];
res.data.forEach(item => { res.data.forEach((item) => {
arr.push({ arr.push({
text: item.title, text: item.title,
type: item.type, type: item.type,
sort: item.sort, sort: item.sort,
score: item.score score: item.score,
}); });
}); });
if (type === "possibility") { if (type === "possibility") {
...@@ -1351,8 +1375,8 @@ export default { ...@@ -1351,8 +1375,8 @@ export default {
this.ShowfloorList = false; this.ShowfloorList = false;
}, },
saveSlectfloor(data) { saveSlectfloor(data) {
if(this.form.floorId!=data.id){ if (this.form.floorId != data.id) {
this.form.roomName = '' this.form.roomName = "";
} }
this.form.floorId = data.id; this.form.floorId = data.id;
this.form.floorName = data.text; this.form.floorName = data.text;
...@@ -1373,9 +1397,9 @@ export default { ...@@ -1373,9 +1397,9 @@ export default {
name: "resultPage", name: "resultPage",
params: { params: {
score: this.severityScore * this.possibleScore, score: this.severityScore * this.possibleScore,
possibleValue:this.possibleValue, possibleValue: this.possibleValue,
severityValue:this.severityValue, severityValue: this.severityValue,
} },
}); });
}, },
performTasks() { performTasks() {
...@@ -1384,8 +1408,8 @@ export default { ...@@ -1384,8 +1408,8 @@ export default {
name: "addPresent", name: "addPresent",
params: { params: {
inherentId: this.inherentId, inherentId: this.inherentId,
isEdit: false isEdit: false,
} },
}); });
}, },
// 点击预览图 // 点击预览图
...@@ -1403,55 +1427,55 @@ export default { ...@@ -1403,55 +1427,55 @@ export default {
let formdata = new FormData(); let formdata = new FormData();
formdata.append("key", val["fileId"]); formdata.append("key", val["fileId"]);
var ids = this.form[key + "Ids"].split(","); var ids = this.form[key + "Ids"].split(",");
const ind = ids.findIndex(x => x == val.fileId); const ind = ids.findIndex((x) => x == val.fileId);
ids.splice(ind, 1); ids.splice(ind, 1);
this.form[key + "Ids"] = ids.join(","); this.form[key + "Ids"] = ids.join(",");
this.form[key].splice(detail.index, 1); this.form[key].splice(detail.index, 1);
console.log(ids, this.form[key], "ddd"); console.log(ids, this.form[key], "ddd");
this.$toast({ this.$toast({
title: "提示", title: "提示",
message: "删除成功!" message: "删除成功!",
}); });
} }
}, },
jsonToFormData(config) { jsonToFormData(config) {
const formData = new FormData(); const formData = new FormData();
//循环传入的值转换formData //循环传入的值转换formData
Object.keys(config).forEach(key => { Object.keys(config).forEach((key) => {
formData.append(key, config[key]); formData.append(key, config[key]);
}); });
return formData; return formData;
}, },
onSubmit(values,event) { onSubmit(values, event) {
if(values=='save'){ if (values == "save") {
event.preventDefault(); event.preventDefault();
} }
// console.log('%c [ values ]-592', 'font-size:13px; background:pink; color:#bf2c9f;', values) // console.log('%c [ values ]-592', 'font-size:13px; background:pink; color:#bf2c9f;', values)
var formDataJson = this.jsonToFormData(this.form); var formDataJson = this.jsonToFormData(this.form);
let url = "/risk/plan/inherent"; let url = "/risk/plan/inherent";
this.loadingStatus = true; this.loadingStatus = true;
this.uploaderImg.forEach(item => { this.uploaderImg.forEach((item) => {
if (item.file) { if (item.file) {
formDataJson.append("pictureFile[]", item.file); formDataJson.append("pictureFile[]", item.file);
} else { } else {
formDataJson.append("pictureFile[]", item.fileId); formDataJson.append("pictureFile[]", item.fileId);
} }
}); });
this.measuresAdministrationFile.forEach(item => { this.measuresAdministrationFile.forEach((item) => {
if (item.file) { if (item.file) {
formDataJson.append("measuresProjectFile[]", item.file); formDataJson.append("measuresProjectFile[]", item.file);
} else { } else {
formDataJson.append("measuresProjectFile[]", item.fileId); formDataJson.append("measuresProjectFile[]", item.fileId);
} }
}); });
this.measuresEmergencyFile.forEach(item => { this.measuresEmergencyFile.forEach((item) => {
if (item.file) { if (item.file) {
formDataJson.append("measuresEmergencyFile[]", item.file); formDataJson.append("measuresEmergencyFile[]", item.file);
} else { } else {
formDataJson.append("measuresEmergencyFile[]", item.fileId); formDataJson.append("measuresEmergencyFile[]", item.fileId);
} }
}); });
this.measuresAdministrationFile.forEach(item => { this.measuresAdministrationFile.forEach((item) => {
if (item.file) { if (item.file) {
formDataJson.append("measuresAdministrationFile[]", item.file); formDataJson.append("measuresAdministrationFile[]", item.file);
} else { } else {
...@@ -1487,11 +1511,11 @@ export default { ...@@ -1487,11 +1511,11 @@ export default {
// } // }
// }); // });
postFun(url, formDataJson) postFun(url, formDataJson)
.then(res => { .then((res) => {
this.$toast.clear(); this.$toast.clear();
this.$toast.success({ this.$toast.success({
message: "提交成功", message: "提交成功",
duration: 2000 duration: 2000,
}); });
this.loadingStatus = false; this.loadingStatus = false;
history.go(-1); history.go(-1);
...@@ -1526,7 +1550,7 @@ export default { ...@@ -1526,7 +1550,7 @@ export default {
this.trouble = ""; this.trouble = "";
// 请求风险源 // 请求风险源
postHdSource(`/riskMain/showSourceName?factorType=${this.factor}`).then( postHdSource(`/riskMain/showSourceName?factorType=${this.factor}`).then(
res => { (res) => {
this.columnsSource = res.data; this.columnsSource = res.data;
} }
); );
...@@ -1549,7 +1573,7 @@ export default { ...@@ -1549,7 +1573,7 @@ export default {
if (this.setRank == "矩阵式定级") { if (this.setRank == "矩阵式定级") {
this.showSetRank = false; this.showSetRank = false;
this.$router.push({ this.$router.push({
name: "matrix-grad" name: "matrix-grad",
}); });
} }
}, },
...@@ -1581,7 +1605,7 @@ export default { ...@@ -1581,7 +1605,7 @@ export default {
// 请求主责人员 // 请求主责人员
let formdata = new FormData(); let formdata = new FormData();
formdata.append("organizationId", this.mainDutyDeptId); formdata.append("organizationId", this.mainDutyDeptId);
postHdPeople(`/riskMain/getUserList`, formdata).then(res => { postHdPeople(`/riskMain/getUserList`, formdata).then((res) => {
this.columnsMainDutyPeopLe = res.data; this.columnsMainDutyPeopLe = res.data;
}); });
}, },
...@@ -1593,12 +1617,17 @@ export default { ...@@ -1593,12 +1617,17 @@ export default {
}, },
//添加房间 //添加房间
tjfjClcik() { tjfjClcik() {
if (!this.form.buildingId) {
this.$toast("请先选择所属建筑物");
return;
}
this.$router.push({ this.$router.push({
name: "riskView", name: "riskView",
params: { params: {
floorId: this.form.floorId, floorId: this.form.floorId,
isView: false buildingId: this.form.buildingId,
} isView: false,
},
}); });
}, },
...@@ -1618,7 +1647,7 @@ export default { ...@@ -1618,7 +1647,7 @@ export default {
this.projectDirector = e[0].loginName; this.projectDirector = e[0].loginName;
this.projectDirectorName = e[0].userName; this.projectDirectorName = e[0].userName;
this.show = false; this.show = false;
} },
}, },
watch: { watch: {
"form.pointType"(val, old) { "form.pointType"(val, old) {
...@@ -1629,8 +1658,8 @@ export default { ...@@ -1629,8 +1658,8 @@ export default {
this.form.specialEquipment = ""; this.form.specialEquipment = "";
} }
} }
} },
} },
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
<template> <template>
<div> <div>
<LHeader :text="text"></LHeader> <LHeader :text="text">
<span slot="right" @click="toImport">导入</span>
</LHeader>
<van-form <van-form
@submit="onSubmit" @submit="onSubmit"
:scroll-to-error="true" :scroll-to-error="true"
...@@ -9,12 +11,17 @@ ...@@ -9,12 +11,17 @@
ref="formEle" ref="formEle"
> >
<div <div
style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" style="
height: 1rem;
font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';
font-weight: 700;
line-height: 1rem;
"
> >
<img <img
src="@/assets/accidentIcon/bookmark.svg" src="@/assets/accidentIcon/bookmark.svg"
alt="" alt=""
style="position: relative;top: 32%;transform: translateY(-50%);" style="position: relative; top: 32%; transform: translateY(-50%)"
/> />
固有风险信息 固有风险信息
</div> </div>
...@@ -43,28 +50,27 @@ ...@@ -43,28 +50,27 @@
placeholder="请输入 " placeholder="请输入 "
/> />
<div style="display: flex;"> <div style="display: flex">
<van-field <van-field
required required
clickable clickable
name="floorName" name="floorName"
:value="form.floorName" :value="form.floorName"
label="所属楼层" label="所属楼层"
placeholder="请选择" placeholder="请选择"
@click="seletFloor('floor')" @click="seletFloor('floor')"
:rules="[{ required: true, message: '所属楼层不能为空' }]" :rules="[{ required: true, message: '所属楼层不能为空' }]"
/> />
<van-button <van-button
style="color: #cccc;background-color: #f0f1f5;" style="color: #cccc; background-color: #f0f1f5"
icon="plus" icon="plus"
type="info" type="info"
native-type="button" native-type="button"
@click="isFloor=true" @click="isFloor = true"
/> />
</div> </div>
<div style="display: flex;"> <div style="display: flex">
<van-field <van-field
readonly readonly
required required
...@@ -76,7 +82,7 @@ ...@@ -76,7 +82,7 @@
:rules="[{ required: true, message: '所属房间不能为空' }]" :rules="[{ required: true, message: '所属房间不能为空' }]"
/> />
<van-button <van-button
style="color: #cccc;background-color: #f0f1f5;" style="color: #cccc; background-color: #f0f1f5"
icon="plus" icon="plus"
type="info" type="info"
native-type="button" native-type="button"
...@@ -111,13 +117,13 @@ ...@@ -111,13 +117,13 @@
v-show="form.pointType == '设备设施类'" v-show="form.pointType == '设备设施类'"
> >
<template #input> <template #input>
<span style="margin-right: 10px;color: red;"></span> <span style="margin-right: 10px; color: red"></span>
<van-switch <van-switch
name="specialEquipment" name="specialEquipment"
v-model="form.specialEquipment" v-model="form.specialEquipment"
size="20" size="20"
/> />
<span style="margin-left: 10px;color: green;"></span> <span style="margin-left: 10px; color: green"></span>
</template> </template>
</van-field> </van-field>
<!-- 多选 --> <!-- 多选 -->
...@@ -176,12 +182,17 @@ ...@@ -176,12 +182,17 @@
/> />
<div <div
style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" style="
height: 1rem;
font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';
font-weight: 700;
line-height: 1rem;
"
> >
<img <img
src="@/assets/accidentIcon/bookmark.svg" src="@/assets/accidentIcon/bookmark.svg"
alt="" alt=""
style="position: relative;top: 32%;transform: translateY(-50%);" style="position: relative; top: 32%; transform: translateY(-50%)"
/> />
风险图片 风险图片
</div> </div>
...@@ -197,14 +208,14 @@ ...@@ -197,14 +208,14 @@
<template slot="default"> <template slot="default">
<div <div
style=" style="
width: 2.13333rem; width: 2.13333rem;
height: 2.13333rem; height: 2.13333rem;
background: #f7f8fa; background: #f7f8fa;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
" "
> >
<img <img
src="@/assets/upload/pic.png" src="@/assets/upload/pic.png"
...@@ -218,12 +229,17 @@ ...@@ -218,12 +229,17 @@
</template> </template>
</van-field> </van-field>
<div <div
style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" style="
height: 1rem;
font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';
font-weight: 700;
line-height: 1rem;
"
> >
<img <img
src="@/assets/accidentIcon/bookmark.svg" src="@/assets/accidentIcon/bookmark.svg"
alt="" alt=""
style="position: relative;top: 32%;transform: translateY(-50%);" style="position: relative; top: 32%; transform: translateY(-50%)"
/> />
应采取的管控措施 应采取的管控措施
</div> </div>
...@@ -237,7 +253,7 @@ ...@@ -237,7 +253,7 @@
rows="3" rows="3"
autosize autosize
placeholder="请输入" placeholder="请输入"
style="padding-left: 0;padding-top: 0;" style="padding-left: 0; padding-top: 0"
/> />
</template> </template>
</van-field> </van-field>
...@@ -254,14 +270,14 @@ ...@@ -254,14 +270,14 @@
<template slot="default"> <template slot="default">
<div <div
style=" style="
width: 2.13333rem; width: 2.13333rem;
height: 2.13333rem; height: 2.13333rem;
background: #f7f8fa; background: #f7f8fa;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
" "
> >
<img <img
src="@/assets/upload/file.png" src="@/assets/upload/file.png"
...@@ -284,7 +300,7 @@ ...@@ -284,7 +300,7 @@
rows="3" rows="3"
autosize autosize
placeholder="请输入" placeholder="请输入"
style="padding-left: 0;padding-top: 0;" style="padding-left: 0; padding-top: 0"
/> />
</template> </template>
</van-field> </van-field>
...@@ -301,14 +317,14 @@ ...@@ -301,14 +317,14 @@
<template slot="default"> <template slot="default">
<div <div
style=" style="
width: 2.13333rem; width: 2.13333rem;
height: 2.13333rem; height: 2.13333rem;
background: #f7f8fa; background: #f7f8fa;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
" "
> >
<img <img
src="@/assets/upload/file.png" src="@/assets/upload/file.png"
...@@ -331,7 +347,7 @@ ...@@ -331,7 +347,7 @@
rows="3" rows="3"
autosize autosize
placeholder="请输入" placeholder="请输入"
style="padding-left: 0;padding-top: 0;" style="padding-left: 0; padding-top: 0"
/> />
</template> </template>
</van-field> </van-field>
...@@ -349,13 +365,13 @@ ...@@ -349,13 +365,13 @@
<!-- 11111111111 --> <!-- 11111111111 -->
<div <div
style=" style="
width: 2.13333rem; width: 2.13333rem;
height: 2.13333rem; height: 2.13333rem;
background: #f7f8fa; background: #f7f8fa;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
" "
> >
<img <img
...@@ -416,21 +432,26 @@ ...@@ -416,21 +432,26 @@
maxlength="11" maxlength="11"
/> />
<div <div
style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" style="
height: 1rem;
font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';
font-weight: 700;
line-height: 1rem;
"
> >
<img <img
src="@/assets/accidentIcon/bookmark.svg" src="@/assets/accidentIcon/bookmark.svg"
alt="" alt=""
style="position: relative;top: 32%;transform: translateY(-50%);" style="position: relative; top: 32%; transform: translateY(-50%)"
/> />
重大危险源管理 重大危险源管理
</div> </div>
<van-field name="majorHazardSource" label="是否为重大危险源"> <van-field name="majorHazardSource" label="是否为重大危险源">
<template #input> <template #input>
<span style="margin-right: 10px;color: red;"></span> <span style="margin-right: 10px; color: red"></span>
<van-switch v-model="form.majorHazardSource" size="20" /> <van-switch v-model="form.majorHazardSource" size="20" />
<span style="margin-left: 10px;color: green;"></span> <span style="margin-left: 10px; color: green"></span>
</template> </template>
</van-field> </van-field>
<van-field <van-field
...@@ -471,7 +492,7 @@ ...@@ -471,7 +492,7 @@
? [{ required: true, message: '重大危险源描述不能为空' }] ? [{ required: true, message: '重大危险源描述不能为空' }]
: [] : []
" "
style="padding-left: 0;padding-top: 0;" style="padding-left: 0; padding-top: 0"
/> />
</template> </template>
</van-field> </van-field>
...@@ -553,7 +574,7 @@ ...@@ -553,7 +574,7 @@
</van-popover> </van-popover>
</van-collapse-item> </van-collapse-item>
</van-collapse> </van-collapse>
<van-row type="flex" justify="center" style="margin-top:10px"> <van-row type="flex" justify="center" style="margin-top: 10px">
<van-col span="6" <van-col span="6"
><van-button ><van-button
size="small" size="small"
...@@ -615,7 +636,8 @@ ...@@ -615,7 +636,8 @@
<!-- 房间弹出层 --> <!-- 房间弹出层 -->
<van-popup v-model="showSource" position="bottom"> <van-popup v-model="showSource" position="bottom">
<van-picker v-if="showSource" <van-picker
v-if="showSource"
show-toolbar show-toolbar
value-key="name" value-key="name"
:columns="columnsSource" :columns="columnsSource"
...@@ -631,7 +653,7 @@ ...@@ -631,7 +653,7 @@
> >
<div <div
class="van-picker__toolbar" class="van-picker__toolbar"
style="position: absolute;width: 100%;top: 0;" style="position: absolute; width: 100%; top: 0"
> >
<button <button
type="button" type="button"
...@@ -648,13 +670,13 @@ ...@@ -648,13 +670,13 @@
确认 确认
</button> </button>
</div> </div>
<div style="display:flex;margin-top: 44px;"> <div style="display: flex; margin-top: 44px">
<selectDept @changeDept="changeDept"></selectDept> <selectDept @changeDept="changeDept"></selectDept>
</div> </div>
</van-popup> </van-popup>
<div v-if="isFloor"> <div v-if="isFloor">
<addFloor @close="closeFloor" :buildingId="form.buildingId"/> <addFloor @close="closeFloor" :buildingId="form.buildingId" />
</div> </div>
<!-- 管控责任人 --> <!-- 管控责任人 -->
<van-popup v-model="showTrouble" position="bottom"> <van-popup v-model="showTrouble" position="bottom">
<van-picker <van-picker
...@@ -673,7 +695,7 @@ ...@@ -673,7 +695,7 @@
round round
block block
type="info" type="info"
@click="onSubmit('save',$event)" @click="onSubmit('save', $event)"
>保存</van-button >保存</van-button
> >
</div> </div>
...@@ -702,7 +724,7 @@ import LHeader from "@/components/header.vue"; ...@@ -702,7 +724,7 @@ import LHeader from "@/components/header.vue";
import selectDept from "@/components/selectDept/index.vue"; import selectDept from "@/components/selectDept/index.vue";
import SelectList from "@/components/selectList.vue"; import SelectList from "@/components/selectList.vue";
import selectFloor from "@/components/selectFloor.vue"; import selectFloor from "@/components/selectFloor.vue";
import addFloor from './addFloor' import addFloor from "./addFloor";
import { getUserInfo, getLocalUserInfo } from "@/utils/userInfo"; import { getUserInfo, getLocalUserInfo } from "@/utils/userInfo";
import { getFun, postFun } from "@/service/table.js"; import { getFun, postFun } from "@/service/table.js";
...@@ -713,7 +735,7 @@ export default { ...@@ -713,7 +735,7 @@ export default {
selectDept, selectDept,
SelectList, SelectList,
selectFloor, selectFloor,
addFloor addFloor,
}, },
activated() { activated() {
...@@ -726,7 +748,7 @@ export default { ...@@ -726,7 +748,7 @@ export default {
} }
this.getList(); this.getList();
this.$bus.$on("riskLevelBus", res => { this.$bus.$on("riskLevelBus", (res) => {
this.showSetRank = false; // 再次关闭弹出层 以防万一 this.showSetRank = false; // 再次关闭弹出层 以防万一
console.log(Boolean(res)); console.log(Boolean(res));
if (res) { if (res) {
...@@ -745,15 +767,18 @@ export default { ...@@ -745,15 +767,18 @@ export default {
} }
next(); next();
}, },
destroyed() {
this.$store.commit("SET_INHERENT_TEMPLATE", {});
},
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
if (to.name != "riskInherent") { if (to.name == "resultPage") {
sessionStorage.setItem("inherenForm", JSON.stringify(this.form)); sessionStorage.setItem("inherenForm", JSON.stringify(this.form));
} }
next(); next();
}, },
data() { data() {
return { return {
isFloor:false, isFloor: false,
loadingStatus: false, loadingStatus: false,
loadingText: "提交...", loadingText: "提交...",
measureNameList: [], measureNameList: [],
...@@ -782,7 +807,7 @@ export default { ...@@ -782,7 +807,7 @@ export default {
isTimely: 1, isTimely: 1,
active: 0, active: 0,
form: { form: {
specialEquipment: "" specialEquipment: "",
}, },
projectId: "", // 所属工程 projectId: "", // 所属工程
projectName: "", // 所属工程 projectName: "", // 所属工程
...@@ -839,7 +864,7 @@ export default { ...@@ -839,7 +864,7 @@ export default {
possibleValue: "", possibleValue: "",
possibleScore: 0, possibleScore: 0,
severityValue: "", severityValue: "",
severityScore: 0 severityScore: 0,
}; };
}, },
created() { created() {
...@@ -860,37 +885,43 @@ export default { ...@@ -860,37 +885,43 @@ export default {
if (sessionStorage.getItem("inherenForm") != "") { if (sessionStorage.getItem("inherenForm") != "") {
this.form = JSON.parse(sessionStorage.getItem("inherenForm")); this.form = JSON.parse(sessionStorage.getItem("inherenForm"));
this.form.level = sessionStorage.getItem("level"); this.form.level = sessionStorage.getItem("level");
} else if (this.$store.state.inherentTemplate) {
this.form = { ...this.form, ...this.$store.state.inherentTemplate };
} }
this.getFloor(); this.getFloor();
}, },
methods: { methods: {
/* swp add */ toImport() {
toSave(e){ //保存 this.$router.push({ name: "inherent-template" });
},
toSave(e) {
//保存
e.preventDefault(); e.preventDefault();
var formDataJson = this.jsonToFormData(this.form); var formDataJson = this.jsonToFormData(this.form);
this.uploaderImg.forEach(item => { this.uploaderImg.forEach((item) => {
if (item.file) { if (item.file) {
formDataJson.append("pictureFile[]", item.file); formDataJson.append("pictureFile[]", item.file);
} else { } else {
formDataJson.append("pictureFile[]", item.fileId); formDataJson.append("pictureFile[]", item.fileId);
} }
}); });
this.measuresAdministrationFile.forEach(item => { this.measuresAdministrationFile.forEach((item) => {
if (item.file) { if (item.file) {
formDataJson.append("measuresProjectFile[]", item.file); formDataJson.append("measuresProjectFile[]", item.file);
} else { } else {
formDataJson.append("measuresProjectFile[]", item.fileId); formDataJson.append("measuresProjectFile[]", item.fileId);
} }
}); });
this.measuresEmergencyFile.forEach(item => { this.measuresEmergencyFile.forEach((item) => {
if (item.file) { if (item.file) {
formDataJson.append("measuresEmergencyFile[]", item.file); formDataJson.append("measuresEmergencyFile[]", item.file);
} else { } else {
formDataJson.append("measuresEmergencyFile[]", item.fileId); formDataJson.append("measuresEmergencyFile[]", item.fileId);
} }
}); });
this.measuresAdministrationFile.forEach(item => { this.measuresAdministrationFile.forEach((item) => {
if (item.file) { if (item.file) {
formDataJson.append("measuresAdministrationFile[]", item.file); formDataJson.append("measuresAdministrationFile[]", item.file);
} else { } else {
...@@ -898,24 +929,26 @@ export default { ...@@ -898,24 +929,26 @@ export default {
} }
}); });
}, },
closeFloor(data){ closeFloor(data) {
if(data){ if (data) {
this.getFloor().then(()=>{ this.getFloor().then(() => {
const floors=[].concat(this.floorSource.map(x=>x.children).flat()) const floors = [].concat(
const currentFloor = floors.find(x=>x.id===data) this.floorSource.map((x) => x.children).flat()
if(currentFloor){ );
this.saveSlectfloor(currentFloor); const currentFloor = floors.find((x) => x.id === data);
} if (currentFloor) {
}) this.saveSlectfloor(currentFloor);
}
});
} }
this.isFloor = false; this.isFloor = false;
}, },
measuresUserNameChange(e) { measuresUserNameChange(e) {
getFun( getFun(
`/risk/plan/inherent/getResponsibilityPersons?personName=${e}&projectId=${this.form.projectId}` `/risk/plan/inherent/getResponsibilityPersons?personName=${e}&projectId=${this.form.projectId}`
).then(res => { ).then((res) => {
this.measureNameList = res.data; this.measureNameList = res.data;
this.measureNameList.forEach(item => { this.measureNameList.forEach((item) => {
if (item.measuresUserName == e) if (item.measuresUserName == e)
this.form.measuresUserPhone = item.measuresUserPhone; this.form.measuresUserPhone = item.measuresUserPhone;
}); });
...@@ -925,11 +958,10 @@ export default { ...@@ -925,11 +958,10 @@ export default {
measuresDeptNameChange(e) { measuresDeptNameChange(e) {
getFun( getFun(
`/risk/plan/inherent/getResponsibilityUnits?unitName=${e}&projectId=${this.form.projectId}` `/risk/plan/inherent/getResponsibilityUnits?unitName=${e}&projectId=${this.form.projectId}`
).then(res => { ).then((res) => {
this.measureDeptList = res.data; this.measureDeptList = res.data;
}); });
}, },
/* swp add end */
// 项目负责人 // 项目负责人
onConTrouble(value) { onConTrouble(value) {
if (!value) { if (!value) {
...@@ -945,7 +977,7 @@ export default { ...@@ -945,7 +977,7 @@ export default {
if (!this.form.measuresDeptId) { if (!this.form.measuresDeptId) {
this.$toast({ this.$toast({
title: "提示", title: "提示",
message: "请选择管控责任单位!" message: "请选择管控责任单位!",
}); });
return false; return false;
} }
...@@ -953,9 +985,9 @@ export default { ...@@ -953,9 +985,9 @@ export default {
message: "加载中...", message: "加载中...",
forbidClick: true, forbidClick: true,
loadingType: "spinner", loadingType: "spinner",
duration: 0 duration: 0,
}); });
getFun(`/risk/plan/user/list/${this.form.measuresDeptId}`).then(res => { getFun(`/risk/plan/user/list/${this.form.measuresDeptId}`).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.columnsTrouble = res.data; this.columnsTrouble = res.data;
// 对数据进行赋值 // 对数据进行赋值
...@@ -978,7 +1010,7 @@ export default { ...@@ -978,7 +1010,7 @@ export default {
getFun( getFun(
`/risk/plan/dict/data/list?dictType=risk_plan_${dataName.toLowerCase()}` `/risk/plan/dict/data/list?dictType=risk_plan_${dataName.toLowerCase()}`
) )
.then(res => { .then((res) => {
if (isSinge) { if (isSinge) {
this.columnsData = res.data; this.columnsData = res.data;
this.showSelect = true; this.showSelect = true;
...@@ -1001,7 +1033,7 @@ export default { ...@@ -1001,7 +1033,7 @@ export default {
this.showCheckSelect = false; this.showCheckSelect = false;
}, },
renameKeyInTree(data, oldKey, newKey) { renameKeyInTree(data, oldKey, newKey) {
let arr = data.map(item => { let arr = data.map((item) => {
const newItem = { ...item }; const newItem = { ...item };
if (item.hasOwnProperty(oldKey)) { if (item.hasOwnProperty(oldKey)) {
...@@ -1022,8 +1054,8 @@ export default { ...@@ -1022,8 +1054,8 @@ export default {
return arr; return arr;
}, },
getFloor() { getFloor() {
return getFun(`/risk/plan/floor/list/${this.form.buildingIds}`) return getFun(`/risk/plan/floor/list/${this.form.buildingIds}`)
.then(res => { .then((res) => {
// this.$toast.clear(); // this.$toast.clear();
// this.showSource = true; // this.showSource = true;
...@@ -1042,7 +1074,7 @@ export default { ...@@ -1042,7 +1074,7 @@ export default {
if (!this.form.floorId) { if (!this.form.floorId) {
this.$toast({ this.$toast({
title: "提示", title: "提示",
message: "请选择所属楼层!" message: "请选择所属楼层!",
}); });
return false; return false;
} }
...@@ -1050,11 +1082,11 @@ export default { ...@@ -1050,11 +1082,11 @@ export default {
message: "加载中...", message: "加载中...",
forbidClick: true, forbidClick: true,
loadingType: "spinner", loadingType: "spinner",
duration: 0 duration: 0,
}); });
this.userPrefix = name; this.userPrefix = name;
getFun(`/risk/plan/room/list/${this.form.floorId}`) getFun(`/risk/plan/room/list/${this.form.floorId}`)
.then(res => { .then((res) => {
this.$toast.clear(); this.$toast.clear();
this.showSource = true; this.showSource = true;
this.columnsSource = res.data; this.columnsSource = res.data;
...@@ -1073,14 +1105,14 @@ export default { ...@@ -1073,14 +1105,14 @@ export default {
//风险模型配置 //风险模型配置
getGradeList(type) { getGradeList(type) {
// possibility 可能性 severity 严重性 // possibility 可能性 severity 严重性
getFun(`/risk/plan/matrix/${type}/list`).then(res => { getFun(`/risk/plan/matrix/${type}/list`).then((res) => {
let arr = []; let arr = [];
res.data.forEach(item => { res.data.forEach((item) => {
arr.push({ arr.push({
text: item.title, text: item.title,
type: item.type, type: item.type,
sort: item.sort, sort: item.sort,
score: item.score score: item.score,
}); });
}); });
if (type === "possibility") { if (type === "possibility") {
...@@ -1100,8 +1132,8 @@ export default { ...@@ -1100,8 +1132,8 @@ export default {
this.ShowfloorList = false; this.ShowfloorList = false;
}, },
saveSlectfloor(data) { saveSlectfloor(data) {
if(this.form.floorId!=data.id){ if (this.form.floorId != data.id) {
this.form.roomName = '' this.form.roomName = "";
} }
this.form.floorId = data.id; this.form.floorId = data.id;
this.form.floorName = data.text; this.form.floorName = data.text;
...@@ -1122,9 +1154,9 @@ export default { ...@@ -1122,9 +1154,9 @@ export default {
name: "resultPage", name: "resultPage",
params: { params: {
score: this.severityScore * this.possibleScore, score: this.severityScore * this.possibleScore,
possibleValue:this.possibleValue, possibleValue: this.possibleValue,
severityValue:this.severityValue, severityValue: this.severityValue,
} },
}); });
}, },
performTasks() { performTasks() {
...@@ -1147,48 +1179,48 @@ export default { ...@@ -1147,48 +1179,48 @@ export default {
formdata.append("key", val["fileId"]); formdata.append("key", val["fileId"]);
this.$toast({ this.$toast({
title: "提示", title: "提示",
message: "删除成功!" message: "删除成功!",
}); });
} }
}, },
jsonToFormData(config) { jsonToFormData(config) {
const formData = new FormData(); const formData = new FormData();
//循环传入的值转换formData //循环传入的值转换formData
Object.keys(config).forEach(key => { Object.keys(config).forEach((key) => {
formData.append(key, config[key]); formData.append(key, config[key]);
}); });
return formData; return formData;
}, },
onSubmit(values,event) { onSubmit(values, event) {
if(values=='save'){ if (values == "save") {
event.preventDefault(); event.preventDefault();
} }
// console.log('%c [ values ]-592', 'font-size:13px; background:pink; color:#bf2c9f;', values) // console.log('%c [ values ]-592', 'font-size:13px; background:pink; color:#bf2c9f;', values)
var formDataJson = this.jsonToFormData(this.form); var formDataJson = this.jsonToFormData(this.form);
let url = "/risk/plan/inherent"; let url = "/risk/plan/inherent";
this.loadingStatus = true; this.loadingStatus = true;
this.uploaderImg.forEach(item => { this.uploaderImg.forEach((item) => {
if (item.file) { if (item.file) {
formDataJson.append("pictureFile[]", item.file); formDataJson.append("pictureFile[]", item.file);
} else { } else {
formDataJson.append("pictureFile[]", item.fileId); formDataJson.append("pictureFile[]", item.fileId);
} }
}); });
this.measuresAdministrationFile.forEach(item => { this.measuresAdministrationFile.forEach((item) => {
if (item.file) { if (item.file) {
formDataJson.append("measuresProjectFile[]", item.file); formDataJson.append("measuresProjectFile[]", item.file);
} else { } else {
formDataJson.append("measuresProjectFile[]", item.fileId); formDataJson.append("measuresProjectFile[]", item.fileId);
} }
}); });
this.measuresEmergencyFile.forEach(item => { this.measuresEmergencyFile.forEach((item) => {
if (item.file) { if (item.file) {
formDataJson.append("measuresEmergencyFile[]", item.file); formDataJson.append("measuresEmergencyFile[]", item.file);
} else { } else {
formDataJson.append("measuresEmergencyFile[]", item.fileId); formDataJson.append("measuresEmergencyFile[]", item.fileId);
} }
}); });
this.measuresAdministrationFile.forEach(item => { this.measuresAdministrationFile.forEach((item) => {
if (item.file) { if (item.file) {
formDataJson.append("measuresAdministrationFile[]", item.file); formDataJson.append("measuresAdministrationFile[]", item.file);
} else { } else {
...@@ -1225,11 +1257,11 @@ export default { ...@@ -1225,11 +1257,11 @@ export default {
// }); // });
postFun(url, formDataJson) postFun(url, formDataJson)
.then(res => { .then((res) => {
this.$toast.clear(); this.$toast.clear();
this.$toast.success({ this.$toast.success({
message: "提交成功", message: "提交成功",
duration: 2000 duration: 2000,
}); });
this.loadingStatus = false; this.loadingStatus = false;
history.go(-1); history.go(-1);
...@@ -1248,10 +1280,10 @@ export default { ...@@ -1248,10 +1280,10 @@ export default {
message: "加载中...", message: "加载中...",
forbidClick: true, forbidClick: true,
loadingType: "spinner", loadingType: "spinner",
duration: 0 duration: 0,
}); });
getFormList("/riskMain/add") getFormList("/riskMain/add")
.then(res => { .then((res) => {
this.$toast.clear(); this.$toast.clear();
this.columnsProjectName = res.data.projectInformations; this.columnsProjectName = res.data.projectInformations;
this.columnsFactor = res.data.riskInventories; this.columnsFactor = res.data.riskInventories;
...@@ -1269,10 +1301,10 @@ export default { ...@@ -1269,10 +1301,10 @@ export default {
message: "加载中...", message: "加载中...",
forbidClick: true, forbidClick: true,
loadingType: "spinner", loadingType: "spinner",
duration: 0 duration: 0,
}); });
postriskConiCause(`/riskMain/edit/${this.taskId}`) postriskConiCause(`/riskMain/edit/${this.taskId}`)
.then(res => { .then((res) => {
console.log( console.log(
"%c [ res ]-332", "%c [ res ]-332",
"font-size:13px; background:pink; color:#bf2c9f;", "font-size:13px; background:pink; color:#bf2c9f;",
...@@ -1306,7 +1338,7 @@ export default { ...@@ -1306,7 +1338,7 @@ export default {
this.trouble = ""; this.trouble = "";
// 请求风险源 // 请求风险源
postHdSource(`/riskMain/showSourceName?factorType=${this.factor}`).then( postHdSource(`/riskMain/showSourceName?factorType=${this.factor}`).then(
res => { (res) => {
this.columnsSource = res.data; this.columnsSource = res.data;
} }
); );
...@@ -1329,7 +1361,7 @@ export default { ...@@ -1329,7 +1361,7 @@ export default {
if (this.setRank == "矩阵式定级") { if (this.setRank == "矩阵式定级") {
this.showSetRank = false; this.showSetRank = false;
this.$router.push({ this.$router.push({
name: "matrix-grad" name: "matrix-grad",
}); });
} }
}, },
...@@ -1361,7 +1393,7 @@ export default { ...@@ -1361,7 +1393,7 @@ export default {
// 请求主责人员 // 请求主责人员
let formdata = new FormData(); let formdata = new FormData();
formdata.append("organizationId", this.mainDutyDeptId); formdata.append("organizationId", this.mainDutyDeptId);
postHdPeople(`/riskMain/getUserList`, formdata).then(res => { postHdPeople(`/riskMain/getUserList`, formdata).then((res) => {
this.columnsMainDutyPeopLe = res.data; this.columnsMainDutyPeopLe = res.data;
}); });
}, },
...@@ -1376,7 +1408,7 @@ export default { ...@@ -1376,7 +1408,7 @@ export default {
if (!this.form.floorId) { if (!this.form.floorId) {
this.$toast({ this.$toast({
title: "提示", title: "提示",
message: "请选择所属楼层!" message: "请选择所属楼层!",
}); });
return false; return false;
} }
...@@ -1384,8 +1416,8 @@ export default { ...@@ -1384,8 +1416,8 @@ export default {
name: "riskView", name: "riskView",
params: { params: {
floorId: this.form.floorId, floorId: this.form.floorId,
isView: false isView: false,
} },
}); });
}, },
...@@ -1405,7 +1437,7 @@ export default { ...@@ -1405,7 +1437,7 @@ export default {
this.projectDirector = e[0].loginName; this.projectDirector = e[0].loginName;
this.projectDirectorName = e[0].userName; this.projectDirectorName = e[0].userName;
this.show = false; this.show = false;
} },
}, },
watch: { watch: {
"form.pointType"(val, old) { "form.pointType"(val, old) {
...@@ -1414,8 +1446,8 @@ export default { ...@@ -1414,8 +1446,8 @@ export default {
} else { } else {
this.form.specialEquipment = ""; this.form.specialEquipment = "";
} }
} },
} },
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<van-sticky offset-top="0"> <van-sticky offset-top="0">
<LHeader :text="text"></LHeader> <LHeader :text="text"></LHeader>
</van-sticky> </van-sticky>
<div style="margin-bottom: 1.5rem;"> <div style="margin-bottom: 1.5rem">
<van-tabs v-model="active" @change="tabList" color="#2980f7" animated> <van-tabs v-model="active" @change="tabList" color="#2980f7" animated>
<van-tab :title="buildingName"> <van-tab :title="buildingName">
<van-dropdown-menu z-index="1000"> <van-dropdown-menu z-index="1000">
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
:key="index" :key="index"
@click="touchstart(index, item)" @click="touchstart(index, item)"
> >
<div style="font-size: 0.45rem;padding: 5px 0;"> <div style="font-size: 0.45rem; padding: 5px 0">
{{ item.name }} {{ item.name }}
</div> </div>
<van-row gutter=""> <van-row gutter="">
...@@ -75,12 +75,12 @@ ...@@ -75,12 +75,12 @@
</van-cell-group> </van-cell-group>
<div <div
style=" style="
width: 100%; width: 100%;
text-align: center; text-align: center;
font-size: 0.48rem; font-size: 0.48rem;
position: fixed; position: fixed;
top: 30%; top: 30%;
" "
v-if="messageList['length'] == 0" v-if="messageList['length'] == 0"
> >
暂无数据 暂无数据
...@@ -90,7 +90,8 @@ ...@@ -90,7 +90,8 @@
</van-tabs> </van-tabs>
</div> </div>
<div <div
style="display: flex; style="
display: flex;
justify-content: space-around; justify-content: space-around;
background-color: #fff; background-color: #fff;
border-top: 1px solid #e3e3e3; border-top: 1px solid #e3e3e3;
...@@ -98,27 +99,28 @@ ...@@ -98,27 +99,28 @@
width: 100%; width: 100%;
text-align: center; text-align: center;
position: fixed; position: fixed;
bottom: 0;" bottom: 0;
"
> >
<div <div
@click="copyFloor" @click="copyFloor"
style="color: #4bced0;font-size: 14px;font-weight: 600;" style="color: #4bced0; font-size: 14px; font-weight: 600"
> >
<div style="font-size: 22px;"><van-icon name="coupon-o" /></div> <div style="font-size: 22px"><van-icon name="coupon-o" /></div>
<div>复制楼层</div> <div>复制楼层</div>
</div> </div>
<div <div
@click="performTasks" @click="performTasks"
style="color: #4bced0;font-size: 14px;font-weight: 600;" style="color: #4bced0; font-size: 14px; font-weight: 600"
> >
<div style="font-size: 22px;"><van-icon name="plus" /></div> <div style="font-size: 22px"><van-icon name="plus" /></div>
<div>新增固有风险</div> <div>新增固有风险</div>
</div> </div>
<div <div
@click="endTasks" @click="endTasks"
style="color: #D9001B;font-size: 14px;font-weight: 600;" style="color: #d9001b; font-size: 14px; font-weight: 600"
> >
<div style="font-size: 22px;"><van-icon name="cross" /></div> <div style="font-size: 22px"><van-icon name="cross" /></div>
<div>任务执行结束</div> <div>任务执行结束</div>
</div> </div>
</div> </div>
...@@ -133,7 +135,7 @@ import { timestampToTime, generateId } from "@/utils/format"; ...@@ -133,7 +135,7 @@ import { timestampToTime, generateId } from "@/utils/format";
export default { export default {
name: "risk-confirme", name: "risk-confirme",
components: { components: {
LHeader LHeader,
}, },
data() { data() {
return { return {
...@@ -156,7 +158,7 @@ export default { ...@@ -156,7 +158,7 @@ export default {
active: 1, active: 1,
form: {}, form: {},
tabs: [], tabs: [],
floorListData: [] floorListData: [],
}; };
}, },
created() { created() {
...@@ -172,11 +174,11 @@ export default { ...@@ -172,11 +174,11 @@ export default {
delInherent(item) { delInherent(item) {
Dialog.confirm({ Dialog.confirm({
title: "删除固有风险", title: "删除固有风险",
message: "是否确认删除?" message: "是否确认删除?",
}) })
.then(() => { .then(() => {
// on confirm // on confirm
getFun(`/risk/plan/inherent/delete/${item.id}`).then(res => { getFun(`/risk/plan/inherent/delete/${item.id}`).then((res) => {
this.$toast.success(res.msg); this.$toast.success(res.msg);
this.riskList( this.riskList(
this.planId, this.planId,
...@@ -199,10 +201,10 @@ export default { ...@@ -199,10 +201,10 @@ export default {
}, },
changeData(arr) { changeData(arr) {
var arrList = []; var arrList = [];
arr.forEach(item => { arr.forEach((item) => {
arrList.push({ arrList.push({
text: item.name, text: item.name,
value: item.id || item.name value: item.id || item.name,
}); });
}); });
return arrList; return arrList;
...@@ -219,30 +221,30 @@ export default { ...@@ -219,30 +221,30 @@ export default {
id: this.active, id: this.active,
planId: this.planId, planId: this.planId,
buildingId: this.buildingId, buildingId: this.buildingId,
buildingName: this.buildingName buildingName: this.buildingName,
} },
}); });
}, },
// 复制楼层 // 复制楼层
copyFloor(){ copyFloor() {
this.$router.push({ this.$router.push({
name:'copyFloor', name: "copyFloor",
query:{ query: {
planId:this.planId, planId: this.planId,
buildingId:this.buildingId buildingId: this.buildingId,
} },
}) });
}, },
//任务执行结束 //任务执行结束
endTasks() { endTasks() {
//toDo //toDo
Dialog.confirm({ Dialog.confirm({
title: "任务执行结束", title: "任务执行结束",
message: "是否任务执行结束" message: "是否任务执行结束",
}) })
.then(() => { .then(() => {
postFun(`/risk/plan/submit/${this.planId}/${this.buildingId}`).then( postFun(`/risk/plan/submit/${this.planId}/${this.buildingId}`).then(
res => { (res) => {
// Dialog.alert({ // Dialog.alert({
// title: '任务执行结束', // title: '任务执行结束',
// message: res.msg, // message: res.msg,
...@@ -250,7 +252,7 @@ export default { ...@@ -250,7 +252,7 @@ export default {
// resolve(res.data); // resolve(res.data);
this.$toast.success(res.msg); this.$toast.success(res.msg);
this.$router.push({ this.$router.push({
name: "riskAssess" name: "riskAssess",
}); });
// }); // });
} }
...@@ -264,16 +266,15 @@ export default { ...@@ -264,16 +266,15 @@ export default {
this.$router.push({ this.$router.push({
name: "riskAdd", name: "riskAdd",
params: { params: {
title: "新增" title: "新增",
} },
}); });
}, },
floorList(id) { floorList(id) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getFun(`/risk/plan/floor/list/${id}`) getFun(`/risk/plan/floor/list/${id}`)
.then(res => { .then((res) => {
console.log(res.data);
res.data = [{ name: "全部" }, ...res.data]; res.data = [{ name: "全部" }, ...res.data];
this.floorListData = res.data; this.floorListData = res.data;
this.changeBuild(res.data[0].name); this.changeBuild(res.data[0].name);
...@@ -289,7 +290,7 @@ export default { ...@@ -289,7 +290,7 @@ export default {
roomList(id) { roomList(id) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getFun(`/risk/plan/room/list/${id}`) getFun(`/risk/plan/room/list/${id}`)
.then(res => { .then((res) => {
if (!res.data) res.data = []; if (!res.data) res.data = [];
res.data = [{ id: "-1", name: "全部" }, ...res.data]; res.data = [{ id: "-1", name: "全部" }, ...res.data];
this.option2 = this.changeData(res.data); this.option2 = this.changeData(res.data);
...@@ -313,13 +314,13 @@ export default { ...@@ -313,13 +314,13 @@ export default {
if (floorId || roomId) { if (floorId || roomId) {
paramsJson = { paramsJson = {
floorId: floorId == -1 ? null : floorId, floorId: floorId == -1 ? null : floorId,
roomId: roomId == -1 ? null : roomId roomId: roomId == -1 ? null : roomId,
}; };
} else { } else {
paramsJson = {}; paramsJson = {};
} }
getFun(`/risk/plan/inherent/list/${planId}/${buildingId}`, paramsJson) getFun(`/risk/plan/inherent/list/${planId}/${buildingId}`, paramsJson)
.then(res => { .then((res) => {
this.messageList = res.data; this.messageList = res.data;
resolve(res.data); resolve(res.data);
}) })
...@@ -333,7 +334,7 @@ export default { ...@@ -333,7 +334,7 @@ export default {
message: "加载中...", message: "加载中...",
forbidClick: true, forbidClick: true,
loadingType: "spinner", loadingType: "spinner",
duration: 0 duration: 0,
}); });
let floor = this.floorList(this.buildingId); let floor = this.floorList(this.buildingId);
let risk = this.riskList( let risk = this.riskList(
...@@ -350,8 +351,9 @@ export default { ...@@ -350,8 +351,9 @@ export default {
}, },
changeBuild() { changeBuild() {
if (this.value0) { if (this.value0) {
let arr = this.floorListData.filter(item => item.name == this.value0)[0] let arr = this.floorListData.filter(
.children; (item) => item.name == this.value0
)[0].children;
console.log(arr); console.log(arr);
if (!arr) arr = []; if (!arr) arr = [];
arr = [{ id: "-1", name: "全部" }, ...arr]; arr = [{ id: "-1", name: "全部" }, ...arr];
...@@ -399,8 +401,8 @@ export default { ...@@ -399,8 +401,8 @@ export default {
inherentId: data.businessId || data.id, inherentId: data.businessId || data.id,
planId: this.planId, planId: this.planId,
buildingId: this.buildingId, buildingId: this.buildingId,
buildingName: this.buildingName buildingName: this.buildingName,
} },
}); });
this.showIndex = null; this.showIndex = null;
}, },
...@@ -409,12 +411,12 @@ export default { ...@@ -409,12 +411,12 @@ export default {
this.$router.push({ this.$router.push({
name: "risk-affirm", name: "risk-affirm",
params: { params: {
data: data data: data,
} },
}); });
this.showIndex = null; this.showIndex = null;
} },
} },
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
<!-- 导入固有风险模板详情 -->
<template>
<div>
<LHeader text="固有风险信息"></LHeader>
<van-form>
<div
style="
height: 1rem;
font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';
font-weight: 700;
line-height: 1rem;
"
>
<img
src="@/assets/accidentIcon/bookmark.svg"
alt=""
style="position: relative; top: 32%; transform: translateY(-50%)"
/>
固有风险信息
</div>
<van-field
required
readonly
clickable
name="name"
v-model="form.name"
label="危险源名称"
placeholder="请输入"
:rules="[{ required: true, message: '危险源名称不能为空' }]"
/>
<!-- 单选 -->
<van-field
readonly
required
clickable
name="pointType"
v-model="form.pointType"
label="风险点类型"
placeholder="请选择"
:rules="[{ required: true, message: '风险点类型不能为空' }]"
/>
<van-field
required
label="是否为特种设备"
v-show="form.pointType == '设备设施类'"
>
<template #input>
<span style="margin-right: 10px; color: red"></span>
<van-switch
disabled
v-model="form.specialEquipment"
size="20"
name="specialEquipment"
/>
<span style="margin-left: 10px; color: green"></span>
</template>
</van-field>
<!-- 多选 -->
<van-field
v-model="form.safetyWarningSigns"
readonly
required
name="safetyWarningSigns"
label="安全警示标志"
placeholder="请选择"
:rules="[{ required: true, message: '安全警示标志不能为空' }]"
/>
<van-field
v-model="form.factor"
readonly
required
name="factor"
label="风险因素"
placeholder="请选择"
:rules="[{ required: true, message: '风险因素不能为空' }]"
/>
<van-field
readonly
v-model="form.type"
required
name="type"
label="准事故类型"
placeholder="请选择"
:rules="[{ required: true, message: '准事故类型不能为空' }]"
/>
<div
style="
height: 1rem;
font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';
font-weight: 700;
line-height: 1rem;
"
>
<img
src="@/assets/accidentIcon/bookmark.svg"
alt=""
style="position: relative; top: 32%; transform: translateY(-50%)"
/>
应采取的管控措施
</div>
<van-field label="技术措施">
<template #input>
<van-field
readonly
v-model="form.measuresProject"
name="measuresProject"
label=""
type="textarea"
rows="3"
autosize
placeholder="请输入"
style="padding-left: 0; padding-top: 0"
/>
</template>
</van-field>
<van-field label="管理措施">
<template #input>
<van-field
readonly
v-model="form.measuresAdministration"
name="measuresAdministration"
label=""
type="textarea"
rows="3"
autosize
placeholder="请输入"
style="padding-left: 0; padding-top: 0"
/>
</template>
</van-field>
<van-field label="应急措施">
<template #input>
<van-field
readonly
v-model="form.measuresEmergency"
name="measuresEmergency"
label=""
type="textarea"
rows="3"
autosize
placeholder="请输入"
style="padding-left: 0; padding-top: 0"
/>
</template>
</van-field>
<div
style="
height: 1rem;
font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';
font-weight: 700;
line-height: 1rem;
"
>
<img
src="@/assets/accidentIcon/bookmark.svg"
alt=""
style="position: relative; top: 32%; transform: translateY(-50%)"
/>
重大危险源管理
</div>
<van-field name="majorHazardSource" label="是否为重大危险源">
<template #input>
<span style="margin-right: 10px; color: red"></span>
<van-switch disabled v-model="form.majorHazardSource" size="20" />
<span style="margin-left: 10px; color: green"></span>
</template>
</van-field>
<van-field
v-model="form.hazardSourceName"
:required="form.majorHazardSource"
name="hazardSourceName"
label="危险源名称 "
readonly
type="textarea"
rows="1"
autosize
placeholder="请输入"
:key="form.majorHazardSource + '123'"
:rules="
form.majorHazardSource
? [{ required: true, message: '危险源名称不能为空' }]
: []
"
/>
<van-field label="重大危险源描述" :required="form.majorHazardSource">
<template #input>
<van-field
readonly
v-model="form.majorHazardSourceDescription"
name="majorHazardSourceDescription"
type="textarea"
rows="3"
autosize
placeholder="请输入"
:key="form.majorHazardSource + '456'"
:rules="
form.majorHazardSource
? [{ required: true, message: '重大危险源描述不能为空' }]
: []
"
style="padding-left: 0; padding-top: 0"
/>
</template>
</van-field>
<van-field
:required="form.majorHazardSource"
readonly
clickable
name="referenceBasis"
:value="form.referenceBasis == 'null' ? '' : form.referenceBasis"
label="判断依据"
placeholder="请选择"
:key="form.majorHazardSource + '789'"
:rules="
form.majorHazardSource
? [{ required: true, message: '判断依据不能为空' }]
: []
"
/>
<div class="import-btn">
<van-button round block type="info" @click="toImport">导入</van-button>
</div>
</van-form>
</div>
</template>
<script>
import LHeader from "@/components/header.vue";
import { getFun, postFun } from "@/service/table.js";
export default {
components: { LHeader },
data() {
return {
form: {},
};
},
mounted() {
this.form = this.$store.state.inherentTemplate;
},
methods: {
// 请求详情数据
postReturnEcho() {
getFun(`/risk/plan/inherent/details/135`)
.then((res) => {
this.form = res.data;
})
.catch(() => {
this.$toast.clear();
});
},
toImport() {
this.$router.go(-2);
},
},
};
</script>
<style lang="less" scoped>
.import-btn {
padding: 20px;
}
</style>
<!-- 导入固有风险模板列表 -->
<template>
<div class="inherent-template">
<LHeader text="固有风险模板"></LHeader>
<van-pull-refresh v-model="list.refreshing" @refresh="onRefresh">
<van-list
v-model="list.loading"
:finished="list.finished"
finished-text="没有更多了"
@load="getList"
class="con-list"
>
<van-cell-group
inset
v-for="(item, index) in messageList"
:key="index"
@click="touchstart(index, item)"
>
<div style="font-size: 0.45rem; padding: 5px 0">
{{ item.name }}
</div>
<van-row gutter="">
<van-col span="17">
<van-row gutter="">
<van-col span="10">风险点类型:</van-col>
<van-col span="14">{{ item.pointType }}</van-col>
</van-row>
<van-row gutter="">
<van-col span="9">风险因素:</van-col>
<van-col span="15">{{ item.factor }}</van-col>
</van-row>
</van-col>
</van-row>
<van-overlay :show="showIndex == index">
<div class="wrapper" @click.stop="showIndex = null">
<van-button round type="info" @click="toImport(item)"
>导入</van-button
>
<van-button round type="primary" @click="toDetail(item)"
>详情</van-button
>
</div>
</van-overlay>
</van-cell-group>
<div
style="
width: 100%;
text-align: center;
font-size: 0.48rem;
position: fixed;
top: 30%;
"
v-if="messageList['length'] == 0"
>
暂无数据
</div>
</van-list>
</van-pull-refresh>
</div>
</template>
<script>
import { getFun, postFun } from "@/service/table.js";
import LHeader from "@/components/header.vue";
import { timestampToTime, generateId } from "@/utils/format";
export default {
components: { LHeader },
data() {
return {
messageList: [],
showIndex: null,
item: null,
list: {
refreshing: false,
loading: false,
finished: false,
},
page: {
pageNum: 0,
total: 0,
},
};
},
mounted() {},
methods: {
toDetail(item) {
this.$store.commit("SET_INHERENT_TEMPLATE", item);
this.$router.push({
path: "/inherent/template/detail",
query: {
id: item.id,
},
});
},
toImport(item) {
this.$store.commit("SET_INHERENT_TEMPLATE", item);
this.$router.go(-1);
},
touchstart(index, item) {
this.showIndex = index;
this.item = item;
},
getList(isFresh = false) {
if (isFresh) {
this.page.pageNum = 0;
this.page.total = 0;
this.messageList = [];
}
this.page.pageNum++;
getFun(`/risk/plan/inherent/template/list`, {
pageNum: this.page.pageNum,
pageSize: 10,
})
.then((res) => {
setTimeout(() => {
this.list.loading = false;
this.list.refreshing = false;
this.messageList = this.messageList.concat(res.rows);
if (this.page.total == 0) {
this.page.total = res.total;
}
if (this.page.total && this.messageList >= this.page.total) {
this.list.finished = true;
return;
}
}, 300);
})
.catch(() => {
this.$toast.fail("加载失败,请稍后再试");
});
},
onRefresh() {
this.getList(true);
},
timestampToTimes(time) {
return timestampToTime(new Date(time), "DT2", true);
},
},
};
</script>
<style lang="less" scoped>
.inherent-template {
.con-list {
padding: 0;
min-height: 10rem;
background-color: #f0f1f5;
.van-cell-group--inset {
margin: 0;
margin-bottom: 0.26667rem;
padding: 0.25rem;
font-size: 0.4rem;
position: relative;
border-radius: 4%;
box-shadow: 0px 0px 10px 2px #f3f3f3;
width: 90%;
margin: 0.4rem auto;
.van-row {
font-size: 0.4rem;
line-height: 0.8rem;
margin-bottom: 0;
}
.van-overlay {
position: absolute;
.wrapper {
display: flex;
align-items: center;
justify-content: space-evenly;
height: 100%;
}
}
}
}
}
</style>
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