From 4aac1609c95a097de0e8da843a9ed2f211303d4e Mon Sep 17 00:00:00 2001 From: Surpriseplus <845948745@qq.com> Date: 星期四, 27 十月 2022 14:21:37 +0800 Subject: [PATCH] 黑白名单,系统配置,综合展示权限管理添加 --- src/views/maintenance/blackwhiteList.vue | 323 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 283 insertions(+), 40 deletions(-) diff --git a/src/views/maintenance/blackwhiteList.vue b/src/views/maintenance/blackwhiteList.vue index 05d4183..65e64f6 100644 --- a/src/views/maintenance/blackwhiteList.vue +++ b/src/views/maintenance/blackwhiteList.vue @@ -59,29 +59,42 @@ :placeholder="$t('operatManage.BWL.interceptionNumber')" /> </el-form-item> + <el-form-item> - <el-button @click="onSubmit">{{ - $t("operatManage.BWL.change") + <el-button + ><i class="el-icon-search"></i> {{ + $t('operatManage.BWL.search') + }}</el-button + > + </el-form-item> + <el-form-item> + <el-button + ><i class="el-icon-delete"></i> {{ + $t('operatManage.BWL.reset') + }}</el-button + > + </el-form-item> + <el-form-item> + <el-button v-if="menuStatus.insert" @click="showInsertdialog(1)">{{ + $t('common.append') }}</el-button> </el-form-item> <el-form-item> - <el-button @click="onSubmit" - ><i class="el-icon-search"></i> {{ - $t("operatManage.BWL.search") - }}</el-button - > - </el-form-item> - <el-form-item> - <el-button @click="onSubmit" - ><i class="el-icon-delete"></i> {{ - $t("operatManage.BWL.reset") - }}</el-button - > + <el-button v-if="menuStatus.delete" @click="delBWList">{{ + $t('common.delete') + }}</el-button> </el-form-item> </el-form> </div> <div class="table_box"> - <el-table :data="BTableData" stripe style="width: 100%" height="85%"> + <el-table + :data="BTableData" + stripe + @selection-change="blackSelectionChange" + style="width: 100%" + height="85%" + > + <el-table-column type="selection" width="55" /> <el-table-column align="center" type="index" @@ -101,7 +114,7 @@ :label="$t('operatManage.BWL.description')" /> <el-table-column - prop="createUser" + prop="createName" :label="$t('operatManage.BWL.creator')" /> <el-table-column @@ -110,7 +123,7 @@ :label="$t('operatManage.BWL.creationTime')" /> <el-table-column - prop="updateUser" + prop="updateName" :label="$t('operatManage.BWL.update')" /> <el-table-column @@ -118,6 +131,22 @@ prop="updateTime" :label="$t('operatManage.BWL.UpdateTime')" /> + <el-table-column + v-if="menuStatus.update" + :label="$t('operatManage.tokentoolObj.operation')" + width="320" + align="center" + > + <template slot-scope="scope"> + <el-button + @click="handleEdit(scope.$index, scope.row)" + type="warning" + plain + size="small" + >{{ $t('common.update') }}</el-button + > + </template> + </el-table-column> </el-table> <div style="margin-top: 40px" class="pagination_box"> <el-pagination @@ -161,21 +190,32 @@ <el-form-item> <el-button @click="onSubmit" ><i class="el-icon-search"></i> {{ - $t("operatManage.BWL.search") + $t('operatManage.BWL.search') }}</el-button > </el-form-item> <el-form-item> <el-button @click="onSubmit" ><i class="el-icon-delete"></i> {{ - $t("operatManage.BWL.reset") + $t('operatManage.BWL.reset') }}</el-button > + </el-form-item> + <el-form-item> + <el-button v-if="menuStatus.insert" @click="showInsertdialog(2)">{{ + $t('common.append') + }}</el-button> + </el-form-item> + <el-form-item> + <el-button v-if="menuStatus.delete" @click="delBWList">{{ + $t('common.delete') + }}</el-button> </el-form-item> </el-form> </div> <div class="table_box"> - <el-table :data="WTableData" stripe style="width: 100%" height="85%"> + <el-table :data="WTableData" stripe @selection-change="blackSelectionChange" style="width: 100%" height="85%"> + <el-table-column type="selection" width="55" /> <el-table-column align="center" type="index" @@ -195,7 +235,7 @@ :label="$t('operatManage.BWL.description')" /> <el-table-column - prop="createUser" + prop="createName" :label="$t('operatManage.BWL.creator')" /> <el-table-column @@ -204,7 +244,7 @@ :label="$t('operatManage.BWL.creationTime')" /> <el-table-column - prop="updateUser" + prop="updateName" :label="$t('operatManage.BWL.update')" /> <el-table-column @@ -212,6 +252,23 @@ prop="updateTime" :label="$t('operatManage.BWL.UpdateTime')" /> + <el-table-column + v-if="menuStatus.update" + :label="$t('operatManage.tokentoolObj.operation')" + width="320" + align="center" + > + <template slot-scope="scope"> + <el-button + @click="handleEdit(scope.$index, scope.row)" + type="warning" + plain + size="small" + >{{ $t('common.update') }}</el-button + > + </template> + </el-table-column> + </el-table> </el-table> <div style="margin-top: 40px" class="pagination_box"> <el-pagination @@ -227,12 +284,88 @@ </div></div ></el-tab-pane> </el-tabs> + <el-dialog + :title="$t('common.append')" + style="overflow: hidden" + :visible.sync="InsertFormdialog" + width="30%" + > + <el-form ref="insertform" :model="insertform"> + <el-form-item :label-width="formLabelWidth" label="IP鍦板潃"> + <el-input + v-model="insertform.ip" + :placeholder="$t('common.pleaseInput')" + /> + </el-form-item> + <el-form-item :label-width="formLabelWidth" label="璁块棶娆℃暟"> + <el-input + v-model="insertform.visit" + :placeholder="$t('common.pleaseInput')" + /> + </el-form-item> + <el-form-item :label-width="formLabelWidth" label="鎻忚堪"> + <el-input + v-model="insertform.descr" + :placeholder="$t('common.pleaseInput')" + /> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button @click="insertFromDataClose">{{ + $t('common.close') + }}</el-button> + <el-button @click="insertFromData" type="primary">{{ + $t('common.confirm') + }}</el-button> + </div> + </el-dialog> + <el-dialog + :title="$t('common.update')" + style="overflow: hidden" + :visible.sync="updateFormdialog" + width="30%" + > + <el-form ref="editfrom" :model="editfrom"> + <el-form-item :label-width="formLabelWidth" label="IP鍦板潃"> + <el-input + v-model="editfrom.ip" + :placeholder="$t('common.pleaseInput')" + /> + </el-form-item> + <el-form-item :label-width="formLabelWidth" label="璁块棶娆℃暟"> + <el-input + v-model="editfrom.visit" + :placeholder="$t('common.pleaseInput')" + /> + </el-form-item> + <el-form-item :label-width="formLabelWidth" label="鎻忚堪"> + <el-input + v-model="editfrom.descr" + :placeholder="$t('common.pleaseInput')" + /> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button @click="editFromDataClose">{{ + $t('common.close') + }}</el-button> + <el-button @click="editFromData" type="primary">{{ + $t('common.confirm') + }}</el-button> + </div> + </el-dialog> </div> </template> - - <script> -import MyBread from "../../components/MyBread.vue"; -import { blacklistSelectByPageAndCount } from "../../api/api"; + +<script> +import MyBread from '../../components/MyBread.vue'; +import { + blacklistSelectByPageAndCount, + blacklistAppend, + deletelacklist, + updateblacklist, + blacklistSelectCount, +} from '../../api/api'; export default { //import寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� components: { @@ -241,14 +374,25 @@ data() { return { - activeName: "first", + menuStatus: { + delete: false, + insert: false, + update: false, + }, + updateFormdialog: false, + multipleSelection: [], + formLabelWidth: '100px', + insertform: {}, + editfrom: {}, + InsertFormdialog: false, + activeName: 'first', currentPage: 1, form: { - blackListIP: "", - IPState: "", - interceptionCycle: "", - unit: "", - interceptionNumber: "", + blackListIP: '', + IPState: '', + interceptionCycle: '', + unit: '', + interceptionNumber: '', }, BTableData: [], WTableData: [], @@ -267,9 +411,89 @@ }; }, methods: { + editFromDataClose() { + this.updateFormdialog = false; + this.editfrom = {}; + }, + async editFromData() { + var data = await updateblacklist(this.editfrom); + if (data.code == 200) { + this.updateFormdialog = false; + this.editfrom = {}; + this.$message({ + message: '淇敼鎴愬姛锛�', + type: 'success', + }); + this.BGetList(); + this.WGetList(); + } else { + this.$message({ + message: '淇敼澶辫触锛�', + type: 'warning', + }); + } + }, + handleEdit(index, row) { + this.editfrom = row; + this.updateFormdialog = true; + }, + + async delBWList() { + var std = []; + for (var i in this.multipleSelection) { + std.push(this.multipleSelection[i].id); + } + //deletes + const data = await deletelacklist({ ids: std.toString() }); + if (data.code == 200) { + this.$message({ + message: '鍒犻櫎鎴愬姛锛�', + type: 'success', + }); + this.BGetList(); + this.WGetList(); + } else { + this.$message({ + message: '鍒犻櫎澶辫触锛�', + type: 'warning', + }); + } + }, + blackSelectionChange(val) { + this.multipleSelection = val; + }, + showInsertdialog(res) { + this.insertform.type = res; + this.InsertFormdialog = true; + }, + insertFromDataClose() { + this.InsertFormdialog = false; + this.insertform = {}; + }, + async insertFromData() { + var count = await blacklistSelectCount(this.insertform); + if (parseInt(count.result) != 0) return; + + var data = await blacklistAppend(this.insertform); + if (data.code == 200) { + this.InsertFormdialog = false; + this.insertform = {}; + this.$message({ + message: '娣诲姞鎴愬姛锛�', + type: 'success', + }); + this.BGetList(); + this.WGetList(); + } else { + this.$message({ + message: '娣诲姞澶辫触锛�', + type: 'warning', + }); + } + }, //鏍煎紡鍖栨椂闂� add0(m) { - return m < 10 ? "0" + m : m; + return m < 10 ? '0' + m : m; }, //鏍煎紡鍖栨椂闂� format(shijianchuo) { @@ -282,7 +506,7 @@ var mm = time.getMinutes(); var s = time.getSeconds(); return ( - y + "-" + this.add0(m) + "-" + this.add0(d) + y + '-' + this.add0(m) + '-' + this.add0(d) // " " + // this.add0(h) + // ":" + @@ -319,7 +543,7 @@ this.getList(); }, onSubmit() { - console.log("submit!"); + console.log('submit!'); }, resetForm(formName) { this.$refs[formName].resetFields(); @@ -328,28 +552,48 @@ const data = await blacklistSelectByPageAndCount(this.WListData); if (data.code != 200) { - return this.$message.error("鍒楄〃璋冪敤澶辫触"); + return this.$message.error('鍒楄〃璋冪敤澶辫触'); } this.WTableData = data.result; this.Wcount = data.count; }, async BGetList() { const data = await blacklistSelectByPageAndCount(this.BListData); - console.log(data); if (data.code != 200) { - return this.$message.error("鍒楄〃璋冪敤澶辫触"); + return this.$message.error('鍒楄〃璋冪敤澶辫触'); } + this.BTableData = data.result; this.Bcount = data.count; }, + showPermsMenu(res) { + switch (res.tag) { + case '/delete': + this.menuStatus.delete = true; + break; + case '/insert': + this.menuStatus.insert = true; + break; + case '/update': + this.menuStatus.update = true; + break; + } + }, }, created() { + var val = this.$store.state.currentPerms; + var permsEntity = this.$store.state.permsEntity; + for (var i = 0; i < permsEntity.length; i++) { + if (permsEntity[i].perms == val) { + this.showPermsMenu(permsEntity[i]); + } + } this.BGetList(); this.WGetList(); }, }; </script> - <style lang="less" scoped> +<style lang="less" scoped> //@import url(); 寮曞叆鍏叡css绫� .logLog_box { background: rgb(240, 242, 245); @@ -384,4 +628,3 @@ } } </style> - \ No newline at end of file -- Gitblit v1.9.3