|
@@ -2,17 +2,20 @@
|
|
|
<el-card>
|
|
|
<el-row justify="space-between" align="middle" class="mb-2">
|
|
|
<el-col>
|
|
|
- <el-button type="primary" @click="openAddDialog">新增机构</el-button>
|
|
|
+ <el-button type="primary" @click="openAddDialog" v-if="operationPermissions['c-3']">新增机构</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-table :data="orgList" style="width: 100%" row-key="id" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
|
|
|
+ <el-table :data="orgList" style="width: 100%" row-key="id"
|
|
|
+ :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
|
|
|
<el-table-column prop="name" label="机构名称" />
|
|
|
<el-table-column prop="manager" label="管理员" />
|
|
|
<el-table-column prop="phone" label="管理员电话" />
|
|
|
<el-table-column label="操作" width="180">
|
|
|
<template #default="scope">
|
|
|
- <el-button size="small" @click="openEditDialog(scope.row)">编辑</el-button>
|
|
|
- <el-button size="small" type="danger" @click="handleDelete(scope.row)">删除</el-button>
|
|
|
+ <el-button size="small" @click="openEditDialog(scope.row)"
|
|
|
+ v-if="operationPermissions['c-4']">编辑</el-button>
|
|
|
+ <el-button size="small" type="danger" @click="handleDelete(scope.row)"
|
|
|
+ v-if="operationPermissions['c-5']">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -24,15 +27,9 @@
|
|
|
<el-input v-model="form.name" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="父级机构" prop="parent_id">
|
|
|
- <el-tree-select
|
|
|
- v-model="form.parent_id"
|
|
|
- :data="orgList"
|
|
|
- :props="{ label: 'name', value: 'id', children: 'children' }"
|
|
|
- placeholder="不选则为一级机构"
|
|
|
- clearable
|
|
|
- check-strictly
|
|
|
- style="width: 100%;"
|
|
|
- />
|
|
|
+ <el-tree-select v-model="form.parent_id" :data="orgList"
|
|
|
+ :props="{ label: 'name', value: 'id', children: 'children' }" placeholder="不选则为一级机构" clearable
|
|
|
+ check-strictly style="width: 100%;" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="负责人" prop="manager">
|
|
|
<el-input v-model="form.manager" />
|
|
@@ -60,23 +57,25 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, reactive, onMounted,getCurrentInstance } from 'vue'
|
|
|
+import { ref, reactive, onMounted, getCurrentInstance } from 'vue'
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
+import { useMenuStore } from "@/stores/menu.js"
|
|
|
+const { operationPermissions } = useMenuStore();
|
|
|
const { proxy } = getCurrentInstance()
|
|
|
|
|
|
// 模拟接口
|
|
|
const fetchOrgList = async () => {
|
|
|
- const {records} = await proxy.$http.get('/open-platform/organ/loadData')
|
|
|
- orgList.value = records
|
|
|
+ const { records } = await proxy.$http.get('/open-platform/organ/loadData')
|
|
|
+ orgList.value = records
|
|
|
}
|
|
|
const fetchAdminList = async () => {
|
|
|
- const {records} = await proxy.$http.get('/open-platform/user/users',{
|
|
|
+ const { records } = await proxy.$http.get('/open-platform/user/users', {
|
|
|
params: {
|
|
|
- userName:'',
|
|
|
- pageNo: 1,
|
|
|
- pageSize: 100,
|
|
|
+ userName: '',
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 100,
|
|
|
}
|
|
|
- })
|
|
|
+ })
|
|
|
return records
|
|
|
}
|
|
|
|
|
@@ -136,32 +135,32 @@ const handleSubmit = () => {
|
|
|
// const admin = adminList.value.find(u => u.account === form.adminAccount)
|
|
|
if (form.id) {
|
|
|
// 编辑
|
|
|
- proxy.$http.post('/open-platform/organ/update', form)
|
|
|
- .then((res) => {
|
|
|
- if (res.code === 200) {
|
|
|
- fetchOrgList()
|
|
|
- ElMessage.success('编辑成功')
|
|
|
- } else {
|
|
|
+ proxy.$http.post('/open-platform/organ/update', form)
|
|
|
+ .then((res) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ fetchOrgList()
|
|
|
+ ElMessage.success('编辑成功')
|
|
|
+ } else {
|
|
|
+ ElMessage.error('编辑失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
ElMessage.error('编辑失败')
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- ElMessage.error('编辑失败')
|
|
|
- })
|
|
|
+ })
|
|
|
} else {
|
|
|
// 新增
|
|
|
- proxy.$http.post('/open-platform/organ/insert', form)
|
|
|
- .then((res) => {
|
|
|
- if (res.code === 200) {
|
|
|
- fetchOrgList()
|
|
|
- ElMessage.success('新增成功')
|
|
|
- } else {
|
|
|
+ proxy.$http.post('/open-platform/organ/insert', form)
|
|
|
+ .then((res) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ fetchOrgList()
|
|
|
+ ElMessage.success('新增成功')
|
|
|
+ } else {
|
|
|
+ ElMessage.error('新增失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
ElMessage.error('新增失败')
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- ElMessage.error('新增失败')
|
|
|
- })
|
|
|
+ })
|
|
|
}
|
|
|
dialogVisible.value = false
|
|
|
})
|
|
@@ -169,18 +168,18 @@ const handleSubmit = () => {
|
|
|
const handleDelete = (row) => {
|
|
|
ElMessageBox.confirm('确定删除该机构吗?', '提示', { type: 'warning' })
|
|
|
.then(() => {
|
|
|
- proxy.$http.post('/open-platform/organ/delete/' + row.id, )
|
|
|
- .then((res) => {
|
|
|
- if (res.code === 200) {
|
|
|
- fetchOrgList()
|
|
|
- ElMessage.success('删除成功')
|
|
|
- } else {
|
|
|
+ proxy.$http.post('/open-platform/organ/delete/' + row.id,)
|
|
|
+ .then((res) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ fetchOrgList()
|
|
|
+ ElMessage.success('删除成功')
|
|
|
+ } else {
|
|
|
+ ElMessage.error('删除失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
ElMessage.error('删除失败')
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- ElMessage.error('删除失败')
|
|
|
- })
|
|
|
+ })
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -191,5 +190,7 @@ onMounted(async () => {
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
-.mb-2 { margin-bottom: 16px; }
|
|
|
+.mb-2 {
|
|
|
+ margin-bottom: 16px;
|
|
|
+}
|
|
|
</style>
|