Commit 716fef03 by 张杰

增加按钮权限

1 parent 4d7b32f5
<template>
<el-button :type="type" v-if="hasPermission()" :size="size">
<slot />
</el-button>
<!-- <el-link :type="type" v-if="link && hasPermission()">
<slot />
</el-link> -->
</template>
<script>
export default {
name: "AuthButton",
props: {
uid: {
type: [String, Number],
default: "",
},
type: {
type: [String, Number],
default: "default",
},
link: {
type: Boolean,
default: false,
},
size:{
type:String,
default:''
}
},
data() {
return {};
},
mounted() {
},
methods: {
// 判断是否有权限
hasPermission() {
let id = this.uid;
let list = this.$root.parentCommon.getAuthData();
console.log(list[0])
let idx = list.findIndex((k) => k.id == id);
if (idx < 0) {
return false;
} else {
return true;
}
},
},
};
</script>
<style lang="scss" scoped>
</style>
\ No newline at end of file \ No newline at end of file
<template>
<el-link class="el_link" :underline="false" :type="type" v-if="hasPermission()">
<slot />
</el-link>
</template>
<script>
export default {
name: "AuthLink",
props: {
uid: {
type: [String, Number],
default: "",
},
type: {
type: [String, Number],
default: "default",
},
link: {
type: Boolean,
default: false,
},
},
data() {
return {};
},
mounted() {
},
methods: {
// 判断是否有权限
hasPermission() {
let id = this.uid;
let list = this.$root.parentCommon.getAuthData();
let idx = list.findIndex((k) => k.id == id);
if (idx < 0) {
return false;
} else {
return true;
}
},
},
};
</script>
<style lang="scss" scoped>
.el_link:hover {
text-decoration: none;
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
</search-form> </search-form>
<!-- 搜索区域 end --> <!-- 搜索区域 end -->
<auth-button type="primary" :uid="17010307">编辑</auth-button>
<!-- 操作按钮区域 开始 --> <!-- 操作按钮区域 开始 -->
<h3>车辆列表 <h3>车辆列表
<div class="pull-right"> <div class="pull-right">
...@@ -75,8 +77,8 @@ ...@@ -75,8 +77,8 @@
<el-form-item label="车架号:" prop="vin" class="long_form_item"> <el-form-item label="车架号:" prop="vin" class="long_form_item">
<div class="el_item_inner"> <div class="el_item_inner">
<el-input v-model="snForm.vin" class="a_input" maxlength="17" clearable :disabled="vinEdit"></el-input> <el-input v-model="snForm.vin" class="a_input" maxlength="17" clearable :disabled="vinEdit"></el-input>
<el-button type="primary" v-if="vinEdit" @click="vinEdit = !vinEdit">编辑</el-button> <auth-button type="primary" size="mini" v-show="vinEdit" :uid="17010307" @click.native="vinEdit = !vinEdit">编辑</auth-button>
<el-button v-else @click="vinEdit = !vinEdit">取消</el-button> <el-button v-show="!vinEdit" @click="vinEdit = !vinEdit">取消</el-button>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="发动机号:" prop="engine" class="long_form_item"> <el-form-item label="发动机号:" prop="engine" class="long_form_item">
...@@ -151,7 +153,7 @@ ...@@ -151,7 +153,7 @@
<td>{{item.frequency}}</td> <td>{{item.frequency}}</td>
</tr> </tr>
<tr v-if="!freqTableData || freqTableData.length<=0"> <tr v-if="!freqTableData || freqTableData.length<=0">
<td colspan="7">暂无特殊操作日志</td> <td colspan="7">操作日志</td>
</tr> </tr>
</table> </table>
</template> </template>
...@@ -238,6 +240,7 @@ import { ...@@ -238,6 +240,7 @@ import {
getAdjFreqInfo, getAdjFreqInfo,
} from "services/vehicle"; } from "services/vehicle";
import { getOrgTree } from "services/common"; import { getOrgTree } from "services/common";
import AuthButton from "@/components/auth-button";
export default { export default {
data() { data() {
const _this = this; const _this = this;
...@@ -839,6 +842,10 @@ export default { ...@@ -839,6 +842,10 @@ export default {
vinEdit: true, // 编辑车辆是否可以编辑车架号 vinEdit: true, // 编辑车辆是否可以编辑车架号
}; };
}, },
components: {
freqModal,
AuthButton,
},
watch: { watch: {
filterText(val) { filterText(val) {
this._timeout && clearTimeout(this._timeout); this._timeout && clearTimeout(this._timeout);
...@@ -865,6 +872,7 @@ export default { ...@@ -865,6 +872,7 @@ export default {
// this.vehicleDefalutData.find((item) => item.prop == "configId").options = // this.vehicleDefalutData.find((item) => item.prop == "configId").options =
// res.data; // res.data;
}); */ }); */
console.log(this.$root.parentVuex.getters.curMenuAuth.data);
let o = history.state; let o = history.state;
if (o.vin) { if (o.vin) {
this.searchForm.keywords = o.vin; this.searchForm.keywords = o.vin;
...@@ -1533,9 +1541,6 @@ export default { ...@@ -1533,9 +1541,6 @@ export default {
); );
}, },
}, },
components: {
freqModal,
},
}; };
</script> </script>
<style> <style>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!