inbound_client_table.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. {{define "client_table"}}
  2. <template slot="actions" slot-scope="text, client, index">
  3. <a-tooltip>
  4. <template slot="title">{{ i18n "qrCode" }}</template>
  5. <a-icon style="font-size: 24px;" class="normal-icon" type="qrcode" v-if="record.hasLink()" @click="showQrcode(record.id,client);"></a-icon>
  6. </a-tooltip>
  7. <a-tooltip>
  8. <template slot="title">{{ i18n "pages.client.edit" }}</template>
  9. <a-icon style="font-size: 24px;" class="normal-icon" type="edit" @click="openEditClient(record.id,client);"></a-icon>
  10. </a-tooltip>
  11. <a-tooltip>
  12. <template slot="title">{{ i18n "info" }}</template>
  13. <a-icon style="font-size: 24px;" class="normal-icon" type="info-circle" @click="showInfo(record.id,client);"></a-icon>
  14. </a-tooltip>
  15. <a-tooltip>
  16. <template slot="title">{{ i18n "pages.inbounds.resetTraffic" }}</template>
  17. <a-popconfirm @confirm="resetClientTraffic(client,record.id,false)" title='{{ i18n "pages.inbounds.resetTrafficContent"}}' :overlay-class-name="themeSwitcher.currentTheme" ok-text='{{ i18n "reset"}}' cancel-text='{{ i18n "cancel"}}'>
  18. <a-icon slot="icon" type="question-circle-o" :style="themeSwitcher.isDarkTheme ? 'color: var(--color-primary-100)' : 'color: var(--color-primary-100)'"></a-icon>
  19. <a-icon style="font-size: 24px; cursor: pointer;" class="normal-icon" type="retweet" v-if="client.email.length > 0"></a-icon>
  20. </a-popconfirm>
  21. </a-tooltip>
  22. <a-tooltip>
  23. <template slot="title">
  24. <span style="color: #FF4D4F"> {{ i18n "delete"}}</span>
  25. </template>
  26. <a-popconfirm @confirm="delClient(record.id,client,false)" title='{{ i18n "pages.inbounds.deleteClientContent"}}' :overlay-class-name="themeSwitcher.currentTheme" ok-text='{{ i18n "delete"}}' ok-type="danger" cancel-text='{{ i18n "cancel"}}'>
  27. <a-icon slot="icon" type="question-circle-o" style="color: #e04141"></a-icon>
  28. <a-icon style="font-size: 24px; cursor: pointer;" class="delete-icon" type="delete" v-if="isRemovable(record.id)"></a-icon>
  29. </a-popconfirm>
  30. </a-tooltip>
  31. </template>
  32. <template slot="enable" slot-scope="text, client, index">
  33. <a-switch v-model="client.enable" @change="switchEnableClient(record.id,client)"></a-switch>
  34. </template>
  35. <template slot="online" slot-scope="text, client, index">
  36. <template v-if="client.enable && isClientOnline(client.email)">
  37. <a-tag color="green">{{ i18n "online" }}</a-tag>
  38. </template>
  39. <template v-else>
  40. <a-tag>{{ i18n "offline" }}</a-tag>
  41. </template>
  42. </template>
  43. <template slot="client" slot-scope="text, client">
  44. <a-tooltip>
  45. <template slot="title">
  46. <template v-if="!isClientEnabled(record, client.email)">{{ i18n "depleted" }}</template>
  47. <template v-else-if="!client.enable">{{ i18n "disabled" }}</template>
  48. <template v-else-if="client.enable && isClientOnline(client.email)">{{ i18n "online" }}</template>
  49. </template>
  50. <a-badge :class="isClientOnline(client.email)? 'online-animation' : ''" :color="client.enable ? statsExpColor(record, client.email) : themeSwitcher.isDarkTheme ? '#2c3950' : '#bcbcbc'"></a-badge>
  51. </a-tooltip> [[ client.email ]]
  52. </template>
  53. <template slot="traffic" slot-scope="text, client">
  54. <a-popover :overlay-class-name="themeSwitcher.currentTheme">
  55. <template slot="content" v-if="client.email">
  56. <table cellpadding="2" width="100%">
  57. <tr>
  58. <td>↑[[ sizeFormat(getUpStats(record, client.email)) ]]</td>
  59. <td>↓[[ sizeFormat(getDownStats(record, client.email)) ]]</td>
  60. </tr>
  61. <tr v-if="client.totalGB > 0">
  62. <td>{{ i18n "remained" }}</td>
  63. <td>[[ sizeFormat(getRemStats(record, client.email)) ]]</td>
  64. </tr>
  65. </table>
  66. </template>
  67. <table>
  68. <tr class="tr-table-box">
  69. <td class="tr-table-rt"> [[ sizeFormat(getSumStats(record, client.email)) ]] </td>
  70. <td class="tr-table-bar" v-if="!client.enable">
  71. <a-progress :stroke-color="themeSwitcher.isDarkTheme ? 'rgb(72 84 105)' : '#bcbcbc'" :show-info="false" :percent="statsProgress(record, client.email)" />
  72. </td>
  73. <td class="tr-table-bar" v-else-if="client.totalGB > 0">
  74. <a-progress :stroke-color="clientStatsColor(record, client.email)" :show-info="false" :status="isClientEnabled(record, client.email)? 'exception' : ''" :percent="statsProgress(record, client.email)" />
  75. </td>
  76. <td v-else class="infinite-bar tr-table-bar">
  77. <a-progress :show-info="false" :percent="100"></a-progress>
  78. </td>
  79. <td class="tr-table-lt">
  80. <template v-if="client.totalGB > 0">[[ client._totalGB + "GB" ]]</template>
  81. <span v-else class="tr-infinity-ch">&infin;</span>
  82. </td>
  83. </tr>
  84. </table>
  85. </a-popover>
  86. </template>
  87. <template slot="expiryTime" slot-scope="text, client, index">
  88. <template v-if="client.expiryTime !=0 && client.reset >0">
  89. <a-popover :overlay-class-name="themeSwitcher.currentTheme">
  90. <template slot="content">
  91. <span v-if="client.expiryTime < 0">{{ i18n "pages.client.delayedStart" }}
  92. </span>
  93. <span v-else>[[ DateUtil.formatMillis(client._expiryTime) ]]</span>
  94. </template>
  95. <table>
  96. <tr class="tr-table-box">
  97. <td class="tr-table-rt"> [[ remainedDays(client.expiryTime) ]] </td>
  98. <td class="infinite-bar tr-table-bar">
  99. <a-progress :show-info="false" :status="isClientEnabled(record, client.email)? 'exception' : ''" :percent="expireProgress(client.expiryTime, client.reset)" />
  100. </td>
  101. <td class="tr-table-lt">[[ client.reset + "d" ]]</td>
  102. </tr>
  103. </table>
  104. </a-popover>
  105. </template>
  106. <template v-else>
  107. <a-popover v-if="client.expiryTime != 0" :overlay-class-name="themeSwitcher.currentTheme">
  108. <template slot="content">
  109. <span v-if="client.expiryTime < 0">{{ i18n "pages.client.delayedStart" }}
  110. </span>
  111. <span v-else>[[ DateUtil.formatMillis(client._expiryTime) ]]</span>
  112. </template>
  113. <a-tag style="min-width: 50px; border: none;" :color="userExpiryColor(app.expireDiff, client, themeSwitcher.isDarkTheme)"> [[ remainedDays(client.expiryTime) ]] </a-tag>
  114. </a-popover>
  115. <a-tag v-else :color="userExpiryColor(app.expireDiff, client, themeSwitcher.isDarkTheme)" style="border: none;" class="infinite-tag">
  116. <svg height="10px" width="14px" viewBox="0 0 640 512" fill="currentColor">
  117. <path d="M484.4 96C407 96 349.2 164.1 320 208.5C290.8 164.1 233 96 155.6 96C69.75 96 0 167.8 0 256s69.75 160 155.6 160C233.1 416 290.8 347.9 320 303.5C349.2 347.9 407 416 484.4 416C570.3 416 640 344.2 640 256S570.3 96 484.4 96zM155.6 368C96.25 368 48 317.8 48 256s48.25-112 107.6-112c67.75 0 120.5 82.25 137.1 112C276 285.8 223.4 368 155.6 368zM484.4 368c-67.75 0-120.5-82.25-137.1-112C364 226.2 416.6 144 484.4 144C543.8 144 592 194.2 592 256S543.8 368 484.4 368z" fill="currentColor"></path>
  118. </svg>
  119. </a-tag>
  120. </template>
  121. </template>
  122. <template slot="actionMenu" slot-scope="text, client, index">
  123. <a-dropdown :trigger="['click']">
  124. <a-icon @click="e => e.preventDefault()" type="ellipsis" style="font-size: 20px;"></a-icon>
  125. <a-menu slot="overlay" :theme="themeSwitcher.currentTheme">
  126. <a-menu-item v-if="record.hasLink()" @click="showQrcode(record.id,client);">
  127. <a-icon style="font-size: 14px;" type="qrcode"></a-icon>
  128. {{ i18n "qrCode" }}
  129. </a-menu-item>
  130. <a-menu-item @click="openEditClient(record.id,client);">
  131. <a-icon style="font-size: 14px;" type="edit"></a-icon>
  132. {{ i18n "pages.client.edit" }}
  133. </a-menu-item>
  134. <a-menu-item @click="showInfo(record.id,client);">
  135. <a-icon style="font-size: 14px;" type="info-circle"></a-icon>
  136. {{ i18n "info" }}
  137. </a-menu-item>
  138. <a-menu-item @click="resetClientTraffic(client,record.id)" v-if="client.email.length > 0">
  139. <a-icon style="font-size: 14px;" type="retweet"></a-icon>
  140. {{ i18n "pages.inbounds.resetTraffic" }}
  141. </a-menu-item>
  142. <a-menu-item v-if="isRemovable(record.id)" @click="delClient(record.id,client)">
  143. <a-icon style="font-size: 14px;" type="delete"></a-icon>
  144. <span style="color: #FF4D4F"> {{ i18n "delete"}}</span>
  145. </a-menu-item>
  146. <a-menu-item>
  147. <a-switch v-model="client.enable" size="small" @change="switchEnableClient(record.id,client)"></a-switch>
  148. {{ i18n "enable"}}
  149. </a-menu-item>
  150. </a-menu>
  151. </a-dropdown>
  152. </template>
  153. <template slot="info" slot-scope="text, client, index">
  154. <a-popover placement="bottomRight" :overlay-class-name="themeSwitcher.currentTheme" trigger="click">
  155. <template slot="content">
  156. <table>
  157. <tr>
  158. <td colspan="3" style="text-align: center;">{{ i18n "pages.inbounds.traffic" }}</td>
  159. </tr>
  160. <tr>
  161. <td width="80px" style="margin:0; text-align: right;font-size: 1em;"> [[ sizeFormat(getUpStats(record, client.email) + getDownStats(record, client.email)) ]] </td>
  162. <td width="120px" v-if="!client.enable">
  163. <a-progress :stroke-color="themeSwitcher.isDarkTheme ? 'rgb(72 84 105)' : '#bcbcbc'" :show-info="false" :percent="statsProgress(record, client.email)" />
  164. </td>
  165. <td width="120px" v-else-if="client.totalGB > 0">
  166. <a-popover :overlay-class-name="themeSwitcher.currentTheme">
  167. <template slot="content" v-if="client.email">
  168. <table cellpadding="2" width="100%">
  169. <tr>
  170. <td>↑[[ sizeFormat(getUpStats(record, client.email)) ]]</td>
  171. <td>↓[[ sizeFormat(getDownStats(record, client.email)) ]]</td>
  172. </tr>
  173. <tr>
  174. <td>{{ i18n "remained" }}</td>
  175. <td>[[ sizeFormat(getRemStats(record, client.email)) ]]</td>
  176. </tr>
  177. </table>
  178. </template>
  179. <a-progress :stroke-color="clientStatsColor(record, client.email)" :show-info="false" :status="isClientEnabled(record, client.email)? 'exception' : ''" :percent="statsProgress(record, client.email)" />
  180. </a-popover>
  181. </td>
  182. <td width="120px" v-else class="infinite-bar">
  183. <a-progress :stroke-color="themeSwitcher.isDarkTheme ? '#2c1e32':'#F2EAF1'" :show-info="false" :percent="100"></a-progress>
  184. </td>
  185. <td width="80px">
  186. <template v-if="client.totalGB > 0">[[ client._totalGB + "GB" ]]</template>
  187. <span v-else class="tr-infinity-ch">&infin;</span>
  188. </td>
  189. </tr>
  190. <tr>
  191. <td colspan="3" style="text-align: center;">
  192. <a-divider style="margin: 0; border-collapse: separate;"></a-divider>
  193. {{ i18n "pages.inbounds.expireDate" }}
  194. </td>
  195. </tr>
  196. <tr>
  197. <template v-if="client.expiryTime !=0 && client.reset >0">
  198. <td width="80px" style="margin:0; text-align: right;font-size: 1em;"> [[ remainedDays(client.expiryTime) ]] </td>
  199. <td width="120px" class="infinite-bar">
  200. <a-popover :overlay-class-name="themeSwitcher.currentTheme">
  201. <template slot="content">
  202. <span v-if="client.expiryTime < 0">{{ i18n "pages.client.delayedStart" }}
  203. </span>
  204. <span v-else>[[ DateUtil.formatMillis(client._expiryTime) ]]</span>
  205. </template>
  206. <a-progress :show-info="false" :status="isClientEnabled(record, client.email)? 'exception' : ''" :percent="expireProgress(client.expiryTime, client.reset)" />
  207. </a-popover>
  208. </td>
  209. <td width="60px">[[ client.reset + "d" ]]</td>
  210. </template>
  211. <template v-else>
  212. <td colspan="3" style="text-align: center;">
  213. <a-popover v-if="client.expiryTime != 0" :overlay-class-name="themeSwitcher.currentTheme">
  214. <template slot="content">
  215. <span v-if="client.expiryTime < 0">{{ i18n "pages.client.delayedStart" }}
  216. </span>
  217. <span v-else>[[ DateUtil.formatMillis(client._expiryTime) ]]</span>
  218. </template>
  219. <a-tag style="min-width: 50px; border: none;" :color="userExpiryColor(app.expireDiff, client, themeSwitcher.isDarkTheme)"> [[ remainedDays(client.expiryTime) ]] </a-tag>
  220. </a-popover>
  221. <a-tag v-else :color="client.enable ? 'purple' : themeSwitcher.isDarkTheme ? '#2c3950' : '#bcbcbc'" class="infinite-tag">
  222. <svg height="10px" width="14px" viewBox="0 0 640 512" fill="currentColor">
  223. <path d="M484.4 96C407 96 349.2 164.1 320 208.5C290.8 164.1 233 96 155.6 96C69.75 96 0 167.8 0 256s69.75 160 155.6 160C233.1 416 290.8 347.9 320 303.5C349.2 347.9 407 416 484.4 416C570.3 416 640 344.2 640 256S570.3 96 484.4 96zM155.6 368C96.25 368 48 317.8 48 256s48.25-112 107.6-112c67.75 0 120.5 82.25 137.1 112C276 285.8 223.4 368 155.6 368zM484.4 368c-67.75 0-120.5-82.25-137.1-112C364 226.2 416.6 144 484.4 144C543.8 144 592 194.2 592 256S543.8 368 484.4 368z" fill="currentColor"></path>
  224. </svg>
  225. </a-tag>
  226. </template>
  227. </td>
  228. </tr>
  229. </table>
  230. </template>
  231. <a-badge>
  232. <a-icon v-if="!client.enable" slot="count" type="pause-circle" theme="filled" :style="'color: ' + themeSwitcher.isDarkTheme ? '#2c3950' : '#bcbcbc'"></a-icon>
  233. <a-button shape="round" size="small" style="font-size: 14px; padding: 0 10px;">
  234. <a-icon type="solution"></a-icon>
  235. </a-button>
  236. </a-badge>
  237. </a-popover>
  238. </template>
  239. {{end}}