feat(project-demand): 实现主子项目名称模糊查询功能

- 在项目需求汇总、成本明细、支出明细和共享明细页面添加主子项目名称模糊查询功能
- 新增相关 API 接口和方法以支持模糊查询
- 优化 fvSelect 组件以适配远程搜索功能
This commit is contained in:
dj
2025-08-03 18:55:53 +08:00
parent 1ad6e021a1
commit 19c566cd0d
5 changed files with 246 additions and 26 deletions

View File

@@ -15,6 +15,12 @@ import {reactive, ref} from "vue";
import {useRoute, useRouter} from "vue-router";
import {costTemplateDownload, exportExcel, ledgerTemplateDownload} from "../../../api/project-manage";
import ImportCostExcel from "@/components/ImportCostExcel.vue";
import fvSelect from "@/fvcomponents/fvSelect/index.vue";
import {
getExpenseMasterProjectNameOption, getExpenseSubprojectNameOption,
getMasterProjectNameOption,
getSubprojectNameOption
} from "@/api/project-demand/summary/index.js";
const router = useRouter()
const route = useRoute()
const searchConfig = ref([
@@ -22,24 +28,65 @@ const searchConfig = ref([
{
label: '主项目',
prop: 'masterProjectName',
component: 'el-input',
component: shallowRef(fvSelect),
props: {
placeholder: '请输入主项目查询',
placeholder: '请输入主项目',
clearable: true,
filterable: true,
checkStrictly: true
}
options: [],
remote: true,
remoteMethod:async (val)=>{
console.log('val',val)
if(val){
const res=await getExpenseMasterProjectNameOption(val)
if(res.code==1000){
let optionObj={}
let optionsMap = new Map();
res.data.forEach(item=>{
optionObj={
value:item.label,
label:item.label
}
optionsMap.set(optionObj.value, optionObj);
})
// 将 Map 转换为数组
searchConfig.value.find(item => item.prop == 'masterProjectName').props.options = Array.from(optionsMap.values())
}
}
}
},
},
{
label: '子项目',
prop: 'subProjectName',
component: 'el-input',
component: shallowRef(fvSelect),
props: {
placeholder: '请输入子项目查询',
placeholder: '请输入子项目',
clearable: true,
filterable: true,
checkStrictly: true
}
options: [],
remote: true,
remoteMethod:async (val)=>{
if(val){
const res=await getExpenseSubprojectNameOption(val)
if(res.code==1000){
let optionObj={}
let optionsMap = new Map();
res.data.forEach(item=>{
if (item.value !== null && item.value !== "") { // 过滤 value 为 null 和 "" 的数据
optionObj={
value:item.label,
label:item.label
}
optionsMap.set(optionObj.value, optionObj);
}
})
// 将 Map 转换为数组
searchConfig.value.find(item => item.prop == 'subProjectName').props.options = Array.from(optionsMap.values())
}
}
}
},
},
{
label: '会计凭证记载金额(元)',

View File

@@ -11,6 +11,11 @@
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
import {toThousands} from '@/utils/changePrice.js'
import { getSubCompOpt } from '@/api/user/user.js';
import {
getMasterProjectNameOption,
getRequirementName,
getSubprojectNameOption
} from "@/api/project-demand/summary/index.js";
const router = useRouter()
const route = useRoute()
const searchConfig = ref(
@@ -19,24 +24,65 @@ const searchConfig = ref(
{
label: '主项目',
prop: 'masterProjectName',
component: 'el-input',
component: shallowRef(fvSelect),
props: {
placeholder: '请输入主项目查询',
placeholder: '请输入主项目',
clearable: true,
filterable: true,
checkStrictly: true
}
options: [],
remote: true,
remoteMethod:async (val)=>{
console.log('val',val)
if(val){
const res=await getMasterProjectNameOption(val)
if(res.code==1000){
let optionObj={}
let optionsMap = new Map();
res.data.forEach(item=>{
optionObj={
value:item.label,
label:item.label
}
optionsMap.set(optionObj.value, optionObj);
})
// 将 Map 转换为数组
searchConfig.value.find(item => item.prop == 'masterProjectName').props.options = Array.from(optionsMap.values())
}
}
}
},
},
{
label: '子项目',
prop: 'subProjectName',
component: 'el-input',
component: shallowRef(fvSelect),
props: {
placeholder: '请输入子项目查询',
placeholder: '请输入子项目',
clearable: true,
filterable: true,
checkStrictly: true
}
options: [],
remote: true,
remoteMethod:async (val)=>{
if(val){
const res=await getSubprojectNameOption(val)
if(res.code==1000){
let optionObj={}
let optionsMap = new Map();
res.data.forEach(item=>{
if (item.value !== null && item.value !== "") { // 过滤 value 为 null 和 "" 的数据
optionObj={
value:item.label,
label:item.label
}
optionsMap.set(optionObj.value, optionObj);
}
})
// 将 Map 转换为数组
searchConfig.value.find(item => item.prop == 'subProjectName').props.options = Array.from(optionsMap.values())
}
}
}
},
},
{
label: '项目类型',

View File

@@ -16,19 +16,77 @@ import { getSubCompOpt } from '@/api/user/user.js';
import {reactive, ref} from "vue";
import {shareDetailExport, shareExportExcel} from "@/api/expense-manage";
import {ElMessage} from "element-plus";
import {
getCostMasterProjectNameOption, getCostSubprojectNameOption,
getMasterProjectNameOption,
getSubprojectNameOption
} from "@/api/project-demand/summary/index.js";
const router = useRouter()
const route = useRoute()
const searchConfig = reactive([
const searchConfig = ref([
{
label: '主项目',
prop: 'masterProjectName',
component: shallowRef(fvSelect),
props: {
placeholder: '请输入主项目',
clearable: true,
filterable: true,
options: [],
remote: true,
remoteMethod:async (val)=>{
console.log('val',val)
if(val){
const res=await getCostMasterProjectNameOption(val)
if(res.code==1000){
let optionObj={}
let optionsMap = new Map();
res.data.forEach(item=>{
optionObj={
value:item.label,
label:item.label
}
optionsMap.set(optionObj.value, optionObj);
})
// 将 Map 转换为数组
searchConfig.value.find(item => item.prop == 'masterProjectName').props.options = Array.from(optionsMap.values())
}
}
}
},
},
{
label: '子项目',
prop: 'subProjectName',
component: 'el-input',
component: shallowRef(fvSelect),
props: {
placeholder: '请输入子项目查询',
placeholder: '请输入子项目',
clearable: true,
filterable: true,
checkStrictly: true
}
options: [],
remote: true,
remoteMethod:async (val)=>{
if(val){
const res=await getCostSubprojectNameOption(val)
if(res.code==1000){
let optionObj={}
let optionsMap = new Map();
res.data.forEach(item=>{
if (item.value !== null && item.value !== "") { // 过滤 value 为 null 和 "" 的数据
optionObj={
value:item.label,
label:item.label
}
optionsMap.set(optionObj.value, optionObj);
}
})
// 将 Map 转换为数组
searchConfig.value.find(item => item.prop == 'subProjectName').props.options = Array.from(optionsMap.values())
}
}
}
},
},
// {
// label: '支付月份',