销售管理>销售台站=》设置新增数据默认日期,添加子产品添加搜索逻辑更改为tree树形式,根据登录的账号匹配用户昵称默认选择当前用户昵称
已修改4个文件
116 ■■■■ 文件已修改
src/views/procurementManagement/paymentEntry/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/paymentLedger/index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/procurementLedger/index.vue 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/salesLedger/index.vue 106 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/paymentEntry/index.vue
@@ -22,7 +22,7 @@
      <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="采购合同号11111:" prop="purchaseLedgerId">
            <el-form-item label="采购合同号:" prop="purchaseLedgerId">
              <el-select v-model="form.purchaseLedgerId" placeholder="请选择" clearable @change="setInfo"
                :disabled="operationType === 'edit'">
                <el-option v-for="item in purchaseLedgerList" :key="item.id" :label="item.purchaseContractNumber"
src/views/procurementManagement/paymentLedger/index.vue
@@ -65,7 +65,6 @@
          <PIMTable
            :column="tableColumnSon"
            :tableData="tableDataSon"
            :page="pageSon"
            :isSelection="false"
            :tableLoading="tableLoadingSon"
            :isShowSummary="isShowSummarySon"
src/views/procurementManagement/procurementLedger/index.vue
@@ -378,6 +378,13 @@
  page.current = 1
  getList()
}
// 子表合计方法
const summarizeChildrenTable = (param) => {
  return proxy.summarizeTable(param, ['taxInclusiveUnitPrice', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice', 'ticketsNum', 'ticketsAmount', 'futureTickets', 'futureTicketsAmount'], {
    ticketsNum: { noDecimal: true }, // 不保留小数
    futureTickets: { noDecimal: true }, // 不保留小数
  });
};
const paginationChange = ({ current, limit }) => {
  page.current = current;
  page.size = limit;
src/views/salesManagement/salesLedger/index.vue
@@ -104,7 +104,7 @@
          </el-col>
          <el-col :span="12">
            <el-form-item label="录入人:" prop="entryPerson">
              <el-select v-model="form.entryPerson" placeholder="请选择" clearable>
              <el-select v-model="form.entryPerson" placeholder="请选择" clearable @change="changs">
                <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId"/>
              </el-select>
            </el-form-item>
@@ -121,6 +121,7 @@
                  type="date"
                  placeholder="请选择"
                  clearable
                  disabled
              />
            </el-form-item>
          </el-col>
@@ -193,17 +194,27 @@
        <el-row :gutter="30">
          <el-col :span="24">
            <el-form-item label="产品大类:" prop="productCategory">
              <el-select v-model="productForm.productCategory" placeholder="请选择" clearable>
              <!-- <el-select v-model="productForm.productCategory" placeholder="请选择" clearable>
                <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"/>
              </el-select>
              </el-select> -->
              <el-tree-select
                  v-model="productForm.productCategory"
                  placeholder="请选择" clearable
                  check-strictly
                  @change="getModels"
                  :data="productOptions"
                  :render-after-expand="false"
                  style="width: 100%"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="24">
            <el-form-item label="规格型号:" prop="specificationModel">
              <el-select v-model="productForm.specificationModel" placeholder="请选择" clearable>
                <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"/>
            <el-form-item label="规格型号:" prop="productModelId">
              <el-select v-model="productForm.productModelId" placeholder="请选择" clearable @change="getProductModel">
                <el-option v-for="item in modelOptions" :key="item.id" :label="item.model" :value="item.id"/>
              </el-select>
            </el-form-item>
          </el-col>
@@ -275,6 +286,7 @@
import { ref } from 'vue'
import {Search} from "@element-plus/icons-vue";
import {ElMessageBox } from "element-plus";
import useUserStore from '@/store/modules/user'
import {userListNoPage} from "@/api/system/user.js";
import {
  ledgerList,
@@ -283,6 +295,8 @@
  addOrUpdateSalesLedger,
  getSalesLedgerWithProducts, delLedger, addOrUpdateSalesLedgerProduct, delProduct, delLedgerFile
} from "@/api/salesManagement/salesLedger.js";
import {modelList, productTreeList} from "@/api/basicData/product.js";
const userStore = useUserStore()
const { proxy } = getCurrentInstance()
const tableData = ref([])
const productData = ref([])
@@ -290,6 +304,8 @@
const productSelectedRows = ref([])
const userList = ref([])
const customerOption = ref([])
const productOptions = ref([])
const modelOptions = ref([])
const tableLoading = ref(false)
const page = reactive({
  current: 1,
@@ -386,6 +402,55 @@
    tableLoading.value = false
  })
}
// 获取产品大类tree数据
const getProductOptions = () => {
  productTreeList().then(res => {
    productOptions.value = convertIdToValue(res)
  })
}
// 获取tree子数据
const getModels =(value) => {
  productForm.value.productCategory = findNodeById(productOptions.value, value)
  modelList({id: value}).then(res => {
    modelOptions.value = res
  })
}
const getProductModel =(value) => {
  const index = modelOptions.value.findIndex(item => item.id === value);
  if (index !== -1) {
    productForm.value.specificationModel = modelOptions.value[index].model;
  } else {
    productForm.value.specificationModel = 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
};
function convertIdToValue(data) {
  return data.map(item => {
    const { id, children, ...rest } = item;
    const newItem = {
      ...rest,
      value: id // 将 id 改为 value
    };
    if (children && children.length > 0) {
      newItem.children = convertIdToValue(children);
    }
    return newItem;
  });
}
// 表格选择数据
const handleSelectionChange = (selection) => {
  selectedRows.value = selection
@@ -460,13 +525,12 @@
  return sums;
}
// 打开弹框
const openForm = (type, row) => {
const openForm = async (type, row) => {
  operationType.value = type
  form.value = {}
  productData.value = []
  userListNoPage().then(res => {
    userList.value = res.data
  })
  let userLists = await userListNoPage()
  userList.value = userLists.data
  customerList().then(res => {
    customerOption.value = res
  })
@@ -478,7 +542,17 @@
      fileList.value = form.value.salesLedgerFiles
    })
  }
  let userAll = await userStore.getInfo()
  userList.value.forEach(element => {
    if(userAll.user.nickName === element.nickName && userAll.user.userName === element.userName) {
      form.value.entryPerson = userAll.user.userId // 设置默认业务员为当前用户
    }
  });
  form.value.entryDate = getCurrentDate() // 设置默认录入日期为当前日期
  dialogFormVisible.value = true
}
function changs(val){
  console.log(val);
}
// 上传前校检
function handleBeforeUpload(file) {
@@ -554,6 +628,7 @@
    productForm.value = {...row}
  }
  productFormVisible.value = true
  getProductOptions()
}
// 提交产品表单
const submitProduct = () => {
@@ -662,6 +737,17 @@
    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}`;
}
const mathNum = (val) => {
  productForm.value.taxExclusiveTotalPrice = proxy.calculateTaxExclusiveTotalPrice(val, productForm.value.taxRate)
}
getList()
</script>