NEZ-1833 feat : asset 新增修改页面 Type & model 调整
This commit is contained in:
@@ -51,7 +51,11 @@
|
|||||||
<el-input maxlength="128" show-word-limit v-model="editAsset.number" size="small"/>
|
<el-input maxlength="128" show-word-limit v-model="editAsset.number" size="small"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('asset.brandAndModel')" class="placeholder-emphasize" prop="brandAndModel">
|
<el-form-item :label="$t('asset.brandAndModel')" class="placeholder-emphasize" prop="brandAndModel">
|
||||||
<el-cascader
|
<div @click="judgeType">
|
||||||
|
<el-cascader
|
||||||
|
ref="cascader"
|
||||||
|
:clearable="true"
|
||||||
|
:disabled="judgeTypes"
|
||||||
v-model="editAsset.brandAndModel"
|
v-model="editAsset.brandAndModel"
|
||||||
:placeholder="lockModelInputValue"
|
:placeholder="lockModelInputValue"
|
||||||
:options="options.brandAndModelOptions"
|
:options="options.brandAndModelOptions"
|
||||||
@@ -60,6 +64,7 @@
|
|||||||
size="small"
|
size="small"
|
||||||
style="width: 100%;"
|
style="width: 100%;"
|
||||||
></el-cascader>
|
></el-cascader>
|
||||||
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('asset.location')" prop="location" class="is-required">
|
<el-form-item :label="$t('asset.location')" prop="location" class="is-required">
|
||||||
<location-cascader v-if="!vmLock" ref="locationCascader" :dc-option="options.dcOptions" :default-model-u-size="1" @change="setLocationData"></location-cascader>
|
<location-cascader v-if="!vmLock" ref="locationCascader" :dc-option="options.dcOptions" :default-model-u-size="1" @change="setLocationData"></location-cascader>
|
||||||
@@ -327,6 +332,7 @@ export default {
|
|||||||
const vm = this
|
const vm = this
|
||||||
return {
|
return {
|
||||||
assetConstants,
|
assetConstants,
|
||||||
|
judgeTypes: true,
|
||||||
showAllTalonOption: false,
|
showAllTalonOption: false,
|
||||||
showAddressOption: true,
|
showAddressOption: true,
|
||||||
talonShowTow: true,
|
talonShowTow: true,
|
||||||
@@ -546,6 +552,17 @@ export default {
|
|||||||
this.getFieldGroupData()
|
this.getFieldGroupData()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
judgeType () {
|
||||||
|
if (!this.editAsset.type.name) {
|
||||||
|
this.$message({
|
||||||
|
type: 'error',
|
||||||
|
message: '请先选择Type值'
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
this.judgeTypes = false
|
||||||
|
}
|
||||||
|
},
|
||||||
clickOutside () {
|
clickOutside () {
|
||||||
this.esc(false)
|
this.esc(false)
|
||||||
},
|
},
|
||||||
@@ -629,6 +646,10 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
selectType (type) {
|
selectType (type) {
|
||||||
|
this.$refs.cascader.$refs.panel.clearCheckedNodes()
|
||||||
|
this.$refs.cascader.$refs.panel.activePath = []
|
||||||
|
this.editAsset.brandAndModel = ''
|
||||||
|
this.lockModelInputValue = ''
|
||||||
this.editAsset.type = { ...type }
|
this.editAsset.type = { ...type }
|
||||||
this.editAsset.typeId = type.id ? type.id : ''
|
this.editAsset.typeId = type.id ? type.id : ''
|
||||||
this.editAsset.authType = ''
|
this.editAsset.authType = ''
|
||||||
@@ -639,6 +660,7 @@ export default {
|
|||||||
this.editAsset.snmpCredentialId = ''
|
this.editAsset.snmpCredentialId = ''
|
||||||
this.editAsset.authProtocolPort = ''
|
this.editAsset.authProtocolPort = ''
|
||||||
this.editAsset.pid = ''
|
this.editAsset.pid = ''
|
||||||
|
this.getModelData()
|
||||||
},
|
},
|
||||||
addLabel ([groupId, metaId]) {
|
addLabel ([groupId, metaId]) {
|
||||||
const label = this.options.metaOptions.find(m => m.id === metaId)
|
const label = this.options.metaOptions.find(m => m.id === metaId)
|
||||||
@@ -798,7 +820,7 @@ export default {
|
|||||||
},
|
},
|
||||||
getModelData () {
|
getModelData () {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
this.$get('asset/model?pageSize=-1').then(response => {
|
this.$get('asset/model?pageSize=-1&typeIds=' + this.editAsset.typeId).then(response => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.options.modelOptions = response.data.list
|
this.options.modelOptions = response.data.list
|
||||||
const titleSearchData = {}
|
const titleSearchData = {}
|
||||||
@@ -810,6 +832,11 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.options.brandAndModelOptions = Object.keys(titleSearchData).map(b => titleSearchData[b])
|
this.options.brandAndModelOptions = Object.keys(titleSearchData).map(b => titleSearchData[b])
|
||||||
|
if (!this.editAsset.type.name) {
|
||||||
|
this.judgeTypes = true
|
||||||
|
} else {
|
||||||
|
this.judgeTypes = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user