d04c6b7a50bbd84a1834cdf301d6e99ddbcededa.svn-base 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280
  1. <template>
  2. <div class="app-container">
  3. <div class="search">
  4. <el-date-picker v-model="tab.table.getdataListParm.parammaps.date" :clearable="false" type="date" placeholder="选择日期" style="width: 150px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />
  5. <el-button class="successBorder" @click="handleSearch">查询</el-button>
  6. <el-button class="export" @click="handleDownload">导出</el-button>
  7. </div>
  8. <div class="table">
  9. <el-table
  10. :key="tab.table.tableKey"
  11. v-loading="tab.table.listLoading"
  12. element-loading-text="给我一点时间"
  13. :data="tab.table.list"
  14. border
  15. fit
  16. highlight-current-row
  17. style="width: 100%;"
  18. :row-style="rowStyle"
  19. :cell-style="tableCellStyle"
  20. class="elTable table-fixed"
  21. >
  22. <el-table-column label="牧场" min-width="110px" align="center">
  23. <template slot-scope="{row}">
  24. <a @click="clickPasture(row)">{{ row.pasturename }}</a>
  25. </template>
  26. </el-table-column>
  27. <el-table-column label="实际牛头数" min-width="90px" align="center" prop="实际牛头数" />
  28. <el-table-column label="应混料量(kg)" min-width="90px" align="center" prop="应混料量" />
  29. <el-table-column label="实际混料量(kg)" min-width="90px" align="center" prop="实际混料量" />
  30. <el-table-column label="撒料量(kg)" min-width="90px" align="center" prop="撒料量" />
  31. <el-table-column label="混料时间" min-width="90px" align="center" prop="混料时间" />
  32. <el-table-column label="转投剩料量(kg)" min-width="90px" align="center" prop="转投剩料量" />
  33. <el-table-column label="今日剩料量(kg)" min-width="90px" align="center" prop="今日剩料量" />
  34. <el-table-column label="剩料率(%)" min-width="90px" align="center" prop="剩料率" />
  35. <el-table-column label="TMR干物质(%)" min-width="90px" align="center" prop="TMR干物质" />
  36. <el-table-column label="配方干物质采食量(kg/头)" min-width="90px" align="center" prop="配方干物质采食量" />
  37. <el-table-column label="实际干物质采食量(kg/头)" min-width="90px" align="center" prop="实际干物质采食量" />
  38. <el-table-column label="采食率(%)" min-width="90px" align="center" prop="采食率" />
  39. <el-table-column label="配方成本(元/头)" min-width="90px" align="center" prop="配方成本" />
  40. <el-table-column label="实际成本(元/头)" min-width="90px" align="center" prop="实际成本" />
  41. <el-table-column label="产奶量(kg/头)" min-width="90px" align="center" prop="产奶量" />
  42. <el-table-column label="饲料转化率" min-width="90px" align="center" prop="饲料转化率" />
  43. <el-table-column label="公斤奶饲料成本" min-width="90px" align="center" prop="公斤奶饲料成本" />
  44. </el-table>
  45. <!-- <pagination v-show="tab.table.total>=0" :total="tab.table.total" :page.sync="tab.table.getdataListParm.offset" :limit.sync="tab.table.getdataListParm.pagecount" @pagination="getList" /> -->
  46. </div>
  47. <div id="chartDate" style="height: 90px;" />
  48. <div class="AnalysisChart">
  49. <el-row :gutter="10">
  50. <el-col :span="2"><h4>图表查询时间:</h4></el-col>
  51. <el-col :span="22" style="margin-top: 10px;">
  52. <el-date-picker v-model="tab.chartDate" :clearable="false" style="width: 250px;margin-right: 10px;" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions" />
  53. <el-button class="successBorder" @click="handleChartDate">确认</el-button>
  54. </el-col>
  55. </el-row>
  56. <el-row :gutter="10">
  57. <!-- 泌乳牛干物质采食量 -->
  58. <el-col :span="12" style="position: relative;">
  59. <h4 style="text-align:center;">泌乳牛干物质采食量</h4>
  60. <div>
  61. <el-date-picker v-model="tab.chart1.getdataListParm.parammaps.inputDatetime" style="width: 250px;" class="inputDatetime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :clearable="false" :picker-options="pickerOptions" @change="changeChartDate('chart1')" />
  62. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('chart1')">导出</el-button>
  63. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleTable('chart1')">切换表格</el-button>
  64. </div>
  65. <div id="chartLine1" style="width:100%;height:430px;" />
  66. <div v-if="tab.chart1.isTable" class="table" style="width: 100%;position: absolute;top:19px;right: 0;">
  67. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('chart1')">导出</el-button>
  68. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleChart('chart1')">切换图表</el-button>
  69. <el-table
  70. :key="tab.chart1.table.tableKey"
  71. v-loading="tab.chart1.table.listLoading"
  72. element-loading-text="给我一点时间"
  73. :data="tab.chart1.table.list"
  74. border
  75. fit
  76. highlight-current-row
  77. style="width: 100%;"
  78. height="430"
  79. :row-style="rowStyle"
  80. :cell-style="cellStyle"
  81. class="elTable table-fixed"
  82. >
  83. <el-table-column label="日期" sortable min-width="110px" align="center" prop="日期" />
  84. <el-table-column label="泌乳牛采食量(kg)" sortable min-width="110px" align="center" prop="field1" />
  85. <el-table-column label="泌乳牛产奶量(kg)" sortable min-width="110px" align="center" prop="field2" />
  86. </el-table>
  87. </div>
  88. </el-col>
  89. <!-- 剩料率 -->
  90. <el-col :span="12" style="position: relative;">
  91. <h4 style="text-align:center;">剩料率</h4>
  92. <div>
  93. <el-date-picker v-model="tab.chart2.getdataListParm.parammaps.inputDatetime" style="width: 250px;" class="inputDatetime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :clearable="false" :picker-options="pickerOptions" @change="changeChartDate('chart2')" />
  94. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('chart2')">导出</el-button>
  95. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleTable('chart2')">切换表格</el-button>
  96. </div>
  97. <div id="chartLine2" style="width:100%;height:430px;" />
  98. <div v-if="tab.chart2.isTable" class="table" style="width: 100%;z-index:1;position: absolute;top:19px;right: 0;">
  99. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('chart2')">导出</el-button>
  100. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleChart('chart2')">切换图表</el-button>
  101. <el-table
  102. :key="tab.chart2.table.tableKey"
  103. v-loading="tab.chart2.table.listLoading"
  104. element-loading-text="给我一点时间"
  105. :data="tab.chart2.table.list"
  106. border
  107. fit
  108. highlight-current-row
  109. style="width: 100%;"
  110. height="430"
  111. :row-style="rowStyle"
  112. :cell-style="cellStyle"
  113. class="elTable table-fixed"
  114. >
  115. <el-table-column label="日期" sortable min-width="110px" align="center" prop="日期" />
  116. <el-table-column label="栏舍名称" sortable min-width="110px" align="center" prop="名称" />
  117. <el-table-column label="剩料量" sortable min-width="110px" align="center" prop="剩料量" />
  118. <el-table-column label="撒料量" sortable min-width="110px" align="center" prop="撒料量" />
  119. <el-table-column label="剩料率" sortable min-width="110px" align="center" prop="准确率" />
  120. </el-table>
  121. </div>
  122. </el-col>
  123. </el-row>
  124. <el-row :gutter="10">
  125. <!-- 混料时间统计 -->
  126. <el-col :span="12" style="position: relative;">
  127. <h4 style="text-align:center;">混料时间统计</h4>
  128. <div>
  129. <el-date-picker v-model="tab.chart3.getdataListParm.parammaps.inputDatetime" style="width: 250px;" class="inputDatetime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :clearable="false" :picker-options="pickerOptions" @change="changeChartDate('chart3')" />
  130. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('chart3')">导出</el-button>
  131. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleTable('chart3')">切换表格</el-button>
  132. </div>
  133. <div id="chartLine3" style="width:100%;height:430px;" />
  134. <div v-if="tab.chart3.isTable" class="table" style="width: 100%;position: absolute;top:19px;right: 0;">
  135. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('chart3')">导出</el-button>
  136. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleChart('chart3')">切换图表</el-button>
  137. <el-table
  138. :key="tab.chart3.table.tableKey"
  139. v-loading="tab.chart3.table.listLoading"
  140. element-loading-text="给我一点时间"
  141. :data="tab.chart3.table.list"
  142. border
  143. fit
  144. highlight-current-row
  145. style="width: 100%;"
  146. height="430"
  147. :row-style="rowStyle"
  148. :cell-style="cellStyle"
  149. class="elTable table-fixed"
  150. >
  151. <el-table-column label="日期" min-width="110px" align="center" prop="日期" />
  152. <el-table-column label="混料时间(分钟)" min-width="110px" align="center" prop="field1" />
  153. </el-table>
  154. </div>
  155. </el-col>
  156. <!-- 转化率 -->
  157. <el-col :span="12" style="position: relative;">
  158. <h4 style="text-align:center;">转化率</h4>
  159. <div>
  160. <el-date-picker v-model="tab.chart4.getdataListParm.parammaps.inputDatetime" style="width: 250px;" class="inputDatetime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :clearable="false" :picker-options="pickerOptions" @change="changeChartDate('chart4')" />
  161. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('chart4')">导出</el-button>
  162. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleTable('chart4')">切换表格</el-button>
  163. </div>
  164. <div id="chartLine4" style="width:100%;height:430px;" />
  165. <div v-if="tab.chart4.isTable" class="table" style="width: 100%;z-index:1;position: absolute;top:19px;right: 0;">
  166. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('chart4')">导出</el-button>
  167. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleChart('chart4')">切换图表</el-button>
  168. <el-table
  169. :key="tab.chart4.table.tableKey"
  170. v-loading="tab.chart4.table.listLoading"
  171. element-loading-text="给我一点时间"
  172. :data="tab.chart4.table.list"
  173. border
  174. fit
  175. highlight-current-row
  176. style="width: 100%;"
  177. height="430"
  178. :row-style="rowStyle"
  179. :cell-style="cellStyle"
  180. class="elTable table-fixed"
  181. >
  182. <el-table-column label="日期" min-width="110px" align="center" prop="日期" />
  183. <el-table-column label="配方名称" min-width="110px" align="center" prop="名称" />
  184. <el-table-column label="饲料转化率" min-width="110px" align="center" prop="准确率" />
  185. </el-table>
  186. </div>
  187. </el-col>
  188. </el-row>
  189. <el-row :gutter="10">
  190. <!-- 成本分析 -->
  191. <el-col :span="24" style="position: relative;">
  192. <h4 style="text-align:center;">成本分析</h4>
  193. <div>
  194. <el-date-picker v-model="tab.chart5.getdataListParm.parammaps.inputDatetime" style="width: 250px;" class="inputDatetime" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :clearable="false" :picker-options="pickerOptions" @change="changeChartDate('chart5')" />
  195. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('chart5')">导出</el-button>
  196. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleTable('chart5')">切换表格</el-button>
  197. </div>
  198. <div id="chartLine5" style="width:100%;height:430px;" />
  199. <div v-if="tab.chart5.isTable" class="table" style="width: 100%;z-index:1;position: absolute;top:19px;right: 0;">
  200. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleExport('chart5')">导出</el-button>
  201. <el-button type="text" style="float: right;margin-right: 5px;" @click="handleChart('chart5')">切换图表</el-button>
  202. <el-table
  203. :key="tab.chart5.table.tableKey"
  204. v-loading="tab.chart5.table.listLoading"
  205. element-loading-text="给我一点时间"
  206. :data="tab.chart5.table.list"
  207. border
  208. fit
  209. highlight-current-row
  210. style="width: 100%;"
  211. height="430"
  212. :row-style="rowStyle"
  213. :cell-style="cellStyle"
  214. class="elTable table-fixed"
  215. >
  216. <el-table-column label="日期" min-width="110px" align="center" prop="日期" />
  217. <el-table-column label="牲畜类别" min-width="110px" align="center" prop="名称" />
  218. <el-table-column label="公斤奶饲料成本(元)" min-width="110px" align="center" prop="准确率" />
  219. </el-table>
  220. </div>
  221. </el-col>
  222. </el-row>
  223. </div>
  224. <el-dialog :title="textMap[pasture.dialogStatus]" :destroy-on-close="true" :visible.sync="pasture.dialogFormVisible" :close-on-click-modal="false" width="90%">
  225. <div class="app-pasture">
  226. <div class="search">
  227. <span style="margin-left: 10px;">统计类型:</span>
  228. <el-radio v-model="pasture.radio" label="1" @change="changeRadio">配方</el-radio>
  229. <el-radio v-model="pasture.radio" label="2" @change="changeRadio">栏舍</el-radio>
  230. <el-radio v-model="pasture.radio" label="3" @change="changeRadio">牲畜类别</el-radio>
  231. <el-input v-if="pasture.isFormulaName" v-model="pasture.table.getdataListParm.parammaps.ftname" class="filter-item" style="width: 245px;" placeholder="配方模板" />
  232. <el-input v-if="pasture.isHouseName" v-model="pasture.table.getdataListParm.parammaps.barname" class="filter-item" style="width: 150px;" placeholder="栏舍" />
  233. <el-input v-if="pasture.isHouseName" v-model="pasture.table.getdataListParm.parammaps.ftname" class="filter-item" style="width: 150px;" placeholder="配方模板" />
  234. <el-input v-if="pasture.isLivestockType" v-model="pasture.table.getdataListParm.parammaps.cowclass" class="filter-item" style="width: 150px;" placeholder="牲畜类别" />
  235. <el-button class="successBorder" @click="handlePastureSearch">查询</el-button>
  236. </div>
  237. <div class="table">
  238. <el-table
  239. :key="pasture.table.tableKey"
  240. v-loading="pasture.table.listLoading"
  241. element-loading-text="给我一点时间"
  242. :data="pasture.table.list"
  243. border
  244. fit
  245. highlight-current-row
  246. style="width: 100%;"
  247. :row-style="rowStyle"
  248. :cell-style="cellStyle"
  249. class="elTable table-fixed"
  250. >
  251. <el-table-column v-if="pasture.isFormulaName" label="配方模板" min-width="110px" align="center" prop="配方模板" />
  252. <el-table-column v-if="pasture.isHouseName" label="栏舍" min-width="110px" align="center" prop="栏舍" />
  253. <el-table-column v-if="pasture.isHouseName" label="配方模板" min-width="110px" align="center" prop="配方模板" />
  254. <el-table-column v-if="pasture.isLivestockType" label="牲畜类别" min-width="110px" align="center" prop="牲畜类别" />
  255. <el-table-column label="实际牛头数" min-width="110px" align="center" prop="实际牛头数" />
  256. <el-table-column label="应混料量(kg)" min-width="110px" align="center" prop="应混料量" />
  257. <el-table-column label="实际混料量(kg)" min-width="110px" align="center" prop="实际混料量" />
  258. <el-table-column label="撒料量(kg)" min-width="110px" align="center" prop="撒料量" />
  259. <el-table-column label="混料时间" min-width="110px" align="center" prop="混料时间" />
  260. <el-table-column label="转投剩料量(kg)" min-width="110px" align="center" prop="转投剩料量" />
  261. <el-table-column label="今日剩料量(kg)" min-width="110px" align="center" prop="今日剩料量" />
  262. <el-table-column label="剩料率(%)" min-width="110px" align="center" prop="剩料率" />
  263. <el-table-column label="TMR干物质(%)" min-width="110px" align="center" prop="TMR干物质" />
  264. <el-table-column label="配方干物质采食量(kg/头)" min-width="110px" align="center" prop="配方干物质采食量" />
  265. <el-table-column label="实际干物质采食量(kg/头)" min-width="110px" align="center" prop="实际干物质采食量" />
  266. <el-table-column label="采食率(%)" min-width="110px" align="center" prop="采食率" />
  267. <el-table-column label="配方成本(元/头)" min-width="110px" align="center" prop="配方成本" />
  268. <el-table-column label="实际成本(元/头)" min-width="110px" align="center" prop="实际成本" />
  269. <el-table-column label="产奶量(kg/头)" min-width="110px" align="center" prop="产奶量" />
  270. <el-table-column label="饲料转化率" min-width="110px" align="center" prop="饲料转化率" />
  271. <el-table-column label="公斤奶饲料成本" min-width="110px" align="center" prop="公斤奶饲料成本" />
  272. </el-table>
  273. </div>
  274. </div>
  275. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  276. <el-button class="cancelClose" @click="pasture.dialogFormVisible = false; ">关闭</el-button>
  277. </div>
  278. </el-dialog>
  279. </div>
  280. </template>
  281. <script>
  282. import echarts from 'echarts'
  283. require('echarts/theme/macarons')
  284. import { GetDataByName, GetReportform } from '@/api/common'
  285. import Cookies from 'js-cookie'
  286. import { parseTime } from '@/utils/index.js'
  287. import Pagination from '@/components/Pagination'
  288. import { json2excel } from '@/utils/index.js'
  289. import { MessageBox } from 'element-ui'
  290. export default {
  291. name: 'GroupFeedingEfficiency',
  292. components: { Pagination },
  293. data() {
  294. return {
  295. pickerMinDate: '',
  296. pickerOptions: {
  297. onPick: ({ maxDate, minDate }) => {
  298. this.pickerMinDate = minDate.getTime()
  299. if (maxDate) {
  300. this.pickerMinDate = ''
  301. }
  302. },
  303. // 限制不能选择今天之后的日期
  304. disabledDate: (time) => {
  305. if (this.pickerMinDate !== '') {
  306. const one = 31 * 24 * 3600 * 1000
  307. const minTime = this.pickerMinDate - one
  308. let maxTime = this.pickerMinDate + one
  309. if (maxTime > new Date()) {
  310. maxTime = new Date()
  311. }
  312. return time.getTime() < minTime || time.getTime() > maxTime
  313. }
  314. return time.getTime() > Date.now()
  315. }
  316. },
  317. tab: {
  318. chartDate: [],
  319. table: {
  320. getdataListParm: {
  321. name: 'getFeedEfficiencyJT',
  322. page: 1,
  323. offset: 1,
  324. pagecount: '',
  325. returntype: 'Map',
  326. parammaps: {
  327. pastureid: Cookies.get('pastureid'),
  328. date: parseTime(new Date(), '{y}-{m}-{d}'),
  329. ftname: '',
  330. barname: '',
  331. cowclass: ''
  332. }
  333. },
  334. tableKey: 1,
  335. list: [],
  336. total: 0,
  337. listLoading: true,
  338. temp: {}
  339. },
  340. chart1: {
  341. chartLine: null,
  342. chartLine_data: {},
  343. getdataListParm: {
  344. name: 'getFeedEffMRJT',
  345. page: 1,
  346. offset: 1,
  347. pagecount: '',
  348. returntype: 'Map',
  349. parammaps: {
  350. pastureid: Cookies.get('pastureid'),
  351. startTime: parseTime(new Date(), '{y}-{m}-{d}'),
  352. stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
  353. inputDatetime: [new Date(), new Date()]
  354. }
  355. },
  356. tableKey: 1,
  357. list: [],
  358. total: 0,
  359. listLoading: true,
  360. isChart: true,
  361. isTable: false,
  362. table: {
  363. tableKey: 1,
  364. list: [],
  365. total: 0,
  366. listLoading: false
  367. }
  368. },
  369. chart2: {
  370. chartLine: null,
  371. chartLine_data: {},
  372. getdataListParm: {
  373. name: 'getFeedEffSLJT',
  374. page: 1,
  375. offset: 1,
  376. pagecount: '',
  377. returntype: 'Map',
  378. parammaps: {
  379. pastureid: Cookies.get('pastureid'),
  380. startTime: parseTime(new Date(), '{y}-{m}-{d}'),
  381. stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
  382. inputDatetime: [new Date(), new Date()]
  383. }
  384. },
  385. tableKey: 1,
  386. list: [],
  387. total: 0,
  388. listLoading: true,
  389. chart2Data3: [],
  390. isChart: true,
  391. isTable: false,
  392. table: {
  393. tableKey: 1,
  394. list: [],
  395. total: 0,
  396. listLoading: false
  397. }
  398. },
  399. chart3: {
  400. chartLine: null,
  401. chartLine_data: {},
  402. getdataListParm: {
  403. name: 'getFeedEffHLJT',
  404. page: 1,
  405. offset: 1,
  406. pagecount: '',
  407. returntype: 'Map',
  408. parammaps: {
  409. pastureid: Cookies.get('pastureid'),
  410. startTime: parseTime(new Date(), '{y}-{m}-{d}'),
  411. stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
  412. inputDatetime: [new Date(), new Date()]
  413. }
  414. },
  415. tableKey: 1,
  416. list: [],
  417. total: 0,
  418. listLoading: true,
  419. isChart: true,
  420. isTable: false,
  421. table: {
  422. tableKey: 1,
  423. list: [],
  424. total: 0,
  425. listLoading: false
  426. }
  427. },
  428. chart4: {
  429. chartLine: null,
  430. chartLine_data: {},
  431. getdataListParm: {
  432. name: 'getFeedEffZHJT',
  433. page: 1,
  434. offset: 1,
  435. pagecount: '',
  436. returntype: 'Map',
  437. parammaps: {
  438. pastureid: Cookies.get('pastureid'),
  439. startTime: parseTime(new Date(), '{y}-{m}-{d}'),
  440. stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
  441. inputDatetime: [new Date(), new Date()]
  442. }
  443. },
  444. tableKey: 1,
  445. list: [],
  446. total: 0,
  447. listLoading: true,
  448. chart4Data3: [],
  449. isChart: true,
  450. isTable: false,
  451. table: {
  452. tableKey: 1,
  453. list: [],
  454. total: 0,
  455. listLoading: false
  456. }
  457. },
  458. chart5: {
  459. chartLine: null,
  460. chartLine_data: {},
  461. getdataListParm: {
  462. name: 'getFeedEffCBAllJT',
  463. page: 1,
  464. offset: 1,
  465. pagecount: '',
  466. returntype: 'Map',
  467. parammaps: {
  468. pastureid: Cookies.get('pastureid'),
  469. startTime: parseTime(new Date(), '{y}-{m}-{d}'),
  470. stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
  471. inputDatetime: [new Date(), new Date()]
  472. }
  473. },
  474. tableKey: 1,
  475. list: [],
  476. total: 0,
  477. listLoading: true,
  478. chart5Data3: [],
  479. isChart: true,
  480. isTable: false,
  481. table: {
  482. tableKey: 1,
  483. list: [],
  484. total: 0,
  485. listLoading: false
  486. }
  487. }
  488. },
  489. pasture: {
  490. dialogFormVisible: false,
  491. dialogStatus: '',
  492. radio: '1',
  493. isFormulaName: true, // 配方名称
  494. isHouseName: false, // 栏舍名称
  495. isLivestockType: false, // 牲畜类别
  496. table: {
  497. getdataListParm: {
  498. name: 'getFeedEfficiencyFT',
  499. page: 1,
  500. offset: 1,
  501. pagecount: '',
  502. returntype: 'Map',
  503. parammaps: {
  504. pastureid: Cookies.get('pastureid'),
  505. date: parseTime(new Date(), '{y}-{m}-{d}'),
  506. ftname: '',
  507. barname: '',
  508. cowclass: ''
  509. }
  510. },
  511. tableKey: 1,
  512. list: [],
  513. total: 0,
  514. listLoading: true,
  515. temp: {}
  516. }
  517. },
  518. textMap: {
  519. pasture: '牧场'
  520. },
  521. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  522. cellStyle: { padding: 0 + 'px' }
  523. }
  524. },
  525. created() {
  526. this.getList()
  527. this.getTimeFn()
  528. this.getChart1()
  529. this.getChart2()
  530. this.getChart3()
  531. this.getChart4()
  532. this.getChart5()
  533. },
  534. mounted() {
  535. },
  536. methods: {
  537. getTimeFn() {
  538. const that = this
  539. const end = new Date()
  540. const start = new Date()
  541. const start2 = new Date()
  542. start2.setTime(start2.getTime() - 3600 * 1000 * 24 * 1)
  543. that.tab.table.getdataListParm.parammaps.date = parseTime(start2, '{y}-{m}-{d}')
  544. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
  545. that.tab.chartDate[0] = parseTime(start, '{y}-{m}-{d}')
  546. that.tab.chartDate[1] = parseTime(end, '{y}-{m}-{d}')
  547. that.tab.chart1.getdataListParm.parammaps.inputDatetime[0] = parseTime(start, '{y}-{m}-{d}')
  548. that.tab.chart1.getdataListParm.parammaps.inputDatetime[1] = parseTime(end, '{y}-{m}-{d}')
  549. that.tab.chart1.getdataListParm.parammaps.startTime = parseTime(start, '{y}-{m}-{d}')
  550. that.tab.chart1.getdataListParm.parammaps.stopTime = parseTime(end, '{y}-{m}-{d}')
  551. that.tab.chart2.getdataListParm.parammaps.inputDatetime[0] = parseTime(start, '{y}-{m}-{d}')
  552. that.tab.chart2.getdataListParm.parammaps.inputDatetime[1] = parseTime(end, '{y}-{m}-{d}')
  553. that.tab.chart2.getdataListParm.parammaps.startTime = parseTime(start, '{y}-{m}-{d}')
  554. that.tab.chart2.getdataListParm.parammaps.stopTime = parseTime(end, '{y}-{m}-{d}')
  555. that.tab.chart3.getdataListParm.parammaps.inputDatetime[0] = parseTime(start, '{y}-{m}-{d}')
  556. that.tab.chart3.getdataListParm.parammaps.inputDatetime[1] = parseTime(end, '{y}-{m}-{d}')
  557. that.tab.chart3.getdataListParm.parammaps.startTime = parseTime(start, '{y}-{m}-{d}')
  558. that.tab.chart3.getdataListParm.parammaps.stopTime = parseTime(end, '{y}-{m}-{d}')
  559. that.tab.chart4.getdataListParm.parammaps.inputDatetime[0] = parseTime(start, '{y}-{m}-{d}')
  560. that.tab.chart4.getdataListParm.parammaps.inputDatetime[1] = parseTime(end, '{y}-{m}-{d}')
  561. that.tab.chart4.getdataListParm.parammaps.startTime = parseTime(start, '{y}-{m}-{d}')
  562. that.tab.chart4.getdataListParm.parammaps.stopTime = parseTime(end, '{y}-{m}-{d}')
  563. that.tab.chart5.getdataListParm.parammaps.inputDatetime[0] = parseTime(start, '{y}-{m}-{d}')
  564. that.tab.chart5.getdataListParm.parammaps.inputDatetime[1] = parseTime(end, '{y}-{m}-{d}')
  565. that.tab.chart5.getdataListParm.parammaps.startTime = parseTime(start, '{y}-{m}-{d}')
  566. that.tab.chart5.getdataListParm.parammaps.stopTime = parseTime(end, '{y}-{m}-{d}')
  567. },
  568. // 导出
  569. handleDownload() {},
  570. // 效率统计
  571. getList() {
  572. this.tab.table.listLoading = true
  573. this.tab.table.getdataListParm.parammaps.date = parseTime(this.tab.table.getdataListParm.parammaps.date, '{y}-{m}-{d}')
  574. GetDataByName(this.tab.table.getdataListParm).then(response => {
  575. console.log('汇总统计/混料table数据', response.data.list)
  576. if (response.data.list !== null) {
  577. this.tab.table.list = response.data.list
  578. this.tab.table.total = response.data.total
  579. } else {
  580. this.tab.table.list = []
  581. }
  582. setTimeout(() => {
  583. this.tab.table.listLoading = false
  584. }, 100)
  585. })
  586. },
  587. // 查询
  588. handleSearch() {
  589. this.getList()
  590. },
  591. tableCellStyle({ row, column, rowIndex, columnIndex }) {
  592. if (columnIndex === 0 && row.pastureid !== '-1') {
  593. return {
  594. textDecoration: 'underline'
  595. }
  596. }
  597. return {
  598. textDecoration: 'none'
  599. }
  600. },
  601. clickPasture(row) {
  602. if (row.pastureid !== '-1') {
  603. this.pasture.dialogStatus = 'pasture'
  604. this.pasture.dialogFormVisible = true
  605. this.pasture.table.getdataListParm.parammaps.pastureid = row.pastureid
  606. this.getTabList()
  607. }
  608. },
  609. // 效率统计
  610. getTabList() {
  611. this.pasture.table.listLoading = true
  612. this.pasture.table.getdataListParm.parammaps.date = this.tab.table.getdataListParm.parammaps.date
  613. GetDataByName(this.pasture.table.getdataListParm).then(response => {
  614. console.log('汇总统计/混料table数据', response.data.list)
  615. if (response.data.list !== null) {
  616. this.pasture.table.list = response.data.list
  617. this.pasture.table.total = response.data.total
  618. } else {
  619. this.pasture.table.list = []
  620. }
  621. setTimeout(() => {
  622. this.pasture.table.listLoading = false
  623. }, 100)
  624. })
  625. },
  626. // 切换统计类型
  627. changeRadio() {
  628. console.log(this.pasture.radio)
  629. if (this.pasture.radio == '1') {
  630. console.log('配方名称')
  631. this.pasture.isFormulaName = true
  632. this.pasture.isHouseName = false
  633. this.pasture.isLivestockType = false
  634. this.pasture.table.getdataListParm.parammaps.ftname = ''
  635. this.pasture.table.getdataListParm.parammaps.barname = ''
  636. this.pasture.table.getdataListParm.parammaps.ftname = ''
  637. this.pasture.table.getdataListParm.parammaps.cowclass = ''
  638. this.pasture.table.getdataListParm.name = 'getFeedEfficiencyFT'
  639. this.getTabList()
  640. } else if (this.pasture.radio == '2') {
  641. console.log('栏舍名称')
  642. this.pasture.isFormulaName = false
  643. this.pasture.isHouseName = true
  644. this.pasture.isLivestockType = false
  645. this.pasture.table.getdataListParm.parammaps.ftname = ''
  646. this.pasture.table.getdataListParm.parammaps.barname = ''
  647. this.pasture.table.getdataListParm.parammaps.ftname = ''
  648. this.pasture.table.getdataListParm.parammaps.cowclass = ''
  649. this.pasture.table.getdataListParm.name = 'getFeedEfficiencyLS'
  650. this.getTabList()
  651. } else if (this.pasture.radio == '3') {
  652. console.log(' 牲畜类别')
  653. this.pasture.isFormulaName = false
  654. this.pasture.isHouseName = false
  655. this.pasture.isLivestockType = true
  656. this.pasture.table.getdataListParm.parammaps.ftname = ''
  657. this.pasture.table.getdataListParm.parammaps.barname = ''
  658. this.pasture.table.getdataListParm.parammaps.ftname = ''
  659. this.pasture.table.getdataListParm.parammaps.cowclass = ''
  660. this.pasture.table.getdataListParm.name = 'getFeedEfficiencySC'
  661. this.getTabList()
  662. }
  663. },
  664. handlePastureSearch() {},
  665. // 图表总查询
  666. handleChartDate() {
  667. console.log('点击了确认时间')
  668. MessageBox.confirm('是否调整以下所有图表查询时间?', {
  669. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  670. }).then(() => {
  671. var that = this
  672. var startTime = parseTime(this.tab.chartDate[0], '{y}-{m}-{d}')
  673. var stopTime = parseTime(this.tab.chartDate[1], '{y}-{m}-{d}')
  674. that.tab.chart1.getdataListParm.parammaps.inputDatetime = this.tab.chartDate
  675. that.tab.chart1.getdataListParm.parammaps.startTime = startTime
  676. that.tab.chart1.getdataListParm.parammaps.stopTime = stopTime
  677. that.getChart1()
  678. that.tab.chart2.getdataListParm.parammaps.inputDatetime = this.tab.chartDate
  679. that.tab.chart2.getdataListParm.parammaps.startTime = startTime
  680. that.tab.chart2.getdataListParm.parammaps.stopTime = stopTime
  681. that.getChart2()
  682. that.tab.chart3.getdataListParm.parammaps.inputDatetime = this.tab.chartDate
  683. that.tab.chart3.getdataListParm.parammaps.startTime = startTime
  684. that.tab.chart3.getdataListParm.parammaps.stopTime = stopTime
  685. that.getChart3()
  686. that.tab.chart4.getdataListParm.parammaps.inputDatetime = this.tab.chartDate
  687. that.tab.chart4.getdataListParm.parammaps.startTime = startTime
  688. that.tab.chart4.getdataListParm.parammaps.stopTime = stopTime
  689. that.getChart4()
  690. that.tab.chart5.getdataListParm.parammaps.inputDatetime = this.tab.chartDate
  691. that.tab.chart5.getdataListParm.parammaps.startTime = startTime
  692. that.tab.chart5.getdataListParm.parammaps.stopTime = stopTime
  693. that.getChart5()
  694. })
  695. },
  696. // 泌乳牛干物质采食量
  697. getChart1() {
  698. this.tab.chart1.listLoading = true
  699. GetReportform(this.tab.chart1.getdataListParm).then(response => {
  700. console.log('泌乳牛干物质采食量图表数据', response.data.list)
  701. if (response.data.list !== null) {
  702. this.tab.chart1.table.list = response.data.data
  703. this.tab.chart1.chartLine_data = response.data.list
  704. // this.tab.chart1.chartLine_data = {
  705. // data1: ['1牧', '2牧', '3牧'], // 折线
  706. // data2: ['12/01', '12/02', '12/03'], // X轴
  707. // data3: [
  708. // { data: [1.5, 1.2, 1.7, 1.2] },
  709. // { data: [1.7, 0.8, 1.2, 1.8] },
  710. // { data: [1.3, 2.2, 1.9, 1.4] }
  711. // ]// 折线对应数据
  712. // }
  713. // this.tab.chart1.total = response.data.total
  714. this.roadChartLine1(this.tab.chart1.chartLine_data)
  715. } else {
  716. this.tab.chart1.list = []
  717. }
  718. setTimeout(() => {
  719. this.tab.chart1.listLoading = false
  720. }, 100)
  721. })
  722. },
  723. roadChartLine1(chartLine_data) {
  724. if (this.tab.chart1.chartLine != null) {
  725. this.tab.chart1.chartLine.dispose()
  726. }
  727. this.tab.chart1.chartLine = echarts.init(document.getElementById('chartLine1'))
  728. var option = {
  729. title: {
  730. text: ''
  731. },
  732. tooltip: {
  733. trigger: 'axis'
  734. },
  735. legend: {
  736. data: chartLine_data.data1,
  737. right: 10
  738. },
  739. grid: {
  740. top: '20%',
  741. left: '3%',
  742. right: '8%',
  743. containLabel: true
  744. },
  745. toolbox: {
  746. show: true,
  747. right: '2%',
  748. feature: {}
  749. },
  750. xAxis: { type: 'category', boundaryGap: false, data: chartLine_data.data2, name: '日期' },
  751. yAxis: {
  752. type: 'value', name: 'kg', axisLabel: { formatter: '{value}' }
  753. },
  754. series: (function() {
  755. var serie = []
  756. for (var i = 0; i < chartLine_data.data3.length; i++) {
  757. var item = {
  758. name: chartLine_data.data1[i],
  759. type: 'line',
  760. data: chartLine_data.data3[i].data
  761. }
  762. serie.push(item)
  763. }
  764. return serie
  765. }())
  766. }
  767. this.tab.chart1.chartLine.setOption(option)
  768. window.onresize = function() {
  769. this.tab.chart1.chartLine.resize()
  770. }
  771. },
  772. // 剩料率
  773. getChart2() {
  774. this.tab.chart2.listLoading = true
  775. GetReportform(this.tab.chart2.getdataListParm).then(response => {
  776. console.log('剩料率图表数据', response.data.list)
  777. if (response.data.list !== null) {
  778. this.tab.chart2.table.list = response.data.data
  779. this.tab.chart2.chartLine_data = response.data.list
  780. // this.tab.chart2.chartLine_data = {
  781. // data1: ['1牧', '2牧', '3牧'], // 折线
  782. // data2: ['12/01', '12/02', '12/03'], // X轴
  783. // data3: [
  784. // { data: [1.5, 1.2, 1.7, 1.2] },
  785. // { data: [1.7, 0.8, 1.2, 1.8] },
  786. // { data: [1.3, 2.2, 1.9, 1.4] }
  787. // ]// 折线对应数据
  788. // }
  789. this.tab.chart2.total = response.data.total
  790. console.log('剩料率图数据', this.tab.chart2.chartLine_data)
  791. console.log('剩料率表数据', this.tab.chart2.table.list)
  792. this.roadChartLine2(this.tab.chart2.chartLine_data)
  793. } else {
  794. this.tab.chart2.list = []
  795. }
  796. setTimeout(() => {
  797. this.tab.chart2.listLoading = false
  798. }, 100)
  799. })
  800. },
  801. roadChartLine2(chartLine_data) {
  802. if (this.tab.chart2.chartLine != null) {
  803. this.tab.chart2.chartLine.dispose()
  804. }
  805. this.tab.chart2.chartLine = echarts.init(document.getElementById('chartLine2'))
  806. var option = {
  807. title: {
  808. text: ''
  809. },
  810. tooltip: {
  811. trigger: 'axis'
  812. },
  813. legend: {
  814. data: chartLine_data.data1,
  815. right: 10
  816. },
  817. grid: {
  818. top: '20%',
  819. left: '3%',
  820. right: '8%',
  821. containLabel: true
  822. },
  823. toolbox: {
  824. show: true,
  825. right: '2%',
  826. feature: {}
  827. },
  828. xAxis: { type: 'category', boundaryGap: false, data: chartLine_data.data2, name: '日期' },
  829. yAxis: {
  830. type: 'value', name: '剩料率', axisLabel: { formatter: '{value} %' }
  831. },
  832. series: (function() {
  833. var serie = []
  834. for (var i = 0; i < chartLine_data.data3.length; i++) {
  835. var item = {
  836. name: chartLine_data.data1[i],
  837. type: 'line',
  838. data: chartLine_data.data3[i].data
  839. }
  840. serie.push(item)
  841. }
  842. return serie
  843. }())
  844. }
  845. this.tab.chart2.chartLine.setOption(option)
  846. window.onresize = function() {
  847. this.tab.chart2.chartLine.resize()
  848. }
  849. },
  850. // 混料时间统计
  851. getChart3() {
  852. this.tab.chart3.listLoading = true
  853. GetReportform(this.tab.chart3.getdataListParm).then(response => {
  854. console.log('混料时间统计图表数据', response.data.list)
  855. if (response.data.list !== null) {
  856. this.tab.chart3.table.list = response.data.data
  857. this.tab.chart3.chartLine_data = response.data.list
  858. // this.tab.chart3.chartLine_data = {
  859. // data1: ['1牧', '2牧', '3牧'], // 折线
  860. // data2: ['12/01', '12/02', '12/03'], // X轴
  861. // data3: [
  862. // { data: [1.5, 1.2, 1.7, 1.2] },
  863. // { data: [1.7, 0.8, 1.2, 1.8] },
  864. // { data: [1.3, 2.2, 1.9, 1.4] }
  865. // ]// 折线对应数据
  866. // }
  867. this.tab.chart3.total = response.data.total
  868. this.tab.chart3.total = response.data.total
  869. this.roadChartLine3(this.tab.chart3.chartLine_data)
  870. } else {
  871. this.tab.chart3.list = []
  872. }
  873. setTimeout(() => {
  874. this.tab.chart3.listLoading = false
  875. }, 100)
  876. })
  877. },
  878. roadChartLine3(chartLine_data) {
  879. if (this.tab.chart3.chartLine != null) {
  880. this.tab.chart3.chartLine.dispose()
  881. }
  882. this.tab.chart3.chartLine = echarts.init(document.getElementById('chartLine3'))
  883. var option = {
  884. title: {
  885. text: ''
  886. },
  887. tooltip: {
  888. trigger: 'axis'
  889. },
  890. legend: {
  891. data: chartLine_data.data1,
  892. right: 10
  893. },
  894. grid: {
  895. top: '20%',
  896. left: '3%',
  897. right: '8%',
  898. containLabel: true
  899. },
  900. toolbox: {
  901. show: true,
  902. right: '2%',
  903. feature: {}
  904. },
  905. xAxis: { type: 'category', boundaryGap: false, data: chartLine_data.data2, name: '日期' },
  906. yAxis: {
  907. type: 'value', name: '分钟', axisLabel: { formatter: '{value}min' }
  908. },
  909. series: (function() {
  910. var serie = []
  911. for (var i = 0; i < chartLine_data.data3.length; i++) {
  912. var item = {
  913. name: chartLine_data.data1[i],
  914. type: 'line',
  915. data: chartLine_data.data3[i].data
  916. }
  917. serie.push(item)
  918. }
  919. return serie
  920. }())
  921. }
  922. this.tab.chart3.chartLine.setOption(option)
  923. window.onresize = function() {
  924. this.tab.chart3.chartLine.resize()
  925. }
  926. },
  927. // 转化率
  928. getChart4() {
  929. this.tab.chart4.listLoading = true
  930. GetReportform(this.tab.chart4.getdataListParm).then(response => {
  931. console.log('转化率图表数据', response.data.list)
  932. if (response.data.list !== null) {
  933. this.tab.chart4.table.list = response.data.data
  934. this.tab.chart4.chartLine_data = response.data.list
  935. // this.tab.chart4.chartLine_data = {
  936. // data1: ['1牧', '2牧', '3牧'], // 折线
  937. // data2: ['12/01', '12/02', '12/03'], // X轴
  938. // data3: [
  939. // { data: [1.5, 1.2, 1.7, 1.2] },
  940. // { data: [1.7, 0.8, 1.2, 1.8] },
  941. // { data: [1.3, 2.2, 1.9, 1.4] }
  942. // ]// 折线对应数据
  943. // }
  944. this.tab.chart4.total = response.data.total
  945. console.log('转化率图数据', this.tab.chart4.chartLine_data)
  946. console.log('转化率表数据', this.tab.chart4.table.list)
  947. this.roadChartLine4(this.tab.chart4.chartLine_data)
  948. } else {
  949. this.tab.chart4.list = []
  950. }
  951. setTimeout(() => {
  952. this.tab.chart4.listLoading = false
  953. }, 100)
  954. })
  955. },
  956. roadChartLine4(chartLine_data) {
  957. if (this.tab.chart4.chartLine != null) {
  958. this.tab.chart4.chartLine.dispose()
  959. }
  960. this.tab.chart4.chartLine = echarts.init(document.getElementById('chartLine4'))
  961. var option = {
  962. title: {
  963. text: ''
  964. },
  965. tooltip: {
  966. trigger: 'axis'
  967. },
  968. legend: {
  969. data: chartLine_data.data1,
  970. right: 10
  971. },
  972. grid: {
  973. top: '20%',
  974. left: '3%',
  975. right: '8%',
  976. containLabel: true
  977. },
  978. toolbox: {
  979. show: true,
  980. right: '2%',
  981. feature: {}
  982. },
  983. xAxis: { type: 'category', boundaryGap: false, data: chartLine_data.data2, name: '日期' },
  984. yAxis: {
  985. type: 'value', name: '饲料转化率', axisLabel: { formatter: '{value} %' }
  986. },
  987. series: (function() {
  988. var serie = []
  989. for (var i = 0; i < chartLine_data.data3.length; i++) {
  990. var item = {
  991. name: chartLine_data.data1[i],
  992. type: 'line',
  993. data: chartLine_data.data3[i].data
  994. }
  995. serie.push(item)
  996. }
  997. return serie
  998. }())
  999. }
  1000. this.tab.chart4.chartLine.setOption(option)
  1001. window.onresize = function() {
  1002. this.tab.chart4.chartLine.resize()
  1003. }
  1004. },
  1005. // 成本分析
  1006. getChart5() {
  1007. this.tab.chart5.listLoading = true
  1008. GetReportform(this.tab.chart5.getdataListParm).then(response => {
  1009. console.log('转化率图表数据', response.data.list)
  1010. if (response.data.list !== null) {
  1011. this.tab.chart5.table.list = response.data.data
  1012. this.tab.chart5.chartLine_data = response.data.list
  1013. // this.tab.chart5.chartLine_data = {
  1014. // data1: ['1牧', '2牧', '3牧'], // 折线
  1015. // data2: ['12/01', '12/02', '12/03'], // X轴
  1016. // data3: [
  1017. // { data: [1.5, 1.2, 1.7, 1.2] },
  1018. // { data: [1.7, 0.8, 1.2, 1.8] },
  1019. // { data: [1.3, 2.2, 1.9, 1.4] }
  1020. // ]// 折线对应数据
  1021. // }
  1022. this.tab.chart5.total = response.data.total
  1023. console.log('转化率图数据', this.tab.chart5.chartLine_data)
  1024. console.log('转化率表数据', this.tab.chart5.table.list)
  1025. this.roadChartLine5(this.tab.chart5.chartLine_data)
  1026. } else {
  1027. this.tab.chart5.list = []
  1028. }
  1029. setTimeout(() => {
  1030. this.tab.chart5.listLoading = false
  1031. }, 100)
  1032. })
  1033. },
  1034. roadChartLine5(chartLine_data) {
  1035. if (this.tab.chart5.chartLine != null) {
  1036. this.tab.chart5.chartLine.dispose()
  1037. }
  1038. this.tab.chart5.chartLine = echarts.init(document.getElementById('chartLine5'))
  1039. var option = {
  1040. title: {
  1041. text: ''
  1042. },
  1043. tooltip: {
  1044. trigger: 'axis'
  1045. },
  1046. legend: {
  1047. data: chartLine_data.data1,
  1048. right: 10
  1049. },
  1050. grid: {
  1051. top: '20%',
  1052. left: '5%',
  1053. right: '8%',
  1054. containLabel: true
  1055. },
  1056. toolbox: {
  1057. show: true,
  1058. right: '2%',
  1059. feature: {}
  1060. },
  1061. xAxis: { type: 'category', boundaryGap: false, data: chartLine_data.data2, name: '日期' },
  1062. yAxis: {
  1063. type: 'value', name: '公斤奶饲料成本(元)'
  1064. },
  1065. series: (function() {
  1066. var serie = []
  1067. for (var i = 0; i < chartLine_data.data3.length; i++) {
  1068. var item = {
  1069. name: chartLine_data.data1[i],
  1070. type: 'line',
  1071. data: chartLine_data.data3[i].data
  1072. }
  1073. serie.push(item)
  1074. }
  1075. return serie
  1076. }())
  1077. }
  1078. this.tab.chart5.chartLine.setOption(option)
  1079. window.onresize = function() {
  1080. this.tab.chart5.chartLine.resize()
  1081. }
  1082. },
  1083. // 时间
  1084. changeChartDate(item) {
  1085. console.log(item)
  1086. if (item == 'chart1') {
  1087. if (this.tab.chart1.getdataListParm.parammaps.inputDatetime !== '' && this.tab.chart1.getdataListParm.parammaps.inputDatetime !== null) {
  1088. this.tab.chart1.getdataListParm.parammaps.startTime = parseTime(this.tab.chart1.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  1089. this.tab.chart1.getdataListParm.parammaps.stopTime = parseTime(this.tab.chart1.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  1090. this.getChart1()
  1091. } else {
  1092. this.tab.chart1.getdataListParm.parammaps.inputDatetime = ''
  1093. this.tab.chart1.getdataListParm.parammaps.startTime = ''
  1094. this.tab.chart1.getdataListParm.parammaps.stopTime = ''
  1095. this.getChart1()
  1096. }
  1097. } else if (item == 'chart2') {
  1098. if (this.tab.chart2.getdataListParm.parammaps.inputDatetime !== '' && this.tab.chart2.getdataListParm.parammaps.inputDatetime !== null) {
  1099. this.tab.chart2.getdataListParm.parammaps.startTime = parseTime(this.tab.chart2.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  1100. this.tab.chart2.getdataListParm.parammaps.stopTime = parseTime(this.tab.chart2.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  1101. this.getChart2()
  1102. } else {
  1103. this.tab.chart2.getdataListParm.parammaps.inputDatetime = ''
  1104. this.tab.chart2.getdataListParm.parammaps.startTime = ''
  1105. this.tab.chart2.getdataListParm.parammaps.stopTime = ''
  1106. this.getChart2()
  1107. }
  1108. } else if (item == 'chart3') {
  1109. if (this.tab.chart3.getdataListParm.parammaps.inputDatetime !== '' && this.tab.chart3.getdataListParm.parammaps.inputDatetime !== null) {
  1110. this.tab.chart3.getdataListParm.parammaps.startTime = parseTime(this.tab.chart3.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  1111. this.tab.chart3.getdataListParm.parammaps.stopTime = parseTime(this.tab.chart3.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  1112. this.getChart3()
  1113. } else {
  1114. this.tab.chart3.getdataListParm.parammaps.inputDatetime = ''
  1115. this.tab.chart3.getdataListParm.parammaps.startTime = ''
  1116. this.tab.chart3.getdataListParm.parammaps.stopTime = ''
  1117. this.getChart3()
  1118. }
  1119. } else if (item == 'chart4') {
  1120. if (this.tab.chart4.getdataListParm.parammaps.inputDatetime !== '' && this.tab.chart4.getdataListParm.parammaps.inputDatetime !== null) {
  1121. this.tab.chart4.getdataListParm.parammaps.startTime = parseTime(this.tab.chart4.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  1122. this.tab.chart4.getdataListParm.parammaps.stopTime = parseTime(this.tab.chart4.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  1123. this.getChart4()
  1124. } else {
  1125. this.tab.chart4.getdataListParm.parammaps.inputDatetime = ''
  1126. this.tab.chart4.getdataListParm.parammaps.startTime = ''
  1127. this.tab.chart4.getdataListParm.parammaps.stopTime = ''
  1128. this.getChart4()
  1129. }
  1130. } else if (item == 'chart5') {
  1131. if (this.tab.chart5.getdataListParm.parammaps.inputDatetime !== '' && this.tab.chart5.getdataListParm.parammaps.inputDatetime !== null) {
  1132. this.tab.chart5.getdataListParm.parammaps.startTime = parseTime(this.tab.chart5.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  1133. this.tab.chart5.getdataListParm.parammaps.stopTime = parseTime(this.tab.chart5.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  1134. this.getChart5()
  1135. } else {
  1136. this.tab.chart5.getdataListParm.parammaps.inputDatetime = ''
  1137. this.tab.chart5.getdataListParm.parammaps.startTime = ''
  1138. this.tab.chart5.getdataListParm.parammaps.stopTime = ''
  1139. this.getChart5()
  1140. }
  1141. }
  1142. },
  1143. // 导出
  1144. handleExport(item) {
  1145. if (item == 'chart1') {
  1146. console.log('泌乳牛采食量导出')
  1147. var excelDatasTabChart1 = [
  1148. {
  1149. tHeader: ['日期', '泌乳牛采食量', '泌乳牛产奶量'],
  1150. filterVal: ['日期', 'field1', 'field2'],
  1151. tableDatas: this.tab.chart1.table.list,
  1152. sheetName: '泌乳牛采食量'
  1153. }
  1154. ]
  1155. json2excel(excelDatasTabChart1, '泌乳牛采食量', true, 'xlsx')
  1156. } else if (item == 'chart2') {
  1157. console.log('剩料率导出')
  1158. var excelDatasTabChart2 = [
  1159. {
  1160. tHeader: ['日期', '栏舍名称', '剩料量', '撒料量', '剩料率'],
  1161. filterVal: ['日期', '名称', '剩料量', '撒料量', '准确率'],
  1162. tableDatas: this.tab.chart2.table.list,
  1163. sheetName: '牛栏剩料率'
  1164. }
  1165. ]
  1166. json2excel(excelDatasTabChart2, '牛栏剩料率', true, 'xlsx')
  1167. } else if (item == 'chart3') {
  1168. console.log('混料时间统计导出')
  1169. var excelDatasTabChart3 = [
  1170. {
  1171. tHeader: ['日期', '混料时间(分钟)'],
  1172. filterVal: ['日期', 'field1'],
  1173. tableDatas: this.tab.chart3.table.list,
  1174. sheetName: '混料时间统计'
  1175. }
  1176. ]
  1177. json2excel(excelDatasTabChart3, '混料时间统计', true, 'xlsx')
  1178. } else if (item == 'chart4') {
  1179. console.log('转化率导出')
  1180. var excelDatasTabChart4 = [
  1181. {
  1182. tHeader: ['日期', '配方名称', '饲料转化率'],
  1183. filterVal: ['日期', '名称', '准确率'],
  1184. tableDatas: this.tab.chart4.table.list,
  1185. sheetName: '转化率统计'
  1186. }
  1187. ]
  1188. json2excel(excelDatasTabChart4, '转化率', true, 'xlsx')
  1189. } else if (item == 'chart5') {
  1190. console.log('成本分析导出')
  1191. var excelDatasTabChart5 = [
  1192. {
  1193. tHeader: ['日期', '牲畜类别', '公斤奶饲料成本(元)'],
  1194. filterVal: ['日期', '名称', '准确率'],
  1195. tableDatas: this.tab.chart5.table.list,
  1196. sheetName: '成本分析'
  1197. }
  1198. ]
  1199. json2excel(excelDatasTabChart5, '成本分析', true, 'xlsx')
  1200. }
  1201. },
  1202. // 切换表格
  1203. handleTable(item) {
  1204. // 显示切换表格
  1205. if (item == 'chart1') {
  1206. console.log('泌乳牛采食量表格')
  1207. this.tab.chart1.isTable = true
  1208. this.tab.chart1.isChart = false
  1209. } else if (item == 'chart2') {
  1210. console.log('牛栏剩料率表格')
  1211. this.tab.chart2.isTable = true
  1212. this.tab.chart2.isChart = false
  1213. } else if (item == 'chart3') {
  1214. console.log('混料时间统计表格')
  1215. this.tab.chart3.isTable = true
  1216. this.tab.chart3.isChart = false
  1217. } else if (item == 'chart4') {
  1218. console.log('转化率表格')
  1219. this.tab.chart4.isTable = true
  1220. this.tab.chart4.isChart = false
  1221. } else if (item == 'chart5') {
  1222. console.log('成本分析表格')
  1223. this.tab.chart5.isTable = true
  1224. this.tab.chart5.isChart = false
  1225. }
  1226. },
  1227. // 切换图表
  1228. handleChart(item) {
  1229. // 显示切换图表
  1230. if (item == 'chart1') {
  1231. console.log('泌乳牛采食量图表')
  1232. this.tab.chart1.isTable = false
  1233. this.tab.chart1.isChart = true
  1234. } else if (item == 'chart2') {
  1235. console.log('牛栏剩料率图表')
  1236. this.tab.chart2.isTable = false
  1237. this.tab.chart2.isChart = true
  1238. } else if (item == 'chart3') {
  1239. console.log('混料时间统计图表')
  1240. this.tab.chart3.isTable = false
  1241. this.tab.chart3.isChart = true
  1242. } else if (item == 'chart4') {
  1243. console.log('转化率图表')
  1244. this.tab.chart4.isTable = false
  1245. this.tab.chart4.isChart = true
  1246. } else if (item == 'chart5') {
  1247. console.log('成本分析图表')
  1248. this.tab.chart5.isTable = false
  1249. this.tab.chart5.isChart = true
  1250. }
  1251. }
  1252. }
  1253. }
  1254. </script>
  1255. <style lang="scss" scoped>
  1256. .search{margin-bottom:10px;}
  1257. </style>