index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <!-- 自动售卖机 -->
  3. <div class="app-container">
  4. <el-row :gutter="10" class="mb8" style="margin-left: 0; margin-top: 10px">
  5. <el-button
  6. type="primary"
  7. plain
  8. icon="el-icon-plus"
  9. size="mini"
  10. @click="handleAdd"
  11. v-hasPermi="['device:robot:list']"
  12. >新增</el-button>
  13. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  14. </el-row>
  15. <el-table ref="tables" v-loading="loading" :data="dataList" border>
  16. <el-table-column label="序号" align="center" type="index" width="60"></el-table-column>
  17. <el-table-column label="设备名称" align="center" prop="deviceName" />
  18. <el-table-column label="设备编码" align="center" prop="deviceNo" />
  19. <el-table-column label="IP" align="center" prop="deviceAddress" />
  20. <el-table-column label="设备类型" align="center" prop="deviceType">
  21. <template slot-scope="scope">
  22. <dict-tag :options="dict.type.device_sys_type" :value="scope.row.deviceType"/>
  23. </template>
  24. </el-table-column>
  25. <el-table-column label="添加时间" align="center" prop="createTime" width="160" >
  26. <template slot-scope="scope">
  27. <span>{{ parseTime(scope.row.createTime) }}</span>
  28. </template>
  29. </el-table-column>
  30. <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
  31. <template slot-scope="scope">
  32. <el-button
  33. size="mini"
  34. type="text"
  35. @click="openDetails(scope.row)"
  36. v-hasPermi="['device:robot:details']"
  37. >详情</el-button>
  38. <el-button
  39. size="mini"
  40. type="text"
  41. @click="handleUpdate(scope.row)"
  42. v-hasPermi="['device:robot:edit']"
  43. >修改</el-button>
  44. <el-button
  45. size="mini"
  46. type="text"
  47. @click="handleDelete(scope.row,scope.index)"
  48. v-hasPermi="['device:robot:delete']"
  49. >删除</el-button>
  50. </template>
  51. </el-table-column>
  52. </el-table>
  53. <pagination
  54. v-show="total>0"
  55. :total="total"
  56. :page.sync="queryParams.pageNum"
  57. :limit.sync="queryParams.pageSize"
  58. @pagination="getList"
  59. />
  60. <!-- 详情 -->
  61. <!-- 新增/编辑弹框 -->
  62. <data-box
  63. ref="addAndEdit"
  64. @getList="getList"
  65. />
  66. </div>
  67. </template>
  68. <script>
  69. import { pageList,deleteById } from "@/api/device/pda";
  70. import dataBox from "./dialog/dataBox.vue";
  71. export default {
  72. name: "Robot",
  73. components: { dataBox },
  74. dicts: ['device_sys_type'],
  75. data() {
  76. return {
  77. // 遮罩层
  78. loading: true,
  79. // 选中数组
  80. ids: [],
  81. // 非单个禁用
  82. single: true,
  83. // 非多个禁用
  84. multiple: true,
  85. // 显示搜索条件
  86. showSearch: true,
  87. // 总条数
  88. total: 0,
  89. // 用户表格数据
  90. dataList: null,
  91. // 弹出层标题
  92. title: "",
  93. // 是否显示弹出层
  94. open: false,
  95. // 日期范围
  96. dateRange: [],
  97. // 查询参数
  98. queryParams: {
  99. pageNum: 1,
  100. pageSize: 10,
  101. },
  102. handleExportLoading: false,
  103. tableData: {}
  104. };
  105. },
  106. created() {
  107. this.getList();
  108. },
  109. methods: {
  110. /** 查询列表 */
  111. getList() {
  112. this.loading = true;
  113. pageList({...this.queryParams,deviceType:2})
  114. .then(response => {
  115. this.dataList = response.data.rows;
  116. this.total = response.data.total;
  117. this.loading = false;
  118. }
  119. );
  120. },
  121. // 取消按钮
  122. cancel() {
  123. this.open = false;
  124. },
  125. /** 搜索按钮操作 */
  126. handleQuery() {
  127. this.queryParams.pageNum = 1;
  128. this.getList();
  129. },
  130. /** 重置按钮操作 */
  131. resetQuery() {
  132. this.dateRange = [];
  133. this.$set(this.queryParams, 'id', '');
  134. this.$set(this.queryParams, 'businessType', '');
  135. this.$set(this.queryParams, 'incomeExpenses', '');
  136. this.queryParams.pageNum = 1;
  137. this.handleQuery();
  138. },
  139. /** 详情按钮操作 */
  140. openDetails(row, type) {
  141. this.$refs["addAndEdit"].openDialog("详情", row,3);
  142. },
  143. /** 新增按钮操作 */
  144. handleAdd() {
  145. this.$refs["addAndEdit"].openDialog("新增数据", null,1);
  146. },
  147. /** 修改按钮操作 */
  148. handleUpdate(row) {
  149. this.$refs["addAndEdit"].openDialog("修改数据", row,2);
  150. },
  151. /** 删除按钮操作 */
  152. handleDelete(row) {
  153. const dataIds = row.id || this.ids;
  154. this.$modal.confirm('是否确认删除数据编号为"' + dataIds + '"的数据项?').then(function() {
  155. return deleteById(dataIds);
  156. }).then(() => {
  157. this.getList();
  158. this.$modal.msgSuccess("删除成功");
  159. }).catch((e) => {console.log("e====",e) });
  160. }
  161. }
  162. };
  163. </script>