采购管理和零售管理相关的详情查看和打印预览

This commit is contained in:
weiwei committed 2025-03-25 16:03:47 +08:00
1 parent fe3054d814
commit 2a21372bee
18 files changed
+823 -209

No files matched your search

-9
View File
@@ -1,14 +1,5 @@
import request from "/@/utils/request"
// 获取库存盘点列表
export function getStockTakingPage(params?: object) {
return request({
url: "/supermarket/smErpInventoryRecords/savePD",
method: "get",
params,
})
}
// 库存盘点新增
export function stockTakingAdd(data?: object) {
return request({
+6 -6
View File
@@ -2,24 +2,24 @@ import { defineStore } from "pinia"
export const usePurchase = defineStore("purchase", {
state: () => ({
smErpCgPlan: {
purchaseFormState: {
id: "",
disabled: false,
},
}),
actions: {
setSmErpCgPlanId(id: string) {
this.smErpCgPlan.id = id
setPurchaseFormId(id: string) {
this.purchaseFormState.id = id
},
setSmErpCgPlanDisabled(disabled: boolean) {
this.smErpCgPlan.disabled = disabled
setPurchaseFormDisabled(disabled: boolean) {
this.purchaseFormState.disabled = disabled
},
},
persist: {
enabled: true,
strategies: [
{
key: "smErpCgPlan", //自定义 Key值
key: "purchaseFormState", //自定义 Key值
storage: localStorage, // 选择存储方式
},
],
@@ -1,13 +1,13 @@
<template>
<div class="layout-padding">
<div v-loading="loading" class="layout-padding-auto layout-padding-view" style="overflow: scroll">
<el-form ref="baseDataFormRef" :model="baseDataForm" :rules="dataRules" label-width="100px">
<div v-loading="loading" :element-loading-svg="svg" element-loading-svg-view-box="-10, -10, 50, 50" class="layout-padding">
<div v-if="baseDataForm.inventoryCode" class="layout-padding-auto layout-padding-view" style="overflow: scroll">
<el-form v-if="!disabled" ref="baseDataFormRef" :model="baseDataForm" :rules="dataRules" label-width="100px">
<div class="flex flex-wrap">
<el-form-item label="单据编号" prop="inventoryCode">
<el-input v-model.trim="baseDataForm.inventoryCode" readonly style="width: 200px" />
<el-input v-model.trim="baseDataForm.inventoryCode" readonly style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="单据日期" prop="inventoryDate">
<el-input v-model.trim="baseDataForm.inventoryDate" readonly style="width: 200px" />
<el-input v-model.trim="baseDataForm.inventoryDate" readonly style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="关联入库单" prop="linkCode">
<el-input
@@ -17,21 +17,59 @@
readonly
placeholder="请选择采购入库单"
style="width: 200px"
:disabled="disabled"
/>
</el-form-item>
<el-form-item label="经办人" prop="handlerUserId">
<SelectHandlerUser v-model.trim="baseDataForm.handlerUserId" placeholder="请选择经办人" style="width: 200px" />
<SelectHandlerUser
v-model.trim="baseDataForm.handlerUserId"
placeholder="请选择经办人"
style="width: 200px"
:disabled="disabled"
/>
</el-form-item>
<el-form-item label="货商" prop="supplierId">
<select-supplier v-model="baseDataForm.supplierId" style="width: 200px" />
<select-supplier v-model="baseDataForm.supplierId" style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model.trim="baseDataForm.remark" placeholder="请输入备注" style="width: 200px" />
<el-input v-model.trim="baseDataForm.remark" placeholder="请输入备注" style="width: 200px" :disabled="disabled" />
</el-form-item>
</div>
</el-form>
<div v-else ref="baseDataInfoRef">
<div style="margin-bottom: 8px; padding: 8px 16px; color: #606279">
<div style="display: inline-block; width: 100%">
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">单据编号:</span>
<span>{{ baseDataForm.inventoryCode }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">单据日期:</span>
<span>{{ baseDataForm.inventoryDate }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">经办人:</span>
<span>{{ baseDataForm.handlerUserId }}</span>
</div>
</div>
<div style="display: inline-block; width: 100%">
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">关联补货申请:</span>
<span>{{ baseDataForm.linkCode }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">货商:</span>
<span>{{ baseDataForm.supplierId }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">备注:</span>
<span>{{ baseDataForm.remark }}</span>
</div>
</div>
</div>
</div>
<el-row class="my-3">
<el-row v-if="!disabled" class="my-3">
<el-button @click="addEvent">新增(顶部)</el-button>
<el-button @click="pushEvent">新增(尾部)</el-button>
<el-button @click="insertEvent">
@@ -62,11 +100,12 @@
:edit-config="{
trigger: 'click',
mode: 'cell',
beforeEditMethod({ row, column }:any) {
beforeEditMethod({ row, column, rowIndex }:any) {
// 禁止编辑
if (column.property === '') {
return false
}
// if (column.property === '') {
// return false
// }
if(disabled) return false
return true
},
}"
@@ -139,14 +178,17 @@
<el-row class="my-3">
<el-tooltip effect="dark" content="返回列表页面" placement="top">
<el-button type="primary" plain @click="router.back()">取消</el-button>
<el-button type="primary" plain @click="router.back()">{{ disabled ? "返回" : "取消" }}</el-button>
</el-tooltip>
<el-tooltip v-if="!baseDataForm.id" effect="dark" content="保存并清空数据" placement="top">
<el-button type="primary" plain @click="onContinueAdd">继续添加</el-button>
</el-tooltip>
<el-tooltip effect="dark" content="保存并返回列表页面" placement="top">
<el-tooltip v-if="!disabled" effect="dark" content="保存并返回列表页面" placement="top">
<el-button type="primary" plain @click="onSave">保存</el-button>
</el-tooltip>
<el-tooltip v-if="disabled" effect="dark" content="打印清单" placement="top">
<el-button type="success" plain @click="printEvent">打印</el-button>
</el-tooltip>
</el-row>
<!-- 商品选择对话框 -->
@@ -170,7 +212,7 @@
<script setup lang="ts">
import { ref, reactive, computed, onMounted } from "vue"
import { useRouter, useRoute } from "vue-router"
import { useRouter } from "vue-router"
import { useMessage } from "/@/hooks/message"
import { getObj, addObj, putObj } from "/@/api/supermarketerp/smErpInventoryRecords"
import { getPlanCode, getErpSpuSimpleAll, getCgInventoryPage } from "/@/api/supermarketerp/common"
@@ -180,14 +222,18 @@ import { Search } from "@element-plus/icons-vue"
import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectDialog.vue"
import linkCodeDialog from "/@/views/supermarketerp/components/linkCodeDialog.vue"
import { displayPrice } from "/@/utils/formatMoney"
import { usePurchase } from "/@/stores/purchase"
import { tablePrint } from "../../supermarketUtils"
const purchaseStore = usePurchase()
const router = useRouter()
const route = useRoute()
const loading = ref(false) // 采购计划加载
const disabled = ref(false)
const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
const linkCgPlanDialogRef = ref() // 关联采购申请单对话框ref
const baseDataFormRef = ref() // 基本数据表单ref
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
const baseDataInfoRef = ref() // 基本信息ref
// 基本信息表单数据
const baseDataForm = reactive<any>({
id: "",
@@ -223,6 +269,14 @@ const state = reactive<{
erpSpuSelectDialogVisible: false, // 商品选择对话框开关
linkCgPlanDialogVisible: false, // 关联采购申请单对话框开关
})
const svg = `<path class="path" d="
M 30 15
L 28 17
M 25.61 25.61
A 15 15, 0, 0, 1, 15 30
A 15 15, 0, 1, 1, 27.99 7.5
L 15 15
" style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/>`
// 基本信息表单校验规则
const dataRules = ref({
@@ -241,7 +295,9 @@ const validRules = ref<VxeTablePropTypes.EditRules<any>>({
// 初始化数据
const getInitData = async () => {
baseDataForm.id = undefined
const id = route.query.id as string
// const id = route.query.id as string
const id = purchaseStore.purchaseFormState.id
disabled.value = purchaseStore.purchaseFormState.disabled
if (id) {
loading.value = true
// 获取采购计划数据 & 获取简要商品列表
@@ -254,12 +310,14 @@ const getInitData = async () => {
state.editableTableData = cgPlanData.data.items
state.erpSpuItemsMemo = cgPlanData.data.items
}
return
}
loading.value = true
// 获取采购退货编号
const [erpSpuSimpleAll, planCode] = await Promise.allSettled([getErpSpuSimpleAll(), getPlanCode({ type: 4 })]).then((results) =>
results.map((result) => (result.status === "fulfilled" ? result.value : null)),
)
const [erpSpuSimpleAll, planCode] = await Promise.allSettled([getErpSpuSimpleAll(), getPlanCode({ type: 4 })])
.then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
.finally(() => (loading.value = false))
erpSpuSimpleAll && erpSpuSimpleAll.code === 0 && (state.erpSpuSimpleAll = erpSpuSimpleAll.data)
planCode && planCode.code === 0 && (baseDataForm.inventoryCode = planCode.data)
}
@@ -516,6 +574,11 @@ const clearData = () => {
return true
}
// 点击打印
const printEvent = () => {
tablePrint(editableTableRef.value, baseDataInfoRef.value, state.editableTableData, 23, "采购退货")
}
onMounted(() => {
getInitData()
})
@@ -87,11 +87,21 @@
<el-table-column label="操作" width="150">
<template #default="scope">
<el-button
v-if="scope.row.checkStatus == '2'"
icon="MessageBox"
text
type="success"
@click="handleClickEditInventoryRecord(scope.row)"
>
详情
</el-button>
<el-button
v-else
icon="edit-pen"
text
type="primary"
v-auth="'supermarket_smErpInventoryRecords_edit'"
@click="handleClickEditInventoryRecord(scope.row.id)"
@click="handleClickEditInventoryRecord(scope.row)"
>
编辑
</el-button>
@@ -118,6 +128,7 @@ import { BasicTableProps, useTable } from "/@/hooks/table"
import { fetchList, delObjs } from "/@/api/supermarketerp/smErpInventoryRecords"
import { useMessage, useMessageBox } from "/@/hooks/message"
import { useDict } from "/@/hooks/dict"
import { usePurchase } from "/@/stores/purchase"
const router = useRouter()
const { check_status } = useDict("check_status")
@@ -134,6 +145,7 @@ const state: BasicTableProps = reactive<BasicTableProps>({
},
pageList: fetchList,
})
const purchaseStore = usePurchase()
// table hook
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
@@ -159,10 +171,21 @@ const selectionChangHandle = (objs: { id: string }[]) => {
}
// 点击创建出库入库记录表
const handleClickCreateInventoryRecord = () => router.push({ path: "/supermarketerp/purchaseManagement/smErpCgBack/form" })
const handleClickCreateInventoryRecord = () => {
purchaseStore.setPurchaseFormId("")
purchaseStore.setPurchaseFormDisabled(false)
router.push({ path: "/supermarketerp/purchaseManagement/smErpCgBack/form" })
}
// 点击编辑出库入库记录表
const handleClickEditInventoryRecord = (id: string) =>
router.push({ path: "/supermarketerp/purchaseManagement/smErpCgBack/form", query: { id } })
const handleClickEditInventoryRecord = (row: any) => {
row.id ? purchaseStore.setPurchaseFormId(row.id) : useMessage().warning("清单id不存在")
if (row.checkStatus == 2) {
purchaseStore.setPurchaseFormDisabled(true)
} else {
purchaseStore.setPurchaseFormDisabled(false)
}
router.push({ path: "/supermarketerp/purchaseManagement/smErpCgBack/form" })
}
// 删除操作
const handleDelete = async (ids: string[]) => {
@@ -1,16 +1,21 @@
<template>
<div class="layout-padding">
<div v-loading="loading" class="layout-padding-auto layout-padding-view" style="overflow: scroll">
<el-form ref="baseDataFormRef" :model="baseDataForm" :rules="dataRules" label-width="100px">
<div v-loading="loading" :element-loading-svg="svg" element-loading-svg-view-box="-10, -10, 50, 50" class="layout-padding">
<div v-if="baseDataForm.code" class="layout-padding-auto layout-padding-view" style="overflow: scroll">
<el-form v-if="!disabled" ref="baseDataFormRef" :model="baseDataForm" :rules="dataRules" label-width="100px">
<div class="flex flex-wrap">
<el-form-item label="编号" prop="code">
<el-input v-model="baseDataForm.code" readonly style="width: 200px" />
<el-input v-model="baseDataForm.code" readonly style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="单据日期" prop="dDate">
<el-input v-model="baseDataForm.ddDate" readonly style="width: 200px" />
<el-input v-model="baseDataForm.ddDate" readonly style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="经办人" prop="handlerUserId">
<SelectHandlerUser v-model.trim="baseDataForm.handlerUserId" placeholder="请选择经办人" style="width: 200px" />
<SelectHandlerUser
v-model.trim="baseDataForm.handlerUserId"
placeholder="请选择经办人"
style="width: 200px"
:disabled="disabled"
/>
</el-form-item>
<el-form-item label="关联补货申请" prop="linkCode">
<el-input
@@ -20,18 +25,51 @@
readonly
placeholder="请选择补货申请单"
style="width: 200px"
:disabled="disabled"
/>
</el-form-item>
<el-form-item label="货商" prop="supplierId">
<select-supplier v-model="baseDataForm.supplierId" style="width: 200px" />
<select-supplier v-model="baseDataForm.supplierId" style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="baseDataForm.remark" placeholder="请输入备注" style="width: 200px" />
<el-input v-model="baseDataForm.remark" placeholder="请输入备注" style="width: 200px" :disabled="disabled" />
</el-form-item>
</div>
</el-form>
<div v-else ref="baseDataInfoRef">
<div style="margin-bottom: 8px; padding: 8px 16px; color: #606279">
<div style="display: inline-block; width: 100%">
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">编号:</span>
<span>{{ baseDataForm.code }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">单据日期:</span>
<span>{{ baseDataForm.ddDate }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">经办人:</span>
<span>{{ baseDataForm.handlerUserId }}</span>
</div>
</div>
<div style="display: inline-block; width: 100%">
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">关联补货申请:</span>
<span>{{ baseDataForm.linkCode }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">货商:</span>
<span>{{ baseDataForm.supplierId }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">备注:</span>
<span>{{ baseDataForm.remark }}</span>
</div>
</div>
</div>
</div>
<el-row class="my-3">
<el-row v-if="!disabled" class="my-3">
<el-button @click="addEvent">新增(顶部)</el-button>
<el-button @click="pushEvent">新增(尾部)</el-button>
<el-button @click="insertEvent">
@@ -62,11 +100,12 @@
:edit-config="{
trigger: 'click',
mode: 'cell',
beforeEditMethod({ row, column }:any) {
beforeEditMethod({ row, column, rowIndex }:any) {
// 禁止编辑
if (column.property === '') {
return false
}
// if (column.property === '') {
// return false
// }
if(disabled) return false
return true
},
}"
@@ -139,14 +178,17 @@
<el-row class="my-3">
<el-tooltip effect="dark" content="返回列表页面" placement="top">
<el-button type="primary" plain @click="router.back()">取消</el-button>
<el-button type="primary" plain @click="router.back()">{{ disabled ? "返回" : "取消" }}</el-button>
</el-tooltip>
<el-tooltip v-if="!baseDataForm.id" effect="dark" content="保存并清空数据" placement="top">
<el-button type="primary" plain @click="onContinueAdd">继续添加</el-button>
</el-tooltip>
<el-tooltip effect="dark" content="保存并返回列表页面" placement="top">
<el-tooltip v-if="!disabled" effect="dark" content="保存并返回列表页面" placement="top">
<el-button type="primary" plain @click="onSave">保存</el-button>
</el-tooltip>
<el-tooltip v-if="disabled" effect="dark" content="打印清单" placement="top">
<el-button type="success" plain @click="printEvent">打印</el-button>
</el-tooltip>
</el-row>
<!-- 商品选择对话框 -->
@@ -170,7 +212,7 @@
<script setup lang="ts" name="smErpCgDd">
import { ref, reactive, computed, onMounted } from "vue"
import { useRouter, useRoute } from "vue-router"
import { useRouter } from "vue-router"
import { useMessage } from "/@/hooks/message"
import { getObj, addObj, putObj } from "/@/api/supermarketerp/smErpCgDd"
import { getPlanCode, getErpSpuSimpleAll, getCgsqPage } from "/@/api/supermarketerp/common"
@@ -180,14 +222,18 @@ import { Search } from "@element-plus/icons-vue"
import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectDialog.vue"
import linkCodeDialog from "/@/views/supermarketerp/components/linkCodeDialog.vue"
import { displayPrice } from "/@/utils/formatMoney"
import { usePurchase } from "/@/stores/purchase"
import { tablePrint } from "../../supermarketUtils"
const purchaseStore = usePurchase()
const router = useRouter()
const route = useRoute()
const loading = ref(false) // 采购计划加载
const disabled = ref(false)
const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
const linkCgPlanDialogRef = ref() // 关联采购申请单对话框ref
const baseDataFormRef = ref() // 基本数据表单ref
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
const baseDataInfoRef = ref() // 基本信息ref
// 基本信息表单数据
const baseDataForm = reactive<any>({
id: "",
@@ -223,6 +269,14 @@ const state = reactive<{
erpSpuSelectDialogVisible: false, // 商品选择对话框开关
linkCgPlanDialogVisible: false, // 关联采购申请单对话框开关
})
const svg = `<path class="path" d="
M 30 15
L 28 17
M 25.61 25.61
A 15 15, 0, 0, 1, 15 30
A 15 15, 0, 1, 1, 27.99 7.5
L 15 15
" style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/>`
// 基本信息表单校验规则
const dataRules = ref({
@@ -241,7 +295,9 @@ const validRules = ref<VxeTablePropTypes.EditRules<any>>({
// 初始化数据
const getInitData = async () => {
baseDataForm.id = undefined
const id = route.query.id as string
// const id = route.query.id as string
const id = purchaseStore.purchaseFormState.id
disabled.value = purchaseStore.purchaseFormState.disabled
if (id) {
loading.value = true
// 获取采购计划数据 & 获取简要商品列表
@@ -254,12 +310,14 @@ const getInitData = async () => {
state.editableTableData = cgPlanData.data.items
state.erpSpuItemsMemo = cgPlanData.data.items
}
return
}
loading.value = true
// 获取采购订单编号
const [erpSpuSimpleAll, planCode] = await Promise.allSettled([getErpSpuSimpleAll(), getPlanCode({ type: 2 })]).then((results) =>
results.map((result) => (result.status === "fulfilled" ? result.value : null)),
)
const [erpSpuSimpleAll, planCode] = await Promise.allSettled([getErpSpuSimpleAll(), getPlanCode({ type: 2 })])
.then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
.finally(() => (loading.value = false))
erpSpuSimpleAll && erpSpuSimpleAll.code === 0 && (state.erpSpuSimpleAll = erpSpuSimpleAll.data)
planCode && planCode.code === 0 && (baseDataForm.code = planCode.data)
}
@@ -516,6 +574,11 @@ const clearData = () => {
return true
}
// 点击打印
const printEvent = () => {
tablePrint(editableTableRef.value, baseDataInfoRef.value, state.editableTableData, 23, "采购订单")
}
onMounted(() => {
getInitData()
})
@@ -42,22 +42,26 @@
<el-table-column prop="ddDate" label="单据日期" show-overflow-tooltip />
<el-table-column prop="productName" label="商品信息" show-overflow-tooltip />
<el-table-column prop="handlerUserName" label="经办人" show-overflow-tooltip />
<el-table-column prop="checkStatus" label="审批状态" show-overflow-tooltip>
<template #default="scope">
<dict-tag :options="check_status" :value="scope.row.checkStatus" />
</template>
</el-table-column>
<el-table-column prop="checkStatus" label="审批状态" show-overflow-tooltip>
<template #default="scope">
<dict-tag :options="check_status" :value="scope.row.checkStatus" />
</template>
</el-table-column>
<!-- <el-table-column prop="totalAmount" label="金额合计" show-overflow-tooltip /> -->
<el-table-column prop="supplierId" label="货商" show-overflow-tooltip />
<el-table-column prop="remark" label="备注" show-overflow-tooltip />
<el-table-column label="操作" width="150">
<template #default="scope">
<el-button v-if="scope.row.checkStatus == '2'" icon="MessageBox" text type="success" @click="handleClickEditCgPlan(scope.row)">
详情
</el-button>
<el-button
v-else
icon="edit-pen"
text
type="primary"
v-auth="'supermarket_smErpCgDd_edit'"
@click="handleClickEditCgPlan(scope.row.id)"
@click="handleClickEditCgPlan(scope.row)"
>
编辑
</el-button>
@@ -78,6 +82,7 @@ import { BasicTableProps, useTable } from "/@/hooks/table"
import { fetchList, delObjs } from "/@/api/supermarketerp/smErpCgDd"
import { useMessage, useMessageBox } from "/@/hooks/message"
import { useDict } from "/@/hooks/dict"
import { usePurchase } from "/@/stores/purchase"
const router = useRouter()
const { check_status } = useDict("check_status")
@@ -85,6 +90,7 @@ const showSearch = ref(true)
// 多选变量
const selectObjs = ref([]) as any
const multiple = ref(true)
const purchaseStore = usePurchase()
const state: BasicTableProps = reactive<BasicTableProps>({
queryForm: {},
@@ -115,9 +121,21 @@ const selectionChangHandle = (objs: { id: string }[]) => {
}
// 点击创建采购清单
const handleClickCreateCgPlan = () => router.push({ path: "/supermarketerp/purchaseManagement/smErpCgDd/form" })
const handleClickCreateCgPlan = () => {
purchaseStore.setPurchaseFormId("")
purchaseStore.setPurchaseFormDisabled(false)
router.push({ path: "/supermarketerp/purchaseManagement/smErpCgDd/form" })
}
// 点击编辑采购清单
const handleClickEditCgPlan = (id: string) => router.push({ path: "/supermarketerp/purchaseManagement/smErpCgDd/form", query: { id } })
const handleClickEditCgPlan = (row: any) => {
row.id ? purchaseStore.setPurchaseFormId(row.id) : useMessage().warning("清单id不存在")
if (row.checkStatus == 2) {
purchaseStore.setPurchaseFormDisabled(true)
} else {
purchaseStore.setPurchaseFormDisabled(false)
}
router.push({ path: "/supermarketerp/purchaseManagement/smErpCgDd/form" })
}
// 删除操作
const handleDelete = async (ids: string[]) => {
@@ -1,13 +1,13 @@
<template>
<div class="layout-padding">
<div v-loading="loading" class="layout-padding-auto layout-padding-view" style="overflow: scroll">
<el-form ref="baseDataFormRef" :model="baseDataForm" :rules="dataRules" label-width="100px">
<div v-loading="loading" :element-loading-svg="svg" element-loading-svg-view-box="-10, -10, 50, 50" class="layout-padding">
<div v-if="baseDataForm.inventoryCode" class="layout-padding-auto layout-padding-view" style="overflow: scroll">
<el-form v-if="!disabled" ref="baseDataFormRef" :model="baseDataForm" :rules="dataRules" label-width="100px">
<div class="flex flex-wrap">
<el-form-item label="单据编号" prop="inventoryCode">
<el-input v-model.trim="baseDataForm.inventoryCode" readonly style="width: 200px" />
<el-input v-model.trim="baseDataForm.inventoryCode" readonly style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="单据日期" prop="inventoryDate">
<el-input v-model.trim="baseDataForm.inventoryDate" readonly style="width: 200px" />
<el-input v-model.trim="baseDataForm.inventoryDate" readonly style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="关联采购订单" prop="linkCode">
<el-input
@@ -17,21 +17,59 @@
readonly
placeholder="请选择采购订单"
style="width: 200px"
:disabled="disabled"
/>
</el-form-item>
<el-form-item label="经办人" prop="handlerUserId">
<SelectHandlerUser v-model.trim="baseDataForm.handlerUserId" placeholder="请选择经办人" style="width: 200px" />
<SelectHandlerUser
v-model.trim="baseDataForm.handlerUserId"
placeholder="请选择经办人"
style="width: 200px"
:disabled="disabled"
/>
</el-form-item>
<el-form-item label="货商" prop="supplierId">
<select-supplier v-model="baseDataForm.supplierId" style="width: 200px" />
<select-supplier v-model="baseDataForm.supplierId" style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model.trim="baseDataForm.remark" placeholder="请输入备注" style="width: 200px" />
<el-input v-model.trim="baseDataForm.remark" placeholder="请输入备注" style="width: 200px" :disabled="disabled" />
</el-form-item>
</div>
</el-form>
<div v-else ref="baseDataInfoRef">
<div style="margin-bottom: 8px; padding: 8px 16px; color: #606279">
<div style="display: inline-block; width: 100%">
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">单据编号:</span>
<span>{{ baseDataForm.inventoryCode }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">单据日期:</span>
<span>{{ baseDataForm.inventoryDate }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">经办人:</span>
<span>{{ baseDataForm.handlerUserId }}</span>
</div>
</div>
<div style="display: inline-block; width: 100%">
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">关联补货申请:</span>
<span>{{ baseDataForm.linkCode }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">货商:</span>
<span>{{ baseDataForm.supplierId }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">备注:</span>
<span>{{ baseDataForm.remark }}</span>
</div>
</div>
</div>
</div>
<el-row class="my-3">
<el-row v-if="!disabled" class="my-3">
<el-button @click="addEvent">新增(顶部)</el-button>
<el-button @click="pushEvent">新增(尾部)</el-button>
<el-button @click="insertEvent">
@@ -62,11 +100,12 @@
:edit-config="{
trigger: 'click',
mode: 'cell',
beforeEditMethod({ row, column }:any) {
beforeEditMethod({ row, column, rowIndex }:any) {
// 禁止编辑
if (column.property === '') {
return false
}
// if (column.property === '') {
// return false
// }
if(disabled) return false
return true
},
}"
@@ -139,14 +178,17 @@
<el-row class="my-3">
<el-tooltip effect="dark" content="返回列表页面" placement="top">
<el-button type="primary" plain @click="router.back()">取消</el-button>
<el-button type="primary" plain @click="router.back()">{{ disabled ? "返回" : "取消" }}</el-button>
</el-tooltip>
<el-tooltip v-if="!baseDataForm.id" effect="dark" content="保存并清空数据" placement="top">
<el-button type="primary" plain @click="onContinueAdd">继续添加</el-button>
</el-tooltip>
<el-tooltip effect="dark" content="保存并返回列表页面" placement="top">
<el-tooltip v-if="!disabled" effect="dark" content="保存并返回列表页面" placement="top">
<el-button type="primary" plain @click="onSave">保存</el-button>
</el-tooltip>
<el-tooltip v-if="disabled" effect="dark" content="打印清单" placement="top">
<el-button type="success" plain @click="printEvent">打印</el-button>
</el-tooltip>
</el-row>
<!-- 商品选择对话框 -->
@@ -170,7 +212,7 @@
<script setup lang="ts">
import { ref, reactive, computed, onMounted } from "vue"
import { useRouter, useRoute } from "vue-router"
import { useRouter } from "vue-router"
import { useMessage } from "/@/hooks/message"
import { getObj, addObj, putObj } from "/@/api/supermarketerp/smErpInventoryRecords"
import { getPlanCode, getErpSpuSimpleAll, getCgddPage } from "/@/api/supermarketerp/common"
@@ -180,16 +222,18 @@ import { Search } from "@element-plus/icons-vue"
import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectDialog.vue"
import linkCodeDialog from "/@/views/supermarketerp/components/linkCodeDialog.vue"
import { displayPrice } from "/@/utils/formatMoney"
import { useDict } from "/@/hooks/dict"
import { usePurchase } from "/@/stores/purchase"
import { tablePrint } from "../../supermarketUtils"
const purchaseStore = usePurchase()
const router = useRouter()
const route = useRoute()
const loading = ref(false) // 采购计划加载
const disabled = ref(false)
const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
const linkCgPlanDialogRef = ref() // 关联采购申请单对话框ref
const baseDataFormRef = ref() // 基本数据表单ref
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
const { check_status } = useDict("check_status")
const baseDataInfoRef = ref() // 基本信息ref
// 基本信息表单数据
const baseDataForm = reactive<any>({
id: "",
@@ -225,6 +269,14 @@ const state = reactive<{
erpSpuSelectDialogVisible: false, // 商品选择对话框开关
linkCgPlanDialogVisible: false, // 关联采购申请单对话框开关
})
const svg = `<path class="path" d="
M 30 15
L 28 17
M 25.61 25.61
A 15 15, 0, 0, 1, 15 30
A 15 15, 0, 1, 1, 27.99 7.5
L 15 15
" style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/>`
// 基本信息表单校验规则
const dataRules = ref({
@@ -243,7 +295,9 @@ const validRules = ref<VxeTablePropTypes.EditRules<any>>({
// 初始化数据
const getInitData = async () => {
baseDataForm.id = undefined
const id = route.query.id as string
// const id = route.query.id as string
const id = purchaseStore.purchaseFormState.id
disabled.value = purchaseStore.purchaseFormState.disabled
if (id) {
loading.value = true
// 获取采购计划数据 & 获取简要商品列表
@@ -256,12 +310,14 @@ const getInitData = async () => {
state.editableTableData = cgPlanData.data.items
state.erpSpuItemsMemo = cgPlanData.data.items
}
return
}
loading.value = true
// 获取采购入库编号
const [erpSpuSimpleAll, planCode] = await Promise.allSettled([getErpSpuSimpleAll(), getPlanCode({ type: 3 })]).then((results) =>
results.map((result) => (result.status === "fulfilled" ? result.value : null)),
)
const [erpSpuSimpleAll, planCode] = await Promise.allSettled([getErpSpuSimpleAll(), getPlanCode({ type: 3 })])
.then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
.finally(() => (loading.value = false))
erpSpuSimpleAll && erpSpuSimpleAll.code === 0 && (state.erpSpuSimpleAll = erpSpuSimpleAll.data)
planCode && planCode.code === 0 && (baseDataForm.inventoryCode = planCode.data)
}
@@ -518,6 +574,11 @@ const clearData = () => {
return true
}
// 点击打印
const printEvent = () => {
tablePrint(editableTableRef.value, baseDataInfoRef.value, state.editableTableData, 23, "采购入库")
}
onMounted(() => {
getInitData()
})
@@ -87,15 +87,26 @@
<el-table-column label="操作" width="150">
<template #default="scope">
<el-button
v-if="scope.row.checkStatus == '2'"
icon="MessageBox"
text
type="success"
@click="handleClickEditInventoryRecord(scope.row)"
>
详情
</el-button>
<el-button
v-else
icon="edit-pen"
text
type="primary"
v-auth="'supermarket_smErpInventoryRecords_edit'"
@click="handleClickEditInventoryRecord(scope.row.id)"
@click="handleClickEditInventoryRecord(scope.row)"
>
编辑
</el-button>
<el-button
v-else
icon="delete"
text
type="primary"
@@ -118,9 +129,10 @@ import { BasicTableProps, useTable } from "/@/hooks/table"
import { fetchList, delObjs } from "/@/api/supermarketerp/smErpInventoryRecords"
import { useMessage, useMessageBox } from "/@/hooks/message"
import { useDict } from "/@/hooks/dict"
import { usePurchase } from "/@/stores/purchase"
const router = useRouter()
const { erp_order_type, inventory_type, check_status } = useDict("erp_order_type", "inventory_type", "check_status")
const { check_status } = useDict("check_status")
// 搜索变量
const queryRef = ref()
const showSearch = ref(true)
@@ -134,6 +146,7 @@ const state: BasicTableProps = reactive<BasicTableProps>({
},
pageList: fetchList,
})
const purchaseStore = usePurchase()
// table hook
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
@@ -159,10 +172,21 @@ const selectionChangHandle = (objs: { id: string }[]) => {
}
// 点击创建出库入库记录表
const handleClickCreateInventoryRecord = () => router.push({ path: "/supermarketerp/purchaseManagement/smErpCgInventory/form" })
const handleClickCreateInventoryRecord = () => {
purchaseStore.setPurchaseFormId("")
purchaseStore.setPurchaseFormDisabled(false)
router.push({ path: "/supermarketerp/purchaseManagement/smErpCgInventory/form" })
}
// 点击编辑出库入库记录表
const handleClickEditInventoryRecord = (id: string) =>
router.push({ path: "/supermarketerp/purchaseManagement/smErpCgInventory/form", query: { id } })
const handleClickEditInventoryRecord = (row: any) => {
row.id ? purchaseStore.setPurchaseFormId(row.id) : useMessage().warning("清单id不存在")
if (row.checkStatus == 2) {
purchaseStore.setPurchaseFormDisabled(true)
} else {
purchaseStore.setPurchaseFormDisabled(false)
}
router.push({ path: "/supermarketerp/purchaseManagement/smErpCgInventory/form" })
}
// 删除操作
const handleDelete = async (ids: string[]) => {
@@ -1,24 +1,59 @@
<template>
<div class="layout-padding">
<div v-loading="loading" class="layout-padding-auto layout-padding-view" style="overflow: scroll">
<el-form ref="baseDataFormRef" :model="baseDataForm" :rules="dataRules" label-width="100px">
<div v-loading="loading" :element-loading-svg="svg" element-loading-svg-view-box="-10, -10, 50, 50" class="layout-padding">
<div v-if="baseDataForm.planCode" class="layout-padding-auto layout-padding-view" style="overflow: scroll">
<el-form v-if="!disabled" ref="baseDataFormRef" :model="baseDataForm" :rules="dataRules" label-width="100px">
<div class="flex flex-wrap">
<el-form-item label="编号" prop="planCode">
<el-input v-model="baseDataForm.planCode" readonly style="width: 200px" />
<el-input v-model="baseDataForm.planCode" readonly style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="单据日期" prop="planDate">
<el-input v-model="baseDataForm.planDate" readonly style="width: 200px" />
<el-input v-model="baseDataForm.planDate" readonly style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="经办人" prop="handlerUserId">
<SelectHandlerUser v-model.trim="baseDataForm.handlerUserId" placeholder="请选择经办人" style="width: 200px" />
<SelectHandlerUser
v-model.trim="baseDataForm.handlerUserId"
placeholder="请选择经办人"
style="width: 200px"
:disabled="disabled"
/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model.trim="baseDataForm.remark" placeholder="请输入备注" maxlength="200" style="width: 200px" />
<el-input
v-model.trim="baseDataForm.remark"
placeholder="请输入备注"
maxlength="200"
style="width: 200px"
:disabled="disabled"
/>
</el-form-item>
</div>
</el-form>
<div v-else ref="baseDataInfoRef">
<div style="margin-bottom: 8px; padding: 8px 16px; color: #606279">
<div style="display: inline-block; width: 100%">
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">编号:</span>
<span>{{ baseDataForm.planCode }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">单据日期:</span>
<span>{{ baseDataForm.planDate }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">经办人:</span>
<span>{{ baseDataForm.handlerUserId }}</span>
</div>
</div>
<div style="display: inline-block; width: 100%">
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">备注:</span>
<span>{{ baseDataForm.remark }}</span>
</div>
</div>
</div>
</div>
<el-row class="my-3">
<el-row v-if="!disabled" class="my-3">
<el-button @click="addEvent">新增(顶部)</el-button>
<el-button @click="pushEvent">新增(尾部)</el-button>
<el-button @click="insertEvent">
@@ -49,11 +84,12 @@
:edit-config="{
trigger: 'click',
mode: 'cell',
beforeEditMethod({ row, column }:any) {
beforeEditMethod({ row, column, rowIndex }:any) {
// 禁止编辑
if (column.property === '') {
return false
}
// if (column.property === '') {
// return false
// }
if(disabled) return false
return true
},
}"
@@ -77,7 +113,7 @@
<vxe-column field="productName" title="库存商品">
<template #default="{ row }">
<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>
</vxe-column>
<vxe-column field="unitId" title="包装单位" :edit-render="{}">
@@ -135,14 +171,17 @@
<el-row class="my-3">
<el-tooltip effect="dark" content="返回列表页面" placement="top">
<el-button type="primary" plain @click="router.back()">取消</el-button>
<el-button type="primary" plain @click="router.back()">{{ disabled ? "返回" : "取消" }}</el-button>
</el-tooltip>
<el-tooltip v-if="!baseDataForm.id" effect="dark" content="保存并清空数据" placement="top">
<el-button type="primary" plain @click="onContinueAdd">继续添加</el-button>
</el-tooltip>
<el-tooltip effect="dark" content="保存并返回列表页面" placement="top">
<el-tooltip v-if="!disabled" effect="dark" content="保存并返回列表页面" placement="top">
<el-button type="primary" plain @click="onSave">保存</el-button>
</el-tooltip>
<el-tooltip v-if="disabled" effect="dark" content="打印清单" placement="top">
<el-button type="success" plain @click="printEvent">打印</el-button>
</el-tooltip>
</el-row>
<!-- 商品选择对话框 -->
@@ -158,7 +197,7 @@
<script setup lang="ts">
import { ref, reactive, computed, onMounted } from "vue"
import { useRouter, useRoute } from "vue-router"
import { useRouter } from "vue-router"
import { useMessage } from "/@/hooks/message"
import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
import { getObj, addObj, putObj } from "/@/api/supermarketerp/smErpCgPlan"
@@ -166,14 +205,16 @@ import { getPlanCode, getErpSpuSimpleAll } from "/@/api/supermarketerp/common"
import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectDialog.vue"
import { formatDate } from "/@/utils/formatTime"
import { usePurchase } from "/@/stores/purchase"
import { tablePrint } from "../../supermarketUtils"
const purchaseStore = usePurchase()
const router = useRouter()
const route = useRoute()
const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
const loading = ref(false) // 采购计划加载
const disabled = ref(false)
const baseDataFormRef = ref() // 基本数据表单ref
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
const baseDataInfoRef = ref() // 基本信息ref
// 基本信息表单数据
const baseDataForm = reactive<any>({
id: undefined,
@@ -197,6 +238,14 @@ const state = reactive<{
erpSpuSimpleAll: [], // 简要商品列表
erpSpuSelectDialogVisible: false, // 商品选择对话框开关
})
const svg = `<path class="path" d="
M 30 15
L 28 17
M 25.61 25.61
A 15 15, 0, 0, 1, 15 30
A 15 15, 0, 1, 1, 27.99 7.5
L 15 15
" style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/>`
// 基本信息表单校验规则
const dataRules = ref({
@@ -215,7 +264,8 @@ const validRules = ref<VxeTablePropTypes.EditRules<any>>({
const getInitData = async () => {
baseDataForm.id = undefined
// const id = route.query.id as string
const id = purchaseStore.smErpCgPlan.id
const id = purchaseStore.purchaseFormState.id
disabled.value = purchaseStore.purchaseFormState.disabled
if (id) {
loading.value = true
// 获取补货申请编号 & 获取简要商品列表
@@ -229,12 +279,14 @@ const getInitData = async () => {
state.erpSpuItemsMemo = cgPlanData.data.items
}
erpSpuSimpleAll && erpSpuSimpleAll.code === 0 && (state.erpSpuSimpleAll = erpSpuSimpleAll.data)
return
}
loading.value = true
// 获取采购计划编号
const [planCode] = await Promise.allSettled([getPlanCode({ type: 1 })]).then((results) =>
results.map((result) => (result.status === "fulfilled" ? result.value : null)),
)
const [planCode] = await Promise.allSettled([getPlanCode({ type: 1 })])
.then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
.finally(() => (loading.value = false))
planCode && planCode.code === 0 && (baseDataForm.planCode = planCode.data)
}
@@ -465,6 +517,11 @@ const clearData = () => {
return true
}
// 点击打印
const printEvent = () => {
tablePrint(editableTableRef.value, baseDataInfoRef.value, state.editableTableData, 23, "补货申请")
}
onMounted(() => {
getInitData()
})
@@ -72,12 +72,16 @@
<el-table-column prop="remark" label="备注" show-overflow-tooltip />
<el-table-column label="操作" width="150">
<template #default="scope">
<el-button v-if="scope.row.checkStatus == '2'" icon="MessageBox" text type="success" @click="handleClickEditCgPlan(scope.row)">
详情
</el-button>
<el-button
v-else
icon="edit-pen"
text
type="primary"
v-auth="'supermarket_smErpCgPlan_edit'"
@click="handleClickEditCgPlan(scope.row.id)"
@click="handleClickEditCgPlan(scope.row)"
>
编辑
</el-button>
@@ -139,14 +143,18 @@ const selectionChangHandle = (objs: { id: string }[]) => {
// 点击创建采购清单
const handleClickCreateCgPlan = () => {
purchaseStore.setSmErpCgPlanId("")
purchaseStore.setSmErpCgPlanDisabled(false)
purchaseStore.setPurchaseFormId("")
purchaseStore.setPurchaseFormDisabled(false)
router.push({ path: "/supermarketerp/purchaseManagement/smErpCgPlan/form" })
}
// 点击编辑采购清单
const handleClickEditCgPlan = (id: string) => {
purchaseStore.setSmErpCgPlanId(id)
purchaseStore.setSmErpCgPlanDisabled(true)
const handleClickEditCgPlan = (row: any) => {
row.id ? purchaseStore.setPurchaseFormId(row.id) : useMessage().warning("清单id不存在")
if (row.checkStatus == 2) {
purchaseStore.setPurchaseFormDisabled(true)
} else {
purchaseStore.setPurchaseFormDisabled(false)
}
router.push({ path: "/supermarketerp/purchaseManagement/smErpCgPlan/form" })
}
@@ -1,13 +1,13 @@
<template>
<div class="layout-padding">
<div v-loading="loading" class="layout-padding-auto layout-padding-view" style="overflow: scroll">
<el-form ref="baseDataFormRef" :model="baseDataForm" :rules="dataRules" label-width="100px">
<div v-loading="loading" :element-loading-svg="svg" element-loading-svg-view-box="-10, -10, 50, 50" class="layout-padding">
<div v-if="baseDataForm.inventoryCode" class="layout-padding-auto layout-padding-view" style="overflow: scroll">
<el-form v-if="!disabled" ref="baseDataFormRef" :model="baseDataForm" :rules="dataRules" label-width="100px">
<div class="flex flex-wrap">
<el-form-item label="单据编号" prop="inventoryCode">
<el-input v-model.trim="baseDataForm.inventoryCode" readonly style="width: 200px" />
<el-input v-model.trim="baseDataForm.inventoryCode" readonly style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="单据日期" prop="inventoryDate">
<el-input v-model.trim="baseDataForm.inventoryDate" readonly style="width: 200px" />
<el-input v-model.trim="baseDataForm.inventoryDate" readonly style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="关联采购订单" prop="linkCode">
<el-input
@@ -17,29 +17,77 @@
readonly
placeholder="请选择采购订单"
style="width: 200px"
:disabled="disabled"
/>
</el-form-item>
<el-form-item label="经办人" prop="handlerUserId">
<SelectHandlerUser v-model.trim="baseDataForm.handlerUserId" placeholder="请选择经办人" style="width: 200px" />
<SelectHandlerUser
v-model.trim="baseDataForm.handlerUserId"
placeholder="请选择经办人"
style="width: 200px"
:disabled="disabled"
/>
</el-form-item>
<el-form-item label="审批状态" prop="checkStatus">
<el-select v-model="baseDataForm.checkStatus" placeholder="请选择审批状态" style="width: 200px">
<el-option :label="item.label" :value="item.value" v-for="(item, index) in check_status" :key="index" />
<el-option :label="item.label" :value="item.value" v-for="(item, index) in check_status" :key="index" :disabled="disabled" />
</el-select>
</el-form-item>
<el-form-item label="货商" prop="supplierId">
<select-supplier v-model="baseDataForm.supplierId" style="width: 200px" />
<select-supplier v-model="baseDataForm.supplierId" style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model.trim="baseDataForm.remark" placeholder="请输入备注" style="width: 200px" />
<el-input v-model.trim="baseDataForm.remark" placeholder="请输入备注" style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="会员卡号" prop="memberNumber">
<el-input v-model.trim="baseDataForm.memberNumber" placeholder="请输入会员卡号" style="width: 200px" />
<el-input v-model.trim="baseDataForm.memberNumber" placeholder="请输入会员卡号" style="width: 200px" :disabled="disabled" />
</el-form-item>
</div>
</el-form>
<div v-else ref="baseDataInfoRef">
<div style="margin-bottom: 8px; padding: 8px 16px; color: #606279">
<div style="display: inline-block; width: 100%">
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">单据编号:</span>
<span>{{ baseDataForm.inventoryCode }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">单据日期:</span>
<span>{{ baseDataForm.inventoryDate }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">经办人:</span>
<span>{{ baseDataForm.handlerUserId }}</span>
</div>
</div>
<div style="display: inline-block; width: 100%">
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">关联补货申请:</span>
<span>{{ baseDataForm.linkCode }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">货商:</span>
<span>{{ baseDataForm.supplierId }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">备注:</span>
<span>{{ baseDataForm.remark }}</span>
</div>
</div>
<div style="display: inline-block; width: 100%">
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">审批状态:</span>
<span>{{ baseDataForm.checkStatus }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">会员卡号:</span>
<span>{{ baseDataForm.memberNumber }}</span>
</div>
</div>
</div>
</div>
<el-row class="my-3">
<el-row v-if="!disabled" class="my-3">
<el-button @click="addEvent">新增(顶部)</el-button>
<el-button @click="pushEvent">新增(尾部)</el-button>
<el-button @click="insertEvent">
@@ -72,11 +120,12 @@
:edit-config="{
trigger: 'click',
mode: 'cell',
beforeEditMethod({ row, column }:any) {
beforeEditMethod({ row, column, rowIndex }:any) {
// 禁止编辑
if (column.property === '') {
return false
}
// if (column.property === '') {
// return false
// }
if(disabled) return false
return true
},
}"
@@ -173,9 +222,12 @@
<el-tooltip v-if="!baseDataForm.id" effect="dark" content="保存并清空数据" placement="top">
<el-button type="primary" plain @click="onContinueAdd">继续添加</el-button>
</el-tooltip>
<el-tooltip effect="dark" content="保存并返回列表页面" placement="top">
<el-tooltip v-if="!disabled" effect="dark" content="保存并返回列表页面" placement="top">
<el-button type="primary" plain @click="onSave">保存</el-button>
</el-tooltip>
<el-tooltip v-if="disabled" effect="dark" content="打印清单" placement="top">
<el-button type="success" plain @click="printEvent">打印</el-button>
</el-tooltip>
</el-row>
<!-- 商品选择对话框 -->
@@ -199,7 +251,7 @@
<script setup lang="ts">
import { ref, reactive, computed, onMounted } from "vue"
import { useRouter, useRoute } from "vue-router"
import { useRouter } from "vue-router"
import { useMessage } from "/@/hooks/message"
import { getObj, addObj, putObj } from "/@/api/supermarketerp/smErpInventoryRecords"
import { getPlanCode, getErpSpuSimpleAll, getCgInventoryPage } from "/@/api/supermarketerp/common"
@@ -210,15 +262,19 @@ import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectD
import linkCodeDialog from "/@/views/supermarketerp/components/linkCodeDialog.vue"
import { displayPrice, storePrice } from "/@/utils/formatMoney"
import { useDict } from "/@/hooks/dict"
import { usePurchase } from "/@/stores/purchase"
import { tablePrint } from "../../supermarketUtils"
const purchaseStore = usePurchase()
const router = useRouter()
const route = useRoute()
const loading = ref(false) // 采购计划加载
const disabled = ref(false)
const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
const linkCgPlanDialogRef = ref() // 关联采购申请单对话框ref
const baseDataFormRef = ref() // 基本数据表单ref
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
const { check_status } = useDict("check_status")
const baseDataInfoRef = ref() // 基本信息ref
// 基本信息表单数据
const baseDataForm = reactive<any>({
id: "",
@@ -255,6 +311,14 @@ const state = reactive<{
erpSpuSelectDialogVisible: false, // 商品选择对话框开关
linkCgPlanDialogVisible: false, // 关联采购申请单对话框开关
})
const svg = `<path class="path" d="
M 30 15
L 28 17
M 25.61 25.61
A 15 15, 0, 0, 1, 15 30
A 15 15, 0, 1, 1, 27.99 7.5
L 15 15
" style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/>`
// 合计金额表单数据
const receiveAmountForm = reactive<{ receiveAmount: number }>({
receiveAmount: 0,
@@ -285,7 +349,9 @@ const receiveAmountFormRules = ref({
// 初始化数据
const getInitData = async () => {
baseDataForm.id = undefined
const id = route.query.id as string
// const id = route.query.id as string
const id = purchaseStore.purchaseFormState.id
disabled.value = purchaseStore.purchaseFormState.disabled
if (id) {
loading.value = true
// 获取采购计划数据 & 获取简要商品列表
@@ -298,12 +364,14 @@ const getInitData = async () => {
state.editableTableData = cgPlanData.data.items
state.erpSpuItemsMemo = cgPlanData.data.items
}
return
}
loading.value = true
// 获取采购入库编号
const [erpSpuSimpleAll, planCode] = await Promise.allSettled([getErpSpuSimpleAll(), getPlanCode({ type: 6 })]).then((results) =>
results.map((result) => (result.status === "fulfilled" ? result.value : null)),
)
const [erpSpuSimpleAll, planCode] = await Promise.allSettled([getErpSpuSimpleAll(), getPlanCode({ type: 6 })])
.then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
.finally(() => (loading.value = false))
erpSpuSimpleAll && erpSpuSimpleAll.code === 0 && (state.erpSpuSimpleAll = erpSpuSimpleAll.data)
planCode && planCode.code === 0 && (baseDataForm.inventoryCode = planCode.data)
}
@@ -563,6 +631,11 @@ const clearData = () => {
return true
}
// 点击打印
const printEvent = () => {
tablePrint(editableTableRef.value, baseDataInfoRef.value, state.editableTableData, 23, "零售退货")
}
onMounted(() => {
getInitData()
})
@@ -87,11 +87,21 @@
<el-table-column label="操作" width="150">
<template #default="scope">
<el-button
v-if="scope.row.checkStatus == '2'"
icon="MessageBox"
text
type="success"
@click="handleClickEditInventoryRecord(scope.row)"
>
详情
</el-button>
<el-button
v-else
icon="edit-pen"
text
type="primary"
v-auth="'supermarket_smErpInventoryRecords_edit'"
@click="handleClickEditInventoryRecord(scope.row.id)"
@click="handleClickEditInventoryRecord(scope.row)"
>
编辑
</el-button>
@@ -118,6 +128,7 @@ import { BasicTableProps, useTable } from "/@/hooks/table"
import { fetchList, delObjs } from "/@/api/supermarketerp/smErpInventoryRecords"
import { useMessage, useMessageBox } from "/@/hooks/message"
import { useDict } from "/@/hooks/dict"
import { usePurchase } from "/@/stores/purchase"
const { check_status } = useDict("check_status")
const router = useRouter()
@@ -134,6 +145,7 @@ const state: BasicTableProps = reactive<BasicTableProps>({
},
pageList: fetchList,
})
const purchaseStore = usePurchase()
// table hook
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
@@ -159,10 +171,21 @@ const selectionChangHandle = (objs: { id: string }[]) => {
}
// 点击创建出库入库记录表
const handleClickCreateInventoryRecord = () => router.push({ path: "/supermarketerp/retailManagement/smErpRetailBack/form" })
const handleClickCreateInventoryRecord = () => {
purchaseStore.setPurchaseFormId("")
purchaseStore.setPurchaseFormDisabled(false)
router.push({ path: "/supermarketerp/retailManagement/smErpRetailBack/form" })
}
// 点击编辑出库入库记录表
const handleClickEditInventoryRecord = (id: string) =>
router.push({ path: "/supermarketerp/retailManagement/smErpRetailBack/form", query: { id } })
const handleClickEditInventoryRecord = (row: any) => {
row.id ? purchaseStore.setPurchaseFormId(row.id) : useMessage().warning("清单id不存在")
if (row.checkStatus == 2) {
purchaseStore.setPurchaseFormDisabled(true)
} else {
purchaseStore.setPurchaseFormDisabled(false)
}
router.push({ path: "/supermarketerp/retailManagement/smErpRetailBack/form" })
}
// 删除操作
const handleDelete = async (ids: string[]) => {
@@ -1,13 +1,13 @@
<template>
<div class="layout-padding">
<div v-loading="loading" class="layout-padding-auto layout-padding-view" style="overflow: scroll">
<el-form ref="baseDataFormRef" :model="baseDataForm" :rules="dataRules" label-width="100px">
<div v-loading="loading" :element-loading-svg="svg" element-loading-svg-view-box="-10, -10, 50, 50" class="layout-padding">
<div v-if="baseDataForm.inventoryCode" class="layout-padding-auto layout-padding-view" style="overflow: scroll">
<el-form v-if="!disabled" ref="baseDataFormRef" :model="baseDataForm" :rules="dataRules" label-width="100px">
<div class="flex flex-wrap">
<el-form-item label="单据编号" prop="inventoryCode">
<el-input v-model.trim="baseDataForm.inventoryCode" readonly style="width: 200px" />
<el-input v-model.trim="baseDataForm.inventoryCode" readonly style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="单据日期" prop="inventoryDate">
<el-input v-model.trim="baseDataForm.inventoryDate" readonly style="width: 200px" />
<el-input v-model.trim="baseDataForm.inventoryDate" readonly style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="关联采购订单" prop="linkCode">
<el-input
@@ -17,29 +17,67 @@
readonly
placeholder="请选择采购订单"
style="width: 200px"
:disabled="disabled"
/>
</el-form-item>
<el-form-item label="经办人" prop="handlerUserId">
<SelectHandlerUser v-model.trim="baseDataForm.handlerUserId" placeholder="请选择经办人" style="width: 200px" />
<SelectHandlerUser
v-model.trim="baseDataForm.handlerUserId"
placeholder="请选择经办人"
style="width: 200px"
:disabled="disabled"
/>
</el-form-item>
<el-form-item label="审批状态" prop="checkStatus">
<el-select v-model="baseDataForm.checkStatus" placeholder="请选择审批状态" style="width: 200px">
<el-option :label="item.label" :value="item.value" v-for="(item, index) in check_status" :key="index" />
<el-option :label="item.label" :value="item.value" v-for="(item, index) in check_status" :key="index" :disabled="disabled" />
</el-select>
</el-form-item>
<el-form-item label="货商" prop="supplierId">
<select-supplier v-model="baseDataForm.supplierId" style="width: 200px" />
<select-supplier v-model="baseDataForm.supplierId" style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model.trim="baseDataForm.remark" placeholder="请输入备注" style="width: 200px" />
<el-input v-model.trim="baseDataForm.remark" placeholder="请输入备注" style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="会员卡号" prop="memberNumber">
<el-input v-model.trim="baseDataForm.memberNumber" placeholder="请输入会员卡号" style="width: 200px" />
<el-input v-model.trim="baseDataForm.memberNumber" placeholder="请输入会员卡号" style="width: 200px" :disabled="disabled" />
</el-form-item>
</div>
</el-form>
<div v-else ref="baseDataInfoRef">
<div style="margin-bottom: 8px; padding: 8px 16px; color: #606279">
<div style="display: inline-block; width: 100%">
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">单据编号:</span>
<span>{{ baseDataForm.inventoryCode }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">单据日期:</span>
<span>{{ baseDataForm.inventoryDate }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">经办人:</span>
<span>{{ baseDataForm.handlerUserId }}</span>
</div>
</div>
<div style="display: inline-block; width: 100%">
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">关联补货申请:</span>
<span>{{ baseDataForm.linkCode }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">货商:</span>
<span>{{ baseDataForm.supplierId }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">备注:</span>
<span>{{ baseDataForm.remark }}</span>
</div>
</div>
</div>
</div>
<el-row class="my-3">
<el-row v-if="!disabled" class="my-3">
<el-button @click="addEvent">新增(顶部)</el-button>
<el-button @click="pushEvent">新增(尾部)</el-button>
<el-button @click="insertEvent">
@@ -72,11 +110,12 @@
:edit-config="{
trigger: 'click',
mode: 'cell',
beforeEditMethod({ row, column }:any) {
beforeEditMethod({ row, column, rowIndex }:any) {
// 禁止编辑
if (column.property === '') {
return false
}
// if (column.property === '') {
// return false
// }
if(disabled) return false
return true
},
}"
@@ -173,9 +212,12 @@
<el-tooltip v-if="!baseDataForm.id" effect="dark" content="保存并清空数据" placement="top">
<el-button type="primary" plain @click="onContinueAdd">继续添加</el-button>
</el-tooltip>
<el-tooltip effect="dark" content="保存并返回列表页面" placement="top">
<el-tooltip v-if="!disabled" effect="dark" content="保存并返回列表页面" placement="top">
<el-button type="primary" plain @click="onSave">保存</el-button>
</el-tooltip>
<el-tooltip v-if="disabled" effect="dark" content="打印清单" placement="top">
<el-button type="success" plain @click="printEvent">打印</el-button>
</el-tooltip>
</el-row>
<!-- 商品选择对话框 -->
@@ -199,7 +241,7 @@
<script setup lang="ts">
import { ref, reactive, computed, onMounted } from "vue"
import { useRouter, useRoute } from "vue-router"
import { useRouter } from "vue-router"
import { useMessage } from "/@/hooks/message"
import { getObj, addObj, putObj } from "/@/api/supermarketerp/smErpInventoryRecords"
import { getPlanCode, getErpSpuSimpleAll, getCgddPage } from "/@/api/supermarketerp/common"
@@ -210,15 +252,19 @@ import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectD
import linkCodeDialog from "/@/views/supermarketerp/components/linkCodeDialog.vue"
import { displayPrice, storePrice } from "/@/utils/formatMoney"
import { useDict } from "/@/hooks/dict"
import { usePurchase } from "/@/stores/purchase"
import { tablePrint } from "../../supermarketUtils"
const purchaseStore = usePurchase()
const router = useRouter()
const route = useRoute()
const loading = ref(false) // 采购计划加载
const disabled = ref(false)
const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
const linkCgPlanDialogRef = ref() // 关联采购申请单对话框ref
const baseDataFormRef = ref() // 基本数据表单ref
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
const { check_status } = useDict("check_status")
const baseDataInfoRef = ref() // 基本信息ref
// 基本信息表单数据
const baseDataForm = reactive<any>({
id: "",
@@ -255,6 +301,14 @@ const state = reactive<{
erpSpuSelectDialogVisible: false, // 商品选择对话框开关
linkCgPlanDialogVisible: false, // 关联采购申请单对话框开关
})
const svg = `<path class="path" d="
M 30 15
L 28 17
M 25.61 25.61
A 15 15, 0, 0, 1, 15 30
A 15 15, 0, 1, 1, 27.99 7.5
L 15 15
" style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/>`
// 合计金额表单数据
const receiveAmountForm = reactive<{ receiveAmount: number }>({
receiveAmount: 0,
@@ -285,7 +339,9 @@ const receiveAmountFormRules = ref({
// 初始化数据
const getInitData = async () => {
baseDataForm.id = undefined
const id = route.query.id as string
// const id = route.query.id as string
const id = purchaseStore.purchaseFormState.id
disabled.value = purchaseStore.purchaseFormState.disabled
if (id) {
loading.value = true
// 获取采购计划数据 & 获取简要商品列表
@@ -298,12 +354,14 @@ const getInitData = async () => {
state.editableTableData = cgPlanData.data.items
state.erpSpuItemsMemo = cgPlanData.data.items
}
return
}
loading.value = true
// 获取采购入库编号
const [erpSpuSimpleAll, planCode] = await Promise.allSettled([getErpSpuSimpleAll(), getPlanCode({ type: 5 })]).then((results) =>
results.map((result) => (result.status === "fulfilled" ? result.value : null)),
)
const [erpSpuSimpleAll, planCode] = await Promise.allSettled([getErpSpuSimpleAll(), getPlanCode({ type: 5 })])
.then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
.finally(() => (loading.value = false))
erpSpuSimpleAll && erpSpuSimpleAll.code === 0 && (state.erpSpuSimpleAll = erpSpuSimpleAll.data)
planCode && planCode.code === 0 && (baseDataForm.inventoryCode = planCode.data)
}
@@ -563,6 +621,11 @@ const clearData = () => {
return true
}
// 点击打印
const printEvent = () => {
tablePrint(editableTableRef.value, baseDataInfoRef.value, state.editableTableData, 23, "零售出库")
}
onMounted(() => {
getInitData()
})
@@ -18,11 +18,11 @@
<el-form-item label="经办人" prop="handlerUserId">
<SelectHandlerUser v-model.trim="state.queryForm.handlerUserId" placeholder="请选择经办人" style="width: 200px" />
</el-form-item>
<!-- <el-form-item label="审批状态" prop="checkStatus">-->
<!-- <el-select v-model="state.queryForm.checkStatus" placeholder="请选择审批状态">-->
<!-- <el-option :label="item.label" :value="item.value" v-for="(item, index) in check_status" :key="index" />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="审批状态" prop="checkStatus">
<el-select v-model="state.queryForm.checkStatus" placeholder="请选择审批状态">
<el-option :label="item.label" :value="item.value" v-for="(item, index) in check_status" :key="index" />
</el-select>
</el-form-item>
<el-form-item>
<el-button icon="search" type="primary" @click="getDataList">查询</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
@@ -87,11 +87,21 @@
<el-table-column label="操作" width="150">
<template #default="scope">
<el-button
v-if="scope.row.checkStatus == '2'"
icon="MessageBox"
text
type="success"
@click="handleClickEditInventoryRecord(scope.row)"
>
详情
</el-button>
<el-button
v-else
icon="edit-pen"
text
type="primary"
v-auth="'supermarket_smErpInventoryRecords_edit'"
@click="handleClickEditInventoryRecord(scope.row.id)"
@click="handleClickEditInventoryRecord(scope.row)"
>
编辑
</el-button>
@@ -118,6 +128,7 @@ import { BasicTableProps, useTable } from "/@/hooks/table"
import { fetchList, delObjs } from "/@/api/supermarketerp/smErpInventoryRecords"
import { useMessage, useMessageBox } from "/@/hooks/message"
import { useDict } from "/@/hooks/dict"
import { usePurchase } from "/@/stores/purchase"
const router = useRouter()
const { check_status } = useDict("check_status")
@@ -134,6 +145,7 @@ const state: BasicTableProps = reactive<BasicTableProps>({
},
pageList: fetchList,
})
const purchaseStore = usePurchase()
// table hook
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
@@ -159,10 +171,21 @@ const selectionChangHandle = (objs: { id: string }[]) => {
}
// 点击创建出库入库记录表
const handleClickCreateInventoryRecord = () => router.push({ path: "/supermarketerp/retailManagement/smErpRetailDelivery/form" })
const handleClickCreateInventoryRecord = () => {
purchaseStore.setPurchaseFormId("")
purchaseStore.setPurchaseFormDisabled(false)
router.push({ path: "/supermarketerp/retailManagement/smErpRetailDelivery/form" })
}
// 点击编辑出库入库记录表
const handleClickEditInventoryRecord = (id: string) =>
router.push({ path: "/supermarketerp/retailManagement/smErpRetailDelivery/form", query: { id } })
const handleClickEditInventoryRecord = (row: any) => {
row.id ? purchaseStore.setPurchaseFormId(row.id) : useMessage().warning("清单id不存在")
if (row.checkStatus == 2) {
purchaseStore.setPurchaseFormDisabled(true)
} else {
purchaseStore.setPurchaseFormDisabled(false)
}
router.push({ path: "/supermarketerp/retailManagement/smErpRetailDelivery/form" })
}
// 删除操作
const handleDelete = async (ids: string[]) => {
+76 -23
View File
@@ -1,24 +1,53 @@
<template>
<div class="layout-padding">
<div v-loading="loading" class="layout-padding-auto layout-padding-view" style="overflow: scroll">
<el-form ref="baseDataFormRef" :model="baseDataForm" :rules="dataRules" label-width="100px">
<div v-loading="loading" :element-loading-svg="svg" element-loading-svg-view-box="-10, -10, 50, 50" class="layout-padding">
<div v-if="baseDataForm.inventoryCode" class="layout-padding-auto layout-padding-view" style="overflow: scroll">
<el-form v-if="!disabled" ref="baseDataFormRef" :model="baseDataForm" :rules="dataRules" label-width="100px">
<div class="flex flex-wrap">
<el-form-item label="单据编号" prop="inventoryCode">
<el-input v-model.trim="baseDataForm.inventoryCode" readonly style="width: 200px" />
<el-input v-model.trim="baseDataForm.inventoryCode" readonly style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="单据日期" prop="inventoryDate">
<el-input v-model="baseDataForm.inventoryDate" readonly style="width: 200px" />
<el-input v-model="baseDataForm.inventoryDate" readonly style="width: 200px" :disabled="disabled" />
</el-form-item>
<el-form-item label="经办人" prop="handlerUserId">
<SelectHandlerUser v-model.trim="baseDataForm.handlerUserId" placeholder="请选择经办人" style="width: 200px" />
<SelectHandlerUser
v-model.trim="baseDataForm.handlerUserId"
placeholder="请选择经办人"
style="width: 200px"
:disabled="disabled"
/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model.trim="baseDataForm.remark" placeholder="请输入备注" style="width: 200px" />
<el-input v-model.trim="baseDataForm.remark" placeholder="请输入备注" style="width: 200px" :disabled="disabled" />
</el-form-item>
</div>
</el-form>
<div v-else ref="baseDataInfoRef">
<div style="margin-bottom: 8px; padding: 8px 16px; color: #606279">
<div style="display: inline-block; width: 100%">
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">单据编号:</span>
<span>{{ baseDataForm.inventoryCode }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">单据日期:</span>
<span>{{ baseDataForm.inventoryDate }}</span>
</div>
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">经办人:</span>
<span>{{ baseDataForm.handlerUserId }}</span>
</div>
</div>
<div style="display: inline-block; width: 100%">
<div style="float: left; width: 33.33%; height: 28px; line-height: 28px">
<span class="font-bold">备注:</span>
<span>{{ baseDataForm.remark }}</span>
</div>
</div>
</div>
</div>
<el-row class="my-3">
<el-row v-if="!disabled" class="my-3">
<el-button @click="addEvent">新增(顶部)</el-button>
<el-button @click="pushEvent">新增(尾部)</el-button>
<el-button @click="insertEvent">
@@ -49,11 +78,12 @@
:edit-config="{
trigger: 'click',
mode: 'cell',
beforeEditMethod({ row, column }:any) {
beforeEditMethod({ row, column, rowIndex }:any) {
// 禁止编辑
if (column.property === '') {
return false
}
// if (column.property === '') {
// return false
// }
if(disabled) return false
return true
},
}"
@@ -170,9 +200,12 @@
<el-tooltip v-if="!baseDataForm.id" effect="dark" content="保存并清空数据" placement="top">
<el-button type="primary" plain @click="onContinueAdd">继续添加</el-button>
</el-tooltip>
<el-tooltip effect="dark" content="保存并返回列表页面" placement="top">
<el-tooltip v-if="!disabled" effect="dark" content="保存并返回列表页面" placement="top">
<el-button type="primary" plain @click="onSave">保存</el-button>
</el-tooltip>
<el-tooltip v-if="disabled" effect="dark" content="打印清单" placement="top">
<el-button type="success" plain @click="printEvent">打印</el-button>
</el-tooltip>
</el-row>
<!-- 商品选择对话框 -->
@@ -189,25 +222,28 @@
</template>
<script setup lang="ts">
import { ref, reactive, computed, onMounted, watch } from "vue"
import { useRouter, useRoute } from "vue-router"
import { ref, reactive, computed, onMounted } from "vue"
import { useRouter } from "vue-router"
import { useMessage } from "/@/hooks/message"
import { addObj, putObj } from "/@/api/supermarketerp/smErpInventoryRecords"
import { getPlanCode, getErpSpuSimpleAll } from "/@/api/supermarketerp/common"
import { getStockTakingDeatil } from "/@/api/supermarketerp/stockTaking"
import { getStockTakingDeatil, stockTakingAdd } from "/@/api/supermarketerp/stockTaking"
import { VxeTableEvents, VxeTablePropTypes, type VxeTableInstance } from "vxe-table"
import { formatDate } from "/@/utils/formatTime"
import erpSpuSelectDialog from "/@/views/supermarketerp/components/erpSpuSelectDialog.vue"
import barCodeEnter from "./barCodeEnter.vue"
import { displayPrice } from "/@/utils/formatMoney"
import { usePurchase } from "/@/stores/purchase"
import { tablePrint } from "../supermarketUtils"
const purchaseStore = usePurchase()
const router = useRouter()
const route = useRoute()
const loading = ref(false) // 采购计划加载
const disabled = ref(false)
const erpSpuSelectDialogRef = ref() // 商品选择对话框ref
const barCodeEnterRef = ref() // 条码录入对话框ref
const baseDataFormRef = ref() // 基本数据表单ref
const editableTableRef = ref<VxeTableInstance<any>>() // 可编辑表格ref
const baseDataInfoRef = ref() // 基本信息ref
// 基本信息表单数据
const baseDataForm = reactive<any>({
id: "",
@@ -238,6 +274,14 @@ const state = reactive<{
erpSpuSelectDialogVisible: false, // 商品选择对话框开关
linkCgPlanDialogVisible: false, // 关联采购申请单对话框开关
})
const svg = `<path class="path" d="
M 30 15
L 28 17
M 25.61 25.61
A 15 15, 0, 0, 1, 15 30
A 15 15, 0, 1, 1, 27.99 7.5
L 15 15
" style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/>`
// 基本信息表单校验规则
const dataRules = ref({
@@ -254,7 +298,9 @@ const validRules = ref<VxeTablePropTypes.EditRules<any>>({
// 初始化数据
const getInitData = async () => {
baseDataForm.id = undefined
const id = route.query.id as string
// const id = route.query.id as string
const id = purchaseStore.purchaseFormState.id
disabled.value = purchaseStore.purchaseFormState.disabled
if (id) {
loading.value = true
// 获取采购计划数据 & 获取简要商品列表
@@ -267,12 +313,14 @@ const getInitData = async () => {
state.editableTableData = cgPlanData.data.items
state.erpSpuItemsMemo = cgPlanData.data.items
}
return
}
loading.value = true
// 获取采购入库编号
const [erpSpuSimpleAll, planCode] = await Promise.allSettled([getErpSpuSimpleAll(), getPlanCode({ type: 7 })]).then((results) =>
results.map((result) => (result.status === "fulfilled" ? result.value : null)),
)
const [erpSpuSimpleAll, planCode] = await Promise.allSettled([getErpSpuSimpleAll(), getPlanCode({ type: 7 })])
.then((results) => results.map((result) => (result.status === "fulfilled" ? result.value : null)))
.finally(() => (loading.value = false))
erpSpuSimpleAll && erpSpuSimpleAll.code === 0 && (state.erpSpuSimpleAll = erpSpuSimpleAll.data)
planCode && planCode.code === 0 && (baseDataForm.inventoryCode = planCode.data)
}
@@ -554,7 +602,7 @@ const submitData = async () => {
console.log("提交的数据:", _pa)
const res = baseDataForm.id ? await putObj(_pa) : await addObj(_pa)
const res = baseDataForm.id ? await putObj(_pa) : await stockTakingAdd(_pa)
if (res.code === 0) {
useMessage().success(baseDataForm.id ? "修改成功" : "添加成功")
return true
@@ -619,6 +667,11 @@ const handleEditChange = ({ row, column }: any) => {
// }
}
// 点击打印
const printEvent = () => {
tablePrint(editableTableRef.value, baseDataInfoRef.value, state.editableTableData, 23, "库存盘点")
}
onMounted(() => {
getInitData()
})
+27 -4
View File
@@ -68,7 +68,16 @@
<!-- <el-table-column prop="totalAmount" label="入库总金额" show-overflow-tooltip /> -->
<el-table-column label="操作" width="150">
<template #default="scope">
<el-button icon="edit-pen" text type="primary" @click="handleClickEditStockTaking(scope.row.id)">编辑</el-button>
<el-button
v-if="scope.row.checkStatus == '2'"
icon="MessageBox"
text
type="success"
@click="handleClickEditStockTaking(scope.row)"
>
详情
</el-button>
<el-button v-else icon="edit-pen" text type="primary" @click="handleClickEditStockTaking(scope.row)">编辑</el-button>
<el-button icon="delete" text type="primary" @click="handleDelete([scope.row.id])">删除</el-button>
</template>
</el-table-column>
@@ -83,7 +92,8 @@ import { useRouter } from "vue-router"
import { BasicTableProps, useTable } from "/@/hooks/table"
import { useMessage, useMessageBox } from "/@/hooks/message"
import { useDict } from "/@/hooks/dict"
import { fetchList } from "/@/api/supermarketerp/smErpCgDd"
import { fetchList } from "/@/api/supermarketerp/smErpInventoryRecords"
import { usePurchase } from "/@/stores/purchase"
const router = useRouter()
const { check_status } = useDict("check_status")
@@ -100,6 +110,7 @@ const state: BasicTableProps = reactive<BasicTableProps>({
},
pageList: fetchList,
})
const purchaseStore = usePurchase()
// table hook
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
@@ -124,8 +135,20 @@ const selectionChangHandle = (objs: { id: string }[]) => {
multiple.value = !objs.length
}
const handleClickCreateStockTaking = () => router.push({ path: "/supermarketerp/stockTaking/form" })
const handleClickEditStockTaking = (id: string) => router.push({ path: "/supermarketerp/stockTaking/form", query: { id } })
const handleClickCreateStockTaking = () => {
purchaseStore.setPurchaseFormId("")
purchaseStore.setPurchaseFormDisabled(false)
router.push({ path: "/supermarketerp/stockTaking/form" })
}
const handleClickEditStockTaking = (row: any) => {
row.id ? purchaseStore.setPurchaseFormId(row.id) : useMessage().warning("清单id不存在")
if (row.checkStatus == 2) {
purchaseStore.setPurchaseFormDisabled(true)
} else {
purchaseStore.setPurchaseFormDisabled(false)
}
router.push({ path: "/supermarketerp/stockTaking/form" })
}
// 删除操作
const handleDelete = async (ids: string[]) => {
@@ -164,7 +164,7 @@ const handleTabChange = (name: TabPaneName) => (currentTabPaneIndex.value = tabP
// 计算包装单位列表
const usePackageUnitList = () => {
const curRadioRowUnit = packageUnitRef.value.getRadioEvent()
const smErpUnitEntityList = JSON.parse(JSON.stringify(form.smErpUnitEntityList)) // 深拷贝
const smErpUnitEntityList = JSON.parse(JSON.stringify(form.smErpUnitEntityList))
return smErpUnitEntityList.map((item: rowVU) => {
if (item.id === curRadioRowUnit.id) {
item.isBase = true
@@ -0,0 +1,48 @@
import { VxeUI } from "vxe-table"
// 数组分块分组
function chunk<T>(array: T[], size: number): T[][] {
if (size <= 0) {
throw new Error("组的大小必须大于0")
}
const result: T[][] = []
for (let i = 0; i < array.length; i += size) {
result.push(array.slice(i, i + size))
}
return result
}
// 表格分页 + 表单信息 打印
export const tablePrint = (
editableTableRef: any,
baseDataInfoRef: any,
editableTableData: any,
tableChunkSize: number = 20,
printTitle: string = "",
) => {
const $table = editableTableRef
const formPrintHtml = baseDataInfoRef ? baseDataInfoRef.innerHTML : ""
if ($table && formPrintHtml) {
// 分割每页20条
Promise.all(
chunk(editableTableData, tableChunkSize).map((pageData: any, index: number) => {
return $table
.getPrintHtml({
data: pageData,
})
.then(({ html }: any) => {
return {
bodyHtml: index === 0 ? formPrintHtml + html : html,
}
})
}),
).then((pageBreaks) => {
VxeUI.print({
title: printTitle,
showPageNumber: true,
pageBreaks,
})
})
}
}