66e47a09b955a259e7f474e26774385c8839bdd4.svn-base 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <div class="app-content">
  3. <div class="search">
  4. <el-select v-model="table.getdataListParm.parammaps.pastureid" placeholder="牧场" class="filter-item" style="width: 120px;float: left;margin-right: 10px;">
  5. <el-option v-for="item in pastureList" :key="item.pastureid" :label="item.pasturename" :value="item.pastureid" />
  6. </el-select>
  7. <el-date-picker v-model="table.getdataListParm.parammaps.inputDatetime" :clearable="false" style="float: left;margin-right: 10px;margin-bottom:10px;width: 250px;" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions" />
  8. <el-input v-model="table.getdataListParm.parammaps.tmrtname" style="float: left;margin-right: 10px;margin-bottom:10px;width: 110px;" placeholder="TMR名称" class="filter-item" clearable />
  9. <el-input v-model="table.getdataListParm.parammaps.projname" style="float: left;margin-right: 10px;margin-bottom:10px;width: 110px;" placeholder="车次" class="filter-item" clearable />
  10. <el-select v-model="table.getdataListParm.parammaps.times" style="float: left;margin-right: 10px;margin-bottom:10px;width: 100px;" filterable placeholder="班次" class="filter-item" clearable>
  11. <el-option v-for="item in frequencyList" :key="item.id" :label="item.name" :value="item.id" />
  12. </el-select>
  13. <el-input v-model="table.getdataListParm.parammaps.templetname" style="float: left;margin-right: 10px;margin-bottom:10px;width: 110px;" placeholder="配方名称" class="filter-item" clearable />
  14. <el-input v-model="table.getdataListParm.parammaps.fname" style="float: left;margin-right: 10px;margin-bottom:10px;width: 110px;" placeholder="栏舍名称" class="filter-item" clearable />
  15. <el-select v-model="table.getdataListParm.parammaps.buttontype" style="float: left;margin-right: 10px;margin-bottom:10px;width: 110px;" filterable placeholder="跳转方式" class="filter-item" clearable>
  16. <el-option v-for="item in jumpModeList" :key="item.id" :label="item.name" :value="item.id" />
  17. </el-select>
  18. <el-button class="successBorder" style="float: left;margin-right: 10px;margin-bottom:10px;" @click="handleSearch">查询</el-button>
  19. <el-button class="successBorder" style="float: left;margin-right: 10px;margin-bottom:10px;" @click="handleRefresh">重置</el-button>
  20. <el-button class="export" style="float: right;margin-right: 10px;margin-bottom:10px;" @click="handleExport">导出</el-button>
  21. </div>
  22. <div class="table">
  23. <el-table
  24. :key="table.tableKey"
  25. v-loading="table.listLoading"
  26. element-loading-text="给我一点时间"
  27. :data="table.list"
  28. border
  29. fit
  30. highlight-current-row
  31. style="width: 100%;"
  32. :row-style="rowStyle"
  33. :cell-style="cellStyle"
  34. class="elTable table-fixed"
  35. >
  36. <el-table-column label="牧场" min-width="110px" align="center" prop="牧场" />
  37. <el-table-column label="日期" min-width="110px" align="center" prop="日期" />
  38. <el-table-column label="TMR名称" min-width="110px" align="center" prop="TMR名称" />
  39. <el-table-column label="车次" min-width="110px" align="center" prop="车次" />
  40. <el-table-column label="班次" min-width="110px" align="center" prop="班次" />
  41. <el-table-column label="配方名称" min-width="110px" align="center" prop="配方名称" />
  42. <el-table-column label="栏舍" min-width="110px" align="center" prop="栏舍" />
  43. <el-table-column label="理论重量" min-width="110px" align="center" prop="理论重量" />
  44. <el-table-column label="实际重量" min-width="110px" align="center" prop="实际重量" />
  45. <el-table-column label="误差值" min-width="110px" align="center" prop="误差值" />
  46. <el-table-column label="准确率" min-width="110px" align="center" prop="准确率" />
  47. <el-table-column label="开始时间" min-width="110px" align="center" prop="开始时间" />
  48. <el-table-column label="结束时间" min-width="110px" align="center" prop="结束时间" />
  49. <el-table-column label="跳转方式" min-width="110px" align="center" prop="跳转方式" />
  50. <el-table-column label="开始重量" min-width="110px" align="center" prop="开始重量" />
  51. <el-table-column label="结束重量" min-width="110px" align="center" prop="结束重量" />
  52. </el-table>
  53. <!-- <pagination v-show="tab3.table.total>=0" :total="tab3.table.total" :page.sync="tab3.table.getdataListParm.offset" :limit.sync="tab3.table.getdataListParm.pagecount" @pagination="getTab3List" /> -->
  54. </div>
  55. </div>
  56. </template>
  57. <script>
  58. import echarts from 'echarts'
  59. require('echarts/theme/macarons')
  60. import { GetDataByName, GetReportform, GetDataByNames } from '@/api/common'
  61. import Cookies from 'js-cookie'
  62. import { parseTime } from '@/utils/index.js'
  63. import Pagination from '@/components/Pagination'
  64. import { json2excel } from '@/utils/index.js'
  65. import { MessageBox } from 'element-ui'
  66. export default {
  67. name: 'Tab2',
  68. components: { Pagination },
  69. data() {
  70. return {
  71. pickerMinDate: '',
  72. pickerOptions: {
  73. onPick: ({ maxDate, minDate }) => {
  74. this.pickerMinDate = minDate.getTime()
  75. if (maxDate) {
  76. this.pickerMinDate = ''
  77. }
  78. },
  79. // 限制不能选择今天之后的日期
  80. disabledDate: (time) => {
  81. if (this.pickerMinDate !== '') {
  82. const one = 31 * 24 * 3600 * 1000
  83. const minTime = this.pickerMinDate - one
  84. let maxTime = this.pickerMinDate + one
  85. if (maxTime > new Date()) {
  86. maxTime = new Date()
  87. }
  88. return time.getTime() < minTime || time.getTime() > maxTime
  89. }
  90. return time.getTime() > Date.now()
  91. }
  92. },
  93. requestParams: [
  94. { name: 'getPastureListJT', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid'), pasturename: '' }}
  95. ],
  96. pastureList: [], // 牧场
  97. // 班次
  98. maxTime: {
  99. getMaxTimesParm: {
  100. name: 'getSysoptEnable',
  101. page: 1,
  102. offset: 1,
  103. pagecount: 1,
  104. returntype: 'Map',
  105. parammaps: {
  106. pastureid: Cookies.get('pastureid'),
  107. inforname: 'times'
  108. }
  109. }
  110. },
  111. jumpModeList: [{ id: '0', name: '手动跳转' }, { id: '1', name: '自动跳转' }],
  112. frequencyList: [],
  113. table: {
  114. getdataListParm: {
  115. name: 'getStatisticsSL',
  116. page: 1,
  117. offset: 1,
  118. pagecount: '',
  119. returntype: 'Map',
  120. parammaps: {
  121. pastureid: Cookies.get('pastureid'),
  122. startTime: parseTime(new Date(), '{y}-{m}-{d}'),
  123. stopTime: parseTime(new Date(), '{y}-{m}-{d}'),
  124. inputDatetime: [new Date(), new Date()],
  125. tmrtname: '',
  126. projname: '',
  127. times: '',
  128. templetname: '',
  129. fname: '',
  130. buttontype: ''
  131. }
  132. },
  133. tableKey: 1,
  134. list: [],
  135. total: 0,
  136. listLoading: true,
  137. temp: {}
  138. },
  139. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  140. cellStyle: { padding: 0 + 'px' }
  141. }
  142. },
  143. create() {
  144. this.getDownList()
  145. this.getIsDisplay()
  146. },
  147. activated() {
  148. this.getDownList()
  149. this.getIsDisplay()
  150. },
  151. methods: {
  152. getIsDisplay() {
  153. GetDataByName(this.maxTime.getMaxTimesParm).then(response => {
  154. if (response.data.list[0].inforvalue == 1) {
  155. this.frequencyList = [{ id: '1', name: '第一班' }]
  156. } else if (response.data.list[0].inforvalue == 2) {
  157. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }]
  158. } else if (response.data.list[0].inforvalue == 3) {
  159. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }]
  160. } else if (response.data.list[0].inforvalue == 4) {
  161. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }, { id: '4', name: '第四班' }]
  162. }
  163. })
  164. },
  165. getDownList() {
  166. GetDataByNames(this.requestParams).then(response => {
  167. this.pastureList = response.data.getPastureListJT.list
  168. this.table.getdataListParm.parammaps.pastureid = response.data.getPastureListJT.list[0].pastureid
  169. this.getList()
  170. })
  171. },
  172. getList() {
  173. this.table.listLoading = true
  174. GetDataByName(this.table.getdataListParm).then(response => {
  175. console.log('撒料统计table数据', response.data.list)
  176. if (response.data.list !== null) {
  177. this.table.list = response.data.list
  178. this.table.total = response.data.total
  179. } else {
  180. this.table.list = []
  181. }
  182. setTimeout(() => {
  183. this.table.listLoading = false
  184. }, 100)
  185. })
  186. },
  187. handleSearch() {
  188. this.table.getdataListParm.name = 'getStatisticsSL'
  189. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  190. this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  191. this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  192. } else {
  193. this.table.getdataListParm.parammaps.inputDatetime = ''
  194. this.table.getdataListParm.parammaps.startTime = ''
  195. this.table.getdataListParm.parammaps.stopTime = ''
  196. }
  197. this.table.getdataListParm.offset = 1
  198. this.getList()
  199. },
  200. handleRefresh() {
  201. this.table.getdataListParm.parammaps.tmrtname = ''
  202. this.table.getdataListParm.parammaps.projname = ''
  203. this.table.getdataListParm.parammaps.times = ''
  204. this.table.getdataListParm.parammaps.templetname = ''
  205. this.table.getdataListParm.parammaps.buttontype = ''
  206. this.table.getdataListParm.parammaps.fname = ''
  207. this.getList()
  208. },
  209. handleExport() {
  210. var excelDatasTab3 = [
  211. {
  212. tHeader: ['日期', 'TMR名称', '车次', '班次', '配方名称', '栏舍', '理论重量', '实际重量', '误差值', '准确率', '开始时间', '结束时间', '跳转方式', '开始重量', '结束重量'],
  213. filterVal: ['日期', 'TMR名称', '车次', '班次', '配方名称', '栏舍', '理论重量', '实际重量', '误差值', '准确率', '开始时间', '结束时间', '跳转方式', '开始重量', '结束重量'],
  214. tableDatas: this.tab3.table.list,
  215. sheetName: '撒料统计'
  216. }
  217. ]
  218. json2excel(excelDatasTab3, '撒料统计', true, 'xlsx')
  219. }
  220. }
  221. }
  222. </script>
  223. <style>
  224. </style>