index.vue 46 KB

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