|
|
|
@ -353,7 +353,7 @@ export default { |
|
|
|
queryPartInventory(this.queryParams).then(({data})=>{ |
|
|
|
this.queryLoading = false; |
|
|
|
if (data && data.code === 0){ |
|
|
|
this.dataList = data.rows |
|
|
|
this.dataList = data.rows || [] |
|
|
|
this.total = data.total |
|
|
|
}else { |
|
|
|
this.$message.warning(data.msg) |
|
|
|
@ -363,6 +363,44 @@ export default { |
|
|
|
this.$message.error(e) |
|
|
|
}) |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 根据失效日期返回整行单元格样式(过期/临期)- rqrq |
|
|
|
* @param {Object} param 单元格信息 |
|
|
|
* @returns {Object} |
|
|
|
*/ |
|
|
|
tableCellStyle({row}){ |
|
|
|
const state = this.getExpiredDateState(row ? row.expiredDate : null) |
|
|
|
if (state === 'expiredOrEmpty'){ |
|
|
|
return { backgroundColor: '#ec8d8d' } |
|
|
|
} |
|
|
|
if (state === 'nearExpired'){ |
|
|
|
return { backgroundColor: '#f4e7a8' } |
|
|
|
} |
|
|
|
return {} |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 失效日期状态判断(过期/临期/正常)- rqrq |
|
|
|
* @param {String|Date} dateVal 失效日期 |
|
|
|
* @returns {String} |
|
|
|
*/ |
|
|
|
getExpiredDateState(dateVal){ |
|
|
|
if (!dateVal){ |
|
|
|
return 'expiredOrEmpty' |
|
|
|
} |
|
|
|
const expired = this.dayjs(dateVal).startOf('day') |
|
|
|
if (!expired.isValid()){ |
|
|
|
return 'expiredOrEmpty' |
|
|
|
} |
|
|
|
const today = this.dayjs().startOf('day') |
|
|
|
const day90 = this.dayjs().add(90, 'day').startOf('day') |
|
|
|
if (expired.valueOf() < today.valueOf()){ |
|
|
|
return 'expiredOrEmpty' |
|
|
|
} |
|
|
|
if (expired.valueOf() <= day90.valueOf()){ |
|
|
|
return 'nearExpired' |
|
|
|
} |
|
|
|
return 'normal' |
|
|
|
}, |
|
|
|
async createExportData() { |
|
|
|
await queryPartInventory(this.queryParams).then(({data}) => { |
|
|
|
this.exportList= data.rows; |
|
|
|
@ -574,7 +612,7 @@ export default { |
|
|
|
</el-row> |
|
|
|
</el-form> |
|
|
|
<div style="height: calc(100% - 180px)"> |
|
|
|
<el-table :data="dataList" v-loading="queryLoading" height="100%" border> |
|
|
|
<el-table :data="dataList" v-loading="queryLoading" :cell-style="tableCellStyle" height="100%" border> |
|
|
|
<el-table-column |
|
|
|
v-for="(item,index) in columnList" :key="index" |
|
|
|
:header-align="item.headerAlign" |
|
|
|
@ -623,4 +661,6 @@ export default { |
|
|
|
.title .el-form-item--medium /deep/ .el-form-item__content .el-button { |
|
|
|
height: 24px; |
|
|
|
} |
|
|
|
|
|
|
|
/* 行底色由 tableCellStyle 动态控制 - rqrq */ |
|
|
|
</style> |