add
This commit is contained in:
parent
52f4e70824
commit
4d40132a02
45
src/components/selectRemote/index.vue
Normal file
45
src/components/selectRemote/index.vue
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<template>
|
||||||
|
<el-select v-model="formData[model]" class="flex-1 w-[280px]">
|
||||||
|
<el-option v-for="(item, index) in list" :key="index" :label="item[lable]" :value="item[value]" />
|
||||||
|
</el-select>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, defineProps, onMounted } from "vue"
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
formData: {
|
||||||
|
require: true,
|
||||||
|
type: Object
|
||||||
|
},
|
||||||
|
model: String,
|
||||||
|
api: Function,
|
||||||
|
lable: {
|
||||||
|
type: String,
|
||||||
|
default: 'projectinfo'
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
type: String,
|
||||||
|
default: 'id'
|
||||||
|
},
|
||||||
|
query: {
|
||||||
|
type: Object,
|
||||||
|
default: {}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const list = ref("")
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
props.api(props.query).then(res => {
|
||||||
|
list.value = res
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
@ -3,11 +3,8 @@
|
|||||||
<el-card class="!border-none mb-4" shadow="never">
|
<el-card class="!border-none mb-4" shadow="never">
|
||||||
<el-form class="mb-[-16px]" :model="queryParams" inline>
|
<el-form class="mb-[-16px]" :model="queryParams" inline>
|
||||||
<el-form-item label="关联项目" prop="cost_project_id">
|
<el-form-item label="关联项目" prop="cost_project_id">
|
||||||
<el-select v-model="queryParams.project_id" remote filterable :remote-method="queryCostProject"
|
<selectRemote :formData="queryParams" model="project_id" :api="apiCostProjectDatas">
|
||||||
:loading="loading" class="flex-1">
|
</selectRemote>
|
||||||
<el-option v-for="(item, index) in optionsData.projectList" :key="index"
|
|
||||||
:label="item.projectinfo" :value="item.id" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="申请编号" prop="num">
|
<el-form-item label="申请编号" prop="num">
|
||||||
<el-input class="w-[280px]" v-model="queryParams.num" clearable placeholder="请输入申请编号" />
|
<el-input class="w-[280px]" v-model="queryParams.num" clearable placeholder="请输入申请编号" />
|
||||||
@ -103,30 +100,12 @@ import { apiApplyWithSealLists, apiApplyWithSealDelete, apiApplyWithSealDetail }
|
|||||||
import feedback from '@/utils/feedback'
|
import feedback from '@/utils/feedback'
|
||||||
import EditPopup from './edit.vue'
|
import EditPopup from './edit.vue'
|
||||||
import { apiCostProjectDatas } from "@/api/cost_project";
|
import { apiCostProjectDatas } from "@/api/cost_project";
|
||||||
import { useDictOptions } from "@/hooks/useDictOptions"
|
|
||||||
|
|
||||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||||
// 是否显示编辑框
|
// 是否显示编辑框
|
||||||
const showEdit = ref(false)
|
const showEdit = ref(false)
|
||||||
const loading = ref(false)
|
|
||||||
|
|
||||||
const queryCostProject = async (query: string) => {
|
|
||||||
loading.value = true
|
|
||||||
const projectList = await apiCostProjectDatas({
|
|
||||||
name: query ?? ''
|
|
||||||
})
|
|
||||||
optionsData.projectList = projectList
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const { optionsData } = useDictOptions<{
|
|
||||||
projectList: any[]
|
|
||||||
}>({
|
|
||||||
projectList: {
|
|
||||||
api: apiCostProjectDatas,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// 查询条件
|
// 查询条件
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user