+
+
diff --git a/src/components/VideoPlayer/index.vue b/src/components/VideoPlayer/index.vue
new file mode 100644
index 0000000..b5a8b87
--- /dev/null
+++ b/src/components/VideoPlayer/index.vue
@@ -0,0 +1,176 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/router/routes/modules/system.js b/src/router/routes/modules/system.js
index 59c9016..37ce2d8 100644
--- a/src/router/routes/modules/system.js
+++ b/src/router/routes/modules/system.js
@@ -3,16 +3,45 @@ export default [
{
path: '/system',
component: Layout,
- redirect: '/system/menu',
+ redirect: '/system/user',
name: 'System',
+ title: '系统管理',
meta: {
title: '系统管理'
},
children: [
+ {
+ path: 'user',
+ component: () => import('@/views/system-manage/user-manage/index.vue'),
+ name: 'SystemUser',
+ title: '用户管理',
+ meta: {
+ title: '用户管理'
+ }
+ },
+ {
+ path: 'role',
+ component: () => import('@/views/system-manage/role-manage/index.vue'),
+ name: 'SystemRole',
+ title: '角色管理',
+ meta: {
+ title: '角色管理'
+ }
+ },
+ {
+ path: 'dept',
+ component: () => import('@/views/system-manage/department-manage/index.vue'),
+ name: 'SystemDept',
+ title: '部门管理',
+ meta: {
+ title: '部门管理'
+ }
+ },
{
path: 'menu',
- component: () => import('@/views/system/menu/index.vue'),
+ component: () => import('@/views/system-manage/menu-manage/index.vue'),
name: 'SystemMenu',
+ title: '菜单管理',
meta: {
title: '菜单管理'
}
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index bcb0dc2..3541c11 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -105,7 +105,7 @@ export default {
}
/* 调用store中的方法,登录以及存储token和用户信息 */
- const res = await userStore.getLoginToken(this.loginForm)
+ const res = await userStore.getLoginToken(data.loginForm)
if (res.code === 0) {
const toPath = decodeURIComponent((route.query?.redirect || '/'))
route.name === '/login' ? router.replace('/') : router.replace(toPath)
diff --git a/src/views/system-manage/department-manage/components/DepartmentModal.vue b/src/views/system-manage/department-manage/components/DepartmentModal.vue
new file mode 100644
index 0000000..a6a00c0
--- /dev/null
+++ b/src/views/system-manage/department-manage/components/DepartmentModal.vue
@@ -0,0 +1,139 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system-manage/department-manage/index.vue b/src/views/system-manage/department-manage/index.vue
new file mode 100644
index 0000000..cf54184
--- /dev/null
+++ b/src/views/system-manage/department-manage/index.vue
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+ 新建
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system-manage/department-manage/tools/form.js b/src/views/system-manage/department-manage/tools/form.js
new file mode 100644
index 0000000..0775825
--- /dev/null
+++ b/src/views/system-manage/department-manage/tools/form.js
@@ -0,0 +1,32 @@
+import { ref, reactive } from 'vue'
+import { USER_STATUS } from '@/utils/dictionary.js'
+import { getDeptAll } from '@/api/system/dept/index'
+import { dataToSelect } from '@/utils/handleData.js'
+const departmentOptions = ref()
+
+export const form = reactive({
+ departmentForm: {
+ code: '',
+ name: '',
+ sort: null,
+ pid: null,
+ note: ''
+ },
+ departmentRules: {
+ code: [{ required: true, message: '请输入部门编号', trigger: 'blur' }],
+ name: [{ required: true, message: '请输入部门名称', type: 'string', trigger: 'blur' }],
+ sort: [{ required: true, type: 'number', message: '请输入排序号', trigger: 'blur' }]
+ },
+ formItem: [
+ { type: 'input', key: 'code', label: '部门编号', props: { maxlength: '20', placeholder: '请输入部门编号', clearable: true }},
+ { type: 'input', key: 'name', label: '部门名称', props: { maxlength: '20', placeholder: '请输入部门名称', clearable: true }},
+ { type: 'select', key: 'pid', label: '所属部门', props: { options: departmentOptions, placeholder: '请选择所属部门' }},
+ { type: 'number', key: 'sort', label: '排序号', props: { min: 0, placeholder: '请输入排序号', clearable: true }},
+ { type: 'input', key: 'note', label: '备注', props: { type: 'textarea', autosize: { maxlength: '200', minRows: 3, maxRows: 3 }}}
+ ]
+})
+
+export const getDeptOptions = async function() {
+ const res = await getDeptAll()
+ departmentOptions.value = dataToSelect(res.data, { label: 'name', value: 'id' })
+}
diff --git a/src/views/system/dept/info.js b/src/views/system-manage/department-manage/tools/search.js
similarity index 69%
rename from src/views/system/dept/info.js
rename to src/views/system-manage/department-manage/tools/search.js
index 7286b30..4a6f045 100644
--- a/src/views/system/dept/info.js
+++ b/src/views/system-manage/department-manage/tools/search.js
@@ -1,4 +1,6 @@
-const data = [
+import { reactive } from 'vue'
+
+const data = reactive([
{
label: '部门名称',
key: 'name',
@@ -6,7 +8,7 @@ const data = [
placeholder: '请输入部门名称'
}
}
-]
+])
export default data
diff --git a/src/views/system-manage/department-manage/tools/table.js b/src/views/system-manage/department-manage/tools/table.js
new file mode 100644
index 0000000..7c3243d
--- /dev/null
+++ b/src/views/system-manage/department-manage/tools/table.js
@@ -0,0 +1,124 @@
+import { h, ref, reactive } from 'vue'
+import TableAction from '@/components/DataTable/tools/Action.vue'
+import { deleteDept } from '@/api/system/dept/index.js'
+
+/* 注册table */
+const tableRef = ref()
+const searchParams = ref()
+
+function handleSearch(params) {
+ searchParams.value = { ...params }
+ tableRef.value.reFetch({ searchParams })
+}
+
+/**
+ * @description: 获取数据及操作
+ * @param {*} row 单行数据
+ * @param {*} type 操作类型 create:创建,preview:预览,edit:编辑
+ * @return {*}
+ */
+function getRowData(row, type) {
+ data.rowData = type === 'create' ? { pid: row.id } : row
+ data.modalType = type
+ data.modalShow = true
+}
+
+// 删除方法
+function deleteData(id) {
+ deleteDept(id)
+ .then((res) => {
+ if (res.code === 0) {
+ handleSearch()
+ }
+ })
+ .catch((e) => {
+ console.log(e)
+ })
+}
+
+const data = reactive({
+ tableRef,
+ searchParams,
+ rowData: {},
+ modalType: 'create',
+ modalShow: false,
+ handleSearch,
+
+ columns: [
+ {
+ title: '部门编号',
+ key: 'code',
+ align: 'center'
+ },
+ {
+ title: '部门名称',
+ key: 'name',
+ align: 'center'
+ },
+ {
+ title: '排序',
+ key: 'sort',
+ align: 'center'
+ },
+ {
+ title: '创建时间',
+ key: 'createTime',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ title: '更新时间',
+ key: 'updateTime',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ title: '操作',
+ align: 'center',
+ width: 150,
+ fixed: 'right',
+ render(row) {
+ return h(TableAction, {
+ actions: [
+ {
+ label: '添加',
+ type: 'button',
+ props: {
+ type: 'primary',
+ text: true,
+ onClick: getRowData.bind(null, row, 'create')
+ },
+ auth: 'basic_list'
+ },
+ {
+ label: '修改',
+ type: 'button',
+ props: {
+ type: 'primary',
+ text: true,
+ onClick: getRowData.bind(null, row, 'update')
+ },
+ auth: 'basic_list'
+ },
+ {
+ label: '删除',
+ type: 'popconfirm',
+ auth: 'basic_list',
+ tip: '确定删除这条数据吗?',
+ props: {
+ onPositiveClick: deleteData.bind(null, [row.id])
+ },
+ ButtonProps: {
+ text: true,
+ type: 'primary'
+ }
+ }
+ ],
+ align: 'center'
+ })
+ }
+ }
+ ]
+})
+
+export default data
diff --git a/src/views/system-manage/menu-manage/components/MenuModal.vue b/src/views/system-manage/menu-manage/components/MenuModal.vue
new file mode 100644
index 0000000..0034e48
--- /dev/null
+++ b/src/views/system-manage/menu-manage/components/MenuModal.vue
@@ -0,0 +1,161 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ cItem.label }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system-manage/menu-manage/index.vue b/src/views/system-manage/menu-manage/index.vue
new file mode 100644
index 0000000..58320e1
--- /dev/null
+++ b/src/views/system-manage/menu-manage/index.vue
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+ 添加菜单
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system-manage/menu-manage/tools/form.js b/src/views/system-manage/menu-manage/tools/form.js
new file mode 100644
index 0000000..9c0ac4f
--- /dev/null
+++ b/src/views/system-manage/menu-manage/tools/form.js
@@ -0,0 +1,53 @@
+import { ref, reactive, watch } from 'vue'
+import { MENU_TYPE, MENU_OPEN, MENU_VISIBLE, MENU_STATUS } from '@/utils/dictionary.js'
+import { getMenu } from '@/api/system/menu/index.js'
+import { dataToSelect } from '@/utils/handleData.js'
+const menuOptions = ref()
+const menuType0 = ref(true)
+const menuType1 = ref(false)
+
+export const form = reactive({
+ menuForm: {
+ pid: null,
+ type: 0,
+ title: '',
+ target: '1',
+ icon: '',
+ permission: '',
+ path: '',
+ sort: null,
+ component: '',
+ hide: 0,
+ status: 1
+ },
+ menuRules: {
+ title: [{ required: true, message: '请输入菜单名称', trigger: 'blur' }],
+ sort: [{ required: true, type: 'number', message: '请输入排序号', trigger: 'blur' }]
+ },
+ formItem: [
+ { type: 'select', key: 'pid', label: '上级菜单', props: { options: menuOptions, placeholder: '请选择上级菜单' }},
+ { type: 'radio', key: 'type', label: '菜单类型', options: MENU_TYPE },
+ { type: 'input', key: 'title', label: '菜单名称', props: { maxlength: '20', placeholder: '请输入菜单名称', clearable: true }},
+ { type: 'radio', key: 'target', label: '打开方式', options: MENU_OPEN },
+ { type: 'input', key: 'icon', label: '菜单图标', props: { maxlength: '20', placeholder: '请选择菜单图标', clearable: true }},
+ { type: 'input', key: 'permission', label: '权限标识', props: { maxlength: '20', placeholder: '请输入部门名称', disabled: menuType0, clearable: true }},
+ { type: 'input', key: 'path', label: '路由地址', props: { maxlength: '20', placeholder: '请输入部门名称', disabled: menuType1, clearable: true }},
+ { type: 'number', key: 'sort', label: '排序号', props: { min: 0, placeholder: '请输入排序号', clearable: true }},
+ { type: 'input', key: 'component', label: '组件路径', props: { maxlength: '20', placeholder: '请输入部门名称', disabled: menuType1, clearable: true }},
+ { type: 'radio', key: 'hide', label: '是否可见', options: MENU_VISIBLE },
+ { type: 'radio', key: 'status', label: '菜单状态', options: MENU_STATUS }
+ ]
+})
+
+export const getMenuOptions = async function() {
+ const res = await getMenu()
+ setTimeout(() => {
+ menuOptions.value = dataToSelect(res.data, { label: 'title', value: 'id' })
+ }, 3000)
+}
+
+export const changeMenuType = function(value) {
+ menuType0.value = !value
+ menuType1.value = !menuType0.value
+}
+
diff --git a/src/views/system-manage/menu-manage/tools/search.js b/src/views/system-manage/menu-manage/tools/search.js
new file mode 100644
index 0000000..d4a721e
--- /dev/null
+++ b/src/views/system-manage/menu-manage/tools/search.js
@@ -0,0 +1,13 @@
+import { reactive } from 'vue'
+const data = reactive([
+ {
+ label: '菜单名称',
+ key: 'title',
+ props: {
+ placeholder: '请输入菜单名称'
+ }
+ }
+])
+
+export default data
+
diff --git a/src/views/system-manage/menu-manage/tools/table.js b/src/views/system-manage/menu-manage/tools/table.js
new file mode 100644
index 0000000..2fa3555
--- /dev/null
+++ b/src/views/system-manage/menu-manage/tools/table.js
@@ -0,0 +1,165 @@
+import { MENU_TYPE, MENU_STATUS, MENU_VISIBLE } from '@/utils/dictionary.js'
+import { h, ref, reactive } from 'vue'
+import TableTags from '@/components/DataTable/tools/Tags.vue'
+import TableAction from '@/components/DataTable/tools/Action.vue'
+import { deleteMenu } from '@/api/system/menu/index.js'
+
+/* 注册table */
+const tableRef = ref()
+const searchParams = ref()
+
+function handleSearch(params) {
+ searchParams.value = { ...params }
+ tableRef.value.reFetch({ searchParams })
+}
+
+/**
+ * @description: 获取数据及操作
+ * @param {*} row 单行数据
+ * @param {*} type 操作类型 create:创建,preview:预览,edit:编辑
+ * @return {*}
+ */
+function getRowData(row, type) {
+ data.rowData = type === 'create' ? { pid: row.id } : row
+ data.modalType = type
+ data.modalShow = true
+}
+
+// 删除方法
+function deleteData(id) {
+ deleteMenu(id)
+ .then((res) => {
+ if (res.code === 0) {
+ handleSearch()
+ }
+ })
+ .catch((e) => {
+ console.log(e)
+ })
+}
+
+const data = reactive({
+ tableRef,
+ searchParams,
+ rowData: {},
+ modalType: 'create',
+ modalShow: false,
+ handleSearch,
+
+ columns: [
+ {
+ title: '菜单标题',
+ key: 'title',
+ align: 'center',
+ width: 200
+ },
+ {
+ title: '菜单类型',
+ key: 'type',
+ align: 'center',
+ width: 100,
+ render(row) {
+ return h(TableTags, {
+ data: row.type,
+ filters: MENU_TYPE
+ })
+ }
+ },
+ {
+ title: '路由地址',
+ key: 'path',
+ align: 'center',
+ width: 200
+ },
+ {
+ title: '组件路径',
+ key: 'component',
+ align: 'center',
+ width: 200
+ },
+ {
+ title: '状态',
+ key: 'status',
+ align: 'center',
+ width: 100,
+ render(row) {
+ return h(TableTags, {
+ data: row.status,
+ filters: MENU_STATUS
+ })
+ }
+ },
+ {
+ title: '排序',
+ key: 'sort',
+ align: 'center',
+ width: 100
+ },
+ {
+ title: '是否可见',
+ key: 'hide',
+ align: 'center',
+ width: 100,
+ render(row) {
+ return h(TableTags, {
+ data: row.hide,
+ filters: MENU_VISIBLE
+ })
+ }
+ },
+ {
+ title: '创建时间',
+ key: 'createTime',
+ align: 'center',
+ width: 160
+ },
+ {
+ title: '操作',
+ align: 'center',
+ width: 150,
+ fixed: 'right',
+ render(row) {
+ return h(TableAction, {
+ actions: [
+ {
+ label: '添加',
+ type: 'button',
+ props: {
+ type: 'primary',
+ text: true,
+ onClick: getRowData.bind(null, row, 'create')
+ },
+ auth: 'basic_list'
+ },
+ {
+ label: '修改',
+ type: 'button',
+ props: {
+ type: 'primary',
+ text: true,
+ onClick: getRowData.bind(null, row, 'update')
+ },
+ auth: 'basic_list'
+ },
+ {
+ label: '删除',
+ type: 'popconfirm',
+ auth: 'basic_list',
+ tip: '确定删除这条数据吗?',
+ props: {
+ onPositiveClick: deleteData.bind(null, [row.id])
+ },
+ ButtonProps: {
+ text: true,
+ type: 'primary'
+ }
+ }
+ ],
+ align: 'center'
+ })
+ }
+ }
+ ]
+})
+
+export default data
diff --git a/src/views/system/role/components/ConfigModal.vue b/src/views/system-manage/role-manage/components/ConfigModal.vue
similarity index 82%
rename from src/views/system/role/components/ConfigModal.vue
rename to src/views/system-manage/role-manage/components/ConfigModal.vue
index 247627f..35b7b60 100644
--- a/src/views/system/role/components/ConfigModal.vue
+++ b/src/views/system-manage/role-manage/components/ConfigModal.vue
@@ -33,14 +33,14 @@ export default defineComponent({
type: Boolean,
default: false
},
- row: {
+ data: {
type: Object,
default: () => {}
}
},
emits: {
'update:visible': null,
- 'done': null
+ 'reload': null
},
setup(props, { emit }) {
const data = reactive({
@@ -62,7 +62,7 @@ export default defineComponent({
// 获取当前角色的权限菜单列表
async function getMenuByRoleId() {
- const res = await getRolePermission(props.row.id)
+ const res = await getRolePermission(props.data.id)
data.allTreeData = toTreeData(res.data, 'id', 'pid', 'children')
const checkedArr = res.data
if (checkedArr.length) {
@@ -80,6 +80,17 @@ export default defineComponent({
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)
@@ -88,25 +99,9 @@ export default defineComponent({
return {
...toRefs(data),
getModalOptions,
- handleClose,
- handleCheckTree
- }
- },
- methods: {
- // 提交
- handleConfirm() {
- console.log(this.menuIds, this.checkedTreeData)
- savePermission({ roleId: this.row.id, menuIds: this.menuIds }).then(res => {
- if (res.code === 0) {
- this.handleClose()
- this.$emit('done')
- $message.success(res.msg)
- } else {
- $message.error(res.msg)
- }
- }).catch(e => {
- console.log(e)
- })
+ handleCheckTree,
+ handleConfirm,
+ handleClose
}
}
})
diff --git a/src/views/system-manage/role-manage/components/RoleModal.vue b/src/views/system-manage/role-manage/components/RoleModal.vue
new file mode 100644
index 0000000..b6e0721
--- /dev/null
+++ b/src/views/system-manage/role-manage/components/RoleModal.vue
@@ -0,0 +1,139 @@
+
+
+
+
+
+
+
+
+
+ {{ cItem.label }}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system-manage/role-manage/index.vue b/src/views/system-manage/role-manage/index.vue
new file mode 100644
index 0000000..f8f814e
--- /dev/null
+++ b/src/views/system-manage/role-manage/index.vue
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+ 新建
+
+
+ 删除
+
+ 确定删除选中的数据吗?
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system-manage/role-manage/tools/form.js b/src/views/system-manage/role-manage/tools/form.js
new file mode 100644
index 0000000..5197d56
--- /dev/null
+++ b/src/views/system-manage/role-manage/tools/form.js
@@ -0,0 +1,24 @@
+import { reactive } from 'vue'
+import { USER_STATUS } from '@/utils/dictionary.js'
+
+const data = reactive({
+ roleForm: {
+ code: '',
+ name: '',
+ status: 1,
+ note: ''
+ },
+ roleRules: {
+ code: [{ required: true, message: '请输入角色编号', trigger: 'blur' }],
+ name: [{ required: true, message: '请输入角色名称', type: 'string', trigger: 'blur' }],
+ status: [{ required: true, message: '请选择状态', type: 'number', trigger: 'blur' }]
+ },
+ formItem: [
+ { type: 'input', key: 'code', label: '角色编号', props: { maxlength: '20', placeholder: '请输入角色编号', clearable: true }},
+ { type: 'input', key: 'name', label: '角色名称', props: { maxlength: '20', placeholder: '请输入角色名称', clearable: true }},
+ { type: 'radio', key: 'status', label: '状态', options: USER_STATUS },
+ { type: 'input', key: 'note', label: '备注', props: { type: 'textarea', autosize: { maxlength: '200', minRows: 3, maxRows: 3 }}}
+ ]
+})
+
+export default data
diff --git a/src/views/system/role/info.js b/src/views/system-manage/role-manage/tools/search.js
similarity index 69%
rename from src/views/system/role/info.js
rename to src/views/system-manage/role-manage/tools/search.js
index d80fb79..76a266d 100644
--- a/src/views/system/role/info.js
+++ b/src/views/system-manage/role-manage/tools/search.js
@@ -1,4 +1,6 @@
-const data = [
+import { reactive } from 'vue'
+
+const data = reactive([
{
label: '角色名称',
key: 'name',
@@ -6,6 +8,6 @@ const data = [
placeholder: '请输入角色名称'
}
}
-]
+])
export default data
diff --git a/src/views/system-manage/role-manage/tools/table.js b/src/views/system-manage/role-manage/tools/table.js
new file mode 100644
index 0000000..59498fc
--- /dev/null
+++ b/src/views/system-manage/role-manage/tools/table.js
@@ -0,0 +1,165 @@
+import { h, ref, reactive } from 'vue'
+import TableSwitch from '@/components/DataTable/tools/Switch.vue'
+import TableAction from '@/components/DataTable/tools/Action.vue'
+import { deleteRole, setRoleStatus } from '@/api/system/role/index'
+
+/* 注册table */
+const tableRef = ref()
+const searchParams = ref()
+
+function handleSearch(params) {
+ searchParams.value = { ...params }
+ tableRef.value.reFetch({ searchParams })
+}
+
+/**
+ * @description: 获取数据及操作
+ * @param {*} row 单行数据
+ * @param {*} type 操作类型 create:创建,preview:预览,edit:编辑
+ * @return {*}
+ */
+function getRowData(row, type) {
+ data.rowData = row
+ data.modalType = type
+ data.modalShow = true
+}
+
+/**
+ * @description: 打开分配权限窗口
+ * @param {*} row 单行数据
+ * @return {*}
+ */
+function configure(row) {
+ data.rowData = row
+ data.configModalShow = true
+}
+
+/**
+ * @description: 改变状态
+ * @param {*} row 选中数据
+ * @return {*}
+ */
+function handleStatusChange(row) {
+ setRoleStatus({ id: row.data.id, status: row.value })
+ .then((res) => {
+ if (res.code === 0) {
+ handleSearch()
+ }
+ })
+ .catch((e) => {
+ console.log(e)
+ })
+}
+
+// 删除接口
+function deleteData(data) {
+ deleteRole(data)
+ .then((res) => {
+ if (res.code === 0) {
+ handleSearch()
+ }
+ })
+ .catch((e) => {
+ console.log(e)
+ })
+}
+
+const data = reactive({
+ tableRef,
+ searchParams,
+ rowData: {},
+ modalType: 'create',
+ modalShow: false,
+ configModalShow: false,
+ handleSearch,
+ deleteData,
+ columns: [
+ { type: 'selection' },
+ {
+ title: '角色编号',
+ key: 'code',
+ align: 'center'
+ },
+ {
+ title: '角色名称',
+ key: 'name',
+ align: 'center'
+ },
+ {
+ title: '创建时间',
+ key: 'createTime',
+ align: 'center',
+ Minwidth: 160
+ },
+ {
+ title: '更新时间',
+ key: 'updateTime',
+ align: 'center',
+ Minwidth: 160
+ },
+ {
+ title: '状态',
+ key: 'status',
+ align: 'center',
+ width: 100,
+ render(row) {
+ return h(TableSwitch, {
+ data: { id: row.id, status: row.status },
+ rowKey: 'status',
+ checkedValue: 1,
+ uncheckedValue: 2,
+ onChange: handleStatusChange.bind(row)
+ })
+ }
+ },
+ {
+ title: '操作',
+ align: 'center',
+ width: 150,
+ fixed: 'right',
+ render(row) {
+ return h(TableAction, {
+ actions: [
+ {
+ label: '修改',
+ type: 'button',
+ props: {
+ type: 'primary',
+ text: true,
+ onClick: getRowData.bind(null, row, 'update')
+ },
+ auth: 'basic_list'
+ },
+ {
+ label: '分配权限',
+ type: 'button',
+ props: {
+ type: 'primary',
+ ghost: true,
+ text: true,
+ onClick: configure.bind(null, row)
+ },
+ auth: 'basic_list'
+ },
+ {
+ label: '删除',
+ type: 'popconfirm',
+ auth: 'basic_list',
+ tip: '确定删除这条数据吗?',
+ props: {
+ onPositiveClick: deleteData.bind(null, [row.id])
+ },
+ ButtonProps: {
+ text: true,
+ type: 'primary'
+ }
+ }
+ ],
+ align: 'center'
+ })
+ }
+ }
+ ]
+})
+
+export default data
diff --git a/src/views/system-manage/user-manage/components/UserModal.vue b/src/views/system-manage/user-manage/components/UserModal.vue
new file mode 100644
index 0000000..ea401e5
--- /dev/null
+++ b/src/views/system-manage/user-manage/components/UserModal.vue
@@ -0,0 +1,168 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{ cItem.label }}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system-manage/user-manage/index.vue b/src/views/system-manage/user-manage/index.vue
new file mode 100644
index 0000000..79ee8f8
--- /dev/null
+++ b/src/views/system-manage/user-manage/index.vue
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+ 新建
+
+
+ 删除
+
+ 确认要删除选中数据吗?
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system-manage/user-manage/tools/form.js b/src/views/system-manage/user-manage/tools/form.js
new file mode 100644
index 0000000..66437f2
--- /dev/null
+++ b/src/views/system-manage/user-manage/tools/form.js
@@ -0,0 +1,52 @@
+import { ref, reactive } from 'vue'
+import { USER_STATUS } from '@/utils/dictionary.js'
+import { getDeptAll } from '@/api/system/dept/index'
+import { getRoleAll } from '@/api/system/role/index'
+import { dataToSelect } from '@/utils/handleData.js'
+const departmentOptions = ref()
+const rolesOptions = ref()
+export const form = reactive({
+ userForm: {
+ avatar: '',
+ code: '',
+ deptId: null,
+ username: '',
+ realname: '',
+ password: '',
+ roleIds: [],
+ status: 1,
+ note: ''
+ },
+ userRules: {
+ imageStatus: [{ required: true, message: '请选择头像', type: 'string', trigger: 'blur' }],
+ code: [{ required: true, message: '请输入编号', trigger: 'blur' }],
+ realname: [{ required: true, message: '请输入用户姓名', type: 'string', trigger: 'blur' }],
+ deptId: [{ required: true, message: '请选择部门', type: 'number', trigger: 'blur' }],
+ status: [{ required: true, message: '请选择状态', type: 'number', trigger: 'blur' }],
+ roleIds: [{ required: true, message: '请选择角色', type: 'array', trigger: 'blur' }],
+ username: [{ required: true, message: '请输入用户账号', type: 'string', trigger: 'blur' }]
+ },
+ formItem: [
+ // { type: 'oss', key: 'imageStatus', label: '头像', file: 'avatar', refIndex: 0 },
+ { type: 'oss', key: 'imageStatus', label: '头像', file: 'avatar' },
+ { type: 'input', key: 'code', label: '用户编号', props: { maxlength: '20', placeholder: '请输入用户编号', clearable: true }},
+ { type: 'input', key: 'username', label: '用户账号', props: { maxlength: '20', placeholder: '请输入用户账号', clearable: true }},
+ { type: 'input', key: 'password', label: '登录密码', props: { type: 'password', maxlength: '20', placeholder: '请输入登录密码', clearable: true }},
+ { type: 'input', key: 'realname', label: '用户姓名', props: { maxlength: '20', placeholder: '请输入用户姓名', clearable: true }},
+ { type: 'select', key: 'deptId', label: '所属部门', props: { options: departmentOptions, placeholder: '请选择所属部门' }},
+ { type: 'select', key: 'roleIds', label: '角色', props: { multiple: true, options: rolesOptions, placeholder: '请选择角色' }},
+ { type: 'radio', key: 'status', label: '状态', options: USER_STATUS },
+ { type: 'input', key: 'note', label: '备注', props: { type: 'textarea', autosize: { maxlength: '200', minRows: 3, maxRows: 3 }}}
+ ]
+})
+
+export const getDeptOptions = async function() {
+ const res = await getDeptAll()
+ departmentOptions.value = dataToSelect(res.data, { label: 'name', value: 'id' })
+}
+
+// 获取角色列表
+export const getRoleOptions = async function() {
+ const res = await getRoleAll()
+ rolesOptions.value = dataToSelect(res.data, { label: 'name', value: 'id' })
+}
diff --git a/src/views/system-manage/user-manage/tools/search.js b/src/views/system-manage/user-manage/tools/search.js
new file mode 100644
index 0000000..3e468f5
--- /dev/null
+++ b/src/views/system-manage/user-manage/tools/search.js
@@ -0,0 +1,36 @@
+import { getRoleAll } from '@/api/system/role/index'
+import { ref, reactive } from 'vue'
+const rolesOptions = ref([])
+
+export const search = reactive({
+ search: [
+ {
+ label: '用户账号',
+ key: 'username',
+ props: {
+ placeholder: '请输入用户账号'
+ }
+ },
+ {
+ label: '用户姓名',
+ key: 'realname',
+ props: {
+ placeholder: '请输入用户姓名'
+ }
+ },
+ {
+ label: '用户角色',
+ type: 'select',
+ key: 'roleId',
+ props: {
+ placeholder: '请选择用户角色',
+ options: rolesOptions
+ }
+ }
+ ]
+})
+
+export const fetchRolesOption = async function() {
+ const res = await getRoleAll()
+ rolesOptions.value = res.data.map((item) => { return { key: item.id, label: item.name } })
+}
diff --git a/src/views/system-manage/user-manage/tools/table.js b/src/views/system-manage/user-manage/tools/table.js
new file mode 100644
index 0000000..5bd2ed8
--- /dev/null
+++ b/src/views/system-manage/user-manage/tools/table.js
@@ -0,0 +1,210 @@
+import { h, ref, reactive } from 'vue'
+import TableImage from '@/components/DataTable/tools/Image.vue'
+import TableTags from '@/components/DataTable/tools/Tags.vue'
+import TableSwitch from '@/components/DataTable/tools/Switch.vue'
+import TableAction from '@/components/DataTable/tools/Action.vue'
+import { resetPassword, deleteUser, setUserStatus } from '@/api/system/user/index.js'
+
+/* 注册table */
+const tableRef = ref()
+const searchParams = ref()
+
+function handleSearch(params) {
+ searchParams.value = { ...params }
+ tableRef.value.reFetch({ searchParams })
+}
+
+/**
+ * @description: 获取数据及操作
+ * @param {*} row 单行数据
+ * @param {*} type 操作类型 create:创建,preview:预览,edit:编辑
+ * @return {*}
+ */
+function getRowData(row, type) {
+ data.rowData = row
+ data.modalType = type
+ data.modalShow = true
+}
+
+// 设置状态
+function setStatus(row) {
+ setUserStatus({ id: row.data.id, status: row.value }).then(res => {
+ if (res.code === 0) {
+ handleSearch()
+ $message.success(res.msg)
+ } else {
+ $message.error(res.msg)
+ }
+ }).catch(e => {
+ console.log(e)
+ })
+}
+
+/**
+ * @description: 重置密码
+ * @param {Number} id 选中数据id
+ * @return {*}
+ */
+function handlePasswordReset(id) {
+ resetPassword({ id })
+ .then(res => {
+ if (res.code === 0) {
+ handleSearch()
+ }
+ }).catch(e => {
+ console.log(e)
+ })
+}
+
+/**
+ * @description: 删除用户接口
+ * @param {Array} ids 用户id集合
+ * @return {*}
+ */
+function deleteData(ids) {
+ deleteUser(ids).then((res) => {
+ if (res.code === 0) {
+ handleSearch()
+ }
+ }).catch(e => {
+ console.log(e)
+ })
+}
+
+const data = reactive({
+ tableRef,
+ searchParams,
+ rowData: {},
+ modalType: 'create',
+ modalShow: false,
+ handleSearch,
+ deleteData,
+ columns: [
+ {
+ type: 'selection'
+ },
+ {
+ title: '用户编号',
+ key: 'code',
+ align: 'center'
+ },
+ {
+ title: '头像',
+ key: 'avatar',
+ align: 'center',
+ render(row) {
+ return h(TableImage, {
+ images: {
+ width: 36,
+ height: 36,
+ src: row.avatar
+ }
+ })
+ }
+ },
+ {
+ title: '用户账号',
+ key: 'username',
+ align: 'center'
+ },
+ {
+ title: '用户姓名',
+ key: 'realname',
+ align: 'center'
+ },
+ {
+ title: '角色',
+ key: 'roleList',
+ align: 'center',
+ render(row) {
+ return h(TableTags, {
+ data: row.roles,
+ rowKey: 'name'
+ })
+ }
+ },
+ {
+ title: '部门',
+ key: 'deptName',
+ align: 'center'
+ },
+ {
+ title: '创建时间',
+ key: 'createTime',
+ align: 'center',
+ width: 160
+ },
+ {
+ title: '更新时间',
+ key: 'updateTime',
+ align: 'center',
+ width: 160
+ },
+ {
+ title: '状态',
+ key: 'status',
+ align: 'center',
+ width: 100,
+ render(row) {
+ return h(TableSwitch, {
+ data: { id: row.id, status: row.status },
+ rowKey: 'status',
+ checkedValue: 1,
+ uncheckedValue: 2,
+ onChange: setStatus.bind(row)
+ })
+ }
+ },
+ {
+ title: '操作',
+ align: 'center',
+ width: 150,
+ fixed: 'right',
+ render(row) {
+ return h(TableAction, {
+ actions: [
+ {
+ label: '修改',
+ type: 'button',
+ props: {
+ type: 'primary',
+ text: true,
+ onClick: getRowData.bind(null, row, 'update')
+ },
+ auth: 'basic_list'
+ },
+ {
+ label: '重置密码',
+ type: 'popconfirm',
+ tip: '确定要重置为123456吗?',
+ props: {
+ onPositiveClick: handlePasswordReset.bind(null, row.id)
+ },
+ ButtonProps: {
+ text: true,
+ type: 'primary'
+ },
+ auth: 'basic_list'
+ },
+ {
+ label: '删除',
+ type: 'popconfirm',
+ auth: 'basic_list',
+ tip: '确定删除这条数据吗?',
+ props: {
+ onPositiveClick: deleteData.bind(null, [row.id])
+ },
+ ButtonProps: {
+ text: true,
+ type: 'primary'
+ }
+ }
+ ],
+ align: 'center'
+ })
+ }
+ }
+ ]
+})
+
+export default data
diff --git a/src/views/system/dept/components/DeptModal.vue b/src/views/system/dept/components/DeptModal.vue
deleted file mode 100644
index 61c8bbb..0000000
--- a/src/views/system/dept/components/DeptModal.vue
+++ /dev/null
@@ -1,187 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue
deleted file mode 100644
index 3ccdb7e..0000000
--- a/src/views/system/dept/index.vue
+++ /dev/null
@@ -1,188 +0,0 @@
-
-
-
-
-
-
- 新建
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/system/dept/table.js b/src/views/system/dept/table.js
deleted file mode 100644
index cb0cc9b..0000000
--- a/src/views/system/dept/table.js
+++ /dev/null
@@ -1,30 +0,0 @@
-const table = {
- columns: [{
- title: '部门编号',
- key: 'code',
- align: 'center'
- },
- {
- title: '部门名称',
- key: 'name',
- align: 'center'
- },
- {
- title: '排序',
- key: 'sort',
- align: 'center'
- },
- {
- title: '创建时间',
- key: 'createTime',
- align: 'center',
- minWidth: 120
- },
- {
- title: '更新时间',
- key: 'updateTime',
- align: 'center',
- minWidth: 120
- }]
-}
-export default table
diff --git a/src/views/system/menu/components/MenuModal.vue b/src/views/system/menu/components/MenuModal.vue
deleted file mode 100644
index e62c0e9..0000000
--- a/src/views/system/menu/components/MenuModal.vue
+++ /dev/null
@@ -1,238 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ item.label }}
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ item.label }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ item.label }}
-
-
-
-
-
-
-
-
- {{ item.label }}
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue
deleted file mode 100644
index 61a55c8..0000000
--- a/src/views/system/menu/index.vue
+++ /dev/null
@@ -1,177 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/system/menu/info.js b/src/views/system/menu/info.js
deleted file mode 100644
index f4f8ec5..0000000
--- a/src/views/system/menu/info.js
+++ /dev/null
@@ -1,15 +0,0 @@
-const data = [
- {
- label: '菜单名称',
- type: 'area',
- key: 'name',
- refIndex: 0,
- props: {
- placeholder: '请输入菜单名称',
- options: [{ label: 1, value: 1, children: [{ label: '1-1', value: '1-1' }] }]
- }
- }
-]
-
-export default data
-
diff --git a/src/views/system/menu/table.js b/src/views/system/menu/table.js
deleted file mode 100644
index 6a87500..0000000
--- a/src/views/system/menu/table.js
+++ /dev/null
@@ -1,101 +0,0 @@
-import { h } from 'vue'
-import TableTags from '@/components/DataTable/tools/Tags.vue'
-const table = {
- columns: [
- {
- title: '菜单标题',
- key: 'title',
- align: 'center',
- width: 200
- },
- {
- title: '菜单类型',
- key: 'type',
- align: 'center',
- width: 100,
- render(row) {
- return h(TableTags, {
- data: row.type,
- filters: [
- {
- key: 0,
- label: '菜单'
- },
- {
- key: 1,
- label: '节点'
- }
- ]
- })
- }
- },
- {
- title: '路由地址',
- key: 'path',
- align: 'center',
- width: 200
- },
- {
- title: '组件路径',
- key: 'component',
- align: 'center',
- width: 200
- },
- {
- title: '状态',
- key: 'status',
- align: 'center',
- width: 100,
- render(row) {
- return h(TableTags, {
- data: row.status,
- filters: [
- {
- key: 1,
- label: '在用'
- },
- {
- key: 2,
- label: '停用'
- }
- ]
- })
- }
- },
- {
- title: '排序',
- key: 'sort',
- align: 'center',
- width: 100
- },
- {
- title: '是否可见',
- key: 'hide',
- align: 'center',
- width: 100,
- render(row) {
- return h(TableTags, {
- data: row.hide,
- filters: [
- {
- key: 1,
- label: '可见'
- },
- {
- key: 2,
- label: '不可见'
- }
- ]
- })
- }
- },
- {
- title: '创建时间',
- key: 'createTime',
- align: 'center',
- width: 160
- }
- ]
-}
-
-export default table
diff --git a/src/views/system/role/components/RoleModal.vue b/src/views/system/role/components/RoleModal.vue
deleted file mode 100644
index 66ccaae..0000000
--- a/src/views/system/role/components/RoleModal.vue
+++ /dev/null
@@ -1,166 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- 正常
- 禁用
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue
deleted file mode 100644
index 8337fb8..0000000
--- a/src/views/system/role/index.vue
+++ /dev/null
@@ -1,239 +0,0 @@
-
-
-
-
-
-
- 新建
-
-
- 删除
-
- 确定删除选中的数据吗?
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/system/role/table.js b/src/views/system/role/table.js
deleted file mode 100644
index 7c1a4f8..0000000
--- a/src/views/system/role/table.js
+++ /dev/null
@@ -1,30 +0,0 @@
-
-const data = {
- columns: [
- { type: 'selection' },
- {
- title: '角色编号',
- key: 'code',
- align: 'center'
- },
- {
- title: '角色名称',
- key: 'name',
- align: 'center'
- },
- {
- title: '创建时间',
- key: 'createTime',
- align: 'center',
- Minwidth: 160
- },
- {
- title: '更新时间',
- key: 'updateTime',
- align: 'center',
- Minwidth: 160
- }
- ]
-}
-
-export default data
diff --git a/src/views/system/user/components/UserModal.vue b/src/views/system/user/components/UserModal.vue
deleted file mode 100644
index 2278a5b..0000000
--- a/src/views/system/user/components/UserModal.vue
+++ /dev/null
@@ -1,251 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 正常
- 禁用
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
deleted file mode 100644
index 61d118f..0000000
--- a/src/views/system/user/index.vue
+++ /dev/null
@@ -1,233 +0,0 @@
-
-
-
-
-
-
- 新建
-
-
- 删除
-
- 确认要删除选中数据吗?
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/system/user/info.js b/src/views/system/user/info.js
deleted file mode 100644
index 8ac87ae..0000000
--- a/src/views/system/user/info.js
+++ /dev/null
@@ -1,45 +0,0 @@
-import { getRoleAll } from '@/api/system/role/index'
-import { dataToSelect } from '@/utils/handleData.js'
-import { ref } from 'vue'
-const rolesOptions = ref([])
-const getRolesOption = async function() {
- const res = await getRoleAll()
- rolesOptions.value = dataToSelect(res.data, { label: 'name', value: 'id' })
-}
-// getRolesOption()
-const data = [
- {
- label: '用户账号',
- key: 'username',
- props: {
- placeholder: '请输入用户账号'
- }
- },
- {
- label: '用户姓名',
- key: 'realname',
- props: {
- placeholder: '请输入用户姓名'
- }
- },
- {
- label: '用户角色',
- type: 'select',
- key: 'roleId',
- props: {
- placeholder: '请选择用户角色',
- options: rolesOptions
- }
- }
-// {
-// label: '角色类型',
-// type: 'date',
-// key: 'date',
-// props: {
-// type: 'date'
-// }
-// }
-]
-
-export default data
-
diff --git a/src/views/system/user/table.js b/src/views/system/user/table.js
deleted file mode 100644
index f9b23d4..0000000
--- a/src/views/system/user/table.js
+++ /dev/null
@@ -1,69 +0,0 @@
-import { h } from 'vue'
-import TableImage from '@/components/DataTable/tools/Image.vue'
-import TableTags from '@/components/DataTable/tools/Tags.vue'
-
-const table = {
- columns: [
- {
- type: 'selection'
- },
- {
- title: '用户编号',
- key: 'code',
- align: 'center'
- },
- {
- title: '头像',
- key: 'avatar',
- align: 'center',
- render(row) {
- return h(TableImage, {
- images: {
- width: 36,
- height: 36,
- src: row.avatar
- }
- })
- }
- },
- {
- title: '用户账号',
- key: 'username',
- align: 'center'
- },
- {
- title: '用户姓名',
- key: 'realname',
- align: 'center'
- },
- {
- title: '角色',
- key: 'roleList',
- align: 'center',
- render(row) {
- return h(TableTags, {
- data: row.roleList,
- rowKey: 'name'
- })
- }
- },
- {
- title: '部门',
- key: 'deptName',
- align: 'center'
- },
- {
- title: '创建时间',
- key: 'createTime',
- align: 'center',
- width: 160
- },
- {
- title: '更新时间',
- key: 'updateTime',
- align: 'center',
- width: 160
- }
- ]
-}
-export default table