模具入库

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

@ -84,7 +84,7 @@
<!-- 子表的表单 -->
<ContentWrap>
<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" />
</el-tab-pane>
</el-tabs>

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

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

@ -1,52 +1,109 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<Dialog :title="dialogTitle" v-model="dialogVisible" width="1200">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
:disabled="disabled"
>
<el-form-item label="领模单号" prop="orderId">
<el-input v-model="formData.orderId" placeholder="请输入领模单号" />
</el-form-item>
<el-form-item label="模具编码" prop="code">
<el-input v-model="formData.code" placeholder="请输入模具编码" />
</el-form-item>
<el-form-item label="模具名称" prop="name">
<el-input v-model="formData.name" placeholder="请输入模具名称" />
</el-form-item>
<el-form-item label="状态" prop="state">
<el-input v-model="formData.state" placeholder="请输入状态" />
</el-form-item>
<el-form-item label="归还人" prop="person">
<el-input v-model="formData.person" placeholder="请输入归还人" />
</el-form-item>
<el-form-item label="入库时间" prop="returnTime">
<el-date-picker
v-model="formData.returnTime"
type="date"
value-format="x"
placeholder="选择入库时间"
/>
</el-form-item>
<el-form-item label="库管员" prop="principal">
<el-input v-model="formData.principal" placeholder="请输入库管员" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" placeholder="请输入备注" />
</el-form-item>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="入库类型" prop="inType">
<el-select
v-model="formData.inType"
clearable
filterable
placeholder="请选择入库类型"
class="!w-1/1"
disabled
>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="入库单号" prop="no">
<el-input disabled v-model="formData.no" placeholder="保存时自动生成" />
</el-form-item>
</el-col>
<!-- <el-col :span="8">
<el-form-item label="客户" prop="customerId">
<el-select
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>
<!-- 子表的表单 -->
<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>
<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>
</template>
</Dialog>
</template>
<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' })
const { t } = useI18n() //
@ -55,25 +112,33 @@ const message = useMessage() // 消息弹窗
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formType = ref('') // create - update - detail -
const formData = ref({
id: undefined,
orderId: undefined,
code: undefined,
name: undefined,
state: undefined,
person: undefined,
returnTime: undefined,
principal: undefined,
customerId: undefined,
inTime: undefined,
remark: undefined,
inType: undefined,
fileUrl: '',
items: []
})
const formRules = reactive({
orderId: [{ required: true, message: '领模单号不能为空', trigger: 'blur' }],
code: [{ required: true, message: '模具编码不能为空', trigger: 'blur' }],
name: [{ required: true, message: '模具名称不能为空', trigger: 'blur' }],
state: [{ required: true, message: '状态不能为空', trigger: 'blur' }],
inTime: [{ required: true, message: '入库时间不能为空', trigger: 'blur' }],
inType: [{ required: true, message: '入库类型不能为空', trigger: 'blur' }]
})
const disabled = computed(() => formType.value === 'detail')
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) => {
@ -85,11 +150,13 @@ const open = async (type: string, id?: number) => {
if (id) {
formLoading.value = true
try {
formData.value = await MoldReturnApi.getMoldReturn(id)
formData.value = await StockInApi.getStockIn(id)
} finally {
formLoading.value = false
}
}
//
customerList.value = await CustomerApi.getCustomerSimpleList()
}
defineExpose({ open }) // open
@ -98,15 +165,16 @@ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成
const submitForm = async () => {
//
await formRef.value.validate()
await itemFormRef.value.validate()
//
formLoading.value = true
try {
const data = formData.value as unknown as MoldReturnVO
const data = formData.value as unknown as StockInVO
if (formType.value === 'create') {
await MoldReturnApi.createMoldReturn(data)
await StockInApi.createStockIn(data)
message.success(t('common.createSuccess'))
} else {
await MoldReturnApi.updateMoldReturn(data)
await StockInApi.updateStockIn(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
@ -121,14 +189,12 @@ const submitForm = async () => {
const resetForm = () => {
formData.value = {
id: undefined,
orderId: undefined,
code: undefined,
name: undefined,
state: undefined,
person: undefined,
returnTime: undefined,
principal: undefined,
customerId: undefined,
inTime: undefined,
remark: undefined,
fileUrl: undefined,
items: [],
inType: "模具入库"
}
formRef.value?.resetFields()
}

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

Loading…
Cancel
Save