|
@@ -144,31 +144,82 @@
|
|
|
</el-row>
|
|
|
<div>
|
|
|
<el-table
|
|
|
- :data="tableData1"
|
|
|
+ ref="moduleTable"
|
|
|
+ :data="moduleData"
|
|
|
style="width: 100%;margin-bottom: 20px;"
|
|
|
row-key="id"
|
|
|
border
|
|
|
- :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
|
|
+ :tree-props="{children: 'childModules', hasChildren: 'hasChildren'}"
|
|
|
+ :row-class-name="tableRowhidden"
|
|
|
>
|
|
|
- <el-table-column prop="date" label="模块名称" width="180" />
|
|
|
- <el-table-column prop="name" label="创建人" width="180" />
|
|
|
- <el-table-column prop="address" label="创建时间" />
|
|
|
+ <el-table-column v-if="false" prop="id" label="ID" width="180" />
|
|
|
+ <el-table-column prop="moduleName" label="模块名称" width="180">
|
|
|
+ <template slot="header">
|
|
|
+ 模块名称<i class="el-icon-circle-plus" @click="handlerModule('add')" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="creator" label="创建人" width="180" />
|
|
|
+ <el-table-column prop="createTime" label="创建时间" />
|
|
|
<el-table-column label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
- @click="handleEdit(scope.$index, scope.row)"
|
|
|
+ @click="handlerModule('add', scope.row, scope.$index)"
|
|
|
+ >添加</el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ @click="handlerModule('edit', scope.row, scope.$index)"
|
|
|
>编辑</el-button>
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="danger"
|
|
|
- @click="handleDelete(scope.$index, scope.row)"
|
|
|
+ @click="handlerModule('delete', scope.row, scope.$index)"
|
|
|
>删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
</el-main>
|
|
|
+ <normal-dialog :show-dialog="moduleDialog" :title="moduleTitle" @confirm="confirmModule('moduleForm')" @cancel="moduleDialog=false">
|
|
|
+ <el-form ref="moduleForm" :model="moduleForm">
|
|
|
+ <template v-if="curcentModule === 'add'">
|
|
|
+ <el-form-item label="父模块:" :label-width="formLabelWidth">
|
|
|
+ <el-col :span="11">{{ curcentParent }}</el-col>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ v-for="(moduleName, index) in moduleForm.moduleNames"
|
|
|
+ :key="index"
|
|
|
+ label="模块名称:"
|
|
|
+ :label-width="formLabelWidth"
|
|
|
+ :prop="'moduleNames.' + index"
|
|
|
+ :rules="[
|
|
|
+ { required: true, message: '请输入模块名称', trigger: 'blur' },
|
|
|
+ { min: 1, max: 20, message: '模块名称过长', trigger: 'blur' }
|
|
|
+ ]"
|
|
|
+ >
|
|
|
+ <el-col :span="11">
|
|
|
+ <el-input v-model="moduleForm.moduleNames[index]" autocomplete="off" placeholder="不超过20个字符" />
|
|
|
+ </el-col>
|
|
|
+ <el-col v-show="index === moduleForm.moduleNames.length-1" :span="2" :offset="1">
|
|
|
+ <i class="el-icon-circle-plus-outline" @click="addModuleForm()" />
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-if="curcentModule === 'edit'">
|
|
|
+ <el-form-item label="父模块:" :label-width="formLabelWidth">
|
|
|
+ <el-col :span="11">{{ curcentParent }}</el-col>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="模块名称:" :label-width="formLabelWidth">
|
|
|
+ <el-col :span="11">
|
|
|
+ <el-input v-model="moduleForm.moduleNames[0]" autocomplete="off" placeholder="不超过20个字符" />
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <el-col v-if="curcentModule === 'delete'" :span="11">
|
|
|
+ 是否要删除模块:<span style="color: #E6A23C">{{ moduleForm.moduleNames[0] }}</span>
|
|
|
+ </el-col>
|
|
|
+ </el-form>
|
|
|
+ </normal-dialog>
|
|
|
</el-container>
|
|
|
</div>
|
|
|
</section>
|
|
@@ -176,7 +227,7 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
|
|
|
-import { teamCreateTeam, memberQueryMemberInfoByIDAPorName, teamQueryTeamInfoList, configShowTeamAndMemberEnum, teamIsTeamNameRepetition, teamQueryTeamInfo, teamModifyTeam, getBizList, verifyIsAdmin, addBiz, updateBiz, deleteBiz } from '@/api/configure'
|
|
|
+import { teamCreateTeam, memberQueryMemberInfoByIDAPorName, teamQueryTeamInfoList, configShowTeamAndMemberEnum, teamIsTeamNameRepetition, teamQueryTeamInfo, teamModifyTeam, getBizList, verifyIsAdmin, addBiz, updateBiz, deleteBiz, queryBizModuleList, addModule, updateBizModule, deleteBizModule } from '@/api/configure'
|
|
|
import normalDialog from '@/components/dialog/normalDialog'
|
|
|
export default {
|
|
|
name: 'PersonalWorkbench',
|
|
@@ -233,23 +284,13 @@ export default {
|
|
|
{ type: 'number', message: 'id必须为数字值' }
|
|
|
]
|
|
|
},
|
|
|
- tableData1: [{
|
|
|
- id: 3,
|
|
|
- date: '2016-05-01',
|
|
|
- name: '王小虎',
|
|
|
- address: '上海市普陀区金沙江路 1519 弄',
|
|
|
- children: [{
|
|
|
- id: 31,
|
|
|
- date: '2016-05-01',
|
|
|
- name: '王小虎',
|
|
|
- address: '上海市普陀区金沙江路 1519 弄'
|
|
|
- }, {
|
|
|
- id: 32,
|
|
|
- date: '2016-05-01',
|
|
|
- name: '王小虎',
|
|
|
- address: '上海市普陀区金沙江路 1519 弄'
|
|
|
- }]
|
|
|
- }]
|
|
|
+ moduleData: [], // 模块数据
|
|
|
+ moduleDialog: false, // 模块操作对话框
|
|
|
+ moduleTitle: '', // 模块对话框title
|
|
|
+ curcentModule: '', // 当前模块类型
|
|
|
+ curcentParent: '', // 当前模块父模块
|
|
|
+ curcentParentId: '', // 当前模块父模块ID
|
|
|
+ moduleForm: { bizId: null, moduleNames: [null], parentId: null, id: null } // 添加模块form
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -454,6 +495,7 @@ export default {
|
|
|
return { id: item.code, label: item.name }
|
|
|
})
|
|
|
this.curcentTreeData = this.treeData[0]
|
|
|
+ this.getQueryBizModuleList(this.curcentTreeData.id)
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.tree.setCurrentKey(this.treeData[0].id)
|
|
|
})
|
|
@@ -484,8 +526,7 @@ export default {
|
|
|
return false
|
|
|
}
|
|
|
})
|
|
|
- }
|
|
|
- if (this.curcentDialog === 'edit') {
|
|
|
+ } else if (this.curcentDialog === 'edit') {
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|
|
|
this.editNodeTree(this.nodeForm)
|
|
@@ -494,8 +535,7 @@ export default {
|
|
|
return false
|
|
|
}
|
|
|
})
|
|
|
- }
|
|
|
- if (this.curcentDialog === 'delete') {
|
|
|
+ } else if (this.curcentDialog === 'delete') {
|
|
|
this.deteleNodeTree(this.nodeForm)
|
|
|
}
|
|
|
},
|
|
@@ -530,17 +570,114 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
handleNodeClick(data) { // 选择业务线
|
|
|
- console.log(data)
|
|
|
this.curcentTreeData = {
|
|
|
id: data.id,
|
|
|
label: data.label
|
|
|
}
|
|
|
+ this.getQueryBizModuleList(this.curcentTreeData.id)
|
|
|
},
|
|
|
- handleEdit() {
|
|
|
-
|
|
|
+ async getQueryBizModuleList(bizId) { // 获取结构化模块列表
|
|
|
+ const res = await queryBizModuleList(bizId)
|
|
|
+ this.moduleData = res.data
|
|
|
},
|
|
|
- handleDelete() {
|
|
|
-
|
|
|
+ tableRowhidden(row, index) { // 隐藏处理
|
|
|
+ if (row.row.isDelete === 1) {
|
|
|
+ return 'hidden-row'
|
|
|
+ }
|
|
|
+ return ''
|
|
|
+ },
|
|
|
+ handlerModule(type, data, index) { // 模块处理
|
|
|
+ console.log(data)
|
|
|
+ this.moduleDialog = true
|
|
|
+ this.moduleTitle = '新增模块'
|
|
|
+ this.curcentModule = type
|
|
|
+ this.moduleForm = { bizId: null, moduleNames: [null], parentId: -1, id: null }// 初始化
|
|
|
+ this.curcentParent = '无'
|
|
|
+ if (data && type === 'add') {
|
|
|
+ this.curcentParent = data.moduleName
|
|
|
+ this.moduleForm.parentId = data.id
|
|
|
+ } else if (data && type === 'edit') {
|
|
|
+ this.moduleForm.id = data.id
|
|
|
+ this.curcentParent = data.parentId === -1 ? '无' : data.parentModuleName
|
|
|
+ this.moduleForm.parentId = data.parentId
|
|
|
+ this.moduleForm.moduleNames[0] = data.moduleName
|
|
|
+ } else if (data && type === 'delete') {
|
|
|
+ this.moduleForm.id = data.id
|
|
|
+ this.moduleForm.moduleNames[0] = data.moduleName
|
|
|
+ }
|
|
|
+ },
|
|
|
+ confirmModule(formName) { // 模块操作确认
|
|
|
+ if (this.curcentModule === 'add') {
|
|
|
+ this.$refs[formName].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.addModule(this.moduleForm)
|
|
|
+ } else {
|
|
|
+ this.$message({ message: '填写格式不正确', type: 'error' })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (this.curcentModule === 'edit') {
|
|
|
+ this.$refs[formName].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.updataModule(this.moduleForm)
|
|
|
+ } else {
|
|
|
+ this.$message({ message: '填写格式不正确', type: 'error' })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (this.curcentModule === 'delete') {
|
|
|
+ this.deleteModule(this.moduleForm)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ addModuleForm() {
|
|
|
+ if (this.moduleForm.moduleNames.length <= 4) {
|
|
|
+ this.moduleForm.moduleNames.push(null)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async addModule(moduleForm) { // 添加模块
|
|
|
+ const form = {
|
|
|
+ bizId: this.curcentTreeData.id,
|
|
|
+ moduleNames: moduleForm.moduleNames,
|
|
|
+ parentId: moduleForm.parentId || -1
|
|
|
+ }
|
|
|
+ const res = await addModule(form)
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message({ message: '添加成功', type: 'success' })
|
|
|
+ this.getQueryBizModuleList(this.curcentTreeData.id)// 重新获取模块列表
|
|
|
+ this.moduleDialog = false
|
|
|
+ } else {
|
|
|
+ this.$message({ message: res.msg, type: 'error' })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async updataModule(moduleForm) { // 更新模块
|
|
|
+ const form = {
|
|
|
+ id: moduleForm.id,
|
|
|
+ bizId: this.curcentTreeData.id,
|
|
|
+ moduleName: moduleForm.moduleNames[0],
|
|
|
+ parentId: moduleForm.parentId || -1
|
|
|
+ }
|
|
|
+ const res = await updateBizModule(form)
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message({ message: '更新成功', type: 'success' })
|
|
|
+ this.getQueryBizModuleList(this.curcentTreeData.id)// 重新获取模块列表
|
|
|
+ this.moduleDialog = false
|
|
|
+ } else {
|
|
|
+ this.$message({ message: res.msg, type: 'error' })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async deleteModule(moduleForm) { // 删除模块
|
|
|
+ const form = {
|
|
|
+ id: moduleForm.id
|
|
|
+ }
|
|
|
+ const res = await deleteBizModule(form)
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message({ message: '删除成功', type: 'success' })
|
|
|
+ this.moduleData = []// 初始化
|
|
|
+ this.getQueryBizModuleList(this.curcentTreeData.id)// 重新获取模块列表
|
|
|
+ this.moduleDialog = false
|
|
|
+ } else {
|
|
|
+ this.$message({ message: res.msg, type: 'error' })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -572,6 +709,7 @@ export default {
|
|
|
width: 98%;
|
|
|
overflow: auto;
|
|
|
border-radius:4px;
|
|
|
+ background-color: white;
|
|
|
.tab-line {
|
|
|
width: 100%;
|
|
|
display: inline-block;
|
|
@@ -610,6 +748,10 @@ export default {
|
|
|
width: 82.7%;
|
|
|
margin: 0 0 1.5% 1.5%;
|
|
|
flex: 0 1 auto !important;
|
|
|
+ i {
|
|
|
+ margin-left: 5%;
|
|
|
+ color: rgb(64, 158, 255);
|
|
|
+ }
|
|
|
.table-main{
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
@@ -629,6 +771,10 @@ export default {
|
|
|
align-items: center;
|
|
|
}
|
|
|
}
|
|
|
+ .el-table .hidden-row {
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+
|
|
|
.el-popover {
|
|
|
min-width: 100px !important;
|
|
|
}
|