From a2ebd9a92a375b0b6898d532d3fee782b5fd8f49 Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@iotlink.com> Date: 星期四, 15 十月 2020 19:22:57 +0800 Subject: [PATCH] 修复权限设置 --- src/pages/ai/index/App.vue | 162 +++++++++++++++++++++++++++--------------------------- 1 files changed, 81 insertions(+), 81 deletions(-) diff --git a/src/pages/ai/index/App.vue b/src/pages/ai/index/App.vue index ba070c3..653f3cc 100644 --- a/src/pages/ai/index/App.vue +++ b/src/pages/ai/index/App.vue @@ -8,7 +8,7 @@ </div> </div> <!-- 瓒呯骇绠$悊鍛樺彲瑙� --> - <div class="super" v-if="isSuperUser"> + <div class="super"> <div class="left-box"> <!-- <div class="title"> <label>绠楁硶搴�</label> @@ -206,7 +206,7 @@ <el-tab-pane label="绂荤嚎鍗囩骇/瀹夎" name="upgradeOrInstallation" - v-show="activeName==='upgradeOrInstallation'" + v-if="isShow('algorithmManage:insOffLine')" > <div class="tab-content"> <div class="action-bar"> @@ -222,7 +222,7 @@ </div> </div> </el-tab-pane> - <el-tab-pane label="搴旂敤涓績" name="algorithmMall" v-show="activeName==='algorithmMall'"> + <el-tab-pane label="搴旂敤涓績" name="algorithmMall" v-if=" isShow('algorithmManage:buy')"> <div class="tab-content"> <p class="src-title">绠楁硶杞欢</p> <div class="store-list flex-list"> @@ -442,29 +442,40 @@ FileUploader }, computed: { - notInstalledList () { + notInstalledList() { return this.TaskMange.list1.filter(sdk => { return sdk.installed === false; }); }, - installedList () { + installedList() { return this.TaskMange.list1.filter(sdk => { return sdk.installed === true; }); }, - ungradeList () { + ungradeList() { // 鍗囩骇澶勭悊浼氬鑷撮噸澶嶇殑key,闇�瑕佷慨鏀� return []; return this.TaskMange.list1.filter(sdk => { return sdk.isUpgrade === true; }); }, + isAdmin() { + if ( + sessionStorage.getItem("userInfo") && + sessionStorage.getItem("userInfo") !== "" + ) { + let loginName = JSON.parse(sessionStorage.getItem("userInfo")).username; + return loginName === "superadmin" || loginName === "basic"; + } + return false; + }, }, - data () { + data() { return { TaskMange: new TaskManage, VideoManageData: new VideoManageData, + buttonAuthority: sessionStorage.getItem("buttonAuthoritys") || [], activeName: "myAlgorithm", patchUpdateStatus: "", dragging: false, @@ -554,7 +565,7 @@ }, watch: { list2: { - handler (newVal, oldVal) { + handler(newVal, oldVal) { // window.console.log(newVal, oldVal, '鐩戝惉list2') if (newVal !== oldVal) { // window.console.log(newVal, '鐩戝惉list2') @@ -575,13 +586,12 @@ } } }, - mounted () { + mounted() { this.getAllApps(); this.findAllSdk(); this.findByType(); this.getBaseList(); this.findAll(); - this.getUser(); this.getUnActivedList(); this.getUnActivedAppList(); // this.TaskMange.findAllSdk(); @@ -589,7 +599,10 @@ this.VideoManageData.init(); }, methods: { - offlineInstall () { + isShow(authority) { + return this.isAdmin || this.buttonAuthority.indexOf("," + authority + ",") > -1 + }, + offlineInstall() { this.installDialogVisible = false; this.isInstall = true; //瀹夎 @@ -617,7 +630,7 @@ }); }) }, - downloadApp (app) { + downloadApp(app) { app.installLoading = true; let _this = this; installApp({ path: app.id }).then(res => { @@ -632,7 +645,7 @@ } }) }, - getAllApps () { + getAllApps() { let _this = this; _this.installedApps = []; _this.storeApps = []; @@ -654,7 +667,7 @@ }) }, //鍗歌浇搴旂敤 - unLoad (app) { + unLoad(app) { app.unloadLoading = true; let _this = this; removeApp({ appId: app.id }).then(res => { @@ -678,7 +691,7 @@ // this.activeCode = ''; // this.activedSdkOrApp = this.newActInfo() // }, - actSdkOrApp (id, type = 'sdk') { + actSdkOrApp(id, type = 'sdk') { this.actType = type; this.actId = id; this.actDrawerShow = true; @@ -686,7 +699,7 @@ this.activeCode = ''; this.activedSdkOrApp = this.newActInfo() }, - newActInfo () { + newActInfo() { return { activateCode: '', productName: '', @@ -696,7 +709,7 @@ devIds: '' } }, - getUnActivedList () { + getUnActivedList() { getUnActivedSdk().then(res => { if (res.code == 200) { this.unActivedSDKList = res.data; @@ -704,7 +717,7 @@ }) }, - getUnActivedAppList () { + getUnActivedAppList() { getUnActivedApp().then(res => { if (res.code == 200) { this.unActivedAppList = res.data; @@ -712,10 +725,10 @@ }); }, - installFormat (percentage) { + installFormat(percentage) { return percentage === 100 ? '瀹夎鎴愬姛' : `${percentage}%`; }, - actived () { + actived() { let _this = this; if (this.actType == 'sdk') { //婵�娲荤畻娉� @@ -753,12 +766,12 @@ }); } }, - getCodeDetail () { }, - checkMyAlgorith () { + getCodeDetail() { }, + checkMyAlgorith() { this.actDrawerShow = false; this.activeName = "myAlgorithm"; }, - onFileUpload (file) { + onFileUpload(file) { //this.patchUpdateStatus = `<span style="color:green">涓婁紶鎴愬姛, 鐐瑰嚮鍗囩骇鎸夐挳寮�濮嬪畨瑁�</span>`; this.patchFile = { ...file }; this.fileAdded = true; @@ -870,12 +883,12 @@ }, - onFileAdded (f) { + onFileAdded(f) { ; this.patchUpdateStatus = ""; }, // 鏍¢獙杈撳叆鐨勬槸鍚︽槸鏁板瓧 - valiNum (value) { + valiNum(value) { if (value) { let re = /[^\-?\d.]*$/; if (!re.test(value)) { @@ -892,7 +905,7 @@ } }, // 宸﹁竟鎷栧姩妯″潡寰楁嫋鍔ㄧ粨鏉熷悗鐨勮Е鍙戝嚱鏁� - endLeft (env) { + endLeft(env) { this.dragging = false; let taskId = env.to.id; let sdkId = this.TaskMange.list1[env.oldIndex].id; @@ -933,24 +946,24 @@ this.addTaskSdk(json); }, // 鍙宠竟鎷栧姩妯″潡寮�濮嬫嫋鍔ㄨЕ鍙戝嚱鏁� - startRight (env) { + startRight(env) { this.$nextTick(() => { this.dragging = true; }); // window.window.console.log(env, "right start"); }, // 鍙宠竟鎷栧姩妯″潡鎷栧姩缁撴潫瑙﹀彂鍑芥暟 - endRight (env) { + endRight(env) { // window.window.console.log(env, "right end"); }, - clickSet (data) { + clickSet(data) { if (data.isSetting) { data.isSetting = false; } else { data.isSetting = true; } }, - clickDel (data, Index) { + clickDel(data, Index) { this.$confirm("鎻愮ず锛氬垹闄ゅ悗锛屾浠诲姟鍦ㄦ憚鍍忔満涓殑搴旂敤澶辨晥锛屾槸鍚﹀垹闄わ紵", { center: true, showConfirmButton: true, @@ -963,7 +976,7 @@ }) .catch(err => { }); }, - clickSetAlgo (row, data) { + clickSetAlgo(row, data) { // window.console.log(row, data, "缂栬緫浠诲姟涓煇涓�涓畻娉�"); if (row.isShowSetAlgo && data.id === this.TaskMange.currentAlgoId) { row.isShowSetAlgo = false; @@ -1029,7 +1042,7 @@ // }); } }, - async getRulesByTaskSdk (taskId, sdkId) { + async getRulesByTaskSdk(taskId, sdkId) { let res = await getRulesByTaskSdk({ taskId: taskId, sdkId: sdkId @@ -1065,7 +1078,7 @@ this.argsList = JSON.parse(JSON.stringify(this.TaskMange.argsList)); } }, - async findAllSdk () { + async findAllSdk() { let res = await findAllSdk(); if (res && res.success) { this.TaskMange.list1 = res.data.map((i, index) => { @@ -1082,7 +1095,7 @@ }); } }, - addTask () { + addTask() { let obj = { id: "", name: "浠诲姟" + this.TaskMange.list2.length, @@ -1098,7 +1111,7 @@ taskArea.scrollTop = taskArea.scrollHeight; }); }, - async findAll () { + async findAll() { let res = await findAll(); if (res && res.success) { if (res.data && res.data.length !== 0) { @@ -1135,7 +1148,7 @@ } } }, - clickDelSdk (task, sdk) { + clickDelSdk(task, sdk) { this.$confirm( "鎻愮ず锛氬垹闄ゅ悗锛屾绠楁硶鍦ㄦ湰浠诲姟涓Щ闄わ紝鍚屾椂鍦ㄦ憚鍍忔満涓殑搴旂敤澶辨晥锛屾槸鍚﹀垹闄わ紵", { @@ -1151,7 +1164,7 @@ }) .catch(err => { }); }, - selectChange (event, type, data) { + selectChange(event, type, data) { if (type === "options1") { // window.window.console.log(type, data, "閫夋嫨涓嬫媺妗�"); data.options1.map(i => { @@ -1162,7 +1175,7 @@ } }, // 鍒犻櫎浠诲姟绠楁硶 - async delTaskSdk (task, sdk) { + async delTaskSdk(task, sdk) { let json = { taskId: task.id, sdkId: sdk.id @@ -1182,7 +1195,7 @@ } }, // 鍒犻櫎浠诲姟 - async deleteTask (data, index) { + async deleteTask(data, index) { // window.console.log(data, "deleteTask"); let res = await deleteTask({ taskId: data.id }); // this.$toast({ @@ -1199,7 +1212,7 @@ } }, // 鏇存柊浠诲姟鐘舵�� - async updateTaskStatus (data) { + async updateTaskStatus(data) { // window.console.log(data, '鏇存柊浠诲姟鐘舵��') let json = { taskId: data.id, @@ -1217,7 +1230,7 @@ }); }, // 鏇存柊浠诲姟鍚嶇О - async updateTaskName (data) { + async updateTaskName(data) { let json = { taskId: data.id, taskName: data.name @@ -1237,7 +1250,7 @@ } }, // 鑾峰彇搴曞簱鏁版嵁 - async getBaseList () { + async getBaseList() { // let res = await getTagList(); // if (res && res.success) { // let filter = res.data.filter(i => { @@ -1266,7 +1279,7 @@ ]; }, // 鑾峰彇绠楁硶鍙傛暟 - async getSdkArgs (data) { + async getSdkArgs(data) { let res = await getSdkArgs({ sdkId: data.id, scope: "TASKRULE" @@ -1288,7 +1301,7 @@ } }, // 鏌ヨ瀛楀吀 - async findByType () { + async findByType() { let res = await findByType(); if (res && res.success) { let list = res.data.RULECOMPUTEBETWEEN.map(i => { @@ -1301,17 +1314,17 @@ } }, // 绠楁硶閰嶇疆锛屾柊寤� - add () { + add() { this.TaskMange.argsList.push( JSON.parse(JSON.stringify(this.TaskMange.baseObject)) ); }, // 绠楁硶閰嶇疆 鍒犻櫎 - delRule (index) { + delRule(index) { this.TaskMange.argsList.splice(index, 1); }, // 绠楁硶鍙傛暟淇濆瓨 - async save () { + async save() { let list = this.TaskMange.argsList.map(i => { let obj = {}; obj.id = i.id; @@ -1344,7 +1357,7 @@ } } }, - getDefault () { + getDefault() { this.deleteTaskSdkRule( this.TaskMange.currentTaskId, this.TaskMange.currentAlgoId @@ -1355,7 +1368,7 @@ ); }); }, - async deleteTaskSdkRule (taskId, sdkId) { + async deleteTaskSdkRule(taskId, sdkId) { let json = { taskId: taskId, sdkId: sdkId @@ -1375,7 +1388,7 @@ } }, // 缁欎换鍔℃坊鍔犵畻娉� - async addTaskSdk (data) { + async addTaskSdk(data) { let res = await addTaskSdk(data); if (res && res.success) { // window.console.log(res, 'res') @@ -1383,7 +1396,7 @@ } }, // 鏂版坊鍔犱换鍔� - async addTaskAsync (name) { + async addTaskAsync(name) { let res = await addTask({ taskname: name }); // this.$toast({ // type: res.success ? "success" : "error", @@ -1399,7 +1412,7 @@ this.findAll(); } }, - cancle (row) { + cancle(row) { if (row.isShowSetAlgo) { row.isShowSetAlgo = false; } @@ -1409,12 +1422,12 @@ this.$set(i, "isSelect", false); }); }, - cancleTask (row) { + cancleTask(row) { if (row.isSetting) { row.isSetting = false; } }, - commandAlgo (command, row, item) { + commandAlgo(command, row, item) { if (command === 1) { // console.log('璁剧疆绠楁硶') this.clickSetAlgo(row, item); @@ -1424,26 +1437,13 @@ this.clickDelSdk(row, item); } }, - commandTask (command, row) { + commandTask(command, row) { if (command === 1) { //缂栬緫浠诲姟 this.clickSet(row); } }, - getUser () { - // console.log("鐧诲綍鐢ㄦ埛",JSON.parse(sessionStorage.getItem("userInfo")).username) - if ( - sessionStorage.getItem("userInfo") && - (JSON.parse(sessionStorage.getItem("userInfo")).username == - "superadmin" || - JSON.parse(sessionStorage.getItem("userInfo")).username == "basic") - ) { - this.isSuperUser = true; - } else { - this.isSuperUser = false; - } - }, - donwload (item) { + donwload(item) { this.downloading = true; this.downloadItem = item.id; @@ -1467,15 +1467,15 @@ this.downloadItem = ""; }); }, - commandAlgLib (item) { + commandAlgLib(item) { this.$set(item, "isEdit", true); }, - inputBlur (item) { + inputBlur(item) { // console.log(item, '淇敼鍚嶇О') this.$set(item, "isEdit", false); }, - cleanTemplateForm () { + cleanTemplateForm() { this.appSceneForm.name = ""; this.appSceneForm.desc = ""; this.appSceneForm.rules = ""; @@ -1483,10 +1483,10 @@ this.$refs.ruleEditor.cleanRule(); }, - handleTabClick () { + handleTabClick() { }, - handleCreateScene () { + handleCreateScene() { this.sceneDialogVisible = true; this.dialogTitle = '鍒涘缓鍦烘櫙妯℃澘'; @@ -1499,10 +1499,10 @@ this.cleanTemplateForm(); }); }, - handleDialogClose () { + handleDialogClose() { this.sceneDialogVisible = false; }, - handleEditScene (item) { + handleEditScene(item) { this.appSceneForm.name = item.name; this.appSceneForm.desc = item.desc; @@ -1594,7 +1594,7 @@ .src-title { //color: #bfbfbf; color: #bbcee8; - font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC'; + font-family: "PingFangSC-Semibold", "PingFang SC Semibold", "PingFang SC"; font-weight: 650; font-style: normal; height: 36px; @@ -1619,7 +1619,7 @@ position: absolute; top: 50%; left: 50%; - background: url('/images/algo/green.gif'); + background: url("/images/algo/green.gif"); overflow: hidden; transform: translate(-50%, -50%); .inner-bar { @@ -1941,16 +1941,16 @@ } } .drawer-content { - font-family: 'PingFangSC-Regular'; + font-family: "PingFangSC-Regular"; .el-step__title.is-process { border-color: #3d68e1 !important; color: #3d68e1 !important; - font-family: Tahoma, Helvetica, Arial, '\5B8B\4F53', sans-serif; + font-family: Tahoma, Helvetica, Arial, "\5B8B\4F53", sans-serif; } .el-step__head.is-process { border-color: #3d68e1 !important; color: #3d68e1 !important; - font-family: Tahoma, Helvetica, Arial, '\5B8B\4F53', sans-serif; + font-family: Tahoma, Helvetica, Arial, "\5B8B\4F53", sans-serif; } .el-input { width: 100%; -- Gitblit v1.8.0