97151af6
李宇
feat(lqInventory)...
|
1
2
3
4
5
6
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
<template>
<div class="NCC-common-layout">
<div class="NCC-common-layout-center">
<!-- 查询条件 -->
<el-row class="NCC-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item label="申请门店">
<el-select v-model="query.applicationStoreId" placeholder="请选择申请门店" clearable filterable>
<el-option v-for="store in storeOptions" :key="store.id" :label="store.dm" :value="store.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="审批状态">
<el-select v-model="query.approvalStatus" placeholder="请选择审批状态" clearable>
<el-option label="待审批" value="待审批" />
<el-option label="审批中" value="审批中" />
<el-option label="已通过" value="已通过" />
<el-option label="未通过" value="未通过" />
<el-option label="已退回" value="已退回" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="是否已领取">
<el-select v-model="query.isReceived" placeholder="请选择" clearable>
<el-option label="未领取" :value="0" />
<el-option label="已领取" :value="1" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()">查询</el-button>
<el-button icon="el-icon-refresh-right" @click="reset()">重置</el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<!-- 申请列表 -->
<div class="NCC-common-layout-main NCC-flex-main">
<div class="NCC-common-head">
<div>
<el-button type="primary" icon="el-icon-plus" @click="addUsage()">添加使用记录</el-button>
</div>
<div class="NCC-common-head-right">
<el-tooltip effect="dark" content="刷新" placement="top">
<el-link icon="icon-ym icon-ym-Refresh NCC-common-head-icon" :underline="false"
@click="initData()" />
</el-tooltip>
<screenfull isContainer />
</div>
</div>
<NCC-table v-loading="loading" :data="list"
:header-cell-style="{ background: '#f5f7fa', color: '#606266' }">
<el-table-column label="申请编号" align="center" prop="id" width="180">
<template slot-scope="scope">
<div class="id-info">
<i class="el-icon-postcard id-icon"></i>
<span class="text-nowrap">{{ scope.row.id || '无' }}</span>
</div>
</template>
</el-table-column>
<el-table-column label="批次ID" align="center" prop="usageBatchId" width="180">
<template slot-scope="scope">
<span class="text-nowrap">{{ scope.row.usageBatchId || '无' }}</span>
</template>
</el-table-column>
<el-table-column label="申请人" align="center" prop="applicationUserName" width="120" />
<el-table-column label="申请门店" align="center" prop="applicationStoreName" width="150" />
<el-table-column label="申请时间" align="center" prop="applicationTime" width="180">
<template slot-scope="scope">
<span>{{ formatDateTime(scope.row.applicationTime) }}</span>
</template>
</el-table-column>
<el-table-column label="审批状态" align="center" prop="approvalStatus" width="120">
<template slot-scope="scope">
<el-tag :type="getStatusType(scope.row.approvalStatus)" size="small">
{{ scope.row.approvalStatus || '无' }}
</el-tag>
</template>
</el-table-column>
|
97151af6
李宇
feat(lqInventory)...
|
121
122
123
124
125
126
127
128
129
130
131
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
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
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
|
@click="approve(scope.row)" class="approve-btn">
审批
</el-button>
<el-button v-if="scope.row.approvalStatus === '已通过' && scope.row.isReceived === 0"
type="text" icon="el-icon-finished" @click="markReceived(scope.row)"
class="receive-btn">
标记已领取
</el-button>
</div>
</template>
</el-table-column>
</NCC-table>
<pagination :total="total" :page.sync="query.currentPage" :limit.sync="query.pageSize"
@pagination="initData" />
</div>
</div>
<!-- 审批弹窗 -->
<ApprovalDialog v-if="approvalDialogVisible" ref="ApprovalDialog" @refresh="initData" />
<!-- 批次详情弹窗 -->
<BatchDetailDialog v-if="batchDetailDialogVisible" ref="BatchDetailDialog" />
<!-- 添加使用记录弹窗 -->
<UsageMultiForm v-if="usageMultiFormVisible" ref="UsageMultiForm" @refresh="initData" />
</div>
</template>
<script>
import request from '@/utils/request'
import { getApplicationByBatchId, approveApplication, markReceived, getBatchInfo } from '@/api/extend/lqInventory'
import ApprovalDialog from './approval-dialog.vue'
import BatchDetailDialog from './batch-detail-dialog.vue'
import UsageMultiForm from './usage-multi-form.vue'
export default {
components: { ApprovalDialog, BatchDetailDialog, UsageMultiForm },
data() {
return {
loading: false,
list: [],
total: 0,
query: {
currentPage: 1,
pageSize: 20,
applicationStoreId: undefined,
approvalStatus: undefined,
isReceived: undefined
},
storeOptions: [],
approvalDialogVisible: false,
batchDetailDialogVisible: false,
usageMultiFormVisible: false
}
},
created() {
this.initStoreOptions()
this.initData()
},
methods: {
initData() {
this.loading = true
let query = { ...this.query }
// 移除空值
Object.keys(query).forEach(key => {
if (query[key] === undefined || query[key] === null || query[key] === '') {
delete query[key]
}
})
request({
url: '/api/Extend/LqInventoryUsage/GetApplicationList',
method: 'GET',
data: query
}).then(res => {
if (res.code == 200 && res.data) {
this.list = res.data.list || []
this.total = res.data.pagination ? res.data.pagination.total : 0
} else {
this.list = []
this.total = 0
}
this.loading = false
}).catch(() => {
this.loading = false
this.list = []
this.total = 0
})
},
initStoreOptions() {
request({
url: '/api/Extend/LqMdxx',
method: 'GET',
data: {
currentPage: 1,
pageSize: 1000
}
}).then(res => {
if (res.data && res.data.list) {
this.storeOptions = res.data.list
}
}).catch(() => {
this.storeOptions = []
})
},
search() {
this.query.currentPage = 1
this.initData()
},
reset() {
this.query = {
currentPage: 1,
pageSize: 20,
applicationStoreId: undefined,
approvalStatus: undefined,
isReceived: undefined
}
this.initData()
},
viewBatchDetail(row) {
this.batchDetailDialogVisible = true
this.$nextTick(() => {
this.$refs.BatchDetailDialog.init(row.usageBatchId)
})
},
approve(row) {
this.approvalDialogVisible = true
this.$nextTick(() => {
this.$refs.ApprovalDialog.init(row)
})
},
markReceived(row) {
this.$confirm('确定要标记该申请为已领取吗?', '提示', {
type: 'warning'
}).then(() => {
markReceived(row.id).then(res => {
this.$message({
type: 'success',
message: res.msg || '标记成功',
onClose: () => {
this.initData()
}
})
}).catch(() => { })
}).catch(() => { })
},
addUsage() {
this.usageMultiFormVisible = true
this.$nextTick(() => {
this.$refs.UsageMultiForm.init()
})
},
getStatusType(status) {
const statusMap = {
'待审批': 'info',
'审批中': 'warning',
'已通过': 'success',
'未通过': 'danger',
'已退回': 'info'
}
return statusMap[status] || 'info'
},
|
0df75a77
李宇
最新
|
279
280
281
282
283
284
285
286
287
288
289
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
|
getApprovalResultType(result) {
const resultMap = {
'待审批': 'info',
'已通过': 'success',
'未通过': 'danger',
'已退回': 'info'
}
return resultMap[result] || 'info'
},
// 判断是否可以审批
canApprove(row) {
// 状态必须是"审批中"
if (row.approvalStatus !== '审批中') {
return false
}
// 获取当前登录用户信息
const currentUser = this.$store.getters.userInfo
if (!currentUser) {
return false
}
const currentUserId = String(currentUser.userId || currentUser.id || '')
if (!currentUserId) {
return false
}
// 判断当前用户是否在currentApprovers中,且approvalResult为"待审批"
if (!row.currentApprovers || row.currentApprovers.length === 0) {
return false
}
// 检查当前用户的ID是否在审批人列表中,且状态为"待审批"
const isCurrentApprover = row.currentApprovers.some(approver => {
const approverId = String(approver.approverId || '')
return approverId === currentUserId && approver.approvalResult === '待审批'
})
return isCurrentApprover
},
|
97151af6
李宇
feat(lqInventory)...
|
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
|
formatDateTime(timestamp) {
if (!timestamp) return '无'
const date = new Date(timestamp)
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0')
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
}
}
}
</script>
<style lang="scss" scoped>
.text-nowrap {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
}
.id-info {
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
}
.id-icon {
color: #409EFF;
font-size: 16px;
}
.action-buttons {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
|