预警告警
This commit is contained in:
parent
81aa7eb50b
commit
39ac1e8708
|
|
@ -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}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除边代设备 */
|
/** 删除边代设备 */
|
||||||
|
|
|
||||||
|
|
@ -1,540 +1,457 @@
|
||||||
<template>
|
<template>
|
||||||
<!-- 表格公共组件 -->
|
<!-- 表格公共组件 -->
|
||||||
<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-select>
|
||||||
<el-form-item
|
<el-cascader v-if="item.f_type === 'selCasAdd'" v-model="queryParams[item.f_model]" :options="item.f_selList"
|
||||||
v-for="(item, v) in formLabel"
|
:props="item.optionProps" :show-all-levels="false" clearable
|
||||||
:key="v"
|
@change="handleCasAdd($event, item.f_model, cascaderFunc, extraTableProp)" style="width: 240px" />
|
||||||
:label="item.f_label"
|
<el-cascader v-if="item.f_type === 'selCas'" v-model="queryParams[item.f_model]" :options="item.f_selList"
|
||||||
:prop="item.f_model"
|
:props="item.optionProps" :show-all-levels="false" @change="handleCas($event, item.f_model)"
|
||||||
>
|
style="width: 240px" />
|
||||||
<el-input
|
<el-date-picker v-if="item.f_type === 'date'" v-model="queryParams[item.f_model]" style="width: 240px"
|
||||||
v-if="item.f_type === 'ipt'"
|
value-format="yyyy-MM-dd" type="date" :placeholder="`请输入${item.f_label}`" />
|
||||||
v-model="queryParams[item.f_model]"
|
<el-date-picker v-if="item.f_type === 'dateRange'" v-model="timeList" style="width: 240px"
|
||||||
:placeholder="`请输入${item.f_label}`"
|
type="daterange" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期"
|
||||||
clearable
|
end-placeholder="结束日期" @change="onChangeTime($event,item.dateType)" />
|
||||||
style="width: 240px"
|
<el-input-number v-if="item.f_type === 'num'" v-model="queryParams[item.f_model]" :min="0"
|
||||||
/>
|
style="width: 240px"></el-input-number>
|
||||||
<el-select
|
</el-form-item>
|
||||||
v-if="item.f_type === 'sel'"
|
<el-form-item v-if="showBtnCrews">
|
||||||
v-model="queryParams[item.f_model]"
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"
|
||||||
clearable
|
v-if="showSearchBtn">查询</el-button>
|
||||||
filterable
|
<el-button type="success" icon="el-icon-edit" size="mini" @click="handleFill"
|
||||||
style="width: 240px"
|
v-if="!showSearchBtn">填充</el-button>
|
||||||
:placeholder="`请选择${item.f_label}`"
|
<el-button type="warning" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
>
|
</el-form-item>
|
||||||
<el-option
|
</el-form>
|
||||||
v-for="(sel, v) in item.f_selList"
|
<!-- 按钮集群 -->
|
||||||
:key="v"
|
<el-row class="btn-container">
|
||||||
:label="sel.label"
|
<div class="btn-handler">
|
||||||
:value="sel.value"
|
<slot name="btn" :queryParams="queryParams"></slot>
|
||||||
/>
|
</div>
|
||||||
</el-select>
|
<ToolbarModel :showSearch.sync="showSearch" :indexNumShow.sync="indexNumShow" :selectionShow.sync="selectionShow"
|
||||||
<el-cascader
|
:handleShow.sync="handleShow" :columns="columCheckList" @queryTable="getTableList" v-if="showRightTools" />
|
||||||
v-if="item.f_type === 'selCasAdd'"
|
</el-row>
|
||||||
v-model="queryParams[item.f_model]"
|
<!-- 表格 -->
|
||||||
:options="item.f_selList"
|
|
||||||
:props="item.optionProps"
|
|
||||||
:show-all-levels="false"
|
|
||||||
clearable
|
|
||||||
@change="handleCasAdd($event, item.f_model, cascaderFunc, extraTableProp)"
|
|
||||||
style="width: 240px"
|
|
||||||
/>
|
|
||||||
<el-cascader
|
|
||||||
v-if="item.f_type === 'selCas'"
|
|
||||||
v-model="queryParams[item.f_model]"
|
|
||||||
: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 v-if="showBtnCrews">
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
icon="el-icon-search"
|
|
||||||
size="mini"
|
|
||||||
@click="handleQuery"
|
|
||||||
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>
|
|
||||||
<!-- 按钮集群 -->
|
|
||||||
<el-row class="btn-container" >
|
|
||||||
<div class="btn-handler">
|
|
||||||
<slot name="btn" :queryParams="queryParams"></slot>
|
|
||||||
</div>
|
|
||||||
<ToolbarModel
|
|
||||||
:showSearch.sync="showSearch"
|
|
||||||
:indexNumShow.sync="indexNumShow"
|
|
||||||
:selectionShow.sync="selectionShow"
|
|
||||||
:handleShow.sync="handleShow"
|
|
||||||
:columns="columCheckList"
|
|
||||||
@queryTable="getTableList"
|
|
||||||
v-if="showRightTools"
|
|
||||||
/>
|
|
||||||
</el-row>
|
|
||||||
<!-- 表格 -->
|
|
||||||
|
|
||||||
<el-table
|
<el-table :data="tableList" border ref="tableRef" select-on-indeterminate style="width: 100%" v-loading="loading"
|
||||||
:data="tableList"
|
@selection-change="handleSelectionChange">
|
||||||
border
|
>
|
||||||
ref="tableRef"
|
<el-table-column type="selection" width="45" align="center" v-if="showSel" :selectable="selectable" />
|
||||||
select-on-indeterminate
|
<el-table-column width="55" align="center" label="序号" type="index" :index="indexContinuation(queryParams.pageNum, queryParams.pageSize)
|
||||||
style="width: 100%"
|
" v-if="showIndex" />
|
||||||
v-loading="loading"
|
<el-table-column v-for="(item, v) in tableColumCheckProps" :key="v" :label="item.t_label" :prop="item.t_props"
|
||||||
@selection-change="handleSelectionChange">
|
:width="item.t_width" align="center" show-overflow-tooltip>
|
||||||
>
|
<template slot-scope="scope">
|
||||||
<el-table-column
|
<!-- 判断当前列数据是否需要使用插槽的数据 -->
|
||||||
type="selection"
|
<template v-if="item.t_slot">
|
||||||
width="45"
|
<slot :data="scope.row" :name="item.t_slot"></slot>
|
||||||
align="center"
|
</template>
|
||||||
v-if="showSel"
|
<template v-else>
|
||||||
:selectable="selectable"
|
{{ scope.row[item.t_props] || '-' }}
|
||||||
/>
|
</template>
|
||||||
<el-table-column
|
</template>
|
||||||
width="55"
|
</el-table-column>
|
||||||
align="center"
|
<el-table-column align="center" label="操作" v-if="handleShow && showOperation" :min-width="dynamicWidth">
|
||||||
label="序号"
|
<template slot-scope="{ row }">
|
||||||
type="index"
|
<div class="optionDivRef">
|
||||||
:index="
|
<slot :data="row" name="handle">-</slot>
|
||||||
indexContinuation(queryParams.pageNum, queryParams.pageSize)
|
</div>
|
||||||
"
|
</template>
|
||||||
v-if="showIndex"
|
</el-table-column>
|
||||||
/>
|
</el-table>
|
||||||
<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 v-if="item.t_slot">
|
|
||||||
<slot :data="scope.row" :name="item.t_slot"></slot>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
{{ scope.row[item.t_props] || '-' }}
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
align="center"
|
|
||||||
label="操作"
|
|
||||||
v-if="handleShow && showOperation"
|
|
||||||
:min-width="dynamicWidth"
|
|
||||||
>
|
|
||||||
<template slot-scope="{ row }">
|
|
||||||
<div class="optionDivRef">
|
|
||||||
<slot :data="row" name="handle">-</slot>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
|
|
||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
<pagination
|
<pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||||||
:total="total"
|
@pagination="getTableList" />
|
||||||
:page.sync="queryParams.pageNum"
|
</div>
|
||||||
:limit.sync="queryParams.pageSize"
|
|
||||||
@pagination="getTableList"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ToolbarModel from '../ToolbarModel'
|
import ToolbarModel from '../ToolbarModel'
|
||||||
export default {
|
export default {
|
||||||
components: { ToolbarModel },
|
components: { ToolbarModel },
|
||||||
props: {
|
props: {
|
||||||
/** 表单查询条件 */
|
/** 表单查询条件 */
|
||||||
formLabel: {
|
formLabel: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
/** 列表请求接口 */
|
/** 列表请求接口 */
|
||||||
requestApi: {
|
requestApi: {
|
||||||
type: Function,
|
type: Function,
|
||||||
default: () => function () {},
|
default: () => function () { },
|
||||||
},
|
},
|
||||||
/** 列表配置项 */
|
/** 列表配置项 */
|
||||||
columnsList: {
|
columnsList: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
/** 是否显示选择框 */
|
/** 是否显示选择框 */
|
||||||
showSel: {
|
showSel: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
/** 传递参数 */
|
/** 传递参数 */
|
||||||
sendParams: {
|
sendParams: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => null
|
default: () => null
|
||||||
},
|
},
|
||||||
sendId: {
|
sendId: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: () => null
|
default: () => null
|
||||||
},
|
},
|
||||||
/** 是否显示查询按钮 */
|
/** 是否显示查询按钮 */
|
||||||
showSearchBtn: {
|
showSearchBtn: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
showBtnCrews: {
|
showBtnCrews: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
cascaderFunc: {
|
cascaderFunc: {
|
||||||
type: Function,
|
type: Function,
|
||||||
default: () => null
|
default: () => null
|
||||||
},
|
},
|
||||||
extraTableProp: {
|
extraTableProp: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => null
|
default: () => null
|
||||||
},
|
},
|
||||||
showOperation: {
|
showOperation: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
showRightTools: {
|
showRightTools: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
selectable: {
|
selectable: {
|
||||||
type: Function,
|
type: Function,
|
||||||
default: () => {
|
default: () => {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selSingle: {
|
selSingle: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
showIndex: {
|
showIndex: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
/* 根据操作栏控制表头是否显示 */
|
||||||
|
tableColumCheckProps() {
|
||||||
|
return this.columCheckList.filter(e => {
|
||||||
|
return e.checked != false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
handleShow: {
|
||||||
|
handler(newValue) {
|
||||||
|
if (!newValue) {
|
||||||
|
this.dynamicWidth = 0
|
||||||
}
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
columnsList: {
|
||||||
/* 根据操作栏控制表头是否显示 */
|
handler(nv, ov) {
|
||||||
tableColumCheckProps() {
|
if (nv !== ov) {
|
||||||
return this.columCheckList.filter(e => {
|
this.columnsList = nv
|
||||||
return e.checked != false
|
this.columCheckList = this.columnsList.map(e => {
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
handleShow: {
|
|
||||||
handler(newValue) {
|
|
||||||
if (!newValue) {
|
|
||||||
this.dynamicWidth = 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
columnsList: {
|
|
||||||
handler(nv, ov) {
|
|
||||||
if(nv !== ov) {
|
|
||||||
this.columnsList = nv
|
|
||||||
this.columCheckList = this.columnsList.map(e => {
|
|
||||||
this.$set(e, 'checked', true)
|
|
||||||
return e
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
deep: true
|
|
||||||
}
|
|
||||||
/* sendParams: {
|
|
||||||
handler(nv, ov) {
|
|
||||||
console.log(nv, ov)
|
|
||||||
if(nv !== ov) {
|
|
||||||
Object.assign(this.queryParams, nv)
|
|
||||||
this.getTableList()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
deep: true,
|
|
||||||
immediate: true
|
|
||||||
} */
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
// 表单校验
|
|
||||||
formRules: {
|
|
||||||
|
|
||||||
},
|
|
||||||
loading: false,
|
|
||||||
// 列表接口查询参数
|
|
||||||
queryParams: {
|
|
||||||
pageNum: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
},
|
|
||||||
// 列表数据源
|
|
||||||
tableList: [],
|
|
||||||
// 导出传递数据
|
|
||||||
msgList: undefined,
|
|
||||||
// 列表数据条数
|
|
||||||
total: 0,
|
|
||||||
// 搜索区域是否隐藏
|
|
||||||
showSearch: true,
|
|
||||||
// 是否显示复选框
|
|
||||||
selectionShow: true,
|
|
||||||
// 是否显示序号
|
|
||||||
indexNumShow: true,
|
|
||||||
// 是否显示操作列
|
|
||||||
handleShow: true,
|
|
||||||
// 列表每列 label
|
|
||||||
columCheckList: [],
|
|
||||||
// 操作列最小宽度
|
|
||||||
dynamicWidth: 0,
|
|
||||||
idCount: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
created() {
|
|
||||||
this.columCheckList = this.columnsList.map(e => {
|
|
||||||
this.$set(e, 'checked', true)
|
this.$set(e, 'checked', true)
|
||||||
return e
|
return e
|
||||||
})
|
})
|
||||||
/* 生成查询参数 */
|
|
||||||
this.formLabel.map(e => {
|
|
||||||
this.$set(this.queryParams, e.f_model, '')
|
|
||||||
// 设置表单必填
|
|
||||||
if(e.f_rule) {
|
|
||||||
this.$set(this.formRules, e.f_rule, [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: `请填写${e.f_label}`,
|
|
||||||
trigger: 'blur'
|
|
||||||
}
|
|
||||||
])
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if(this.sendParams !== null) {
|
|
||||||
Object.assign(this.queryParams, this.sendParams)
|
|
||||||
/* for(let key in this.sendParams) {
|
|
||||||
console.log(key, this.sendParams[key])
|
|
||||||
this.$set(this.queryParams, key, this.sendParams[key])
|
|
||||||
} */
|
|
||||||
}
|
}
|
||||||
if(this.sendId !== null) this.queryParams.id = this.sendId
|
},
|
||||||
this.getTableList()
|
deep: true
|
||||||
},
|
}
|
||||||
updated() {
|
/* sendParams: {
|
||||||
// 更新时重新计算操作列需要的最小宽度 确保展示无误
|
handler(nv, ov) {
|
||||||
this.dynamicWidth = this.getOperatorWidth()
|
console.log(nv, ov)
|
||||||
},
|
if(nv !== ov) {
|
||||||
methods: {
|
Object.assign(this.queryParams, nv)
|
||||||
/** 获取列表数据 */
|
|
||||||
async getTableList() {
|
|
||||||
if(this.queryParams.time && this.queryParams.time.length !== 0) {
|
|
||||||
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)
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
/** 查询按钮 */
|
|
||||||
handleQuery() {
|
|
||||||
this.getTableList()
|
this.getTableList()
|
||||||
},
|
|
||||||
/** 填充按钮 */
|
|
||||||
handleFill() {
|
|
||||||
/* this.tableList.forEach(obj => {
|
|
||||||
Object.assign(obj, this.formLabel)
|
|
||||||
}) */
|
|
||||||
},
|
|
||||||
/** 重置按钮 */
|
|
||||||
resetQuery() {
|
|
||||||
this.$refs.queryFormRef.resetFields()
|
|
||||||
this.queryParams.pageNum = 1
|
|
||||||
this.queryParams.pageSize = 10
|
|
||||||
this.getTableList()
|
|
||||||
},
|
|
||||||
/** 级联选择 */
|
|
||||||
handleCas(e, val) {
|
|
||||||
this.queryParams[val] = e[e.length - 1]
|
|
||||||
},
|
|
||||||
/** 级联选择只选最后一级 */
|
|
||||||
handleCasAdd(
|
|
||||||
e,
|
|
||||||
val,
|
|
||||||
func,
|
|
||||||
prop
|
|
||||||
) {
|
|
||||||
if(e.length !== 0) {
|
|
||||||
this.queryParams[val] = e[e.length - 1]
|
|
||||||
let setObj = {}
|
|
||||||
// 合并
|
|
||||||
if(prop) {
|
|
||||||
Object.assign(setObj, prop)
|
|
||||||
}
|
|
||||||
// 设置id自增
|
|
||||||
this.$set(setObj, 'id', this.idCount)
|
|
||||||
this.idCount++
|
|
||||||
// 获取单位
|
|
||||||
func({
|
|
||||||
id: e[e.length - 1]
|
|
||||||
}).then(res => {
|
|
||||||
this.$set(setObj, 'name', res.data.parentName)
|
|
||||||
this.$set(setObj, 'unitName', res.data.unitName)
|
|
||||||
this.$set(setObj, 'typeName', res.data.name)
|
|
||||||
}).catch(err => {})
|
|
||||||
for(let key in this.queryParams) {
|
|
||||||
this.$set(setObj, key, this.queryParams[key])
|
|
||||||
}
|
|
||||||
this.tableList.unshift(setObj)
|
|
||||||
console.log(this.tableList)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/** 动态设置操作列的列宽 */
|
deep: true,
|
||||||
getOperatorWidth() {
|
immediate: true
|
||||||
const operatorColumn =
|
} */
|
||||||
document.getElementsByClassName('optionDivRef')
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 表单校验
|
||||||
|
formRules: {
|
||||||
|
|
||||||
// 默认宽度
|
},
|
||||||
let width = 100
|
loading: false,
|
||||||
// 内间距
|
// 列表接口查询参数
|
||||||
let paddingSpacing = 0
|
queryParams: {
|
||||||
// 按钮数量
|
pageNum: 1,
|
||||||
let buttonCount = 0
|
pageSize: 10,
|
||||||
|
},
|
||||||
|
// 列表数据源
|
||||||
|
tableList: [],
|
||||||
|
// 导出传递数据
|
||||||
|
msgList: undefined,
|
||||||
|
// 列表数据条数
|
||||||
|
total: 0,
|
||||||
|
// 搜索区域是否隐藏
|
||||||
|
showSearch: true,
|
||||||
|
// 是否显示复选框
|
||||||
|
selectionShow: true,
|
||||||
|
// 是否显示序号
|
||||||
|
indexNumShow: true,
|
||||||
|
// 是否显示操作列
|
||||||
|
handleShow: true,
|
||||||
|
// 列表每列 label
|
||||||
|
columCheckList: [],
|
||||||
|
// 操作列最小宽度
|
||||||
|
dynamicWidth: 0,
|
||||||
|
idCount: 1,
|
||||||
|
timeList:[],
|
||||||
|
typeList:[]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
if (operatorColumn.length > 0) {
|
created() {
|
||||||
Array.prototype.forEach.call(operatorColumn, function (item) {
|
this.columCheckList = this.columnsList.map(e => {
|
||||||
// 最宽的宽度
|
this.$set(e, 'checked', true)
|
||||||
width = width > item.offsetWidth ? width : item.offsetWidth
|
return e
|
||||||
const buttons = item.getElementsByClassName('el-button')
|
})
|
||||||
buttonCount = buttons.length
|
/* 生成查询参数 */
|
||||||
buttonCount =
|
this.formLabel.map(e => {
|
||||||
buttonCount > buttons.length
|
|
||||||
? buttonCount
|
|
||||||
: buttons.length
|
|
||||||
})
|
|
||||||
return width
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
queryTableList(params) {
|
if(e.f_type === 'dateRange') {
|
||||||
Object.assign(this.queryParams, params)
|
this.$set(this.queryParams, e.dateType[0], '')
|
||||||
this.getTableList()
|
this.$set(this.queryParams, e.dateType[1], '')
|
||||||
},
|
this.typeList = e.dateType
|
||||||
|
} else {
|
||||||
|
this.$set(this.queryParams, e.f_model, '')
|
||||||
|
}
|
||||||
|
// 设置表单必填
|
||||||
|
if (e.f_rule) {
|
||||||
|
this.$set(this.formRules, e.f_rule, [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: `请填写${e.f_label}`,
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (this.sendParams !== null) {
|
||||||
|
Object.assign(this.queryParams, this.sendParams)
|
||||||
|
/* for(let key in this.sendParams) {
|
||||||
|
console.log(key, this.sendParams[key])
|
||||||
|
this.$set(this.queryParams, key, this.sendParams[key])
|
||||||
|
} */
|
||||||
|
}
|
||||||
|
if (this.sendId !== null) this.queryParams.id = this.sendId
|
||||||
|
this.getTableList()
|
||||||
|
},
|
||||||
|
updated() {
|
||||||
|
// 更新时重新计算操作列需要的最小宽度 确保展示无误
|
||||||
|
this.dynamicWidth = this.getOperatorWidth()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 获取列表数据 */
|
||||||
|
async getTableList() {
|
||||||
|
console.log(this.queryParams, '请求参数')
|
||||||
|
const res = await this.requestApi(this.queryParams)
|
||||||
|
|
||||||
handleSelectionChange(e) {
|
console.log(res, '列表数据')
|
||||||
console.log(e, 'e')
|
|
||||||
this.msgList = e
|
this.tableList = res.data.rows || res.data
|
||||||
this.$emit('transIdList', this.msgList)
|
this.total = res.data.total
|
||||||
},
|
// if(this.queryParams.time && this.queryParams.time.length !== 0) {
|
||||||
|
// 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)
|
||||||
|
// 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
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
},
|
},
|
||||||
|
/** 查询按钮 */
|
||||||
|
handleQuery() {
|
||||||
|
this.getTableList()
|
||||||
|
},
|
||||||
|
/** 填充按钮 */
|
||||||
|
handleFill() {
|
||||||
|
/* this.tableList.forEach(obj => {
|
||||||
|
Object.assign(obj, this.formLabel)
|
||||||
|
}) */
|
||||||
|
},
|
||||||
|
/** 重置按钮 */
|
||||||
|
resetQuery() {
|
||||||
|
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.pageSize = 10
|
||||||
|
this.getTableList()
|
||||||
|
},
|
||||||
|
/** 级联选择 */
|
||||||
|
handleCas(e, val) {
|
||||||
|
this.queryParams[val] = e[e.length - 1]
|
||||||
|
},
|
||||||
|
/** 级联选择只选最后一级 */
|
||||||
|
handleCasAdd(
|
||||||
|
e,
|
||||||
|
val,
|
||||||
|
func,
|
||||||
|
prop
|
||||||
|
) {
|
||||||
|
if (e.length !== 0) {
|
||||||
|
this.queryParams[val] = e[e.length - 1]
|
||||||
|
let setObj = {}
|
||||||
|
// 合并
|
||||||
|
if (prop) {
|
||||||
|
Object.assign(setObj, prop)
|
||||||
|
}
|
||||||
|
// 设置id自增
|
||||||
|
this.$set(setObj, 'id', this.idCount)
|
||||||
|
this.idCount++
|
||||||
|
// 获取单位
|
||||||
|
func({
|
||||||
|
id: e[e.length - 1]
|
||||||
|
}).then(res => {
|
||||||
|
this.$set(setObj, 'name', res.data.parentName)
|
||||||
|
this.$set(setObj, 'unitName', res.data.unitName)
|
||||||
|
this.$set(setObj, 'typeName', res.data.name)
|
||||||
|
}).catch(err => { })
|
||||||
|
for (let key in this.queryParams) {
|
||||||
|
this.$set(setObj, key, this.queryParams[key])
|
||||||
|
}
|
||||||
|
this.tableList.unshift(setObj)
|
||||||
|
console.log(this.tableList)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** 动态设置操作列的列宽 */
|
||||||
|
getOperatorWidth() {
|
||||||
|
const operatorColumn =
|
||||||
|
document.getElementsByClassName('optionDivRef')
|
||||||
|
|
||||||
|
// 默认宽度
|
||||||
|
let width = 100
|
||||||
|
// 内间距
|
||||||
|
let paddingSpacing = 0
|
||||||
|
// 按钮数量
|
||||||
|
let buttonCount = 0
|
||||||
|
|
||||||
|
if (operatorColumn.length > 0) {
|
||||||
|
Array.prototype.forEach.call(operatorColumn, function (item) {
|
||||||
|
// 最宽的宽度
|
||||||
|
width = width > item.offsetWidth ? width : item.offsetWidth
|
||||||
|
const buttons = item.getElementsByClassName('el-button')
|
||||||
|
buttonCount = buttons.length
|
||||||
|
buttonCount =
|
||||||
|
buttonCount > buttons.length
|
||||||
|
? buttonCount
|
||||||
|
: buttons.length
|
||||||
|
})
|
||||||
|
return width
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
queryTableList(params) {
|
||||||
|
Object.assign(this.queryParams, params)
|
||||||
|
this.getTableList()
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSelectionChange(e) {
|
||||||
|
console.log(e, 'e')
|
||||||
|
this.msgList = e
|
||||||
|
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>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.btn-container {
|
.btn-container {
|
||||||
margin-bottom: 6px;
|
margin-bottom: 6px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
::v-deep .btn-handler {
|
|
||||||
flex: 1;
|
|
||||||
|
|
||||||
.el-button {
|
::v-deep .btn-handler {
|
||||||
padding: 6px 18px;
|
flex: 1;
|
||||||
}
|
|
||||||
|
.el-button {
|
||||||
|
padding: 6px 18px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .optionDivRef {
|
::v-deep .optionDivRef {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
||||||
.el-button {
|
.el-button {
|
||||||
padding: 6px 12px;
|
padding: 6px 12px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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 => {})
|
||||||
|
|
|
||||||
|
|
@ -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 => {})
|
||||||
|
|
|
||||||
|
|
@ -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: '申请项目部', },
|
||||||
|
|
|
||||||
|
|
@ -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%'
|
||||||
|
|
|
||||||
|
|
@ -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 = [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue