| | |
| | | <template slot="menuLeft"> |
| | | <!-- <el-button icon="el-icon-search" size="small" type="primary" @click="handleStatus">查 询 |
| | | </el-button> --> |
| | | <el-button icon="el-icon-delete" size="small" type="danger" @click="handleDeleteByIds">删 除 |
| | | <el-button icon="el-icon-delete" size="small" type="danger" @click="handleDeleteByIds" v-if="this.permission.systemInfo.systemInfo_remove">删 除 |
| | | </el-button> |
| | | </template> |
| | | <template slot="search" slot-scope="{row,size}"> |
| | |
| | | :size="size" clearable style="width:300px;margin-left: 10px;" |
| | | @clear="handleClear" @keyup.enter.native="handleEnter"></el-input> |
| | | </template> |
| | | <template #menu="{row,index,size}"> |
| | | <template #menu="{row,index,size}" v-if="this.permission.systemInfo.systemInfo_empower"> |
| | | <el-button icon="el-icon-menu" size="small" type="text" @click="classifyHandler(row)">分类授权</el-button> |
| | | |
| | | </template> |
| | | |
| | | |
| | | </avue-crud> |
| | | <el-dialog :visible.sync="dialogVisible" append-to-body class="avue-dialog avue-dialog--top" title="分类授权" |
| | | top="-50px"> |
| | |
| | | sysInfoTree, |
| | | batchAddSave |
| | | } from '@/api/integration/sysInfo.js' |
| | | |
| | | import {mapGetters} from "vuex"; |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | search: {}, |
| | | delIds: [], |
| | | data: [], |
| | | option: { |
| | | height: "auto", |
| | | tip: false, |
| | | border: true, |
| | | align: 'center', |
| | | menuAlign: 'center', |
| | | index: true, |
| | | searchMenuSpan: 8, |
| | | searchBtn: false, |
| | | emptyBtn: false, |
| | | columnBtn: false, |
| | | defaultSort: { |
| | | prop: 'id,name', |
| | | order: 'descending' |
| | | }, |
| | | selection: true, |
| | | column: [ |
| | | { |
| | | label: '系统编号', |
| | | prop: 'id', |
| | | sortable: true, |
| | | rules: [{ |
| | | required: true, |
| | | message: '系统编号不能为空', |
| | | trigger: 'blur' |
| | | }], |
| | | // maxlength: 30, //字数限制 |
| | | }, { |
| | | label: '系统名称', |
| | | prop: 'name', |
| | | sortable: true, |
| | | rules: [{ |
| | | required: true, |
| | | message: '系统名称不能为空', |
| | | trigger: 'blur' |
| | | }], |
| | | // maxlength: 30, //字数限制 |
| | | }, |
| | | { |
| | | label: '系统描述', |
| | | prop: 'description', |
| | | type: 'textarea' |
| | | } |
| | | ] |
| | | }, |
| | | |
| | | } |
| | | }, |
| | | created() { |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["permission"]), |
| | | option(){ |
| | | return{ |
| | | height: "auto", |
| | | tip: false, |
| | | border: true, |
| | | align: 'center', |
| | | menuAlign: 'center', |
| | | index: true, |
| | | searchMenuSpan: 8, |
| | | addBtn:this.permission.systemInfo.systemInfo_add, |
| | | editBtn:this.permission.systemInfo.systemInfo_edit, |
| | | delBtn:this.permission.systemInfo.systemInfo_remove, |
| | | searchBtn: false, |
| | | emptyBtn: false, |
| | | columnBtn: false, |
| | | defaultSort: { |
| | | prop: 'id,name', |
| | | order: 'descending' |
| | | }, |
| | | selection: true, |
| | | column: [ |
| | | { |
| | | label: '系统编号', |
| | | prop: 'id', |
| | | sortable: true, |
| | | rules: [{ |
| | | required: true, |
| | | message: '系统编号不能为空', |
| | | trigger: 'blur' |
| | | }], |
| | | // maxlength: 30, //字数限制 |
| | | }, { |
| | | label: '系统名称', |
| | | prop: 'name', |
| | | sortable: true, |
| | | rules: [{ |
| | | required: true, |
| | | message: '系统名称不能为空', |
| | | trigger: 'blur' |
| | | }], |
| | | // maxlength: 30, //字数限制 |
| | | }, |
| | | { |
| | | label: '系统描述', |
| | | prop: 'description', |
| | | type: 'textarea' |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | //重置 |
| | |
| | | if (checked) { |
| | | this.addAllChildren(row.children); |
| | | this.addToParentList(row); |
| | | // 勾选行时,将当前行以及其所有子节点添加到ParentList中 |
| | | // 勾选行时将所有节点添加到ParentList中 |
| | | } else { |
| | | this.removeAllChildren(row.children); |
| | | this.removeFromParentList(row); |
| | | // 取消勾选行时,将当前行以及其所有子节点从ParentList中移除 |
| | | // 取消勾选将所有节点添加从ParentList中移除 |
| | | } |
| | | |
| | | // console.table(this.ParentList); |
| | | }, |
| | | //子节点添加 |
| | | addAllChildren(children) { |
| | | for (let child of children) { |
| | | this.addToParentList(child); |
| | | // 将子节点添加到 ParentList 中 |
| | | if (child.children && child.children.length > 0) { |
| | | this.addAllChildren(child.children); |
| | | // 递归调用继续添加子节点的子节点 |
| | | } |
| | | } |
| | | }, |
| | | //子节点移除 |
| | | removeAllChildren(children) { |
| | | for (let child of children) { |
| | | this.removeFromParentList(child); |
| | | // 将子节点从 ParentList 中移除 |
| | | if (child.children && child.children.length > 0) { |
| | | this.removeAllChildren(child.children); |
| | | // 递归调用继续移除子节点的子节点 |
| | | } |
| | | } |
| | | }, |
| | | //当前父节点添加 |
| | | addToParentList(item) { |
| | | const classifyOid = item.attributes.classifyOid; |
| | | if (!this.isClassifyOidExists(classifyOid)) { |
| | |
| | | classifyOid: classifyOid, |
| | | }; |
| | | this.ParentList.push(record); |
| | | // 将节点添加到ParentList中 |
| | | } |
| | | }, |
| | | //当前父节点移除 |
| | | removeFromParentList(item) { |
| | | const classifyOid = item.attributes.classifyOid; |
| | | if (this.isClassifyOidExists(classifyOid)) { |
| | |
| | | if (index !== -1) { |
| | | this.ParentList.splice(index, 1); |
| | | } |
| | | // 将节点从ParentList中移除 |
| | | } |
| | | }, |
| | | //判重-ParentList |
| | | isClassifyOidExists(classifyOid) { |
| | | return this.ParentList.some(item => item.classifyOid === classifyOid); |
| | | }, |
| | | //查找index位置 |
| | | findIndexByClassifyOid(classifyOid) { |
| | | return this.ParentList.findIndex(item => item.classifyOid === classifyOid); |
| | | }, |
| | |
| | | type: 'success', |
| | | message: '删除成功!' |
| | | }); |
| | | this.getDataList() |
| | | await this.getDataList() |
| | | } |
| | | }) |
| | | }, |