deviceAdmin.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <div class="device-management">
  3. <!-- 设备管理 -->
  4. <div class="box">
  5. <div class="box_item" v-for="item in boxList" :key="item.id">
  6. <p>{{item.name}}</p>
  7. <p>{{item.value}}</p>
  8. </div>
  9. </div>
  10. <!-- 查询条件 -->
  11. <div class="conditions">
  12. <el-form inline :model="searchForm" size="mini">
  13. <el-form-item label="注册时间:">
  14. <el-input v-model="searchForm.registerTime" placeholder=""></el-input>
  15. </el-form-item>
  16. <el-form-item label="设备编码:">
  17. <el-input v-model="searchForm.deviceCode" placeholder=""></el-input>
  18. </el-form-item>
  19. <el-form-item label="地县:">
  20. <el-input v-model="searchForm.county" placeholder="地县/编码"></el-input>
  21. </el-form-item>
  22. <el-form-item label="牧场:">
  23. <el-input v-model="searchForm.farm" placeholder="牧场名/牧场编号"></el-input>
  24. </el-form-item>
  25. <el-form-item label="栋舍:">
  26. <el-input v-model="searchForm.pigsty" placeholder=""></el-input>
  27. </el-form-item>
  28. <el-form-item label="状态:">
  29. <el-input v-model="searchForm.status" placeholder="正常/异常"></el-input>
  30. </el-form-item>
  31. <el-form-item style="margin-left: 20px">
  32. <el-button plain @click="init">查询</el-button>
  33. </el-form-item>
  34. </el-form>
  35. </div>
  36. <!-- 按钮栏 -->
  37. <div class="title">
  38. <div class="title-left">
  39. <i class="el-icon-s-unfold"></i>
  40. <span>设备列表</span>
  41. <el-button plain size="mini" class="button-margin">批量上传</el-button>
  42. <el-button type="primary" plain size="mini">新增设备</el-button>
  43. </div>
  44. </div>
  45. <!-- 表格 -->
  46. <el-table
  47. :data="tableData"
  48. style="width: 100%"
  49. height="700"
  50. border
  51. stripe
  52. :default-sort="{prop: 'date', order: 'descending'}"
  53. size="mini"
  54. v-loading="dataListLoading">
  55. <el-table-column
  56. type="selection"
  57. width="50"
  58. align="center">
  59. </el-table-column>
  60. <el-table-column
  61. prop="id"
  62. label="注册ID"
  63. width="70"
  64. align="center">
  65. </el-table-column>
  66. <el-table-column
  67. prop="registerTime"
  68. label="注册时间"
  69. width="100"
  70. align="center">
  71. </el-table-column>
  72. <el-table-column
  73. prop="deviceCode"
  74. label="设备编码"
  75. width="80"
  76. align="center">
  77. </el-table-column>
  78. <el-table-column
  79. prop="countyName"
  80. label="省市县"
  81. align="center">
  82. </el-table-column>
  83. <el-table-column
  84. prop="countyCode"
  85. label="省市县编码"
  86. align="center">
  87. </el-table-column>
  88. <el-table-column
  89. prop="farmName"
  90. label="牧场名称"
  91. width="90"
  92. align="center">
  93. </el-table-column>
  94. <el-table-column
  95. prop="farmCode"
  96. label="牧场编码"
  97. width="90"
  98. align="center">
  99. </el-table-column>
  100. <el-table-column
  101. prop="stage"
  102. label="阶段"
  103. sortable
  104. width="80"
  105. align="center">
  106. </el-table-column>
  107. <el-table-column
  108. prop="pigpenName"
  109. label="栋舍"
  110. align="center">
  111. </el-table-column>
  112. <el-table-column
  113. prop="serverIp"
  114. label="上传服务器地址"
  115. width="120"
  116. align="center">
  117. </el-table-column>
  118. <el-table-column
  119. prop="port"
  120. label="端口"
  121. width="70"
  122. align="center">
  123. </el-table-column>
  124. <el-table-column
  125. prop="lastTime"
  126. label="最后上传时间"
  127. sortable
  128. align="center">
  129. </el-table-column>
  130. <!-- 这里需要修改 -->
  131. <el-table-column
  132. prop="delStatus"
  133. label="状态"
  134. width="70"
  135. align="center">
  136. </el-table-column>
  137. <el-table-column
  138. label="操作"
  139. align="center">
  140. <template slot-scope="scope">
  141. <el-button type="text" size="small">查看</el-button>
  142. <el-button type="text" size="small" @click="handleEdit(scope.row)">编辑</el-button>
  143. <el-button type="text" size="small">注销</el-button>
  144. <el-button type="text" size="small">删除</el-button>
  145. </template>
  146. <!-- TODO: 按钮 -->
  147. </el-table-column>
  148. </el-table>
  149. <table-footer
  150. :totals="totalPages"
  151. :size="pageSize"
  152. @sizeChange="sizeChange"
  153. @pageChange="pageChange">
  154. </table-footer>
  155. </div>
  156. </template>
  157. <script>
  158. import TableFooter from "../../components/TableFooter";
  159. import {mapState} from 'vuex';
  160. export default {
  161. name: "deviceAdmin",
  162. data() {
  163. return {
  164. boxList: [
  165. {
  166. id: 1,
  167. name: '采集设备总数',
  168. value: 2500,
  169. },
  170. {
  171. id: 2,
  172. name: '正常设备总数',
  173. value: 2498
  174. },
  175. {
  176. id: 3,
  177. name: '异常设备总数',
  178. value: 1
  179. },
  180. {
  181. id: 4,
  182. name: '注销设备总数',
  183. value: 1
  184. }
  185. ],
  186. searchForm: {
  187. farmCode: '',
  188. registerStartTime: '',
  189. registerEndTime: '',
  190. deviceCode: '',
  191. countyName: '',
  192. farmName: '',
  193. acqStatus: '',
  194. sortord: ''
  195. },
  196. pageSizeList: [ // 表格显示条数
  197. {
  198. value: 0,
  199. label: '显示条数'
  200. },
  201. {
  202. value: 10,
  203. label: '10条/页'
  204. },
  205. {
  206. value: 20,
  207. label: '20条/页'
  208. },
  209. {
  210. value: 50,
  211. label: '50条/页'
  212. }
  213. ],
  214. pageSize: 20, // 表格显示条数
  215. tableData: [], // 表格数据
  216. totalPages: 0, // 共 n 条数据
  217. pageIndex: 1, // 表格当前页数
  218. dataListLoading: true
  219. }
  220. },
  221. components: {
  222. TableFooter
  223. },
  224. computed: {
  225. ...mapState(['baseUrl'])
  226. },
  227. methods: {
  228. // 初始化
  229. init () {
  230. this.$http({
  231. url: this.$http.adornUrl(`${this.baseUrl}/manager/collectorregister/list`),
  232. method: 'get',
  233. params: this.$http.adornParams({
  234. 'page': this.pageIndex,
  235. 'limit': this.pageSize,
  236. 'farmCode': this.searchForm.farmCode || undefined,
  237. 'registerStartTime': this.searchForm.registerStartTime || undefined,
  238. 'registerEndTime': this.searchForm.registerEndTime || undefined,
  239. 'deviceCode': this.searchForm.deviceCode || undefined,
  240. 'countyName': this.searchForm.countyName || undefined,
  241. 'farmName': this.searchForm.farmName || undefined,
  242. 'acqStatus': this.searchForm.acqStatus || undefined,
  243. 'sortord': this.searchForm.sortord || undefined
  244. }, false)
  245. }).then(async({data}) => {
  246. console.log(data);
  247. this.tableData = data.page.list
  248. this.totalPages = data.page.totalPage
  249. this.dataListLoading = false
  250. })
  251. },
  252. // 显示条数改变
  253. sizeChange (val) {
  254. this.pageSize = val
  255. },
  256. // 页数改变
  257. pageChange (val) {
  258. this.pageIndex = val
  259. },
  260. handleEdit (row) {
  261. console.log(row);
  262. // 编辑
  263. }
  264. },
  265. mounted() {
  266. this.init()
  267. }
  268. }
  269. </script>
  270. <style scoped>
  271. .box{
  272. width: 100%;
  273. height: 140px;
  274. background-color: #F9F9F9;
  275. display: flex;
  276. justify-content: space-around;
  277. align-items: center;
  278. margin-bottom: 10px;
  279. }
  280. .box_item {
  281. width: 198px;
  282. height: 78px;
  283. border: 1px solid #ddd;
  284. text-align: center;
  285. }
  286. .box_item p {
  287. height: 39px;
  288. line-height: 39px;
  289. margin: 0;
  290. }
  291. /** 选择条件 */
  292. .conditions {
  293. width: 100%;
  294. background-color: #fff;
  295. margin: 30px 0px 10px;
  296. border: 1px solid #ddd;
  297. padding: 20px;
  298. padding-bottom: 10px;
  299. }
  300. /** 设备列表 */
  301. .title {
  302. background-color: rgba(243, 243, 243, 1);
  303. height: 50px;
  304. line-height: 50px;
  305. font-size: 14px;
  306. border: 1px solid #ddd;
  307. font-size: 12px;
  308. }
  309. .title-left {
  310. margin-left: 20px;
  311. display: inline-block;
  312. width: 300px;
  313. }
  314. .title-left span {
  315. margin-left: 2px;
  316. }
  317. .button-margin {
  318. margin: 0 5px 0 20px;
  319. }
  320. .title-right {
  321. float: right;
  322. }
  323. </style>