index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="10" class="mb8" style="margin-left: 0; margin-top: 10px">
  4. <el-button
  5. type="primary"
  6. plain
  7. icon="el-icon-plus"
  8. size="mini"
  9. @click="getList"
  10. v-hasPermi="['gateMr:gateMr:synchronous']"
  11. >同步</el-button>
  12. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  13. </el-row>
  14. <el-table ref="tables" v-loading="loading" :data="dataList" border>
  15. <el-table-column label="序号" align="center" type="index" width="60"></el-table-column>
  16. <el-table-column label="设备名称" align="center" prop="deviceName" />
  17. <el-table-column label="设备型号" align="center" prop="deviceCode" />
  18. <el-table-column label="验票站点" align="center" prop="deviceAddress" />
  19. <el-table-column label="出口\入口" align="center" prop="isExit">
  20. <template slot-scope="scope">
  21. <span>{{ !scope.row.isExit&&scope.row.isExit!=0?'': scope.row.isExit==0?'入口': '出口'}}</span>
  22. </template>
  23. </el-table-column>
  24. <el-table-column label="设备编码" align="center" prop="deviceNo" />
  25. <el-table-column label="在线状态" align="center" prop="onlineStatus">
  26. <template slot-scope="scope">
  27. <span>{{ !scope.row.onlineStatus&&scope.row.onlineStatus!=0?'': scope.row.onlineStatus==0?'离线': '在线'}}</span>
  28. </template>
  29. </el-table-column>
  30. <el-table-column label="添加时间" align="center" prop="createTime" width="160" >
  31. <template slot-scope="scope">
  32. <span>{{ parseTime(scope.row.createTime) }}</span>
  33. </template>
  34. </el-table-column>
  35. <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
  36. <template slot-scope="scope">
  37. <el-button
  38. size="mini"
  39. type="text"
  40. @click="openOrCloseFun(scope.row,true)"
  41. v-hasPermi="['gateMr:gateMr:open']"
  42. >开闸</el-button>
  43. <el-button
  44. size="mini"
  45. type="text"
  46. @click="openOrCloseFun(scope.row,false)"
  47. v-hasPermi="['gateMr:gateMr:close']"
  48. >关闸</el-button>
  49. </template>
  50. </el-table-column>
  51. </el-table>
  52. <pagination
  53. v-show="total>0"
  54. :total="total"
  55. :page.sync="queryParams.pageNum"
  56. :limit.sync="queryParams.pageSize"
  57. @pagination="getList"
  58. />
  59. </div>
  60. </template>
  61. <script>
  62. import { pageList,openOrClose } from '@/api/device/gateMr'
  63. export default {
  64. name: "gateMr",
  65. data() {
  66. return {
  67. // 遮罩层
  68. loading: true,
  69. // 选中数组
  70. ids: [],
  71. // 非单个禁用
  72. single: true,
  73. // 非多个禁用
  74. multiple: true,
  75. // 显示搜索条件
  76. showSearch: true,
  77. // 总条数
  78. total: 0,
  79. // 用户表格数据
  80. dataList: null,
  81. // 弹出层标题
  82. title: "",
  83. // 是否显示弹出层
  84. open: false,
  85. // 日期范围
  86. dateRange: [],
  87. // 查询参数
  88. queryParams: {
  89. pageNum: 1,
  90. pageSize: 9999,
  91. },
  92. visibleStatus: false,
  93. newObj: {},
  94. visibleType: '',
  95. handleExportLoading: false,
  96. tableData: {}
  97. };
  98. },
  99. created() {
  100. this.getList();
  101. },
  102. methods: {
  103. /** 查询列表 */
  104. getList() {
  105. this.loading = true;
  106. pageList(this.queryParams)
  107. .then(response => {
  108. this.dataList = response.data.rows;
  109. this.total = response.data.total;
  110. this.loading = false;
  111. }
  112. );
  113. },
  114. /**
  115. * 同步
  116. * @date 2022-10-24
  117. * @returns {any}
  118. */
  119. synchronousEven() {
  120. },
  121. /**
  122. * 开闸 或 关闸
  123. * type=ture 开闸
  124. */
  125. openOrCloseFun(row,type) {
  126. this.$confirm(`确定${type?'开闸':'关闸'}吗?`, '提示', {
  127. confirmButtonText: '确定',
  128. cancelButtonText: '取消',
  129. type: 'warning'
  130. }).then(async () => {
  131. let { code,data } = await openOrClose({id: row.id,status:type?1:2})
  132. this.$message.success("操作成功!");
  133. }).catch((error) => {
  134. console.error("error===",error)
  135. // this.$message.error("操作失败!");
  136. });
  137. }
  138. }
  139. };
  140. </script>