inbound_client_table.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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;" 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;" 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;" 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-icon style="font-size: 24px;" type="retweet" @click="resetClientTraffic(client,record.id)" v-if="client.email.length > 0"></a-icon>
  18. </a-tooltip>
  19. <a-tooltip>
  20. <template slot="title"><span style="color: #FF4D4F"> {{ i18n "delete"}}</span></template>
  21. <a-icon style="font-size: 24px;" type="delete" v-if="isRemovable(record.id)" @click="delClient(record.id,client)"></a-icon>
  22. </a-tooltip>
  23. </template>
  24. <template slot="enable" slot-scope="text, client, index">
  25. <a-switch v-model="client.enable" @change="switchEnableClient(record.id,client)"></a-switch>
  26. </template>
  27. <template slot="client" slot-scope="text, client">
  28. [[ client.email ]]
  29. <a-tag v-if="!isClientEnabled(record, client.email)" color="red">{{ i18n "depleted" }}</a-tag>
  30. </template>
  31. <template slot="traffic" slot-scope="text, client">
  32. <a-popover :overlay-class-name="themeSwitcher.darkClass">
  33. <template slot="content" v-if="client.email">
  34. <table cellpadding="2" width="100%">
  35. <tr>
  36. <td>↑[[ sizeFormat(getUpStats(record, client.email)) ]]</td>
  37. <td>↓[[ sizeFormat(getDownStats(record, client.email)) ]]</td>
  38. </tr>
  39. <tr v-if="client.totalGB > 0">
  40. <td>{{ i18n "remained" }}</td>
  41. <td>[[ sizeFormat(client.totalGB - getUpStats(record, client.email) - getDownStats(record, client.email)) ]]</td>
  42. </tr>
  43. </table>
  44. </template>
  45. <a-tag :color="statsColor(record, client.email)">
  46. [[ sizeFormat(getUpStats(record, client.email) + getDownStats(record, client.email)) ]] /
  47. <template v-if="client.totalGB > 0">[[client._totalGB]]GB</template>
  48. <template v-else>♾</template>
  49. </a-tag>
  50. </a-popover>
  51. </template>
  52. <template slot="expiryTime" slot-scope="text, client, index">
  53. <template v-if="client.expiryTime > 0">
  54. <a-tag :color="usageColor(new Date().getTime(), app.expireDiff, client.expiryTime)">
  55. [[ DateUtil.formatMillis(client._expiryTime) ]]
  56. </a-tag>
  57. </template>
  58. <a-tag v-else-if="client.expiryTime < 0" color="cyan">
  59. [[ client._expiryTime ]] {{ i18n "pages.client.days" }}
  60. </a-tag>
  61. <a-tag v-else color="green">{{ i18n "indefinite" }}</a-tag>
  62. </template>
  63. {{end}}