| | |
| | | topMenuId, |
| | | } |
| | | }); |
| | | |
| | | export const cloneMenuButton = (data) => request({ |
| | | url: '/api/ubcs-system/menu/cloneMenuButton', |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | |
| | | size="small" |
| | | icon="el-icon-connection" |
| | | plain |
| | | @click="cloneButton">ä»å
¶ä»èåå
éæé® |
| | | @click="cloneMenuButton">ä»å
¶ä»èåå
éæé® |
| | | </el-button> |
| | | </template> |
| | | <template slot-scope="scope" slot="menu"> |
| | |
| | | </div> |
| | | </template> |
| | | </avue-crud> |
| | | |
| | | <!-- ä»å
¶ä»èåå
éæé® --> |
| | | <el-dialog title="ä»å
¶ä»èåå
éæé®" |
| | | append-to-body |
| | | :visible.sync="cloneButtonSettingBox" |
| | | width="800px" |
| | | style="height: 116vh; margin-top: -10vh;"> |
| | | <avue-crud |
| | | :option="dialogeOption" |
| | | :table-loading="dialogLoading" |
| | | :data="useRangeData" |
| | | @refresh-change="refreshUseRangeChange"> |
| | | :visible.sync="cloneOtherMenuButtons.cloneButtonSettingBox" |
| | | width="1100px" |
| | | @close="cleanCloneSelections" |
| | | style="height: 110vh; margin-top: -10vh;"> |
| | | <avue-crud :option="cloneOtherMenuButtons.cloneOption" |
| | | :table-loading="cloneOtherMenuButtons.cloneLoading" |
| | | :data="cloneOtherMenuButtons.cloneData" |
| | | ref="cloneCrud" |
| | | @search-change="searchCloneChange" |
| | | @search-reset="searchCloneReset" |
| | | @selection-change="selectionCloneChange" |
| | | @row-click="clickRowCloneChange" |
| | | @refresh-change="refreshCloneChange" |
| | | @on-load="cloneOnLoad" |
| | | @tree-load="treeLoad"> |
| | | <template slot-scope="{row}" slot="source"> |
| | | <div style="text-align:center"> |
| | | <i :class="row.source"/> |
| | | </div> |
| | | </template> |
| | | </avue-crud> |
| | | </el-dialog> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="cloneButtonsToMenu">ä¿ å</el-button> |
| | | <el-button @click="cloneOtherMenuButtons.cloneButtonSettingBox = false">å æ¶</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import {getLazyList, remove, update, add, getMenu} from "@/api/system/menu"; |
| | | import {getLazyList, remove, update, add, getMenu ,cloneMenuButton} from "@/api/system/menu"; |
| | | import {mapGetters} from "vuex"; |
| | | import iconList from "@/config/iconList"; |
| | | import func from "@/util/func"; |
| | |
| | | // ä»å
¶ä»èåå
éæé® |
| | | cloneOtherMenuButtons: { |
| | | cloneButtonSettingBox: false, |
| | | |
| | | selectCloneButtons: [], |
| | | cloneOption: { |
| | | height: "auto", |
| | | menu: false, |
| | | addBtn: false, |
| | | lazy: true, |
| | | tip: false, |
| | | simplePage: true, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | dialogWidth: "60%", |
| | | tree: true, |
| | | border: true, |
| | | index: true, |
| | | selection: true, |
| | | columnBtn: false, |
| | | searchShowBtn: false, |
| | | menuWidth: 300, |
| | | dialogClickModal: false, |
| | | highlightCurrentRow: true, //è¡é䏿¶é«äº® |
| | | column: [ |
| | | { |
| | | label: "èååç§°", |
| | | prop: "name", |
| | | search: true, |
| | | }, |
| | | { |
| | | label: "è·¯ç±å°å", |
| | | prop: "path", |
| | | }, |
| | | { |
| | | label: "ä¸çº§èå", |
| | | prop: "parentId", |
| | | type: "tree", |
| | | hide: true, |
| | | addDisabled: false, |
| | | props: { |
| | | label: "title" |
| | | }, |
| | | }, |
| | | { |
| | | label: "èå徿 ", |
| | | prop: "source", |
| | | type: "icon", |
| | | slot: true, |
| | | iconList: iconList, |
| | | }, |
| | | { |
| | | label: "èåç¼å·", |
| | | prop: "code", |
| | | search: true, |
| | | }, |
| | | { |
| | | label: "èåç±»å", |
| | | prop: "category", |
| | | type: "radio", |
| | | dicData: [ |
| | | { |
| | | label: "èå", |
| | | value: 1 |
| | | }, |
| | | { |
| | | label: "æé®", |
| | | value: 2 |
| | | } |
| | | ], |
| | | }, |
| | | { |
| | | label: "èåå«å", |
| | | prop: "alias", |
| | | search: true, |
| | | }, |
| | | { |
| | | label: "æ°çªå£", |
| | | prop: "isOpen", |
| | | type: "radio", |
| | | dicData: [ |
| | | { |
| | | label: "å¦", |
| | | value: 1 |
| | | }, |
| | | { |
| | | label: "æ¯", |
| | | value: 2 |
| | | } |
| | | ], |
| | | }, |
| | | { |
| | | label: "èåæåº", |
| | | prop: "sort", |
| | | type: "number", |
| | | }, |
| | | { |
| | | label: "è·¯ç±ç¼å", |
| | | prop: "keepAlive", |
| | | type: "switch", |
| | | dicData: [ |
| | | { |
| | | label: "å¦", |
| | | value: "false" |
| | | }, |
| | | { |
| | | label: "æ¯", |
| | | value: "true" |
| | | } |
| | | ], |
| | | }, |
| | | { |
| | | label: "èå夿³¨", |
| | | prop: "remark", |
| | | type: "textarea", |
| | | span: 24, |
| | | minRows: 2, |
| | | } |
| | | ] |
| | | }, |
| | | cloneLoading: false, |
| | | cloneData: [], |
| | | cloneQuery: {}, |
| | | clonePage: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0, |
| | | }, |
| | | } |
| | | }; |
| | | }, |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | |
| | | /** ä»å
¶ä»èåå
éæé® */ |
| | | cloneMenuButton(){ |
| | | if(this.selectionList.length != 1 || this.selectionList[0].category === 2){ |
| | | this.$message({ |
| | | type: "warning", |
| | | message: "è¯·éæ©ä¸æ¡éæé®ç±»åçæ°æ®!" |
| | | }); |
| | | return; |
| | | } |
| | | this.cloneOtherMenuButtons.cloneButtonSettingBox = true; |
| | | }, |
| | | /** å
éæé®å°éä¸çèåä¸ */ |
| | | cloneButtonsToMenu(){ |
| | | if(this.selectionList.length != 1){ |
| | | this.$message({ |
| | | type: "warning", |
| | | message: "è¦å
éæé®çèåä¿¡æ¯å·²ä¸¢å¤±ï¼è¯·éæ°éæ©!" |
| | | }); |
| | | return; |
| | | } |
| | | if(this.cloneOtherMenuButtons.selectCloneButtons.length <= 0){ |
| | | this.$message({ |
| | | type: "warning", |
| | | message: "è¯·éæ©è¦å
éæé®æ°æ®!" |
| | | }); |
| | | return; |
| | | } |
| | | this.$confirm("ç¡®å®å°éä¸çæé®å
éå°ã"+this.selectionList[0].name+"ãèåä¸?", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "info" |
| | | }) |
| | | .then(() => { |
| | | let buttonIds = []; |
| | | let flag = true; |
| | | this.cloneOtherMenuButtons.selectCloneButtons.forEach(function(item) { |
| | | if(item.category != 2){ |
| | | flag = false; |
| | | }else { |
| | | buttonIds.push(item.id); |
| | | } |
| | | }); |
| | | // éæ©äºéæé®ç±»åçæ°æ® |
| | | if(!flag){ |
| | | this.$message({ |
| | | type: "warning", |
| | | message: "åªè½éæ©æé®ç±»åçè¡¨æ ¼è¡!" |
| | | }); |
| | | return; |
| | | } |
| | | // console.log(buttonIds); |
| | | return cloneMenuButton({"menuId":this.selectionList[0].id,"buttonIds": buttonIds}); |
| | | }) |
| | | .then(res => { |
| | | this.$message({ |
| | | type: res.data.success ? "success":"error", |
| | | message: res.data.msg, |
| | | }); |
| | | this.cloneOtherMenuButtons.cloneButtonSettingBox = false; |
| | | // æ°æ®åè°è¿è¡å·æ° |
| | | this.onLoad(this.page); |
| | | }); |
| | | }, |
| | | /** éä¸è¢«å
éçæé®æ¶è§¦å */ |
| | | selectionCloneChange(list) { |
| | | this.cloneOtherMenuButtons.selectCloneButtons = list; |
| | | this.$refs.cloneCrud.setCurrentRow(this.cloneOtherMenuButtons.selectCloneButtons[list.length-1]); |
| | | }, |
| | | clickRowCloneChange(row){ |
| | | this.cloneOtherMenuButtons.selectCloneButtons.push(row); |
| | | this.$refs.cloneCrud.setCurrentRow(row); |
| | | this.$refs.cloneCrud.toggleRowSelection(row); //éä¸å½åè¡ |
| | | }, |
| | | /** å
³éå¯¹è¯æ¡æ¶æ¸
空éä¸çå表 */ |
| | | cleanCloneSelections(){ |
| | | this.cloneOtherMenuButtons.selectCloneButtons = []; |
| | | this.$refs.cloneCrud.toggleSelection(); |
| | | }, |
| | | cloneOnLoad(page, params = {}) { |
| | | this.cloneOtherMenuButtons.cloneLoading = true; |
| | | getLazyList(this.parentId, Object.assign(params, this.cloneOtherMenuButtons.cloneQuery)).then(res => { |
| | | this.cloneOtherMenuButtons.cloneData = res.data.data; |
| | | this.cloneOtherMenuButtons.cloneLoading = false; |
| | | }); |
| | | }, |
| | | searchCloneChange(params, done){ |
| | | this.cloneOtherMenuButtons.cloneQuery = params; |
| | | this.parentId = ''; |
| | | this.cloneOtherMenuButtons.clonePage.currentPage = 1; |
| | | this.cloneOnLoad(this.cloneOtherMenuButtons.clonePage, params); |
| | | done(); |
| | | }, |
| | | searchCloneReset(){ |
| | | this.cloneOtherMenuButtons.cloneQuery = {}; |
| | | this.parentId = 0; |
| | | this.cloneOnLoad(this.cloneOtherMenuButtons.clonePage); |
| | | }, |
| | | refreshCloneChange(){ |
| | | this.onLoad(this.cloneOtherMenuButtons.clonePage, this.cloneOtherMenuButtons.cloneQuery); |
| | | }, |
| | | |
| | | initData() { |
| | | getMenuTree().then(res => { |
| | | const column = this.findObject(this.option.column, "parentId"); |
| | |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id); |
| | | }) |
| | | .then(() => { |
| | | this.$message({ |
| | | type: "success", |
| | | message: "æä½æå!" |
| | | }); |
| | | // æ°æ®åè°è¿è¡å·æ° |
| | | done(row); |
| | | .then(() => { |
| | | return remove(row.id); |
| | | }) |
| | | .then(() => { |
| | | this.$message({ |
| | | type: "success", |
| | | message: "æä½æå!" |
| | | }); |
| | | // æ°æ®åè°è¿è¡å·æ° |
| | | done(row); |
| | | }); |
| | | }, |
| | | handleDelete() { |
| | | if (this.selectionList.length === 0) { |
| | |
| | | message: "æä½æå!" |
| | | }); |
| | | }); |
| | | }, |
| | | /** ä»å
¶ä»èåå
éæé® */ |
| | | cloneButton(){ |
| | | |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | |
| | | proxy: { |
| | | '/api': { |
| | | //æ¬å°æå¡æ¥å£å°å |
| | | // target: 'http://localhost:37000', |
| | | target: 'http://localhost:37000', |
| | | // target: 'http://192.168.1.51:37000', |
| | | // target: 'http://192.168.1.46:37000', |
| | | target: 'http://dev.vci-tech.com:37000', |
| | | // target: 'http://dev.vci-tech.com:37000', |
| | | // target: 'http://192.168.1.51:37000/', |
| | | // target: 'http://192.168.1.104:37000', |
| | | // target: 'http://192.168.1.63:37000', |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.system.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author ludc |
| | | * @date 2023/7/26 12:11 |
| | | */ |
| | | @Data |
| | | public class ButtonCloneVO { |
| | | |
| | | private Long menuId; |
| | | |
| | | private List<String> buttonIds; |
| | | |
| | | } |
| | |
| | | return dataGrid; |
| | | } |
| | | //è¿ä¸ªä¸å¡ç±»åä¸çææå±æ§ |
| | | R<BtmTypeVO> btmTypeVOR = btmTypeClient.getAllAttributeByBtmOid(codeClassifyTemplateDO.getBtmTypeId()); |
| | | R<BtmTypeVO> btmTypeVOR = btmTypeClient.getAllAttributeByBtmId(codeClassifyTemplateDO.getBtmTypeId()); |
| | | if(!btmTypeVOR.isSuccess()){ |
| | | throw new ServiceException("ä¸å¡ç±»åfeignè°ç¨é误ï¼"); |
| | | } |
| | |
| | | import com.vci.ubcs.system.entity.TopMenu; |
| | | import com.vci.ubcs.system.service.IMenuService; |
| | | import com.vci.ubcs.system.service.ITopMenuService; |
| | | import com.vci.ubcs.system.vo.ButtonCloneVO; |
| | | import com.vci.ubcs.system.vo.CheckedTreeVO; |
| | | import com.vci.ubcs.system.vo.GrantTreeVO; |
| | | import com.vci.ubcs.system.vo.MenuVO; |
| | |
| | | } |
| | | return R.data(menuService.authRoutes(user)); |
| | | } |
| | | |
| | | /** |
| | | * å
éå
¶ä»èåä¸æé® |
| | | * @param buttonCloneVO è¦å
éçèåæé®ä¸»é® 被å
éçæé®ä¸»é® |
| | | * @return |
| | | */ |
| | | @PostMapping("/cloneMenuButton") |
| | | public R cloneMenuButton(@RequestBody ButtonCloneVO buttonCloneVO) { |
| | | return menuService.cloneMenuButton(buttonCloneVO.getMenuId(), buttonCloneVO.getButtonIds()); |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | void handleKeepAlive(List<MenuVO> childMenu); |
| | | |
| | | /** |
| | | * å
éå
¶ä»èåä¸æé® |
| | | * @param menuId è¦å
éçèåæé®ä¸»é® |
| | | * @param buttonIds 被å
éçæé®ä¸»é® |
| | | * @return |
| | | */ |
| | | R cloneMenuButton(Long menuId, List<String> buttonIds); |
| | | |
| | | } |
| | |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * å
éå
¶ä»èåä¸æé® |
| | | * @param menuId è¦å
éçèåæé®ä¸»é® |
| | | * @param buttonIds 被å
éçæé®ä¸»é® |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R cloneMenuButton(Long menuId, List<String> buttonIds) { |
| | | if(Func.isEmpty(menuId)){ |
| | | return R.fail("è¦å
éçèå主é®ä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | if(buttonIds.isEmpty() || buttonIds.size() <= 0){ |
| | | return R.fail("被å
éçæé®ä¸»é®ä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | // å
æ ¹æ®ä¸»é®æ¥è¯¢åºæææé®çä¿¡æ¯ |
| | | List<Menu> buttons = this.listByIds(buttonIds); |
| | | List<Menu> newButtons = new ArrayList<>(); |
| | | List<String> addButtonCodes = new ArrayList(); |
| | | buttons.parallelStream().forEach(item->{ |
| | | // 夿æ¯å¦ä¸ºæé®ï¼éæé®ä¸å¤ç |
| | | if(item.getCategory().equals(2)){ |
| | | // æ¹åç¶èç¹ä¿¡æ¯ |
| | | item.setParentId(menuId); |
| | | // å°ä¸»é®èµç©º |
| | | item.setId(null); |
| | | addButtonCodes.add(item.getCode()); |
| | | newButtons.add(item); |
| | | } |
| | | }); |
| | | //æ£éªæ¯å¦éå¤èåå«åï¼åªæ ¡éªåä¸ç¶åç±»èåä¸çç¼å·æ¯å¦éå¤ |
| | | LambdaQueryWrapper<Menu> menuQueryWrapper = Wrappers.<Menu>lambdaQuery() |
| | | .eq(Menu::getParentId,menuId) |
| | | .and(a -> a.in( Menu::getCode, addButtonCodes)); |
| | | Long cnt = baseMapper.selectCount(menuQueryWrapper); |
| | | if (cnt > 0L) { |
| | | return R.fail("该èåä¸å·²åå¨çç¼å·ä¸è¦å
éçæé®ç¼å·åå¨éå¤!"); |
| | | } |
| | | return this.saveBatch(newButtons) ? R.success("æé®å
éæåï¼"):R.fail("æé®å
é失败ï¼"); |
| | | } |
| | | |
| | | } |