index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <div class="content main">
  3. <organ-tree @organId="currentOrganId" :buildingType="1"></organ-tree>
  4. <div class="content-right">
  5. <div class="search">
  6. <el-input clearable placeholder="输入设备编号/名称" class="search-input" v-model.trim="mixins_query.name"></el-input>
  7. <el-select v-model="mixins_query.gateType" clearable placeholder="门禁类型" >
  8. <el-option :value="1" label="围墙机"></el-option>
  9. <el-option :value="2" label="单元机"></el-option>
  10. </el-select>
  11. <el-select v-model="mixins_query.deviceStatus" clearable placeholder="设备状态">
  12. <el-option :value="1" label="正常"></el-option>
  13. <el-option :value="2" label="离线"></el-option>
  14. </el-select>
  15. <el-button
  16. class="search-btn"
  17. type="primary"
  18. @click="mixins_search()"
  19. :disabled="mixins_onQuery"
  20. :loading="mixins_onQuery"
  21. icon="el-icon-search"
  22. >搜索</el-button
  23. >
  24. <div class="search-icon">
  25. <el-tooltip class="item" effect="light" placement="bottom" content="添加">
  26. <i class="zoniot_font zoniot-icon-tianjia2" @click="addCard()"></i>
  27. </el-tooltip>
  28. <el-tooltip class="item" effect="light" placement="bottom" content="重启">
  29. <i class="zoniot_font zoniot-icon-chongqi" @click="restartCard()"></i>
  30. </el-tooltip>
  31. <el-tooltip class="item" effect="light" placement="bottom" content="远程开门">
  32. <i class="zoniot_font zoniot-icon-yuanchengkaimen" @click="remoteDoorOpeningCard()"></i>
  33. </el-tooltip>
  34. <el-tooltip class="item" effect="light" placement="bottom" content="删除">
  35. <i class="zoniot_font zoniot-icon-shanchu2" @click="deleteCard()"></i>
  36. </el-tooltip>
  37. </div>
  38. </div>
  39. <zz-table
  40. :settings="{ showCheckbox: true, stripe: true }"
  41. :cols="cols"
  42. :loading="mixins_onQuery"
  43. :data="mixins_list"
  44. :pageset="mixins_pageset"
  45. @page-change="pageChange"
  46. @selection-change="selectionChange"
  47. >
  48. <template slot-scope="scope" slot="opt">
  49. <div class="opt">
  50. <el-tooltip class="item" effect="light" placement="bottom" content="详情">
  51. <i class="zoniot_font zoniot-icon-xiangqing" @click="lookAccessControl(scope.row)"></i>
  52. </el-tooltip>
  53. <el-tooltip class="item" effect="light" placement="bottom" content="替换">
  54. <i class="zoniot_font zoniot-icon-tihuan" @click="replaceCard(scope.row)"></i>
  55. </el-tooltip>
  56. <el-tooltip class="item" effect="light" placement="bottom" content="临时密码">
  57. <i class="zoniot_font zoniot-icon-linshimima" @click="temporaryPasswordCard(scope.row)"></i>
  58. </el-tooltip>
  59. </div>
  60. </template>
  61. </zz-table>
  62. </div>
  63. </div>
  64. </template>
  65. <script>
  66. import list from '@utils/list.js';
  67. export default {
  68. mixins: [list],
  69. data() {
  70. return {
  71. currentId: '',
  72. cols: [
  73. {
  74. label: '门禁机名称',
  75. prop: 'name'
  76. },
  77. {
  78. label: '所属社区',
  79. prop: 'communityName'
  80. },
  81. {
  82. label: '门禁位置',
  83. prop: 'idNumber'
  84. },
  85. {
  86. label: '门禁机类型',
  87. prop: 'communityName'
  88. },
  89. {
  90. label: '设备编号',
  91. prop: 'roomNumber'
  92. },
  93. {
  94. label: '设备状态',
  95. prop: 'roomNumber'
  96. },
  97. {
  98. label: 'APP开门',
  99. prop: 'roomNumber'
  100. },
  101. {
  102. label: '人脸开门',
  103. prop: 'roomNumber'
  104. },
  105. {
  106. label: '临时密码开门',
  107. prop: 'roomNumber'
  108. },
  109. {
  110. label: '临时密码',
  111. prop: 'roomNumber'
  112. },
  113. {
  114. label: '临时密码有效期',
  115. prop: 'roomNumber'
  116. },
  117. {
  118. label: '操作',
  119. slot: 'opt',
  120. width: 150
  121. }
  122. ],
  123. thisLeftData: {},
  124. selectRow: [],
  125. mixins_post: 'get'
  126. };
  127. },
  128. methods: {
  129. currentOrganId(data) {
  130. this.currentId = data || '';
  131. },
  132. selectionChange(val) {
  133. this.selectRow = val;
  134. },
  135. CheckChinese(val, name) {
  136. var reg = new RegExp('[\\u4E00-\\u9FFF]+', 'g');
  137. let newVal = val;
  138. if (!reg.test(val)) {
  139. newVal = val + name;
  140. }
  141. return newVal;
  142. },
  143. checkDateType(time) {
  144. return !!time ? this.$moment(new Date(time)).format('YYYY-MM-DD') : '--';
  145. },
  146. addCard() {
  147. new Promise((resolve) => {
  148. this.$store.dispatch('addPopup', {
  149. url: '/deviceManagement/accessControlMachineManagement/popups/add.vue',
  150. width: '548px',
  151. height: '724px',
  152. props: {
  153. callback: resolve
  154. },
  155. hideStar: false,
  156. title: '添加门禁机'
  157. });
  158. }).then(() => {
  159. this.mixins_search();
  160. });
  161. },
  162. restartCard() {
  163. //获取选中列表的ids
  164. let ids = [];
  165. if (!this.selectRow.length) {
  166. this.$message.error('您尚未选择,请选择后再操作');
  167. return;
  168. }
  169. this.selectRow.forEach((v) => {
  170. ids.push(v.id);
  171. });
  172. this.$msgBox(`门禁机重启`, '重启时无法开门,你确定继续吗?')
  173. .then(() => {
  174. this.$message({
  175. type: 'success',
  176. message: '重启成功!'
  177. });
  178. // this.$http.post('/sc-community/assets/house/delete', ids).then(({ status, data, msg }) => {
  179. // if (0 === status) {
  180. // this.$message({
  181. // type: 'success',
  182. // message: '重启成功!'
  183. // });
  184. // this.mixins_search();
  185. // } else {
  186. // this.$message.error(msg);
  187. // }
  188. // });
  189. })
  190. .catch(() => {});
  191. },
  192. remoteDoorOpeningCard() {
  193. let ids = [];
  194. if (!this.selectRow.length) {
  195. this.$message.error('您尚未选择,请选择后再操作');
  196. return;
  197. }
  198. this.selectRow.forEach((v) => {
  199. ids.push(v.id);
  200. });
  201. this.$msgBox(`远程开门`, `已选${ids.length}台门禁机,其中${ids.length}台在线,是否远程开门?`)
  202. .then(() => {
  203. this.$message({
  204. type: 'success',
  205. message: '远程开门成功!'
  206. });
  207. // this.$http.post('/sc-community/assets/house/delete', ids).then(({ status, data, msg }) => {
  208. // if (0 === status) {
  209. // this.$message({
  210. // type: 'success',
  211. // message: '重启成功!'
  212. // });
  213. // this.mixins_search();
  214. // } else {
  215. // this.$message.error(msg);
  216. // }
  217. // });
  218. })
  219. .catch(() => {});
  220. },
  221. deleteCard() {
  222. //获取选中列表的ids
  223. let ids = [];
  224. if (!this.selectRow.length) {
  225. this.$message.error('您尚未选择,请选择后再操作');
  226. return;
  227. }
  228. this.selectRow.forEach((v) => {
  229. ids.push(v.id);
  230. });
  231. this.$msgBox(`删除确认`, '门禁设备删除后,人员将无法正常开启门禁')
  232. .then(() => {
  233. this.$message({
  234. type: 'success',
  235. message: '重启成功!'
  236. });
  237. // this.$http.post('/sc-community/assets/house/delete', ids).then(({ status, data, msg }) => {
  238. // if (0 === status) {
  239. // this.$message({
  240. // type: 'success',
  241. // message: '重启成功!'
  242. // });
  243. // this.mixins_search();
  244. // } else {
  245. // this.$message.error(msg);
  246. // }
  247. // });
  248. })
  249. .catch(() => {});
  250. },
  251. lookAccessControl(row) {
  252. new Promise((resolve) => {
  253. this.$store.dispatch('addPopup', {
  254. url: '/deviceManagement/accessControlMachineManagement/popups/details.vue',
  255. width: '615px',
  256. height: '724px',
  257. props: {
  258. callback: resolve
  259. },
  260. hideStar: true,
  261. showCancelButton: true,
  262. showConfirmButton: true,
  263. title: '门禁机信息'
  264. });
  265. }).then(() => {
  266. this.mixins_search();
  267. });
  268. },
  269. replaceCard(row) {},
  270. temporaryPasswordCard(row) {}
  271. },
  272. watch: {
  273. currentId(newValue, oldValue) {
  274. this.mixins_query.communityId = '';
  275. this.mixins_query.buildingId = '';
  276. this.mixins_query.unitName = '';
  277. this.mixins_query.roomNumber = '';
  278. if (newValue.type) {
  279. let newValueIds = newValue.id.split('-');
  280. if (newValue.type === 'community') {
  281. this.mixins_query.communityId = newValueIds[0];
  282. } else if (newValue.type === 'building') {
  283. this.mixins_query.buildingId = newValueIds[1];
  284. } else if (newValue.type === 'unit') {
  285. this.mixins_query.buildingId = newValueIds[1];
  286. this.mixins_query.unitName = newValueIds[2];
  287. } else if (newValue.type === 'room') {
  288. this.mixins_query.roomNumber = newValueIds[newValueIds.length - 1];
  289. }
  290. }
  291. this.thisLeftData = newValue;
  292. this.mixins_search();
  293. }
  294. },
  295. created() {
  296. this.mixins_dataUrl = '/sc-gate-web/gate/page'; // 分页查询接口
  297. this.mixins_query = {};
  298. this.mixins_search();
  299. }
  300. };
  301. </script>