资源模块-新建权限 #62

Merged
lyc merged 1 commits from lyc-dev into main 2024-07-25 10:08:19 +08:00
3 changed files with 19 additions and 9 deletions

View File

@ -145,6 +145,7 @@ watch(() => props.modelValue, (newVal) => {
.dialog-footer{
text-align: center;
padding-bottom: 10px;
-webkit-app-region: no-drag;
}

View File

@ -6,7 +6,7 @@
<div class="page-right">
<!-- 搜索 -->
<ResoureSearch #add>
<el-button v-if="hasPermission(['platformmanager'])" type="primary" round @click="openDialog" class="create-btn">
<el-button v-if="sourceStore.isCreate" type="primary" round @click="openDialog" class="create-btn">
<i class="iconfont icon-jiahao"></i>
新建资源</el-button>
</ResoureSearch>
@ -19,7 +19,7 @@
</template>
<script setup>
import { ref, toRaw } from 'vue'
import { onMounted, ref, toRaw } from 'vue'
import useResoureStore from './store'
import ChooseTextbook from '@/components/choose-textbook/index.vue'
import ResoureSearch from './container/resoure-search.vue'
@ -27,7 +27,7 @@ import ResoureList from './container/resoure-list.vue'
import uploadDialog from '@/components/upload-dialog/index.vue'
import uploaderState from '@/store/modules/uploader'
import { hasPermission } from '@/utils/hasPermission'
//
const sourceStore = useResoureStore()
const isDialogOpen = ref(false)
@ -82,6 +82,10 @@ const fileCallBack = (res) => {
}
}
onMounted(()=>{
sourceStore.getCreate()
})
</script>
<style lang="scss" scoped>

View File

@ -27,11 +27,6 @@ tabs.forEach((item) => {
item.value = userStore.user.deptId
}
})
tabs.forEach((item, i) => {
if (item.label == '平台资源' && !hasPermission(['platformmanager'])) {
tabs.splice(i, 1)
}
})
const structQuery = {
pageNum: 1,
@ -49,6 +44,8 @@ export default defineStore('resource', {
//节点数据
nodeData: {},
loading: false,
//
isCreate: true,
//查询条件
query: {
textbookId: '',
@ -76,7 +73,6 @@ export default defineStore('resource', {
if (data.fileSuffix == -1) {
data.fileSuffix = ''
}
console.log(data, 200)
getSmarttalkPage(data).then((res) => {
this.result.total = res.total
this.result.list = res.rows
@ -87,6 +83,7 @@ export default defineStore('resource', {
},
changeTab(val) {
this.query.fileSource = val
this.getCreate()
this.handleQuery()
},
changeType(val) {
@ -100,6 +97,14 @@ export default defineStore('resource', {
// 关键词搜索
changeName() {
this.handleQuery()
},
getCreate(){
if(this.query.fileSource == '平台'){
this.isCreate = hasPermission(['platformmanager'])
}
else{
this.isCreate = hasPermission(['schoolteacher','headmaster'])
}
}
}
})