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-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">
|
<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
|
<el-form-item
|
||||||
v-if="configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]"
|
v-if="configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]"
|
||||||
:prop="configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name"
|
:prop="configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name"
|
||||||
@ -394,4 +395,8 @@ export default {
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background: #ccc;
|
background: #ccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.super-flexible-dialog >>> .hidden-input {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -22,13 +22,15 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
emitClick() {
|
emitClick() {
|
||||||
this.$emit('emitData', {
|
console.log('inject data:' ,this.injectData)
|
||||||
action: this.injectData.actionName || 'view-detail-action',
|
this.$emit('emit-data', {
|
||||||
data: this.injectData.emitFullData ? this.injectData : { id: this.injectData.id }
|
type: this.injectData.head?.actionName || 'view-detail-action',
|
||||||
|
data: this.injectData.head?.emitFullData ? this.injectData : this.injectData.id
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render: function (h) {
|
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: 'name', name: '分组名称' },
|
||||||
{ prop: 'code', name: '分组编码' },
|
{ prop: 'code', name: '分组编码' },
|
||||||
{ prop: 'remark', 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'] }
|
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -131,6 +131,17 @@ export default {
|
|||||||
},
|
},
|
||||||
handleOperations({ type, data: id }) {
|
handleOperations({ type, data: id }) {
|
||||||
switch (type) {
|
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':
|
case 'edit':
|
||||||
return this.addOrUpdateHandle(id)
|
return this.addOrUpdateHandle(id)
|
||||||
case 'delete':
|
case 'delete':
|
||||||
|
@ -1,21 +1,24 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="mod-config">
|
<div class="mod-config">
|
||||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
<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="设备分组编码">
|
<el-form-item label="设备分组编码">
|
||||||
<strong>111</strong>
|
<strong>{{ $route.params.groupCode }}</strong>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item>
|
<!-- <el-form-item>
|
||||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
<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> -->
|
</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-form>
|
||||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
<!-- <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>
|
<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"
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
></el-pagination>
|
></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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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 BaseTable from '@/components/base-table'
|
||||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
import dictListMixin from '@/mixins/dictlist-module'
|
||||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
|
// 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 = [
|
const tableConfigs = [
|
||||||
{ prop: 'createTime', name: '添加时间' },
|
{ prop: 'createTime', name: '添加时间' },
|
||||||
@ -92,9 +103,28 @@ const tableConfigs = [
|
|||||||
// { prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
// { 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 {
|
export default {
|
||||||
|
mixins: [dictListMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
addOrUpdateConfigs,
|
||||||
tableConfigs,
|
tableConfigs,
|
||||||
dataForm: {
|
dataForm: {
|
||||||
key: ''
|
key: ''
|
||||||
@ -113,9 +143,25 @@ export default {
|
|||||||
BaseTable
|
BaseTable
|
||||||
},
|
},
|
||||||
activated() {
|
activated() {
|
||||||
|
this.getDictData()
|
||||||
this.getDataList()
|
this.getDataList()
|
||||||
},
|
},
|
||||||
methods: {
|
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() {
|
getDataList() {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
@ -125,7 +171,7 @@ export default {
|
|||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
page: this.pageIndex,
|
page: this.pageIndex,
|
||||||
limit: this.pageSize,
|
limit: this.pageSize,
|
||||||
key: this.dataForm.key
|
groupId: this.$route.params.id
|
||||||
})
|
})
|
||||||
}).then(({ data }) => {
|
}).then(({ data }) => {
|
||||||
if (data && data.code === 0) {
|
if (data && data.code === 0) {
|
||||||
|
@ -55,7 +55,7 @@ import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
|||||||
// import AddOrUpdate from './equipmentType-add-or-update'
|
// import AddOrUpdate from './equipmentType-add-or-update'
|
||||||
import BaseTable from '@/components/base-table'
|
import BaseTable from '@/components/base-table'
|
||||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
|
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 = [
|
const tableConfigs = [
|
||||||
{ prop: 'createTime', name: '添加时间' },
|
{ prop: 'createTime', name: '添加时间' },
|
||||||
@ -65,7 +65,18 @@ const tableConfigs = [
|
|||||||
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
{ 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 {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
|
Loading…
Reference in New Issue
Block a user