tenantUser.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <div class="content--l">
  3. <div class="content--inner">
  4. <div class="content--inner--title">
  5. <h3>사용 현황</h3>
  6. </div>
  7. <div class="content--inner--content">
  8. <div class="db--chart--wrap">
  9. <userDoughnut
  10. :max-subscriber="userInfo?.maxSubscriber || 0"
  11. :cur-subscriber="userInfo?.curSubscriber || 0"
  12. />
  13. </div>
  14. </div>
  15. </div>
  16. <div class="content--inner">
  17. <div class="content--inner--title">
  18. <h3>테넌트 정보</h3>
  19. <p
  20. v-if="dday != '' && dday > 0"
  21. class="d--day"
  22. >
  23. D-{{ dday }}일
  24. </p>
  25. <p
  26. v-else-if="dday != '' && dday < 1"
  27. class="d--day"
  28. >
  29. 만료
  30. </p>
  31. </div>
  32. <div class="content--inner--content">
  33. <div class="db--table">
  34. <table>
  35. <colgroup>
  36. <col style="width:7.5rem">
  37. <col>
  38. </colgroup>
  39. <tbody>
  40. <tr>
  41. <th>테넌트명</th>
  42. <td>{{ userInfo?.tenantName }}</td>
  43. </tr>
  44. <tr>
  45. <th>테넌트 고유번호</th>
  46. <td>{{ userInfo?.tenantCode }}</td>
  47. </tr>
  48. <tr>
  49. <th>고객 유형</th>
  50. <td>{{ customerTypeName }}</td>
  51. </tr>
  52. <tr>
  53. <th>라이선스 키</th>
  54. <td>{{ userInfo?.licenseKey }}</td>
  55. </tr>
  56. <tr>
  57. <th>라이선스 유형</th>
  58. <td>{{ licenseTypeName }}</td>
  59. </tr>
  60. <tr>
  61. <th>라이선스 발급일</th>
  62. <td>{{ issueDate }}</td>
  63. </tr>
  64. <tr>
  65. <th>라이선스 만료일</th>
  66. <td>{{ expirationDate }}</td>
  67. </tr>
  68. <tr>
  69. <th>계정 현황</th>
  70. <td>
  71. <span>사용 : {{ userInfo?.currentAccountCount || 0 }}</span> / 최대 : {{ userInfo?.maxAccount || 0 }}
  72. </td>
  73. </tr>
  74. <tr>
  75. <th>접속 현황</th>
  76. <td>
  77. <span>사용 : {{ userInfo?.currentConnectingCount || 0 }}</span> / 최대 : {{ userInfo?.maxSession || 0 }}
  78. </td>
  79. </tr>
  80. </tbody>
  81. </table>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. </template>
  87. <script setup>
  88. /***********************
  89. * import
  90. ************************/
  91. import { useI18n } from 'vue-i18n'
  92. import userDoughnut from '@/components/home/tenant/chart/userDoughnut.vue'
  93. import dayjs from '#build/dayjs.imports.mjs';
  94. import testJson from '../dashboard/test.json'
  95. /***********************
  96. * plugins inject
  97. ************************/
  98. const {$toast, $log, $dayjs, $eventBus } = useNuxtApp()
  99. const i18n = useI18n()
  100. const props = defineProps({})
  101. // 참조가능 데이터 설정
  102. defineExpose({
  103. fnInit,
  104. })
  105. /***********************
  106. * data & created
  107. ************************/
  108. // 사용 현황 정보
  109. const userInfo = ref({});
  110. /***********************
  111. * Watch Computed
  112. ************************/
  113. const licenseTypeList = computed(() => {
  114. return useEnumCode.getEnumCode(useUtil.nvl(useLangStore().getLang, 'kr')).licenseType;
  115. })
  116. const customerTypeList = computed(() => {
  117. return useEnumCode.getEnumCode(useUtil.nvl(useLangStore().getLang, 'kr')).customerType;
  118. })
  119. const licenseTypeName = computed(() => fnGetLicenseTypeName(userInfo.value?.licenseType));
  120. const customerTypeName = computed(() => fnGetCustomerTypeName(userInfo.value?.customerType));
  121. const issueDate = computed(() => fnGetDateStr(userInfo.value?.issueDate));
  122. const expirationDate = computed(() => fnGetDateStr(userInfo.value?.expirationDate));
  123. const dday = computed(() => fnGetDayDiff(userInfo.value?.expirationDate));
  124. /***********************
  125. * Methods
  126. ************************/
  127. function fnInit(tenantName) {
  128. fnGetUserInfo(tenantName)
  129. }
  130. /**
  131. * 사용 현황 정보 조회
  132. */
  133. const fnGetUserInfo = (tenantName) => {
  134. const params = {
  135. tenantName: tenantName
  136. }
  137. userInfo.value = {};
  138. useAxios().post(useApi.getUserList, params).then((res) => {
  139. const {resCode, resMsg, data} = res.data;
  140. if(resCode == 200) {
  141. userInfo.value = data.items.find((i) => i.tenantName == params.tenantName);
  142. $log.debug("[tenantDashboard][fnGetUserList][success]")
  143. } else {
  144. $log.debug("[tenantDashboard][fnGetUserList][error]", `[${resCode}] ${resMsg}`);
  145. }
  146. console.log('::::::::: 사용자 정보 조회 ::', userInfo.value)
  147. }).catch((error)=>{
  148. $log.debug("[tenantDashboard][fnGetUserList][error]", error)
  149. useErrorHandler().fnSetCommErrorHandle(error, fnGetUserInfo)
  150. // 테스트 데이터 파싱
  151. }).finally(()=>{
  152. $log.debug("[tenantDashboard][fnGetUserList][finished]")
  153. })
  154. }
  155. // 라이선스 유형명
  156. const fnGetLicenseTypeName = (licenseType) => {
  157. if(useUtil.isNull(licenseType)) return '';
  158. const licenseTypeObj = licenseTypeList.value.find((l) => l.value == licenseType)
  159. return licenseTypeObj ? licenseTypeObj.title : ''
  160. }
  161. // 고객 유형명
  162. const fnGetCustomerTypeName = (customerType) => {
  163. if(useUtil.isNull(customerType)) return '';
  164. const customerTypeObj = customerTypeList.value.find((c) => c.value == customerType)
  165. return customerTypeObj ? customerTypeObj.title : ''
  166. }
  167. // 날짜
  168. const fnGetDateStr = (date) => {
  169. try {
  170. if(!date) return '';
  171. return dayjs(date).format('YYYY-MM-DD')
  172. } catch(e) {
  173. return date;
  174. }
  175. }
  176. // DDay
  177. const fnGetDayDiff = (date) => {
  178. try {
  179. if(!date) return '';
  180. return Math.floor(dayjs(date).diff(dayjs(), 'days') + 1);
  181. } catch(e) {
  182. return ''
  183. }
  184. }
  185. </script>