zhouwx
2024-08-22 e8ae17c0fbe5dc0a5424905c738004b143d9ce2c
src/views/hazardousChemicals/warehouseManage/components/rawDetail.vue
@@ -37,7 +37,7 @@
      </div>
    </div>
    <!-- 表格数据 -->
    <el-table v-loading="loading" :data="data.dataList" :border="true">
    <el-table v-loading="loading" :data="data.dataList" :border="true" :cell-style="cellStyle">
      <el-table-column label="序号" type="index" align="center" width="80" />
      <el-table-column label="品名" prop="hazmatBasic.name" align="center"  />
      <el-table-column label="产品编号" prop="hazmatBasic.productSn" align="center" />
@@ -59,8 +59,8 @@
      </el-table-column>
      <el-table-column label="在库余量" prop="remaining" align="center" >
        <template #default="scope">
          <span v-if="scope.row.state === 0 || scope.row.state === 1">{{scope.row.remaining}}{{scope.row.hazmatBasic.unit}}</span>
          <span v-else>—</span>
          <span>{{scope.row.remaining}}{{scope.row.hazmatBasic.unit}}</span>
        </template>
      </el-table-column>
      <el-table-column label="所在仓库" prop="warehouseName" align="center" />
@@ -215,6 +215,23 @@
  })
}
const cellStyle = ({ row, column,rowIndex, columnIndex }) => {
  let arr = []
  if (data.dataList !== null) {
    data.dataList.filter((item, index) => {
      arr.push(item.basicId)
    })
  }
  for (let i = 0; i <= arr.length; i++) {
    if (arr[i] == row.basicId) {
      if(row.remaining < row.hazmatBasic.metering){
        if (columnIndex === 11 || columnIndex === 10){
          return { color:' red' }
        }
      }
    }
  }
};
</script>
<style scoped lang="scss">