瀏覽代碼

更新团队配置视图,新增团队ID字段,优化搜索功能,调整权限管理逻辑,提升用户体验。

wuyi 3 月之前
父節點
當前提交
24158de41f
共有 1 個文件被更改,包括 31 次插入10 次删除
  1. 31 10
      src/views/TeamConfigView.vue

+ 31 - 10
src/views/TeamConfigView.vue

@@ -70,7 +70,8 @@ const tempValue = ref({
 // 搜索表单
 const searchForm = ref({
   name: '',
-  type: ''
+  type: '',
+  teamId: null
 })
 
 // 计算当前用户的团队ID
@@ -91,7 +92,7 @@ const currentTeamId = computed(() => {
 // 计算是否有操作权限
 const canCreate = computed(() => isAdmin.value || isTeam.value)
 const canUpdate = computed(() => isAdmin.value || isTeam.value)
-const canDelete = computed(() => isAdmin.value || isTeam.value)
+const canDelete = computed(() => isAdmin.value)
 const canView = computed(() => isAdmin.value || isTeam.value || isPromoter.value)
 
 const fetchData = async (page = 0) => {
@@ -101,7 +102,7 @@ const fetchData = async (page = 0) => {
       tableData.value.meta.size,
       searchForm.value.name || undefined,
       searchForm.value.type || undefined,
-      currentTeamId.value
+      searchForm.value.teamId || currentTeamId.value
     )
     tableData.value = result || {
       data: [],
@@ -151,7 +152,8 @@ const handleSearch = () => {
 const handleRefresh = () => {
   searchForm.value = {
     name: '',
-    type: ''
+    type: '',
+    teamId: null
   }
   tableData.value.meta.page = 0
   fetchData()
@@ -473,10 +475,13 @@ const uploadFile = async () => {
 // 计算团队选项(仅管理员需要)
 const teamOptions = computed(() => {
   if (!isAdmin.value) return []
-  return teamStore.teams.map((team) => ({
-    label: team.name,
-    value: team.id
-  }))
+  return [
+    { label: '全部团队', value: null },
+    ...teamStore.teams.map((team) => ({
+      label: team.name,
+      value: team.id
+    }))
+  ]
 })
 
 // 获取团队名称
@@ -507,7 +512,7 @@ onMounted(() => {
         :paginator="true"
         paginatorTemplate="CurrentPageReport FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown JumpToPageInput"
         currentPageReportTemplate="{totalRecords} 条记录 "
-        :rows="tableData.meta.size"
+        :rows="Number(tableData.meta.size)"
         :rowsPerPageOptions="[10, 20, 50, 100]"
         :totalRecords="tableData.meta.total"
         @page="handlePageChange"
@@ -540,6 +545,19 @@ onMounted(() => {
                 class="w-32"
                 clearable
               />
+              <Select
+                v-if="isAdmin"
+                v-model="searchForm.teamId"
+                :options="teamOptions"
+                optionLabel="label"
+                optionValue="value"
+                placeholder="选择团队"
+                size="small"
+                class="w-32"
+                clearable
+                filter
+                filterPlaceholder="搜索团队"
+              />
               <Button icon="pi pi-search" @click="handleSearch" label="搜索" size="small" severity="secondary" />
               <Button icon="pi pi-refresh" @click="handleRefresh" label="重置" size="small" />
             </div>
@@ -601,6 +619,9 @@ onMounted(() => {
               optionValue="value"
               placeholder="请选择团队"
               :disabled="isEditing"
+              filter
+              filterPlaceholder="搜索团队"
+              :showClear="true"
             />
             <small v-if="!configModel.teamId" class="p-error">请选择团队</small>
           </div>
@@ -735,7 +756,7 @@ onMounted(() => {
         </div>
         <template #footer>
           <Button label="取消" icon="pi pi-times" @click="onCancel" class="p-button-text" />
-          <Button label="保存" icon="pi pi-check" @click="onSubmit" autofocus />
+          <Button label="保存" icon="pi pi-check" @click="onSubmit" />
         </template>
       </Dialog>
     </div>