inbound_client_table.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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: #008771' : 'color: #008771'"></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="isClientOnline(client.email)? 'active' : 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. :status="isClientOnline(client.email)? 'active' : ''"
  96. :percent="100"></a-progress>
  97. </td>
  98. <td width="60px">
  99. <template v-if="client.totalGB > 0">[[ client._totalGB + "GB" ]]</template>
  100. <span v-else style="font-weight: 100;font-size: 14pt;">&infin;</span>
  101. </td>
  102. </tr>
  103. </table>
  104. </a-popover>
  105. </template>
  106. <template slot="expiryTime" slot-scope="text, client, index">
  107. <template v-if="client.expiryTime !=0 && client.reset >0">
  108. <a-popover :overlay-class-name="themeSwitcher.currentTheme">
  109. <template slot="content">
  110. <span v-if="client.expiryTime < 0">{{ i18n "pages.client.delayedStart" }}</span>
  111. <span v-else>[[ DateUtil.formatMillis(client._expiryTime) ]]</span>
  112. </template>
  113. <table>
  114. <tr>
  115. <td width="80px" style="margin:0; text-align: right;font-size: 1em;">
  116. [[ remainedDays(client.expiryTime) ]]
  117. </td>
  118. <td width="120px" class="infinite-bar">
  119. <a-progress :show-info="false"
  120. :status="isClientOnline(client.email)? 'active' : isClientEnabled(record, client.email)? 'exception' : ''"
  121. :percent="expireProgress(client.expiryTime, client.reset)"/>
  122. </td>
  123. <td width="60px">[[ client.reset + "d" ]]</td>
  124. </tr>
  125. </table>
  126. </a-popover>
  127. </template>
  128. <template v-else>
  129. <a-popover v-if="client.expiryTime != 0" :overlay-class-name="themeSwitcher.currentTheme">
  130. <template slot="content">
  131. <span v-if="client.expiryTime < 0">{{ i18n "pages.client.delayedStart" }}</span>
  132. <span v-else>[[ DateUtil.formatMillis(client._expiryTime) ]]</span>
  133. </template>
  134. <a-tag style="min-width: 50px; border: none;" :color="userExpiryColor(app.expireDiff, client, themeSwitcher.isDarkTheme)">
  135. [[ remainedDays(client.expiryTime) ]]
  136. </a-tag>
  137. </a-popover>
  138. <a-tag v-else :color="userExpiryColor(app.expireDiff, client, themeSwitcher.isDarkTheme)" style="border: none;" class="infinite-tag">&infin;</a-tag>
  139. </template>
  140. </template>
  141. <template slot="actionMenu" slot-scope="text, client, index">
  142. <a-dropdown :trigger="['click']">
  143. <a-icon @click="e => e.preventDefault()" type="ellipsis" style="font-size: 20px;"></a-icon>
  144. <a-menu slot="overlay" :theme="themeSwitcher.currentTheme">
  145. <a-menu-item v-if="record.hasLink()" @click="showQrcode(record.id,client);">
  146. <a-icon style="font-size: 14px;" type="qrcode"></a-icon>
  147. {{ i18n "qrCode" }}
  148. </a-menu-item>
  149. <a-menu-item @click="openEditClient(record.id,client);">
  150. <a-icon style="font-size: 14px;" type="edit"></a-icon>
  151. {{ i18n "pages.client.edit" }}
  152. </a-menu-item>
  153. <a-menu-item @click="showInfo(record.id,client);">
  154. <a-icon style="font-size: 14px;" type="info-circle"></a-icon>
  155. {{ i18n "info" }}
  156. </a-menu-item>
  157. <a-menu-item @click="resetClientTraffic(client,record.id)" v-if="client.email.length > 0">
  158. <a-icon style="font-size: 14px;" type="retweet"></a-icon>
  159. {{ i18n "pages.inbounds.resetTraffic" }}
  160. </a-menu-item>
  161. <a-menu-item v-if="isRemovable(record.id)" @click="delClient(record.id,client)">
  162. <a-icon style="font-size: 14px;" type="delete"></a-icon>
  163. <span style="color: #FF4D4F"> {{ i18n "delete"}}</span>
  164. </a-menu-item>
  165. <a-menu-item>
  166. <a-switch v-model="client.enable" size="small" @change="switchEnableClient(record.id,client)">
  167. </a-switch>
  168. {{ i18n "enable"}}
  169. </a-menu-item>
  170. </a-menu>
  171. </a-dropdown>
  172. </template>
  173. <template slot="info" slot-scope="text, client, index">
  174. <a-popover placement="bottomRight" :overlay-class-name="themeSwitcher.currentTheme" trigger="click">
  175. <template slot="content">
  176. <table>
  177. <tr>
  178. <td colspan="3" style="text-align: center;">{{ i18n "pages.inbounds.traffic" }}</td>
  179. </tr>
  180. <tr>
  181. <td width="80px" style="margin:0; text-align: right;font-size: 1em;">
  182. [[ sizeFormat(getUpStats(record, client.email) + getDownStats(record, client.email)) ]]
  183. </td>
  184. <td width="120px" v-if="!client.enable">
  185. <a-progress :stroke-color="themeSwitcher.isDarkTheme ? 'rgb(72 84 105)' : '#bcbcbc'"
  186. :show-info="false"
  187. :percent="statsProgress(record, client.email)"/>
  188. </td>
  189. <td width="120px" v-else-if="client.totalGB > 0">
  190. <a-popover :overlay-class-name="themeSwitcher.currentTheme">
  191. <template slot="content" v-if="client.email">
  192. <table cellpadding="2" width="100%">
  193. <tr>
  194. <td>↑[[ sizeFormat(getUpStats(record, client.email)) ]]</td>
  195. <td>↓[[ sizeFormat(getDownStats(record, client.email)) ]]</td>
  196. </tr>
  197. <tr>
  198. <td>{{ i18n "remained" }}</td>
  199. <td>[[ sizeFormat(getRemStats(record, client.email)) ]]</td>
  200. </tr>
  201. </table>
  202. </template>
  203. <a-progress :stroke-color="clientStatsColor(record, client.email)"
  204. :show-info="false"
  205. :status="isClientOnline(client.email)? 'active' : isClientEnabled(record, client.email)? 'exception' : ''"
  206. :percent="statsProgress(record, client.email)"/>
  207. </a-popover>
  208. </td>
  209. <td width="120px" v-else class="infinite-bar">
  210. <a-progress :stroke-color="themeSwitcher.isDarkTheme ? '#2c1e32':'#F2EAF1'"
  211. :show-info="false"
  212. :status="isClientOnline(client.email)? 'active' : ''"
  213. :percent="100"></a-progress>
  214. </td>
  215. <td width="80px">
  216. <template v-if="client.totalGB > 0">[[ client._totalGB + "GB" ]]</template>
  217. <span v-else style="font-weight: 100;font-size: 14pt;">&infin;</span>
  218. </td>
  219. </tr>
  220. <tr>
  221. <td colspan="3" style="text-align: center;">
  222. <a-divider style="margin: 0; border-collapse: separate;"></a-divider>
  223. {{ i18n "pages.inbounds.expireDate" }}
  224. </td>
  225. </tr>
  226. <tr>
  227. <template v-if="client.expiryTime !=0 && client.reset >0">
  228. <td width="80px" style="margin:0; text-align: right;font-size: 1em;">
  229. [[ remainedDays(client.expiryTime) ]]
  230. </td>
  231. <td width="120px" class="infinite-bar">
  232. <a-popover :overlay-class-name="themeSwitcher.currentTheme">
  233. <template slot="content">
  234. <span v-if="client.expiryTime < 0">{{ i18n "pages.client.delayedStart" }}</span>
  235. <span v-else>[[ DateUtil.formatMillis(client._expiryTime) ]]</span>
  236. </template>
  237. <a-progress :show-info="false"
  238. :status="isClientOnline(client.email)? 'active' : isClientEnabled(record, client.email)? 'exception' : ''"
  239. :percent="expireProgress(client.expiryTime, client.reset)"/>
  240. </a-popover>
  241. </td>
  242. <td width="60px">[[ client.reset + "d" ]]</td>
  243. </template>
  244. <template v-else>
  245. <td colspan="3" style="text-align: center;">
  246. <a-popover v-if="client.expiryTime != 0" :overlay-class-name="themeSwitcher.currentTheme">
  247. <template slot="content">
  248. <span v-if="client.expiryTime < 0">{{ i18n "pages.client.delayedStart" }}</span>
  249. <span v-else>[[ DateUtil.formatMillis(client._expiryTime) ]]</span>
  250. </template>
  251. <a-tag style="min-width: 50px; border: none;"
  252. :color="userExpiryColor(app.expireDiff, client, themeSwitcher.isDarkTheme)">
  253. [[ remainedDays(client.expiryTime) ]]
  254. </a-tag>
  255. </a-popover>
  256. <a-tag v-else :color="client.enable ? 'purple' : themeSwitcher.isDarkTheme ? '#2c3950' : '#bcbcbc'" class="infinite-tag">&infin;</a-tag>
  257. </template>
  258. </td>
  259. </tr>
  260. </table>
  261. </template>
  262. <a-badge>
  263. <a-icon v-if="!client.enable" slot="count" type="pause-circle" :style="'color: ' + themeSwitcher.isDarkTheme ? '#2c3950' : '#bcbcbc'"></a-icon>
  264. <a-button shape="round" size="small" style="font-size: 14px; padding: 0 10px;"><a-icon type="solution"></a-icon></a-button>
  265. </a-badge>
  266. </a-popover>
  267. </template>
  268. {{end}}