RCCZtable.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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" @click="goOff">漯河亿通集团数据看板</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 class="kccl">首次入厂产值</span>
  21. </p>
  22. </div>
  23. <div style="display: flex">
  24. <!-- 下拉框 -->
  25. <div style="margin-right: 20px">
  26. <el-select class="select" v-model="company_ids" multiple placeholder="请选择" style="width: 200px">
  27. <el-option v-for="item in options" :key="item.value" :label="item.text" :value="item.value">
  28. </el-option>
  29. </el-select>
  30. </div>
  31. <!-- 日期表 -->
  32. <div class="dataForm" style="margin-right: 20px">
  33. <el-date-picker
  34. v-model="serach_month"
  35. type="month"
  36. placeholder="2023-08"
  37. >
  38. </el-date-picker>
  39. </div>
  40. <!-- 按钮 -->
  41. <el-button @click="searchBtn(company_ids, serach_month)" style="background-color: rgb(40, 155, 209); color: black">查询</el-button>
  42. </div>
  43. </div>
  44. <!-- 表格 -->
  45. <el-table
  46. border
  47. class="exporttable"
  48. :data="tableData"
  49. stripe
  50. :header-cell-style="{ 'text-align': 'center', background: '#03111c' }"
  51. :cell-style="{ 'text-align': 'center' }"
  52. show-summary
  53. style="width: 100%; margin: 1px"
  54. :max-height="taheight">
  55. <el-table-column
  56. prop="name"
  57. label="品牌">
  58. </el-table-column>
  59. <el-table-column label="产值">
  60. <el-table-column prop="mbcz" label="目标" width="120" sortable></el-table-column>
  61. <el-table-column prop="sjcz" label="实际达成" width="120" sortable></el-table-column>
  62. <el-table-column prop="czwcl" label="完成率" width="120" sortable></el-table-column>
  63. <el-table-column prop="cztb" label="同比" width="120" sortable></el-table-column>
  64. <el-table-column prop="czhb" label="环比" width="120" sortable></el-table-column>
  65. </el-table-column>
  66. <el-table-column label="产值分类">
  67. <el-table-column prop="jdmb" label="机电目标" width="120" sortable></el-table-column>
  68. <el-table-column prop="jdsj" label="实际达成" width="120" sortable></el-table-column>
  69. <el-table-column prop="spmb" label="索赔目标" width="120" sortable></el-table-column>
  70. <el-table-column prop="spsj" label="实际达成" width="120" sortable></el-table-column>
  71. <el-table-column prop="bpmb" label="钣喷目标" width="120" sortable></el-table-column>
  72. <el-table-column prop="bpsj" label="实际达成" width="120" sortable></el-table-column>
  73. </el-table-column>
  74. <el-table-column label="毛利率">
  75. <el-table-column prop="jdmlv" label="机电毛利率" width="120" sortable></el-table-column>
  76. <el-table-column prop="spmll" label="索赔毛利率" width="120" sortable></el-table-column>
  77. <el-table-column prop="bpmll" label="钣喷毛利率" width="120" sortable></el-table-column>
  78. <el-table-column prop="zhmlv" label="综合毛利率" width="120" sortable></el-table-column>
  79. <el-table-column prop="mlvhb" label="环比" width="120" sortable></el-table-column>
  80. <el-table-column prop="mlvtb" label="同比" width="120" sortable></el-table-column>
  81. </el-table-column>
  82. <el-table-column label="客单价">
  83. <el-table-column prop="jxkdj" label="机修客单价" width="120" sortable></el-table-column>
  84. <el-table-column prop="bpkdj" label="钣喷客单价" width="120" sortable></el-table-column>
  85. </el-table-column>
  86. </el-table>
  87. <!-- <el-tab-pane label=" 分渠道销量统计分析">配置管理</el-tab-pane> -->
  88. </el-tabs>
  89. </div>
  90. </div>
  91. </template>
  92. <script>
  93. import { rccztabledataInfo } from "../../servuces/prove";
  94. import { nowmonthy } from "../../servuces/getnowtime";
  95. import { column } from "../../store/tuozhuai";
  96. export default {
  97. data() {
  98. return {
  99. taheight: window.innerHeight - (window.innerHeight * 0.15),
  100. currentTime: "",
  101. company_ids: [],
  102. //表格各类属性
  103. tableData: [],
  104. tableDatahj: [],
  105. //下拉框内属性
  106. options: [],
  107. //日期表属性
  108. serach_month: '',
  109. };
  110. },
  111. created () {
  112. const data = sessionStorage.getItem('company_data');
  113. if (data) {
  114. this.options = JSON.parse(data)
  115. }
  116. },
  117. mounted() {
  118. column(this);
  119. this.updateTime();
  120. this.getTableData(); //开始获取表格
  121. },
  122. beforeDestroy() {
  123. // 在组件销毁前清除定时器,避免内存泄漏
  124. clearInterval(this.timer);
  125. },
  126. methods: {
  127. //表格接口数据
  128. getTableData () {
  129. this.serach_month = nowmonthy;
  130. rccztabledataInfo({ "company_ids": '', "search_month": nowmonthy}).then(res => {
  131. this.tableData = res.data;
  132. this.tableDatahj = res.footer
  133. })
  134. },
  135. //查询
  136. searchBtn(value, value1) {
  137. const company_ids = value.join(',');
  138. const date = new Date(value1);
  139. // 获取年份和月份
  140. const year = date.getFullYear();
  141. const month = date.getMonth() + 1; // 月份从0开始,需要加1
  142. // 将年份和月份拼接成所需形式的字符串
  143. const serach_date = `${year}-${month}`;
  144. rccztabledataInfo({ "company_ids": company_ids, "search_month": serach_date}).then(res => {
  145. this.tableData = res.data;
  146. this.tableDatahj = res.footer
  147. });
  148. },
  149. goOff(){
  150. history.go(-1);
  151. },
  152. //更新时间
  153. updateTime() {
  154. // 在组件挂载结束时启动定时器,每秒更新一次时间
  155. this.currentTime = this.getCurrentTime();
  156. //每秒更新一次
  157. this.timer = setInterval(() => {
  158. this.currentTime = this.getCurrentTime();
  159. }, 1000);
  160. },
  161. getCurrentTime() {
  162. const now = new Date();
  163. const year = now.getFullYear();
  164. const month = String(now.getMonth() + 1).padStart(2, "0");
  165. const day = String(now.getDate()).padStart(2, "0");
  166. const hours = String(now.getHours()).padStart(2, "0");
  167. const minutes = String(now.getMinutes()).padStart(2, "0");
  168. const seconds = String(now.getSeconds()).padStart(2, "0");
  169. return `${year}.${month}.${day} ${hours}:${minutes}:${seconds}`;
  170. },
  171. },
  172. };
  173. </script>
  174. <style scoped="less">
  175. .content {
  176. padding: 10px;
  177. }
  178. .title {
  179. width: 100%;
  180. /* background: url('../../assets/bargound/'); */
  181. height: 64px;
  182. p {
  183. height: 100px;
  184. }
  185. }
  186. .kccl {
  187. color: #697c91;
  188. font-size: 24px;
  189. margin-left: 10px;
  190. }
  191. .el-input__inner {
  192. background-color: #133654;
  193. }
  194. .el-input__inner {
  195. border: 0;
  196. }
  197. ::v-deep .el-date-editor .el-range-input {
  198. display: inline-block;
  199. height: 100%;
  200. width: 39%;
  201. text-align: center;
  202. font-size: 14px;
  203. color: #ffffffba;
  204. background-color: #133654;
  205. }
  206. ::v-deep .el-table {
  207. border: none;
  208. }
  209. ::v-deep .el-table::before {
  210. background-color: black;
  211. }
  212. ::v-deep .el-table__footer-wrapper tbody td.el-table__cell,
  213. .el-table__header-wrapper tbody td.el-table__cell {
  214. background-color: rgb(2, 62, 2);
  215. color: #93acbf;
  216. }
  217. ::v-deep .el-table--border::after,
  218. .el-table--group::after,
  219. .el-table::before {
  220. content: "";
  221. position: absolute;
  222. background-color: black;
  223. z-index: 1;
  224. }
  225. /* 日期表 */
  226. :deep(.el-input__inner) {
  227. background-color: #133654;
  228. border: none;
  229. color: #ffffffc1;
  230. }
  231. ::v-deep .el-table td,
  232. .building-top .el-table th.is-leaf {
  233. color: #93acbf;
  234. }
  235. ::v-deep .el-table--enable-row-hover .el-table__body tr:hover>td {
  236. background-color: #133654;
  237. }
  238. ::v-deep .el-table tr {
  239. background: #133654;
  240. }
  241. ::v-deep .el-table--striped .el-table__body tr.el-table__row--striped td {
  242. background: #081b2b;
  243. }
  244. /**
  245. 改变边框颜色
  246. */
  247. .el-table {
  248. border-bottom: 1px solid #102b47;
  249. border-right: 1px solid #102b47;
  250. margin: 0 auto;
  251. }
  252. ::v-deep .el-tabs.theme.el-tabs--top.theme.el-tabs--border-card .el-tabs__nav-scroll {
  253. border-bottom: 1px solid;
  254. }
  255. ::v-deep.el-table th {
  256. border: 1px solid #102b47 !important;
  257. border-right: none !important;
  258. border-bottom: none !important;
  259. }
  260. ::v-deep.el-table td {
  261. border: 1px solid #102b47;
  262. border-right: none !important;
  263. }
  264. .time {
  265. color: rgb(174, 201, 222);
  266. margin-right: 2%;
  267. font-size: 16px;
  268. overflow: hidden;
  269. max-width: 15%;
  270. white-space: nowrap;
  271. }
  272. </style>