forked from mt-fe-group/mt-yd-ui
update 设备类型
This commit is contained in:
@@ -71,10 +71,14 @@ const addOrUpdateConfigs = {
|
||||
fields: [
|
||||
{ name: 'name', label: '设备类型名称' },
|
||||
{ name: 'code', label: '设备类型编码', api: '/monitoring/equipmentType/getCode' },
|
||||
{ name: 'parentId', label: '父类', type: 'tree' },
|
||||
{ name: 'parentId', label: '父类', type: 'cascader', props: { label: 'name', value: 'id', checkStrictly: true, emitPath: false }, options: [] },
|
||||
'remark'
|
||||
],
|
||||
operations: [],
|
||||
operations: [
|
||||
{ name: 'cancel', showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/equipmentType', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/equipmentType', permission: '', showOnEdit: true }
|
||||
],
|
||||
extraComponents: null
|
||||
}
|
||||
|
||||
@@ -100,9 +104,23 @@ export default {
|
||||
BaseTable
|
||||
},
|
||||
activated() {
|
||||
this.getTreeEquipmentType()
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取设备类型树形数据
|
||||
getTreeEquipmentType() {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentType/getTree'),
|
||||
method: 'post'
|
||||
}).then(({ data: res }) => {
|
||||
if (res && res.code === 0 && res.data.length) {
|
||||
this.addOrUpdateConfigs.fields.find(item => item.name === 'parentId').options = res.data
|
||||
} else {
|
||||
this.addOrUpdateConfigs.fields.find(item => item.name === 'parentId').options.splice(0)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.addOrUpdateVisible = false
|
||||
@@ -151,6 +169,8 @@ export default {
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle(id) {
|
||||
// 更新树形结构
|
||||
this.getTreeEquipmentType()
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
|
||||
Reference in New Issue
Block a user