| | |
| | | <template> |
| | | <div class="cataSettings_box"> |
| | | <div class="cataSettings_tree"> |
| | | <My-bread :list="['数据管理', '目录管理']"></My-bread> |
| | | <!-- <el-button class="saveBtn" type="primary" size="mini" @click="sendChange" --> |
| | | <!-- >保存</el-button --> |
| | | <!-- > --> |
| | | <el-divider /> |
| | | <div class="cataTreeBox"> |
| | | <div class="cataLogBox"> |
| | | <My-bread |
| | | :list="[ |
| | | `${$t('dataManage.dataManage')}`, |
| | | `${$t('dataManage.catalogueManage')}`, |
| | | ]" |
| | | ></My-bread> |
| | | <el-divider /> |
| | | <div class="cataLogContent"> |
| | | <div class="cataLog_leftTree"> |
| | | <el-tree |
| | | ref="tree" |
| | | :props="defaultProps" |
| | |
| | | </span> |
| | | </el-tree> |
| | | </div> |
| | | </div> |
| | | <div class="itemSettings"> |
| | | <div class="title_box"> |
| | | <h4>详细信息</h4> |
| | | </div> |
| | | <div class="form_box"> |
| | | <div class="cataLog_rightContent"> |
| | | <el-breadcrumb separator="/"> |
| | | <el-breadcrumb-item :to="{ path: '/' }">{{ |
| | | $t('dataManage.dictionaryManageObj.particulars') |
| | | }}</el-breadcrumb-item> |
| | | </el-breadcrumb> |
| | | <el-divider /> |
| | | <el-form :model="itemdetail" ref="itemdetail" :rules="rules"> |
| | | <!-- <el-form-item label="目录编码" :label-width="formLabelWidth"> |
| | | <el-input v-model="itemdetail.id" disabled /> |
| | | </el-form-item> --> |
| | | <el-form-item |
| | | prop="name" |
| | | label="目录名称" |
| | | :label="$t('dataManage.dataUpObj.directoryName')" |
| | | :label-width="formLabelWidth" |
| | | > |
| | | <el-input v-model="itemdetail.name" /> |
| | | </el-form-item> |
| | | <el-form-item label="目录说明" :label-width="formLabelWidth"> |
| | | <el-form-item |
| | | :label="$t('dataManage.dataUpObj.catalogDescription')" |
| | | :label-width="formLabelWidth" |
| | | > |
| | | <el-input |
| | | v-model="itemdetail.descr" |
| | | type="textarea" |
| | |
| | | style="height: 100%; overflow: auto" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="目录备注" :label-width="formLabelWidth"> |
| | | <el-form-item |
| | | :label="$t('dataManage.dataUpObj.catalogRemarks')" |
| | | :label-width="formLabelWidth" |
| | | > |
| | | <el-input v-model="itemdetail.bak" type="textarea" resize="none" /> |
| | | </el-form-item> |
| | | <div class="btnBox"> |
| | | <el-button type="primary" @click="updCata('itemdetail')" |
| | | >保存</el-button |
| | | > |
| | | <el-button type="primary" @click="reset('itemdetail')" |
| | | >取消</el-button |
| | | > |
| | | <el-button class="primary" @click="updCata('itemdetail')">{{ |
| | | $t('common.preservation') |
| | | }}</el-button> |
| | | <el-button type="info" @click="reset">{{ |
| | | $t('common.cancel') |
| | | }}</el-button> |
| | | </div> |
| | | </el-form> |
| | | </div> |
| | | </div> |
| | | ' |
| | | <!-- <div class="cataSettings_tree"> --> |
| | | |
| | | <el-dialog title="新增子目录" :visible.sync="dialogFormVisible"> |
| | | <!-- <div class="cataTreeBox"> |
| | | |
| | | </div> --> |
| | | <!-- </div> --> |
| | | <!-- <div class="itemSettings"> --> |
| | | <!-- <div class="title_box"> |
| | | <h4>详细信息</h4> |
| | | </div> --> |
| | | <!-- <div class="form_box"> |
| | | |
| | | </div> --> |
| | | <!-- </div> --> |
| | | <el-dialog |
| | | :title="$t('dataManage.dataUpObj.newDirectory')" |
| | | :visible.sync="dialogFormVisible" |
| | | :before-close="handleClose" |
| | | > |
| | | <el-form :model="ruleForm" ref="ruleForm" :rules="rules"> |
| | | <el-form-item |
| | | label="目录名称" |
| | | :label="$t('dataManage.dataUpObj.directoryName')" |
| | | prop="name" |
| | | :label-width="formLabelWidth" |
| | | > |
| | | <el-input v-model="ruleForm.name" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="目录说明" :label-width="formLabelWidth"> |
| | | <el-form-item |
| | | :label="$t('dataManage.dataUpObj.catalogDescription')" |
| | | :label-width="formLabelWidth" |
| | | > |
| | | <el-input v-model="ruleForm.descr" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="目录备注" :label-width="formLabelWidth"> |
| | | <el-form-item |
| | | :label="$t('dataManage.dataUpObj.catalogRemarks')" |
| | | :label-width="formLabelWidth" |
| | | > |
| | | <el-input v-model="ruleForm.bak" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="resetForm('ruleForm')">取消</el-button> |
| | | <el-button @click="resetForm('ruleForm')">{{ |
| | | $t('common.cancel') |
| | | }}</el-button> |
| | | <el-button |
| | | type="primary" |
| | | class="primary" |
| | | @click="submitForm('ruleForm')" |
| | | v-loading.fullscreen.lock="fullscreenLoading" |
| | | >提交</el-button |
| | | >{{ $t('common.preservation') }}</el-button |
| | | > |
| | | </div> |
| | | </el-dialog> |
| | |
| | | updateDirTrees, |
| | | insertDir, |
| | | deleteDir, |
| | | } from "../../api/api"; |
| | | import MyBread from "../../components/MyBread.vue"; |
| | | } from '../../api/api'; |
| | | import MyBread from '../../components/MyBread.vue'; |
| | | export default { |
| | | name: "catalogueManage", |
| | | name: 'catalogueManage', |
| | | components: { |
| | | MyBread, |
| | | }, |
| | | data() { |
| | | let validName = (rule, value, callback) => { |
| | | if (value === "" || value === null || value === undefined) { |
| | | return callback(new Error("目录名称不能为空")); |
| | | if (value === '' || value === null || value === undefined) { |
| | | return callback(new Error('目录名称不能为空')); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | return { |
| | | defaultProps: { |
| | | children: "children", |
| | | label: "name", |
| | | children: 'children', |
| | | label: 'name', |
| | | }, |
| | | fullscreenLoading: false, |
| | | oriData: [], //原始树数据 |
| | |
| | | old_dirDat: [], //el树数据(拖动前) |
| | | newData: [], //拖动后原始数据 |
| | | itemdetail: {}, |
| | | backUpData: "", |
| | | formLabelWidth: "130px", |
| | | delChildID: "", |
| | | backUpData: '', |
| | | formLabelWidth: '150px', |
| | | delChildID: '', |
| | | delChildIDs: [], |
| | | dialogFormVisible: false, |
| | | ruleForm: { |
| | | level: null, |
| | | orderNum: null, |
| | | pid: null, |
| | | name: "", |
| | | descr: "", |
| | | bak: "", |
| | | name: '', |
| | | descr: '', |
| | | bak: '', |
| | | }, |
| | | rules: { |
| | | name: [{ required: true, validator: validName, trigger: "blur" }], |
| | | name: [{ required: true, validator: validName, trigger: 'blur' }], |
| | | }, |
| | | }; |
| | | }, |
| | |
| | | this.newData = res.result; |
| | | this.dirList = this.treeData(res.result); |
| | | } else { |
| | | console.log("接口报错"); |
| | | console.log('接口报错'); |
| | | } |
| | | }); |
| | | }, |
| | | handleClose() { |
| | | this.$confirm('确认关闭?') |
| | | .then((_) => { |
| | | this.resetForm(); |
| | | }) |
| | | .catch((_) => {}); |
| | | }, |
| | | treeData(source) { |
| | | let cloneData = JSON.parse(JSON.stringify(source)); // 对源数据深度克隆 |
| | | return cloneData.filter((father) => { |
| | | // 循环所有项 |
| | | let branchArr = cloneData.filter((child) => father.id == child.pid); // 对比ID,分别上下级菜单,并返回数据 |
| | | branchArr.length > 0 ? (father.children = branchArr) : ""; // 给父级添加一个children属性,并赋值 |
| | | branchArr.length > 0 ? (father.children = branchArr) : ''; // 给父级添加一个children属性,并赋值 |
| | | // 属于同一对象问题,例如:令 a=b、c=1 ,然后再令 b.c=c , 那么 a.c=b.c=c=1 ;同理,后续令 c.d=2 ,那么 a.c.d 也是=2; |
| | | // 由此循环多次后,就能形成相应的树形数据结构 |
| | | return father.pid == 0; // 返回一级菜单 |
| | |
| | | }, |
| | | resetForm(formName) { |
| | | this.dialogFormVisible = false; |
| | | this.ruleForm = {}; |
| | | this.$nextTick(() => { |
| | | this.ruleForm = {}; |
| | | this.$refs[formName].resetFields(); |
| | |
| | | this.fullscreenLoading = false; |
| | | if (res.code == 200) { |
| | | this.$message({ |
| | | message: "添加成功", |
| | | type: "success", |
| | | message: '添加成功', |
| | | type: 'success', |
| | | }); |
| | | this.itemdetail = {}; |
| | | this.ruleForm = {}; |
| | | this.dialogFormVisible = false; |
| | | this.$refs[formName].resetFields(); |
| | | this.getDirTree(); |
| | | } |
| | | }, 500); |
| | | }) |
| | | .catch((res) => { |
| | | this.itemdetail = {}; |
| | | this.$message.error("添加失败"); |
| | | this.$message.error('添加失败'); |
| | | this.fullscreenLoading = false; |
| | | console.log(res); |
| | | }); |
| | |
| | | }); |
| | | }, |
| | | remove(node, data) { |
| | | this.$confirm("此操作将删除该节点, 是否继续?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | this.$confirm('此操作将删除该节点, 是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then(() => { |
| | | //兄弟重新排序 |
| | |
| | | console.log(res); |
| | | if (res[0].code == 200 && res[1].code == 200) { |
| | | this.$message({ |
| | | type: "success", |
| | | message: "删除成功!", |
| | | type: 'success', |
| | | message: '删除成功!', |
| | | }); |
| | | this.itemdetail = {}; |
| | | } else if (res[0].code == 200) { |
| | | this.$message.error("删除成功,位置调整失败"); |
| | | this.$message.error('删除成功,位置调整失败'); |
| | | } else if (res[1].code == 200) { |
| | | this.$message.error("删除失败,位置调整成功"); |
| | | this.$message.error('删除失败,位置调整成功'); |
| | | } else { |
| | | this.$message.error("删除失败"); |
| | | this.$message.error('删除失败'); |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | this.$message.error("删除失败"); |
| | | this.$message.error('删除失败'); |
| | | this.itemdetail = {}; |
| | | }); |
| | | |
| | |
| | | this.delChildIDs = []; |
| | | }) |
| | | .catch(() => { |
| | | this.$message("已取消删除"); |
| | | this.$message('已取消删除'); |
| | | }); |
| | | // this.dialogMessage="是否删除" |
| | | // this.dialogFlag = 1; |
| | |
| | | this.old_dirDat = JSON.parse(JSON.stringify(this.dirList)); //将备份的dir重新赋值 |
| | | }, |
| | | handleDrop(draggingNode, dropNode, dropType, ev) { |
| | | this.$confirm("此操作将保存目录更改, 是否继续?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | this.$confirm('此操作将保存目录更改, 是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then(() => { |
| | | //父节点 |
| | | let data = dropType != "inner" ? dropNode.parent.data : dropNode.data; |
| | | let data = dropType != 'inner' ? dropNode.parent.data : dropNode.data; |
| | | // 父节点中全部子节点 |
| | | let nodeData = |
| | | dropNode.level == 1 && dropType != "inner" ? data : data.children; |
| | | dropNode.level == 1 && dropType != 'inner' ? data : data.children; |
| | | //变更节点 |
| | | nodeData.forEach((item, i) => { |
| | | if (dropType != "inner") { |
| | | if (dropType != 'inner') { |
| | | if (draggingNode.data.pid === dropNode.data.pid) { |
| | | item.pid = item.pid; |
| | | } else { |
| | |
| | | this.sendChange(); |
| | | }) |
| | | .catch(() => { |
| | | this.$message("已取消更改"); |
| | | this.$message('已取消更改'); |
| | | this.dirList = this.old_dirDat; //将备份的dir重新赋值 |
| | | }); |
| | | }, |
| | |
| | | this.getDirTree(); |
| | | return; |
| | | } else { |
| | | alert("调整失败,请重试!"); |
| | | alert('调整失败,请重试!'); |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | alert("修改失败,请重试!"); |
| | | alert('修改失败,请重试!'); |
| | | }); |
| | | }, |
| | | handleNodeClick(data) { |
| | |
| | | }, 500); |
| | | }) |
| | | .catch((res) => { |
| | | alert("修改失败,请重试!"); |
| | | alert('修改失败,请重试!'); |
| | | this.fullscreenLoading = false; |
| | | }); |
| | | } else { |
| | |
| | | }); |
| | | }, |
| | | reset(formName) { |
| | | this.itemdetail = {}; |
| | | this.$refs[formName].resetFields(); |
| | | if (this.backUpData != "") { |
| | | if (this.backUpData != '') { |
| | | this.itemdetail = JSON.parse(this.backUpData); |
| | | } |
| | | }, |
| | |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | .cataSettings_box { |
| | | border-radius: 10px; |
| | | height: 100%; |
| | | padding: 10px; |
| | | box-sizing: border-box; |
| | | display: flex; |
| | | .cataSettings_tree { |
| | | position: relative; |
| | | width: 344px; |
| | | height: 100%; |
| | | background: rgb(240, 242, 245); |
| | | padding: 20px; |
| | | border-radius: 10px; |
| | | box-sizing: border-box; |
| | | overflow: auto; |
| | | .saveBtn { |
| | | position: absolute; |
| | | left: 250px; |
| | | top: 23px; |
| | | .cataLogBox { |
| | | height: 80%; |
| | | width: 97%; |
| | | |
| | | position: absolute; |
| | | .cataLogContent { |
| | | width: 100%; |
| | | height: 92%; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | .cataLog_leftTree { |
| | | width: 15%; |
| | | height: 96%; |
| | | border: 1px solid white; |
| | | border-radius: 5px; |
| | | padding: 1%; |
| | | max-height: 670px; |
| | | overflow-y: auto; |
| | | } |
| | | .cataTreeBox { |
| | | height: 88%; |
| | | width: 100%; |
| | | overflow: auto; |
| | | .el-tree { |
| | | background: transparent; |
| | | font-size: 15px; |
| | | font-family: Microsoft YaHei; |
| | | font-weight: 400; |
| | | color: #000000; |
| | | /deep/ .el-tree-node { |
| | | padding-top: 10px; |
| | | // padding-bottom: 10px; |
| | | } |
| | | /deep/ .el-tree-node:focus > .el-tree-node__content { |
| | | background-color: #b9b9b9; |
| | | } |
| | | /deep/ .el-tree-node__content:hover { |
| | | background-color: rgb(153, 153, 153); |
| | | } |
| | | .btnBox { |
| | | margin: 0 10px 0 5px; |
| | | .el-button + .el-button { |
| | | margin-left: 5px; |
| | | } |
| | | } |
| | | } |
| | | .cataLog_rightContent { |
| | | width: 80%; |
| | | height: 96%; |
| | | border: 1px solid white; |
| | | border-radius: 5px; |
| | | padding: 1%; |
| | | max-height: 670px; |
| | | overflow-y: auto; |
| | | } |
| | | } |
| | | .itemSettings { |
| | | width: calc(100% - 344px); |
| | | border-radius: 10px; |
| | | background: rgb(240, 242, 245); |
| | | margin-left: 10px; |
| | | height: 100%; |
| | | padding: 10px; |
| | | box-sizing: border-box; |
| | | .title_box { |
| | | background: #fff; |
| | | padding: 10px; |
| | | margin-bottom: 24px; |
| | | display: flex; |
| | | border-radius: 10px; |
| | | border: 1px solid rgb(202, 201, 204); |
| | | box-sizing: border-box; |
| | | } |
| | | .form_box { |
| | | border: 1px solid rgb(202, 201, 204); |
| | | border-radius: 10px; |
| | | background: #fff; |
| | | padding-top: 30px; |
| | | box-sizing: border-box; |
| | | width: 100%; |
| | | .el-input, |
| | | /deep/ .el-textarea { |
| | | width: 400px; |
| | | } |
| | | .btnBox { |
| | | margin: 0 270px 20px; |
| | | width: 200px; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | } |
| | | } |
| | | // .cataSettings_tree { |
| | | // position: relative; |
| | | // width: 344px; |
| | | // height: 100%; |
| | | // background: rgb(240, 242, 245); |
| | | // padding: 20px; |
| | | // border-radius: 10px; |
| | | // box-sizing: border-box; |
| | | // overflow: auto; |
| | | // .saveBtn { |
| | | // position: absolute; |
| | | // left: 250px; |
| | | // top: 23px; |
| | | // } |
| | | // .cataTreeBox { |
| | | // height: 88%; |
| | | // width: 100%; |
| | | // overflow: auto; |
| | | // .el-tree { |
| | | // background: transparent; |
| | | // font-size: 15px; |
| | | // font-family: Microsoft YaHei; |
| | | // font-weight: 400; |
| | | // color: #000000; |
| | | // /deep/ .el-tree-node { |
| | | // padding-top: 10px; |
| | | // // padding-bottom: 10px; |
| | | // } |
| | | // /deep/ .el-tree-node:focus > .el-tree-node__content { |
| | | // background-color: #b9b9b9; |
| | | // } |
| | | // /deep/ .el-tree-node__content:hover { |
| | | // background-color: rgb(153, 153, 153); |
| | | // } |
| | | // .btnBox { |
| | | // margin: 0 10px 0 5px; |
| | | // .el-button + .el-button { |
| | | // margin-left: 5px; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // .itemSettings { |
| | | // width: calc(100% - 344px); |
| | | // border-radius: 10px; |
| | | // background: rgb(240, 242, 245); |
| | | // margin-left: 10px; |
| | | // height: 100%; |
| | | // padding: 10px; |
| | | // box-sizing: border-box; |
| | | // .title_box { |
| | | // background: #fff; |
| | | // padding: 10px; |
| | | // margin-bottom: 24px; |
| | | // display: flex; |
| | | // border-radius: 10px; |
| | | // border: 1px solid rgb(202, 201, 204); |
| | | // box-sizing: border-box; |
| | | // } |
| | | // .form_box { |
| | | // border: 1px solid rgb(202, 201, 204); |
| | | // border-radius: 10px; |
| | | // background: #fff; |
| | | // padding-top: 30px; |
| | | // box-sizing: border-box; |
| | | // width: 100%; |
| | | // .el-input, |
| | | // /deep/ .el-textarea { |
| | | // width: 400px; |
| | | // } |
| | | // .btnBox { |
| | | // margin: 0 270px 20px; |
| | | // width: 200px; |
| | | // display: flex; |
| | | // justify-content: space-between; |
| | | // } |
| | | // } |
| | | // } |
| | | // /deep/ .el-dialog__body { |
| | | // padding: 0 30px 0 0; |
| | | // } |
| | | .el-icon-delete-solid { |
| | | color: gray; |
| | | } |
| | | /deep/ .el-dialog__body { |
| | | padding: 0 30px 0 0; |
| | | .el-icon-circle-plus { |
| | | color: gray; |
| | | } |
| | | /deep/.el-form-item__label { |
| | | color: white; |
| | | } |
| | | // 设置输入框的背景色、字体颜色、边框属性设置; |
| | | /deep/.el-input__inner { |
| | | background-color: transparent !important ; |
| | | color: #fff; |
| | | border: 1px solid; |
| | | } |
| | | /deep/ .el-dialog { |
| | | background: #303030; |
| | | } |
| | | /deep/.el-range-editor.is-active, |
| | | .el-range-editor.is-active:hover, |
| | | .el-select .el-input.is-focus .el-input__inner { |
| | | border: 1px solid; |
| | | } |
| | | /deep/.el-dialog__title { |
| | | color: white; |
| | | } |
| | | .primary { |
| | | background: #409eff; |
| | | border: #409eff; |
| | | color: white; |
| | | } |
| | | } |
| | | </style> |