| | |
| | | <template> |
| | | <el-container> |
| | | <el-container v-loading="createdLoading"> |
| | | <el-aside> |
| | | <basic-container> |
| | | <div style="max-height: calc(100vh - 170px);overflow: auto"> |
| | | <avue-tree :key="refresh" ref="tree" :data="treeData" :option="treeOption" @node-click="nodeClick"> |
| | | <div style="max-height: calc(100vh - 150px);overflow: auto"> |
| | | <avue-tree :key="refresh" node-key="id" ref="tree" :data="treeData" :option="treeOption" @node-click="nodeClick"> |
| | | <span slot-scope="{ node, data }" class="el-tree-node__label"> |
| | | <span style="font-size: 15px"> |
| | | <i class="el-icon-s-promotion"></i> |
| | |
| | | |
| | | <el-main> |
| | | <basic-container> |
| | | <el-form ref="form" :model="form" label-width="85px" style="height: 79vh"> |
| | | <el-form ref="form" :model="form" label-width="85px" style="max-height: calc(100vh - 180px);overflow: auto;"> |
| | | <span v-if="form.childType !== 0"> |
| | | <el-form-item label="模块名:"> |
| | | <el-input v-model="form.name" placeholder="请输入模块名"></el-input> |
| | |
| | | </el-button> |
| | | </div> |
| | | <div v-if="form.childType === 0" class="btnBox"> |
| | | <el-button icon="el-icon-edit" plain size="small" type="primary">修改别名 |
| | | <el-button icon="el-icon-edit" plain size="small" type="primary" @click="updataAliasClickHandler">修改别名 |
| | | </el-button> |
| | | <el-button icon="el-icon-close" plain size="small" type="danger">删除 |
| | | <el-button icon="el-icon-close" plain size="small" type="danger" @click="deleteOperationClickHandler">删除 |
| | | </el-button> |
| | | </div> |
| | | </basic-container> |
| | |
| | | <el-button type="primary" @click="methodsSaveClickHandler">保 存</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <!--导入 --> |
| | | <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" fileName="files" title="导入" |
| | | @updata="resetFormValue"></upload-file> |
| | | </el-container> |
| | | </template> |
| | | |
| | |
| | | updateModel, |
| | | delModule, |
| | | exportFunctionSql, |
| | | addOperationType |
| | | addOperationType, |
| | | exportModule, |
| | | updateAlias, |
| | | delFuncOperation |
| | | } from "@/api/systemModel/mangeModel/api" |
| | | import func from "@/util/func"; |
| | | import basicOption from "@/util/basic-option"; |
| | |
| | | name: "index", |
| | | data() { |
| | | return { |
| | | tipList: [], |
| | | upFileType: ['xls', 'xlsx'], |
| | | fileUrl: 'api/hmSysModConfigController/importModule', |
| | | createdLoading: false, |
| | | lastIndex: null, |
| | | methodsList: [], |
| | | methodsData: [], |
| | |
| | | addStatus: false, |
| | | editStatus: false, |
| | | nodeRow: {}, |
| | | currentClickNode:null, |
| | | form: {}, |
| | | treeData: [], |
| | | treeOption: { |
| | |
| | | }, |
| | | methods: { |
| | | // 树行点击 |
| | | nodeClick(row) { |
| | | console.log(row.childType); |
| | | nodeClick(row,node) { |
| | | this.form = {...row}; |
| | | this.nodeRow = {...row}; |
| | | this.currentClickNode=node; |
| | | this.addStatus = false; |
| | | this.editStatus = false; |
| | | }, |
| | | |
| | | // 新增按钮 |
| | | addClickHandler() { |
| | | this.resetFormValue(); |
| | | // this.resetFormValue(); |
| | | this.defalutName.forEach(key => { |
| | | this.form[key] = null; |
| | | }) |
| | | this.form.isValid = false; |
| | | this.addStatus = true; |
| | | this.editStatus = false; |
| | | }, |
| | | |
| | | // 清空表单绑定值 |
| | | resetFormValue() { |
| | | this.defalutName.forEach(key => { |
| | | this.form[key] = null; |
| | | }) |
| | | this.form.isValid = false; |
| | | this.form = {}; |
| | | this.refresh = Math.random(); // 刷新左侧树 |
| | | }, |
| | | |
| | | // 新增保存按钮 |
| | |
| | | return |
| | | } |
| | | if (this.form.name.length > 128) { |
| | | this.$message.error('模块名长度超过128!'); |
| | | this.$message.error('模块名长度不能超过128!'); |
| | | return |
| | | } |
| | | if (this.form.remark && this.form.remark.length > 255) { |
| | | this.$message.error('描述长度超过255!'); |
| | | this.$message.error('描述长度不能超过255!'); |
| | | return |
| | | } |
| | | if (this.form.resourceDotNet && this.form.resourceDotNet.length > 255) { |
| | | this.$message.error('.NET标识长度不能255!'); |
| | | this.$message.error('.NET标识长度不能超过255!'); |
| | | return |
| | | } |
| | | if (this.form.pathC && this.form.pathC.length > 255) { |
| | | this.$message.error('C/S标识长度不能255!'); |
| | | this.$message.error('C/S标识长度不能超过255!'); |
| | | return |
| | | } |
| | | if (this.form.resourceMobile && this.form.resourceMobile.length > 255) { |
| | | this.$message.error('Mobile标识长度不能255!'); |
| | | this.$message.error('Mobile标识长度不能超过255!'); |
| | | return |
| | | } |
| | | this.form.parentId = this.form.id; |
| | |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.msg); |
| | | this.addStatus = false; |
| | | this.refresh = Math.random(); // 刷新左侧树 |
| | | // this.resetFormValue(); |
| | | this.form.childType = null; |
| | | this.handleRefreshTree('add') |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | // 修改按钮 |
| | | editClickHandler() { |
| | | console.log(this.form); |
| | | this.editStatus = true; |
| | | this.addStatus = false; |
| | | }, |
| | |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.msg); |
| | | this.editStatus = false; |
| | | this.refresh = Math.random(); // 刷新左侧树 |
| | | // this.resetFormValue(); |
| | | this.form.childType = null; |
| | | this.handleRefreshTree('edit') |
| | | } |
| | | }) |
| | | }, |
| | |
| | | type: 'warning' |
| | | }).then(() => { |
| | | delModule(this.form).then(res => { |
| | | console.log(res); |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.msg); |
| | | this.resetFormValue(); |
| | | this.handleRefreshTree('del') |
| | | this.addStatus = false; |
| | | this.editStatus = false; |
| | | this.refresh = Math.random(); // 刷新左侧树 |
| | | } |
| | | }) |
| | | }).catch(() => { |
| | |
| | | exportFunctionSql({isFunction: true}).then(res => { |
| | | func.downloadFileByBlobHandler(res); |
| | | this.$message.success('导出成功'); |
| | | }).catch(err => { |
| | | this.$message.error(err); |
| | | }); |
| | | }, |
| | | |
| | |
| | | } |
| | | }) |
| | | addOperationType(list).then(res => { |
| | | console.log(res) |
| | | if (res.data.code === 200) { |
| | | this.methodsVisble = false; |
| | | this.$message.success(res.data.msg); |
| | | this.refresh = Math.random(); // 刷新左侧树 |
| | | this.resetFormValue(); |
| | | this.form.childType = null; |
| | | this.handleRefreshTree('add') // 刷新左侧树 |
| | | } |
| | | }) |
| | | }, |
| | |
| | | } |
| | | ); |
| | | }, |
| | | |
| | | // 修改别名 |
| | | updataAliasClickHandler() { |
| | | const params = { |
| | | id: this.form.id, |
| | | isValid: this.form.isValid, |
| | | alias: this.form.alias |
| | | } |
| | | updateAlias(params).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.msg); |
| | | this.handleRefreshTree('edit') |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | // 删除模块下关联的操作类型 |
| | | deleteOperationClickHandler() { |
| | | this.$confirm('您确定要删除所选择的数据吗?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | const params = { |
| | | funcId: this.form.funcId, |
| | | operId: this.form.operId |
| | | } |
| | | delFuncOperation(params).then(res => { |
| | | console.log(res); |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.msg); |
| | | this.handleRefreshTree('del'); |
| | | } |
| | | }) |
| | | }).catch(() => { |
| | | this.$message({ |
| | | type: 'info', |
| | | message: '已取消删除' |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | // 导出 |
| | | exportClickHandler() { |
| | | this.createdLoading = true; |
| | | exportModule().then(res => { |
| | | func.downloadFileByBlobHandler(res); |
| | | this.createdLoading = false |
| | | this.$message.success('导出成功'); |
| | | }).catch(err => { |
| | | this.$message.error(err); |
| | | }) |
| | | }, |
| | | |
| | | // 导入 |
| | | upLoadClickHandler() { |
| | | this.$refs.upload.visible = true; |
| | | }, |
| | | handleRefreshTree(type) { |
| | | //type:add\edit\del |
| | | if(type=="del"){ |
| | | this.$refs.tree.remove(this.currentClickNode); |
| | | this.currentClickNode=null; |
| | | this.form={}; |
| | | }else{ |
| | | if (this.currentClickNode) { |
| | | let node = this.currentClickNode.parent; |
| | | node.loaded = false; |
| | | node.expand(); |
| | | this.$refs.tree.setCurrentNode(this.currentClickNode); |
| | | }else { |
| | | this.refresh = Math.random(); // 刷新左侧树 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |