update 设备分组和设备分组报警

This commit is contained in:
g7hoo 2022-08-12 13:45:34 +08:00
parent 19730bb635
commit 04f19e82e3
3 ha cambiato i file con 35 aggiunte e 11 eliminazioni

Vedi File

@ -315,7 +315,9 @@ export default {
/** 提取url */
const urls = {}
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) {
@ -325,9 +327,9 @@ export default {
this.$refs['dataForm'].validate(valid => {
if (valid) {
this.$http({
url: this.$http.adornUrl(urls[btn.name]),
url: this.$http.adornUrl(urls[btn.name].url),
method: btn.name === 'save' ? 'POST' : 'PUT',
data: this.dataForm
data: { ...this.dataForm, ...urls[btn.name].extraFields}
})
.then(({ data: res }) => {
if (res && res.code === 0) {

Vedi File

@ -64,7 +64,16 @@ const tableConfigs = [
{ 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 {
data() {
@ -132,7 +141,7 @@ export default {
handleOperations({ type, data: id }) {
switch (type) {
case 'view-alarm':
const {name, code} = this.dataList.find(item => item.id === id)
const { name, code } = this.dataList.find(item => item.id === id)
this.$router.push({
name: 'monitoring-equipmentGroupAlarm',
params: {

Vedi File

@ -48,7 +48,7 @@
</template>
</el-table-column>
</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
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
@ -68,7 +68,7 @@
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
import BaseTable from '@/components/base-table'
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'
// const alarmTypeDictId = '1557925215454814210'
@ -83,7 +83,8 @@ const tableConfigs = [
{ prop: 'code', name: '报警编码' },
{ prop: 'typeDictValue', 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: 'gradeDictValue', name: ' label_value' },
// { "prop": "id", "name": "ID" },
@ -112,11 +113,10 @@ const addOrUpdateConfigs = {
{ 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 }
{ name: 'save', url: '/monitoring/equipmentGroupAlarm', extraFields: { equipmentGroupId: null }, permission: '', showOnEdit: false },
{ name: 'update', url: '/monitoring/equipmentGroupAlarm', extraFields: { equipmentGroupId: null }, permission: '', showOnEdit: true }
]
}
@ -199,8 +199,21 @@ export default {
selectionChangeHandle(val) {
this.dataListSelections = val
},
handleOperations({ type, data: id }) {
switch (type) {
case 'edit':
return this.addOrUpdateHandle(id)
case 'delete':
return this.deleteHandle(id)
}
},
// /
addOrUpdateHandle(id) {
this.addOrUpdateConfigs.operations.forEach(item => {
if (item.extraFields) {
item.extraFields.equipmentGroupId = this.$route.params.id || null
}
})
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)