301 lines
8.6 KiB
Vue
301 lines
8.6 KiB
Vue
<template>
|
|
<div>
|
|
<el-drawer
|
|
title="编辑"
|
|
:visible.sync="isShow"
|
|
size="35%"
|
|
class="drawerLog"
|
|
:wrapperClosable="false"
|
|
@close="handleClose"
|
|
>
|
|
<el-form ref="applicationFormRef" :model="applicationForm" label-width="150px"
|
|
class="label-input-form" size="medium" :rules="applicationFormRule"
|
|
>
|
|
<el-row>
|
|
<el-col :span="22">
|
|
<el-form-item label="报告名称:" prop="name">
|
|
<el-input disabled v-model="applicationForm.name"
|
|
></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="22">
|
|
<el-form-item label="报告涉密等级:" prop="confidentialLevel">
|
|
<el-input disabled v-model="applicationForm.confidentialLevel"
|
|
></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="22">
|
|
<el-form-item label="报告隐私等级:" prop="privacyLevel">
|
|
<el-input disabled v-model="applicationForm.privacyLevel"
|
|
></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="22">
|
|
<el-form-item label="审批人:" prop="oneApprove">
|
|
<el-input readonly :disabled="formControl" v-model="applicationForm.oneApproveName"
|
|
@click.native="handleCheck('spr1')"
|
|
placeholder="请选择审批人"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="22">
|
|
<el-form-item label="二级审批人:" prop="twoApprove">
|
|
<el-input readonly :disabled="formControl " v-model="applicationForm.twoApproveName"
|
|
@click.native="handleCheck('spr2')"
|
|
placeholder="请选择二级审批人"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="22">
|
|
<el-form-item label="选择申请权限:" prop="power">
|
|
<el-select :disabled="formControl" v-model="applicationForm.power" placeholder="请选择申请权限"
|
|
@change="changeType">
|
|
<el-option
|
|
v-for="item in PERMISSION"
|
|
:key="item.value"
|
|
:label="item.label"
|
|
:disabled="item.disabled"
|
|
:value="item.value">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="22">
|
|
<el-form-item label="申请原因:" prop="applyReason">
|
|
<el-input :disabled="formControl" type="textarea" v-model="applicationForm.applyReason"
|
|
placeholder="请输入申请原因"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
</el-row>
|
|
</el-form>
|
|
<div class="done">
|
|
<el-button type="primary" size="medium" @click.native="savaCheck">确定</el-button>
|
|
<el-button type="default" size="medium" @click.native="handleClose">取消</el-button>
|
|
</div>
|
|
</el-drawer>
|
|
<orgTable :visible.sync="visibleOrgTable" title="人员列表" dialog-model :config="{
|
|
value: orgTableVal,
|
|
valueName: orgTableValName
|
|
}" :workNumFlag="true" :maxSelected="1" @confirm="isTreeOk"></orgTable>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {PERMISSION} from '@/utils/Enum/enum'
|
|
|
|
export default {
|
|
name: "reportDrawer",
|
|
data() {
|
|
return {
|
|
conTwo: false,
|
|
isShow: false,
|
|
visibleOrgTable: false,
|
|
treeType: '',
|
|
orgTableVal: '',
|
|
orgTableValName: '',
|
|
formControl: false,
|
|
PERMISSION,
|
|
applicationForm: {},
|
|
applicationFormRule: {
|
|
applyReason: [{
|
|
max: 500, message: '申请原因最多填写500字符'
|
|
}],
|
|
power: [{
|
|
required: true,
|
|
message: '请选择申请权限'
|
|
}],
|
|
oneApprove: [{
|
|
required: true,
|
|
message: '请选择审批人',
|
|
trigger: 'change'
|
|
}],
|
|
twoApprove: [{
|
|
required: true,
|
|
message: '请选择二级审批人',
|
|
trigger: 'change'
|
|
}],
|
|
},
|
|
|
|
}
|
|
},
|
|
props: {
|
|
form: {
|
|
type: Object,
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
changeType(i) {
|
|
let newItem = this.PERMISSION.filter(item=>{
|
|
if(i==item.value){
|
|
return item
|
|
}
|
|
})
|
|
this.applicationForm.powerName = newItem[0].label
|
|
this.$set( this.applicationForm,'powerName',newItem[0].label )
|
|
console.log(this.applicationForm,"报告隐私等级")
|
|
},
|
|
handleClose() {
|
|
this.isShow = false
|
|
},
|
|
async open(form) {
|
|
this.isShow = true
|
|
let oldPower = form.power
|
|
if (!form.twoApprove) {
|
|
|
|
form.twoApprove = ''
|
|
form.twoApproveName = ''
|
|
|
|
form.applyReason = ''
|
|
form.prcType = ''
|
|
form.powerName=''
|
|
form.power=''
|
|
this.PERMISSION = this.PERMISSION.map(item=>{
|
|
if(item.value == oldPower){
|
|
item.disabled=true
|
|
}else{
|
|
item.disabled=false
|
|
}
|
|
return item
|
|
})
|
|
}else if(form.twoApprove){
|
|
|
|
let res=await this.getLearder(form.oneApprove)
|
|
if(res.length>0){
|
|
form.twoApprove = res[0].usid
|
|
form.twoApproveName= res[0].usname
|
|
this.conTwo=true
|
|
if(form.powerName == ''|| !form.powerName){
|
|
form.applyReason = ''
|
|
form.prcType = ''
|
|
form.powerName=''
|
|
form.power=''
|
|
}
|
|
}else{
|
|
this.conTwo=false
|
|
form.applyReason = ''
|
|
form.prcType = ''
|
|
form.powerName=''
|
|
form.power=''
|
|
}
|
|
|
|
}
|
|
this.applicationForm = JSON.parse(JSON.stringify(form))
|
|
|
|
this.$nextTick(() => {
|
|
this.$refs.applicationFormRef.clearValidate()
|
|
|
|
})
|
|
},
|
|
savaCheck() {
|
|
this.$refs.applicationFormRef.validate(v => {
|
|
if (v) {
|
|
this.$emit('update', this.applicationForm)
|
|
this.isShow = false
|
|
} else {
|
|
this.$message.warning("请检查表单")
|
|
}
|
|
|
|
})
|
|
},
|
|
// 获取领导
|
|
getLearder(id){
|
|
console.log("获取领导")
|
|
return new Promise((resolve,reject)=>{
|
|
this.$api.reportProcess.getLeader({
|
|
userId:id
|
|
}).then(res=>{
|
|
if(res.data.length>0){
|
|
resolve(res.data)
|
|
}else{
|
|
resolve('')
|
|
}
|
|
})
|
|
})
|
|
},
|
|
handleCheck(name) {
|
|
if (this.formControl ) {
|
|
return false
|
|
}
|
|
if(name==='spr2' &&this.conTwo){
|
|
return false
|
|
}
|
|
this.treeType = name
|
|
this.orgTableVal = ''
|
|
this.orgTableValName = ''
|
|
if (name === 'spr1') {
|
|
this.orgTableVal = this.applicationForm.oneApprove ? this.applicationForm.oneApprove : ''
|
|
this.orgTableValName = this.applicationForm.oneApproveName ? this.applicationForm.oneApproveName : ''
|
|
} else {
|
|
this.orgTableVal = this.applicationForm.twoApprove ? this.applicationForm.twoApprove : ''
|
|
this.orgTableValName = this.applicationForm.twoApproveName ? this.applicationForm.twoApproveName : ''
|
|
}
|
|
|
|
this.visibleOrgTable = true
|
|
|
|
|
|
},
|
|
// 树点击
|
|
async isTreeOk(checkedList) {
|
|
// console.log(checkedList)
|
|
const parts = []
|
|
const partsName = []
|
|
console.log(checkedList, '0009999')
|
|
checkedList.map((item, index) => {
|
|
parts.push(item.userId || item.USID)
|
|
partsName.push(item.uname)
|
|
})
|
|
if (this.treeType === 'spr1') {
|
|
this.applicationForm.oneApprove = parts.toString()
|
|
this.applicationForm.oneApproveName = partsName.toString()
|
|
let res=await this.getLearder(this.applicationForm.oneApprove)
|
|
if(res.length>0){
|
|
this.applicationForm.twoApprove = res[0].usid
|
|
this.applicationForm.twoApproveName= res[0].usname
|
|
this.conTwo=true
|
|
}else{
|
|
this.applicationForm.twoApprove =''
|
|
this.applicationForm.twoApproveName=''
|
|
this.conTwo=false
|
|
}
|
|
|
|
} else if (this.treeType === 'spr2') {
|
|
this.applicationForm.twoApprove = parts.toString()
|
|
this.applicationForm.twoApproveName = partsName.toString()
|
|
}
|
|
|
|
// console.log(this.assignForm.name1Id, this.assignForm.name2Id)
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.drawerLog {
|
|
::v-deep .el-drawer__header {
|
|
padding: 10px 15px;
|
|
color: #555;
|
|
font-size: 18px;
|
|
}
|
|
|
|
.done {
|
|
position: fixed;
|
|
bottom: 20px;
|
|
right: 20px;
|
|
}
|
|
}
|
|
</style>
|