From 5612bbd431d10589a06c7ed3584de2cad1b5ea0a Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: Thu, 18 Jun 2026 16:24:31 +0800
Subject: [PATCH] 中科大支线—订单入库
---
src/views/hazardousChemicals/warehouseManageMenu/orderWarehouse/components/orderDialog.vue | 95 ++++++++++++++++++++++++++---------------------
1 files changed, 53 insertions(+), 42 deletions(-)
diff --git a/src/views/hazardousChemicals/warehouseManageMenu/orderWarehouse/components/orderDialog.vue b/src/views/hazardousChemicals/warehouseManageMenu/orderWarehouse/components/orderDialog.vue
index 1f5abf4..d8a3bde 100644
--- a/src/views/hazardousChemicals/warehouseManageMenu/orderWarehouse/components/orderDialog.vue
+++ b/src/views/hazardousChemicals/warehouseManageMenu/orderWarehouse/components/orderDialog.vue
@@ -9,10 +9,10 @@
:close-on-click-modal="false"
>
<el-form :model="state.form" size="default" ref="busRef" :rules="state.formRules" label-width="150px" >
- <el-form-item required label= "申购订单列表" >
+ <el-form-item label= "申购订单列表" prop="subscribeNum">
<el-select
clearable
- v-model="state.orderName"
+ v-model="state.form.subscribeNum"
filterable
remote
reserve-keyword
@@ -34,15 +34,15 @@
<el-table-column type="index" label="序号" width="80" align="center"></el-table-column>
<el-table-column label="危化品名称" align="center" >
<template #default="{row,$index}">
- <el-form-item :prop="'subscribeHazmats.' + '[' + $index + ']' + '.hazmatName'" :rules="state.formRules.hazmatName">
- <el-input type="textarea" :rows="1" v-model="row.hazmatName" placeholder="请输入危化品名称"></el-input>
+ <el-form-item align="center" :prop="'subscribeHazmats.' + '[' + $index + ']' + '.hazmatName'" :rules="state.formRules.hazmatName">
+ <span>{{row.hazmatName}}</span>
</el-form-item>
</template>
</el-table-column>
<el-table-column label="数量" align="center" >
<template #default="{row,$index}">
<el-form-item :prop="'subscribeHazmats.' + '[' + $index + ']' + '.hazmatCount'" :rules="state.formRules.hazmatCount">
- <el-input v-model="row.hazmatCount" @input="row.hazmatCount = row.hazmatCount.replace(/[^0-9]/g,'')" placeholder="请输入数量"></el-input>
+ <span>{{row.hazmatCount}}</span>
</el-form-item>
</template>
</el-table-column>
@@ -110,6 +110,8 @@
import {addSubscribe, editSubscribe, getSubscribeList} from "@/api/hazardousChemicals/subscribeApply";
import {getCupById, getWarehouse} from "@/api/hazardousChemicals/warehouse";
import moment from "moment";
+import Cookies from "js-cookie";
+import {addOrder, editOrder} from "@/api/hazardousChemicals/orderWarehouse";
const dialogVisible = ref(false);
const title = ref("");
@@ -119,36 +121,39 @@
const state = reactive({
form: {
id: '',
- checkId: null,
- checkName:'',
- subscribeHazmats:[],
+ companyId:null,
+ cupboardId: null,
+ warehouseId:null,
+ batchNo:'',
+ subscribeNum:'',
+ num:'',
+ warehouseName:'',
+ subscribeHazmats:[]
},
+ orderName:'',
orderList:[],
wareHouseList: [],
cupList: [],
+ subscribePersonId:null,
formRules:{
- checkId: [{ required: true, message: '请选择审核人', trigger: 'blur' }],
- filePath:[{ required: true, message: '请上传文件', trigger: 'blur' }],
- hazmatName: [{ required: true, message: '', trigger: 'blur' }],
- hazmatCount: [{ required: true, message: '', trigger: 'blur' }],
+ warehouseName: [{ required: true, message: '请选择主柜', trigger: 'blur' }],
+ cupboardId:[{ required: true, message: '请选择副柜', trigger: 'blur' }],
+ subscribeNum: [{ required: true, message: '请选择申购订单', trigger: 'blur' }],
},
})
-
-
const openDialog = async (type, value) => {
await getOrderList("")
await getWareHouseList("")
- title.value = type === 'add' ? '申购申请' : type ==='edit' ? '申购编辑' : '查看' ;
+ const userInfo= JSON.parse(Cookies.get('userInfo'))
+ state.subscribePersonId = userInfo.id
+ title.value = type === 'add' ? '订单入库' : type ==='edit' ? '编辑' : '查看' ;
if(type === 'edit' || type === 'view') {
- state.form = JSON.parse(JSON.stringify(value));
- if(state.form.filePath) {
- const obj = {
- url: value.filePath,
- name: value.fileName
- }
- state.fileList = [obj]
- }
+ Object.keys(value).forEach(key => key in state.form && (state.form[key] = value[key]));
+ state.form.subscribeHazmats = value.subscribe.subscribeHazmats
+ state.form.warehouseName = value.warehouse.name
+ state.form.companyId = userInfo.companyId
+ await getCupList(state.form.warehouseId)
}
state.form.batchNo = moment(new Date()).format("YYYYMMDD")
dialogVisible.value = true;
@@ -157,9 +162,10 @@
const onSubmit = async () => {
const valid = await busRef.value.validate();
if(valid){
- if(title.value === '申购申请'){
- const {id, ...data} = JSON.parse(JSON.stringify(state.form))
- const res = await addSubscribe(data)
+ state.form.num = state.form.subscribeHazmats.reduce((sum, item) => sum + item.hazmatCount, 0)
+ if(title.value === '订单入库'){
+ const {id,subscribeHazmats,warehouseName,companyId, ...data} = JSON.parse(JSON.stringify(state.form))
+ const res = await addOrder(data)
if(res.code === 200){
ElMessage({
type: 'success',
@@ -172,9 +178,9 @@
busRef.value.clearValidate();
reset();
dialogVisible.value = false;
- }else if(title.value === '申购编辑'){
- const {...data} = JSON.parse(JSON.stringify(state.form))
- const res = await editSubscribe(data)
+ }else if(title.value === '编辑'){
+ const {subscribeHazmats,warehouseName,...data} = JSON.parse(JSON.stringify(state.form))
+ const res = await editOrder(data)
if(res.code === 200){
ElMessage({
type: 'success',
@@ -200,37 +206,42 @@
const reset = () => {
state.form = {
id: '',
- checkId: null,
- filePath: '',
- fileName: '',
+ companyId:null,
+ cupboardId: null,
+ warehouseId:null,
+ batchNo:'',
+ subscribeNum:'',
+ num:'',
subscribeHazmats:[],
+ warehouseName:''
}
+ state.subscribePersonId = null
+ state.orderName = ''
}
const selectValue = (val) => {
- state.form.orderId = null
if(!val){
state.form.subscribeHazmats = []
return
}
- state.orderList.forEach(item => {
- if(item.subscribeNum === val){
- state.form.orderId = item.id
- state.form.subscribeHazmats = item.subscribeHazmats
- }
- })
+ const match = state.orderList.find(i => i.subscribeNum == val)
+ if(match){
+ state.form.subscribeHazmats = match.subscribeHazmats
+ }
}
const getOrderList = async (val) => {
let param = {}
if(val != ""){
param = {
- name: val,
- status: 1
+ subscribeNum: val,
+ status: 1,
+ subscribePersonId:state.subscribePersonId
}
}else {
param = {
pageNum: 1,
pageSize: 10,
- status: 1
+ status: 1,
+ subscribePersonId:state.subscribePersonId
}
}
const res = await getSubscribeList(param)
--
Gitblit v1.9.2