update
This commit is contained in:
parent
ba44951b71
commit
19730bb635
@ -5,6 +5,7 @@
|
||||
<!-- 如果需要更精细一点的布局,可以根据配置项实现地再复杂一点,但此处暂时全部采用一行两列布局 -->
|
||||
<el-row v-for="n in rows" :key="n" :gutter="20">
|
||||
<el-col v-for="c in COLUMN_PER_ROW" :key="`${n}+'col'+${c}`" :span="24 / COLUMN_PER_ROW">
|
||||
<!-- :class="{ 'hidden-input': configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].hidden }" -->
|
||||
<el-form-item
|
||||
v-if="configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]"
|
||||
:prop="configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name"
|
||||
@ -394,4 +395,8 @@ export default {
|
||||
border-radius: 4px;
|
||||
background: #ccc;
|
||||
}
|
||||
|
||||
.super-flexible-dialog >>> .hidden-input {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
@ -22,13 +22,15 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
emitClick() {
|
||||
this.$emit('emitData', {
|
||||
action: this.injectData.actionName || 'view-detail-action',
|
||||
data: this.injectData.emitFullData ? this.injectData : { id: this.injectData.id }
|
||||
console.log('inject data:' ,this.injectData)
|
||||
this.$emit('emit-data', {
|
||||
type: this.injectData.head?.actionName || 'view-detail-action',
|
||||
data: this.injectData.head?.emitFullData ? this.injectData : this.injectData.id
|
||||
})
|
||||
}
|
||||
},
|
||||
render: function (h) {
|
||||
return h('span', null, [h('el-button', { props: { type: 'text' }, style: { paddingLeft: 0 } }, this.injectData.buttonContent || this.defaultText)])
|
||||
// console.log(this)
|
||||
return h('span', null, [h('el-button', { props: { type: 'text' }, style: { paddingLeft: 0 }, on: { click: this.emitClick } }, this.injectData.buttonContent || this.defaultText)])
|
||||
}
|
||||
}
|
@ -60,7 +60,7 @@ const tableConfigs = [
|
||||
{ prop: 'name', name: '分组名称' },
|
||||
{ prop: 'code', name: '分组编码' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
{ prop: 'alarm', name: '报警', buttonContent: '查看报警', subcomponent: TableTextComponent },
|
||||
{ prop: 'alarm', name: '报警', buttonContent: '查看报警', subcomponent: TableTextComponent, actionName: 'view-alarm' },
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
@ -131,6 +131,17 @@ export default {
|
||||
},
|
||||
handleOperations({ type, data: id }) {
|
||||
switch (type) {
|
||||
case 'view-alarm':
|
||||
const {name, code} = this.dataList.find(item => item.id === id)
|
||||
this.$router.push({
|
||||
name: 'monitoring-equipmentGroupAlarm',
|
||||
params: {
|
||||
groupName: name,
|
||||
groupCode: code,
|
||||
id
|
||||
}
|
||||
})
|
||||
break
|
||||
case 'edit':
|
||||
return this.addOrUpdateHandle(id)
|
||||
case 'delete':
|
||||
|
@ -1,21 +1,24 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item label="设备分组名称"> <strong>111</strong></el-form-item>
|
||||
<el-form-item label="设备分组名称">
|
||||
<strong>{{ $route.params.groupName }}</strong></el-form-item
|
||||
>
|
||||
|
||||
<el-form-item label="设备分组编码">
|
||||
<strong>111</strong>
|
||||
<strong>{{ $route.params.groupCode }}</strong>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:equipmengroupalarm:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
<el-button v-if="$hasPermission('monitoring:equipmengroupalarm:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">
|
||||
批量删除
|
||||
</el-button>
|
||||
</el-form-item> -->
|
||||
<br />
|
||||
<el-form-item>
|
||||
<!-- <el-button @click="getDataList()">查询</el-button> -->
|
||||
<el-button v-if="$hasPermission('monitoring:equipmentgroupalarm:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
<!-- <el-button v-if="$hasPermission('monitoring:equipmentgroupalarm:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">
|
||||
批量删除
|
||||
</el-button> -->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
|
||||
@ -56,16 +59,24 @@
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
></el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './equipmentGroupAlarm-add-or-update'
|
||||
|
||||
// import AddOrUpdate from './equipmentGroupAlarm-add-or-update'
|
||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
import dictListMixin from '@/mixins/dictlist-module'
|
||||
// import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
// import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
// const alarmTypeDictId = '1557925215454814210'
|
||||
// const alarmLevelDictId = '1557925289517834242'
|
||||
const dictEntries = {
|
||||
alarmType: { value: '1557925215454814210', field: 'typeDictValue' }, // field 和下面 addOrUpdateConfigs 里对应
|
||||
alarmLevel: { value: '1557925289517834242', field: 'gradeDictValue' }
|
||||
}
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
@ -92,9 +103,28 @@ const tableConfigs = [
|
||||
// { prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/equipmentGroupAlarm',
|
||||
fields: [
|
||||
{ name: 'code', label: '报警编码', required: true },
|
||||
{ name: 'typeDictValue', label: '报警类型', type: 'select', options: [] },
|
||||
{ name: 'gradeDictValue', label: '报警级别', type: 'select', options: [] },
|
||||
{ name: 'alarmContent', label: '报警内容', required: true }
|
||||
],
|
||||
hideFields: [{ name: 'groupId', value: 'xx' }],
|
||||
operations: [
|
||||
{ name: 'cancel', showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/equipmentGroupAlarm', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/equipmentGroupAlarm', permission: '', showOnEdit: true }
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
mixins: [dictListMixin],
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateConfigs,
|
||||
tableConfigs,
|
||||
dataForm: {
|
||||
key: ''
|
||||
@ -113,9 +143,25 @@ export default {
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getDictData()
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取字典数据
|
||||
getDictData() {
|
||||
this.initDictList(Object.entries(dictEntries).map(([_, item]) => item.value))
|
||||
this.addOrUpdateConfigs.fields.forEach(item => {
|
||||
if (item.options && Array.isArray(item.options)) {
|
||||
let id
|
||||
Object.entries(dictEntries).forEach(([_, d]) => {
|
||||
if (d.field === item.name) {
|
||||
id = d.value
|
||||
}
|
||||
})
|
||||
item.options = this.dictList[id]
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
@ -125,7 +171,7 @@ export default {
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
groupId: this.$route.params.id
|
||||
})
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
|
@ -55,7 +55,7 @@ import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||
// import AddOrUpdate from './equipmentType-add-or-update'
|
||||
import BaseTable from '@/components/base-table'
|
||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
// import TableTextComponent from '@/components/base-table/components/detailComponent'
|
||||
|
||||
const tableConfigs = [
|
||||
{ prop: 'createTime', name: '添加时间' },
|
||||
@ -65,7 +65,18 @@ const tableConfigs = [
|
||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||
]
|
||||
|
||||
const addOrUpdateConfigs = {}
|
||||
const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/equipmentType',
|
||||
fields: [
|
||||
{ name: 'name', label: '设备类型名称' },
|
||||
{ name: 'code', label: '设备类型编码', api: '/monitoring/equipmentType/getCode' },
|
||||
{ name: 'parentId', label: '父类', type: 'tree' },
|
||||
'remark'
|
||||
],
|
||||
operations: [],
|
||||
extraComponents: null
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
|
Loading…
Reference in New Issue
Block a user