inbound_client_table.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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)"
  18. title='{{ i18n "pages.inbounds.resetTrafficContent"}}'
  19. :overlay-class-name="themeSwitcher.currentTheme"
  20. ok-text='{{ i18n "reset"}}'
  21. cancel-text='{{ i18n "cancel"}}'>
  22. <a-icon slot="icon" type="question-circle-o" :style="themeSwitcher.isDarkTheme ? 'color: var(--color-primary-100)' : 'color: var(--color-primary-100)'"></a-icon>
  23. <a-icon style="font-size: 24px; cursor: pointer;" class="normal-icon" type="retweet" v-if="client.email.length > 0"></a-icon>
  24. </a-popconfirm>
  25. </a-tooltip>
  26. <a-tooltip>
  27. <template slot="title"><span style="color: #FF4D4F"> {{ i18n "delete"}}</span></template>
  28. <a-popconfirm @confirm="delClient(record.id,client,false)"
  29. title='{{ i18n "pages.inbounds.deleteClientContent"}}'
  30. :overlay-class-name="themeSwitcher.currentTheme"
  31. ok-text='{{ i18n "delete"}}'
  32. ok-type="danger"
  33. cancel-text='{{ i18n "cancel"}}'>
  34. <a-icon slot="icon" type="question-circle-o" style="color: #e04141"></a-icon>
  35. <a-icon style="font-size: 24px; cursor: pointer;" class="delete-icon" type="delete" v-if="isRemovable(record.id)"></a-icon>
  36. </a-popconfirm>
  37. </a-tooltip>
  38. </template>
  39. <template slot="enable" slot-scope="text, client, index">
  40. <a-switch v-model="client.enable" @change="switchEnableClient(record.id,client)"></a-switch>
  41. </template>
  42. <template slot="online" slot-scope="text, client, index">
  43. <template v-if="client.enable && isClientOnline(client.email)">
  44. <a-tag color="green">{{ i18n "online" }}</a-tag>
  45. </template>
  46. <template v-else>
  47. <a-tag>{{ i18n "offline" }}</a-tag>
  48. </template>
  49. </template>
  50. <template slot="client" slot-scope="text, client">
  51. <a-tooltip>
  52. <template slot="title">
  53. <template v-if="!isClientEnabled(record, client.email)">{{ i18n "depleted" }}</template>
  54. <template v-else-if="!client.enable">{{ i18n "disabled" }}</template>
  55. <template v-else-if="client.enable && isClientOnline(client.email)">{{ i18n "online" }}</template>
  56. </template>
  57. <a-badge :class="isClientOnline(client.email)? 'online-animation' : ''" :color="client.enable ? statsExpColor(record, client.email) : themeSwitcher.isDarkTheme ? '#2c3950' : '#bcbcbc'">
  58. </a-badge>
  59. </a-tooltip>
  60. [[ client.email ]]
  61. </template>
  62. <template slot="traffic" slot-scope="text, client">
  63. <a-popover :overlay-class-name="themeSwitcher.currentTheme">
  64. <template slot="content" v-if="client.email">
  65. <table cellpadding="2" width="100%">
  66. <tr>
  67. <td>↑[[ sizeFormat(getUpStats(record, client.email)) ]]</td>
  68. <td>↓[[ sizeFormat(getDownStats(record, client.email)) ]]</td>
  69. </tr>
  70. <tr v-if="client.totalGB > 0">
  71. <td>{{ i18n "remained" }}</td>
  72. <td>[[ sizeFormat(getRemStats(record, client.email)) ]]</td>
  73. </tr>
  74. </table>
  75. </template>
  76. <table>
  77. <tr>
  78. <td width="80px" style="margin:0; text-align: right;font-size: 1em;">
  79. [[ sizeFormat(getSumStats(record, client.email)) ]]
  80. </td>
  81. <td width="120px" v-if="!client.enable">
  82. <a-progress :stroke-color="themeSwitcher.isDarkTheme ? 'rgb(72 84 105)' : '#bcbcbc'"
  83. :show-info="false"
  84. :percent="statsProgress(record, client.email)"/>
  85. </td>
  86. <td width="120px" v-else-if="client.totalGB > 0">
  87. <a-progress :stroke-color="clientStatsColor(record, client.email)"
  88. :show-info="false"
  89. :status="isClientEnabled(record, client.email)? 'exception' : ''"
  90. :percent="statsProgress(record, client.email)"/>
  91. </td>
  92. <td width="120px" v-else class="infinite-bar">
  93. <a-progress
  94. :show-info="false"
  95. :percent="100"></a-progress>
  96. </td>
  97. <td width="60px">
  98. <template v-if="client.totalGB > 0">[[ client._totalGB + "GB" ]]</template>
  99. <span v-else style="font-weight: 100;font-size: 14pt;">&infin;</span>
  100. </td>
  101. </tr>
  102. </table>
  103. </a-popover>
  104. </template>
  105. <template slot="expiryTime" slot-scope="text, client, index">
  106. <template v-if="client.expiryTime !=0 && client.reset >0">
  107. <a-popover :overlay-class-name="themeSwitcher.currentTheme">
  108. <template slot="content">
  109. <span v-if="client.expiryTime < 0">{{ i18n "pages.client.delayedStart" }}</span>
  110. <span v-else>[[ DateUtil.formatMillis(client._expiryTime) ]]</span>
  111. </template>
  112. <table>
  113. <tr>
  114. <td width="80px" style="margin:0; text-align: right;font-size: 1em;">
  115. [[ remainedDays(client.expiryTime) ]]
  116. </td>
  117. <td width="120px" class="infinite-bar">
  118. <a-progress :show-info="false"
  119. :status="isClientEnabled(record, client.email)? 'exception' : ''"
  120. :percent="expireProgress(client.expiryTime, client.reset)"/>
  121. </td>
  122. <td width="60px">[[ client.reset + "d" ]]</td>
  123. </tr>
  124. </table>
  125. </a-popover>
  126. </template>
  127. <template v-else>
  128. <a-popover v-if="client.expiryTime != 0" :overlay-class-name="themeSwitcher.currentTheme">
  129. <template slot="content">
  130. <span v-if="client.expiryTime < 0">{{ i18n "pages.client.delayedStart" }}</span>
  131. <span v-else>[[ DateUtil.formatMillis(client._expiryTime) ]]</span>
  132. </template>
  133. <a-tag style="min-width: 50px; border: none;" :color="userExpiryColor(app.expireDiff, client, themeSwitcher.isDarkTheme)">
  134. [[ remainedDays(client.expiryTime) ]]
  135. </a-tag>
  136. </a-popover>
  137. <a-tag v-else :color="userExpiryColor(app.expireDiff, client, themeSwitcher.isDarkTheme)" style="border: none;" class="infinite-tag">&infin;</a-tag>
  138. </template>
  139. </template>
  140. <template slot="actionMenu" slot-scope="text, client, index">
  141. <a-dropdown :trigger="['click']">
  142. <a-icon @click="e => e.preventDefault()" type="ellipsis" style="font-size: 20px;"></a-icon>
  143. <a-menu slot="overlay" :theme="themeSwitcher.currentTheme">
  144. <a-menu-item v-if="record.hasLink()" @click="showQrcode(record.id,client);">
  145. <a-icon style="font-size: 14px;" type="qrcode"></a-icon>
  146. {{ i18n "qrCode" }}
  147. </a-menu-item>
  148. <a-menu-item @click="openEditClient(record.id,client);">
  149. <a-icon style="font-size: 14px;" type="edit"></a-icon>
  150. {{ i18n "pages.client.edit" }}
  151. </a-menu-item>
  152. <a-menu-item @click="showInfo(record.id,client);">
  153. <a-icon style="font-size: 14px;" type="info-circle"></a-icon>
  154. {{ i18n "info" }}
  155. </a-menu-item>
  156. <a-menu-item @click="resetClientTraffic(client,record.id)" v-if="client.email.length > 0">
  157. <a-icon style="font-size: 14px;" type="retweet"></a-icon>
  158. {{ i18n "pages.inbounds.resetTraffic" }}
  159. </a-menu-item>
  160. <a-menu-item v-if="isRemovable(record.id)" @click="delClient(record.id,client)">
  161. <a-icon style="font-size: 14px;" type="delete"></a-icon>
  162. <span style="color: #FF4D4F"> {{ i18n "delete"}}</span>
  163. </a-menu-item>
  164. <a-menu-item>
  165. <a-switch v-model="client.enable" size="small" @change="switchEnableClient(record.id,client)">
  166. </a-switch>
  167. {{ i18n "enable"}}
  168. </a-menu-item>
  169. </a-menu>
  170. </a-dropdown>
  171. </template>
  172. <template slot="info" slot-scope="text, client, index">
  173. <a-popover placement="bottomRight" :overlay-class-name="themeSwitcher.currentTheme" trigger="click">
  174. <template slot="content">
  175. <table>
  176. <tr>
  177. <td colspan="3" style="text-align: center;">{{ i18n "pages.inbounds.traffic" }}</td>
  178. </tr>
  179. <tr>
  180. <td width="80px" style="margin:0; text-align: right;font-size: 1em;">
  181. [[ sizeFormat(getUpStats(record, client.email) + getDownStats(record, client.email)) ]]
  182. </td>
  183. <td width="120px" v-if="!client.enable">
  184. <a-progress :stroke-color="themeSwitcher.isDarkTheme ? 'rgb(72 84 105)' : '#bcbcbc'"
  185. :show-info="false"
  186. :percent="statsProgress(record, client.email)"/>
  187. </td>
  188. <td width="120px" v-else-if="client.totalGB > 0">
  189. <a-popover :overlay-class-name="themeSwitcher.currentTheme">
  190. <template slot="content" v-if="client.email">
  191. <table cellpadding="2" width="100%">
  192. <tr>
  193. <td>↑[[ sizeFormat(getUpStats(record, client.email)) ]]</td>
  194. <td>↓[[ sizeFormat(getDownStats(record, client.email)) ]]</td>
  195. </tr>
  196. <tr>
  197. <td>{{ i18n "remained" }}</td>
  198. <td>[[ sizeFormat(getRemStats(record, client.email)) ]]</td>
  199. </tr>
  200. </table>
  201. </template>
  202. <a-progress :stroke-color="clientStatsColor(record, client.email)"
  203. :show-info="false"
  204. :status="isClientEnabled(record, client.email)? 'exception' : ''"
  205. :percent="statsProgress(record, client.email)"/>
  206. </a-popover>
  207. </td>
  208. <td width="120px" v-else class="infinite-bar">
  209. <a-progress :stroke-color="themeSwitcher.isDarkTheme ? '#2c1e32':'#F2EAF1'"
  210. :show-info="false"
  211. :percent="100"></a-progress>
  212. </td>
  213. <td width="80px">
  214. <template v-if="client.totalGB > 0">[[ client._totalGB + "GB" ]]</template>
  215. <span v-else style="font-weight: 100;font-size: 14pt;">&infin;</span>
  216. </td>
  217. </tr>
  218. <tr>
  219. <td colspan="3" style="text-align: center;">
  220. <a-divider style="margin: 0; border-collapse: separate;"></a-divider>
  221. {{ i18n "pages.inbounds.expireDate" }}
  222. </td>
  223. </tr>
  224. <tr>
  225. <template v-if="client.expiryTime !=0 && client.reset >0">
  226. <td width="80px" style="margin:0; text-align: right;font-size: 1em;">
  227. [[ remainedDays(client.expiryTime) ]]
  228. </td>
  229. <td width="120px" class="infinite-bar">
  230. <a-popover :overlay-class-name="themeSwitcher.currentTheme">
  231. <template slot="content">
  232. <span v-if="client.expiryTime < 0">{{ i18n "pages.client.delayedStart" }}</span>
  233. <span v-else>[[ DateUtil.formatMillis(client._expiryTime) ]]</span>
  234. </template>
  235. <a-progress :show-info="false"
  236. :status="isClientEnabled(record, client.email)? 'exception' : ''"
  237. :percent="expireProgress(client.expiryTime, client.reset)"/>
  238. </a-popover>
  239. </td>
  240. <td width="60px">[[ client.reset + "d" ]]</td>
  241. </template>
  242. <template v-else>
  243. <td colspan="3" style="text-align: center;">
  244. <a-popover v-if="client.expiryTime != 0" :overlay-class-name="themeSwitcher.currentTheme">
  245. <template slot="content">
  246. <span v-if="client.expiryTime < 0">{{ i18n "pages.client.delayedStart" }}</span>
  247. <span v-else>[[ DateUtil.formatMillis(client._expiryTime) ]]</span>
  248. </template>
  249. <a-tag style="min-width: 50px; border: none;"
  250. :color="userExpiryColor(app.expireDiff, client, themeSwitcher.isDarkTheme)">
  251. [[ remainedDays(client.expiryTime) ]]
  252. </a-tag>
  253. </a-popover>
  254. <a-tag v-else :color="client.enable ? 'purple' : themeSwitcher.isDarkTheme ? '#2c3950' : '#bcbcbc'" class="infinite-tag">&infin;</a-tag>
  255. </template>
  256. </td>
  257. </tr>
  258. </table>
  259. </template>
  260. <a-badge>
  261. <a-icon v-if="!client.enable" slot="count" type="pause-circle" theme="filled" :style="'color: ' + themeSwitcher.isDarkTheme ? '#2c3950' : '#bcbcbc'"></a-icon>
  262. <a-button shape="round" size="small" style="font-size: 14px; padding: 0 10px;"><a-icon type="solution"></a-icon></a-button>
  263. </a-badge>
  264. </a-popover>
  265. </template>
  266. {{end}}