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
This diff is collapsed.
...@@ -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>
This diff is collapsed.
This diff is collapsed.
...@@ -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