修复我管理的页面bug

This commit is contained in:
GUjiYN 2024-03-15 13:26:19 +08:00
parent 0eace96ab7
commit 842fcbde8c

View File

@ -1,102 +1,33 @@
<template> <template>
<div class="flex flex-col h-full bg-gray-50 w-full"> <div class="flex flex-col w-full">
<a-breadcrumb class="mt-6 ml-6"> <a-breadcrumb class="mt-6 ml-6">
<a-breadcrumb-item>我管理的</a-breadcrumb-item> <a-breadcrumb-item>我管理的</a-breadcrumb-item>
<a-breadcrumb-item><a href="">梁溪区纪委大数据管理平台项目</a></a-breadcrumb-item> <a-breadcrumb-item><a href="">梁溪区纪委大数据管理平台项目</a></a-breadcrumb-item>
</a-breadcrumb> </a-breadcrumb>
<div class="flex space-x-[10vw] ml-96"> <div class="flex flex-row justify-between mt-3">
<div class="inline-flex rounded-md ml-6" role="group"> <div>
<button <!-- 第一个是 全部 所以独立出来 -->
<a-checkable-tag
:class="buttonClass('DisableSelection')" v-model:checked="tagAll"
class="w-16 h-8 flex justify-center items-center" @change="checked => handleClickAll(checked)"
type="button"
@click="toggleSelectionDisabled"
> >
全部 全部
</button> </a-checkable-tag>
<button <a-checkable-tag
:class="buttonClass('web')" v-for="(tag, index) in tagsData"
class="w-16 h-8 flex justify-center items-center" :key="tag.id"
type="button" v-model:checked="selectTags[index]"
@click="toggleSelection('web')" @change="checked => handleChange(tag, checked)"
> >
Web {{ tag.name }}
</button> </a-checkable-tag>
<button
:class="buttonClass('Ai')"
class="w-16 h-8 flex justify-center items-center"
type="button"
@click="toggleSelection('Ai')"
>
Ai
</button>
<button
:class="buttonClass('App')"
class="w-16 h-8 flex justify-center items-center"
type="button"
@click="toggleSelection('App')"
>
App
</button>
<button
:class="buttonClass('大数据')"
class="w-20 h-8 flex justify-center items-center"
type="button"
@click="toggleSelection('大数据')"
>
大数据
</button>
</div> </div>
<div class="flex space-x-8"> <div>
<label class="inline-flex items-center space-x-2 hover:text-blue-600"> <a-checkbox-group v-model:value="projStatus" :options="['进行中','已完成']" />
<input
v-model="selectedStatus.weikaishi"
class="form-checkbox h-5 w-5 text-red-400 rounded-lg focus:ring-white"
type="checkbox"
/>
<span class="text-sm">未开始</span>
</label>
<label class="inline-flex items-center space-x-2 hover:text-blue-600">
<input
v-model="selectedStatus.jinxingzhong"
class="form-checkbox h-5 w-5 text-blue-400 rounded-lg focus:ring-white"
type="checkbox"
/>
<span class="text-sm">进行中</span>
</label>
<label class="inline-flex items-center space-x-2 hover:text-blue-600">
<input
v-model="selectedStatus.yiwancheng"
class="form-checkbox h-5 w-5 text-green-400 rounded-full focus:ring-white"
type="checkbox"
/>
<span class="text-sm">已完成</span>
</label>
<label class="inline-flex items-center space-x-2 hover:text-blue-600">
<input
v-model="selectedStatus.stop"
class="form-checkbox h-5 w-5 text-red-400 rounded-full focus:ring-white "
type="checkbox"
/>
<span class="text-sm ">暂停</span>
</label>
</div> </div>
</div>
</div> </div>
<div class="mt-12 ml-12 flex space-x-16 h-full"> <div class="mt-12 ml-12 flex space-x-16 h-full">
<div class="flex flex-col space-y-6 border-r border-gray-200 w-80 h-full p-8">
<p class="text-lg">项目名称梁溪区纪委大数据管理平台项目</p>
<p>项目周期3个月</p>
<p>项目开始日期2024/3/2</p>
<div class="space-y-2">
<p>技术选型</p>
<p>前端vue3</p>
<p>后端java,springboot</p>
</div>
<p>完成情况进行中</p>
<p>是否发布未发布</p>
<p>负责人张三</p>
</div>
<div class="flex space-x-9"> <div class="flex space-x-9">
<a-card v-for="(ChildProject, index) in ChildProjects" :key="index" class="transition-transform transform-gpu hover:scale-105 relative w-96 h-64 rounded-none bg-cover bg-center bg-[url('@/assert/images/img23.jpg')]" @mouseleave="showButton[index]=false" @mouseover="showButton[index]=true"> <a-card v-for="(ChildProject, index) in ChildProjects" :key="index" class="transition-transform transform-gpu hover:scale-105 relative w-96 h-64 rounded-none bg-cover bg-center bg-[url('@/assert/images/img23.jpg')]" @mouseleave="showButton[index]=false" @mouseover="showButton[index]=true">
<div class="flex absolute left-0 bottom-0 min-h-[30%] w-full bg-white"> <div class="flex absolute left-0 bottom-0 min-h-[30%] w-full bg-white">
@ -116,18 +47,20 @@
</a-card> </a-card>
</div> </div>
</div> </div>
</div>
</template> </template>
<script setup> <script setup>
import {onMounted, reactive, ref, watch} from 'vue'; import {onMounted, reactive, ref} from 'vue';
import request from "@/js/request.js"; import request from "@/js/request.js";
const showButton = reactive([]); const showButton = reactive([]);
const token = window.localStorage.getItem('token') const token = window.localStorage.getItem('token')
const ChildProjects = ref([]); // 使ref const ChildProjects = ref([]); // 使ref
const id = ref(13); const id = ref(2);
const tagsData = ref([]);
const selectTags = ref([false, false, false, false]);
onMounted(() =>{ onMounted(() =>{
request.projectWorkGet(id, token).then((res) => { request.projectWorkGet(id, token).then((res) => {
@ -135,81 +68,63 @@ onMounted(() =>{
}) })
}) })
const handleClickAll=(checked)=>{
if(checked){
selectTags.value.forEach((item,index)=>{
selectTags.value[index]=false
})
//
request.projectGet(token).then(res=>{
console.log(res.data.data)
})
}
const toggleSelectionDisabled = () => { }
selectionDisabled.value = !selectionDisabled.value; //
if (selectionDisabled.value) { const handleChange = (tag, checked) => {
// if(checked){
selectedButtons.value = []; tagAll.value=false
}
else{
let flag=true
selectTags.value.forEach((item,index)=>{
if(item){
flag=false
}
})
if(flag){
tagAll.value=true
}
} }
}; };
const toggleSelection = (button) => {
//
if (selectionDisabled.value) {
return;
}
//
const index = selectedButtons.value.indexOf(button);
if (index > -1) {
selectedButtons.value.splice(index, 1); //
} else {
selectedButtons.value.push(button); //
}
};
const buttonClass = (button) => ({
'px-4 py-2 text-sm font-medium border focus:z-10 focus:ring-1': true,
'text-gray-900 bg-white border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:ring-blue-100 focus:text-blue-700 outline-none ': (!selectedButtons.value.includes(button) && !selectionDisabled.value) || (button === 'DisableSelection' && !selectionDisabled.value),
'bg-blue-400 text-white': selectedButtons.value.includes(button) || (button === 'DisableSelection' && selectionDisabled.value), //
});
// @click="selectedTags.web = !selectedTags.web" //
const handleAdd=()=>{
console.log('新增')
// }
const filteredProjects = ref([]);
//
const selectedButtons = ref(['web','ai','大数据']);
const selectionDisabled = ref('');
const selectedStatus = reactive({
weikaishi:true, //1
jinxingzhong:true, //2
yiwancheng:true, //0
stop:true //-1
}); //
const select = reactive({
})
const data = reactive({
tags:[],
isFinish:[]
})
const clickedButton= ref(null)
//
watch(() => selectedButtons.value, (clickedButton) => {
if (selectedButtons.value === 1){
}
});
watch(selectedStatus, async (newValue, oldValue) => {
if (newValue.stop === true) {
data.isFinish.push(-1)
}
if (newValue.jinxingzhong === true) {
data.isFinish.push(2)
}
if (newValue.weikaishi === true ) {
data.isFinish.push(1)
}
if (newValue.yiwancheng === true) {
data.isFinish.push(0)
}
request.projectWorkGet(data) // tag
onMounted(
()=>{
data.isFinish = [] //
}) request.getTagsProjectList(token).then(res=>{
console.log(res.data.data)
tagsData.value=res.data.data
})
//
request.projectGet(token).then(res=>{
console.log(res)
})
}
)
</script> </script>