项目编号修改为下拉搜索框

This commit is contained in:
zhangsir
2024-08-29 16:40:01 +08:00
parent 207518d0ef
commit d89cc8ea11
3 changed files with 55 additions and 4 deletions

View File

@@ -0,0 +1,47 @@
<template>
<a-select
:getPopupContainer="
(triggerNode) => {
return triggerNode.parentNode || document.body;
}
"
v-model:value="numValue"
style="width: 100%;"
placeholder="请选择项目编号"
:options="options"
showSearch
allowClear
@select="handleSelect"
>
</a-select>
</template>
<script setup>
import {computed, defineEmits, defineProps, onMounted, ref, watch} from 'vue';
import { useStore } from "vuex";
const props = defineProps({
value: String,
label: String,
})
const emit = defineEmits(['update:value','update:label'])
const store = useStore();
const numValue = ref(props.value)
const handleSelect = (value,option) => {
emit('update:value',value)
emit('update:label',option.id)
};
onMounted(() => {
// console.log(store.state.project_number,'xixixixii')
});
const options = ref([
{id:4,value:1,label:1},
{id:5,value:2,label:2},
{id:6,value:3,label:3},
])
</script>
<style lang="scss" scoped>
::v-deep .ant-select-selector{
border-radius: 8px !important;
}
</style>

View File

@@ -131,5 +131,6 @@ async function init() {
initDict("course_pic"); //课程封面 initDict("course_pic"); //课程封面
initDict("job_type"); //岗位 initDict("job_type"); //岗位
initDict("band"); //band initDict("band"); //band
initDict("examine_cover") initDict("examine_cover") //讲师认证封面图
initDict("project_number") //项目编号
} }

View File

@@ -150,7 +150,8 @@
<div class="num" v-if="projectInfo.boeFlag === 1"> <div class="num" v-if="projectInfo.boeFlag === 1">
<div class="num_text">项目编号</div> <div class="num_text">项目编号</div>
<div class="num_input"> <div class="num_input">
<a-input style="border-radius: 8px;" show-count allowClear maxlength="30" v-model:value="projectInfo.numValue" placeholder="请输入项目编号" /> <!-- <a-input style="border-radius: 8px;" show-count allowClear maxlength="30" v-model:value="projectInfo.numValue" placeholder="请输入项目编号" /> -->
<ProjectNumber v-model:value="projectInfo.numValue" v-model:label="projectInfo.numLabel"></ProjectNumber>
</div> </div>
</div> </div>
</div> </div>
@@ -275,7 +276,7 @@ import * as api2 from "../../api/indexAudit";
import {validateName} from "@/api/index1"; import {validateName} from "@/api/index1";
import dayjs from "dayjs"; import dayjs from "dayjs";
import {scrollLoad} from "@/api/method"; import {scrollLoad} from "@/api/method";
import ProjectNumber from "@/components/project/ProjectNumber";
export default { export default {
name: "projectAdd", name: "projectAdd",
components: { components: {
@@ -285,6 +286,7 @@ export default {
TrainClass, TrainClass,
NameInput, NameInput,
OrgClass, OrgClass,
ProjectNumber
}, },
setup() { setup() {
const store = useStore(); const store = useStore();
@@ -342,7 +344,8 @@ export default {
}); });
watch(()=>state.projectInfo.boeFlag,(val)=>{ watch(()=>state.projectInfo.boeFlag,(val)=>{
if(!val){ if(!val){
state.projectInfo.numValue = '' state.projectInfo.numValue = null
state.projectInfo.numLabel = null
} }
}) })