Commit 5dc13f86 by 胡悦

提交字典数据、操作日志页面

1 parent 15adcd5f
...@@ -9,8 +9,9 @@ ...@@ -9,8 +9,9 @@
<router-link to="/user">user</router-link> | <router-link to="/user">user</router-link> |
<router-link to="/role">role</router-link> | <router-link to="/role">role</router-link> |
<router-link to="/orginizaManage">orginizaManage</router-link> | <router-link to="/orginizaManage">orginizaManage</router-link> |
<router-link to="/dictionaryManage">dictionaryManage</router-link> <router-link to="/dictionaryManage">dictionaryManage</router-link> |
<router-link to="/dictionaryData">dictionaryData</router-link> |
<router-link to="/workLog">workLog</router-link>
<!-- <p>a链接跳转到主项目/其他子项目的页面,页面会刷新,效果不好<a href="/about">parent About</a></p> --> <!-- <p>a链接跳转到主项目/其他子项目的页面,页面会刷新,效果不好<a href="/about">parent About</a></p> -->
<p v-if="isQiankun"> <p v-if="isQiankun">
主项目把router传给子项目,子项目用这个router来跳转 主项目把router传给子项目,子项目用这个router来跳转
......
...@@ -13,10 +13,18 @@ const API = { ...@@ -13,10 +13,18 @@ const API = {
getMockConfig() { getMockConfig() {
return MOCK_CONFIG_URL + '/test_config' return MOCK_CONFIG_URL + '/test_config'
}, },
LOGIN_ACTION: BASE_URL + '/login_action', LOGIN_ACTION: BASE_URL + '/login_action'
}
const USER_API = {
USER_SEARCH: BASE_URL + '/usercenter/user/search', USER_SEARCH: BASE_URL + '/usercenter/user/search',
USER_SUPER: BASE_URL + '/usercenter/user/suitableSuperUsers',
USER_ADD: BASE_URL + '/usercenter/user/add'
}
const ORGINIZA_API = {
ORGINIZA_SEARCH: BASE_URL + '/usercenter/organization/rootList', ORGINIZA_SEARCH: BASE_URL + '/usercenter/organization/rootList',
ORGINIZA_CHILDREN: BASE_URL + '/usercenter/organization/children' ORGINIZA_CHILDREN: BASE_URL + '/usercenter/organization/children',
ORGINIZA_SIMPLElIST: BASE_URL + '/usercenter/organization/simpleList',
ORGINIZA_TREEORY: BASE_URL + '/usercenter/organization/treeOrg'
} }
export { API, USER_API, ORGINIZA_API }
export { API }
...@@ -37,6 +37,16 @@ const routes = [ ...@@ -37,6 +37,16 @@ const routes = [
path: '/dictionaryManage', path: '/dictionaryManage',
name: 'DictionaryManage', name: 'DictionaryManage',
component: () => import('../views/dictionaryManage/index.vue') component: () => import('../views/dictionaryManage/index.vue')
},
{
path: '/dictionaryData',
name: 'dictionaryData',
component: () => import('../views/dictionaryManage/dictionaryData/index.vue')
},
{
path: '/workLog',
name: 'workLog',
component: () => import('../views/workLog/index.vue')
} }
] ]
......
import HTTP from '@/utils/http' import HTTP from '@/utils/http'
import { API } from '@/config/config' import { ORGINIZA_API } from '@/config/config'
export default class OrginizaService extends HTTP { export default class OrginizaService extends HTTP {
// 获取组织列表
getTableList () { getTableList () {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.axiosGet({ this.axiosGet({
url: API.ORGINIZA_SEARCH, url: ORGINIZA_API.ORGINIZA_SEARCH,
data: {}, data: {},
success(data) { success(data) {
resolve(data) resolve(data)
...@@ -13,15 +14,15 @@ export default class OrginizaService extends HTTP { ...@@ -13,15 +14,15 @@ export default class OrginizaService extends HTTP {
error(error) { error(error) {
// 网络请求失败 // 网络请求失败
console.log('网络请求失败') console.log('网络请求失败')
// window.location.reload()
} }
}) })
}) })
} }
// 根据根节点,获取子节点列表
getChildren (id) { getChildren (id) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.axiosGet({ this.axiosGet({
url: API.ORGINIZA_CHILDREN, url: ORGINIZA_API.ORGINIZA_CHILDREN,
data: { data: {
rootId: id rootId: id
}, },
...@@ -31,7 +32,38 @@ export default class OrginizaService extends HTTP { ...@@ -31,7 +32,38 @@ export default class OrginizaService extends HTTP {
error(error) { error(error) {
// 网络请求失败 // 网络请求失败
console.log('网络请求失败') console.log('网络请求失败')
// window.location.reload() }
})
})
}
// 获取组织列表树
getSimpleList () {
return new Promise((resolve, reject) => {
this.axiosGet({
url: ORGINIZA_API.ORGINIZA_SIMPLElIST,
data: {},
success(data) {
resolve(data)
},
error(error) {
// 网络请求失败
console.log('网络请求失败')
}
})
})
}
// 组织架构
getTreeOrg () {
return new Promise((resolve, reject) => {
this.axiosGet({
url: ORGINIZA_API.ORGINIZA_TREEORY,
data: {},
success(data) {
resolve(data)
},
error(error) {
// 网络请求失败
console.log('网络请求失败')
} }
}) })
}) })
......
import HTTP from '@/utils/http' import HTTP from '@/utils/http'
import { API } from '@/config/config' import { USER_API } from '@/config/config'
export default class UserService extends HTTP { export default class UserService extends HTTP {
// 获取用户列表
getUserList () { getUserList () {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.axiosGet({ this.axiosGet({
url: API.USER_SEARCH, url: USER_API.USER_SEARCH,
data: {}, data: {},
success(data) { success(data) {
resolve(data) resolve(data)
...@@ -18,4 +19,36 @@ export default class UserService extends HTTP { ...@@ -18,4 +19,36 @@ export default class UserService extends HTTP {
}) })
}) })
} }
// 获取上级树
getSuperUser (params) {
return new Promise((resolve, reject) => {
this.axiosGet({
url: USER_API.USER_SUPER,
data: {params},
success(data) {
resolve(data)
},
error(error) {
// 网络请求失败
console.log('网络请求失败')
}
})
})
}
// 新增用户
addUser (params) {
return new Promise((resolve, reject) => {
this.axiosGet({
url: USER_API.USER_SUPER,
data: {params},
success(data) {
resolve(data)
},
error(error) {
// 网络请求失败
console.log('网络请求失败')
}
})
})
}
} }
...@@ -17,6 +17,31 @@ ...@@ -17,6 +17,31 @@
rgba(232, 237, 250, 0.5) 0px 2px 4px 0px; rgba(232, 237, 250, 0.5) 0px 2px 4px 0px;
} }
.system-container {
padding: 0 0 0 10px;
margin: 20px 24px;
background-color: #ffffff;
overflow: hidden;
.user-tree {
margin-top: 20px;
padding: 20px;
float: left;
width: 18%;
.user-tree-top {
height: 30px;
}
}
.user-container {
padding: 20px 10px 0px 20px;
float: left;
width: 82%;
}
}
.el-tree {
margin-top: 20px;
}
// 状态 // 状态
.dot { .dot {
display: inline-block; display: inline-block;
......
<template>
<div class="system-container">
<div class="user-container">
<search-form
class="searchTop border-shadow"
:formModel="searchForm"
:formList="dictionaryFormList"
>
<slot name="form-slot">
<el-button
type="primary"
:size="btn_size"
icon="el-icon-search"
:id="tableParams.btnId"
>搜索</el-button>
<el-button
type="primary"
:size="btn_size"
icon="el-icon-refresh"
>重置</el-button>
</slot>
</search-form>
<div class="table-btn">
<el-button
type="primary"
:size="btn_size"
icon="el-icon-plus"
@click="handleClose"
>新增</el-button>
</div>
<basic-table
:tableParams="tableParams"
:getListApi="getListApi"
:searchForm="searchForm"
:hasNum="false"
>
<span
slot="status"
slot-scope="scope"
>
<span class="dot green"></span><span class="statusText">正常</span>
</span>
<span
slot="table-button"
slot-scope="scope"
>
<el-button
v-for="(j, idx) in tableParams.tableOption.btnList"
:key="idx"
:type="j.type"
size="mini"
plain
@click="btnClick(j.pType, scope.scope)"
>{{j.name}}</el-button>
</span>
</basic-table>
<basic-dialog
:title="dictionaryDialogTitle"
:isVisible="dictionaryVisible"
@confirmDialog="handleConfirm"
@closeDialog="handleClose"
>
<slot>
<rule-form
:ruleForm="dictionaryForm"
:rules="dictionaryRules"
:ruleData="dictionaryData"
ref='dictionaryForm'
></rule-form>
</slot>
</basic-dialog>
</div>
</div>
</template>
<script>
export default {
data() {
return {
searchForm: {},
dictionaryFormList: [
{
type: 'input',
inputType: 'text',
prop: 'name',
placeholder: '请输入字典名称'
},
{
type: 'input',
inputType: 'text',
prop: 'type',
placeholder: '请输入字典标签'
},
{
type: 'select',
prop: 'status',
placeholder: '请选择字典状态',
options: [
{
label: '正常',
value: 1
}, {
label: '停用',
value: 2
}
]
}
],
tableParams: {
mutiSelectName: 'dictionaryData',
mutiSelectUniqueKey: 'id',
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableColumns: [
{
label: '字典编码',
prop: 'id'
}, {
label: '字典标签',
prop: 'dictName'
}, {
label: '字典键值',
prop: 'dictType'
}, {
label: '字典排序',
prop: 'remark'
}, {
label: '备注',
prop: 'remark'
}, {
label: '字典状态',
prop: 'enableStatus',
addHtml: 'status'
}, {
label: '创建时间',
prop: 'createdDate'
}
],
tableOption: {
width: 300,
btnList: [
{
type: 'primary',
name: '编辑',
pType: 'edit'
},
{
type: 'danger',
name: '删除',
pType: 'delete'
}
]
}
},
getListApi: null,
// 弹窗
dictionaryDialogTitle: '新增字典',
dictionaryVisible: false,
dictionaryForm: {},
dictionaryData: [
{ label: '字典类型:', prop: 'dictType', type: 'input' },
{ label: '字典标签:', prop: 'dictName', type: 'input' },
{ label: '字典编码:', prop: 'dictName', type: 'input' },
{ label: '字典键值:', prop: 'dictName', type: 'input' },
{ label: '字典顺序:', prop: 'dictName', type: 'input' },
{ label: '状态', prop: 'enableStatus', type: 'switch' },
{ label: '备注', prop: 'remark', type: 'input', inputText: 'textarea' }
],
dictionaryRules: {}
}
},
methods: {
// 按钮事件
btnClick(pType, scope) {
console.log(pType, scope)
switch (pType) {
case 'edit':
this.handleClose(scope)
break
case 'delete':
this.deleteEvent(scope.id)
break
case 'list':
console.log('list')
break
}
},
// 确定
handleConfirm() {
console.log(this.$refs.dictionaryForm)
this.$refs.dictionaryForm.$children[0].validate((valid) => {
if (valid) {
this.handleClose()
} else {
console.log('error')
}
})
},
// 取消
handleClose(row) {
console.log(row)
if (!this.dictionaryVisible && this.$refs.dictionaryForm) {
this.$refs.dictionaryForm.$children[0].resetFields()
}
this.dictionaryVisible = !this.dictionaryVisible
},
// 删除触发事件
deleteEvent(id) {
const that = this
const tipData = {
that: that,
tipText: '是否删除当前记录',
tipTitle: '提示',
type: 'error',
callBack: () => {
this.$message({
type: 'success',
message: '删除成功!'
})
}
}
this.$Common.confirmDialog(tipData)
}
}
}
</script>
\ No newline at end of file \ No newline at end of file
<template> <template>
<div> <div class="system-container">
<search-form <div class="user-container">
class="searchTop border-shadow" <search-form
:formModel="searchForm" class="searchTop border-shadow"
:formList="dictionaryFormList" :formModel="searchForm"
> :formList="dictionaryFormList"
<slot name="form-slot"> >
<el-button <slot name="form-slot">
type="primary" <el-button
:size="btn_size" type="primary"
icon="el-icon-search" :size="btn_size"
:id="tableParams.btnId" icon="el-icon-search"
>搜索</el-button> :id="tableParams.btnId"
>搜索</el-button>
<el-button
type="primary"
:size="btn_size"
icon="el-icon-refresh"
>重置</el-button>
</slot>
</search-form>
<div class="table-btn">
<el-button <el-button
type="primary" type="primary"
:size="btn_size" :size="btn_size"
icon="el-icon-refresh" icon="el-icon-plus"
>重置</el-button> @click="handleClose"
</slot> >新增</el-button>
</search-form> </div>
<div class="table-btn"> <basic-table
<el-button :tableParams="tableParams"
type="primary" :getListApi="getListApi"
:size="btn_size" :searchForm="searchForm"
icon="el-icon-plus" :hasNum="false"
@click="handleClose"
>新增</el-button>
</div>
<basic-table
:tableParams="tableParams"
:getListApi="getListApi"
:searchForm="searchForm"
:hasNum="false"
>
<span
slot="status"
slot-scope="scope"
> >
<span class="dot green"></span><span class="statusText">正常</span> <span
</span> slot="status"
<span slot-scope="scope"
slot="table-button" >
slot-scope="scope" <span class="dot green"></span><span class="statusText">正常</span>
</span>
<span
slot="table-button"
slot-scope="scope"
>
<el-button
v-for="(j, idx) in tableParams.tableOption.btnList"
:key="idx"
:type="j.type"
size="mini"
plain
@click="btnClick(j.pType, scope.scope)"
>{{j.name}}</el-button>
</span>
</basic-table>
<basic-dialog
:title="dictionaryDialogTitle"
:isVisible="dictionaryVisible"
@confirmDialog="handleConfirm"
@closeDialog="handleClose"
> >
<el-button <slot>
v-for="(j, idx) in tableParams.tableOption.btnList" <rule-form
:key="idx" :ruleForm="dictionaryForm"
:type="j.type" :rules="dictionaryRules"
size="mini" :ruleData="dictionaryData"
plain ref='dictionaryForm'
@click="btnClick(j.pType, scope.scope)" ></rule-form>
>{{j.name}}</el-button> </slot>
</span> </basic-dialog>
</basic-table> </div>
<basic-dialog
:title="dictionaryDialogTitle"
:isVisible="dictionaryVisible"
@confirmDialog="handleConfirm"
@closeDialog="handleClose"
>
<slot>
<rule-form
:ruleForm="dictionaryForm"
:rules="dictionaryRules"
:ruleData="dictionaryData"
ref='dictionaryForm'
></rule-form>
</slot>
</basic-dialog>
</div> </div>
</template> </template>
......
...@@ -388,24 +388,4 @@ export default { ...@@ -388,24 +388,4 @@ export default {
} }
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
.system-container {
padding: 0 0 0 10px;
margin: 20px 24px;
background-color: #ffffff;
overflow: hidden;
.user-tree {
margin-top: 20px;
padding: 20px;
float: left;
width: 18%;
.user-tree-top {
height: 30px;
}
}
.user-container {
padding: 20px 10px 0px 20px;
float: left;
width: 82%;
}
}
</style> </style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<div> <div class="system-container">
<div> <div class="user-container">
<search-form <search-form
class="searchTop border-shadow" class="searchTop border-shadow"
:formModel="searchForm" :formModel="searchForm"
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
<el-tree <el-tree
:data="data" :data="data"
accordion accordion
:props="props"
node-key="id" node-key="id"
@node-click="handleNodeClick" @node-click="handleNodeClick"
:render-content="renderContent" :render-content="renderContent"
...@@ -94,14 +93,15 @@ ...@@ -94,14 +93,15 @@
<el-input <el-input
placeholder="输入关键字进行过滤" placeholder="输入关键字进行过滤"
v-model="filterText" v-model="filterText"
size="small"
> >
</el-input> </el-input>
<el-tree <el-tree
class="filter-tree" class="filter-tree"
:data="filterTextData" :data="filterTextData"
:props="defaultProps"
:filter-node-method="filterNode" :filter-node-method="filterNode"
highlight-current
ref="tree" ref="tree"
node-key="id" node-key="id"
check-on-click-node check-on-click-node
...@@ -115,7 +115,9 @@ ...@@ -115,7 +115,9 @@
<script> <script>
import UserService from 'services/user'; import UserService from 'services/user';
import OrginizaService from 'services/orginizaManage';
const userService = new UserService(); const userService = new UserService();
const orginizaService = new OrginizaService();
export default { export default {
data() { data() {
return { return {
...@@ -188,71 +190,22 @@ export default { ...@@ -188,71 +190,22 @@ export default {
] ]
} }
}, },
getListApi: userService.getUserList, getListApi: null,
// 折叠菜单数据 // 折叠菜单数据
props: { data: [],
label: 'departmentName',
children: 'list',
isLeaf: 'hasChildren'
},
data: [{
id: 1,
userNumber: 200,
departmentName: '一级 1',
hasChildren: true,
list: [{
id: 10,
userNumber: 200,
departmentName: '二级 1-1',
hasChildren: true,
list: [{
id: 100,
userNumber: 200,
departmentName: '三级 1-1-1'
}]
}]
}, {
userNumber: 10,
departmentName: '一级 2',
list: [{
departmentName: '二级 2-1',
list: [{
departmentName: '三级 2-1-1'
}]
}, {
departmentName: '二级 2-2',
list: [{
departmentName: '三级 2-2-1'
}]
}]
}, {
userNumber: 0,
departmentName: '一级 3',
list: [{
departmentName: '二级 3-1',
list: [{
departmentName: '三级 3-1-1'
}]
}, {
departmentName: '二级 3-2',
list: [{
departmentName: '三级 3-2-1'
}]
}]
}],
// 弹窗数据 // 弹窗数据
userDialogTitle: '新增用户', userDialogTitle: '新增用户',
userVisible: false, userVisible: false,
userForm: { userForm: {
account: '', account: '',
departmentId: '', departmentName: '',
superiorId: '', superiorName: '',
enableStatus: true enableStatus: true
}, },
userData: [ userData: [
{ label: '登录名称:', prop: 'account', type: 'input' }, { label: '登录名称:', prop: 'account', type: 'input' },
{ label: '部门名称:', prop: 'departmentId', type: 'input', readonly: true, clickFunc: this.selectDepart }, { label: '部门名称:', prop: 'departmentName', type: 'input', readonly: true, clickFunc: this.selectDepart },
{ label: '直接上级:', prop: 'superiorId', type: 'input', readonly: true, clickFunc: this.selectSuperior }, { label: '直接上级:', prop: 'superiorName', type: 'input', readonly: true, clickFunc: this.selectSuperior },
{ label: '用户名称:', prop: 'username', type: 'input' }, { label: '用户名称:', prop: 'username', type: 'input' },
{ label: '密码:', prop: 'password', type: 'input', inputText: 'password' }, { label: '密码:', prop: 'password', type: 'input', inputText: 'password' },
{ label: '角色:', prop: 'roleId', type: 'select', options: [] }, { label: '角色:', prop: 'roleId', type: 'select', options: [] },
...@@ -264,7 +217,7 @@ export default { ...@@ -264,7 +217,7 @@ export default {
], ],
userRules: { userRules: {
account: [{ required: true, message: '请输入登录名称', trigger: blur }], account: [{ required: true, message: '请输入登录名称', trigger: blur }],
departmentId: [{ required: true, message: '请选择部门名称', trigger: blur }], departmentName: [{ required: true, message: '请选择部门名称', trigger: blur }],
username: [{ required: true, message: '请输入用户名称', trigger: blur }], username: [{ required: true, message: '请输入用户名称', trigger: blur }],
password: [{ required: true, message: '请输入密码', trigger: blur }], password: [{ required: true, message: '请输入密码', trigger: blur }],
roleId: [{ required: true, message: '请选择角色', trigger: blur }], roleId: [{ required: true, message: '请选择角色', trigger: blur }],
...@@ -337,12 +290,7 @@ export default { ...@@ -337,12 +290,7 @@ export default {
} }
] ]
} }
], ]
defaultProps: {
children: 'children',
label: 'label'
}
} }
}, },
watch: { watch: {
...@@ -356,6 +304,7 @@ export default { ...@@ -356,6 +304,7 @@ export default {
// }, (err) => { // }, (err) => {
// }); // });
this.getTreeOrg()
}, },
methods: { methods: {
// 确定,新增用户、编辑用户 // 确定,新增用户、编辑用户
...@@ -370,7 +319,12 @@ export default { ...@@ -370,7 +319,12 @@ export default {
}) })
}, },
// 取消 // 取消
handleClose() { handleClose(row) {
if (row && row.id) {
this.userDialogTitle = '编辑用户'
} else {
this.userDialogTitle = '新增用户'
}
if (!this.userVisible && this.$refs.userForm) { if (!this.userVisible && this.$refs.userForm) {
this.$refs.userForm.$children[0].resetFields() this.$refs.userForm.$children[0].resetFields()
} }
...@@ -402,7 +356,10 @@ export default { ...@@ -402,7 +356,10 @@ export default {
}, },
// 编辑触发事件 // 编辑触发事件
editEvent(row) { editEvent(row) {
this.handleClose() console.log(row)
this.userDialogTitle = '编辑用户'
this.userForm = row
this.handleClose(row)
}, },
// 删除触发事件 // 删除触发事件
deleteEvent(id) { deleteEvent(id) {
...@@ -424,47 +381,59 @@ export default { ...@@ -424,47 +381,59 @@ export default {
// 部门弹窗 // 部门弹窗
selectDepart() { selectDepart() {
this.filterDialogTitle = '选择组织' this.filterDialogTitle = '选择组织'
this.getSimpleList()
this.closeFilter() this.closeFilter()
}, },
// 上级弹窗 // 上级弹窗
selectSuperior() { selectSuperior() {
this.filterDialogTitle = '选择直接上级' this.filterDialogTitle = '选择直接上级'
this.getSuperUser()
this.closeFilter() this.closeFilter()
}, },
closeFilter() { closeFilter() {
this.filterVisible = !this.filterVisible this.filterVisible = !this.filterVisible
}, },
filterConfirm() { filterConfirm() {
console.log(this.$refs.tree.getCheckedKeys(false, true)) console.log(this.$refs.tree.getCheckedKeys(false, true), this.$refs.tree.getCurrentNode())
// this.closeFilter() if (this.filterDialogTitle == '选择直接上级') {
this.userForm.superiorId = this.$refs.tree.getCurrentNode().id
this.userForm.superiorName = this.$refs.tree.getCurrentNode().label
} else {
this.userForm.departmentId = this.$refs.tree.getCurrentNode().id
this.userForm.departmentName = this.$refs.tree.getCurrentNode().label
}
this.closeFilter()
}, },
filterNode(value, data) { filterNode(value, data) {
console.log(value, data) console.log(value, data)
if (!value) return true if (!value) return true
return data.label.indexOf(value) !== -1 return data.label.indexOf(value) !== -1
},
// 获取上级树
getSuperUser(params) {
userService.getSuperUser(params).then(res => {
console.log(res)
this.filterTextData = res.data.list
})
},
// 获取组织树
getSimpleList() {
orginizaService.getSimpleList().then(res => {
console.log(res)
this.filterTextData = res.data.list
})
},
// 获取组织架构
getTreeOrg() {
orginizaService.getTreeOrg().then(res => {
console.log(res)
this.data = res.data.list
})
} }
} }
} }
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
.system-container {
padding: 0 0 0 10px;
margin: 20px 24px;
background-color: #ffffff;
overflow: hidden;
.user-tree {
margin-top: 20px;
padding: 20px;
float: left;
width: 18%;
.user-tree-top {
height: 30px;
}
}
.user-container {
padding: 20px 10px 0px 20px;
float: left;
width: 82%;
}
}
</style> </style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="system-container">
<div class="user-container">
<search-form
class="searchTop border-shadow"
:formModel="searchForm"
:formList="dictionaryFormList"
>
<slot name="form-slot">
<el-button
type="primary"
:size="btn_size"
icon="el-icon-search"
:id="tableParams.btnId"
>搜索</el-button>
<el-button
type="primary"
:size="btn_size"
icon="el-icon-refresh"
>重置</el-button>
</slot>
</search-form>
<div class="table-btn">
<el-button
type="primary"
:size="btn_size"
icon="el-icon-plus"
@click="handleClose"
>新增</el-button>
</div>
<basic-table
:tableParams="tableParams"
:getListApi="getListApi"
:searchForm="searchForm"
:hasNum="false"
>
<span
slot="status"
slot-scope="scope"
>
<span class="dot green"></span><span class="statusText">正常</span>
</span>
</basic-table>
<basic-dialog
:title="dictionaryDialogTitle"
:isVisible="dictionaryVisible"
@confirmDialog="handleConfirm"
@closeDialog="handleClose"
>
<slot>
<rule-form
:ruleForm="dictionaryForm"
:rules="dictionaryRules"
:ruleData="dictionaryData"
ref='dictionaryForm'
></rule-form>
</slot>
</basic-dialog>
</div>
</div>
</template>
<script>
export default {
data() {
return {
searchForm: {},
dictionaryFormList: [
{
type: 'input',
inputType: 'text',
prop: 'name',
placeholder: '请输入字典名称'
}
],
tableParams: {
mutiSelectName: 'worklog',
mutiSelectUniqueKey: 'id',
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableColumns: [
{
label: '日志编号',
prop: 'id'
}, {
label: '系统菜单',
prop: 'dictName'
}, {
label: '操作类型',
prop: 'dictType'
}, {
label: '操作账号',
prop: 'remark'
}, {
label: '所属组织',
prop: 'enableStatus',
addHtml: 'status'
}, {
label: '主机IP',
prop: 'enableStatus',
addHtml: 'status'
}, {
label: '操作状态',
prop: 'enableStatus',
addHtml: 'status'
}, {
label: '创建时间',
prop: 'createdDate'
}
]
},
getListApi: null,
// 弹窗
dictionaryDialogTitle: '新增字典',
dictionaryVisible: false,
dictionaryForm: {},
dictionaryData: [
{ label: '字典名称:', prop: 'dictName', type: 'input' },
{ label: '字典类型', prop: 'dictType', type: 'input' },
{ label: '状态', prop: 'enableStatus', type: 'switch' },
{ label: '备注', prop: 'remark', type: 'input', inputText: 'textarea' }
],
dictionaryRules: {}
}
},
methods: {
// 按钮事件
btnClick(pType, scope) {
console.log(pType, scope)
switch (pType) {
case 'edit':
this.handleClose(scope)
break
case 'delete':
this.deleteEvent(scope.id)
break
case 'list':
console.log('list')
break
}
},
// 确定
handleConfirm() {
console.log(this.$refs.dictionaryForm)
this.$refs.dictionaryForm.$children[0].validate((valid) => {
if (valid) {
this.handleClose()
} else {
console.log('error')
}
})
},
// 取消
handleClose(row) {
console.log(row)
if (!this.dictionaryVisible && this.$refs.dictionaryForm) {
this.$refs.dictionaryForm.$children[0].resetFields()
}
this.dictionaryVisible = !this.dictionaryVisible
},
// 删除触发事件
deleteEvent(id) {
const that = this
const tipData = {
that: that,
tipText: '是否删除当前记录',
tipTitle: '提示',
type: 'error',
callBack: () => {
this.$message({
type: 'success',
message: '删除成功!'
})
}
}
this.$Common.confirmDialog(tipData)
}
}
}
</script>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!