|
|
|
1
|
+<template>
|
|
|
|
2
|
+ <view class="page">
|
|
|
|
3
|
+ <scroll-view class="scroll" scroll-y>
|
|
|
|
4
|
+ <view class="section" v-if="users.length > 0">
|
|
|
|
5
|
+ <view
|
|
|
|
6
|
+ v-for="it in users"
|
|
|
|
7
|
+ :key="it.id"
|
|
|
|
8
|
+ class="card"
|
|
|
|
9
|
+ :class="{ 'is-selected': selectedId === it.id }"
|
|
|
|
10
|
+ @click="onSelect(it)"
|
|
|
|
11
|
+ >
|
|
|
|
12
|
+ <view class="card-row">
|
|
|
|
13
|
+ <text class="card-name">{{ safeText(it.name) }}</text>
|
|
|
|
14
|
+ <text class="card-check" v-if="selectedId === it.id">✓</text>
|
|
|
|
15
|
+ </view>
|
|
|
|
16
|
+ <view class="card-row sub">
|
|
|
|
17
|
+ <text class="card-label">部门:</text>
|
|
|
|
18
|
+ <text class="card-value">{{ safeText(it.deptName) }}</text>
|
|
|
|
19
|
+ </view>
|
|
|
|
20
|
+ <view class="card-row sub">
|
|
|
|
21
|
+ <text class="card-label">角色:</text>
|
|
|
|
22
|
+ <text class="card-value">{{ safeText(it.roleName) }}</text>
|
|
|
|
23
|
+ </view>
|
|
|
|
24
|
+ <view class="card-row sub">
|
|
|
|
25
|
+ <text class="card-label">用户名:</text>
|
|
|
|
26
|
+ <text class="card-value">{{ safeText(it.username) }}</text>
|
|
|
|
27
|
+ </view>
|
|
|
|
28
|
+ </view>
|
|
|
|
29
|
+ </view>
|
|
|
|
30
|
+ <view v-else-if="!loading" class="empty">暂无可分配人员</view>
|
|
|
|
31
|
+ </scroll-view>
|
|
|
|
32
|
+
|
|
|
|
33
|
+ <view class="footer">
|
|
|
|
34
|
+ <button class="btn submit" :disabled="!selectedId" @click="onSubmit">确定分配</button>
|
|
|
|
35
|
+ </view>
|
|
|
|
36
|
+ </view>
|
|
|
|
37
|
+</template>
|
|
|
|
38
|
+
|
|
|
|
39
|
+<script>
|
|
|
|
40
|
+import { supplierQuotationDealAssignUsersApi, supplierQuotationDealAssignApi } from '@/api/procure-manage/supplierQuotationDeal.js'
|
|
|
|
41
|
+
|
|
|
|
42
|
+export default {
|
|
|
|
43
|
+ name: 'AssignQuoteManage',
|
|
|
|
44
|
+ data() {
|
|
|
|
45
|
+ return {
|
|
|
|
46
|
+ id: '',
|
|
|
|
47
|
+ purchaseDepartment: '',
|
|
|
|
48
|
+ loading: false,
|
|
|
|
49
|
+ users: [],
|
|
|
|
50
|
+ selectedId: ''
|
|
|
|
51
|
+ }
|
|
|
|
52
|
+ },
|
|
|
|
53
|
+ onLoad(options) {
|
|
|
|
54
|
+ this.id = (options && options.id) ? options.id : ''
|
|
|
|
55
|
+ this.purchaseDepartment = (options && options.purchaseDepartment) ? options.purchaseDepartment : ''
|
|
|
|
56
|
+ if (!this.id) {
|
|
|
|
57
|
+ uni.showToast({ title: '缺少主键ID', icon: 'none' })
|
|
|
|
58
|
+ return
|
|
|
|
59
|
+ }
|
|
|
|
60
|
+ this.loadUsers()
|
|
|
|
61
|
+ },
|
|
|
|
62
|
+ methods: {
|
|
|
|
63
|
+ safeText(v) {
|
|
|
|
64
|
+ const s = v == null ? '' : String(v)
|
|
|
|
65
|
+ return s.trim() ? s : '-'
|
|
|
|
66
|
+ },
|
|
|
|
67
|
+ async loadUsers() {
|
|
|
|
68
|
+ this.loading = true
|
|
|
|
69
|
+ try {
|
|
|
|
70
|
+ const res = await supplierQuotationDealAssignUsersApi({ purchaseDepartment: this.purchaseDepartment })
|
|
|
|
71
|
+ const data = (res && res.data) ? res.data : []
|
|
|
|
72
|
+ this.users = Array.isArray(data) ? data : []
|
|
|
|
73
|
+ } catch (e) {
|
|
|
|
74
|
+ this.users = []
|
|
|
|
75
|
+ uni.showToast({ title: '加载人员失败', icon: 'none' })
|
|
|
|
76
|
+ } finally {
|
|
|
|
77
|
+ this.loading = false
|
|
|
|
78
|
+ }
|
|
|
|
79
|
+ },
|
|
|
|
80
|
+ onSelect(it) {
|
|
|
|
81
|
+ this.selectedId = it.id
|
|
|
|
82
|
+ },
|
|
|
|
83
|
+ async onSubmit() {
|
|
|
|
84
|
+ if (!this.selectedId) {
|
|
|
|
85
|
+ uni.showToast({ title: '请选择负责人', icon: 'none' })
|
|
|
|
86
|
+ return
|
|
|
|
87
|
+ }
|
|
|
|
88
|
+ const confirmRes = await new Promise(resolve => {
|
|
|
|
89
|
+ uni.showModal({ title: '提示', content: '确定分配给该负责人吗?', confirmText: '确定', cancelText: '取消', success: resolve })
|
|
|
|
90
|
+ })
|
|
|
|
91
|
+ if (!(confirmRes && confirmRes.confirm)) return
|
|
|
|
92
|
+ try {
|
|
|
|
93
|
+ await supplierQuotationDealAssignApi({ id: this.id, principalId: this.selectedId })
|
|
|
|
94
|
+ uni.showToast({ title: '分配成功', icon: 'none' })
|
|
|
|
95
|
+ try { uni.setStorageSync('QUOTE_MANAGE_LIST_NEED_REFRESH', '1') } catch (e) {}
|
|
|
|
96
|
+ setTimeout(() => { uni.navigateBack() }, 400)
|
|
|
|
97
|
+ } catch (e) {
|
|
|
|
98
|
+ uni.showToast({ title: e.msg || '分配失败', icon: 'none' })
|
|
|
|
99
|
+ }
|
|
|
|
100
|
+ }
|
|
|
|
101
|
+ }
|
|
|
|
102
|
+}
|
|
|
|
103
|
+</script>
|
|
|
|
104
|
+
|
|
|
|
105
|
+<style lang="scss" scoped>
|
|
|
|
106
|
+.page {
|
|
|
|
107
|
+ display: flex;
|
|
|
|
108
|
+ flex-direction: column;
|
|
|
|
109
|
+ height: 100%;
|
|
|
|
110
|
+ background: #f3f3f3;
|
|
|
|
111
|
+}
|
|
|
|
112
|
+
|
|
|
|
113
|
+.scroll {
|
|
|
|
114
|
+ flex: 1;
|
|
|
|
115
|
+ padding: 20rpx 0 200rpx;
|
|
|
|
116
|
+}
|
|
|
|
117
|
+
|
|
|
|
118
|
+.section {
|
|
|
|
119
|
+ padding: 0 24rpx;
|
|
|
|
120
|
+}
|
|
|
|
121
|
+
|
|
|
|
122
|
+.card {
|
|
|
|
123
|
+ background: #fff;
|
|
|
|
124
|
+ border-radius: 12rpx;
|
|
|
|
125
|
+ padding: 28rpx 32rpx;
|
|
|
|
126
|
+ margin-bottom: 20rpx;
|
|
|
|
127
|
+ border: 2rpx solid transparent;
|
|
|
|
128
|
+
|
|
|
|
129
|
+ &.is-selected {
|
|
|
|
130
|
+ border-color: $theme-primary;
|
|
|
|
131
|
+ background: rgba($theme-primary, 0.04);
|
|
|
|
132
|
+ }
|
|
|
|
133
|
+
|
|
|
|
134
|
+ .card-row {
|
|
|
|
135
|
+ display: flex;
|
|
|
|
136
|
+ align-items: center;
|
|
|
|
137
|
+ margin-bottom: 12rpx;
|
|
|
|
138
|
+
|
|
|
|
139
|
+ &.sub {
|
|
|
|
140
|
+ margin-bottom: 8rpx;
|
|
|
|
141
|
+ }
|
|
|
|
142
|
+
|
|
|
|
143
|
+ &:last-child {
|
|
|
|
144
|
+ margin-bottom: 0;
|
|
|
|
145
|
+ }
|
|
|
|
146
|
+ }
|
|
|
|
147
|
+
|
|
|
|
148
|
+ .card-name {
|
|
|
|
149
|
+ flex: 1;
|
|
|
|
150
|
+ font-size: 32rpx;
|
|
|
|
151
|
+ font-weight: 600;
|
|
|
|
152
|
+ color: rgba(0, 0, 0, 0.9);
|
|
|
|
153
|
+ }
|
|
|
|
154
|
+
|
|
|
|
155
|
+ .card-check {
|
|
|
|
156
|
+ color: $theme-primary;
|
|
|
|
157
|
+ font-size: 36rpx;
|
|
|
|
158
|
+ font-weight: 700;
|
|
|
|
159
|
+ }
|
|
|
|
160
|
+
|
|
|
|
161
|
+ .card-label {
|
|
|
|
162
|
+ font-size: 28rpx;
|
|
|
|
163
|
+ color: rgba(0, 0, 0, 0.6);
|
|
|
|
164
|
+ }
|
|
|
|
165
|
+
|
|
|
|
166
|
+ .card-value {
|
|
|
|
167
|
+ flex: 1;
|
|
|
|
168
|
+ font-size: 28rpx;
|
|
|
|
169
|
+ color: rgba(0, 0, 0, 0.9);
|
|
|
|
170
|
+ }
|
|
|
|
171
|
+}
|
|
|
|
172
|
+
|
|
|
|
173
|
+.empty {
|
|
|
|
174
|
+ text-align: center;
|
|
|
|
175
|
+ color: rgba(0, 0, 0, 0.4);
|
|
|
|
176
|
+ font-size: 28rpx;
|
|
|
|
177
|
+ padding: 120rpx 0;
|
|
|
|
178
|
+}
|
|
|
|
179
|
+
|
|
|
|
180
|
+.footer {
|
|
|
|
181
|
+ z-index: 2;
|
|
|
|
182
|
+ position: fixed;
|
|
|
|
183
|
+ left: 0;
|
|
|
|
184
|
+ right: 0;
|
|
|
|
185
|
+ bottom: 0;
|
|
|
|
186
|
+ padding: 32rpx;
|
|
|
|
187
|
+ padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
|
|
|
|
188
|
+ background: #fff;
|
|
|
|
189
|
+ box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
|
|
|
|
190
|
+
|
|
|
|
191
|
+ .btn {
|
|
|
|
192
|
+ height: 80rpx;
|
|
|
|
193
|
+ line-height: 80rpx;
|
|
|
|
194
|
+ border-radius: 12rpx;
|
|
|
|
195
|
+ font-size: 32rpx;
|
|
|
|
196
|
+ }
|
|
|
|
197
|
+
|
|
|
|
198
|
+ .submit {
|
|
|
|
199
|
+ background: $theme-primary;
|
|
|
|
200
|
+ color: #fff;
|
|
|
|
201
|
+
|
|
|
|
202
|
+ &[disabled] {
|
|
|
|
203
|
+ opacity: 0.5;
|
|
|
|
204
|
+ }
|
|
|
|
205
|
+ }
|
|
|
|
206
|
+}
|
|
|
|
207
|
+</style> |