05a5850cc3868c5651b184a1d913d6f0dd844011.svn-base 56 KB

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