字段关联增加是否授权字段,并对接

This commit is contained in:
文永达 2023-09-27 00:03:42 +08:00
parent e6a0491d57
commit 34c9676e4c
2 changed files with 14 additions and 9 deletions

View File

@ -20,13 +20,13 @@ import useSettingsStore from '@/store/modules/settings'
defineProps({ defineProps({
collapse: { collapse: {
type: Boolean, type: Boolean,
required: true, required: true
}, }
}) })
const title = ref(import.meta.env.VITE_APP_TITLE) const title = ref(import.meta.env.VITE_APP_TITLE)
const settingsStore = useSettingsStore(); const settingsStore = useSettingsStore()
const sideTheme = computed(() => settingsStore.sideTheme); const sideTheme = computed(() => settingsStore.sideTheme)
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -30,12 +30,12 @@
<el-button type="primary" plain>{{ $t('btn.save') }}</el-button> <el-button type="primary" plain>{{ $t('btn.save') }}</el-button>
</div> </div>
</template> </template>
<el-table :data="fieldList" height="580" border> <el-table v-loading="fieldListLoading" :data="fieldList" height="580" border>
<el-table-column prop="fieldName" label="字段名称" /> <el-table-column prop="fieldName" label="字段名称" />
<el-table-column prop="fieldType" label="字段类型" /> <el-table-column prop="fieldType" label="字段类型" />
<el-table-column prop="" label="是否授权" align="center"> <el-table-column prop="isPermission" label="是否授权" align="center">
<template #default="scope"> <template #default="scope">
<el-switch v-model="value2" class="ml-2" style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949" /> <el-switch v-model="scope.row.isPermission" class="ml-2" style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949" />
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -62,11 +62,13 @@ const handleInit = async () => {
} }
interface model { interface model {
fullName: string fullName: string
properties: field[] // properties: field[]
} }
interface field { interface field {
id: number
fieldName: string fieldName: string
fieldType: string fieldType: string
isPermission: boolean
} }
const modelList = ref<model[]>([]) const modelList = ref<model[]>([])
const fieldList = ref<field[]>([]) const fieldList = ref<field[]>([])
@ -77,12 +79,15 @@ const getList = async () => {
cardLoading.value = false cardLoading.value = false
} }
const handleCurrentChange = async (val: any) => { const handleCurrentChange = async (val: any) => {
const { data } = await getFields({ fullName: val.fullName }) fieldListLoading.value = true
const { data } = await getFields({ fullName: val.fullName, roleId: route.query.roleId })
fieldList.value = data fieldList.value = data
fieldListLoading.value = false
} }
const getProperties = (row) => { const getProperties = (row) => {
console.log(row) console.log(row)
} }
const fieldListLoading = ref(false)
const value2 = ref(true) const value2 = ref(true)
onMounted(() => { onMounted(() => {
getList() getList()