lishenao
10 天以前 d50a93ffd0baa588ad4650b7584b608cdc761990
src/views/inventoryManagement/dispatchLog/index.vue
@@ -4,7 +4,7 @@
      <div>
        <span class="search_title">供应商名称:</span>
        <el-input
          v-model="searchForm.customerName"
          v-model="searchForm.supplierName"
          style="width: 240px"
          placeholder="请输入"
          @change="handleQuery"
@@ -38,67 +38,67 @@
        <el-table-column align="center" label="序号" type="index" width="60" />
        <el-table-column
          label="出库日期"
          prop="salesContractNo"
          prop="inboundTime"
          width="100"
          show-overflow-tooltip
        />
        <el-table-column
          label="供应商名称"
          prop="customerName"
          prop="supplierName"
          width="160"
          show-overflow-tooltip
        />
        <el-table-column
          label="产品大类"
          prop="salesman"
          prop="productCategory"
          width="100"
          show-overflow-tooltip
        />
        <el-table-column
          label="规格型号"
          prop="projectName"
          prop="specificationModel"
          width="100"
          show-overflow-tooltip
        />
        <el-table-column
          label="单位"
          prop="contractAmount"
          prop="unit"
          width="80"
          show-overflow-tooltip
        />
        <el-table-column
          label="出库数量"
          prop="entryPersonName"
          prop="inboundQuantity"
          width="100"
          show-overflow-tooltip
        />
        <el-table-column
          label="含税单价"
          prop="entryDate"
          prop="taxInclusiveUnitPrice"
          width="100"
          show-overflow-tooltip
        />
        <el-table-column
          label="含税总价"
          prop="executionDate"
          prop="taxInclusiveTotalPrice"
          width="100"
          show-overflow-tooltip
        />
        <el-table-column
          label="税率"
          prop="executionDate"
          prop="taxRate"
          width="100"
          show-overflow-tooltip
        />
        <el-table-column
          label="不含税总价"
          prop="executionDate"
          prop="taxExclusiveTotalPrice"
          width="100"
          show-overflow-tooltip
        />
        <el-table-column
          label="出库人"
          prop="executionDate"
          prop="nickname"
          width="80"
          show-overflow-tooltip
        />
@@ -284,20 +284,24 @@
import useUserStore from "@/store/modules/user";
import { userListNoPage } from "@/api/system/user.js";
import {
  ledgerListPage,
  customerList,
  addOrUpdateSalesLedger,
  getSalesLedgerWithProducts,
  delLedger,
} from "@/api/salesManagement/salesLedger.js";
  getStockOutPage,
  addStockOut,
  updateStockOut,
  delStockOut,
  exportStockOut
} from "@/api/inventoryManagement/stockOut.js";
const userStore = useUserStore();
const { proxy } = getCurrentInstance();
const tableData = ref([]);
const productData = ref([]);
// const productData = ref([]);
const selectedRows = ref([]);
const userList = ref([]);
const customerOption = ref([]);
// const customerOption = ref([]);
const tableLoading = ref(false);
const supplierList = ref([])
const productList = ref([])
const productModelList = ref([])
const page = reactive({
  current: 1,
  size: 100,
@@ -310,30 +314,30 @@
const dialogFormVisible = ref(false);
const data = reactive({
  searchForm: {
    customerName: "",
    supplierName: "",
  },
  form: {
    salesContractNo: "",
    salesman: "",
    customerContractNo: "",
    customerId: "",
    projectName: "",
    entryPerson: "",
    entryDate: "",
    maintenanceTime: "",
    productData: [],
    executionDate: "",
    supplierId: null,
    supplierName: '',
    productId: null,
    productCategory: '',
    specificationModel: '',
    unit: '',
    inboundTime: '',
    inboundBatch: '',
    inboundQuantity: 0,
    taxInclusiveUnitPrice: 0,
    taxInclusiveTotalPrice: 0,
    taxRate: 0,
    taxExclusiveTotalPrice: 0,
    userId: null,
    nickname: ''
  },
  rules: {
    salesman: [{ required: true, message: "请选择", trigger: "change" }],
    customerContractNo: [
      { required: true, message: "请输入", trigger: "blur" },
    ],
    customerId: [{ required: true, message: "请选择", trigger: "change" }],
    projectName: [{ required: true, message: "请输入", trigger: "blur" }],
    entryPerson: [{ required: true, message: "请选择", trigger: "change" }],
    entryDate: [{ required: true, message: "请选择", trigger: "change" }],
    executionDate: [{ required: true, message: "请选择", trigger: "change" }],
    supplierId: [{ required: true, message: '请选择供应商', trigger: 'change' }],
    productRecordid: [{ required: true, message: '请选择产品', trigger: 'change' }],
    inboundTime: [{ required: true, message: '请选择入库时间', trigger: 'change' }],
    inboundQuantity: [{ required: true, message: '请输入入库数量', trigger: 'blur' }]
  },
});
const { searchForm, form, rules } = toRefs(data);
@@ -351,10 +355,10 @@
};
const getList = () => {
  tableLoading.value = true;
  ledgerListPage({ ...searchForm.value, ...page })
  getStockOutPage({ ...searchForm.value, ...page })
    .then((res) => {
      tableLoading.value = false;
      tableData.value = res.records;
      tableData.value = res.data.records;
      tableData.value.map((item) => {
        item.children = [];
      });
@@ -364,24 +368,24 @@
      tableLoading.value = false;
    });
};
const findNodeById = (nodes, productId) => {
  for (let i = 0; i < nodes.length; i++) {
    if (nodes[i].value === productId) {
      return nodes[i].label; // 找到节点,返回该节点
    }
    if (nodes[i].children && nodes[i].children.length > 0) {
      const foundNode = findNodeById(nodes[i].children, productId);
      if (foundNode) {
        return foundNode.label; // 在子节点中找到,返回该节点
      }
    }
  }
  return null; // 没有找到节点,返回null
};
// const findNodeById = (nodes, productId) => {
//   for (let i = 0; i < nodes.length; i++) {
//     if (nodes[i].value === productId) {
//       return nodes[i].label; // 找到节点,返回该节点
//     }
//     if (nodes[i].children && nodes[i].children.length > 0) {
//       const foundNode = findNodeById(nodes[i].children, productId);
//       if (foundNode) {
//         return foundNode.label; // 在子节点中找到,返回该节点
//       }
//     }
//   }
//   return null; // 没有找到节点,返回null
// };
// 表格选择数据
const handleSelectionChange = (selection) => {
  // 过滤掉子数据
  selectedRows.value = selection.filter((item) => item.children !== undefined);
  selectedRows.value = selection.filter((item) => item.id);
  console.log("selection", selectedRows.value);
};
const expandedRowKeys = ref([]);
@@ -464,7 +468,7 @@
    type: "warning",
  })
    .then(() => {
      proxy.download("/sales/ledger/export", {}, "出库台账.xlsx");
      proxy.download("/stockmanagement/export", {}, "出库台账.xlsx");
    })
    .catch(() => {
      proxy.$modal.msg("已取消");
@@ -485,7 +489,7 @@
    type: "warning",
  })
    .then(() => {
      delLedger(ids).then((res) => {
      delStockOut(ids).then((res) => {
        proxy.$modal.msgSuccess("删除成功");
        getList();
      });