[update] 内部工作组左侧树一级节点的新增删除和二级节点的编辑删除走角色管理,二级新增和三级编辑删除权限按一级新增时的管理权限走

This commit is contained in:
lideqin
2023-11-08 15:11:37 +08:00
parent 1323edc080
commit ea6aac0329
5 changed files with 224 additions and 30 deletions
@@ -0,0 +1,117 @@
<template>
<j-modal
:title="title"
:maskClosable="true"
:width="500"
:closable="true"
switchFullscreen
@cancel="handleCancel"
@ok="handleOk"
:visible="visible">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<!-- 工作组名称 -->
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('system.internalWorkGroup.workGroupName')">
<a-input :placeholder="$t('pleaseEnter') + $t('system.internalWorkGroup.workGroupName')"
:maxLength="50"
@change="event => event.target.value = event.target.value.trim()"
v-decorator.trim="[ 'name', validatorRules.name ]" />
</a-form-item>
</a-form>
</a-spin>
</j-modal>
</template>
<script>
import pick from 'lodash.pick'
import { postAction } from '@/api/manage'
export default {
name: 'TreeNodeWorkGroupModal',
data () {
return {
title: '',
visible: false,
confirmLoading: false,
form: this.$form.createForm(this),
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 6 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
validatorRules: {
name: {
rules: [
{ required: true, message: this.$t('pleaseEnter') + this.$t('system.internalWorkGroup.workGroupName') }
],
validateTrigger: 'blur'
}
},
url: {
add: '/sys/lawsWorkingGroup/add',
edit: '/sys/lawsWorkingGroup/edit'
}
}
},
methods: {
add (parentNodeKey) {
this.visible = true
this.form.resetFields()
this.model.pid = parentNodeKey
},
edit (nodeKey, record) {
this.visible = true
this.form.resetFields()
this.model = Object.assign({}, record)
this.model.id = nodeKey
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'name'))
})
},
close () {
this.visible = false
this.model = {}
},
handleCancel () {
this.close()
},
handleOk () {
if (this.confirmLoading) return
this.form.validateFields((err, values) => {
if (!err) {
this.confirmLoading = true
const param = Object.assign({}, this.model)
param.name = values.name
let url = ''
if (this.model.id) {
url = this.url.edit
} else {
url = this.url.add
}
postAction(url, param).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
})
}
})
}
}
}
</script>
<style scoped>
</style>