1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
| <!-- * @Description: 特征使用设置 * @Author: jmguo2 * @Date: 2023-10-12 11:28:59 * @LastEditors: jmguo2 * @LastEditTime: 2023-10-18 10:46:34 --> <template> <div> <!-- <el-button @click="handleClickTest">加一</el-button> --> <tab-table :tab-config="areaData" ref="tabRef" @tab-click="handleTabClick" @row-click="handleRowClick" :is-show-right-extend="true"> <template #header> <el-button @click="openDialog">添加</el-button> </template> </tab-table>
<el-dialog v-model="isShowAddDialog" title="弹窗"> <tab-table :tab-config="configData" ref="tabDialogRef" @tab-click="handleTabClick" class="table-content"> <template #tzlbId="scope"> <span>{{ scope.scope.scope.tzId === 1? '加分': '优先' }}</span> </template> </tab-table> <template #footer> <div class="footer-contaienr"> <el-button>取消</el-button> <el-button type="primary" @click="handleSubmit">确认</el-button> </div> </template> </el-dialog> </div> </template>
<script setup lang="ts"> import { ref, onMounted, nextTick } from 'vue'; import tabTable from '@/components/tabTable/Index.vue'; import { areaConfig, config } from './tableConfig' import { getFeatureList, getAllFeatureList, getAllFeatureSchoolList } from '@/api/FeatureUseSettingController'; import { IAddFeature, FEATURE_TYPE } from './type.d' import { addFeature } from '@/api/FeatureUseSettingController';
// table configData const areaData = ref(areaConfig); const configData = ref(config)
const tabRef = ref({} as any); const tabDialogRef = ref({} as any);
const isShowAddDialog = ref(false); let currentTab = ''
const fileType = { xqid: 0, tddid: 0 }
const handleTabClick = (activeTab: string) => { console.log('tab', activeTab); currentTab = activeTab;
}
const handleRowClick = (rowObj: { row: any, selectedList: any[] }) => { console.log('点击了', rowObj); }
const openDialog = async () => { isShowAddDialog.value = true; // 等待dialog渲染完成 await nextTick(); tabDialogRef.value.setActiveTab('list'); }
const handleSubmit = async() => { const tableIndex = currentTab === FEATURE_TYPE.FEATURE? 0: 1 const list = tabDialogRef.value.getSelectedList(0); const params: IAddFeature = { gzdyIds: [], tddid: 0, tzFw: 0, tzFz: '', tzLx: 0, xqid: 0 } params.gzdyIds = list.map((item: any) => item.tzId); params.tzFw = 1; params.tzFz = '20'; params.tzLx = 1; await addFeature(params); }
onMounted(() => { // 默认进入全局特征页面 tabRef.value.setActiveTab('global'); getTableList() getFeatureDialogList(); })
const getTableList = async () => { await getFeatureList(fileType) }
const getFeatureDialogList = async () => { const { data } = await getAllFeatureList(); configData.value[0].tableData = data; }
const handleClickTest = () => { // config.value[0].tableData[0].type2++; }
</script>
<style scoped lang="scss"> .footer-contaienr { display: flex; justify-content: center; // width: 100%; }
.table-content { max-height: 500px; overflow: scroll; } </style>
|