RCCZtable.vue 10 KB

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