【modify】使用ESLint格式化代码

This commit is contained in:
zer0Black
2023-03-01 09:33:58 +08:00
parent 694855ae8b
commit 63369b8b87
400 changed files with 42942 additions and 43132 deletions
+67 -67
View File
@@ -60,79 +60,79 @@
</template>
<script>
import DataLogModal from './modules/DataLogModal'
import {JeroListMixin} from '@/mixins/JeroListMixin'
import JEllipsis from "@/components/jero/JEllipsis";
import DataLogModal from './modules/DataLogModal'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import JEllipsis from '@/components/jero/JEllipsis'
export default {
name: 'DataLogList',
mixins: [JeroListMixin],
components: {
JEllipsis,
DataLogModal
},
data() {
return {
description: '数据日志管理页面',
//表头
columns: [
{
title: '表名',
align: 'center',
dataIndex: 'dataTable',
width: "120"
}, {
title: '数据ID',
align: 'center',
dataIndex: 'dataId',
width: "120"
}, {
title: '版本号',
align: 'center',
dataIndex: 'dataVersion',
width: "50"
}, {
title: '数据内容',
align: 'center',
dataIndex: 'dataContent',
width: "150",
scopedSlots: {customRender: 'dataContent'},
}, {
title: '创建人',
align: 'center',
dataIndex: 'createBy',
width: "100"
},
],
url: {
list: "/sys/dataLog/page",
},
export default {
name: 'DataLogList',
mixins: [JeroListMixin],
components: {
JEllipsis,
DataLogModal
},
data () {
return {
description: '数据日志管理页面',
// 表头
columns: [
{
title: '表名',
align: 'center',
dataIndex: 'dataTable',
width: '120'
}, {
title: '数据ID',
align: 'center',
dataIndex: 'dataId',
width: '120'
}, {
title: '版本号',
align: 'center',
dataIndex: 'dataVersion',
width: '50'
}, {
title: '数据内容',
align: 'center',
dataIndex: 'dataContent',
width: '150',
scopedSlots: { customRender: 'dataContent' }
}, {
title: '创建人',
align: 'center',
dataIndex: 'createBy',
width: '100'
}
],
url: {
list: '/sys/dataLog/page'
}
}
},
methods: {
handleCompare: function () {
if (!this.selectionRows || this.selectionRows.length != 2) {
this.openNotifIcon('请选择两条数据')
return false
} else if (this.selectionRows[0].dataId != this.selectionRows[1].dataId) {
this.openNotifIcon('请选择相同的数据库表和数据ID进行比较')
return false
} else {
this.$refs.modalForm.addModal(this.selectionRows)
this.$refs.modalForm.title = '数据比较'
}
},
methods: {
handleCompare: function () {
if (!this.selectionRows || this.selectionRows.length != 2) {
this.openNotifIcon('请选择两条数据');
return false;
} else if (this.selectionRows[0].dataId != this.selectionRows[1].dataId) {
this.openNotifIcon('请选择相同的数据库表和数据ID进行比较');
return false;
} else {
this.$refs.modalForm.addModal(this.selectionRows);
this.$refs.modalForm.title = "数据比较";
}
},
openNotifIcon(msg) {
this.$notification['warning']({
message: '提示信息',
description: msg,
});
},
openNotifIcon (msg) {
this.$notification.warning({
message: '提示信息',
description: msg
})
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less'
</style>
</style>
+387 -389
View File
@@ -144,421 +144,419 @@
</a-row>
</template>
<script>
import DepartModal from './modules/DepartModal'
import {queryDepartTreeList, searchByKeywords, deleteByDepartId} from '@/api/api'
import {httpAction, deleteAction} from '@/api/manage'
import {JeroListMixin} from '@/mixins/JeroListMixin'
import DepartAuthModal from './modules/DepartAuthModal'
// 表头
const columns = [
{
title: '机构名称',
dataIndex: 'departName'
},
{
title: '机构类型',
align: 'center',
dataIndex: 'orgType'
},
{
title: '机构编码',
dataIndex: 'orgCode',
},
{
title: '手机号',
dataIndex: 'mobile'
},
{
title: '传真',
dataIndex: 'fax'
},
{
title: '地址',
dataIndex: 'address'
},
{
title: '排序',
align: 'center',
dataIndex: 'departOrder'
},
{
title: '操作',
align: 'center',
dataIndex: 'action',
scopedSlots: {customRender: 'action'}
import DepartModal from './modules/DepartModal'
import { queryDepartTreeList, searchByKeywords, deleteByDepartId } from '@/api/api'
import { httpAction, deleteAction } from '@/api/manage'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import DepartAuthModal from './modules/DepartAuthModal'
// 表头
const columns = [
{
title: '机构名称',
dataIndex: 'departName'
},
{
title: '机构类型',
align: 'center',
dataIndex: 'orgType'
},
{
title: '机构编码',
dataIndex: 'orgCode'
},
{
title: '手机号',
dataIndex: 'mobile'
},
{
title: '传真',
dataIndex: 'fax'
},
{
title: '地址',
dataIndex: 'address'
},
{
title: '排序',
align: 'center',
dataIndex: 'departOrder'
},
{
title: '操作',
align: 'center',
dataIndex: 'action',
scopedSlots: { customRender: 'action' }
}
]
export default {
name: 'DepartList',
mixins: [JeroListMixin],
components: {
DepartAuthModal,
DepartModal
},
data () {
return {
iExpandedKeys: [],
loading: false,
autoExpandParent: true,
currFlowId: '',
currFlowName: '',
disable: true,
treeData: [],
visible: false,
departTree: [],
rightClickSelectedKey: '',
rightClickSelectedOrgCode: '',
hiding: true,
model: {},
dropTrigger: '',
depart: {},
columns: columns,
disableSubmit: false,
checkedKeys: [],
selectedKeys: [],
autoIncr: 1,
currSelected: {},
allTreeKeys: [],
checkStrictly: true,
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
graphDatasource: {
nodes: [],
edges: []
},
validatorRules: {
departName: [{ required: true, message: '请输入机构/部门名称!' }],
orgCode: [{ required: true, message: '请输入机构编码!' }],
orgCategory: [{ required: true, message: '请输入机构类型!' }],
mobile: [{ validator: this.validateMobile }]
},
url: {
delete: '/sys/sysDepart/delete',
edit: '/sys/sysDepart/edit',
deleteBatch: '/sys/sysDepart/deleteBatch',
exportXlsUrl: 'sys/sysDepart/exportXls',
importExcelUrl: 'sys/sysDepart/importExcel'
},
orgCategoryDisabled: false
}
]
export default {
name: 'DepartList',
mixins: [JeroListMixin],
components: {
DepartAuthModal,
DepartModal
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG.domianURL}/${this.url.importExcelUrl}`
}
},
methods: {
loadData () {
this.refresh()
},
data() {
return {
iExpandedKeys: [],
loading: false,
autoExpandParent: true,
currFlowId: '',
currFlowName: '',
disable: true,
treeData: [],
visible: false,
departTree: [],
rightClickSelectedKey: '',
rightClickSelectedOrgCode: '',
hiding: true,
model: {},
dropTrigger: '',
depart: {},
columns: columns,
disableSubmit: false,
checkedKeys: [],
selectedKeys: [],
autoIncr: 1,
currSelected: {},
allTreeKeys:[],
checkStrictly: true,
labelCol: {
xs: {span: 24},
sm: {span: 5}
},
wrapperCol: {
xs: {span: 24},
sm: {span: 16}
},
graphDatasource: {
nodes: [],
edges: []
},
validatorRules: {
departName: [{required: true, message: '请输入机构/部门名称!'}],
orgCode: [{required: true, message: '请输入机构编码!'}],
orgCategory:[{required: true, message: '请输入机构类型!'}],
mobile:[{validator: this.validateMobile}]
},
url: {
delete: '/sys/sysDepart/delete',
edit: '/sys/sysDepart/edit',
deleteBatch: '/sys/sysDepart/deleteBatch',
exportXlsUrl: "sys/sysDepart/exportXls",
importExcelUrl: "sys/sysDepart/importExcel",
},
orgCategoryDisabled:false,
loadTree () {
var that = this
that.treeData = []
that.departTree = []
queryDepartTreeList().then((res) => {
if (res.success) {
// 部门全选后,再添加部门,选中数量增多
this.allTreeKeys = []
for (let i = 0; i < res.result.length; i++) {
const temp = res.result[i]
that.treeData.push(temp)
that.departTree.push(temp)
that.setThisExpandedKeys(temp)
that.getAllKeys(temp)
// console.log(temp.id)
}
this.loading = false
}
})
},
setThisExpandedKeys (node) {
if (node.children && node.children.length > 0) {
this.iExpandedKeys.push(node.key)
for (let a = 0; a < node.children.length; a++) {
this.setThisExpandedKeys(node.children[a])
}
}
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
}
refresh () {
this.loading = true
this.loadTree()
},
methods: {
loadData() {
this.refresh();
},
loadTree() {
var that = this
that.treeData = []
that.departTree = []
queryDepartTreeList().then((res) => {
if (res.success) {
//部门全选后,再添加部门,选中数量增多
this.allTreeKeys = [];
for (let i = 0; i < res.result.length; i++) {
let temp = res.result[i]
that.treeData.push(temp)
that.departTree.push(temp)
that.setThisExpandedKeys(temp)
that.getAllKeys(temp);
// console.log(temp.id)
}
this.loading = false
}
})
},
setThisExpandedKeys(node) {
if (node.children && node.children.length > 0) {
this.iExpandedKeys.push(node.key)
for (let a = 0; a < node.children.length; a++) {
this.setThisExpandedKeys(node.children[a])
}
}
},
refresh() {
this.loading = true
this.loadTree()
},
// 右键操作方法
rightHandle(node) {
this.dropTrigger = 'contextmenu'
console.log(node.node.eventKey)
this.rightClickSelectedKey = node.node.eventKey
this.rightClickSelectedOrgCode = node.node.dataRef.orgCode
},
onExpand(expandedKeys) {
console.log('onExpand', expandedKeys)
this.iExpandedKeys = expandedKeys
this.autoExpandParent = false
},
backFlowList() {
this.$router.back(-1)
},
// 右键点击下拉框改变事件
dropStatus(visible) {
if (visible == false) {
this.dropTrigger = ''
}
},
// 右键下拉关闭下拉框
closeDrop() {
// 右键操作方法
rightHandle (node) {
this.dropTrigger = 'contextmenu'
console.log(node.node.eventKey)
this.rightClickSelectedKey = node.node.eventKey
this.rightClickSelectedOrgCode = node.node.dataRef.orgCode
},
onExpand (expandedKeys) {
console.log('onExpand', expandedKeys)
this.iExpandedKeys = expandedKeys
this.autoExpandParent = false
},
backFlowList () {
this.$router.back(-1)
},
// 右键点击下拉框改变事件
dropStatus (visible) {
if (visible == false) {
this.dropTrigger = ''
},
addRootNode() {
this.$refs.nodeModal.add(this.currFlowId, '')
},
batchDel: function () {
console.log(this.checkedKeys)
if (this.checkedKeys.length <= 0) {
this.$message.warning('请选择一条记录!')
} else {
var ids = ''
for (var a = 0; a < this.checkedKeys.length; a++) {
ids += this.checkedKeys[a] + ','
}
var that = this
this.$confirm({
title: '确认删除',
content: '确定要删除所选中的 ' + this.checkedKeys.length + ' 条数据,以及子节点数据吗?',
onOk: function () {
deleteAction(that.url.deleteBatch, {ids: ids}).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loadTree()
that.onClearSelected()
} else {
that.$message.warning(res.message)
}
})
}
})
}
},
// 右键下拉关闭下拉框
closeDrop () {
this.dropTrigger = ''
},
addRootNode () {
this.$refs.nodeModal.add(this.currFlowId, '')
},
batchDel: function () {
console.log(this.checkedKeys)
if (this.checkedKeys.length <= 0) {
this.$message.warning('请选择一条记录!')
} else {
var ids = ''
for (var a = 0; a < this.checkedKeys.length; a++) {
ids += this.checkedKeys[a] + ','
}
},
onSearch(value) {
let that = this
if (value) {
searchByKeywords({keyWord: value}).then((res) => {
if (res.success) {
that.departTree = []
for (let i = 0; i < res.result.length; i++) {
let temp = res.result[i]
that.departTree.push(temp)
}
} else {
that.$message.warning(res.message)
}
})
} else {
that.loadTree()
}
},
nodeModalOk() {
this.loadTree()
},
nodeModalClose() {
},
hide() {
console.log(111)
this.visible = false
},
onCheck(checkedKeys, info) {
console.log('onCheck', checkedKeys, info)
this.hiding = false
//---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------
if(this.checkStrictly){
this.checkedKeys = checkedKeys.checked;
}else{
this.checkedKeys = checkedKeys
}
//---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------
},
onSelect(selectedKeys, e) {
console.log('selected', selectedKeys, e)
this.hiding = false
let record = e.node.dataRef
console.log('onSelect-record', record)
this.currSelected = Object.assign({}, record)
this.model = this.currSelected
this.selectedKeys = [record.key]
this.model.parentId = record.parentId
this.setValuesToForm(record)
this.$refs.departAuth.show(record.id);
},
// 触发onSelect事件时,为部门树右侧的form表单赋值
setValuesToForm(record) {
if(record.orgCategory == '1'){
this.orgCategoryDisabled = true;
}else{
this.orgCategoryDisabled = false;
}
},
getCurrSelectedTitle() {
return !this.currSelected.title ? '' : this.currSelected.title
},
onClearSelected() {
this.hiding = true
this.checkedKeys = []
this.currSelected = {}
this.selectedKeys = []
this.$refs.departAuth.departId = ''
},
handleNodeTypeChange(val) {
this.currSelected.nodeType = val
},
notifyTriggerTypeChange(value) {
this.currSelected.notifyTriggerType = value
},
receiptTriggerTypeChange(value) {
this.currSelected.receiptTriggerType = value
},
submitCurrForm() {
this.$refs.form.validate(valid => {
if (valid) {
if (!this.currSelected.id) {
this.$message.warning('请点击选择要修改部门!')
return
}
httpAction(this.url.edit, this.currSelected, 'put').then((res) => {
if (res.success) {
this.$message.success('保存成功!')
this.loadTree()
} else {
this.$message.error(res.message)
}
})
}
})
},
emptyCurrForm() {
this.$refs.form.resetFields();
this.model={}
},
nodeSettingFormSubmit() {
this.$refs.form.validate(valid => {
if (valid) {
console.log('Received values of form: ', this.model)
}
})
},
openSelect() {
this.$refs.sysDirectiveModal.show()
},
handleAdd(num) {
if (num == 1) {
this.$refs.departModal.add()
this.$refs.departModal.title = '新增'
} else if (num == 2) {
let key = this.currSelected.key
if (!key) {
this.$message.warning('请先点击选中上级部门!')
return false
}
this.$refs.departModal.add(this.selectedKeys)
this.$refs.departModal.title = '新增'
} else {
this.$refs.departModal.add(this.rightClickSelectedKey)
this.$refs.departModal.title = '新增'
}
},
handleDelete() {
var that = this
this.$confirm({
title: '确认删除',
content: '确定要删除此部门以及子节点数据吗?',
content: '确定要删除所选中的 ' + this.checkedKeys.length + ' 条数据,以及子节点数据吗?',
onOk: function () {
deleteByDepartId({id: that.rightClickSelectedKey}).then((resp) => {
if (resp.success) {
//删除成功后,去除已选中中的数据
that.checkedKeys.splice(that.checkedKeys.findIndex(key => key === that.rightClickSelectedKey), 1);
that.$message.success('删除成功!')
deleteAction(that.url.deleteBatch, { ids: ids }).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loadTree()
//删除后同步清空右侧基本信息内容
let orgCode=that.model.orgCode;
if(orgCode && orgCode === that.rightClickSelectedOrgCode){
that.onClearSelected()
}
that.onClearSelected()
} else {
that.$message.warning('删除失败!')
that.$message.warning(res.message)
}
})
}
})
},
selectDirectiveOk(record) {
console.log('选中指令数据', record)
this.nodeSettingForm.setFieldsValue({directiveCode: record.directiveCode})
this.currSelected.sysCode = record.sysCode
},
getFlowGraphData(node) {
this.graphDatasource.nodes.push({
id: node.id,
text: node.flowNodeName
}
},
onSearch (value) {
const that = this
if (value) {
searchByKeywords({ keyWord: value }).then((res) => {
if (res.success) {
that.departTree = []
for (let i = 0; i < res.result.length; i++) {
const temp = res.result[i]
that.departTree.push(temp)
}
} else {
that.$message.warning(res.message)
}
})
if (node.children.length > 0) {
for (let a = 0; a < node.children.length; a++) {
let temp = node.children[a]
this.graphDatasource.edges.push({
source: node.id,
target: temp.id
})
this.getFlowGraphData(temp)
} else {
that.loadTree()
}
},
nodeModalOk () {
this.loadTree()
},
nodeModalClose () {
},
hide () {
console.log(111)
this.visible = false
},
onCheck (checkedKeys, info) {
console.log('onCheck', checkedKeys, info)
this.hiding = false
// ---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------
if (this.checkStrictly) {
this.checkedKeys = checkedKeys.checked
} else {
this.checkedKeys = checkedKeys
}
// ---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------
},
onSelect (selectedKeys, e) {
console.log('selected', selectedKeys, e)
this.hiding = false
const record = e.node.dataRef
console.log('onSelect-record', record)
this.currSelected = Object.assign({}, record)
this.model = this.currSelected
this.selectedKeys = [record.key]
this.model.parentId = record.parentId
this.setValuesToForm(record)
this.$refs.departAuth.show(record.id)
},
// 触发onSelect事件时,为部门树右侧的form表单赋值
setValuesToForm (record) {
if (record.orgCategory == '1') {
this.orgCategoryDisabled = true
} else {
this.orgCategoryDisabled = false
}
},
getCurrSelectedTitle () {
return !this.currSelected.title ? '' : this.currSelected.title
},
onClearSelected () {
this.hiding = true
this.checkedKeys = []
this.currSelected = {}
this.selectedKeys = []
this.$refs.departAuth.departId = ''
},
handleNodeTypeChange (val) {
this.currSelected.nodeType = val
},
notifyTriggerTypeChange (value) {
this.currSelected.notifyTriggerType = value
},
receiptTriggerTypeChange (value) {
this.currSelected.receiptTriggerType = value
},
submitCurrForm () {
this.$refs.form.validate(valid => {
if (valid) {
if (!this.currSelected.id) {
this.$message.warning('请点击选择要修改部门!')
return
}
httpAction(this.url.edit, this.currSelected, 'put').then((res) => {
if (res.success) {
this.$message.success('保存成功!')
this.loadTree()
} else {
this.$message.error(res.message)
}
})
}
},
//---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------
expandAll () {
this.iExpandedKeys = this.allTreeKeys
},
closeAll () {
this.iExpandedKeys = []
},
checkALL () {
this.checkStriccheckStrictlytly = false
this.checkedKeys = this.allTreeKeys
},
cancelCheckALL () {
//this.checkedKeys = this.defaultCheckedKeys
this.checkedKeys = []
},
switchCheckStrictly (v) {
if(v==1){
this.checkStrictly = false
}else if(v==2){
this.checkStrictly = true
})
},
emptyCurrForm () {
this.$refs.form.resetFields()
this.model = {}
},
nodeSettingFormSubmit () {
this.$refs.form.validate(valid => {
if (valid) {
console.log('Received values of form: ', this.model)
}
},
getAllKeys(node) {
// console.log('node',node);
this.allTreeKeys.push(node.key)
if (node.children && node.children.length > 0) {
for (let a = 0; a < node.children.length; a++) {
this.getAllKeys(node.children[a])
}
})
},
openSelect () {
this.$refs.sysDirectiveModal.show()
},
handleAdd (num) {
if (num == 1) {
this.$refs.departModal.add()
this.$refs.departModal.title = '新增'
} else if (num == 2) {
const key = this.currSelected.key
if (!key) {
this.$message.warning('请先点击选中上级部门!')
return false
}
this.$refs.departModal.add(this.selectedKeys)
this.$refs.departModal.title = '新增'
} else {
this.$refs.departModal.add(this.rightClickSelectedKey)
this.$refs.departModal.title = '新增'
}
},
handleDelete () {
var that = this
this.$confirm({
title: '确认删除',
content: '确定要删除此部门以及子节点数据吗?',
onOk: function () {
deleteByDepartId({ id: that.rightClickSelectedKey }).then((resp) => {
if (resp.success) {
// 删除成功后,去除已选中中的数据
that.checkedKeys.splice(that.checkedKeys.findIndex(key => key === that.rightClickSelectedKey), 1)
that.$message.success('删除成功!')
that.loadTree()
// 删除后同步清空右侧基本信息内容
const orgCode = that.model.orgCode
if (orgCode && orgCode === that.rightClickSelectedOrgCode) {
that.onClearSelected()
}
} else {
that.$message.warning('删除失败!')
}
})
}
})
},
selectDirectiveOk (record) {
console.log('选中指令数据', record)
this.nodeSettingForm.setFieldsValue({ directiveCode: record.directiveCode })
this.currSelected.sysCode = record.sysCode
},
getFlowGraphData (node) {
this.graphDatasource.nodes.push({
id: node.id,
text: node.flowNodeName
})
if (node.children.length > 0) {
for (let a = 0; a < node.children.length; a++) {
const temp = node.children[a]
this.graphDatasource.edges.push({
source: node.id,
target: temp.id
})
this.getFlowGraphData(temp)
}
}
//---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------
},
created() {
this.currFlowId = this.$route.params.id
this.currFlowName = this.$route.params.name
// this.loadTree()
// ---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------
expandAll () {
this.iExpandedKeys = this.allTreeKeys
},
closeAll () {
this.iExpandedKeys = []
},
checkALL () {
this.checkStriccheckStrictlytly = false
this.checkedKeys = this.allTreeKeys
},
cancelCheckALL () {
// this.checkedKeys = this.defaultCheckedKeys
this.checkedKeys = []
},
switchCheckStrictly (v) {
if (v == 1) {
this.checkStrictly = false
} else if (v == 2) {
this.checkStrictly = true
}
},
getAllKeys (node) {
// console.log('node',node);
this.allTreeKeys.push(node.key)
if (node.children && node.children.length > 0) {
for (let a = 0; a < node.children.length; a++) {
this.getAllKeys(node.children[a])
}
}
}
// ---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------
},
created () {
this.currFlowId = this.$route.params.id
this.currFlowName = this.$route.params.name
// this.loadTree()
}
}
</script>
<style scoped>
.ant-card-body .table-operator {
@@ -620,4 +618,4 @@
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>
</style>
+450 -453
View File
@@ -138,485 +138,482 @@
</a-row>
</template>
<script>
import DepartModal from './modules/DepartModal'
import { deleteByDepartId, queryDepartTreeSync, searchByKeywords } from '@/api/api'
import { deleteAction, httpAction } from '@/api/manage'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import DepartAuthModal from './modules/DepartAuthModal'
import { cloneObject } from '@/utils/util'
import JThirdAppButton from '@comp/jerobiz/thirdApp/JThirdAppButton'
// 表头
const columns = [
{
title: '机构名称',
dataIndex: 'departName'
},
{
title: '机构类型',
align: 'center',
dataIndex: 'orgType'
},
{
title: '机构编码',
dataIndex: 'orgCode',
},
{
title: '手机号',
dataIndex: 'mobile'
},
{
title: '传真',
dataIndex: 'fax'
},
{
title: '地址',
dataIndex: 'address'
},
{
title: '排序',
align: 'center',
dataIndex: 'departOrder'
},
{
title: '操作',
align: 'center',
dataIndex: 'action',
scopedSlots: {customRender: 'action'}
}
]
export default {
name: 'DepartList',
mixins: [JeroListMixin],
components: {
JThirdAppButton,
DepartAuthModal,
DepartModal
},
data() {
return {
iExpandedKeys: [],
loading: true,
autoExpandParent: false,
currFlowId: '',
currFlowName: '',
disable: true,
treeData: [],
visible: false,
departTree: [],
departTreeAll: [],
loadedKeys: [],
allIds: [],
rightClickSelectedKey: '',
rightClickSelectedOrgCode: '',
hiding: true,
model: {},
dropTrigger: '',
depart: {},
columns: columns,
disableSubmit: false,
checkedKeys: [],
selectedKeys: [],
autoIncr: 1,
currSelected: {},
import DepartModal from './modules/DepartModal'
import { deleteByDepartId, queryDepartTreeSync, searchByKeywords } from '@/api/api'
import { deleteAction, httpAction } from '@/api/manage'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import DepartAuthModal from './modules/DepartAuthModal'
import { cloneObject } from '@/utils/util'
import JThirdAppButton from '@comp/jerobiz/thirdApp/JThirdAppButton'
// 表头
const columns = [
{
title: '机构名称',
dataIndex: 'departName'
},
{
title: '机构类型',
align: 'center',
dataIndex: 'orgType'
},
{
title: '机构编码',
dataIndex: 'orgCode'
},
{
title: '手机号',
dataIndex: 'mobile'
},
{
title: '传真',
dataIndex: 'fax'
},
{
title: '地址',
dataIndex: 'address'
},
{
title: '排序',
align: 'center',
dataIndex: 'departOrder'
},
{
title: '操作',
align: 'center',
dataIndex: 'action',
scopedSlots: { customRender: 'action' }
}
]
export default {
name: 'DepartList',
mixins: [JeroListMixin],
components: {
JThirdAppButton,
DepartAuthModal,
DepartModal
},
data () {
return {
iExpandedKeys: [],
loading: true,
autoExpandParent: false,
currFlowId: '',
currFlowName: '',
disable: true,
treeData: [],
visible: false,
departTree: [],
departTreeAll: [],
loadedKeys: [],
allIds: [],
rightClickSelectedKey: '',
rightClickSelectedOrgCode: '',
hiding: true,
model: {},
dropTrigger: '',
depart: {},
columns: columns,
disableSubmit: false,
checkedKeys: [],
selectedKeys: [],
autoIncr: 1,
currSelected: {},
allTreeKeys:[],
loadTreeKeys:[],
checkStrictly: true,
labelCol: {
xs: {span: 24},
sm: {span: 5}
},
wrapperCol: {
xs: {span: 24},
sm: {span: 16}
},
graphDatasource: {
nodes: [],
edges: []
},
validatorRules: {
departName: [{required: true, message: '请输入机构/部门名称!'}],
orgCode: [{required: true, message: '请输入机构编码!'}],
orgCategory: [{required: true, message: '请输入机构类型!'}],
mobile: [{validator: this.validateMobile}]
},
url: {
delete: '/sys/sysDepart/delete',
edit: '/sys/sysDepart/edit',
deleteBatch: '/sys/sysDepart/deleteBatch',
exportXlsUrl: "sys/sysDepart/exportXls",
importExcelUrl: "sys/sysDepart/importExcel",
},
orgCategoryDisabled:false,
}
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
}
},
methods: {
loadData() {
this.refresh();
allTreeKeys: [],
loadTreeKeys: [],
checkStrictly: true,
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
loadTree() {
var that = this
//上级部门树信息
that.treeData = []
//保存的树信息,搜索是需要用到
that.departTreeAll = []
//所有的树信息
that.departTree = []
//所有的树节点key信息
that.allIds = []
that.iExpandedKeys = []
that.loading = false
queryDepartTreeSync().then((res) => {
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
graphDatasource: {
nodes: [],
edges: []
},
validatorRules: {
departName: [{ required: true, message: '请输入机构/部门名称!' }],
orgCode: [{ required: true, message: '请输入机构编码!' }],
orgCategory: [{ required: true, message: '请输入机构类型!' }],
mobile: [{ validator: this.validateMobile }]
},
url: {
delete: '/sys/sysDepart/delete',
edit: '/sys/sysDepart/edit',
deleteBatch: '/sys/sysDepart/deleteBatch',
exportXlsUrl: 'sys/sysDepart/exportXls',
importExcelUrl: 'sys/sysDepart/importExcel'
},
orgCategoryDisabled: false
}
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG.domianURL}/${this.url.importExcelUrl}`
}
},
methods: {
loadData () {
this.refresh()
},
loadTree () {
var that = this
// 上级部门树信息
that.treeData = []
// 保存的树信息,搜索是需要用到
that.departTreeAll = []
// 所有的树信息
that.departTree = []
// 所有的树节点key信息
that.allIds = []
that.iExpandedKeys = []
that.loading = false
queryDepartTreeSync().then((res) => {
if (res.success) {
this.allTreeKeys = []
for (let i = 0; i < res.result.length; i++) {
const temp = res.result[i]
that.treeData.push(temp)
that.departTreeAll.push(temp)
that.departTree.push(temp)
that.allIds.push(temp.key)
that.allTreeKeys.push(temp.key)
if (that.loadTreeKeys.indexOf(temp.key) >= 0) {
that.iExpandedKeys.push(temp.key)
}
}
that.$nextTick(() => {
that.loading = true
})
}
})
},
loadSubTree (treeNode) {
var that = this
return new Promise(resolve => {
queryDepartTreeSync({ pid: treeNode.dataRef.id }).then((res) => {
if (res.success) {
this.allTreeKeys = [];
// 判断chidlren是否为空,并修改isLeaf属性值
if (res.result.length == 0) {
treeNode.dataRef.isLeaf = true
return
} else {
treeNode.dataRef.children = res.result
}
for (let i = 0; i < res.result.length; i++) {
let temp = res.result[i]
that.treeData.push(temp)
that.departTreeAll.push(temp)
that.departTree.push(temp)
const temp = res.result[i]
that.allIds.push(temp.key)
that.allTreeKeys.push(temp.key)
if(that.loadTreeKeys.indexOf(temp.key)>=0){
if (that.loadTreeKeys.indexOf(temp.key) > 0) {
that.iExpandedKeys.push(temp.key)
}
}
that.$nextTick(()=>{
that.loading = true
})
}
})
},
loadSubTree(treeNode) {
var that = this;
return new Promise(resolve => {
queryDepartTreeSync({pid:treeNode.dataRef.id}).then((res) => {
if (res.success) {
//判断chidlren是否为空,并修改isLeaf属性值
if(res.result.length == 0){
treeNode.dataRef['isLeaf']=true
return;
}else{
treeNode.dataRef['children']= res.result;
}
for (let i = 0; i < res.result.length; i++) {
let temp = res.result[i]
that.allIds.push(temp.key)
if(that.loadTreeKeys.indexOf(temp.key)>0){
that.iExpandedKeys.push(temp.key)
}
}
}
})
resolve();
});
//保存全部部门信息,方便后面搜索使用
that.departTreeAll=that.departTree
},
refresh() {
this.loading = true
this.loadTree()
},
// 右键操作方法
rightHandle(node) {
this.dropTrigger = 'contextmenu'
console.log(node.node.eventKey)
this.rightClickSelectedKey = node.node.eventKey
this.rightClickSelectedOrgCode = node.node.dataRef.orgCode
},
onExpand(expandedKeys) {
console.log('onExpand', expandedKeys)
this.iExpandedKeys = expandedKeys
this.autoExpandParent = false
this.allTreeKeys=expandedKeys
this.loadTreeKeys=expandedKeys
},
backFlowList() {
this.$router.back(-1)
},
// 右键点击下拉框改变事件
dropStatus(visible) {
if (visible == false) {
this.dropTrigger = ''
}
},
// 右键店家下拉关闭下拉框
closeDrop() {
resolve()
})
// 保存全部部门信息,方便后面搜索使用
that.departTreeAll = that.departTree
},
refresh () {
this.loading = true
this.loadTree()
},
// 右键操作方法
rightHandle (node) {
this.dropTrigger = 'contextmenu'
console.log(node.node.eventKey)
this.rightClickSelectedKey = node.node.eventKey
this.rightClickSelectedOrgCode = node.node.dataRef.orgCode
},
onExpand (expandedKeys) {
console.log('onExpand', expandedKeys)
this.iExpandedKeys = expandedKeys
this.autoExpandParent = false
this.allTreeKeys = expandedKeys
this.loadTreeKeys = expandedKeys
},
backFlowList () {
this.$router.back(-1)
},
// 右键点击下拉框改变事件
dropStatus (visible) {
if (visible == false) {
this.dropTrigger = ''
},
addRootNode() {
this.$refs.nodeModal.add(this.currFlowId, '')
},
batchDel: function () {
console.log(this.checkedKeys)
if (this.checkedKeys.length <= 0) {
this.$message.warning('请选择一条记录!')
} else {
var ids = ''
for (var a = 0; a < this.checkedKeys.length; a++) {
ids += this.checkedKeys[a]+ ','
}
var that = this
this.$confirm({
title: '确认删除',
content: '确定要删除所选中的 ' + this.checkedKeys.length + ' 条数据,以及子节点数据吗?',
onOk: function () {
deleteAction(that.url.deleteBatch, {ids: ids}).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loadTree()
that.onClearSelected()
} else {
that.$message.warning(res.message)
}
})
}
})
}
},
// 右键店家下拉关闭下拉框
closeDrop () {
this.dropTrigger = ''
},
addRootNode () {
this.$refs.nodeModal.add(this.currFlowId, '')
},
batchDel: function () {
console.log(this.checkedKeys)
if (this.checkedKeys.length <= 0) {
this.$message.warning('请选择一条记录!')
} else {
var ids = ''
for (var a = 0; a < this.checkedKeys.length; a++) {
ids += this.checkedKeys[a] + ','
}
},
onSearch(value) {
let that = this
if (value) {
searchByKeywords({keyWord: value}).then((res) => {
if (res.success) {
that.departTree = []
for (let i = 0; i < res.result.length; i++) {
let temp = res.result[i]
that.departTree.push(temp)
}
} else {
that.$message.warning(res.message)
}
})
} else {
that.departTree=that.departTreeAll
}
},
nodeModalOk() {
this.loadTree()
},
nodeModalClose() {
},
hide() {
this.visible = false
},
onCheck(checkedKeys, info) {
console.log('onCheck', checkedKeys, info)
this.hiding = false
//this.checkedKeys = checkedKeys.checked
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
if(this.checkStrictly){
this.checkedKeys = checkedKeys.checked;
}else{
this.checkedKeys = checkedKeys
}
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
},
onSelect(selectedKeys, e) {
console.log('selected', selectedKeys, e)
this.hiding = false
let record = e.node.dataRef
console.log('onSelect-record', record)
this.currSelected = Object.assign({}, record)
this.model = this.currSelected
this.selectedKeys = [record.key]
this.model.parentId = record.parentId
this.setValuesToForm(record)
this.$refs.departAuth.show(record.id);
},
// 触发onSelect事件时,为部门树右侧的form表单赋值
setValuesToForm(record) {
if(record.orgCategory == '1'){
this.orgCategoryDisabled = true;
}else{
this.orgCategoryDisabled = false;
}
this.$nextTick(() => {
this.model = cloneObject(record)
})
},
getCurrSelectedTitle() {
return !this.currSelected.title ? '' : this.currSelected.title
},
onClearSelected() {
this.hiding = true
this.checkedKeys = []
this.currSelected = {}
this.model = cloneObject(this.currSelected)
this.selectedKeys = []
this.$refs.departAuth.departId = ''
},
handleNodeTypeChange(val) {
this.currSelected.nodeType = val
},
notifyTriggerTypeChange(value) {
this.currSelected.notifyTriggerType = value
},
receiptTriggerTypeChange(value) {
this.currSelected.receiptTriggerType = value
},
submitCurrForm() {
this.$refs.form.validate((ok, err) => {
if (ok) {
if (!this.currSelected.id) {
this.$message.warning('请点击选择要修改部门!')
return
}
let formData = Object.assign(this.currSelected, this.model)
console.log('Received values of form: ', formData)
httpAction(this.url.edit, formData, 'put').then((res) => {
if (res.success) {
this.$message.success('保存成功!')
this.loadTree()
} else {
this.$message.error(res.message)
}
})
}
})
},
emptyCurrForm() {
this.model = this.currSelected
},
nodeSettingFormSubmit() {
this.$refs.form.validate((ok, err) => {
if (ok) {
console.log('Received values of form: ', this.model)
}
})
},
openSelect() {
this.$refs.sysDirectiveModal.show()
},
handleAdd(num) {
if (num == 1) {
this.$refs.departModal.add()
this.$refs.departModal.title = '新增'
} else if (num == 2) {
let key = this.currSelected.key
if (!key) {
this.$message.warning('请先点击选中上级部门!')
return false
}
this.$refs.departModal.add(this.selectedKeys[0])
this.$refs.departModal.title = '新增'
} else {
this.$refs.departModal.add(this.rightClickSelectedKey)
this.$refs.departModal.title = '新增'
}
},
handleDelete() {
var that = this
this.$confirm({
title: '确认删除',
content: '确定要删除此部门以及子节点数据吗?',
content: '确定要删除所选中的 ' + this.checkedKeys.length + ' 条数据,以及子节点数据吗?',
onOk: function () {
deleteByDepartId({id: that.rightClickSelectedKey}).then((resp) => {
if (resp.success) {
//删除成功后,去除已选中中的数据
that.checkedKeys.splice(that.checkedKeys.findIndex(key => key === that.rightClickSelectedKey), 1);
that.$message.success('删除成功!')
deleteAction(that.url.deleteBatch, { ids: ids }).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loadTree()
//删除后同步清空右侧基本信息内容
let orgCode = that.model.orgCode
if(orgCode && orgCode === that.rightClickSelectedOrgCode){
that.onClearSelected()
}
that.onClearSelected()
} else {
that.$message.warning('删除失败!')
that.$message.warning(res.message)
}
})
}
})
},
selectDirectiveOk(record) {
console.log('选中指令数据', record)
this.nodeSettingForm.setFieldsValue({directiveCode: record.directiveCode})
this.currSelected.sysCode = record.sysCode
},
getFlowGraphData(node) {
this.graphDatasource.nodes.push({
id: node.id,
text: node.flowNodeName
})
if (node.children.length > 0) {
for (let a = 0; a < node.children.length; a++) {
let temp = node.children[a]
this.graphDatasource.edges.push({
source: node.id,
target: temp.id
})
this.getFlowGraphData(temp)
}
}
},
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
expandAll () {
this.iExpandedKeys = this.allTreeKeys
//this.loadTree()
},
closeAll () {
this.iExpandedKeys = []
},
checkALL () {
this.checkStriccheckStrictlytly = false
//this.checkedKeys = this.allTreeKeys
this.checkedKeys = this.allIds
},
cancelCheckALL () {
//this.checkedKeys = this.defaultCheckedKeys
this.checkedKeys = []
},
switchCheckStrictly (v) {
if(v==1){
this.checkStrictly = false
}else if(v==2){
this.checkStrictly = true
}
},
getAllKeys(node) {
// console.log('node',node);
this.allTreeKeys.push(node.key)
if (node.children && node.children.length > 0) {
for (let a = 0; a < node.children.length; a++) {
this.getAllKeys(node.children[a])
}
}
},
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
// 验证手机号
validateMobile(rule,value,callback){
if (!value || new RegExp(/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/).test(value)){
callback();
}else{
callback("您的手机号码格式不正确!");
}
},
onSyncFinally({isToLocal}) {
// 同步到本地时刷新下数据
if (isToLocal) {
this.loadData()
}
},
}
},
created() {
this.currFlowId = this.$route.params.id
this.currFlowName = this.$route.params.name
onSearch (value) {
const that = this
if (value) {
searchByKeywords({ keyWord: value }).then((res) => {
if (res.success) {
that.departTree = []
for (let i = 0; i < res.result.length; i++) {
const temp = res.result[i]
that.departTree.push(temp)
}
} else {
that.$message.warning(res.message)
}
})
} else {
that.departTree = that.departTreeAll
}
},
nodeModalOk () {
this.loadTree()
},
nodeModalClose () {
},
hide () {
this.visible = false
},
onCheck (checkedKeys, info) {
console.log('onCheck', checkedKeys, info)
this.hiding = false
// this.checkedKeys = checkedKeys.checked
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
if (this.checkStrictly) {
this.checkedKeys = checkedKeys.checked
} else {
this.checkedKeys = checkedKeys
}
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
},
onSelect (selectedKeys, e) {
console.log('selected', selectedKeys, e)
this.hiding = false
const record = e.node.dataRef
console.log('onSelect-record', record)
this.currSelected = Object.assign({}, record)
this.model = this.currSelected
this.selectedKeys = [record.key]
this.model.parentId = record.parentId
this.setValuesToForm(record)
this.$refs.departAuth.show(record.id)
},
// 触发onSelect事件时,为部门树右侧的form表单赋值
setValuesToForm (record) {
if (record.orgCategory == '1') {
this.orgCategoryDisabled = true
} else {
this.orgCategoryDisabled = false
}
this.$nextTick(() => {
this.model = cloneObject(record)
})
},
getCurrSelectedTitle () {
return !this.currSelected.title ? '' : this.currSelected.title
},
onClearSelected () {
this.hiding = true
this.checkedKeys = []
this.currSelected = {}
this.model = cloneObject(this.currSelected)
this.selectedKeys = []
this.$refs.departAuth.departId = ''
},
handleNodeTypeChange (val) {
this.currSelected.nodeType = val
},
notifyTriggerTypeChange (value) {
this.currSelected.notifyTriggerType = value
},
receiptTriggerTypeChange (value) {
this.currSelected.receiptTriggerType = value
},
submitCurrForm () {
this.$refs.form.validate((ok, err) => {
if (ok) {
if (!this.currSelected.id) {
this.$message.warning('请点击选择要修改部门!')
return
}
const formData = Object.assign(this.currSelected, this.model)
console.log('Received values of form: ', formData)
httpAction(this.url.edit, formData, 'put').then((res) => {
if (res.success) {
this.$message.success('保存成功!')
this.loadTree()
} else {
this.$message.error(res.message)
}
})
}
})
},
emptyCurrForm () {
this.model = this.currSelected
},
nodeSettingFormSubmit () {
this.$refs.form.validate((ok, err) => {
if (ok) {
console.log('Received values of form: ', this.model)
}
})
},
openSelect () {
this.$refs.sysDirectiveModal.show()
},
handleAdd (num) {
if (num == 1) {
this.$refs.departModal.add()
this.$refs.departModal.title = '新增'
} else if (num == 2) {
const key = this.currSelected.key
if (!key) {
this.$message.warning('请先点击选中上级部门!')
return false
}
this.$refs.departModal.add(this.selectedKeys[0])
this.$refs.departModal.title = '新增'
} else {
this.$refs.departModal.add(this.rightClickSelectedKey)
this.$refs.departModal.title = '新增'
}
},
handleDelete () {
var that = this
this.$confirm({
title: '确认删除',
content: '确定要删除此部门以及子节点数据吗?',
onOk: function () {
deleteByDepartId({ id: that.rightClickSelectedKey }).then((resp) => {
if (resp.success) {
// 删除成功后,去除已选中中的数据
that.checkedKeys.splice(that.checkedKeys.findIndex(key => key === that.rightClickSelectedKey), 1)
that.$message.success('删除成功!')
that.loadTree()
// 删除后同步清空右侧基本信息内容
const orgCode = that.model.orgCode
if (orgCode && orgCode === that.rightClickSelectedOrgCode) {
that.onClearSelected()
}
} else {
that.$message.warning('删除失败!')
}
})
}
})
},
selectDirectiveOk (record) {
console.log('选中指令数据', record)
this.nodeSettingForm.setFieldsValue({ directiveCode: record.directiveCode })
this.currSelected.sysCode = record.sysCode
},
getFlowGraphData (node) {
this.graphDatasource.nodes.push({
id: node.id,
text: node.flowNodeName
})
if (node.children.length > 0) {
for (let a = 0; a < node.children.length; a++) {
const temp = node.children[a]
this.graphDatasource.edges.push({
source: node.id,
target: temp.id
})
this.getFlowGraphData(temp)
}
}
},
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
expandAll () {
this.iExpandedKeys = this.allTreeKeys
// this.loadTree()
},
closeAll () {
this.iExpandedKeys = []
},
checkALL () {
this.checkStriccheckStrictlytly = false
// this.checkedKeys = this.allTreeKeys
this.checkedKeys = this.allIds
},
cancelCheckALL () {
// this.checkedKeys = this.defaultCheckedKeys
this.checkedKeys = []
},
switchCheckStrictly (v) {
if (v == 1) {
this.checkStrictly = false
} else if (v == 2) {
this.checkStrictly = true
}
},
getAllKeys (node) {
// console.log('node',node);
this.allTreeKeys.push(node.key)
if (node.children && node.children.length > 0) {
for (let a = 0; a < node.children.length; a++) {
this.getAllKeys(node.children[a])
}
}
},
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
// 验证手机号
validateMobile (rule, value, callback) {
if (!value || new RegExp(/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/).test(value)) {
callback()
} else {
callback('您的手机号码格式不正确!')
}
},
onSyncFinally ({ isToLocal }) {
// 同步到本地时刷新下数据
if (isToLocal) {
this.loadData()
}
}
},
created () {
this.currFlowId = this.$route.params.id
this.currFlowName = this.$route.params.name
// this.loadTree()
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
@@ -677,4 +674,4 @@
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>
</style>
+140 -141
View File
@@ -44,161 +44,160 @@
</a-row>
</template>
<script>
import DeptBaseInfo from './modules/DeptBaseInfo'
import DeptUserInfo from './modules/DeptUserInfo'
import { queryMyDepartTreeList, searchByKeywords } from '@/api/api'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import DeptBaseInfo from './modules/DeptBaseInfo'
import DeptUserInfo from './modules/DeptUserInfo'
import { queryMyDepartTreeList, searchByKeywords } from '@/api/api'
import { JeroListMixin } from '@/mixins/JeroListMixin'
export default {
name: 'DepartUserList',
mixins: [JeroListMixin],
components: {
// DeptRoleInfo,
DeptBaseInfo,
DeptUserInfo,
export default {
name: 'DepartUserList',
mixins: [JeroListMixin],
components: {
// DeptRoleInfo,
DeptBaseInfo,
DeptUserInfo
},
data () {
return {
currentDeptId: '',
iExpandedKeys: [],
loading: false,
autoExpandParent: true,
currFlowId: '',
currFlowName: '',
disable: true,
treeData: [],
visible: false,
departTree: [],
rightClickSelectedKey: '',
hiding: true,
model: {},
dropTrigger: '',
depart: {},
disableSubmit: false,
checkedKeys: [],
selectedKeys: [],
autoIncr: 1,
currSelected: {},
form: this.$form.createForm(this),
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
graphDatasource: {
nodes: [],
edges: []
},
userIdentity: ''
}
},
methods: {
callback (key) {
// console.log(key)
},
data() {
return {
currentDeptId: '',
iExpandedKeys: [],
loading: false,
autoExpandParent: true,
currFlowId: '',
currFlowName: '',
disable: true,
treeData: [],
visible: false,
departTree: [],
rightClickSelectedKey: '',
hiding: true,
model: {},
dropTrigger: '',
depart: {},
disableSubmit: false,
checkedKeys: [],
selectedKeys: [],
autoIncr: 1,
currSelected: {},
form: this.$form.createForm(this),
labelCol: {
xs: {span: 24},
sm: {span: 5}
},
wrapperCol: {
xs: {span: 24},
sm: {span: 16}
},
graphDatasource: {
nodes: [],
edges: []
},
userIdentity:"",
}
loadData () {
this.refresh()
},
methods: {
callback(key) {
//console.log(key)
},
loadData() {
this.refresh();
},
clearSelectedDepartKeys() {
this.checkedKeys = [];
this.selectedKeys = [];
this.currentDeptId = '';
this.$refs.DeptUserInfo.currentDeptId='';
},
loadTree() {
var that = this
that.treeData = []
that.departTree = []
queryMyDepartTreeList().then((res) => {
if (res.success && res.result ) {
for (let i = 0; i < res.result.length; i++) {
let temp = res.result[i]
that.treeData.push(temp)
that.departTree.push(temp)
that.setThisExpandedKeys(temp)
// console.log(temp.id)
}
this.loading = false
clearSelectedDepartKeys () {
this.checkedKeys = []
this.selectedKeys = []
this.currentDeptId = ''
this.$refs.DeptUserInfo.currentDeptId = ''
},
loadTree () {
var that = this
that.treeData = []
that.departTree = []
queryMyDepartTreeList().then((res) => {
if (res.success && res.result) {
for (let i = 0; i < res.result.length; i++) {
const temp = res.result[i]
that.treeData.push(temp)
that.departTree.push(temp)
that.setThisExpandedKeys(temp)
// console.log(temp.id)
}
that.userIdentity = res.message
})
},
setThisExpandedKeys(node) {
//只展开一级目录
if (node.children && node.children.length > 0) {
this.iExpandedKeys.push(node.key)
//下方代码放开注释则默认展开所有节点
/**
this.loading = false
}
that.userIdentity = res.message
})
},
setThisExpandedKeys (node) {
// 只展开一级目录
if (node.children && node.children.length > 0) {
this.iExpandedKeys.push(node.key)
// 下方代码放开注释则默认展开所有节点
/**
for (let a = 0; a < node.children.length; a++) {
this.setThisExpandedKeys(node.children[a])
}
*/
}
},
refresh() {
this.loading = true
this.loadTree()
},
}
},
refresh () {
this.loading = true
this.loadTree()
},
onExpand(expandedKeys) {
// console.log('onExpand', expandedKeys)
// if not set autoExpandParent to false, if children expanded, parent can not collapse.
// or, you can remove all expanded children keys.
this.iExpandedKeys = expandedKeys
this.autoExpandParent = false
},
onExpand (expandedKeys) {
// console.log('onExpand', expandedKeys)
// if not set autoExpandParent to false, if children expanded, parent can not collapse.
// or, you can remove all expanded children keys.
this.iExpandedKeys = expandedKeys
this.autoExpandParent = false
},
onSearch(value) {
let that = this
if (value) {
searchByKeywords({keyWord: value,myDeptSearch:'1'}).then((res) => {
if (res.success) {
that.departTree = []
for (let i = 0; i < res.result.length; i++) {
let temp = res.result[i]
that.departTree.push(temp)
}
} else {
that.$message.warning(res.message)
onSearch (value) {
const that = this
if (value) {
searchByKeywords({ keyWord: value, myDeptSearch: '1' }).then((res) => {
if (res.success) {
that.departTree = []
for (let i = 0; i < res.result.length; i++) {
const temp = res.result[i]
that.departTree.push(temp)
}
})
} else {
that.loadTree()
}
},
onCheck(checkedKeys, e) {
let record = e.node.dataRef;
this.checkedKeys = [];
this.currentDeptId = record.id;
this.checkedKeys.push(record.id);
this.$refs.DeptBaseInfo.open(record);
this.$refs.DeptUserInfo.open(record);
this.hiding = false;
},
onSelect(selectedKeys, e) {
if (this.selectedKeys[0] !== selectedKeys[0]) {
this.selectedKeys = [selectedKeys[0]];
}
let record = e.node.dataRef;
this.checkedKeys.push(record.id);
this.$refs.DeptBaseInfo.open(record);
this.$refs.DeptUserInfo.onClearSelected();
this.$refs.DeptUserInfo.open(record);
},
} else {
that.$message.warning(res.message)
}
})
} else {
that.loadTree()
}
},
created() {
this.currFlowId = this.$route.params.id
this.currFlowName = this.$route.params.name
// this.loadTree()
onCheck (checkedKeys, e) {
const record = e.node.dataRef
this.checkedKeys = []
this.currentDeptId = record.id
this.checkedKeys.push(record.id)
this.$refs.DeptBaseInfo.open(record)
this.$refs.DeptUserInfo.open(record)
this.hiding = false
},
onSelect (selectedKeys, e) {
if (this.selectedKeys[0] !== selectedKeys[0]) {
this.selectedKeys = [selectedKeys[0]]
}
const record = e.node.dataRef
this.checkedKeys.push(record.id)
this.$refs.DeptBaseInfo.open(record)
this.$refs.DeptUserInfo.onClearSelected()
this.$refs.DeptUserInfo.open(record)
}
},
created () {
this.currFlowId = this.$route.params.id
this.currFlowName = this.$route.params.name
// this.loadTree()
}
}
</script>
<style scoped>
@import '~@assets/less/common.less'
</style>
</style>
+94 -95
View File
@@ -25,114 +25,113 @@
</a-modal>
</template>
<script>
import { getAction,deleteAction,putAction } from '@/api/manage'
export default {
name: "DictDeleteList",
data () {
return {
modalWidth: '90%',
modalStyle: { 'top': '20px'},
title: '操作',
visible: false,
loading: false,
dataSource:[],
columns:[
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 120,
align: "center",
customRender: function (t, r, index) {
return parseInt(index) + 1;
}
},
{
title: '字典名称',
align: "left",
dataIndex: 'dictName'
},
{
title: '字典编号',
align: "left",
dataIndex: 'dictCode'
},
{
title: '描述',
align: "left",
dataIndex: 'description'
},
{
title: '操作',
dataIndex: 'action',
align: "center",
scopedSlots: {customRender: 'action'}
import { getAction, deleteAction, putAction } from '@/api/manage'
export default {
name: 'DictDeleteList',
data () {
return {
modalWidth: '90%',
modalStyle: { top: '20px' },
title: '操作',
visible: false,
loading: false,
dataSource: [],
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 120,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
]
}
},
},
{
title: '字典名称',
align: 'left',
dataIndex: 'dictName'
},
{
title: '字典编号',
align: 'left',
dataIndex: 'dictCode'
},
{
title: '描述',
align: 'left',
dataIndex: 'description'
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
scopedSlots: { customRender: 'action' }
}
]
}
},
methods: {
handleCancel(){
this.visible = false
//回收站字典列表刷新
this.$emit("refresh")
},
show(){
this.visible = true
this.loadData();
},
loadData(){
this.loading = true
getAction("/sys/dict/deleteList").then(res=>{
this.loading = false
if(res.success){
this.dataSource = res.result
}else{
this.$message.warning(res.message)
}
})
},
handleBack(id){
putAction("/sys/dict/back/"+id).then(res=>{
if(res.success){
this.$message.success(res.message)
this.loadData();
}else{
this.$message.warning(res.message)
}
})
},
handleDelete(id){
this.$confirm({
title: '彻底删除字典',
content: (<div>
<p>您确定要彻底删除这个字典项吗</p>
<p style="color:red;">注意彻底删除后将无法恢复请谨慎操作</p>
</div>),
centered: false,
onOk: () => {
var that = this;
deleteAction("/sys/dict/deletePhysic/"+id).then((res) => {
methods: {
handleCancel () {
this.visible = false
// 回收站字典列表刷新
this.$emit('refresh')
},
show () {
this.visible = true
this.loadData()
},
loadData () {
this.loading = true
getAction('/sys/dict/deleteList').then(res => {
this.loading = false
if (res.success) {
this.dataSource = res.result
} else {
this.$message.warning(res.message)
}
})
},
handleBack (id) {
putAction('/sys/dict/back/' + id).then(res => {
if (res.success) {
this.$message.success(res.message)
this.loadData()
} else {
this.$message.warning(res.message)
}
})
},
handleDelete (id) {
this.$confirm({
title: '彻底删除字典',
content: (<div>
<p>您确定要彻底删除这个字典项吗</p>
<p style="color:red;">注意彻底删除后将无法恢复请谨慎操作</p>
</div>),
centered: false,
onOk: () => {
var that = this
deleteAction('/sys/dict/deletePhysic/' + id).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.loadData();
this.loadData()
} else {
that.$message.warning(res.message);
that.$message.warning(res.message)
}
});
},
})
}
})
}
}
}
}
</script>
<style scoped>
</style>
</style>
+131 -131
View File
@@ -78,142 +78,142 @@
</template>
<script>
import pick from 'lodash.pick'
import {filterObj} from '@/utils/util';
import DictItemModal from './modules/DictItemModal'
import {JeroListMixin} from '@/mixins/JeroListMixin'
import pick from 'lodash.pick'
import { filterObj } from '@/utils/util'
import DictItemModal from './modules/DictItemModal'
import { JeroListMixin } from '@/mixins/JeroListMixin'
export default {
name: "DictItemList",
mixins: [JeroListMixin],
components: {DictItemModal},
data() {
return {
columns: [
{
title: '名称',
align: "center",
dataIndex: 'itemText',
},
{
title: '数据值',
align: "center",
dataIndex: 'itemValue',
},
{
title: '操作',
dataIndex: 'action',
align: "center",
scopedSlots: {customRender: 'action'},
}
],
queryParam: {
dictId: "",
dictName: "",
itemText: "",
delFlag: "1",
status: [],
export default {
name: 'DictItemList',
mixins: [JeroListMixin],
components: { DictItemModal },
data () {
return {
columns: [
{
title: '名称',
align: 'center',
dataIndex: 'itemText'
},
title: "操作",
visible: false,
screenWidth: 800,
model: {},
dictId: "",
status: 1,
labelCol: {
xs: {span: 5},
sm: {span: 5},
},
wrapperCol: {
xs: {span: 12},
sm: {span: 12},
},
form: this.$form.createForm(this),
validatorRules: {
itemText: {rules: [{required: true, message: '请输入名称!'}]},
itemValue: {rules: [{required: true, message: '请输入数据值!'}]},
},
url: {
list: "/sys/dictItem/page",
delete: "/sys/dictItem/delete",
deleteBatch: "/sys/dictItem/deleteBatch",
{
title: '数据值',
align: 'center',
dataIndex: 'itemValue'
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
scopedSlots: { customRender: 'action' }
}
],
queryParam: {
dictId: '',
dictName: '',
itemText: '',
delFlag: '1',
status: []
},
title: '操作',
visible: false,
screenWidth: 800,
model: {},
dictId: '',
status: 1,
labelCol: {
xs: { span: 5 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 12 },
sm: { span: 12 }
},
form: this.$form.createForm(this),
validatorRules: {
itemText: { rules: [{ required: true, message: '请输入名称!' }] },
itemValue: { rules: [{ required: true, message: '请输入数据值!' }] }
},
url: {
list: '/sys/dictItem/page',
delete: '/sys/dictItem/delete',
deleteBatch: '/sys/dictItem/deleteBatch'
}
},
created() {
// 当页面初始化时,根据屏幕大小来给抽屉设置宽度
this.resetScreenSize();
},
methods: {
add(dictId) {
this.dictId = dictId;
this.edit({});
},
edit(record) {
if (record.id) {
this.dictId = record.id;
}
this.queryParam = {}
this.form.resetFields();
this.model = Object.assign({}, record);
this.model.dictId = this.dictId;
this.model.status = this.status;
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'itemText', 'itemValue'))
});
// 当其它模块调用该模块时,调用此方法加载字典数据
this.loadData();
},
getQueryParams() {
//update--begin--autor:wangshuai-----date:20191204------for:清空总条数 teambition JT-113------
this.ipagination.total=0;
//update--end--autor:wangshuai-----date:20191204------for:清空总条数 teambition JT-113------
var param = Object.assign({}, this.queryParam);
param.dictId = this.dictId;
param.field = this.getQueryField();
param.pageNo = this.ipagination.current;
param.pageSize = this.ipagination.pageSize;
if (this.superQueryParams) {
param['superQueryParams'] = encodeURI(this.superQueryParams)
param['superQueryMatchType'] = this.superQueryMatchType
}
return filterObj(param);
},
// 添加字典数据
handleAdd() {
this.$refs.modalForm.add(this.dictId);
this.$refs.modalForm.title = "新增";
},
showDrawer() {
this.visible = true
},
onClose() {
this.visible = false
this.form.resetFields();
this.dataSource = [];
},
// 抽屉的宽度随着屏幕大小来改变
resetScreenSize() {
let screenWidth = document.body.clientWidth;
if (screenWidth < 600) {
this.screenWidth = screenWidth;
} else {
this.screenWidth = 600;
}
},
//update--begin--autor:wangshuai-----date:20191204------for:系统管理 数据字典禁用和正常区别开,添加背景颜色 teambition JT-22------
//增加样式方法返回值
getRowClassname(record){
if(record.status==0){
return "data-rule-invalid"
}
}
//update--end--autor:wangshuai-----date:20191204------for:系统管理 数据字典禁用和正常区别开,添加背景颜色 teambition JT-22------
}
},
created () {
// 当页面初始化时,根据屏幕大小来给抽屉设置宽度
this.resetScreenSize()
},
methods: {
add (dictId) {
this.dictId = dictId
this.edit({})
},
edit (record) {
if (record.id) {
this.dictId = record.id
}
this.queryParam = {}
this.form.resetFields()
this.model = Object.assign({}, record)
this.model.dictId = this.dictId
this.model.status = this.status
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'itemText', 'itemValue'))
})
// 当其它模块调用该模块时,调用此方法加载字典数据
this.loadData()
},
getQueryParams () {
// update--begin--autor:wangshuai-----date:20191204------for:清空总条数 teambition JT-113------
this.ipagination.total = 0
// update--end--autor:wangshuai-----date:20191204------for:清空总条数 teambition JT-113------
var param = Object.assign({}, this.queryParam)
param.dictId = this.dictId
param.field = this.getQueryField()
param.pageNo = this.ipagination.current
param.pageSize = this.ipagination.pageSize
if (this.superQueryParams) {
param.superQueryParams = encodeURI(this.superQueryParams)
param.superQueryMatchType = this.superQueryMatchType
}
return filterObj(param)
},
// 添加字典数据
handleAdd () {
this.$refs.modalForm.add(this.dictId)
this.$refs.modalForm.title = '新增'
},
showDrawer () {
this.visible = true
},
onClose () {
this.visible = false
this.form.resetFields()
this.dataSource = []
},
// 抽屉的宽度随着屏幕大小来改变
resetScreenSize () {
const screenWidth = document.body.clientWidth
if (screenWidth < 600) {
this.screenWidth = screenWidth
} else {
this.screenWidth = 600
}
},
// update--begin--autor:wangshuai-----date:20191204------for:系统管理 数据字典禁用和正常区别开,添加背景颜色 teambition JT-22------
// 增加样式方法返回值
getRowClassname (record) {
if (record.status == 0) {
return 'data-rule-invalid'
}
}
// update--end--autor:wangshuai-----date:20191204------for:系统管理 数据字典禁用和正常区别开,添加背景颜色 teambition JT-22------
}
}
</script>
<style lang="less" scoped>
//update--begin--autor:wangshuai-----date:20191204------for:系统管理 数据字典禁用和正常区别开,添加背景颜色 teambition JT-22------
@@ -222,4 +222,4 @@
color: #bababa;
}
//update--begin--autor:wangshuai-----date:20191204------for:系统管理 数据字典禁用和正常区别开,添加背景颜色 teambition JT-22------
</style>
</style>
+125 -125
View File
@@ -66,143 +66,143 @@
</template>
<script>
import { filterObj } from '@/utils/util';
import { JeroListMixin } from '@/mixins/JeroListMixin'
import DictModal from './modules/DictModal'
import DictItemList from './DictItemList'
import DictDeleteList from './DictDeleteList'
import { getAction } from '@/api/manage'
import { UI_CACHE_DB_DICT_DATA } from "@/store/mutation-types"
import Vue from 'vue'
import { filterObj } from '@/utils/util'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import DictModal from './modules/DictModal'
import DictItemList from './DictItemList'
import DictDeleteList from './DictDeleteList'
import { getAction } from '@/api/manage'
import { UI_CACHE_DB_DICT_DATA } from '@/store/mutation-types'
import Vue from 'vue'
export default {
name: "DictList",
mixins:[JeroListMixin],
components: {DictModal, DictItemList,DictDeleteList},
data() {
return {
description: '这是数据字典页面',
visible: false,
// 查询条件
queryParam: {
dictCode: "",
dictName: "",
},
// 表头
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 120,
align: "center",
customRender: function (t, r, index) {
return parseInt(index) + 1;
}
},
{
title: '字典名称',
align: "left",
dataIndex: 'dictName',
},
{
title: '字典编号',
align: "left",
dataIndex: 'dictCode',
},
{
title: '描述',
align: "left",
dataIndex: 'description',
},
{
title: '操作',
dataIndex: 'action',
align: "center",
scopedSlots: {customRender: 'action'},
export default {
name: 'DictList',
mixins: [JeroListMixin],
components: { DictModal, DictItemList, DictDeleteList },
data () {
return {
description: '这是数据字典页面',
visible: false,
// 查询条件
queryParam: {
dictCode: '',
dictName: ''
},
// 表头
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 120,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
],
dict: "",
labelCol: {
xs: {span: 8},
sm: {span: 5},
},
wrapperCol: {
xs: {span: 16},
sm: {span: 19},
{
title: '字典名称',
align: 'left',
dataIndex: 'dictName'
},
url: {
list: "/sys/dict/page",
delete: "/sys/dict/delete",
exportXlsUrl: "sys/dict/exportXls",
importExcelUrl: "sys/dict/importExcel",
refleshCache: "sys/dict/refleshCache",
queryAllDictItems: "sys/dict/queryAllDictItems",
{
title: '字典编号',
align: 'left',
dataIndex: 'dictCode'
},
}
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
}
},
methods: {
getQueryParams() {
var param = Object.assign({}, this.queryParam, this.isorter);
param.field = this.getQueryField();
param.pageNo = this.ipagination.current;
param.pageSize = this.ipagination.pageSize;
if (this.superQueryParams) {
param['superQueryParams'] = encodeURI(this.superQueryParams)
param['superQueryMatchType'] = this.superQueryMatchType
{
title: '描述',
align: 'left',
dataIndex: 'description'
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
scopedSlots: { customRender: 'action' }
}
return filterObj(param);
],
dict: '',
labelCol: {
xs: { span: 8 },
sm: { span: 5 }
},
//取消选择
cancelDict() {
this.dict = "";
this.visible = false;
this.loadData();
wrapperCol: {
xs: { span: 16 },
sm: { span: 19 }
},
//编辑字典数据
editDictItem(record) {
this.$refs.dictItemList.edit(record);
},
// 重置字典类型搜索框的内容
searchReset() {
var that = this;
that.queryParam.dictName = "";
that.queryParam.dictCode = "";
that.loadData(this.ipagination.current);
},
openDeleteList(){
this.$refs.dictDeleteList.show()
},
refleshCache(){
getAction(this.url.refleshCache).then((res) => {
if (res.success) {
//重新加载缓存
getAction(this.url.queryAllDictItems).then((res) => {
if (res.success) {
Vue.ls.remove(UI_CACHE_DB_DICT_DATA)
Vue.ls.set(UI_CACHE_DB_DICT_DATA, res.result, 7 * 24 * 60 * 60 * 1000)
}
})
this.$message.success("刷新缓存完成");
}
}).catch(e=>{
this.$message.warn("刷新缓存失败");
console.log("刷新失败",e)
})
url: {
list: '/sys/dict/page',
delete: '/sys/dict/delete',
exportXlsUrl: 'sys/dict/exportXls',
importExcelUrl: 'sys/dict/importExcel',
refleshCache: 'sys/dict/refleshCache',
queryAllDictItems: 'sys/dict/queryAllDictItems'
}
}
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG.domianURL}/${this.url.importExcelUrl}`
}
},
methods: {
getQueryParams () {
var param = Object.assign({}, this.queryParam, this.isorter)
param.field = this.getQueryField()
param.pageNo = this.ipagination.current
param.pageSize = this.ipagination.pageSize
if (this.superQueryParams) {
param.superQueryParams = encodeURI(this.superQueryParams)
param.superQueryMatchType = this.superQueryMatchType
}
return filterObj(param)
},
watch: {
openKeys(val) {
console.log('openKeys', val)
},
// 取消选择
cancelDict () {
this.dict = ''
this.visible = false
this.loadData()
},
// 编辑字典数据
editDictItem (record) {
this.$refs.dictItemList.edit(record)
},
// 重置字典类型搜索框的内容
searchReset () {
var that = this
that.queryParam.dictName = ''
that.queryParam.dictCode = ''
that.loadData(this.ipagination.current)
},
openDeleteList () {
this.$refs.dictDeleteList.show()
},
refleshCache () {
getAction(this.url.refleshCache).then((res) => {
if (res.success) {
// 重新加载缓存
getAction(this.url.queryAllDictItems).then((res) => {
if (res.success) {
Vue.ls.remove(UI_CACHE_DB_DICT_DATA)
Vue.ls.set(UI_CACHE_DB_DICT_DATA, res.result, 7 * 24 * 60 * 60 * 1000)
}
})
this.$message.success('刷新缓存完成!')
}
}).catch(e => {
this.$message.warn('刷新缓存失败!')
console.log('刷新失败', e)
})
}
},
watch: {
openKeys (val) {
console.log('openKeys', val)
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less'
</style>
</style>
+132 -134
View File
@@ -73,73 +73,73 @@
</template>
<script>
import { filterObj } from '@/utils/util';
import { JeroListMixin } from '@/mixins/JeroListMixin'
import JEllipsis from '@/components/jero/JEllipsis'
import { filterObj } from '@/utils/util'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import JEllipsis from '@/components/jero/JEllipsis'
export default {
name: "LogList",
mixins:[JeroListMixin],
components: {
JEllipsis
},
data () {
return {
description: '这是日志管理页面',
// 查询条件
queryParam: {
ipInfo:'',
createTimeRange:[],
logType:'1',
keyWord:'',
export default {
name: 'LogList',
mixins: [JeroListMixin],
components: {
JEllipsis
},
data () {
return {
description: '这是日志管理页面',
// 查询条件
queryParam: {
ipInfo: '',
createTimeRange: [],
logType: '1',
keyWord: ''
},
tabKey: '1',
// 表头
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
tabKey: "1",
// 表头
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title: '日志内容',
align:"left",
dataIndex: 'logContent',
scopedSlots: { customRender: 'logContent' },
sorter: true
},
{
title: '操作人ID',
dataIndex: 'userid',
align:"center",
sorter: true
},
{
title: '操作人名称',
dataIndex: 'username',
align:"center",
sorter: true
},
{
title: 'IP',
dataIndex: 'ip',
align:"center",
sorter: true
},
{
title: '耗时(毫秒)',
dataIndex: 'costTime',
align:"center",
sorter: true
},
{
title: '日志类型',
dataIndex: 'logType_dictText',
/*customRender:function (text) {
{
title: '日志内容',
align: 'left',
dataIndex: 'logContent',
scopedSlots: { customRender: 'logContent' },
sorter: true
},
{
title: '操作人ID',
dataIndex: 'userid',
align: 'center',
sorter: true
},
{
title: '操作人名称',
dataIndex: 'username',
align: 'center',
sorter: true
},
{
title: 'IP',
dataIndex: 'ip',
align: 'center',
sorter: true
},
{
title: '耗时(毫秒)',
dataIndex: 'costTime',
align: 'center',
sorter: true
},
{
title: '日志类型',
dataIndex: 'logType_dictText',
/* customRender:function (text) {
if(text==1){
return "登录日志";
}else if(text==2){
@@ -147,85 +147,83 @@
}else{
return text;
}
},*/
align:"center",
},
{
title: '创建时间',
dataIndex: 'createTime',
align:"center",
sorter: true
}
],
operateColumn:
}, */
align: 'center'
},
{
title: '创建时间',
dataIndex: 'createTime',
align: 'center',
sorter: true
}
],
operateColumn:
{
title: '操作类型',
dataIndex: 'operateType_dictText',
align:"center",
},
labelCol: {
xs: { span: 1 },
sm: { span: 2 },
},
wrapperCol: {
xs: { span: 10 },
sm: { span: 16 },
},
url: {
list: "/sys/log/page",
align: 'center'
},
labelCol: {
xs: { span: 1 },
sm: { span: 2 }
},
wrapperCol: {
xs: { span: 10 },
sm: { span: 16 }
},
url: {
list: '/sys/log/page'
}
}
},
methods: {
getQueryParams () {
var param = Object.assign({}, this.queryParam, this.isorter)
param.field = this.getQueryField()
param.pageNo = this.ipagination.current
param.pageSize = this.ipagination.pageSize
delete param.createTimeRange // 时间参数不传递后台
if (this.superQueryParams) {
param.superQueryParams = encodeURI(this.superQueryParams)
param.superQueryMatchType = this.superQueryMatchType
}
return filterObj(param)
},
methods: {
getQueryParams(){
var param = Object.assign({}, this.queryParam,this.isorter);
param.field = this.getQueryField();
param.pageNo = this.ipagination.current;
param.pageSize = this.ipagination.pageSize;
delete param.createTimeRange; // 时间参数不传递后台
if (this.superQueryParams) {
param['superQueryParams'] = encodeURI(this.superQueryParams)
param['superQueryMatchType'] = this.superQueryMatchType
}
return filterObj(param);
},
// 重置
searchReset(){
var that = this;
var logType = that.queryParam.logType;
that.queryParam = {}; //清空查询区域参数
that.queryParam.logType = logType;
that.loadData(this.ipagination.current);
},
// 日志类型
callback(key){
// 重置
searchReset () {
var that = this
var logType = that.queryParam.logType
that.queryParam = {} // 清空查询区域参数
that.queryParam.logType = logType
that.loadData(this.ipagination.current)
},
// 日志类型
callback (key) {
// 动态添加操作类型列
if (key == 2) {
this.tabKey = '2'
this.columns.splice(7, 0, this.operateColumn)
} else if (this.columns.length == 9) {
this.tabKey = '1'
this.columns.splice(7, 1)
}
// 动态添加操作类型列
if (key == 2) {
this.tabKey = '2';
this.columns.splice(7, 0, this.operateColumn);
}else if(this.columns.length == 9)
{
this.tabKey = '1';
this.columns.splice(7,1);
}
let that=this;
that.queryParam.logType=key;
that.loadData();
},
onDateChange: function (value, dateString) {
console.log(dateString[0],dateString[1]);
this.queryParam.createTime_begin=dateString[0];
this.queryParam.createTime_end=dateString[1];
},
onDateOk(value) {
console.log(value);
},
const that = this
that.queryParam.logType = key
that.loadData()
},
onDateChange: function (value, dateString) {
console.log(dateString[0], dateString[1])
this.queryParam.createTime_begin = dateString[0]
this.queryParam.createTime_end = dateString[1]
},
onDateOk (value) {
console.log(value)
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less'
</style>
</style>
+129 -129
View File
@@ -80,149 +80,149 @@
</template>
<script>
import PermissionModal from './modules/PermissionModal'
import { getSystemMenuList, getSystemSubmenu, getSystemSubmenuBatch } from '@/api/api'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import PermissionDataRuleList from './PermissionDataRuleList'
import JEllipsis from '@/components/jero/JEllipsis'
import PermissionModal from './modules/PermissionModal'
import { getSystemMenuList, getSystemSubmenu, getSystemSubmenuBatch } from '@/api/api'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import PermissionDataRuleList from './PermissionDataRuleList'
import JEllipsis from '@/components/jero/JEllipsis'
const columns = [
{
title: '菜单名称',
dataIndex: 'name',
key: 'name'
}, {
title: '菜单类型',
dataIndex: 'menuType',
key: 'menuType',
customRender: function(text) {
if (text == 0) {
return '菜单'
} else if (text == 1) {
return '菜单'
} else if (text == 2) {
return '按钮/权限'
} else {
return text
}
const columns = [
{
title: '菜单名称',
dataIndex: 'name',
key: 'name'
}, {
title: '菜单类型',
dataIndex: 'menuType',
key: 'menuType',
customRender: function (text) {
if (text == 0) {
return '菜单'
} else if (text == 1) {
return '菜单'
} else if (text == 2) {
return '按钮/权限'
} else {
return text
}
},/*{
}
}, /* {
title: '权限编码',
dataIndex: 'perms',
key: 'permissionCode',
},*/{
title: 'icon',
dataIndex: 'icon',
key: 'icon'
},
{
title: '组件',
dataIndex: 'component',
key: 'component',
scopedSlots: { customRender: 'component' }
},
{
title: '路径',
dataIndex: 'url',
key: 'url',
scopedSlots: { customRender: 'url' }
},
{
title: '排序',
dataIndex: 'sortNo',
key: 'sortNo'
},
{
title: '操作',
dataIndex: 'action',
scopedSlots: { customRender: 'action' },
align: 'center',
width: 150
}
]
}, */{
title: 'icon',
dataIndex: 'icon',
key: 'icon'
},
{
title: '组件',
dataIndex: 'component',
key: 'component',
scopedSlots: { customRender: 'component' }
},
{
title: '路径',
dataIndex: 'url',
key: 'url',
scopedSlots: { customRender: 'url' }
},
{
title: '排序',
dataIndex: 'sortNo',
key: 'sortNo'
},
{
title: '操作',
dataIndex: 'action',
scopedSlots: { customRender: 'action' },
align: 'center',
width: 150
}
]
export default {
name: 'PermissionListAsync',
mixins: [JeroListMixin],
components: {
PermissionDataRuleList,
PermissionModal,
JEllipsis
},
data() {
return {
description: '这是菜单管理页面',
// 表头
columns: columns,
loading: false,
// 展开的行,受控属性
expandedRowKeys: [],
url: {
list: '/sys/permission/page',
delete: '/sys/permission/delete',
deleteBatch: '/sys/permission/deleteBatch'
export default {
name: 'PermissionListAsync',
mixins: [JeroListMixin],
components: {
PermissionDataRuleList,
PermissionModal,
JEllipsis
},
data () {
return {
description: '这是菜单管理页面',
// 表头
columns: columns,
loading: false,
// 展开的行,受控属性
expandedRowKeys: [],
url: {
list: '/sys/permission/page',
delete: '/sys/permission/delete',
deleteBatch: '/sys/permission/deleteBatch'
}
}
},
methods: {
loadData () {
this.loading = true
getSystemMenuList().then((res) => {
if (res.success) {
this.dataSource = res.result
return this.loadDataByExpandedRows(this.dataSource)
}
}).finally(() => {
this.loading = false
})
},
expandSubmenu (expanded, record) {
if (expanded && (!record.children || record.children.length === 0)) {
getSystemSubmenu({ parentId: record.id }).then((res) => {
if (res.success) {
record.children = res.result
}
})
}
},
methods: {
loadData() {
this.loading = true
getSystemMenuList().then((res) => {
// 根据已展开的行查询数据(用于保存后刷新时异步加载子级的数据)
loadDataByExpandedRows (dataList) {
if (this.expandedRowKeys.length > 0) {
return getSystemSubmenuBatch({ parentIds: this.expandedRowKeys.join(',') }).then((res) => {
if (res.success) {
this.dataSource = res.result
return this.loadDataByExpandedRows(this.dataSource)
}
}).finally(()=>{
this.loading = false
})
},
expandSubmenu(expanded, record){
if (expanded && (!record.children || record.children.length === 0)) {
getSystemSubmenu({parentId:record.id}).then((res) => {
if (res.success) {
record.children = res.result
}
})
}
},
// 根据已展开的行查询数据(用于保存后刷新时异步加载子级的数据)
loadDataByExpandedRows(dataList) {
if (this.expandedRowKeys.length > 0) {
return getSystemSubmenuBatch({ parentIds: this.expandedRowKeys.join(',') }).then((res) => {
if (res.success) {
let childrenMap = res.result
let fn = (list) => {
if(list&&list.length>0){
list.forEach(data => {
if (this.expandedRowKeys.includes(data.id)) {
data.children = childrenMap[data.id]
fn(data.children)
}
})
}
const childrenMap = res.result
const fn = (list) => {
if (list && list.length > 0) {
list.forEach(data => {
if (this.expandedRowKeys.includes(data.id)) {
data.children = childrenMap[data.id]
fn(data.children)
}
})
}
fn(dataList)
}
})
} else {
return Promise.resolve()
}
},
// 打开数据规则编辑
handleDataRule(record) {
this.$refs.PermissionDataRuleList.edit(record)
},
handleAddSub(record) {
this.$refs.modalForm.title = "添加子菜单";
this.$refs.modalForm.disableSubmit = false;
this.$refs.modalForm.edit({status:'1',permsType:'1',route:true,'parentId':record.id,menuType:1});
},
handleExpandedRowsChange(expandedRows) {
this.expandedRowKeys = expandedRows
},
fn(dataList)
}
})
} else {
return Promise.resolve()
}
},
// 打开数据规则编辑
handleDataRule (record) {
this.$refs.PermissionDataRuleList.edit(record)
},
handleAddSub (record) {
this.$refs.modalForm.title = '添加子菜单'
this.$refs.modalForm.disableSubmit = false
this.$refs.modalForm.edit({ status: '1', permsType: '1', route: true, parentId: record.id, menuType: 1 })
},
handleExpandedRowsChange (expandedRows) {
this.expandedRowKeys = expandedRows
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
</style>
@@ -64,120 +64,120 @@
</a-drawer>
</template>
<script>
import {getPermissionRuleList, queryPermissionRule} from '@/api/api'
import {JeroListMixin} from '@/mixins/JeroListMixin'
import PermissionDataRuleModal from './modules/PermissionDataRuleModal'
import { getPermissionRuleList, queryPermissionRule } from '@/api/api'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import PermissionDataRuleModal from './modules/PermissionDataRuleModal'
const columns = [
{
title: '规则名称',
dataIndex: 'ruleName',
key: 'ruleName'
},
{
title: '规则字段',
dataIndex: 'ruleColumn',
key: 'ruleColumn'
},
{
title: '规则值',
dataIndex: 'ruleValue',
key: 'ruleValue'
},
{
title: '操作',
dataIndex: 'action',
scopedSlots: {customRender: 'action'},
align: 'center'
}
]
export default {
name: 'PermissionDataRuleList',
mixins: [JeroListMixin],
components: {
PermissionDataRuleModal
},
data() {
return {
queryParam: {},
drawerWidth: 650,
columns: columns,
permId: '',
visible: false,
form: this.$form.createForm(this),
loading: false,
url: {
list: "/sys/permission/getPermRuleListByPermId",
delete: "/sys/permission/deletePermissionRule",
},
const columns = [
{
title: '规则名称',
dataIndex: 'ruleName',
key: 'ruleName'
},
{
title: '规则字段',
dataIndex: 'ruleColumn',
key: 'ruleColumn'
},
{
title: '规则值',
dataIndex: 'ruleValue',
key: 'ruleValue'
},
{
title: '操作',
dataIndex: 'action',
scopedSlots: { customRender: 'action' },
align: 'center'
}
]
export default {
name: 'PermissionDataRuleList',
mixins: [JeroListMixin],
components: {
PermissionDataRuleModal
},
data () {
return {
queryParam: {},
drawerWidth: 650,
columns: columns,
permId: '',
visible: false,
form: this.$form.createForm(this),
loading: false,
url: {
list: '/sys/permission/getPermRuleListByPermId',
delete: '/sys/permission/deletePermissionRule'
}
}
},
created () {
this.resetScreenSize()
},
methods: {
loadData () {
// 20190908 scott for: 首次进入菜单列表的时候,不加载权限列表
if (!this.permId) {
return
}
const that = this
this.dataSource = []
var params = this.getQueryParams()// 查询条件
getPermissionRuleList(params).then((res) => {
if (res.success) {
that.dataSource = res.result
}
})
},
created() {
edit (record) {
if (record.id) {
this.visible = true
this.permId = record.id
}
this.queryParam = {}
this.queryParam.permissionId = record.id
this.visible = true
this.loadData()
this.resetScreenSize()
},
methods: {
loadData() {
//20190908 scott for: 首次进入菜单列表的时候,不加载权限列表
if(!this.permId){
return
}
let that = this
this.dataSource = []
var params = this.getQueryParams()//查询条件
getPermissionRuleList(params).then((res) => {
if (res.success) {
that.dataSource = res.result
}
})
},
edit(record) {
if (record.id) {
this.visible = true
this.permId = record.id
}
this.queryParam = {}
this.queryParam.permissionId = record.id
this.visible = true
this.loadData()
this.resetScreenSize()
},
addPermissionRule() {
this.$refs.modalForm.add(this.permId)
this.$refs.modalForm.title = '新增'
},
searchQuery() {
var params = this.getQueryParams();
params.permissionId = this.permId;
queryPermissionRule(params).then((res) => {
if (res.success) {
this.dataSource = res.result
}
})
},
searchReset() {
this.queryParam = {}
this.queryParam.permissionId = this.permId
this.loadData(1);
},
onClose() {
this.visible = false
},
// 根据屏幕变化,设置抽屉尺寸
resetScreenSize() {
let screenWidth = document.body.clientWidth
if (screenWidth < 500) {
this.drawerWidth = screenWidth
} else {
this.drawerWidth = 650
}
},
getRowClassname(record){
if(record.status!=1){
return "data-rule-invalid"
addPermissionRule () {
this.$refs.modalForm.add(this.permId)
this.$refs.modalForm.title = '新增'
},
searchQuery () {
var params = this.getQueryParams()
params.permissionId = this.permId
queryPermissionRule(params).then((res) => {
if (res.success) {
this.dataSource = res.result
}
})
},
searchReset () {
this.queryParam = {}
this.queryParam.permissionId = this.permId
this.loadData(1)
},
onClose () {
this.visible = false
},
// 根据屏幕变化,设置抽屉尺寸
resetScreenSize () {
const screenWidth = document.body.clientWidth
if (screenWidth < 500) {
this.drawerWidth = screenWidth
} else {
this.drawerWidth = 650
}
},
getRowClassname (record) {
if (record.status != 1) {
return 'data-rule-invalid'
}
}
}
}
</script>
<style>
@@ -185,4 +185,4 @@
background: #f4f4f4;
color: #bababa;
}
</style>
</style>
+100 -100
View File
@@ -80,116 +80,116 @@
</template>
<script>
import PermissionModal from './modules/PermissionModal'
import { getPermissionList } from '@/api/api'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import PermissionDataRuleList from './PermissionDataRuleList'
import JEllipsis from '@/components/jero/JEllipsis'
import PermissionModal from './modules/PermissionModal'
import { getPermissionList } from '@/api/api'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import PermissionDataRuleList from './PermissionDataRuleList'
import JEllipsis from '@/components/jero/JEllipsis'
const columns = [
{
title: '菜单名称',
dataIndex: 'name',
key: 'name'
}, {
title: '菜单类型',
dataIndex: 'menuType',
key: 'menuType',
customRender: function(text) {
if (text == 0) {
return '菜单'
} else if (text == 1) {
return '菜单'
} else if (text == 2) {
return '按钮/权限'
} else {
return text
}
const columns = [
{
title: '菜单名称',
dataIndex: 'name',
key: 'name'
}, {
title: '菜单类型',
dataIndex: 'menuType',
key: 'menuType',
customRender: function (text) {
if (text == 0) {
return '菜单'
} else if (text == 1) {
return '菜单'
} else if (text == 2) {
return '按钮/权限'
} else {
return text
}
},/*{
}
}, /* {
title: '权限编码',
dataIndex: 'perms',
key: 'permissionCode',
},*/{
title: 'icon',
dataIndex: 'icon',
key: 'icon'
},
{
title: '组件',
dataIndex: 'component',
key: 'component',
scopedSlots: { customRender: 'component' }
},
{
title: '路径',
dataIndex: 'url',
key: 'url',
scopedSlots: { customRender: 'url' }
},
{
title: '排序',
dataIndex: 'sortNo',
key: 'sortNo'
},
{
title: '操作',
dataIndex: 'action',
fixed: 'right',
scopedSlots: { customRender: 'action' },
align: 'center',
width: 150
}
]
}, */{
title: 'icon',
dataIndex: 'icon',
key: 'icon'
},
{
title: '组件',
dataIndex: 'component',
key: 'component',
scopedSlots: { customRender: 'component' }
},
{
title: '路径',
dataIndex: 'url',
key: 'url',
scopedSlots: { customRender: 'url' }
},
{
title: '排序',
dataIndex: 'sortNo',
key: 'sortNo'
},
{
title: '操作',
dataIndex: 'action',
fixed: 'right',
scopedSlots: { customRender: 'action' },
align: 'center',
width: 150
}
]
export default {
name: 'PermissionList',
mixins: [JeroListMixin],
components: {
PermissionDataRuleList,
PermissionModal,
JEllipsis
},
data() {
return {
description: '这是菜单管理页面',
// 表头
columns: columns,
loading: false,
// 展开的行,受控属性
expandedRowKeys: [],
url: {
list: '/sys/permission/page',
delete: '/sys/permission/delete',
deleteBatch: '/sys/permission/deleteBatch'
}
export default {
name: 'PermissionList',
mixins: [JeroListMixin],
components: {
PermissionDataRuleList,
PermissionModal,
JEllipsis
},
data () {
return {
description: '这是菜单管理页面',
// 表头
columns: columns,
loading: false,
// 展开的行,受控属性
expandedRowKeys: [],
url: {
list: '/sys/permission/page',
delete: '/sys/permission/delete',
deleteBatch: '/sys/permission/deleteBatch'
}
}
},
methods: {
loadData () {
this.dataSource = []
getPermissionList().then((res) => {
if (res.success) {
console.log(res.result)
this.dataSource = res.result
}
})
},
methods: {
loadData() {
this.dataSource = []
getPermissionList().then((res) => {
if (res.success) {
console.log(res.result)
this.dataSource = res.result
}
})
},
// 打开数据规则编辑
handleDataRule(record) {
this.$refs.PermissionDataRuleList.edit(record)
},
handleAddSub(record) {
this.$refs.modalForm.title = "添加子菜单";
this.$refs.modalForm.disableSubmit = false;
this.$refs.modalForm.edit({status:'1',permsType:'1',route:true,'parentId':record.id,menuType:1});
},
handleExpandedRowsChange(expandedRows) {
this.expandedRowKeys = expandedRows
},
// 打开数据规则编辑
handleDataRule (record) {
this.$refs.PermissionDataRuleList.edit(record)
},
handleAddSub (record) {
this.$refs.modalForm.title = '添加子菜单'
this.$refs.modalForm.disableSubmit = false
this.$refs.modalForm.edit({ status: '1', permsType: '1', route: true, parentId: record.id, menuType: 1 })
},
handleExpandedRowsChange (expandedRows) {
this.expandedRowKeys = expandedRows
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
</style>
+167 -169
View File
@@ -74,7 +74,6 @@
<j-ellipsis :value="text" :length="20" />
</span>
<span slot="action" slot-scope="text, record">
<a @click="resumeJob(record)" v-if="record.status==-1">启动</a>
<a @click="pauseJob(record)" v-if="record.status==0">停止</a>
@@ -109,181 +108,180 @@
</template>
<script>
import QuartzJobModal from './modules/QuartzJobModal'
import { getAction } from '@/api/manage'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import JEllipsis from "@/components/jero/JEllipsis";
import QuartzJobModal from './modules/QuartzJobModal'
import { getAction } from '@/api/manage'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import JEllipsis from '@/components/jero/JEllipsis'
export default {
name: "QuartzJobList",
mixins:[JeroListMixin],
components: {
QuartzJobModal,
JEllipsis
},
data () {
return {
description: '定时任务在线管理',
// 查询条件
queryParam: {},
// 表头
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title: '任务类名',
align:"center",
dataIndex: 'jobClassName',
sorter: true,
/* customRender:function (text) {
return "*"+text.substring(9,text.length);
}*/
},
{
title: 'cron表达式',
align:"center",
dataIndex: 'cronExpression'
},
{
title: '参数',
align:"center",
width: 150,
dataIndex: 'parameter',
scopedSlots: {customRender: 'parameterRender'},
},
{
title: '描述',
align:"center",
width: 250,
dataIndex: 'description',
scopedSlots: {customRender: 'description'},
},
{
title: '状态',
align:"center",
dataIndex: 'status',
scopedSlots: { customRender: 'customRenderStatus' },
filterMultiple: false,
filters: [
{ text: '已启动', value: '0' },
{ text: '已暂停', value: '-1' },
]
},
{
title: '操作',
dataIndex: 'action',
align:"center",
width:180,
scopedSlots: { customRender: 'action' },
export default {
name: 'QuartzJobList',
mixins: [JeroListMixin],
components: {
QuartzJobModal,
JEllipsis
},
data () {
return {
description: '定时任务在线管理',
// 查询条件
queryParam: {},
// 表头
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
],
url: {
list: "/sys/quartzJob/page",
delete: "/sys/quartzJob/delete",
deleteBatch: "/sys/quartzJob/deleteBatch",
pause: "/sys/quartzJob/pause",
resume: "/sys/quartzJob/resume",
exportXlsUrl: "sys/quartzJob/exportXls",
importExcelUrl: "sys/quartzJob/importExcel",
execute: "sys/quartzJob/execute"
},
}
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
}
},
methods: {
//筛选需要重写handleTableChange
handleTableChange(pagination, filters, sorter) {
//分页、排序、筛选变化时触发
//TODO 筛选
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field;
this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
{
title: '任务类名',
align: 'center',
dataIndex: 'jobClassName',
sorter: true
/* customRender:function (text) {
return "*"+text.substring(9,text.length);
} */
},
{
title: 'cron表达式',
align: 'center',
dataIndex: 'cronExpression'
},
{
title: '参数',
align: 'center',
width: 150,
dataIndex: 'parameter',
scopedSlots: { customRender: 'parameterRender' }
},
{
title: '描述',
align: 'center',
width: 250,
dataIndex: 'description',
scopedSlots: { customRender: 'description' }
},
{
title: '状态',
align: 'center',
dataIndex: 'status',
scopedSlots: { customRender: 'customRenderStatus' },
filterMultiple: false,
filters: [
{ text: '已启动', value: '0' },
{ text: '已暂停', value: '-1' }
]
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
width: 180,
scopedSlots: { customRender: 'action' }
}
//这种筛选方式只支持单选
// update-begin-author:liusq date:20210624 for:前台定时任务无法翻页 #2666
if(filters && Object.keys(filters).length>0 && filters.status){
this.filters.status = filters.status[0];
}
// update-end-author:liusq date:20210624 for:前台定时任务无法翻页 #2666
this.ipagination = pagination;
this.loadData();
},
pauseJob: function(record){
var that = this;
//暂停定时任务
this.$confirm({
title:"确认暂停",
content:"是否暂停选中任务?",
onOk: function(){
getAction(that.url.pause,{id:record.id}).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.loadData();
that.onClearSelected();
}else{
that.$message.warning(res.message);
}
});
}
});
},
resumeJob: function(record){
var that = this;
//恢复定时任务
this.$confirm({
title:"确认启动",
content:"是否启动选中任务?",
onOk: function(){
getAction(that.url.resume,{id:record.id}).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.loadData();
that.onClearSelected();
}else{
that.$message.warning(res.message);
}
});
}
});
},
executeImmediately(record){
var that = this;
//立即执行定时任务
this.$confirm({
title:"确认提示",
content:"是否立即执行任务?",
onOk: function(){
getAction(that.url.execute,{id:record.id}).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.loadData();
that.onClearSelected();
}else{
that.$message.warning(res.message);
}
});
}
});
],
url: {
list: '/sys/quartzJob/page',
delete: '/sys/quartzJob/delete',
deleteBatch: '/sys/quartzJob/deleteBatch',
pause: '/sys/quartzJob/pause',
resume: '/sys/quartzJob/resume',
exportXlsUrl: 'sys/quartzJob/exportXls',
importExcelUrl: 'sys/quartzJob/importExcel',
execute: 'sys/quartzJob/execute'
}
}
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG.domianURL}/${this.url.importExcelUrl}`
}
},
methods: {
// 筛选需要重写handleTableChange
handleTableChange (pagination, filters, sorter) {
// 分页、排序、筛选变化时触发
// TODO 筛选
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field
this.isorter.order = sorter.order == 'ascend' ? 'asc' : 'desc'
}
// 这种筛选方式只支持单选
// update-begin-author:liusq date:20210624 for:前台定时任务无法翻页 #2666
if (filters && Object.keys(filters).length > 0 && filters.status) {
this.filters.status = filters.status[0]
}
// update-end-author:liusq date:20210624 for:前台定时任务无法翻页 #2666
this.ipagination = pagination
this.loadData()
},
pauseJob: function (record) {
var that = this
// 暂停定时任务
this.$confirm({
title: '确认暂停',
content: '是否暂停选中任务?',
onOk: function () {
getAction(that.url.pause, { id: record.id }).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loadData()
that.onClearSelected()
} else {
that.$message.warning(res.message)
}
})
}
})
},
resumeJob: function (record) {
var that = this
// 恢复定时任务
this.$confirm({
title: '确认启动',
content: '是否启动选中任务?',
onOk: function () {
getAction(that.url.resume, { id: record.id }).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loadData()
that.onClearSelected()
} else {
that.$message.warning(res.message)
}
})
}
})
},
executeImmediately (record) {
var that = this
// 立即执行定时任务
this.$confirm({
title: '确认提示',
content: '是否立即执行任务?',
onOk: function () {
getAction(that.url.execute, { id: record.id }).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loadData()
that.onClearSelected()
} else {
that.$message.warning(res.message)
}
})
}
})
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less'
</style>
</style>
+82 -83
View File
@@ -86,7 +86,6 @@
</a-dropdown>
</span>
</a-table>
</div>
<!-- table区域-end -->
@@ -98,96 +97,96 @@
</template>
<script>
import RoleModal from './modules/RoleModal'
import UserRoleModal from './modules/UserRoleModal'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import JDate from '@/components/jero/JDate'
import RoleModal from './modules/RoleModal'
import UserRoleModal from './modules/UserRoleModal'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import JDate from '@/components/jero/JDate'
export default {
name: "RoleList",
mixins:[JeroListMixin],
components: {
RoleModal,
UserRoleModal,
JDate
},
data () {
return {
export default {
name: 'RoleList',
mixins: [JeroListMixin],
components: {
RoleModal,
UserRoleModal,
JDate
},
data () {
return {
description: '角色管理页面',
// 查询条件
queryParam: {roleName:'',},
// 表头
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title: '角色名称',
align:"center",
dataIndex: 'roleName'
},
{
title: '角色编码',
align:"center",
dataIndex: 'roleCode'
},
{
title: '备注',
align:"center",
dataIndex: 'description'
},
{
title: '创建时间',
dataIndex: 'createTime',
align:"center",
sorter: true
},
{
title: '更新时间',
dataIndex: 'updateTime',
align:"center",
sorter: true
},
{
title: '操作',
dataIndex: 'action',
align:"center",
scopedSlots: { customRender: 'action' },
description: '角色管理页面',
// 查询条件
queryParam: { roleName: '' },
// 表头
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
],
url: {
list: "/sys/role/page",
delete: "/sys/role/delete",
deleteBatch: "/sys/role/deleteBatch",
exportXlsUrl: "/sys/role/exportXls",
importExcelUrl: "sys/role/importExcel",
},
{
title: '角色名称',
align: 'center',
dataIndex: 'roleName'
},
{
title: '角色编码',
align: 'center',
dataIndex: 'roleCode'
},
{
title: '备注',
align: 'center',
dataIndex: 'description'
},
{
title: '创建时间',
dataIndex: 'createTime',
align: 'center',
sorter: true
},
{
title: '更新时间',
dataIndex: 'updateTime',
align: 'center',
sorter: true
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
scopedSlots: { customRender: 'action' }
}
],
url: {
list: '/sys/role/page',
delete: '/sys/role/delete',
deleteBatch: '/sys/role/deleteBatch',
exportXlsUrl: '/sys/role/exportXls',
importExcelUrl: 'sys/role/importExcel'
}
}
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG.domianURL}/${this.url.importExcelUrl}`
}
},
methods: {
handlePerssion: function (roleId) {
// alert(roleId);
this.$refs.modalUserRole.show(roleId)
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
}
},
methods: {
handlePerssion: function(roleId){
// alert(roleId);
this.$refs.modalUserRole.show(roleId);
},
onChangeDate(date, dateString) {
console.log(date, dateString);
},
onChangeDate (date, dateString) {
console.log(date, dateString)
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less'
</style>
</style>
+301 -305
View File
@@ -178,75 +178,75 @@
</a-row>
</template>
<script>
import { JeroListMixin } from '@/mixins/JeroListMixin'
import { deleteAction, postAction, getAction } from '@/api/manage'
import SelectUserModal from './modules/SelectUserModal'
import RoleModal from './modules/RoleModal'
import UserModal from './modules/UserModal'
import { filterObj } from '@/utils/util'
import UserRoleModal from './modules/UserRoleModal'
import moment from 'moment'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import { deleteAction, postAction, getAction } from '@/api/manage'
import SelectUserModal from './modules/SelectUserModal'
import RoleModal from './modules/RoleModal'
import UserModal from './modules/UserModal'
import { filterObj } from '@/utils/util'
import UserRoleModal from './modules/UserRoleModal'
import moment from 'moment'
export default {
name: 'RoleUserList',
mixins: [JeroListMixin],
components: {
UserRoleModal,
SelectUserModal,
RoleModal,
UserModal,
moment
},
data() {
return {
model1: {},
model2: {},
currentRoleId: '',
queryParam1: {},
queryParam2: {},
dataSource1: [],
dataSource2: [],
ipagination1: {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '20', '30'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' 共' + total + '条'
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
export default {
name: 'RoleUserList',
mixins: [JeroListMixin],
components: {
UserRoleModal,
SelectUserModal,
RoleModal,
UserModal,
moment
},
data () {
return {
model1: {},
model2: {},
currentRoleId: '',
queryParam1: {},
queryParam2: {},
dataSource1: [],
dataSource2: [],
ipagination1: {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '20', '30'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' 共' + total + '条'
},
ipagination2: {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '20', '30'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' 共' + total + '条'
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
ipagination2: {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '20', '30'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' 共' + total + '条'
},
isorter1: {
column: 'createTime',
order: 'desc'
},
isorter2: {
column: 'createTime',
order: 'desc'
},
filters1: {},
filters2: {},
loading1: false,
loading2: false,
selectedRowKeys1: [],
selectedRowKeys2: [],
selectionRows1: [],
selectionRows2: [],
test:{},
rightcolval:0,
columns:
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
isorter1: {
column: 'createTime',
order: 'desc'
},
isorter2: {
column: 'createTime',
order: 'desc'
},
filters1: {},
filters2: {},
loading1: false,
loading2: false,
selectedRowKeys1: [],
selectedRowKeys2: [],
selectionRows1: [],
selectionRows2: [],
test: {},
rightcolval: 0,
columns:
[
{
title: '角色编码',
@@ -261,7 +261,7 @@
{
title: '创建时间',
dataIndex: 'createTime',
align:"center",
align: 'center',
sorter: true,
customRender: (text) => {
return moment(text).format('YYYY-MM-DD')
@@ -274,271 +274,267 @@
scopedSlots: { customRender: 'action' }
}
],
columns2: [{
title: '用户账号',
align: 'center',
dataIndex: 'username',
width: 120
},
{
title: '用户名称',
align: 'center',
width: 100,
dataIndex: 'realname'
},
{
title: '状态',
align: 'center',
width: 80,
dataIndex: 'status_dictText'
},
columns2: [{
title: '用户账号',
align: 'center',
dataIndex: 'username',
width: 120
},
{
title: '用户名称',
align: 'center',
width: 100,
dataIndex: 'realname'
},
{
title: '状态',
align: 'center',
width: 80,
dataIndex: 'status_dictText'
},
{
title: '操作',
dataIndex: 'action',
scopedSlots: { customRender: 'action' },
align: 'center',
width: 120
}],
{
title: '操作',
dataIndex: 'action',
scopedSlots: { customRender: 'action' },
align: 'center',
width: 120
}],
// 高级查询参数
superQueryParams2: '',
// 高级查询拼接条件
superQueryMatchType2: 'and',
url: {
list: '/sys/role/page',
delete: '/sys/role/delete',
list2: '/sys/user/userRoleList',
addUserRole: '/sys/user/addSysUserRole',
delete2: '/sys/user/deleteUserRole',
deleteBatch2: '/sys/user/deleteUserRoleBatch',
exportXlsUrl: 'sys/role/exportXls',
importExcelUrl: 'sys/role/importExcel'
}
// 高级查询参数
superQueryParams2: '',
// 高级查询拼接条件
superQueryMatchType2: 'and',
url: {
list: '/sys/role/page',
delete: '/sys/role/delete',
list2: '/sys/user/userRoleList',
addUserRole: '/sys/user/addSysUserRole',
delete2: '/sys/user/deleteUserRole',
deleteBatch2: '/sys/user/deleteUserRoleBatch',
exportXlsUrl: 'sys/role/exportXls',
importExcelUrl: 'sys/role/importExcel'
}
}
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG.domianURL}/${this.url.importExcelUrl}`
},
computed: {
importExcelUrl: function() {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
},
leftColMd() {
return this.selectedRowKeys1.length === 0 ? 24 : 12
},
rightColMd() {
return this.selectedRowKeys1.length === 0 ? 0 : 12
}
leftColMd () {
return this.selectedRowKeys1.length === 0 ? 24 : 12
},
rightColMd () {
return this.selectedRowKeys1.length === 0 ? 0 : 12
}
},
methods: {
onSelectChange2 (selectedRowKeys, selectionRows) {
this.selectedRowKeys2 = selectedRowKeys
this.selectionRows2 = selectionRows
},
onClearSelected2 () {
this.selectedRowKeys2 = []
this.selectionRows2 = []
},
onClearSelected1 () {
this.selectedRowKeys1 = []
this.selectionRows1 = []
},
onSelectChange1 (selectedRowKeys, selectionRows) {
this.rightcolval = 1
this.selectedRowKeys1 = selectedRowKeys
this.selectionRows1 = selectionRows
this.model1 = Object.assign({}, selectionRows[0])
console.log(this.model1)
this.currentRoleId = selectedRowKeys[0]
this.loadData2()
},
onClearSelected () {
},
methods: {
onSelectChange2(selectedRowKeys, selectionRows) {
this.selectedRowKeys2 = selectedRowKeys
this.selectionRows2 = selectionRows
},
onClearSelected2() {
this.selectedRowKeys2 = []
this.selectionRows2 = []
},
onClearSelected1() {
this.selectedRowKeys1 = []
this.selectionRows1 = []
},
onSelectChange1(selectedRowKeys, selectionRows) {
this.rightcolval = 1
this.selectedRowKeys1 = selectedRowKeys
this.selectionRows1 = selectionRows
this.model1 = Object.assign({}, selectionRows[0])
console.log(this.model1)
this.currentRoleId = selectedRowKeys[0]
this.loadData2()
},
onClearSelected() {
},
getQueryParams2() {
//获取查询条件
let sqp = {}
if (this.superQueryParams2) {
sqp['superQueryParams'] = encodeURI(this.superQueryParams2)
sqp['superQueryMatchType'] = this.superQueryMatchType2
}
var param = Object.assign(sqp, this.queryParam2, this.isorter2, this.filters2)
param.field = this.getQueryField2()
param.pageNo = this.ipagination2.current
param.pageSize = this.ipagination2.pageSize
return filterObj(param)
},
getQueryField2() {
//TODO 字段权限控制
var str = 'id,'
this.columns2.forEach(function(value) {
str += ',' + value.dataIndex
})
return str
},
handleEdit2: function(record) {
this.$refs.modalForm2.title = '编辑'
getQueryParams2 () {
// 获取查询条件
const sqp = {}
if (this.superQueryParams2) {
sqp.superQueryParams = encodeURI(this.superQueryParams2)
sqp.superQueryMatchType = this.superQueryMatchType2
}
var param = Object.assign(sqp, this.queryParam2, this.isorter2, this.filters2)
param.field = this.getQueryField2()
param.pageNo = this.ipagination2.current
param.pageSize = this.ipagination2.pageSize
return filterObj(param)
},
getQueryField2 () {
// TODO 字段权限控制
var str = 'id,'
this.columns2.forEach(function (value) {
str += ',' + value.dataIndex
})
return str
},
handleEdit2: function (record) {
this.$refs.modalForm2.title = '编辑'
this.$refs.modalForm2.roleDisabled = true
this.$refs.modalForm2.edit(record)
},
handleAdd2: function () {
if (this.currentRoleId == '') {
this.$message.error('请选择一个角色!')
} else {
this.$refs.modalForm2.roleDisabled = true
this.$refs.modalForm2.edit(record)
},
handleAdd2: function() {
if (this.currentRoleId == '') {
this.$message.error('请选择一个角色!')
this.$refs.modalForm2.title = '新增'
this.$refs.modalForm2.edit({ activitiSync: '1', userIdentity: 1, selectedroles: this.currentRoleId })
}
},
modalFormOk2 () {
// 新增/修改 成功时,重载列表
this.loadData2()
},
loadData2 (arg) {
if (!this.url.list2) {
this.$message.error('请设置url.list2属性!')
return
}
// 加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination2.current = 1
}
if (this.currentRoleId === '') return
const params = this.getQueryParams2()// 查询条件
params.roleId = this.currentRoleId
this.loading2 = true
getAction(this.url.list2, params).then((res) => {
if (res.success) {
this.dataSource2 = res.result.records
this.ipagination2.total = res.result.total
}
this.loading2 = false
})
},
handleDelete1: function (id) {
this.handleDelete(id)
this.dataSource2 = []
this.currentRoleId = ''
},
handleDelete2: function (id) {
if (!this.url.delete2) {
this.$message.error('请设置url.delete2属性!')
return
}
var that = this
deleteAction(that.url.delete2, { roleId: this.currentRoleId, userId: id }).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loadData2()
} else {
this.$refs.modalForm2.roleDisabled = true
this.$refs.modalForm2.title = '新增'
this.$refs.modalForm2.edit({activitiSync:'1',userIdentity:1,selectedroles:this.currentRoleId})
that.$message.warning(res.message)
}
},
modalFormOk2() {
// 新增/修改 成功时,重载列表
this.loadData2()
},
loadData2(arg) {
if (!this.url.list2) {
this.$message.error('请设置url.list2属性!')
return
}
//加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination2.current = 1
}
if (this.currentRoleId === '') return
let params = this.getQueryParams2()//查询条件
params.roleId = this.currentRoleId
this.loading2 = true
getAction(this.url.list2, params).then((res) => {
if (res.success) {
this.dataSource2 = res.result.records
this.ipagination2.total = res.result.total
}
this.loading2 = false
})
},
handleDelete1: function(id) {
this.handleDelete(id)
this.dataSource2 = []
this.currentRoleId = ''
},
handleDelete2: function(id) {
if (!this.url.delete2) {
this.$message.error('请设置url.delete2属性!')
return
})
},
batchDel2: function () {
if (!this.url.deleteBatch2) {
this.$message.error('请设置url.deleteBatch2属性!')
return
}
if (this.selectedRowKeys2.length <= 0) {
this.$message.warning('请选择一条记录!')
} else {
var ids = ''
for (var a = 0; a < this.selectedRowKeys2.length; a++) {
ids += this.selectedRowKeys2[a] + ','
}
var that = this
deleteAction(that.url.delete2, { roleId: this.currentRoleId, userId: id }).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loadData2()
} else {
that.$message.warning(res.message)
console.log(this.currentDeptId)
this.$confirm({
title: '确认删除',
content: '是否删除选中数据?',
onOk: function () {
deleteAction(that.url.deleteBatch2, { roleId: that.currentRoleId, userIds: ids }).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loadData2()
that.onClearSelected()
} else {
that.$message.warning(res.message)
}
})
}
})
},
batchDel2: function() {
if (!this.url.deleteBatch2) {
this.$message.error('请设置url.deleteBatch2属性!')
return
}
if (this.selectedRowKeys2.length <= 0) {
this.$message.warning('请选择一条记录!')
return
}
},
selectOK (data) {
const params = {}
params.roleId = this.currentRoleId
params.userIdList = []
for (var a = 0; a < data.length; a++) {
params.userIdList.push(data[a])
}
console.log(params)
postAction(this.url.addUserRole, params).then((res) => {
if (res.success) {
this.loadData2()
this.$message.success(res.message)
} else {
var ids = ''
for (var a = 0; a < this.selectedRowKeys2.length; a++) {
ids += this.selectedRowKeys2[a] + ','
}
var that = this
console.log(this.currentDeptId)
this.$confirm({
title: '确认删除',
content: '是否删除选中数据?',
onOk: function() {
deleteAction(that.url.deleteBatch2, { roleId: that.currentRoleId, userIds: ids }).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loadData2()
that.onClearSelected()
} else {
that.$message.warning(res.message)
}
})
}
})
this.$message.warning(res.message)
}
},
selectOK(data) {
let params = {}
params.roleId = this.currentRoleId
params.userIdList = []
for (var a = 0; a < data.length; a++) {
params.userIdList.push(data[a])
}
console.log(params)
postAction(this.url.addUserRole, params).then((res) => {
if (res.success) {
this.loadData2()
this.$message.success(res.message)
} else {
this.$message.warning(res.message)
}
})
},
})
},
handleAddUserRole() {
if (this.currentRoleId == '') {
this.$message.error('请选择一个角色!')
} else {
this.$refs.selectUserModal.visible = true
}
},
handleOpen(record) {
this.rightcolval = 1
this.selectedRowKeys1 = [record.id]
this.model1 = Object.assign({}, record)
this.currentRoleId = record.id
this.onClearSelected2()
this.loadData2()
},
/*handleEdit: function(record) {
handleAddUserRole () {
if (this.currentRoleId == '') {
this.$message.error('请选择一个角色!')
} else {
this.$refs.selectUserModal.visible = true
}
},
handleOpen (record) {
this.rightcolval = 1
this.selectedRowKeys1 = [record.id]
this.model1 = Object.assign({}, record)
this.currentRoleId = record.id
this.onClearSelected2()
this.loadData2()
},
/* handleEdit: function(record) {
if (this.currentRoleId == '') {
this.$message.error('请选择一个角色!')
} else {
this.$refs.modalForm.edit(record)
this.$refs.modalForm.title = '编辑'
}
},*/
searchQuery2() {
this.loadData2(1)
},
searchReset2() {
this.queryParam2 = {}
this.loadData2(1)
},
handleTableChange2(pagination, filters, sorter) {
//分页、排序、筛选变化时触发
//TODO 筛选
if (Object.keys(sorter).length > 0) {
this.isorter2.column = sorter.field
this.isorter2.order = 'ascend' == sorter.order ? 'asc' : 'desc'
}
this.ipagination2 = pagination
this.loadData2()
},
hideUserList(){
//this.rightcolval = 0
this.selectedRowKeys1 = []
},
handlePerssion(roleId){
this.$refs.modalUserRole.show(roleId);
},
}, */
searchQuery2 () {
this.loadData2(1)
},
searchReset2 () {
this.queryParam2 = {}
this.loadData2(1)
},
handleTableChange2 (pagination, filters, sorter) {
// 分页、排序、筛选变化时触发
// TODO 筛选
if (Object.keys(sorter).length > 0) {
this.isorter2.column = sorter.field
this.isorter2.order = sorter.order == 'ascend' ? 'asc' : 'desc'
}
this.ipagination2 = pagination
this.loadData2()
},
hideUserList () {
// this.rightcolval = 0
this.selectedRowKeys1 = []
},
handlePerssion (roleId) {
this.$refs.modalUserRole.show(roleId)
}
}
}
</script>
<style scoped>
/** Button按钮间距 */
.ant-btn {
margin-left: 8px
}
</style>
</style>
+166 -166
View File
@@ -112,56 +112,56 @@
</template>
<script>
import SysAnnouncementModal from './modules/SysAnnouncementModal'
import {doReleaseData, doReovkeData} from '@/api/api'
import {getAction} from '@/api/manage'
import {JeroListMixin} from '@/mixins/JeroListMixin'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import SysAnnouncementModal from './modules/SysAnnouncementModal'
import { doReleaseData, doReovkeData } from '@/api/api'
import { getAction } from '@/api/manage'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import { ACCESS_TOKEN } from '@/store/mutation-types'
export default {
name: "SysAnnouncementList",
mixins: [JeroListMixin],
components: {
SysAnnouncementModal
},
data() {
return {
description: '系统通告表管理页面',
// 查询条件
queryParam: {},
// 表头
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: "center",
customRender: function (t, r, index) {
return parseInt(index) + 1;
}
},
export default {
name: 'SysAnnouncementList',
mixins: [JeroListMixin],
components: {
SysAnnouncementModal
},
data () {
return {
description: '系统通告表管理页面',
// 查询条件
queryParam: {},
// 表头
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{
title: '标题',
align: "center",
dataIndex: 'titile'
},
{
title: '消息类型',
align: "center",
dataIndex: 'msgCategory',
customRender: function (text) {
if (text == '1') {
return "通知公告";
} else if (text == "2") {
return "系统消息";
} else {
return text;
}
{
title: '标题',
align: 'center',
dataIndex: 'titile'
},
{
title: '消息类型',
align: 'center',
dataIndex: 'msgCategory',
customRender: function (text) {
if (text == '1') {
return '通知公告'
} else if (text == '2') {
return '系统消息'
} else {
return text
}
},
/*{
}
},
/* {
title: '开始时间',
align: "center",
dataIndex: 'startTime'
@@ -170,135 +170,135 @@
title: '结束时间',
align: "center",
dataIndex: 'endTime'
},*/
{
title: '发布人',
align: "center",
dataIndex: 'sender'
},
{
title: '优先级',
align: "center",
dataIndex: 'priority',
customRender: function (text) {
if (text == 'L') {
return "";
} else if (text == "M") {
return "";
} else if (text == "H") {
return "";
} else {
return text;
}
}, */
{
title: '发布人',
align: 'center',
dataIndex: 'sender'
},
{
title: '优先级',
align: 'center',
dataIndex: 'priority',
customRender: function (text) {
if (text == 'L') {
return '低'
} else if (text == 'M') {
return '中'
} else if (text == 'H') {
return '高'
} else {
return text
}
},
{
title: '通告对象',
align: "center",
dataIndex: 'msgType',
customRender: function (text) {
if (text == 'USER') {
return "指定用户";
} else if (text == "ALL") {
return "全体用户";
} else {
return text;
}
}
},
{
title: '通告对象',
align: 'center',
dataIndex: 'msgType',
customRender: function (text) {
if (text == 'USER') {
return '指定用户'
} else if (text == 'ALL') {
return '全体用户'
} else {
return text
}
},
{
title: '发布状态',
align: "center",
dataIndex: 'sendStatus',
customRender: function (text) {
if (text == 0) {
return "未发布";
} else if (text == 1) {
return "已发布";
} else if (text == 2) {
return "已撤销";
} else {
return text;
}
}
},
{
title: '发布状态',
align: 'center',
dataIndex: 'sendStatus',
customRender: function (text) {
if (text == 0) {
return '未发布'
} else if (text == 1) {
return '已发布'
} else if (text == 2) {
return '已撤销'
} else {
return text
}
},
{
title: '发布时间',
align: "center",
dataIndex: 'sendTime'
},
{
title: '撤销时间',
align: "center",
dataIndex: 'cancelTime'
},
/*{
}
},
{
title: '发布时间',
align: 'center',
dataIndex: 'sendTime'
},
{
title: '撤销时间',
align: 'center',
dataIndex: 'cancelTime'
},
/* {
title: '删除状态(0,正常,1已删除)',
align:"center",
dataIndex: 'delFlag'
},*/
{
title: '操作',
dataIndex: 'action',
align: "center",
scopedSlots: {customRender: 'action'},
}
],
detailModal: {visible: false, url: '',},
url: {
list: "/sys/annountCement/page",
delete: "/sys/annountCement/delete",
deleteBatch: "/sys/annountCement/deleteBatch",
releaseDataUrl: "/sys/annountCement/doReleaseData",
reovkeDataUrl: "sys/annountCement/doReovkeData",
exportXlsUrl: "sys/annountCement/exportXls",
importExcelUrl: "sys/annountCement/importExcel",
},
}, */
{
title: '操作',
dataIndex: 'action',
align: 'center',
scopedSlots: { customRender: 'action' }
}
],
detailModal: { visible: false, url: '' },
url: {
list: '/sys/annountCement/page',
delete: '/sys/annountCement/delete',
deleteBatch: '/sys/annountCement/deleteBatch',
releaseDataUrl: '/sys/annountCement/doReleaseData',
reovkeDataUrl: 'sys/annountCement/doReovkeData',
exportXlsUrl: 'sys/annountCement/exportXls',
importExcelUrl: 'sys/annountCement/importExcel'
}
}
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG.domianURL}/${this.url.importExcelUrl}`
}
},
methods: {
// 执行发布操作
releaseData: function (id) {
console.log(id)
var that = this
doReleaseData({ id: id }).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loadData(1)
} else {
that.$message.warning(res.message)
}
})
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
}
// 执行撤销操作
reovkeData: function (id) {
var that = this
doReovkeData({ id: id }).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loadData(1)
this.syncHeadNotic(id)
} else {
that.$message.warning(res.message)
}
})
},
methods: {
//执行发布操作
releaseData: function (id) {
console.log(id);
var that = this;
doReleaseData({id: id}).then((res) => {
if (res.success) {
that.$message.success(res.message);
that.loadData(1);
} else {
that.$message.warning(res.message);
}
});
},
//执行撤销操作
reovkeData: function (id) {
var that = this;
doReovkeData({id: id}).then((res) => {
if (res.success) {
that.$message.success(res.message);
that.loadData(1);
this.syncHeadNotic(id)
} else {
that.$message.warning(res.message);
}
});
},
syncHeadNotic(anntId){
getAction("sys/annountCement/syncNotic",{anntId:anntId})
},
handleDetail:function(record){
const domain = window._CONFIG['domianURL']
const token = this.$ls.get(ACCESS_TOKEN)
this.detailModal.url = `${domain}/sys/annountCement/show/${record.id}?token=${token}`
this.detailModal.visible = true
},
syncHeadNotic (anntId) {
getAction('sys/annountCement/syncNotic', { anntId: anntId })
},
handleDetail: function (record) {
const domain = window._CONFIG.domianURL
const token = this.$ls.get(ACCESS_TOKEN)
this.detailModal.url = `${domain}/sys/annountCement/show/${record.id}?token=${token}`
this.detailModal.visible = true
}
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
@@ -330,4 +330,4 @@
top: 0;
}
</style>
</style>
+251 -253
View File
@@ -55,284 +55,282 @@
<script>
import { getAction } from '@/api/manage'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import SysCategoryModal from './modules/SysCategoryModal'
import { deleteAction } from '@/api/manage'
import { getAction, deleteAction } from '@/api/manage'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import SysCategoryModal from './modules/SysCategoryModal'
export default {
name: "SysCategoryList",
mixins:[JeroListMixin],
components: {
SysCategoryModal
},
data () {
return {
description: '分类字典管理页面',
// 表头
columns: [
{
title:'分类名称',
align:"left",
dataIndex: 'name'
},
{
title:'分类编码',
align:"left",
dataIndex: 'code'
},
{
title: '操作',
dataIndex: 'action',
align:"center",
scopedSlots: { customRender: 'action' },
}
],
url: {
list: "/sys/category/rootList",
childList: "/sys/category/childList",
getChildListBatch: "/sys/category/getChildListBatch",
delete: "/sys/category/delete",
deleteBatch: "/sys/category/deleteBatch",
exportXlsUrl: "/sys/category/exportXls",
importExcelUrl: "sys/category/importExcel",
export default {
name: 'SysCategoryList',
mixins: [JeroListMixin],
components: {
SysCategoryModal
},
data () {
return {
description: '分类字典管理页面',
// 表头
columns: [
{
title: '分类名称',
align: 'left',
dataIndex: 'name'
},
expandedRowKeys:[],
hasChildrenField:"hasChild",
pidField:"pid",
dictOptions:{
{
title: '分类编码',
align: 'left',
dataIndex: 'code'
},
subExpandedKeys:[],
}
},
computed: {
importExcelUrl(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
{
title: '操作',
dataIndex: 'action',
align: 'center',
scopedSlots: { customRender: 'action' }
}
],
url: {
list: '/sys/category/rootList',
childList: '/sys/category/childList',
getChildListBatch: '/sys/category/getChildListBatch',
delete: '/sys/category/delete',
deleteBatch: '/sys/category/deleteBatch',
exportXlsUrl: '/sys/category/exportXls',
importExcelUrl: 'sys/category/importExcel'
},
tableProps() {
let _this = this
return {
// 列表项是否可选择
rowSelection: {
selectedRowKeys: _this.selectedRowKeys,
onChange: (selectedRowKeys) => _this.selectedRowKeys = selectedRowKeys
}
expandedRowKeys: [],
hasChildrenField: 'hasChild',
pidField: 'pid',
dictOptions: {
},
subExpandedKeys: []
}
},
computed: {
importExcelUrl () {
return `${window._CONFIG.domianURL}/${this.url.importExcelUrl}`
},
tableProps () {
const _this = this
return {
// 列表项是否可选择
rowSelection: {
selectedRowKeys: _this.selectedRowKeys,
onChange: (selectedRowKeys) => _this.selectedRowKeys = selectedRowKeys
}
}
}
},
methods: {
loadData (arg) {
if (arg == 1) {
this.ipagination.current = 1
}
this.loading = true
const params = this.getQueryParams()
return new Promise((resolve) => {
getAction(this.url.list, params).then(res => {
if (res.success) {
const result = res.result
if (Number(result.total) > 0) {
this.ipagination.total = Number(result.total)
this.dataSource = this.getDataByResult(res.result.records)
// update--begin--autor:lvdandan-----date:20201204------forJT-31 删除成功后默认展开已展开信息
return this.loadDataByExpandedRows(this.dataSource)
// update--end--autor:lvdandan-----date:20201204------forJT-31 删除成功后默认展开已展开信息
} else {
this.ipagination.total = 0
this.dataSource = []
}
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
})
},
methods: {
loadData(arg){
if(arg==1){
this.ipagination.current=1
}
this.loading = true
let params = this.getQueryParams()
return new Promise((resolve) => {
getAction(this.url.list,params).then(res=>{
if(res.success){
let result = res.result
if(Number(result.total)>0){
this.ipagination.total = Number(result.total)
this.dataSource = this.getDataByResult(res.result.records)
//update--begin--autor:lvdandan-----date:20201204------forJT-31 删除成功后默认展开已展开信息
return this.loadDataByExpandedRows(this.dataSource)
//update--end--autor:lvdandan-----date:20201204------forJT-31 删除成功后默认展开已展开信息
}else{
this.ipagination.total=0
this.dataSource=[]
getDataByResult (result) {
if (result && result.length > 0) {
return result.map(item => {
// 判断是否标记了带有子节点
if (item[this.hasChildrenField] == '1') {
const loadChild = { id: item.id + '_loadChild', name: 'loading...', isLoading: true }
item.children = [loadChild]
}
return item
})
}
},
handleExpand (expanded, record) {
// 判断是否是展开状态
if (expanded) {
this.expandedRowKeys.push(record.id)
if (record.children.length > 0 && record.children[0].isLoading === true) {
const params = this.getQueryParams()// 查询条件
params[this.pidField] = record.id
getAction(this.url.childList, params).then((res) => {
if (res.success) {
if (res.result && res.result.length > 0) {
record.children = this.getDataByResult(res.result)
this.dataSource = [...this.dataSource]
} else {
record.children = ''
record.hasChildrenField = '0'
}
}else{
} else {
this.$message.warning(res.message)
}
}).finally(()=>{
this.loading = false
})
})
},
getDataByResult(result){
if(result && result.length>0){
return result.map(item=>{
//判断是否标记了带有子节点
if(item[this.hasChildrenField]=='1'){
let loadChild = { id: item.id+'_loadChild', name: 'loading...', isLoading: true }
item.children = [loadChild]
}
return item
})
}
},
handleExpand(expanded, record){
// 判断是否是展开状态
if (expanded) {
this.expandedRowKeys.push(record.id)
if (record.children.length>0 && record.children[0].isLoading === true) {
let params = this.getQueryParams();//查询条件
params[this.pidField] = record.id
getAction(this.url.childList,params).then((res)=>{
if(res.success){
if(res.result && res.result.length>0){
record.children = this.getDataByResult(res.result)
this.dataSource = [...this.dataSource]
}else{
record.children=''
record.hasChildrenField='0'
}
}else{
this.$message.warning(res.message)
}
})
}
}else{
let keyIndex = this.expandedRowKeys.indexOf(record.id)
if(keyIndex>=0){
this.expandedRowKeys.splice(keyIndex, 1);
} else {
const keyIndex = this.expandedRowKeys.indexOf(record.id)
if (keyIndex >= 0) {
this.expandedRowKeys.splice(keyIndex, 1)
}
}
},
initDictConfig () {
},
modalFormOk (formData, arr) {
if (!formData.id) {
this.addOk(formData, arr)
} else {
this.editOk(formData, this.dataSource)
this.dataSource = [...this.dataSource]
}
},
editOk (formData, arr) {
if (arr && arr.length > 0) {
for (let i = 0; i < arr.length; i++) {
if (arr[i].id == formData.id) {
arr[i] = formData
break
} else {
this.editOk(formData, arr[i].children)
}
}
},
initDictConfig(){
},
modalFormOk(formData,arr){
if(!formData.id){
this.addOk(formData,arr)
}else{
this.editOk(formData,this.dataSource)
this.dataSource=[...this.dataSource]
}
},
async addOk (formData, arr) {
if (!formData[this.pidField]) {
this.loadData()
} else {
this.expandedRowKeys = []
console.log('22222', arr)
for (const i of arr) {
await this.expandTreeNode(i)
}
},
editOk(formData,arr){
if(arr && arr.length>0){
for(let i=0;i<arr.length;i++){
if(arr[i].id==formData.id){
arr[i]=formData
break
}else{
this.editOk(formData,arr[i].children)
}
}
}
},
async addOk(formData,arr){
if(!formData[this.pidField]){
this.loadData()
}else{
this.expandedRowKeys=[]
console.log("22222",arr)
for(let i of arr){
await this.expandTreeNode(i)
}
}
},
expandTreeNode(nodeId){
return new Promise((resolve,reject)=>{
this.getFormDataById(nodeId,this.dataSource)
let row = this.parentFormData
this.expandedRowKeys.push(nodeId)
let params = this.getQueryParams();//查询条件
params[this.pidField] = nodeId
getAction(this.url.childList,params).then((res)=>{
console.log("11111",res)
if(res.success){
if(res.result && res.result.length>0){
row.children = this.getDataByResult(res.result)
this.dataSource = [...this.dataSource]
resolve()
}else{
row.children=''
row.hasChildrenField='0'
reject()
}
}else{
}
},
expandTreeNode (nodeId) {
return new Promise((resolve, reject) => {
this.getFormDataById(nodeId, this.dataSource)
const row = this.parentFormData
this.expandedRowKeys.push(nodeId)
const params = this.getQueryParams()// 查询条件
params[this.pidField] = nodeId
getAction(this.url.childList, params).then((res) => {
console.log('11111', res)
if (res.success) {
if (res.result && res.result.length > 0) {
row.children = this.getDataByResult(res.result)
this.dataSource = [...this.dataSource]
resolve()
} else {
row.children = ''
row.hasChildrenField = '0'
reject()
}
})
})
},
getFormDataById(id,arr){
if(arr && arr.length>0){
for(let i=0;i<arr.length;i++){
if(arr[i].id==id){
this.parentFormData = arr[i]
}else{
this.getFormDataById(id,arr[i].children)
}
}
}
},
handleAddSub(record){
this.subExpandedKeys = [];
this.getExpandKeysByPid(record.id,this.dataSource,this.dataSource)
this.$refs.modalForm.subExpandedKeys = this.subExpandedKeys;
this.$refs.modalForm.title = "添加子分类";
this.$refs.modalForm.edit({'pid':record.id});
this.$refs.modalForm.disableSubmit = false;
},
handleDelete: function (record) {
let that = this;
deleteAction(that.url.delete, {id: record.id}).then((res) => {
if (res.success) {
//update--begin--autor:lvdandan-----date:20201204------forJT-31 删除成功后默认展开已展开信息
that.loadData();
//update--end--autor:lvdandan-----date:20201204------forJT-31 删除成功后默认展开已展开信息
} else {
that.$message.warning(res.message);
reject()
}
});
},
// 添加子分类时获取所有父级id
getExpandKeysByPid(pid,arr,all){
if(pid && arr && arr.length>0){
for(let i=0;i<arr.length;i++){
if(arr[i].id==pid){
this.subExpandedKeys.push(arr[i].id)
this.getExpandKeysByPid(arr[i]['pid'],all,all)
}else{
this.getExpandKeysByPid(pid,arr[i].children,all)
}
})
})
},
getFormDataById (id, arr) {
if (arr && arr.length > 0) {
for (let i = 0; i < arr.length; i++) {
if (arr[i].id == id) {
this.parentFormData = arr[i]
} else {
this.getFormDataById(id, arr[i].children)
}
}
},
// 根据已展开的行查询数据(用于保存后刷新时异步加载子级的数据)
loadDataByExpandedRows(dataList) {
if (this.expandedRowKeys.length > 0) {
return getAction(this.url.getChildListBatch,{ parentIds: this.expandedRowKeys.join(',') }).then(res=>{
if (res.success && res.result.records.length>0) {
//已展开的数据批量子节点
let records = res.result.records
const listMap = new Map();
for (let item of records) {
let pid = item[this.pidField];
if (this.expandedRowKeys.join(',').includes(pid)) {
let mapList = listMap.get(pid);
if (mapList == null) {
mapList = [];
}
mapList.push(item);
listMap.set(pid, mapList);
}
}
let childrenMap = listMap;
let fn = (list) => {
if(list) {
list.forEach(data => {
if (this.expandedRowKeys.includes(data.id)) {
data.children = this.getDataByResult(childrenMap.get(data.id))
fn(data.children)
}
})
}
}
fn(dataList)
}
})
}
},
handleAddSub (record) {
this.subExpandedKeys = []
this.getExpandKeysByPid(record.id, this.dataSource, this.dataSource)
this.$refs.modalForm.subExpandedKeys = this.subExpandedKeys
this.$refs.modalForm.title = '添加子分类'
this.$refs.modalForm.edit({ pid: record.id })
this.$refs.modalForm.disableSubmit = false
},
handleDelete: function (record) {
const that = this
deleteAction(that.url.delete, { id: record.id }).then((res) => {
if (res.success) {
// update--begin--autor:lvdandan-----date:20201204------forJT-31 删除成功后默认展开已展开信息
that.loadData()
// update--end--autor:lvdandan-----date:20201204------forJT-31 删除成功后默认展开已展开信息
} else {
return Promise.resolve()
that.$message.warning(res.message)
}
},
})
},
// 添加子分类时获取所有父级id
getExpandKeysByPid (pid, arr, all) {
if (pid && arr && arr.length > 0) {
for (let i = 0; i < arr.length; i++) {
if (arr[i].id == pid) {
this.subExpandedKeys.push(arr[i].id)
this.getExpandKeysByPid(arr[i].pid, all, all)
} else {
this.getExpandKeysByPid(pid, arr[i].children, all)
}
}
}
},
// 根据已展开的行查询数据(用于保存后刷新时异步加载子级的数据)
loadDataByExpandedRows (dataList) {
if (this.expandedRowKeys.length > 0) {
return getAction(this.url.getChildListBatch, { parentIds: this.expandedRowKeys.join(',') }).then(res => {
if (res.success && res.result.records.length > 0) {
// 已展开的数据批量子节点
const records = res.result.records
const listMap = new Map()
for (const item of records) {
const pid = item[this.pidField]
if (this.expandedRowKeys.join(',').includes(pid)) {
let mapList = listMap.get(pid)
if (mapList == null) {
mapList = []
}
mapList.push(item)
listMap.set(pid, mapList)
}
}
const childrenMap = listMap
const fn = (list) => {
if (list) {
list.forEach(data => {
if (this.expandedRowKeys.includes(data.id)) {
data.children = this.getDataByResult(childrenMap.get(data.id))
fn(data.children)
}
})
}
}
fn(dataList)
}
})
} else {
return Promise.resolve()
}
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less'
</style>
</style>
+60 -60
View File
@@ -108,71 +108,71 @@
</template>
<script>
import JEllipsis from '@/components/jero/JEllipsis'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import SysCheckRuleModal from './modules/SysCheckRuleModal'
import SysCheckRuleTestModal from './modules/SysCheckRuleTestModal'
import JEllipsis from '@/components/jero/JEllipsis'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import SysCheckRuleModal from './modules/SysCheckRuleModal'
import SysCheckRuleTestModal from './modules/SysCheckRuleTestModal'
export default {
name: 'SysCheckRuleList',
mixins: [JeroListMixin],
components: { SysCheckRuleModal, SysCheckRuleTestModal, JEllipsis },
data() {
return {
description: '编码校验规则管理页面',
// 表头
columns: [
{
title: '#',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: (t, r, i) => i + 1
},
{
title: '规则名称',
align: 'center',
dataIndex: 'ruleName'
},
{
title: '规则Code',
align: 'center',
dataIndex: 'ruleCode'
},
{
title: '规则描述',
align: 'center',
dataIndex: 'ruleDescription',
customRender: (t) => (<j-ellipsis value={t} length={48}/>)
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
scopedSlots: { customRender: 'action' },
}
],
url: {
list: '/sys/checkRule/page',
delete: '/sys/checkRule/delete',
deleteBatch: '/sys/checkRule/deleteBatch',
exportXlsUrl: 'sys/checkRule/exportXls',
importExcelUrl: 'sys/checkRule/importExcel',
export default {
name: 'SysCheckRuleList',
mixins: [JeroListMixin],
components: { SysCheckRuleModal, SysCheckRuleTestModal, JEllipsis },
data () {
return {
description: '编码校验规则管理页面',
// 表头
columns: [
{
title: '#',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: (t, r, i) => i + 1
},
}
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
}
},
methods: {
handleTest(record) {
this.$refs.testModal.open(record.ruleCode)
{
title: '规则名称',
align: 'center',
dataIndex: 'ruleName'
},
{
title: '规则Code',
align: 'center',
dataIndex: 'ruleCode'
},
{
title: '规则描述',
align: 'center',
dataIndex: 'ruleDescription',
customRender: (t) => (<j-ellipsis value={t} length={48}/>)
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
scopedSlots: { customRender: 'action' }
}
],
url: {
list: '/sys/checkRule/page',
delete: '/sys/checkRule/delete',
deleteBatch: '/sys/checkRule/deleteBatch',
exportXlsUrl: 'sys/checkRule/exportXls',
importExcelUrl: 'sys/checkRule/importExcel'
}
}
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG.domianURL}/${this.url.importExcelUrl}`
}
},
methods: {
handleTest (record) {
this.$refs.testModal.open(record.ruleCode)
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
</style>
+70 -70
View File
@@ -100,79 +100,79 @@
</template>
<script>
import JEllipsis from '@/components/jero/JEllipsis'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import SysDataSourceModal from './modules/SysDataSourceModal'
import JEllipsis from '@/components/jero/JEllipsis'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import SysDataSourceModal from './modules/SysDataSourceModal'
export default {
name: 'SysDataSourceList',
mixins: [JeroListMixin],
components: { JEllipsis, SysDataSourceModal },
data() {
let ellipsis = (v, l = 20) => (<j-ellipsis value={v} length={l}/>)
return {
description: '多数据源管理管理页面',
// 表头
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: (t, r, index) => index + 1
},
{
title: '数据源名称',
align: 'center',
dataIndex: 'name'
},
{
title: '数据库类型',
align: 'center',
dataIndex: 'dbType_dictText'
},
{
title: '驱动类',
align: 'center',
dataIndex: 'dbDriver',
customRender: (t) => ellipsis(t)
},
{
title: '数据源地址',
align: 'center',
dataIndex: 'dbUrl',
customRender: (t) => ellipsis(t)
},
{
title: '用户名',
align: 'center',
dataIndex: 'dbUsername'
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
scopedSlots: { customRender: 'action' },
}
],
url: {
list: '/sys/dataSource/page',
delete: '/sys/dataSource/delete',
deleteBatch: '/sys/dataSource/deleteBatch',
exportXlsUrl: 'sys/dataSource/exportXls',
importExcelUrl: 'sys/dataSource/importExcel',
export default {
name: 'SysDataSourceList',
mixins: [JeroListMixin],
components: { JEllipsis, SysDataSourceModal },
data () {
const ellipsis = (v, l = 20) => (<j-ellipsis value={v} length={l}/>)
return {
description: '多数据源管理管理页面',
// 表头
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: (t, r, index) => index + 1
},
{
title: '数据源名称',
align: 'center',
dataIndex: 'name'
},
{
title: '数据库类型',
align: 'center',
dataIndex: 'dbType_dictText'
},
{
title: '驱动类',
align: 'center',
dataIndex: 'dbDriver',
customRender: (t) => ellipsis(t)
},
{
title: '数据源地址',
align: 'center',
dataIndex: 'dbUrl',
customRender: (t) => ellipsis(t)
},
{
title: '用户名',
align: 'center',
dataIndex: 'dbUsername'
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
scopedSlots: { customRender: 'action' }
}
],
url: {
list: '/sys/dataSource/page',
delete: '/sys/dataSource/delete',
deleteBatch: '/sys/dataSource/deleteBatch',
exportXlsUrl: 'sys/dataSource/exportXls',
importExcelUrl: 'sys/dataSource/importExcel'
}
},
computed: {
importExcelUrl() {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
}
},
methods: {}
}
}
},
computed: {
importExcelUrl () {
return `${window._CONFIG.domianURL}/${this.url.importExcelUrl}`
}
},
methods: {}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
</style>
+80 -80
View File
@@ -97,91 +97,91 @@
</template>
<script>
import { getAction } from '@/api/manage'
import SysFillRuleModal from './modules/SysFillRuleModal'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import { getAction } from '@/api/manage'
import SysFillRuleModal from './modules/SysFillRuleModal'
import { JeroListMixin } from '@/mixins/JeroListMixin'
export default {
name: 'SysFillRuleList',
mixins: [JeroListMixin],
components: { SysFillRuleModal },
data() {
return {
description: '填值规则管理页面',
// 表头
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: (t, r, index) => 1 + index
},
{
title: '规则名称',
align: 'center',
dataIndex: 'ruleName'
},
{
title: '规则Code',
align: 'center',
dataIndex: 'ruleCode'
},
{
title: '规则实现类',
align: 'center',
dataIndex: 'ruleClass'
},
{
title: '规则参数',
align: 'center',
dataIndex: 'ruleParams'
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
scopedSlots: { customRender: 'action' },
}
],
url: {
list: '/sys/fillRule/page',
test: '/sys/fillRule/testFillRule',
delete: '/sys/fillRule/delete',
deleteBatch: '/sys/fillRule/deleteBatch',
exportXlsUrl: '/sys/fillRule/exportXls',
importExcelUrl: '/sys/fillRule/importExcel',
export default {
name: 'SysFillRuleList',
mixins: [JeroListMixin],
components: { SysFillRuleModal },
data () {
return {
description: '填值规则管理页面',
// 表头
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: (t, r, index) => 1 + index
},
}
},
computed: {
importExcelUrl() {
return `${window._CONFIG['domianURL']}${this.url.importExcelUrl}`
}
},
methods: {
handleTest(record) {
let closeLoading = this.$message.loading('生成中...', 0)
getAction(this.url.test, {
ruleCode: record.ruleCode
}).then(res => {
if (res.success) {
this.$info({
title: '填值规则功能测试',
content: '生成结果:' + res.result
})
} else {
this.$message.warn(res.message)
}
}).finally(() => {
closeLoading()
})
{
title: '规则名称',
align: 'center',
dataIndex: 'ruleName'
},
{
title: '规则Code',
align: 'center',
dataIndex: 'ruleCode'
},
{
title: '规则实现类',
align: 'center',
dataIndex: 'ruleClass'
},
{
title: '规则参数',
align: 'center',
dataIndex: 'ruleParams'
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
scopedSlots: { customRender: 'action' }
}
],
url: {
list: '/sys/fillRule/page',
test: '/sys/fillRule/testFillRule',
delete: '/sys/fillRule/delete',
deleteBatch: '/sys/fillRule/deleteBatch',
exportXlsUrl: '/sys/fillRule/exportXls',
importExcelUrl: '/sys/fillRule/importExcel'
}
}
},
computed: {
importExcelUrl () {
return `${window._CONFIG.domianURL}${this.url.importExcelUrl}`
}
},
methods: {
handleTest (record) {
const closeLoading = this.$message.loading('生成中...', 0)
getAction(this.url.test, {
ruleCode: record.ruleCode
}).then(res => {
if (res.success) {
this.$info({
title: '填值规则功能测试',
content: '生成结果:' + res.result
})
} else {
this.$message.warn(res.message)
}
}).finally(() => {
closeLoading()
})
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less'
</style>
</style>
@@ -45,67 +45,67 @@
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import GateWayRouteModal from './modules/GateWayRouteModal'
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import GateWayRouteModal from './modules/GateWayRouteModal'
export default {
name: 'TenantList',
mixins: [JeroListMixin, mixinDevice],
components: {
GateWayRouteModal
},
data() {
return {
description: 'adad管理页面',
// 表头
columns: [
{
title: '路由ID',
align: 'center',
dataIndex: 'routerId'
}, {
title: '路由名称',
align: 'center',
dataIndex: 'name'
},
{
title: '路由URI',
align: 'center',
dataIndex: 'uri'
},
{
title: '状态',
align: 'center',
dataIndex: 'status',
scopedSlots: { customRender: 'status' }
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
fixed: 'right',
width: 147,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: '/sys/gatewayRoute/page',
delete: '/sys/gatewayRoute/delete'
export default {
name: 'TenantList',
mixins: [JeroListMixin, mixinDevice],
components: {
GateWayRouteModal
},
data () {
return {
description: 'adad管理页面',
// 表头
columns: [
{
title: '路由ID',
align: 'center',
dataIndex: 'routerId'
}, {
title: '路由名称',
align: 'center',
dataIndex: 'name'
},
dictOptions: {}
}
},
created() {
},
methods: {
showModal(record) {
this.$refs['modalForm'].show(record)
}
{
title: '路由URI',
align: 'center',
dataIndex: 'uri'
},
{
title: '状态',
align: 'center',
dataIndex: 'status',
scopedSlots: { customRender: 'status' }
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
fixed: 'right',
width: 147,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: '/sys/gatewayRoute/page',
delete: '/sys/gatewayRoute/delete'
},
dictOptions: {}
}
},
created () {
},
methods: {
showModal (record) {
this.$refs.modalForm.show(record)
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
</style>
+85 -85
View File
@@ -61,98 +61,98 @@
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import { forceLogout } from '@/api/login'
import {filterDictTextByCache} from '@/components/dict/JDictSelectUtil'
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import { forceLogout } from '@/api/login'
import { filterDictTextByCache } from '@/components/dict/JDictSelectUtil'
import {getFileAccessHttpUrl} from '@/api/manage';
import { getFileAccessHttpUrl } from '@/api/manage'
export default {
name: "SysUserOnlineList",
mixins:[JeroListMixin, mixinDevice],
components: {},
data () {
return {
description: '在线用户管理页面',
queryParam: {
username: ''
},
// 表头
columns: [
{
title:'用户账号',
align:"center",
dataIndex: 'username'
},{
title:'用户姓名',
align:"center",
dataIndex: 'realname'
},{
title: '头像',
align: "center",
width: 120,
dataIndex: 'avatar',
scopedSlots: {customRender: "avatarslot"}
},{
title:'生日',
align:"center",
dataIndex: 'birthday'
},{
title: '性别',
align: "center",
dataIndex: 'sex',
customRender: (text) => {
//字典值翻译通用方法
return filterDictTextByCache('sex', text);
}
},{
title:'手机号',
align:"center",
dataIndex: 'phone'
},{
title: '操作',
dataIndex: 'action',
scopedSlots: {customRender: 'action'},
align: "center",
width: 170
export default {
name: 'SysUserOnlineList',
mixins: [JeroListMixin, mixinDevice],
components: {},
data () {
return {
description: '在线用户管理页面',
queryParam: {
username: ''
},
// 表头
columns: [
{
title: '用户账号',
align: 'center',
dataIndex: 'username'
}, {
title: '用户姓名',
align: 'center',
dataIndex: 'realname'
}, {
title: '头像',
align: 'center',
width: 120,
dataIndex: 'avatar',
scopedSlots: { customRender: 'avatarslot' }
}, {
title: '生日',
align: 'center',
dataIndex: 'birthday'
}, {
title: '性别',
align: 'center',
dataIndex: 'sex',
customRender: (text) => {
// 字典值翻译通用方法
return filterDictTextByCache('sex', text)
}
],
url: {
list: "/sys/online/list"
},
dictOptions:{},
}
},
created() {
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
methods: {
getAvatarView: function (avatar) {
return getFileAccessHttpUrl(avatar)
},
handleForce(record) {
let that = this;
let forceParam = {
token: record.token
}, {
title: '手机号',
align: 'center',
dataIndex: 'phone'
}, {
title: '操作',
dataIndex: 'action',
scopedSlots: { customRender: 'action' },
align: 'center',
width: 170
}
return forceLogout(forceParam).then((res) => {
if (res.success) {
that.loadData();
this.$message.success('强制退出用户”'+record.realname+'“成功!');
} else {
that.$message.warning(res.message);
}
})
],
url: {
list: '/sys/online/list'
},
dictOptions: {}
}
},
created () {
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG.domianURL}/${this.url.importExcelUrl}`
}
},
methods: {
getAvatarView: function (avatar) {
return getFileAccessHttpUrl(avatar)
},
handleForce (record) {
const that = this
const forceParam = {
token: record.token
}
return forceLogout(forceParam).then((res) => {
if (res.success) {
that.loadData()
this.$message.success('强制退出用户”' + record.realname + '“成功!')
} else {
that.$message.warning(res.message)
}
})
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
</style>
+65 -66
View File
@@ -89,77 +89,76 @@
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import TenantModal from './modules/TenantModal'
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import TenantModal from './modules/TenantModal'
export default {
name: "TenantList",
mixins:[JeroListMixin, mixinDevice],
components: {
TenantModal
},
data () {
return {
description: 'adad管理页面',
// 表头
columns: [
{
title:'租户名称',
align:"center",
dataIndex: 'name'
},{
title:'租户编号',
align:"center",
dataIndex: 'id'
},
{
title:'开始时间',
align:"center",
dataIndex: 'beginDate'
},
{
title:'结束时间',
align:"center",
dataIndex: 'endDate'
},
{
title:'状态',
align:"center",
dataIndex: 'status_dictText'
},
{
title: '操作',
dataIndex: 'action',
align:"center",
fixed:"right",
width:147,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: "/sys/tenant/page",
delete: "/sys/tenant/delete",
deleteBatch: "/sys/tenant/deleteBatch"
export default {
name: 'TenantList',
mixins: [JeroListMixin, mixinDevice],
components: {
TenantModal
},
data () {
return {
description: 'adad管理页面',
// 表头
columns: [
{
title: '租户名称',
align: 'center',
dataIndex: 'name'
}, {
title: '租户编号',
align: 'center',
dataIndex: 'id'
},
dictOptions:{},
}
},
created() {
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
{
title: '开始时间',
align: 'center',
dataIndex: 'beginDate'
},
{
title: '结束时间',
align: 'center',
dataIndex: 'endDate'
},
{
title: '状态',
align: 'center',
dataIndex: 'status_dictText'
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
fixed: 'right',
width: 147,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: '/sys/tenant/page',
delete: '/sys/tenant/delete',
deleteBatch: '/sys/tenant/deleteBatch'
},
},
methods: {
initDictConfig(){
}
dictOptions: {}
}
},
created () {
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG.domianURL}/${this.url.importExcelUrl}`
}
},
methods: {
initDictConfig () {
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
</style>
+118 -118
View File
@@ -51,133 +51,133 @@
</template>
<script>
import { filterObj } from '@/utils/util'
import { getAction,putAction } from '@/api/manage'
import ShowAnnouncement from '@/components/tools/ShowAnnouncement'
import {JeroListMixin} from '@/mixins/JeroListMixin'
import DynamicNotice from '../../components/tools/DynamicNotice'
import { filterObj } from '@/utils/util'
import { getAction, putAction } from '@/api/manage'
import ShowAnnouncement from '@/components/tools/ShowAnnouncement'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import DynamicNotice from '../../components/tools/DynamicNotice'
export default {
name: "UserAnnouncementList",
mixins: [JeroListMixin],
components: {
DynamicNotice,
ShowAnnouncement
},
data () {
return {
description: '系统通告表管理页面',
queryParam: {},
columns: [{
title: '标题',
align:"center",
dataIndex: 'titile'
},{
title: '消息类型',
align: "center",
dataIndex: 'msgCategory',
customRender: function (text) {
if (text == '1') {
return "通知公告";
} else if (text == "2") {
return "系统消息";
} else {
return text;
}
export default {
name: 'UserAnnouncementList',
mixins: [JeroListMixin],
components: {
DynamicNotice,
ShowAnnouncement
},
data () {
return {
description: '系统通告表管理页面',
queryParam: {},
columns: [{
title: '标题',
align: 'center',
dataIndex: 'titile'
}, {
title: '消息类型',
align: 'center',
dataIndex: 'msgCategory',
customRender: function (text) {
if (text == '1') {
return '通知公告'
} else if (text == '2') {
return '系统消息'
} else {
return text
}
},{
title: '发布人',
align:"center",
dataIndex: 'sender'
},{
title: '发布时间',
align:"center",
dataIndex: 'sendTime'
},{
title: '优先级',
align:"center",
dataIndex: 'priority',
customRender:function (text) {
if(text=='L'){
return "";
}else if(text=="M"){
return "";
}else if(text=="H"){
return "";
} else {
return text;
}
}
}, {
title: '发布人',
align: 'center',
dataIndex: 'sender'
}, {
title: '发布时间',
align: 'center',
dataIndex: 'sendTime'
}, {
title: '优先级',
align: 'center',
dataIndex: 'priority',
customRender: function (text) {
if (text == 'L') {
return '低'
} else if (text == 'M') {
return '中'
} else if (text == 'H') {
return '高'
} else {
return text
}
},{
title: '阅读状态',
align:"center",
dataIndex: 'readFlag',
customRender:function (text) {
if(text=='0'){
return "未读";
}else if(text=="1"){
return "已读";
} else {
return text;
}
}
}, {
title: '阅读状态',
align: 'center',
dataIndex: 'readFlag',
customRender: function (text) {
if (text == '0') {
return '未读'
} else if (text == '1') {
return '已读'
} else {
return text
}
},{
title: '操作',
dataIndex: 'action',
align:"center",
scopedSlots: { customRender: 'action' },
}],
}
}, {
title: '操作',
dataIndex: 'action',
align: 'center',
scopedSlots: { customRender: 'action' }
}],
url: {
list: "/sys/sysAnnouncementSend/getMyAnnouncementSend",
editCementSend:"sys/sysAnnouncementSend/editByAnntIdAndUserId",
readAllMsg:"sys/sysAnnouncementSend/readAll",
},
loading:false,
openPath:'',
formData:''
list: '/sys/sysAnnouncementSend/getMyAnnouncementSend',
editCementSend: 'sys/sysAnnouncementSend/editByAnntIdAndUserId',
readAllMsg: 'sys/sysAnnouncementSend/readAll'
},
loading: false,
openPath: '',
formData: ''
}
},
methods: {
handleDetail: function (record) {
this.$refs.sysAnnouncementModal.detail(record)
this.$refs.sysAnnouncementModal.title = '查看'
},
showAnnouncement (record) {
putAction(this.url.editCementSend, { anntId: record.anntId }).then((res) => {
if (res.success) {
this.loadData()
this.syncHeadNotic(record.anntId)
}
})
if (record.openType === 'component') {
this.openPath = record.openPage
this.formData = { id: record.busId }
this.$refs.showDynamNotice.detail()
} else {
this.$refs.ShowAnnouncement.detail(record)
}
},
methods: {
handleDetail: function(record){
this.$refs.sysAnnouncementModal.detail(record);
this.$refs.sysAnnouncementModal.title="查看";
},
showAnnouncement(record){
putAction(this.url.editCementSend,{anntId:record.anntId}).then((res)=>{
if(res.success){
this.loadData();
this.syncHeadNotic(record.anntId)
}
});
if(record.openType==='component'){
this.openPath = record.openPage;
this.formData = {id:record.busId};
this.$refs.showDynamNotice.detail();
}else{
this.$refs.ShowAnnouncement.detail(record);
syncHeadNotic (anntId) {
getAction('sys/annountCement/syncNotic', { anntId: anntId })
},
readAll () {
var that = this
that.$confirm({
title: '确认操作',
content: '是否全部标注已读?',
onOk: function () {
putAction(that.url.readAllMsg).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loadData()
that.syncHeadNotic()
}
})
}
},
syncHeadNotic(anntId){
getAction("sys/annountCement/syncNotic",{anntId:anntId})
},
readAll(){
var that = this;
that.$confirm({
title:"确认操作",
content:"是否全部标注已读?",
onOk: function(){
putAction(that.url.readAllMsg).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.loadData();
that.syncHeadNotic();
}
});
}
});
},
})
}
}
}
</script>
<style scoped>
.ant-card-body .table-operator{
@@ -189,4 +189,4 @@
.ant-modal-cust-warp{height: 100%}
.ant-modal-cust-warp .ant-modal-body{height:calc(100% - 110px) !important;overflow-y: auto}
.ant-modal-cust-warp .ant-modal-content{height:90% !important;overflow-y: hidden}
</style>
</style>
+230 -232
View File
@@ -22,7 +22,6 @@
</a-form-item>
</a-col>
<template v-if="toggleSearchStatus">
<a-col :md="6" :sm="8">
<a-form-item label="真实名字">
@@ -184,7 +183,6 @@
</a-dropdown>
</span>
</a-table>
</div>
<!-- table区域-end -->
@@ -204,250 +202,250 @@
</template>
<script>
import RoleAssignment from './modules/RoleAssignment'
import UserModal from './modules/UserModal'
import PasswordModal from './modules/PasswordModal'
import {getAction,getFileAccessHttpUrl} from '@/api/manage';
import {frozenBatch,queryall} from '@/api/api'
import {JeroListMixin} from '@/mixins/JeroListMixin'
import JInput from '@/components/jero/JInput'
import UserRecycleBinModal from './modules/UserRecycleBinModal'
import JSuperQuery from '@/components/jero/JSuperQuery'
import RoleAssignment from './modules/RoleAssignment'
import UserModal from './modules/UserModal'
import PasswordModal from './modules/PasswordModal'
import { getAction, getFileAccessHttpUrl } from '@/api/manage'
import { frozenBatch, queryall } from '@/api/api'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import JInput from '@/components/jero/JInput'
import UserRecycleBinModal from './modules/UserRecycleBinModal'
import JSuperQuery from '@/components/jero/JSuperQuery'
export default {
name: "UserList",
mixins: [JeroListMixin],
components: {
RoleAssignment,
UserModal,
PasswordModal,
JInput,
UserRecycleBinModal,
JSuperQuery
},
data() {
return {
description: '这是用户管理页面',
queryParam: {},
recycleBinVisible: false,
selectedRowKeys: [],
categoryTreeList:[], // 组织机构查询的组织机构树数据
rolesList:[], // 角色查询的角色数据
columns: [
{
title: '序号',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title: '头像',
align: "center",
width: 120,
dataIndex: 'avatar',
scopedSlots: {customRender: "avatarslot"}
},
{
title: '用户账号',
align: "center",
dataIndex: 'username',
width: 120,
sorter: true
},
{
title: '用户姓名',
align: "center",
width: 100,
dataIndex: 'realname',
},
{
title: '性别',
align: "center",
width: 80,
dataIndex: 'sex_dictText',
sorter: true
},
{
title: '手机号码',
align: "center",
width: 100,
dataIndex: 'phone'
},
{
title: '部门',
align: "center",
width: 180,
dataIndex: 'orgCodeTxt'
},
{
title: '角色',
align: "center",
width: 180,
dataIndex: 'roleTxt'
},
// {
// title: '生日',
// align: "center",
// width: 100,
// dataIndex: 'birthday'
// },
// {
// title: '负责部门',
// align: "center",
// width: 180,
// dataIndex: 'departIds_dictText'
// },
{
title: '状态',
align: "center",
width: 80,
dataIndex: 'status_dictText'
},
{
title: '操作',
dataIndex: 'action',
scopedSlots: {customRender: 'action'},
align: "center",
width: 170
export default {
name: 'UserList',
mixins: [JeroListMixin],
components: {
RoleAssignment,
UserModal,
PasswordModal,
JInput,
UserRecycleBinModal,
JSuperQuery
},
data () {
return {
description: '这是用户管理页面',
queryParam: {},
recycleBinVisible: false,
selectedRowKeys: [],
categoryTreeList: [], // 组织机构查询的组织机构树数据
rolesList: [], // 角色查询的角色数据
columns: [
{
title: '序号',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
],
superQueryFieldList: [
{ type: 'input', value: 'username', text: '用户账号', },
{ type: 'input', value: 'realname', text: '用户姓名', },
{ type: 'select', value: 'sex', dbType: 'int', text: '性别', dictCode: 'sex' },
],
url: {
syncUser: "/act/process/extActProcess/doSyncUser",
list: "/sys/user/page",
delete: "/sys/user/delete",
deleteBatch: "/sys/user/deleteBatch",
exportXlsUrl: "/sys/user/exportXls",
importExcelUrl: "sys/user/importExcel",
getSysCategoryTree: '/sys/sysDepart/queryTreeList', // 获取组织机构树
},
{
title: '头像',
align: 'center',
width: 120,
dataIndex: 'avatar',
scopedSlots: { customRender: 'avatarslot' }
},
{
title: '用户账号',
align: 'center',
dataIndex: 'username',
width: 120,
sorter: true
},
{
title: '用户姓名',
align: 'center',
width: 100,
dataIndex: 'realname'
},
{
title: '性别',
align: 'center',
width: 80,
dataIndex: 'sex_dictText',
sorter: true
},
{
title: '手机号码',
align: 'center',
width: 100,
dataIndex: 'phone'
},
{
title: '部门',
align: 'center',
width: 180,
dataIndex: 'orgCodeTxt'
},
{
title: '角色',
align: 'center',
width: 180,
dataIndex: 'roleTxt'
},
// {
// title: '生日',
// align: "center",
// width: 100,
// dataIndex: 'birthday'
// },
// {
// title: '负责部门',
// align: "center",
// width: 180,
// dataIndex: 'departIds_dictText'
// },
{
title: '状态',
align: 'center',
width: 80,
dataIndex: 'status_dictText'
},
{
title: '操作',
dataIndex: 'action',
scopedSlots: { customRender: 'action' },
align: 'center',
width: 170
}
],
superQueryFieldList: [
{ type: 'input', value: 'username', text: '用户账号' },
{ type: 'input', value: 'realname', text: '用户姓名' },
{ type: 'select', value: 'sex', dbType: 'int', text: '性别', dictCode: 'sex' }
],
url: {
syncUser: '/act/process/extActProcess/doSyncUser',
list: '/sys/user/page',
delete: '/sys/user/delete',
deleteBatch: '/sys/user/deleteBatch',
exportXlsUrl: '/sys/user/exportXls',
importExcelUrl: 'sys/user/importExcel',
getSysCategoryTree: '/sys/sysDepart/queryTreeList' // 获取组织机构树
}
}
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG.domianURL}/${this.url.importExcelUrl}`
}
},
mounted () {
this.getSysCategoryTree()
this.initRoleList()
},
methods: {
getAvatarView: function (avatar) {
return getFileAccessHttpUrl(avatar)
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
}
},
mounted() {
this.getSysCategoryTree()
this.initRoleList()
},
methods: {
getAvatarView: function (avatar) {
return getFileAccessHttpUrl(avatar)
},
batchFrozen: function (status) {
if (this.selectedRowKeys.length <= 0) {
this.$message.warning('请选择一条记录!');
return false;
} else {
let ids = "";
let that = this;
let isAdmin = false;
that.selectionRows.forEach(function (row) {
if (row.username == 'admin') {
isAdmin = true;
}
});
if (isAdmin) {
that.$message.warning('管理员账号不允许此操作,请重新选择!');
return;
}
that.selectedRowKeys.forEach(function (val) {
ids += val + ",";
});
that.$confirm({
title: "确认操作",
content: "是否" + (status == 1 ? "解冻" : "冻结") + "选中账号?",
onOk: function () {
frozenBatch({ids: ids, status: status}).then((res) => {
if (res.success) {
that.$message.success(res.message);
that.loadData();
that.onClearSelected();
} else {
that.$message.warning(res.message);
}
});
}
});
}
},
handleMenuClick(e) {
if (e.key == 1) {
this.batchDel();
} else if (e.key == 2) {
this.batchFrozen(2);
} else if (e.key == 3) {
this.batchFrozen(1);
}
},
handleFrozen: function (id, status, username) {
let that = this;
if ('admin' == username) {
that.$message.warning('管理员账号不允许此操作!');
return;
}
frozenBatch({ids: id, status: status}).then((res) => {
if (res.success) {
that.$message.success(res.message);
that.loadData();
} else {
that.$message.warning(res.message);
}
});
},
handleChangePassword(username) {
this.$refs.passwordmodal.show(username);
},
passwordModalOk() {
console.log("密码修改完成")
},
// 获取组织机构树
getSysCategoryTree() {
getAction(this.url.getSysCategoryTree, {}).then((res) => {
if (res.success) {
this.categoryTreeList = res.result
} else {
this.categoryTreeList = []
batchFrozen: function (status) {
if (this.selectedRowKeys.length <= 0) {
this.$message.warning('请选择一条记录!')
return false
} else {
let ids = ''
const that = this
let isAdmin = false
that.selectionRows.forEach(function (row) {
if (row.username == 'admin') {
isAdmin = true
}
})
},
//初始化角色字典
initRoleList(){
queryall().then((res)=>{
if(res.success){
this.rolesList = res.result.map((item,index,arr)=>{
let c = {text:item.roleName, value:item.id}
return c;
if (isAdmin) {
that.$message.warning('管理员账号不允许此操作,请重新选择!')
return
}
that.selectedRowKeys.forEach(function (val) {
ids += val + ','
})
that.$confirm({
title: '确认操作',
content: '是否' + (status == 1 ? '解冻' : '冻结') + '选中账号?',
onOk: function () {
frozenBatch({ ids: ids, status: status }).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loadData()
that.onClearSelected()
} else {
that.$message.warning(res.message)
}
})
}
});
},
// 角色配置
roleAssignment() {
if(this.selectedRowKeys.length == 0) {
this.$message.warning("请选择至少一条数据")
})
}
},
handleMenuClick (e) {
if (e.key == 1) {
this.batchDel()
} else if (e.key == 2) {
this.batchFrozen(2)
} else if (e.key == 3) {
this.batchFrozen(1)
}
},
handleFrozen: function (id, status, username) {
const that = this
if (username == 'admin') {
that.$message.warning('管理员账号不允许此操作!')
return
}
frozenBatch({ ids: id, status: status }).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loadData()
} else {
this.$refs.roleAssignmentModal.show();
that.$message.warning(res.message)
}
},
rolevisibleMethods(val) {
this.selectedRowKeys = []
},
})
},
handleChangePassword (username) {
this.$refs.passwordmodal.show(username)
},
passwordModalOk () {
console.log('密码修改完成')
},
// 获取组织机构树
getSysCategoryTree () {
getAction(this.url.getSysCategoryTree, {}).then((res) => {
if (res.success) {
this.categoryTreeList = res.result
} else {
this.categoryTreeList = []
}
})
},
// 初始化角色字典
initRoleList () {
queryall().then((res) => {
if (res.success) {
this.rolesList = res.result.map((item, index, arr) => {
const c = { text: item.roleName, value: item.id }
return c
})
}
})
},
// 角色配置
roleAssignment () {
if (this.selectedRowKeys.length == 0) {
this.$message.warning('请选择至少一条数据')
} else {
this.$refs.roleAssignmentModal.show()
}
},
rolevisibleMethods (val) {
this.selectedRowKeys = []
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less'
</style>
</style>
@@ -17,83 +17,83 @@
</template>
<script>
import { queryDepartTreeList, searchByKeywords } from '@/api/api'
import { queryDepartTreeList, searchByKeywords } from '@/api/api'
export default {
name: 'AddressListLeft',
props: ['value'],
data() {
return {
cardLoading: true,
loading: false,
treeDataSource: [],
selectedKeys: [],
expandedKeys: []
export default {
name: 'AddressListLeft',
props: ['value'],
data () {
return {
cardLoading: true,
loading: false,
treeDataSource: [],
selectedKeys: [],
expandedKeys: []
}
},
created () {
this.queryTreeData()
},
methods: {
queryTreeData (keyword) {
this.commonRequestThen(queryDepartTreeList({
departName: keyword || undefined
}))
},
handleSearch (value) {
if (value) {
this.commonRequestThen(searchByKeywords({ keyWord: value }))
} else {
this.queryTreeData()
}
},
created() {
this.queryTreeData()
handleTreeSelect (selectedKeys, event) {
if (selectedKeys.length > 0 && this.selectedKeys[0] !== selectedKeys[0]) {
this.selectedKeys = [selectedKeys[0]]
const orgCode = event.node.dataRef.orgCode
this.emitInput(orgCode)
}
},
methods: {
queryTreeData(keyword) {
this.commonRequestThen(queryDepartTreeList({
departName: keyword ? keyword : undefined
}))
},
emitInput (orgCode) {
this.$emit('input', orgCode)
},
handleSearch(value) {
if (value) {
this.commonRequestThen(searchByKeywords({ keyWord: value }))
commonRequestThen (promise) {
this.loading = true
promise.then(res => {
if (res.success) {
this.treeDataSource = res.result
// update-begin- --- author:wangshuai ------ date:20200102 ---- for:去除默认选中第一条数据、默认展开所有第一级
// 默认选中第一条数据、默认展开所有第一级
// if (res.result.length > 0) {
// this.expandedKeys = []
// res.result.forEach((item, index) => {
// if (index === 0) {
// this.selectedKeys = [item.id]
// this.emitInput(item.orgCode)
// }
// this.expandedKeys.push(item.id)
// })
// }
// update-end- --- author:wangshuai ------ date:20200102 ---- for:去除默认选中第一条数据、默认展开所有第一级
} else {
this.queryTreeData()
this.$message.warn(res.message)
console.error('组织机构查询失败:', res)
}
},
handleTreeSelect(selectedKeys, event) {
if (selectedKeys.length > 0 && this.selectedKeys[0] !== selectedKeys[0]) {
this.selectedKeys = [selectedKeys[0]]
let orgCode = event.node.dataRef.orgCode
this.emitInput(orgCode)
}
},
emitInput(orgCode) {
this.$emit('input', orgCode)
},
commonRequestThen(promise) {
this.loading = true
promise.then(res => {
if (res.success) {
this.treeDataSource = res.result
// update-begin- --- author:wangshuai ------ date:20200102 ---- for:去除默认选中第一条数据、默认展开所有第一级
// 默认选中第一条数据、默认展开所有第一级
// if (res.result.length > 0) {
// this.expandedKeys = []
// res.result.forEach((item, index) => {
// if (index === 0) {
// this.selectedKeys = [item.id]
// this.emitInput(item.orgCode)
// }
// this.expandedKeys.push(item.id)
// })
// }
// update-end- --- author:wangshuai ------ date:20200102 ---- for:去除默认选中第一条数据、默认展开所有第一级
} else {
this.$message.warn(res.message)
console.error('组织机构查询失败:', res)
}
}).finally(() => {
this.loading = false
this.cardLoading = false
})
},
}).finally(() => {
this.loading = false
this.cardLoading = false
})
}
}
}
</script>
<style scoped>
</style>
</style>
@@ -10,7 +10,6 @@
</a-form-model-item>
</a-col>
<a-col :md="6" :sm="12">
<a-form-model-item label="工号" prop="workNo" style="margin-left:8px">
<a-input placeholder="请输入工号查询" v-model="queryParam.workNo"></a-input>
@@ -43,113 +42,113 @@
</template>
<script>
import { getAction } from '@/api/manage'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import { getAction } from '@/api/manage'
import { JeroListMixin } from '@/mixins/JeroListMixin'
export default {
name: 'AddressListRight',
mixins: [JeroListMixin],
components: {},
props: ['value'],
data() {
return {
description: '用户信息',
cardLoading: true,
positionInfo: {},
columns: [
{
title: '#',
key: 'rowIndex',
dataIndex: '',
width: 60,
align: 'center',
customRender: (t, r, i) => parseInt(i) + 1
},
{
title: '姓名',
width: '15%',
align: 'center',
dataIndex: 'realname'
},
{
title: '工号',
width: '15%',
align: 'center',
dataIndex: 'workNo'
},
{
title: '部门',
width: '20%',
align: 'center',
dataIndex: 'departName'
},
{
title: '职务',
width: '15%',
align: 'center',
dataIndex: 'post',
customRender: (text) => (text || '').split(',').map(t => this.positionInfo[t] ? this.positionInfo[t] : t).join(',')
},
{
title: '手机',
width: '15%',
align: 'center',
dataIndex: 'telephone'
},
// {
// title: '手机号',
// width: '12%',
// align: 'center',
// dataIndex: 'phone'
// },
{
title: '公司邮箱',
width: '15%',
align: 'center',
dataIndex: 'email'
}
],
url: {
list: '/sys/user/queryByOrgCodeForAddressList',
listByPosition: '/sys/position/page'
export default {
name: 'AddressListRight',
mixins: [JeroListMixin],
components: {},
props: ['value'],
data () {
return {
description: '用户信息',
cardLoading: true,
positionInfo: {},
columns: [
{
title: '#',
key: 'rowIndex',
dataIndex: '',
width: 60,
align: 'center',
customRender: (t, r, i) => parseInt(i) + 1
},
{
title: '姓名',
width: '15%',
align: 'center',
dataIndex: 'realname'
},
{
title: '工号',
width: '15%',
align: 'center',
dataIndex: 'workNo'
},
{
title: '部门',
width: '20%',
align: 'center',
dataIndex: 'departName'
},
{
title: '职务',
width: '15%',
align: 'center',
dataIndex: 'post',
customRender: (text) => (text || '').split(',').map(t => this.positionInfo[t] ? this.positionInfo[t] : t).join(',')
},
{
title: '手机',
width: '15%',
align: 'center',
dataIndex: 'telephone'
},
// {
// title: '手机号',
// width: '12%',
// align: 'center',
// dataIndex: 'phone'
// },
{
title: '公司邮箱',
width: '15%',
align: 'center',
dataIndex: 'email'
}
],
url: {
list: '/sys/user/queryByOrgCodeForAddressList',
listByPosition: '/sys/position/page'
}
},
watch: {
value: {
immediate: true,
handler(orgCode) {
this.dataSource = []
this.loadData(1, orgCode)
}
},
},
created() {
this.queryPositionInfo()
},
methods: {
}
},
watch: {
value: {
immediate: true,
handler (orgCode) {
this.dataSource = []
this.loadData(1, orgCode)
}
}
},
created () {
this.queryPositionInfo()
},
methods: {
loadData(pageNum, orgCode) {
this.loading = true
if (pageNum === 1) {
this.ipagination.current = 1
}
// update-begin- --- author:wangshuai ------ date:20200102 ---- for:传过来的部门编码为空全查
if (!orgCode) {
getAction(this.url.list, {
...this.getQueryParams()
}).then((res) => {
if (res.success) {
this.dataSource = res.result.records
this.ipagination.total = res.result.total
}
}).finally(() => {
this.loading = false
this.cardLoading = false
})
// update-end- --- author:wangshuai ------ date:20200102 ---- for:传过来的部门编码为空全查
}else{
//加载数据 若传入参数1则加载第一页的内容
loadData (pageNum, orgCode) {
this.loading = true
if (pageNum === 1) {
this.ipagination.current = 1
}
// update-begin- --- author:wangshuai ------ date:20200102 ---- for:传过来的部门编码为空全查
if (!orgCode) {
getAction(this.url.list, {
...this.getQueryParams()
}).then((res) => {
if (res.success) {
this.dataSource = res.result.records
this.ipagination.total = res.result.total
}
}).finally(() => {
this.loading = false
this.cardLoading = false
})
// update-end- --- author:wangshuai ------ date:20200102 ---- for:传过来的部门编码为空全查
} else {
// 加载数据 若传入参数1则加载第一页的内容
getAction(this.url.list, {
orgCode,
...this.getQueryParams()
@@ -162,41 +161,41 @@
this.loading = false
this.cardLoading = false
})
}
},
searchQuery() {
this.loadData(1, this.value)
},
searchReset() {
this.queryParam = {}
this.loadData(1, this.value)
},
handleTableChange(pagination, filters, sorter) {
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field
this.isorter.order = 'ascend' === sorter.order ? 'asc' : 'desc'
}
this.ipagination = pagination
this.loadData(null, this.value)
},
// 查询职务信息
queryPositionInfo() {
getAction(this.url.listByPosition, { pageSize: 99999 }).then(res => {
if (res.success) {
let positionInfo = {}
res.result.records.forEach(record => {
positionInfo[record['code']] = record['name']
})
this.positionInfo = positionInfo
}
})
}
},
searchQuery () {
this.loadData(1, this.value)
},
searchReset () {
this.queryParam = {}
this.loadData(1, this.value)
},
handleTableChange (pagination, filters, sorter) {
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field
this.isorter.order = sorter.order === 'ascend' ? 'asc' : 'desc'
}
this.ipagination = pagination
this.loadData(null, this.value)
},
// 查询职务信息
queryPositionInfo () {
getAction(this.url.listByPosition, { pageSize: 99999 }).then(res => {
if (res.success) {
const positionInfo = {}
res.result.records.forEach(record => {
positionInfo[record.code] = record.name
})
this.positionInfo = positionInfo
}
})
}
}
}
</script>
<style>
.j-address-list-right-card-box .ant-table-placeholder {
@@ -208,4 +207,4 @@
height: 100%;
min-height: 300px;
}
</style>
</style>
@@ -32,117 +32,117 @@
</template>
<script>
import {getAction} from '@/api/manage'
import { getAction } from '@/api/manage'
export default {
name: 'DataLogCompareModal',
data() {
return {
modalWidth: 1000,
modaltoggleFlag: true,
confirmDirty: false,
title: '操作',
visible: false,
model: {},
confirmLoading: false,
headers: {},
//版本号
dataVersion1Num:'',
dataVersion2Num:'',
//表头
columns: [
{
title: '字段名',
align: 'left',
dataIndex: 'code',
width: '30%',
}, {
align: 'left',
dataIndex: 'dataVersion1',
width: '30%',
slots: { title: 'dataVersionTitle1' },
}, {
title: '',
dataIndex: 'imgshow',
align: 'center',
scopedSlots: {customRender: "avatarslot"},
width: '10%',
}, {
align: 'left',
dataIndex: 'dataVersion2',
width: '30%',
slots: { title: 'dataVersionTitle2' },
}
],
//数据集
dataSource: [],
loading: false,
url: {
queryCompareUrl: "/sys/dataLog/queryCompareList",
},
export default {
name: 'DataLogCompareModal',
data () {
return {
modalWidth: 1000,
modaltoggleFlag: true,
confirmDirty: false,
title: '操作',
visible: false,
model: {},
confirmLoading: false,
headers: {},
// 版本号
dataVersion1Num: '',
dataVersion2Num: '',
// 表头
columns: [
{
title: '字段名',
align: 'left',
dataIndex: 'code',
width: '30%'
}, {
align: 'left',
dataIndex: 'dataVersion1',
width: '30%',
slots: { title: 'dataVersionTitle1' }
}, {
title: '',
dataIndex: 'imgshow',
align: 'center',
scopedSlots: { customRender: 'avatarslot' },
width: '10%'
}, {
align: 'left',
dataIndex: 'dataVersion2',
width: '30%',
slots: { title: 'dataVersionTitle2' }
}
],
// 数据集
dataSource: [],
loading: false,
url: {
queryCompareUrl: '/sys/dataLog/queryCompareList'
}
},
created() {
}
},
created () {
},
methods: {
loadData(dataId1, dataId2) {
this.dataSource = [];
let that = this;
getAction(that.url.queryCompareUrl, {dataId1: dataId1, dataId2: dataId2}).then((res) => {
if (res.success) {
that.dataVersion1Num = res.result[0].dataVersion;
that.dataVersion2Num = res.result[1].dataVersion;
let json1 = JSON.parse(res.result[0].dataContent);
let json2 = JSON.parse(res.result[1].dataContent);
for (var item1 in json1) {
for (var item2 in json2) {
if (item1 == item2) {
this.dataSource.push({
code: item1,
imgshow: '',
dataVersion1: json1[item1],
dataVersion2: json2[item2],
})
}
},
methods: {
loadData (dataId1, dataId2) {
this.dataSource = []
const that = this
getAction(that.url.queryCompareUrl, { dataId1: dataId1, dataId2: dataId2 }).then((res) => {
if (res.success) {
that.dataVersion1Num = res.result[0].dataVersion
that.dataVersion2Num = res.result[1].dataVersion
const json1 = JSON.parse(res.result[0].dataContent)
const json2 = JSON.parse(res.result[1].dataContent)
for (var item1 in json1) {
for (var item2 in json2) {
if (item1 == item2) {
this.dataSource.push({
code: item1,
imgshow: '',
dataVersion1: json1[item1],
dataVersion2: json2[item2]
})
}
}
} else {
console.log(res.message);
}
})
},
compareModal(dataId1, dataId2) {
this.visible = true
this.loadData(dataId1, dataId2);
},
handleCancel() {
this.close()
},
modalFormOk() {
},
close() {
this.$emit('close');
this.visible = false;
this.disableSubmit = false;
},
setdataCss(record) {
let className = 'trcolor';
const dataVersion1 = record.dataVersion1;
const dataVersion2 = record.dataVersion2;
if (dataVersion1 != dataVersion2) {
return className;
}
},
getAvatarView: function (avatar) {
if (avatar.dataVersion1 != avatar.dataVersion2) {
return "/goright.png";
} else {
return "";
console.log(res.message)
}
},
})
},
compareModal (dataId1, dataId2) {
this.visible = true
this.loadData(dataId1, dataId2)
},
handleCancel () {
this.close()
},
modalFormOk () {
},
close () {
this.$emit('close')
this.visible = false
this.disableSubmit = false
},
setdataCss (record) {
const className = 'trcolor'
const dataVersion1 = record.dataVersion1
const dataVersion2 = record.dataVersion2
if (dataVersion1 != dataVersion2) {
return className
}
},
getAvatarView: function (avatar) {
if (avatar.dataVersion1 != avatar.dataVersion2) {
return '/goright.png'
} else {
return ''
}
}
}
}
</script>
<style scoped>
@@ -160,4 +160,4 @@
}
@import '../../../assets/less/index.less';
</style>
</style>
@@ -53,101 +53,100 @@
</template>
<script>
import { getAction } from '@/api/manage'
import DataLogCompareModal from './DataLogCompareModal'
export default {
name: 'DataLogModal',
components: { DataLogCompareModal },
dataId1:'',
dataId2: '',
dataTable1:'',
dataID3:'',
import { getAction } from '@/api/manage'
import DataLogCompareModal from './DataLogCompareModal'
export default {
name: 'DataLogModal',
components: { DataLogCompareModal },
dataId1: '',
dataId2: '',
dataTable1: '',
dataID3: '',
data () {
return {
modalWidth:700,
modaltoggleFlag:true,
confirmDirty: false,
title:"操作",
visible: false,
model: {},
confirmLoading: false,
headers:{},
form:this.$form.createForm(this),
url: {
queryDataVerListUrl:"/sys/dataLog/queryDataVerList",
},
DataVersionList:[],
}
data () {
return {
modalWidth: 700,
modaltoggleFlag: true,
confirmDirty: false,
title: '操作',
visible: false,
model: {},
confirmLoading: false,
headers: {},
form: this.$form.createForm(this),
url: {
queryDataVerListUrl: '/sys/dataLog/queryDataVerList'
},
DataVersionList: []
}
},
created () {
},
methods: {
addModal (records) {
const dataTable = records[0].dataTable
const dataId = records[0].dataId
const dataVersion1 = records[0].dataVersion
const dataVersion2 = records[1].dataVersion
this.dataId1 = records[0].id
this.dataId2 = records[1].id
this.dataTable1 = records[0].dataTable
this.dataID3 = records[0].dataId
this.initDataVersionList()
this.form.resetFields()
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue({ dataTale: dataTable, dataId: dataId, dataVersion1: dataVersion1, dataVersion2: dataVersion2 })
})
},
created () {
handleOk () {
this.close()
this.$refs.modal.compareModal(this.dataId1, this.dataId2)
this.$refs.modal.title = '数据比较'
},
methods: {
addModal(records){
const dataTable = records[0].dataTable
const dataId = records[0].dataId;
const dataVersion1 = records[0].dataVersion;
const dataVersion2 = records[1].dataVersion;
this.dataId1 = records[0].id;
this.dataId2 = records[1].id;
this.dataTable1 = records[0].dataTable
this.dataID3 = records[0].dataId
this.initDataVersionList();
this.form.resetFields();
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue({dataTale:dataTable,dataId:dataId,dataVersion1:dataVersion1,dataVersion2:dataVersion2});
});
},
handleOk () {
this.close();
this.$refs.modal.compareModal(this.dataId1 ,this.dataId2);
this.$refs.modal.title="数据比较";
},
handleCancel(){
this.close()
},
handleSubmit(){
},
close () {
this.$emit('close');
this.visible = false;
this.disableSubmit = false;
},
modalFormOk () {
},
initDataVersionList(){
let that = this;
getAction(that.url.queryDataVerListUrl,{dataTable:this.dataTable1,dataId:this.dataID3}).then((res)=>{
if(res.success){
this.DataVersionList = res.result;
}else{
this.DataVersionList=[];
this.dataId1 = '',
this.dataId2='',
console.log(res.message);
}
});
},
handleChange1(value) {
this.dataId1 = value;
},
handleChange2(value) {
this.dataId2 = value;
},
handleTableBlur(e){
this.dataTable1 = e.target.value;
this.initDataVersionList();
},
handleIdBlur(e){
this.dataID3 = e.target.value;
this.initDataVersionList();
}
handleCancel () {
this.close()
},
handleSubmit () {
},
close () {
this.$emit('close')
this.visible = false
this.disableSubmit = false
},
modalFormOk () {
},
initDataVersionList () {
const that = this
getAction(that.url.queryDataVerListUrl, { dataTable: this.dataTable1, dataId: this.dataID3 }).then((res) => {
if (res.success) {
this.DataVersionList = res.result
} else {
this.DataVersionList = []
this.dataId1 = '',
this.dataId2 = '',
console.log(res.message)
}
})
},
handleChange1 (value) {
this.dataId1 = value
},
handleChange2 (value) {
this.dataId2 = value
},
handleTableBlur (e) {
this.dataTable1 = e.target.value
this.initDataVersionList()
},
handleIdBlur (e) {
this.dataID3 = e.target.value
this.initDataVersionList()
}
}
}
</script>
<style scoped>
</style>
</style>
@@ -52,141 +52,141 @@
</template>
<script>
import {queryTreeListForRole,queryDepartPermission,saveDepartPermission} from '@/api/api'
import DepartDataruleModal from './DepartDataruleModal'
import { queryTreeListForRole, queryDepartPermission, saveDepartPermission } from '@/api/api'
import DepartDataruleModal from './DepartDataruleModal'
export default {
name: 'DepartAuthModal',
components: { DepartDataruleModal },
data(){
return {
departId:"",
treeData: [],
defaultCheckedKeys:[],
checkedKeys:[],
halfCheckedKeys:[],
expandedKeysss:[],
allTreeKeys:[],
autoExpandParent: true,
checkStrictly: false,
title:"部门权限配置",
visible: false,
loading: false,
selectedKeys:[]
export default {
name: 'DepartAuthModal',
components: { DepartDataruleModal },
data () {
return {
departId: '',
treeData: [],
defaultCheckedKeys: [],
checkedKeys: [],
halfCheckedKeys: [],
expandedKeysss: [],
allTreeKeys: [],
autoExpandParent: true,
checkStrictly: false,
title: '部门权限配置',
visible: false,
loading: false,
selectedKeys: []
}
},
methods: {
onTreeNodeSelect (id) {
if (id && id.length > 0) {
this.selectedKeys = id
}
this.$refs.datarule.show(this.selectedKeys[0], this.departId)
},
methods: {
onTreeNodeSelect(id){
if(id && id.length>0){
this.selectedKeys = id
onCheck (checkedKeys, { halfCheckedKeys }) {
// 保存选中的和半选中的,后面保存的时候合并提交
this.checkedKeys = checkedKeys
this.halfCheckedKeys = halfCheckedKeys
},
show (departId) {
this.departId = departId
this.loadData()
},
close () {
this.reset()
this.$emit('close')
this.visible = false
},
onExpand (expandedKeys) {
this.expandedKeysss = expandedKeys
this.autoExpandParent = false
},
reset () {
this.expandedKeysss = []
this.checkedKeys = []
this.defaultCheckedKeys = []
this.loading = false
},
expandAll () {
this.expandedKeysss = this.allTreeKeys
},
closeAll () {
this.expandedKeysss = []
},
checkALL () {
this.checkedKeys = this.allTreeKeys
},
cancelCheckALL () {
this.checkedKeys = []
},
handleCancel () {
this.close()
},
handleSubmit () {
const that = this
if (!that.departId) {
this.$message.warning('请点击选择一个部门!')
}
const checkedKeys = [...that.checkedKeys, ...that.halfCheckedKeys]
const permissionIds = checkedKeys.join(',')
const params = {
departId: that.departId,
permissionIds,
lastpermissionIds: that.defaultCheckedKeys.join(',')
}
that.loading = true
saveDepartPermission(params).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loading = false
that.loadData()
} else {
that.$message.error(res.message)
that.loading = false
}
this.$refs.datarule.show(this.selectedKeys[0],this.departId)
},
onCheck (checkedKeys, { halfCheckedKeys }) {
// 保存选中的和半选中的,后面保存的时候合并提交
this.checkedKeys = checkedKeys
this.halfCheckedKeys = halfCheckedKeys
},
show(departId){
this.departId=departId
this.loadData();
},
close () {
this.reset()
this.$emit('close');
this.visible = false;
},
onExpand(expandedKeys){
this.expandedKeysss = expandedKeys;
this.autoExpandParent = false
},
reset () {
this.expandedKeysss = []
this.checkedKeys = []
this.defaultCheckedKeys = []
this.loading = false
},
expandAll () {
this.expandedKeysss = this.allTreeKeys
},
closeAll () {
this.expandedKeysss = []
},
checkALL () {
this.checkedKeys = this.allTreeKeys
},
cancelCheckALL () {
this.checkedKeys = []
},
handleCancel () {
this.close()
},
handleSubmit() {
let that = this;
if(!that.departId){
this.$message.warning('请点击选择一个部门!')
})
},
convertTreeListToKeyLeafPairs (treeList, keyLeafPair = []) {
for (const { key, isLeaf, children } of treeList) {
keyLeafPair.push({ key, isLeaf })
if (children && children.length > 0) {
this.convertTreeListToKeyLeafPairs(children, keyLeafPair)
}
let checkedKeys = [...that.checkedKeys, ...that.halfCheckedKeys]
const permissionIds = checkedKeys.join(",")
let params = {
departId:that.departId,
permissionIds,
lastpermissionIds:that.defaultCheckedKeys.join(","),
};
that.loading = true;
saveDepartPermission(params).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.loading = false;
that.loadData();
}else {
that.$message.error(res.message);
that.loading = false;
}
})
},
convertTreeListToKeyLeafPairs(treeList, keyLeafPair = []) {
for(const {key, isLeaf, children} of treeList) {
keyLeafPair.push({key, isLeaf})
if(children && children.length > 0) {
this.convertTreeListToKeyLeafPairs(children, keyLeafPair)
}
}
return keyLeafPair;
},
emptyCurrForm() {
this.form.resetFields()
},
loadData(){
this.loading = true;
queryTreeListForRole().then((res) => {
this.treeData = res.result.treeList
this.allTreeKeys = res.result.ids
const keyLeafPairs = this.convertTreeListToKeyLeafPairs(this.treeData)
queryDepartPermission({departId:this.departId}).then((res)=>{
// 过滤出 leaf node 即可,即选中的
// Tree组件中checkStrictly默认为false的时候,选中子节点,父节点会自动设置选中或半选中
// 保存 checkedKeys 以及 halfCheckedKeys 以便于未做任何操作时提交表单数据
const checkedKeys = [...res.result].filter(key => {
const keyLeafPair = keyLeafPairs.filter(item => item.key === key)[0]
return keyLeafPair && keyLeafPair.isLeaf
})
const halfCheckedKeys = [...res.result].filter(key => {
const keyLeafPair = keyLeafPairs.filter(item => item.key === key)[0]
return keyLeafPair && !keyLeafPair.isLeaf
})
this.checkedKeys = [...checkedKeys];
this.halfCheckedKeys = [...halfCheckedKeys]
this.defaultCheckedKeys = [...halfCheckedKeys, ...checkedKeys];
this.expandedKeysss = this.allTreeKeys;
this.loading = false;
}
return keyLeafPair
},
emptyCurrForm () {
this.form.resetFields()
},
loadData () {
this.loading = true
queryTreeListForRole().then((res) => {
this.treeData = res.result.treeList
this.allTreeKeys = res.result.ids
const keyLeafPairs = this.convertTreeListToKeyLeafPairs(this.treeData)
queryDepartPermission({ departId: this.departId }).then((res) => {
// 过滤出 leaf node 即可,即选中的
// Tree组件中checkStrictly默认为false的时候,选中子节点,父节点会自动设置选中或半选中
// 保存 checkedKeys 以及 halfCheckedKeys 以便于未做任何操作时提交表单数据
const checkedKeys = [...res.result].filter(key => {
const keyLeafPair = keyLeafPairs.filter(item => item.key === key)[0]
return keyLeafPair && keyLeafPair.isLeaf
})
const halfCheckedKeys = [...res.result].filter(key => {
const keyLeafPair = keyLeafPairs.filter(item => item.key === key)[0]
return keyLeafPair && !keyLeafPair.isLeaf
})
this.checkedKeys = [...checkedKeys]
this.halfCheckedKeys = [...halfCheckedKeys]
this.defaultCheckedKeys = [...halfCheckedKeys, ...checkedKeys]
this.expandedKeysss = this.allTreeKeys
this.loading = false
})
}
},
})
}
}
}
</script>
<style scoped>
</style>
</style>
@@ -31,86 +31,86 @@
</template>
<script>
import ARow from 'ant-design-vue/es/grid/Row'
import ACol from 'ant-design-vue/es/grid/Col'
import { getAction,postAction } from '@/api/manage'
import ARow from 'ant-design-vue/es/grid/Row'
import ACol from 'ant-design-vue/es/grid/Col'
import { getAction, postAction } from '@/api/manage'
export default {
name: 'DepartDataruleModal',
components: { ACol, ARow },
data(){
return {
functionId:'',
departId:'',
visible:false,
tabList: [{
key: '1',
tab: '数据规则',
}, {
key: '2',
tab: '按钮权限',
}],
activeTabKey: '1',
url:{
datarule:"/sys/sysDepartPermission/datarule",
},
dataruleList:[],
dataruleChecked:[]
}
export default {
name: 'DepartDataruleModal',
components: { ACol, ARow },
data () {
return {
functionId: '',
departId: '',
visible: false,
tabList: [{
key: '1',
tab: '数据规则'
}, {
key: '2',
tab: '按钮权限'
}],
activeTabKey: '1',
url: {
datarule: '/sys/sysDepartPermission/datarule'
},
dataruleList: [],
dataruleChecked: []
}
},
methods: {
loadData () {
getAction(`${this.url.datarule}/${this.functionId}/${this.departId}`).then(res => {
if (res.success) {
this.dataruleList = res.result.datarule
const drChecked = res.result.drChecked
if (drChecked) {
this.dataruleChecked = drChecked.split(',')
}
}
})
},
methods:{
loadData(){
getAction(`${this.url.datarule}/${this.functionId}/${this.departId}`).then(res=>{
if(res.success){
this.dataruleList = res.result.datarule
let drChecked = res.result.drChecked
if(drChecked){
this.dataruleChecked = drChecked.split(",")
}
}
})
},
saveDataruleForRole(){
if(!this.dataruleChecked || this.dataruleChecked.length==0){
this.$message.warning("请注意,现未勾选任何数据权限!")
}
let params = {
permissionId:this.functionId,
departId:this.departId,
dataRuleIds:this.dataruleChecked.join(",")
}
postAction(this.url.datarule,params).then(res=>{
if(res.success){
this.$message.success(res.message)
}else{
this.$message.error(res.message)
}
})
},
show(functionId,departId){
this.onReset()
this.functionId = functionId
this.departId = departId
this.visible=true
this.loadData()
},
onClose(){
this.visible=false
this.onReset()
},
onTabChange (key) {
this.activeTabKey = key
},
onReset(){
this.functionId=''
this.departId=''
this.dataruleList=[]
this.dataruleChecked=[]
saveDataruleForRole () {
if (!this.dataruleChecked || this.dataruleChecked.length == 0) {
this.$message.warning('请注意现未勾选任何数据权限!')
}
const params = {
permissionId: this.functionId,
departId: this.departId,
dataRuleIds: this.dataruleChecked.join(',')
}
postAction(this.url.datarule, params).then(res => {
if (res.success) {
this.$message.success(res.message)
} else {
this.$message.error(res.message)
}
})
},
show (functionId, departId) {
this.onReset()
this.functionId = functionId
this.departId = departId
this.visible = true
this.loadData()
},
onClose () {
this.visible = false
this.onReset()
},
onTabChange (key) {
this.activeTabKey = key
},
onReset () {
this.functionId = ''
this.departId = ''
this.dataruleList = []
this.dataruleChecked = []
}
}
}
</script>
<style scoped>
</style>
</style>
+116 -118
View File
@@ -91,134 +91,132 @@
</template>
<script>
import { httpAction } from '@/api/manage'
import { queryIdTree } from '@/api/api'
import pick from 'lodash.pick'
import ATextarea from 'ant-design-vue/es/input/TextArea'
export default {
name: "SysDepartModal",
components: { ATextarea },
data () {
return {
departTree:[],
orgTypeData:[],
phoneWarning:'',
departName:"",
title:"操作",
seen:false,
visible: false,
condition:true,
disableSubmit:false,
model: {},
defaultModel:{
departOrder:0,
orgCategory:'1'
},
menuhidden:false,
menuusing:true,
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
import { httpAction } from '@/api/manage'
import { queryIdTree } from '@/api/api'
import pick from 'lodash.pick'
import ATextarea from 'ant-design-vue/es/input/TextArea'
export default {
name: 'SysDepartModal',
components: { ATextarea },
data () {
return {
departTree: [],
orgTypeData: [],
phoneWarning: '',
departName: '',
title: '操作',
seen: false,
visible: false,
condition: true,
disableSubmit: false,
model: {},
defaultModel: {
departOrder: 0,
orgCategory: '1'
},
menuhidden: false,
menuusing: true,
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
confirmLoading: false,
validatorRules:{
departName:[{ required: true, message: '请输入机构/部门名称!' }],
orgCode:[{ required: true, message: '请输入机构编码!' }],
mobile: [{validator:this.validateMobile}],
orgCategory:[{required: true, message: '请输入机构类型!'}]
},
url: {
add: "/sys/sysDepart/add",
},
dictDisabled:true,
confirmLoading: false,
validatorRules: {
departName: [{ required: true, message: '请输入机构/部门名称!' }],
orgCode: [{ required: true, message: '请输入机构编码!' }],
mobile: [{ validator: this.validateMobile }],
orgCategory: [{ required: true, message: '请输入机构类型!' }]
},
url: {
add: '/sys/sysDepart/add'
},
dictDisabled: true
}
},
created () {
},
methods: {
loadTreeData () {
var that = this
queryIdTree().then((res) => {
if (res.success) {
that.departTree = []
for (let i = 0; i < res.result.length; i++) {
const temp = res.result[i]
that.departTree.push(temp)
}
}
})
},
add (depart) {
if (depart) {
this.seen = false
this.dictDisabled = false
} else {
this.seen = true
this.dictDisabled = true
}
this.edit(depart)
},
edit (record) {
this.visible = true
this.model = Object.assign({}, this.defaultModel, record)
this.loadTreeData()
this.model.parentId = record != null ? record.toString() : null
if (this.seen) {
this.model.orgCategory = '1'
} else {
this.model.orgCategory = '2'
}
},
created () {
close () {
this.$emit('close')
this.disableSubmit = false
this.visible = false
this.$refs.form.resetFields()
},
methods: {
loadTreeData(){
var that = this;
queryIdTree().then((res)=>{
if(res.success){
that.departTree = [];
for (let i = 0; i < res.result.length; i++) {
let temp = res.result[i];
that.departTree.push(temp);
handleOk () {
const that = this
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true
httpAction(this.url.add, this.model, 'post').then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loadTreeData()
that.$emit('ok')
} else {
that.$message.warning(res.message)
}
}
})
},
add (depart) {
if(depart){
this.seen = false;
this.dictDisabled = false;
}else{
this.seen = true;
this.dictDisabled = true;
}).finally(() => {
that.confirmLoading = false
that.close()
})
} else {
return false
}
this.edit(depart);
},
edit (record) {
this.visible = true;
this.model = Object.assign({}, this.defaultModel, record)
this.loadTreeData();
this.model.parentId = record!=null?record.toString():null;
if(this.seen){
this.model.orgCategory = '1';
}else{
this.model.orgCategory = '2';
}
},
close () {
this.$emit('close');
this.disableSubmit = false;
this.visible = false;
this.$refs.form.resetFields();
},
handleOk () {
const that = this;
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
httpAction(this.url.add,this.model,"post").then((res)=>{
if(res.success){
that.$message.success(res.message);
that.loadTreeData();
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
that.close();
})
}else{
return false;
}
})
},
handleCancel () {
this.close()
},
validateMobile(rule,value,callback){
if (!value || new RegExp(/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/).test(value)){
callback();
}else{
callback("您的手机号码格式不正确!");
}
})
},
handleCancel () {
this.close()
},
validateMobile (rule, value, callback) {
if (!value || new RegExp(/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/).test(value)) {
callback()
} else {
callback('您的手机号码格式不正确!')
}
}
}
}
</script>
<style scoped>
</style>
</style>
+130 -126
View File
@@ -35,141 +35,145 @@
</template>
<script>
import pick from 'lodash.pick'
import { getAction } from '@/api/manage'
import { queryIdTree } from '@/api/api'
export default {
name: "DepartWindow",
components: {
import pick from 'lodash.pick'
import { getAction } from '@/api/manage'
import { queryIdTree } from '@/api/api'
export default {
name: 'DepartWindow',
components: {
},
data () {
return {
checkedKeys: [], // 存储选中的部门id
expandedKeysss: [], // 展开的节点
userId: '', // 存储用户id
model: {}, // 存储SysUserDepartsVO表
userDepartModel: { userId: '', departIdList: [] }, // 存储用户id一对多部门信息的对象
departList: [], // 存储部门信息
modalWidth: 400,
departTree: [],
title: '操作',
visible: false,
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
confirmLoading: false,
headers: {},
form: this.$form.createForm(this),
url: {
userId: '/sys/user/generateUserId' // 引入生成添加用户情况下的url
}
}
},
methods: {
add (checkedDepartKeys, userId) {
this.checkedKeys = checkedDepartKeys
this.userId = userId
this.edit({})
},
data () {
return {
checkedKeys:[], // 存储选中的部门id
expandedKeysss:[],//展开的节点
userId:"", // 存储用户id
model:{}, // 存储SysUserDepartsVO表
userDepartModel:{userId:'',departIdList:[]}, // 存储用户id一对多部门信息的对象
departList:[], // 存储部门信息
modalWidth:400,
departTree:[],
title:"操作",
visible: false,
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
headers:{},
form:this.$form.createForm(this),
url: {
userId:"/sys/user/generateUserId", // 引入生成添加用户情况下的url
},
edit (record) {
this.departList = []
this.queryDepartTree()
this.form.resetFields()
this.visible = true
this.model = Object.assign({}, record)
const filedsVal = pick(this.model, 'id', 'userId', 'departIdList')
this.$nextTick(() => {
this.form.setFieldsValue(filedsVal)
})
},
close () {
this.$emit('close')
this.visible = false
this.departList = []
this.checkedKeys = []
},
handleSubmit () {
const that = this
// 触发表单验证
this.form.validateFields((err) => {
if (!err) {
that.confirmLoading = true
if (this.userId == null) {
getAction(this.url.userId).then((res) => {
if (res.success) {
const formData = {
userId: res.result,
departIdList: this.departList
}
that.$emit('ok', formData)
}
}).finally(() => {
that.departList = []
that.confirmLoading = false
that.close()
})
} else {
const formData = {
userId: this.userId,
departIdList: this.departList
}
that.departList = []
that.$emit('ok', formData)
that.confirmLoading = false
that.close()
}
}
})
},
handleCancel () {
this.close()
},
// 选择部门时作用的API
onCheck (checkedKeys, info) {
this.departList = []
this.checkedKeys = checkedKeys.checked
const checkedNodes = info.checkedNodes
for (let i = 0; i < checkedNodes.length; i++) {
const de = checkedNodes[i].data.props
const depart = { key: '', value: '', title: '' }
depart.key = de.value
depart.value = de.value
depart.title = de.title
this.departList.push(depart)
}
},
methods: {
add (checkedDepartKeys,userId) {
this.checkedKeys = checkedDepartKeys;
this.userId = userId;
this.edit({});
},
edit (record) {
this.departList = [];
this.queryDepartTree();
this.form.resetFields();
this.visible = true;
this.model = Object.assign({}, record);
let filedsVal = pick(this.model,'id','userId','departIdList');
this.$nextTick(() => {
this.form.setFieldsValue(filedsVal);
});
},
close () {
this.$emit('close');
this.visible = false;
this.departList = [];
this.checkedKeys = [];
},
handleSubmit () {
const that = this;
// 触发表单验证
this.form.validateFields((err) => {
if (!err) {
that.confirmLoading = true;
if(this.userId == null){
getAction(this.url.userId).then((res)=>{
if(res.success){
let formData = {userId:res.result,
departIdList:this.departList}
that.$emit('ok', formData);
}
}).finally(() => {
that.departList = [];
that.confirmLoading = false;
that.close();
})
}else {
let formData = {userId:this.userId,
departIdList:this.departList}
that.departList = [];
that.$emit('ok', formData);
that.confirmLoading = false;
that.close();
}
}
})
},
handleCancel () {
this.close()
},
// 选择部门时作用的API
onCheck(checkedKeys, info){
this.departList = [];
this.checkedKeys = checkedKeys.checked;
let checkedNodes = info.checkedNodes;
for (let i = 0; i < checkedNodes.length; i++) {
let de = checkedNodes[i].data.props;
let depart = {key:"",value:"",title:""};
depart.key = de.value;
depart.value = de.value;
depart.title = de.title;
this.departList.push(depart);
}
},
queryDepartTree(){
queryIdTree().then((res)=>{
if(res.success){
this.departTree = res.result;
if(this.checkedKeys&&this.checkedKeys.length >0){
let treekey=[];
let arr=res.result;
if(arr&&arr.length>0){
arr.forEach(item => {
treekey.push(item.key);
/* if(item.children&&item.children.length>0){
queryDepartTree () {
queryIdTree().then((res) => {
if (res.success) {
this.departTree = res.result
if (this.checkedKeys && this.checkedKeys.length > 0) {
const treekey = []
const arr = res.result
if (arr && arr.length > 0) {
arr.forEach(item => {
treekey.push(item.key)
/* if(item.children&&item.children.length>0){
item.children.forEach(item1 => {
treekey.push(item1.key);
})
}*/
})
this.expandedKeysss = treekey
}
} */
})
this.expandedKeysss = treekey
}
}
})
},
onExpand(expandedKeys){
this.expandedKeysss = expandedKeys;
},
modalFormOk(){
}
})
},
onExpand (expandedKeys) {
this.expandedKeysss = expandedKeys
},
modalFormOk () {
}
},
}
}
}
</script>
<style lang="less" scoped>
@@ -180,4 +184,4 @@
/deep/ .ant-modal{
height: 700px;
}
</style>
</style>
@@ -67,58 +67,57 @@
</a-card>
</template>
<script>
import {queryIdTree} from '@/api/api'
import { queryIdTree } from '@/api/api'
export default {
name: 'DeptBaseInfo',
components: {},
data() {
return {
departTree: [],
id: '',
model: {},
visible: false,
disable: true,
treeData: [],
labelCol: {
xs: {span: 24},
sm: {span: 3}
},
wrapperCol: {
xs: {span: 24},
sm: {span: 16}
},
export default {
name: 'DeptBaseInfo',
components: {},
data () {
return {
departTree: [],
id: '',
model: {},
visible: false,
disable: true,
treeData: [],
labelCol: {
xs: { span: 24 },
sm: { span: 3 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
}
},
created() {
this.loadTreeData();
},
methods: {
loadTreeData() {
queryIdTree().then((res) => {
if (res.success) {
for (let i = 0; i < res.result.length; i++) {
let temp = res.result[i];
this.treeData.push(temp);
}
}
},
created () {
this.loadTreeData()
},
methods: {
loadTreeData () {
queryIdTree().then((res) => {
if (res.success) {
for (let i = 0; i < res.result.length; i++) {
const temp = res.result[i]
this.treeData.push(temp)
}
})
},
open(record) {
this.visible = true;
this.$nextTick(() => {
this.$refs.form.resetFields()
this.model = Object.assign({}, record)
})
},
clearForm() {
this.$refs.form.resetFields();
this.treeData = [];
},
}
})
},
open (record) {
this.visible = true
this.$nextTick(() => {
this.$refs.form.resetFields()
this.model = Object.assign({}, record)
})
},
clearForm () {
this.$refs.form.resetFields()
this.treeData = []
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less'
</style>
</style>
+199 -204
View File
@@ -58,8 +58,6 @@
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
@@ -84,7 +82,6 @@
</a-dropdown>
</span>
</a-table>
</div>
<!-- table区域-end -->
@@ -96,216 +93,214 @@
</template>
<script>
import {JeroListMixin} from '@/mixins/JeroListMixin'
import {getAction, postAction, deleteAction} from '@/api/manage'
import SelectUserModal from './SelectUserModal'
import UserModal from './UserModal'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import { getAction, postAction, deleteAction } from '@/api/manage'
import SelectUserModal from './SelectUserModal'
import UserModal from './UserModal'
export default {
name: "DeptUserInfo",
mixins: [JeroListMixin],
components: {
SelectUserModal,
UserModal
export default {
name: 'DeptUserInfo',
mixins: [JeroListMixin],
components: {
SelectUserModal,
UserModal
},
data () {
return {
description: '用户信息',
currentDeptId: '',
currentDept: {},
// 表头
columns: [{
title: '用户账号',
align: 'center',
dataIndex: 'username'
},
{
title: '用户名称',
align: 'center',
dataIndex: 'realname'
},
{
title: '部门',
align: 'center',
dataIndex: 'orgCode'
},
{
title: '性别',
align: 'center',
dataIndex: 'sex_dictText'
},
{
title: '电话',
align: 'center',
dataIndex: 'phone'
},
{
title: '操作',
dataIndex: 'action',
scopedSlots: { customRender: 'action' },
align: 'center',
width: 150
}],
url: {
list: '/sys/user/departUserList',
edit: '/sys/user/editSysDepartWithUser',
delete: '/sys/user/deleteUserInDepart',
deleteBatch: '/sys/user/deleteUserInDepartBatch'
}
}
},
created () {
},
methods: {
searchReset () {
this.queryParam = {}
this.loadData(1)
},
data() {
return {
description: '用户信息',
currentDeptId: '',
currentDept: {},
// 表头
columns: [{
title: '用户账号',
align: "center",
dataIndex: 'username'
},
{
title: '用户名称',
align: "center",
dataIndex: 'realname'
},
{
title: '部门',
align: "center",
dataIndex: 'orgCode'
},
{
title: '性别',
align: "center",
dataIndex: 'sex_dictText'
},
{
title: '电话',
align: "center",
dataIndex: 'phone'
},
{
title: '操作',
dataIndex: 'action',
scopedSlots: {customRender: 'action'},
align: "center",
width: 150
}],
url: {
list: "/sys/user/departUserList",
edit: "/sys/user/editSysDepartWithUser",
delete: "/sys/user/deleteUserInDepart",
deleteBatch: "/sys/user/deleteUserInDepartBatch",
loadData (arg) {
if (!this.url.list) {
this.$message.error('请设置url.list属性!')
return
}
// 加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1
}
// if (this.currentDeptId === '') return;
const params = this.getQueryParams()// 查询条件
params.depId = this.currentDeptId
getAction(this.url.list, params).then((res) => {
if (res.success && res.result) {
this.dataSource = res.result.records
this.ipagination.total = res.result.total
}
})
},
batchDel: function () {
if (!this.url.deleteBatch) {
this.$message.error('请设置url.deleteBatch属性!')
return
}
if (!this.currentDeptId) {
this.$message.error('未选中任何部门,无法取消部门与用户的关联!')
return
}
if (this.selectedRowKeys.length <= 0) {
this.$message.warning('请选择一条记录!')
} else {
var ids = ''
for (var a = 0; a < this.selectedRowKeys.length; a++) {
ids += this.selectedRowKeys[a] + ','
}
var that = this
console.log(this.currentDeptId)
this.$confirm({
title: '确认取消',
content: '是否取消用户与选中部门的关联?',
onOk: function () {
deleteAction(that.url.deleteBatch, { depId: that.currentDeptId, userIds: ids }).then((res) => {
if (res.success) {
that.$message.success('删除用户与选中部门关系成功!')
that.loadData()
that.onClearSelected()
} else {
that.$message.warning(res.message)
}
})
}
})
}
},
created() {
handleDelete: function (id) {
if (!this.url.delete) {
this.$message.error('请设置url.delete属性!')
return
}
if (!this.currentDeptId) {
this.$message.error('未选中任何部门,无法取消部门与用户的关联!')
return
}
var that = this
deleteAction(that.url.delete, { depId: this.currentDeptId, userId: id }).then((res) => {
if (res.success) {
that.$message.success('删除用户与选中部门关系成功!')
if (this.selectedRowKeys.length > 0) {
for (let i = 0; i < this.selectedRowKeys.length; i++) {
if (this.selectedRowKeys[i] == id) {
this.selectedRowKeys.splice(i, 1)
break
}
}
}
that.loadData()
} else {
that.$message.warning(res.message)
}
})
},
methods: {
searchReset() {
this.queryParam = {}
this.loadData(1);
},
loadData(arg) {
if (!this.url.list) {
this.$message.error("请设置url.list属性!")
return
}
//加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1;
}
//if (this.currentDeptId === '') return;
let params = this.getQueryParams();//查询条件
params.depId = this.currentDeptId;
getAction(this.url.list, params).then((res) => {
if (res.success && res.result) {
this.dataSource = res.result.records;
this.ipagination.total = res.result.total;
}
})
},
batchDel: function () {
if (!this.url.deleteBatch) {
this.$message.error("请设置url.deleteBatch属性!")
return
}
if (!this.currentDeptId) {
this.$message.error("未选中任何部门无法取消部门与用户的关联!")
return
}
if (this.selectedRowKeys.length <= 0) {
this.$message.warning('请选择一条记录!');
return;
open (record) {
this.currentDeptId = record.id
this.currentDept = record
this.loadData(1)
},
clearList () {
this.currentDeptId = ''
this.dataSource = []
},
hasSelectDept () {
if (this.currentDeptId == '') {
this.$message.error('请选择一个部门!')
return false
}
return true
},
handleAddUserDepart () {
if (this.currentDeptId == '') {
this.$message.error('请选择一个部门!')
} else {
this.$refs.selectUserModal.visible = true
}
},
handleEdit: function (record) {
this.$refs.modalForm.title = '编辑'
this.$refs.modalForm.departDisabled = true
this.$refs.modalForm.disableSubmit = false
this.$refs.modalForm.edit(record)
},
handleAdd: function () {
if (this.currentDeptId == '') {
this.$message.error('请选择一个部门!')
} else {
this.$refs.modalForm.departDisabled = true
// 初始化负责部门
this.$refs.modalForm.nextDepartOptions = [{ value: this.currentDept.key, label: this.currentDept.title }]
this.$refs.modalForm.title = '新增'
this.$refs.modalForm.edit({ activitiSync: '1', userIdentity: 1, selecteddeparts: this.currentDeptId })
}
},
selectOK (data) {
const params = {}
params.depId = this.currentDeptId
params.userIdList = []
for (var a = 0; a < data.length; a++) {
params.userIdList.push(data[a])
}
console.log(params)
postAction(this.url.edit, params).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.loadData()
} else {
var ids = "";
for (var a = 0; a < this.selectedRowKeys.length; a++) {
ids += this.selectedRowKeys[a] + ",";
}
var that = this;
console.log(this.currentDeptId);
this.$confirm({
title: "确认取消",
content: "是否取消用户与选中部门的关联?",
onOk: function () {
deleteAction(that.url.deleteBatch, {depId: that.currentDeptId, userIds: ids}).then((res) => {
if (res.success) {
that.$message.success("删除用户与选中部门关系成功");
that.loadData();
that.onClearSelected();
} else {
that.$message.warning(res.message);
}
});
}
});
this.$message.warning(res.message)
}
},
handleDelete: function (id) {
if (!this.url.delete) {
this.$message.error("请设置url.delete属性!")
return
}
if (!this.currentDeptId) {
this.$message.error("未选中任何部门无法取消部门与用户的关联!")
return
}
var that = this;
deleteAction(that.url.delete, {depId: this.currentDeptId, userId: id}).then((res) => {
if (res.success) {
that.$message.success("删除用户与选中部门关系成功");
if (this.selectedRowKeys.length>0){
for(let i =0; i<this.selectedRowKeys.length;i++){
if (this.selectedRowKeys[i] == id){
this.selectedRowKeys.splice(i,1);
break;
}
}
}
that.loadData();
} else {
that.$message.warning(res.message);
}
});
},
open(record) {
this.currentDeptId = record.id;
this.currentDept = record;
this.loadData(1);
},
clearList() {
this.currentDeptId = '';
this.dataSource = [];
},
hasSelectDept() {
if (this.currentDeptId == '') {
this.$message.error("请选择一个部门!")
return false;
}
return true;
},
handleAddUserDepart() {
if (this.currentDeptId == '' ) {
this.$message.error("请选择一个部门!")
} else {
this.$refs.selectUserModal.visible = true;
}
},
handleEdit: function (record) {
this.$refs.modalForm.title = "编辑";
this.$refs.modalForm.departDisabled = true;
this.$refs.modalForm.disableSubmit = false;
this.$refs.modalForm.edit(record);
},
handleAdd: function () {
if (this.currentDeptId == '') {
this.$message.error("请选择一个部门!")
} else {
this.$refs.modalForm.departDisabled = true;
//初始化负责部门
this.$refs.modalForm.nextDepartOptions=[{value:this.currentDept.key,label:this.currentDept.title}]
this.$refs.modalForm.title = "新增";
this.$refs.modalForm.edit({activitiSync:'1',userIdentity:1,selecteddeparts:this.currentDeptId})
}
},
selectOK(data) {
let params = {};
params.depId = this.currentDeptId;
params.userIdList = [];
for (var a = 0; a < data.length; a++) {
params.userIdList.push(data[a]);
}
console.log(params);
postAction(this.url.edit, params).then((res) => {
if (res.success) {
this.$message.success(res.message);
this.loadData();
} else {
this.$message.warning(res.message);
}
})
},
})
}
}
}
</script>
<style scoped>
/** Button按钮间距 */
@@ -323,4 +318,4 @@
margin-top: -16px;
margin-bottom: 16px;
}
</style>
</style>
@@ -56,132 +56,132 @@
</template>
<script>
import pick from 'lodash.pick'
import {addDictItem, editDictItem} from '@/api/api'
import { getAction } from '@api/manage'
import pick from 'lodash.pick'
import { addDictItem, editDictItem } from '@/api/api'
import { getAction } from '@api/manage'
export default {
name: "DictItemModal",
data() {
return {
title: "操作",
visible: false,
visibleCheck: true,
model: {},
dictId: "",
status: 1,
labelCol: {
xs: {span: 24},
sm: {span: 5},
},
wrapperCol: {
xs: {span: 24},
sm: {span: 16},
},
confirmLoading: false,
validatorRules: {
itemText: [{required: true, message: '请输入名称!'}],
itemValue: [{required: true, message: '请输入数据值!'},{validator: this.validateItemValue}],
},
export default {
name: 'DictItemModal',
data () {
return {
title: '操作',
visible: false,
visibleCheck: true,
model: {},
dictId: '',
status: 1,
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
confirmLoading: false,
validatorRules: {
itemText: [{ required: true, message: '请输入名称!' }],
itemValue: [{ required: true, message: '请输入数据值!' }, { validator: this.validateItemValue }]
}
}
},
created () {
},
methods: {
add (dictId) {
this.dictId = dictId
// 初始化默认值
this.edit({ sortOrder: 1, status: 1 })
},
edit (record) {
if (record.id) {
this.dictId = record.dictId
}
this.status = record.status
this.visibleCheck = (record.status == 1)
this.model = Object.assign({}, record)
this.model.dictId = this.dictId
this.model.status = this.status
this.visible = true
},
onChose (checked) {
if (checked) {
this.status = 1
this.visibleCheck = true
} else {
this.status = 0
this.visibleCheck = false
}
},
created() {
},
methods: {
add(dictId) {
this.dictId = dictId;
//初始化默认值
this.edit({sortOrder:1,status:1});
},
edit(record) {
if (record.id) {
this.dictId = record.dictId;
}
this.status = record.status;
this.visibleCheck = (record.status == 1) ? true : false;
this.model = Object.assign({}, record);
this.model.dictId = this.dictId;
this.model.status = this.status;
this.visible = true;
},
onChose(checked) {
if (checked) {
this.status = 1;
this.visibleCheck = true;
} else {
this.status = 0;
this.visibleCheck = false;
}
},
// 确定
handleOk() {
const that = this;
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
this.model.itemText = (this.model.itemText || '').trim()
this.model.itemValue = (this.model.itemValue || '').trim()
this.model.description = (this.model.description || '').trim()
this.model.status = this.status;
let obj;
if (!this.model.id) {
obj = addDictItem(this.model);
// 确定
handleOk () {
const that = this
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true
this.model.itemText = (this.model.itemText || '').trim()
this.model.itemValue = (this.model.itemValue || '').trim()
this.model.description = (this.model.description || '').trim()
this.model.status = this.status
let obj
if (!this.model.id) {
obj = addDictItem(this.model)
} else {
obj = editDictItem(this.model)
}
obj.then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
} else {
obj = editDictItem(this.model);
that.$message.warning(res.message)
}
obj.then((res) => {
if (res.success) {
that.$message.success(res.message);
that.$emit('ok');
} else {
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
that.close();
})
}else{
return false;
}
})
},
// 关闭
handleCancel() {
this.close();
},
close() {
this.$emit('close');
this.visible = false;
this.$refs.form.resetFields();
},
validateItemValue(rule, value, callback){
let param = {
itemValue:value,
dictId:this.dictId,
}).finally(() => {
that.confirmLoading = false
that.close()
})
} else {
return false
}
if(this.model.id){
param.id = this.model.id
}
if(value){
let reg=new RegExp("[`_~!@#$^&*()=|{}'.<>《》/?!¥()—【】‘;:”“。,、?]")
if(reg.test(value)){
callback("数据值不能包含特殊字符!")
}else{
//update--begin--autor:lvdandan-----date:20201203------forJT-27【数据字典】字典 - 数据值可重复
getAction("/sys/dictItem/dictItemCheck",param).then((res)=>{
if(res.success){
callback()
}else{
callback(res.message);
}
});
//update--end--autor:lvdandan-----date:20201203------forJT-27【数据字典】字典 - 数据值可重复
}
}else{
callback()
})
},
// 关闭
handleCancel () {
this.close()
},
close () {
this.$emit('close')
this.visible = false
this.$refs.form.resetFields()
},
validateItemValue (rule, value, callback) {
const param = {
itemValue: value,
dictId: this.dictId
}
if (this.model.id) {
param.id = this.model.id
}
if (value) {
const reg = new RegExp("[`_~!@#$^&*()=|{}'.<>《》/?!¥()—【】‘;:”“。,、?]")
if (reg.test(value)) {
callback('数据值不能包含特殊字符')
} else {
// update--begin--autor:lvdandan-----date:20201203------forJT-27【数据字典】字典 - 数据值可重复
getAction('/sys/dictItem/dictItemCheck', param).then((res) => {
if (res.success) {
callback()
} else {
callback(res.message)
}
})
// update--end--autor:lvdandan-----date:20201203------forJT-27【数据字典】字典 - 数据值可重复
}
} else {
callback()
}
}
}
}
</script>
+100 -100
View File
@@ -42,109 +42,109 @@
</template>
<script>
import pick from 'lodash.pick'
import { addDict, editDict, duplicateCheck } from '@/api/api'
import pick from 'lodash.pick'
import { addDict, editDict, duplicateCheck } from '@/api/api'
export default {
name: 'DictModal',
data() {
return {
value: 1,
title: '操作',
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
confirmLoading: false,
validatorRules: {
dictName: [{ required: true, message: '请输入字典名称!' }],
dictCode: [
{ required: true, message: '请输入字典编码!' },
{ validator: this.validateDictCode }]
}
}
},
created() {
},
methods: {
validateDictCode(rule, value, callback) {
// 重复校验
var params = {
tableName: 'sys_dict',
fieldName: 'dict_code',
fieldVal: value,
dataId: this.model.id
}
duplicateCheck(params).then((res) => {
if (res.success) {
callback()
} else {
callback(res.message)
}
})
export default {
name: 'DictModal',
data () {
return {
value: 1,
title: '操作',
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
handleChange(value) {
this.model.status = value
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
add() {
this.edit({})
},
edit(record) {
if (record.id) {
this.visiblekey = true
} else {
this.visiblekey = false
}
this.model = Object.assign({}, record)
this.visible = true
},
// 确定
handleOk() {
const that = this
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true
this.model.dictName = (this.model.dictName || '').trim()
this.model.dictCode = (this.model.dictCode || '').trim()
this.model.description = (this.model.description || '').trim()
let obj
if (!this.model.id) {
obj = addDict(this.model)
} else {
obj = editDict(this.model)
}
obj.then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
that.close()
})
}else{
return false;
}
})
},
// 关闭
handleCancel() {
this.close()
},
close() {
this.$emit('close')
this.visible = false
this.$refs.form.resetFields();
confirmLoading: false,
validatorRules: {
dictName: [{ required: true, message: '请输入字典名称!' }],
dictCode: [
{ required: true, message: '请输入字典编码!' },
{ validator: this.validateDictCode }]
}
}
},
created () {
},
methods: {
validateDictCode (rule, value, callback) {
// 重复校验
var params = {
tableName: 'sys_dict',
fieldName: 'dict_code',
fieldVal: value,
dataId: this.model.id
}
duplicateCheck(params).then((res) => {
if (res.success) {
callback()
} else {
callback(res.message)
}
})
},
handleChange (value) {
this.model.status = value
},
add () {
this.edit({})
},
edit (record) {
if (record.id) {
this.visiblekey = true
} else {
this.visiblekey = false
}
this.model = Object.assign({}, record)
this.visible = true
},
// 确定
handleOk () {
const that = this
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true
this.model.dictName = (this.model.dictName || '').trim()
this.model.dictCode = (this.model.dictCode || '').trim()
this.model.description = (this.model.description || '').trim()
let obj
if (!this.model.id) {
obj = addDict(this.model)
} else {
obj = editDict(this.model)
}
obj.then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
that.close()
})
} else {
return false
}
})
},
// 关闭
handleCancel () {
this.close()
},
close () {
this.$emit('close')
this.visible = false
this.$refs.form.resetFields()
}
}
</script>
}
</script>
@@ -100,192 +100,189 @@
</template>
<script>
import { postAction } from '@/api/manage'
import { postAction } from '@/api/manage'
export default {
name: 'GateWayRouteModal',
components: {},
data() {
export default {
name: 'GateWayRouteModal',
components: {},
data () {
return {
layout: 'horizontal',
labelCol: { span: 3 },
wrapperCol: { span: 14 },
currentNameIndex: 0,
currentTagIndex: -1,
predicates: {},
filterArray: [{ key: 0, name: '熔断器' }, { key: 1, name: '限流过滤器' }],
tagArray: ['Path', 'Host', 'Cookie', 'Header', 'Method', 'Query', 'After', 'Before', 'Between', 'RemoteAddr'],
inputVisible: false,
inputValue: '',
url: {
update: '/sys/gatewayRoute/updateAll',
clear: '/sys/gatewayRoute/clearRedis'
},
router: this.getRouter(),
title: '路由编辑',
visible: false,
loading: false
}
},
methods: {
getRouter () {
return {
layout: 'horizontal',
labelCol: { span: 3 },
wrapperCol: { span: 14 },
currentNameIndex: 0,
currentTagIndex:-1,
predicates: {},
filterArray: [{ key: 0, name: '熔断器' }, { key: 1, name: '限流过滤器' }],
tagArray: ['Path', 'Host', 'Cookie', 'Header', 'Method', 'Query', 'After', 'Before', 'Between', 'RemoteAddr'],
inputVisible: false,
inputValue: '',
url: {
update: '/sys/gatewayRoute/updateAll',
clear: '/sys/gatewayRoute/clearRedis'
},
router: this.getRouter(),
title: '路由编辑',
visible: false,
loading: false
routerId: '',
name: '',
uri: '',
predicates: [],
filters: []
}
},
methods: {
getRouter() {
return {
routerId: '',
name: '',
uri: '',
predicates: [],
filters: []
}
},
show(router) {
if (router) {
router.status=Boolean(router.status)
this.router = router
} else {
this.router = this.getRouter()
this.inputValue=''
}
this.visible = true
this.currentTagIndex=-1
this.currentNameIndex=-1
},
close() {
this.reset()
this.$emit('close')
this.$refs['form'].resetFields()
this.visible = false
},
//删除路由条件配置项
removeTag(item, removedTag) {
const tags = item.args.filter(tag => tag !== removedTag)
item.args = tags
},
//添加路由选项
predicatesHandleMenuClick(e) {
this.router.predicates.push({
args: [],
name: e.key
})
},
editTag(tag,index){
this.currentTagIndex=index
},
//显示输入框
showInput(item, index) {
this.inputVisible = true
this.currentNameIndex = index
},
//路由选项输入框失去焦点事件
handleInputChange(e) {
this.inputValue = e.target.value
},
//删除路由条件
removePredicate(item, index) {
item.predicates.splice(index, 1)
},
//删除过滤器参数
removeFilterParams(item, index) {
item.args.splice(index, 1)
},
//删除过滤器
removeFilter(item, index) {
item.filters.splice(index, 1)
},
//添加过滤器参数
addFilterParams(item) {
item.args.push({
key: 'key' + item.args.length + 1,
value: ''
})
},
//过滤器添加事件
filterHandleMenuClick(e) {
if (e.key == 0) {
this.router.filters.push({
args: [ {
key: 'name',
value: 'default'
},{
key: 'fallbackUri',
value: 'forward:/fallback'
}],
name:'Hystrix',
title: this.filterArray[0].name
})
}
if (e.key == 1) {
this.router.filters.push({
args: [ {
key: 'key-resolver',
value: '#{@ipKeyResolver}'
}, {
key: 'redis-rate-limiter.replenishRate',
value: 20
}, {
key: 'redis-rate-limiter.burstCapacity',
value: 20
}],
name:"RequestRateLimiter",
title: this.filterArray[1].name
})
}
},
//输入框确认
handleInputConfirm(item) {
const inputValue = this.inputValue
let tags = item.args
if (inputValue && tags.indexOf(inputValue) === -1) {
item.args = [...tags, inputValue]
}
console.log(tags)
Object.assign(this, {
tags,
inputVisible: false,
inputValue: ''
})
this.currentTagIndex=-1
},
//输入框确认
handleInputEditConfirm(item,tag,index) {
if(this.inputValue)
{
const inputValue = this.inputValue
item.args[index]=inputValue
}
this.currentTagIndex=-1
},
reset() {
this.expandedKeysss = []
this.checkedKeys = []
this.defaultCheckedKeys = []
this.loading = false
},
//关闭弹窗
handleCancel() {
this.close()
},
//提交路由
handleSubmit() {
let { predicates, filters, ...other } = this.router
let router = other
router.predicates = JSON.stringify(this.router.predicates)
router.filters = JSON.stringify(this.router.filters)
postAction(this.url.update, {
router
}).then(res => {
if (res.success) {
this.close()
this.$emit('ok')
this.$message.success(res.message)
} else {
this.$message.error(res.message)
}
})
show (router) {
if (router) {
router.status = Boolean(router.status)
this.router = router
} else {
this.router = this.getRouter()
this.inputValue = ''
}
this.visible = true
this.currentTagIndex = -1
this.currentNameIndex = -1
},
close () {
this.reset()
this.$emit('close')
this.$refs.form.resetFields()
this.visible = false
},
// 删除路由条件配置项
removeTag (item, removedTag) {
const tags = item.args.filter(tag => tag !== removedTag)
item.args = tags
},
// 添加路由选项
predicatesHandleMenuClick (e) {
this.router.predicates.push({
args: [],
name: e.key
})
},
editTag (tag, index) {
this.currentTagIndex = index
},
// 显示输入框
showInput (item, index) {
this.inputVisible = true
this.currentNameIndex = index
},
// 路由选项输入框失去焦点事件
handleInputChange (e) {
this.inputValue = e.target.value
},
// 删除路由条件
removePredicate (item, index) {
item.predicates.splice(index, 1)
},
// 删除过滤器参数
removeFilterParams (item, index) {
item.args.splice(index, 1)
},
// 删除过滤器
removeFilter (item, index) {
item.filters.splice(index, 1)
},
// 添加过滤器参数
addFilterParams (item) {
item.args.push({
key: 'key' + item.args.length + 1,
value: ''
})
},
// 过滤器添加事件
filterHandleMenuClick (e) {
if (e.key == 0) {
this.router.filters.push({
args: [{
key: 'name',
value: 'default'
}, {
key: 'fallbackUri',
value: 'forward:/fallback'
}],
name: 'Hystrix',
title: this.filterArray[0].name
})
}
if (e.key == 1) {
this.router.filters.push({
args: [{
key: 'key-resolver',
value: '#{@ipKeyResolver}'
}, {
key: 'redis-rate-limiter.replenishRate',
value: 20
}, {
key: 'redis-rate-limiter.burstCapacity',
value: 20
}],
name: 'RequestRateLimiter',
title: this.filterArray[1].name
})
}
},
// 输入框确认
handleInputConfirm (item) {
const inputValue = this.inputValue
const tags = item.args
if (inputValue && tags.indexOf(inputValue) === -1) {
item.args = [...tags, inputValue]
}
console.log(tags)
Object.assign(this, {
tags,
inputVisible: false,
inputValue: ''
})
this.currentTagIndex = -1
},
// 输入框确认
handleInputEditConfirm (item, tag, index) {
if (this.inputValue) {
const inputValue = this.inputValue
item.args[index] = inputValue
}
this.currentTagIndex = -1
},
reset () {
this.expandedKeysss = []
this.checkedKeys = []
this.defaultCheckedKeys = []
this.loading = false
},
// 关闭弹窗
handleCancel () {
this.close()
},
// 提交路由
handleSubmit () {
const { predicates, filters, ...other } = this.router
const router = other
router.predicates = JSON.stringify(this.router.predicates)
router.filters = JSON.stringify(this.router.filters)
postAction(this.url.update, {
router
}).then(res => {
if (res.success) {
this.close()
this.$emit('ok')
this.$message.success(res.message)
} else {
this.$message.error(res.message)
}
})
}
}
}
</script>
<style lang="less" scoped>
@@ -300,4 +297,4 @@
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>
</style>
@@ -30,113 +30,113 @@
</template>
<script>
import {changePassword} from '@/api/api'
import { changePassword } from '@/api/api'
export default {
name: "PasswordModal",
data () {
return {
visible: false,
confirmLoading: false,
confirmDirty: false,
validatorRules:{
password:{
rules: [{
required: true,
pattern:/^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{8,}$/,
message: '密码由8位数字、大小写字母和特殊符号组成!'
}, {
validator: this.validateToNextPassword,
}],
},
confirmpassword:{
rules: [{
required: true, message: '请重新输入登录密码!',
}, {
validator: this.compareToFirstPassword,
}],
},
export default {
name: 'PasswordModal',
data () {
return {
visible: false,
confirmLoading: false,
confirmDirty: false,
validatorRules: {
password: {
rules: [{
required: true,
pattern: /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{8,}$/,
message: '密码由8位数字、大小写字母和特殊符号组成!'
}, {
validator: this.validateToNextPassword
}]
},
confirmpassword: {
rules: [{
required: true, message: '请重新输入登录密码!'
}, {
validator: this.compareToFirstPassword
}]
}
},
model: {},
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
form:this.$form.createForm(this)
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
form: this.$form.createForm(this)
}
},
created () {
console.log('created')
},
methods: {
show (username) {
this.form.resetFields()
this.visible = true
this.model.username = username
this.$nextTick(() => {
this.form.setFieldsValue({ username: username })
})
},
close () {
this.$emit('close')
this.visible = false
this.disableSubmit = false
this.selectedRole = []
},
handleSubmit () {
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.confirmLoading = true
const formData = Object.assign(this.model, values)
changePassword(formData).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.$emit('ok')
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.confirmLoading = false
this.close()
})
}
})
},
handleCancel () {
this.close()
},
validateToNextPassword (rule, value, callback) {
const form = this.form
const confirmpassword = form.getFieldValue('confirmpassword')
console.log('confirmpassword==>', confirmpassword)
if (value && confirmpassword && value !== confirmpassword) {
callback('两次输入的密码不一样!')
}
if (value && this.confirmDirty) {
form.validateFields(['confirm'], { force: true })
}
callback()
},
compareToFirstPassword (rule, value, callback) {
const form = this.form
if (value && value !== form.getFieldValue('password')) {
callback('两次输入的密码不一样!')
} else {
callback()
}
},
created () {
console.log("created");
},
methods: {
show (username) {
this.form.resetFields();
this.visible = true;
this.model.username = username;
this.$nextTick(() => {
this.form.setFieldsValue({username:username});
});
},
close () {
this.$emit('close');
this.visible = false;
this.disableSubmit = false;
this.selectedRole = [];
},
handleSubmit () {
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.confirmLoading = true;
let formData = Object.assign(this.model, values);
changePassword(formData).then((res)=>{
if(res.success){
this.$message.success(res.message);
this.$emit('ok');
}else{
this.$message.warning(res.message);
}
}).finally(() => {
this.confirmLoading = false;
this.close();
});
}
})
},
handleCancel () {
this.close()
},
validateToNextPassword (rule, value, callback) {
const form = this.form;
const confirmpassword=form.getFieldValue('confirmpassword');
console.log("confirmpassword==>",confirmpassword);
if (value && confirmpassword && value !== confirmpassword) {
callback('两次输入的密码不一样!');
}
if (value && this.confirmDirty) {
form.validateFields(['confirm'], { force: true })
}
callback();
},
compareToFirstPassword (rule, value, callback) {
const form = this.form;
if (value && value !== form.getFieldValue('password')) {
callback('两次输入的密码不一样!');
} else {
callback()
}
},
handleConfirmBlur (e) {
const value = e.target.value
this.confirmDirty = this.confirmDirty || !!value
}
handleConfirmBlur (e) {
const value = e.target.value
this.confirmDirty = this.confirmDirty || !!value
}
}
</script>
}
</script>
@@ -57,118 +57,118 @@
</template>
<script>
import { httpAction } from '@/api/manage'
import { httpAction } from '@/api/manage'
export default {
name: 'PermissionDataRuleModal',
data() {
return {
queryParam: {},
title: '操作',
visible: false,
model: {},
ruleConditionList: [],
labelCol: {
xs: {span: 24},
sm: {span: 5}
},
wrapperCol: {
xs: {span: 24},
sm: {span: 16}
},
confirmLoading: false,
permissionId: '',
validatorRules: {
ruleConditions: [{required: true, message: '请选择条件!'}],
ruleName:[{required: true, message: '请输入规则名称!'}],
ruleValue: [{required: true, message: '请输入规则值!'}],
ruleColumn: []
},
url: {
list: '/sys/dictItem/page',
add: '/sys/permission/addPermissionRule',
edit: '/sys/permission/editPermissionRule'
},
showRuleColumn:true
export default {
name: 'PermissionDataRuleModal',
data () {
return {
queryParam: {},
title: '操作',
visible: false,
model: {},
ruleConditionList: [],
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
confirmLoading: false,
permissionId: '',
validatorRules: {
ruleConditions: [{ required: true, message: '请选择条件!' }],
ruleName: [{ required: true, message: '请输入规则名称!' }],
ruleValue: [{ required: true, message: '请输入规则值!' }],
ruleColumn: []
},
url: {
list: '/sys/dictItem/page',
add: '/sys/permission/addPermissionRule',
edit: '/sys/permission/editPermissionRule'
},
showRuleColumn: true
}
},
created () {
},
methods: {
add (permId) {
this.permissionId = permId
// 初始化默认值
this.edit({ status: '1' })
},
edit (record) {
this.model = Object.assign({}, record)
if (record.permissionId) {
this.model.permissionId = record.permissionId
} else {
this.model.permissionId = this.permissionId
}
this.visible = true
this.initRuleCondition()
},
close () {
this.$emit('close')
this.visible = false
this.$refs.form.resetFields()
},
handleOk () {
const that = this
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true
let httpurl = ''
let method = ''
if (!this.model.id) {
httpurl += this.url.add
method = 'post'
} else {
httpurl += this.url.edit
method = 'put'
}
httpAction(httpurl, this.model, method).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
that.close()
})
} else {
return false
}
})
},
handleCancel () {
this.close()
},
initRuleCondition () {
if (this.model.ruleConditions && this.model.ruleConditions == 'USE_SQL_RULES') {
this.showRuleColumn = false
} else {
this.showRuleColumn = true
}
},
created() {
},
methods: {
add(permId) {
this.permissionId = permId
//初始化默认值
this.edit({status:'1'})
},
edit(record) {
this.model = Object.assign({}, record)
if (record.permissionId) {
this.model.permissionId = record.permissionId
} else {
this.model.permissionId = this.permissionId
}
this.visible = true
this.initRuleCondition()
},
close() {
this.$emit('close')
this.visible = false
this.$refs.form.resetFields()
},
handleOk() {
const that = this
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true
let httpurl = ''
let method = ''
if (!this.model.id) {
httpurl += this.url.add
method = 'post'
} else {
httpurl += this.url.edit
method = 'put'
}
httpAction(httpurl, this.model, method).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
that.close()
})
}else{
return false;
}
})
},
handleCancel() {
this.close()
},
initRuleCondition(){
if(this.model.ruleConditions && this.model.ruleConditions=='USE_SQL_RULES'){
this.showRuleColumn = false
}else{
this.showRuleColumn = true
}
},
handleChangeRuleCondition(val){
if(val=='USE_SQL_RULES'){
this.model.ruleColumn=''
this.showRuleColumn = false
}else{
this.showRuleColumn = true
}
handleChangeRuleCondition (val) {
if (val == 'USE_SQL_RULES') {
this.model.ruleColumn = ''
this.showRuleColumn = false
} else {
this.showRuleColumn = true
}
}
}
}
</script>
<style scoped>
</style>
</style>
@@ -27,7 +27,6 @@
<a-input placeholder="请输入菜单名称" v-model="model.name" :readOnly="disableSubmit"/>
</a-form-model-item>
<a-form-model-item
v-show="model.menuType!=0"
label="上级菜单"
@@ -89,7 +88,6 @@
label="授权策略">
<j-dict-select-tag v-model="model.permsType" placeholder="请选择授权策略" :type="'radio'" dictCode="global_perms_type"/>
</a-form-model-item>
<a-form-model-item
v-show="!show"
@@ -143,7 +141,6 @@
<a-switch checkedChildren="" unCheckedChildren="" v-model="model.keepAlive"/>
</a-form-model-item>
<a-form-model-item
v-show="show"
:labelCol="labelCol"
@@ -176,193 +173,193 @@
</template>
<script>
import {addPermission,editPermission,queryTreeList, duplicateCheck} from '@/api/api'
import Icons from './icon/Icons'
import { addPermission, editPermission, queryTreeList, duplicateCheck } from '@/api/api'
import Icons from './icon/Icons'
export default {
name: "PermissionModal",
components: {Icons},
data () {
export default {
name: 'PermissionModal',
components: { Icons },
data () {
return {
drawerWidth: 700,
treeData: [],
title: '操作',
visible: false,
disableSubmit: false,
model: {},
show: true, // 根据菜单类型,动态显示隐藏表单元素
menuLabel: '菜单名称',
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
confirmLoading: false,
iconChooseVisible: false,
validateStatus: ''
}
},
computed: {
validatorRules: function () {
return {
drawerWidth:700,
treeData:[],
title:"操作",
visible: false,
disableSubmit:false,
model: {},
show:true,//根据菜单类型,动态显示隐藏表单元素
menuLabel:'菜单名称',
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
iconChooseVisible: false,
validateStatus:""
name: [{ required: true, message: '请输入菜单标题!' }],
component: [{ required: this.show, message: '请输入前端组件!' }],
url: [{ required: this.show, message: '请输入菜单路径!' }],
permsType: [{ required: true, message: '请输入授权策略!' }],
perms: [{ required: false, message: '请输入授权标识!' }, { validator: this.validatePerms }]
}
},
computed:{
validatorRules:function() {
return {
name:[{ required: true, message: '请输入菜单标题!' }],
component:[{ required: this.show, message: '请输入前端组件!' }],
url: [{ required: this.show, message: '请输入菜单路径!' }],
permsType: [{ required: true, message: '请输入授权策略!' }],
perms:[{ required: false, message: '请输入授权标识!' },{validator: this.validatePerms }]
}
}
},
created () {
},
methods: {
loadTree(){
var that = this;
queryTreeList().then((res)=>{
if(res.success){
that.treeData = [];
let treeList = res.result.treeList
for(let a=0;a<treeList.length;a++){
let temp = treeList[a];
temp.isLeaf = temp.leaf;
that.treeData.push(temp);
}
}
},
created () {
},
methods: {
loadTree () {
var that = this
queryTreeList().then((res) => {
if (res.success) {
that.treeData = []
const treeList = res.result.treeList
for (let a = 0; a < treeList.length; a++) {
const temp = treeList[a]
temp.isLeaf = temp.leaf
that.treeData.push(temp)
}
});
},
add () {
//初始化默认值
this.edit({status:'1', permsType:'1', sortNo:1.0, route:true, menuType:0 });
},
edit (record) {
this.resetScreenSize(); // 调用此方法,根据屏幕宽度自适应调整抽屉的宽度
this.model = Object.assign({}, record);
}
})
},
add () {
// 初始化默认值
this.edit({ status: '1', permsType: '1', sortNo: 1.0, route: true, menuType: 0 })
},
edit (record) {
this.resetScreenSize() // 调用此方法,根据屏幕宽度自适应调整抽屉的宽度
this.model = Object.assign({}, record)
//--------------------------------------------------------------------------------------------------
//根据菜单类型,动态展示页面字段
console.log('record: ',record)
this.show = record.menuType==2?false:true;
this.menuLabel = record.menuType==2?'按钮/权限':'菜单名称';
// --------------------------------------------------------------------------------------------------
// 根据菜单类型,动态展示页面字段
console.log('record: ', record)
this.show = record.menuType != 2
this.menuLabel = record.menuType == 2 ? '按钮/权限' : '菜单名称'
this.visible = true;
this.loadTree();
},
close () {
this.$emit('close');
this.disableSubmit = false;
this.visible = false;
this.$refs.form.resetFields();
},
handleOk () {
const that = this;
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
if ((this.model.menuType == 1 || this.model.menuType == 2) && !this.model.parentId) {
that.validateStatus = 'error';
that.$message.error("请检查你填的类型以及信息是否正确");
return;
this.visible = true
this.loadTree()
},
close () {
this.$emit('close')
this.disableSubmit = false
this.visible = false
this.$refs.form.resetFields()
},
handleOk () {
const that = this
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
if ((this.model.menuType == 1 || this.model.menuType == 2) && !this.model.parentId) {
that.validateStatus = 'error'
that.$message.error('请检查你填的类型以及信息是否正确')
return
} else {
that.validateStatus = 'success'
}
that.confirmLoading = true
let obj
if (!this.model.id) {
obj = addPermission(this.model)
} else {
obj = editPermission(this.model)
}
obj.then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
} else {
that.validateStatus = 'success';
that.$message.warning(res.message)
}
that.confirmLoading = true;
let obj;
if (!this.model.id) {
obj = addPermission(this.model);
} else {
obj = editPermission(this.model);
}
obj.then((res) => {
if (res.success) {
that.$message.success(res.message);
that.$emit('ok');
} else {
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
that.close();
});
}else{
return false;
}).finally(() => {
that.confirmLoading = false
that.close()
})
} else {
return false
}
})
},
handleCancel () {
this.close()
},
validateNumber (rule, value, callback) {
if (!value || new RegExp(/^[0-9]*[1-9][0-9]*$/).test(value)) {
callback()
} else {
callback('请输入正整数!')
}
},
validatePerms (rule, value, callback) {
if (value && value.length > 0) {
// 校验授权标识是否存在
var params = {
tableName: 'sys_permission',
fieldName: 'perms',
fieldVal: value,
dataId: this.model.id
}
duplicateCheck(params).then((res) => {
if (res.success) {
callback()
} else {
callback('授权标识已存在!')
}
})
},
handleCancel () {
this.close()
},
validateNumber(rule, value, callback){
if(!value || new RegExp(/^[0-9]*[1-9][0-9]*$/).test(value)){
callback();
}else{
callback("请输入正整数!");
}
},
validatePerms(rule, value, callback){
if(value && value.length>0){
//校验授权标识是否存在
var params = {
tableName: 'sys_permission',
fieldName: 'perms',
fieldVal: value,
dataId: this.model.id
};
duplicateCheck(params).then((res) => {
if (res.success) {
callback()
} else {
callback("授权标识已存在!")
}
})
}else{
callback()
}
},
onChangeMenuType(e) {
if(this.model.menuType == 2){
this.show = false;
this.menuLabel = '按钮/权限';
}else{
this.show = true;
this.menuLabel = '菜单名称';
}
this.$nextTick(() => {
this.$refs.form.validateField(['url','component']);
});
},
selectIcons(){
this.iconChooseVisible = true
},
handleIconCancel () {
this.iconChooseVisible = false
},
handleIconChoose (value) {
this.model.icon = value
this.iconChooseVisible = false
},
// 根据屏幕变化,设置抽屉尺寸
resetScreenSize(){
let screenWidth = document.body.clientWidth;
if(screenWidth < 500){
this.drawerWidth = screenWidth;
}else{
this.drawerWidth = 700;
}
},
handleParentIdChange(value){
if(!value){
this.validateStatus="error"
}else{
this.validateStatus="success"
}
} else {
callback()
}
},
onChangeMenuType (e) {
if (this.model.menuType == 2) {
this.show = false
this.menuLabel = '按钮/权限'
} else {
this.show = true
this.menuLabel = '菜单名称'
}
this.$nextTick(() => {
this.$refs.form.validateField(['url', 'component'])
})
},
selectIcons () {
this.iconChooseVisible = true
},
handleIconCancel () {
this.iconChooseVisible = false
},
handleIconChoose (value) {
this.model.icon = value
this.iconChooseVisible = false
},
// 根据屏幕变化,设置抽屉尺寸
resetScreenSize () {
const screenWidth = document.body.clientWidth
if (screenWidth < 500) {
this.drawerWidth = screenWidth
} else {
this.drawerWidth = 700
}
},
handleParentIdChange (value) {
if (!value) {
this.validateStatus = 'error'
} else {
this.validateStatus = 'success'
}
}
}
}
</script>
<style scoped>
</style>
</style>
@@ -34,107 +34,106 @@
</template>
<script>
import { httpAction } from '@/api/manage'
import cronValidator from "@/components/jero/JEasyCron/validator";
import { httpAction } from '@/api/manage'
import cronValidator from '@/components/jero/JEasyCron/validator'
export default {
name: "QuartzJobModal",
components: {
export default {
name: 'QuartzJobModal',
components: {
},
data () {
return {
title:"操作",
buttonStyle: 'solid',
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
cron: {
label: '',
value: ''
},
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules: {
cronExpression: [
{required: true, message: '请输入cron表达式!'},
{validator: cronValidator,}
],
jobClassName: [{required: true, message: '请输入任务类名!'}]
},
url: {
add: "/sys/quartzJob/add",
edit: "/sys/quartzJob/edit",
},
},
data () {
return {
title: '操作',
buttonStyle: 'solid',
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
cron: {
label: '',
value: ''
},
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules: {
cronExpression: [
{ required: true, message: '请输入cron表达式!' },
{ validator: cronValidator }
],
jobClassName: [{ required: true, message: '请输入任务类名!' }]
},
url: {
add: '/sys/quartzJob/add',
edit: '/sys/quartzJob/edit'
}
}
},
created () {
},
methods: {
add () {
// 统一设置默认值
this.edit({
cronExpression: '* * * * * ? *',
status: 0
})
},
created () {
edit (record) {
this.visible = true
this.$nextTick(() => {
this.$refs.form.resetFields()
this.model = Object.assign({}, record)
})
},
methods: {
add() {
// 统一设置默认值
this.edit({
cronExpression: '* * * * * ? *',
status: 0,
})
},
edit (record) {
this.visible = true;
this.$nextTick(() => {
this.$refs.form.resetFields()
this.model = Object.assign({}, record)
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
const that = this;
// 触发表单验证
this.$refs.form.validate((ok, err) => {
if (ok) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
console.log('提交参数',this.model)
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
that.close();
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
})
close () {
this.$emit('close')
this.visible = false
},
handleOk () {
const that = this
// 触发表单验证
this.$refs.form.validate((ok, err) => {
if (ok) {
that.confirmLoading = true
let httpurl = ''
let method = ''
if (!this.model.id) {
httpurl += this.url.add
method = 'post'
} else {
httpurl += this.url.edit
method = 'put'
}
})
},
handleCancel () {
this.close()
},
console.log('提交参数', this.model)
httpAction(httpurl, this.model, method).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
that.close()
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
})
}
})
},
handleCancel () {
this.close()
}
}
}
</script>
<style scoped>
</style>
</style>
@@ -41,17 +41,17 @@
</template>
<script>
import { postAction, getAction, } from '@/api/manage'
import { postAction, getAction } from '@/api/manage'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
export default {
name: 'RoleAssignment',
components: {},
data() {
data () {
return {
token:Vue.ls.get(ACCESS_TOKEN),
title: "角色配置",
token: Vue.ls.get(ACCESS_TOKEN),
title: '角色配置',
total: 0,
selectedRowKeysDate: {},
loading: false,
@@ -69,7 +69,7 @@ export default {
form: {},
rules: {},
areaTable: [],
flag: false, //表单提交标识
flag: false, // 表单提交标识
spinLoading: false,
confirmLoading: false,
selectedRowKeys: [],
@@ -84,11 +84,11 @@ export default {
require: true
}
},
mounted() {
mounted () {
this.loadData()
},
methods: {
loadData() {
loadData () {
this.loading = true
getAction(`sys/role/queryall`, {}).then(res => {
if (res.success) {
@@ -98,18 +98,18 @@ export default {
this.loading = false
})
},
show(){
this.visible = true;
show () {
this.visible = true
},
handleCancel() {
this.visible = false;
handleCancel () {
this.visible = false
this.$emit('rolevisible', false)
},
//保存
handleSubmit() {
let param = {ids: this.selectedRowKeysArray.join(','), selectedroles: `${this.selectedRole.join(',')}` }
// 保存
handleSubmit () {
const param = { ids: this.selectedRowKeysArray.join(','), selectedroles: `${this.selectedRole.join(',')}` }
postAction('/sys/user/setRole', param).then((res) => {
this.visible = false;
this.visible = false
if (res.success) {
this.$emit('rolevisible', false)
this.$message.success(res.message)
@@ -161,4 +161,4 @@ export default {
}
}
</style>
</style>
@@ -33,88 +33,88 @@
</template>
<script>
import ARow from 'ant-design-vue/es/grid/Row'
import ACol from 'ant-design-vue/es/grid/Col'
import { getAction,postAction } from '@/api/manage'
import ARow from 'ant-design-vue/es/grid/Row'
import ACol from 'ant-design-vue/es/grid/Col'
import { getAction, postAction } from '@/api/manage'
export default {
name: 'RoleDataruleModal',
components: { ACol, ARow },
data(){
return {
functionId:'',
roleId:'',
visible:false,
tabList: [{
key: '1',
tab: '数据规则',
}, {
key: '2',
tab: '按钮权限',
}],
activeTabKey: '1',
url:{
datarule:"/sys/role/datarule",
},
dataruleList:[],
dataruleChecked:[]
}
export default {
name: 'RoleDataruleModal',
components: { ACol, ARow },
data () {
return {
functionId: '',
roleId: '',
visible: false,
tabList: [{
key: '1',
tab: '数据规则'
}, {
key: '2',
tab: '按钮权限'
}],
activeTabKey: '1',
url: {
datarule: '/sys/role/datarule'
},
dataruleList: [],
dataruleChecked: []
}
},
methods: {
loadData () {
getAction(`${this.url.datarule}/${this.functionId}/${this.roleId}`).then(res => {
console.log(res)
if (res.success) {
this.dataruleList = res.result.datarule
const drChecked = res.result.drChecked
if (drChecked) {
this.dataruleChecked = drChecked.split(',')
}
}
})
},
methods:{
loadData(){
getAction(`${this.url.datarule}/${this.functionId}/${this.roleId}`).then(res=>{
console.log(res)
if(res.success){
this.dataruleList = res.result.datarule
let drChecked = res.result.drChecked
if(drChecked){
this.dataruleChecked = drChecked.split(",")
}
}
})
},
saveDataruleForRole(){
if(!this.dataruleChecked || this.dataruleChecked.length==0){
this.$message.warning("请注意,现未勾选任何数据权限!")
}
let params = {
permissionId:this.functionId,
roleId:this.roleId,
dataRuleIds:this.dataruleChecked.join(",")
}
console.log("保存数据权限",params)
postAction(this.url.datarule,params).then(res=>{
if(res.success){
this.$message.success(res.message)
}else{
this.$message.error(res.message)
}
})
},
show(functionId,roleId){
this.onReset()
this.functionId = functionId
this.roleId = roleId
this.visible=true
this.loadData()
},
onClose(){
this.visible=false
this.onReset()
},
onTabChange (key) {
this.activeTabKey = key
},
onReset(){
this.functionId=''
this.roleId=''
this.dataruleList=[]
this.dataruleChecked=[]
saveDataruleForRole () {
if (!this.dataruleChecked || this.dataruleChecked.length == 0) {
this.$message.warning('请注意现未勾选任何数据权限!')
}
const params = {
permissionId: this.functionId,
roleId: this.roleId,
dataRuleIds: this.dataruleChecked.join(',')
}
console.log('保存数据权限', params)
postAction(this.url.datarule, params).then(res => {
if (res.success) {
this.$message.success(res.message)
} else {
this.$message.error(res.message)
}
})
},
show (functionId, roleId) {
this.onReset()
this.functionId = functionId
this.roleId = roleId
this.visible = true
this.loadData()
},
onClose () {
this.visible = false
this.onReset()
},
onTabChange (key) {
this.activeTabKey = key
},
onReset () {
this.functionId = ''
this.roleId = ''
this.dataruleList = []
this.dataruleChecked = []
}
}
}
</script>
<style scoped>
</style>
</style>
+97 -97
View File
@@ -27,113 +27,113 @@
</template>
<script>
import {addRole,editRole,duplicateCheck } from '@/api/api'
export default {
name: "RoleModal",
data () {
return {
title:"操作",
visible: false,
roleDisabled: false,
model: {},
layout: {
labelCol: { span: 3 },
wrapperCol: { span: 14 },
},
confirmLoading: false,
validatorRules:{
roleName: [
{ required: true, message: '请输入角色名称!' },
{ min: 2, max: 30, message: '长度在 2 30 个字符', trigger: 'blur' }
],
roleCode: [
{ required: true, message: '请输入角色名称!'},
{ min: 0, max: 64, message: '长度不超过 64 个字符', trigger: 'blur' },
{ validator: this.validateRoleCode}
],
description: [
{ min: 0, max: 126, message: '长度不超过 126 个字符', trigger: 'blur' }
]
},
import { addRole, editRole, duplicateCheck } from '@/api/api'
export default {
name: 'RoleModal',
data () {
return {
title: '操作',
visible: false,
roleDisabled: false,
model: {},
layout: {
labelCol: { span: 3 },
wrapperCol: { span: 14 }
},
confirmLoading: false,
validatorRules: {
roleName: [
{ required: true, message: '请输入角色名称!' },
{ min: 2, max: 30, message: '长度在 2 30 个字符', trigger: 'blur' }
],
roleCode: [
{ required: true, message: '请输入角色名称!' },
{ min: 0, max: 64, message: '长度不超过 64 个字符', trigger: 'blur' },
{ validator: this.validateRoleCode }
],
description: [
{ min: 0, max: 126, message: '长度不超过 126 个字符', trigger: 'blur' }
]
}
}
},
created () {
// 备份model原始值
this.modelDefault = JSON.parse(JSON.stringify(this.model))
},
methods: {
add () {
this.edit(this.modelDefault)
},
edit (record) {
this.model = Object.assign({}, record)
this.visible = true
// 编辑页面禁止修改角色编码
if (this.model.id) {
this.roleDisabled = true
} else {
this.roleDisabled = false
}
},
created () {
//备份model原始值
this.modelDefault = JSON.parse(JSON.stringify(this.model));
close () {
this.$refs.form.clearValidate()
this.$emit('close')
this.visible = false
},
methods: {
add () {
this.edit(this.modelDefault);
},
edit (record) {
this.model = Object.assign({}, record);
this.visible = true;
//编辑页面禁止修改角色编码
if(this.model.id){
this.roleDisabled = true;
}else{
this.roleDisabled = false;
}
},
close () {
this.$refs.form.clearValidate();
this.$emit('close');
this.visible = false;
},
handleOk () {
const that = this;
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let obj;
if(!this.model.id){
obj=addRole(this.model);
}else{
obj=editRole(this.model);
handleOk () {
const that = this
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true
let obj
if (!this.model.id) {
obj = addRole(this.model)
} else {
obj = editRole(this.model)
}
obj.then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
} else {
that.$message.warning(res.message)
}
obj.then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
that.close();
})
}else{
return false;
}).finally(() => {
that.confirmLoading = false
that.close()
})
} else {
return false
}
})
},
handleCancel () {
this.close()
},
validateRoleCode (rule, value, callback) {
if (/[\u4E00-\u9FA5]/g.test(value)) {
callback('角色编码不可输入汉字!')
} else {
const params = {
tableName: 'sys_role',
fieldName: 'role_code',
fieldVal: value,
dataId: this.model.id
}
duplicateCheck(params).then((res) => {
if (res.success) {
callback()
} else {
callback(res.message)
}
})
},
handleCancel () {
this.close()
},
validateRoleCode(rule, value, callback){
if(/[\u4E00-\u9FA5]/g.test(value)){
callback("角色编码不可输入汉字!");
}else{
let params = {
tableName: "sys_role",
fieldName: "role_code",
fieldVal: value,
dataId: this.model.id,
};
duplicateCheck(params).then((res)=>{
if(res.success){
callback();
}else{
callback(res.message);
}
});
}
}
}
}
}
</script>
<style scoped>
</style>
</style>
@@ -27,7 +27,6 @@
</a-form-item>
</a-col>
<template v-if="toggleSearchStatus">
<a-col :span="6">
<a-form-item label="邮箱">
@@ -82,192 +81,192 @@
</template>
<script>
import { filterObj } from '@/utils/util';
import { filterObj } from '@/utils/util'
import { getUserList } from '@/api/api'
import { getUserList } from '@/api/api'
export default {
name: "SelectUserListModal",
components: {
export default {
name: 'SelectUserListModal',
components: {
},
data () {
return {
title: '选择用户',
queryParam: {},
columns: [{
title: '用户账号',
align: 'center',
dataIndex: 'username',
fixed: 'left',
width: 200
}, {
title: '用户名称',
align: 'center',
dataIndex: 'realname'
}, {
title: '性别',
align: 'center',
dataIndex: 'sex',
customRender: function (text) {
if (text == 1) {
return '男'
} else if (text == 2) {
return '女'
} else {
return text
}
}
}, {
title: '手机号码',
align: 'center',
dataIndex: 'phone'
}, {
title: '邮箱',
align: 'center',
dataIndex: 'email'
}, {
title: '状态',
align: 'center',
dataIndex: 'status',
customRender: function (text) {
if (text == 1) {
return '正常'
} else if (text == 2) {
return '冻结'
} else {
return text
}
}
}],
dataSource: [],
ipagination: {
current: 1,
pageSize: 5,
pageSizeOptions: ['5', '10', '20'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' 共' + total + '条'
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
isorter: {
column: 'createTime',
order: 'desc'
},
selectedRowKeys: [],
selectionRows: [],
visible: false,
toggleSearchStatus: false
}
},
created () {
this.loadData()
},
methods: {
add (selectUser, userIds) {
this.visible = true
this.edit(selectUser, userIds)
},
data () {
return {
title:"选择用户",
queryParam: {},
columns: [{
title: '用户账号',
align:"center",
dataIndex: 'username',
fixed:'left',
width:200
},{
title: '用户名称',
align:"center",
dataIndex: 'realname',
},{
title: '性别',
align:"center",
dataIndex: 'sex',
customRender:function (text) {
if(text==1){
return "";
}else if(text==2){
return "";
}else{
return text;
}
}
},{
title: '手机号码',
align:"center",
dataIndex: 'phone'
},{
title: '邮箱',
align:"center",
dataIndex: 'email'
},{
title: '状态',
align:"center",
dataIndex: 'status',
customRender:function (text) {
if(text==1){
return "正常";
}else if(text==2){
return "冻结";
}else{
return text;
}
}
}],
dataSource:[],
ipagination:{
current: 1,
pageSize: 5,
pageSizeOptions: ['5', '10', '20'],
showTotal: (total, range) => {
return range[0] + "-" + range[1] + " " + total + ""
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
isorter:{
column: 'createTime',
order: 'desc',
},
selectedRowKeys: [],
selectionRows: [],
visible:false,
toggleSearchStatus:false,
edit (selectUser, userIds) {
// 控制台报错
if (userIds && userIds.length > 0) {
this.selectedRowKeys = userIds.split(',')
} else {
this.selectedRowKeys = []
}
if (!selectUser) {
this.selectionRows = []
} else {
var that = this
that.selectionRows = []
selectUser.forEach(function (record, index) {
console.log(record)
that.selectionRows.push({ id: that.selectedRowKeys[index], realname: record.label })
})
// this.selectionRows = selectUser;
}
},
created() {
this.loadData();
loadData (arg) {
if (arg === 1) {
this.ipagination.current = 1
}
const params = this.getQueryParams()// 查询条件
getUserList(params).then((res) => {
if (res.success) {
this.dataSource = res.result.records
this.ipagination.total = res.result.total
}
})
},
methods: {
add (selectUser,userIds) {
this.visible = true;
this.edit(selectUser,userIds);
},
edit(selectUser,userIds){
//控制台报错
if(userIds&&userIds.length>0){
this.selectedRowKeys = userIds.split(',');
}else{
this.selectedRowKeys = []
}
if(!selectUser){
this.selectionRows=[]
}else{
var that=this;
that.selectionRows=[];
selectUser.forEach(function(record,index){
console.log(record)
that.selectionRows.push({id: that.selectedRowKeys[index],realname:record.label})
})
// this.selectionRows = selectUser;
}
},
loadData (arg){
if(arg===1){
this.ipagination.current = 1;
}
let params = this.getQueryParams();//查询条件
getUserList(params).then((res)=>{
if(res.success){
this.dataSource = res.result.records;
this.ipagination.total = res.result.total;
getQueryParams () {
const param = Object.assign({}, this.queryParam, this.isorter)
param.field = this.getQueryField()
// --update-begin----author:scott---date:20190818------for:新建公告时指定特定用户翻页错误SelectUserListModal #379----
// param.current = this.ipagination.current;
// param.pageSize = this.ipagination.pageSize;
param.pageNo = this.ipagination.current
param.pageSize = this.ipagination.pageSize
// --update-end----author:scott---date:20190818------for:新建公告时指定特定用户翻页错误SelectUserListModal #379---
return filterObj(param)
},
getQueryField () {
let str = 'id,'
for (let a = 0; a < this.columns.length; a++) {
str += ',' + this.columns[a].dataIndex
}
return str
},
// --update-begin----author:kangxiaolin---date:20190921------for:系统发送通知 用户多选失败 #513----
onSelectChange (selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys
},
onSelect (record, selected) {
if (selected == true) {
this.selectionRows.push(record)
} else {
this.selectionRows.forEach(function (item, index, arr) {
if (item.id == record.id) {
arr.splice(index, 1)
}
})
},
getQueryParams(){
let param = Object.assign({}, this.queryParam,this.isorter);
param.field = this.getQueryField();
//--update-begin----author:scott---date:20190818------for:新建公告时指定特定用户翻页错误SelectUserListModal #379----
// param.current = this.ipagination.current;
// param.pageSize = this.ipagination.pageSize;
param.pageNo = this.ipagination.current;
param.pageSize = this.ipagination.pageSize;
//--update-end----author:scott---date:20190818------for:新建公告时指定特定用户翻页错误SelectUserListModal #379---
return filterObj(param);
},
getQueryField(){
let str = "id,";
for(let a = 0;a<this.columns.length;a++){
str+=","+this.columns[a].dataIndex;
}
return str;
},
//--update-begin----author:kangxiaolin---date:20190921------for:系统发送通知 用户多选失败 #513----
onSelectChange (selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys;
},
onSelect(record, selected){
if(selected == true ){
this.selectionRows.push(record);
}else {
this.selectionRows.forEach(function(item,index,arr){
if(item.id == record.id) {
arr.splice(index, 1);
}
})
}
//--update-end----author:kangxiaolin---date:20190921------for:系统发送通知 用户多选失败 #513----
},
}
// --update-end----author:kangxiaolin---date:20190921------for:系统发送通知 用户多选失败 #513----
},
searchReset(){
let that = this;
Object.keys(that.queryParam).forEach(function(key){
that.queryParam[key] = '';
});
that.loadData(1);
},
handleTableChange(pagination, filters, sorter){
//TODO 筛选
if (Object.keys(sorter).length>0){
this.isorter.column = sorter.field;
this.isorter.order = "ascend"==sorter.order?"asc":"desc"
}
this.ipagination = pagination;
this.loadData();
},
handleCancel () {
this.selectionRows = [];
this.selectedRowKeys = [];
this.visible = false;
},
handleOk () {
this.$emit("choseUser",this.selectionRows);
this.handleCancel();
},
searchByquery(){
this.loadData(1);
},
handleToggleSearch(){
this.toggleSearchStatus = !this.toggleSearchStatus;
},
searchReset () {
const that = this
Object.keys(that.queryParam).forEach(function (key) {
that.queryParam[key] = ''
})
that.loadData(1)
},
handleTableChange (pagination, filters, sorter) {
// TODO 筛选
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field
this.isorter.order = sorter.order == 'ascend' ? 'asc' : 'desc'
}
this.ipagination = pagination
this.loadData()
},
handleCancel () {
this.selectionRows = []
this.selectedRowKeys = []
this.visible = false
},
handleOk () {
this.$emit('choseUser', this.selectionRows)
this.handleCancel()
},
searchByquery () {
this.loadData(1)
},
handleToggleSearch () {
this.toggleSearchStatus = !this.toggleSearchStatus
}
}
}
</script>
<style scoped>
.ant-card-body .table-operator{
@@ -287,4 +286,4 @@
.anty-img-wrap{height:25px;position: relative;}
.anty-img-wrap > img{max-height:100%;}
</style>
</style>
@@ -9,7 +9,6 @@
@cancel="handleCancel"
cancelText="关闭">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
@@ -48,211 +47,209 @@
</div>
<!-- table区域-end -->
</a-modal>
</div>
</template>
<script>
import {filterObj} from '@/utils/util'
import {getAction} from '@/api/manage'
import { filterObj } from '@/utils/util'
import { getAction } from '@/api/manage'
export default {
name: "SelectUserModal",
data() {
return {
title: "添加已有用户",
names: [],
visible: false,
placement: 'right',
description: '',
// 查询条件
queryParam: {},
// 表头
columns1: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 50,
align: "center",
customRender: function (t, r, index) {
return parseInt(index) + 1;
}
},
{
title: '用户账号',
align: "center",
width: 100,
dataIndex: 'username'
},
{
title: '用户名称',
align: "center",
width: 100,
dataIndex: 'realname'
},
{
title: '性别',
align: "center",
width: 100,
dataIndex: 'sex_dictText'
},
{
title: '电话',
align: "center",
width: 100,
dataIndex: 'phone'
},
{
title: '部门',
align: "center",
width: 150,
dataIndex: 'orgCodeTxt'
export default {
name: 'SelectUserModal',
data () {
return {
title: '添加已有用户',
names: [],
visible: false,
placement: 'right',
description: '',
// 查询条件
queryParam: {},
// 表头
columns1: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 50,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
],
columns2: [
{
title: '用户账号',
align: "center",
dataIndex: 'username',
},
{
title: '用户名称',
align: "center",
dataIndex: 'realname',
},
{
title: '操作',
dataIndex: 'action',
align: "center",
width: 100,
scopedSlots: {customRender: 'action'},
}
],
//数据集
dataSource1: [],
dataSource2: [],
// 分页参数
ipagination: {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '20', '30'],
showTotal: (total, range) => {
return range[0] + "-" + range[1] + " " + total + ""
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
isorter: {
column: 'createTime',
order: 'desc',
{
title: '用户账号',
align: 'center',
width: 100,
dataIndex: 'username'
},
loading: false,
selectedRowKeys: [],
selectedRows: [],
url: {
list: "/sys/user/page",
{
title: '用户名称',
align: 'center',
width: 100,
dataIndex: 'realname'
},
{
title: '性别',
align: 'center',
width: 100,
dataIndex: 'sex_dictText'
},
{
title: '电话',
align: 'center',
width: 100,
dataIndex: 'phone'
},
{
title: '部门',
align: 'center',
width: 150,
dataIndex: 'orgCodeTxt'
}
}
},
created() {
this.loadData();
},
methods: {
searchQuery() {
this.loadData(1);
},
searchReset() {
this.queryParam = {};
this.loadData(1);
},
handleCancel() {
this.visible = false;
this.onClearSelected();
},
handleOk() {
this.dataSource2 = this.selectedRowKeys;
console.log("data:" + this.dataSource2);
this.$emit("selectFinished", this.dataSource2);
this.visible = false;
},
add() {
this.visible = true;
},
loadData(arg) {
//加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1;
}
var params = this.getQueryParams();//查询条件
getAction(this.url.list, params).then((res) => {
if (res.success) {
this.dataSource1 = res.result.records;
this.ipagination.total = res.result.total;
}
})
},
getQueryParams() {
var param = Object.assign({}, this.queryParam, this.isorter);
param.field = this.getQueryField();
param.pageNo = this.ipagination.current;
param.pageSize = this.ipagination.pageSize;
return filterObj(param);
},
getQueryField() {
//TODO 字段权限控制
},
onSelectAll(selected, selectedRows, changeRows) {
if (selected === true) {
for (var a = 0; a < changeRows.length; a++) {
this.dataSource2.push(changeRows[a]);
}
} else {
for (var b = 0; b < changeRows.length; b++) {
this.dataSource2.splice(this.dataSource2.indexOf(changeRows[b]), 1);
}
}
// console.log(selected, selectedRows, changeRows);
},
onSelect(record, selected) {
if (selected === true) {
this.dataSource2.push(record);
} else {
var index = this.dataSource2.indexOf(record);
//console.log();
if (index >= 0) {
this.dataSource2.splice(this.dataSource2.indexOf(record), 1);
}
],
columns2: [
{
title: '用户账号',
align: 'center',
dataIndex: 'username'
},
{
title: '用户名称',
align: 'center',
dataIndex: 'realname'
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
width: 100,
scopedSlots: { customRender: 'action' }
}
],
// 数据集
dataSource1: [],
dataSource2: [],
// 分页参数
ipagination: {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '20', '30'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' 共' + total + '条'
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
onSelectChange(selectedRowKeys, selectedRows) {
this.selectedRowKeys = selectedRowKeys;
this.selectionRows = selectedRows;
isorter: {
column: 'createTime',
order: 'desc'
},
onClearSelected() {
this.selectedRowKeys = [];
this.selectionRows = [];
},
handleDelete: function (record) {
this.dataSource2.splice(this.dataSource2.indexOf(record), 1);
},
handleTableChange(pagination, filters, sorter) {
//分页、排序、筛选变化时触发
console.log(sorter);
//TODO 筛选
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field;
this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
}
this.ipagination = pagination;
this.loadData();
loading: false,
selectedRowKeys: [],
selectedRows: [],
url: {
list: '/sys/user/page'
}
}
},
created () {
this.loadData()
},
methods: {
searchQuery () {
this.loadData(1)
},
searchReset () {
this.queryParam = {}
this.loadData(1)
},
handleCancel () {
this.visible = false
this.onClearSelected()
},
handleOk () {
this.dataSource2 = this.selectedRowKeys
console.log('data:' + this.dataSource2)
this.$emit('selectFinished', this.dataSource2)
this.visible = false
},
add () {
this.visible = true
},
loadData (arg) {
// 加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1
}
var params = this.getQueryParams()// 查询条件
getAction(this.url.list, params).then((res) => {
if (res.success) {
this.dataSource1 = res.result.records
this.ipagination.total = res.result.total
}
})
},
getQueryParams () {
var param = Object.assign({}, this.queryParam, this.isorter)
param.field = this.getQueryField()
param.pageNo = this.ipagination.current
param.pageSize = this.ipagination.pageSize
return filterObj(param)
},
getQueryField () {
// TODO 字段权限控制
},
onSelectAll (selected, selectedRows, changeRows) {
if (selected === true) {
for (var a = 0; a < changeRows.length; a++) {
this.dataSource2.push(changeRows[a])
}
} else {
for (var b = 0; b < changeRows.length; b++) {
this.dataSource2.splice(this.dataSource2.indexOf(changeRows[b]), 1)
}
}
// console.log(selected, selectedRows, changeRows);
},
onSelect (record, selected) {
if (selected === true) {
this.dataSource2.push(record)
} else {
var index = this.dataSource2.indexOf(record)
// console.log();
if (index >= 0) {
this.dataSource2.splice(this.dataSource2.indexOf(record), 1)
}
}
},
onSelectChange (selectedRowKeys, selectedRows) {
this.selectedRowKeys = selectedRowKeys
this.selectionRows = selectedRows
},
onClearSelected () {
this.selectedRowKeys = []
this.selectionRows = []
},
handleDelete: function (record) {
this.dataSource2.splice(this.dataSource2.indexOf(record), 1)
},
handleTableChange (pagination, filters, sorter) {
// 分页、排序、筛选变化时触发
console.log(sorter)
// TODO 筛选
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field
this.isorter.order = sorter.order == 'ascend' ? 'asc' : 'desc'
}
this.ipagination = pagination
this.loadData()
}
}
}
</script>
<style lang="less" scoped>
.ant-card-body .table-operator {
@@ -285,4 +282,4 @@
height: 90% !important;
overflow-y: hidden
}
</style>
</style>
@@ -141,219 +141,219 @@
</template>
<script>
import { httpAction } from '@/api/manage'
import pick from 'lodash.pick'
import { getAction } from '@/api/manage'
import JDate from '@/components/jero/JDate'
import JEditor from '@/components/jero/JEditor'
import SelectUserListModal from "./SelectUserListModal";
import moment from 'moment'
import { httpAction, getAction } from '@/api/manage'
import pick from 'lodash.pick'
export default {
components: { JEditor, JDate, SelectUserListModal},
name: "SysAnnouncementModal",
data () {
return {
title:"操作",
visible: false,
disableSubmit:false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 6 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 18 },
},
labelColX1: {
xs: { span: 24 },
sm: { span: 3 },
},
wrapperColX1: {
xs: { span: 24 },
sm: { span: 21 },
},
confirmLoading: false,
validatorRules:{
titile: [{ required: true, message: '请输入标题!' }],
msgCategory: [{ required: true, message: '请选择消息类型!' }],
msgType:[{ required: true, message: '请选择通告对象类型!' }],
endTime:[{ required: true, message: '请选择结束时间!'} ,{validator: this.endTimeValidate}],
startTime:[{required: true, message: '请选择开始时间!'},{validator: this.startTimeValidate}],
msgAbstract: [{ required: true, message: '请输入摘要!' }],
},
url: {
queryByIds: "/sys/user/queryByIds",
add: "/sys/annountCement/add",
edit: "/sys/annountCement/edit",
},
userType:false,
userIds:[],
selectedUser:[],
disabled:false,
msgContent:"",
userList:[]
}
import JDate from '@/components/jero/JDate'
import JEditor from '@/components/jero/JEditor'
import SelectUserListModal from './SelectUserListModal'
import moment from 'moment'
export default {
components: { JEditor, JDate, SelectUserListModal },
name: 'SysAnnouncementModal',
data () {
return {
title: '操作',
visible: false,
disableSubmit: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 6 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 18 }
},
labelColX1: {
xs: { span: 24 },
sm: { span: 3 }
},
wrapperColX1: {
xs: { span: 24 },
sm: { span: 21 }
},
confirmLoading: false,
validatorRules: {
titile: [{ required: true, message: '请输入标题!' }],
msgCategory: [{ required: true, message: '请选择消息类型!' }],
msgType: [{ required: true, message: '请选择通告对象类型!' }],
endTime: [{ required: true, message: '请选择结束时间!' }, { validator: this.endTimeValidate }],
startTime: [{ required: true, message: '请选择开始时间!' }, { validator: this.startTimeValidate }],
msgAbstract: [{ required: true, message: '请输入摘要!' }]
},
url: {
queryByIds: '/sys/user/queryByIds',
add: '/sys/annountCement/add',
edit: '/sys/annountCement/edit'
},
userType: false,
userIds: [],
selectedUser: [],
disabled: false,
msgContent: '',
userList: []
}
},
created () {
},
methods: {
add () {
this.edit({})
},
created () {
edit (record) {
this.model = {}
this.disable = false
this.visible = true
this.getUser(record)
},
methods: {
add () {
this.edit({});
},
edit (record) {
this.model = {}
this.disable = false;
this.visible = true;
this.getUser(record);
},
getUser(record){
this.model = Object.assign({}, record);
// 指定用户
if(record&&record.msgType === "USER"){
this.userType = true;
this.userIds = record.userIds;
getAction(this.url.queryByIds,{userIds:this.userIds}).then((res)=>{
if(res.success){
//update--begin--autor:wangshuai-----date:20200601------for:系统公告选人后,不能删除------
var userList=[];
for(var i=0;i<res.result.length;i++){
var user={};
user.label =res.result[i].realname;
user.key=res.result[i].id;
userList.push(user);
}
this.selectedUser=userList;
//update--begin--autor:wangshuai-----date:20200601------for:系统公告选人后,不能删除------
this.$refs.UserListModal.edit(res.result,this.userIds);
getUser (record) {
this.model = Object.assign({}, record)
// 指定用户
if (record && record.msgType === 'USER') {
this.userType = true
this.userIds = record.userIds
getAction(this.url.queryByIds, { userIds: this.userIds }).then((res) => {
if (res.success) {
// update--begin--autor:wangshuai-----date:20200601------for:系统公告选人后,不能删除------
var userList = []
for (var i = 0; i < res.result.length; i++) {
var user = {}
user.label = res.result[i].realname
user.key = res.result[i].id
userList.push(user)
}
});
}
},
close () {
this.$emit('close');
this.selectedUser = [];
this.visible = false;
this.$refs.form.resetFields();
},
handleOk () {
const that = this;
//当设置指定用户类型,但用户为空时,后台报错
if(this.userType &&!(this.userIds!=null && this.userIds.length >0)){
this.$message.warning('指定用户不能为空!')
return;
}
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
if(this.userType){
this.model.userIds = this.userIds;
}
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
that.resetUser();
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
that.close();
})
}else{
return false;
this.selectedUser = userList
// update--begin--autor:wangshuai-----date:20200601------for:系统公告选人后,不能删除------
this.$refs.UserListModal.edit(res.result, this.userIds)
}
})
},
handleCancel () {
this.visible = false;
this.$emit('close');
this.$refs.form.resetFields();
this.resetUser();
},
resetUser (){
this.userType = false;
this.userIds = [];
this.selectedUser = [];
this.disabled = false;
this.$refs.UserListModal.edit(null,null);
},
selectUserIds() {
this.$refs.UserListModal.add(this.selectedUser,this.userIds);
},
chooseMsgType(value) {
if("USER" == value) {
this.userType = true;
} else {
this.userType = false;
this.selectedUser = [];
this.userIds = [];
}
},
// 子modal回调
choseUser:function(userList){
this.selectedUser = [];
this.userIds = [];
for(var i=0;i<userList.length;i++){
//update--begin--autor:wangshuai-----date:20200601------for:系统公告选人后,不能删除------
var user={};
user.label =userList[i].realname;
user.key=userList[i].id;
this.selectedUser.push(user);
//update--end--autor:wangshuai-----date:20200601------for:系统公告选人后,不能删除------
this.userIds += userList[i].id+","
}
},
startTimeValidate(rule,value,callback){
let endTime = this.model.endTime
if(!value || !endTime){
callback()
}else if(moment(value).isBefore(endTime)){
callback()
}else{
callback("开始时间需小于结束时间")
}
},
endTimeValidate(rule,value,callback){
let startTime = this.model.startTime;
if(!value || !startTime){
callback()
}else if(moment(startTime).isBefore(value)){
callback()
}else{
callback("结束时间需大于开始时间")
}
},
handleChange(userList) {
if (userList) {
this.userIds = [];
var users=[];
for (var i = 0; i < userList.length; i++) {
var user={};
user.id=userList[i].key;
user.realname=userList[i].label;
this.userIds += userList[i].key + ',';
users.push(user);
}
}
this.$refs.UserListModal.edit(users,this.userIds);
}
},
close () {
this.$emit('close')
this.selectedUser = []
this.visible = false
this.$refs.form.resetFields()
},
handleOk () {
const that = this
// 当设置指定用户类型,但用户为空时,后台报错
if (this.userType && !(this.userIds != null && this.userIds.length > 0)) {
this.$message.warning('指定用户不能为空!')
return
}
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true
let httpurl = ''
let method = ''
if (!this.model.id) {
httpurl += this.url.add
method = 'post'
} else {
httpurl += this.url.edit
method = 'put'
}
if (this.userType) {
this.model.userIds = this.userIds
}
httpAction(httpurl, this.model, method).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
that.resetUser()
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
that.close()
})
} else {
return false
}
})
},
handleCancel () {
this.visible = false
this.$emit('close')
this.$refs.form.resetFields()
this.resetUser()
},
resetUser () {
this.userType = false
this.userIds = []
this.selectedUser = []
this.disabled = false
this.$refs.UserListModal.edit(null, null)
},
selectUserIds () {
this.$refs.UserListModal.add(this.selectedUser, this.userIds)
},
chooseMsgType (value) {
if (value == 'USER') {
this.userType = true
} else {
this.userType = false
this.selectedUser = []
this.userIds = []
}
},
// 子modal回调
choseUser: function (userList) {
this.selectedUser = []
this.userIds = []
for (var i = 0; i < userList.length; i++) {
// update--begin--autor:wangshuai-----date:20200601------for:系统公告选人后,不能删除------
var user = {}
user.label = userList[i].realname
user.key = userList[i].id
this.selectedUser.push(user)
// update--end--autor:wangshuai-----date:20200601------for:系统公告选人后,不能删除------
this.userIds += userList[i].id + ','
}
},
startTimeValidate (rule, value, callback) {
const endTime = this.model.endTime
if (!value || !endTime) {
callback()
} else if (moment(value).isBefore(endTime)) {
callback()
} else {
callback('开始时间需小于结束时间')
}
},
endTimeValidate (rule, value, callback) {
const startTime = this.model.startTime
if (!value || !startTime) {
callback()
} else if (moment(startTime).isBefore(value)) {
callback()
} else {
callback('结束时间需大于开始时间')
}
},
handleChange (userList) {
if (userList) {
this.userIds = []
var users = []
for (var i = 0; i < userList.length; i++) {
var user = {}
user.id = userList[i].key
user.realname = userList[i].label
this.userIds += userList[i].key + ','
users.push(user)
}
}
this.$refs.UserListModal.edit(users, this.userIds)
}
}
}
</script>
<style scoped>
</style>
</style>
@@ -34,125 +34,125 @@
<script>
import { httpAction,getAction } from '@/api/manage'
import JTreeSelect from '@/components/jero/JTreeSelect'
import { httpAction, getAction } from '@/api/manage'
import JTreeSelect from '@/components/jero/JTreeSelect'
export default {
name: "SysCategoryModal",
components: {
JTreeSelect
},
data () {
return {
title:"操作",
width:800,
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
export default {
name: 'SysCategoryModal',
components: {
JTreeSelect
},
data () {
return {
title: '操作',
width: 800,
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
confirmLoading: false,
validatorRules:{
pid:{},
name: [{ required: true, message: '请输入类型名称!' }]
},
url: {
add: "/sys/category/add",
edit: "/sys/category/edit",
checkCode:"/sys/category/checkCode",
},
expandedRowKeys:[],
pidField:"pid",
subExpandedKeys:[]
confirmLoading: false,
validatorRules: {
pid: {},
name: [{ required: true, message: '请输入类型名称!' }]
},
url: {
add: '/sys/category/add',
edit: '/sys/category/edit',
checkCode: '/sys/category/checkCode'
},
expandedRowKeys: [],
pidField: 'pid',
subExpandedKeys: []
}
}
},
created () {
},
computed: {
disabled () {
return !!this.model.id
}
},
methods: {
add () {
this.edit({})
},
created () {
edit (record) {
this.model = Object.assign({}, record)
this.visible = true
},
computed : {
disabled() {
return this.model.id ? true : false;
}
close () {
this.$emit('close')
this.visible = false
this.$refs.form.resetFields()
},
methods: {
add () {
this.edit({});
},
edit (record) {
this.model = Object.assign({}, record);
this.visible = true;
},
close () {
this.$emit('close');
this.visible = false;
this.$refs.form.resetFields();
},
handleOk () {
const that = this;
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
// close的时候清空了表单的值 导致model为空 修改值在列表页没有变 此处需要复制一下model
that.submitSuccess({...this.model})
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
that.close();
})
}else{
return false;
handleOk () {
const that = this
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true
let httpurl = ''
let method = ''
if (!this.model.id) {
httpurl += this.url.add
method = 'post'
} else {
httpurl += this.url.edit
method = 'put'
}
})
},
handleCancel () {
this.close()
},
submitSuccess(formData){
if(!formData.id){
let treeData = this.$refs.treeSelect.getCurrTreeData()
this.expandedRowKeys=[]
this.getExpandKeysByPid(formData[this.pidField],treeData,treeData)
if(formData.pid && this.expandedRowKeys.length==0){
this.expandedRowKeys = this.subExpandedKeys;
}
this.$emit('ok',formData,this.expandedRowKeys.reverse());
}else{
this.$emit('ok',formData);
}
},
getExpandKeysByPid(pid,arr,all){
if(pid && arr && arr.length>0){
for(let i=0;i<arr.length;i++){
if(arr[i].key==pid){
this.expandedRowKeys.push(arr[i].key)
this.getExpandKeysByPid(arr[i]['parentId'],all,all)
}else{
this.getExpandKeysByPid(pid,arr[i].children,all)
httpAction(httpurl, this.model, method).then((res) => {
if (res.success) {
that.$message.success(res.message)
// close的时候清空了表单的值 导致model为空 修改值在列表页没有变 此处需要复制一下model
that.submitSuccess({ ...this.model })
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
that.close()
})
} else {
return false
}
})
},
handleCancel () {
this.close()
},
submitSuccess (formData) {
if (!formData.id) {
const treeData = this.$refs.treeSelect.getCurrTreeData()
this.expandedRowKeys = []
this.getExpandKeysByPid(formData[this.pidField], treeData, treeData)
if (formData.pid && this.expandedRowKeys.length == 0) {
this.expandedRowKeys = this.subExpandedKeys
}
this.$emit('ok', formData, this.expandedRowKeys.reverse())
} else {
this.$emit('ok', formData)
}
},
getExpandKeysByPid (pid, arr, all) {
if (pid && arr && arr.length > 0) {
for (let i = 0; i < arr.length; i++) {
if (arr[i].key == pid) {
this.expandedRowKeys.push(arr[i].key)
this.getExpandKeysByPid(arr[i].parentId, all, all)
} else {
this.getExpandKeysByPid(pid, arr[i].children, all)
}
}
},
}
}
}
</script>
}
</script>
@@ -54,299 +54,299 @@
</template>
<script>
import pick from 'lodash.pick'
import { httpAction } from '@/api/manage'
import { validateDuplicateValue, alwaysResolve, failedSymbol } from '@/utils/util'
import { FormTypes } from '@/utils/JEditableTableUtil'
import JEditableTable from '@comp/jero/JEditableTable'
import pick from 'lodash.pick'
import { httpAction } from '@/api/manage'
import { validateDuplicateValue, alwaysResolve, failedSymbol } from '@/utils/util'
import { FormTypes } from '@/utils/JEditableTableUtil'
import JEditableTable from '@comp/jero/JEditableTable'
export default {
name: 'SysCheckRuleModal',
components: {
JEditableTable,
'my-action-button': {
props: { rowEvent: Object, allowEmpty: Boolean },
methods: {
confirmIsShow() {
const { index, allValues: { inputValues } } = this.rowEvent
let value = inputValues[index]
return value.digits || value.pattern
},
handleLineAdd() {
const { target } = this.rowEvent
target.add()
},
handleLineDelete() {
const { rowId, target } = this.rowEvent
target.removeRows(rowId)
},
renderDeleteButton() {
if (this.allowEmpty || this.rowEvent.index > 0) {
if (this.confirmIsShow()) {
return (
<a-popconfirm title="确定要删除吗?" onConfirm={this.handleLineDelete}>
<a-button icon="minus"/>
</a-popconfirm>
)
} else {
return (
<a-button icon="minus" onClick={this.handleLineDelete}/>
)
}
}
return ''
},
export default {
name: 'SysCheckRuleModal',
components: {
JEditableTable,
'my-action-button': {
props: { rowEvent: Object, allowEmpty: Boolean },
methods: {
confirmIsShow () {
const { index, allValues: { inputValues } } = this.rowEvent
const value = inputValues[index]
return value.digits || value.pattern
},
render() {
return (
<div>
<a-button onClick={this.handleLineAdd} icon="plus"/>
handleLineAdd () {
const { target } = this.rowEvent
target.add()
},
handleLineDelete () {
const { rowId, target } = this.rowEvent
target.removeRows(rowId)
},
renderDeleteButton () {
if (this.allowEmpty || this.rowEvent.index > 0) {
if (this.confirmIsShow()) {
return (
<a-popconfirm title="确定要删除吗?" onConfirm={this.handleLineDelete}>
<a-button icon="minus"/>
</a-popconfirm>
)
} else {
return (
<a-button icon="minus" onClick={this.handleLineDelete}/>
)
}
}
return ''
}
},
render () {
return (
<div>
<a-button onClick={this.handleLineAdd} icon="plus"/>
&nbsp;
{this.renderDeleteButton()}
</div>
)
}
{this.renderDeleteButton()}
</div>
)
}
},
data() {
return {
title: '操作',
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules: {
ruleName: [{required: true, message: '请输入规则名称!'}],
ruleCode: [
{required: true, message: '请输入规则Code!'},
{validator: (rule, value, callback) => validateDuplicateValue('sys_check_rule', 'rule_code', value, this.model.id, callback)}
],
},
tabs: {
activeKey: 'design',
global: {
key: 'global',
columns: [
{
title: '优先级',
key: 'priority',
width: '15%',
type: FormTypes.select,
defaultValue: '1',
options: [
{ title: '优先运行', value: '1' },
{ title: '最后运行', value: '0' },
],
validateRules: []
},
{
title: '规则正则表达式',
key: 'pattern',
width: '50%',
type: FormTypes.input,
validateRules: [
{ required: true, message: '规则不能为空' },
{ handler: this.validatePatternHandler },
]
},
{
title: '提示文本',
key: 'message',
width: '20%',
type: FormTypes.input,
validateRules: [
{ required: true, message: '${title}不能为空' },
]
},
{
title: '操作',
key: 'action',
width: '15%',
slotName: 'action',
type: FormTypes.slot
}
],
dataSource: [],
},
design: {
key: 'design',
columns: [
{
title: '位数',
key: 'digits',
width: '15%',
type: FormTypes.inputNumber,
validateRules: [
{ required: true, message: '${title}不能为空' },
{ pattern: /^[1-9]\d*$/, message: '请输入零以上的正整数' },
]
},
{
title: '规则正则表达式',
key: 'pattern',
width: '50%',
type: FormTypes.input,
validateRules: [
{ required: true, message: '规则不能为空' },
{ handler: this.validatePatternHandler }
]
},
{
title: '提示文本',
key: 'message',
width: '20%',
type: FormTypes.input,
validateRules: [
{ required: true, message: '${title}不能为空' },
]
},
{
title: '操作',
key: 'action',
width: '15%',
slotName: 'action',
type: FormTypes.slot
},
],
dataSource: [],
}
},
url: {
add: '/sys/checkRule/add',
edit: '/sys/checkRule/edit',
},
}
},
created() {
},
methods: {
validatePatternHandler(type, value, row, column, callback, target) {
if (type === 'blur' || type === 'getValues') {
try {
new RegExp(value)
callback(true)
} catch (e) {
callback(false, '请输入正确的正则表达式')
}
} else {
callback(true) // 不填写或者填写 null 代表不进行任何操作
}
},
add() {
this.edit({})
},
edit(record) {
this.tabs.activeKey = this.tabs.design.key
this.tabs.global.dataSource = []
this.tabs.design.dataSource = [{ digits: '', pattern: '', message: '' }]
this.visible = true
this.$nextTick(() => {
this.$refs.form.resetFields()
this.model = Object.assign({}, record)
// 子表数据
let ruleJson = this.model.ruleJson
if (ruleJson) {
let ruleList = JSON.parse(ruleJson)
// 筛选出全局规则和局部规则
let global = [], design = [], priority = '1'
ruleList.forEach(rule => {
if (rule.digits === '*') {
global.push(Object.assign(rule, { priority }))
} else {
priority = '0'
design.push(rule)
}
})
this.tabs.global.dataSource = global
this.tabs.design.dataSource = design
}
})
},
close() {
this.$emit('close')
this.visible = false
},
handleOk() {
Promise.all([
// 主表单校验
alwaysResolve(new Promise((resolve, reject) => {
this.$refs.form.validate((ok, err) => ok ? resolve(this.model) : reject(err))
})),
// 局部规则子表校验
alwaysResolve(this.$refs.designTable.getValuesPromise),
// 全局规则子表校验
alwaysResolve(this.$refs.globalTable.getValuesPromise),
]).then(results => {
let [mainResult, designResult, globalResult] = results
if (mainResult.type === failedSymbol) {
return Promise.reject('主表校验未通过')
} else if (designResult.type === failedSymbol) {
this.tabs.activeKey = this.tabs.design.key
return Promise.reject('局部规则子表校验未通过')
} else if (globalResult.type === failedSymbol) {
this.tabs.activeKey = this.tabs.global.key
return Promise.reject('全局规则子表校验未通过')
} else {
// 所有校验已通过,这一步是整合数据
let mainValues = mainResult.data, globalValues = globalResult.data, designValues = designResult.data
// 整合两个子表的数据
let firstGlobal = [], afterGlobal = []
globalValues.forEach(v => {
v.digits = '*'
if (v.priority === '1') {
firstGlobal.push(v)
} else {
afterGlobal.push(v)
}
})
let concatValues = firstGlobal.concat(designValues).concat(afterGlobal)
let subValues = concatValues.map(i => pick(i, 'digits', 'pattern', 'message'))
// 生成 formData,用于传入后台
let ruleJson = JSON.stringify(subValues)
let formData = Object.assign(this.model, mainValues, { ruleJson })
// 判断请求方式和请求地址,并发送请求
let method = 'post', httpUrl = this.url.add
if (this.model.id) {
method = 'put'
httpUrl = this.url.edit
}
this.confirmLoading = true
return httpAction(httpUrl, formData, method)
}
}).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.$emit('ok')
this.close()
} else {
this.$message.warning(res.message)
}
}).catch(e => {
console.error(e)
}).finally(() => {
this.confirmLoading = false
})
},
handleCancel() {
this.close()
},
}
},
data () {
return {
title: '操作',
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
confirmLoading: false,
validatorRules: {
ruleName: [{ required: true, message: '请输入规则名称!' }],
ruleCode: [
{ required: true, message: '请输入规则Code!' },
{ validator: (rule, value, callback) => validateDuplicateValue('sys_check_rule', 'rule_code', value, this.model.id, callback) }
]
},
tabs: {
activeKey: 'design',
global: {
key: 'global',
columns: [
{
title: '优先级',
key: 'priority',
width: '15%',
type: FormTypes.select,
defaultValue: '1',
options: [
{ title: '优先运行', value: '1' },
{ title: '最后运行', value: '0' }
],
validateRules: []
},
{
title: '规则正则表达式',
key: 'pattern',
width: '50%',
type: FormTypes.input,
validateRules: [
{ required: true, message: '规则不能为空' },
{ handler: this.validatePatternHandler }
]
},
{
title: '提示文本',
key: 'message',
width: '20%',
type: FormTypes.input,
validateRules: [
{ required: true, message: '${title}不能为空' }
]
},
{
title: '操作',
key: 'action',
width: '15%',
slotName: 'action',
type: FormTypes.slot
}
],
dataSource: []
},
design: {
key: 'design',
columns: [
{
title: '位数',
key: 'digits',
width: '15%',
type: FormTypes.inputNumber,
validateRules: [
{ required: true, message: '${title}不能为空' },
{ pattern: /^[1-9]\d*$/, message: '请输入零以上的正整数' }
]
},
{
title: '规则正则表达式',
key: 'pattern',
width: '50%',
type: FormTypes.input,
validateRules: [
{ required: true, message: '规则不能为空' },
{ handler: this.validatePatternHandler }
]
},
{
title: '提示文本',
key: 'message',
width: '20%',
type: FormTypes.input,
validateRules: [
{ required: true, message: '${title}不能为空' }
]
},
{
title: '操作',
key: 'action',
width: '15%',
slotName: 'action',
type: FormTypes.slot
}
],
dataSource: []
}
},
url: {
add: '/sys/checkRule/add',
edit: '/sys/checkRule/edit'
}
}
},
created () {
},
methods: {
validatePatternHandler (type, value, row, column, callback, target) {
if (type === 'blur' || type === 'getValues') {
try {
new RegExp(value)
callback(true)
} catch (e) {
callback(false, '请输入正确的正则表达式')
}
} else {
callback(true) // 不填写或者填写 null 代表不进行任何操作
}
},
add () {
this.edit({})
},
edit (record) {
this.tabs.activeKey = this.tabs.design.key
this.tabs.global.dataSource = []
this.tabs.design.dataSource = [{ digits: '', pattern: '', message: '' }]
this.visible = true
this.$nextTick(() => {
this.$refs.form.resetFields()
this.model = Object.assign({}, record)
// 子表数据
const ruleJson = this.model.ruleJson
if (ruleJson) {
const ruleList = JSON.parse(ruleJson)
// 筛选出全局规则和局部规则
const global = []; const design = []; let priority = '1'
ruleList.forEach(rule => {
if (rule.digits === '*') {
global.push(Object.assign(rule, { priority }))
} else {
priority = '0'
design.push(rule)
}
})
this.tabs.global.dataSource = global
this.tabs.design.dataSource = design
}
})
},
close () {
this.$emit('close')
this.visible = false
},
handleOk () {
Promise.all([
// 主表单校验
alwaysResolve(new Promise((resolve, reject) => {
this.$refs.form.validate((ok, err) => ok ? resolve(this.model) : reject(err))
})),
// 局部规则子表校验
alwaysResolve(this.$refs.designTable.getValuesPromise),
// 全局规则子表校验
alwaysResolve(this.$refs.globalTable.getValuesPromise)
]).then(results => {
const [mainResult, designResult, globalResult] = results
if (mainResult.type === failedSymbol) {
return Promise.reject('主表校验未通过')
} else if (designResult.type === failedSymbol) {
this.tabs.activeKey = this.tabs.design.key
return Promise.reject('局部规则子表校验未通过')
} else if (globalResult.type === failedSymbol) {
this.tabs.activeKey = this.tabs.global.key
return Promise.reject('全局规则子表校验未通过')
} else {
// 所有校验已通过,这一步是整合数据
const mainValues = mainResult.data; const globalValues = globalResult.data; const designValues = designResult.data
// 整合两个子表的数据
const firstGlobal = []; const afterGlobal = []
globalValues.forEach(v => {
v.digits = '*'
if (v.priority === '1') {
firstGlobal.push(v)
} else {
afterGlobal.push(v)
}
})
const concatValues = firstGlobal.concat(designValues).concat(afterGlobal)
const subValues = concatValues.map(i => pick(i, 'digits', 'pattern', 'message'))
// 生成 formData,用于传入后台
const ruleJson = JSON.stringify(subValues)
const formData = Object.assign(this.model, mainValues, { ruleJson })
// 判断请求方式和请求地址,并发送请求
let method = 'post'; let httpUrl = this.url.add
if (this.model.id) {
method = 'put'
httpUrl = this.url.edit
}
this.confirmLoading = true
return httpAction(httpUrl, formData, method)
}
}).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.$emit('ok')
this.close()
} else {
this.$message.warning(res.message)
}
}).catch(e => {
console.error(e)
}).finally(() => {
this.confirmLoading = false
})
},
handleCancel () {
this.close()
}
}
}
</script>
<style lang="less" scoped></style>
<style lang="less" scoped></style>
@@ -26,33 +26,33 @@
</template>
<script>
import { validateCheckRule } from '@/utils/util'
import { validateCheckRule } from '@/utils/util'
export default {
name: 'SysCheckRuleTestModal',
data() {
return {
title: '操作',
visible: false,
ruleCode: '',
testValue: '',
form: this.$form.createForm(this),
validatorRules: {
test: {
rules: [{ validator: (rule, value, callback) => validateCheckRule(this.ruleCode, value, callback) }]
}
},
export default {
name: 'SysCheckRuleTestModal',
data () {
return {
title: '操作',
visible: false,
ruleCode: '',
testValue: '',
form: this.$form.createForm(this),
validatorRules: {
test: {
rules: [{ validator: (rule, value, callback) => validateCheckRule(this.ruleCode, value, callback) }]
}
}
},
methods: {
open(ruleCode) {
this.ruleCode = ruleCode
this.form.resetFields()
this.testValue = ''
this.visible = true
},
}
},
methods: {
open (ruleCode) {
this.ruleCode = ruleCode
this.form.resetFields()
this.testValue = ''
this.visible = true
}
}
}
</script>
<style lang="less" scoped></style>
<style lang="less" scoped></style>
@@ -72,210 +72,210 @@
</template>
<script>
import pick from 'lodash.pick'
import { httpAction, postAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
import pick from 'lodash.pick'
import { httpAction, postAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
export default {
name: 'SysDataSourceModal',
components: {},
data() {
return {
title: '操作',
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
export default {
name: 'SysDataSourceModal',
components: {},
data () {
return {
title: '操作',
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules: {
code: {
validateFirst: true,
rules: [
{ required: true, message: '请输入数据源编码!' },
{
validator: (rule, value, callback) => {
let pattern = /^[a-z|A-Z][a-z|A-Z\d_-]{0,}$/
if (!pattern.test(value)) {
callback('编码必须以字母开头可包含数字下划线横杠')
} else {
validateDuplicateValue('sys_data_source', 'code', value, this.model.id, callback)
}
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules: {
code: {
validateFirst: true,
rules: [
{ required: true, message: '请输入数据源编码!' },
{
validator: (rule, value, callback) => {
const pattern = /^[a-z|A-Z][a-z|A-Z\d_-]{0,}$/
if (!pattern.test(value)) {
callback('编码必须以字母开头可包含数字下划线横杠')
} else {
validateDuplicateValue('sys_data_source', 'code', value, this.model.id, callback)
}
}
]
},
name: { rules: [{ required: true, message: '请输入数据源名称!' }] },
dbType: { rules: [{ required: true, message: '请选择数据库类型!' }] },
dbDriver: { rules: [{ required: true, message: '请输入驱动类!' }] },
dbUrl: { rules: [{ required: true, message: '请输入数据源地址!' }] },
dbName: { rules: [{ required: true, message: '请输入数据库名称!' }] },
dbUsername: { rules: [{ required: true, message: '请输入用户名!' }] },
dbPassword: { rules: [{ required: false, message: '请输入密码!' }] }
},
url: {
add: '/sys/dataSource/add',
edit: '/sys/dataSource/edit',
},
dbDriverMap: {
// MySQL 数据库
'1': { dbDriver: 'com.mysql.jdbc.Driver' },
//MySQL5.7+ 数据库
'4': { dbDriver: 'com.mysql.cj.jdbc.Driver' },
// Oracle
'2': { dbDriver: 'oracle.jdbc.OracleDriver' },
// SQLServer 数据库
'3': { dbDriver: 'com.microsoft.sqlserver.jdbc.SQLServerDriver' },
// marialDB 数据库
'5': { dbDriver: 'org.mariadb.jdbc.Driver' },
// postgresql 数据库
'6': { dbDriver: 'org.postgresql.Driver' },
// 达梦 数据库
'7': { dbDriver: 'dm.jdbc.driver.DmDriver' },
// 人大金仓 数据库
'8': { dbDriver: 'com.kingbase8.Driver' },
// 神通 数据库
'9': { dbDriver: 'com.oscar.Driver' },
// SQLite 数据库
'10': { dbDriver: 'org.sqlite.JDBC' },
// DB2 数据库
'11': { dbDriver: 'com.ibm.db2.jcc.DB2Driver' },
// Hsqldb 数据库
'12': { dbDriver: 'org.hsqldb.jdbc.JDBCDriver' },
// Derby 数据库
'13': { dbDriver: 'org.apache.derby.jdbc.ClientDriver' },
// H2 数据库
'14': { dbDriver: 'org.h2.Driver' },
// 其他数据库
'15': { dbDriver: '' }
},
dbUrlMap: {
// MySQL 数据库
'1': { dbUrl: 'jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false' },
//MySQL5.7+ 数据库
'4': { dbUrl: 'jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai' },
// Oracle
'2': { dbUrl: 'jdbc:oracle:thin:@127.0.0.1:1521:ORCL' },
// SQLServer 数据库
'3': { dbUrl: 'jdbc:sqlserver://127.0.0.1:1433;SelectMethod=cursor;DatabaseName=jeecgboot' },
// Mariadb 数据库
'5': { dbUrl: 'jdbc:mariadb://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useSSL=false' },
// Postgresql 数据库
'6': { dbUrl: 'jdbc:postgresql://127.0.0.1:5432/jeecg-boot' },
// 达梦 数据库
'7': { dbUrl: 'jdbc:dm://127.0.0.1:5236/?jeecg-boot&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8' },
// 人大金仓 数据库
'8': { dbUrl: 'jdbc:kingbase8://127.0.0.1:54321/jeecg-boot' },
// 神通 数据库
'9': { dbUrl: 'jdbc:oscar://192.168.1.125:2003/jeecg-boot' },
// SQLite 数据库
'10': { dbUrl: 'jdbc:sqlite://opt/test.db' },
// DB2 数据库
'11': { dbUrl: 'jdbc:db2://127.0.0.1:50000/jeecg-boot' },
// Hsqldb 数据库
'12': { dbUrl: 'jdbc:hsqldb:hsql://127.0.0.1/jeecg-boot' },
// Derby 数据库
'13': { dbUrl: 'jdbc:derby://127.0.0.1:1527/jeecg-boot' },
// H2 数据库
'14': { dbUrl: 'jdbc:h2:tcp://127.0.0.1:8082/jeecg-boot' },
// 其他数据库
'15': { dbUrl: '' }
}
}
},
created() {
},
methods: {
add() {
this.edit({})
},
edit(record) {
this.form.resetFields()
this.model = Object.assign({}, record)
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'code', 'name', 'remark', 'dbType', 'dbDriver', 'dbUrl', 'dbName', 'dbUsername', 'dbPassword'))
})
},
close() {
this.$emit('close')
this.visible = false
},
handleOk() {
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.confirmLoading = true
let formData = Object.assign(this.model, values)
let httpUrl = this.url.add, method = 'post'
if (this.model.id) {
httpUrl = this.url.edit
method = 'put'
// 由于编码的特殊性,所以不能更改
formData['code'] = undefined
}
httpAction(httpUrl, formData, method).then((res) => {
]
},
name: { rules: [{ required: true, message: '请输入数据源名称!' }] },
dbType: { rules: [{ required: true, message: '请选择数据库类型!' }] },
dbDriver: { rules: [{ required: true, message: '请输入驱动类!' }] },
dbUrl: { rules: [{ required: true, message: '请输入数据源地址!' }] },
dbName: { rules: [{ required: true, message: '请输入数据库名称!' }] },
dbUsername: { rules: [{ required: true, message: '请输入用户名!' }] },
dbPassword: { rules: [{ required: false, message: '请输入密码!' }] }
},
url: {
add: '/sys/dataSource/add',
edit: '/sys/dataSource/edit'
},
dbDriverMap: {
// MySQL 数据库
1: { dbDriver: 'com.mysql.jdbc.Driver' },
// MySQL5.7+ 数据库
4: { dbDriver: 'com.mysql.cj.jdbc.Driver' },
// Oracle
2: { dbDriver: 'oracle.jdbc.OracleDriver' },
// SQLServer 数据库
3: { dbDriver: 'com.microsoft.sqlserver.jdbc.SQLServerDriver' },
// marialDB 数据库
5: { dbDriver: 'org.mariadb.jdbc.Driver' },
// postgresql 数据库
6: { dbDriver: 'org.postgresql.Driver' },
// 达梦 数据库
7: { dbDriver: 'dm.jdbc.driver.DmDriver' },
// 人大金仓 数据库
8: { dbDriver: 'com.kingbase8.Driver' },
// 神通 数据库
9: { dbDriver: 'com.oscar.Driver' },
// SQLite 数据库
10: { dbDriver: 'org.sqlite.JDBC' },
// DB2 数据库
11: { dbDriver: 'com.ibm.db2.jcc.DB2Driver' },
// Hsqldb 数据库
12: { dbDriver: 'org.hsqldb.jdbc.JDBCDriver' },
// Derby 数据库
13: { dbDriver: 'org.apache.derby.jdbc.ClientDriver' },
// H2 数据库
14: { dbDriver: 'org.h2.Driver' },
// 其他数据库
15: { dbDriver: '' }
},
dbUrlMap: {
// MySQL 数据库
1: { dbUrl: 'jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false' },
// MySQL5.7+ 数据库
4: { dbUrl: 'jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai' },
// Oracle
2: { dbUrl: 'jdbc:oracle:thin:@127.0.0.1:1521:ORCL' },
// SQLServer 数据库
3: { dbUrl: 'jdbc:sqlserver://127.0.0.1:1433;SelectMethod=cursor;DatabaseName=jeecgboot' },
// Mariadb 数据库
5: { dbUrl: 'jdbc:mariadb://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useSSL=false' },
// Postgresql 数据库
6: { dbUrl: 'jdbc:postgresql://127.0.0.1:5432/jeecg-boot' },
// 达梦 数据库
7: { dbUrl: 'jdbc:dm://127.0.0.1:5236/?jeecg-boot&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8' },
// 人大金仓 数据库
8: { dbUrl: 'jdbc:kingbase8://127.0.0.1:54321/jeecg-boot' },
// 神通 数据库
9: { dbUrl: 'jdbc:oscar://192.168.1.125:2003/jeecg-boot' },
// SQLite 数据库
10: { dbUrl: 'jdbc:sqlite://opt/test.db' },
// DB2 数据库
11: { dbUrl: 'jdbc:db2://127.0.0.1:50000/jeecg-boot' },
// Hsqldb 数据库
12: { dbUrl: 'jdbc:hsqldb:hsql://127.0.0.1/jeecg-boot' },
// Derby 数据库
13: { dbUrl: 'jdbc:derby://127.0.0.1:1527/jeecg-boot' },
// H2 数据库
14: { dbUrl: 'jdbc:h2:tcp://127.0.0.1:8082/jeecg-boot' },
// 其他数据库
15: { dbUrl: '' }
}
}
},
created () {
},
methods: {
add () {
this.edit({})
},
edit (record) {
this.form.resetFields()
this.model = Object.assign({}, record)
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'code', 'name', 'remark', 'dbType', 'dbDriver', 'dbUrl', 'dbName', 'dbUsername', 'dbPassword'))
})
},
close () {
this.$emit('close')
this.visible = false
},
handleOk () {
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.confirmLoading = true
const formData = Object.assign(this.model, values)
let httpUrl = this.url.add; let method = 'post'
if (this.model.id) {
httpUrl = this.url.edit
method = 'put'
// 由于编码的特殊性,所以不能更改
formData.code = undefined
}
httpAction(httpUrl, formData, method).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.$emit('ok')
this.close()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
}
})
},
handleCancel () {
this.close()
},
// 测试数据源配置是否可以正常连接
handleTest () {
const keys = ['dbType', 'dbDriver', 'dbUrl', 'dbName', 'dbUsername', 'dbPassword']
// 获取以上字段的值,并清除校验状态
const fieldsValues = this.form.getFieldsValue(keys)
const setFields = {}
keys.forEach(key => setFields[key] = { value: fieldsValues[key], errors: null })
// 清除校验状态,目的是可以让错误文字闪烁
this.form.setFields(setFields)
// 重新校验
this.$nextTick(() => {
this.form.validateFields(keys, (errors, values) => {
if (!errors) {
const loading = this.$message.loading('连接中', 0)
postAction('/online/cgreport/api/testConnection', fieldsValues).then(res => {
if (res.success) {
this.$message.success(res.message)
this.$emit('ok')
this.close()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
this.$message.success('连接成功')
} else throw new Error(res.message)
}).catch(error => {
this.$warning({ title: '连接失败', content: error.message || error })
}).finally(() => loading())
}
})
},
handleCancel() {
this.close()
},
// 测试数据源配置是否可以正常连接
handleTest() {
let keys = ['dbType', 'dbDriver', 'dbUrl', 'dbName', 'dbUsername', 'dbPassword']
// 获取以上字段的值,并清除校验状态
let fieldsValues = this.form.getFieldsValue(keys)
let setFields = {}
keys.forEach(key => setFields[key] = { value: fieldsValues[key], errors: null })
// 清除校验状态,目的是可以让错误文字闪烁
this.form.setFields(setFields)
// 重新校验
this.$nextTick(() => {
this.form.validateFields(keys, (errors, values) => {
if (!errors) {
let loading = this.$message.loading('连接中', 0)
postAction('/online/cgreport/api/testConnection', fieldsValues).then(res => {
if (res.success) {
this.$message.success('连接成功')
} else throw new Error(res.message)
}).catch(error => {
this.$warning({ title: '连接失败', content: error.message || error })
}).finally(() => loading())
}
})
})
},
// 数据库类型更改时,联动更改数据库驱动
handleDbTypeChange(val) {
let dbDriver = this.dbDriverMap[val]
let dbUrl = this.dbUrlMap[val]
if (dbDriver) {
this.form.setFieldsValue(dbDriver)
}
if (dbUrl) {
this.form.setFieldsValue(dbUrl)
}
},
})
},
// 数据库类型更改时,联动更改数据库驱动
handleDbTypeChange (val) {
const dbDriver = this.dbDriverMap[val]
const dbUrl = this.dbUrlMap[val]
if (dbDriver) {
this.form.setFieldsValue(dbDriver)
}
if (dbUrl) {
this.form.setFieldsValue(dbUrl)
}
}
}
}
</script>
<style lang="less" scoped></style>
<style lang="less" scoped></style>
@@ -154,4 +154,4 @@
<!--<style lang="less" scoped>-->
<!--</style>-->
<!--</style>-->
@@ -31,108 +31,107 @@
</template>
<script>
import { httpAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
import { httpAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
export default {
name: 'SysFillRuleModal',
components: {},
data() {
return {
title: '操作',
visible: false,
model: {},
labelCol: { xs: { span: 24 }, sm: { span: 5 } },
wrapperCol: { xs: { span: 24 }, sm: { span: 16 } },
export default {
name: 'SysFillRuleModal',
components: {},
data () {
return {
title: '操作',
visible: false,
model: {},
labelCol: { xs: { span: 24 }, sm: { span: 5 } },
wrapperCol: { xs: { span: 24 }, sm: { span: 16 } },
confirmLoading: false,
validatorRules: {
ruleName: [{ required: true, message: '规则名称不能为空' }],
ruleCode: [
{ required: true, message: '规则Code不能为空' },
{ validator: (rule, value, callback) => validateDuplicateValue('sys_fill_rule', 'rule_code', value, this.model.id, callback) }
],
ruleClass: [{ required: true, message: '规则实现类不能为空' }],
ruleParams: [{
validator: (rule, value, callback) => {
try {
let json = JSON.parse(value)
if (json instanceof Array) {
callback('只能传递JSON对象不能传递JSON数组')
} else if (json instanceof Object) {
callback()
} else {
callback('请输入JSON字符串')
}
} catch {
confirmLoading: false,
validatorRules: {
ruleName: [{ required: true, message: '规则名称不能为空' }],
ruleCode: [
{ required: true, message: '规则Code不能为空' },
{ validator: (rule, value, callback) => validateDuplicateValue('sys_fill_rule', 'rule_code', value, this.model.id, callback) }
],
ruleClass: [{ required: true, message: '规则实现类不能为空' }],
ruleParams: [{
validator: (rule, value, callback) => {
try {
const json = JSON.parse(value)
if (json instanceof Array) {
callback('只能传递JSON对象不能传递JSON数组')
} else if (json instanceof Object) {
callback()
} else {
callback('请输入JSON字符串')
}
} catch {
callback('请输入JSON字符串')
}
}],
},
url: {
add: '/sys/fillRule/add',
edit: '/sys/fillRule/edit',
},
}
},
computed: {
disabledCode() {
return !!this.model.id
}
},
created() {
},
methods: {
add() {
this.edit({})
},
edit(record) {
this.visible = true
this.$nextTick(() => {
this.$refs.form.resetFields()
this.model = Object.assign({}, record)
})
},
close() {
this.$emit('close')
this.visible = false
},
handleOk() {
const that = this
// 触发表单验证
this.$refs.form.validate((ok, err) => {
if (ok) {
that.confirmLoading = true
let httpUrl = this.url.add, method = 'post'
if (this.model.id) {
httpUrl = this.url.edit
method = 'put'
}
httpAction(httpUrl, this.model, method).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
that.close()
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
})
}
})
}]
},
handleCancel() {
this.close()
url: {
add: '/sys/fillRule/add',
edit: '/sys/fillRule/edit'
}
}
},
computed: {
disabledCode () {
return !!this.model.id
}
},
created () {
},
methods: {
add () {
this.edit({})
},
edit (record) {
this.visible = true
this.$nextTick(() => {
this.$refs.form.resetFields()
this.model = Object.assign({}, record)
})
},
close () {
this.$emit('close')
this.visible = false
},
handleOk () {
const that = this
// 触发表单验证
this.$refs.form.validate((ok, err) => {
if (ok) {
that.confirmLoading = true
let httpUrl = this.url.add; let method = 'post'
if (this.model.id) {
httpUrl = this.url.edit
method = 'put'
}
httpAction(httpUrl, this.model, method).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
that.close()
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
})
}
})
},
handleCancel () {
this.close()
}
}
}
</script>
<style lang="less" scoped>
</style>
</style>
@@ -48,123 +48,123 @@
</template>
<script>
import { httpAction } from '@/api/manage'
import { duplicateCheck } from '@/api/api'
import JDictSelectTag from '@/components/dict/JDictSelectTag'
import { httpAction } from '@/api/manage'
import { duplicateCheck } from '@/api/api'
import JDictSelectTag from '@/components/dict/JDictSelectTag'
let validatorCodeTimer = null
let validatorCodeTimer = null
export default {
name: 'SysPositionModal',
components: { JDictSelectTag },
data() {
return {
title: '操作',
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules: {
code: [
{ required: true, message: '请输入职务编码' },
{
validator: (rule, value, callback) => {
// 函数消抖的简单实现,防止一段时间内发送多次请求
if (validatorCodeTimer) {
// 停止上次开启的定时器
clearTimeout(validatorCodeTimer)
}
validatorCodeTimer = setTimeout(() => {
duplicateCheck({
tableName: 'sys_position',
fieldName: 'code',
fieldVal: value,
dataId: this.model.id
}).then((res) => {
if (res.success) {
callback()
} else {
callback(res.message)
}
}).catch(console.error)
}, 300)
export default {
name: 'SysPositionModal',
components: { JDictSelectTag },
data () {
return {
title: '操作',
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
confirmLoading: false,
validatorRules: {
code: [
{ required: true, message: '请输入职务编码' },
{
validator: (rule, value, callback) => {
// 函数消抖的简单实现,防止一段时间内发送多次请求
if (validatorCodeTimer) {
// 停止上次开启的定时器
clearTimeout(validatorCodeTimer)
}
validatorCodeTimer = setTimeout(() => {
duplicateCheck({
tableName: 'sys_position',
fieldName: 'code',
fieldVal: value,
dataId: this.model.id
}).then((res) => {
if (res.success) {
callback()
} else {
callback(res.message)
}
}).catch(console.error)
}, 300)
}
],
name: [{ required: true, message: '请输入职务名称' }] ,
postRank: [{ required: true, message: '选择职级' }] ,
},
url: {
add: '/sys/position/add',
edit: '/sys/position/edit',
},
readOnly:false
}
],
name: [{ required: true, message: '输入职务名称' }],
postRank: [{ required: true, message: '请选择职级' }]
},
url: {
add: '/sys/position/add',
edit: '/sys/position/edit'
},
readOnly: false
}
},
created () {
},
methods: {
add () {
this.edit({})
},
edit (record) {
this.model = Object.assign({}, record)
this.visible = true
if (record.id) {
this.readOnly = true
} else {
this.readOnly = false
}
},
created() {
close () {
this.$emit('close')
this.visible = false
this.$refs.form.resetFields()
},
methods: {
add() {
this.edit({})
},
edit(record) {
this.model = Object.assign({}, record)
this.visible = true
if(record.id){
this.readOnly=true
}else{
this.readOnly=false
}
},
close() {
this.$emit('close')
this.visible = false
this.$refs.form.resetFields();
},
handleOk() {
const that = this
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true
let httpurl = ''
let method = ''
if (!this.model.id) {
httpurl += this.url.add
method = 'post'
} else {
httpurl += this.url.edit
method = 'put'
}
httpAction(httpurl, this.model, method).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
that.close()
})
}else{
return false;
handleOk () {
const that = this
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true
let httpurl = ''
let method = ''
if (!this.model.id) {
httpurl += this.url.add
method = 'post'
} else {
httpurl += this.url.edit
method = 'put'
}
})
},
handleCancel() {
this.close()
},
httpAction(httpurl, this.model, method).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
that.close()
})
} else {
return false
}
})
},
handleCancel () {
this.close()
}
}
}
</script>
<style lang="less" scoped>
@@ -66,116 +66,112 @@
</template>
<script>
import pick from 'lodash.pick'
import { httpAction, getAction } from '@/api/manage'
import JDate from '@/components/jero/JDate.vue';
import JSelectUserByDep from '@/components/jerobiz/JSelectUserByDep'
export default {
name: "SysUserAgentModal",
components: {
JDate,
JSelectUserByDep
},
data () {
return {
title:"操作",
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
username:"",
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules:{
agentUserName:{rules: [{ required: true, message: '请输入代理人用户名!' }]},
startTime:{rules: [{ required: true, message: '请输入代理开始时间!' }]},
endTime:{rules: [{ required: true, message: '请输入代理结束时间!' }]},
},
url: {
add: "/sys/sysUserAgent/add",
edit: "/sys/sysUserAgent/edit",
queryByUserName:"/sys/sysUserAgent/queryByUserName",
},
}
},
created () {
},
methods: {
agentSettings(username){
this.username = username;
this.init();
import pick from 'lodash.pick'
import { httpAction, getAction } from '@/api/manage'
import JDate from '@/components/jero/JDate.vue'
import JSelectUserByDep from '@/components/jerobiz/JSelectUserByDep'
export default {
name: 'SysUserAgentModal',
components: {
JDate,
JSelectUserByDep
},
data () {
return {
title: '操作',
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
init () {
var params = {userName:this.username};//查询条件
getAction(this.url.queryByUserName,params).then((res)=>{
if(res.success){
console.log("获取流程节点信息",res);
this.edit (res.result);
}else{
this.edit({userName:this.username,status:"0"});
}
})
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
edit (record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model,'userName','agentUserName','status','startTime','endTime'))
});
username: '',
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules: {
agentUserName: { rules: [{ required: true, message: '请输入代理人用户名!' }] },
startTime: { rules: [{ required: true, message: '请输入代理开始时间!' }] },
endTime: { rules: [{ required: true, message: '请输入代理结束时间!' }] }
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
let formData = Object.assign(this.model, values);
httpAction(httpurl,formData,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
//this.init();
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
that.close();
})
}
})
},
handleCancel () {
this.close()
url: {
add: '/sys/sysUserAgent/add',
edit: '/sys/sysUserAgent/edit',
queryByUserName: '/sys/sysUserAgent/queryByUserName'
}
}
},
created () {
},
methods: {
agentSettings (username) {
this.username = username
this.init()
},
init () {
var params = { userName: this.username }// 查询条件
getAction(this.url.queryByUserName, params).then((res) => {
if (res.success) {
console.log('获取流程节点信息', res)
this.edit(res.result)
} else {
this.edit({ userName: this.username, status: '0' })
}
})
},
edit (record) {
this.form.resetFields()
this.model = Object.assign({}, record)
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'userName', 'agentUserName', 'status', 'startTime', 'endTime'))
})
},
close () {
this.$emit('close')
this.visible = false
},
handleOk () {
const that = this
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true
let httpurl = ''
let method = ''
if (!this.model.id) {
httpurl += this.url.add
method = 'post'
} else {
httpurl += this.url.edit
method = 'put'
}
const formData = Object.assign(this.model, values)
httpAction(httpurl, formData, method).then((res) => {
if (res.success) {
that.$message.success(res.message)
// this.init();
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
that.close()
})
}
})
},
handleCancel () {
this.close()
}
}
}
</script>
<style scoped>
</style>
</style>
+124 -125
View File
@@ -8,13 +8,13 @@
<a-input v-model="model.name" placeholder="请输入租户名称"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="租户编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="id">
<a-input-number style="width: 100%" :min="1" v-model="model.id" placeholder="请输入租户编号" :disabled="disabledId"></a-input-number>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="开始时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-date placeholder="请选择开始时间" v-model="model.beginDate" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
@@ -43,141 +43,140 @@
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
import JFormContainer from '@/components/jero/JFormContainer'
import JDate from '@/components/jero/JDate'
import JDictSelectTag from "@/components/dict/JDictSelectTag"
export default {
name: "TenantForm",
components: {
JFormContainer,
JDate,
JDictSelectTag,
import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
import JFormContainer from '@/components/jero/JFormContainer'
import JDate from '@/components/jero/JDate'
import JDictSelectTag from '@/components/dict/JDictSelectTag'
export default {
name: 'TenantForm',
components: {
JFormContainer,
JDate,
JDictSelectTag
},
props: {
formData: {
type: Object,
default: () => {},
required: false
},
props: {
formData: {
type: Object,
default: ()=>{},
required: false
normal: {
type: Boolean,
default: false,
required: false
},
disabled: {
type: Boolean,
default: false,
required: false
}
},
data () {
return {
model: { status: 1 },
id: '',
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
normal: {
type: Boolean,
default: false,
required: false
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
disabled: {
type: Boolean,
default: false,
required: false
confirmLoading: false,
validatorRules: {
id: [{ required: true, message: '请输入租户编号!' }]
},
url: {
add: '/sys/tenant/add',
edit: '/sys/tenant/edit',
queryById: '/sys/tenant/queryById'
}
},
data () {
return {
model: {status:1},
id:'',
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules: {
id:[ { required: true, message: '请输入租户编号!' },]
},
url: {
add: "/sys/tenant/add",
edit: "/sys/tenant/edit",
queryById: "/sys/tenant/queryById"
}
},
computed: {
formDisabled () {
if (this.normal === false) {
if (this.formData.disabled === false) {
return false
} else {
return true
}
}
return this.disabled
},
computed: {
formDisabled(){
if(this.normal===false){
if(this.formData.disabled===false){
return false
}else{
return true
}
}
return this.disabled
},
disabledId(){
return this.id?true : false;
},
showFlowSubmitButton(){
if(this.normal===false){
if(this.formData.disabled===false){
return true
}else{
return false
}
}else{
disabledId () {
return !!this.id
},
showFlowSubmitButton () {
if (this.normal === false) {
if (this.formData.disabled === false) {
return true
} else {
return false
}
} else {
return false
}
}
},
created () {
this.showFlowData()
},
methods: {
show (record) {
this.model = record ? Object.assign({}, record) : this.model
this.id = record ? record.id : ''
this.visible = true
},
showFlowData () {
if (this.normal === false) {
const params = { id: this.formData.dataId }
getAction(this.url.queryById, params).then((res) => {
if (res.success) {
this.edit(res.result)
}
})
}
},
created () {
this.showFlowData();
},
methods: {
show (record) {
this.model = record?Object.assign({}, record):this.model;
this.id = record?record.id:'';
this.visible = true;
},
showFlowData(){
if(this.normal === false){
let params = {id:this.formData.dataId};
getAction(this.url.queryById,params).then((res)=>{
if(res.success){
this.edit (res.result);
}
});
}
},
submitForm () {
const that = this;
// 触发表单验证
that.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
if("该编号已存在!" == res.message){
this.model.id=""
}
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
})
}else{
return false;
submitForm () {
const that = this
// 触发表单验证
that.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true
let httpurl = ''
let method = ''
if (!this.id) {
httpurl += this.url.add
method = 'post'
} else {
httpurl += this.url.edit
method = 'put'
}
})
},
popupCallback(row){
this.model = Object.assign(this.model, row);
},
httpAction(httpurl, this.model, method).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
} else {
if (res.message == '该编号已存在!') {
this.model.id = ''
}
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
})
} else {
return false
}
})
},
popupCallback (row) {
this.model = Object.assign(this.model, row)
}
}
}
</script>
@@ -13,47 +13,47 @@
</template>
<script>
import TenantForm from './TenantForm'
export default {
name: "TenantModal",
components: {
TenantForm
import TenantForm from './TenantForm'
export default {
name: 'TenantModal',
components: {
TenantForm
},
data () {
return {
title: '',
width: 800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible = true
this.$nextTick(() => {
this.$refs.realForm.show()
})
},
data () {
return {
title:'',
width:800,
visible: false,
disableSubmit: false
}
edit (record) {
this.visible = true
this.$nextTick(() => {
this.$refs.realForm.show(record)
})
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.show();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.show(record);
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleCancel () {
this.close()
}
close () {
this.$emit('close')
this.visible = false
},
handleOk () {
this.$refs.realForm.submitForm()
},
submitCallback () {
this.$emit('ok')
this.visible = false
},
handleCancel () {
this.close()
}
}
</script>
}
</script>
+357 -357
View File
@@ -138,383 +138,383 @@
<script>
import moment from 'moment'
import Vue from 'vue'
import { ACCESS_TOKEN } from "@/store/mutation-types"
import { ACCESS_TOKEN } from '@/store/mutation-types'
import { getAction } from '@/api/manage'
import { addUser,editUser,queryUserRole,queryall } from '@/api/api'
import { disabledAuthFilter } from "@/utils/authFilter"
import { duplicateCheck } from '@/api/api'
import { addUser, editUser, queryUserRole, queryall, duplicateCheck } from '@/api/api'
import { disabledAuthFilter } from '@/utils/authFilter'
import { getRSAPublicKey } from '@/utils/encryption.js'
import { JSEncrypt } from 'jsencrypt'
export default {
name: "UserModal",
components: {
export default {
name: 'UserModal',
components: {
},
data () {
return {
departDisabled: false, // 是否是我的部门调用该页面
roleDisabled: false, // 是否是角色维护调用该页面
modalWidth: 800,
drawerWidth: 700,
modaltoggleFlag: true,
confirmDirty: false,
userId: '', // 保存用户id
disableSubmit: false,
dateFormat: 'YYYY-MM-DD',
validatorRules: {
username: [{ required: true, message: '请输入用户账号!' },
{ validator: this.validateUsername }],
password: [{ required: true, pattern: /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{8,}$/, message: '密码由8位数字大小写字母和特殊符号组成!' },
{ validator: this.validateToNextPassword, trigger: 'change' }],
confirmpassword: [{ required: true, message: '请重新输入登录密码!' },
{ validator: this.compareToFirstPassword }],
realname: [{ required: true, message: '请输入用户名称!' }],
phone: [{ validator: this.validatePhone }],
email: [{ validator: this.validateEmail }],
roles: {},
workNo: [{ required: true, message: '请输入工号' },
{ validator: this.validateWorkNo }]
},
departIdShow: false,
title: '操作',
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
uploadLoading: false,
confirmLoading: false,
headers: {},
url: {
fileUpload: window._CONFIG.domianURL + '/sys/common/upload',
userWithDepart: '/sys/user/userDepartList', // 引入为指定用户查看部门信息需要的url
userId: '/sys/user/generateUserId', // 引入生成添加用户情况下的url
syncUserByUserName: '/act/process/extActProcess/doSyncUserByUserName', // 同步用户到工作流
queryTenantList: '/sys/tenant/queryList'
},
tenantsOptions: [],
rolesOptions: [],
nextDepartOptions: [],
rsaPublicKey: ''
}
},
created () {
const token = Vue.ls.get(ACCESS_TOKEN)
this.headers = { 'X-Access-Token': token }
this.initRoleList()
this.initTenantList()
},
computed: {
uploadAction: function () {
return this.url.fileUpload
}
},
methods: {
add () {
this.refresh()
this.edit({ userIdentity: 1 })
},
data () {
return {
departDisabled: false, //是否是我的部门调用该页面
roleDisabled: false, //是否是角色维护调用该页面
modalWidth:800,
drawerWidth:700,
modaltoggleFlag:true,
confirmDirty: false,
userId:"", //保存用户id
disableSubmit:false,
dateFormat:"YYYY-MM-DD",
validatorRules:{
username:[{required: true, message: '请输入用户账号!'},
{validator: this.validateUsername,}],
password: [{required: true,pattern:/^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{8,}$/,message: '密码由8位数字大小写字母和特殊符号组成!'},
{validator: this.validateToNextPassword,trigger: 'change'}],
confirmpassword: [{required: true, message: '请重新输入登录密码!',},
{ validator: this.compareToFirstPassword,}],
realname:[{ required: true, message: '请输入用户名称!' }],
phone: [{validator: this.validatePhone}],
email: [{validator: this.validateEmail}],
roles:{},
workNo:[ { required: true, message: '请输入工号' },
{ validator: this.validateWorkNo }],
},
departIdShow:false,
title:"操作",
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
uploadLoading:false,
confirmLoading: false,
headers:{},
url: {
fileUpload: window._CONFIG['domianURL']+"/sys/common/upload",
userWithDepart: "/sys/user/userDepartList", // 引入为指定用户查看部门信息需要的url
userId:"/sys/user/generateUserId", // 引入生成添加用户情况下的url
syncUserByUserName:"/act/process/extActProcess/doSyncUserByUserName",//同步用户到工作流
queryTenantList: '/sys/tenant/queryList'
},
tenantsOptions: [],
rolesOptions:[],
nextDepartOptions:[],
rsaPublicKey:'',
edit (record) {
const that = this
that.visible = true
// 根据屏幕宽度自适应抽屉宽度
this.resetScreenSize()
that.model = Object.assign({}, { selectedroles: '', selecteddeparts: '' }, record)
// 身份为上级显示负责部门,否则不显示
if (this.model.userIdentity == 2) {
this.departIdShow = true
} else {
this.departIdShow = false
}
if (record.hasOwnProperty('id')) {
that.userId = record.id
that.getUserRoles(record.id)
that.getUserDeparts(record.id)
}
},
created () {
const token = Vue.ls.get(ACCESS_TOKEN);
this.headers = {"X-Access-Token":token}
this.initRoleList()
this.initTenantList()
isDisabledAuth (code) {
return disabledAuthFilter(code)
},
computed:{
uploadAction:function () {
return this.url.fileUpload;
// 窗口最大化切换
toggleScreen () {
if (this.modaltoggleFlag) {
this.modalWidth = window.innerWidth
} else {
this.modalWidth = 800
}
this.modaltoggleFlag = !this.modaltoggleFlag
},
// 根据屏幕变化,设置抽屉尺寸
resetScreenSize () {
const screenWidth = document.body.clientWidth
if (screenWidth < 500) {
this.drawerWidth = screenWidth
} else {
this.drawerWidth = 700
}
},
methods: {
add () {
this.refresh();
this.edit({userIdentity:1});
},
edit (record) {
let that = this;
that.visible = true;
//根据屏幕宽度自适应抽屉宽度
this.resetScreenSize();
that.model = Object.assign({},{selectedroles:'',selecteddeparts:''}, record);
//身份为上级显示负责部门,否则不显示
if(this.model.userIdentity==2){
this.departIdShow=true;
}else{
this.departIdShow=false;
}
if(record.hasOwnProperty("id")){
that.userId = record.id;
that.getUserRoles(record.id);
that.getUserDeparts(record.id);
}
},
isDisabledAuth(code){
return disabledAuthFilter(code);
},
//窗口最大化切换
toggleScreen(){
if(this.modaltoggleFlag){
this.modalWidth = window.innerWidth;
}else{
this.modalWidth = 800;
}
this.modaltoggleFlag = !this.modaltoggleFlag;
},
// 根据屏幕变化,设置抽屉尺寸
resetScreenSize(){
let screenWidth = document.body.clientWidth;
if(screenWidth < 500){
this.drawerWidth = screenWidth;
}else{
this.drawerWidth = 700;
}
},
//初始化租户字典
initTenantList(){
getAction(this.url.queryTenantList).then(res=>{
if(res.success){
this.tenantsOptions = res.result.map((item,index,arr)=>{
let c = {label:item.name, value: item.id+""}
return c;
})
}
})
},
//初始化角色字典
initRoleList(){
queryall().then((res)=>{
if(res.success){
this.rolesOptions = res.result.map((item,index,arr)=>{
let c = {label:item.roleName, value:item.id}
return c;
})
}
});
},
getUserRoles(userid){
queryUserRole({userid:userid}).then((res)=>{
if(res.success){
this.model.selectedroles = res.result.join(",");
}
});
},
getUserDeparts(userid){
let that = this;
getAction(that.url.userWithDepart,{userId:userid}).then((res)=>{
if(res.success){
let departOptions=[];
let selectDepartKeys=[]
for (let i = 0; i < res.result.length; i++) {
selectDepartKeys.push(res.result[i].key);
//新增负责部门选择下拉框
departOptions.push({
value: res.result[i].key,
label: res.result[i].title
})
}
that.model.selecteddeparts = selectDepartKeys.join(",")
that.nextDepartOptions = departOptions;
}
})
},
backDepartInfo(info) {
this.model.departIds = this.model.selecteddeparts;
this.nextDepartOptions = info.map((item,index,arr)=>{
let c = {label:item.text, value: item.value+""}
return c;
})
},
refresh () {
this.userId=""
this.nextDepartOptions=[];
this.departIdShow=false;
},
close () {
this.$emit('close');
this.visible = false;
this.disableSubmit = false;
this.nextDepartOptions=[];
this.departIdShow=false;
this.$refs.form.resetFields();
},
moment,
handleSubmit () {
const that = this;
//先拉取秘钥
getRSAPublicKey().then(res => {
this.rsaPublicKey = res.result
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
//如果是上级择传入departIds,否则为空
if(this.model.userIdentity!==2){
this.model.departIds="";
}
// 对密码、邮箱、手机号进行加密
let encrypt = new JSEncrypt();
encrypt.setPublicKey(that.rsaPublicKey);
if (this.model.password != ""
&& this.model.password != null
&& this.model.password != undefined){
this.model.password = encrypt.encrypt(this.model.password)
}
if (this.model.phone != ""
&& this.model.phone != null
&& this.model.phone != undefined){
this.model.phone = encrypt.encrypt(this.model.phone)
}
if (this.model.email != ""
&& this.model.email != null
&& this.model.email != undefined){
this.model.email = encrypt.encrypt(this.model.email)
}
this.model.rsaPublicKey = that.rsaPublicKey
let obj;
if(!this.model.id){
this.model.id = this.userId;
obj=addUser(this.model);
}else{
obj=editUser(this.model);
}
obj.then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
that.close();
})
}else{
return false;
}
// 初始化租户字典
initTenantList () {
getAction(this.url.queryTenantList).then(res => {
if (res.success) {
this.tenantsOptions = res.result.map((item, index, arr) => {
const c = { label: item.name, value: item.id + '' }
return c
})
})
},
handleCancel () {
this.close()
},
validateToNextPassword (rule, value, callback) {
const confirmpassword=this.model.confirmpassword;
if (value && confirmpassword && value !== confirmpassword) {
callback('两次输入的密码不一样');
}
if (value && this.confirmDirty) {
this.$refs.form.validateField(['confirmpassword']);
}
callback();
},
compareToFirstPassword (rule, value, callback) {
if (value && value !== this.model.password) {
callback('两次输入的密码不一样');
} else {
callback()
}
},
validatePhone(rule, value, callback){
if(!value){
callback()
}else{
if(new RegExp(/^1[3|4|5|7|8|9][0-9]\d{8}$/).test(value)){
var params = {
tableName: 'sys_user',
fieldName: 'phone',
fieldVal: value,
dataId: this.userId
};
duplicateCheck(params).then((res) => {
if (res.success) {
callback()
} else {
callback("手机号已存在!")
}
})
}else{
callback("请输入正确格式的手机号码!");
}
}
},
validateEmail(rule, value, callback){
if(!value){
callback()
}else{
if(new RegExp(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/).test(value)){
var params = {
tableName: 'sys_user',
fieldName: 'email',
fieldVal: value,
dataId: this.userId
};
duplicateCheck(params).then((res) => {
console.log(res)
if (res.success) {
callback()
} else {
callback("邮箱已存在!")
}
})
}else{
callback("请输入正确格式的邮箱!")
}
}
},
validateUsername(rule, value, callback){
var params = {
tableName: 'sys_user',
fieldName: 'username',
fieldVal: value,
dataId: this.userId
};
duplicateCheck(params).then((res) => {
if (res.success) {
callback()
} else {
callback("用户名已存在!")
}
})
},
validateWorkNo(rule, value, callback){
var params = {
tableName: 'sys_user',
fieldName: 'work_no',
fieldVal: value,
dataId: this.userId
};
duplicateCheck(params).then((res) => {
if (res.success) {
callback()
},
// 初始化角色字典
initRoleList () {
queryall().then((res) => {
if (res.success) {
this.rolesOptions = res.result.map((item, index, arr) => {
const c = { label: item.roleName, value: item.id }
return c
})
}
})
},
getUserRoles (userid) {
queryUserRole({ userid: userid }).then((res) => {
if (res.success) {
this.model.selectedroles = res.result.join(',')
}
})
},
getUserDeparts (userid) {
const that = this
getAction(that.url.userWithDepart, { userId: userid }).then((res) => {
if (res.success) {
const departOptions = []
const selectDepartKeys = []
for (let i = 0; i < res.result.length; i++) {
selectDepartKeys.push(res.result[i].key)
// 新增负责部门选择下拉框
departOptions.push({
value: res.result[i].key,
label: res.result[i].title
})
}
that.model.selecteddeparts = selectDepartKeys.join(',')
that.nextDepartOptions = departOptions
}
})
},
backDepartInfo (info) {
this.model.departIds = this.model.selecteddeparts
this.nextDepartOptions = info.map((item, index, arr) => {
const c = { label: item.text, value: item.value + '' }
return c
})
},
refresh () {
this.userId = ''
this.nextDepartOptions = []
this.departIdShow = false
},
close () {
this.$emit('close')
this.visible = false
this.disableSubmit = false
this.nextDepartOptions = []
this.departIdShow = false
this.$refs.form.resetFields()
},
moment,
handleSubmit () {
const that = this
// 先拉取秘钥
getRSAPublicKey().then(res => {
this.rsaPublicKey = res.result
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true
// 如果是上级择传入departIds,否则为空
if (this.model.userIdentity !== 2) {
this.model.departIds = ''
}
// 对密码、邮箱、手机号进行加密
const encrypt = new JSEncrypt()
encrypt.setPublicKey(that.rsaPublicKey)
if (this.model.password != '' &&
this.model.password != null &&
this.model.password != undefined) {
this.model.password = encrypt.encrypt(this.model.password)
}
if (this.model.phone != '' &&
this.model.phone != null &&
this.model.phone != undefined) {
this.model.phone = encrypt.encrypt(this.model.phone)
}
if (this.model.email != '' &&
this.model.email != null &&
this.model.email != undefined) {
this.model.email = encrypt.encrypt(this.model.email)
}
this.model.rsaPublicKey = that.rsaPublicKey
let obj
if (!this.model.id) {
this.model.id = this.userId
obj = addUser(this.model)
} else {
obj = editUser(this.model)
}
obj.then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
that.close()
})
} else {
callback("工号已存在!")
return false
}
})
},
handleConfirmBlur(e) {
const value = e.target.value;
this.confirmDirty = this.confirmDirty || !!value
},
beforeUpload: function(file){
var fileType = file.type;
if(fileType.indexOf('image')<0){
this.$message.warning('请上传图片');
return false;
}
//TODO 验证文件大小
},
})
},
handleCancel () {
this.close()
},
validateToNextPassword (rule, value, callback) {
const confirmpassword = this.model.confirmpassword
// 搜索用户对应的部门API
onSearch(){
this.$refs.departWindow.add(this.checkedDepartKeys,this.userId);
},
identityChange(e){
if(e.target.value===1){
this.departIdShow=false;
}else{
this.departIdShow=true;
if (value && confirmpassword && value !== confirmpassword) {
callback('两次输入的密码不一样')
}
if (value && this.confirmDirty) {
this.$refs.form.validateField(['confirmpassword'])
}
callback()
},
compareToFirstPassword (rule, value, callback) {
if (value && value !== this.model.password) {
callback('两次输入的密码不一样')
} else {
callback()
}
},
validatePhone (rule, value, callback) {
if (!value) {
callback()
} else {
if (new RegExp(/^1[3|4|5|7|8|9][0-9]\d{8}$/).test(value)) {
var params = {
tableName: 'sys_user',
fieldName: 'phone',
fieldVal: value,
dataId: this.userId
}
duplicateCheck(params).then((res) => {
if (res.success) {
callback()
} else {
callback('手机号已存在!')
}
})
} else {
callback('请输入正确格式的手机号码!')
}
}
},
validateEmail (rule, value, callback) {
if (!value) {
callback()
} else {
if (new RegExp(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/).test(value)) {
var params = {
tableName: 'sys_user',
fieldName: 'email',
fieldVal: value,
dataId: this.userId
}
duplicateCheck(params).then((res) => {
console.log(res)
if (res.success) {
callback()
} else {
callback('邮箱已存在!')
}
})
} else {
callback('请输入正确格式的邮箱!')
}
}
},
validateUsername (rule, value, callback) {
var params = {
tableName: 'sys_user',
fieldName: 'username',
fieldVal: value,
dataId: this.userId
}
duplicateCheck(params).then((res) => {
if (res.success) {
callback()
} else {
callback('用户名已存在!')
}
})
},
validateWorkNo (rule, value, callback) {
var params = {
tableName: 'sys_user',
fieldName: 'work_no',
fieldVal: value,
dataId: this.userId
}
duplicateCheck(params).then((res) => {
if (res.success) {
callback()
} else {
callback('工号已存在!')
}
})
},
handleConfirmBlur (e) {
const value = e.target.value
this.confirmDirty = this.confirmDirty || !!value
},
beforeUpload: function (file) {
var fileType = file.type
if (fileType.indexOf('image') < 0) {
this.$message.warning('请上传图片')
return false
}
// TODO 验证文件大小
},
// 搜索用户对应的部门API
onSearch () {
this.$refs.departWindow.add(this.checkedDepartKeys, this.userId)
},
identityChange (e) {
if (e.target.value === 1) {
this.departIdShow = false
} else {
this.departIdShow = true
}
}
}
}
</script>
<style scoped>
@@ -548,4 +548,4 @@ import { JSEncrypt } from 'jsencrypt'
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>
</style>
@@ -53,141 +53,141 @@
</template>
<script>
import { putAction,deleteAction,getFileAccessHttpUrl } from "@/api/manage"
import { putAction, deleteAction, getFileAccessHttpUrl } from '@/api/manage'
// 高度封装的请求,请务必使用 superRequest.call(this,{}) 的方式调用
function superRequest(options) {
this.loading = !!options.loading
options.promise.then(res => {
if (res.success && typeof options.success === 'function') {
options.success(res)
} else {
throw new Error(res.message)
}
}).catch(e => {
console.error('查询已删除的用户失败:', e)
this.$message.warning('查询已删除的用户失败:' + (e.message || e))
}).finally(() => {
this.loading = false
})
}
// 高度封装的请求,请务必使用 superRequest.call(this,{}) 的方式调用
function superRequest (options) {
this.loading = !!options.loading
options.promise.then(res => {
if (res.success && typeof options.success === 'function') {
options.success(res)
} else {
throw new Error(res.message)
}
}).catch(e => {
console.error('查询已删除的用户失败:', e)
this.$message.warning('查询已删除的用户失败:' + (e.message || e))
}).finally(() => {
this.loading = false
})
}
export default {
name: 'UserRecycleBinModal',
props: {
visible: {
type: Boolean,
default: false
},
},
data() {
return {
title: '用户回收站',
loading: false,
innerVisible: false,
selectedRowKeys: [],
dataSource: [],
columns: [
{ title: '#', align: 'center', key: 'rowIndex', width: 80, customRender: (t, r, i) => i + 1 },
{ title: '账号', align: 'center', dataIndex: 'username' },
{ title: '姓名', align: 'center', dataIndex: 'realname', },
{ title: '头像', align: 'center', dataIndex: 'avatar', scopedSlots: { customRender: 'avatarslot' } },
{ title: '部门', align: 'center', dataIndex: 'orgCode' },
{ title: '操作', align: 'center', dataIndex: 'action', width: 200, scopedSlots: { customRender: 'action' } }
],
url: {
getAvatar: (path) => getFileAccessHttpUrl(`${path}`),
// 回收站操作,get = 获取列表;put = 取回;delete = 彻底删除
recycleBin: '/sys/user/recycleBin',
putRecycleBin: '/sys/user/putRecycleBin',
deleteRecycleBin: '/sys/user/deleteRecycleBin',
},
export default {
name: 'UserRecycleBinModal',
props: {
visible: {
type: Boolean,
default: false
}
},
data () {
return {
title: '用户回收站',
loading: false,
innerVisible: false,
selectedRowKeys: [],
dataSource: [],
columns: [
{ title: '#', align: 'center', key: 'rowIndex', width: 80, customRender: (t, r, i) => i + 1 },
{ title: '账号', align: 'center', dataIndex: 'username' },
{ title: '姓名', align: 'center', dataIndex: 'realname' },
{ title: '头像', align: 'center', dataIndex: 'avatar', scopedSlots: { customRender: 'avatarslot' } },
{ title: '部门', align: 'center', dataIndex: 'orgCode' },
{ title: '操作', align: 'center', dataIndex: 'action', width: 200, scopedSlots: { customRender: 'action' } }
],
url: {
getAvatar: (path) => getFileAccessHttpUrl(`${path}`),
// 回收站操作,get = 获取列表;put = 取回;delete = 彻底删除
recycleBin: '/sys/user/recycleBin',
putRecycleBin: '/sys/user/putRecycleBin',
deleteRecycleBin: '/sys/user/deleteRecycleBin'
}
},
watch: {
visible: {
immediate: true,
handler(val) {
if (val) {
this.loadData()
}
this.innerVisible = val
}
},
watch: {
visible: {
immediate: true,
handler (val) {
if (val) {
this.loadData()
}
},
innerVisible(val) {
this.$emit('update:visible', val)
},
this.innerVisible = val
}
},
methods: {
loadData() {
superRequest.call(this, {
loading: true,
promise: this.$http.get(this.url.recycleBin),
success: res => this.dataSource = res.result
})
},
handleOk() {
this.loadData()
this.$emit('ok')
},
handleCancel() {
this.innerVisible = false
},
// 还原用户
handleRevert(userIds) {
this.$confirm({
title: '恢复用户',
content: `您确定要恢复这 ${userIds.length} 个用户吗?`,
centered: true,
onOk: () => {
putAction(this.url.putRecycleBin,{userIds:userIds.join(',')}).then((res)=>{
if(res.success){
this.handleOk()
this.handleClearSelection()
this.$message.success(`还原 ${userIds.length} 个用户成功!`)
}
})
}
})
},
// 彻底删除用户
handleDelete(userIds) {
this.$confirm({
title: '彻底删除用户',
content: (<div>
<p>您确定要彻底删除这 {userIds.length} 个用户吗?</p>
<p style="color:red;">注意:彻底删除后将无法恢复,请谨慎操作!</p>
</div>),
centered: true,
onOk: () => {
var that = this;
deleteAction(that.url.deleteRecycleBin, {userIds: userIds.join(',')}).then((res) => {
if (res.success) {
this.loadData()
this.handleClearSelection()
this.$message.success(`彻底删除 ${userIds.length} 个用户成功!`)
} else {
that.$message.warning(res.message);
}
});
},
})
},
handleRevertBatch() {
this.handleRevert(this.selectedRowKeys)
},
handleDeleteBatch() {
this.handleDelete(this.selectedRowKeys)
},
handleClearSelection() {
this.handleTableSelectChange([], [])
},
handleTableSelectChange(selectedRowKeys, selectionRows) {
this.selectedRowKeys = selectedRowKeys
this.selectionRows = selectionRows
},
innerVisible (val) {
this.$emit('update:visible', val)
}
},
methods: {
loadData () {
superRequest.call(this, {
loading: true,
promise: this.$http.get(this.url.recycleBin),
success: res => this.dataSource = res.result
})
},
handleOk () {
this.loadData()
this.$emit('ok')
},
handleCancel () {
this.innerVisible = false
},
// 还原用户
handleRevert (userIds) {
this.$confirm({
title: '恢复用户',
content: `您确定要恢复这 ${userIds.length} 个用户吗?`,
centered: true,
onOk: () => {
putAction(this.url.putRecycleBin, { userIds: userIds.join(',') }).then((res) => {
if (res.success) {
this.handleOk()
this.handleClearSelection()
this.$message.success(`还原 ${userIds.length} 个用户成功!`)
}
})
}
})
},
// 彻底删除用户
handleDelete (userIds) {
this.$confirm({
title: '彻底删除用户',
content: (<div>
<p>您确定要彻底删除这 {userIds.length} 个用户吗?</p>
<p style="color:red;">注意:彻底删除后将无法恢复,请谨慎操作!</p>
</div>),
centered: true,
onOk: () => {
var that = this
deleteAction(that.url.deleteRecycleBin, { userIds: userIds.join(',') }).then((res) => {
if (res.success) {
this.loadData()
this.handleClearSelection()
this.$message.success(`彻底删除 ${userIds.length} 个用户成功!`)
} else {
that.$message.warning(res.message)
}
})
}
})
},
handleRevertBatch () {
this.handleRevert(this.selectedRowKeys)
},
handleDeleteBatch () {
this.handleDelete(this.selectedRowKeys)
},
handleClearSelection () {
this.handleTableSelectChange([], [])
},
handleTableSelectChange (selectedRowKeys, selectionRows) {
this.selectedRowKeys = selectedRowKeys
this.selectionRows = selectionRows
}
}
}
</script>
<style lang="less" scoped></style>
<style lang="less" scoped></style>
@@ -55,133 +55,133 @@
</template>
<script>
import {queryTreeListForRole,queryRolePermission,saveRolePermission} from '@/api/api'
import RoleDataruleModal from './RoleDataruleModal.vue'
import { queryTreeListForRole, queryRolePermission, saveRolePermission } from '@/api/api'
import RoleDataruleModal from './RoleDataruleModal.vue'
export default {
name: "RoleModal",
components:{
RoleDataruleModal
export default {
name: 'RoleModal',
components: {
RoleDataruleModal
},
data () {
return {
roleId: '',
treeData: [],
defaultCheckedKeys: [],
checkedKeys: [],
expandedKeysss: [],
allTreeKeys: [],
autoExpandParent: true,
checkStrictly: true,
title: '角色权限配置',
visible: false,
loading: false,
selectedKeys: []
}
},
methods: {
onTreeNodeSelect (id) {
if (id && id.length > 0) {
this.selectedKeys = id
}
this.$refs.datarule.show(this.selectedKeys[0], this.roleId)
},
data(){
return {
roleId:"",
treeData: [],
defaultCheckedKeys:[],
checkedKeys:[],
expandedKeysss:[],
allTreeKeys:[],
autoExpandParent: true,
checkStrictly: true,
title:"角色权限配置",
visible: false,
loading: false,
selectedKeys:[]
onCheck (o) {
if (this.checkStrictly) {
this.checkedKeys = o.checked
} else {
this.checkedKeys = o
}
},
methods: {
onTreeNodeSelect(id){
if(id && id.length>0){
this.selectedKeys = id
}
this.$refs.datarule.show(this.selectedKeys[0],this.roleId)
},
onCheck (o) {
if(this.checkStrictly){
this.checkedKeys = o.checked;
}else{
this.checkedKeys = o
}
},
show(roleId){
this.roleId=roleId
this.visible = true;
},
close () {
this.reset()
this.$emit('close');
this.visible = false;
},
onExpand(expandedKeys){
this.expandedKeysss = expandedKeys;
this.autoExpandParent = false
},
reset () {
this.expandedKeysss = []
this.checkedKeys = []
this.defaultCheckedKeys = []
this.loading = false
},
expandAll () {
this.expandedKeysss = this.allTreeKeys
},
closeAll () {
this.expandedKeysss = []
},
checkALL () {
this.checkedKeys = this.allTreeKeys
},
cancelCheckALL () {
//this.checkedKeys = this.defaultCheckedKeys
this.checkedKeys = []
},
switchCheckStrictly (v) {
if(v==1){
this.checkStrictly = false
}else if(v==2){
this.checkStrictly = true
}
},
handleCancel () {
this.close()
},
handleSubmit(exit) {
let that = this;
let params = {
roleId:that.roleId,
permissionIds:that.checkedKeys.join(","),
lastpermissionIds:that.defaultCheckedKeys.join(","),
};
that.loading = true;
console.log("请求参数",params);
saveRolePermission(params).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.loading = false;
if (exit) {
that.close()
}
}else {
that.$message.error(res.message);
that.loading = false;
if (exit) {
that.close()
}
show (roleId) {
this.roleId = roleId
this.visible = true
},
close () {
this.reset()
this.$emit('close')
this.visible = false
},
onExpand (expandedKeys) {
this.expandedKeysss = expandedKeys
this.autoExpandParent = false
},
reset () {
this.expandedKeysss = []
this.checkedKeys = []
this.defaultCheckedKeys = []
this.loading = false
},
expandAll () {
this.expandedKeysss = this.allTreeKeys
},
closeAll () {
this.expandedKeysss = []
},
checkALL () {
this.checkedKeys = this.allTreeKeys
},
cancelCheckALL () {
// this.checkedKeys = this.defaultCheckedKeys
this.checkedKeys = []
},
switchCheckStrictly (v) {
if (v == 1) {
this.checkStrictly = false
} else if (v == 2) {
this.checkStrictly = true
}
},
handleCancel () {
this.close()
},
handleSubmit (exit) {
const that = this
const params = {
roleId: that.roleId,
permissionIds: that.checkedKeys.join(','),
lastpermissionIds: that.defaultCheckedKeys.join(',')
}
that.loading = true
console.log('请求参数:', params)
saveRolePermission(params).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loading = false
if (exit) {
that.close()
}
this.loadData();
})
},
loadData(){
queryTreeListForRole().then((res) => {
this.treeData = res.result.treeList
this.allTreeKeys = res.result.ids
queryRolePermission({roleId:this.roleId}).then((res)=>{
this.checkedKeys = [...res.result];
this.defaultCheckedKeys = [...res.result];
this.expandedKeysss = this.allTreeKeys;
console.log(this.defaultCheckedKeys)
})
})
}
} else {
that.$message.error(res.message)
that.loading = false
if (exit) {
that.close()
}
}
this.loadData()
})
},
loadData () {
queryTreeListForRole().then((res) => {
this.treeData = res.result.treeList
this.allTreeKeys = res.result.ids
queryRolePermission({ roleId: this.roleId }).then((res) => {
this.checkedKeys = [...res.result]
this.defaultCheckedKeys = [...res.result]
this.expandedKeysss = this.allTreeKeys
console.log(this.defaultCheckedKeys)
})
})
}
},
watch: {
visible () {
if (this.visible) {
this.loadData();
this.loadData()
}
}
}
}
}
</script>
<style lang="less" scoped>
@@ -197,4 +197,4 @@
border-radius: 0 0 2px 2px;
}
</style>
</style>