CZTJtable.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <div>
  3. <!-- 标题 -->
  4. <div class="title" style="margin-top: 10px">
  5. <div style="display: flex; justify-content: space-between">
  6. <h1 style="color: azure">漯河亿通集团数据看板</h1>
  7. <div class="time">
  8. <span class="iconfont icon-riqi"></span>&nbsp;&nbsp;{{ currentTime }}
  9. </div>
  10. </div>
  11. <img src="../../assets/bargound/图层 6.png" width="100%" />
  12. </div>
  13. <div class="content">
  14. <!-- 库存车辆 -->
  15. <el-tabs type="border-card" class="theme">
  16. <div style="display: flex; justify-content: space-between">
  17. <!-- 图标 -->
  18. <div>
  19. <p>
  20. <img src="../../assets/bargound/data.png" alt="" /><span
  21. class="kccl"
  22. >产值统计</span
  23. >
  24. </p>
  25. </div>
  26. <div style="display: flex">
  27. <!-- 下拉框 -->
  28. <div style="margin-right: 20px">
  29. <el-select class="select" v-model="company_ids" multiple placeholder="请选择" style="width: 200px">
  30. <el-option v-for="item in options" :key="item.value" :label="item.text" :value="item.value">
  31. </el-option>
  32. </el-select>
  33. </div>
  34. <!-- 日期表 -->
  35. <div class="dataForm" style="margin-right: 20px">
  36. <el-date-picker
  37. v-model="value1"
  38. type="daterange"
  39. range-separator="——"
  40. start-placeholder="开始日期"
  41. end-placeholder="结束日期"
  42. >
  43. </el-date-picker>
  44. </div>
  45. <!-- 按钮 -->
  46. <el-button
  47. @click="searchBtn"
  48. style="background-color: rgb(40, 155, 209); color: black"
  49. >搜索</el-button
  50. >
  51. </div>
  52. </div>
  53. <!-- 表格 -->
  54. <el-table
  55. class="exporttable"
  56. :data="tableData"
  57. border
  58. stripe
  59. :header-cell-style="{
  60. 'text-align': 'center',
  61. background: '#03111c',
  62. }"
  63. :cell-style="{ 'text-align': 'center' }"
  64. show-summary
  65. style="width: 100%; margin: 1px"
  66. >
  67. <el-table-column prop="company" label="品牌"> </el-table-column>
  68. <el-table-column label="收入类">
  69. <el-table-column prop="pjls" sortable label="零件配售"> </el-table-column>
  70. </el-table-column>
  71. <el-table-column label="首保收入">
  72. <el-table-column prop="sbgs" label="首保工时"> </el-table-column>
  73. <el-table-column prop="sbll" label="首保领料"> </el-table-column>
  74. </el-table-column>
  75. <el-table-column label="索赔收入">
  76. <el-table-column prop="spll" label="索赔领料"> </el-table-column>
  77. <el-table-column prop="spgs" label="索赔工时"> </el-table-column>
  78. </el-table-column>
  79. <el-table-column label="定保收入">
  80. <el-table-column prop="dbgs" label="定保工时"> </el-table-column>
  81. <el-table-column prop="dbll" label="定保领料"> </el-table-column>
  82. </el-table-column>
  83. <el-table-column label="一般维修收入">
  84. <el-table-column prop="ybwxll" label="外修领料"> </el-table-column>
  85. <el-table-column prop="ybwxgs" label="外修工时"> </el-table-column>
  86. </el-table-column>
  87. <el-table-column label="钣喷收入">
  88. <el-table-column prop="bpll" label="钣喷材料"> </el-table-column>
  89. <el-table-column prop="bpgs" label="钣喷工时"> </el-table-column>
  90. </el-table-column>
  91. <el-table-column prop="jpsr" label="精品"> </el-table-column>
  92. <el-table-column prop="qtsr" label="其他收入"> </el-table-column>
  93. <el-table-column prop="srhj" label="收入合计"> </el-table-column>
  94. </el-table>
  95. </el-tabs>
  96. </div>
  97. </div>
  98. </template>
  99. <script>
  100. import axios from "axios";
  101. export default {
  102. data() {
  103. return {
  104. company_ids:[],
  105. currentTime: "",
  106. value: "",
  107. //表格各类属性
  108. tableData: [],
  109. //下拉框内属性
  110. options: [],
  111. //日期表属性
  112. pickerOptions: {
  113. shortcuts: [
  114. {
  115. text: "最近一个月",
  116. onClick(picker) {
  117. const end = new Date();
  118. const start = new Date();
  119. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  120. picker.$emit("pick", [start, end]);
  121. },
  122. },
  123. ],
  124. },
  125. value1: ["2023-08-01", "2023-08-03"],
  126. };
  127. },
  128. mounted() {
  129. this.updateTime(); //时间
  130. this.getTableDate(); //开始获取表格
  131. this.getSelectDate(); //下拉框接口数据
  132. },
  133. beforeDestroy() {
  134. // 在组件销毁前清除定时器,避免内存泄漏
  135. clearInterval(this.timer);
  136. },
  137. methods: {
  138. //表格接口数据
  139. getTableDate() {
  140. axios
  141. .get("http://192.168.2.55:8022/plugins/lhyt/shsr_detail", {
  142. params: {
  143. company_ids: this.company_ids.join(),
  144. date_begin: this.value1[0],
  145. date_end: this.value1[1],
  146. },
  147. })
  148. .then((res) => {
  149. console.log("--------", res.data.rows);
  150. this.tableData = res.data.rows;
  151. });
  152. },
  153. //下拉框数据
  154. getSelectDate() {
  155. axios
  156. .get("http://192.168.2.55:8022/plugins/lhyt/get_companies")
  157. .then((ret) => {
  158. console.log(ret);
  159. this.options = ret.data.data;
  160. });
  161. },
  162. //更新时间
  163. updateTime() {
  164. // 在组件挂载结束时启动定时器,每秒更新一次时间
  165. this.currentTime = this.getCurrentTime();
  166. //每秒更新一次
  167. this.timer = setInterval(() => {
  168. this.currentTime = this.getCurrentTime();
  169. }, 1000);
  170. },
  171. getCurrentTime() {
  172. const now = new Date();
  173. const year = now.getFullYear();
  174. const month = String(now.getMonth() + 1).padStart(2, "0");
  175. const day = String(now.getDate()).padStart(2, "0");
  176. const hours = String(now.getHours()).padStart(2, "0");
  177. const minutes = String(now.getMinutes()).padStart(2, "0");
  178. const seconds = String(now.getSeconds()).padStart(2, "0");
  179. return `${year}.${month}.${day} ${hours}:${minutes}:${seconds}`;
  180. },
  181. resetDateFilter() {
  182. this.$refs.filterTable.clearFilter("date");
  183. },
  184. clearFilter() {
  185. this.$refs.filterTable.clearFilter();
  186. },
  187. formatter(row, column) {
  188. return row.address;
  189. },
  190. filterTag(value, row) {
  191. return row.tag === value;
  192. },
  193. filterHandler(value, row, column) {
  194. const property = column["property"];
  195. return row[property] === value;
  196. },
  197. searchBtn() {
  198. this.getTableDate()
  199. },
  200. },
  201. };
  202. </script>
  203. <style scoped="less">
  204. .content {
  205. padding: 10px;
  206. }
  207. .title {
  208. width: 100%;
  209. /* background: url('../../assets/bargound/'); */
  210. height: 64px;
  211. p {
  212. height: 100px;
  213. }
  214. }
  215. .kccl {
  216. color: #697c91;
  217. font-size: 24px;
  218. margin-left: 10px;
  219. }
  220. .el-input__inner {
  221. background-color: #133654;
  222. }
  223. .el-input__inner {
  224. border: 0;
  225. }
  226. ::v-deep .el-date-editor .el-range-input {
  227. display: inline-block;
  228. height: 100%;
  229. width: 39%;
  230. text-align: center;
  231. font-size: 14px;
  232. color: #ffffffba;
  233. background-color: #133654;
  234. }
  235. ::v-deep .el-table {
  236. border: none;
  237. }
  238. ::v-deep .el-table::before {
  239. background-color: black;
  240. }
  241. ::v-deep .el-table__footer-wrapper tbody td.el-table__cell,
  242. .el-table__header-wrapper tbody td.el-table__cell {
  243. background-color: rgb(2, 62, 2);
  244. color: #93acbf;
  245. }
  246. ::v-deep .el-table--border::after,
  247. .el-table--group::after,
  248. .el-table::before {
  249. content: "";
  250. position: absolute;
  251. background-color: black;
  252. z-index: 1;
  253. }
  254. ::v-deep .el-table td,
  255. .building-top .el-table th.is-leaf {
  256. color: #93acbf;
  257. }
  258. ::v-deep .el-table--enable-row-hover .el-table__body tr:hover > td {
  259. background-color: #133654;
  260. }
  261. ::v-deep .el-table tr {
  262. background: #133654;
  263. }
  264. ::v-deep .el-table--striped .el-table__body tr.el-table__row--striped td {
  265. background: #081b2b;
  266. }
  267. /**
  268. 改变边框颜色
  269. */
  270. .el-table {
  271. border-bottom: 1px solid #102b47;
  272. border-right: 1px solid #102b47;
  273. margin: 0 auto;
  274. }
  275. ::v-deep.el-table th {
  276. border: 1px solid #102b47 !important;
  277. border-right: none !important;
  278. border-bottom: none !important;
  279. }
  280. ::v-deep
  281. .el-tabs.theme.el-tabs--top.theme.el-tabs--border-card
  282. .el-tabs__nav-scroll {
  283. border-bottom: 1px solid;
  284. }
  285. ::v-deep.el-table td {
  286. border: 1px solid #102b47;
  287. border-right: none !important;
  288. }
  289. .time {
  290. color: rgb(174, 201, 222);
  291. margin-right: 2%;
  292. font-size: 16px;
  293. overflow: hidden;
  294. max-width: 15%;
  295. white-space: nowrap;
  296. }
  297. </style>