Commit 4e734d77 authored by 13841799530's avatar 13841799530

解润东

预警模块移植
20220317
parent 3e08cff0
Pipeline #8073 passed with stage
in 5 minutes and 19 seconds
......@@ -287,6 +287,56 @@ const routes = [{
},
component: () => import( /* webpackChunkName: "create-order" */ '../views/checkedConfirm/confirmNote/detail'),
},
//预警记录
{
path: '/warningNote',
name: 'warningNote',
meta: {
title: '预警记录',
index: 9
},
component: () => import(/* webpackChunkName: "create-order" */ '../views/warningNote'),
},
//预警记录
{
path: '/warning',
name: 'warning',
meta: {
title: '预警提醒',
index: 10
},
component: () => import(/* webpackChunkName: "create-order" */'../views/warning'),
},
// 预警处置
{
path: '/warningForm',
name: 'warningForm',
component: () => import('../views/warningForm'),
},
{
path: '/warningNoteDetail',
name: 'warningNoteDetail',
meta: {
title: '预警详情',
},
component: () => import('../views/warningNote/warningNoteDetail'),
},
{
path: '/warningNoteEdit',
name: 'warningNoteEdit',
meta: {
title: '预警编辑详情',
},
component: () => import('../views/warningNote/warningNoteEdit'),
},
{
path: '/warningNoteList',
name: 'warningNoteList',
meta: {
title: '预警记录列表',
},
component: () => import('../views/warningNote/warningNoteList'),
},
// 登录页
{
path: '/login2',
......
......@@ -3,7 +3,7 @@ import request from '@/utils/axios'
/*get请求*/
export function getFun(url,params) {
return request({
url: url,
url: '/hse/app-api/'+url,
method: 'get',
params
})
......@@ -11,7 +11,23 @@ export function getFun(url,params) {
/* post请求 */
export function postFun(url,data) {
return request({
url: url,
url: '/hse/app-api/'+url,
method: 'post',
data
})
}
/*get请求*/
export function getFunTwo(url,params) {
return request({
url: '/ps_ceninss/'+url,
method: 'get',
params
})
}
/* post请求 */
export function postFunTwo(url,data) {
return request({
url: '/ps_ceninss/'+url,
method: 'post',
data
})
......
......@@ -11,7 +11,7 @@ export function getFun(url,params) {
/* post请求 */
export function postWork(url,data) {
return request({
url: url,
url: '/hse/app-api/'+url,
method: 'post',
data
})
......
......@@ -11,7 +11,8 @@ import router from '../router'
import { Toast ,Dialog} from 'vant';
import { getToken ,removeToken} from '@/utils/auth' // get token from cookie
const service = axios.create({
baseURL: '/hse/app-api', //前缀路径
// baseURL: '/hse/app-api', //前缀路径
baseURL: '/', //前缀路径
headers: {//请求头部
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"content-type": "application/json",
......@@ -32,7 +33,7 @@ service.interceptors.response.use(response => {
const res = response.data//获取请求返回数据
const code = response.status//获取请求响应码
if (code == 200) {//请求响应码200 代表已经请求到接口
if (res.code === 0) {//接口响应码0 代表接口代码运行正常
if (res.code === 0||res.code === 200) {//接口响应码0 代表接口代码运行正常
return res
} else if (res.code === 301) {
// Notify({ type: 'danger', message: res.msg});
......
......@@ -79,7 +79,11 @@ export default {
var userInfo={
avatar:Response2.data.avatar,
userName:Response2.data.userName,
deptName:Response2.data.dept.deptName
deptName:Response2.data.dept.deptName,
organizationId:Response2.data.organizationId,
organizationName:Response2.data.organizationName,
userId:Response2.data.userId,
roles:Response2.data.roles
}
/* 存储用户信息 */
setUserInfo(userInfo)
......
......@@ -246,6 +246,18 @@ export default {
imgUrl: require("@/assets/workbench/ehcek-record.png"),
text: "整改确认",
},
{
key: "9",
path: "/warning",
imgUrl: require("@/assets/workbench/warn-tip.png"),
text: "预警提醒",
},
{
key: "10",
path: "/warningNote",
imgUrl: require("@/assets/workbench/warn-record.png"),
text: "预警记录",
},
],
// 后台给的数据权限对象
......
<template>
<div>
<LHeader v-bind:text="text"></LHeader>
<van-search
v-model="value"
placeholder="搜索"
@search="onSearch"
>
</van-search>
<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
<van-list
v-model="loading"
:finished="finished"
finished-text="没有更多了"
@load="onLoad"
>
<div class="card" v-for="(item,index) in list" :key="index" v-show="item.status=='wait'" @click="warningClick(item)">
<div class="card-header">
<van-row>
<van-col span="10">
<span class="card-header-left">{{item.orderType+'预警'}}</span>
</van-col>
<van-col span="6" class="card-header-medium">
<van-tag size="medium" type="danger" v-if="item.gradeType=='一级预警'">一级预警</van-tag>
<van-tag size="medium" type="warning" v-else-if="item.gradeType=='二级预警'">二级预警</van-tag>
<van-tag size="medium" color="#FAED55" v-else-if="item.gradeType=='三级预警'">三级预警</van-tag>
</van-col>
<van-col span="8" class="card-header-right">
<van-tag size="medium" type="success" plain v-if="item.status=='error'">已处置</van-tag>
<van-tag size="medium" type="success" plain v-if="item.status=='finish'">已处置</van-tag>
<van-tag size="medium" type="danger" plain v-else-if="item.status=='wait'">未处置</van-tag>
</van-col>
</van-row>
</div>
<div class="card-body">
{{util.timestampToTime(item.alarmTime,'DT1',true)}}&nbsp;&nbsp;
{{ item.gradeName}}&nbsp;&nbsp;
{{item.orderNo}}&nbsp;&nbsp;
{{item.gradeType+'请及时处理'}}
</div>
</div>
</van-list>
</van-pull-refresh>
<tab-bar :index="1"></tab-bar>
</div>
</template>
<script>
import LHeader from "@/components/header";
import tabBar from "@/components/TabBar";
import { getFun,postFun ,postFunTwo,getFunTwo} from '@/service/table'
import { setUserInfo ,getUserInfo} from '@/utils/userInfo'
export default {
name: 'warning',
components: {
tabBar,
LHeader
},
data() {
return {
text:'预警提醒',//顶部文本
total:0,//总条数
page:1,//页码
psize:5,//页数量
loading: false,
finished: false,
refreshing:false,
value:'',//搜索内容
userId:'',//登录用户ID
list:[
// {
// warningName:'有限空间作业预警',
// warningLevel:1,
// ishandle:false,
// content:'2021年8月23日 12:34:32&nbsp; 有限空间作业 0294758585发生 安全帽佩戴 一级预警 请及时处理。'
// },
// {
// warningName:'动力作业预警',
// warningLevel:2,
// ishandle:false,
// content:'2021年8月23日 12:34:32&nbsp; 动火作业 0294758585发生 防护面罩佩戴 二级预警 请及时处理。'
// },
// {
// warningName:'有限空间作业预警',
// warningLevel:3,
// ishandle:false,
// content:'2021年8月23日 12:34:32&nbsp; 有限空间作业 0294758585发生 安全帽佩戴 一级预警 请及时处理。'
// }
]
}
},
mounted() {
if(getUserInfo())
this.userId=getUserInfo().userId
console.log(getUserInfo())
// this.init()
},
methods: {
//预警列表
init(){
// this.list=[];
var obj={
page:this.page,
psize:this.psize,
desc:this.value
}
getFunTwo('app/push/list/'+this.userId,obj).then((Response2)=>{
if(Response2.code==200){
Response2.data.list.forEach((item)=>{
this.list.push(item)
})
this.page=Response2.data.pageNum
this.total=Response2.data.totalCount
//防止分页超出操作
if(!(this.page*5-this.total>=0)){
this.page++;
}
if (this.list.length>=this.total) {
this.finished = true;
}
this.loading = false
}
})
},
//搜索查询
onSearch(){
this.init()
},
//点击卡片跳转
warningClick(item){
sessionStorage.setItem('warningId',item.id)
this.$router.push('/warningForm')
},
//下拉页面刷新
onRefresh() {
// 清空列表数据
this.page=1
this.finished = false;
this.loading=true
this.onLoad();
},
//上拉页面加载数据
onLoad() {
if (this.refreshing) {
this.list=[]
this.refreshing = false;
}
setTimeout(() => {
this.init()
}, 1000);
},
}
}
</script>
<style lang="less" scoped>
/* 搜索框 */
.van-search{
margin:0.26667rem auto 0;
width: 95%;
border-radius: 4%;
border-radius: 5px;
padding: 5px 12px;
}
.van-search__content {
background-color: #ffffff;
}
/* 卡片系列 */
.card{
width:90%;
box-shadow: 0px 0px 10px 2px #F3F3F3;
padding: 0.25rem;
margin:0.26667rem auto;
background: white;
border-radius: 4%;
}
.card div{
font-size: 0.4rem;
line-height: 0.7rem;
}
.card-header-left{
font-weight: bolder;
font-size: 0.45rem;
}
.card-header-right{
text-align: right;
}
.card-header-medium{
text-align: left;
}
</style>
\ No newline at end of file
This diff is collapsed.
<template>
<div>
<LHeader v-bind:text="text"></LHeader>
<van-search
v-model="value"
placeholder="搜索"
@search="onSearch"
>
</van-search>
<van-tabs v-model="active" type="card" title-inactive-color="#2980F7" color="#2980F7" @change="tabChange">
<van-tab v-for="(item1,index1) in tabList" :key="index1" :title="item1.title">
<van-pull-refresh v-model="item1.refreshing" @refresh="onRefresh">
<van-list
v-model="item1.loading"
:finished="item1.finished"
finished-text="没有更多了"
@load="onLoad()"
>
<div class="card" v-for="(item,index) in item1.list" :key="index" @click="warningClick(item)">
<div class="card-header">
<van-row>
<van-col span="10">
<span class="card-header-left">{{item.orderType+'预警'}}</span>
</van-col>
<van-col span="6" class="card-header-medium">
<van-tag size="medium" type="danger" v-if="item.gradeId==1">一级预警</van-tag>
<van-tag size="medium" type="warning" v-else-if="item.gradeId==2">二级预警</van-tag>
<van-tag size="medium" type="success" v-else-if="item.gradeId==3">三级预警</van-tag>
</van-col>
<van-col span="8" class="card-header-right">
<van-tag size="medium" type="success" plain v-if="item.status=='error'">已处置</van-tag>
<van-tag size="medium" type="success" plain v-if="item.status=='finish'">已处置</van-tag>
<van-tag size="medium" type="danger" plain v-else-if="item.status=='wait'">未处置</van-tag>
</van-col>
</van-row>
</div>
<div class="card-body">
{{util.timestampToTime(item.alarmTime,'DT1',true)}}&nbsp;&nbsp;
{{ item.gradeName}}&nbsp;&nbsp;
{{item.orderNo}}&nbsp;&nbsp;
{{item.gradeType+'请及时处理'}}
</div>
</div>
</van-list>
</van-pull-refresh>
</van-tab>
</van-tabs>
<tab-bar :index="1"></tab-bar>
</div>
</template>
<script>
import tabBar from "@/components/TabBar";
import LHeader from "@/components/header";
import { getFun,postFun,postFunTwo,getFunTwo } from '@/service/table'
import { setUserInfo ,getUserInfo} from '@/utils/userInfo'
export default {
name: 'warning',
components: {
tabBar,
LHeader
},
data() {
return {
total:0,//总条数
page:1,//页码
psize:5,//页数量
loading: false,
finished: false,
refreshing:false,
type:'',//处置类型
userId:'',//用户登录ID
tabList:[
{
title:'全部',
type:"",
loading: false,
finished: false,
refreshing:false,
list:[]
// ishandle:'all',
},
{
title:'已处置',
type:"finish",
loading: false,
finished: false,
refreshing:false,
list:[]
// ishandle:true,
},
{
title:'未处置',
type:"wait",
loading: false,
finished: false,
refreshing:false,
list:[]
// ishandle:false,
}
],//切换标题数组
active:0,//默认切换状态
value:'',//搜索框值
text:'预警记录',//顶部文本
}
},
mounted() {
if(getUserInfo())
this.userId=getUserInfo().userId
// this.init()
},
methods: {
init(){
var obj={
page:this.page,
psize:this.psize,
type:this.type,
desc:this.value
}
getFunTwo('app/push/list/'+this.userId,obj).then((Response2)=>{
if(Response2.code==200){
Response2.data.list.forEach((item)=>{
this.tabList.forEach((i)=>{
if(i.type==this.type){
i.list.push(item)
}
})
})
this.page=Response2.data.pageNum
this.total=Response2.data.totalCount
//防止分页超出操作
if(!(this.page*5-this.total>=0)){
this.page++;
}
//遍历哪个类型的分页加载函数
this.tabList.forEach((i)=>{
if(i.type==this.type){
if (i.list.length>=this.total) {
i.finished = true;
console.log(this.tabList)
}
i.loading = false;
}
})
}
})
},
//切换改变请求查询
tabChange(title,name){
this.page=1
this.tabList.forEach((i)=>{
i.list=[]
})
this.type=""
if(name=='全部'){
this.type=""
}else if(name=='已处置'){
this.type="finish"
}else if(name=='未处置'){
this.type="wait"
}
this.tabList.forEach((i)=>{
if(i.type==this.type){
i.loading=true
i.finished=false
}
})
this.onLoad();
},
//搜索查询
onSearch(){
this.tabList.forEach((i)=>{
i.list=[]
})
this.page=1
this.init()
},
//点击卡片跳转
warningClick(item){
sessionStorage.setItem('warningNoteId',item.id)
if(item.status=='wait'){
this.$router.push('/warningNoteEdit')
}else if(item.status=='error'||item.status=='finish'){
this.$router.push('/warningNoteDetail')
}
},
//下拉页面刷新
onRefresh() {
// 清空列表数据
this.page=1
this.tabList.forEach((i)=>{
if(i.type==this.type){
i.loading=true
i.finished=false
}
})
this.onLoad();
},
//上拉页面加载数据
onLoad() {
this.tabList.forEach((i)=>{
if(i.type==this.type){
if (i.refreshing) {
i.list=[]
i.refreshing = false;
}
}
})
this.init()
},
}
}
</script>
<style lang="less" scoped>
/* 搜索框 */
.van-search{
margin:0.26667rem auto 0;
width: 95%;
border-radius: 4%;
border-radius: 5px;
padding: 5px 12px;
}
.van-search__content {
background-color: #ffffff;
}
/* tab栏 */
.van-tabs{
margin-top: 0.4rem;
}
/deep/ .van-tab--active{
border-radius: 5px !important;
}
/deep/ .van-tabs__nav--card{
border: none !important;
border-radius: 5px !important
}
/* 卡片系列 */
.card{
width:90%;
box-shadow: 0px 0px 10px 2px #F3F3F3;
padding: 0.25rem;
margin:0.4rem auto;
background: white;
border-radius: 4%;
}
.card div{
font-size: 0.4rem;
line-height: 0.7rem;
}
.card-header-left{
font-weight: bolder;
font-size: 0.45rem;
}
.card-header-right{
text-align: right;
}
.card-header-medium{
text-align: left;
}
</style>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
<template>
<div>
<LHeader v-bind:text="text"></LHeader>
<van-search
v-model="value"
placeholder="搜索"
@search="onSearch"
>
</van-search>
<van-tabs v-model="active" type="card" title-inactive-color="#2980F7" color="#2980F7" @change="tabChange">
<van-tab v-for="(item1,index1) in tabList" :key="index1" :title="item1.title">
<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
<van-list
v-model="item1.loading"
:finished="item1.finished"
finished-text="没有更多了"
@load="onLoad()"
>
<div class="card" v-for="(item,index) in item1.list" :key="index" @click="warningClick(item)">
<div class="card-header">
<van-row>
<van-col span="10">
<span class="card-header-left">{{item.orderType+'预警'}}</span>
</van-col>
<van-col span="6" class="card-header-medium">
<van-tag size="medium" type="danger" v-if="item.gradeId==1">一级预警</van-tag>
<van-tag size="medium" type="warning" v-else-if="item.gradeId==2">二级预警</van-tag>
<van-tag size="medium" type="success" v-else-if="item.gradeId==3">三级预警</van-tag>
</van-col>
<van-col span="8" class="card-header-right">
<van-tag size="medium" type="success" plain v-if="item.status=='error'">已处置</van-tag>
<van-tag size="medium" type="success" plain v-if="item.status=='finish'">已处置</van-tag>
<van-tag size="medium" type="danger" plain v-else-if="item.status=='wait'">未处置</van-tag>
</van-col>
</van-row>
</div>
<div class="card-body">
{{util.timestampToTime(item.alarmTime,'DT1',true)}}&nbsp;&nbsp;
{{ item.gradeName}}&nbsp;&nbsp;
{{item.orderNo}}&nbsp;&nbsp;
{{item.gradeType+'请及时处理'}}
</div>
</div>
</van-list>
</van-pull-refresh>
</van-tab>
</van-tabs>
<!-- <tab-bar :index="1"></tab-bar> -->
</div>
</template>
<script>
// import tabBar from "@/components/TabBar";
import LHeader from "@/components/header";
import { getFun,postFun,postFunTwo,getFunTwo } from '@/service/table'
import { setUserInfo ,getUserInfo} from '@/utils/userInfo'
export default {
name: 'warning',
components: {
// tabBar,
LHeader
},
data() {
return {
orderId:'',//工单ID
total:0,//总条数
page:1,//页码
psize:5,//页数量
loading: false,
finished: false,
refreshing:false,
type:'',//处置类型
userId:'',//用户登录ID
tabList:[
{
title:'全部',
type:"",
loading: false,
finished: false,
refreshing:false,
list:[]
// ishandle:'all',
},
{
title:'已处置',
type:"finish",
loading: false,
finished: false,
refreshing:false,
list:[]
// ishandle:true,
},
{
title:'未处置',
type:"wait",
loading: false,
finished: false,
refreshing:false,
list:[]
// ishandle:false,
}
],//切换标题数组
active:0,//默认切换状态
value:'',//搜索框值
text:'工单预警记录',//顶部文本
}
},
mounted() {
if(getUserInfo())
this.userId=getUserInfo().userId
// this.init()
if(sessionStorage.getItem('orderId')){
this.orderId=sessionStorage.getItem('orderId')
}
},
methods: {
init(){
var obj={
page:this.page,
psize:this.psize,
type:this.type,
desc:this.value
}
getFunTwo('app/push/list/no/'+this.orderId,obj).then((Response2)=>{
if(Response2.code==200){
Response2.data.list.forEach((item)=>{
this.tabList.forEach((i)=>{
if(i.type==this.type){
i.list.push(item)
}
})
})
this.page=Response2.data.pageNum
this.total=Response2.data.totalCount
//防止分页超出操作
if(!(this.page*5-this.total>=0)){
this.page++;
}
//遍历哪个类型的分页加载函数
this.tabList.forEach((i)=>{
if(i.type==this.type){
if (i.list.length>=this.total) {
i.finished = true;
console.log(this.tabList)
}
i.loading = false;
}
})
}
})
},
//切换改变请求查询
tabChange(title,name){
this.page=1
this.tabList.forEach((i)=>{
i.list=[]
})
this.type=""
if(name=='全部'){
this.type=""
}else if(name=='已处置'){
this.type="finish"
}else if(name=='未处置'){
this.type="wait"
}
this.tabList.forEach((i)=>{
if(i.type==this.type){
i.loading=true
i.finished=false
}
})
this.onLoad();
},
//搜索查询
onSearch(){
this.tabList.forEach((i)=>{
i.list=[]
})
this.page=1
this.init()
},
//点击卡片跳转
warningClick(item){
sessionStorage.setItem('warningNoteId',item.id)
if(item.status=='wait'){
this.$router.push({path:'/warningNoteEdit',query:{name:'noteList'}})
}else if(item.status=='error'||item.status=='finish'){
this.$router.push({path:'/warningNoteDetail',query:{name:'noteList'}})
}
},
//下拉页面刷新
onRefresh() {
// 清空列表数据
this.page=1
this.tabList.forEach((i)=>{
if(i.type==this.type){
i.loading=true
i.finished=false
}
})
this.onLoad();
},
//上拉页面加载数据
onLoad(value) {
this.tabList.forEach((i)=>{
if(i.type==this.type){
if (i.refreshing) {
i.list=[]
i.refreshing = false;
}
}
})
this.init()
},
}
}
</script>
<style lang="less" scoped>
/* 搜索框 */
.van-search{
margin:0.26667rem auto 0;
width: 95%;
border-radius: 4%;
border-radius: 5px;
padding: 5px 12px;
}
.van-search__content {
background-color: #ffffff;
}
/* tab栏 */
.van-tabs{
margin-top: 0.4rem;
}
/deep/ .van-tab--active{
border-radius: 5px !important;
}
/deep/ .van-tabs__nav--card{
border: none !important;
border-radius: 5px !important
}
/* 卡片系列 */
.card{
width:90%;
box-shadow: 0px 0px 10px 2px #F3F3F3;
padding: 0.25rem;
margin:0.4rem auto;
background: white;
border-radius: 4%;
}
.card div{
font-size: 0.4rem;
line-height: 0.7rem;
}
.card-header-left{
font-weight: bolder;
font-size: 0.45rem;
}
.card-header-right{
text-align: right;
}
.card-header-medium{
text-align: left;
}
</style>
\ No newline at end of file
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