topologyPopMgmt.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <div class="ne--topology--pop">
  3. <div class="v-common-dialog-wrapper custom-dialog">
  4. <div class="modal-tit">NE Topology</div>
  5. <div class="v-common-dialog-content">
  6. <div class="dialog-tree">
  7. <div class="tree-area">
  8. <div class="tree-depth1">
  9. <ul>
  10. <li class="depth1-item" v-for="(tenant, index) in myTreeView" :key="index">
  11. <div class="depth-item-tit depth1-item-tit" :class="[tenant.fold ? '' : 'down']">
  12. <button class="arr" :class="[tenant.neGroupList.length == 0 ? 'nor' : '']" @click="tenant.neGroupList.length > 0 && (tenant.fold = !tenant.fold)"></button>
  13. <i class="ico"></i>
  14. <strong>{{ tenant.tenantName }}{{tenant.neGroupList.length > 0 ? '('+tenant.neGroupList.length+')': ''}}</strong>
  15. <!-- <button class="btn-tree btn-add" @click="addTree2(tenant, index)"></button> -->
  16. </div>
  17. <div class="tree-depth2" v-if="tenant.fold">
  18. <ul>
  19. <!-- <li class="depth2-item" v-if="tenant.add">
  20. <div class="depth-item-tit depth2-item-tit depth-item-reg">
  21. <button class="arr"></button>
  22. <i class="ico"></i>
  23. <v-text-field
  24. class="custom-input mini"
  25. placeholder=""
  26. v-model="addGroupTitle"
  27. ></v-text-field>
  28. <button class="btn-tree btn-save" @click="saveTree2(tenant)"></button>
  29. </div>
  30. </li> -->
  31. <li class="depth2-item" v-for="(neGroup, index2) in tenant.neGroupList" :key="index2">
  32. <div class="depth-item-tit depth2-item-tit" :class="[neGroup.fold ? '' : 'down']">
  33. <button class="arr" @click="neGroup.fold = !neGroup.fold"></button>
  34. <i class="ico"></i>
  35. <div class="middle-group">{{ neGroup.neGroup }}{{neGroup.neList.length > 0 ? '('+neGroup.neList.length+')': ''}}</div>
  36. <!-- <v-checkbox
  37. class="custom-check type2"
  38. hide-details
  39. v-model="neGroup.isAllCheck"
  40. @update:modelValue="fnAllCheck($event, neGroup)">
  41. <template v-slot:label>{{neGroup.neGroup}}{{neGroup.neList.length > 0 ? '('+neGroup.neList.length+')': ''}}</template>
  42. </v-checkbox> -->
  43. <!-- <button class="btn-ne-add" @click="neRegPop = true"><i class="plus"></i>NE</button>
  44. <button class="btn-tree btn-pos"></button> -->
  45. </div>
  46. <div class="tree-depth3" v-if="neGroup.fold">
  47. <ul>
  48. <li class="depth3-item" v-for="(ne, index3) in neGroup.neList" :key="index3">
  49. <div class="depth-item-tit depth3-item-tit">
  50. <i class="ico" :class="getNeType(ne.neType)"></i>
  51. <v-checkbox
  52. class="custom-check type2"
  53. hide-details
  54. v-model="selectItem"
  55. :value="tenant.tenantName+' '+neGroup.neGroup+' '+ne.neName+' '+ne.neType"
  56. :id="neGroup.neGroup+ne.neName"
  57. ><!--@update:modelValue="fnCheckNeBox($event, neGroup)"-->
  58. <template v-slot:label v-if="ne.modify == false">{{ ne.neName }}</template>
  59. </v-checkbox>
  60. </div>
  61. </li>
  62. </ul>
  63. </div>
  64. </li>
  65. </ul>
  66. </div>
  67. </li>
  68. </ul>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. <div class="btn-wrap">
  74. <v-btn
  75. class="custom-btn btn-white mini"
  76. @click="$emit('closePop')"
  77. >
  78. 취소
  79. </v-btn>
  80. <v-btn
  81. class="custom-btn btn-blue mini"
  82. @click="fnSave"
  83. >
  84. 선택
  85. </v-btn>
  86. </div>
  87. </div>
  88. </div>
  89. </template>
  90. <script setup>
  91. /***********************
  92. * import
  93. ************************/
  94. import { useI18n } from "vue-i18n"
  95. import useUtil from "@/composables/useUtil"
  96. import useValid from "@/composables/useValid"
  97. /***********************
  98. * plugins inject
  99. ************************/
  100. const { $toast, $log, $dayjs, $eventBus } = useNuxtApp();
  101. // props
  102. const props = defineProps({
  103. isTopologyPop: Boolean,
  104. })
  105. // 참조가능 데이터 설정
  106. defineExpose({
  107. fnInit,
  108. })
  109. // 발신 이벤트 선언
  110. const emit = defineEmits(["closePop", "selectTarget"])
  111. /***********************
  112. * data & created
  113. ************************/
  114. const coreList = ['AMF', 'SMF', 'UDC', 'MEC', 'UPF']
  115. const ranList = ['CU', 'DU', 'RU', 'AU']
  116. const myTreeView = ref([])
  117. const selectItem = ref('')
  118. const userLevel = ref('')
  119. const userTenant = ref('')
  120. /***********************
  121. * Watch & computed
  122. ************************/
  123. const getNeType = computed(() => {
  124. return (val) => {
  125. if(!useUtil.isNull(val)) {
  126. if(coreList.includes(val)) return 'core'
  127. else if(ranList.includes(val)) return 'ran'
  128. }else return ''
  129. }
  130. })
  131. /***********************
  132. * Methods
  133. ************************/
  134. onMounted(() =>{
  135. userTenant.value = useAuthStore().getTenantName
  136. userLevel.value = useAuthStore().getAccountLevel
  137. fnInit()
  138. })
  139. function fnInit(){
  140. fnGetNeTopology()
  141. }
  142. /**
  143. * NE Topology 트리뷰 데이터 조회
  144. */
  145. function fnGetNeTopology(){
  146. useAxios().post(useApi.getTopology).then((res) => {
  147. $log.debug("[neMgmt][fnGetNeTopology][success]")
  148. let list = res.data.data
  149. let temp = []
  150. list.forEach((item, idx) => {
  151. let depth1 = {}
  152. depth1.tenantName = item.tenantName
  153. depth1.fold = true
  154. depth1.neGroupList = []
  155. if(item.neGroupList){
  156. item.neGroupList.forEach((neGroup, idx2) => {
  157. let depth2 = {}
  158. depth2.neGroup = neGroup.neGroup
  159. depth2.fold = true
  160. depth2.add = false
  161. depth2.neList = []
  162. depth2.isAllCheck = false
  163. depth2.selectNeList = []
  164. if(neGroup.neList && neGroup.neList.length > 0){
  165. neGroup.neList.forEach((ne, idx3)=> {
  166. let depth3 = {}
  167. depth3.neName = ne.neName
  168. depth3.neId = ne.neId
  169. depth3.neType = ne.neType
  170. depth3.upfNum = ne.upfNum
  171. depth3.customerType = ne.customerType
  172. depth3.modify = false
  173. depth2.neList.push(depth3)
  174. })
  175. if(depth2.neList.length > 0){
  176. depth1.neGroupList.push(depth2)
  177. }
  178. }
  179. })
  180. }
  181. if(userLevel.value == 0 || userLevel.value == -1){
  182. if(depth1.neGroupList.length > 0){
  183. temp.push(depth1)
  184. }
  185. } else{
  186. if(depth1.neGroupList.length > 0 && userTenant.value == depth1.tenantName){
  187. temp.push(depth1)
  188. }
  189. }
  190. })
  191. myTreeView.value = _cloneDeep(temp)
  192. }).catch((error)=>{
  193. $log.debug("[neMgmt][fnGetNeTopology][error]")
  194. useErrorHandler().fnSetCommErrorHandle(error, fnGetNeTopology)
  195. }).finally(()=>{
  196. $log.debug("[neMgmt][fnGetNeTopology][finished]")
  197. })
  198. }
  199. const checkList = ref([])
  200. function fnAllCheck(event, obj) {
  201. if(event) {
  202. obj.neList.forEach((item) => {
  203. obj.selectNeList.push(item.neId)
  204. })
  205. }else{
  206. obj.selectNeList = []
  207. }
  208. }
  209. function fnCheckNeBox(event, group){
  210. group.isAllCheck = group.selectNeList.length === group.neList.length
  211. }
  212. function fnSave(){
  213. let selectItems = selectItem.value
  214. emit('selectTarget', selectItems)
  215. }
  216. function toggleChk(id){
  217. console.log('%c[id]','color:#bada55',id);
  218. let checkBox = document.getElementById(id)
  219. checkBox.click()
  220. }
  221. </script>
  222. <style lang="scss" scoped>
  223. .checked-text{
  224. color:#7ba1c5;
  225. }
  226. .label-text{
  227. font-size: 0.75rem;
  228. margin-left: 0.63rem;
  229. line-height: 1.06rem;
  230. white-space: nowrap;
  231. text-overflow: ellipsis;
  232. overflow: hidden;
  233. display: block;
  234. }
  235. .middle-group{
  236. height: auto;
  237. padding-left: 0.94rem;
  238. margin: 0;
  239. font-size: 0.81rem;
  240. font-weight: 400;
  241. color: #333;
  242. opacity: 1;
  243. }
  244. </style>