Analysis.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. <template>
  2. <div class="analysis">
  3. <!-- 工作看板 -->
  4. <board :title="title[0]">
  5. <div>
  6. <work-infos :dataList="workInfos" @workInfoClick="handleWorkInfoClick"></work-infos>
  7. <div class="table-content">
  8. <table-content
  9. :tableItems="tableItems"
  10. :height="height"
  11. :shows="tableShows"
  12. :listData="tableData">
  13. </table-content>
  14. </div>
  15. </div>
  16. </board>
  17. <!-- 存栏情况 -->
  18. <board :title="title[1]">
  19. <div>
  20. <div>
  21. <!-- 存栏结构 -->
  22. <chart-inventory-pie></chart-inventory-pie>
  23. <!-- 存栏变动 -->
  24. <chart-inventory-lines></chart-inventory-lines>
  25. </div>
  26. <div>
  27. <!-- 存栏计数 -->
  28. <inventory-items></inventory-items>
  29. </div>
  30. </div>
  31. </board>
  32. <!-- 生产情况 -->
  33. <board :title="title[2]">
  34. <!-- 环形图 -->
  35. <production-donuts></production-donuts>
  36. <!-- 8个格子 -->
  37. <production-items></production-items>
  38. </board>
  39. <!-- 经营分析 -->
  40. <board :title="title[3]">
  41. <!-- 成本分析 -->
  42. <div class="cost">
  43. <div class="select">
  44. <el-select size="small" v-model="costValue">
  45. <el-option
  46. v-for="item in costOptions"
  47. :key="item.value"
  48. :label="item.label"
  49. :value="item.value">
  50. </el-option>
  51. </el-select>
  52. </div>
  53. <div class="cost-content">
  54. <div class="cost-left">
  55. <cost-pie></cost-pie>
  56. </div>
  57. <div class="cost-right">
  58. <cost-histogram></cost-histogram>
  59. </div>
  60. </div>
  61. <h3 class="label">成本分析</h3>
  62. </div>
  63. <!-- 重要指标 -->
  64. <div class="important">
  65. <div class="condition">
  66. <el-select
  67. size="small"
  68. v-model="importantValue"
  69. style="margin-right: 20px">
  70. <el-option
  71. v-for="item in importantOptions"
  72. :key="item.value"
  73. :label="item.label"
  74. :value="item.value">
  75. </el-option>
  76. </el-select>
  77. <el-date-picker
  78. v-model="importantDates"
  79. size="small"
  80. type="daterange"
  81. range-separator="至"
  82. start-placeholder="开始日期"
  83. end-placeholder="结束日期">
  84. </el-date-picker>
  85. </div>
  86. <div class="important-chart">
  87. <important-line></important-line>
  88. </div>
  89. </div>
  90. <!-- 销售情况 -->
  91. <div class="sales">
  92. <div class="sales-condition">
  93. <x-form :formItems="salesFormItems" :day="salesDay" @setDay="salesSetDay" @onClickType="salesOnClickType"></x-form>
  94. </div>
  95. <div class="sales-content">
  96. <div class="sales-left">
  97. <div class="up">
  98. <label>本周销售额</label>
  99. <span>{{ weekSales }}元</span>
  100. <div class="sales-change">
  101. <div>
  102. <div class="triangle-change" :class="weekSalesChange>0? 'triangle-up': 'triangle-down'"></div>
  103. <span :class="weekSalesChange>0? 'color-up': 'color-down'">{{ weekSalesChange }}%</span>
  104. &nbsp;&nbsp;&nbsp;同比上周
  105. </div>
  106. </div>
  107. </div>
  108. <div class="down">
  109. <label>本周销售量</label>
  110. <span>{{ weekSalesVolume }}元</span>
  111. <div class="sales-change">
  112. <div>
  113. <div class="triangle-change" :class="weekSalesVolumeChange>0? 'triangle-up': 'triangle-down'"></div>
  114. <span :class="weekSalesVolumeChange>0? 'color-up': 'color-down'">{{ weekSalesVolumeChange }}%</span>
  115. &nbsp;&nbsp;&nbsp;同比上周
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. <div class="sales-right">
  121. <sales-chart></sales-chart>
  122. </div>
  123. </div>
  124. </div>
  125. </board>
  126. <!-- 应收排名 -->
  127. <board :title="title[4]">
  128. <table-content
  129. :tableItems="yingshouTableItems"
  130. :height="height"
  131. :shows="yingshouTableShows"
  132. :listData="yingshouTableData">
  133. </table-content>
  134. </board>
  135. <!-- 应付排名 -->
  136. <board :title="title[5]">
  137. <table-content
  138. :tableItems="yingshouTableItems"
  139. :height="height"
  140. :shows="yingshouTableShows"
  141. :listData="yingfuTableData">
  142. </table-content>
  143. </board>
  144. <!-- 安全库存报警 -->
  145. <board :title="title[6]">
  146. <table-content
  147. :tableItems="safetyTableItems"
  148. :height="height"
  149. :shows="safetyTableShows"
  150. :listData="safetyTableData">
  151. </table-content>
  152. <table-footer
  153. :totals="total"
  154. :size="size"
  155. @sizeChange="sizeChange"
  156. @pageChange="pageChange">
  157. </table-footer>
  158. </board>
  159. </div>
  160. </template>
  161. <script>
  162. import Board from 'components/board/index.vue'
  163. import WorkInfos from './analysis/WorkInfos.vue'
  164. import TableContent from 'components/newTable/TableContent.vue'
  165. import ChartInventoryPie from './analysis/ChartInventoryPie.vue'
  166. import ChartInventoryLines from './analysis/ChartInventoryLines.vue'
  167. import InventoryItems from './analysis/InventoryItems.vue'
  168. import ProductionDonuts from './analysis/ProductionDonuts.vue'
  169. import ProductionItems from './analysis/ProductionItems.vue'
  170. import CostPie from './analysis/CostPie.vue'
  171. import CostHistogram from './analysis/CostHistogram.vue'
  172. import ImportantLine from './analysis/ImportantLine.vue'
  173. import XForm from "components/XForm";
  174. import SalesChart from './analysis/SalesChart.vue'
  175. import TableFooter from "../../components/TableFooter"
  176. import { tableItems, tableShows } from './analysis/table.config'
  177. import { yingshouTableItems, yingshouTableShows } from './analysis/yingshouTable.config'
  178. import { safetyTableItems, safetyTableShows } from './analysis/safetyTable.config'
  179. import { formItems } from './analysis/salesXForm.config'
  180. export default {
  181. name: "Analysis",
  182. components: {
  183. Board,
  184. WorkInfos,
  185. TableContent,
  186. ChartInventoryPie,
  187. ChartInventoryLines,
  188. InventoryItems,
  189. ProductionDonuts,
  190. ProductionItems,
  191. CostPie,
  192. CostHistogram,
  193. ImportantLine,
  194. XForm,
  195. SalesChart,
  196. TableFooter
  197. },
  198. data() {
  199. return {
  200. title: ['工作看板', '存栏情况', '生产情况', '经营分析', '应收排名', '应付排名', '安全库存报警'],
  201. workInfos: [
  202. {
  203. label: '预警信息',
  204. number: 10
  205. },
  206. {
  207. label: '断奶数量',
  208. number: 1150
  209. },
  210. {
  211. label: '配种数量',
  212. number: 1540
  213. },
  214. {
  215. label: '转舍计划',
  216. number: 108
  217. },
  218. {
  219. label: '分娩数量',
  220. number: 180
  221. },
  222. {
  223. label: '日常计划',
  224. number: 10
  225. },
  226. {
  227. label: '天才计划',
  228. number: 10
  229. },
  230. {
  231. label: '保健计划',
  232. number: 10
  233. }
  234. ],
  235. tableItems: [],
  236. tableShows: {},
  237. height: 300,
  238. tableData: [],
  239. // 生产情况
  240. costOptions: [],
  241. costValue: '',
  242. // 重要指标
  243. importantOptions: [],
  244. importantValue: '',
  245. importantDates: [],
  246. // 销售额
  247. salesFormItems: [],
  248. salesDay: 2, //默认选择本周
  249. weekSales: 1545252,
  250. weekSalesChange: 10,
  251. weekSalesVolume: 1000,
  252. weekSalesVolumeChange: -10,
  253. // 应收排名
  254. yingshouTableItems: [],
  255. yingshouTableShows: {},
  256. yingshouTableData: [],
  257. // 应付排名
  258. yingfuTableData: [],
  259. // 安全库存报警
  260. safetyTableItems: [],
  261. safetyTableShows: {},
  262. safetyTableData: [],
  263. total: 0,
  264. size: 20,
  265. pageNum: 1,
  266. }
  267. },
  268. mounted() {
  269. this.salesFormItems = formItems
  270. this.tableItems = tableItems
  271. this.tableShows = tableShows
  272. this.yingshouTableItems = yingshouTableItems
  273. this.yingshouTableShows = yingshouTableShows
  274. this.safetyTableItems = safetyTableItems
  275. this.safetyTableShows = safetyTableShows
  276. },
  277. methods: {
  278. handleWorkInfoClick(item) {
  279. console.log(item)
  280. },
  281. // 修改size
  282. sizeChange(val) {
  283. this.size = val;
  284. this.init();
  285. },
  286. // 修改页数
  287. pageChange(val) {
  288. this.pageNum= val;
  289. this.init();
  290. },
  291. init() {
  292. let params = {
  293. pageNum: this.pageNum,
  294. pageSize: this.size,
  295. searchStr: this.keyword
  296. }
  297. console.log(params)
  298. // 获取后端数据
  299. },
  300. // 销售额选中日期
  301. salesSetDay(data) {
  302. this.salesDay = data;
  303. },
  304. // 销售额选中日周月
  305. salesOnClickType(data) {
  306. console.log(data)
  307. }
  308. },
  309. }
  310. </script>
  311. <style scoped>
  312. .analysis {
  313. width: 100%;
  314. height: 100%;
  315. box-sizing: border-box;
  316. padding: 20px;
  317. }
  318. .table-content {
  319. padding: 10px 15px 12px;
  320. }
  321. /* 成本分析echarts图排列 */
  322. .cost {
  323. border-bottom: 1px solid rgba(228, 228, 228, 1);
  324. position: relative;
  325. }
  326. .cost>.select {
  327. position: absolute;
  328. right: 0;
  329. margin: 20px;
  330. }
  331. .cost-content {
  332. padding-top: 20px;
  333. display: flex;
  334. }
  335. .cost-left {
  336. flex: 1;
  337. }
  338. .cost-right {
  339. flex: 1;
  340. }
  341. .cost>.label {
  342. text-align: center;
  343. font-weight: bold;
  344. font-size: 18px;
  345. }
  346. /* 重要指标 */
  347. .important {
  348. padding: 20px;
  349. position: relative;
  350. border-bottom: 1px solid rgba(228, 228, 228, 1);
  351. }
  352. .important>.condition {
  353. position: absolute;
  354. right: 0;
  355. margin-right: 20px;
  356. }
  357. .important-chart {
  358. margin-top: 20px;
  359. }
  360. /* 销售情况 */
  361. .sales {
  362. padding: 20px;
  363. padding-bottom: 0;
  364. }
  365. .sales-content {
  366. padding-top: 20px;
  367. width: 100%;
  368. display: flex;
  369. flex-direction: row;
  370. justify-content: space-around
  371. }
  372. .sales-left {
  373. width: 15%;
  374. line-height: 25px;
  375. padding-top: 30px;
  376. }
  377. .sales-left>.up {
  378. margin-bottom: 20px;
  379. }
  380. .sales-left>.up>label,
  381. .sales-left>.down>label {
  382. display: block;
  383. text-align: center;
  384. font-size: 13px;
  385. color: #999;
  386. }
  387. .sales-left>.up>span,
  388. .sales-left>.down>span {
  389. display: block;
  390. text-align: center;
  391. font-size: 16px;
  392. color: #333;
  393. }
  394. .sales-left>.up>.sales-change,
  395. .sales-left>.down>.sales-change {
  396. display: flex;
  397. justify-content: space-around;
  398. font-size: 13px;
  399. }
  400. /* 三角形 */
  401. .triangle-change {
  402. display: inline-block;
  403. width: 8px;
  404. height: 8px;
  405. border-style: solid;
  406. border-width: 8px;
  407. margin-right: 20px;
  408. }
  409. .triangle-up {
  410. border-color: transparent transparent rgb(238, 16, 16) transparent;
  411. }
  412. .triangle-down {
  413. border-color: rgb(2, 112, 2) transparent transparent transparent;
  414. position: relative;
  415. top: 7px;
  416. }
  417. .color-up {
  418. color: rgb(238, 16, 16);
  419. }
  420. .color-down {
  421. color: rgb(2, 112, 2);
  422. }
  423. /* 销售情况右侧 */
  424. .sales-right {
  425. width: 85%;
  426. border-left: 1px solid rgba(228, 228, 228, 1);
  427. height: 300px;
  428. }
  429. </style>