[add] 权限工程接口人

This commit is contained in:
zhaomeijing
2022-05-16 16:31:05 +08:00
parent dadb953d5f
commit 305ca79397
4 changed files with 117 additions and 45 deletions
+1
View File
@@ -707,6 +707,7 @@ module.exports = {
uploadTime: 'Upload time',
enclosure: 'enclosure',
// 认证
operatethisbutton: 'You do not have permission to operate this button',
ParameterLibrary: 'Parameter Library',
referenceparameter: 'reference Parameter',
Assignedby: 'Assignedby',
+1
View File
@@ -716,6 +716,7 @@ module.exports = {
uploadTime: '上传时间',
enclosure: '附件',
// 认证
operatethisbutton: '没有权限操作此按钮',
ParameterLibrary: '参数库',
referenceparameter: '引用参数',
Assignedby: '分配填写人',
@@ -73,6 +73,7 @@ export default {
indeterminate: false,
columns: [],
selectedRowKeys: [],
selectedRowrowValue: [],
dataSource: [],
pageNo: 1,
pageSize: 10,
@@ -81,6 +82,7 @@ export default {
loading: false,
orderBy: '1',
orderByField: '',
LoginUserType: '', // 登陆人角色状态
homo: 0, // 认证工程师
sdt: 0, // 工程接口人
dre: 0, // 填写人
@@ -98,6 +100,8 @@ export default {
}
getAction(this.url.getLoginUserType, params).then((res) => {
if (res.success) {
this.LoginUserType = res.result
this.$emit('LoginUserType', this.LoginUserType)
res.result.split(',').forEach((item,index) => {
if(item === 'homo') {
this.homo = 1
@@ -190,8 +194,8 @@ export default {
// this.getTableList()
},
onSelectChange(value,rowValue) {
console.log(value,rowValue)
this.selectedRowKeys = value
this.selectedRowrowValue = rowValue
this.$emit('value',value)
this.$emit('rowValue', rowValue)
},
@@ -64,12 +64,12 @@
<a-popconfirm overlayClassName='popconfirm' placement="bottomRight">
<template slot="title" id="popconfirm">
<!-- 下发收集 -->
<div @click="handleAdd" class="operator-text-title">
<div @click="distributionAndCollection" class="operator-text-title">
<a-icon type="plus"/>
{{$t('distributionAndCollection')}}
</div>
<!-- 冻结配置-->
<div @click="handleAdd" class="operator-text-title">
<div @click="freezeConfiguration" class="operator-text-title">
<a-icon type="plus"/>
{{$t('FreezeConfiguration')}}
</div>
@@ -121,7 +121,7 @@
</div>
<div style="width: 100%">
<!-- 表格-10控件-->
<table-collection ref="CollectionTabel" :url='url' :paramsManifest='paramsManifest' @rowValue='rowValue' :formInline='formInline' @value='value'/>
<table-collection ref="CollectionTabel" :url='url' :paramsManifest='paramsManifest' @rowValue='rowValue' :formInline='formInline' @LoginUserType='LoginUserType' @value='value'/>
</div>
<!-- 添加--->
<a-modal v-model="areaVisible" :title="$t('ParameterLibrary')" width='750px' :footer="null">
@@ -217,8 +217,11 @@ export default {
rowId: '',
version: 0,
itemId: '',
selectedRowKeysValue: [],
selectedRowKeysValue: [], // table列表所选得数据
token:Vue.ls.get(ACCESS_TOKEN),
homo: 0, // 认证工程师
sdt: 0, // 工程接口人
dre: 0, // 填写人
}
},
props: {
@@ -230,6 +233,45 @@ export default {
},
mounted() {},
methods:{
// 判断是否有权限 认证工程师 待发起收集
// 添加 批量删除 下发收集 冻结配置 工程接口人列修改
permission() {
// 判断是否具有提交权限
// 认证工程师
// 定义开关 0为没有权限 1为有权限
let flag = 1
if(this.homo) {
if(this.selectedRowKeysValue.length == 0) {
flag = 0
this.$message.success(this.$t('selectLeastOne'))
} else {
this.selectedRowKeysValue.forEach((item, index) => {
if(item.state !== '待发起收集') {
flag = 0
}
})
if(flag === 1) {
flag = 1
} else {
this.$message.warning(this.$t('operatethisbutton'))
}
}
}else {
this.$message.success(this.$t('operatethisbutton'))
}
return flag
},
LoginUserType(val) {
val.split(',').forEach((item,index) => {
if(item === 'homo') {
this.homo = 1
} else if(item === 'sdt') {
this.sdt = 1
} else if(item === 'dre') {
this.dre = 1
}
})
},
// 表格所选中得行内容
rowValue(val) {
this.selectedRowKeysValue = val
@@ -239,9 +281,29 @@ export default {
this.selectedRowKeys = val,
this.selectedRowKeysArray = val.join(',')
},
// 冻结配置
freezeConfiguration() {
// 先判断是否有权限
let permission = this.permission()
if(permission) {
console.log('拥有冻结配置权限')
}
},
// 下发收集
distributionAndCollection() {
// 先判断是否有权限
let permission = this.permission()
if(permission) {
console.log('拥有下发收集权限')
}
},
// 添加
handleAdd() {
this.areaVisible = true
// 先判断是否有权限
let permission = this.permission()
if(permission) {
this.areaVisible = true
}
},
// 提交
handleSubmit() {
@@ -284,47 +346,51 @@ export default {
this.$refs.CollectionTabel.getTableListReset()
},
handleDel(){
let param={
ids: this.selectedRowKeysArray
}
if (this.selectedRowKeys.length > 0) {
let _this = this
this.$confirm({
content: _this.$t('ConfirmBatchDeletion'),
onOk() {
axios({
url: '/jero-boot/params/collectManifest/deleteBatch',
method: 'post',
data: param,
transformRequest: [function (data) {
let ret = ''
for (let it in data) {
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
}
return ret
}],
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Access-Token':_this.token
}
})
.then( (res) =>{
if (res.data.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.selectedRowKeys = []
_this.$refs.CollectionTabel.getData()
_this.$refs.CollectionTabel.getTableList()
}else{
_this.$message.warning(_this.$t('operationFailed'))
// 先判断是否有权限
let permission = this.permission()
if(permission) {
let param={
ids: this.selectedRowKeysArray
}
if (this.selectedRowKeys.length > 0) {
let _this = this
this.$confirm({
content: _this.$t('ConfirmBatchDeletion'),
onOk() {
axios({
url: '/jero-boot/params/collectManifest/deleteBatch',
method: 'post',
data: param,
transformRequest: [function (data) {
let ret = ''
for (let it in data) {
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
}
return ret
}],
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Access-Token':_this.token
}
})
.catch( (error) =>{
console.log(error);
});
}
})
} else {
this.$message.warning(this.$t('selectLeastOne'))
.then( (res) =>{
if (res.data.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.selectedRowKeys = []
_this.$refs.CollectionTabel.getData()
_this.$refs.CollectionTabel.getTableList()
}else{
_this.$message.warning(_this.$t('operationFailed'))
}
})
.catch( (error) =>{
console.log(error);
});
}
})
} else {
this.$message.warning(this.$t('selectLeastOne'))
}
}
},
pageOnChange() {