zhouwx
23 小时以前 1ea0d85b0fe2e7e4427fd484a9342d964c831b3d
src/views/hazardousChemicals/accessRecords/components/rawTable.vue
@@ -22,7 +22,7 @@
      </el-form>
    </div>
    <!-- 表格数据 -->
    <el-table v-loading="loading" :data="dataList" :border="true">
    <el-table v-loading="loading" :data="dataList" :border="true" :cell-style="cellStyle">
      <el-table-column label="序号" type="index" align="center" width="80" />
      <el-table-column label="流转时间" prop="updateTime" align="center"  width="120"/>
      <el-table-column label="品名" prop="hazmatBasic.name" align="center"  />
@@ -30,7 +30,7 @@
      <el-table-column label="二维码识别号" prop="code" align="center" />
      <el-table-column label="类型" prop="hazmatBasic.productSn" align="center" >
        <template #default="scope">
          <span>{{scope.row.state === 0 ? '入库' :scope.row.state === 1 ? '取用' :scope.row.state === 2 ? '归还' : scope.row.state === 3? '标签作废':scope.row.state === 4 ? '用尽登记':scope.row.state === 5? '销售': ''}}</span>
          <span>{{scope.row.state === 0 ? '入库' :scope.row.state === 1 ? '取用' :scope.row.state === 2 ? '归还' : scope.row.state === 3? '标签作废':scope.row.state === 4 ? '用尽登记':scope.row.state === 5? '销售': scope.row.state === 6?'零头入库':''}}</span>
        </template>
      </el-table-column>
      <el-table-column label="数量" prop="num" align="center" width="120" >
@@ -112,7 +112,6 @@
  }
  getList()
})
const getList = async () => {
  loading.value = true
  const res = await getRawFlow(data.queryParams)
@@ -185,6 +184,28 @@
const getProRecord = (val) => {
  dialogRef.value.openDialog(val)
}
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 (columnIndex === 6 || columnIndex === 5){
        if(row.num > 0){
          return { color:' green' }
        }else{
          return { color:' red' }
        }
      }
    }
  }
};
defineExpose({
  getList