src/views/inventoryManagement/stockManagement/index.vue
@@ -18,6 +18,7 @@
            <el-button type="primary" @click="handleQuery" style="margin-left: 10px">搜索</el-button>
          </div>
          <div>
        <!-- <el-button type="primary" @click="openForm('add')">新增</el-button> -->
            <el-button @click="handleOut">导出</el-button>
            <el-button type="danger" plain @click="handleDelete">删除</el-button>
          </div>
@@ -34,9 +35,7 @@
            <el-table-column label="产品大类" prop="productCategory" width="100" show-overflow-tooltip />
            <el-table-column label="规格型号" prop="specificationModel" width="200" show-overflow-tooltip />
            <el-table-column label="单位" prop="unit" width="80" show-overflow-tooltip />
                  <el-table-column label="库存数量" prop="inboundNum" width="100" show-overflow-tooltip />
                  <el-table-column label="已出库数量" prop="totalInboundNum" width="100" show-overflow-tooltip />
                  <el-table-column label="待出库数量" prop="inboundNum0" width="100" show-overflow-tooltip />
        <el-table-column label="库存数量" prop="inboundNum0" width="100" show-overflow-tooltip />
            <el-table-column label="库存预警数量" prop="warnNum" width="130" show-overflow-tooltip />
            <el-table-column label="含税单价" prop="taxInclusiveUnitPrice" width="100" show-overflow-tooltip />
            <el-table-column label="含税总价" prop="taxInclusiveTotalPrice" width="100" show-overflow-tooltip />
@@ -45,7 +44,7 @@
            <el-table-column label="入库人" prop="createBy" width="80" show-overflow-tooltip />
            <el-table-column fixed="right" label="操作" min-width="60" align="center">
              <template #default="scope">
                <el-button link type="primary" size="small" @click="openForm('edit', scope.row);" :disabled="scope.row.createUser !== userStore.id">编辑</el-button>
            <el-button link type="primary" size="small" @click="openForm('edit', scope.row);">编辑</el-button>
              </template>
            </el-table-column>
          </el-table>
@@ -157,6 +156,7 @@
import useUserStore from '@/store/modules/user'
import { userListNoPageByTenantId } from "@/api/system/user.js";
import { productTreeList,modelList } from "@/api/basicData/product.js"
import { getCurrentDate } from "@/utils/index.js";
import {
  getStockManagePage,
  delStockManage,
@@ -243,21 +243,14 @@
  page.size = obj.limit;
  getList()
}
const buildQueryParams = () => {
  return {
    ...page,
    supplierName: searchForm.value.supplierName,
    timeStr: searchForm.value.timeStr,
  }
}
const getList = () => {
  tableLoading.value = true
  const params = buildQueryParams()
  getStockManagePage(params).then(res => {
  getStockManagePage({ ...searchForm.value, ...page }).then(res => {
    tableLoading.value = false
    tableData.value = res.data.records
    total.value = res.data.total
    // 数据加载完成后检查库存
    // checkStockAndCreatePurchase();
  }).catch(() => {
    tableLoading.value = false
  })
@@ -365,8 +358,7 @@
    type: 'warning',
  }
  ).then(() => {
    const exportParams = buildQueryParams()
    proxy.download("/stockin/exportCopy", exportParams, '库存信息.xlsx')
    proxy.download("/stockin/exportCopy", {}, '库存信息.xlsx')
  }).catch(() => {
    proxy.$modal.msg("已取消")
  })
@@ -376,7 +368,7 @@
  let ids = []
  if (selectedRows.value.length > 0) {
      // 检查是否有他人维护的数据
      const unauthorizedData = selectedRows.value.filter(item => item.createBy !== userStore.nickName);
      const unauthorizedData = selectedRows.value.filter(item => item.createUser !== userStore.id);
      if (unauthorizedData.length > 0) {
         proxy.$modal.msgWarning("不可删除他人维护的数据");
         return;
@@ -401,14 +393,6 @@
  }).catch(() => {
    proxy.$modal.msg("已取消")
  })
}
// 获取当前日期并格式化为 YYYY-MM-DD
function getCurrentDate() {
  const today = new Date();
  const year = today.getFullYear();
  const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从0开始
  const day = String(today.getDate()).padStart(2, '0');
  return `${year}-${month}-${day}`;
}
onMounted(() => {
  getList()