From 02c0fe95de11fe9e692144a9a15b6d96bb991b66 Mon Sep 17 00:00:00 2001 From: lxl <lixuliang_hd@126.com> Date: 星期二, 08 十一月 2022 18:38:33 +0800 Subject: [PATCH] nav --- src/views/datamanage/metadataManage.vue | 1 src/api/api.js | 42 +- src/components/navMenu - 副本.vue | 270 ++++++++++++++++++++ src/assets/lang/zh.js | 2 src/views/Home.vue | 41 +- src/components/navMenu.vue | 210 +++++++-------- src/views/datamanage/domainManage.vue | 182 +++++++++++-- 7 files changed, 552 insertions(+), 196 deletions(-) diff --git a/src/api/api.js b/src/api/api.js index a0b3766..f288228 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -198,7 +198,7 @@ export function queryMenuTree() { return request.get('/perms/selectMenus'); } -// //璇锋眰缂栬緫鑿滃崟鏍忔暟鎹� +//璇锋眰缂栬緫鑿滃崟鏍忔暟鎹� export function queryMenuAll() { return request.get('/menu/selectMenuAll'); } @@ -461,11 +461,11 @@ export function querySitePoint(size, index, name) { return service.get( '/LFServer/SitePoint/Query?pageSize=' + - size + - '&pageIndex=' + - (index - 1) + - '&name=' + - name + size + + '&pageIndex=' + + (index - 1) + + '&name=' + + name ); } //璇锋眰绔欏満鐐规暟閲� @@ -476,11 +476,11 @@ export function queryStationSeries(size, index, name) { return service.get( '/LFServer/StationSeries/Query?pageSize=' + - size + - '&pageIndex=' + - (index - 1) + - '&name=' + - name + size + + '&pageIndex=' + + (index - 1) + + '&name=' + + name ); } //璇锋眰绠¢亾涓績绾挎暟閲� @@ -492,11 +492,11 @@ export function queryMarker(size, index, name) { return service.get( '/LFServer/Marker/Query?pageSize=' + - size + - '&pageIndex=' + - (index - 1) + - '&name=' + - name + size + + '&pageIndex=' + + (index - 1) + + '&name=' + + name ); } //璇锋眰鏍囨々鏁伴噺 @@ -564,10 +564,14 @@ export function getSingleTab(params) { return request.get('domain/selectByPageAndCount', { params: params }); } - +//鏇存柊鍊煎煙鏁版嵁 export function updateDomain(params) { - return service.post('domain/update', params); + return request.post('domain/update', params); } +export function deleteDomain(params) { + return request.get('domain/deletes', { params: params }); +} +//鎻掑叆鍊煎煙鏁版嵁 export function insertDomain(params) { - return service.post('domain/insert', params); + return request.post('domain/insert', params); } \ No newline at end of file diff --git a/src/assets/lang/zh.js b/src/assets/lang/zh.js index 9d46361..2c083b6 100644 --- a/src/assets/lang/zh.js +++ b/src/assets/lang/zh.js @@ -85,7 +85,7 @@ codeDesc: "缂栫爜鎻忚堪", domCode: "缂栫爜", domDesc: "鍊煎煙琛ㄦ弿杩�", - domName: "鍊煎煙琛ㄥ悕", + domName: "鍊煎煙鍚嶇О", level: "灞傜骇", orderid: "搴忓彿", diff --git "a/src/components/navMenu - \345\211\257\346\234\254.vue" "b/src/components/navMenu - \345\211\257\346\234\254.vue" new file mode 100644 index 0000000..15e444d --- /dev/null +++ "b/src/components/navMenu - \345\211\257\346\234\254.vue" @@ -0,0 +1,270 @@ +<template> + <div class="leftMenu"> + <div class="leftTopWrapper"> + <div class="logo"> + <img src="../assets/img/www.terra-it.cn.png" alt="" /> + </div> + <div class="menu"> + <el-menu + active-text-color="#ffd04b" + class="el-menu-vertical-demo" + :default-active="activeIndex" + background-color="#586884" + text-color="#fff" + @select="handleselect" + > + <customElMenu :menuData="menuList"></customElMenu> + </el-menu> + </div> + </div> + <div class="leftBotWrapper"> + <div class="userInfo"> + <img src="../assets/img/user.png" alt="" /> + <span>admin</span> + <span @click="logOut">娉ㄩ攢</span> + + <span @click="switchLang"> 鍒囨崲璇█</span> + </div> + <div class="btnBox"> + <div><img src="../assets/img/leftBtn.png" alt="" /></div> + <div><img src="../assets/img/rightBtn.png" alt="" /></div> + </div> + </div> + </div> +</template> + +<script> +import { logout } from '@/api/api'; +import { removeToken, getToken } from '@/utils/auth'; +import customElMenu from '../components/customElMenu.vue'; +import { queryMenuTree, getPerms } from '../api/api'; + +export default { + name: 'navMenu', + //import寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: { + customElMenu, + }, + data() { + return { + oriData: [], //鍘熷鏍戞暟鎹� + dirData: [], //el鏍戞暟鎹� + newData: [], //鎷栧姩鍚庢暟鎹� + lang: 'zh', + activeIndex: '/', + menuList: [], + editTitle: '', + showPopover: false, + showEditInfoWrapper: false, + showEdit: false, + editMenu: false, + editCatalogue: false, + editUnit: false, + itemdetail: {}, + formLabelWidth: '70px', + }; + }, + mounted() { + this.getUserPerms(); + this.getMenuTree(); + }, + computed: { + // 鎴戜滑浣跨敤璁$畻灞炴�ф潵鑾峰彇鍒板綋鍓嶇偣鍑荤殑鑿滃崟鐨勮矾鐢辫矾寰勶紝鐒跺悗璁剧疆default-active涓殑鍊� + // 浣垮緱鑿滃崟鍦ㄨ浇鍏ユ椂灏辫兘瀵瑰簲楂樹寒 + // activeIndex() { + // const route = this.$route; + // const { meta, path } = route; + // // if set path, the sidebar will highlight the path you set + // // 鍙互鍦ㄨ矾鐢遍厤缃枃浠朵腑璁剧疆鑷畾涔夌殑璺敱璺緞鍒癿eta.activeMenu灞炴�т腑锛屾潵鎺у埗鑿滃崟鑷畾涔夐珮浜樉绀� + // if (meta.activeMenu) { + // return meta.activeMenu; + // } + // return path; + // }, + }, + methods: { + getMenuTree() { + //鑾峰彇鐩綍鏍戞渶澶D锛屾柊寤鸿妭鐐逛娇鐢� + // queryMaxId().then((res) => { + // this.id = res.data; + // }); + // 鑾峰彇鐩綍鏍戞暟鎹� + queryMenuTree().then((res) => { + if (res.code == 200) { + if (res.result.length != 0) { + let menuLists = res.result.filter((value) => { + return value.type == 1; + }); + this.menuList = this.treeData(menuLists); + } else { + alert('鏆傛棤鑿滃崟鏍忔暟鎹�'); + } + } else { + console.log('鎺ュ彛鎶ラ敊'); + } + }); + }, + treeData(source) { + let cloneData = JSON.parse(JSON.stringify(source)); // 瀵规簮鏁版嵁娣卞害鍏嬮殕 + // console.log(cloneData); + if (cloneData.length != 0) { + return cloneData.filter((father) => { + // 寰幆鎵�鏈夐」 + let branchArr = cloneData.filter((child) => father.id == child.pid); // 瀵规瘮ID锛屽垎鍒笂涓嬬骇鑿滃崟锛屽苟杩斿洖鏁版嵁 + branchArr.length > 0 ? (father.children = branchArr) : ''; // 缁欑埗绾ф坊鍔犱竴涓猚hildren灞炴�э紝骞惰祴鍊� + // 灞炰簬鍚屼竴瀵硅薄闂锛屼緥濡傦細浠� a=b銆乧=1 锛岀劧鍚庡啀浠� b.c=c 锛� 閭d箞 a.c=b.c=c=1 锛涘悓鐞嗭紝鍚庣画浠� c.d=2 ,閭d箞 a.c.d 涔熸槸=2锛� + // 鐢辨寰幆澶氭鍚庯紝灏辫兘褰㈡垚鐩稿簲鐨勬爲褰㈡暟鎹粨鏋� + return father.pid == 1; // 杩斿洖涓�绾ц彍鍗� + }); + } else { + alert('鏆傛棤鑿滃崟鏍忔暟鎹�'); + } + }, + logOut() { + this.$confirm('纭鏄惁閫�鍑虹櫥褰�?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning', + }) + .then(async () => { + const data = await logout({ token: getToken() }); + // console.log(data); + if (data.code != 200) { + return this.$message.error('閫�鍑虹櫥褰曞け璐�'); + } + removeToken(); + this.$router.push('/login'); + this.$message({ + message: '閫�鍑虹櫥褰曟垚鍔�', + type: 'success', + }); + }) + .catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑�', + }); + }); + }, + switchLang() { + //褰撳墠en + if (this.lang == 'en') { + //璇█鎹㈡垚zh + this.lang = 'zh'; + //鑿滃崟鎹负zh + this.$store.commit('changeLang', 'zh'); + //i18鎹㈡垚zh + this.$i18n.locale = this.lang; + } + //褰撳墠zh + else { + this.lang = 'en'; + this.$i18n.locale = this.lang; + this.$store.commit('changeLang', 'en'); //浼犻�掔偣鍑荤殑鑺傜偣 + } + }, + handleselect(index, indexPath, e) { + // console.log(e.$attrs.perms); + this.$store.commit('currentPerms', e.$attrs.perms.perms); + if (Window.ws != null) { + Window.ws.close(); + Window.ws.onclose = () => { + console.log('鏈嶅姟鍣ㄥ叧闂�'); + }; + Window.ws = null; + } + + if (index.indexOf('http') != -1) { + this.$router.push('/databaseMonitoring'); + this.$store.commit('getIframe', index); + } else if (isNaN(Number(index))) { + this.$router.push(index); + } + }, + getUserPerms() { + getPerms().then((res) => { + if (res.code == 200) this.$store.commit('getPermsEntity', res.result); + }); + }, + }, + watch: { + $route() { + let str = this.$route.path; + if (str[0] == '/') { + this.activeIndex = str.slice(1); + } + }, + }, + created() { + let str = this.$route.path; + if (str[0] == '/') { + this.activeIndex = str.slice(1); + } + }, +}; +</script> +<style lang="less" scoped> +//@import url(); 寮曞叆鍏叡css绫� +.leftMenu { + // width: 300px; + height: 99%; + // background-color: #bfa; +} +.leftTopWrapper { + width: 100%; + height: 100%; + .logo { + // background-color: rgb(139, 0, 0); + width: 249px; + height: 52px; + img { + width: 100%; + } + } + .menu { + height: 90%; + margin-top: 22px; + overflow: auto; + // background-color: rgb(120, 121, 120); + .el-menu { + height: 100%; + width: 280px; + border-right: none; + /deep/ .el-submenu { + margin-bottom: 10px; + .el-submenu__title { + background-color: transparent !important; + } + } + .faSub { + background-color: #586884; + } + } + } +} +.leftBotWrapper { + width: 258px; + position: absolute; + left: 19px; + bottom: 17px; + display: flex; + justify-content: space-between; + align-items: center; + .userInfo { + // width: 138px; + font-size: 16px; + font-family: Microsoft YaHei; + font-weight: 400; + color: #fcfcfc; + display: flex; + justify-content: space-between; + align-items: center; + cursor: pointer; + } + .btnBox { + width: 65px; + display: flex; + justify-content: space-between; + } +} +</style> diff --git a/src/components/navMenu.vue b/src/components/navMenu.vue index 15e444d..800d365 100644 --- a/src/components/navMenu.vue +++ b/src/components/navMenu.vue @@ -1,23 +1,16 @@ <template> - <div class="leftMenu"> - <div class="leftTopWrapper"> - <div class="logo"> - <img src="../assets/img/www.terra-it.cn.png" alt="" /> - </div> - <div class="menu"> - <el-menu - active-text-color="#ffd04b" - class="el-menu-vertical-demo" - :default-active="activeIndex" - background-color="#586884" - text-color="#fff" - @select="handleselect" - > - <customElMenu :menuData="menuList"></customElMenu> - </el-menu> - </div> + <div class="topMenu"> + <div class="logo"> + <img src="../assets/img/www.terra-it.cn.png" alt="" /> </div> - <div class="leftBotWrapper"> + <div class="rightWrapper"> + <div class="menu"> + <ul> + <li v-for="item in menuList" :key="item.id"> + {{ item.cnName }} + </li> + </ul> + </div> <div class="userInfo"> <img src="../assets/img/user.png" alt="" /> <span>admin</span> @@ -25,22 +18,18 @@ <span @click="switchLang"> 鍒囨崲璇█</span> </div> - <div class="btnBox"> - <div><img src="../assets/img/leftBtn.png" alt="" /></div> - <div><img src="../assets/img/rightBtn.png" alt="" /></div> - </div> </div> </div> </template> <script> -import { logout } from '@/api/api'; -import { removeToken, getToken } from '@/utils/auth'; -import customElMenu from '../components/customElMenu.vue'; -import { queryMenuTree, getPerms } from '../api/api'; +import { logout } from "@/api/api"; +import { removeToken, getToken } from "@/utils/auth"; +import customElMenu from "../components/customElMenu.vue"; +import { queryMenuTree, getPerms } from "../api/api"; export default { - name: 'navMenu', + name: "navMenu", //import寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� components: { customElMenu, @@ -50,10 +39,10 @@ oriData: [], //鍘熷鏍戞暟鎹� dirData: [], //el鏍戞暟鎹� newData: [], //鎷栧姩鍚庢暟鎹� - lang: 'zh', - activeIndex: '/', + lang: "zh", + activeIndex: "/", menuList: [], - editTitle: '', + editTitle: "", showPopover: false, showEditInfoWrapper: false, showEdit: false, @@ -61,7 +50,7 @@ editCatalogue: false, editUnit: false, itemdetail: {}, - formLabelWidth: '70px', + formLabelWidth: "70px", }; }, mounted() { @@ -93,14 +82,15 @@ if (res.code == 200) { if (res.result.length != 0) { let menuLists = res.result.filter((value) => { - return value.type == 1; + return value.pid == 1; }); - this.menuList = this.treeData(menuLists); + // console.log(menuLists); + this.menuList = menuLists; } else { - alert('鏆傛棤鑿滃崟鏍忔暟鎹�'); + alert("鏆傛棤鑿滃崟鏍忔暟鎹�"); } } else { - console.log('鎺ュ彛鎶ラ敊'); + console.log("鎺ュ彛鎶ラ敊"); } }); }, @@ -111,93 +101,93 @@ return cloneData.filter((father) => { // 寰幆鎵�鏈夐」 let branchArr = cloneData.filter((child) => father.id == child.pid); // 瀵规瘮ID锛屽垎鍒笂涓嬬骇鑿滃崟锛屽苟杩斿洖鏁版嵁 - branchArr.length > 0 ? (father.children = branchArr) : ''; // 缁欑埗绾ф坊鍔犱竴涓猚hildren灞炴�э紝骞惰祴鍊� + branchArr.length > 0 ? (father.children = branchArr) : ""; // 缁欑埗绾ф坊鍔犱竴涓猚hildren灞炴�э紝骞惰祴鍊� // 灞炰簬鍚屼竴瀵硅薄闂锛屼緥濡傦細浠� a=b銆乧=1 锛岀劧鍚庡啀浠� b.c=c 锛� 閭d箞 a.c=b.c=c=1 锛涘悓鐞嗭紝鍚庣画浠� c.d=2 ,閭d箞 a.c.d 涔熸槸=2锛� // 鐢辨寰幆澶氭鍚庯紝灏辫兘褰㈡垚鐩稿簲鐨勬爲褰㈡暟鎹粨鏋� return father.pid == 1; // 杩斿洖涓�绾ц彍鍗� }); } else { - alert('鏆傛棤鑿滃崟鏍忔暟鎹�'); + alert("鏆傛棤鑿滃崟鏍忔暟鎹�"); } }, logOut() { - this.$confirm('纭鏄惁閫�鍑虹櫥褰�?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning', + this.$confirm("纭鏄惁閫�鍑虹櫥褰�?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", }) .then(async () => { const data = await logout({ token: getToken() }); // console.log(data); if (data.code != 200) { - return this.$message.error('閫�鍑虹櫥褰曞け璐�'); + return this.$message.error("閫�鍑虹櫥褰曞け璐�"); } removeToken(); - this.$router.push('/login'); + this.$router.push("/login"); this.$message({ - message: '閫�鍑虹櫥褰曟垚鍔�', - type: 'success', + message: "閫�鍑虹櫥褰曟垚鍔�", + type: "success", }); }) .catch(() => { this.$message({ - type: 'info', - message: '宸插彇娑�', + type: "info", + message: "宸插彇娑�", }); }); }, switchLang() { //褰撳墠en - if (this.lang == 'en') { + if (this.lang == "en") { //璇█鎹㈡垚zh - this.lang = 'zh'; + this.lang = "zh"; //鑿滃崟鎹负zh - this.$store.commit('changeLang', 'zh'); + this.$store.commit("changeLang", "zh"); //i18鎹㈡垚zh this.$i18n.locale = this.lang; } //褰撳墠zh else { - this.lang = 'en'; + this.lang = "en"; this.$i18n.locale = this.lang; - this.$store.commit('changeLang', 'en'); //浼犻�掔偣鍑荤殑鑺傜偣 + this.$store.commit("changeLang", "en"); //浼犻�掔偣鍑荤殑鑺傜偣 } }, handleselect(index, indexPath, e) { // console.log(e.$attrs.perms); - this.$store.commit('currentPerms', e.$attrs.perms.perms); + this.$store.commit("currentPerms", e.$attrs.perms.perms); if (Window.ws != null) { Window.ws.close(); Window.ws.onclose = () => { - console.log('鏈嶅姟鍣ㄥ叧闂�'); + console.log("鏈嶅姟鍣ㄥ叧闂�"); }; Window.ws = null; } - if (index.indexOf('http') != -1) { - this.$router.push('/databaseMonitoring'); - this.$store.commit('getIframe', index); + if (index.indexOf("http") != -1) { + this.$router.push("/databaseMonitoring"); + this.$store.commit("getIframe", index); } else if (isNaN(Number(index))) { this.$router.push(index); } }, getUserPerms() { getPerms().then((res) => { - if (res.code == 200) this.$store.commit('getPermsEntity', res.result); + if (res.code == 200) this.$store.commit("getPermsEntity", res.result); }); }, }, watch: { $route() { let str = this.$route.path; - if (str[0] == '/') { + if (str[0] == "/") { this.activeIndex = str.slice(1); } }, }, created() { let str = this.$route.path; - if (str[0] == '/') { + if (str[0] == "/") { this.activeIndex = str.slice(1); } }, @@ -205,66 +195,58 @@ </script> <style lang="less" scoped> //@import url(); 寮曞叆鍏叡css绫� -.leftMenu { - // width: 300px; - height: 99%; - // background-color: #bfa; -} -.leftTopWrapper { +.topMenu { width: 100%; height: 100%; - .logo { - // background-color: rgb(139, 0, 0); - width: 249px; - height: 52px; - img { - width: 100%; - } - } - .menu { - height: 90%; - margin-top: 22px; - overflow: auto; - // background-color: rgb(120, 121, 120); - .el-menu { - height: 100%; - width: 280px; - border-right: none; - /deep/ .el-submenu { - margin-bottom: 10px; - .el-submenu__title { - background-color: transparent !important; - } - } - .faSub { - background-color: #586884; - } - } - } -} -.leftBotWrapper { - width: 258px; - position: absolute; - left: 19px; - bottom: 17px; + background-image: linear-gradient(rgb(34, 33, 33), rgb(27, 31, 78)); display: flex; justify-content: space-between; - align-items: center; - .userInfo { - // width: 138px; - font-size: 16px; - font-family: Microsoft YaHei; - font-weight: 400; - color: #fcfcfc; - display: flex; - justify-content: space-between; - align-items: center; - cursor: pointer; + + .logo { + width: 500px; + height: 100%; + position: relative; + img { + width: 70%; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + margin: auto; + } } - .btnBox { - width: 65px; + .rightWrapper { + width: 70%; + height: 100%; display: flex; - justify-content: space-between; + .menu { + height: 100%; + width: 80%; + background-color: rgb(120, 121, 120); + ul { + display: flex; + justify-content: space-around; + li { + width: 120px; + height: 120px; + background: #bfa; + } + } + } + .userInfo { + background-color: pink; + + // width: 138px; + font-size: 16px; + font-family: Microsoft YaHei; + font-weight: 400; + color: #fcfcfc; + // display: flex; + // justify-content: space-between; + // align-items: center; + // cursor: pointer; + } } } </style> diff --git a/src/views/Home.vue b/src/views/Home.vue index c072e13..be05f22 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -1,17 +1,13 @@ <template> <div class="home"> <el-container> - <el-container> - <el-aside> - <nav-menu></nav-menu> - </el-aside> - <el-main> - <!-- <synthesis class="showsynthesis" v-show="shwomMapview"></synthesis> --> - <router-view /> - </el-main> - </el-container> + <el-header> + <nav-menu></nav-menu> + </el-header> + <el-main> + <router-view /> + </el-main> </el-container> - <!-- <iframe src="http://localhost/LFWeb/test.html" width="100%" height="100%"></iframe> --> </div> </template> @@ -22,35 +18,30 @@ name: "Home", components: { navMenu, - }, data() { return { shwomMapview: true, }; }, - methods: { - - }, + methods: {}, }; </script> <style lang="less"> .home { height: 100vh; position: relative; - background-color: #3b4d6e; - .el-aside { - margin: 26px 0 0 27px; - width: 249px; - // background-color: #bfa; - } .el-container { height: 100%; - } - .el-main { - margin: 0px; - padding: 10px; - background: rgb(61, 76, 112); + .el-header { + padding: 0; + height: 160px !important; + } + .el-main { + margin: 0px; + padding: 10px; + background-color: rgb(53, 53, 57); + } } } </style> diff --git a/src/views/datamanage/domainManage.vue b/src/views/datamanage/domainManage.vue index 47c68ed..f8ba528 100644 --- a/src/views/datamanage/domainManage.vue +++ b/src/views/datamanage/domainManage.vue @@ -2,7 +2,7 @@ <div class="authorityManagement_box"> <My-bread :list="[`${$t('dataManage.dataManage')}`, `鍊煎煙绠$悊`]"></My-bread> <el-divider /> - <div class="contentBox"> + <div class="mainBox"> <div class="leftTree"> <el-tree :data="domainData" @@ -16,7 +16,7 @@ <el-form ref="queryForm" :model="queryForm" :inline="true"> <el-form-item :label="$t('dataManage.vmobj.keyword')" prop="name"> <el-input - v-model="queryForm.name" + v-model="queryForm.code" :placeholder="$t('common.pleaseInput')" /> </el-form-item> @@ -42,9 +42,9 @@ > <el-button v-if="btnStatus.delete" + @click="deleteInfo" type="danger" size="small" - @click="handleDelete" icon="el-icon-delete" >{{ $t("common.delete") }}</el-button > @@ -52,7 +52,14 @@ </el-form> </div> <div class="table_box"> - <el-table :data="tableData" stripe style="width: 100%" height="99%"> + <el-table + :data="tableData" + border + style="width: 100%" + fit + @selection-change="handleSelectionChange" + height="99%" + > <el-table-column type="selection" width="50" /> <el-table-column align="center" @@ -102,20 +109,15 @@ /> <el-table-column min-width="150" :label="$t('common.operate')"> - <template slot-scope="scope"> + <template slot-scope="scope" + ><el-button @click="showDetail(scope.row)" size="small" + >鏌ョ湅</el-button + > <el-button v-if="btnStatus.update" @click="handleEdit(scope.$index, scope.row)" - type="warning" size="small" >{{ $t("common.update") }}</el-button - > - <el-button - v-if="btnStatus.delete" - @click="handleDelete(scope.$index, scope.row)" - type="danger" - size="small" - >{{ $t("common.delete") }}</el-button > </template> </el-table-column> @@ -142,7 +144,7 @@ <el-card class="box-card"> <div slot="header" class="clearfix"> <span>璇︾粏淇℃伅</span> - <div style="float: right; cursor: pointer"> + <div style="float: right; cursor: pointer" @click="closeDetial"> <i class="el-icon-close"></i> </div> </div> @@ -225,7 +227,7 @@ <el-button size="medium" type="primary" - @click="sendEdit()" + @click="sendEdit('editForm')" v-loading.fullscreen.lock="fullscreenLoading" >{{ $t("common.confirm") }}</el-button > @@ -249,8 +251,8 @@ getDomainTabs, getSingleTab, insertDomain, - // deleteDomain, - // updateDomain, + deleteDomain, + updateDomain, } from "../../api/api"; import MyBread from "../../components/MyBread.vue"; export default { @@ -266,7 +268,9 @@ fullscreenLoading: false, itemdetail: {}, editForm: {}, - queryForm: {}, + queryForm: { + code: "", + }, insertform: {}, initialForm: "", @@ -340,16 +344,20 @@ this.domainData[1].children = bsres; }); }, + handleSelectionChange(val) { + this.multipleSelection = val; + }, queryInfo() { - alert("缂哄皯鏌ヨ鏉′欢鎺ュ彛"); - return; - // let searchData = { - // name: this.queryForm.name.trim(), - // pageIndex: this.pageIndex, - // pageSize: this.pageSize, - // }; - XXX(searchData).then((res) => { + let searchData = { + code: this.queryForm.code, + ns: this.listData.ns, + tab: this.listData.tab, + pageIndex: this.listData.pageIndex, + pageSize: this.listData.pageSize, + }; + // console.log(searchData); + getSingleTab(searchData).then((res) => { if (res.code == 200) { this.tableData = res.result; this.count = res.count; @@ -368,6 +376,48 @@ this.$bus.$emit("clearTressLabel", true); this.getAllTabelData(); }, + // 鍒犻櫎澶氭潯 + deleteInfo() { + this.$confirm("纭畾鏄惁鍒犻櫎鎵�閫夊唴瀹�?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + if (this.multipleSelection.length == 0) { + alert("璇烽�夋嫨瑕佸垹闄ょ殑瀵硅薄"); + return; + } else { + var std = []; + for (var i in this.multipleSelection) { + std.push(this.multipleSelection[i].id); + } + deleteDomain({ ids: std.toString() }).then((res) => { + console.log(res); + if (res.code == 200) { + this.$message({ + type: "success", + message: "鍒犻櫎鎴愬姛!", + }); + this.multipleSelection = []; + getSingleTab(this.listData).then((res) => { + setTimeout(() => { + this.tableData = res.result; + this.count = res.count; + this.fullscreenLoading = false; + }, 500); + }); + } else { + this.$message.error("鍒犻櫎澶辫触"); + this.multipleSelection = []; + } + }); + } + }) + .catch(() => { + this.$message("宸插彇娑堝垹闄�"); + }); + }, showAddDialog() { this.behavior = "鏂板鐢ㄦ埛"; this.editForm = {}; @@ -377,21 +427,26 @@ this.editForm = {}; this.$refs[formName].resetFields(); }, - sendAdd() { + sendAdd(formName) { this.$refs[formName].validate((valid) => { if (valid) { - return; - console.log(this.editForm); + // console.log(this.editForm); this.fullscreenLoading = true; insertDomain(this.editForm) .then((res) => { setTimeout(() => { this.fullscreenLoading = false; if (res.code == 200) { - this.getMetaData({ pageIndex: 1, pageSize: 10 }); this.$message({ message: "娣诲姞鎴愬姛", type: "success", + }); + getSingleTab(this.listData).then((res) => { + setTimeout(() => { + this.tableData = res.result; + this.count = res.count; + this.fullscreenLoading = false; + }, 500); }); this.editForm = {}; this.dialogFormVisible = false; @@ -416,20 +471,73 @@ }) .catch((_) => {}); }, + // 鏌ョ湅鐣岄潰 + showDetail(row) { + // console.log(index, row); + this.showinfoBox = true; + this.itemdetail = row; + }, + // 鍏抽棴鏌ョ湅 + closeDetial() { + this.showinfoBox = false; + this.itemdetail = {}; + }, handleEdit(index, row) { this.dialogFormVisible = true; + this.initialForm = JSON.stringify(row); //澶囦唤 this.editForm = row; - this.behavior = "灞炴�т慨鏀�"; + this.behavior = "淇敼淇℃伅"; }, editFromDataClose() { this.dialogFormVisible = false; this.editForm = {}; }, - editFromData() { - // this.editForm = {}; - console.log(this.editForm); + + // 鎻愪氦淇敼 + sendEdit() { + this.$confirm("鏄惁纭畾缂栬緫?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + this.dialogFormVisible = false; + this.fullscreenLoading = true; + updateDomain(this.editForm) + .then((res) => { + if (res.code == 200) { + getSingleTab(this.listData).then((res) => { + setTimeout(() => { + this.tableData = res.result; + this.count = res.count; + this.fullscreenLoading = false; + }, 500); + }); + this.$message({ + message: "淇敼鎴愬姛", + type: "success", + }); + this.editForm = {}; + } else { + alert("淇敼澶辫触锛岃閲嶈瘯锛�"); + this.fullscreenLoading = false; + } + }) + .catch(() => { + alert("淇敼澶辫触锛岃閲嶈瘯锛�"); + this.fullscreenLoading = false; + }); + }) + .catch(() => { + alert("淇敼澶辫触锛岃閲嶈瘯锛�"); + this.fullscreenLoading = false; + }); }, - handleDelete(index, row) {}, + cancelEdit() { + this.$nextTick(() => { + this.editForm = JSON.parse(this.initialForm); + }); + }, handleSizeChange(val) { this.listData.pageSize = val; // console.log(this.listData); @@ -471,7 +579,7 @@ .el-input { width: 300px !important; } - .contentBox { + .mainBox { display: flex; justify-content: space-between; .leftTree { @@ -572,6 +680,8 @@ } .contentBox { margin: 0 aotu 10px; + height: 600px; + overflow: auto; p { // background-color: #bfa; // margin-bottom: 10px; diff --git a/src/views/datamanage/metadataManage.vue b/src/views/datamanage/metadataManage.vue index 1caf54c..afecd65 100644 --- a/src/views/datamanage/metadataManage.vue +++ b/src/views/datamanage/metadataManage.vue @@ -648,7 +648,6 @@ } .infoBox { width: 500px; - border: 1px solid #eee; position: absolute; z-index: 100; -- Gitblit v1.9.3