组件改动

This commit is contained in:
weiwei committed 2025-02-27 18:44:41 +08:00
1 parent 1dd21a5061
commit 69b54f260b
13 files changed
+110 -207

No files matched your search

+6 -13
View File
@@ -45,7 +45,7 @@
:data="state.treeDataList"
:expand-on-click-node="false"
node-key="id"
highlight-current
:highlight-current="nodeClickable ? true : false"
default-expand-all
show-checkbox
@node-click="handleNodeClick"
@@ -63,7 +63,7 @@
@change="handleSwitchChange"
:inactive-text="switchInactiveText"
:active-text="switchActiveText"
:disabled="state.checkedTreeNodes.length > 0"
:disabled="nodeClickable && state.checkedTreeNodes.length > 0"
/>
</div>
</div>
@@ -101,6 +101,7 @@ const props = withDefaults(
showExpand?: boolean // 折叠控制
query?: (searchName?: string) => Promise<any> // 查询函数
props?: object
nodeClickable?: boolean
switchInactiveText?: string | undefined
switchActiveText?: string | undefined
defaultTreeWidth?: number | string
@@ -116,6 +117,7 @@ const props = withDefaults(
value: "id",
}
},
nodeClickable: true,
switchInactiveText: "当前级",
switchActiveText: "当前级及子级",
defaultTreeWidth: 20,
@@ -177,6 +179,7 @@ const handleSearchInputChange = () => {
// 点击树形结构节点
const handleNodeClick = (nodeData: any) => {
if (!props.nodeClickable) return
state.curClickedNode = nodeData
emit("getSelectNode", state.curClickedNode, state.checkedTreeNodes, state.switch)
}
@@ -186,7 +189,7 @@ const handleCheck = (data: any, checkStatus: any) => {
const { checkedNodes } = checkStatus
console.log("checkedNodes", checkedNodes)
state.checkedTreeNodes = checkedNodes
if (state.checkedTreeNodes.length > 0) {
if (props.nodeClickable && state.checkedTreeNodes.length > 0) {
state.switch = false
}
emit("getSelectNode", state.curClickedNode, state.checkedTreeNodes, state.switch)
@@ -204,16 +207,6 @@ const toggleRowExpansionAll = (status: boolean) => {
}
}
// 勾选树节点时关闭switch
watch(
() => state.checkedTreeNodes,
(val) => {
if (state.checkedTreeNodes.length > 0) {
state.switch = false
}
},
)
// 重置数据
const resetData = () => {
state.searchName = ""
+4 -3
View File
@@ -6,9 +6,10 @@
placeholder="请输入部门名称"
:show-expand="true"
@getSelectNode="handleGetSelectNode"
switch-inactive-text="当前部门"
switch-active-text="当前部门及子部门"
switch-inactive-text="包含"
switch-active-text="不包含"
:defaultTreeWidth="20"
:nodeClickable="false"
>
<template #default>
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
@@ -208,7 +209,7 @@ const resetQuery = () => {
const handleGetSelectNode = (curClickedNode: any, checkedTreeNodes: any, isDeepTree: any) => {
state.queryForm.deptId = curClickedNode.id
state.queryForm.deptIds = checkedTreeNodes.map((item: any) => item.id)
state.queryForm.isDeepDept = isDeepTree
state.queryForm.isInclude = isDeepTree
getDataList()
}
</script>
+4 -3
View File
@@ -6,9 +6,10 @@
placeholder="请输入部门名称"
:show-expand="true"
@getSelectNode="handleGetSelectNode"
switch-inactive-text="当前部门"
switch-active-text="当前部门及子部门"
switch-inactive-text="包含"
switch-active-text="不包含"
:defaultTreeWidth="20"
:nodeClickable="false"
>
<template #default>
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
@@ -160,7 +161,7 @@ const selectionChangHandle = (objs: { id: string }[]) => {
const handleGetSelectNode = (curClickedNode: any, checkedTreeNodes: any, isDeepTree: any) => {
state.queryForm.deptId = curClickedNode.id
state.queryForm.deptIds = checkedTreeNodes.map((item: any) => item.id)
state.queryForm.isDeepDept = isDeepTree
state.queryForm.isInclude = isDeepTree
getDataList()
}
</script>
+4 -3
View File
@@ -6,9 +6,10 @@
placeholder="请输入部门名称"
:show-expand="true"
@getSelectNode="handleGetSelectNode"
switch-inactive-text="当前部门"
switch-active-text="当前部门及子部门"
switch-inactive-text="包含"
switch-active-text="不包含"
:defaultTreeWidth="20"
:nodeClickable="false"
>
<template #default>
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
@@ -148,7 +149,7 @@ const selectionChangHandle = (objs: { id: string }[]) => {
const handleGetSelectNode = (curClickedNode: any, checkedTreeNodes: any, isDeepTree: any) => {
state.queryForm.deptId = curClickedNode.id
state.queryForm.deptIds = checkedTreeNodes.map((item: any) => item.id)
state.queryForm.isDeepDept = isDeepTree
state.queryForm.isInclude = isDeepTree
getDataList()
}
</script>
@@ -1,22 +1,20 @@
<template>
<!-- 关联采购申请单对话框 -->
<el-dialog v-model="linkCgCodeDialogVisible" title="选择采购单" width="70%" :close-on-click-modal="false" draggable @close="onClose">
<!-- 关联订单对话框 -->
<el-dialog v-model="linkCodeDialogVisible" :title="title" width="70%" :close-on-click-modal="false" draggable @close="onClose">
<vxe-table
v-show="step === 0"
ref="linkCgPlanTableRef"
ref="linkCodeTableRef"
border
v-loading="linkCodeLoading"
:row-config="{ isCurrent: true, isHover: true }"
:radio-config="{ labelField: '', trigger: 'row' }"
:data="cgsqPage"
:data="linkCodeTableData"
@radio-change="radioChangeEvent"
>
<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="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="productName" 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>
@@ -30,14 +28,14 @@
/> -->
<vxe-table
v-show="step === 1"
ref="linkCgPlanSpuTableRef"
ref="linkCodeUnitTableRef"
border
:row-config="{ isCurrent: true, isHover: true }"
:checkbox-config="{ trigger: 'row' }"
:data="currRadioRowItems"
>
<vxe-column type="checkbox" width="60" align="center"></vxe-column>
<!-- <vxe-column field="erpSpuId" title="erpSpuId" align="center" width="200"></vxe-column>-->
<vxe-column field="erpSpuId" title="erpSpuId" align="center" width="200"></vxe-column>
<vxe-column field="unit" title="包装单位" align="center" width="200"></vxe-column>
<vxe-column field="quantity" title="数量" align="center" width="100"></vxe-column>
<vxe-column field="purchasePrice" title="进价" align="center" width="100"></vxe-column>
@@ -47,7 +45,7 @@
</vxe-table>
<template #footer>
<el-button @click="linkCgCodeDialogVisible = false">取消</el-button>
<el-button @click="linkCodeDialogVisible = false">取消</el-button>
<el-button v-show="step === 1" type="primary" @click="step--">上一步</el-button>
<el-button v-show="step === 0" type="primary" @click="step++" :disabled="currRadioRowItems.length <= 0">下一步</el-button>
<el-button v-show="step === 1" type="primary" @click="getSelectedRowData" :disabled="linkCodeLoading">确认</el-button>
@@ -57,31 +55,40 @@
<script setup lang="ts" name="linkCgCodeDialog">
import { ref } from "vue"
import { getCgsqPage } from "/@/api/supermarketerp/smErpCgDd"
import { VxeTableEvents } from "vxe-table"
const linkCgCodeDialogVisible = defineModel()
const emit = defineEmits(["getSelectedCgPlan"])
const linkCodeDialogVisible = defineModel()
const emit = defineEmits(["getSelectedLinkCode"])
const props = withDefaults(
defineProps<{
title?: string
getTableData?: (params?: object) => Promise<any>
}>(),
{
title: "",
getTableData: (params?: object) => Promise.resolve([]),
},
)
const linkCodeLoading = ref(false) // 关联采购申请单对话框加载状态
const linkCgPlanTableRef = ref() // 关联补货单对话框表格1ref
const linkCgPlanSpuTableRef = ref() // 关联补货单对话框表格2ref
const cgsqPage = ref([]) // 采购申请列表数据
const linkCodeLoading = ref(false)
const linkCodeTableRef = ref() // 关联订单表格ref
const linkCodeUnitTableRef = ref() // 关联订单的包装单位表格ref
const linkCodeTableData = ref([]) // 关联订单列表数据
const currRadioRowItems = ref([]) // 当前单选的表格行的items
const step = ref(0) // 选择步骤
const step = ref(0)
// 打开关联补货单对话框
const openLinkCodeDialog = async () => {
linkCgCodeDialogVisible.value = true
linkCodeDialogVisible.value = true
step.value = 0
linkCodeLoading.value = true
try {
const res = await getCgsqPage().finally(() => (linkCodeLoading.value = false))
const res = await props.getTableData().finally(() => (linkCodeLoading.value = false))
if (res.code === 0) {
cgsqPage.value = res.data.records
linkCodeTableData.value = res.data.records
}
} catch (error) {
cgsqPage.value = []
linkCodeTableData.value = []
linkCodeLoading.value = false
}
}
@@ -91,23 +98,23 @@ const radioChangeEvent: VxeTableEvents.RadioChange<any> = ({ row }) => (currRadi
// 获取选择的关联补货单对话框表格行数据
const getSelectedRowData = () => {
const $table = linkCgPlanTableRef.value
const $SpuTable = linkCgPlanSpuTableRef.value
if ($table && $SpuTable) {
const $table = linkCodeTableRef.value
const $unitTable = linkCodeUnitTableRef.value
if ($table && $unitTable) {
const currRadioRow = $table.getRadioRecord()
console.log("currRadioRow", currRadioRow)
const currSpuRows = $SpuTable.getCheckboxRecords()
console.log("currSpuRows", currSpuRows)
const currUnitRows = $unitTable.getCheckboxRecords()
console.log("currUnitRows", currUnitRows)
emit("getSelectedCgPlan", { ...currRadioRow, items: currSpuRows })
emit("getSelectedLinkCode", { ...currRadioRow, items: currUnitRows })
}
}
// 对话框关闭
const onClose = () => {
linkCgCodeDialogVisible.value = false
linkCodeDialogVisible.value = false
currRadioRowItems.value = []
cgsqPage.value = []
linkCodeTableData.value = []
}
defineExpose({
@@ -56,7 +56,6 @@
<script setup lang="ts" name="linkCgCodeDialog">
import { ref } from "vue"
import { VxeTableEvents } from "vxe-table"
import { getCgInventoryPage } from "/@/api/supermarketerp/smErpCgBack"
const linkCgCodeDialogVisible = defineModel()
const emit = defineEmits(["getSelectedCgPlan"])
@@ -74,7 +73,7 @@ const openLinkCodeDialog = async () => {
step.value = 0
linkCodeLoading.value = true
try {
const res = await getCgInventoryPage({ inventoryType: "3" }).finally(() => (linkCodeLoading.value = false))
const res = await getCgInventoryPage({}).finally(() => (linkCodeLoading.value = false))
if (res.code === 0) {
cgddPage.value = res.data.records
}
@@ -171,8 +171,8 @@
@getSelectedSpuRows="getSelectedSpuRows"
/>
<!-- 关联采购申请单对话框 -->
<linkCgCodeDialog ref="linkCgCodeDialogRef" v-model="state.linkCgCodeDialogVisible" @getSelectedCgPlan="getSelectedCgPlan" />
<linkCodeDialog ref="linkCgPlanDialogRef" v-model="state.linkCgPlanDialogVisible" title="关联采购订单"
:getTableData="getCgInventoryPage({inventoryType: "3"})" @getSelectedLinkCode="getSelectedLinkCode" />
</div>
</div>
</template>
@@ -188,14 +188,15 @@ import { getSupplierTypeOptions } from "/@/api/supermarketerp/smErpSupplier"
import { formatDate } from "/@/utils/formatTime"
import { Search } from "@element-plus/icons-vue"
import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectDialog.vue"
import linkCgCodeDialog from "/@/views/supermarketerp/smErpCgBack/components/linkCgCodeDialog.vue"
import linkCodeDialog from "../components/linkCodeDialog.vue"
import { getCgInventoryPage } from "/@/api/supermarketerp/smErpCgBack"
import { displayPrice } from "/@/utils/formatMoney"
const router = useRouter()
const route = useRoute()
const loading = ref(false) // 采购计划加载
const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
const linkCgCodeDialogRef = ref() // 关联采购申请单对话框ref
const linkCgPlanDialogRef = ref() // 关联采购申请单对话框ref
const baseDataFormRef = ref() // 基本数据表单ref
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
const supplierTypeDict = ref<any[]>([]) // 货商下拉选项
@@ -222,7 +223,7 @@ const state = reactive<{
erpSpuSimpleAll: any
linkCodeVisible: boolean
erpSpuSelectDialogVisible: boolean
linkCgCodeDialogVisible: boolean
linkCgPlanDialogVisible: boolean
}>({
editableTableData: [], // 可编辑表格数据
erpSpuItemsMemo: [], // 请求到的可编辑表格商品数据的缓存
@@ -232,7 +233,7 @@ const state = reactive<{
linkCodeVisible: false, // 关联采购申请单对话框开关
erpSpuSelectDialogVisible: false, // 商品选择对话框开关
linkCgCodeDialogVisible: false, // 关联采购申请单对话框开关
linkCgPlanDialogVisible: false, // 关联采购申请单对话框开关
})
// 基本信息表单校验规则
@@ -279,16 +280,16 @@ const getInitData = async () => {
}
// 点击关联采购申请编号
const handleClickLinkCode = () => linkCgCodeDialogRef.value.openLinkCodeDialog()
const handleClickLinkCode = () => linkCgPlanDialogRef.value.openLinkCodeDialog()
// 获取选择的采购申请
const getSelectedCgPlan = (selectionRows: any) => {
const getSelectedLinkCode = (selectionRows: any) => {
console.log("被选择的关联数据", selectionRows)
baseDataForm.linkCode = selectionRows.planCode
state.editableTableData = selectionRows.items
state.erpSpuItemsMemo = selectionRows.items
state.linkCgCodeDialogVisible = false
state.linkCgPlanDialogVisible = false
}
// 顶部表格行新增
@@ -176,13 +176,18 @@
@getSelectedSpuRows="getSelectedSpuRows"
/>
<!-- 关联采购申请单对话框 -->
<linkCgCodeDialog ref="linkCgCodeDialogRef" v-model="state.linkCgCodeDialogVisible" @getSelectedCgPlan="getSelectedCgPlan" />
<linkCodeDialog
ref="linkCgPlanDialogRef"
v-model="state.linkCgPlanDialogVisible"
title="关联补货申请"
:getTableData="getCgsqPage"
@getSelectedLinkCode="getSelectedLinkCode"
/>
</div>
</div>
</template>
<script setup lang="ts" name="cgPlanOption">
<script setup lang="ts" name="smErpCgDd">
import { ref, reactive, computed, onMounted } from "vue"
import { useRouter, useRoute } from "vue-router"
import { useMessage } from "/@/hooks/message"
@@ -193,7 +198,8 @@ import { getSupplierTypeOptions } from "/@/api/supermarketerp/smErpSupplier"
import { formatDate } from "/@/utils/formatTime"
import { Search } from "@element-plus/icons-vue"
import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectDialog.vue"
import linkCgCodeDialog from "/@/views/supermarketerp/smErpCgDd/components/linkCgCodeDialog.vue"
import linkCodeDialog from "../components/linkCodeDialog.vue"
import { getCgsqPage } from "/@/api/supermarketerp/smErpCgDd"
import { displayPrice } from "/@/utils/formatMoney"
import { useDict } from "/@/hooks/dict"
@@ -201,7 +207,7 @@ const router = useRouter()
const route = useRoute()
const loading = ref(false) // 采购计划加载
const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
const linkCgCodeDialogRef = ref() // 关联采购申请单对话框ref
const linkCgPlanDialogRef = ref() // 关联采购申请单对话框ref
const baseDataFormRef = ref() // 基本数据表单ref
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
const supplierTypeDict = ref<any[]>([]) // 货商下拉选项
@@ -230,7 +236,7 @@ const state = reactive<{
erpSpuSimpleAll: any
linkCodeVisible: boolean
erpSpuSelectDialogVisible: boolean
linkCgCodeDialogVisible: boolean
linkCgPlanDialogVisible: boolean
}>({
editableTableData: [], // 可编辑表格数据
erpSpuItemsMemo: [], // 请求到的可编辑表格商品数据的缓存
@@ -239,7 +245,7 @@ const state = reactive<{
erpSpuSimpleAll: [], // 简要商品列表
linkCodeVisible: false, // 关联采购申请单对话框开关
erpSpuSelectDialogVisible: false, // 商品选择对话框开关
linkCgCodeDialogVisible: false, // 关联采购申请单对话框开关
linkCgPlanDialogVisible: false, // 关联采购申请单对话框开关
})
// 基本信息表单校验规则
@@ -286,16 +292,16 @@ const getInitData = async () => {
}
// 点击关联采购申请编号
const handleClickLinkCode = () => linkCgCodeDialogRef.value.openLinkCodeDialog()
const handleClickLinkCode = () => linkCgPlanDialogRef.value.openLinkCodeDialog()
// 获取选择的采购申请
const getSelectedCgPlan = (selectionRows: any) => {
const getSelectedLinkCode = (selectionRows: any) => {
console.log("被选择的关联数据", selectionRows)
baseDataForm.linkCode = selectionRows.planCode
state.editableTableData = selectionRows.items
state.erpSpuItemsMemo = selectionRows.items
state.linkCgCodeDialogVisible = false
state.linkCgPlanDialogVisible = false
}
// 顶部表格行新增
@@ -1,115 +0,0 @@
<template>
<!-- 关联采购申请单对话框 -->
<el-dialog v-model="linkCgCodeDialogVisible" title="选择采购单" width="70%" :close-on-click-modal="false" draggable @close="onClose">
<vxe-table
v-show="step === 0"
ref="linkCgPlanTableRef"
border
v-loading="linkCodeLoading"
:row-config="{ isCurrent: true, isHover: true }"
:radio-config="{ labelField: '', trigger: 'row' }"
:data="cgddPage"
@radio-change="radioChangeEvent"
>
<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="productName" title="商品" align="center" width="200"></vxe-column>
<vxe-column field="code" title="编号" align="center" width="200"></vxe-column>
<vxe-column field="ddDate" 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"
/> -->
<vxe-table
v-show="step === 1"
ref="linkCgPlanSpuTableRef"
border
:row-config="{ isCurrent: true, isHover: true }"
:checkbox-config="{ trigger: 'row' }"
:data="currRadioRowItems"
>
<vxe-column type="checkbox" width="60" align="center"></vxe-column>
<!-- <vxe-column field="erpSpuId" title="erpSpuId" align="center" width="200"></vxe-column>-->
<vxe-column field="unit" title="包装单位" align="center" width="200"></vxe-column>
<vxe-column field="quantity" title="数量" align="center" width="100"></vxe-column>
<vxe-column field="purchasePrice" title="进价" align="center" width="100"></vxe-column>
<vxe-column field="unitPrice" title="进价" align="center" width="100"></vxe-column>
<vxe-column field="totalAmount" title="累计总金额" align="center" width="100"></vxe-column>
<vxe-column field="remark" title="备注" show-overflow align="center" min-width="100"></vxe-column>
</vxe-table>
<template #footer>
<el-button @click="linkCgCodeDialogVisible = false">取消</el-button>
<el-button v-show="step === 1" type="primary" @click="step--">上一步</el-button>
<el-button v-show="step === 0" type="primary" @click="step++" :disabled="currRadioRowItems.length <= 0">下一步</el-button>
<el-button v-show="step === 1" type="primary" @click="getSelectedRowData" :disabled="linkCodeLoading">确认</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts" name="linkCgCodeDialog">
import { ref } from "vue"
import { getCgddPage } from "/@/api/supermarketerp/smErpInventoryRecords"
import { VxeTableEvents } from "vxe-table"
const linkCgCodeDialogVisible = defineModel()
const emit = defineEmits(["getSelectedCgPlan"])
const linkCodeLoading = ref(false) // 关联采购申请单对话框加载状态
const linkCgPlanTableRef = ref() // 关联补货单对话框表格1ref
const linkCgPlanSpuTableRef = ref() // 关联补货单对话框表格2ref
const cgddPage = ref([]) // 采购申请列表数据
const currRadioRowItems = ref([]) // 当前单选的表格行的items
const step = ref(0) // 选择步骤
// 打开关联补货单对话框
const openLinkCodeDialog = async () => {
linkCgCodeDialogVisible.value = true
step.value = 0
linkCodeLoading.value = true
try {
const res = await getCgddPage().finally(() => (linkCodeLoading.value = false))
if (res.code === 0) {
cgddPage.value = res.data.records
}
} catch (error) {
cgddPage.value = []
linkCodeLoading.value = false
}
}
// 单选时
const radioChangeEvent: VxeTableEvents.RadioChange<any> = ({ row }) => (currRadioRowItems.value = row.items)
// 获取选择的关联补货单对话框表格行数据
const getSelectedRowData = () => {
const $table = linkCgPlanTableRef.value
const $SpuTable = linkCgPlanSpuTableRef.value
if ($table && $SpuTable) {
const currRadioRow = $table.getRadioRecord()
console.log("currRadioRow", currRadioRow)
const currSpuRows = $SpuTable.getCheckboxRecords()
console.log("currSpuRows", currSpuRows)
emit("getSelectedCgPlan", { ...currRadioRow, items: currSpuRows })
}
}
// 对话框关闭
const onClose = () => {
linkCgCodeDialogVisible.value = false
currRadioRowItems.value = []
cgddPage.value = []
}
defineExpose({
openLinkCodeDialog,
})
</script>
@@ -177,13 +177,18 @@
@getSelectedSpuRows="getSelectedSpuRows"
/>
<!-- 关联采购申请单对话框 -->
<linkCgCodeDialog ref="linkCgCodeDialogRef" v-model="state.linkCgCodeDialogVisible" @getSelectedCgPlan="getSelectedCgPlan" />
<linkCodeDialog
ref="linkCgPlanDialogRef"
v-model="state.linkCgPlanDialogVisible"
title="关联采购订单"
:getTableData="getCgddPage"
@getSelectedLinkCode="getSelectedLinkCode"
/>
</div>
</div>
</template>
<script setup lang="ts" name="cgPlanOption">
<script setup lang="ts" name="smErpInventoryRecords">
import { ref, reactive, computed, onMounted } from "vue"
import { useRouter, useRoute } from "vue-router"
import { useMessage } from "/@/hooks/message"
@@ -194,7 +199,8 @@ import { getSupplierTypeOptions } from "/@/api/supermarketerp/smErpSupplier"
import { formatDate } from "/@/utils/formatTime"
import { Search } from "@element-plus/icons-vue"
import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectDialog.vue"
import linkCgCodeDialog from "/@/views/supermarketerp/smErpInventoryRecords/components/linkCgCodeDialog.vue"
import linkCodeDialog from "../components/linkCodeDialog.vue"
import { getCgddPage } from "/@/api/supermarketerp/smErpInventoryRecords"
import { displayPrice } from "/@/utils/formatMoney"
import { useDict } from "/@/hooks/dict"
@@ -202,7 +208,7 @@ const router = useRouter()
const route = useRoute()
const loading = ref(false) // 采购计划加载
const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
const linkCgCodeDialogRef = ref() // 关联采购申请单对话框ref
const linkCgPlanDialogRef = ref() // 关联采购申请单对话框ref
const baseDataFormRef = ref() // 基本数据表单ref
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
const supplierTypeDict = ref<any[]>([]) // 货商下拉选项
@@ -230,7 +236,7 @@ const state = reactive<{
erpSpuSimpleAll: any
linkCodeVisible: boolean
erpSpuSelectDialogVisible: boolean
linkCgCodeDialogVisible: boolean
linkCgPlanDialogVisible: boolean
}>({
editableTableData: [], // 可编辑表格数据
erpSpuItemsMemo: [], // 请求到的可编辑表格商品数据的缓存
@@ -240,7 +246,7 @@ const state = reactive<{
linkCodeVisible: false, // 关联采购申请单对话框开关
erpSpuSelectDialogVisible: false, // 商品选择对话框开关
linkCgCodeDialogVisible: false, // 关联采购申请单对话框开关
linkCgPlanDialogVisible: false, // 关联采购申请单对话框开关
})
// 基本信息表单校验规则
@@ -287,16 +293,16 @@ const getInitData = async () => {
}
// 点击关联采购申请编号
const handleClickLinkCode = () => linkCgCodeDialogRef.value.openLinkCodeDialog()
const handleClickLinkCode = () => linkCgPlanDialogRef.value.openLinkCodeDialog()
// 获取选择的采购申请
const getSelectedCgPlan = (selectionRows: any) => {
const getSelectedLinkCode = (selectionRows: any) => {
console.log("被选择的关联数据", selectionRows)
baseDataForm.linkCode = selectionRows.code
state.editableTableData = selectionRows.items
state.erpSpuItemsMemo = selectionRows.items
state.linkCgCodeDialogVisible = false
state.linkCgPlanDialogVisible = false
}
// 顶部表格行新增
+4 -3
View File
@@ -6,9 +6,10 @@
placeholder="请输入部门名称"
:show-expand="true"
@getSelectNode="handleGetSelectNode"
switch-inactive-text="当前部门"
switch-active-text="当前部门及子部门"
switch-inactive-text="包含"
switch-active-text="不包含"
:defaultTreeWidth="20"
:nodeClickable="false"
>
<template #default>
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
@@ -213,7 +214,7 @@ const handleDelete = async (ids: string[]) => {
const handleGetSelectNode = (curClickedNode: any, checkedTreeNodes: any, isDeepTree: any) => {
state.queryForm.deptId = curClickedNode.id
state.queryForm.deptIds = checkedTreeNodes.map((item: any) => item.id)
state.queryForm.isDeepDept = isDeepTree
state.queryForm.isInclude = isDeepTree
getDataList()
}
</script>
+4 -3
View File
@@ -6,9 +6,10 @@
placeholder="请输入部门名称"
:show-expand="true"
@getSelectNode="handleGetSelectNode"
switch-inactive-text="当前部门"
switch-active-text="当前部门及子部门"
switch-inactive-text="包含"
switch-active-text="不包含"
:defaultTreeWidth="20"
:nodeClickable="false"
>
<template #default>
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
@@ -226,7 +227,7 @@ const handleDelete = async (ids: string[]) => {
const handleGetSelectNode = (curClickedNode: any, checkedTreeNodes: any, isDeepTree: any) => {
state.queryForm.deptId = curClickedNode.id
state.queryForm.deptIds = checkedTreeNodes.map((item: any) => item.id)
state.queryForm.isDeepDept = isDeepTree
state.queryForm.isInclude = isDeepTree
getDataList()
}
</script>
+4 -3
View File
@@ -6,9 +6,10 @@
placeholder="请输入部门名称"
:show-expand="true"
@getSelectNode="handleGetSelectNode"
switch-inactive-text="当前部门"
switch-active-text="当前部门及子部门"
switch-inactive-text="包含"
switch-active-text="不包含"
:defaultTreeWidth="20"
:nodeClickable="false"
>
<template #default>
<el-form ref="queryRef" :inline="true" :model="state.queryForm" @keyup.enter="getDataList">
@@ -221,7 +222,7 @@ const handleDelete = async (ids: string[]) => {
const handleGetSelectNode = (curClickedNode: any, checkedTreeNodes: any, isDeepTree: any) => {
state.queryForm.deptId = curClickedNode.id
state.queryForm.deptIds = checkedTreeNodes.map((item: any) => item.id)
state.queryForm.isDeepDept = isDeepTree
state.queryForm.isInclude = isDeepTree
getDataList()
}
</script>