Commit 56b98c01 by 胡悦

字典管理相关接口完成、操作日志导出

1 parent e4d24655
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
<el-table-column <el-table-column
v-if="hasNum" v-if="hasNum"
align="center" align="center"
width="60px" width="70px"
label="序号" :label="tableParams.numName || '序号'"
type='index' type='index'
:index="index=>index+(page.pageNumber - 1) * page.pageSize + 1" :index="index=>index+(page.pageNumber - 1) * page.pageSize + 1"
></el-table-column> ></el-table-column>
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
v-model="formModel[item.prop]" v-model="formModel[item.prop]"
:type="item.inputType || 'text'" :type="item.inputType || 'text'"
:placeholder="item.placeholder || '请输入'" :placeholder="item.placeholder || '请输入'"
:readonly="item.readonly || false"
></el-input> ></el-input>
</template> </template>
<template v-else-if="item.type === 'select'"> <template v-else-if="item.type === 'select'">
...@@ -40,7 +41,7 @@ ...@@ -40,7 +41,7 @@
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
value-format="yyyy-MM-dd hh:mm:ss" value-format="yyyy-MM-dd"
> >
</el-date-picker> </el-date-picker>
</template> </template>
......
import axios from 'axios'
export const Common = { export const Common = {
// 提示框 // 提示框
confirmDialog: (tipData) => { confirmDialog: (tipData) => {
...@@ -11,5 +12,43 @@ export const Common = { ...@@ -11,5 +12,43 @@ export const Common = {
}).catch(() => { }).catch(() => {
tipData.errorCallBack ? tipData.errorCallBack() : '' tipData.errorCallBack ? tipData.errorCallBack() : ''
}) })
},
/**
* 导出excel
* */
exportExcel: function (options) {
if (!options) {
return false
}
console.log(options.data)
axios({
method: options.method || 'POST',
url: options.url,
params: options.data,
responseType: 'blob',
headers: {
Authorization: localStorage.getItem('token') || ''
}
}).then(response => {
if (!response) {
return
}
let url = window.URL.createObjectURL(new Blob([response.data], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
}))
let link = document.createElement('a')
link.style.display = 'none'
link.href = url
link.setAttribute('download', options.fileName || 'excel.xlsx')
document.body.appendChild(link)
link.click()
if (options.success) {
(options.success)()
}
}).catch((error) => {
if (options.errorFunc) {
(options.errorFunc)(error)
}
})
} }
} }
...@@ -32,8 +32,9 @@ ...@@ -32,8 +32,9 @@
<basic-table <basic-table
:tableParams="tableParams" :tableParams="tableParams"
:getListApi="getListApi" :getListApi="getListApi"
:beforeSearchFn="beforeSearchFn"
:searchForm="searchForm" :searchForm="searchForm"
:hasNum="false" :hasNum="true"
ref="dictDataTable" ref="dictDataTable"
> >
<span <span
...@@ -85,18 +86,21 @@ export default { ...@@ -85,18 +86,21 @@ export default {
data() { data() {
return { return {
DICTSTATUS: this.$Constants.DICT_STATUS, DICTSTATUS: this.$Constants.DICT_STATUS,
searchForm: {}, searchForm: {
name: ''
},
dictDataFormList: [ dictDataFormList: [
{ {
type: 'input', type: 'input',
inputType: 'text', inputType: 'text',
prop: 'name', prop: 'name',
readonly: true,
placeholder: '请输入字典名称' placeholder: '请输入字典名称'
}, },
{ {
type: 'input', type: 'input',
inputType: 'text', inputType: 'text',
prop: 'type', prop: 'tag',
placeholder: '请输入字典标签' placeholder: '请输入字典标签'
}, },
{ {
...@@ -115,23 +119,24 @@ export default { ...@@ -115,23 +119,24 @@ export default {
} }
], ],
tableParams: { tableParams: {
numName: '字典编码',
mutiSelectName: 'dictDataData', mutiSelectName: 'dictDataData',
mutiSelectUniqueKey: 'id', mutiSelectUniqueKey: 'id',
btnId: new Date().getTime() + parseInt(Math.random() * 1000), btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list', listName: 'list',
tableColumns: [ tableColumns: [
{ {
label: '字典编码', // label: '字典编码',
prop: 'id' // prop: 'id'
}, { // }, {
label: '字典标签', label: '字典标签',
prop: 'dictLabel' prop: 'dictLabel'
}, { }, {
label: '字典键值', label: '字典键值',
prop: 'dictType' prop: 'dictValue'
}, { }, {
label: '字典排序', label: '字典排序',
prop: 'remark' prop: 'dictSort'
}, { }, {
label: '备注', label: '备注',
prop: 'remark' prop: 'remark'
...@@ -145,7 +150,7 @@ export default { ...@@ -145,7 +150,7 @@ export default {
} }
], ],
tableOption: { tableOption: {
width: 300, width: 200,
btnList: [ btnList: [
{ {
type: 'primary', type: 'primary',
...@@ -168,28 +173,42 @@ export default { ...@@ -168,28 +173,42 @@ export default {
enableStatus: true enableStatus: true
}, },
dictDataData: [ dictDataData: [
{ label: '字典类型:', prop: 'dictType', type: 'input' }, { label: '字典类型:', prop: 'dictType', type: 'input', readonly: true },
{ label: '字典标签:', prop: 'dictLabel', type: 'input' }, { label: '字典标签:', prop: 'dictLabel', type: 'input' },
{ label: '字典编码:', prop: 'dictSort', type: 'input' }, // { label: '字典编码:', prop: 'id', type: 'input', readonly: true },
{ label: '字典键值:', prop: 'dictValue', type: 'input' }, { label: '字典键值:', prop: 'dictValue', type: 'input' },
{ label: '字典顺序:', prop: 'dictSort', type: 'input' }, { label: '字典顺序:', prop: 'dictSort', type: 'input' },
{ label: '状态', prop: 'enableStatus', type: 'switch' }, { label: '状态', prop: 'enableStatus', type: 'switch' },
{ label: '备注', prop: 'remark', type: 'input', inputText: 'textarea' } { label: '备注', prop: 'remark', type: 'input', inputText: 'textarea' }
], ],
dictDataRules: { dictDataRules: {
dictType: [{ required: true, message: '请输入字典类型', trigger: blur }], dictType: [{ required: true }],
dictLabel: [{ required: true, message: '请输入字典标签', trigger: blur }], dictLabel: [{ required: true, message: '请输入字典标签', trigger: 'blur' }],
dictSort: [{ required: true, message: '请输入字典编码', trigger: blur }], // id: [{ required: true }],
dictValue: [{ required: true, message: '请输入字典键值', trigger: blur }], dictValue: [{ required: true, message: '请输入字典键值', trigger: 'blur' }],
dictSort: [{ required: true, message: '请输入字典顺序', trigger: blur }], dictSort: [{ required: true, message: '请输入字典顺序', trigger: 'blur' }],
enableStatus: [{ required: true }] enableStatus: [{ required: true }]
} }
} }
}, },
mounted() {
console.log(this.$route.params)
this.searchForm.name = this.$route.params.row.dictName
this.dictDataForm.dictType = this.$route.params.row.dictType
},
methods: { methods: {
// 重置搜索条件 // 重置搜索条件
refresh() { refresh() {
this.searchForm = {} this.searchForm = {
name: this.$route.params.row.dictName
}
},
beforeSearchFn() {
return new Promise((resolve, reject) => {
this.searchForm.type = this.$route.params.row.dictType
console.log(this.searchForm)
resolve()
})
}, },
// 确定 // 确定
handleConfirm() { handleConfirm() {
...@@ -199,11 +218,21 @@ export default { ...@@ -199,11 +218,21 @@ export default {
params.enableStatus = this.dictDataForm.enableStatus ? 1 : 2 params.enableStatus = this.dictDataForm.enableStatus ? 1 : 2
console.log(params) console.log(params)
let api = addDictData let api = addDictData
if (params.id) api = editDictData if (params.id) {
api = editDictData
}
api(params).then(res => { api(params).then(res => {
console.log(res) console.log(res)
this.handleClose() if (res.code = 200) {
this.$refs.dictDataTable.refreshTable() this.$message({
type: 'success',
message: '操作成功!'
})
this.handleClose()
this.$refs.dictDataTable.refreshTable()
} else {
this.$message(res.message)
}
}) })
} else { } else {
console.log('error') console.log('error')
...@@ -223,6 +252,7 @@ export default { ...@@ -223,6 +252,7 @@ export default {
switch (pType) { switch (pType) {
case 'create': case 'create':
this.handleClose() this.handleClose()
break
case 'edit': case 'edit':
this.editEvent(scope) this.editEvent(scope)
break break
...@@ -237,8 +267,11 @@ export default { ...@@ -237,8 +267,11 @@ export default {
// 编辑触发事件 // 编辑触发事件
editEvent(row) { editEvent(row) {
console.log(row, '------------')
this.dictDataForm = JSON.parse(JSON.stringify(row)) this.dictDataForm = JSON.parse(JSON.stringify(row))
this.dictDataForm.enableStatus = row.enableStatus == 1 ? true : false this.dictDataForm.enableStatus = row.enableStatus == 1 ? true : false
delete this.dictDataForm.createdDate
delete this.dictDataForm.isDefault
this.handleClose() this.handleClose()
}, },
// 删除触发事件 // 删除触发事件
...@@ -251,14 +284,19 @@ export default { ...@@ -251,14 +284,19 @@ export default {
type: 'error', type: 'error',
callBack: () => { callBack: () => {
const params = { const params = {
id: id dataId: id
} }
deleteDictData(params).then(res => { deleteDictData(params).then(res => {
this.$message({ if (res.code == 200) {
type: 'success', this.$message({
message: '删除成功!' type: 'success',
}) message: '删除成功!'
this.$refs.dictDataTable.refreshTable() })
this.$refs.dictDataTable.refreshTable()
} else {
this.$message(res.message)
}
}) })
} }
} }
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
>新增</el-button> >新增</el-button>
</div> </div>
<basic-table <basic-table
ref="dictManage"
:tableParams="tableParams" :tableParams="tableParams"
:getListApi="getListApi" :getListApi="getListApi"
:searchForm="searchForm" :searchForm="searchForm"
...@@ -103,18 +104,18 @@ export default { ...@@ -103,18 +104,18 @@ export default {
placeholder: '请选择字典状态', placeholder: '请选择字典状态',
options: [ options: [
{ {
label: '正常', label: '启用',
value: 1 value: 1
}, { }, {
label: '停用', label: '禁用',
value: 2 value: 2
} }
] ]
} }
], ],
tableParams: { tableParams: {
mutiSelectName: 'dictionary', // mutiSelectName: 'dictionary',
mutiSelectUniqueKey: 'id', // mutiSelectUniqueKey: 'id',
btnId: new Date().getTime() + parseInt(Math.random() * 1000), btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list', listName: 'list',
tableColumns: [ tableColumns: [
...@@ -140,7 +141,7 @@ export default { ...@@ -140,7 +141,7 @@ export default {
} }
], ],
tableOption: { tableOption: {
width: 300, width: 250,
btnList: [ btnList: [
{ {
type: 'primary', type: 'primary',
...@@ -196,8 +197,16 @@ export default { ...@@ -196,8 +197,16 @@ export default {
let api = addDict let api = addDict
if (params.id) api = editDict if (params.id) api = editDict
api(params).then(res => { api(params).then(res => {
console.log(res) if (res.code == 200) {
this.handleClose() this.$message({
type: 'success',
message: '操作成功!'
})
this.$refs.dictManage.refreshTable()
this.handleClose()
} else {
this.$message(res.message)
}
}) })
} else { } else {
console.log('error') console.log('error')
...@@ -216,16 +225,19 @@ export default { ...@@ -216,16 +225,19 @@ export default {
console.log(pType, scope) console.log(pType, scope)
switch (pType) { switch (pType) {
case 'create': case 'create':
this.dictionaryDialogTitle = '新增字典'
this.handleClose() this.handleClose()
break break
case 'edit': case 'edit':
this.dictionaryDialogTitle = '编辑字典'
this.editEvent(scope) this.editEvent(scope)
break break
case 'delete': case 'delete':
this.deleteEvent(scope.id) this.deleteEvent(scope.id)
break break
case 'list': case 'list':
console.log('list') console.log('list', scope)
this.$router.push({ name: 'dictionaryData', params: { row: scope } })
break break
} }
}, },
...@@ -234,6 +246,7 @@ export default { ...@@ -234,6 +246,7 @@ export default {
editEvent(row) { editEvent(row) {
this.dictionaryForm = JSON.parse(JSON.stringify(row)) this.dictionaryForm = JSON.parse(JSON.stringify(row))
this.dictionaryForm.enableStatus = row.enableStatus == 1 ? true : false this.dictionaryForm.enableStatus = row.enableStatus == 1 ? true : false
delete this.dictionaryForm.createdDate
this.handleClose() this.handleClose()
}, },
// 删除触发事件 // 删除触发事件
...@@ -246,13 +259,18 @@ export default { ...@@ -246,13 +259,18 @@ export default {
type: 'error', type: 'error',
callBack: () => { callBack: () => {
const params = { const params = {
id: id typeId: id
} }
deleteDict(params).then(res => { deleteDict(params).then(res => {
this.$message({ if (res.code == 200) {
type: 'success', this.$message({
message: '删除成功!' type: 'success',
}) message: '删除成功!'
})
this.$refs.dictManage.refreshTable()
} else {
this.$message(res.message)
}
}) })
} }
......
...@@ -66,8 +66,8 @@ ...@@ -66,8 +66,8 @@
> >
<div slot="visible-type"> <div slot="visible-type">
<el-radio-group <el-radio-group
@change="radioChange(roleForm.visibleType)" @change="radioChange(roleForm.roleVisibility)"
v-model="roleForm.visibleType" v-model="roleForm.roleVisibility"
> >
<el-radio <el-radio
v-for="(child,childIndex) in $Constants.ROLE_VISIBLE" v-for="(child,childIndex) in $Constants.ROLE_VISIBLE"
...@@ -76,9 +76,11 @@ ...@@ -76,9 +76,11 @@
>{{child}}{{childIndex}}</el-radio> >{{child}}{{childIndex}}</el-radio>
</el-radio-group> </el-radio-group>
<el-select <el-select
v-if="roleForm.visibleType == '2'" v-if="roleForm.roleVisibility == 2"
v-model="roleForm.visibleTenant" v-model="roleForm.roleTenants"
placeholder="请选择" placeholder="请选择"
multiple
filterable
> >
<el-option <el-option
v-for="i in tenantList" v-for="i in tenantList"
...@@ -175,17 +177,15 @@ export default { ...@@ -175,17 +177,15 @@ export default {
{ label: '角色名称:', prop: 'roleName', type: 'input' }, { label: '角色名称:', prop: 'roleName', type: 'input' },
{ label: '备注:', prop: 'remark', type: 'input' }, { label: '备注:', prop: 'remark', type: 'input' },
{ label: '状态:', prop: 'enableStatus', type: 'switch' }, { label: '状态:', prop: 'enableStatus', type: 'switch' },
{ label: '租户可见度:', prop: 'visibleType', type: 'customize', slotName: 'visible-type' }, { label: '租户可见度:', prop: 'roleVisibility', type: 'customize', slotName: 'visible-type' },
// { label: '租户可见度:', prop: 'visibleType', type: 'radio', hasSelect: true, children: this.$Constants.ROLE_VISIBLE }, { label: '数据权限:', prop: 'rolePermissionType', type: 'radio', children: this.$Constants.ROLE_AUTH },
{ label: '数据权限:', prop: 'permissionType', type: 'radio', children: this.$Constants.ROLE_AUTH },
// [{ id: 1, label: '本人' }, { id: 2, label: '本人及下属' }, { id: 3, label: '本部门' }, { id: 4, label: '本部门&下属' }, { id: 5, label: '全部' }]
{ label: '菜单权限:', prop: 'menuIdList', type: 'customize', slotName: 'menu-list' } { label: '菜单权限:', prop: 'menuIdList', type: 'customize', slotName: 'menu-list' }
], ],
roleRules: { roleRules: {
roleName: [{ required: true, message: '请输入角色名称', trigger: 'blur' }], roleName: [{ required: true, message: '请输入角色名称', trigger: 'blur' }],
enableStatus: [{ required: true }], enableStatus: [{ required: true }],
visibleType: [{ required: true, message: '请选择租户可见度' }], roleVisibility: [{ required: true, message: '请选择租户可见度' }],
permissionType: [{ required: true, message: '请选择数据权限' }], rolePermissionType: [{ required: true, message: '请选择数据权限' }],
menuIdList: [{ required: true, validator: checkMenu, trigger: 'blur' }] menuIdList: [{ required: true, validator: checkMenu, trigger: 'blur' }]
}, },
treedata: [], treedata: [],
...@@ -193,6 +193,7 @@ export default { ...@@ -193,6 +193,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.getTenantList()
}, },
methods: { methods: {
// 重置搜索条件 // 重置搜索条件
...@@ -205,13 +206,22 @@ export default { ...@@ -205,13 +206,22 @@ export default {
console.log(this.roleForm) console.log(this.roleForm)
this.$refs.roleForm.$children[0].validate((valid) => { this.$refs.roleForm.$children[0].validate((valid) => {
if (valid) { if (valid) {
let params = JSON.parse(JSON.stringify(this.roleForm)) // let params = JSON.parse(JSON.stringify(this.roleForm))
params.enableStatus = this.roleForm.enableStatus ? 1 : 2
let api = addRole let api = addRole
if (params.id) { let params = {
remark: this.roleForm.remark,
roleName: this.roleForm.roleName,
menuIdList: this.roleForm.menuIdList
}
params.enableStatus = this.roleForm.enableStatus ? 1 : 2
if (this.roleForm.id) {
api = editRole api = editRole
delete params.maxUser params.roleId = this.roleForm.id
if (params.roleVisibility != 2) delete params.roleTenants params.roleVisibility = Number(this.roleForm.roleVisibility)
params.rolePermissionType = Number(this.roleForm.rolePermissionType)
if (params.roleVisibility == 2) {
params.roleTenants = this.roleForm.roleTenants.toString()
}
} }
console.log(params) console.log(params)
api(params).then(res => { api(params).then(res => {
...@@ -248,7 +258,6 @@ export default { ...@@ -248,7 +258,6 @@ export default {
menuIdList: [] menuIdList: []
} }
this.getMenuTree() this.getMenuTree()
this.getTenantList()
this.handleClose() this.handleClose()
break break
case 'edit': case 'edit':
...@@ -266,6 +275,9 @@ export default { ...@@ -266,6 +275,9 @@ export default {
roleInfo({ id: row.id }).then(res => { roleInfo({ id: row.id }).then(res => {
this.roleForm = JSON.parse(JSON.stringify(res.data)) this.roleForm = JSON.parse(JSON.stringify(res.data))
this.roleForm.enableStatus = res.data.enableStatus == 1 ? true : false this.roleForm.enableStatus = res.data.enableStatus == 1 ? true : false
this.roleForm.roleVisibility = res.data.roleVisibility + ''
this.roleForm.rolePermissionType = res.data.rolePermissionType + ''
this.roleForm.roleTenants = res.data.roleTenants.split(',').map(Number)
this.getMenuTree({ roleId: 1 }) this.getMenuTree({ roleId: 1 })
this.handleClose(res.data) this.handleClose(res.data)
}) })
...@@ -318,7 +330,7 @@ export default { ...@@ -318,7 +330,7 @@ export default {
}, },
radioChange(e) { radioChange(e) {
console.log(e, this.roleForm) console.log(e, this.roleForm)
this.$set(this.roleForm, 'visibleType', e) this.$set(this.roleForm, 'roleVisibility', e)
} }
} }
} }
......
...@@ -232,14 +232,14 @@ export default { ...@@ -232,14 +232,14 @@ export default {
{ label: '岗位:', prop: 'position', type: 'select', options: [{ label: '12121', value: 0 }, { label: 'fasdfas', value: 1 }] } { label: '岗位:', prop: 'position', type: 'select', options: [{ label: '12121', value: 0 }, { label: 'fasdfas', value: 1 }] }
], ],
userRules: { userRules: {
account: [{ required: true, message: '请输入登录名称', trigger: blur }], account: [{ required: true, message: '请输入登录名称', trigger: 'blur' }],
departmentName: [{ 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 }], roleId: [{ required: true, message: '请选择角色', trigger: 'change' }],
roleId: [{ required: true, message: '请选择角色', trigger: blur }], phoneNumber: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
phoneNumber: [{ required: true, message: '请输入手机号', trigger: blur }],
enableStatus: [{ required: true }], enableStatus: [{ required: true }],
}, },
addRule: [{ required: true, message: '请输入密码', trigger: 'blur' }],
// 部门弹窗 // 部门弹窗
filterDialogTitle: '选择组织', filterDialogTitle: '选择组织',
filterVisible: false, filterVisible: false,
...@@ -319,6 +319,15 @@ export default { ...@@ -319,6 +319,15 @@ export default {
this.getRoleList() this.getRoleList()
}, },
methods: { methods: {
emptyData(params) {
let arr = params
for (let key in arr) {
if (params[key] == null || params[key] == '' || params[key] == []) {
delete params[key]
}
}
return arr
},
// 重置搜索条件 // 重置搜索条件
refresh() { refresh() {
this.searchForm = {} this.searchForm = {}
...@@ -332,10 +341,12 @@ export default { ...@@ -332,10 +341,12 @@ export default {
params.enableStatus = this.userForm.enableStatus ? 1 : 2 params.enableStatus = this.userForm.enableStatus ? 1 : 2
delete params.departmentName delete params.departmentName
delete params.superiorName delete params.superiorName
delete params.createdDate
this.emptyData(params)
let api = addUser let api = addUser
if (params.id) api = editUser if (params.id) api = editUser
api(params).then(res => { api(params).then(res => {
if (res.code = '200') { if (res.code == '200') {
this.$refs.userTable.refreshTable() this.$refs.userTable.refreshTable()
this.handleClose() this.handleClose()
this.$message({ this.$message({
...@@ -343,7 +354,6 @@ export default { ...@@ -343,7 +354,6 @@ export default {
message: '操作成功!' message: '操作成功!'
}) })
} }
}) })
} else { } else {
console.log('error') console.log('error')
...@@ -377,15 +387,18 @@ export default { ...@@ -377,15 +387,18 @@ export default {
switch (pType) { switch (pType) {
case 'create': case 'create':
this.userDialogTitle = '新增用户' this.userDialogTitle = '新增用户'
this.userRules.password = this.addRule
this.userForm = { this.userForm = {
departmentName: '', departmentName: '',
superiorName: '', superiorName: '',
enableStatus: true enableStatus: true
} }
this.handleClose() this.handleClose()
break break
case 'edit': case 'edit':
this.userDialogTitle = '编辑用户' this.userDialogTitle = '编辑用户'
if (this.userRules.password) delete this.userRules.password
this.editEvent(scope) this.editEvent(scope)
break break
case 'delete': case 'delete':
...@@ -400,6 +413,7 @@ export default { ...@@ -400,6 +413,7 @@ export default {
this.userDialogTitle = '编辑用户' this.userDialogTitle = '编辑用户'
this.userForm = JSON.parse(JSON.stringify(res.data)) this.userForm = JSON.parse(JSON.stringify(res.data))
this.userForm.enableStatus = res.data.enableStatus == 1 ? true : false this.userForm.enableStatus = res.data.enableStatus == 1 ? true : false
console.log(this.userForm)
this.handleClose(res.data) this.handleClose(res.data)
}) })
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
:searchForm="searchDataForm" :searchForm="searchDataForm"
:hasNum="false" :hasNum="false"
> >
<span <!-- <span
slot="status" slot="status"
slot-scope="scope" slot-scope="scope"
> >
...@@ -46,28 +46,14 @@ ...@@ -46,28 +46,14 @@
> >
{{scope.scope.operStatus ? WORKLOGSTATUS[scope.scope.operStatus].split(',')[0] : '--'}} {{scope.scope.operStatus ? WORKLOGSTATUS[scope.scope.operStatus].split(',')[0] : '--'}}
</span> </span>
</span> </span> -->
</basic-table> </basic-table>
<basic-dialog
:title="worklogDialogTitle"
:isVisible="worklogVisible"
@confirmDialog="handleConfirm"
@closeDialog="handleClose"
>
<slot>
<rule-form
:ruleForm="worklogForm"
:rules="worklogRules"
:ruleData="worklogData"
ref='worklogForm'
></rule-form>
</slot>
</basic-dialog>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { WORKLOG_API } from '@/config/config'
import { getWorkLogList, exportWorkLog } from 'services/worklog'; import { getWorkLogList, exportWorkLog } from 'services/worklog';
export default { export default {
data() { data() {
...@@ -83,8 +69,8 @@ export default { ...@@ -83,8 +69,8 @@ export default {
} }
], ],
tableParams: { tableParams: {
mutiSelectName: 'worklog', // mutiSelectName: 'worklog',
mutiSelectUniqueKey: 'id', // mutiSelectUniqueKey: 'id',
btnId: new Date().getTime() + parseInt(Math.random() * 1000), btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list', listName: 'list',
tableColumns: [ tableColumns: [
...@@ -108,26 +94,15 @@ export default { ...@@ -108,26 +94,15 @@ export default {
prop: 'ip', prop: 'ip',
}, { }, {
label: '操作状态', label: '操作状态',
prop: 'operStatus', prop: 'result',
addHtml: 'status' // addHtml: 'status'
}, { }, {
label: '创建时间', label: '创建时间',
prop: 'createdDate' prop: 'createdDate'
} }
] ]
}, },
getListApi: getWorkLogList, getListApi: getWorkLogList
// 弹窗
worklogDialogTitle: '新增字典',
worklogVisible: false,
worklogForm: {},
worklogData: [
{ label: '字典名称:', prop: 'dictName', type: 'input' },
{ label: '字典类型', prop: 'dictType', type: 'input' },
{ label: '状态', prop: 'enableStatus', type: 'switch' },
{ label: '备注', prop: 'remark', type: 'input', inputText: 'textarea' }
],
worklogRules: {}
} }
}, },
methods: { methods: {
...@@ -135,72 +110,27 @@ export default { ...@@ -135,72 +110,27 @@ export default {
this.searchForm = {} this.searchForm = {}
this.searchDataForm = {} this.searchDataForm = {}
}, },
// 按钮事件
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
}
},
beforeSearchFn() { beforeSearchFn() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
console.log(this.searchForm) console.log(this.searchForm)
if (this.searchForm.daterange) this.searchDataForm.sDate = this.searchForm.daterange[0] if (this.searchForm.daterange) {
if (this.searchForm.daterange) this.searchDataForm.eDate = this.searchForm.daterange[1] this.searchDataForm.sDate = this.searchForm.daterange[0]
this.searchDataForm.eDate = this.searchForm.daterange[1]
resolve()
})
},
// 确定
handleConfirm() {
console.log(this.$refs.worklogForm)
this.$refs.worklogForm.$children[0].validate((valid) => {
if (valid) {
this.handleClose()
} else { } else {
console.log('error') if (this.searchDataForm.sDate) delete this.searchDataForm.sDate && delete this.searchDataForm.eDate
} }
resolve()
}) })
}, },
// 取消
handleClose(row) {
console.log(row)
if (!this.worklogVisible && this.$refs.worklogForm) {
this.$refs.worklogForm.$children[0].resetFields()
}
this.worklogVisible = !this.worklogVisible
},
// 删除触发事件
deleteEvent(id) {
const that = this
const tipData = {
that: that,
tipText: '是否删除当前记录',
tipTitle: '提示',
type: 'error',
callBack: () => {
this.$message({
type: 'success',
message: '删除成功!'
})
}
}
this.$Common.confirmDialog(tipData)
},
// 导出列表 // 导出列表
exportTable() { exportTable() {
console.log(this.$refs.worklogTable)
const params = this.$refs.worklogTable.page const params = this.$refs.worklogTable.page
exportWorkLog(params).then(res => { this.$Common.exportExcel({
url: WORKLOG_API.WORKLOG_EXPORT,
data: params,
method: 'GET',
fileName: '操作日志.xlsx'
}) })
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!