cabb481756be5fda33a9f61d1004561bf72cfdd0.svn-base 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <div class="app-container">
  3. <div class="operation">
  4. <el-button class="import" style="float: right;margin-bottom: 10px;" @click="handleExport">导出</el-button>
  5. </div>
  6. <div class="table">
  7. <el-table
  8. :key="table.tableKey"
  9. v-loading="table.listLoading"
  10. element-loading-text="给我一点时间"
  11. :data="table.list"
  12. border
  13. fit
  14. highlight-current-row
  15. style="width: 100%;"
  16. :cell-style="cellStyle"
  17. class="elTable table-fixed"
  18. :row-style="rowStyle"
  19. >
  20. <el-table-column label="序号" align="center" type="index" width="50px" />
  21. <!-- <el-table-column label="序号" align="center" type="index" width="50px">
  22. <template slot-scope="scope">
  23. <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
  24. </template>
  25. </el-table-column> -->
  26. <el-table-column label="饲料名称" min-width="130px" align="center">
  27. <template slot-scope="scope">
  28. <span>{{ scope.row.feedname }}</span>
  29. </template>
  30. </el-table-column>
  31. <el-table-column label="库存量(kg)" min-width="130px" align="center">
  32. <template slot-scope="scope">
  33. <span>{{ scope.row.stockweight }}</span>
  34. </template>
  35. </el-table-column>
  36. <el-table-column label="近七天平均计划量(kg)" min-width="110px" align="center">
  37. <template slot-scope="scope">
  38. <span>{{ scope.row.avgweight }}</span>
  39. </template>
  40. </el-table-column>
  41. <el-table-column label="剩余使用天数" min-width="110px" align="center">
  42. <template slot-scope="scope">
  43. <span>{{ scope.row.ldays }}</span>
  44. </template>
  45. </el-table-column>
  46. <el-table-column label="最近预警日期" min-width="110px" align="center">
  47. <template slot-scope="scope">
  48. <span>{{ scope.row.lastdate }}</span>
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="操作" align="center" width="120" class-name="small-padding fixed-width" fixed="right">
  52. <template slot-scope="{row}">
  53. <el-button class="miniSuccess" :disabled="isokDisable" @click="handleSee(row)">查看</el-button>
  54. </template>
  55. </el-table-column>
  56. </el-table>
  57. </div>
  58. <el-dialog :title="textMap[see.dialogStatus]" :visible.sync="see.dialogFormVisible" :close-on-click-modal="false" width="90%">
  59. <div class="app-see">
  60. <el-form ref="temp" :rules="see.rules" :model="see.temp" label-position="right" label-width="110px" style="width: 100%;margin:0 auto">
  61. <el-row>
  62. <el-col :span="8">
  63. <el-form-item label="饲料名称:" prop="feedname">
  64. <span> {{ see.temp.feedname }}</span>
  65. </el-form-item>
  66. </el-col>
  67. </el-row>
  68. </el-form>
  69. <el-table
  70. :key="see.tableKey"
  71. v-loading="see.listLoading"
  72. element-loading-text="给我一点时间"
  73. :data="see.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 label="序号" align="center" type="index" width="50px">
  83. <template slot-scope="scope">
  84. <span>{{ scope.$index + (see.pageNum-1) * see.pageSize + 1 }}</span>
  85. </template>
  86. </el-table-column>
  87. <el-table-column label="库存量" min-width="130px" align="center">
  88. <template slot-scope="scope">
  89. <span>{{ scope.row.stockweight }}</span>
  90. </template>
  91. </el-table-column>
  92. <el-table-column label="近七天平均计划量(kg)" min-width="130px" align="center">
  93. <template slot-scope="scope">
  94. <span>{{ scope.row.avgweight }}</span>
  95. </template>
  96. </el-table-column>
  97. <el-table-column label="剩余使用天数" min-width="110px" align="center">
  98. <template slot-scope="scope">
  99. <span> {{ scope.row.ldays }}</span>
  100. </template>
  101. </el-table-column>
  102. <el-table-column label="预警日期" min-width="110px" align="center">
  103. <template slot-scope="scope">
  104. <span>{{ scope.row.date }}</span>
  105. </template>
  106. </el-table-column>
  107. </el-table>
  108. <pagination v-show="see.total>=0" style="margin-bottom: 50px;" :total="see.total" :page.sync="see.getdataListParm.offset" :limit.sync="see.getdataListParm.pagecount" @pagination="getSeeList" />
  109. <div slot="footer" class="dialog-footer">
  110. <el-button class="cancel" @click="see.dialogFormVisible = false; ">关闭</el-button>
  111. </div>
  112. </div>
  113. </el-dialog>
  114. </div>
  115. </template>
  116. <script>
  117. import { GetDataByName } from '@/api/common'
  118. import Pagination from '@/components/Pagination'
  119. import Cookies from 'js-cookie'
  120. export default {
  121. name: 'Warning',
  122. components: { Pagination },
  123. data() {
  124. return {
  125. table: {
  126. getdataListParm: {
  127. name: 'getFsWarnList',
  128. page: 1,
  129. offset: 1,
  130. pagecount: '',
  131. returntype: 'Map',
  132. parammaps: {
  133. pastureid: Cookies.get('pastureid')
  134. }
  135. },
  136. tableKey: 0,
  137. list: [],
  138. total: 0,
  139. listLoading: true
  140. },
  141. textMap: {
  142. see: '库存预警记录'
  143. },
  144. see: {
  145. dialogFormVisible: false,
  146. dialogStatus: '',
  147. temp: {},
  148. rules: {},
  149. getdataListParm: {
  150. name: 'getFsWarnListdate',
  151. page: 1,
  152. offset: 1,
  153. pagecount: 10,
  154. returntype: 'Map',
  155. parammaps: {
  156. pastureid: Cookies.get('pastureid'),
  157. feedid: ''
  158. }
  159. },
  160. tableKey: 0,
  161. list: [],
  162. total: 0,
  163. listLoading: true
  164. },
  165. isokDisable: false,
  166. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  167. cellStyle: { padding: 0 + 'px' }
  168. }
  169. },
  170. created() {
  171. this.getList()
  172. },
  173. methods: {
  174. getList() {
  175. this.table.listLoading = true
  176. GetDataByName(this.table.getdataListParm).then(response => {
  177. console.log('table数据', response.data.list)
  178. if (response.data.list !== null) {
  179. this.table.list = response.data.list
  180. // this.table.pageNum = response.data.pageNum
  181. // this.table.pageSize = response.data.pageSize
  182. this.table.total = response.data.total
  183. } else {
  184. this.table.list = []
  185. }
  186. setTimeout(() => {
  187. this.table.listLoading = false
  188. }, 100)
  189. })
  190. },
  191. handleSee(row) {
  192. this.see.dialogStatus = 'see'
  193. this.see.dialogFormVisible = true
  194. this.see.temp = Object.assign({}, row)
  195. this.see.list = []
  196. this.see.getdataListParm.offset = 1
  197. this.see.getdataListParm.parammaps.feedid = row.feedid
  198. this.getSeeList()
  199. },
  200. getSeeList() {
  201. this.see.listLoading = true
  202. GetDataByName(this.see.getdataListParm).then(response => {
  203. console.log('table数据', response.data.list)
  204. if (response.data.list !== null) {
  205. this.see.list = response.data.list
  206. this.see.pageNum = response.data.pageNum
  207. this.see.pageSize = response.data.pageSize
  208. this.see.total = response.data.total
  209. } else {
  210. this.see.list = []
  211. }
  212. setTimeout(() => {
  213. this.see.listLoading = false
  214. }, 100)
  215. })
  216. },
  217. handleExport() {
  218. console.log('导出')
  219. }
  220. }
  221. }
  222. </script>