cmvr-wms/ruoyi-ui/src/components/ProjectLoans/PurchasePurpose.vue
lixiaolong ca1f5a27f9 feat(mobile): 优化移动端界面和功能
- 添加移动工作空间对话框全屏样式支持
- 更新应用主视图以支持桌面视口布局
- 重构Excel导入对话框增加预览和校验功能
- 在移动端主页增加生产与交付模块和项目借还功能
- 移动端库存列表显示项目名称和成品标识
- 增加入库记录批量操作和撤销功能
- 优化分页组件在桌面视口中的滚动行为
- 更新路由配置和数据库连接配置
- 调整仓库领域模型移除预期日期字段
- 优化智能代理服务的正则匹配和出库类型处理
2026-10-12 16:41:42 +08:00

12 lines
1.7 KiB
Vue

<template><div>
<el-form-item label="采购用途"><el-radio-group :value="purpose || 'SELF'" :disabled="disabled" @input="changePurpose"><el-radio label="SELF">本项目使用</el-radio><el-radio label="REPAY">归还借用</el-radio></el-radio-group></el-form-item>
<el-form-item v-if="purpose==='REPAY'" label="归还哪笔借用"><el-select :value="loanId" :disabled="disabled" @input="$emit('update:loanId',$event)" :loading="loading" filterable style="width:100%" placeholder="请先选择采购项目和物品">
<el-option v-for="l in options" :key="l.id" :label="l.lenderProjectName+' / '+l.itemName+' / 未还 '+l.outstandingQuantity+' '+(l.unit||'')" :value="l.id"/>
<el-option v-if="loanId && !options.some(l=>l.id===loanId)" :value="loanId" :label="'当前借用 #'+loanId+'(已归还或非待还)'"/>
</el-select></el-form-item>
</div></template>
<script>
import { loanOptions } from '@/api/project/loan'
export default {name:'PurchasePurpose',props:{purpose:String,loanId:[Number,String],projectId:[Number,String],itemId:[Number,String],disabled:Boolean},data:()=>({options:[],loading:false,request:0}),watch:{projectId:'load',itemId:'load',purpose:'load'},mounted(){this.load()},methods:{changePurpose(v){this.$emit('update:purpose',v);if(v==='SELF')this.$emit('update:loanId',null)},load(){const id=++this.request;this.options=[];this.loading=false;if(this.purpose!=='REPAY'||!this.projectId||!this.itemId)return;this.loading=true;loanOptions({projectId:this.projectId,itemId:this.itemId}).then(r=>{if(id===this.request)this.options=(r.data||[]).filter(l=>Number(l.borrowerProjectId)===Number(this.projectId))}).finally(()=>{if(id===this.request)this.loading=false})}}}
</script>