2825d3277285f42b380d6f4ed06713602b9e6eb3.svn-base 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <div class="app-container">
  3. <div class="operation">
  4. <el-button class="success" @click="handleExamine">审核</el-button>
  5. </div>
  6. <div class="search">
  7. <el-date-picker v-model="table.getdataListParm.parammaps.inputDatetime" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;" />
  8. <el-select v-model="table.getdataListParm.parammaps.enable" placeholder="牲畜类别" class="filter-item" style="width: 150px;" clearable>
  9. <el-option v-for="item in livestockTypeList" :key="item.id" :label="item.name" :value="item.name" />
  10. </el-select>
  11. <el-button class="successBorder" @click="handleSearch">查询</el-button>
  12. <el-button class="successBorder" @click="handleRefresh">重置</el-button>
  13. </div>
  14. <div class="table">
  15. <el-table
  16. :key="table.tableKey"
  17. v-loading="table.listLoading"
  18. element-loading-text="给我一点时间"
  19. :data="table.list"
  20. border
  21. fit
  22. highlight-current-row
  23. style="width: 100%;"
  24. :row-style="rowStyle"
  25. :cell-style="cellStyle"
  26. class="elTable table-fixed"
  27. :row-class-name="tableRowClassName"
  28. @cell-click="tabClick"
  29. >
  30. <el-table-column label="序号" align="center" type="index" width="50px">
  31. <template slot-scope="scope">
  32. <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
  33. </template>
  34. </el-table-column>
  35. <el-table-column label="业务日期" min-width="130px" align="center">
  36. <template slot-scope="scope">
  37. <span>{{ scope.row.brandName }}</span>
  38. </template>
  39. </el-table-column>
  40. <el-table-column label="牲畜类别" min-width="130px" align="center">
  41. <template slot-scope="scope">
  42. <span>{{ scope.row.brandName }}</span>
  43. </template>
  44. </el-table-column>
  45. <el-table-column label="饲料名称" min-width="130px" align="center">
  46. <template slot-scope="scope">
  47. <span>{{ scope.row.brandName }}</span>
  48. </template>
  49. </el-table-column>
  50. <el-table-column label="计划重量(kg)" min-width="130px" align="center">
  51. <template slot-scope="scope">
  52. <span>{{ scope.row.brandName }}</span>
  53. </template>
  54. </el-table-column>
  55. <el-table-column label="设备实测重量(kg)" min-width="150px" align="center">
  56. <template slot-scope="scope">
  57. <span>{{ scope.row.brandName }}</span>
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="出库重量(kg)" min-width="130px" align="center">
  61. <template slot-scope="scope">
  62. <el-input v-if="scope.row.index === table.tabClickIndex && table.tabClickLabel === '出库重量(kg)'" ref="input1" v-model="scope.row.pastureName" style="width:80%;padding:10px 0;" @blur="handleBlur" />
  63. <span v-else> {{ scope.row.pastureName }}</span>
  64. </template>
  65. </el-table-column>
  66. <el-table-column label="备注" min-width="110px" align="center">
  67. <template slot-scope="scope">
  68. <el-input v-if="scope.row.index === table.tabClickIndex && table.tabClickLabel === '备注'" ref="input2" v-model="scope.row.status" style="width:80%;padding:10px 0;" @blur="handleBlur" />
  69. <span v-else>{{ scope.row.status }}</span>
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="是否审核" min-width="130px" align="center">
  73. <template slot-scope="scope">
  74. <span>{{ scope.row.brandName }}</span>
  75. </template>
  76. </el-table-column>
  77. </el-table>
  78. </div>
  79. </div>
  80. </template>
  81. <script>
  82. import { GetDataByName } from '@/api/common'
  83. export default {
  84. name: 'SystemConsumption',
  85. data() {
  86. return {
  87. livestockTypeList: [{ id: 0, name: '类别01' }, { id: 1, name: '类别02' }], // 牲畜类别
  88. table: {
  89. getdataListParm: {
  90. name: 'getAssetList',
  91. page: 1,
  92. offset: 1,
  93. pagecount: 10,
  94. returntype: 'Map',
  95. parammaps: {
  96. enable: '',
  97. inputDatetime: ''
  98. }
  99. },
  100. tableKey: 0,
  101. list: [],
  102. total: 0,
  103. listLoading: true,
  104. tabClickIndex: null, // 点击的单元格
  105. tabClickLabel: '' // 当前点击的列名
  106. },
  107. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  108. cellStyle: { padding: 0 + 'px' }
  109. }
  110. },
  111. created() {
  112. this.getList()
  113. },
  114. methods: {
  115. getList() {
  116. this.table.listLoading = true
  117. GetDataByName(this.table.getdataListParm).then(response => {
  118. console.log('table数据', response.data.list)
  119. if (response.data.list !== null) {
  120. this.table.list = response.data.list
  121. this.table.pageNum = response.data.pageNum
  122. this.table.pageSize = response.data.pageSize
  123. this.table.total = response.data.total
  124. } else {
  125. this.table.list = []
  126. }
  127. setTimeout(() => {
  128. this.table.listLoading = false
  129. }, 100)
  130. })
  131. },
  132. tableRowClassName({ row, rowIndex }) {
  133. row.index = rowIndex // 把每一行的索引放进row
  134. },
  135. tabClick(row, column) {
  136. switch (column.label) {
  137. case '出库重量(kg)':
  138. this.table.tabClickIndex = row.index
  139. this.table.tabClickLabel = column.label
  140. this.$nextTick(() => {
  141. this.$refs.input1.focus()
  142. })
  143. break
  144. case '备注':
  145. this.table.tabClickIndex = row.index
  146. this.table.tabClickLabel = column.label
  147. this.$nextTick(() => {
  148. this.$refs.input2.focus()
  149. })
  150. break
  151. default: return
  152. }
  153. },
  154. handleBlur(index, row) {
  155. this.table.tabClickIndex = null
  156. this.table.tabClickLabel = ''
  157. },
  158. handleExamine() {
  159. console.log('点击了审核')
  160. },
  161. handleSearch() {
  162. console.log('点击了查询')
  163. },
  164. handleRefresh() {
  165. console.log('点击了重置')
  166. }
  167. }
  168. }
  169. </script>
  170. <style lang="scss" scoped>
  171. .operation{margin-top:10px;}
  172. .search{margin-top:10px;}
  173. .table{margin-top:10px;}
  174. </style>