Commit ec6b490d5903a44f37f92155bdda65589df1c713

Authored by gesilong
1 parent c619206e

报价管理联调

@@ -11,8 +11,27 @@ export function supplierQuotationDealQueryApi(params) { @@ -11,8 +11,27 @@ export function supplierQuotationDealQueryApi(params) {
11 11
12 export function supplierQuotationDealGetApi(id) { 12 export function supplierQuotationDealGetApi(id) {
13 return request({ 13 return request({
14 - url: '/procurement/supplierQuotationDeal/get', 14 + url: '/procurement/supplierQuotationDeal',
15 method: 'get', 15 method: 'get',
16 params: { id } 16 params: { id }
17 }) 17 })
18 } 18 }
  19 +
  20 +// 可分配人员
  21 +export function supplierQuotationDealAssignUsersApi(params) {
  22 + return request({
  23 + url: '/procurement/supplierQuotationDeal/assignUsers',
  24 + method: 'get',
  25 + params
  26 + })
  27 +}
  28 +
  29 +// 分配
  30 +export function supplierQuotationDealAssignApi(data) {
  31 + return request({
  32 + url: '/procurement/supplierQuotationDeal/assign',
  33 + method: 'put',
  34 + data,
  35 + contentType: ContentTypeEnum.JSON
  36 + })
  37 +}
@@ -373,6 +373,14 @@ @@ -373,6 +373,14 @@
373 } 373 }
374 }, 374 },
375 { 375 {
  376 + "path": "pages/quote-manage/assign",
  377 + "style": {
  378 + "navigationBarTitleText": "分配负责人",
  379 + "navigationBarBackgroundColor": "#ffffff",
  380 + "navigationBarTextStyle": "black"
  381 + }
  382 + },
  383 + {
376 "path": "pages/peer-info/index", 384 "path": "pages/peer-info/index",
377 "style": { 385 "style": {
378 "navigationBarTitleText": "同行信息", 386 "navigationBarTitleText": "同行信息",
  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>
@@ -16,19 +16,36 @@ @@ -16,19 +16,36 @@
16 </view> 16 </view>
17 </view> 17 </view>
18 </scroll-view> 18 </scroll-view>
  19 +
  20 + <detail-buttons :buttons="displayButtons" @click="handleButtonClick" />
19 </view> 21 </view>
20 </template> 22 </template>
21 23
22 <script> 24 <script>
  25 +import DetailButtons from '@/components/detail-buttons/index.vue'
23 import { supplierQuotationDealGetApi } from '@/api/procure-manage/supplierQuotationDeal.js' 26 import { supplierQuotationDealGetApi } from '@/api/procure-manage/supplierQuotationDeal.js'
24 27
25 export default { 28 export default {
26 name: 'QuoteManageDetail', 29 name: 'QuoteManageDetail',
  30 + components: { DetailButtons },
27 data() { 31 data() {
28 return { 32 return {
29 id: '', 33 id: '',
30 loading: false, 34 loading: false,
31 - form: {} 35 + form: {},
  36 + buttons: [{
  37 + text: '分配',
  38 + visible: true,
  39 + variant: 'primary',
  40 + event: 'assign'
  41 + }]
  42 + }
  43 + },
  44 + computed: {
  45 + displayButtons() {
  46 + return [
  47 + { ...this.buttons[0], visible: !this.form.principalId && this.$auth.hasPermi('procure-manage:quote-manage:assign') }
  48 + ]
32 } 49 }
33 }, 50 },
34 onShow() { 51 onShow() {
@@ -61,6 +78,15 @@ export default { @@ -61,6 +78,15 @@ export default {
61 } finally { 78 } finally {
62 this.loading = false 79 this.loading = false
63 } 80 }
  81 + },
  82 + handleButtonClick(btn) {
  83 + if (!btn || btn.disabled) return
  84 + const e = btn.event || ''
  85 + if (e === 'assign') return this.onAssign()
  86 + },
  87 + onAssign() {
  88 + const pd = this.form.purchaseDepartment || this.form.purchaseDepartmentId || ''
  89 + uni.navigateTo({ url: '/pages/quote-manage/assign?id=' + this.id + '&purchaseDepartment=' + pd })
64 } 90 }
65 } 91 }
66 } 92 }