采购管理和零售管理相关的详情查看和打印预览
This commit is contained in:
1 parent
fe3054d814
commit
2a21372bee
18 files changed
+823
-209
No files matched your search
@@ -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()
|
||||
})
|
||||
|
||||
@@ -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[]) => {
|
||||
|
||||
Reference in new issue
Block a user