组件调整

This commit is contained in:
weiwei committed 2025-02-21 09:22:39 +08:00
1 parent 211ba23883
commit 496e45b770
9 files changed
+1045 -507

No files matched your search

@@ -0,0 +1,82 @@
<template>
<el-select
style="width: 100%"
v-model="state.selectId"
:placeholder="props.placeholder"
clearable
remote-show-suffix
filterable
remote
:remote-method="remoteSearch"
:loading="state.loading"
@visible-change="(e: boolean) => e && getOptions()"
>
<el-option v-for="v in state.options" :key="v.id" :label="`${v.nameWithMobile}`" :value="v.id">
<!-- <div class="flex items-center">
<div class="color-primary">{{ v.name }}</div>
<div class="flex items-center just ml5">
<el-tag size="small">
{{ v.deptName }}
</el-tag>
</div>
</div> -->
</el-option>
</el-select>
</template>
<script setup lang="ts" name="SelectHandlerUser">
import { reactive } from "vue"
import { getSimpleUserAll } from "/@/api/admin/user"
const selectId = defineModel()
export type Props = {
placeholder?: string
}
const props = withDefaults(defineProps<Props>(), {
placeholder: "请选择",
})
const queryForm = reactive<any>({})
const state = reactive<any>({
loading: true,
selectId: selectId,
options: [],
})
watch(
selectId,
(newVal, oldValue) => {
if (newVal == oldValue) return
state.selectId = newVal
getOptions()
},
{ immediate: true },
)
async function getOptions() {
try {
state.loading = true
const _pa = {
...queryForm,
}
const { data } = await getSimpleUserAll(_pa)
state.options = data ?? []
} finally {
setTimeout(() => (state.loading = false), 500)
}
}
function remoteSearch(params: string) {
if (params != queryForm.name) {
queryForm.name = params
getOptions()
}
}
function clear() {
state.selectId = null
getOptions()
}
</script>
+2
View File
@@ -22,6 +22,7 @@ import SelectDept from "/@/components/Select/SelectDept.vue"
import SelectCtcg from "/@/components/Select/SelectCtcg.vue"
import SelectCtcgol from "/@/components/Select/SelectCtcgol.vue"
import SelectHardGroup from "/@/components/Select/selectHardGroup.vue"
import SelectHandlerUser from "/@/components/Select/SelectHandlerUser.vue"
// 第三方组件
import ElementPlus from "element-plus"
@@ -66,6 +67,7 @@ export default {
app.component("SelectCtcg", SelectCtcg)
app.component("SelectCtcgol", SelectCtcgol)
app.component("SelectHardGroup", SelectHardGroup)
app.component("SelectHandlerUser", SelectHandlerUser)
// 导入全部的elmenet-plus的图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {