From 3830233baf564fe39d5887ad5fd02207aba91f34 Mon Sep 17 00:00:00 2001
From: lzhe <181968431@qq.com>
Date: 星期日, 14 四月 2024 23:45:58 +0800
Subject: [PATCH] 1
---
src/views/home/widgets/components/about.vue | 3
src/views/home/index.vue | 2
src/views/home/widgets/components/welcome.vue | 3
src/views/console/resource/attach.vue | 264 +++++++++++++++++++++++++++++++++
src/views/login/components/passwordForm.vue | 72 +++-----
src/layout/components/NavMenu.vue | 5
src/views/home/widgets/components/ver.vue | 128 +++++++++++++--
src/router/index.js | 1
8 files changed, 411 insertions(+), 67 deletions(-)
diff --git a/src/layout/components/NavMenu.vue b/src/layout/components/NavMenu.vue
index 8d4d083..c1b09ed 100644
--- a/src/layout/components/NavMenu.vue
+++ b/src/layout/components/NavMenu.vue
@@ -13,7 +13,7 @@
</el-menu-item>
<el-sub-menu v-else :index="navMenu.path">
<template #title>
- <el-icon v-if="navMenu.meta&&navMenu.meta.icon"><component :is="navMenu.meta.icon || 'el-icon-menu'"/></el-icon>
+ <!-- <el-icon v-if="navMenu.meta&&navMenu.meta.icon"><component :is="navMenu.meta.icon || 'el-icon-menu'"/></el-icon> -->
<span>{{navMenu.meta.title}}</span>
<span v-if="navMenu.meta.tag" class="menu-tag">{{navMenu.meta.tag}}</span>
</template>
@@ -33,6 +33,9 @@
hasChildren(item) {
return item.children && !item.children.every(item => item.meta.hidden)
}
+ },
+ mounted(){
+
}
}
</script>
diff --git a/src/router/index.js b/src/router/index.js
index d0735c0..f2a6ed3 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -81,7 +81,6 @@
if (to.matched.length == 0) {
router.push(to.fullPath);
}
- console.log(menuRouter,router)
isGetRouter = true;
}
beforeEach(to, from)
diff --git a/src/views/console/resource/attach.vue b/src/views/console/resource/attach.vue
new file mode 100644
index 0000000..fa9a24a
--- /dev/null
+++ b/src/views/console/resource/attach.vue
@@ -0,0 +1,264 @@
+<!--
+ * @Author: lzhe lzhe@example.com
+ * @Date: 2024-03-26 10:28:33
+ * @LastEditors: lzhe lzhe@example.com
+ * @LastEditTime: 2024-04-02 17:48:31
+ * @FilePath: /smart-web/src/views/master/person/main/index.vue
+ * @Description: 杩欐槸榛樿璁剧疆,璇疯缃甡customMade`, 鎵撳紑koroFileHeader鏌ョ湅閰嶇疆 杩涜璁剧疆: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+-->
+<template>
+ <div class="dict-main">
+ <el-form :inline="true" :model="searchData" abel-width="120px">
+ <el-form-item label="瀛楀吀缂栧彿">
+ <el-input v-model="searchData.code" placeholder="瀛楀吀缂栧彿" clearable />
+ </el-form-item>
+ <el-form-item label="瀛楀吀鍚嶇О">
+ <el-input v-model="searchData.dictValue" placeholder="瀛楀吀鍚嶇О" clearable></el-input>
+ </el-form-item>
+ <el-form-item>
+ <el-button type="primary" @click="searchclick">鎼滅储</el-button>
+ <el-button @click="searchClearBtn">娓呯┖</el-button>
+ </el-form-item>
+ </el-form>
+ <div>
+ <div class="dict-Btn">
+ <div class="dict-btn-bottom">
+ <el-button type="primary" @click="addData">+ 鏂板</el-button>
+ <el-button type="danger" plain @click="delData">鍒犻櫎</el-button>
+ </div>
+ </div>
+ <div class="dict-table">
+ <el-table ref="multipleTableRef" :data="tableData" border style="width: 100%" class="multipleTableRef" @selection-change="handleSelectionChange">
+ <el-table-column type="selection" width="55" />
+ <el-table-column prop="code" label="瀛楀吀缂栧彿">
+ <template #default="scope">
+ <el-check-tag type="info" checked @change="table_allocation(scope.row, scope.$index)">{{scope.row.code}}</el-check-tag>
+ </template>
+ </el-table-column>
+ <el-table-column prop="dictValue" label="瀛楀吀鍚嶇О"></el-table-column>
+ <el-table-column prop="sort" label="瀛楀吀鎺掑簭"></el-table-column>
+ <el-table-column prop="isSealed" label="灏佸瓨">
+ <template #default="scope">
+ <div>{{scope.row.isSealed == 0?"鍚�":"鏄�"}}</div>
+ </template>
+ </el-table-column>
+ <el-table-column fixed="right" label="鎿嶄綔">
+ <template #default="scope">
+ <el-button text type="primary" size="small" @click="table_show(scope.row, scope.$index)">鏌ョ湅</el-button>
+ <el-button type="text" size="small" @click="table_edit(scope.row, scope.$index)">缂栬緫</el-button>
+ <el-button text type="primary" size="small" @click="table_del(scope.row, scope.$index)">鍒犻櫎</el-button>
+ <el-button text type="primary" size="small" @click="table_allocation(scope.row, scope.$index)">瀛楀吀閰嶇疆</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <el-pagination
+ style="margin-top: 12px;"
+ @size-change="handleSizeChange"
+ @current-change="handleCurrentChange"
+ :current-page="currentPage4"
+ :page-sizes="[15, 50, 100]"
+ :page-size="15"
+ layout="total, sizes, prev, pager, next, jumper"
+ :total="total">
+ </el-pagination>
+ </div>
+ </div>
+ </div>
+
+</template>
+<script>
+ export default {
+ name: "attach",
+ data(){
+ return {
+ getModalData: [],
+ selection: [],
+ total: 0,
+ searchData: {
+ code: "",
+ dictValue: "",
+ current: "1",
+ size: "15"
+ },
+ dialog: {
+ save: false,
+ allocation: false
+ },
+ leftActive: true,
+ input: '',
+ options: [{
+ value: '閫夐」1',
+ label: '榛勯噾绯�'
+ }],
+ input3: '',
+ tableData: []
+ }
+ },
+ created(){
+
+ },
+ mounted(){
+ this.searchBtn();
+ },
+ components: {
+
+ },
+ methods: {
+ codeClick() {
+
+ },
+ addDictSuccess(addDictForm) {
+ this.searchClearBtn();
+ },
+ searchClearBtn() {
+ this.searchData = {
+ code: "",
+ dictValue: "",
+ current: "1",
+ size: "15"
+ }
+ this.searchBtn();
+ },
+ searchclick() {
+ this.searchData.current = "1";
+ this.searchData.size = "15";
+ this.searchBtn();
+ },
+ searchBtn() {
+ this.$HTTP.get("/api/blade-system/dict/parent-list",this.searchData).then(res=> {
+ if(res.code == 200) {
+ this.tableData = res.data.records;
+ this.total = res.data.total;
+ }
+ })
+ },
+ //瀛楀吀閰嶇疆
+ table_allocation(row) {
+ this.dialog.allocation = true;
+ this.$nextTick(() => {
+ this.$refs.allocationDialog.open('edit').setData(row);
+ })
+ },
+ //鍒犻櫎
+ table_del(row) {
+ var that = this;
+ this.$confirm(`纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?`, '', {
+ type: 'warning'
+ }).then(() => {
+ this.$HTTP.post("/api/blade-system/dict/remove?ids="+row.id).then(res=> {
+ if(res.code == 200) {
+ that.$message.success("鎿嶄綔鎴愬姛");
+ that.searchBtn();
+ }
+ })
+ }).catch(() => {
+
+ })
+ },
+ //娣诲姞
+ addData(){
+ this.dialog.save = true
+ this.$nextTick(() => {
+ this.$refs.saveDialog.open()
+ })
+ },
+ table_edit(row){
+ this.dialog.save = true
+ this.$HTTP.get("/api/blade-system/dict/detail?id="+row.id).then(res=> {
+ if(res.code == 200) {
+ this.dialog.save = true;
+ this.$nextTick(() => {
+ this.$refs.saveDialog.open('edit').setData(res.data);
+ })
+ }
+ })
+ },
+ //鏌ョ湅
+ table_show(row){
+ this.dialog.save = true
+ this.$nextTick(() => {
+ this.$refs.saveDialog.open('show').setData(row)
+ })
+ },
+ handleSelectionChange(selection) {
+ this.selection = selection;
+ },
+ delData() {
+ if(this.selection.length == 0) {
+ this.$message({
+ message: '璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�',
+ type: 'warning'
+ });
+ return;
+ }
+ var selStr = "";
+ this.selection.map(item=> {
+ selStr += item.id + ","
+ })
+ selStr = selStr.replace(/,$/, '');
+ var that = this;
+ this.$HTTP.post("/api/blade-system/dict/remove?ids="+selStr).then(res=> {
+ if(res.code == 200) {
+ that.$message.success("鎿嶄綔鎴愬姛");
+ that.searchclick();
+ }
+ })
+ },
+ changeDepartment() {
+ this.departmentVisible = true;
+ },
+ changeTab(name) {
+ if(name == 1) {
+ this.leftActive = true;
+ }else {
+ this.leftActive = false;
+ }
+ },
+ handleSizeChange(val) {
+ console.log(`姣忛〉 ${val} 鏉);
+ this.searchData.current = "1";
+ this.searchData.size = val;
+ this.searchBtn();
+ },
+ handleCurrentChange(val) {
+ console.log(`褰撳墠椤�: ${val}`);
+ this.searchData.current = val;
+ this.searchBtn();
+ }
+ }
+ }
+</script>
+
+<style scoped>
+ .dict-main {
+ background-color: #fff;
+ margin: 8px;
+ padding: 8px;
+ }
+ .dict-Btn {
+ display: flex;
+ justify-content: space-between;
+ border-bottom: 1px solid #dcdfe6;
+ margin-bottom: 8px;
+ padding-left: 8px;
+ padding-right: 8px;
+ }
+ .searchStatus {
+ margin-right: 6px;
+ width: 200px;
+ }
+ .dict-btn-bottom {
+ padding-left: 8px;
+ padding-right: 8px;
+ margin-bottom: 8px;
+ }
+ .dict-table {
+ padding-left: 8px;
+ padding-right: 8px;
+ margin-bottom: 8px;
+
+ }
+ .multipleTableRef {
+ margin-bottom: 8px;
+ }
+</style>
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index dae58c7..ff6eeb1 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -34,7 +34,7 @@
this.dashboard = this.$TOOL.data.get("USER_INFO").dashboard || '0';
},
mounted(){
-
+
},
methods: {
onMounted(){
diff --git a/src/views/home/widgets/components/about.vue b/src/views/home/widgets/components/about.vue
index 447f7ad..ce6812c 100644
--- a/src/views/home/widgets/components/about.vue
+++ b/src/views/home/widgets/components/about.vue
@@ -20,6 +20,9 @@
<script>
export default {
+ title: "淇℃伅鍗�",
+ icon: "el-icon-setting",
+ description: "鍛樺伐鑱屼綅淇℃伅銆佽处鍙蜂俊鎭�佺郴缁熺増鏈揩閫熸煡鐪�",
data() {
return {
diff --git a/src/views/home/widgets/components/ver.vue b/src/views/home/widgets/components/ver.vue
index dd30852..4283079 100644
--- a/src/views/home/widgets/components/ver.vue
+++ b/src/views/home/widgets/components/ver.vue
@@ -2,7 +2,9 @@
<div>
<el-card shadow="hover" header="蹇嵎鍏ュ彛">
<ul>
- <li><div>浜哄伐-閮ㄩ棬</div></li>
+ <li v-for="(item,index) in titleList">
+ <div @click="goPage(item)">{{item.name}}</div>
+ </li>
<li><div class="addMenu" @click="showDrawer">+ 娣诲姞鑿滃崟</div></li>
</ul>
</el-card>
@@ -10,12 +12,16 @@
<div v-for="(value,key,index) in menuList">
<div class="parent-children-title">{{key}}</div>
<div class="parent-children">
- <span v-for="item in value">
- {{item}}
- <div class="triangle-topright"></div>
- <el-icon class="icon-topright"><Select /></el-icon>
+ <span v-for="(item,index1) in value" @click="addChecked(item,key,index1)" >
+ <div class="parent-name">{{item.name}}</div>
+ <div class="triangle-topright" v-if="item.checked"></div>
+ <el-icon class="icon-topright" v-if="item.checked"><Select /></el-icon>
</span>
</div>
+ </div>
+ <div class="drawer-foot">
+ <el-button @click="closeDrawer">鍙栨秷</el-button>
+ <el-button type="primary" @click="drawerConfirm">纭畾</el-button>
</div>
</el-drawer>
</div>
@@ -28,28 +34,99 @@
icons.push(key)
}
export default {
+ title: "蹇嵎鍏ュ彛",
+ icon: "el-icon-data-line",
+ description: "娣诲姞甯哥敤鑿滃崟鍏ュ彛",
data() {
return {
direction: "rtl",
+ titleList: [],
drawer: false,
- menuList: {}
+ menuList: {},
+ CARD_INFO: [],
+ firstMenuList: [], //瀛樺偍鍒濆鍖栫殑鏁版嵁
+ setCard: [],
+ workid: ""
}
},
components: {...ElementPlusIconsVue},
mounted() {
- var data = this.$TOOL.data.get("MENU");
- var obj = {};
- data.forEach((item,index)=> {
- if(item.name != "宸ヤ綔鍙�") {
- obj[item.name] = this.getLastLevelNames(item.children);
- }
- })
- this.menuList = obj;
+ this.getCard();
},
methods: {
+ drawerConfirm() {
+ var list = [];
+ for(var key in this.menuList) {
+ this.menuList[key].forEach(item=> {
+ if(item.checked) {
+ list.push(item.id);
+ }
+ })
+ }
+ this.setCard.forEach(item=> {
+ if(item.cardKey == "Entrance") {
+ item.textContent = list.join(",");
+ }
+ })
+ var obj = {
+ workbenchId: this.workid,
+ workbenchCardAddVOList: this.setCard
+ }
+ this.$HTTP.post(`/api/blade-system/workbench-card/create-workbench-card`,obj).then(res=> {
+ if(res.code == 200) {
+ this.drawer = false;
+ this.menuList = {};
+ this.getCard(); //閲嶆柊鑾峰彇蹇嵎鑿滃崟
+ }
+ })
+ //console.log(this.setCard,222)
+ },
+ getCard() { //鑾峰彇蹇嵎鑿滃崟
+ this.$HTTP.get(`/api/blade-system/workbench-card/list?workbenchId=${this.workid}`).then(res=> {
+ if(res.code == 200) {
+ this.setCard = res.data;
+ res.data.forEach(item=> {
+ if(item.cardKey == "Entrance") {
+ this.$TOOL.data.set("CARD_INFO", item.textContent);
+ }
+ })
+ this.init(); //鏍规嵁鑾峰彇鐨勫揩鎹疯彍鍗曞拰鑿滃崟纭畾鏈�鍚庝竴绾у拰鍕鹃�夌姸鎬�
+ }
+ })
+ },
+ init() {
+ this.titleList = [];
+ var data = this.$TOOL.data.get("MENU");
+ this.workid = data[0].children[0].id; //璁板綍绗竴涓猚hildren鐨刬d
+ this.CARD_INFO = this.$TOOL.data.get("CARD_INFO").split(",");
+ var obj = {};
+ //鍙栨渶鍚庝竴绾ц彍鍗�
+ data.forEach((item,index)=> {
+ if(item.name != "宸ヤ綔鍙�") {
+ obj[item.name] = this.getLastLevelNames(item.children);
+ }
+ })
+ this.menuList = obj;
+ this.firstMenuList = JSON.parse(JSON.stringify(obj)); //瀛樺偍鍒濆鍖栫殑鏁版嵁
+ // 鑾峰彇title
+ for(var key in this.menuList) {
+ this.menuList[key].forEach(item=> {
+ if(item.checked) {
+ this.titleList.push(item)
+ }
+ })
+ }
+ },
+ addChecked(item,key,index1) {
+ this.menuList[key][index1].checked = !this.menuList[key][index1].checked;
+ },
+ goPage(item) {
+ this.$router.push(item.path);
+ },
getLastLevelNames(tree) {
- const lastLevelNames = [];
-
+ var that = this;
+ const lastLevelNames = [];
+ //,checked: this.$TOOL.data.get("CARD_INFO").split(",").include(item.id)
tree.forEach(item => {
if (item.children) {
// 閫掑綊璋冪敤锛屽鐞嗗瓙鑿滃崟椤�
@@ -58,7 +135,7 @@
lastLevelNames.push(...childLastLevelNames);
} else {
// 褰撳墠椤规病鏈夊瓙鑿滃崟椤癸紝鏄渶鍚庝竴灞傦紝娣诲姞鍏跺悕绉�
- lastLevelNames.push(item.name);
+ lastLevelNames.push({name:item.name,id: item.id,checked: that.CARD_INFO.includes(item.id),path: item.path});
}
});
@@ -67,24 +144,29 @@
showDrawer() {
this.drawer = true;
},
+ closeDrawer() {
+ this.menuList = JSON.parse(JSON.stringify(this.firstMenuList));
+ this.drawer = false;
+ },
handleClose(done) {
- this.$confirm('纭鍏抽棴锛�').then(_ => {
- done();
- }).catch(_ => {});
- }
+ this.menuList = JSON.parse(JSON.stringify(this.firstMenuList));
+ done();
+ }
}
}
</script>
<style scoped>
ul {list-style: none;margin-bottom: 10px;overflow: hidden;}
ul li {float: left;margin-bottom: 8px;}
- ul li div {border: 1px solid #3b8e8e;margin-top: 10px;height: 43px;margin-left: 10px;display: flex;align-items: center;justify-content: center;color: #3b8e8e;padding: 7px 15px;border-radius: 2px;border-radius: 2px;white-space: nowrap;cursor: pointer;}
+ ul li div,.addMenu{border: 1px solid #3b8e8e;margin-top: 10px;height: 43px;margin-left: 10px;display: flex;align-items: center;justify-content: center;color: #3b8e8e;border-radius: 2px;border-radius: 2px;white-space: nowrap;cursor: pointer;min-width: 112px;}
ul li div:hover {background-color: #ebf4f4;}
.addMenu {border: 1px dashed #3b8e8e;}
+ ..addMenu:hover {border: 1px dashed #104E8B;}
.parent-children-title {margin-left: 10px;margin-top: 24px;font-weight: 700;font-size: 14px;text-align: left;color: #333;}
.parent-children {display: flex;flex-direction: row;flex-wrap: wrap;justify-content: flex-start;align-items: flex-start;padding-left: 10px;box-sizing: border-box;}
- .parent-children span {margin-left: 10px;margin-top: 10px;width: 22%;border: 0.5px solid #20B2AA;border-radius: 2px;height: 43px;display: flex;align-items: center;justify-content: center;cursor: pointer;position: relative;}
+ .parent-children span {margin-left: 10px;margin-top: 10px;width: 22%;border: 0.5px solid #20B2AA;border-radius: 2px;height: 43px;display: flex;align-items: center;justify-content: center;cursor: pointer;position: relative;min-width: 112px;}
.parent-children span:hover {border: 1px solid #104E8B;}
.triangle-topright {width: 0;height: 0;border-top: 28px solid #3b8e8e;border-left: 28px solid transparent;position: absolute;right: 0;top: 0;}
.icon-topright {position: absolute;right: 2px;top: 2px;z-index: 2;color: #fff;}
+ .drawer-foot {text-align: right;margin-top: 8px;margin-bottom: 8px;margin-right: 20px;}
</style>
\ No newline at end of file
diff --git a/src/views/home/widgets/components/welcome.vue b/src/views/home/widgets/components/welcome.vue
index 13f8961..1c7fe96 100644
--- a/src/views/home/widgets/components/welcome.vue
+++ b/src/views/home/widgets/components/welcome.vue
@@ -9,6 +9,9 @@
<script>
export default {
+ title: "鍏憡",
+ icon: "el-icon-setting",
+ description: "绯荤粺鍐呴�氱煡銆佸叕鍛婇�氱煡蹇�熸煡鐪�",
data() {
return {
diff --git a/src/views/login/components/passwordForm.vue b/src/views/login/components/passwordForm.vue
index ad2e3ab..a028d51 100644
--- a/src/views/login/components/passwordForm.vue
+++ b/src/views/login/components/passwordForm.vue
@@ -81,6 +81,7 @@
});
}
})
+ //鑾峰彇鑿滃崟
await this.$HTTP.get("/api/blade-system/menu/routes?" + this.$TOOL.qsStringify({"appCode": "CPS"})).then(res=> {
if(res.data.length==0){
this.islogin = false
@@ -118,48 +119,37 @@
});
}
var transformedArray = addComponentToLastLevel(res.data);
- transformedArray[0].path = "/home";
- transformedArray[0].children = [{
- component: "home",
- meta: {title: "宸ヤ綔鍙�", icon: 'el-icon-menu', affix: true},
- name: "宸ヤ綔鍙�",
- path: "/dashboard"
- }]
- // this.$HTTP.get("/api/blade-system/workbench/list?status=1").then(resp=> {
- // if(resp.data.length) {
- // console.log(resp.data,resp.data[0].name,333);
- // resp.data.forEach(item=> {
- // item.component = "home";
- // item.meta = {title: item.nam, icon: 'el-icon-menu', affix: true};
- // item.path = "/dashboard";
- // item.parentId = item.id;
- // })
- // transformedArray[0].path = "/home";
- // transformedArray[0].children = resp.data;
- // }
- // })
- //缁撴潫
- var obj = {
- dashboardGrid: ["welcome", "ver", "time", "progress", "echarts", "about"],
- menu: transformedArray,
- permissions: ["list.add", "list.edit", "list.delete", "user.add", "user.edit", "user.delete"]
- }
- console.log(transformedArray,123)
- // this.$API.system.menu.myMenus.get().then(resp=> {
- // Object.assign({},transformedArray,resp.data.menu);
- // this.$TOOL.data.set("MENU", obj.menu)
- // this.$TOOL.data.set("PERMISSIONS", obj.permissions)
- // this.$TOOL.data.set("DASHBOARDGRID", obj.dashboardGrid)
- // });
- this.$TOOL.data.set("MENU", obj.menu)
- this.$TOOL.data.set("PERMISSIONS", obj.permissions)
- this.$TOOL.data.set("DASHBOARDGRID", obj.dashboardGrid)
+ //鑾峰彇澶氫釜宸ヤ綔鍙�
+ this.$HTTP.get("/api/blade-system/workbench/list?status=1").then(resp=> {
+ if(resp.data.length) {
+ //console.log(resp.data,resp.data[0].name,333);
+ resp.data.forEach((item,index)=> {
+ item.component = "home";
+ item.meta = {title: item.name, icon: 'el-icon-menu', affix: true};
+ item.path = "/dashboard";
+ item.parentId = item.id;
+ })
+ transformedArray[0].path = "/home";
+ transformedArray[0].children = resp.data;
+ var obj = {
+ dashboardGrid: ["welcome", "ver", "time", "progress", "echarts", "about"],
+ menu: transformedArray,
+ permissions: ["list.add", "list.edit", "list.delete", "user.add", "user.edit", "user.delete"]
+ }
+ this.$TOOL.data.set("MENU", obj.menu)
+ this.$TOOL.data.set("PERMISSIONS", obj.permissions)
+ this.$TOOL.data.set("DASHBOARDGRID", obj.dashboardGrid)
+ console.log(transformedArray,222)
+
+ this.$router.replace({
+ path: '/'
+ })
+ this.$message.success("Login Success 鐧诲綍鎴愬姛")
+ this.islogin = false;
+ }
+ })
})
- this.$router.replace({
- path: '/'
- })
- this.$message.success("Login Success 鐧诲綍鎴愬姛")
- this.islogin = false;
+
}
}
}
--
Gitblit v1.9.3