采购更新
This commit is contained in:
@@ -38,6 +38,10 @@
|
||||
<el-form-item v-if="agentMode === 'random'">
|
||||
<el-button type="primary" :loading="assignAgentSubmitting" :disabled="!!assignedAgentName" @click="handleAssignAgentRandom">随机分配</el-button>
|
||||
</el-form-item>
|
||||
<!-- 发送招标代理按钮 -->
|
||||
<el-form-item v-if="canSendToAgent">
|
||||
<el-button type="success" :loading="sendToAgentSubmitting" @click="handleSendToAgent">发送招标代理</el-button>
|
||||
</el-form-item>
|
||||
</template>
|
||||
|
||||
<!-- 仅部门审核角色显示:采购代表相关 -->
|
||||
@@ -71,7 +75,7 @@
|
||||
<script setup lang="ts" name="PurchasingImplement">
|
||||
import { ref, computed, onMounted, watch, onUnmounted } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { getDeptMembers, getObj, assignAgent } from '/@/api/finance/purchasingrequisition'
|
||||
import { getDeptMembers, getObj, assignAgent, sendToAgent } from '/@/api/finance/purchasingrequisition'
|
||||
import { getPage as getAgentPage } from '/@/api/finance/purchaseagent'
|
||||
import { useMessage } from '/@/hooks/message'
|
||||
import { Session } from '/@/utils/storage'
|
||||
@@ -129,6 +133,7 @@ const agentListLoading = ref(false)
|
||||
const assignAgentSubmitting = ref(false)
|
||||
const rollingAgentName = ref<string>('')
|
||||
const assignedAgentName = ref<string>('')
|
||||
const sendToAgentSubmitting = ref(false)
|
||||
let rollInterval: ReturnType<typeof setInterval> | null = null
|
||||
|
||||
/** 是否可以分配代理:委托代理采购 且 (学校统一采购 或 部门自行采购且委托采购中心采购) */
|
||||
@@ -140,6 +145,16 @@ const canAssignAgent = computed(() => {
|
||||
return row.purchaseMode === '2' || (row.purchaseMode === '0' && row.purchaseType === '4')
|
||||
})
|
||||
|
||||
/** 是否可以发送招标代理:委托代理采购 且 已分配代理 且 未发送 */
|
||||
const canSendToAgent = computed(() => {
|
||||
// 自行组织采购不需要发送
|
||||
if (implementType.value !== '2') return false
|
||||
const row = applyRow.value
|
||||
if (!row) return false
|
||||
// 已分配代理 且 未发送
|
||||
return !!row.agentId && row.agentSent !== '1'
|
||||
})
|
||||
|
||||
const loadAgentList = async () => {
|
||||
if (!canAssignAgent.value) return
|
||||
agentListLoading.value = true
|
||||
@@ -233,6 +248,25 @@ const handleAssignAgentDesignated = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
/** 发送招标代理 */
|
||||
const handleSendToAgent = async () => {
|
||||
const id = applyRow.value?.id ?? applyId.value
|
||||
if (!id) {
|
||||
useMessage().warning('无法获取申请单ID')
|
||||
return
|
||||
}
|
||||
sendToAgentSubmitting.value = true
|
||||
try {
|
||||
await sendToAgent(Number(id))
|
||||
useMessage().success('已发送招标代理')
|
||||
await loadData()
|
||||
} catch (e: any) {
|
||||
useMessage().error(e?.msg || '发送招标代理失败')
|
||||
} finally {
|
||||
sendToAgentSubmitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const isInIframe = () => typeof window !== 'undefined' && window.self !== window.top
|
||||
|
||||
const postMessage = (type: string, payload?: any) => {
|
||||
|
||||
Reference in New Issue
Block a user