9c311762
wuxw
工作办理测试中
|
1
2
|
<template>
<div class="resource-out-manage-container">
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
3
4
|
<div class="box-card">
<div class="card-header flex justify-between">
|
9c311762
wuxw
工作办理测试中
|
5
6
|
<span>{{ $t('resourceOutManage.orderId') }}:{{ resourceOutManageInfo.applyOrderId }}</span>
</div>
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
<div class="table-container">
<!-- 加载状态 -->
<div v-if="loading" class="loading-overlay">
<div class="loading-spinner">加载中...</div>
</div>
<!-- 普通HTML表格 -->
<table class="data-table" v-if="!loading">
<thead>
<tr>
<th class="table-header">{{ $t('resourceOutManage.itemType') }}</th>
<th class="table-header">{{ $t('resourceOutManage.itemName') }}</th>
<th class="table-header">{{ $t('resourceOutManage.itemSpec') }}</th>
<th class="table-header">{{ $t('resourceOutManage.itemCode') }}</th>
<th class="table-header">{{ $t('resourceOutManage.itemStock') }}</th>
<th class="table-header">{{ $t('resourceOutManage.applyQuantity') }}</th>
<th class="table-header">{{ $t('resourceOutManage.issueQuantity') }}</th>
<th class="table-header">{{ $t('resourceOutManage.remark') }}</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in resourceOutManageInfo.purchaseApplyDetailVo" :key="index" class="table-row">
<td class="table-cell">{{ item.rstName || '-' }}</td>
<td class="table-cell">{{ item.resName }}</td>
<td class="table-cell">{{ item.specName || '-' }}</td>
<td class="table-cell">{{ item.resCode }}</td>
<td class="table-cell">{{ item.stock }}</td>
<td class="table-cell">{{ item.quantity }}</td>
<td class="table-cell">
<input
v-model.number="item.purchaseQuantity"
type="number"
class="form-input"
:placeholder="$t('resourceOutManage.issueQuantityPlaceholder')"
@input="validateQuantity(item)"
/>
</td>
<td class="table-cell">
<input
v-model="item.purchaseRemark"
type="text"
class="form-input"
:placeholder="$t('resourceOutManage.remarkPlaceholder')"
/>
</td>
</tr>
</tbody>
</table>
<!-- 空数据状态 -->
<div v-if="!loading && resourceOutManageInfo.purchaseApplyDetailVo.length === 0" class="empty-data">
暂无数据
</div>
</div>
<div class="footer-row">
<div class="text-right">
<button type="button" class="btn btn-primary" @click="handleSubmit">
|
9c311762
wuxw
工作办理测试中
|
66
|
{{ $t('resourceOutManage.submit') }}
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
67
68
69
70
|
</button>
</div>
</div>
</div>
|
9c311762
wuxw
工作办理测试中
|
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
</div>
</template>
<script>
import { listPurchaseApplys, submitResourceOut } from '@/api/resource/resourceOutManageApi'
export default {
name: 'ResourceOutManageList',
data() {
return {
loading: false,
resourceOutManageInfo: {
purchaseApplyDetailVo: [],
applyOrderId: '',
taskId: '',
resOrderType: ''
}
}
},
created() {
this.resourceOutManageInfo.applyOrderId = this.$route.query.applyOrderId
this.resourceOutManageInfo.resOrderType = this.$route.query.resOrderType
this.resourceOutManageInfo.taskId = this.$route.query.taskId
this.getList()
},
methods: {
async getList() {
try {
this.loading = true
const params = {
page: 1,
row: 10,
applyOrderId: this.resourceOutManageInfo.applyOrderId,
resOrderType: this.resourceOutManageInfo.resOrderType
}
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
106
|
const data = await listPurchaseApplys(params)
|
9c311762
wuxw
工作办理测试中
|
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
const purchaseApply = data.purchaseApplys[0]
this.resourceOutManageInfo = {
...this.resourceOutManageInfo,
...purchaseApply
}
this.resourceOutManageInfo.purchaseApplyDetailVo.forEach(item => {
item.purchaseQuantity = ''
item.price = ''
item.purchaseRemark = ''
})
} catch (error) {
console.error('Failed to fetch purchase apply list:', error)
this.$message.error(this.$t('resourceOutManage.fetchError'))
} finally {
this.loading = false
}
},
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
124
125
126
127
128
129
130
131
|
// 新增:验证数量输入
validateQuantity(item) {
if (item.purchaseQuantity && parseFloat(item.purchaseQuantity) > parseFloat(item.stock)) {
this.$message.warning('出库数量不能超过库存数量')
}
},
|
9c311762
wuxw
工作办理测试中
|
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
async handleSubmit() {
try {
// Validate form
let isValid = true
this.resourceOutManageInfo.purchaseApplyDetailVo.forEach(item => {
if (!item.purchaseQuantity || parseFloat(item.purchaseQuantity) <= 0) {
this.$message.error(this.$t('resourceOutManage.quantityRequired'))
isValid = false
return
}
item.purchaseQuantity = parseFloat(item.purchaseQuantity)
if (item.purchaseQuantity > parseFloat(item.stock)) {
this.$message.error(this.$t('resourceOutManage.insufficientStock'))
isValid = false
return
}
})
if (!isValid) return
const response = await submitResourceOut(this.resourceOutManageInfo)
if (response.code === 0) {
this.$message.success(this.$t('resourceOutManage.submitSuccess'))
this.$router.go(-1)
} else {
this.$message.error(response.msg)
}
} catch (error) {
console.error('Failed to submit resource out:', error)
this.$message.error(this.$t('resourceOutManage.submitError'))
}
}
}
}
</script>
<style lang="scss" scoped>
.resource-out-manage-container {
padding: 20px;
.box-card {
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
173
174
175
|
background: #fff;
border-radius: 4px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
9c311762
wuxw
工作办理测试中
|
176
177
178
|
margin-bottom: 20px;
}
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
|
.card-header {
padding: 20px;
border-bottom: 1px solid #ebeef5;
font-size: 16px;
font-weight: 500;
color: #303133;
}
.table-container {
position: relative;
padding: 20px;
}
.loading-overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(255, 255, 255, 0.8);
display: flex;
align-items: center;
justify-content: center;
z-index: 10;
}
.loading-spinner {
color: #409eff;
font-size: 14px;
}
.data-table {
width: 100%;
border-collapse: collapse;
border: 1px solid #ebeef5;
border-radius: 4px;
overflow: hidden;
}
.table-header {
background-color: #fafafa;
color: #606266;
font-weight: 500;
padding: 12px 8px;
text-align: center;
border-bottom: 1px solid #ebeef5;
font-size: 14px;
min-width: 120px;
}
.table-row {
&:hover {
background-color: #f5f7fa;
}
&:nth-child(even) {
background-color: #fafafa;
}
}
.table-cell {
padding: 12px 8px;
text-align: center;
border-bottom: 1px solid #ebeef5;
font-size: 14px;
color: #606266;
vertical-align: middle;
}
.form-input {
width: 100%;
padding: 8px 12px;
border: 1px solid #dcdfe6;
border-radius: 4px;
font-size: 14px;
color: #606266;
background-color: #fff;
transition: border-color 0.2s;
box-sizing: border-box;
&:focus {
outline: none;
border-color: #409eff;
box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
}
&::placeholder {
color: #c0c4cc;
}
&:hover {
border-color: #c0c4cc;
}
}
.empty-data {
text-align: center;
padding: 40px;
color: #909399;
font-size: 14px;
}
|
9c311762
wuxw
工作办理测试中
|
281
282
|
.footer-row {
margin-top: 20px;
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
283
284
|
padding: 20px;
border-top: 1px solid #ebeef5;
|
9c311762
wuxw
工作办理测试中
|
285
286
287
288
289
|
}
.text-right {
text-align: right;
}
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
|
.btn {
padding: 10px 20px;
border: none;
border-radius: 4px;
font-size: 14px;
cursor: pointer;
transition: all 0.3s;
&.btn-primary {
background-color: #409eff;
color: #fff;
&:hover {
background-color: #66b1ff;
}
&:active {
background-color: #3a8ee6;
}
&:disabled {
background-color: #a0cfff;
cursor: not-allowed;
}
}
}
// 响应式设计
@media (max-width: 768px) {
.data-table {
font-size: 12px;
}
.table-header,
.table-cell {
padding: 8px 4px;
min-width: 80px;
}
.form-input {
padding: 6px 8px;
font-size: 12px;
}
}
|
9c311762
wuxw
工作办理测试中
|
335
336
|
}
</style>
|