index.vue 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232
  1. <template>
  2. <div class="app-container">
  3. <!-- <el-dialog
  4. v-dialogDrag
  5. ref="dialog__wrapper">
  6. <div class="dialog-body">
  7. <div
  8. class="line"
  9. v-dialogDrag Width="$refs.dialog__wrapper">1111111111111111111</div>
  10. </div>
  11. </el-dialog> -->
  12. <el-row :gutter="20">
  13. <el-col :span="18">
  14. <!-- <draggable v-model="arr1" group="itxst" animation="300" :group="{name: 'dashboard',pull: true}">
  15. <transition-group>
  16. <div style = "width:300px;height:20px;border:1px soild #333" :class="item.id==1?'item forbid':'item'" v-for="item in arr1" key="1">{{item.name}}</div>
  17. </transition-group>
  18. </draggable> -->
  19. <div class="search">
  20. <el-select v-model="tableObj.getDataParameters.parammaps.dateType" placeholder="查询日期" @change="change_date_type">
  21. <el-option v-for="item in dateTypeList" :key="item.id" :label="item.name" :value="item.id" ></el-option>
  22. </el-select>
  23. <el-select v-model="tableObj.getDataParameters.parammaps.type" filterable placeholder="数据类型" class="filter-item" style="width: 120px;" clearable>
  24. <el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id" />
  25. </el-select>
  26. <el-select v-model="tableObj.getDataParameters.parammaps.dimension" @change="change_dimension" filterable placeholder="维度" class="filter-item" style="width: 120px;" >
  27. <el-option v-for="item in dimensionList" :key="item.id" :label="item.name" :value="item.id" />
  28. </el-select>
  29. <!-- <el-select v-model="tableObj.getDataParameters.parammaps.mixture" multiple placeholder="混料数据">
  30. <el-option v-for="item in mixtureList" :key="item.id" :label="item.name" :value="item.id" ></el-option>
  31. </el-select>
  32. <el-select v-model="tableObj.getDataParameters.parammaps.spread" multiple placeholder="撒料数据">
  33. <el-option v-for="item in spreadList" :key="item.id" :label="item.name" :value="item.id" ></el-option>
  34. </el-select> -->
  35. <el-cascader style = "width:400px;" ref = "cascader1" v-model="tableObj.getDataParameters.parammaps.mixture" :options="mixtureList" :props = "{ multiple: true, emitPath: false,}" :show-all-levels="false" @change="change_cascader1"></el-cascader>
  36. <el-cascader style = "width:400px;" ref = "cascader2" v-model="tableObj.getDataParameters.parammaps.spread" :options="spreadList" :props = "{ multiple: true, emitPath: false,}" :show-all-levels="false" @change="change_cascader2"></el-cascader>
  37. <el-button class="successBorder" @click="form_search">查询</el-button>
  38. <el-button class="successBorder" @click="form_clear">重置</el-button>
  39. </div>
  40. <div class="operation">
  41. <el-button class="success" icon="el-icon-plus" @click="form_add_screening">添加筛选条件</el-button>
  42. <el-button class="danger" icon="el-icon-delete" @click="form_clear_screening">清空筛选条件</el-button>
  43. </div>
  44. <div v-if="screeningVisible">
  45. <div class="search">
  46. <el-select v-model="screeningObj.screeningCondition" filterable placeholder="筛选条件" class="filter-item" style="width: 120px;" clearable @change="change_screening">
  47. <el-option v-for="item in screeningList" :key="item.id" :label="item.name" :value="item.id" />
  48. </el-select>
  49. <el-input v-model="screeningObj.screeningField" placeholder="筛选字段" style="width: 180px;" class="filter-item" clearable />
  50. <el-select v-model="screeningObj.screeningField" placeholder="筛选字段">
  51. <el-option v-for="item in screeningFieldList1" :key="item.id" :label="item.name" :value="item.id" ></el-option>
  52. </el-select>
  53. <el-select v-model="screeningObj.screeningField" placeholder="筛选字段">
  54. <el-option v-for="item in screeningFieldList2" :key="item.id" :label="item.name" :value="item.id" ></el-option>
  55. </el-select>
  56. <el-date-picker v-model="screeningObj.inputDatetime" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;" />
  57. <el-button class="successBorder" @click="form_search_screening">查询</el-button>
  58. <el-button class="successBorder" @click="form_cancel_screening">重置</el-button>
  59. </div>
  60. <div>
  61. <el-row :gutter="20">
  62. <el-col :span="6" v-for = "(item,index) in screeningArr">
  63. <span style="font-size:14px;color:#555">{{index+1}}、条件:{{item.txt}}</span>
  64. </el-col>
  65. </el-row>
  66. </div>
  67. </div>
  68. <ChartTable/>
  69. <div>
  70. <!-- <div style = "">
  71. <el-select v-model="tableObj.getDataParameters.parammaps.dateType" multiple placeholder="维度">
  72. <el-option v-for="item in fieldTypeList" :key="item.id" :label="item.name" :value="item.id" ></el-option>
  73. </el-select>
  74. </div> -->
  75. <BarChart v-if = "chartData.chartType == 'bar'" :chart-data="chartData" />
  76. <LineChart v-if = "chartData.chartType == 'line'" :chart-data="chartData" />
  77. <HorizontalBarChart v-if = "chartData.chartType == 'line'" :chart-data="chartData" />
  78. <!-- <div id="chartLine" style="width:100%;height:385px;" >
  79. </div> -->
  80. </div>
  81. </el-col>
  82. <el-col :span="6">
  83. <div class="chart-style-panel">
  84. <el-form label-position="top" size="mini">
  85. <el-form-item label="图表类型">
  86. <div class="chart-type-list">
  87. <span @click="switch_chart_type(item)" v-for="item in chartTypeList" style = "display:inline-block;height:30px;width:30px;margin-right:10px;margin-bottom:10px">
  88. <el-tooltip :content="item.desc" placement="top">
  89. <svg-icon class="icon" style="height:20px;width:20px" :icon-class="item.isUse? item.icon : (item.icon + '_disabled')" />
  90. </el-tooltip>
  91. </span>
  92. </div>
  93. </el-form-item>
  94. </el-form>
  95. </div>
  96. </el-col>
  97. </el-row>
  98. </div>
  99. </template>
  100. <script>
  101. import echarts from 'echarts'
  102. import draggable from 'vuedraggable'
  103. import ChartTable from '@/componentChart/ChartTable.vue'
  104. import LineChart from '@/componentChart/LineChart.vue'
  105. import BarChart from '@/componentChart/BarChart.vue'
  106. // import HorizontalBarChart from '@/componentChart/BarChart.vue'
  107. require('echarts/theme/macarons')
  108. import { GetDataByName, PostDataByName, failproccess, ExecDataByConfig, checkButtons } from '@/api/common'
  109. import Cookies from 'js-cookie'
  110. import Pagination from '@/components/Pagination'
  111. import { MessageBox } from 'element-ui'
  112. export default {
  113. name: 'ChartPanel2',
  114. components: { Pagination, draggable , ChartTable ,LineChart,BarChart },
  115. data() {
  116. return {
  117. chartType:'line',
  118. chartTypeList:[
  119. // {type:'table', desc:"表格:任意维度数据" ,icon:'chart_table',isUse:true,id:0},
  120. {type:'line', desc:"折线图:任意维度数据" ,icon:'chart_line',isUse:false,id:0},
  121. {type:'bar', desc:"柱状图:任意维度数据" ,icon:'chart_bar',isUse:false,id:1},
  122. {type:'horizontal_bar', desc:"条形图:任意维度数据" ,icon:'horizontal_bar',isUse:false,id:2},
  123. {type:'pie', desc:"饼图:任意维度数据" ,icon:'chart_pie',isUse:false,id:3},
  124. {type:'line_bar', desc:"线柱图:任意维度数据" ,icon:'linebar_chart',isUse:false,id:4},
  125. ],
  126. isRoleEdit: [],
  127. dateTypeList: [
  128. { id: '汇总', name: '汇总' },
  129. { id: '分日', name: '分日' }
  130. ],
  131. typeList: [
  132. { id: '车次', name: '车次' },
  133. { id: '栏舍', name: '栏舍' }
  134. ],
  135. dimensionList: [
  136. { id: '栏舍', name: '栏舍' },
  137. { id: '配方', name: '配方' },
  138. { id: '班次', name: '班次' },
  139. { id: '车次', name: '车次' },
  140. { id: 'TMR', name: 'TMR' },
  141. { id: '牲畜大类', name: '牲畜大类' },
  142. { id: '牲畜小类', name: '牲畜小类' }
  143. ],
  144. //混料数据
  145. mixtureList: [],
  146. //撒料数据
  147. spreadList: [],
  148. //车次 - 数据1 - 栏舍 - 理论重量、实际重量、误差值、允许误差数、准确率(平均)、是否超出误差
  149. mixtureSpreadArr1: [
  150. {
  151. value: '理论重量',label: '理论重量',
  152. children: [
  153. { value: '理论重量-合计', label: '理论重量-合计'},
  154. { value: '理论重量-平均', label: '理论重量-平均'},
  155. { value: '理论重量-最大值', label: '理论重量-最大值'},
  156. { value: '理论重量-最小值', label: '理论重量-最小值'},
  157. { value: '理论重量-标准差', label: '理论重量-标准差'},
  158. { value: '理论重量-变异系数', label: '理论重量-变异系数'},
  159. ]
  160. },
  161. {
  162. value: '实际重量',label: '实际重量',
  163. children: [
  164. { value: '实际重量-合计', label: '实际重量-合计'},
  165. { value: '实际重量-平均', label: '实际重量-平均'},
  166. { value: '实际重量-最大值', label: '实际重量-最大值'},
  167. { value: '实际重量-最小值', label: '实际重量-最小值'},
  168. { value: '实际重量-标准差', label: '实际重量-标准差'},
  169. { value: '实际重量-变异系数', label: '实际重量-变异系数'},
  170. ]
  171. },
  172. {
  173. value: '误差值',label: '误差值',
  174. children: [
  175. { value: '误差值-合计', label: '误差值-合计'},
  176. { value: '误差值-平均', label: '误差值-平均'},
  177. { value: '误差值-最大值', label: '误差值-最大值'},
  178. { value: '误差值-最小值', label: '误差值-最小值'},
  179. { value: '误差值-标准差', label: '误差值-标准差'},
  180. { value: '误差值-变异系数', label: '误差值-变异系数'},
  181. ]
  182. },
  183. {
  184. value: '允许误差数',label: '允许误差数',
  185. children: [
  186. { value: '允许误差数-合计', label: '允许误差数-合计'},
  187. { value: '允许误差数-平均', label: '允许误差数-平均'},
  188. { value: '允许误差数-最大值', label: '允许误差数-最大值'},
  189. { value: '允许误差数-最小值', label: '允许误差数-最小值'},
  190. { value: '允许误差数-标准差', label: '允许误差数-标准差'},
  191. { value: '允许误差数-变异系数', label: '允许误差数-变异系数'},
  192. ]
  193. },
  194. { value: '准确率-平均',label: '准确率-平均'},
  195. { value: '是否超出误差',label: '是否超出误差'}
  196. ],
  197. //车次 - 数据2 - 配方 - 理论重量、实际重量、误差值、准确率(平均)
  198. mixtureSpreadArr2: [
  199. {
  200. value: '理论重量',label: '理论重量',
  201. children: [
  202. { value: '理论重量-合计', label: '理论重量-合计'},
  203. { value: '理论重量-平均', label: '理论重量-平均'},
  204. { value: '理论重量-最大值', label: '理论重量-最大值'},
  205. { value: '理论重量-最小值', label: '理论重量-最小值'},
  206. { value: '理论重量-标准差', label: '理论重量-标准差'},
  207. { value: '理论重量-变异系数', label: '理论重量-变异系数'},
  208. ]
  209. },
  210. {
  211. value: '实际重量',label: '实际重量',
  212. children: [
  213. { value: '实际重量-合计', label: '实际重量-合计'},
  214. { value: '实际重量-平均', label: '实际重量-平均'},
  215. { value: '实际重量-最大值', label: '实际重量-最大值'},
  216. { value: '实际重量-最小值', label: '实际重量-最小值'},
  217. { value: '实际重量-标准差', label: '实际重量-标准差'},
  218. { value: '实际重量-变异系数', label: '实际重量-变异系数'},
  219. ]
  220. },
  221. {
  222. value: '误差值',label: '误差值',
  223. children: [
  224. { value: '误差值-合计', label: '误差值-合计'},
  225. { value: '误差值-平均', label: '误差值-平均'},
  226. { value: '误差值-最大值', label: '误差值-最大值'},
  227. { value: '误差值-最小值', label: '误差值-最小值'},
  228. { value: '误差值-标准差', label: '误差值-标准差'},
  229. { value: '误差值-变异系数', label: '误差值-变异系数'},
  230. ]
  231. },
  232. { value: '准确率-平均',label: '准确率-平均'}
  233. ],
  234. //车次 - 数据3 - 班次 - 理论重量、实际重量、误差值、准确率(平均)、开始重量、结束重量
  235. mixtureSpreadArr3: [
  236. {
  237. value: '理论重量',label: '理论重量',
  238. children: [
  239. { value: '理论重量-合计', label: '理论重量-合计'},
  240. { value: '理论重量-平均', label: '理论重量-平均'},
  241. { value: '理论重量-最大值', label: '理论重量-最大值'},
  242. { value: '理论重量-最小值', label: '理论重量-最小值'},
  243. { value: '理论重量-标准差', label: '理论重量-标准差'},
  244. { value: '理论重量-变异系数', label: '理论重量-变异系数'},
  245. ]
  246. },
  247. {
  248. value: '实际重量',label: '实际重量',
  249. children: [
  250. { value: '实际重量-合计', label: '实际重量-合计'},
  251. { value: '实际重量-平均', label: '实际重量-平均'},
  252. { value: '实际重量-最大值', label: '实际重量-最大值'},
  253. { value: '实际重量-最小值', label: '实际重量-最小值'},
  254. { value: '实际重量-标准差', label: '实际重量-标准差'},
  255. { value: '实际重量-变异系数', label: '实际重量-变异系数'},
  256. ]
  257. },
  258. {
  259. value: '误差值',label: '误差值',
  260. children: [
  261. { value: '误差值-合计', label: '误差值-合计'},
  262. { value: '误差值-平均', label: '误差值-平均'},
  263. { value: '误差值-最大值', label: '误差值-最大值'},
  264. { value: '误差值-最小值', label: '误差值-最小值'},
  265. { value: '误差值-标准差', label: '误差值-标准差'},
  266. { value: '误差值-变异系数', label: '误差值-变异系数'},
  267. ]
  268. },
  269. { value: '准确率-平均',label: '准确率-平均'},
  270. {
  271. value: '开始重量',label: '开始重量',
  272. children: [
  273. { value: '开始重量-合计', label: '开始重量-合计'},
  274. { value: '开始重量-平均', label: '开始重量-平均'},
  275. { value: '开始重量-最大值', label: '开始重量-最大值'},
  276. { value: '开始重量-最小值', label: '开始重量-最小值'},
  277. { value: '开始重量-标准差', label: '开始重量-标准差'},
  278. { value: '开始重量-变异系数', label: '开始重量-变异系数'},
  279. ]
  280. },
  281. {
  282. value: '结束重量',label: '结束重量',
  283. children: [
  284. { value: '结束重量-合计', label: '结束重量-合计'},
  285. { value: '结束重量-平均', label: '结束重量-平均'},
  286. { value: '结束重量-最大值', label: '结束重量-最大值'},
  287. { value: '结束重量-最小值', label: '结束重量-最小值'},
  288. { value: '结束重量-标准差', label: '结束重量-标准差'},
  289. { value: '结束重量-变异系数', label: '结束重量-变异系数'},
  290. ]
  291. }
  292. ],
  293. //车次 - 数据4 - 车次 - 理论重量、实际重量、误差值、准确率(平均)、跳转方式、开始重量、结束重量、计划时间、开始时间、结束时间、过程时间
  294. mixtureSpreadArr4: [
  295. {
  296. value: '理论重量',label: '理论重量',
  297. children: [
  298. { value: '理论重量-合计', label: '理论重量-合计'},
  299. { value: '理论重量-平均', label: '理论重量-平均'},
  300. { value: '理论重量-最大值', label: '理论重量-最大值'},
  301. { value: '理论重量-最小值', label: '理论重量-最小值'},
  302. { value: '理论重量-标准差', label: '理论重量-标准差'},
  303. { value: '理论重量-变异系数', label: '理论重量-变异系数'},
  304. ]
  305. },
  306. {
  307. value: '实际重量',label: '实际重量',
  308. children: [
  309. { value: '实际重量-合计', label: '实际重量-合计'},
  310. { value: '实际重量-平均', label: '实际重量-平均'},
  311. { value: '实际重量-最大值', label: '实际重量-最大值'},
  312. { value: '实际重量-最小值', label: '实际重量-最小值'},
  313. { value: '实际重量-标准差', label: '实际重量-标准差'},
  314. { value: '实际重量-变异系数', label: '实际重量-变异系数'},
  315. ]
  316. },
  317. {
  318. value: '误差值',label: '误差值',
  319. children: [
  320. { value: '误差值-合计', label: '误差值-合计'},
  321. { value: '误差值-平均', label: '误差值-平均'},
  322. { value: '误差值-最大值', label: '误差值-最大值'},
  323. { value: '误差值-最小值', label: '误差值-最小值'},
  324. { value: '误差值-标准差', label: '误差值-标准差'},
  325. { value: '误差值-变异系数', label: '误差值-变异系数'},
  326. ]
  327. },
  328. { value: '准确率-平均',label: '准确率-平均'},
  329. { value: '跳转方式',label: '跳转方式'},
  330. {
  331. value: '开始重量',label: '开始重量',
  332. children: [
  333. { value: '开始重量-合计', label: '开始重量-合计'},
  334. { value: '开始重量-平均', label: '开始重量-平均'},
  335. { value: '开始重量-最大值', label: '开始重量-最大值'},
  336. { value: '开始重量-最小值', label: '开始重量-最小值'},
  337. { value: '开始重量-标准差', label: '开始重量-标准差'},
  338. { value: '开始重量-变异系数', label: '开始重量-变异系数'},
  339. ]
  340. },
  341. {
  342. value: '结束重量',label: '结束重量',
  343. children: [
  344. { value: '结束重量-合计', label: '结束重量-合计'},
  345. { value: '结束重量-平均', label: '结束重量-平均'},
  346. { value: '结束重量-最大值', label: '结束重量-最大值'},
  347. { value: '结束重量-最小值', label: '结束重量-最小值'},
  348. { value: '结束重量-标准差', label: '结束重量-标准差'},
  349. { value: '结束重量-变异系数', label: '结束重量-变异系数'},
  350. ]
  351. },
  352. { value: '计划时间',label: '计划时间'},
  353. { value: '开始时间',label: '开始时间'},
  354. { value: '结束时间',label: '结束时间'},
  355. { value: '过程时间',label: '过程时间'},
  356. ],
  357. //车次 - 数据5 - 牲畜大类 - 理论重量、实际重量、误差值、准确率(平均)
  358. //车次 - 数据5 - 牲畜小类 - 理论重量、实际重量、误差值、准确率(平均)
  359. //车次 - 数据5 - TMR - 理论重量、实际重量、误差值、准确率(平均)
  360. mixtureSpreadArr5: [
  361. {
  362. value: '理论重量',label: '理论重量',
  363. children: [
  364. { value: '理论重量-合计', label: '理论重量-合计'},
  365. { value: '理论重量-平均', label: '理论重量-平均'},
  366. { value: '理论重量-最大值', label: '理论重量-最大值'},
  367. { value: '理论重量-最小值', label: '理论重量-最小值'},
  368. { value: '理论重量-标准差', label: '理论重量-标准差'},
  369. { value: '理论重量-变异系数', label: '理论重量-变异系数'},
  370. ]
  371. },
  372. {
  373. value: '实际重量',label: '实际重量',
  374. children: [
  375. { value: '实际重量-合计', label: '实际重量-合计'},
  376. { value: '实际重量-平均', label: '实际重量-平均'},
  377. { value: '实际重量-最大值', label: '实际重量-最大值'},
  378. { value: '实际重量-最小值', label: '实际重量-最小值'},
  379. { value: '实际重量-标准差', label: '实际重量-标准差'},
  380. { value: '实际重量-变异系数', label: '实际重量-变异系数'},
  381. ]
  382. },
  383. {
  384. value: '误差值',label: '误差值',
  385. children: [
  386. { value: '误差值-合计', label: '误差值-合计'},
  387. { value: '误差值-平均', label: '误差值-平均'},
  388. { value: '误差值-最大值', label: '误差值-最大值'},
  389. { value: '误差值-最小值', label: '误差值-最小值'},
  390. { value: '误差值-标准差', label: '误差值-标准差'},
  391. { value: '误差值-变异系数', label: '误差值-变异系数'},
  392. ]
  393. },
  394. { value: '准确率-平均',label: '准确率-平均'}
  395. ],
  396. mixScreenArr:[],
  397. spreadScreenArr:[],
  398. screeningVisible:true,
  399. // 筛选条件
  400. screeningList: [
  401. // { id: '配方名称', name: '配方名称' },
  402. // { id: 'TMR名称', name: 'TMR名称' },
  403. // { id: '班次', name: '班次' },
  404. // { id: '车次计划', name: '车次计划' },
  405. ],
  406. // 筛选条件 - 参数
  407. screeningObj:{
  408. screeningCondition: '',
  409. screeningField: '',
  410. inputDatetime: '',
  411. startTime: '',
  412. stopTime: '',
  413. },
  414. // 筛选条件 - 参数
  415. screeningArr:[
  416. ],
  417. screeningFieldList1:[
  418. { id: '是', name: '是' },
  419. { id: '否', name: '否' }
  420. ],
  421. screeningFieldList2:[
  422. { id: '自动', name: '自动' },
  423. { id: '手动', name: '手动' }
  424. ],
  425. // 筛选条件 - 结果
  426. fieldTypeList: [
  427. { id: '配方A', name: '配方A' },
  428. { id: '配方B', name: '配方B' }
  429. ],
  430. tableObj: {
  431. getDataParameters: {
  432. name: 'getDriverList',
  433. page: 1,
  434. offset: 1,
  435. pagecount: parseInt(Cookies.get('pageCount')),
  436. returntype: 'Map',
  437. parammaps: {
  438. pastureid: Cookies.get('pastureid'),
  439. dateType:'',
  440. type: '',
  441. dimension: '',
  442. mixture: [],
  443. spread: [],
  444. }
  445. },
  446. tableKey: 0,
  447. list: [],
  448. total: 0,
  449. listLoading: false,
  450. temp: {}
  451. },
  452. chartData:{
  453. chartType:null,
  454. // xAxisArr: ['2019-01', '2019-02', '2019-03', '2019-04', '2019-05', '2019-06', '2019-07', '2019-08', '2019-09', '2019-10', '2019-11', '2019-12'],
  455. // legendArr: ['数据1', '数据2', '数据3', '数据4', '线条1'],
  456. // dataArr:[
  457. // [1, 10, 7, 0, 1, 7, 7, 6, 4, 4, 1, 6],
  458. // [1, 10, 7, 0, 1, 7, 7, 6, 4, 4, 1, 6],
  459. // [1, 10, 7, 0, 1, 7, 7, 6, 4, 4, 1, 6],
  460. // [2, 10, 3, 2, 10, 4, 4, 9, 3, 9, 3, 8],
  461. // [2, 10, 3, 2, 10, 4, 4, 9, 3, 9, 3, 8]
  462. // ]
  463. },
  464. chartLine_data2:{
  465. chartType:'pie',
  466. xAxisArr: ['2019-01', '2019-02', '2019-03', '2019-04', '2019-05', '2019-06', '2019-07', '2019-08', '2019-09', '2019-10', '2019-11', '2019-12'],
  467. legendArr: ['数据1', '数据2', '数据3', '数据4', '线条1'],
  468. dataArr:[1, 10, 7, 0, 1, 7, 7, 6, 4, 4, 1, 6],
  469. },
  470. chartLine_data3:{
  471. chartType:'line_bar',
  472. xAxisArr: ['2019-01', '2019-02', '2019-03', '2019-04', '2019-05', '2019-06', '2019-07', '2019-08', '2019-09', '2019-10', '2019-11', '2019-12'],
  473. legendArr1: ['数据1', '数据2', '数据3', '数据4' ],
  474. dataArr1:[
  475. [1, 10, 7, 0, 1, 7, 7, 6, 4, 4, 1, 6],
  476. [1, 10, 7, 0, 1, 7, 7, 6, 4, 4, 1, 6],
  477. [1, 10, 7, 0, 1, 7, 7, 6, 4, 4, 1, 6],
  478. [2, 10, 3, 2, 10, 4, 4, 9, 3, 9, 3, 8],
  479. ],
  480. legendArr2: ['数据5', '线条1'],
  481. dataArr2:[
  482. [1, 10, 7, 0, 1, 7, 7, 6, 4, 4, 1, 6],
  483. [1, 10, 7, 0, 1, 7, 7, 6, 4, 4, 1, 6],
  484. ]
  485. },
  486. requestParam: {},
  487. isokDisable: false,
  488. selectList: [],
  489. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  490. cellStyle: { padding: 0 + 'px' }
  491. }
  492. },
  493. created() {
  494. // console.log(VUE_APP_BASE_pageCount)
  495. // console.log(this.VUE_APP_BASE_pageCount, 'this.VUE_APP_BASE_pageCount')
  496. // this.getList()
  497. // this.getButtons()
  498. },
  499. methods: {
  500. getButtons() {
  501. const Edit = 'Driver'
  502. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  503. this.isRoleEdit = isRoleEdit
  504. },
  505. getList() {
  506. this.tableObj.listLoading = true
  507. GetDataByName(this.tableObj.getDataParameters).then(response => {
  508. console.log('table数据', response.data.list)
  509. if (response.data.list !== null) {
  510. for (let i = 0; i < response.data.list.length; i++) {
  511. this.$set(response.data.list[i], 'Edit', false) // 编辑
  512. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  513. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  514. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  515. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  516. }
  517. this.tableObj.list = response.data.list
  518. this.tableObj.pageNum = response.data.pageNum
  519. this.tableObj.pageSize = response.data.pageSize
  520. this.tableObj.total = response.data.total
  521. } else {
  522. this.tableObj.list = []
  523. }
  524. setTimeout(() => {
  525. this.tableObj.listLoading = false
  526. }, 100)
  527. })
  528. },
  529. form_search() {
  530. console.log('点击了查询 - 表单 tableObj', this.tableObj.getDataParameters.parammaps)
  531. // this.tableObj.getDataParameters.offset = 1
  532. // this.getList()
  533. console.log('点击了查询 - this.chartLine_data', this.chartLine_data)
  534. this.roadChartLine(this.chartLine_data)
  535. },
  536. form_clear() {
  537. console.log('点击了重置')
  538. // this.tableObj.getDataParameters.parammaps.drivername = ''
  539. // this.tableObj.getDataParameters.parammaps.enable = ''
  540. // this.tableObj.getDataParameters.parammaps.drivercode = ''
  541. // this.tableObj.getDataParameters.offset = 1
  542. //this.getList()
  543. },
  544. //查询 - 汇总/分日
  545. change_date_type(value) {
  546. console.log('查询日期', value)
  547. },
  548. //维度
  549. change_dimension(value) {
  550. console.log('维度', value)
  551. this.tableObj.getDataParameters.parammaps.mixture = []
  552. this.tableObj.getDataParameters.parammaps.spread = []
  553. if(value == "栏舍"){
  554. this.mixtureList = this.mixtureSpreadArr1
  555. this.spreadList = this.mixtureSpreadArr1
  556. } else if(value == "配方"){
  557. this.mixtureList = this.mixtureSpreadArr2
  558. this.spreadList = this.mixtureSpreadArr2
  559. } else if(value == "班次"){
  560. this.mixtureList = this.mixtureSpreadArr3
  561. this.spreadList = this.mixtureSpreadArr3
  562. } else if(value == "车次"){
  563. this.mixtureList = this.mixtureSpreadArr4
  564. this.spreadList = this.mixtureSpreadArr4
  565. } else if(value == "牲畜大类" || value == "牲畜小类" || value == "TMR"){
  566. this.mixtureList = this.mixtureSpreadArr5
  567. this.spreadList = this.mixtureSpreadArr5
  568. }
  569. },
  570. //级联选择 - 混料数据
  571. change_cascader1(value) {
  572. console.log('级联选择 - 混料数据', value)
  573. var allNode = this.$refs['cascader1'].getCheckedNodes()
  574. console.log("级联选择 - 混料数据的Node", allNode)
  575. var mixScreenArr = []
  576. value.forEach(function(i){
  577. allNode.forEach(function(j){
  578. if(i == j.value){
  579. mixScreenArr.push({name: "混料-"+j.label, id:j.value})
  580. }
  581. })
  582. })
  583. // allNode.forEach(function(item){
  584. // if(item.children.length == 0){
  585. // mixScreenArr.push({name: "混料-"+item.label, id:item.value})
  586. // }
  587. // })
  588. var spreadScreenArr = this.spreadScreenArr
  589. this.mixScreenArr = mixScreenArr
  590. this.screeningList = mixScreenArr.concat(spreadScreenArr)
  591. },
  592. //级联选择 - 撒料数据
  593. change_cascader2(value) {
  594. console.log('级联选择 - 撒料数据', value)
  595. var allNode2 = this.$refs['cascader2'].getCheckedNodes()
  596. console.log("级联选择 - 撒料数据的Node", allNode2)
  597. var spreadScreenArr = []
  598. value.forEach(function(i){
  599. allNode2.forEach(function(j){
  600. if(i == j.value){
  601. spreadScreenArr.push({name: "撒料-"+j.label, id:j.value})
  602. }
  603. })
  604. })
  605. // allNode2.forEach(function(item){
  606. // if(item.children.length == 0){
  607. // spreadScreenArr.push({name: "撒料-"+item.label, id:item.value})
  608. // }
  609. // })
  610. var mixScreenArr = this.mixScreenArr
  611. this.spreadScreenArr = spreadScreenArr
  612. this.screeningList = mixScreenArr.concat(spreadScreenArr)
  613. },
  614. change_screening(value) {
  615. console.log('筛选', value)
  616. console.log('筛选数组', this.screeningList)
  617. },
  618. handleCreate() {
  619. // this.resetRequestParam()
  620. // this.dialogStatus = 'create'
  621. // this.parent = this.parentmenu
  622. // this.screeningVisible = true
  623. // this.$nextTick(() => {
  624. // this.$refs['dataForm'].clearValidate()
  625. // this.$refs.name.focus()
  626. // })
  627. },
  628. form_search_screening() {
  629. console.log('点击了筛选条件 - 确认 - screeningObj',this.screeningObj)
  630. var screeningCondition = this.screeningObj.screeningCondition
  631. var screeningField = this.screeningObj.screeningField
  632. var txt = { txt: screeningCondition + screeningField}
  633. console.log(txt)
  634. this.screeningArr.push(txt)
  635. },
  636. form_add_screening() {
  637. console.log('点击了查询')
  638. this.tableObj.getDataParameters.offset = 1
  639. this.getList()
  640. },
  641. form_clear_screening() {
  642. console.log('点击了查询')
  643. this.tableObj.getDataParameters.offset = 1
  644. this.getList()
  645. },
  646. form_cancel_screening() {
  647. console.log('点击了查询')
  648. this.tableObj.getDataParameters.offset = 1
  649. this.getList()
  650. },
  651. roadChartLine(chartLine_data) {
  652. console.log(1111111111)
  653. if (this.chartLine != null) {
  654. this.chartLine.dispose()
  655. }
  656. this.chartLine = echarts.init(document.getElementById('chartLine'))
  657. var option_line = {
  658. title: { text: 'Stacked Line' },
  659. tooltip: { trigger: 'axis' },
  660. legend: { data:chartLine_data.legendArr, right: 10, show: true, type: 'scroll' },
  661. grid: { top: '15%', left: '8%', right: '8%', containLabel: true },
  662. xAxis: [{ type: 'category',data:chartLine_data.xAxisArr }],
  663. yAxis: [
  664. {type: 'value', name: 'kg'},
  665. ],
  666. series: function (e) {
  667. var serie = [];
  668. for (var i = 0; i < chartLine_data.xAxisArr.length; i++) {
  669. console.log(i)
  670. var item = {
  671. name: chartLine_data.legendArr[i],
  672. data: chartLine_data.dataArr[i],
  673. type: 'line',
  674. emphasis: { label: { show: true, position: 'inside' } },
  675. }
  676. serie.push(item);
  677. }
  678. console.log(serie)
  679. return serie;
  680. }()
  681. // series: [
  682. // {
  683. // name: 'Email',
  684. // type: 'line',
  685. // stack: 'Total',
  686. // data: [120, 132, 101, 134, 90, 230, 210]
  687. // },
  688. // {
  689. // name: 'Union Ads',
  690. // type: 'line',
  691. // stack: 'Total',
  692. // data: [220, 182, 191, 234, 290, 330, 310]
  693. // },
  694. // {
  695. // name: 'Video Ads',
  696. // type: 'line',
  697. // stack: 'Total',
  698. // data: [150, 232, 201, 154, 190, 330, 410]
  699. // },
  700. // {
  701. // name: 'Direct',
  702. // type: 'line',
  703. // stack: 'Total',
  704. // data: [320, 332, 301, 334, 390, 330, 320]
  705. // },
  706. // {
  707. // name: 'Search Engine',
  708. // type: 'line',
  709. // stack: 'Total',
  710. // data: [820, 932, 901, 934, 1290, 1330, 1320]
  711. // }
  712. // ]
  713. }
  714. var option_bar = {
  715. title: { text: 'Stacked Line' },
  716. tooltip: { trigger: 'axis' },
  717. legend: { data:chartLine_data.legendArr, right: 10, show: true, type: 'scroll' },
  718. grid: { top: '15%', left: '8%', right: '8%', containLabel: true },
  719. xAxis: [{ type: 'category',data:chartLine_data.xAxisArr }],
  720. yAxis: [
  721. {type: 'value', name: 'kg'},
  722. ],
  723. series: function (e) {
  724. var serie = [];
  725. for (var i = 0; i < chartLine_data.xAxisArr.length; i++) {
  726. console.log(i)
  727. var item = {
  728. name: chartLine_data.legendArr[i],
  729. data: chartLine_data.dataArr[i],
  730. type: 'bar',
  731. emphasis: { label: { show: true, position: 'inside' } },
  732. }
  733. serie.push(item);
  734. }
  735. console.log(serie)
  736. return serie;
  737. }()
  738. }
  739. var option_horizontal_bar = {
  740. title: { text: 'Stacked Line' },
  741. tooltip: { trigger: 'axis' },
  742. legend: { data:chartLine_data.legendArr, right: 10, show: true, type: 'scroll' },
  743. grid: { top: '15%', left: '8%', right: '8%', containLabel: true },
  744. xAxis: {type: 'value', name: 'kg'},
  745. yAxis: [
  746. { type: 'category',data:chartLine_data.xAxisArr }
  747. ],
  748. series: function (e) {
  749. var serie = [];
  750. for (var i = 0; i < chartLine_data.xAxisArr.length; i++) {
  751. console.log(i)
  752. var item = {
  753. name: chartLine_data.legendArr[i],
  754. data: chartLine_data.dataArr[i],
  755. type: 'bar',
  756. emphasis: { label: { show: true, position: 'inside' } },
  757. }
  758. serie.push(item);
  759. }
  760. console.log(serie)
  761. return serie;
  762. }()
  763. }
  764. var option_pie = {
  765. title: { text: 'Stacked Line' },
  766. tooltip: { trigger: 'axis' },
  767. legend: { data:chartLine_data.legendArr, right: 10, show: true, },
  768. grid: { top: '15%', left: '8%', right: '8%', containLabel: true },
  769. xAxis: [{ type: 'category',data:chartLine_data.xAxisArr }],
  770. yAxis: [
  771. {type: 'value', name: 'kg'},
  772. ],
  773. series: function (e) {
  774. var serie = [
  775. {
  776. name: 'Access From',
  777. type: 'pie',
  778. radius: '50%',
  779. data: [
  780. // { value: 1048, name: 'Search Engine' },
  781. // { value: 735, name: 'Direct' },
  782. // { value: 580, name: 'Email' },
  783. // { value: 484, name: 'Union Ads' },
  784. // { value: 300, name: 'Video Ads' }
  785. ],
  786. emphasis: {
  787. itemStyle: {
  788. shadowBlur: 10,
  789. shadowOffsetX: 0,
  790. shadowColor: 'rgba(0, 0, 0, 0.5)'
  791. }
  792. }
  793. }
  794. ];
  795. for (var i = 0; i < chartLine_data.xAxisArr.length; i++) {
  796. console.log(i)
  797. var item = {
  798. name: chartLine_data.legendArr[i],
  799. value: chartLine_data.dataArr[i],
  800. }
  801. serie[0].data.push(item);
  802. }
  803. console.log(serie)
  804. return serie;
  805. }()
  806. }
  807. // var option_line_bar = {
  808. // title: { text: 'Stacked Line' },
  809. // tooltip: { trigger: 'axis' },
  810. // legend: { data: chartLine_data.legendArr1.concat( chartLine_data.legendArr2) , right: 10, show: true, type: 'scroll' },
  811. // grid: { top: '15%', left: '8%', right: '8%', containLabel: true },
  812. // xAxis: [{ type: 'category',data:chartLine_data.xAxisArr }],
  813. // yAxis: [
  814. // {type: 'value', name: 'kg'},
  815. // ],
  816. // series: function (e) {
  817. // var serie = [];
  818. // for (var i = 0; i < chartLine_data.xAxisArr.length; i++) {
  819. // var item = {
  820. // name: chartLine_data.legendArr1[i],
  821. // data: chartLine_data.dataArr1[i],
  822. // type: 'line',
  823. // emphasis: { label: { show: true, position: 'inside' } },
  824. // }
  825. // serie.push(item);
  826. // }
  827. // for (var i = 0; i < chartLine_data.xAxisArr.length; i++) {
  828. // var item = {
  829. // name: chartLine_data.legendArr2[i],
  830. // data: chartLine_data.dataArr2[i],
  831. // type: 'bar',
  832. // emphasis: { label: { show: true, position: 'inside' } },
  833. // }
  834. // serie.push(item);
  835. // }
  836. // console.log(serie)
  837. // return serie;
  838. // }()
  839. // }
  840. var option_line_bar = {
  841. tooltip: {
  842. trigger: 'axis',
  843. axisPointer: {
  844. type: 'cross',
  845. crossStyle: {
  846. color: '#999'
  847. }
  848. }
  849. },
  850. toolbox: {
  851. feature: {
  852. dataView: { show: true, readOnly: false },
  853. magicType: { show: true, type: ['line', 'bar'] },
  854. restore: { show: true },
  855. saveAsImage: { show: true }
  856. }
  857. },
  858. legend: {
  859. data: ['Evaporation', 'Precipitation', 'Temperature']
  860. },
  861. xAxis: [
  862. {
  863. type: 'category',
  864. data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
  865. axisPointer: {
  866. type: 'shadow'
  867. }
  868. }
  869. ],
  870. yAxis: [
  871. {
  872. type: 'value',
  873. name: 'Precipitation',
  874. min: 0,
  875. max: 250,
  876. interval: 50,
  877. axisLabel: {
  878. formatter: '{value} ml'
  879. }
  880. },
  881. {
  882. type: 'value',
  883. name: 'Temperature',
  884. min: 0,
  885. max: 25,
  886. interval: 5,
  887. axisLabel: {
  888. formatter: '{value} °C'
  889. }
  890. }
  891. ],
  892. series: [
  893. {
  894. name: 'Evaporation',
  895. type: 'bar',
  896. data: [
  897. 2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3
  898. ]
  899. },
  900. {
  901. name: 'Precipitation',
  902. type: 'bar',
  903. data: [
  904. 2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3
  905. ]
  906. },
  907. {
  908. name: 'Temperature',
  909. type: 'line',
  910. yAxisIndex: 1,
  911. data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
  912. }
  913. ]
  914. };
  915. if(chartLine_data.chartType == 'line'){
  916. this.chartLine.setOption(option_line)
  917. } else if(chartLine_data.chartType == 'bar'){
  918. this.chartLine.setOption(option_bar)
  919. } else if(chartLine_data.chartType == 'horizontal_bar'){
  920. this.chartLine.setOption(option_horizontal_bar)
  921. } else if(chartLine_data.chartType == 'pie'){
  922. this.chartLine.setOption(option_pie)
  923. } else if(chartLine_data.chartType == 'line_bar'){
  924. this.chartLine.setOption(option_line_bar)
  925. }
  926. window.onresize = function() {
  927. this.chartLine.resize()
  928. }
  929. },
  930. //切换图表类型
  931. switch_chart_type(item){
  932. console.log(item)
  933. console.log(this.chartTypeList)
  934. var chartTypeList = this.chartTypeList
  935. chartTypeList.forEach(function(i){
  936. i.isUse = false
  937. })
  938. chartTypeList[item.id].isUse = true
  939. this.chartType = item.type
  940. this.chartTypeList = chartTypeList
  941. if(item.type == 'line'){
  942. this.chartData = {
  943. chartType:'line',
  944. xAxisArr: ['2019-01', '2019-02', '2019-03', '2019-04', '2019-05', '2019-06', '2019-07', '2019-08', '2019-09', '2019-10', '2019-11', '2019-12'],
  945. legendArr: ['数据1', '数据2', '数据3'],
  946. dataArr:[
  947. [1, 10, 7, 0, 1, 7, 7, 6, 4, 4, 1, 6],
  948. [1, 10, 7, 0, 1, 7, 7, 6, 4, 4, 1, 6],
  949. [1, 10, 7, 0, 1, 7, 7, 6, 4, 4, 1, 6],
  950. ]
  951. }
  952. } else if(item.type == 'bar'){
  953. this.chartData = {
  954. chartType:'bar',
  955. xAxisArr: ['2019-01', '2019-02', '2019-03', '2019-04', '2019-05', '2019-06', '2019-07', '2019-08', '2019-09', '2019-10', '2019-11', '2019-12'],
  956. legendArr: ['数据1', '数据2', '数据3'],
  957. dataArr:[
  958. [1, 10, 7, 0, 1, 7, 7, 6, 4, 4, 1, 6],
  959. [1, 10, 7, 0, 1, 7, 7, 6, 4, 4, 1, 6],
  960. [1, 10, 7, 0, 1, 7, 7, 6, 4, 4, 1, 6],
  961. ]
  962. }
  963. } else if(item.type == 'horizontal_bar'){
  964. this.chartData = {
  965. chartType:'horizontal_bar',
  966. xAxisArr: ['2019-01', '2019-02', '2019-03', '2019-04', '2019-05', '2019-06', '2019-07', '2019-08', '2019-09', '2019-10', '2019-11', '2019-12'],
  967. legendArr: ['数据1', '数据2', '数据3'],
  968. dataArr:[
  969. [1, 10, 7, 0, 1, 7, 7, 6, 4, 4, 1, 6],
  970. [1, 10, 7, 0, 1, 7, 7, 6, 4, 4, 1, 6],
  971. [1, 10, 7, 0, 1, 7, 7, 6, 4, 4, 1, 6],
  972. ]
  973. }
  974. }
  975. // if(item.type == 'line'){
  976. // this.chartLine_data.chartType = 'line'
  977. // this.roadChartLine(this.chartLine_data)
  978. // } else if(item.type == 'bar'){
  979. // this.chartLine_data.chartType = 'bar'
  980. // this.roadChartLine(this.chartLine_data)
  981. // } else if(item.type == 'horizontal_bar'){
  982. // this.chartLine_data.chartType = 'horizontal_bar'
  983. // this.roadChartLine(this.chartLine_data)
  984. // } else if(item.type == 'pie'){
  985. // this.chartLine_data2.chartType = 'pie'
  986. // this.roadChartLine(this.chartLine_data2)
  987. // } else if(item.type == 'line_bar'){
  988. // console.log(1111)
  989. // this.chartLine_data3.chartType = 'line_bar'
  990. // console.log(this.chartLine_data3)
  991. // this.roadChartLine(this.chartLine_data3)
  992. // }
  993. }
  994. }
  995. }
  996. </script>
  997. <style lang="scss" scoped>
  998. .search{margin-top:10px;}
  999. .table{margin-top:10px;}
  1000. </style>