<template>
|
<div>
|
<el-form
|
:label-position="labelPosition"
|
:model="form"
|
ref="form"
|
>
|
<el-row>
|
<p class="title">审批意见</p>
|
<el-col :span="16">
|
<el-form-item label="审批结果" prop="phasechoice" :rules="rules.phasechoice" id="project-opinion">
|
<el-select v-model="form.phasechoice" filterable clearable placeholder="请选择" style="width:750px">
|
<el-option
|
v-for="item in options.phasechoice"
|
:key="item.value"
|
:label="item.valueDesc"
|
:value="item.value">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="24" class="el-form-textarea">
|
<el-form-item label="审批意见" prop="phaseopinion2" :rules="rules.phaseopinion2">
|
<el-input type="textarea" :rows="5" v-model="form.phaseopinion2" resize="none" maxlength="500"></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
</div>
|
</template>
|
|
<script>
|
import { queryProjectFlowOpinion, addOrUpdateProjectOpinion, queryCommitActionRange } from '@/api/area'
|
import { mapState } from 'vuex'
|
export default {
|
data: function () {
|
return {
|
labelPosition: 'right',
|
form: {
|
serialno: '',
|
phasechoice: '',
|
phaseopinion2: '',
|
opinionno: '',
|
objectno: '',
|
objectType: ''
|
},
|
options: {
|
phasechoice: []
|
},
|
rules: {
|
phasechoice: {
|
required: true, message: '请选择审批结果', trigger: 'blur'
|
},
|
phaseopinion2: {
|
required: false, message: '请输入审批意见', trigger: 'blur'
|
}
|
}
|
}
|
},
|
computed: {
|
...mapState({
|
detailsParams: state => state.risk.detailsParams
|
})
|
},
|
watch: {
|
'form.phasechoice': function(newVal) {
|
this.rules.phaseopinion2.required = Boolean(newVal !== '01')
|
}
|
},
|
created () {
|
this.selectLoad()
|
this.initForm()
|
},
|
methods: {
|
initForm () {
|
let params = {
|
objectType: this.detailsParams.objectType,
|
dataType: this.detailsParams.dataType,
|
projectFlag: this.detailsParams.projectFlag,
|
projectType: this.detailsParams.projectType,
|
serialno: this.detailsParams.objectNo
|
}
|
queryProjectFlowOpinion(params).then(res => {
|
this.form = res.result
|
})
|
},
|
selectLoad () {
|
let params = {
|
objectType: this.detailsParams.objectType,
|
serialno: this.detailsParams.objectNo
|
}
|
queryCommitActionRange(params).then(res => {
|
this.options.phasechoice = res.result
|
})
|
},
|
submitForm () {
|
this.$refs['form'].validate((valid) => {
|
if (valid) {
|
let params = this.form
|
addOrUpdateProjectOpinion(params).then(res => {
|
if (res.code === '00') {
|
// this.$message.success('提交成功!')
|
this.$emit('handleNextPage', true)
|
}
|
})
|
} else {
|
// this.$message.warning('当前页面存在必填项未录入或数据录入错误,请检查!')
|
return false
|
}
|
})
|
},
|
handleSave (saveOpinion) {
|
let params = this.form
|
if (!saveOpinion) { // 点击保存是不会传递saveOpinion参数,点击提交传递saveOpinion=true
|
addOrUpdateProjectOpinion(params).then(res => {
|
if (res.code === '00') {
|
this.$message.success(res.result.resultsDesc)
|
}
|
})
|
} else {
|
this.$refs['form'].validate((valid) => {
|
if (valid) {
|
let params = this.form
|
addOrUpdateProjectOpinion(params).then(res => {
|
if (res.code === '00') {
|
this.$emit('commitSaveBefore', true)
|
}
|
})
|
} else {
|
this.$message.warning('当前页面存在必填项未录入或数据录入错误,请检查!')
|
this.$emit('commitSaveBefore', false)
|
}
|
})
|
}
|
}
|
}
|
}
|
</script>
|
|
<style lang="stylus" scoped>
|
>>> .el-textarea
|
width 750px
|
& .el-textarea__inner
|
color #222222
|
#project-opinion
|
>>> .el-form-item__label
|
padding-right 12px
|
>>> .el-form-item__content
|
.el-select
|
.el-input__inner
|
width 750px
|
</style>
|