模具入库

main
kkk-ops 3 weeks ago
parent 30d831e8d6
commit 89eafccec3

@ -84,7 +84,7 @@
<!-- 子表的表单 --> <!-- 子表的表单 -->
<ContentWrap> <ContentWrap>
<el-tabs v-model="subTabsName" class="-mt-15px -mb-10px"> <el-tabs v-model="subTabsName" class="-mt-15px -mb-10px">
<el-tab-pane label="出库产品清单" name="item"> <el-tab-pane label="出库模具清单" name="item">
<StockOutItemForm ref="itemFormRef" :items="formData.items" :disabled="disabled" /> <StockOutItemForm ref="itemFormRef" :items="formData.items" :disabled="disabled" />
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>

@ -149,8 +149,8 @@ const formData = ref([])
const formRules = reactive({ const formRules = reactive({
inId: [{ required: true, message: '出库编号不能为空', trigger: 'blur' }], inId: [{ required: true, message: '出库编号不能为空', trigger: 'blur' }],
warehouseId: [{ required: true, message: '仓库不能为空', trigger: 'blur' }], warehouseId: [{ required: true, message: '仓库不能为空', trigger: 'blur' }],
productId: [{ required: true, message: '备件不能为空', trigger: 'blur' }], productId: [{ required: true, message: '模具不能为空', trigger: 'blur' }],
count: [{ required: true, message: '备件数量不能为空', trigger: 'blur' }] count: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
}) })
const formRef = ref([]) // Ref const formRef = ref([]) // Ref
const productList = ref<MoldVO[]>([]) // const productList = ref<MoldVO[]>([]) //

@ -283,7 +283,7 @@ const queryParams = reactive({
no: undefined, no: undefined,
productId: undefined, productId: undefined,
customerId: undefined, customerId: undefined,
outType: '模出库', outType: '出库',
warehouseId: undefined, warehouseId: undefined,
outTime: [], outTime: [],
status: 10, status: 10,
@ -363,7 +363,7 @@ const handleExport = async () => {
// //
exportLoading.value = true exportLoading.value = true
const data = await StockOutApi.exportStockOut(queryParams) const data = await StockOutApi.exportStockOut(queryParams)
download.excel(data, '其它出库单.xls') download.excel(data, '模具出库单.xls')
} catch { } catch {
} finally { } finally {
exportLoading.value = false exportLoading.value = false
@ -381,7 +381,7 @@ const query = reactive({
}) })
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
queryParams.outType ='模出库' queryParams.outType ='出库'
await getList() await getList()
// //
// productList.value = await ProductApi.getProductSimpleList() // productList.value = await ProductApi.getProductSimpleList()
@ -390,12 +390,5 @@ onMounted(async () => {
customerList.value = await CustomerApi.getCustomerSimpleList() customerList.value = await CustomerApi.getCustomerSimpleList()
userList.value = await UserApi.getSimpleUserList() userList.value = await UserApi.getSimpleUserList()
}) })
// TODO
// TODO
/** tab 切换 */
let activeName = '产品出库'
const handleTabClick = (tab: TabsPaneContext) => {
queryParams.outType = tab.paneName
handleQuery()
}
</script> </script>

@ -1,52 +1,109 @@
<template> <template>
<Dialog :title="dialogTitle" v-model="dialogVisible"> <Dialog :title="dialogTitle" v-model="dialogVisible" width="1200">
<el-form <el-form
ref="formRef" ref="formRef"
:model="formData" :model="formData"
:rules="formRules" :rules="formRules"
label-width="100px" label-width="100px"
v-loading="formLoading" v-loading="formLoading"
:disabled="disabled"
> >
<el-form-item label="领模单号" prop="orderId"> <el-row :gutter="20">
<el-input v-model="formData.orderId" placeholder="请输入领模单号" /> <el-col :span="8">
</el-form-item> <el-form-item label="入库类型" prop="inType">
<el-form-item label="模具编码" prop="code"> <el-select
<el-input v-model="formData.code" placeholder="请输入模具编码" /> v-model="formData.inType"
</el-form-item> clearable
<el-form-item label="模具名称" prop="name"> filterable
<el-input v-model="formData.name" placeholder="请输入模具名称" /> placeholder="请选择入库类型"
</el-form-item> class="!w-1/1"
<el-form-item label="状态" prop="state"> disabled
<el-input v-model="formData.state" placeholder="请输入状态" /> >
</el-form-item> <el-option
<el-form-item label="归还人" prop="person"> v-for="item in options"
<el-input v-model="formData.person" placeholder="请输入归还人" /> :key="item.value"
</el-form-item> :label="item.label"
<el-form-item label="入库时间" prop="returnTime"> :value="item.value"
<el-date-picker />
v-model="formData.returnTime" </el-select>
type="date" </el-form-item>
value-format="x" </el-col>
placeholder="选择入库时间" <el-col :span="8">
/> <el-form-item label="入库单号" prop="no">
</el-form-item> <el-input disabled v-model="formData.no" placeholder="保存时自动生成" />
<el-form-item label="库管员" prop="principal"> </el-form-item>
<el-input v-model="formData.principal" placeholder="请输入库管员" /> </el-col>
</el-form-item> <!-- <el-col :span="8">
<el-form-item label="备注" prop="remark"> <el-form-item label="客户" prop="customerId">
<el-input v-model="formData.remark" placeholder="请输入备注" /> <el-select
</el-form-item> v-model="formData.customerId"
clearable
filterable
placeholder="请选择客户"
class="!w-1/1"
>
<el-option
v-for="item in customerList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col> -->
<el-col :span="8">
<el-form-item label="入库时间" prop="inTime">
<el-date-picker
v-model="formData.inTime"
type="date"
value-format="x"
placeholder="选择入库时间"
class="!w-1/1"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="备注" prop="remark">
<el-input
type="textarea"
v-model="formData.remark"
:rows="1"
placeholder="请输入备注"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="附件" prop="fileUrl">
<UploadFile :is-show-tip="false" v-model="formData.fileUrl" :limit="1" />
</el-form-item>
</el-col>
</el-row>
</el-form> </el-form>
<!-- 子表的表单 -->
<ContentWrap>
<el-tabs v-model="subTabsName" class="-mt-15px -mb-10px">
<el-tab-pane label="入库模具清单" name="item">
<StockInItemForm ref="itemFormRef" :items="formData.items" :disabled="disabled" />
</el-tab-pane>
</el-tabs>
</ContentWrap>
<template #footer> <template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button> <el-button @click="submitForm" type="primary" :disabled="formLoading" v-if="!disabled">
</el-button>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
</template> </template>
</Dialog> </Dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { MoldReturnApi, MoldReturnVO } from '@/api/mes/moldreturn' import { StockInApi, StockInVO } from '@/api/erp/stock/in'
import StockInItemForm from './components/StockInItemForm.vue'
import { CustomerApi, CustomerVO } from '@/api/erp/sale/customer'
import {DICT_TYPE, getBoolDictOptions, getStrDictOptions} from "@/utils/dict";
/** 模具管理-模具入库 表单 */ /** ERP 其它出库单表单 */
defineOptions({ name: 'MoldReturnForm' }) defineOptions({ name: 'MoldReturnForm' })
const { t } = useI18n() // const { t } = useI18n() //
@ -55,25 +112,33 @@ const message = useMessage() // 消息弹窗
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const dialogTitle = ref('') // const dialogTitle = ref('') //
const formLoading = ref(false) // 12 const formLoading = ref(false) // 12
const formType = ref('') // create - update - const formType = ref('') // create - update - detail -
const formData = ref({ const formData = ref({
id: undefined, id: undefined,
orderId: undefined, customerId: undefined,
code: undefined, inTime: undefined,
name: undefined,
state: undefined,
person: undefined,
returnTime: undefined,
principal: undefined,
remark: undefined, remark: undefined,
inType: undefined,
fileUrl: '',
items: []
}) })
const formRules = reactive({ const formRules = reactive({
orderId: [{ required: true, message: '领模单号不能为空', trigger: 'blur' }], inTime: [{ required: true, message: '入库时间不能为空', trigger: 'blur' }],
code: [{ required: true, message: '模具编码不能为空', trigger: 'blur' }], inType: [{ required: true, message: '入库类型不能为空', trigger: 'blur' }]
name: [{ required: true, message: '模具名称不能为空', trigger: 'blur' }],
state: [{ required: true, message: '状态不能为空', trigger: 'blur' }],
}) })
const disabled = computed(() => formType.value === 'detail')
const formRef = ref() // Ref const formRef = ref() // Ref
const customerList = ref<CustomerVO[]>([]) //
const options = [
{
value: '模具入库',
label: '模具入库',
},
]
/** 子表的表单 */
const subTabsName = ref('item')
const itemFormRef = ref()
/** 打开弹窗 */ /** 打开弹窗 */
const open = async (type: string, id?: number) => { const open = async (type: string, id?: number) => {
@ -85,11 +150,13 @@ const open = async (type: string, id?: number) => {
if (id) { if (id) {
formLoading.value = true formLoading.value = true
try { try {
formData.value = await MoldReturnApi.getMoldReturn(id) formData.value = await StockInApi.getStockIn(id)
} finally { } finally {
formLoading.value = false formLoading.value = false
} }
} }
//
customerList.value = await CustomerApi.getCustomerSimpleList()
} }
defineExpose({ open }) // open defineExpose({ open }) // open
@ -98,15 +165,16 @@ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成
const submitForm = async () => { const submitForm = async () => {
// //
await formRef.value.validate() await formRef.value.validate()
await itemFormRef.value.validate()
// //
formLoading.value = true formLoading.value = true
try { try {
const data = formData.value as unknown as MoldReturnVO const data = formData.value as unknown as StockInVO
if (formType.value === 'create') { if (formType.value === 'create') {
await MoldReturnApi.createMoldReturn(data) await StockInApi.createStockIn(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} else { } else {
await MoldReturnApi.updateMoldReturn(data) await StockInApi.updateStockIn(data)
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
} }
dialogVisible.value = false dialogVisible.value = false
@ -121,15 +189,13 @@ const submitForm = async () => {
const resetForm = () => { const resetForm = () => {
formData.value = { formData.value = {
id: undefined, id: undefined,
orderId: undefined, customerId: undefined,
code: undefined, inTime: undefined,
name: undefined,
state: undefined,
person: undefined,
returnTime: undefined,
principal: undefined,
remark: undefined, remark: undefined,
fileUrl: undefined,
items: [],
inType: "模具入库"
} }
formRef.value?.resetFields() formRef.value?.resetFields()
} }
</script> </script>

@ -257,7 +257,7 @@
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict' import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import { dateFormatter2 } from '@/utils/formatTime' import { dateFormatter2 } from '@/utils/formatTime'
import download from '@/utils/download' import download from '@/utils/download'
import { StockOutApi, StockOutVO } from '@/api/erp/stock/out' import { StockInApi, StockInVO } from '@/api/erp/stock/in'
import MoldReturnForm from './MoldReturnForm.vue' import MoldReturnForm from './MoldReturnForm.vue'
import { ProductApi, ProductVO } from '@/api/erp/product/product' import { ProductApi, ProductVO } from '@/api/erp/product/product'
import { MoldBrandApi, MoldVO } from '@/api/erp/mold' import { MoldBrandApi, MoldVO } from '@/api/erp/mold'
@ -267,13 +267,13 @@ import * as UserApi from '@/api/system/user'
import { CustomerApi, CustomerVO } from '@/api/erp/sale/customer' import { CustomerApi, CustomerVO } from '@/api/erp/sale/customer'
/** ERP 其它出库单列表 */ /** ERP 其它出库单列表 */
defineOptions({ name: 'MoldGet' }) defineOptions({ name: 'MoldReturn' })
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
const loading = ref(true) // const loading = ref(true) //
const list = ref<StockOutVO[]>([]) // const list = ref<StockInVO[]>([]) //
const total = ref(0) // const total = ref(0) //
const queryParams = reactive({ const queryParams = reactive({
pageNo: 1, pageNo: 1,
@ -281,7 +281,7 @@ const queryParams = reactive({
no: undefined, no: undefined,
productId: undefined, productId: undefined,
customerId: undefined, customerId: undefined,
outType: '领模出库', inType: '模具入库',
warehouseId: undefined, warehouseId: undefined,
outTime: [], outTime: [],
status: 10, status: 10,
@ -300,7 +300,7 @@ const moldList = ref<MoldVO[]>([]) // 模具列表
const getList = async () => { const getList = async () => {
loading.value = true loading.value = true
try { try {
const data = await StockOutApi.getStockOutPage(queryParams) const data = await StockInApi.getStockInPage(queryParams)
list.value = data.list list.value = data.list
total.value = data.total total.value = data.total
} finally { } finally {
@ -332,7 +332,7 @@ const handleDelete = async (ids: number[]) => {
// //
await message.delConfirm() await message.delConfirm()
// //
await StockOutApi.deleteStockOut(ids) await StockInApi.deleteStockIn(ids)
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
await getList() await getList()
@ -344,9 +344,9 @@ const handleDelete = async (ids: number[]) => {
const handleUpdateStatus = async (id: number, status: number) => { const handleUpdateStatus = async (id: number, status: number) => {
try { try {
// //
await message.confirm(`确定${status === 20 ? '审批' : '反审批'}库单吗?`) await message.confirm(`确定${status === 20 ? '审批' : '反审批'}库单吗?`)
// //
await StockOutApi.updateStockOutStatus(id, status) await StockInApi.updateStockInStatus(id, status)
message.success(`${status === 20 ? '审批' : '反审批'}成功`) message.success(`${status === 20 ? '审批' : '反审批'}成功`)
// //
await getList() await getList()
@ -360,8 +360,8 @@ const handleExport = async () => {
await message.exportConfirm() await message.exportConfirm()
// //
exportLoading.value = true exportLoading.value = true
const data = await StockOutApi.exportStockOut(queryParams) const data = await StockInApi.exportStockIn(queryParams)
download.excel(data, '其它出库单.xls') download.excel(data, '模具入库单.xls')
} catch { } catch {
} finally { } finally {
exportLoading.value = false exportLoading.value = false
@ -369,8 +369,8 @@ const handleExport = async () => {
} }
/** 选中操作 */ /** 选中操作 */
const selectionList = ref<StockOutVO[]>([]) const selectionList = ref<StockInVO[]>([])
const handleSelectionChange = (rows: StockOutVO[]) => { const handleSelectionChange = (rows: StockInVO[]) => {
selectionList.value = rows selectionList.value = rows
} }
@ -379,7 +379,7 @@ const query = reactive({
}) })
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
queryParams.outType ='领模出库' queryParams.inType ='模具入库'
await getList() await getList()
// //
// productList.value = await ProductApi.getProductSimpleList() // productList.value = await ProductApi.getProductSimpleList()
@ -388,12 +388,4 @@ onMounted(async () => {
customerList.value = await CustomerApi.getCustomerSimpleList() customerList.value = await CustomerApi.getCustomerSimpleList()
userList.value = await UserApi.getSimpleUserList() userList.value = await UserApi.getSimpleUserList()
}) })
// TODO
// TODO
/** tab 切换 */
let activeName = '产品出库'
const handleTabClick = (tab: TabsPaneContext) => {
queryParams.outType = tab.paneName
handleQuery()
}
</script> </script>

Loading…
Cancel
Save