123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <template>
- <div class="app-container">
- <div class="operation">
- <el-button class="success" @click="handleExamine">审核</el-button>
- </div>
- <div class="search">
- <el-date-picker v-model="table.getdataListParm.parammaps.inputDatetime" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;" />
- <el-select v-model="table.getdataListParm.parammaps.enable" placeholder="牲畜类别" class="filter-item" style="width: 150px;" clearable>
- <el-option v-for="item in livestockTypeList" :key="item.id" :label="item.name" :value="item.name" />
- </el-select>
- <el-button class="successBorder" @click="handleSearch">查询</el-button>
- <el-button class="successBorder" @click="handleRefresh">重置</el-button>
- </div>
- <div class="table">
- <el-table
- :key="table.tableKey"
- v-loading="table.listLoading"
- element-loading-text="给我一点时间"
- :data="table.list"
- border
- fit
- highlight-current-row
- style="width: 100%;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- :row-class-name="tableRowClassName"
- @cell-click="tabClick"
- >
- <el-table-column label="序号" align="center" type="index" width="50px">
- <template slot-scope="scope">
- <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
- </template>
- </el-table-column>
- <el-table-column label="业务日期" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.brandName }}</span>
- </template>
- </el-table-column>
- <el-table-column label="牲畜类别" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.brandName }}</span>
- </template>
- </el-table-column>
- <el-table-column label="饲料名称" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.brandName }}</span>
- </template>
- </el-table-column>
- <el-table-column label="计划重量(kg)" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.brandName }}</span>
- </template>
- </el-table-column>
- <el-table-column label="设备实测重量(kg)" min-width="150px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.brandName }}</span>
- </template>
- </el-table-column>
- <el-table-column label="出库重量(kg)" min-width="130px" align="center">
- <template slot-scope="scope">
- <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" />
- <span v-else> {{ scope.row.pastureName }}</span>
- </template>
- </el-table-column>
- <el-table-column label="备注" min-width="110px" align="center">
- <template slot-scope="scope">
- <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" />
- <span v-else>{{ scope.row.status }}</span>
- </template>
- </el-table-column>
- <el-table-column label="是否审核" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.brandName }}</span>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- </template>
- <script>
- import { GetDataByName } from '@/api/common'
- export default {
- name: 'SystemConsumption',
- data() {
- return {
- livestockTypeList: [{ id: 0, name: '类别01' }, { id: 1, name: '类别02' }], // 牲畜类别
- table: {
- getdataListParm: {
- name: 'getAssetList',
- page: 1,
- offset: 1,
- pagecount: 10,
- returntype: 'Map',
- parammaps: {
- enable: '',
- inputDatetime: ''
- }
- },
- tableKey: 0,
- list: [],
- total: 0,
- listLoading: true,
- tabClickIndex: null, // 点击的单元格
- tabClickLabel: '' // 当前点击的列名
- },
- rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
- cellStyle: { padding: 0 + 'px' }
- }
- },
- created() {
- this.getList()
- },
- methods: {
- getList() {
- this.table.listLoading = true
- GetDataByName(this.table.getdataListParm).then(response => {
- console.log('table数据', response.data.list)
- if (response.data.list !== null) {
- this.table.list = response.data.list
- this.table.pageNum = response.data.pageNum
- this.table.pageSize = response.data.pageSize
- this.table.total = response.data.total
- } else {
- this.table.list = []
- }
- setTimeout(() => {
- this.table.listLoading = false
- }, 100)
- })
- },
- tableRowClassName({ row, rowIndex }) {
- row.index = rowIndex // 把每一行的索引放进row
- },
- tabClick(row, column) {
- switch (column.label) {
- case '出库重量(kg)':
- this.table.tabClickIndex = row.index
- this.table.tabClickLabel = column.label
- this.$nextTick(() => {
- this.$refs.input1.focus()
- })
- break
- case '备注':
- this.table.tabClickIndex = row.index
- this.table.tabClickLabel = column.label
- this.$nextTick(() => {
- this.$refs.input2.focus()
- })
- break
- default: return
- }
- },
- handleBlur(index, row) {
- this.table.tabClickIndex = null
- this.table.tabClickLabel = ''
- },
- handleExamine() {
- console.log('点击了审核')
- },
- handleSearch() {
- console.log('点击了查询')
- },
- handleRefresh() {
- console.log('点击了重置')
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .operation{margin-top:10px;}
- .search{margin-top:10px;}
- .table{margin-top:10px;}
- </style>
|