Merge branch 'master' of http://gitea.zianxin.com/zianxin/biz-pc-cloud
This commit is contained in:
commit
0d320a98ef
5 files changed
+174
-77
No files matched your search
@@ -1,41 +1,49 @@
|
|||||||
import request from "/@/utils/request"
|
import request from "/@/utils/request"
|
||||||
|
|
||||||
export function fetchList(query?: Object) {
|
export function fetchList(query?: Object) {
|
||||||
return request({
|
return request({
|
||||||
url: '/supermarket/smErpCgDd/page',
|
url: "/supermarket/smErpCgDd/page",
|
||||||
method: 'get',
|
method: "get",
|
||||||
params: query
|
params: query,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addObj(obj?: Object) {
|
export function addObj(obj?: Object) {
|
||||||
return request({
|
return request({
|
||||||
url: '/supermarket/smErpCgDd',
|
url: "/supermarket/smErpCgDd",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: obj
|
data: obj,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getObj(id?: string) {
|
export function getObj(id?: string) {
|
||||||
return request({
|
return request({
|
||||||
url: '/supermarket/smErpCgDd/' + id,
|
url: "/supermarket/smErpCgDd/" + id,
|
||||||
method: 'get'
|
method: "get",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function delObjs(ids?: Object) {
|
export function delObjs(ids?: Object) {
|
||||||
return request({
|
return request({
|
||||||
url: '/supermarket/smErpCgDd',
|
url: "/supermarket/smErpCgDd",
|
||||||
method: 'delete',
|
method: "delete",
|
||||||
data: ids
|
data: ids,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function putObj(obj?: Object) {
|
export function putObj(obj?: Object) {
|
||||||
return request({
|
return request({
|
||||||
url: '/supermarket/smErpCgDd',
|
url: "/supermarket/smErpCgDd",
|
||||||
method: 'put',
|
method: "put",
|
||||||
data: obj
|
data: obj,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 采购申请单分页查询
|
||||||
|
export function getCgsqPage(query?: Object) {
|
||||||
|
return request({
|
||||||
|
url: "/supermarket/smErpCgDd/cgsq/page",
|
||||||
|
method: "get",
|
||||||
|
params: query,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -234,7 +234,7 @@ const resetQuery = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 树节点选择时
|
// 树节点选择时
|
||||||
const handleGetSelectNode = (curClickedNode: any, checkedTreeNodes: any, isDeepTree: any) => {
|
const handleGetSelectNode = (curClickedNode: any, checkedTreeNodes: any, isDeepTree: boolean) => {
|
||||||
state.queryForm.deptId = curClickedNode.id
|
state.queryForm.deptId = curClickedNode.id
|
||||||
state.queryForm.deptIds = checkedTreeNodes.map((item: any) => item.id)
|
state.queryForm.deptIds = checkedTreeNodes.map((item: any) => item.id)
|
||||||
state.queryForm.isDeepDept = isDeepTree
|
state.queryForm.isDeepDept = isDeepTree
|
||||||
|
|||||||
@@ -17,10 +17,15 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="关联补货申请" prop="handlerUserId">
|
<el-form-item label="关联补货申请" prop="linkCode">
|
||||||
<el-select v-model="baseDataForm.handlerUserId" placeholder="请选择补货申请单" style="width: 200px">
|
<el-input
|
||||||
<el-option label="请选择" value="0" />
|
v-model="baseDataForm.linkCode"
|
||||||
</el-select>
|
:suffix-icon="Search"
|
||||||
|
@click="openLinkCodeDialog"
|
||||||
|
readonly
|
||||||
|
placeholder="请选择补货申请单"
|
||||||
|
style="width: 200px"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="审批状态" prop="checkStatus">
|
<el-form-item label="审批状态" prop="checkStatus">
|
||||||
@@ -28,7 +33,9 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="货商" prop="supplierId">
|
<el-form-item label="货商" prop="supplierId">
|
||||||
<el-input v-model="baseDataForm.supplierId" placeholder="请输入货商" style="width: 200px" />
|
<el-select v-model="baseDataForm.supplierId" placeholder="请选择货商" style="width: 200px">
|
||||||
|
<el-option v-for="item in supplierTypeDict" :key="item?.id" :label="item?.typeName" :value="item?.id" />
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
@@ -99,7 +106,7 @@
|
|||||||
<vxe-column field="productName" title="库存商品">
|
<vxe-column field="productName" title="库存商品">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<span v-if="row.productName">{{ row.productName }}</span>
|
<span v-if="row.productName">{{ row.productName }}</span>
|
||||||
<span v-else>{{ row.erpSpuId && state.erpSpuSimpleAll.find((item: any) => item.id === row.erpSpuId).productName }}</span>
|
<span v-else>{{ row.erpSpuId && state.erpSpuSimpleAll.find((item: any) => item.id === row.erpSpuId)?.productName }}</span>
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
|
|
||||||
@@ -116,7 +123,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<span v-if="row.unitId">{{ row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.unit }}</span>
|
<span v-if="row.unitId">{{ row.unit ?? row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.unit }}</span>
|
||||||
<span v-else style="color: #c0c4cf">请选择</span>
|
<span v-else style="color: #c0c4cf">请选择</span>
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
@@ -129,7 +136,7 @@
|
|||||||
|
|
||||||
<vxe-column field="unitPrice" title="进价">
|
<vxe-column field="unitPrice" title="进价">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{ row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice }}
|
{{ row.purchasePrice ?? row.erpUnitVos?.find((item: any) => item.id == row.unitId)?.purchasePrice }}
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</vxe-column>
|
||||||
|
|
||||||
@@ -242,6 +249,53 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 关联采购申请单对话框 -->
|
||||||
|
<el-dialog v-model="state.linkCodeVisible" title="选择商品" width="70%" :close-on-click-modal="false" draggable @close="">
|
||||||
|
<!-- <el-row>
|
||||||
|
<el-form :model="foodQueryForm" ref="queryRef" :inline="true" @keyup.enter="getDataListAndSelect">
|
||||||
|
<el-form-item label="商品名称" prop="name">
|
||||||
|
<el-input placeholder="请输入商品名称" v-model="foodQueryForm.name" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="商品分类" prop="categoryId">
|
||||||
|
<select-ctcg v-model="foodQueryForm.categoryId" style="width: 200px" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button icon="search" type="primary" @click="getDataListAndSelect">查询</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-row> -->
|
||||||
|
|
||||||
|
<vxe-table
|
||||||
|
ref="linkCodeTableRef"
|
||||||
|
border
|
||||||
|
v-loading="linkCodeLoading"
|
||||||
|
:row-config="{ isCurrent: true, isHover: true }"
|
||||||
|
:radio-config="{ labelField: '', trigger: 'row' }"
|
||||||
|
:data="state.cgsqPage"
|
||||||
|
>
|
||||||
|
<vxe-column type="radio" width="60" align="center"></vxe-column>
|
||||||
|
<vxe-column field="id" title="id" align="center" width="200"></vxe-column>
|
||||||
|
<vxe-column field="planCode" title="编号" align="center" width="200"></vxe-column>
|
||||||
|
<vxe-column field="planDate" title="单据日期" align="center" width="200"></vxe-column>
|
||||||
|
<vxe-column field="handlerUserId" title="经办人" align="center" width="100"></vxe-column>
|
||||||
|
<vxe-column field="checkStatus" title="审批状态" align="center" width="100"></vxe-column>
|
||||||
|
<vxe-column field="remark" title="备注" show-overflow align="center" min-width="100"></vxe-column>
|
||||||
|
</vxe-table>
|
||||||
|
<!-- <pagination
|
||||||
|
@size-change="sizeChangeHandle"
|
||||||
|
@current-change="currentChangeHandle"
|
||||||
|
v-model:current-page="foodQueryForm.current"
|
||||||
|
v-model:page-size="foodQueryForm.size"
|
||||||
|
:total="total"
|
||||||
|
/> -->
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="state.linkCodeVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="getRadioEvent" :disabled="linkCodeLoading">确认</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -250,12 +304,13 @@
|
|||||||
import { ref, reactive, computed, onMounted } from "vue"
|
import { ref, reactive, computed, onMounted } from "vue"
|
||||||
import { useRouter, useRoute } from "vue-router"
|
import { useRouter, useRoute } from "vue-router"
|
||||||
import { useMessage } from "/@/hooks/message"
|
import { useMessage } from "/@/hooks/message"
|
||||||
import { getObj, addObj, putObj } from "/@/api/supermarketerp/smErpCgDd"
|
import { getObj, addObj, putObj, getCgsqPage } from "/@/api/supermarketerp/smErpCgDd"
|
||||||
import { getPlanCode, getCgPlanSpuPage, getErpSpuSimpleAll } from "/@/api/supermarketerp/common"
|
import { getPlanCode, getCgPlanSpuPage, getErpSpuSimpleAll } from "/@/api/supermarketerp/common"
|
||||||
import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
|
import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
|
||||||
import { getSupplierTypeOptions } from "/@/api/supermarketerp/smErpSupplier"
|
import { getSupplierTypeOptions } from "/@/api/supermarketerp/smErpSupplier"
|
||||||
import { storePrice } from "/@/utils/formatMoney"
|
import { storePrice } from "/@/utils/formatMoney"
|
||||||
import { formatDate } from "/@/utils/formatTime"
|
import { formatDate } from "/@/utils/formatTime"
|
||||||
|
import { Search } from "@element-plus/icons-vue"
|
||||||
|
|
||||||
// 基本表单数据类型
|
// 基本表单数据类型
|
||||||
interface FormVO {
|
interface FormVO {
|
||||||
@@ -264,6 +319,7 @@ interface FormVO {
|
|||||||
dDate: string
|
dDate: string
|
||||||
warehouseId: string
|
warehouseId: string
|
||||||
handlerUserId: string
|
handlerUserId: string
|
||||||
|
linkCode: string
|
||||||
checkStatus: string
|
checkStatus: string
|
||||||
checkUserId: string
|
checkUserId: string
|
||||||
checkTime: string
|
checkTime: string
|
||||||
@@ -293,9 +349,11 @@ const router = useRouter()
|
|||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const loading = ref(false) // 采购计划加载
|
const loading = ref(false) // 采购计划加载
|
||||||
const spuListLoading = ref(false) // 对话框商品列表加载
|
const spuListLoading = ref(false) // 对话框商品列表加载
|
||||||
|
const linkCodeLoading = ref(false) // 关联采购申请单对话框加载状态
|
||||||
const baseDataFormRef = ref() // 基本数据表单ref
|
const baseDataFormRef = ref() // 基本数据表单ref
|
||||||
const editableTableRef = ref<VxeTableInstance<RowVO>>() // 可编辑表格ref
|
const editableTableRef = ref<VxeTableInstance<RowVO>>() // 可编辑表格ref
|
||||||
const spuMultipleTableRef = ref() // 对话框多选表格ref
|
const spuMultipleTableRef = ref() // 对话框多选表格ref
|
||||||
|
const linkCodeTableRef = ref() // 关联补货单对话框表格ref
|
||||||
const supplierTypeDict = ref<any[]>([]) // 货商下拉选项
|
const supplierTypeDict = ref<any[]>([]) // 货商下拉选项
|
||||||
|
|
||||||
// 基本信息表单数据
|
// 基本信息表单数据
|
||||||
@@ -305,6 +363,7 @@ const baseDataForm = reactive<FormVO>({
|
|||||||
dDate: formatDate(new Date(), "YYYY-mm-dd"),
|
dDate: formatDate(new Date(), "YYYY-mm-dd"),
|
||||||
warehouseId: "",
|
warehouseId: "",
|
||||||
handlerUserId: "",
|
handlerUserId: "",
|
||||||
|
linkCode: "",
|
||||||
checkStatus: "",
|
checkStatus: "",
|
||||||
checkUserId: "",
|
checkUserId: "",
|
||||||
checkTime: "",
|
checkTime: "",
|
||||||
@@ -326,6 +385,8 @@ const state = reactive<{
|
|||||||
spuSelectDialogVisible: boolean
|
spuSelectDialogVisible: boolean
|
||||||
spuDataList: any[]
|
spuDataList: any[]
|
||||||
selectedSpuObjs: any[]
|
selectedSpuObjs: any[]
|
||||||
|
linkCodeVisible: boolean
|
||||||
|
cgsqPage: any[]
|
||||||
}>({
|
}>({
|
||||||
editableTableData: [], // 可编辑表格数据
|
editableTableData: [], // 可编辑表格数据
|
||||||
erpSpuItemsMemo: [], // 请求到的可编辑表格商品数据的缓存
|
erpSpuItemsMemo: [], // 请求到的可编辑表格商品数据的缓存
|
||||||
@@ -336,6 +397,9 @@ const state = reactive<{
|
|||||||
spuSelectDialogVisible: false, // 商品选择对话框开关
|
spuSelectDialogVisible: false, // 商品选择对话框开关
|
||||||
spuDataList: [], // 商品列表
|
spuDataList: [], // 商品列表
|
||||||
selectedSpuObjs: [], // 已选中的商品列表项
|
selectedSpuObjs: [], // 已选中的商品列表项
|
||||||
|
linkCodeVisible: false, // 关联采购申请单对话框开关
|
||||||
|
|
||||||
|
cgsqPage: [], // 对话框采购申请单分页数据
|
||||||
})
|
})
|
||||||
|
|
||||||
// 基本信息表单校验规则
|
// 基本信息表单校验规则
|
||||||
@@ -358,34 +422,56 @@ const getInitData = async () => {
|
|||||||
if (id) {
|
if (id) {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
// 获取采购计划数据 & 获取简要商品列表
|
// 获取采购计划数据 & 获取简要商品列表
|
||||||
const [cgPlanData, erpSpuSimpleAll] = await Promise.allSettled([getObj(id), getErpSpuSimpleAll()])
|
const [cgPlanData] = await Promise.allSettled([getObj(id)])
|
||||||
.then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
|
.then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
|
||||||
.finally(() => (loading.value = false))
|
.finally(() => (loading.value = false))
|
||||||
|
|
||||||
if (cgPlanData && cgPlanData.code === 0) {
|
if (cgPlanData && cgPlanData.code === 0) {
|
||||||
Object.assign(baseDataForm, {
|
Object.assign(baseDataForm, cgPlanData.data)
|
||||||
id: cgPlanData.data.id,
|
|
||||||
planCode: cgPlanData.data.planCode,
|
|
||||||
orderNumber: cgPlanData.data.orderNumber,
|
|
||||||
planDate: cgPlanData.data.planDate,
|
|
||||||
supplierId: cgPlanData.data.supplierId,
|
|
||||||
handlerUserId: cgPlanData.data.handlerUserId,
|
|
||||||
remark: cgPlanData.data.remark,
|
|
||||||
})
|
|
||||||
state.editableTableData = cgPlanData.data.items
|
state.editableTableData = cgPlanData.data.items
|
||||||
state.erpSpuItemsMemo = cgPlanData.data.items
|
state.erpSpuItemsMemo = cgPlanData.data.items
|
||||||
}
|
}
|
||||||
erpSpuSimpleAll && erpSpuSimpleAll.code === 0 && (state.erpSpuSimpleAll = erpSpuSimpleAll.data)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取货商选项 & 获取采购计划编号
|
// 获取货商选项 & 获取采购计划编号
|
||||||
const [supplierTypeOptions, planCode] = await Promise.allSettled([getSupplierTypeOptions(), getPlanCode({ type: 2 })]).then((results) =>
|
const [erpSpuSimpleAll, supplierTypeOptions, planCode] = await Promise.allSettled([
|
||||||
results.map((result) => (result.status === "fulfilled" ? result.value : null)),
|
getErpSpuSimpleAll(),
|
||||||
)
|
getSupplierTypeOptions(),
|
||||||
|
getPlanCode({ type: 2 }),
|
||||||
|
]).then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
|
||||||
|
erpSpuSimpleAll && erpSpuSimpleAll.code === 0 && (state.erpSpuSimpleAll = erpSpuSimpleAll.data)
|
||||||
supplierTypeOptions && supplierTypeOptions.code === 0 && (supplierTypeDict.value = supplierTypeOptions.data)
|
supplierTypeOptions && supplierTypeOptions.code === 0 && (supplierTypeDict.value = supplierTypeOptions.data)
|
||||||
planCode && planCode.code === 0 && (baseDataForm.code = planCode.data)
|
planCode && planCode.code === 0 && (baseDataForm.code = planCode.data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 打开关联补货单对话框
|
||||||
|
const openLinkCodeDialog = async () => {
|
||||||
|
state.linkCodeVisible = true
|
||||||
|
linkCodeLoading.value = true
|
||||||
|
try {
|
||||||
|
const res = await getCgsqPage().finally(() => (linkCodeLoading.value = false))
|
||||||
|
if (res.code === 0) {
|
||||||
|
state.cgsqPage = res.data.records
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
state.cgsqPage = []
|
||||||
|
linkCodeLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取关联补货单对话框表格被单选行
|
||||||
|
const getRadioEvent = () => {
|
||||||
|
const $table = linkCodeTableRef.value
|
||||||
|
if ($table) {
|
||||||
|
const currRow = $table.getRadioRecord()
|
||||||
|
console.log("currRadioRow", currRow)
|
||||||
|
baseDataForm.linkCode = currRow.planCode
|
||||||
|
state.editableTableData = currRow.items
|
||||||
|
state.erpSpuItemsMemo = currRow.items
|
||||||
|
state.linkCodeVisible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 可编辑表格行勾选
|
// 可编辑表格行勾选
|
||||||
const selectChangeEvent: VxeTableEvents.CheckboxChange<RowVO> = ({ checked }) => {
|
const selectChangeEvent: VxeTableEvents.CheckboxChange<RowVO> = ({ checked }) => {
|
||||||
const $table = editableTableRef.value
|
const $table = editableTableRef.value
|
||||||
@@ -547,7 +633,8 @@ const handleSelectDialogConfirm = () => {
|
|||||||
const addedItems = state.selectedSpuObjs
|
const addedItems = state.selectedSpuObjs
|
||||||
.filter((item: any) => !state.editableTableData.some((editableTableItem: RowVO) => editableTableItem.erpSpuId === item.erpSpuId))
|
.filter((item: any) => !state.editableTableData.some((editableTableItem: RowVO) => editableTableItem.erpSpuId === item.erpSpuId))
|
||||||
.map((addItem) => {
|
.map((addItem) => {
|
||||||
if (state.erpSpuItemsMemo.some((item: any) => item.erpSpuId === addItem.erpSpuId)) return addItem
|
const index = state.erpSpuItemsMemo.findIndex((item: any) => item.erpSpuId === addItem.erpSpuId)
|
||||||
|
if (index !== -1) return state.erpSpuItemsMemo[index]
|
||||||
return { ...addItem, isNew: true }
|
return { ...addItem, isNew: true }
|
||||||
}) // 为新增的数据项添加isNew标志,若该项原本已经存在,则不添加isNew标志
|
}) // 为新增的数据项添加isNew标志,若该项原本已经存在,则不添加isNew标志
|
||||||
// 仅添加新勾选的项
|
// 仅添加新勾选的项
|
||||||
@@ -575,15 +662,27 @@ const handleSelectDialogConfirm = () => {
|
|||||||
// 整理数据
|
// 整理数据
|
||||||
const cgPlanSpuItems = computed(() => {
|
const cgPlanSpuItems = computed(() => {
|
||||||
return state.editableTableData.map((item: any) => {
|
return state.editableTableData.map((item: any) => {
|
||||||
const unit = item.erpUnitVos.find((unitItem: any) => unitItem.id === item.unitId)
|
if (item.erpUnitVos) {
|
||||||
return {
|
const unit = item.erpUnitVos.find((unitItem: any) => unitItem.id === item.unitId)
|
||||||
id: item.isNew ? undefined : item.id,
|
return {
|
||||||
erpSpuId: item.erpSpuId,
|
id: item.isNew ? undefined : item.id,
|
||||||
quantity: item.quantity,
|
erpSpuId: item.erpSpuId,
|
||||||
unitPrice: unit.purchasePrice ? storePrice(unit?.purchasePrice) : 0,
|
quantity: item.quantity,
|
||||||
totalAmount: Number(unit?.purchasePrice || 0) * item.quantity,
|
unitPrice: unit.purchasePrice ? storePrice(unit?.purchasePrice) : 0,
|
||||||
remark: item.remark,
|
totalAmount: Number(unit?.purchasePrice || 0) * item.quantity,
|
||||||
unitId: item.unitId,
|
remark: item.remark,
|
||||||
|
unitId: item.unitId,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
id: item.isNew ? undefined : item.id,
|
||||||
|
erpSpuId: item.erpSpuId,
|
||||||
|
quantity: item.quantity,
|
||||||
|
unitPrice: item.unitPrice ? storePrice(item.unitPrice) : 0,
|
||||||
|
totalAmount: Number(item.unitPrice || 0) * item.quantity,
|
||||||
|
remark: item.remark,
|
||||||
|
unitId: item.unitId,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -219,10 +219,8 @@
|
|||||||
/> -->
|
/> -->
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<el-button @click="state.spuSelectDialogVisible = false">取消</el-button>
|
||||||
<el-button @click="state.spuSelectDialogVisible = false">取消</el-button>
|
<el-button type="primary" @click="handleSelectDialogConfirm" :disabled="spuListLoading">确认</el-button>
|
||||||
<el-button type="primary" @click="handleSelectDialogConfirm" :disabled="spuListLoading">确认</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
@@ -512,7 +510,8 @@ const handleSelectDialogConfirm = () => {
|
|||||||
const addedItems = state.selectedSpuObjs
|
const addedItems = state.selectedSpuObjs
|
||||||
.filter((item: any) => !state.editableTableData.some((editableTableItem: RowVO) => editableTableItem.erpSpuId === item.erpSpuId))
|
.filter((item: any) => !state.editableTableData.some((editableTableItem: RowVO) => editableTableItem.erpSpuId === item.erpSpuId))
|
||||||
.map((addItem) => {
|
.map((addItem) => {
|
||||||
if (state.erpSpuItemsMemo.some((item: any) => item.erpSpuId === addItem.erpSpuId)) return addItem
|
const index = state.erpSpuItemsMemo.findIndex((item: any) => item.erpSpuId === addItem.erpSpuId)
|
||||||
|
if (index !== -1) return state.erpSpuItemsMemo[index]
|
||||||
return { ...addItem, isNew: true }
|
return { ...addItem, isNew: true }
|
||||||
}) // 为新增的数据项添加isNew标志,若该项原本已经存在,则不添加isNew标志
|
}) // 为新增的数据项添加isNew标志,若该项原本已经存在,则不添加isNew标志
|
||||||
// 仅添加新勾选的项
|
// 仅添加新勾选的项
|
||||||
|
|||||||
@@ -234,10 +234,8 @@
|
|||||||
/> -->
|
/> -->
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<el-button @click="state.spuSelectDialogVisible = false">取消</el-button>
|
||||||
<el-button @click="state.spuSelectDialogVisible = false">取消</el-button>
|
<el-button type="primary" @click="handleSelectDialogConfirm" :disabled="spuListLoading">确认</el-button>
|
||||||
<el-button type="primary" @click="handleSelectDialogConfirm" :disabled="spuListLoading">确认</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
@@ -362,15 +360,7 @@ const getInitData = async () => {
|
|||||||
.finally(() => (loading.value = false))
|
.finally(() => (loading.value = false))
|
||||||
|
|
||||||
if (cgPlanData && cgPlanData.code === 0) {
|
if (cgPlanData && cgPlanData.code === 0) {
|
||||||
Object.assign(baseDataForm, {
|
Object.assign(baseDataForm, cgPlanData.data)
|
||||||
id: cgPlanData.data.id,
|
|
||||||
planCode: cgPlanData.data.planCode,
|
|
||||||
orderNumber: cgPlanData.data.orderNumber,
|
|
||||||
planDate: cgPlanData.data.planDate,
|
|
||||||
supplierId: cgPlanData.data.supplierId,
|
|
||||||
handlerUserId: cgPlanData.data.handlerUserId,
|
|
||||||
remark: cgPlanData.data.remark,
|
|
||||||
})
|
|
||||||
state.editableTableData = cgPlanData.data.items
|
state.editableTableData = cgPlanData.data.items
|
||||||
state.erpSpuItemsMemo = cgPlanData.data.items
|
state.erpSpuItemsMemo = cgPlanData.data.items
|
||||||
}
|
}
|
||||||
@@ -546,7 +536,8 @@ const handleSelectDialogConfirm = () => {
|
|||||||
const addedItems = state.selectedSpuObjs
|
const addedItems = state.selectedSpuObjs
|
||||||
.filter((item: any) => !state.editableTableData.some((editableTableItem: RowVO) => editableTableItem.erpSpuId === item.erpSpuId))
|
.filter((item: any) => !state.editableTableData.some((editableTableItem: RowVO) => editableTableItem.erpSpuId === item.erpSpuId))
|
||||||
.map((addItem) => {
|
.map((addItem) => {
|
||||||
if (state.erpSpuItemsMemo.some((item: any) => item.erpSpuId === addItem.erpSpuId)) return addItem
|
const index = state.erpSpuItemsMemo.findIndex((item: any) => item.erpSpuId === addItem.erpSpuId)
|
||||||
|
if (index !== -1) return state.erpSpuItemsMemo[index]
|
||||||
return { ...addItem, isNew: true }
|
return { ...addItem, isNew: true }
|
||||||
}) // 为新增的数据项添加isNew标志,若该项原本已经存在,则不添加isNew标志
|
}) // 为新增的数据项添加isNew标志,若该项原本已经存在,则不添加isNew标志
|
||||||
// 仅添加新勾选的项
|
// 仅添加新勾选的项
|
||||||
|
|||||||
Reference in new issue
Block a user