e5777926
wuxw
优化工作办理
|
1
2
3
|
<template>
<div class="resource-enter-manage-container">
<el-card class="box-card">
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
4
5
|
<div slot="header" class="flex justify-between">
<span>{{ $t('resourceEnterManage.orderId') }}:{{ resourceEnterManageInfo.applyOrderId }}</span>
|
e5777926
wuxw
优化工作办理
|
6
7
8
9
|
</div>
<el-row :gutter="20">
<el-col :span="24">
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
10
11
12
|
<el-table :data="resourceEnterManageInfo.purchaseApplyDetailVo" border style="width: 100%"
class="table-wrapper" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
|
e5777926
wuxw
优化工作办理
|
13
14
|
<el-table-column prop="rstName" :label="$t('resourceEnterManage.itemType')" align="center">
<template slot-scope="scope">
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
15
|
{{ scope.row.rstName || '-' }}
|
e5777926
wuxw
优化工作办理
|
16
17
18
19
20
|
</template>
</el-table-column>
<el-table-column prop="resName" :label="$t('resourceEnterManage.itemName')" align="center" />
<el-table-column prop="specName" :label="$t('resourceEnterManage.itemSpec')" align="center">
<template slot-scope="scope">
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
21
|
{{ scope.row.specName || '-' }}
|
e5777926
wuxw
优化工作办理
|
22
23
24
25
26
27
|
</template>
</el-table-column>
<el-table-column prop="resCode" :label="$t('resourceEnterManage.itemCode')" align="center" />
<el-table-column prop="stock" :label="$t('resourceEnterManage.itemStock')" align="center" />
<el-table-column prop="standardPrice" :label="$t('resourceEnterManage.referencePrice')" align="center">
<template slot-scope="scope">
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
28
|
¥{{ scope.row.standardPrice }}
|
e5777926
wuxw
优化工作办理
|
29
30
31
32
33
|
</template>
</el-table-column>
<el-table-column prop="quantity" :label="$t('resourceEnterManage.applyQuantity')" align="center" />
<el-table-column :label="$t('resourceEnterManage.purchaseQuantity')" align="center">
<template slot-scope="scope">
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
34
35
|
<el-input v-model.number="scope.row.purchaseQuantity" type="number"
:placeholder="$t('resourceEnterManage.purchaseQuantityPlaceholder')" />
|
e5777926
wuxw
优化工作办理
|
36
37
38
39
|
</template>
</el-table-column>
<el-table-column :label="$t('resourceEnterManage.purchasePrice')" align="center">
<template slot-scope="scope">
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
40
41
|
<el-input v-model.number="scope.row.price" type="number"
:placeholder="$t('resourceEnterManage.purchasePricePlaceholder')" />
|
e5777926
wuxw
优化工作办理
|
42
43
44
45
|
</template>
</el-table-column>
<el-table-column :label="$t('resourceEnterManage.supplier')" align="center">
<template slot-scope="scope">
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
46
47
48
49
|
<el-select v-model="scope.row.rsId" :placeholder="$t('resourceEnterManage.selectSupplier')"
style="width:100%">
<el-option v-for="supplier in resourceEnterManageInfo.resourceSuppliers" :key="supplier.rsId"
:label="supplier.supplierName" :value="supplier.rsId" />
|
e5777926
wuxw
优化工作办理
|
50
51
52
53
54
|
</el-select>
</template>
</el-table-column>
<el-table-column :label="$t('resourceEnterManage.remark')" align="center">
<template slot-scope="scope">
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
55
56
|
<el-input v-model="scope.row.purchaseRemark" type="text"
:placeholder="$t('resourceEnterManage.remarkPlaceholder')" />
|
e5777926
wuxw
优化工作办理
|
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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
106
107
|
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
<el-row :gutter="20" class="footer-wrapper">
<el-col :span="22" :offset="2">
<el-button type="primary" @click="handleSubmit">{{ $t('resourceEnterManage.submit') }}</el-button>
</el-col>
</el-row>
</el-card>
</div>
</template>
<script>
import { listPurchaseApplys, listResourceSuppliers, resourceEnter } from '@/api/resource/resourceEnterManageApi'
export default {
name: 'ResourceEnterManageList',
data() {
return {
resourceEnterManageInfo: {
purchaseApplyDetailVo: [],
resourceSuppliers: [],
selectResIds: [],
applyOrderId: '',
taskId: '',
resOrderType: ''
}
}
},
created() {
this.resourceEnterManageInfo.applyOrderId = this.$route.query.applyOrderId
this.resourceEnterManageInfo.resOrderType = this.$route.query.resOrderType
this.resourceEnterManageInfo.taskId = this.$route.query.taskId
this.loadData()
},
methods: {
async loadData() {
await this.listPurchaseApply()
await this.loadResourceSuppliers()
},
async listPurchaseApply() {
try {
const params = {
page: 1,
row: 10,
applyOrderId: this.resourceEnterManageInfo.applyOrderId,
resOrderType: this.resourceEnterManageInfo.resOrderType
}
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
108
|
const data = await listPurchaseApplys(params)
|
e5777926
wuxw
优化工作办理
|
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
const purchaseApply = data.purchaseApplys[0]
Object.assign(this.resourceEnterManageInfo, purchaseApply)
this.resourceEnterManageInfo.purchaseApplyDetailVo.forEach(item => {
item.purchaseQuantity = ''
item.price = ''
item.purchaseRemark = ''
item.rsId = ''
})
} catch (error) {
console.error('Failed to load purchase apply:', error)
}
},
async loadResourceSuppliers() {
try {
const params = { page: 1, row: 50 }
const { data } = await listResourceSuppliers(params)
this.resourceEnterManageInfo.resourceSuppliers = data
} catch (error) {
console.error('Failed to load resource suppliers:', error)
}
},
handleSelectionChange(selection) {
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
131
|
console.log(selection)
|
e5777926
wuxw
优化工作办理
|
132
133
134
135
136
|
this.resourceEnterManageInfo.selectResIds = selection.map(item => item.resId)
},
async handleSubmit() {
// Validation
let msg = ''
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
137
|
const selectedItems = this.resourceEnterManageInfo.purchaseApplyDetailVo.filter(item =>
|
e5777926
wuxw
优化工作办理
|
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
this.resourceEnterManageInfo.selectResIds.includes(item.resId)
)
if (selectedItems.length < 1) {
this.$message.error(this.$t('resourceEnterManage.selectItemError'))
return
}
for (const item of selectedItems) {
if (!item.purchaseQuantity || parseInt(item.purchaseQuantity) < 0) {
msg = this.$t('resourceEnterManage.purchaseQuantityError')
break
}
item.purchaseQuantity = parseInt(item.purchaseQuantity)
|
19bafb73
wuxw
v1.9 优化采购相关bug
|
152
|
|
e5777926
wuxw
优化工作办理
|
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
if (!item.price || parseFloat(item.price) <= 0) {
msg = this.$t('resourceEnterManage.purchasePriceError')
break
}
item.price = parseFloat(item.price)
}
if (msg) {
this.$message.error(msg)
return
}
try {
const response = await resourceEnter(this.resourceEnterManageInfo)
if (response.code === 0) {
this.$message.success(this.$t('resourceEnterManage.submitSuccess'))
this.$router.go(-1)
} else {
this.$message.error(response.msg)
}
} catch (error) {
console.error('Submit failed:', error)
this.$message.error(this.$t('resourceEnterManage.submitError'))
}
}
}
}
</script>
<style lang="scss" scoped>
.resource-enter-manage-container {
padding: 20px;
.box-card {
margin-bottom: 20px;
}
.table-wrapper {
margin-top: 20px;
}
.footer-wrapper {
margin-top: 20px;
text-align: right;
}
}
</style>
|