8
8
v-loading =" formLoading"
9
9
>
10
10
<el-row :gutter =" 20" >
11
- <el-col :span =" 12" >
11
+ <!-- TODO 芋艿:待接入 -->
12
+ <el-col :span =" 8" >
12
13
<el-form-item label =" 入库单号" prop =" no" >
13
14
<el-input v-model =" formData.no" placeholder =" 请输入入库单号" />
14
15
</el-form-item >
15
16
</el-col >
16
- <el-col :span =" 12 " >
17
+ <el-col :span =" 8 " >
17
18
<el-form-item label =" 入库时间" prop =" inTime" >
18
19
<el-date-picker
19
20
v-model =" formData.inTime"
20
21
type =" date"
21
22
value-format =" x"
22
23
placeholder =" 选择入库时间"
24
+ class =" !w-1/1"
23
25
/>
24
26
</el-form-item >
25
27
</el-col >
26
- <el-col :span =" 12" >
28
+ <!-- TODO 芋艿:待接入 -->
29
+ <el-col :span =" 8" >
27
30
<el-form-item label =" 供应商" prop =" supplierId" >
28
- <el-input v-model =" formData.supplierId" placeholder =" 请输入供应商编号 " />
31
+ <el-input v-model =" formData.supplierId" placeholder =" 请输入供应商 " />
29
32
</el-form-item >
30
33
</el-col >
31
- <!-- TODO 芋艿:附件 -->
32
- <el-col :span =" 24" >
34
+ <el-col :span =" 16" >
33
35
<el-form-item label =" 备注" prop =" remark" >
34
- <el-input type =" textarea" v-model =" formData.remark" placeholder =" 请输入备注" />
36
+ <el-input
37
+ type =" textarea"
38
+ v-model =" formData.remark"
39
+ :rows =" 1"
40
+ placeholder =" 请输入备注"
41
+ />
42
+ </el-form-item >
43
+ </el-col >
44
+ <el-col :span =" 8" >
45
+ <el-form-item label =" 附件" prop =" fileUrl" >
46
+ <UploadFile :is-show-tip =" false" v-model =" formData.fileUrl" :limit =" 1" />
35
47
</el-form-item >
36
48
</el-col >
37
49
</el-row >
38
50
</el-form >
39
51
<!-- 子表的表单 -->
40
- <el-tabs v-model =" subTabsName" >
41
- <el-tab-pane label =" 入库产品清单" name =" stockInItem" >
42
- <StockInItemForm ref =" stockInItemFormRef" :in-id =" formData.id" />
43
- </el-tab-pane >
44
- </el-tabs >
45
- <el-form
46
- ref =" formRef2"
47
- :model =" formData"
48
- :rules =" formRules"
49
- label-width =" 100px"
50
- v-loading =" formLoading"
51
- >
52
- <el-form-item label =" 合计数量" prop =" totalCount" >
53
- <el-input v-model =" formData.totalCount" placeholder =" 请输入合计数量" />
54
- </el-form-item >
55
- <el-form-item label =" 合计金额" prop =" totalPrice" >
56
- <el-input v-model =" formData.totalPrice" placeholder =" 请输入合计金额,单位:元" />
57
- </el-form-item >
58
- </el-form >
52
+ <ContentWrap >
53
+ <el-tabs v-model =" subTabsName" class =" -mt-15px -mb-10px" >
54
+ <el-tab-pane label =" 入库产品清单" name =" stockInItem" >
55
+ <StockInItemForm ref =" stockInItemFormRef" :items =" formData.items" />
56
+ </el-tab-pane >
57
+ </el-tabs >
58
+ </ContentWrap >
59
59
<template #footer >
60
60
<el-button @click =" submitForm" type =" primary" :disabled =" formLoading" >确 定</el-button >
61
61
<el-button @click =" dialogVisible = false" >取 消</el-button >
@@ -82,18 +82,15 @@ const formData = ref({
82
82
no: undefined ,
83
83
supplierId: undefined ,
84
84
inTime: undefined ,
85
- totalCount : undefined ,
86
- totalPrice: undefined ,
87
- remark: undefined
85
+ remark : undefined ,
86
+ fileUrl: ' ' ,
87
+ items: []
88
88
})
89
89
const formRules = reactive ({
90
90
no: [{ required: true , message: ' 入库单号不能为空' , trigger: ' blur' }],
91
- inTime: [{ required: true , message: ' 入库时间不能为空' , trigger: ' blur' }],
92
- totalCount: [{ required: true , message: ' 合计数量不能为空' , trigger: ' blur' }],
93
- totalPrice: [{ required: true , message: ' 合计金额,单位:元不能为空' , trigger: ' blur' }]
91
+ inTime: [{ required: true , message: ' 入库时间不能为空' , trigger: ' blur' }]
94
92
})
95
93
const formRef = ref () // 表单 Ref
96
- const formRef2 = ref () // 表单 Ref TODO 芋艿:需要优化
97
94
98
95
/** 子表的表单 */
99
96
const subTabsName = ref (' stockInItem' )
@@ -122,20 +119,11 @@ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成
122
119
const submitForm = async () => {
123
120
// 校验表单
124
121
await formRef .value .validate ()
125
- await formRef2 .value .validate () // TODO 芋艿:需要在看看
126
- // 校验子表单
127
- try {
128
- await stockInItemFormRef .value .validate ()
129
- } catch (e ) {
130
- subTabsName .value = ' stockInItem'
131
- return
132
- }
122
+ await stockInItemFormRef .value .validate ()
133
123
// 提交请求
134
124
formLoading .value = true
135
125
try {
136
126
const data = formData .value as unknown as StockInVO
137
- // 拼接子表的数据
138
- data .stockInItems = stockInItemFormRef .value .getData ()
139
127
if (formType .value === ' create' ) {
140
128
await StockInApi .createStockIn (data )
141
129
message .success (t (' common.createSuccess' ))
@@ -160,9 +148,10 @@ const resetForm = () => {
160
148
inTime: undefined ,
161
149
totalCount: undefined ,
162
150
totalPrice: undefined ,
163
- remark: undefined
151
+ remark: undefined ,
152
+ fileUrl: undefined ,
153
+ items: []
164
154
}
165
155
formRef .value ?.resetFields ()
166
- formRef2 .value ?.resetFields () // TODO 芋艿:需要在看看
167
156
}
168
157
</script >
0 commit comments