160160<script >
161161import _ from ' lodash'
162162import { deleteDevice } from ' @/modules/cmdb/api/dcim.js'
163+ import { U_NUMBERING_DIRECTION } from ' ../../../constants.js'
163164
164165import RackHeader from ' ./rackHeader/index.vue'
165166import draggable from ' vuedraggable'
@@ -187,9 +188,9 @@ export default {
187188 type: Array ,
188189 default : () => []
189190 },
190- rackId : {
191- type: Number ,
192- default: 0
191+ rackData : {
192+ type: Object ,
193+ default : () => {}
193194 }
194195 },
195196 data () {
@@ -213,8 +214,14 @@ export default {
213214 const sliceUnitList = this .unitList .slice (0 , index)
214215 const unitCount = sliceUnitList .reduce ((acc , cur ) => acc + cur .unitCount , 0 )
215216
217+ const u_numbering_direction = this ? .rackData ? .u_numbering_direction
218+ let unitStart = this .countList .length - unitCount
219+ if (u_numbering_direction === U_NUMBERING_DIRECTION .TOP_TO_BOTTOM ) {
220+ unitStart = unitCount + 1
221+ }
222+
216223 this .$emit (' openDeviceForm' , {
217- unitStart: this . countList . length - unitCount
224+ unitStart
218225 })
219226 },
220227
@@ -283,10 +290,11 @@ export default {
283290 title: this .$t (' warning' ),
284291 content,
285292 onOk : () => {
286- deleteDevice (
287- this .rackId ,
288- data .id
289- ).then (() => {
293+ if (! this .rackData ._id ) {
294+ return
295+ }
296+
297+ deleteDevice (this .rackData ._id , data .id ).then (() => {
290298 this .$message .success (this .$t (' deleteSuccess' ))
291299 this .$emit (' refreshRackAllData' )
292300 })
@@ -383,6 +391,7 @@ export default {
383391 background: linear- gradient (90deg , rgba (0 , 0 , 0 , 0.80 ) 0 % , rgba (102 , 102 , 102 , 0.80 ) 100 % );
384392 align- items: center;
385393 justify- content: center;
394+ z- index: 1 ;
386395
387396 & - btn {
388397 font- size: 14px ;
0 commit comments