index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. <template>
  2. <div class="app-container">
  3. <div class="main-right-box">
  4. <!-- 搜索条件 -->
  5. <div class="main-search-box">
  6. <el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" size="small">
  7. <el-form-item label="检查机构">
  8. <org-tree
  9. v-model="queryParams.orgId"
  10. @defaultOrg="getDefaultOrg"
  11. @checkChange="checkChange"
  12. @click="clickTreeNode"
  13. ref="orgTree"
  14. ></org-tree>
  15. </el-form-item>
  16. <el-form-item label="检测时间" prop="range">
  17. <el-date-picker
  18. v-model="queryParams.range"
  19. style="width: 240px"
  20. value-format="yyyy-MM-dd HH:mm:ss"
  21. :clearable="false"
  22. type="daterange"
  23. range-separator="-"
  24. start-placeholder="开始日期"
  25. end-placeholder="结束日期"
  26. :default-time="['00:00:00', '23:59:59']"
  27. ></el-date-picker>
  28. </el-form-item>
  29. </el-form>
  30. <el-row :gutter="10">
  31. <el-col :span="1.5">
  32. <el-button icon="el-icon-search" size="mini" type="primary" @click="handleQuery"
  33. >搜索
  34. </el-button>
  35. </el-col>
  36. <el-col :span="1.5">
  37. <el-button icon="el-icon-refresh" size="mini" type="primary" @click="resetQuery"
  38. >重置
  39. </el-button>
  40. </el-col>
  41. <el-col :span="1.5">
  42. <el-button icon="el-icon-upload2" size="mini" type="primary" @click="handleExport"
  43. >导出
  44. </el-button>
  45. </el-col>
  46. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  47. </el-row>
  48. </div>
  49. <el-row :gutter="20">
  50. <!-- 日历和饼图 -->
  51. <el-col :xs="24" :sm="12" :md="9" :lg="9">
  52. <p class="card-title">统计</p>
  53. <el-card>
  54. <div>
  55. <Calendar
  56. :startDate="this.queryParams.range[0]"
  57. :endDate="this.queryParams.range[1]"
  58. :doDates="this.doDates"
  59. :unDoDates="this.unDoDates"
  60. :halfDoDates="this.halfDoDates"
  61. @select="onSelectDate"
  62. ></Calendar>
  63. <el-descriptions :column="1">
  64. <el-descriptions-item label="丢失时段">
  65. <!-- <time-line></time-line>-->
  66. <ul class="legend-box">
  67. <li>
  68. <i class="legend" style="background-color: green"></i>
  69. <span>已检</span>
  70. </li>
  71. <li>
  72. <i class="legend" style="background-color: orange"></i>
  73. <span>未检查完全</span>
  74. </li>
  75. <li>
  76. <i class="legend" style="background-color: red"></i>
  77. <span>未检</span>
  78. </li>
  79. </ul>
  80. </el-descriptions-item>
  81. </el-descriptions>
  82. </div>
  83. </el-card>
  84. <div style="height: 340px">
  85. <report
  86. :rateData="this.rateData"
  87. ></report>
  88. </div>
  89. </el-col>
  90. <!-- 分页数据 -->
  91. <el-col :xs="24" :sm="12" :md="15" :lg="15">
  92. <el-table v-loading="loading" :data="dataList" border height="680" size="small">
  93. <el-table-column align="center" label="序号" min-width="50" >
  94. <template v-slot:default="scope">
  95. <span v-text="getPageIndex(scope.$index)"> </span>
  96. </template>
  97. </el-table-column>
  98. <el-table-column align="center" label="地区" prop="affiliatedArea"/>
  99. <el-table-column align="center" label="行社" prop="affiliatedBank"/>
  100. <el-table-column align="center" label="机构名称" prop="orgName"/>
  101. <el-table-column align="center" label="文件名称" prop="fileName"/>
  102. <el-table-column align="center" label="检测时间" prop="recordDate" width="110px"/>
  103. <el-table-column align="center" label="操作人" prop="userName"width="80px"/>
  104. <el-table-column
  105. class-name="small-padding fixed-width"
  106. width="80px"
  107. label="操作"
  108. align="center"
  109. >
  110. <template slot-scope="{ row }">
  111. <el-button
  112. class="el-icon-download"
  113. size="mini"
  114. type="text"
  115. @click="handleDownLoad(row.id)"
  116. >下载
  117. </el-button>
  118. </template>
  119. </el-table-column>
  120. </el-table>
  121. <pagination v-show="total > 0" :limit.sync="queryParams.pageSize" :page.sync="queryParams.pageNum"
  122. :total="total"
  123. @pagination="getList"/>
  124. </el-col>
  125. </el-row>
  126. </div>
  127. </div>
  128. </template>
  129. <script>
  130. import dayjs from "dayjs";
  131. import {mapGetters} from "vuex";
  132. import {pageData, rateData, statistics} from "@/api/iot/dailyCheck";
  133. import OrgTree from "@/components/orgTree/orgQuerySelector.vue";
  134. import DataRangePicker from "@/components/dateTime/daterange.picker.vue";
  135. import Calendar from "./Calendar.vue";
  136. import report from "./report.vue";
  137. export default {
  138. name: "dayiltCheck",
  139. components: {
  140. DataRangePicker,
  141. OrgTree,
  142. Calendar,
  143. report,
  144. },
  145. data() {
  146. return {
  147. // 遮罩层
  148. loading: true,
  149. // 选中数组
  150. ids: [],
  151. // 非单个停用
  152. single: true,
  153. // 非多个停用
  154. multiple: true,
  155. // 显示搜索条件
  156. showSearch: true,
  157. // 总条数
  158. total: 0,
  159. // 弹出层标题
  160. title: "",
  161. // 是否显示弹出层
  162. open: false,
  163. selectedOrgName: "",
  164. // 查询参数
  165. queryParams: {
  166. pageNum: 1,
  167. pageSize: 10,
  168. checkSub: true,
  169. orgId: null,
  170. range: this.getTodayRange(),
  171. },
  172. dataList: [],
  173. doDates: [],
  174. unDoDates: [],
  175. halfDoDates: [],
  176. rateData: {},
  177. };
  178. },
  179. mounted() {
  180. // this.getList();
  181. },
  182. computed: {
  183. ...mapGetters(["roleList", "isAdmin", "orgName"]),
  184. },
  185. methods: {
  186. dayjs,
  187. getTodayRange() {
  188. const start = new Date();
  189. start.setHours(0, 0, 0, 0); // 设置为当天的0点0分0秒
  190. const end = new Date();
  191. end.setHours(23, 59, 59, 999); // 设置为当天的23点59分59秒
  192. return [start, end];
  193. },
  194. onSelectDate(date) {
  195. },
  196. /** 搜索按钮操作 */
  197. handleQuery() {
  198. this.queryParams.pageNum = 1;
  199. this.getList();
  200. },
  201. /** 重置按钮操作 */
  202. resetQuery() {
  203. this.dateRange = [];
  204. this.resetForm("queryForm");
  205. this.selectedOrgName = this.orgName;
  206. this.handleQuery();
  207. },
  208. getDefaultOrg(node) {
  209. this.queryParams.orgId = node.id;
  210. this.selectedOrgName = node.shortName;
  211. this.getList();
  212. },
  213. //单选框状态改变
  214. checkChange(state) {
  215. this.queryParams.checkSub = state;
  216. this.selectedOrgName = node.shortName;
  217. this.getList();
  218. },
  219. // 节点单击事件
  220. clickTreeNode(data) {
  221. if (data == null) {
  222. return;
  223. }
  224. this.queryParams.orgId = data.id;
  225. this.selectedOrgName = node.shortName;
  226. this.getList();
  227. },
  228. handleClose() {
  229. this.show = false;
  230. this.selectMsg = null;
  231. },
  232. /** 查询主机列表 */
  233. getList() {
  234. this.loading = true;
  235. console.log(123, this.queryParams.range);
  236. pageData(this.queryParams).then(response => {
  237. this.dataList = response.rows;
  238. this.total = response.total;
  239. this.loading = false;
  240. }
  241. ).catch((err) => {
  242. this.loading = false;
  243. });
  244. statistics(this.queryParams).then(response => {
  245. this.doDates = response.data.doDates;
  246. this.unDoDates = response.data.unDoDates;
  247. this.halfDoDates = response.data.halfDoDates;
  248. this.loading = false;
  249. }
  250. ).catch((err) => {
  251. this.loading = false;
  252. });
  253. rateData(this.queryParams).then(response => {
  254. this.rateData = response.data;
  255. this.loading = false;
  256. }
  257. ).catch((err) => {
  258. this.loading = false;
  259. });
  260. },
  261. getPageIndex($index) {
  262. //表格序号
  263. return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1
  264. },
  265. /** 导出按钮操作 */
  266. handleDownLoad(id) {
  267. this.download(
  268. "/iot/dailyCheckData/downLoad",
  269. {
  270. id,
  271. },
  272. `${this.selectedOrgName}-${this.$tab.getCurrentTabName()}-${dayjs(
  273. new Date()
  274. ).format("YYYYMMDD")}.xlsx`
  275. );
  276. },
  277. /** 导出按钮操作 */
  278. handleExport() {
  279. if (this.total <1){
  280. this.$modal.alert("暂无可用数据导出");
  281. return;
  282. }
  283. this.download(
  284. "/iot/dailyCheckData/export",
  285. {
  286. ...this.queryParams,
  287. },
  288. `${
  289. this.selectedOrgName
  290. }-${this.$tab.getCurrentTabName()}-${dayjs().format("YYYYMMDD")}.xlsx`
  291. );
  292. },
  293. },
  294. };
  295. </script>
  296. <style lang="scss" scoped>
  297. .tab_font {
  298. font-size: 16px;
  299. font-weight: bold;
  300. }
  301. .home-container {
  302. padding: 20px;
  303. background-color: rgb(240, 242, 245);
  304. .chart-wrapper {
  305. background: #fff;
  306. margin-top: 20px;
  307. }
  308. }
  309. .card-title {
  310. width: 120px;
  311. margin: 0 0 10px 0;
  312. padding-left: 4px;
  313. color: #fff;
  314. line-height: 26px;
  315. font-weight: bold;
  316. letter-spacing: 2px;
  317. background: linear-gradient(to right, #71bfe3, #fff);
  318. }
  319. .card-group {
  320. height: 740px;
  321. .card-title {
  322. margin: 0;
  323. }
  324. }
  325. .tab-panel {
  326. height: 457px;
  327. overflow: auto;
  328. }
  329. //css 透明的属性=
  330. .card-item-icon {
  331. width: 50px;
  332. height: 50px;
  333. &:hover {
  334. opacity: 0.8;
  335. }
  336. }
  337. .msg-item {
  338. font-size: 15px;
  339. padding: 0 10px;
  340. color: #1ea8e9;
  341. line-height: 39px;
  342. display: flex;
  343. justify-content: space-between;
  344. cursor: pointer;
  345. &:hover {
  346. text-decoration: underline;
  347. }
  348. > span {
  349. display: inline-block;
  350. overflow: hidden;
  351. white-space: nowrap;
  352. text-overflow: ellipsis;
  353. text-align: start;
  354. }
  355. .item-title {
  356. flex: 0.75;
  357. }
  358. .item-time {
  359. flex: 0.25;
  360. text-align: right;
  361. }
  362. }
  363. .legend-box {
  364. display: flex;
  365. flex-direction: row;
  366. justify-content: flex-start;
  367. align-items: center;
  368. > li {
  369. display: flex;
  370. flex-direction: row;
  371. justify-content: flex-start;
  372. align-items: center;
  373. margin-right: 20px;
  374. i {
  375. margin-right: 5px;
  376. }
  377. }
  378. }
  379. .legend {
  380. display: block;
  381. width: 10px;
  382. height: 10px;
  383. margin-right: 5px;
  384. }
  385. </style>