Merge branch 'master' of https://codeup.aliyun.com/bsdtec/biz-pc-cloud
This commit is contained in:
commit
7f63941291
10 files changed
+218
-123
No files matched your search
@@ -10,13 +10,30 @@
|
||||
:loading="state.loading"
|
||||
@visible-change="handleVisibleChange"
|
||||
@change="handleChange"
|
||||
popper-class="supplier-select-dropdown"
|
||||
>
|
||||
<el-option v-for="item in state.optionList" :key="item.supplierId" :label="item.supplierName" :value="item.supplierId" />
|
||||
<el-option
|
||||
v-if="state.loading && state.optionList.length > 0"
|
||||
value=""
|
||||
disabled
|
||||
style="text-align: center; color: #999;"
|
||||
>
|
||||
加载中...
|
||||
</el-option>
|
||||
<el-option
|
||||
v-if="!state.hasMore && state.optionList.length > 0"
|
||||
value=""
|
||||
disabled
|
||||
style="text-align: center; color: #999;"
|
||||
>
|
||||
没有更多数据了
|
||||
</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, watch } from "vue"
|
||||
import { reactive, watch, nextTick, onMounted, onUnmounted } from "vue"
|
||||
import { fetchList } from "/@/api/supermarketerp/smErpSupplier"
|
||||
|
||||
interface Supplier {
|
||||
@@ -46,30 +63,63 @@ const state = reactive({
|
||||
current: 1,
|
||||
size: 10,
|
||||
},
|
||||
hasMore: true,
|
||||
total: 0,
|
||||
isLoadingMore: false,
|
||||
})
|
||||
|
||||
let scrollContainer: HTMLElement | null = null
|
||||
|
||||
// 监听选中值变化
|
||||
watch(
|
||||
selectedId,
|
||||
(newVal) => {
|
||||
if (newVal !== undefined) {
|
||||
fetchoptionList()
|
||||
resetAndFetch()
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
// 重置并获取数据
|
||||
async function resetAndFetch() {
|
||||
state.searchParams.current = 1
|
||||
state.optionList = []
|
||||
state.hasMore = true
|
||||
state.isLoadingMore = false
|
||||
await fetchoptionList()
|
||||
}
|
||||
|
||||
async function fetchoptionList() {
|
||||
if (state.loading || state.isLoadingMore) return
|
||||
|
||||
try {
|
||||
state.loading = true
|
||||
if (state.searchParams.current === 1) {
|
||||
state.loading = true
|
||||
} else {
|
||||
state.isLoadingMore = true
|
||||
}
|
||||
|
||||
const params = {
|
||||
supplierId: selectedId.value,
|
||||
...state.searchParams,
|
||||
}
|
||||
const { data } = await fetchList(params)
|
||||
state.optionList = data.records ?? []
|
||||
|
||||
// 如果是第一页,替换数据;否则追加数据
|
||||
if (state.searchParams.current === 1) {
|
||||
state.optionList = data.records ?? []
|
||||
} else {
|
||||
// 确保追加而不是替换
|
||||
const newRecords = data.records ?? []
|
||||
state.optionList = [...state.optionList, ...newRecords]
|
||||
}
|
||||
|
||||
state.total = data.total || 0
|
||||
state.hasMore = state.optionList.length < state.total
|
||||
} finally {
|
||||
state.loading = false
|
||||
state.isLoadingMore = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,14 +127,23 @@ async function fetchoptionList() {
|
||||
function handleSearch(keyword: string) {
|
||||
if (keyword !== state.searchParams.supplierName) {
|
||||
state.searchParams.supplierName = keyword
|
||||
fetchoptionList()
|
||||
resetAndFetch()
|
||||
}
|
||||
}
|
||||
|
||||
// 下拉框显示状态变化
|
||||
function handleVisibleChange(visible: boolean) {
|
||||
if (visible) {
|
||||
fetchoptionList()
|
||||
if (state.optionList.length === 0) {
|
||||
resetAndFetch()
|
||||
}
|
||||
// 添加滚动监听
|
||||
nextTick(() => {
|
||||
addScrollListener()
|
||||
})
|
||||
} else {
|
||||
// 移除滚动监听
|
||||
removeScrollListener()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,4 +152,50 @@ function handleChange(supplierId: string) {
|
||||
const selectedOption = state.optionList.find((option) => option.supplierId === supplierId)
|
||||
emit("change", selectedOption)
|
||||
}
|
||||
|
||||
// 加载更多
|
||||
function loadMore() {
|
||||
if (state.hasMore && !state.loading && !state.isLoadingMore) {
|
||||
state.searchParams.current += 1
|
||||
fetchoptionList()
|
||||
}
|
||||
}
|
||||
|
||||
// 添加滚动监听
|
||||
function addScrollListener() {
|
||||
// 查找下拉框的滚动容器
|
||||
scrollContainer = document.querySelector('.supplier-select-dropdown .el-select-dropdown__wrap') as HTMLElement
|
||||
if (scrollContainer) {
|
||||
scrollContainer.addEventListener('scroll', handleScroll)
|
||||
}
|
||||
}
|
||||
|
||||
// 移除滚动监听
|
||||
function removeScrollListener() {
|
||||
if (scrollContainer) {
|
||||
scrollContainer.removeEventListener('scroll', handleScroll)
|
||||
scrollContainer = null
|
||||
}
|
||||
}
|
||||
|
||||
// 处理滚动事件
|
||||
function handleScroll() {
|
||||
if (!scrollContainer || state.isLoadingMore || !state.hasMore) return
|
||||
|
||||
const { scrollTop, scrollHeight, clientHeight } = scrollContainer
|
||||
// 当滚动到底部附近时(距离底部50px)触发加载
|
||||
if (scrollTop + clientHeight >= scrollHeight - 50) {
|
||||
loadMore()
|
||||
}
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
removeScrollListener()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.supplier-select-dropdown .el-select-dropdown__wrap {
|
||||
max-height: 300px !important;
|
||||
}
|
||||
</style>
|
||||
File renamed without changes.
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog v-model="dialogVisible" title="选择商品" width="80%" :close-on-click-modal="false" draggable @close="dialogVisible = false">
|
||||
<el-dialog v-model="dialogVisible" title="选择商品" width="90%" :close-on-click-modal="false" draggable @close="dialogVisible = false">
|
||||
<el-row>
|
||||
<el-form :model="queryForm" ref="queryRef" :inline="true" @keyup.enter="getDataListAndSelect">
|
||||
<el-form-item label="商品名称" prop="productName">
|
||||
@@ -24,8 +24,7 @@
|
||||
v-loading="loading"
|
||||
:row-key="(row:any) => row.id"
|
||||
:reserve-selection="true"
|
||||
@row-click="rowClick"
|
||||
:row-style="{ cursor: 'pointer' }"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="50" fixed="left" align="center" />
|
||||
<el-table-column type="index" label="#" width="50" fixed="left" align="center" />
|
||||
@@ -35,20 +34,30 @@
|
||||
<preview-image @click.stop :src="scope.row.picUrl" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="barcode" label="自编码/条码" min-width="150px" align="center" show-overflow-tooltip /> -->
|
||||
<el-table-column prop="stock" label="库存" min-width="80px" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="productCode" label="货号" min-width="100px" align="center" show-overflow-tooltip />
|
||||
<!-- <el-table-column prop="brandId" label="品牌" min-width="100px" align="center" show-overflow-tooltip>
|
||||
<el-table-column label="包装单位" min-width="300px" align="center">
|
||||
<template #default="scope">
|
||||
{{ supermarketBrand?.find((item: any) => item.id === scope.row.brandId)?.name }}
|
||||
<div v-if="scope.row.erpUnitVos && scope.row.erpUnitVos.length > 0">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<el-tag
|
||||
v-for="unit in scope.row.erpUnitVos"
|
||||
:key="unit.id"
|
||||
:type="unit.isBase ? 'primary' : 'info'"
|
||||
size="small"
|
||||
>
|
||||
{{ unit.unit }}
|
||||
<span class="text-xs ml-1">
|
||||
({{ formatPrice(unit.purchasePrice) }}元)
|
||||
</span>
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="text-gray-400">
|
||||
无包装单位
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="categoryId" label="分类" min-width="100px" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
{{ supermarketCategory?.find((item: any) => item.id === scope.row.categoryId)?.name }}
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<!-- <el-table-column prop="supplierId" label="货商" min-width="100px" align="center" show-overflow-tooltip /> -->
|
||||
<el-table-column prop="status" label="状态" min-width="100px" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="status" :value="scope.row.status" />
|
||||
@@ -75,6 +84,7 @@ import { ref } from "vue"
|
||||
import { getErpSpuPage } from "/@/api/supermarketerp/common"
|
||||
import { getSupermarketCategory, getSupermarketBrand } from "/@/api/supermarketerp/supermarketSpu"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
|
||||
const emit = defineEmits(["getSelectedRows"])
|
||||
const props = withDefaults(
|
||||
@@ -100,10 +110,29 @@ const total = ref<number>(0)
|
||||
const dataList = ref<any[]>([]) // 对话框多选表格数据
|
||||
const supermarketCategory = ref<any>([]) // 商品分类
|
||||
const supermarketBrand = ref<any>([]) // 商品品牌
|
||||
const selectedRowsWithUnit = ref<any[]>([]) // 记录选中行及其包装单位
|
||||
const currentSelectedRows = ref<any[]>([]) // 当前选中的商品行
|
||||
|
||||
// 格式化价格显示
|
||||
const formatPrice = (price: number) => {
|
||||
return displayPrice(price, "")
|
||||
}
|
||||
|
||||
// 判断行是否被选中
|
||||
const isRowSelected = (row: any) => {
|
||||
return currentSelectedRows.value.some((selectedRow: any) => selectedRow.id === row.id)
|
||||
}
|
||||
|
||||
// 处理商品选择变化
|
||||
const handleSelectionChange = (selection: any[]) => {
|
||||
currentSelectedRows.value = selection
|
||||
}
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = async () => {
|
||||
dialogVisible.value = true
|
||||
selectedRowsWithUnit.value = []
|
||||
currentSelectedRows.value = []
|
||||
getDataListAndSelect()
|
||||
}
|
||||
|
||||
@@ -113,21 +142,24 @@ const getDataListAndSelect = async () => {
|
||||
try {
|
||||
const { code, data } = await getErpSpuPage(queryForm)
|
||||
if (code === 0) {
|
||||
dataList.value = data.records.map((item: any) => ({ ...item, erpSpuId: item.id }))
|
||||
dataList.value = data.records.map((item: any) => {
|
||||
return {
|
||||
...item,
|
||||
erpSpuId: item.id
|
||||
}
|
||||
})
|
||||
total.value = data.total
|
||||
|
||||
// 保存当前已选中的行
|
||||
// const currentSelectedRows = tableRef.value?.getSelectionRows() || []
|
||||
// 清空表格数据后重新设置
|
||||
// 恢复之前的选择状态
|
||||
nextTick(() => {
|
||||
// 合并当前页面数据中的已选行和之前保存的已选行
|
||||
const rowsToSelect = [...props.selectedRows.filter((row) => dataList.value.some((item) => item.erpSpuId === row.erpSpuId))]
|
||||
// 去重
|
||||
// const uniqueRowsToSelect = Array.from(new Map(rowsToSelect.map((row) => [row.erpSpuId, row])).values())
|
||||
// 为匹配的行设置选中状态
|
||||
rowsToSelect.forEach((row) => {
|
||||
const rowsToRestore = props.selectedRows.filter((row) => dataList.value.some((item) => item.erpSpuId === row.erpSpuId))
|
||||
|
||||
// 恢复商品选择状态
|
||||
rowsToRestore.forEach((row) => {
|
||||
const targetRow = dataList.value.find((item) => item.erpSpuId === row.erpSpuId)
|
||||
targetRow && tableRef.value?.toggleRowSelection(targetRow, true)
|
||||
if (targetRow) {
|
||||
tableRef.value?.toggleRowSelection(targetRow, true)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -153,24 +185,22 @@ const resetQuery = () => {
|
||||
getDataListAndSelect()
|
||||
}
|
||||
|
||||
// 点击商品列表表格行
|
||||
const rowClick = (row: any) => {
|
||||
console.log("clicked-row", row)
|
||||
tableRef.value.toggleRowSelection(row)
|
||||
}
|
||||
|
||||
// 商品选择对话框确认
|
||||
const dialogConfirm = () => {
|
||||
const $table = tableRef.value
|
||||
if ($table) {
|
||||
// 获取所有选中的行,包括其他页面的选择
|
||||
// 获取当前选中的商品
|
||||
const currentSelectedRows = $table.getSelectionRows()
|
||||
|
||||
// 合并当前选中的行和之前已选的行(排除当前页面的行)
|
||||
const allSelectedRows = [
|
||||
...currentSelectedRows,
|
||||
...props.selectedRows.filter((row) => !dataList.value.some((item) => item.erpSpuId === row.erpSpuId)),
|
||||
]
|
||||
|
||||
dialogVisible.value = false
|
||||
selectedRowsWithUnit.value = []
|
||||
currentSelectedRows.value = []
|
||||
emit("getSelectedRows", allSelectedRows)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,9 +174,8 @@
|
||||
<!-- 商品选择对话框 -->
|
||||
<select-dialog ref="erpSpuSelectDialogRef" :selectedRows="state.editableTableData" @getSelectedRows="getSelectedRows" />
|
||||
|
||||
<linkCodeDialog
|
||||
ref="linkCgPlanDialogRef"
|
||||
v-model="state.linkCgPlanDialogVisible"
|
||||
<link-code-dialog
|
||||
ref="linkCodeDialogRef"
|
||||
title="关联采购订单"
|
||||
:getTableData="() => getCgInventoryPage({ inventoryType: '3' })"
|
||||
@getSelectedLinkCode="getSelectedLinkCode"
|
||||
@@ -192,7 +191,7 @@ import { getPlanCode, getErpSpuSimpleAll, getCgInventoryPage } from "/@/api/supe
|
||||
import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
|
||||
import { formatDate } from "/@/utils/formatTime"
|
||||
import { Search } from "@element-plus/icons-vue"
|
||||
import linkCodeDialog from "/@/views/supermarketerp/components/linkCodeDialog.vue"
|
||||
import LinkCodeDialog from "/@/views/supermarketerp/components/link-code-dialog.vue"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
import { tablePrint } from "../../supermarketUtils"
|
||||
import { useSmProcessFormAction } from "/@/hooks/smProcessFormAction"
|
||||
@@ -214,7 +213,7 @@ const emit = defineEmits(["close"])
|
||||
const loading = ref(false) // 采购计划加载
|
||||
const disabled = ref(false)
|
||||
const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
|
||||
const linkCgPlanDialogRef = ref() // 关联采购申请单对话框ref
|
||||
const linkCodeDialogRef = ref() // 关联采购申请单对话框ref
|
||||
const baseDataFormRef = ref() // 基本数据表单ref
|
||||
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
|
||||
const baseDataInfoRef = ref() // 基本信息ref
|
||||
@@ -238,16 +237,11 @@ const state = reactive<{
|
||||
erpSpuItemsMemo: any[]
|
||||
selectedRowsErpSpuIds: string[]
|
||||
erpSpuSimpleAll: any
|
||||
linkCodeVisible: boolean
|
||||
linkCgPlanDialogVisible: boolean
|
||||
}>({
|
||||
editableTableData: [], // 可编辑表格数据
|
||||
erpSpuItemsMemo: [], // 请求到的可编辑表格商品数据的缓存
|
||||
selectedRowsErpSpuIds: [], // 可编辑表格已选行的ErpSpuId
|
||||
erpSpuSimpleAll: [], // 简要商品列表
|
||||
|
||||
linkCodeVisible: false, // 关联采购申请单对话框开关
|
||||
linkCgPlanDialogVisible: false, // 关联采购申请单对话框开关
|
||||
})
|
||||
|
||||
// 基本信息表单校验规则
|
||||
@@ -299,7 +293,7 @@ const getInitData = async () => {
|
||||
}
|
||||
|
||||
// 点击关联采购申请编号
|
||||
const handleClickLinkCode = () => linkCgPlanDialogRef.value.openLinkCodeDialog(3)
|
||||
const handleClickLinkCode = () => linkCodeDialogRef.value.openLinkCodeDialog(3)
|
||||
|
||||
// 获取选择的采购申请
|
||||
const getSelectedLinkCode = (selectionRows: any) => {
|
||||
@@ -308,7 +302,6 @@ const getSelectedLinkCode = (selectionRows: any) => {
|
||||
baseDataForm.linkCode = selectionRows.inventoryCode
|
||||
state.editableTableData = selectionRows.items
|
||||
state.erpSpuItemsMemo = selectionRows.items
|
||||
state.linkCgPlanDialogVisible = false
|
||||
}
|
||||
|
||||
// 删除选中的行
|
||||
|
||||
@@ -179,9 +179,8 @@
|
||||
<!-- 商品选择对话框 -->
|
||||
<select-dialog ref="erpSpuSelectDialogRef" :selectedRows="state.editableTableData" @getSelectedRows="getSelectedRows" />
|
||||
|
||||
<linkCodeDialog
|
||||
ref="linkCgPlanDialogRef"
|
||||
v-model="state.linkCgPlanDialogVisible"
|
||||
<link-code-dialog
|
||||
ref="linkCodeDialogRef"
|
||||
title="关联补货申请"
|
||||
:getTableData="getCgsqPage"
|
||||
@getSelectedLinkCode="getSelectedLinkCode"
|
||||
@@ -197,7 +196,7 @@ import { getPlanCode, getErpSpuSimpleAll, getCgsqPage } from "/@/api/supermarket
|
||||
import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
|
||||
import { formatDate } from "/@/utils/formatTime"
|
||||
import { Search } from "@element-plus/icons-vue"
|
||||
import linkCodeDialog from "/@/views/supermarketerp/components/linkCodeDialog.vue"
|
||||
import LinkCodeDialog from "/@/views/supermarketerp/components/link-code-dialog.vue"
|
||||
import { displayPrice } from "/@/utils/formatMoney"
|
||||
import { tablePrint } from "../../supermarketUtils"
|
||||
import { useSmProcessFormAction } from "/@/hooks/smProcessFormAction"
|
||||
@@ -219,7 +218,7 @@ const emit = defineEmits(["close"])
|
||||
const loading = ref(false) // 采购计划加载
|
||||
const disabled = ref(false)
|
||||
const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
|
||||
const linkCgPlanDialogRef = ref() // 关联采购申请单对话框ref
|
||||
const linkCodeDialogRef = ref() // 关联采购申请单对话框ref
|
||||
const baseDataFormRef = ref() // 基本数据表单ref
|
||||
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
|
||||
const baseDataInfoRef = ref() // 基本信息ref
|
||||
@@ -244,15 +243,11 @@ const state = reactive<{
|
||||
erpSpuItemsMemo: any[]
|
||||
selectedRowsErpSpuIds: string[]
|
||||
erpSpuSimpleAll: any
|
||||
linkCodeVisible: boolean
|
||||
linkCgPlanDialogVisible: boolean
|
||||
}>({
|
||||
editableTableData: [], // 可编辑表格数据
|
||||
erpSpuItemsMemo: [], // 请求到的可编辑表格商品数据的缓存
|
||||
selectedRowsErpSpuIds: [], // 可编辑表格已选行的ErpSpuId
|
||||
erpSpuSimpleAll: [], // 简要商品列表
|
||||
linkCodeVisible: false, // 关联采购申请单对话框开关
|
||||
linkCgPlanDialogVisible: false, // 关联采购申请单对话框开关
|
||||
})
|
||||
|
||||
// 基本信息表单校验规则
|
||||
@@ -304,7 +299,7 @@ const getInitData = async () => {
|
||||
}
|
||||
|
||||
// 点击关联采购申请编号
|
||||
const handleClickLinkCode = () => linkCgPlanDialogRef.value.openLinkCodeDialog(1)
|
||||
const handleClickLinkCode = () => linkCodeDialogRef.value.openLinkCodeDialog(1)
|
||||
|
||||
// 获取选择的采购申请
|
||||
const getSelectedLinkCode = (selectionRows: any) => {
|
||||
@@ -313,7 +308,6 @@ const getSelectedLinkCode = (selectionRows: any) => {
|
||||
baseDataForm.linkCode = selectionRows.planCode
|
||||
state.editableTableData = selectionRows.items
|
||||
state.erpSpuItemsMemo = selectionRows.items
|
||||
state.linkCgPlanDialogVisible = false
|
||||
}
|
||||
|
||||
// 删除选中的行
|
||||
|
||||
@@ -180,9 +180,8 @@
|
||||
<!-- 商品选择对话框 -->
|
||||
<select-dialog ref="erpSpuSelectDialogRef" :selectedRows="state.editableTableData" @getSelectedRows="getSelectedRows" />
|
||||
|
||||
<linkCodeDialog
|
||||
ref="linkCgPlanDialogRef"
|
||||
v-model="state.linkCgPlanDialogVisible"
|
||||
<link-code-dialog
|
||||
ref="linkCodeDialogRef"
|
||||
title="关联采购订单"
|
||||
:getTableData="getCgddPage"
|
||||
@getSelectedLinkCode="getSelectedLinkCode"
|
||||
@@ -198,7 +197,7 @@ import { getPlanCode, getErpSpuSimpleAll, getCgddPage } from "/@/api/supermarket
|
||||
import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
|
||||
import { formatDate } from "/@/utils/formatTime"
|
||||
import { Search } from "@element-plus/icons-vue"
|
||||
import linkCodeDialog from "/@/views/supermarketerp/components/linkCodeDialog.vue"
|
||||
import LinkCodeDialog from "/@/views/supermarketerp/components/link-code-dialog.vue"
|
||||
import { displayPrice, storePrice } from "/@/utils/formatMoney"
|
||||
import { tablePrint } from "../../supermarketUtils"
|
||||
import { useSmProcessFormAction } from "/@/hooks/smProcessFormAction"
|
||||
@@ -220,7 +219,7 @@ const emit = defineEmits(["close"])
|
||||
const loading = ref(false) // 采购计划加载
|
||||
const disabled = ref(false)
|
||||
const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
|
||||
const linkCgPlanDialogRef = ref() // 关联采购申请单对话框ref
|
||||
const linkCodeDialogRef = ref() // 关联采购申请单对话框ref
|
||||
const baseDataFormRef = ref() // 基本数据表单ref
|
||||
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
|
||||
const baseDataInfoRef = ref() // 基本信息ref
|
||||
@@ -244,16 +243,11 @@ const state = reactive<{
|
||||
erpSpuItemsMemo: any[]
|
||||
selectedRowsErpSpuIds: string[]
|
||||
erpSpuSimpleAll: any
|
||||
linkCodeVisible: boolean
|
||||
linkCgPlanDialogVisible: boolean
|
||||
}>({
|
||||
editableTableData: [], // 可编辑表格数据
|
||||
erpSpuItemsMemo: [], // 请求到的可编辑表格商品数据的缓存
|
||||
selectedRowsErpSpuIds: [], // 可编辑表格已选行的ErpSpuId
|
||||
erpSpuSimpleAll: [], // 简要商品列表
|
||||
|
||||
linkCodeVisible: false, // 关联采购申请单对话框开关
|
||||
linkCgPlanDialogVisible: false, // 关联采购申请单对话框开关
|
||||
})
|
||||
|
||||
// 基本信息表单校验规则
|
||||
@@ -317,7 +311,7 @@ const getInitData = async () => {
|
||||
}
|
||||
|
||||
// 点击关联采购申请编号
|
||||
const handleClickLinkCode = () => linkCgPlanDialogRef.value.openLinkCodeDialog(2)
|
||||
const handleClickLinkCode = () => linkCodeDialogRef.value.openLinkCodeDialog(2)
|
||||
|
||||
// 获取选择的采购申请
|
||||
const getSelectedLinkCode = (selectionRows: any) => {
|
||||
@@ -334,7 +328,6 @@ const getSelectedLinkCode = (selectionRows: any) => {
|
||||
unitObj: {},
|
||||
realPrice: displayPrice(item.purchasePrice, ""),
|
||||
}))
|
||||
state.linkCgPlanDialogVisible = false
|
||||
}
|
||||
|
||||
// 删除选中的行
|
||||
|
||||
@@ -206,9 +206,8 @@
|
||||
<!-- 商品选择对话框 -->
|
||||
<select-dialog ref="erpSpuSelectDialogRef" :selectedRows="state.editableTableData" @getSelectedRows="getSelectedRows" />
|
||||
|
||||
<linkCodeDialog
|
||||
ref="linkCgPlanDialogRef"
|
||||
v-model="state.linkCgPlanDialogVisible"
|
||||
<link-code-dialog
|
||||
ref="linkCodeDialogRef"
|
||||
title="关联采购订单"
|
||||
:getTableData="() => getCgInventoryPage({ inventoryType: '5' })"
|
||||
@getSelectedLinkCode="getSelectedLinkCode"
|
||||
@@ -224,7 +223,7 @@ import { getPlanCode, getErpSpuSimpleAll, getCgInventoryPage } from "/@/api/supe
|
||||
import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
|
||||
import { formatDate } from "/@/utils/formatTime"
|
||||
import { Search } from "@element-plus/icons-vue"
|
||||
import linkCodeDialog from "/@/views/supermarketerp/components/linkCodeDialog.vue"
|
||||
import LinkCodeDialog from "/@/views/supermarketerp/components/link-code-dialog.vue"
|
||||
import { displayPrice, storePrice } from "/@/utils/formatMoney"
|
||||
import { tablePrint } from "../../supermarketUtils"
|
||||
import { useSmProcessFormAction } from "/@/hooks/smProcessFormAction"
|
||||
@@ -246,7 +245,7 @@ const emit = defineEmits(["close"])
|
||||
const loading = ref(false) // 采购计划加载
|
||||
const disabled = ref(false)
|
||||
const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
|
||||
const linkCgPlanDialogRef = ref() // 关联采购申请单对话框ref
|
||||
const linkCodeDialogRef = ref() // 关联采购申请单对话框ref
|
||||
const baseDataFormRef = ref() // 基本数据表单ref
|
||||
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
|
||||
const baseDataInfoRef = ref() // 基本信息ref
|
||||
@@ -271,16 +270,11 @@ const state = reactive<{
|
||||
erpSpuItemsMemo: any[]
|
||||
selectedRowsErpSpuIds: string[]
|
||||
erpSpuSimpleAll: any
|
||||
linkCodeVisible: boolean
|
||||
linkCgPlanDialogVisible: boolean
|
||||
}>({
|
||||
editableTableData: [], // 可编辑表格数据
|
||||
erpSpuItemsMemo: [], // 请求到的可编辑表格商品数据的缓存
|
||||
selectedRowsErpSpuIds: [], // 可编辑表格已选行的ErpSpuId
|
||||
erpSpuSimpleAll: [], // 简要商品列表
|
||||
|
||||
linkCodeVisible: false, // 关联采购申请单对话框开关
|
||||
linkCgPlanDialogVisible: false, // 关联采购申请单对话框开关
|
||||
})
|
||||
|
||||
// 合计金额表单数据
|
||||
@@ -345,7 +339,7 @@ const getInitData = async () => {
|
||||
}
|
||||
|
||||
// 点击关联采购申请编号
|
||||
const handleClickLinkCode = () => linkCgPlanDialogRef.value.openLinkCodeDialog(3)
|
||||
const handleClickLinkCode = () => linkCodeDialogRef.value.openLinkCodeDialog(3)
|
||||
|
||||
// 获取选择的采购申请
|
||||
const getSelectedLinkCode = (selectionRows: any) => {
|
||||
@@ -354,7 +348,6 @@ const getSelectedLinkCode = (selectionRows: any) => {
|
||||
baseDataForm.linkCode = selectionRows.inventoryCode
|
||||
state.editableTableData = selectionRows.items
|
||||
state.erpSpuItemsMemo = selectionRows.items
|
||||
state.linkCgPlanDialogVisible = false
|
||||
}
|
||||
|
||||
// 删除选中的行
|
||||
|
||||
@@ -198,9 +198,8 @@
|
||||
<!-- 商品选择对话框 -->
|
||||
<select-dialog ref="erpSpuSelectDialogRef" :selectedRows="state.editableTableData" @getSelectedRows="getSelectedRows" />
|
||||
|
||||
<linkCodeDialog
|
||||
ref="linkCgPlanDialogRef"
|
||||
v-model="state.linkCgPlanDialogVisible"
|
||||
<link-code-dialog
|
||||
ref="linkCodeDialogRef"
|
||||
title="关联采购订单"
|
||||
:getTableData="getCgddPage"
|
||||
@getSelectedLinkCode="getSelectedLinkCode"
|
||||
@@ -216,7 +215,7 @@ import { getPlanCode, getErpSpuSimpleAll, getCgddPage } from "/@/api/supermarket
|
||||
import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
|
||||
import { formatDate } from "/@/utils/formatTime"
|
||||
import { Search } from "@element-plus/icons-vue"
|
||||
import linkCodeDialog from "/@/views/supermarketerp/components/linkCodeDialog.vue"
|
||||
import LinkCodeDialog from "/@/views/supermarketerp/components/link-code-dialog.vue"
|
||||
import { displayPrice, storePrice } from "/@/utils/formatMoney"
|
||||
import { tablePrint } from "../../supermarketUtils"
|
||||
import { useSmProcessFormAction } from "/@/hooks/smProcessFormAction"
|
||||
@@ -238,7 +237,7 @@ const emit = defineEmits(["close"])
|
||||
const loading = ref(false) // 采购计划加载
|
||||
const disabled = ref(false)
|
||||
const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
|
||||
const linkCgPlanDialogRef = ref() // 关联采购申请单对话框ref
|
||||
const linkCodeDialogRef = ref() // 关联采购申请单对话框ref
|
||||
const baseDataFormRef = ref() // 基本数据表单ref
|
||||
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
|
||||
const baseDataInfoRef = ref() // 基本信息ref
|
||||
@@ -263,16 +262,11 @@ const state = reactive<{
|
||||
erpSpuItemsMemo: any[]
|
||||
selectedRowsErpSpuIds: string[]
|
||||
erpSpuSimpleAll: any
|
||||
linkCodeVisible: boolean
|
||||
linkCgPlanDialogVisible: boolean
|
||||
}>({
|
||||
editableTableData: [], // 可编辑表格数据
|
||||
erpSpuItemsMemo: [], // 请求到的可编辑表格商品数据的缓存
|
||||
selectedRowsErpSpuIds: [], // 可编辑表格已选行的ErpSpuId
|
||||
erpSpuSimpleAll: [], // 简要商品列表
|
||||
|
||||
linkCodeVisible: false, // 关联采购申请单对话框开关
|
||||
linkCgPlanDialogVisible: false, // 关联采购申请单对话框开关
|
||||
})
|
||||
|
||||
// 合计金额表单数据
|
||||
@@ -337,7 +331,7 @@ const getInitData = async () => {
|
||||
}
|
||||
|
||||
// 点击关联采购申请编号
|
||||
const handleClickLinkCode = () => linkCgPlanDialogRef.value.openLinkCodeDialog(2)
|
||||
const handleClickLinkCode = () => linkCodeDialogRef.value.openLinkCodeDialog(2)
|
||||
|
||||
// 获取选择的采购申请
|
||||
const getSelectedLinkCode = (selectionRows: any) => {
|
||||
@@ -346,7 +340,6 @@ const getSelectedLinkCode = (selectionRows: any) => {
|
||||
baseDataForm.linkCode = selectionRows.code
|
||||
state.editableTableData = selectionRows.items
|
||||
state.erpSpuItemsMemo = selectionRows.items
|
||||
state.linkCgPlanDialogVisible = false
|
||||
}
|
||||
|
||||
// 删除选中的行
|
||||
|
||||
@@ -51,10 +51,8 @@
|
||||
<!-- <pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" /> -->
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<!-- <el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button> -->
|
||||
</div>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -85,10 +83,11 @@ const form = reactive({
|
||||
salesCount: "",
|
||||
erpSpuName: "",
|
||||
})
|
||||
const dialogVisible = ref(false)
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
// sliderPicUrls: [{ required: true, message: "请上传轮播图", trigger: "blur" }],
|
||||
sliderPicUrls: [{ required: true, message: "请上传轮播图", trigger: "blur" }],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
@@ -143,29 +142,29 @@ const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
|
||||
// const resetQuery = () => {
|
||||
// getDataList()
|
||||
// }
|
||||
const resetQuery = () => {
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 点击选择库存商品
|
||||
// const handleClickSelectSpu = () => {
|
||||
// loading.value = true
|
||||
// resetQuery()
|
||||
// spuSelectDialogVisible.value = true
|
||||
// try {
|
||||
// getDataList()
|
||||
// } catch (error) {
|
||||
// state.dataList = []
|
||||
// loading.value = false
|
||||
// }
|
||||
// loading.value = false
|
||||
// }
|
||||
const handleClickSelectSpu = () => {
|
||||
loading.value = true
|
||||
resetQuery()
|
||||
dialogVisible.value = true
|
||||
try {
|
||||
getDataList()
|
||||
} catch (error) {
|
||||
state.dataList = []
|
||||
loading.value = false
|
||||
}
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
// 线上商品列表表格行点击
|
||||
const handleRowClick = (row: any) => {
|
||||
// spuSelectDialogVisible.value = false
|
||||
// form.erpSpuId = row.id
|
||||
// form.erpSpuName = row.productName
|
||||
dialogVisible.value = false
|
||||
form.erpSpuId = row.id
|
||||
form.erpSpuName = row.productName
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
|
||||
@@ -243,16 +243,11 @@ const state = reactive<{
|
||||
erpSpuItemsMemo: any[]
|
||||
selectedRowsErpSpuIds: string[]
|
||||
erpSpuSimpleAll: any
|
||||
linkCodeVisible: boolean
|
||||
linkCgPlanDialogVisible: boolean
|
||||
}>({
|
||||
editableTableData: [], // 可编辑表格数据
|
||||
erpSpuItemsMemo: [], // 请求到的可编辑表格商品数据的缓存
|
||||
selectedRowsErpSpuIds: [], // 可编辑表格已选行的ErpSpuId
|
||||
erpSpuSimpleAll: [], // 简要商品列表
|
||||
|
||||
linkCodeVisible: false, // 关联采购申请单对话框开关
|
||||
linkCgPlanDialogVisible: false, // 关联采购申请单对话框开关
|
||||
})
|
||||
|
||||
// 基本信息表单校验规则
|
||||
|
||||
Reference in new issue
Block a user