预警告警

This commit is contained in:
jjLv 2024-09-20 16:56:28 +08:00
parent 81aa7eb50b
commit 39ac1e8708
8 changed files with 430 additions and 513 deletions

View File

@ -50,7 +50,7 @@ export const editEdgeDeviceApi = (data) => {
/** 根据id查询边代设备 */ /** 根据id查询边代设备 */
export const queryEdgeDeviceByIdApi = (id) => { export const queryEdgeDeviceByIdApi = (id) => {
return request.get(`/base/tbBdRecord/${id}`) return request.get(`/base/tbBdRecord/getInner/${id}`)
} }
/** 删除边代设备 */ /** 删除边代设备 */

View File

@ -2,165 +2,55 @@
<!-- 表格公共组件 --> <!-- 表格公共组件 -->
<div> <div>
<!-- 表单搜索 --> <!-- 表单搜索 -->
<el-form <el-form :model="queryParams" ref="queryFormRef" size="small" :inline="true" label-width="100px" v-show="showSearch"
:model="queryParams" :rules="formRules">
ref="queryFormRef" <el-form-item v-for="(item, v) in formLabel" :key="v" :label="item.f_label" :prop="item.f_model">
size="small" <el-input v-if="item.f_type === 'ipt'" v-model="queryParams[item.f_model]" :placeholder="`请输入${item.f_label}`"
:inline="true" clearable style="width: 240px" />
label-width="100px" <el-select v-if="item.f_type === 'sel'" v-model="queryParams[item.f_model]" clearable filterable
v-show="showSearch" style="width: 240px" :placeholder="`请选择${item.f_label}`">
:rules="formRules" <el-option v-for="(sel, v) in item.f_selList" :key="v" :label="sel.label" :value="sel.value" />
>
<el-form-item
v-for="(item, v) in formLabel"
:key="v"
:label="item.f_label"
:prop="item.f_model"
>
<el-input
v-if="item.f_type === 'ipt'"
v-model="queryParams[item.f_model]"
:placeholder="`请输入${item.f_label}`"
clearable
style="width: 240px"
/>
<el-select
v-if="item.f_type === 'sel'"
v-model="queryParams[item.f_model]"
clearable
filterable
style="width: 240px"
:placeholder="`请选择${item.f_label}`"
>
<el-option
v-for="(sel, v) in item.f_selList"
:key="v"
:label="sel.label"
:value="sel.value"
/>
</el-select> </el-select>
<el-cascader <el-cascader v-if="item.f_type === 'selCasAdd'" v-model="queryParams[item.f_model]" :options="item.f_selList"
v-if="item.f_type === 'selCasAdd'" :props="item.optionProps" :show-all-levels="false" clearable
v-model="queryParams[item.f_model]" @change="handleCasAdd($event, item.f_model, cascaderFunc, extraTableProp)" style="width: 240px" />
:options="item.f_selList" <el-cascader v-if="item.f_type === 'selCas'" v-model="queryParams[item.f_model]" :options="item.f_selList"
:props="item.optionProps" :props="item.optionProps" :show-all-levels="false" @change="handleCas($event, item.f_model)"
:show-all-levels="false" style="width: 240px" />
clearable <el-date-picker v-if="item.f_type === 'date'" v-model="queryParams[item.f_model]" style="width: 240px"
@change="handleCasAdd($event, item.f_model, cascaderFunc, extraTableProp)" value-format="yyyy-MM-dd" type="date" :placeholder="`请输入${item.f_label}`" />
style="width: 240px" <el-date-picker v-if="item.f_type === 'dateRange'" v-model="timeList" style="width: 240px"
/> type="daterange" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期"
<el-cascader end-placeholder="结束日期" @change="onChangeTime($event,item.dateType)" />
v-if="item.f_type === 'selCas'" <el-input-number v-if="item.f_type === 'num'" v-model="queryParams[item.f_model]" :min="0"
v-model="queryParams[item.f_model]" style="width: 240px"></el-input-number>
:options="item.f_selList"
:props="item.optionProps"
:show-all-levels="false"
@change="handleCas($event, item.f_model)"
style="width: 240px"
/>
<el-date-picker
v-if="item.f_type === 'date'"
v-model="queryParams[item.f_model]"
style="width: 240px"
value-format="yyyy-MM-dd"
type="date"
:placeholder="`请输入${item.f_label}`"
/>
<el-date-picker
v-if="item.f_type === 'dateRange'"
v-model="queryParams[item.f_model]"
style="width: 240px"
type="daterange"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
<el-input-number
v-if="item.f_type === 'num'"
v-model="queryParams[item.f_model]"
:min="0"
style="width: 240px"
></el-input-number>
</el-form-item> </el-form-item>
<el-form-item v-if="showBtnCrews"> <el-form-item v-if="showBtnCrews">
<el-button <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"
type="primary" v-if="showSearchBtn">查询</el-button>
icon="el-icon-search" <el-button type="success" icon="el-icon-edit" size="mini" @click="handleFill"
size="mini" v-if="!showSearchBtn">填充</el-button>
@click="handleQuery" <el-button type="warning" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
v-if="showSearchBtn"
>查询</el-button
>
<el-button
type="success"
icon="el-icon-edit"
size="mini"
@click="handleFill"
v-if="!showSearchBtn"
>填充</el-button
>
<el-button
type="warning"
icon="el-icon-refresh"
size="mini"
@click="resetQuery"
>重置</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
<!-- 按钮集群 --> <!-- 按钮集群 -->
<el-row class="btn-container" > <el-row class="btn-container">
<div class="btn-handler"> <div class="btn-handler">
<slot name="btn" :queryParams="queryParams"></slot> <slot name="btn" :queryParams="queryParams"></slot>
</div> </div>
<ToolbarModel <ToolbarModel :showSearch.sync="showSearch" :indexNumShow.sync="indexNumShow" :selectionShow.sync="selectionShow"
:showSearch.sync="showSearch" :handleShow.sync="handleShow" :columns="columCheckList" @queryTable="getTableList" v-if="showRightTools" />
:indexNumShow.sync="indexNumShow"
:selectionShow.sync="selectionShow"
:handleShow.sync="handleShow"
:columns="columCheckList"
@queryTable="getTableList"
v-if="showRightTools"
/>
</el-row> </el-row>
<!-- 表格 --> <!-- 表格 -->
<el-table <el-table :data="tableList" border ref="tableRef" select-on-indeterminate style="width: 100%" v-loading="loading"
:data="tableList"
border
ref="tableRef"
select-on-indeterminate
style="width: 100%"
v-loading="loading"
@selection-change="handleSelectionChange"> @selection-change="handleSelectionChange">
> >
<el-table-column <el-table-column type="selection" width="45" align="center" v-if="showSel" :selectable="selectable" />
type="selection" <el-table-column width="55" align="center" label="序号" type="index" :index="indexContinuation(queryParams.pageNum, queryParams.pageSize)
width="45" " v-if="showIndex" />
align="center" <el-table-column v-for="(item, v) in tableColumCheckProps" :key="v" :label="item.t_label" :prop="item.t_props"
v-if="showSel" :width="item.t_width" align="center" show-overflow-tooltip>
:selectable="selectable"
/>
<el-table-column
width="55"
align="center"
label="序号"
type="index"
:index="
indexContinuation(queryParams.pageNum, queryParams.pageSize)
"
v-if="showIndex"
/>
<el-table-column
v-for="(item, v) in tableColumCheckProps"
:key="v"
:label="item.t_label"
:prop="item.t_props"
:width="item.t_width"
align="center"
show-overflow-tooltip
>
<template slot-scope="scope"> <template slot-scope="scope">
<!-- 判断当前列数据是否需要使用插槽的数据 --> <!-- 判断当前列数据是否需要使用插槽的数据 -->
<template v-if="item.t_slot"> <template v-if="item.t_slot">
@ -171,12 +61,7 @@
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column align="center" label="操作" v-if="handleShow && showOperation" :min-width="dynamicWidth">
align="center"
label="操作"
v-if="handleShow && showOperation"
:min-width="dynamicWidth"
>
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<div class="optionDivRef"> <div class="optionDivRef">
<slot :data="row" name="handle">-</slot> <slot :data="row" name="handle">-</slot>
@ -186,12 +71,8 @@
</el-table> </el-table>
<!-- 分页 --> <!-- 分页 -->
<pagination <pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
:total="total" @pagination="getTableList" />
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getTableList"
/>
</div> </div>
</template> </template>
@ -208,7 +89,7 @@ export default {
/** 列表请求接口 */ /** 列表请求接口 */
requestApi: { requestApi: {
type: Function, type: Function,
default: () => function () {}, default: () => function () { },
}, },
/** 列表配置项 */ /** 列表配置项 */
columnsList: { columnsList: {
@ -287,7 +168,7 @@ export default {
}, },
columnsList: { columnsList: {
handler(nv, ov) { handler(nv, ov) {
if(nv !== ov) { if (nv !== ov) {
this.columnsList = nv this.columnsList = nv
this.columCheckList = this.columnsList.map(e => { this.columCheckList = this.columnsList.map(e => {
this.$set(e, 'checked', true) this.$set(e, 'checked', true)
@ -339,7 +220,9 @@ export default {
columCheckList: [], columCheckList: [],
// //
dynamicWidth: 0, dynamicWidth: 0,
idCount: 1 idCount: 1,
timeList:[],
typeList:[]
} }
}, },
@ -350,9 +233,17 @@ export default {
}) })
/* 生成查询参数 */ /* 生成查询参数 */
this.formLabel.map(e => { this.formLabel.map(e => {
if(e.f_type === 'dateRange') {
this.$set(this.queryParams, e.dateType[0], '')
this.$set(this.queryParams, e.dateType[1], '')
this.typeList = e.dateType
} else {
this.$set(this.queryParams, e.f_model, '') this.$set(this.queryParams, e.f_model, '')
}
// //
if(e.f_rule) { if (e.f_rule) {
this.$set(this.formRules, e.f_rule, [ this.$set(this.formRules, e.f_rule, [
{ {
required: true, required: true,
@ -362,14 +253,14 @@ export default {
]) ])
} }
}) })
if(this.sendParams !== null) { if (this.sendParams !== null) {
Object.assign(this.queryParams, this.sendParams) Object.assign(this.queryParams, this.sendParams)
/* for(let key in this.sendParams) { /* for(let key in this.sendParams) {
console.log(key, this.sendParams[key]) console.log(key, this.sendParams[key])
this.$set(this.queryParams, key, this.sendParams[key]) this.$set(this.queryParams, key, this.sendParams[key])
} */ } */
} }
if(this.sendId !== null) this.queryParams.id = this.sendId if (this.sendId !== null) this.queryParams.id = this.sendId
this.getTableList() this.getTableList()
}, },
updated() { updated() {
@ -379,45 +270,52 @@ export default {
methods: { methods: {
/** 获取列表数据 */ /** 获取列表数据 */
async getTableList() { async getTableList() {
if(this.queryParams.time && this.queryParams.time.length !== 0) { console.log(this.queryParams, '请求参数')
this.queryParams.startTime = this.queryParams.time[0]
this.queryParams.endTime = this.queryParams.time[1]
delete this.queryParams.time
}
console.log(this.queryParams)
if(Object.keys(this.formRules).length !== 0) {
this.$refs.queryFormRef.validate(async valid => {
if (valid) {
this.loading = true
const res = await this.requestApi(this.queryParams) const res = await this.requestApi(this.queryParams)
this.loading = false
console.log(res, '列表数据') console.log(res, '列表数据')
if (res.code === 200) {
if (res.data) {
this.tableList = res.data.rows || res.data
this.total = res.data.total || res.data.length
} else {
this.tableList = res.rows || res.data
this.total = res.data.total || res.rows.length
}
}
}
})
} else {
this.loading = true
const res = await this.requestApi(this.queryParams)
this.loading = false
console.log(res, '列表数据2')
if (res.code === 200) {
if (res.data) {
this.tableList = res.data.rows || res.data this.tableList = res.data.rows || res.data
this.total = res.data.total this.total = res.data.total
} else { // if(this.queryParams.time && this.queryParams.time.length !== 0) {
this.tableList = res.rows || res.data // this.queryParams.startTime = this.queryParams.time[0]
this.total = res.total // this.queryParams.endTime = this.queryParams.time[1]
} // delete this.queryParams.time
} // }
} // console.log(this.queryParams)
// if(Object.keys(this.formRules).length !== 0) {
// this.$refs.queryFormRef.validate(async valid => {
// if (valid) {
// this.loading = true
// const res = await this.requestApi(this.queryParams)
// this.loading = false
// console.log(res, '')
// if (res.code === 200) {
// if (res.data) {
// this.tableList = res.data.rows || res.data
// this.total = res.data.total || res.data.length
// } else {
// this.tableList = res.rows || res.data
// this.total = res.data.total || res.rows.length
// }
// }
// }
// })
// } else {
// this.loading = true
// const res = await this.requestApi(this.queryParams)
// this.loading = false
// console.log(res, '2')
// if (res.code === 200) {
// if (res.data) {
// this.tableList = res.data.rows || res.data
// this.total = res.data.total
// } else {
// this.tableList = res.rows || res.data
// this.total = res.total
// }
// }
// }
}, },
/** 查询按钮 */ /** 查询按钮 */
@ -433,6 +331,13 @@ export default {
/** 重置按钮 */ /** 重置按钮 */
resetQuery() { resetQuery() {
this.$refs.queryFormRef.resetFields() this.$refs.queryFormRef.resetFields()
this.timeList = []
if(this.typeList.length > 0) {
this.queryParams[this.typeList[0]] = ''
this.queryParams[this.typeList[1]] = ''
}
// this.queryParams[this.typeList[0]] = ''
// this.queryParams[this.typeList[1]] = ''
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
this.queryParams.pageSize = 10 this.queryParams.pageSize = 10
this.getTableList() this.getTableList()
@ -448,11 +353,11 @@ export default {
func, func,
prop prop
) { ) {
if(e.length !== 0) { if (e.length !== 0) {
this.queryParams[val] = e[e.length - 1] this.queryParams[val] = e[e.length - 1]
let setObj = {} let setObj = {}
// //
if(prop) { if (prop) {
Object.assign(setObj, prop) Object.assign(setObj, prop)
} }
// id // id
@ -465,8 +370,8 @@ export default {
this.$set(setObj, 'name', res.data.parentName) this.$set(setObj, 'name', res.data.parentName)
this.$set(setObj, 'unitName', res.data.unitName) this.$set(setObj, 'unitName', res.data.unitName)
this.$set(setObj, 'typeName', res.data.name) this.$set(setObj, 'typeName', res.data.name)
}).catch(err => {}) }).catch(err => { })
for(let key in this.queryParams) { for (let key in this.queryParams) {
this.$set(setObj, key, this.queryParams[key]) this.$set(setObj, key, this.queryParams[key])
} }
this.tableList.unshift(setObj) this.tableList.unshift(setObj)
@ -511,6 +416,17 @@ export default {
this.$emit('transIdList', this.msgList) this.$emit('transIdList', this.msgList)
}, },
/* 时间change事件 */
onChangeTime(e,type) {
console.log(e, '时间',type)
const [_1,_2]= type
const [_time1,_time2] = e
if(e.length > 0) {
this.$set(this.queryParams, _1, _time1)
this.$set(this.queryParams, _2, _time2)
}
}
}, },
} }
</script> </script>
@ -521,6 +437,7 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
} }
::v-deep .btn-handler { ::v-deep .btn-handler {
flex: 1; flex: 1;

View File

@ -145,9 +145,9 @@ export default {
// this.projectParams.remarks = '' // this.projectParams.remarks = ''
// //
queryEdgeDeviceByIdApi(this.editParams.id).then(res => { queryEdgeDeviceByIdApi(this.editParams.id).then(res => {
this.projectParams.auditUserName = res.data.auditUserName res.rows.forEach(item => {
res.data.recordList.forEach(item => {
this.$refs.tableRef.tableList.unshift(item) this.$refs.tableRef.tableList.unshift(item)
this.projectParams.auditUserName = item.auditUserName
}) })
}).catch(err => {}) }).catch(err => {})
this.subSort = 2 this.subSort = 2

View File

@ -132,7 +132,7 @@ export default {
this.projectParams.remarks = '' this.projectParams.remarks = ''
// //
queryEdgeDeviceByIdApi(this.editParams.id).then(res => { queryEdgeDeviceByIdApi(this.editParams.id).then(res => {
res.data.recordList.forEach(item => { res.rows.forEach(item => {
this.$refs.tableRef.tableList.unshift(item) this.$refs.tableRef.tableList.unshift(item)
}) })
}).catch(err => {}) }).catch(err => {})

View File

@ -151,7 +151,7 @@ export default {
Object.assign(this.projectParams, this.editParams) Object.assign(this.projectParams, this.editParams)
// //
queryEdgeDeviceByIdApi(this.editParams.id).then(res => { queryEdgeDeviceByIdApi(this.editParams.id).then(res => {
res.data.recordList.forEach(item => { res.rows.forEach(item => {
this.$refs.tableRef.tableList.unshift(item) this.$refs.tableRef.tableList.unshift(item)
}) })
}).catch(err => {}) }).catch(err => {})

View File

@ -2,7 +2,7 @@ export const formLabel = [
{ f_label: '项目部名称', f_model: 'departName', f_type: 'ipt' }, { f_label: '项目部名称', f_model: 'departName', f_type: 'ipt' },
{ f_label: '工程名称', f_model: 'proName', f_type: 'ipt' }, { f_label: '工程名称', f_model: 'proName', f_type: 'ipt' },
{ f_label: '申请人', f_model: 'relUser', f_type: 'ipt' }, { f_label: '申请人', f_model: 'relUser', f_type: 'ipt' },
{ f_label: '申请时间', f_model: 'auditStatus', f_type: 'date', }, { f_label: '申请时间', f_model: 'applyTime', f_type: 'date', },
] ]
export const columnsList = [ export const columnsList = [
{ t_props: 'departName', t_label: '申请项目部', }, { t_props: 'departName', t_label: '申请项目部', },

View File

@ -134,6 +134,7 @@ export default {
}, },
handleExamData(v) { handleExamData(v) {
this.editParams = v this.editParams = v
console.log(v)
this.dialogConfigApprove.outerVisible = true this.dialogConfigApprove.outerVisible = true
this.dialogConfigApprove.outerTitle = '审核' this.dialogConfigApprove.outerTitle = '审核'
// this.dialogConfig.dialogWidth = '50%' // this.dialogConfig.dialogWidth = '50%'

View File

@ -15,8 +15,7 @@ import {
export const formLabel = [ export const formLabel = [
{ f_label: '设备名称', f_model: 'devName', f_type: 'ipt' }, { f_label: '设备名称', f_model: 'devName', f_type: 'ipt' },
{ f_label: '设备类型', f_model: 'devType', f_type: 'sel',f_selList: [] }, { f_label: '设备类型', f_model: 'devType', f_type: 'sel',f_selList: [] },
{ f_label: '预警日期', f_model: 'startTime', f_type: 'dateRange' }, { f_label: '预警日期', f_model: 'time', f_type: 'dateRange' , dateType:['startTime','endTime']},
] ]
export const columnsList = [ export const columnsList = [