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/domainManage.vue | 182 ++++++++++++++++++++++++++++++++++++--------- 1 files changed, 146 insertions(+), 36 deletions(-) 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; -- Gitblit v1.9.3