forked from mt-fe-group/mt-yd-ui
update 设备分组和设备分组报警
This commit is contained in:
parent
19730bb635
commit
04f19e82e3
@ -315,7 +315,9 @@ export default {
|
|||||||
/** 提取url */
|
/** 提取url */
|
||||||
const urls = {}
|
const urls = {}
|
||||||
this.configs.operations.map(item => {
|
this.configs.operations.map(item => {
|
||||||
urls[item.name] = item.url
|
urls[item.name] = {}
|
||||||
|
urls[item.name].url = item.url
|
||||||
|
urls[item.name].extraFields = item.extraFields || {}
|
||||||
})
|
})
|
||||||
/** 操作 */
|
/** 操作 */
|
||||||
switch (btn.name) {
|
switch (btn.name) {
|
||||||
@ -325,9 +327,9 @@ export default {
|
|||||||
this.$refs['dataForm'].validate(valid => {
|
this.$refs['dataForm'].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl(urls[btn.name]),
|
url: this.$http.adornUrl(urls[btn.name].url),
|
||||||
method: btn.name === 'save' ? 'POST' : 'PUT',
|
method: btn.name === 'save' ? 'POST' : 'PUT',
|
||||||
data: this.dataForm
|
data: { ...this.dataForm, ...urls[btn.name].extraFields}
|
||||||
})
|
})
|
||||||
.then(({ data: res }) => {
|
.then(({ data: res }) => {
|
||||||
if (res && res.code === 0) {
|
if (res && res.code === 0) {
|
||||||
|
@ -64,7 +64,16 @@ 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/equipmentGroup',
|
||||||
|
fields: [{ name: 'name', label: '分组名称' }, { name: 'code', label: '分组编码' }, 'remark'],
|
||||||
|
operations: [
|
||||||
|
{ name: 'cancel', showAlways: true },
|
||||||
|
{ name: 'save', url: '/monitoring/equipmentGroup', permission: '', showOnEdit: false },
|
||||||
|
{ name: 'update', url: '/monitoring/equipmentGroup', permission: '', showOnEdit: true }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table> -->
|
</el-table> -->
|
||||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
|
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||||
<el-pagination
|
<el-pagination
|
||||||
@size-change="sizeChangeHandle"
|
@size-change="sizeChangeHandle"
|
||||||
@current-change="currentChangeHandle"
|
@current-change="currentChangeHandle"
|
||||||
@ -68,7 +68,7 @@
|
|||||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
|
||||||
import BaseTable from '@/components/base-table'
|
import BaseTable from '@/components/base-table'
|
||||||
import dictListMixin from '@/mixins/dictlist-module'
|
import dictListMixin from '@/mixins/dictlist-module'
|
||||||
// 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 alarmTypeDictId = '1557925215454814210'
|
// const alarmTypeDictId = '1557925215454814210'
|
||||||
@ -83,7 +83,8 @@ const tableConfigs = [
|
|||||||
{ prop: 'code', name: '报警编码' },
|
{ prop: 'code', name: '报警编码' },
|
||||||
{ prop: 'typeDictValue', name: '报警类型' },
|
{ prop: 'typeDictValue', name: '报警类型' },
|
||||||
{ prop: 'gradeDictValue', name: '报警级别' },
|
{ prop: 'gradeDictValue', name: '报警级别' },
|
||||||
{ prop: 'alarmContent', name: '报警内容' }
|
{ prop: 'alarmContent', name: '报警内容' },
|
||||||
|
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
|
||||||
// { prop: 'typeDictValue', name: '报警类型 字典表关联label_value' },
|
// { prop: 'typeDictValue', name: '报警类型 字典表关联label_value' },
|
||||||
// { prop: 'gradeDictValue', name: '报警级别 字典表关联label_value' },
|
// { prop: 'gradeDictValue', name: '报警级别 字典表关联label_value' },
|
||||||
// { "prop": "id", "name": "ID" },
|
// { "prop": "id", "name": "ID" },
|
||||||
@ -112,11 +113,10 @@ const addOrUpdateConfigs = {
|
|||||||
{ name: 'gradeDictValue', label: '报警级别', type: 'select', options: [] },
|
{ name: 'gradeDictValue', label: '报警级别', type: 'select', options: [] },
|
||||||
{ name: 'alarmContent', label: '报警内容', required: true }
|
{ name: 'alarmContent', label: '报警内容', required: true }
|
||||||
],
|
],
|
||||||
hideFields: [{ name: 'groupId', value: 'xx' }],
|
|
||||||
operations: [
|
operations: [
|
||||||
{ name: 'cancel', showAlways: true },
|
{ name: 'cancel', showAlways: true },
|
||||||
{ name: 'save', url: '/monitoring/equipmentGroupAlarm', permission: '', showOnEdit: false },
|
{ name: 'save', url: '/monitoring/equipmentGroupAlarm', extraFields: { equipmentGroupId: null }, permission: '', showOnEdit: false },
|
||||||
{ name: 'update', url: '/monitoring/equipmentGroupAlarm', permission: '', showOnEdit: true }
|
{ name: 'update', url: '/monitoring/equipmentGroupAlarm', extraFields: { equipmentGroupId: null }, permission: '', showOnEdit: true }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,8 +199,21 @@ export default {
|
|||||||
selectionChangeHandle(val) {
|
selectionChangeHandle(val) {
|
||||||
this.dataListSelections = val
|
this.dataListSelections = val
|
||||||
},
|
},
|
||||||
|
handleOperations({ type, data: id }) {
|
||||||
|
switch (type) {
|
||||||
|
case 'edit':
|
||||||
|
return this.addOrUpdateHandle(id)
|
||||||
|
case 'delete':
|
||||||
|
return this.deleteHandle(id)
|
||||||
|
}
|
||||||
|
},
|
||||||
// 新增 / 修改
|
// 新增 / 修改
|
||||||
addOrUpdateHandle(id) {
|
addOrUpdateHandle(id) {
|
||||||
|
this.addOrUpdateConfigs.operations.forEach(item => {
|
||||||
|
if (item.extraFields) {
|
||||||
|
item.extraFields.equipmentGroupId = this.$route.params.id || null
|
||||||
|
}
|
||||||
|
})
|
||||||
this.addOrUpdateVisible = true
|
this.addOrUpdateVisible = true
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.addOrUpdate.init(id)
|
this.$refs.addOrUpdate.init(id)
|
||||||
|
Loading…
Reference in New Issue
Block a user