<template>
|
<el-dialog :visible.sync="authDialogVisible" :modal-append-to-body="false" :close-on-click-modal="false"
|
width="900px">
|
<div style="padding-bottom: 20px">
|
<el-button v-show="userType != 3" type="primary" plain @click="createAuthHandle">生成授权码</el-button>
|
</div>
|
|
<el-table v-loading="listLoading"
|
:key="tableKey"
|
:data="authData"
|
border
|
fit
|
highlight-current-row
|
:header-cell-style="turnRed"
|
style="width: 100%;">
|
<el-table-column type="index" label="" align="center" width="60"/>
|
<el-table-column label="授权码" prop="authcode" align="center">
|
</el-table-column>
|
<el-table-column label="合同编号" prop="contractcode" align="center">
|
</el-table-column>
|
<el-table-column label="状态" prop="status" align="center">
|
<template slot-scope="scope">
|
<div v-for="item in status">
|
<div v-if="scope.row.status === item.id">
|
{{item.name}}
|
</div>
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column label="类型" prop="status" align="center">
|
<template slot-scope="scope">
|
<div v-for="item in flagList">
|
<div v-if="scope.row.flag === item.id">
|
{{item.name}}
|
</div>
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column label="OCR状态" prop="isocr" align="center">
|
<template slot-scope="scope">
|
{{scope.row.isocr == 0?'禁用':scope.row.isocr == 1?'启用':'--'}}
|
</template>
|
</el-table-column>
|
<el-table-column label="创建时间" prop="createdat" align="center">
|
</el-table-column>
|
<el-table-column label="最后登录时间" prop="lasttime" align="center">
|
</el-table-column>
|
<el-table-column label="到期时间" prop="expiredat" align="center">
|
</el-table-column>
|
<el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width" v-if="userType != 3">
|
<template slot-scope="scope">
|
<el-button type="text" @click="changStatus(scope.row,0)" v-if="scope.row.status === 1" >停用</el-button>
|
<el-button type="text" @click="changStatus(scope.row,1)" v-else>启用</el-button>
|
<el-button type="text" @click="deleteAuth(scope.row)">删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<el-dialog :visible="addAuthDialogVisible" :modal-append-to-body="false" :close-on-click-modal="false"
|
width="400px" append-to-body>
|
<el-input v-model="contractCode" placeholder="请选择合同编号" ></el-input><br>
|
<el-select v-model="flag" placeholder="请选择类型">
|
<el-option
|
class="filter-item"
|
v-for="item in flagList"
|
:key="item.id"
|
:label="item.name"
|
:value="item.id">
|
</el-option>
|
</el-select>
|
<el-select v-model="isocr" placeholder="请选择是否启用OCR">
|
<el-option class="filter-item" label="启用OCR" :value="1"></el-option>
|
<el-option class="filter-item" label="禁用OCR" :value="0"></el-option>
|
</el-select>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="addAuthDialogVisible = false">取消</el-button>
|
<el-button type="primary" @click="createAuth">确认</el-button>
|
</div>
|
</el-dialog>
|
|
</el-dialog>
|
</template>
|
|
<script>
|
import {changeStatus, createAuth, deleteAuth, getAuthListById} from "../../../api/auth";
|
import { mapGetters } from 'vuex'
|
export default {
|
name: "authDetail",
|
// props: ["userId"],
|
data() {
|
return {
|
userId:'',
|
addAuthDialogVisible: false,
|
authDialogVisible: false,
|
authForm: {},
|
authData: [],
|
listLoading: true,
|
pageSize: 10,
|
recordTotal: 0,
|
currentPage: 1,
|
pageTotal: 0,
|
tableKey: 0,
|
status:[{id:0,name:"已停用"},{id:1,name:"已启用"}],
|
flagList:[{id:0,name:"标配"},{id:1,name:"无身份证阅读器"},{id:2,name:"无扫码枪"},{id:3,name:"全无"}],
|
contractCode:"",
|
flag:0,
|
isocr: 0
|
}
|
},
|
computed: {
|
...mapGetters([
|
'userType',
|
'username'
|
])
|
},
|
methods: {
|
open(userId){
|
this.userId = userId;
|
this.authDialogVisible = true;
|
this.getAuthDataList();
|
},
|
|
getAuthDataList() {
|
const params = {}
|
params['userId'] = this.userId;
|
getAuthListById(params).then(response => {
|
const res = response.data;
|
if (res.code === "200") {
|
this.authData = res.result;
|
this.listLoading = false;
|
}
|
})
|
},
|
|
changStatus(row,status){
|
const param = {
|
id:row.id,
|
status:status
|
};
|
changeStatus(param).then(response=>{
|
const res = response.data;
|
if (res.code === "200") {
|
this.getAuthDataList();
|
this.$emit('getinfo')
|
}
|
})
|
},
|
deleteAuth(row){
|
const param = {
|
id:row.id,
|
};
|
deleteAuth(param).then(response=>{
|
const res = response.data;
|
if (res.code === "200") {
|
this.getAuthDataList();
|
this.$emit('getinfo')
|
}
|
})
|
},
|
|
createAuthHandle() {
|
this.addAuthDialogVisible = true;
|
this.contractCode = ''
|
this.flag = 0
|
this.isocr = 0
|
},
|
|
createAuth(){
|
const param = {
|
userId:this.userId,
|
contractCode:this.contractCode,
|
flag:this.flag,
|
isocr: this.isocr
|
};
|
createAuth(param).then(response=>{
|
const res = response.data;
|
if (res.code === "200") {
|
this.getAuthDataList();
|
this.$emit('getinfo')
|
this.addAuthDialogVisible = false;
|
}
|
})
|
},
|
turnRed({row, column, rowIndex, columnIndex}){
|
if(rowIndex == 0 && columnIndex==7){
|
return 'color: red'
|
}
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
|
</style>
|