inspectionsRecordsStatistics.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <div class="main">
  3. <div class="search">
  4. <el-input
  5. placeholder="巡检设备编号/名称"
  6. class="search-input"
  7. clearable
  8. v-model="mixins_query.no"
  9. ></el-input>
  10. <el-select
  11. v-model="mixins_query.communityId"
  12. placeholder="请选择所属社区"
  13. >
  14. <el-option
  15. v-for="(item, index) in communityArr"
  16. :key="index"
  17. :label="item.communityName"
  18. :value="item.id"
  19. ></el-option>
  20. </el-select>
  21. <el-cascader
  22. v-model="typeValueW"
  23. :props="defaultProps"
  24. ref="typeValue"
  25. placeholder="请选择"
  26. :options="productOptions"
  27. @change="deviceArrToggle"
  28. ></el-cascader>
  29. <el-date-picker
  30. v-model="times"
  31. value-format="yyyy-MM-dd"
  32. type="daterange"
  33. range-separator="至"
  34. start-placeholder="开始日期"
  35. end-placeholder="结束日期"
  36. @change="effectiveDateToggle"
  37. ></el-date-picker>
  38. <el-button
  39. type="primary"
  40. class="search-btn"
  41. @click="mixins_search"
  42. icon="el-icon-search"
  43. >查询 </el-button>
  44. <div class="search-icon">
  45. <el-tooltip
  46. class="item"
  47. effect="light"
  48. placement="bottom"
  49. content="导出"
  50. >
  51. <i
  52. class="zoniot_font zoniot-icon-daochu2"
  53. @click="exportExcel()"
  54. ></i>
  55. </el-tooltip>
  56. </div>
  57. </div>
  58. <div class="zz-table">
  59. <el-table
  60. :data="mixins_list"
  61. stripe
  62. >
  63. <el-table-column
  64. type="index"
  65. label="No."
  66. > </el-table-column>
  67. <el-table-column
  68. prop="communityName"
  69. label="所属社区"
  70. > </el-table-column>
  71. <el-table-column label="设备设施类型">
  72. <template slot-scope="scope">
  73. {{ scope.row.typeValue || '--' }}
  74. </template>
  75. </el-table-column>
  76. <el-table-column
  77. prop="no"
  78. label="设备编号"
  79. > </el-table-column>
  80. <el-table-column
  81. prop="name"
  82. label="设备名称"
  83. > </el-table-column>
  84. <el-table-column
  85. prop="address"
  86. label="地址"
  87. > </el-table-column>
  88. <el-table-column
  89. prop="checkTime"
  90. label="巡检时间"
  91. > </el-table-column>
  92. <el-table-column
  93. prop="result"
  94. label="巡检结果"
  95. > </el-table-column>
  96. <el-table-column label="图片/视频">
  97. <template slot-scope="scope">
  98. <div v-if="!!scope.row.picturePath">
  99. <div
  100. class="imgVdio"
  101. v-for="item in scope.row.picturePath.split(',')"
  102. :key="item"
  103. >
  104. <video
  105. v-if="typeVideo(item)"
  106. :src="item"
  107. @click="lookVideos(item)"
  108. ></video>
  109. <el-image
  110. class="imgs"
  111. v-else
  112. :src="item"
  113. :preview-src-list="[item]"
  114. ></el-image>
  115. </div>
  116. </div>
  117. </template>
  118. </el-table-column>
  119. <el-table-column
  120. :label="item"
  121. v-for="(item, index) in headArr"
  122. :key="index"
  123. >
  124. <template slot-scope="scope">
  125. {{ scope.row.options[item] || '--' }}
  126. </template>
  127. </el-table-column>
  128. </el-table>
  129. <div class="foot">
  130. <el-pagination
  131. class="pagination"
  132. background
  133. @size-change="pageSize"
  134. @current-change="pageChange"
  135. :current-page="mixins_pageset.currentPage"
  136. :page-sizes="mixins_pageset.pageSizes || [15, 30, 60, 120]"
  137. :page-size="mixins_pageset.pageSize || 15"
  138. :total="mixins_pageset.total || 0"
  139. layout="total, sizes, prev, pager, next, jumper"
  140. >
  141. </el-pagination>
  142. </div>
  143. </div>
  144. </div>
  145. </template>
  146. <script>
  147. import list from '@utils/list.js';
  148. export default {
  149. mixins: [list],
  150. name: 'workOrdersRecords',
  151. data () {
  152. return {
  153. communityArr: [],
  154. productOptions: [],
  155. typeValueW: [],
  156. defaultProps: {
  157. value: 'id', // 唯一标识
  158. label: 'label', // 标签显示
  159. children: 'children'
  160. },
  161. mixins_query: {
  162. communityId: '',
  163. type: '',
  164. typeId: '',
  165. no: ''
  166. },
  167. times: [],
  168. headArr: [],
  169. mixins_post: 'post'
  170. };
  171. },
  172. created () {
  173. let p1 = new Promise((resolve) => {
  174. this.getorgTree(resolve);
  175. });
  176. let p2 = new Promise((resolve) => {
  177. this.getProductOptions(resolve);
  178. });
  179. this.getTable(p1, p2);
  180. },
  181. mounted () { },
  182. methods: {
  183. typeVideo (str) {
  184. let type = str.slice(str.lastIndexOf('.') + 1, str.length);
  185. let videoType = ['mp4'];
  186. return videoType.includes(type);
  187. },
  188. lookVideos (src) {
  189. new Promise((resolve) => {
  190. this.$store.dispatch('addPopup', {
  191. url: '/lookVideo.vue',
  192. width: '600px',
  193. height: '500px',
  194. props: {
  195. src: src,
  196. callback: resolve
  197. },
  198. showConfirmButton: true,
  199. showCancelButton: true,
  200. hideStar: true,
  201. title: '查看视频'
  202. });
  203. }).then(() => {
  204. this.mixins_search();
  205. });
  206. },
  207. exportExcel () {
  208. this.__exportExcel('/czc-community/inspectionRecord/getInspectionOptionExcel', this.mixins_query);
  209. },
  210. pageChange (obj) {
  211. this.mixins_pageset.pageNum = obj;
  212. this.getList();
  213. },
  214. pageSize (obj) {
  215. this.mixins_pageset.pageSize = obj;
  216. this.getList();
  217. },
  218. getTable (p1, p2) {
  219. Promise.all([p1, p2])
  220. .then((results) => {
  221. new Promise((resolve) => {
  222. this.getHetailHead(resolve);
  223. }).then((res) => {
  224. this.mixins_dataUrl = '/czc-community/inspectionRecord/statisticsDetail';
  225. this.mixins_search();
  226. });
  227. })
  228. .catch((e) => { });
  229. },
  230. effectiveDateToggle (va) {
  231. if (va != null && va.length != 0) {
  232. let arr = va;
  233. if (!arr) {
  234. arr = ['', ''];
  235. }
  236. this.mixins_query.startTime = arr[0] + ' 00:00:00';
  237. this.mixins_query.endTime = arr[1] + ' 23:59:59';
  238. } else {
  239. this.mixins_query.startTime = null;
  240. this.mixins_query.endTime = null;
  241. }
  242. },
  243. getHetailHead (resolve) {
  244. this.$http
  245. .post('/czc-community/inspectionRecord/getstatisticsDetailHead', this.mixins_query)
  246. .then(({ status, data, msg }) => {
  247. if (status == 0) {
  248. this.headArr = data;
  249. resolve && resolve(true);
  250. }
  251. })
  252. .catch((err) => { });
  253. },
  254. getorgTree (resolve) {
  255. this.$http
  256. .get('/czc-community/assets/community/list')
  257. .then((data) => {
  258. this.communityArr = data.data;
  259. this.mixins_query.communityId = data.data[0].id;
  260. this.$store.commit('setAreaSelect', data.data);
  261. resolve && resolve(true);
  262. })
  263. .catch(function () { });
  264. },
  265. getProductOptions (resolve) {
  266. this.$http.postForm('/czc-community/devicetype/getTypeTree', { name: '' }).then((data) => {
  267. this.productOptions = data;
  268. if (data.length !== 0) {
  269. if (!!data[0].children && !!data[0].children[0].children) {
  270. this.mixins_query.type = data[0].children[0].children[0].type;
  271. this.mixins_query.typeId = data[0].children[0].children[0].id;
  272. this.typeValueW = [null, null, data[0].children[0].children[0].id];
  273. }
  274. }
  275. resolve && resolve(true);
  276. });
  277. },
  278. deviceArrToggle (e) {
  279. this.mixins_query.typeId = e[e.length - 1];
  280. if (!!this.mixins_query.typeId) {
  281. this.mixins_query.type = this.$refs.typeValue.getCheckedNodes()[0].data.type;
  282. }
  283. this.getTable();
  284. }
  285. }
  286. };
  287. </script>
  288. <style scoped lang='scss'>
  289. .imgVdio {
  290. display: inline-block;
  291. margin-right: 10px;
  292. .imgs,
  293. video {
  294. width: 64px;
  295. cursor: pointer;
  296. }
  297. }
  298. /deep/ .el-table--striped .el-table__body tr.el-table__row--striped td,
  299. /deep/ .el-table__row--striped {
  300. background: #f8fcff;
  301. }
  302. </style>