inbound_client_table.html 15 KB

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