statisticAnalysis.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <div>
  3. <div class="block">
  4. <span class="demonstration">选择日期:</span>
  5. <el-date-picker
  6. size="medium"
  7. v-model="dateArea"
  8. type="daterange"
  9. :picker-options="pickerOptions"
  10. range-separator="至"
  11. start-placeholder="开始日期 "
  12. end-placeholder="结束日期 "
  13. align="right"
  14. >
  15. </el-date-picker>
  16. <button class="btn green" @click="search">搜索</button>
  17. </div>
  18. <div class="table1">
  19. <el-table
  20. max-height="80vh"
  21. v-loading="loading"
  22. element-loading-background="rgba(0, 0, 0, 0.8)"
  23. :data="tableData"
  24. :header-cell-style="{
  25. height: '40px',
  26. background: 'rgba(83, 98, 104, 0.2)',
  27. color: '#b2bdc0',
  28. 'border-bottom': '0px solid red',
  29. }"
  30. :cell-style="{
  31. height: '40px',
  32. 'border-bottom': 'solid 0px #242424',
  33. }"
  34. stripe
  35. style="width: 100%; margin-bottom: 10px; overflow-y: auto"
  36. >
  37. <el-table-column prop="wpname" label="场站" align="center" width="360">
  38. </el-table-column>
  39. <el-table-column prop="theday" label="日期" align="center" width="360">
  40. </el-table-column>
  41. <el-table-column align="center" label="操作">
  42. <template #default="scope">
  43. <button @click="handleClickForm(scope.row)" class="btn">
  44. 表底
  45. </button>
  46. <button class="btn" @click="handleClickCZ(scope.row)">场站</button>
  47. </template>
  48. </el-table-column>
  49. <el-table-column align="center" label="操作">
  50. <template #default="scope">
  51. <el-button
  52. @click="handleClick3(scope.row)"
  53. :class="scope.row.isConfirm == 1 ? 'aaaa' : 'btn'"
  54. :disabled="scope.row.isConfirm == 1"
  55. >
  56. 确认</el-button
  57. >
  58. </template>
  59. </el-table-column>
  60. </el-table>
  61. <!-- :class="scope.row.isConfirm == 1 ? 'active' : 'active:hover'" -->
  62. </div>
  63. </div>
  64. </template>
  65. <script>
  66. import api from "@api/economic/index.js";
  67. export default {
  68. created() {
  69. // 将查询的日期存入到routerData
  70. this.routerData.beginDate = this.$route.query.beginDate;
  71. this.routerData.endDate = this.$route.query.endDate;
  72. this.getList();
  73. },
  74. components: {},
  75. data() {
  76. return {
  77. dateArea: [
  78. this.fmtDate(
  79. new Date(
  80. new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 30)
  81. )
  82. ),
  83. this.fmtDate(new Date()),
  84. ],
  85. tableData: [],
  86. loading: false,
  87. routerData: {},
  88. };
  89. },
  90. methods: {
  91. handleClickCZ(row) {
  92. this.$router.push({
  93. path: "/others/statisticAnalysis/station",
  94. query: {
  95. wpid: row.wpid,
  96. theday: row.theday,
  97. isConfirm: row.isConfirm,
  98. beginDate: this.routerData.beginDate,
  99. endDate: this.routerData.endDate,
  100. },
  101. });
  102. },
  103. handleClickForm(row) {
  104. this.$router.push({
  105. path: "/others/statisticAnalysis/form",
  106. query: {
  107. wpid: row.wpid,
  108. theday: row.theday,
  109. isConfirm: row.isConfirm,
  110. beginDate: this.routerData.beginDate,
  111. endDate: this.routerData.endDate,
  112. },
  113. });
  114. },
  115. handleClick3(row) {
  116. api.analysisplusCommit(row).then((res) => {
  117. this.getList();
  118. });
  119. },
  120. getList: function () {
  121. if (this.$route.query.beginDate != null) {
  122. this.dateArea[0] = this.$route.query.beginDate;
  123. this.dateArea[1] = this.$route.query.endDate;
  124. }
  125. api
  126. .statisticAnalysis({
  127. beginDate: new Date(this.dateArea[0]).formatDate("yyyy-MM-dd"),
  128. endDate: new Date(this.dateArea[1]).formatDate("yyyy-MM-dd"),
  129. })
  130. .then((res) => {
  131. this.tableData = res.data;
  132. this.loading = false;
  133. });
  134. },
  135. getTime(val) {
  136. //时间戳处理,val=1是默认开始时间(当前月第一天),val=2是默认结束时间(今天)
  137. var date = new Date();
  138. var year = date.getFullYear(),
  139. month = date.getMonth() + 1,
  140. day = date.getDate();
  141. month >= 1 && month <= 9 ? (month = "0" + month) : "";
  142. day >= 0 && day <= 9 ? (day = "0" + day) : "";
  143. var begin = year + "-" + month + "-01";
  144. var end = year + "-" + month + "-" + day;
  145. if (val == 1) {
  146. return begin;
  147. } else if (val == 2) {
  148. return end;
  149. }
  150. },
  151. // 格式化日期
  152. fmtDate(date) {
  153. let curDate = date || new Date();
  154. let year = curDate.getFullYear();
  155. let mouth = curDate.getUTCMonth() + 1;
  156. let day = curDate.getDate();
  157. let hour = curDate.getHours();
  158. let minutes = curDate.getMinutes();
  159. let seconds = curDate.getSeconds();
  160. return (
  161. year +
  162. "-" +
  163. (mouth < 10 ? "0" + mouth : mouth) +
  164. "-" +
  165. (day < 10 ? "0" + day : day) +
  166. " " +
  167. (hour < 10 ? "0" + hour : hour) +
  168. ":" +
  169. (minutes < 10 ? "0" + minutes : minutes) +
  170. ":" +
  171. (seconds < 10 ? "0" + seconds : seconds)
  172. );
  173. },
  174. search() {
  175. // 将查询的日期存入到routerData
  176. this.routerData.beginDate = new Date(this.dateArea[0]).formatDate(
  177. "yyyy-MM-dd"
  178. );
  179. this.routerData.endDate = new Date(this.dateArea[1]).formatDate(
  180. "yyyy-MM-dd"
  181. );
  182. this.loading = true;
  183. this.getList();
  184. },
  185. },
  186. };
  187. </script>
  188. <style lang="less" scoped>
  189. .btn {
  190. margin-left: 160px;
  191. border-radius: 5px;
  192. }
  193. .table1 {
  194. margin-top: 60px;
  195. }
  196. /deep/.el-date-editor {
  197. width: 490px;
  198. border-color: black;
  199. }
  200. .block {
  201. margin-left: 20px;
  202. }
  203. /deep/.el-date-editor .el-range-input {
  204. color: #fff;
  205. }
  206. .btn,
  207. .el-button {
  208. margin-left: 10px;
  209. height: 33px !important;
  210. line-height: 33px;
  211. flex: 0 0 auto;
  212. background: transparent;
  213. border: 1px solid #606769;
  214. padding: 0 1.481vh;
  215. color: #606769;
  216. font-size: 1.296vh;
  217. cursor: pointer;
  218. min-height: 0;
  219. }
  220. .el-button:hover {
  221. background-color: black;
  222. color: #05bb4c;
  223. border-color: #05bb4c;
  224. }
  225. .btn:hover {
  226. color: #05bb4c;
  227. border-color: #05bb4c;
  228. }
  229. .aaaa {
  230. background-color: #4d4949;
  231. color: rgb(87 110 108);
  232. }
  233. .aaaa:hover {
  234. border: #4d4949;
  235. background-color: #4d4949;
  236. color: rgb(87 110 108);
  237. }
  238. </style>