资源模块-新建权限

This commit is contained in:
lyc 2024-07-25 10:07:59 +08:00
parent 580ab2ee5b
commit 212d5be4d4
3 changed files with 19 additions and 9 deletions

View File

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

View File

@ -6,7 +6,7 @@
<div class="page-right"> <div class="page-right">
<!-- 搜索 --> <!-- 搜索 -->
<ResoureSearch #add> <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> <i class="iconfont icon-jiahao"></i>
新建资源</el-button> 新建资源</el-button>
</ResoureSearch> </ResoureSearch>
@ -19,7 +19,7 @@
</template> </template>
<script setup> <script setup>
import { ref, toRaw } from 'vue' import { onMounted, ref, toRaw } from 'vue'
import useResoureStore from './store' import useResoureStore from './store'
import ChooseTextbook from '@/components/choose-textbook/index.vue' import ChooseTextbook from '@/components/choose-textbook/index.vue'
import ResoureSearch from './container/resoure-search.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 uploadDialog from '@/components/upload-dialog/index.vue'
import uploaderState from '@/store/modules/uploader' import uploaderState from '@/store/modules/uploader'
import { hasPermission } from '@/utils/hasPermission' import { hasPermission } from '@/utils/hasPermission'
//
const sourceStore = useResoureStore() const sourceStore = useResoureStore()
const isDialogOpen = ref(false) const isDialogOpen = ref(false)
@ -82,6 +82,10 @@ const fileCallBack = (res) => {
} }
} }
onMounted(()=>{
sourceStore.getCreate()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

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