From e87012567c674cd69f7a8f87df7202eac60a8208 Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期二, 11 六月 2024 22:28:14 +0800
Subject: [PATCH] update

---
 src/views/console/system/menu.vue |  106 +++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 78 insertions(+), 28 deletions(-)

diff --git a/src/views/console/system/menu.vue b/src/views/console/system/menu.vue
index f561906..c3abd0c 100644
--- a/src/views/console/system/menu.vue
+++ b/src/views/console/system/menu.vue
@@ -2,13 +2,13 @@
  * @Author: lzhe lzhe@example.com
  * @Date: 2024-03-26 10:28:33
  * @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-03-29 15:50:35
+ * @LastEditTime: 2024-04-07 11:54:15
  * @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="80px">
+		<el-form :inline="true" :model="searchData" label-width="80px">
 			<el-row>
 				<el-col :span="6">
 					<el-form-item label="鑿滃崟鍚嶇О">
@@ -34,7 +34,7 @@
 				</el-col>
 				<el-col :span="6">
 					<el-form-item>
-						<el-button type="primary" @click="searchBtn">鎼滅储</el-button>
+						<el-button type="primary" @click="searchclick">鎼滅储</el-button>
 						<el-button @click="clearSearch">娓呯┖</el-button>
 					</el-form-item>
 				</el-col>
@@ -43,12 +43,12 @@
 		<div>
 			<div class="dict-Btn">
 				<div class="dict-btn-bottom"> 
-					<el-button type="primary" @click="addPerson">+ 鏂板</el-button>
-					<el-button type="danger" plain @click="delPerson">鍒犻櫎</el-button>
+					<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 ref="multipleTableRef" :data="tableData" border style="width: 100%" class="multipleTableRef" @selection-change="handleSelectionChange" row-key="id" lazy :load="tableLoad" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
 					<el-table-column type="selection" width="55" />
 					<el-table-column prop="name" label="鑿滃崟鍚嶇О"></el-table-column>
 					<el-table-column prop="path" label="璺敱鍦板潃"></el-table-column>
@@ -72,24 +72,15 @@
 							<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="addPerson(scope.row, scope.$index)">鏂板瀛愰」</el-button>
+							<el-button text type="primary" size="small" @click="table_edit(scope.row, scope.$index,'fixed')">鏂板瀛愰」</el-button>
 						</template>
 					</el-table-column>
 				</el-table>
-				<el-pagination
-					@size-change="handleSizeChange"
-					@current-change="handleCurrentChange"
-					:current-page="currentPage4"
-					:page-sizes="[100, 200, 300, 400]"
-					:page-size="100"
-					layout="total, sizes, prev, pager, next, jumper"
-					:total="400">
-				</el-pagination>
 			</div>
 		</div>
 	</div>
 	
-	<save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSuccess" @closed="dialog.save=false"></save-dialog>
+	<save-dialog v-if="dialog.save" ref="saveDialog" :applicationList="applicationList" @success="handleSuccess" @closed="dialog.save=false"></save-dialog>
 </template>
 <script>
 	import saveDialog from './addMenu'
@@ -97,12 +88,14 @@
 		name: "allocation",
 		data(){
 			return {
+				selection: [],
 				applicationList: [],
 				searchData: {
 					name: "",
 					code: "",
 					alias: "",
-					belongApplication: ""
+					belongApplication: "",
+					parentId: "0"
 				},
 				dialog: {
 					save: false,
@@ -129,6 +122,18 @@
 			saveDialog
 		},
 		methods: {
+			handleSuccess(formAddMenu) {
+				this.searchData.parentId = formAddMenu.parentId;
+				this.clearSearch();
+			},
+			tableLoad(row,treeNode,resolve) {
+				this.searchData.parentId= row.id;
+				this.$HTTP.get("/api/blade-system/menu/lazy-list",this.searchData).then(res=> {
+					if(res.code == 200) {
+						resolve(res.data);
+					}
+				})
+			},
 			clearSearch() {
 				this.searchData= {
 					name: "",
@@ -145,11 +150,13 @@
 					}
 				})
 			},
+			searchclick() {
+				this.searchData.parentId= "0";
+				this.searchBtn();
+			},
 			searchBtn() {
-				this.searchData.parentId="";
 				this.$HTTP.get("/api/blade-system/menu/lazy-list",this.searchData).then(res=> {
 					if(res.code == 200) {
-						console.log(res.data,111)
 						this.tableData = res.data;
 					}
 				})
@@ -162,18 +169,39 @@
 				})
 			},
 			//鍒犻櫎
-			table_del(row) {},
+			table_del(row) {
+				var that = this;
+				this.$confirm(`纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?`, '', {
+					type: 'warning'
+				}).then(() => {
+					this.$HTTP.post("/api/blade-system/menu/remove?ids="+row.id).then(res=> {
+						if(res.code == 200) {
+							that.$message.success("鎿嶄綔鎴愬姛");
+							that.searchclick();
+						}
+					})
+				}).catch(() => {
+
+				})
+			},
 			//娣诲姞
-			addPerson(){
+			addData(){
 				this.dialog.save = true
 				this.$nextTick(() => {
 					this.$refs.saveDialog.open()
 				})
 			},
-			table_edit(row){
-				this.dialog.save = true
-				this.$nextTick(() => {
-					this.$refs.saveDialog.open('edit').setData(row)
+			table_edit(row,index,fixed){
+				this.$HTTP.get("/api/blade-system/menu/detail?id="+row.id).then(res=> {
+					if(res.code == 200) {
+						this.dialog.save = true;
+						this.$nextTick(() => {
+							if(fixed) {  //鍒ゆ柇鏂板瀛愰」
+								res.data.fixed = "fixed";
+							}
+							this.$refs.saveDialog.open('edit').setData(res.data);
+						})
+					}
 				})
 			},
 			//鏌ョ湅
@@ -183,8 +211,30 @@
 					this.$refs.saveDialog.open('show').setData(row)
 				})
 			},
-			handleSelectionChange() {},
-			delPerson() {},
+			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/menu/remove?ids="+selStr).then(res=> {
+					if(res.code == 200) {
+						that.$message.success("鎿嶄綔鎴愬姛");
+						that.searchclick();
+					}
+				})
+			},
 			changeDepartment() {
 				this.departmentVisible = true;
 			},

--
Gitblit v1.9.3