添加预警展示

duizhaopin_ui
13507605001 2 years ago
parent 8c2ca4d850
commit fbe8ca6b6c

@ -43,3 +43,12 @@ export function update_warning_tp(data) {
data
})
}
// /api/home/home_warning_num
export function home_warning_num(data) {
return request({
url: '/api/home/home_warning_num',
method: 'post',
data
})
}

@ -0,0 +1,171 @@
<template>
<div>
<div class="header-custom">
<el-date-picker
v-model="start_time"
clearable
type="datetime"
placeholder="选择生产日期"
value-format="yyyy-MM-dd HH:mm:ss"
/>
<el-date-picker
v-model="end_time"
clearable
type="datetime"
placeholder="选择过期日期"
value-format="yyyy-MM-dd HH:mm:ss"
/>
<el-select v-model="object_type" clearable placeholder="请选择预警信息类型">
<el-option
v-for="(item,index) in warning_data_map"
:key="index"
:label="item"
:value="index + 1"
/>
</el-select>
<el-input v-model="seach_word" clearable placeholder="请输入搜索预警信息" />
<el-button :disabled="loadingReagent" type="primary" icon="el-icon-search" @click="searchData"></el-button>
</div>
<el-table
v-loading="loadingReagent"
:data="gridData"
stripe
height="400"
element-loading-text="拼命加载中"
:header-cell-style="headerStyle"
>
<el-table-column
align="center"
type="index"
width="50"
label="序号"
/>
<el-table-column
align="center"
prop="warning_date"
label="预警时间"
/>
<el-table-column
align="center"
prop="object_type"
label="预警信息类型"
>
<template slot-scope="scope">
{{ warning_data_map[scope.row.object_type - 1] }}
</template>
</el-table-column>
<el-table-column
align="center"
prop="object_name"
label="对象"
/>
<el-table-column
align="center"
show-overflow-tooltip
prop="warning_content"
label="内容"
/>
</el-table>
<div class="my-pagination" style="text-align: center">
<el-pagination
background
layout="prev, pager, next"
:disabled="loadingReagent"
:current-page.sync="page"
:total="total"
:page-size.sync="page_size"
@current-change="pageChange"
/>
</div>
<el-dialog
width="50%"
title="预警详情"
:visible.sync="innerVisible"
append-to-body
>
<el-descriptions :column="2" border>
<el-descriptions-item label="预警对象" span="2">{{ rowData.object_name }}</el-descriptions-item>
<el-descriptions-item label="预警内容" span="2">{{ rowData.warning_content }}</el-descriptions-item>
<el-descriptions-item label="预警类型">{{ warning_data_map[rowData.object_type - 1] }}</el-descriptions-item>
<el-descriptions-item label="预警来源">{{ rowData.object_name }}</el-descriptions-item>
<el-descriptions-item label="最后使用人">
<el-tag>{{ rowData.warning_user_name }}</el-tag>
</el-descriptions-item>
</el-descriptions>
<div style="text-align: center;margin-top: 20px">
<el-button type="primary" @click="innerVisible=false"></el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { home_warning_list } from '@/api/reagent/overView'
import stringify from '@/utils/stringify'
export default {
name:'WaringListView',
data() {
return {
headerStyle: { 'background': '#E6E6E6' },
rowData: {},
gridData: [],
seach_word: '',
page: 1,
total: 0,
page_size: 15,
start_time: '',
end_time: '',
object_type: '',
innerVisible: false,
loadingReagent: false,
dialogTableVisible: false,
warning_data_map: ['试剂临期', '试剂过期', '余量不足', '环境异常', '出库临期', '出库超期', '未称重'],
}
},
created () {
this.getWarnList()
},
methods: {
getWarnList() {
const data = {
'seach_word': this.seach_word,
'object_type': this.object_type,
'start_time': this.start_time,
'end_time': this.end_time,
'page': this.page,
'page_size': this.page_size
}
this.loadingReagent = true
home_warning_list(stringify(data)).then(res => {
this.gridData = res.data.data_list
this.total = res.data.total_count
}).finally(() => (this.loadingReagent = false))
},
pageChange(page) {
this.page = page
this.getWarnList()
},
searchData() {
this.getWarnList()
},
}
}
</script>
<style lang="scss">
.header-custom {
margin-bottom: 1rem;
.el-input {
width: 12.5rem;
margin-right: 1rem;
}
.el-select {
margin-right: 1rem;
}
}
</style>

@ -4,9 +4,12 @@
<div class="header-top-item"><img src="@/assets/login/logo-white.png" alt=""> </div>
<div v-if="!$store.getters.isMain"><img class="log-img" src="@/assets/rms/mainoverview_white.png" alt=""></div>
<div class="header-top-item">
<el-badge :value="39">
<img style="height: 23px" src="@/assets/0-常用/预警管理-白.png" alt="">
<el-badge :value="this.$store.getters.warning_number">
<img style="height: 23px" src="@/assets/0-常用/预警管理-白.png" alt="" @click="dialogTableVisible=true">
</el-badge>
<el-dialog :close-on-click-modal="false" title="预警信息" width="70%" :visible.sync="dialogTableVisible">
<WaringListView />
</el-dialog>
<el-select v-model="$store.state.user.classification" placeholder="请选择" @change="selectChange">
<el-option
v-for="item in local_ops"
@ -32,9 +35,9 @@
// import { mapGetters } from 'vuex'
// import Breadcrumb from '@/components/Breadcrumb'
// import Hamburger from '@/components/Hamburger'
export default {
components: {
WaringListView: () => import('@/components/WaringForm/index')
// Breadcrumb
// Hamburger
},
@ -51,14 +54,14 @@ export default {
'background-size': '100%'
},
local_ops: [],
dialogTableVisible: false,
}
},
created() {
this.local_ops_func()
},
methods: {
local_ops_func : function() {
local_ops_func: function() {
this.local_ops = this.$store.getters.opts.filter(item => item.name !='user')
},
toggleSideBar() {

@ -11,6 +11,7 @@ const getters = {
isMain: state => state.settings.isMain,
roleData: state => state.permission.roleData,
opts: state => state.permission.opts,
warning_number: state => state.app.warning_number,
clientOptions: state => state.app.clientOptions,
currentOptions: state => state.app.clientOptions[state.user.classification]
}

@ -8,7 +8,8 @@ const state = {
},
device: 'desktop',
title: '',
clientOptions: {}
clientOptions: {},
warning_number: 0
}
const mutations = {
@ -35,6 +36,9 @@ const mutations = {
},
SET_TITLE: (state, opt) => {
state.title = opt
},
SET_WARNING_NUM: (state, num) => {
state.warning_number = num
}
}

@ -105,6 +105,7 @@
// import { validUsername } from '@/utils/validate'
import stringify from '@/utils/stringify'
import { faceStart, faceStop, login, get_user_manage_auth } from '@/api/user/user'
import { home_warning_num } from '@/api/reagent/overView'
import { client_list } from '@/api/common'
// import { throttle } from '@/utils'
import { func_map } from '@/utils'
@ -161,6 +162,13 @@ export default {
this.handleClose()
},
methods: {
set_warning_num_func: function() {
home_warning_num({}).then( rsp => {
if (rsp.status === 0) {
this.$store.commit('app/SET_WARNING_NUM', rsp.data)
}
})
},
user_manage_auth: function () {
get_user_manage_auth({}).then(rsp => {
this.$store.commit('user/SET_USERMANAGE_AUTH', rsp.data)
@ -192,6 +200,7 @@ export default {
this.$store.dispatch('permission/generateRoutes')
this.$router.replace('/home')
this.user_manage_auth()
this.set_warning_num_func()
// client使
console.log('func_type:', func_map)
Object.keys(func_map).forEach(
@ -246,6 +255,7 @@ export default {
this.$store.dispatch('permission/generateRoutes')
this.$router.replace('/home')
this.user_manage_auth()
this.set_warning_num_func()
// client使
// client使
console.log('func_type:', func_map)

@ -195,7 +195,8 @@
</div>
<!-- // -->
<el-dialog :close-on-click-modal="false" title="预警信息" width="70%" :visible.sync="dialogTableVisible">
<div class="header-custom">
<WaringListView />
<!-- <div class="header-custom">
<el-date-picker
v-model="start_time"
clearable
@ -277,19 +278,14 @@
<el-descriptions-item label="预警内容" span="2">{{ rowData.warning_content }}</el-descriptions-item>
<el-descriptions-item label="预警类型">{{ warning_data_map[rowData.object_type - 1] }}</el-descriptions-item>
<el-descriptions-item label="预警来源">{{ rowData.object_name }}</el-descriptions-item>
<!-- <el-descriptions-item label="生产日期">{{ this.rowData.object_name }}</el-descriptions-item>-->
<!-- <el-descriptions-item label="过期日期">{{ this.rowData.object_name }}</el-descriptions-item>-->
<!-- <el-descriptions-item label="试剂余量">{{ this.rowData.object_name }}</el-descriptions-item>-->
<!-- <el-descriptions-item label="所属终端">{{ this.rowData.object_name }}</el-descriptions-item>-->
<el-descriptions-item label="最后使用人">
<el-tag>{{ rowData.warning_user_name }}</el-tag>
</el-descriptions-item>
</el-descriptions>
<div style="text-align: center;margin-top: 20px">
<!-- <el-button @click="innerVisible=false"></el-button> -->
<el-button type="primary" @click="innerVisible=false"></el-button>
</div>
</el-dialog>
</el-dialog> -->
</el-dialog>
</div>
</template>
@ -298,10 +294,11 @@
import Detail from '@/components/Detail/index'
import { home_info, home_warning_list, home_drug_remaining, get_monitoring_info} from '@/api/reagent/overView'
import stringify from '@/utils/stringify'
import WaringListView from '@/components/WaringForm/index'
export default {
name: 'MainOverview',
components: { Detail },
components: { Detail, WaringListView},
data() {
return {
headerStyle: { 'background': '#E6E6E6' },
@ -496,7 +493,7 @@ export default {
warnAll() {
this.dialogTableVisible = true
//
this.getWarnList()
// this.getWarnList()
},
getLoadEcharts() {
this.myChart = this.$echarts.init(

Loading…
Cancel
Save