fzq #31
@ -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) {
|
||||
|
@ -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() {
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user