Przeglądaj źródła

Merge branch 'develop' of gitadmin/tuoheng_pilot_web into release

pull/114/head
yufei111 1 rok temu
rodzic
commit
d769b71547
14 zmienionych plików z 115 dodań i 180 usunięć
  1. +18
    -19
      src/api/system/menu/index.js
  2. +15
    -3
      src/views/equipment-library/box-manage/index.vue
  3. +2
    -2
      src/views/equipment-library/box-manage/tools/table.js
  4. +14
    -3
      src/views/equipment-library/mount-manage/index.vue
  5. +2
    -2
      src/views/equipment-library/mount-manage/tools/table.js
  6. +11
    -3
      src/views/equipment-library/uva-manage/index.vue
  7. +2
    -2
      src/views/equipment-library/uva-manage/tools/table.js
  8. +1
    -1
      src/views/system-manage/menu-manage/index.vue
  9. +6
    -7
      src/views/system-manage/role-manage/components/AuthModal.vue
  10. +0
    -108
      src/views/system-manage/role-manage/components/ConfigModal.vue
  11. +22
    -10
      src/views/system-manage/role-manage/index.vue
  12. +4
    -4
      src/views/system-manage/role-manage/tools/form.js
  13. +16
    -15
      src/views/system-manage/role-manage/tools/table.js
  14. +2
    -1
      src/views/user-manage/components/UserModal.vue

+ 18
- 19
src/api/system/menu/index.js Wyświetl plik

data data
}) })
} }
/**
* 删除菜单
* params
*/
export function deleteMenu(id) {
return request({
url: `/menu/delete/${id}`,
method: 'DELETE'
})
}
/** /**
* 添加按钮 * 添加按钮
* params * params
*/ */
export function permissionCreate(data) { export function permissionCreate(data) {
return request({ return request({
url: '/menu/add',
url: '/permission/add',
method: 'POST', method: 'POST',
data data
}) })
*/ */
export function permissionUpdate(data) { export function permissionUpdate(data) {
return request({ return request({
url: '/menu/edit',
url: '/permission/edit',
method: 'PUT', method: 'PUT',
data data
}) })
} }


/** /**
* 删除菜单
* 删除按钮
* params * params
*/ */
export function deleteMenu(id) {
export function deletePermission(ids) {
return request({ return request({
url: `/menu/delete/${id}`,
url: `/permission/delete/${ids}`,
method: 'DELETE' method: 'DELETE'
}) })
} }

/** /**
* 添加按钮
* 添加小程序菜单
* params * params
*/ */
export function mpMenuCreate(data) { export function mpMenuCreate(data) {
} }


/** /**
* 编辑菜单
* 编辑小程序菜单
* params * params
*/ */
export function mpMenuUpdate(data) { export function mpMenuUpdate(data) {
} }


/** /**
* 删除菜单
* 删除小程序菜单
* params * params
*/ */
export function deleteMpMenu(id) { export function deleteMpMenu(id) {
}) })
} }


/**
* 删除按钮
* params
*/
export function deletePermission(ids) {
return request({
url: `/menu/delete/${ids}`,
method: 'DELETE'
})
}

+ 15
- 3
src/views/equipment-library/box-manage/index.vue Wyświetl plik

@update:checked-row-keys="handleCheck" @update:checked-row-keys="handleCheck"
> >
<template #tableTitle> <template #tableTitle>
<n-button type="primary" @click="handleModal"> 新建 </n-button>
<n-button v-if="permissionList.includes('equipment:box:create')" type="primary" @click="handleModal"> {{ getPermissionLabel('equipment:box:create') }} </n-button>
<n-popconfirm <n-popconfirm
negative-text="取消" negative-text="取消"
positive-text="确认" positive-text="确认"
import BoxModal from './components/BoxModal.vue' import BoxModal from './components/BoxModal.vue'
import { ref, unref, toRefs, reactive, onUnmounted } from 'vue' import { ref, unref, toRefs, reactive, onUnmounted } from 'vue'
import { boxPage } from '@/api/equipment/box.js' import { boxPage } from '@/api/equipment/box.js'
import { usePermissionStore } from '@/store/modules/permission'


export default { export default {
name: 'BoxManage', name: 'BoxManage',
components: { dataTable, BoxModal, headSearch }, components: { dataTable, BoxModal, headSearch },
setup() { setup() {
const permissionStore = usePermissionStore()

const data = reactive({ const data = reactive({
...toRefs(table), ...toRefs(table),
search
search,
permissionList: permissionStore.accessPermissionCodes

}) })


const getPermissionLabel = (code) => {
return permissionStore.accessPermissions.find((item) => {
return item.code === code
})?.name || ''
}

const loadDataTable = async(res) => { const loadDataTable = async(res) => {
const _params = { const _params = {
...unref(data.searchParams), ...unref(data.searchParams),
loadDataTable, loadDataTable,
handleModal, handleModal,
handleDelete, handleDelete,
handleCheck
handleCheck,
getPermissionLabel
} }
} }
} }

+ 2
- 2
src/views/equipment-library/box-manage/tools/table.js Wyświetl plik

text: true, text: true,
onClick: getRowData.bind(null, row, 'update') onClick: getRowData.bind(null, row, 'update')
}, },
auth: 'basic_list'
auth: 'equipment:box:edit'
}, },
{ {
label: '删除', label: '删除',
type: 'popconfirm', type: 'popconfirm',
auth: 'basic_list',
auth: 'equipment:box:delete',
tip: '确定删除这条数据吗?', tip: '确定删除这条数据吗?',
props: { props: {
onPositiveClick: deleteData.bind(null, [row.id]) onPositiveClick: deleteData.bind(null, [row.id])

+ 14
- 3
src/views/equipment-library/mount-manage/index.vue Wyświetl plik

@update:checked-row-keys="handleCheck" @update:checked-row-keys="handleCheck"
> >
<template #tableTitle> <template #tableTitle>
<n-button type="primary" @click="handleModal"> 新建 </n-button>
<n-button v-if="permissionList.includes('equipment:mount:create')" type="primary" @click="handleModal"> {{ getPermissionLabel('equipment:mount:create') }} </n-button>
<n-popconfirm <n-popconfirm
negative-text="取消" negative-text="取消"
positive-text="确认" positive-text="确认"
import MountModal from './components/MountModal.vue' import MountModal from './components/MountModal.vue'
import { ref, unref, toRefs, reactive, onUnmounted } from 'vue' import { ref, unref, toRefs, reactive, onUnmounted } from 'vue'
import { mountPage } from '@/api/equipment/mount.js' import { mountPage } from '@/api/equipment/mount.js'
import { usePermissionStore } from '@/store/modules/permission'


export default { export default {
name: 'BoxManage', name: 'BoxManage',
components: { dataTable, MountModal, headSearch }, components: { dataTable, MountModal, headSearch },
setup() { setup() {
const permissionStore = usePermissionStore()

const data = reactive({ const data = reactive({
...toRefs(table), ...toRefs(table),
search
search,
permissionList: permissionStore.accessPermissionCodes

}) })
const getPermissionLabel = (code) => {
return permissionStore.accessPermissions.find((item) => {
return item.code === code
})?.name || ''
}


const loadDataTable = async(res) => { const loadDataTable = async(res) => {
const _params = { const _params = {
loadDataTable, loadDataTable,
handleModal, handleModal,
handleDelete, handleDelete,
handleCheck
handleCheck,
getPermissionLabel
} }
} }
} }

+ 2
- 2
src/views/equipment-library/mount-manage/tools/table.js Wyświetl plik

text: true, text: true,
onClick: getRowData.bind(null, row, 'update') onClick: getRowData.bind(null, row, 'update')
}, },
auth: 'basic_list'
auth: 'equipment:mount:edit'
}, },
{ {
label: '删除', label: '删除',
type: 'popconfirm', type: 'popconfirm',
auth: 'basic_list',
auth: 'equipment:mount:delete',
tip: '确定删除这条数据吗?', tip: '确定删除这条数据吗?',
props: { props: {
onPositiveClick: deleteData.bind(null, [row.id]) onPositiveClick: deleteData.bind(null, [row.id])

+ 11
- 3
src/views/equipment-library/uva-manage/index.vue Wyświetl plik

@update:checked-row-keys="handleCheck" @update:checked-row-keys="handleCheck"
> >
<template #tableTitle> <template #tableTitle>
<n-button type="primary" @click="handleModal"> 新建 </n-button>
<n-button v-if="permissionList.includes('equipment:uva:create')" type="primary" @click="handleModal"> {{ getPermissionLabel('equipment:uva:create') }} </n-button>
<n-popconfirm <n-popconfirm
negative-text="取消" negative-text="取消"
positive-text="确认" positive-text="确认"
import UVAModal from './components/UVAModal.vue' import UVAModal from './components/UVAModal.vue'
import { ref, unref, toRefs, reactive, onUnmounted } from 'vue' import { ref, unref, toRefs, reactive, onUnmounted } from 'vue'
import { uvaPage } from '@/api/equipment/uva.js' import { uvaPage } from '@/api/equipment/uva.js'
import { usePermissionStore } from '@/store/modules/permission'


export default { export default {
name: 'BoxManage', name: 'BoxManage',
components: { dataTable, UVAModal, headSearch }, components: { dataTable, UVAModal, headSearch },
setup() { setup() {
const permissionStore = usePermissionStore()

const data = reactive({ const data = reactive({
...toRefs(table), ...toRefs(table),
search search
}) })

const getPermissionLabel = (code) => {
return permissionStore.accessPermissions.find((item) => {
return item.code === code
})?.name || ''
}
const loadDataTable = async(res) => { const loadDataTable = async(res) => {
const _params = { const _params = {
...unref(data.searchParams), ...unref(data.searchParams),
loadDataTable, loadDataTable,
handleModal, handleModal,
handleDelete, handleDelete,
handleCheck
handleCheck,
getPermissionLabel
} }
} }
} }

+ 2
- 2
src/views/equipment-library/uva-manage/tools/table.js Wyświetl plik

text: true, text: true,
onClick: getRowData.bind(null, row, 'update') onClick: getRowData.bind(null, row, 'update')
}, },
auth: 'basic_list'
auth: 'equipment:uva:edit'
}, },
{ {
label: '删除', label: '删除',
type: 'popconfirm', type: 'popconfirm',
auth: 'basic_list',
auth: 'equipment:uva:delete',
tip: '确定删除这条数据吗?', tip: '确定删除这条数据吗?',
props: { props: {
onPositiveClick: deleteData.bind(null, [row.id]) onPositiveClick: deleteData.bind(null, [row.id])

+ 1
- 1
src/views/system-manage/menu-manage/index.vue Wyświetl plik

v-if="permissionList.includes('system:menu:create')" v-if="permissionList.includes('system:menu:create')"
type="primary" type="primary"
@click="handleModal" @click="handleModal"
><n-icon size="18"><AddOutline /></n-icon> {{ getPermissionLabel('system:menu:create') }} </n-button>
> {{ getPermissionLabel('system:menu:create') }} </n-button>
</template> </template>
</DataTable> </DataTable>
</n-card> </n-card>

+ 6
- 7
src/views/system-manage/role-manage/components/AuthModal.vue Wyświetl plik

const { opMenusList, permissionsList } = res.data const { opMenusList, permissionsList } = res.data
const adminMenus = opMenusList.filter((item) => { const adminMenus = opMenusList.filter((item) => {
item.title = item.name item.title = item.name
item.key = item.identificationId
item.key = item.id
return item.clientId === 'tuoheng-pilot-admin' return item.clientId === 'tuoheng-pilot-admin'
}) })
const adminPermissions = permissionsList.filter((item) => { const adminPermissions = permissionsList.filter((item) => {
}) })
const mpMenus = opMenusList.filter((item) => { const mpMenus = opMenusList.filter((item) => {
item.title = item.name item.title = item.name
item.key = item.identificationId
return item.clientId === 'tuoheng-waterway-mp'
item.key = item.id
return item.clientId === 'tuoheng-pilot-mp'
}) })
const mpPermissions = permissionsList.filter((item) => { const mpPermissions = permissionsList.filter((item) => {
item.title = item.name item.title = item.name
item.parentId = item.menuId item.parentId = item.menuId
item.key = item.identificationId item.key = item.identificationId
return item.clientId === 'tuoheng-waterway-mp'
return item.clientId === 'tuoheng-pilot-mp'
}) })
const adminData = adminMenus.concat(adminPermissions) const adminData = adminMenus.concat(adminPermissions)
const adminTreeData = toTreeData(adminData, 'id', 'parentId', 'children')
const adminTreeData = toTreeData(adminData, 'key', 'parentId', 'children')
data.adminKeys = [] data.adminKeys = []
querySelectedKeys(adminTreeData, data.adminKeys) querySelectedKeys(adminTreeData, data.adminKeys)
const miniData = mpMenus.concat(mpPermissions) const miniData = mpMenus.concat(mpPermissions)
const miniTreeData = toTreeData(miniData, 'id', 'parentId', 'children')
const miniTreeData = toTreeData(miniData, 'key', 'parentId', 'children')
data.miniKeys = [] data.miniKeys = []
querySelectedKeys(miniTreeData, data.miniKeys) querySelectedKeys(miniTreeData, data.miniKeys)

nextTick(() => { nextTick(() => {
data.tabsTreeVisible = true data.tabsTreeVisible = true
data.adminData = adminTreeData data.adminData = adminTreeData

+ 0
- 108
src/views/system-manage/role-manage/components/ConfigModal.vue Wyświetl plik

<template>
<Modal
:options="getModalOptions"
:on-positive-click="handleConfirm"
:on-negative-click="handleClose"
:on-close="handleClose"
>
<template #Context>
<n-tree
block-line
cascade
checkable
:data="allTreeData"
key-field="id"
label-field="title"
:default-expand-all="true"
:default-checked-keys="checkedTreeData"
@update:checked-keys="handleCheckTree"
/>
</template>
</Modal>
</template>
<script>
import { defineComponent, computed, onBeforeMount, reactive, toRefs } from 'vue'
import { getRolePermission, savePermission } from '@/api/system/role/index'
import Modal from '@/components/Modal/index.vue'
import { toTreeData } from '@/utils/handleData.js'
export default defineComponent({
name: 'ConfigModal',
components: { Modal },
props: {
visible: {
type: Boolean,
default: false
},
data: {
type: Object,
default: () => {}
}
},
emits: {
'update:visible': null,
'reload': null
},
setup(props, { emit }) {
const data = reactive({
menuIds: [],
checkedTreeData: [],
allTreeData: []
})
const getModalOptions = computed(() => {
return {
title: '权限分配',
show: props.visible,
negativeText: '取消',
positiveText: '确认'
}
})
onBeforeMount(() => {
getMenuByRoleId()
})

// 获取当前角色的权限菜单列表
async function getMenuByRoleId() {
const res = await getRolePermission(props.data.id)
data.allTreeData = toTreeData(res.data, 'id', 'pid', 'children')
const checkedArr = res.data
if (checkedArr.length) {
checkedArr.forEach((item) => {
if (item.checked) {
data.checkedTreeData.push(item.id)
}
})
}
data.menuIds = data.checkedTreeData
}

// 勾选节点
function handleCheckTree(keys) {
data.menuIds = keys
}

function handleConfirm() {
savePermission({ roleId: props.data.id, menuIds: data.menuIds }).then(res => {
if (res.code === 0) {
emit('reload')
handleClose()
}
}).catch(e => {
console.log(e)
})
}

/* 关闭弹窗 */
const handleClose = () => {
emit('update:visible', false)
}

return {
...toRefs(data),
getModalOptions,
handleCheckTree,
handleConfirm,
handleClose
}
}
})
</script>

+ 22
- 10
src/views/system-manage/role-manage/index.vue Wyświetl plik

<template> <template>
<div> <div>
<n-card> <n-card>
<headSearch :info="search" @search="handleSearch" @reset="handleSearch" />
<data-table
<HeadSearch :info="search" @search="handleSearch" @reset="handleSearch" />
<DataTable
ref="tableRef" ref="tableRef"
:columns="columns" :columns="columns"
:request="loadDataTable" :request="loadDataTable"
size="large" size="large"
> >
<template #tableTitle> <template #tableTitle>
<n-button v-if="permissionStore.includes('system:role:create')" type="primary" @click="handleModal"> 新建 </n-button>
<n-button
v-if="permissionList.includes('system:role:create')"
type="primary"
@click="handleModal"
> {{ getPermissionLabel('system:role:create') }} </n-button>
</template> </template>
</data-table>
</DataTable>
</n-card> </n-card>
</div> </div>
{{ permissionStore.getToken }} {{ permissionStore.getToken }}
<script> <script>
import search from './tools/search.js' import search from './tools/search.js'
import table from './tools/table.js' import table from './tools/table.js'
import headSearch from '@/components/Search/index.vue'
import dataTable from '@/components/DataTable/index.vue'
import HeadSearch from '@/components/Search/index.vue'
import DataTable from '@/components/DataTable/index.vue'
import RoleModal from './components/RoleModal.vue' import RoleModal from './components/RoleModal.vue'
import AuthModal from './components/AuthModal.vue' import AuthModal from './components/AuthModal.vue'
import { getRoleList } from '@/api/system/role/index.js' import { getRoleList } from '@/api/system/role/index.js'


export default { export default {
name: 'UserManage', name: 'UserManage',
components: { dataTable, headSearch, RoleModal, AuthModal },
components: { DataTable, HeadSearch, RoleModal, AuthModal },
setup() { setup() {
const permissionStore = usePermissionStore()

const data = reactive({ const data = reactive({
...toRefs(table), ...toRefs(table),
search
search,
permissionList: permissionStore.accessPermissionCodes

}) })
const permissionStore = usePermissionStore().accessPermissionCodes // 按钮权限
const getPermissionLabel = (code) => {
return permissionStore.accessPermissions.find((item) => {
return item.code === code
})?.name || ''
}
const loadDataTable = async(res) => { const loadDataTable = async(res) => {
const _params = { const _params = {
...unref(data.searchParams), ...unref(data.searchParams),
...toRefs(data), ...toRefs(data),
loadDataTable, loadDataTable,
handleModal, handleModal,
permissionStore
getPermissionLabel
} }
} }
} }

+ 4
- 4
src/views/system-manage/role-manage/tools/form.js Wyświetl plik

userForm: { userForm: {
roleName: null, roleName: null,
remark: null, remark: null,
roleCode: null,
// code: null,
status: 1 status: 1
}, },
userRules: { userRules: {
roleName: [{ required: true, message: '请输入角色名称', trigger: 'blur' }],
roleCode: [{ required: true, message: '请输入角色编码', trigger: 'blur' }]
roleName: [{ required: true, message: '请输入角色名称', trigger: 'blur' }]
// code: [{ required: true, message: '请输入角色编码', trigger: 'blur' }]
}, },
formItem: [ formItem: [
{ type: 'input', key: 'roleName', label: '角色名称', props: { maxlength: '20', placeholder: '请输入角色名称', clearable: true }}, { type: 'input', key: 'roleName', label: '角色名称', props: { maxlength: '20', placeholder: '请输入角色名称', clearable: true }},
{ type: 'input', key: 'roleCode', label: '角色编码', props: { maxlength: '20', placeholder: '请输入角色名称', clearable: true }},
// { type: 'input', key: 'code', label: '角色编码', props: { maxlength: '20', placeholder: '请输入角色名称', clearable: true }},
{ type: 'radio', key: 'status', label: '角色状态', options: ROLE_STATUS }, { type: 'radio', key: 'status', label: '角色状态', options: ROLE_STATUS },
{ type: 'input', key: 'remark', label: '备注', props: { type: 'textarea', maxlength: '140', autosize: { minRows: 3, maxRows: 3 }, placeholder: '请输入备注', clearable: true }} { type: 'input', key: 'remark', label: '备注', props: { type: 'textarea', maxlength: '140', autosize: { minRows: 3, maxRows: 3 }, placeholder: '请输入备注', clearable: true }}
] ]

+ 16
- 15
src/views/system-manage/role-manage/tools/table.js Wyświetl plik

* @return {*} * @return {*}
*/ */
function handleStatusChange(row) { function handleStatusChange(row) {
console.log(row)
setRoleStatus({ id: row.data.id, status: row.value }) setRoleStatus({ id: row.data.id, status: row.value })
.then((res) => { .then((res) => {
if (res.code === 0) { if (res.code === 0) {
align: 'center', align: 'center',
width: 200 width: 200
}, },
{
title: '角色编码',
key: 'roleCode',
align: 'center',
width: 200
},
// {
// title: '角色编码',
// key: 'code',
// align: 'center',
// width: 200
// },
{ {
title: '状态', title: '状态',
key: 'status', key: 'status',
}) })
} }
}, },
{
title: '描述',
key: 'remark',
align: 'center',
ellipsis: {
tooltip: true
},
width: 400
},
// {
// title: '描述',
// key: 'remark',
// align: 'center',
// ellipsis: {
// tooltip: true
// },
// width: 400
// },
{ {
title: '操作', title: '操作',
align: 'center', align: 'center',

+ 2
- 1
src/views/user-manage/components/UserModal.vue Wyświetl plik

> >
<template v-for="(item,index) in getFormOptions" :key="index"> <template v-for="(item,index) in getFormOptions" :key="index">
<n-form-item :label="item.label" :path="item.key"> <n-form-item :label="item.label" :path="item.key">
<n-input v-if="item.type === 'input'" v-model:value="userForm[item.key]" v-bind="item.props" />
<n-input v-if="item.type === 'input'" v-model:value="userForm[item.key]" :disabled="item.key==='username' && modelTyle ==='update'" v-bind="item.props" />
<n-select v-if="item.type === 'select'" v-model:value="userForm[item.key]" v-bind="item.props" /> <n-select v-if="item.type === 'select'" v-model:value="userForm[item.key]" v-bind="item.props" />
</n-form-item> </n-form-item>
</template> </template>
userRules: { userRules: {
...userRules ...userRules
}, },
modelTyle: props.type,
disabled: props.type === 'preview' disabled: props.type === 'preview'
}) })



Ładowanie…
Anuluj
Zapisz