zhouwx
2024-08-21 48d5ab35c3fcdc6edca1278d1474a1b54a431191
src/views/hazardousChemicals/electronicWarehouse/components/rawDetail.vue
@@ -44,7 +44,7 @@
      <el-table-column label="CAS号" prop="hazmatBasic.cas" align="center" />
      <el-table-column label="厂家" prop="hazmatBasic.manufacturer" align="center" />
      <el-table-column label="供应商" prop="hazmatBasic.supplier" align="center" />
      <el-table-column label="批号" prop="batchNo" align="center" width="120" />
      <el-table-column label="二维码编号" prop="code" align="center" width="120" />
      <el-table-column label="危险性质" prop="hazmatBasic.hazmatCharacter" align="center" />
      <el-table-column label="最小包装" prop="hazmatBasic.productSn" align="center" width="120">
        <template #default="scope">
@@ -54,19 +54,20 @@
      <el-table-column label="入库时间" prop="updateTime" align="center" />
      <el-table-column label="当前状态" prop="state" 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 ? '标签作废' : ''}}</span>
          <span>{{scope.row.state ===0 || scope.row.state === 1 ? '在库' : scope.row.state === 2 ? '领用中': scope.row.state === 3 ? '已用完' : scope.row.state === 4 ? '标签作废' : ''}}</span>
        </template>
      </el-table-column>
      <el-table-column label="在库余量" prop="remaining" align="center" >
        <template #default="scope">
          <span v-if="scope.row.state === 0">{{scope.row.remaining}}{{scope.row.hazmatBasic.unit}}</span>
          <span v-if="scope.row.state === 0 || scope.row.state === 1">{{scope.row.remaining}}{{scope.row.hazmatBasic.unit}}</span>
          <span v-else>—</span>
        </template>
      </el-table-column>
      <el-table-column label="所在仓库" prop="warehouseName" align="center" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180" >
        <template #default="scope">
          <el-button link type="primary" >取用记录</el-button>
          <el-button link type="primary" @click="viewFlow(scope.row)">取用记录</el-button>
          <el-button link type="danger" v-if="scope.row.state === 0 || scope.row.state === 1|| scope.row.state === 2" @click="disCard(scope.row)">标签作废</el-button>
          <el-button link type="primary" @click="viewQR(scope.row)">查看二维码</el-button>
        </template>
      </el-table-column>
@@ -79,20 +80,32 @@
        @pagination="getList"
    />
    <viewQRcode ref="dialogRef" @getList="getList"></viewQRcode>
    <el-dialog
        v-model="dialogVisible"
        width="650px"
        :before-close="handleClose"
        :close-on-press-escape="false"
        :close-on-click-modal="false"
    >
      <flow-deail ref="flowRef"></flow-deail>
    </el-dialog>
  </div>
</template>
<script setup>
import {onMounted, reactive, ref} from "vue";
import {nextTick, onMounted, reactive, ref} from "vue";
import {useRoute, useRouter} from "vue-router";
import {getProDetail, getProductRecord} from "@/api/hazardousChemicals/productRecord";
import flowDeail from '../../../components/flowDetail.vue'
import {disCardPro, getProDetail, getProductRecord} from "@/api/hazardousChemicals/productRecord";
import viewQRcode from './viewQR.vue'
import {ElMessage} from "element-plus";
import {getRawDetail} from "@/api/hazardousChemicals/rawRecord";
import {ElMessage, ElMessageBox} from "element-plus";
import {disCardRaw, getRawDetail} from "@/api/hazardousChemicals/rawRecord";
import Cookies from "js-cookie";
const route = useRoute()
const router = useRouter();
const dialogRef = ref();
const dialogVisible = ref(false)
const flowRef = ref();
const data = reactive({
  queryParams: {
    basicId: null,
@@ -175,6 +188,36 @@
const viewQR = (val) => {
  dialogRef.value.openDialog('raw',val)
}
const disCard = async (val) => {
  ElMessageBox.confirm(
      '确定作废该标签?',
      '提示',
      {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
      .then( async() => {
        const res = await disCardRaw(val.id)
        if(res.code == 200){
          ElMessage.success('操作成功')
          await getList()
        }else{
          ElMessage.warning(res.message)
        }
      })
}
const viewFlow = (val) => {
  dialogVisible.value = true
  nextTick(() => {
    flowRef.value.openDialog('raw',val)
  })
}
const handleClose = () => {
  dialogVisible.value = false
}
</script>