statisticAnalysis.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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. this.getList();
  70. },
  71. components: {},
  72. data() {
  73. return {
  74. dateArea: [
  75. this.fmtDate(
  76. new Date(
  77. new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 30)
  78. )
  79. ),
  80. this.fmtDate(new Date()),
  81. ],
  82. tableData: [],
  83. loading: false,
  84. };
  85. },
  86. methods: {
  87. handleClickCZ(row) {
  88. this.$router.push({
  89. path: "/decision/statisticAnalysis/station",
  90. query: {
  91. wpid: row.wpid,
  92. theday: row.theday,
  93. },
  94. });
  95. },
  96. handleClickForm(row) {
  97. this.$router.push({
  98. path: "/decision/statisticAnalysis/form",
  99. query: {
  100. wpid: row.wpid,
  101. theday: row.theday,
  102. },
  103. });
  104. },
  105. handleClick3(row) {
  106. console.log("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", row);
  107. api.analysisplusCommit(row).then((res) => {
  108. console.log("666666666666666666", res);
  109. this.getList();
  110. // this.tableData = res.data;
  111. });
  112. },
  113. getList: function () {
  114. api
  115. .statisticAnalysis({
  116. beginDate: new Date(this.dateArea[0]).formatDate("yyyy-MM-dd"),
  117. endDate: new Date(this.dateArea[1]).formatDate("yyyy-MM-dd"),
  118. })
  119. .then((res) => {
  120. // console.log('666666666666666666',res.data);
  121. this.tableData = res.data;
  122. this.loading=false
  123. });
  124. },
  125. getTime(val) {
  126. //时间戳处理,val=1是默认开始时间(当前月第一天),val=2是默认结束时间(今天)
  127. var date = new Date();
  128. var year = date.getFullYear(),
  129. month = date.getMonth() + 1,
  130. day = date.getDate();
  131. month >= 1 && month <= 9 ? (month = "0" + month) : "";
  132. day >= 0 && day <= 9 ? (day = "0" + day) : "";
  133. var begin = year + "-" + month + "-01";
  134. var end = year + "-" + month + "-" + day;
  135. if (val == 1) {
  136. return begin;
  137. } else if (val == 2) {
  138. return end;
  139. }
  140. },
  141. // 格式化日期
  142. fmtDate(date) {
  143. let curDate = date || new Date();
  144. let year = curDate.getFullYear();
  145. let mouth = curDate.getUTCMonth() + 1;
  146. let day = curDate.getDate();
  147. let hour = curDate.getHours();
  148. let minutes = curDate.getMinutes();
  149. let seconds = curDate.getSeconds();
  150. return (
  151. year +
  152. "-" +
  153. (mouth < 10 ? "0" + mouth : mouth) +
  154. "-" +
  155. (day < 10 ? "0" + day : day) +
  156. " " +
  157. (hour < 10 ? "0" + hour : hour) +
  158. ":" +
  159. (minutes < 10 ? "0" + minutes : minutes) +
  160. ":" +
  161. (seconds < 10 ? "0" + seconds : seconds)
  162. );
  163. },
  164. search() {
  165. this.loading = true;
  166. this.getList();
  167. },
  168. },
  169. };
  170. </script>
  171. <style lang="less" scoped>
  172. .btn {
  173. margin-left: 160px;
  174. border-radius: 5px;
  175. }
  176. .table1 {
  177. margin-top: 60px;
  178. }
  179. /deep/.el-date-editor {
  180. width: 490px;
  181. border-color: black;
  182. }
  183. .block {
  184. margin-left: 20px;
  185. }
  186. /deep/.el-date-editor .el-range-input {
  187. color: #fff;
  188. }
  189. .btn,
  190. .el-button {
  191. margin-left: 10px;
  192. height: 33px !important;
  193. line-height: 33px;
  194. flex: 0 0 auto;
  195. background: transparent;
  196. border: 1px solid #606769;
  197. padding: 0 1.481vh;
  198. color: #606769;
  199. font-size: 1.296vh;
  200. cursor: pointer;
  201. min-height: 0;
  202. }
  203. .el-button:hover {
  204. background-color: black;
  205. color: #05bb4c;
  206. border-color: #05bb4c;
  207. }
  208. .btn:hover {
  209. color: #05bb4c;
  210. border-color: #05bb4c;
  211. }
  212. .aaaa {
  213. background-color: #4d4949;
  214. color: rgb(87 110 108);
  215. }
  216. .aaaa:hover {
  217. border: #4d4949;
  218. background-color: #4d4949;
  219. color: rgb(87 110 108);
  220. }
  221. </style>