RCCZtable.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  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 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="value1"
  35. type="month"
  36. placeholder="2023-08"
  37. >
  38. </el-date-picker>
  39. </div>
  40. <!-- 按钮 -->
  41. <el-button @click="searchBtn" style="background-color: rgb(40, 155, 209); color: black">查询</el-button>
  42. </div>
  43. </div>
  44. <!-- 表格 -->
  45. <el-table
  46. class="exporttable"
  47. :data="tableData"
  48. border
  49. stripe
  50. :header-cell-style="{
  51. 'text-align': 'center',
  52. background: '#03111c'
  53. }"
  54. :cell-style="{ 'text-align': 'center' }"
  55. show-summary
  56. style="width: 100%; margin: 1px">
  57. <el-table-column
  58. prop="name"
  59. label="品牌">
  60. </el-table-column>
  61. <el-table-column
  62. label="产值">
  63. <el-table-column
  64. prop="mbcz"
  65. label="目标">
  66. </el-table-column>
  67. <el-table-column
  68. prop="sjcz"
  69. label="实际达成">
  70. </el-table-column>
  71. <el-table-column
  72. prop="czwcl"
  73. label="完成率">
  74. </el-table-column>
  75. <el-table-column
  76. prop="cztb"
  77. label="同比">
  78. </el-table-column>
  79. <el-table-column
  80. prop="czhb"
  81. label="环比">
  82. </el-table-column>
  83. </el-table-column>
  84. <el-table-column
  85. prop="name"
  86. label="产值分类">
  87. <el-table-column
  88. prop="jdmb"
  89. label="机电目标">
  90. </el-table-column>
  91. <el-table-column
  92. prop="jdsj"
  93. label="实际达成">
  94. </el-table-column>
  95. <el-table-column
  96. prop="spmb"
  97. label="索赔目标">
  98. </el-table-column>
  99. <el-table-column
  100. prop="spsj"
  101. label="实际达成">
  102. </el-table-column>
  103. <el-table-column
  104. label="钣喷目标">
  105. </el-table-column>
  106. <el-table-column
  107. prop="bpsj"
  108. label="实际达成">
  109. </el-table-column>
  110. </el-table-column>
  111. <el-table-column
  112. prop="name"
  113. label="毛利率">
  114. <el-table-column
  115. prop="jdmlv"
  116. label="机电毛利率">
  117. </el-table-column>
  118. <el-table-column
  119. prop="spmll"
  120. label="索赔毛利率">
  121. </el-table-column>
  122. <el-table-column
  123. prop="bpmll"
  124. label="钣喷毛利率">
  125. </el-table-column>
  126. <el-table-column
  127. prop="zhmlv"
  128. label="综合毛利率">
  129. </el-table-column>
  130. <el-table-column
  131. prop="mlvhb"
  132. label="环比">
  133. </el-table-column>
  134. <el-table-column
  135. prop="mlvtb"
  136. label="同比">
  137. </el-table-column>
  138. </el-table-column>
  139. <el-table-column
  140. prop="amount7"
  141. label="客单价">
  142. <el-table-column
  143. prop="jxkdj"
  144. label="机修客单价">
  145. </el-table-column>
  146. <el-table-column
  147. prop="bpkdj"
  148. label="钣喷客单价">
  149. </el-table-column>
  150. </el-table-column>
  151. </el-table>
  152. <!-- <el-tab-pane label=" 分渠道销量统计分析">配置管理</el-tab-pane> -->
  153. </el-tabs>
  154. </div>
  155. </div>
  156. </template>
  157. <script>
  158. import axios from "axios";
  159. export default {
  160. data() {
  161. return {
  162. currentTime: "",
  163. company_ids: [],
  164. //表格各类属性
  165. tableData: [],
  166. //下拉框内属性
  167. options: [],
  168. //日期表属性
  169. pickerOptions: {
  170. shortcuts: [
  171. {
  172. text: "最近一个月",
  173. onClick(picker) {
  174. const end = new Date();
  175. const start = new Date();
  176. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  177. picker.$emit("pick", [start, end]);
  178. },
  179. },
  180. ],
  181. },
  182. value1: [("2023-08-01")],
  183. };
  184. },
  185. computed: {
  186. Riqi : function getNowFormatDate() {
  187. let date = new Date(),
  188. year = date.getFullYear(), //获取完整的年份(4位)
  189. month = date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
  190. strDate = date.getDate(); // 获取当前日(1-31)
  191. if (month < 10) month = `0${month}`; // 如果月份是个位数,在前面补0
  192. if (strDate < 10) strDate = `0${strDate}`; // 如果日是个位数,在前面补0
  193. return `${year}-${month}`;
  194. }
  195. },
  196. mounted() {
  197. this.updateTime(); //时间
  198. this.getTableDate(); //开始获取表格
  199. this.getSelectDate(); //下拉框接口数据
  200. console.log(this.Riqi);
  201. this.value1 =this.Riqi;
  202. },
  203. beforeDestroy() {
  204. // 在组件销毁前清除定时器,避免内存泄漏
  205. clearInterval(this.timer);
  206. },
  207. methods: {
  208. //表格接口数据
  209. getTableDate() {
  210. axios
  211. .get("http://192.168.2.55:8022/plugins/lhyt/shjy_detail", {
  212. params: {
  213. company_ids: this.company_ids.join(),
  214. search_month: this.Riqi,
  215. }
  216. })
  217. .then((res) => {
  218. console.log("--------", res.data.data);
  219. this.tableData = res.data.data;
  220. });
  221. },
  222. //下拉框数据
  223. getSelectDate() {
  224. axios
  225. .get("http://192.168.2.55:8022/plugins/lhyt/get_companies")
  226. .then((ret) => {
  227. this.options = ret.data.data;
  228. });
  229. },
  230. //更新时间
  231. updateTime() {
  232. // 在组件挂载结束时启动定时器,每秒更新一次时间
  233. this.currentTime = this.getCurrentTime();
  234. //每秒更新一次
  235. this.timer = setInterval(() => {
  236. this.currentTime = this.getCurrentTime();
  237. }, 1000);
  238. },
  239. getCurrentTime() {
  240. const now = new Date();
  241. const year = now.getFullYear();
  242. const month = String(now.getMonth() + 1).padStart(2, "0");
  243. const day = String(now.getDate()).padStart(2, "0");
  244. const hours = String(now.getHours()).padStart(2, "0");
  245. const minutes = String(now.getMinutes()).padStart(2, "0");
  246. const seconds = String(now.getSeconds()).padStart(2, "0");
  247. return `${year}.${month}.${day} ${hours}:${minutes}:${seconds}`;
  248. },
  249. resetDateFilter() {
  250. this.$refs.filterTable.clearFilter("date");
  251. },
  252. clearFilter() {
  253. this.$refs.filterTable.clearFilter();
  254. },
  255. formatter(row, column) {
  256. return row.address;
  257. },
  258. filterTag(value, row) {
  259. return row.tag === value;
  260. },
  261. filterHandler(value, row, column) {
  262. const property = column["property"];
  263. return row[property] === value;
  264. },
  265. //查询
  266. searchBtn() {
  267. this.getTableDate()
  268. }
  269. },
  270. };
  271. </script>
  272. <style scoped="less">
  273. .content {
  274. padding: 10px;
  275. }
  276. .title {
  277. width: 100%;
  278. /* background: url('../../assets/bargound/'); */
  279. height: 64px;
  280. p {
  281. height: 100px;
  282. }
  283. }
  284. .kccl {
  285. color: #697c91;
  286. font-size: 24px;
  287. margin-left: 10px;
  288. }
  289. .el-input__inner {
  290. background-color: #133654;
  291. }
  292. .el-input__inner {
  293. border: 0;
  294. }
  295. ::v-deep .el-date-editor .el-range-input {
  296. display: inline-block;
  297. height: 100%;
  298. width: 39%;
  299. text-align: center;
  300. font-size: 14px;
  301. color: #ffffffba;
  302. background-color: #133654;
  303. }
  304. ::v-deep .el-table {
  305. border: none;
  306. }
  307. ::v-deep .el-table::before {
  308. background-color: black;
  309. }
  310. ::v-deep .el-table__footer-wrapper tbody td.el-table__cell,
  311. .el-table__header-wrapper tbody td.el-table__cell {
  312. background-color: rgb(2, 62, 2);
  313. color: #93acbf;
  314. }
  315. ::v-deep .el-table--border::after,
  316. .el-table--group::after,
  317. .el-table::before {
  318. content: "";
  319. position: absolute;
  320. background-color: black;
  321. z-index: 1;
  322. }
  323. /* 日期表 */
  324. :deep(.el-input__inner) {
  325. background-color: #133654;
  326. border: none;
  327. color: #ffffffc1;
  328. }
  329. ::v-deep .el-table td,
  330. .building-top .el-table th.is-leaf {
  331. color: #93acbf;
  332. }
  333. ::v-deep .el-table--enable-row-hover .el-table__body tr:hover>td {
  334. background-color: #133654;
  335. }
  336. ::v-deep .el-table tr {
  337. background: #133654;
  338. }
  339. ::v-deep .el-table--striped .el-table__body tr.el-table__row--striped td {
  340. background: #081b2b;
  341. }
  342. /**
  343. 改变边框颜色
  344. */
  345. .el-table {
  346. border-bottom: 1px solid #102b47;
  347. border-right: 1px solid #102b47;
  348. margin: 0 auto;
  349. }
  350. ::v-deep .el-tabs.theme.el-tabs--top.theme.el-tabs--border-card .el-tabs__nav-scroll {
  351. border-bottom: 1px solid;
  352. }
  353. ::v-deep.el-table th {
  354. border: 1px solid #102b47 !important;
  355. border-right: none !important;
  356. border-bottom: none !important;
  357. }
  358. ::v-deep.el-table td {
  359. border: 1px solid #102b47;
  360. border-right: none !important;
  361. }
  362. .time {
  363. color: rgb(174, 201, 222);
  364. margin-right: 2%;
  365. font-size: 16px;
  366. overflow: hidden;
  367. max-width: 15%;
  368. white-space: nowrap;
  369. }
  370. </style>