From f6ebd1820968db8521bed86d25b183efe7eb877b Mon Sep 17 00:00:00 2001 From: lxl <lixuliang_hd@126.com> Date: 星期四, 27 十月 2022 16:01:40 +0800 Subject: [PATCH] 权限 --- src/views/datamanage/versionManage.vue | 101 ++++++++++++++++++++++++++++++-------------------- 1 files changed, 60 insertions(+), 41 deletions(-) diff --git a/src/views/datamanage/versionManage.vue b/src/views/datamanage/versionManage.vue index 77cc835..39c0286 100644 --- a/src/views/datamanage/versionManage.vue +++ b/src/views/datamanage/versionManage.vue @@ -20,19 +20,20 @@ @click="onSubmit('ruleForm')" icon="el-icon-search" size="small" - >{{ $t('common.iquery') }}</el-button + >{{ $t("common.iquery") }}</el-button > <el-button + v-if="btnStatus.insert" @click="InsertFormdialog = true" icon="el-icon-plus" size="small" - >{{ $t('common.append') }}</el-button + >{{ $t("common.append") }}</el-button > <el-button @click="resetForm('ruleForm')" icon="el-icon-delete" size="small" - >{{ $t('common.empty') }}</el-button + >{{ $t("common.empty") }}</el-button > </el-form-item> </el-form> @@ -92,16 +93,18 @@ <el-table-column min-width="150" :label="$t('common.operate')"> <template slot-scope="scope"> <el-button + v-if="btnStatus.update" @click="handleEdit(scope.$index, scope.row)" type="warning" size="small" - >{{ $t('common.update') }}</el-button + >{{ $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 + >{{ $t("common.delete") }}</el-button > </template> </el-table-column> @@ -170,7 +173,7 @@ disabled ></el-input> <el-button style="margin-left: 20px" @click="showVerTree(2)">{{ - $t('common.choose') + $t("common.choose") }}</el-button> </el-form-item> <el-form-item @@ -182,10 +185,10 @@ </el-form> <div slot="footer" class="dialog-footer"> <el-button @click="editFromDataClose">{{ - $t('common.close') + $t("common.close") }}</el-button> <el-button @click="editFromData" type="primary">{{ - $t('common.confirm') + $t("common.confirm") }}</el-button> </div> </el-dialog> @@ -210,7 +213,7 @@ disabled ></el-input> <el-button style="margin-left: 20px" @click="showVerTree(3)">{{ - $t('common.choose') + $t("common.choose") }}</el-button> </el-form-item> @@ -223,10 +226,10 @@ </el-form> <div slot="footer" class="dialog-footer"> <el-button @click="insertFromDataClose">{{ - $t('common.close') + $t("common.close") }}</el-button> <el-button @click="insertFromData" type="primary">{{ - $t('common.confirm') + $t("common.confirm") }}</el-button> </div> </el-dialog> @@ -236,10 +239,10 @@ </div> <div class="btnBox"> <el-button type="primary" size="small" @click="selectCataName">{{ - $t('common.confirm') + $t("common.confirm") }}</el-button> <el-button type="primary" size="small" @click="showCata = false">{{ - $t('common.close') + $t("common.close") }}</el-button> </div> </div> @@ -252,18 +255,18 @@ insertVersion, deleteVersion, updateVersion, -} from '../../api/api'; -import verDirTree from './verDirTree.vue'; -import MyBread from '../../components/MyBread.vue'; -import verDirTrees from './verDirTrees.vue'; -import moment from 'moment'; +} from "../../api/api"; +import verDirTree from "./verDirTree.vue"; +import MyBread from "../../components/MyBread.vue"; +import verDirTrees from "./verDirTrees.vue"; +import moment from "moment"; export default { - name: 'versionManage', + name: "versionManage", components: { MyBread, verDirTree, verDirTrees }, data() { return { showCata: false, - formLabelWidth: '100px', + formLabelWidth: "100px", dialogFormVisible: false, InsertFormdialog: false, showinfoBox: false, @@ -280,10 +283,19 @@ pageIndex: 1, pageSize: 10, }, + btnStatus: { + select: false, + delete: false, + upload: false, + download: false, + insert: false, + update: false, + }, }; }, created() { this.getRoleTabelData(); + this.showPermsBtn(); }, computed: { pathId() { @@ -291,17 +303,24 @@ }, }, methods: { + showPermsBtn() { + let currentPerms = this.$store.state.currentPerms; + let permsEntity = this.$store.state.permsEntity; + permsEntity + .filter((item) => item.perms == currentPerms) + .map((item) => (this.btnStatus[item.tag.substr(1)] = true)); + }, resetForm() { this.ruleForm = {}; this.$store.state.verCateNode = {}; - this.$bus.$emit('clearTressLabel', true); + this.$bus.$emit("clearTressLabel", true); this.getRoleTabelData(); }, onSubmit() { this.getRoleTabelData(); }, async getRoleTabelData() { - if (this.listData.tab == '') { + if (this.listData.tab == "") { delete this.listData.tab; } @@ -310,7 +329,7 @@ const data = await select_Ver_ByPageAndCount(this.listData); if (data.code != 200) { - this.$message.error('鍒楄〃璋冪敤澶辫触'); + this.$message.error("鍒楄〃璋冪敤澶辫触"); } this.tableData = data.result; this.count = data.count; @@ -344,8 +363,8 @@ async editFromData() { if (this.upform.depName == null) { this.$message({ - message: '璇烽�夋嫨瑙掕壊鎵�灞炲崟浣�', - type: 'warning', + message: "璇烽�夋嫨瑙掕壊鎵�灞炲崟浣�", + type: "warning", }); return; } @@ -354,14 +373,14 @@ this.dialogFormVisible = false; this.upform = {}; this.$message({ - message: '淇敼鎴愬姛锛�', - type: 'success', + message: "淇敼鎴愬姛锛�", + type: "success", }); this.getRoleTabelData(); } else { this.$message({ - message: '淇敼澶辫触锛�', - type: 'warning', + message: "淇敼澶辫触锛�", + type: "warning", }); } }, @@ -372,8 +391,8 @@ async insertFromData() { if (this.insertform.dirid == null) { this.$message({ - message: '璇烽�夋嫨瑙掕壊鎵�灞炲崟浣�', - type: 'warning', + message: "璇烽�夋嫨瑙掕壊鎵�灞炲崟浣�", + type: "warning", }); return; } @@ -382,37 +401,37 @@ this.InsertFormdialog = false; this.insertform = {}; this.$message({ - message: '娣诲姞鎴愬姛锛�', - type: 'success', + message: "娣诲姞鎴愬姛锛�", + type: "success", }); this.getRoleTabelData(); } else { this.$message({ - message: '娣诲姞澶辫触锛�', - type: 'warning', + message: "娣诲姞澶辫触锛�", + type: "warning", }); } }, formatTime(row, column) { let date = row[column.property]; if (date === undefined || date === null) { - return ''; + return ""; } - return moment(parseInt(date)).format('YYYY-MM-DD HH:mm:ss'); + return moment(parseInt(date)).format("YYYY-MM-DD HH:mm:ss"); }, async handleDelete(index, row) { const data = await deleteVersion(row.id); if (data.code == 200) { this.InsertFormdialog = false; this.$message({ - message: '鍒犻櫎鎴愬姛锛�', - type: 'success', + message: "鍒犻櫎鎴愬姛锛�", + type: "success", }); this.getRoleTabelData(); } else { this.$message({ - message: '鍒犻櫎澶辫触锛�', - type: 'warning', + message: "鍒犻櫎澶辫触锛�", + type: "warning", }); } }, -- Gitblit v1.9.3