zhouwx
2 天以前 1ea0d85b0fe2e7e4427fd484a9342d964c831b3d
src/views/hazardousChemicals/warehouseManage/components/rawTable.vue
@@ -16,6 +16,43 @@
        <el-form-item label="产品编号:" >
          <el-input v-model="data.queryParams.params.productSn" placeholder="请输入产品编号" clearable></el-input>
        </el-form-item>
        <el-form-item label="仓库:" prop="warehouseName" >
          <el-select
              clearable
              v-model="data.queryParams.params.warehouseName"
              filterable
              remote
              reserve-keyword
              placeholder="请输入所入仓库"
              remote-show-suffix
              :remote-method="getWareHouseList"
              style="width: 100%"
              @change="selectWareValue"
          >
            <el-option
                v-for="item in data.wareHouseList"
                :key="item.id"
                :label="item.name"
                :value="item.name"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="存储柜:" prop="cupboardId" >
          <el-select
              clearable
              v-model="data.queryParams.params.cupboardId"
              placeholder="请选择存储柜"
              style="width: 100%"
          >
            <el-option
                v-for="item in data.cupList"
                :key="item.id"
                :label="item.cupboardName"
                :value="item.id"
            />
          </el-select>
        </el-form-item>
        <el-form-item >
          <el-button
              type="primary"
@@ -50,6 +87,7 @@
          <span>{{scope.row.warehouse.name}}</span>
        </template>
      </el-table-column>
      <el-table-column label="存储柜" prop="cupboard.cupboardName" align="center" width="120" />
      <el-table-column label="批号" prop="batchNo" align="center" width="120" />
      <el-table-column label="状态" prop="state" align="center">
        <template #default="scope">
@@ -78,6 +116,18 @@
    <raw-dialog ref="dialogRef" @getList=getList></raw-dialog>
    <printcode ref="codeRef" @getList=getList></printcode>
    <printMorecodeDialog ref="codeMoreRef" @getList=getList></printMorecodeDialog>
    <el-dialog
        v-model="dialogVisible"
        title="打印纸张"
        width="350"
        :before-close="handlePrintClose"
    >
      <div style="display: flex;align-items: center;justify-content: center;height: 60px">
        <el-button type="primary" @click="openPrint('one')">单张打印</el-button>
        <el-button type="primary" @click="openPrint('more')">28张打印</el-button>
      </div>
    </el-dialog>
  </div>
</template>
@@ -86,31 +136,41 @@
import {ElMessage, ElMessageBox} from "element-plus";
import rawDialog from "./addRawDialog.vue";
import printcode from './printCode.vue'
import printMorecodeDialog from './printCodeMore.vue'
import {delRawRecord, doEntryRaw, getRawRecord, getRawWarehouseRecord} from "@/api/hazardousChemicals/rawRecord";
import {useRoute, useRouter} from "vue-router";
import {getCupById, getWarehouse} from "@/api/hazardousChemicals/warehouse";
const { proxy } = getCurrentInstance();
const loading = ref(false);
const dialogRef = ref();
const codeRef = ref();
const codeMoreRef = ref();
const router = useRouter()
const route = useRoute()
const dialogVisible =ref(false)
const data = reactive({
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    params :{
      name: '',
      productSn: ''
      productSn: '',
      cupboardId: null,
      warehouseId: null
    }
  },
  total: 0,
  dataList: []
  dataList: [],
  wareHouseList: [],
  cupList: []
});
const { queryParams, total, dataList } = toRefs(data);
const classHourRef = ref();
onMounted(()=>{
  getList()
  getWareHouseList("")
})
const getList = async () => {
@@ -136,10 +196,14 @@
    pageSize: 10,
    params :{
      name: '',
      productSn: ''
      productSn: '',
      cupboardId: null,
      warehouseId: null
    }
  }
  data.cupList = []
  getList()
  getWareHouseList("")
}
const handleDelete = (val) => {
  ElMessageBox.confirm(
@@ -181,9 +245,21 @@
      })
}
const entryItem = ref()
const printCode = (val) => {
  console.log("val",val)
  codeRef.value.openDialog('raw',val);
  entryItem.value = val
  dialogVisible.value = true
  // codeRef.value.openDialog('raw',val);
}
const openPrint = (type) => {
  if(type === 'one'){
    codeRef.value.openDialog('raw',entryItem.value);
  }else {
    codeMoreRef.value.openDialog('raw',entryItem.value);
  }
}
const toDetail = (val) => {
@@ -196,6 +272,45 @@
  router.push({ path: "/whRawDetail", query: { val: v } });
}
const getWareHouseList = async (val) => {
  let param = {}
  if(val != ""){
    param = {
      name: val
    }
  }else {
    param = {
      pageNum: 1,
      pageSize: 10
    }
  }
  const res = await getWarehouse(param)
  if(res.code == 200){
    data.wareHouseList = res.data.list
  }else{
    ElMessage.warning(res.message)
  }
}
const selectWareValue = (val) => {
  data.queryParams.params.cupboardId = null
  data.wareHouseList.forEach(item => {
    if(item.name === val){
      data.queryParams.params.warehouseId = item.id
      getCupList(item.id)
    }
  })
}
const getCupList = async (val) => {
  const res = await getCupById(val)
  if(res.code == 200) {
    data.cupList = res.data
  }else {
    ElMessage.warning(res.message)
  }
}
const handlePrintClose = () => {
  dialogVisible.value = false
}
defineExpose({
  getList