25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

596 satır
18 KiB

  1. <template>
  2. <div class="box-center">
  3. <div class="toptab" style="cursor: pointer;">
  4. <div
  5. @click="tapclickyab(0)"
  6. :class="{ activecllasscet: activeTotal == 0 }"
  7. :style="{ background: activeTotal == 0 ? '#2671E2' : '#ffffff' }"
  8. >
  9. 设备离线记录
  10. </div>
  11. <div
  12. @click="tapclickyab(1)"
  13. :class="{ activecllasscet: activeTotal == 1 }"
  14. :style="{ background: activeTotal == 1 ? '#2671E2' : '#ffffff' }"
  15. >
  16. 设备指派记录
  17. </div>
  18. </div>
  19. <div class="titlebox" v-if="activeTotal == 0">
  20. <div
  21. style="
  22. background: #ffffff;
  23. padding-left: 18px;
  24. display: flex;
  25. padding-top: 18px;
  26. "
  27. >
  28. <span style="line-height: 40px" class="demonstration">离线时间:</span>
  29. <el-date-picker
  30. @change="confirmtime()"
  31. v-model="customtime"
  32. type="daterange"
  33. range-separator="-"
  34. :default-time="['00:00:00', '23:59:59']"
  35. value-format="yyyy-MM-dd"
  36. start-placeholder="开始日期"
  37. end-placeholder="结束日期"
  38. >
  39. </el-date-picker>
  40. <span class="demonstration" v-if="orgType!=3" style="margin-left: 18px; line-height: 40px"
  41. >项目名称:</span
  42. >
  43. <div style="width: 200px" v-if="orgType!=3">
  44. <!-- <el-input v-model="page.houseName"></el-input>-->
  45. <el-select v-model="page.houseName" filterable placeholder="请选择">
  46. <el-option
  47. v-for="item in houseList"
  48. :key="item.id"
  49. :label="item.propertyName"
  50. :value="item.id"
  51. >
  52. </el-option>
  53. </el-select>
  54. </div>
  55. </div>
  56. <div
  57. style="
  58. background: #ffffff;
  59. padding-left: 18px;
  60. display: flex;
  61. padding-top: 18px;
  62. "
  63. >
  64. <span style="line-height: 40px" class="demonstration">领用人:</span>
  65. <div style="width: 200px">
  66. <el-input maxlength="10" clearable placeholder="领用人" v-model="page.accountName"></el-input>
  67. </div>
  68. <span class="demonstration" style="margin-left: 18px; line-height: 40px"
  69. >设备编号:</span
  70. >
  71. <div style="width: 200px">
  72. <el-input maxlength="20" placeholder="设备编号" clearable v-model="page.imei"></el-input>
  73. </div>
  74. </div>
  75. <div
  76. style="
  77. background: #ffffff;
  78. padding-left: 18px;
  79. display: flex;
  80. padding-top: 18px;
  81. "
  82. >
  83. <div style="margin-left: 20px">
  84. <el-button
  85. @click="screening()"
  86. style="background: #2671e2; color: #ffffff"
  87. >筛选</el-button
  88. >
  89. </div>
  90. <div style="margin-left: 20px">
  91. <el-button @click="empty()" type="text">清空筛选条件</el-button>
  92. </div>
  93. <div style="margin-left: auto;margin-right:10px;" v-if="equ_edg_download">
  94. <el-button @click="downLoad" icon="el-icon-download">导出</el-button>
  95. </div>
  96. </div>
  97. </div>
  98. <div class="tablebox" v-if="activeTotal == 0">
  99. <template>
  100. <el-table :data="tableData" style="width: 100%" :header-cell-style="{background:'#F5F7FA',color:'#333333'}">
  101. <el-table-column prop="index" label="序号" width="100" align="center">
  102. </el-table-column>
  103. <el-table-column prop="imei" label="设备编号" align="center">
  104. </el-table-column>
  105. <el-table-column prop="accountName" label="领用人" align="center">
  106. </el-table-column>
  107. <el-table-column prop="openTime" label="离线开始时间" align="center">
  108. </el-table-column>
  109. <el-table-column prop="closeTime" label="恢复在线时间" align="center">
  110. </el-table-column>
  111. <el-table-column prop="offlineTimeStr" label="离线时长" align="center">
  112. </el-table-column>
  113. <el-table-column prop="offStatusName" label="离线原因" align="center">
  114. </el-table-column>
  115. </el-table>
  116. </template>
  117. <div style="display: flex; justify-content: flex-end; margin-top: 10px">
  118. <el-pagination
  119. @size-change="handleSizeChange"
  120. @current-change="handleCurrentChange"
  121. :current-page="page.pageNum"
  122. :page-sizes="[ 10, 30, 50]"
  123. :page-size="page.pageSize"
  124. layout="total, sizes, prev, pager, next, jumper"
  125. :total="page.total"
  126. >
  127. </el-pagination>
  128. </div>
  129. </div>
  130. <div class="titlebox" v-if="activeTotal == 1">
  131. <div
  132. style="
  133. background: #ffffff;
  134. padding-left: 18px;
  135. display: flex;
  136. padding-top: 18px;
  137. "
  138. >
  139. <span style="line-height: 40px" class="demonstration">指派时间:</span>
  140. <el-date-picker
  141. @change="confirmtime()"
  142. v-model="customtime"
  143. type="daterange"
  144. range-separator="-"
  145. :default-time="['00:00:00', '23:59:59']"
  146. value-format="yyyy-MM-dd"
  147. start-placeholder="开始日期"
  148. end-placeholder="结束日期"
  149. >
  150. </el-date-picker>
  151. <span class="demonstration" v-if="orgType!=3" style="margin-left: 18px; line-height: 40px"
  152. >项目名称:</span
  153. >
  154. <div style="width: 200px;" v-if="orgType!=3">
  155. <!-- <el-input v-model="page.houseName"></el-input>-->
  156. <el-select v-model="page.houseName" filterable placeholder="请选择">
  157. <el-option
  158. v-for="item in houseList"
  159. :key="item.id"
  160. :label="item.propertyName"
  161. :value="item.id"
  162. >
  163. </el-option>
  164. </el-select>
  165. </div>
  166. </div>
  167. <div
  168. style="
  169. background: #ffffff;
  170. padding-left: 18px;
  171. display: flex;
  172. padding-top: 18px;
  173. "
  174. >
  175. <span style="line-height: 40px" class="demonstration">领用人:</span>
  176. <div style="width: 200px">
  177. <el-input v-model="page.accountName" placeholder="领用人"></el-input>
  178. </div>
  179. <span class="demonstration" style="margin-left: 18px; line-height: 40px"
  180. >设备编号:</span
  181. >
  182. <div style="width: 200px">
  183. <el-input v-model="page.imei" placeholder="设备编号"></el-input>
  184. </div>
  185. <span class="demonstration" style="margin-left: 18px; line-height: 40px"
  186. >录音结果:</span
  187. >
  188. <div style="width: 200px">
  189. <el-select v-model="page.recording" placeholder="请选择">
  190. <el-option
  191. v-for="item in options"
  192. :key="item.value"
  193. :label="item.label"
  194. :value="item.value"
  195. >
  196. </el-option>
  197. </el-select>
  198. </div>
  199. </div>
  200. <div
  201. style="
  202. background: #ffffff;
  203. padding-left: 18px;
  204. display: flex;
  205. padding-top: 18px;
  206. "
  207. >
  208. <div style="margin-left: 20px">
  209. <el-button
  210. @click="screening()"
  211. style="background: #2671e2; color: #ffffff"
  212. >筛选</el-button
  213. >
  214. </div>
  215. <div style="margin-left: 20px">
  216. <el-button @click="empty()" type="text">清空筛选条件</el-button>
  217. </div>
  218. <div style="margin-left: auto;margin-right:10px;" v-if="equ_edg_download">
  219. <el-button @click="downLoad" icon="el-icon-download">导出</el-button>
  220. </div>
  221. </div>
  222. </div>
  223. <div class="tablebox" v-if="activeTotal == 1">
  224. <template>
  225. <el-table :data="tableData" style="width: 100%" :header-cell-style="{background:'#F5F7FA',color:'#333333'}">
  226. <el-table-column prop="index" label="序号" width="100" align="center">
  227. </el-table-column>
  228. <el-table-column prop="imei" label="设备编号" align="center">
  229. </el-table-column>
  230. <el-table-column prop="agentName" label="领用人" align="center">
  231. </el-table-column>
  232. <!-- <el-table-column-->
  233. <!-- prop="id"-->
  234. <!-- label="接待记录ID"-->
  235. <!-- align="center">-->
  236. <!-- </el-table-column>-->
  237. <el-table-column prop="staTime" label="指派时间" align="center">
  238. </el-table-column>
  239. <el-table-column prop="endTime" label="结束时间" align="center">
  240. <template slot-scope="scope">
  241. {{ scope.row.endTime.substring(0, 19) }}
  242. </template>
  243. </el-table-column>
  244. <el-table-column prop="recordingName" label="录音结果" align="center">
  245. </el-table-column>
  246. <el-table-column
  247. prop="recordingReasonName"
  248. label="未完整录音原因"
  249. align="center"
  250. >
  251. </el-table-column>
  252. <el-table-column prop="" label="操作" align="center" v-if="equ_edg_detail">
  253. <template slot-scope="{ row }">
  254. <el-button
  255. v-if="row.recording != 0&&equ_edg_detail"
  256. @click.native.prevent="goinfo(row)"
  257. type="text"
  258. size="small"
  259. >接待详情</el-button
  260. >
  261. </template>
  262. </el-table-column>
  263. </el-table>
  264. </template>
  265. <div style="display: flex; justify-content: flex-end; margin-top: 10px">
  266. <el-pagination
  267. @size-change="handleSizeChange"
  268. @current-change="handleCurrentChange"
  269. :current-page="page.pageNum"
  270. :page-sizes="[ 10, 30, 50]"
  271. :page-size="page.pageSize"
  272. layout="total, sizes, prev, pager, next, jumper"
  273. :total="page.total"
  274. >
  275. </el-pagination>
  276. </div>
  277. </div>
  278. </div>
  279. </template>
  280. <script>
  281. import { mapGetters } from "vuex";
  282. export default {
  283. data() {
  284. return {
  285. activeTotal: 0,
  286. customtime: "",
  287. tableData: [],
  288. currentPage4: 1,
  289. orgType:localStorage.getItem('orgType'),
  290. houseList: [],
  291. flag: false,
  292. page: {
  293. pageNum: 1,
  294. pageSize: 10,
  295. openTime: "",
  296. closeTime: "",
  297. houseName: "",
  298. accountName: "",
  299. imei: "",
  300. total: 10,
  301. recording: "",
  302. },
  303. options: [
  304. {
  305. value: "0",
  306. label: "无录音",
  307. },
  308. {
  309. value: "1",
  310. label: "部分录音",
  311. },
  312. {
  313. value: "2",
  314. label: "完整录音",
  315. },
  316. ],
  317. };
  318. },
  319. computed: {
  320. ...mapGetters(["permissions"]),
  321. },
  322. created() {
  323. this.equ_edg_detail = this.permissions["equ_edg_detail"];
  324. this.equ_edg_download = this.permissions["equ_edg_download"];
  325. },
  326. mounted() {
  327. // return
  328. let theRequest = this.$route.query;
  329. console.log(theRequest, "123"); //此时的theRequest就是我们需要的参数;
  330. if (theRequest.houseId) {
  331. this.activeTotal = theRequest.flag;
  332. this.flag = true;
  333. this.page.openTime = theRequest.startDate;
  334. this.page.closeTime = theRequest.endDate;
  335. this.customtime = [theRequest.startDate, theRequest.endDate];
  336. this.page.houseName = theRequest.houseId;
  337. } else {
  338. let num = 24 * 3600 * 1000 * 6;
  339. let time1 = this.timestampToTime(new Date().getTime() - num);
  340. console.log(this.timestampToTime(new Date().getTime()), time1);
  341. this.page.openTime = time1.trim();
  342. this.page.closeTime = this.timestampToTime(new Date().getTime()).trim();
  343. this.customtime = [this.page.openTime, this.page.closeTime];
  344. }
  345. // this.activeTotal=0;
  346. // this.customtime=[] ;
  347. this.tableData = [];
  348. this.tableData1 = [];
  349. this.getHouseList();
  350. },
  351. methods: {
  352. downLoad(){
  353. let obj = {
  354. imei: this.page.imei,
  355. };
  356. if (this.activeTotal == 0) {
  357. obj.openTime = this.page.openTime;
  358. obj.closeTime = this.page.closeTime;
  359. obj.houseId = this.page.houseName;
  360. obj.accountName = this.page.accountName;
  361. this.exportMethodPost('autoSR/zk/equipment/onlineRecordListExport','设备在线记录',obj)
  362. } else {
  363. obj.staDate = this.page.openTime;
  364. obj.endDate = this.page.closeTime;
  365. obj.projectId = this.page.houseName;
  366. obj.agentName = this.page.accountName;
  367. obj.recording = this.page.recording;
  368. this.exportMethodPost('autoSR/zk/equipment/assignmentRecordListExport','设备指派记录',obj)
  369. }
  370. },
  371. // 导出.Excel公用方法
  372. exportMethodPost(url, name, data = {}) {
  373. axios({
  374. method: "get",
  375. url: url,
  376. params:data,
  377. responseType: "blob",
  378. })
  379. .then((res) => {
  380. let blob = new Blob([res], { type: "application/vnd.ms-excel" });
  381. let date = new Date();
  382. let time = date.toLocaleDateString();
  383. // console.log(time, "时间");
  384. if ("download" in document.createElement("a")) {
  385. const link = document.createElement("a");
  386. link.style.display = "none";
  387. link.href = URL.createObjectURL(blob);
  388. // link.download = res.headers['content-disposition'] //下载后文件名
  389. link.download = (name || "导出文件") + time + ".xlsx"; //下载的文件名
  390. document.body.appendChild(link);
  391. link.click();
  392. document.body.removeChild(link);
  393. } else {
  394. // console.log("--------------------jingla")
  395. let fileName = (name || "导出文件") + time + ".xlsx"; //下载的文件名
  396. navigator.msSaveBlob(blob, fileName);
  397. }
  398. })
  399. .catch((error) => {
  400. // Message.error({
  401. // message: '网络连接错误'
  402. // })
  403. console.log(error);
  404. });
  405. },
  406. timestampToTime(timestamp) {
  407. var date = new Date(timestamp); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
  408. // var date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
  409. var yyyy = date.getFullYear() + "-";
  410. var MM =
  411. (date.getMonth() + 1 < 10
  412. ? "0" + (date.getMonth() + 1)
  413. : date.getMonth() + 1) + "-";
  414. // var dd = date.getDate() + ' ';
  415. var dd =
  416. (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " ";
  417. return yyyy + MM + dd;
  418. },
  419. //时间补0
  420. Zeropadding(s) {
  421. return s < 10 ? "0" + s : s;
  422. },
  423. tapclickyab(i) {
  424. this.activeTotal = i;
  425. this.getTableList();
  426. },
  427. screening() {
  428. this.page.pageNum = 1;
  429. // this.page.pageSize = 6;
  430. this.getTableList();
  431. },
  432. goinfo(row) {
  433. console.log(row);
  434. return;
  435. location.href = "${jypath}/zk/file/receptionDetails";
  436. localStorage.setItem("AudioListId", row.id);
  437. localStorage.setItem("AudioIdx", 0);
  438. },
  439. empty() {
  440. this.page = {
  441. pageNum: 1,
  442. pageSize: 10,
  443. openTime: "",
  444. closeTime: "",
  445. // houseName: this.houseList[0].id,
  446. houseName:this.orgType==3? localStorage.getItem('houseId'):this.houseList[0].id,
  447. accountName: "",
  448. imei: "",
  449. total: "",
  450. };
  451. this.customtime = "";
  452. this.getTableList();
  453. },
  454. //时间选择
  455. confirmtime() {
  456. console.log(this.customtime);
  457. this.page.openTime = this.customtime[0];
  458. this.page.closeTime = this.customtime[1];
  459. },
  460. handleSizeChange(val) {
  461. console.log("每页条" + val);
  462. this.page.pageSize = val;
  463. this.getTableList();
  464. },
  465. handleCurrentChange(val) {
  466. console.log("当前页" + val);
  467. this.page.pageNum = val;
  468. this.getTableList();
  469. },
  470. //获取项目数据
  471. getHouseList() {
  472. axios({
  473. url: `/autoSR/zkhouse/findHouseByUser`,
  474. method: "get",
  475. params:{
  476. orgType:this.orgType,
  477. agentId:localStorage.getItem("agentId"),
  478. orgCode:localStorage.getItem("orgCode"),
  479. }
  480. }).then((res) => {
  481. // console.log(res.data.obj)
  482. this.houseList = res.data;
  483. if (!this.flag) {
  484. if (localStorage.getItem("orgType") == 3) {
  485. this.page.houseName = localStorage.getItem("houseId");
  486. } else {
  487. this.page.houseName = res.data[0].id;
  488. }
  489. // this.page.houseName = res.data[0].id;
  490. }
  491. this.getTableList();
  492. });
  493. },
  494. //获取table数据、
  495. getTableList() {
  496. console.log(this.activeTotal, "888888888888888888888");
  497. var url = "";
  498. let obj = {
  499. current: this.page.pageNum,
  500. size: this.page.pageSize,
  501. imei: this.page.imei,
  502. };
  503. this.tableData = [];
  504. if (this.activeTotal == 0) {
  505. url = `autoSR/zk/equipment/onlineRecordList`;
  506. obj.openTime = this.page.openTime;
  507. obj.closeTime = this.page.closeTime;
  508. obj.houseId = this.page.houseName;
  509. obj.accountName = this.page.accountName;
  510. } else {
  511. url = `autoSR/zk/equipment/assignmentRecordList`;
  512. obj.staDate = this.page.openTime;
  513. obj.endDate = this.page.closeTime;
  514. obj.projectId = this.page.houseName;
  515. obj.agentName = this.page.accountName;
  516. obj.recording = this.page.recording;
  517. }
  518. axios({
  519. url: url,
  520. method: "get",
  521. params: obj,
  522. }).then((res) => {
  523. // console.log(res)
  524. if (!res.data.records) return;
  525. res.data.records.forEach((item, index) => {
  526. item.index = index + 1;
  527. });
  528. this.tableData = res.data.records;
  529. this.page.total = res.data.total;
  530. });
  531. },
  532. },
  533. };
  534. </script>
  535. <style scoped lang="less">
  536. /deep/ .el-table__header-wrapper{
  537. thead{
  538. tr{
  539. th{
  540. background: #F5F7FA;
  541. color: #333333;
  542. }
  543. }
  544. }
  545. }
  546. .box-center {
  547. width: 100%;
  548. padding: 5px 15px 40px;
  549. min-width: 1000px;
  550. }
  551. .toptab {
  552. width: 100%;
  553. display: flex;
  554. }
  555. .toptab div {
  556. padding-left: 30px;
  557. padding-right: 30px;
  558. padding-top: 10px;
  559. padding-bottom: 10px;
  560. font-size: 14px;
  561. }
  562. .activecllasscet {
  563. color: #ffffff;
  564. }
  565. .titlebox {
  566. width: 100%;
  567. background: #ffffff;
  568. box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.04);
  569. border-radius: 8px;
  570. margin-top: 20px;
  571. padding-bottom: 18px;
  572. }
  573. .tablebox {
  574. width: 100%;
  575. background: #ffffff;
  576. box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.04);
  577. border-radius: 8px;
  578. margin-top: 20px;
  579. padding: 18px;
  580. }
  581. /deep/ .el-button--text{
  582. color: #2671E2;
  583. }
  584. </style>