| | |
| | | :summary-method="getSummaries" |
| | | :show-summary="showSummary" |
| | | > |
| | | <el-table-column v-if="tableList.selectBox" type="selection" width="40"> </el-table-column> |
| | | <el-table-column v-if="tableList.selectBox" type="selection" width="40" :selectable="selectable"> </el-table-column> |
| | | <el-table-column v-if="tableList.selectIndex" type="index" label="序号" width="50"> </el-table-column> |
| | | <el-table-column |
| | | v-for="(item, i) in tableList.tableColumn" |
| | |
| | | :style="{ |
| | | color: new Date().getTime() > new Date(scope.row[item.prop]).getTime() ? '#D23F3A' : '#606266' |
| | | }" |
| | | >{{ timeAgo(scope.row[item.prop]) }}</span |
| | | >{{ scope.row[item.prop] }}</span |
| | | > |
| | | <div v-else-if="item.conversion"> |
| | | <p class="exceed_width">{{ item.getStatus(scope.row[item.prop]) }}</p> |
| | |
| | | export default { |
| | | name: "TableCommonView", |
| | | props: { |
| | | warehouseId:{ |
| | | type:Number, |
| | | default:0 |
| | | }, |
| | | tableList: { |
| | | type: Object, |
| | | default: () => { |
| | |
| | | showSummary: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | // 列表不可选的数据 |
| | | selectBoxList: { |
| | | type: Array, |
| | | default: () => [] |
| | | }, |
| | | name:{ |
| | | type:String, |
| | | default:'' |
| | | } |
| | | }, |
| | | data() { |
| | |
| | | }, |
| | | // 单选行相关 |
| | | tableRowClassName({ row }) { |
| | | if (Object.keys(this.selectClassRow).length > 0) { |
| | | if (row.id == this.selectClassRow.id) { |
| | | return "onSelect" |
| | | if(this.$route.query.workType!=1){ |
| | | if(Object.keys(this.selectClassRow).length>0&&this.selectClassRow.location){ |
| | | if(this.selectClassRow.id==row.id&&this.selectClassRow.location.warehouseId==row.location.warehouseId&&row.location.name==this.selectClassRow.location.name){ |
| | | return "onSelect"; |
| | | } |
| | | } |
| | | } else{ |
| | | if (Object.keys(this.selectClassRow).length > 0) { |
| | | if (row.id == this.selectClassRow.id) { |
| | | return "onSelect" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | this.$emit("tableRowClassName", row) |
| | | this.$emit("tableRowClassName", row); |
| | | }, |
| | | timeAgo(val) { |
| | | return timeago(val) |
| | |
| | | } |
| | | this.tableList.countcol.forEach((countcols) => { |
| | | if (column.label === countcols) { |
| | | const values = data.map((item) => Number(item[column.property])) |
| | | const values = (data||[]).map((item) => Number(item[column.property])) |
| | | if (!values.every((value) => isNaN(value))) { |
| | | sums[index] = values.reduce((prev, curr) => { |
| | | const value = Number(curr) |
| | |
| | | }) |
| | | }) |
| | | return sums |
| | | } |
| | | }, |
| | | selectable(row) { |
| | | let prop='id' |
| | | if(this.name=='product'){ |
| | | prop='productId' |
| | | } |
| | | if(this.$route.query.workType!=1){ |
| | | const flag= this.selectBoxList.some(item=>{ |
| | | if(item.location){ |
| | | return item[prop]==row.id&&item.location.warehouseId==row.location.warehouseId&&item.location.name==row.location.name; |
| | | } |
| | | return false; |
| | | }) |
| | | return !flag; |
| | | }else{ |
| | | let list = (this.selectBoxList||[]).map((item) => item[prop]) |
| | | if (list.findIndex((v) => v == row.id) == -1) { |
| | | return true |
| | | } else { |
| | | return false |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | right: 2px; |
| | | display: flex; |
| | | align-items: center; |
| | | // z-index: 9999; |
| | | z-index: 9999; |
| | | .label { |
| | | position: absolute; |
| | | top: 6px; |
| | |
| | | .el-table__cell.is-right { |
| | | text-align: right !important; |
| | | } |
| | | .el-table::before{ width: 0px; } |
| | | } |
| | | .overSpread1 { |
| | | width: 100%; |