Device.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <v-container fluid>
  3. <CommonQueryCard :query-model="queryModel" v-on:searchDone="search" :col="4"></CommonQueryCard>
  4. <v-card style="margin-top: 15px" tile>
  5. <v-card-title>设备
  6. <v-spacer></v-spacer>
  7. <!-- <v-btn @click="addOpen" elevation="0" tile dark color="primary" class="mr-2">-->
  8. <!-- <v-icon left>-->
  9. <!-- mdi-plus-->
  10. <!-- </v-icon>-->
  11. <!-- 新增-->
  12. <!-- </v-btn>-->
  13. <v-btn icon slot="widget-header-action" @click="search(null)">
  14. <v-icon class="text--secondary">mdi-refresh</v-icon>
  15. </v-btn>
  16. </v-card-title>
  17. <v-divider/>
  18. <v-data-table
  19. :headers="headers"
  20. :items="desserts"
  21. loading-text="加载中..."
  22. :loading="loading"
  23. class="elevation-1"
  24. :items-per-page="50"
  25. >
  26. <template v-slot:item.account="{ item }">
  27. {{ item.accountObj.username }}[{{ item.accountObj.name }}]
  28. </template>
  29. <template v-slot:item.deviceName="{ item }">
  30. {{ item.deviceBrand }}
  31. </template>
  32. <template v-slot:item.option="{item}">
  33. <v-btn elevation="0" tile @click="unBoundingDialogOpen(item)" dark color="red" class="mr-2">
  34. <v-icon left>
  35. mdi-alert-remove
  36. </v-icon>
  37. 解绑
  38. </v-btn>
  39. </template>
  40. </v-data-table>
  41. </v-card>
  42. <CommonDialog
  43. title="确认解绑设备?"
  44. ref="unBoundingDialog"
  45. v-on:done="unBoundingDone"
  46. ></CommonDialog>
  47. <!-- <RoleAuthDialog v-on:done="search" :roles="roles" :user="currentUser" ref="roleDialog"></permissionAuthDialog>-->
  48. </v-container>
  49. </template>
  50. <script>
  51. // import RoleAuthDialog from '../../components/dialog/permissionAuthDialog'
  52. // import CommonForm from '../../components/dialog/CommonForm'
  53. import CommonDialog from '../../components/dialog/CommonDialog'
  54. import request from '../../axios/request'
  55. import CommonQueryCard from '../../components/dialog/CommonQueryCard.vue'
  56. import Device from '../../data/system/device/Device'
  57. export default {
  58. name: 'Device',
  59. components: {
  60. CommonQueryCard,
  61. // RoleAuthDialog,
  62. CommonDialog
  63. },
  64. data () {
  65. return {
  66. show: false,
  67. headers: [
  68. {
  69. text: 'uuid',
  70. align: 'center',
  71. sortable: false,
  72. value: 'uuid'
  73. },
  74. {
  75. text: '所属用户',
  76. align: 'center',
  77. sortable: false,
  78. value: 'account'
  79. },
  80. {
  81. text: '手机型号',
  82. align: 'center',
  83. sortable: false,
  84. value: 'deviceName'
  85. },
  86. {
  87. text: 'IMEI标识',
  88. align: 'center',
  89. sortable: false,
  90. value: 'androidId'
  91. },
  92. {
  93. text: '注册时间',
  94. align: 'center',
  95. sortable: false,
  96. value: 'registerAt'
  97. },
  98. {
  99. text: '操作',
  100. align: 'center',
  101. sortable: false,
  102. value: 'option'
  103. }
  104. ],
  105. desserts: [],
  106. loading: true,
  107. query: {
  108. username: ''
  109. },
  110. temp: null,
  111. type: 'add',
  112. formModel: [
  113. {
  114. code: 'packageName',
  115. name: '包名',
  116. formType: 'text',
  117. value: '',
  118. notNull: true,
  119. option: [],
  120. col: 6
  121. },
  122. {
  123. code: 'name',
  124. name: 'App名称',
  125. formType: 'text',
  126. value: '',
  127. notNull: true,
  128. option: [],
  129. col: 6
  130. },
  131. {
  132. code: 'supportVersion',
  133. name: '支持版本',
  134. formType: 'json',
  135. mode: 'text',
  136. value: '',
  137. notNull: true,
  138. option: [],
  139. col: 6
  140. }
  141. ],
  142. file: null,
  143. importLoading: false,
  144. queryModel: Device.queryModel
  145. }
  146. },
  147. methods: {
  148. unBoundingDialogOpen (item) {
  149. this.temp = item
  150. this.$refs.unBoundingDialog.show()
  151. },
  152. unBoundingDone () {
  153. request({
  154. url: '/api/unBundleDevice/' + this.temp.uuid,
  155. method: 'get'
  156. })
  157. .then((resp) => {
  158. this.search(null)
  159. this.$refs.unBoundingDialog.close()
  160. })
  161. .catch((resp) => {
  162. })
  163. },
  164. search (params) {
  165. if (!this.$util.isNullOrUndefined(params)) {
  166. this.$util.replaceNull(params)
  167. this.query = params
  168. }
  169. this.loading = true
  170. request({
  171. url: '/device/search',
  172. method: 'get',
  173. params: {
  174. userId: this.query.username
  175. }
  176. })
  177. .then((resp) => {
  178. this.loading = false
  179. this.desserts = resp.data
  180. })
  181. .catch((resp) => {
  182. })
  183. }
  184. },
  185. created () {
  186. this.search()
  187. }
  188. }
  189. </script>
  190. <style scoped>
  191. </style>