NEZ-610 fix: cabinet列表页面bug
This commit is contained in:
@@ -35,7 +35,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</nz-bottom-data-list>
|
</nz-bottom-data-list>
|
||||||
<transition name="right-box">
|
<transition name="right-box">
|
||||||
<cabinet-box v-if="rightBox.show" :current-dc="obj" :obj="object" ref="cabinetEditBox" @close="closeRightBox"></cabinet-box>
|
<cabinet-box v-if="rightBox.show" :current-dc="obj" :obj="object" ref="cabinetEditBox" v-has="'dc_add'" @close="closeRightBox"></cabinet-box>
|
||||||
</transition>
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -696,7 +696,7 @@ const en = {
|
|||||||
assets: 'Assets',
|
assets: 'Assets',
|
||||||
remark: 'Description',
|
remark: 'Description',
|
||||||
cabinets: 'Cabinets',
|
cabinets: 'Cabinets',
|
||||||
createDc: 'Nre data center',
|
createDc: 'New data center',
|
||||||
editDc: 'Edit data center',
|
editDc: 'Edit data center',
|
||||||
editCabinet: 'Edit cabinet',
|
editCabinet: 'Edit cabinet',
|
||||||
alert: 'Alert',
|
alert: 'Alert',
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
edit (u) {
|
edit (u) {
|
||||||
|
console.info(u)
|
||||||
this.$get(`${this.url}/${u.id}`).then(response => {
|
this.$get(`${this.url}/${u.id}`).then(response => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.object = response.data
|
this.object = response.data
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export default {
|
|||||||
tableOperation ([command, row, param]) {
|
tableOperation ([command, row, param]) {
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case 'edit': {
|
case 'edit': {
|
||||||
|
console.info(1, command, row)
|
||||||
this.$emit('edit', row)
|
this.$emit('edit', row)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,6 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--底部按钮-->
|
<!--底部按钮-->
|
||||||
<div class="right-box-bottom-btns">
|
<div class="right-box-bottom-btns">
|
||||||
<button v-cancel="{obj:editDc,func:esc}" id="dc-box-esc" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new">
|
<button v-cancel="{obj:editDc,func:esc}" id="dc-box-esc" class="nz-btn nz-btn-size-normal-new nz-btn-style-light-new">
|
||||||
@@ -71,7 +70,9 @@ export default {
|
|||||||
name: 'dcBox',
|
name: 'dcBox',
|
||||||
components: { latlngPicker },
|
components: { latlngPicker },
|
||||||
props: {
|
props: {
|
||||||
dc: Object,
|
obj: {
|
||||||
|
type: Object
|
||||||
|
},
|
||||||
userData: Array
|
userData: Array
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
@@ -89,6 +90,9 @@ export default {
|
|||||||
coordinateFlag: false
|
coordinateFlag: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
console.log(this.props)
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/* 关闭弹框 */
|
/* 关闭弹框 */
|
||||||
esc (refresh) {
|
esc (refresh) {
|
||||||
@@ -98,17 +102,16 @@ export default {
|
|||||||
clickOutside () {
|
clickOutside () {
|
||||||
this.esc(false)
|
this.esc(false)
|
||||||
},
|
},
|
||||||
/* 弹出选择area弹框 */
|
// /* 弹出选择area弹框 */
|
||||||
toSelectArea () {
|
// toSelectArea () {
|
||||||
this.$refs.selectArea.openBox(this.editDc.area)
|
// this.$refs.selectArea.openBox(this.editDc.area)
|
||||||
},
|
// },
|
||||||
|
|
||||||
/* 保存 */
|
/* 保存 */
|
||||||
save: function () {
|
save () {
|
||||||
if (this.prevent_opt.save) {
|
if (this.prevent_opt.save) {
|
||||||
return
|
return
|
||||||
}
|
};
|
||||||
;
|
|
||||||
this.prevent_opt.save = true
|
this.prevent_opt.save = true
|
||||||
this.$refs.dcForm.validate((valid) => {
|
this.$refs.dcForm.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
@@ -117,7 +120,8 @@ export default {
|
|||||||
const attr = this.$refs.latlngPicker.getAttribute()
|
const attr = this.$refs.latlngPicker.getAttribute()
|
||||||
param.latitude = attr.latitude
|
param.latitude = attr.latitude
|
||||||
param.longitude = attr.longitude
|
param.longitude = attr.longitude
|
||||||
this.$put('idc', param).then(response => {
|
this.$put('/dc', param).then(response => {
|
||||||
|
console.log('修改')
|
||||||
this.prevent_opt.save = false
|
this.prevent_opt.save = false
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
|
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
|
||||||
@@ -137,7 +141,8 @@ export default {
|
|||||||
if (!regNum.test(param.latitude)) {
|
if (!regNum.test(param.latitude)) {
|
||||||
param.latitude = null
|
param.latitude = null
|
||||||
}
|
}
|
||||||
this.$post('idc', param).then(response => {
|
this.$post('/dc', param).then(response => {
|
||||||
|
console.log('成功')
|
||||||
this.prevent_opt.save = false
|
this.prevent_opt.save = false
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
|
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
|
||||||
@@ -162,7 +167,7 @@ export default {
|
|||||||
cancelButtonText: this.$t('tip.no'),
|
cancelButtonText: this.$t('tip.no'),
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.$delete('idc?ids=' + this.editDc.id).then(response => {
|
this.$delete('/dc' + this.editDc.id).then(response => {
|
||||||
this.prevent_opt.save = false
|
this.prevent_opt.save = false
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.deleteSuccess') })
|
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.deleteSuccess') })
|
||||||
@@ -198,13 +203,15 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
// this.getAreaData();
|
// this.getAreaData();
|
||||||
|
// console.log(this.editDc)
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
dc: {
|
obj: {
|
||||||
immediate: true,
|
immediate: true,
|
||||||
deep: true,
|
deep: true,
|
||||||
handler (n, o) {
|
handler (n, o) {
|
||||||
this.editDc = JSON.parse(JSON.stringify(n))
|
this.editDc = JSON.parse(JSON.stringify(n))
|
||||||
|
console.info(this.editDc)
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.latlngPicker.setLnglat(this.editDc.latitude, this.editDc.longitude)
|
this.$refs.latlngPicker.setLnglat(this.editDc.latitude, this.editDc.longitude)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -17,43 +17,19 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
:resizable="true"
|
:resizable="true"
|
||||||
v-for="(item, index) in tableTitle"
|
v-for="(item, index) in customTableTitle"
|
||||||
v-if="item.show"
|
v-if="item.show"
|
||||||
:key="`col-${index}`"
|
:key="`col-${index}`"
|
||||||
:label="item.label"
|
:label="item.label">
|
||||||
>
|
|
||||||
<template slot-scope="scope" :column="item">
|
<template slot-scope="scope" :column="item">
|
||||||
<template v-if="item.prop == 'assetStat'">
|
<template v-if="item.prop === 'assetNum'">
|
||||||
<el-popover
|
<span style="cursor: pointer"><i class="nz-icon nz-icon-overview-project monitorColor"></i> <span>{{scope.row.assetNum ? scope.row.assetNum : 0}}</span></span>
|
||||||
placement="top-start"
|
</template>
|
||||||
offset="-100"
|
<template v-else-if="item.prop === 'alertNum'">
|
||||||
trigger="hover"
|
<span style="cursor: pointer"><i :class="scope.row.alertNum ? 'red' : 'green'" class="nz-icon nz-icon-overview-alert"></i> <span>{{scope.row.alertNum ? scope.row.alertNum : 0}}</span></span>
|
||||||
:content="$t('overall.result.total') + ':' + scope.row.assetStat.total + ',' + $t('asset.inStock') + ':' + scope.row.assetStat.inStock + ',' + $t('asset.notInStock') + ':' + scope.row.assetStat.outStock + ',' + $t('asset.suspended') + ':' + scope.row.assetStat.suspended">
|
</template>
|
||||||
<div slot="reference" class="dc-asset-states">
|
|
||||||
<span class="dc-asset-state dc-asset-state-total">{{scope.row.assetStat.total}}</span>
|
|
||||||
<span class="dc-asset-state dc-asset-state-in">{{scope.row.assetStat.inStock}}</span>
|
|
||||||
<span class="dc-asset-state dc-asset-state-out">{{scope.row.assetStat.outStock}}</span>
|
|
||||||
<span class="dc-asset-state dc-asset-state-suspended">{{scope.row.assetStat.suspended}}</span>
|
|
||||||
</div>
|
|
||||||
</el-popover>
|
|
||||||
|
|
||||||
</template >
|
|
||||||
<template v-else-if="item.prop == 'alertStat'">
|
|
||||||
<el-popover
|
|
||||||
placement="top-start"
|
|
||||||
offset="-128"
|
|
||||||
trigger="hover"
|
|
||||||
:content="$t('overall.result.total') + ':' + scope.row.alertStat.total + ',' + $t('alert.config.P1') + ':' + scope.row.alertStat.P1 + ',' + $t('alert.config.P2') + ':' + scope.row.alertStat.P2+ ',' + $t('alert.config.P3') + ':' + scope.row.alertStat.P3">
|
|
||||||
<div slot="reference" class="dc-asset-states">
|
|
||||||
<span class="dc-asset-state dc-asset-state-total">{{scope.row.alertStat.total}}</span>
|
|
||||||
<span class="dc-asset-state alert-level-P1">{{scope.row.alertStat.P1}}</span>
|
|
||||||
<span class="dc-asset-state alert-level-P2">{{scope.row.alertStat.P2}}</span>
|
|
||||||
<span class="dc-asset-state alert-level-P3">{{scope.row.alertStat.P3}}</span>
|
|
||||||
</div>
|
|
||||||
</el-popover>
|
|
||||||
</template >
|
|
||||||
<template v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</template>
|
<template v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</template>
|
||||||
<template v-else>-</template>
|
<template v-else="scope.row[item.prop]">-</template>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
@@ -62,13 +38,13 @@
|
|||||||
fixed="right">
|
fixed="right">
|
||||||
<div slot="header" class="table-operation-title">{{$t('overall.option')}}</div>
|
<div slot="header" class="table-operation-title">{{$t('overall.option')}}</div>
|
||||||
<div slot-scope="scope" class="table-operation-items">
|
<div slot-scope="scope" class="table-operation-items">
|
||||||
<button class="table-operation-item" @click="tableOperation(['edit', scope.row])"><i class="nz-icon nz-icon-edit"></i></button>
|
<button class="table-operation-item" v-has="'dc_edit'" @click="tableOperation(['edit', scope.row])"><i class="nz-icon nz-icon-edit"></i></button>
|
||||||
<el-dropdown size="medium" trigger="hover" @command="tableOperation">
|
<el-dropdown size="medium" trigger="hover" @command="tableOperation">
|
||||||
<div class="table-operation-item table-operation-item--more">
|
<div class="table-operation-item table-operation-item--more">
|
||||||
<span>…</span><i class="nz-icon nz-icon-arrow-down"></i>
|
<span>…</span><i class="nz-icon nz-icon-arrow-down"></i>
|
||||||
</div>
|
</div>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item :command="['delete', scope.row]" :disabled="isBuiltIn(scope.row)"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
<el-dropdown-item :command="['delete', scope.row]" v-has="'dc_delete'" :disabled="isBuiltIn(scope.row)"><i class="nz-icon nz-icon-delete"></i><span class="operation-dropdown-text">{{$t('overall.delete')}}</span></el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</div>
|
</div>
|
||||||
@@ -78,8 +54,10 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import table from '@/components/common/mixin/table'
|
import table from '@/components/common/mixin/table'
|
||||||
|
import Template from "../../../page/config/template";
|
||||||
export default {
|
export default {
|
||||||
name: 'cabinet Table',
|
name: 'cabinet Table',
|
||||||
|
components: {Template},
|
||||||
mixins: [table],
|
mixins: [table],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
@@ -102,12 +80,12 @@ export default {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.$t('config.dc.assets'),
|
label: this.$t('config.dc.assets'),
|
||||||
prop: 'assetStat',
|
prop: 'assetNum',
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.$t('alert.alert'),
|
label: this.$t('alert.alert'),
|
||||||
prop: 'alertStat',
|
prop: 'alertNum',
|
||||||
show: true
|
show: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -117,10 +95,18 @@ export default {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.colorEF7458{
|
||||||
|
color: #EF7458;
|
||||||
|
}
|
||||||
|
.color23BF9A{
|
||||||
|
color: #23BF9A;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -116,11 +116,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -37,12 +37,8 @@
|
|||||||
</template>
|
</template>
|
||||||
</nz-data-list>
|
</nz-data-list>
|
||||||
<transition name="right-box">
|
<transition name="right-box">
|
||||||
<dc-box v-if="rightBox.dc.show" :dc="object" :user-data="userData" @close="closeDcBox" @reload="getTableData"></dc-box>
|
<dc-box v-if="rightBox.show" :obj="object" :user-data="userData" @close="closeRightBox" @reload="getTableData"></dc-box>
|
||||||
</transition>
|
</transition>
|
||||||
<transition name="right-box">
|
|
||||||
<traffic-setting-box v-if="rightBox.trafficSetting.show" ref="trafficBox" :dc="object" @close="closeTrafficBox"></traffic-setting-box>
|
|
||||||
</transition>
|
|
||||||
<span v-if="dcDataRefresh" style="display: none"></span>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@@ -77,10 +73,6 @@ export default {
|
|||||||
longitude: undefined,
|
longitude: undefined,
|
||||||
latitude: undefined
|
latitude: undefined
|
||||||
},
|
},
|
||||||
rightBox: {
|
|
||||||
dc: { show: false },
|
|
||||||
trafficSetting: { show: false }
|
|
||||||
},
|
|
||||||
searchMsg: { // 给搜索框子组件传递的信息
|
searchMsg: { // 给搜索框子组件传递的信息
|
||||||
zheze_none: true,
|
zheze_none: true,
|
||||||
searchLabelList: [
|
searchLabelList: [
|
||||||
@@ -111,66 +103,12 @@ export default {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
regNum: /^[0-9]+.?[0-9]*/,
|
regNum: /^[0-9]+.?[0-9]*/,
|
||||||
tabShow: 1, // 控制显示一级页面和二级页面 1 dc 2cabinet
|
|
||||||
userData: []
|
userData: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
dcDataRefresh () { // 通过vuex更新dc 需要该属性到页面 否则不被监听
|
|
||||||
if (this.$store.getters.getDcDataRefresh) {
|
|
||||||
this.getTableData()
|
|
||||||
}
|
|
||||||
return this.$store.getters.getDcDataRefresh
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
assetStatClassName (param) {
|
statusChange (dc) {
|
||||||
if (param.column.label == this.$t('config.dc.assets')) {
|
this.$put(this.url, dc).then(response => {
|
||||||
return 'asset-state'
|
|
||||||
}
|
|
||||||
return ''
|
|
||||||
},
|
|
||||||
edit (u) {
|
|
||||||
this.dc = JSON.parse(JSON.stringify(u))
|
|
||||||
if (!this.regNum.test(this.dc.longitude)) {
|
|
||||||
this.dc.longitude = undefined
|
|
||||||
}
|
|
||||||
if (!this.regNum.test(this.dc.latitude)) {
|
|
||||||
this.dc.latitude = undefined
|
|
||||||
}
|
|
||||||
if (!this.dc.area) {
|
|
||||||
this.$set(this.dc, 'area', { id: '', name: '' })
|
|
||||||
}
|
|
||||||
this.rightBox.dc.show = true
|
|
||||||
},
|
|
||||||
detail (u) {
|
|
||||||
this.bottomBox.object = JSON.parse(JSON.stringify(u))
|
|
||||||
if (!this.bottomBox.object.area) {
|
|
||||||
this.$set(this.bottomBox.object, 'area', { id: '', name: '' })
|
|
||||||
}
|
|
||||||
this.bottomBox.targetTab = 'detail'
|
|
||||||
this.bottomBox.showSubList = true
|
|
||||||
},
|
|
||||||
add () {
|
|
||||||
this.object = this.newObject()
|
|
||||||
this.rightBox.dc.show = true
|
|
||||||
},
|
|
||||||
closeDcBox (refresh) {
|
|
||||||
this.rightBox.dc.show = false
|
|
||||||
if (refresh) {
|
|
||||||
this.delFlag = true
|
|
||||||
this.getTableData()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
closeTrafficBox (refresh) {
|
|
||||||
this.rightBox.trafficSetting.show = false
|
|
||||||
if (refresh) {
|
|
||||||
this.delFlag = true
|
|
||||||
this.getTableData()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
statusChange (idc) {
|
|
||||||
this.$put('dc', idc).then(response => {
|
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.rightBox.show = false
|
this.rightBox.show = false
|
||||||
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
|
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
|
||||||
@@ -192,16 +130,8 @@ export default {
|
|||||||
},
|
},
|
||||||
regNumTest (val) { // 校验是否是数字
|
regNumTest (val) { // 校验是否是数字
|
||||||
return this.regNum.test(val)
|
return this.regNum.test(val)
|
||||||
},
|
|
||||||
initEvent () {
|
|
||||||
bus.$on('dc-list-change', () => {
|
|
||||||
this.getTableData()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
|
||||||
bus.$off('dc-list-change')
|
|
||||||
},
|
|
||||||
mounted () {
|
mounted () {
|
||||||
this.getUserData()
|
this.getUserData()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user