Commit 2b2c2195 authored by 白舜's avatar 白舜 🎱

优化改进“能力推荐管理”

parent 9f57ca73
...@@ -130,6 +130,10 @@ const move = (type) => { ...@@ -130,6 +130,10 @@ const move = (type) => {
}; };
emit("move", temp); emit("move", temp);
}; };
defineExpose({
checked
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<template v-if="props.list.length > 0"> <template v-if="props.list.length > 0">
<div v-for="(item, i) in props.list" :key="'card' + i" class="item"> <div v-for="(item, i) in props.list" :key="'card' + i" class="item">
<ability-card <ability-card
ref="itemRefs"
:item="item" :item="item"
@change-selected-list="changeSelectedList" @change-selected-list="changeSelectedList"
:flag="props.flag" :flag="props.flag"
...@@ -22,7 +23,9 @@ ...@@ -22,7 +23,9 @@
</template> </template>
<script setup> <script setup>
import { onMounted, ref } from "vue";
import abilityCard from "./ability-card.vue"; import abilityCard from "./ability-card.vue";
const itemRefs = ref([]);
const props = defineProps({ const props = defineProps({
list: { list: {
type: Array, type: Array,
...@@ -35,7 +38,7 @@ const props = defineProps({ ...@@ -35,7 +38,7 @@ const props = defineProps({
loading: { loading: {
type: Boolean, type: Boolean,
default: false, default: false,
} },
}); });
const emit = defineEmits(["changeSelectedList", "openBox", "deleteItem", "move"]); const emit = defineEmits(["changeSelectedList", "openBox", "deleteItem", "move"]);
const changeSelectedList = (item, checked) => { const changeSelectedList = (item, checked) => {
...@@ -50,6 +53,19 @@ const deleteItem = (item) => { ...@@ -50,6 +53,19 @@ const deleteItem = (item) => {
const move = (temp) => { const move = (temp) => {
emit("move", temp); emit("move", temp);
}; };
// const setRef = (el, index) => {
// itemRefs.value.push(el)
// }
onMounted(() => {
console.log(itemRefs);
})
defineExpose({
list: props.list,
itemRefs
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -102,13 +102,16 @@ ...@@ -102,13 +102,16 @@
</div> </div>
<div> <div>
<span>已选择</span> <span>已选择</span>
<span class="num">({{ toBeAddedItemList.length }}/9)</span> <span class="num"
>({{ selectedItemList.length + toBeAddedItemList.length }}/9)</span
>
<span></span> <span></span>
<span class="can_click_text" @click="clearSelection">清空</span> <span class="can_click_text" @click="clearSelection">清空</span>
</div> </div>
</div> </div>
<div class="user_table bg-scroll"> <div class="user_table bg-scroll">
<ability-list <ability-list
ref="abilityListRef"
:list="list" :list="list"
:loading="abilityLoading" :loading="abilityLoading"
:flag="false" :flag="false"
...@@ -146,6 +149,7 @@ import abilityList from "@/components/ability-list.vue"; ...@@ -146,6 +149,7 @@ import abilityList from "@/components/ability-list.vue";
const router = useRouter(); const router = useRouter();
const route = useRoute(); const route = useRoute();
const typeFormRef = ref(null); const typeFormRef = ref(null);
const abilityListRef = ref(null);
const state = reactive({ const state = reactive({
formData: { formData: {
business_type_id: "", business_type_id: "",
...@@ -322,7 +326,9 @@ const changeCollation = (val) => { ...@@ -322,7 +326,9 @@ const changeCollation = (val) => {
const clearSelection = () => { const clearSelection = () => {
state.toBeAddedItemList = []; state.toBeAddedItemList = [];
state.list = []; abilityListRef.value.itemRefs.forEach((item) => {
item.checked = false;
});
}; };
const searchAction = () => { const searchAction = () => {
changePage(1); changePage(1);
...@@ -368,7 +374,8 @@ const submit = () => { ...@@ -368,7 +374,8 @@ const submit = () => {
const cancelSelectDialog = () => { const cancelSelectDialog = () => {
state.selectDialog = false; state.selectDialog = false;
clearSelection(); state.toBeAddedItemList = [];
state.list = [];
}; };
const confirm = () => { const confirm = () => {
...@@ -391,8 +398,7 @@ const confirm = () => { ...@@ -391,8 +398,7 @@ const confirm = () => {
state.selectedItemList.push(..._newItemList); state.selectedItemList.push(..._newItemList);
state.toBeAddedItemList.length = 0; state.toBeAddedItemList.length = 0;
moveAbleChanging(); moveAbleChanging();
clearSelection(); cancelSelectDialog();
state.selectDialog = false;
}; };
const submitFormData = (data) => { const submitFormData = (data) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment