src/views/inventoryManagement/stockManagement/Unqualified.vue
@@ -7,7 +7,16 @@
                  style="width: 240px"
                  placeholder="请输入"
                  clearable/>
        <span class="search_title ml10">质检状态:</span>
        <el-select v-model="searchForm.type"
                  style="width: 240px"
                  placeholder="请选择"
                  clearable>
          <el-option label="合格" :value="0" />
          <el-option label="不合格" :value="1" />
        </el-select>
        <el-button type="primary" @click="handleQuery" style="margin-left: 10px">搜索</el-button>
        <el-button @click="handleReset">重置</el-button>
      </div>
      <div>
         <el-button type="primary" @click="isShowNewModal = true">新增库存</el-button>
@@ -24,6 +33,16 @@
        <el-table-column label="规格型号" prop="model" show-overflow-tooltip />
        <el-table-column label="单位" prop="unit" show-overflow-tooltip />
        <el-table-column label="库存数量" prop="qualitity" show-overflow-tooltip />
        <el-table-column label="质检状态"
                         prop="type"
                         show-overflow-tooltip
                         width="100">
          <template #default="scope">
            <el-tag :type="scope.row.type == 0 ? 'success' : 'danger'" size="small">
              {{ scope.row.type == 0 ? '合格' : '不合格' }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="冻结数量" prop="lockedQuantity" show-overflow-tooltip />
        <el-table-column label="备注" prop="remark"  show-overflow-tooltip />
        <el-table-column label="最近更新时间" prop="updateTime" show-overflow-tooltip />
@@ -60,7 +79,7 @@
<script setup>
import pagination from '@/components/PIMTable/Pagination.vue'
import { ref, reactive, toRefs, onMounted, getCurrentInstance } from 'vue'
import { ref, reactive, toRefs, onMounted, getCurrentInstance, watch } from 'vue'
import { ElMessageBox } from "element-plus";
import { getStockUninventoryListPage } from "@/api/inventoryManagement/stockUninventory.js";
const NewStockInventory = defineAsyncComponent(() => import("@/views/inventoryManagement/stockManagement/New.vue"));
@@ -68,6 +87,15 @@
const FrozenAndThawStockInventory = defineAsyncComponent(() => import("@/views/inventoryManagement/stockManagement/FrozenAndThaw.vue"));
const { proxy } = getCurrentInstance()
const props = defineProps({
  type: {
    type: Number,
    required: true,
    default: 3
  }
})
const tableData = ref([])
const selectedRows = ref([])
const record = ref({})
@@ -88,6 +116,7 @@
const data = reactive({
  searchForm: {
    productName: '',
    type: '',
  }
})
const { searchForm } = toRefs(data)
@@ -98,6 +127,13 @@
  page.current = 1
  getList()
}
/** 重置按钮操作 */
const handleReset = () => {
  searchForm.value.productName = '';
  searchForm.value.type = '';
  handleQuery();
}
const paginationChange = (obj) => {
  page.current = obj.page;
  page.size = obj.limit;
@@ -105,7 +141,11 @@
}
const getList = () => {
  tableLoading.value = true
  getStockUninventoryListPage({ ...searchForm.value, ...page }).then(res => {
  const params = { ...searchForm.value, ...page, productType: props.type };
  if (searchForm.value.type !== "") {
    params.type = searchForm.value.type;
  }
  getStockUninventoryListPage(params).then(res => {
    tableLoading.value = false
    tableData.value = res.data.records
    total.value = res.data.total
@@ -164,7 +204,12 @@
    type: 'warning',
  }
  ).then(() => {
    proxy.download("/stockUninventory/exportStockUninventory", {}, '不合格库存信息.xlsx')
    const fileNameMap = {
      1: '自制库存信息.xlsx',
      2: '外购库存信息.xlsx',
      3: '委外库存信息.xlsx'
    };
    proxy.download("/stockUninventory/exportStockUninventory", {productType: props.type}, fileNameMap[props.type] || '库存信息.xlsx')
  }).catch(() => {
    proxy.$modal.msg("已取消")
  })
@@ -173,6 +218,11 @@
onMounted(() => {
  getList()
})
watch(() => props.type, () => {
  page.current = 1
  getList()
})
</script>
<style scoped lang="scss">