北尚诉办前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

131 lines
4.2 KiB

<template>
<el-dialog :visible.sync="visible" :title="'处理'" :close-on-click-modal="false" :close-on-press-escape="false">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" :label-width="$i18n.locale === 'en-US' ? '120px' : '80px'">
<!-- <el-form-item label="审批状态" prop="checkResult" label-width="80px">-->
<!-- <el-select v-model="dataForm.checkResult" placeholder="请选择" clearable>-->
<!-- <el-option label="通过" value="3"> </el-option>-->
<!-- <el-option label="驳回" value="4"> </el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="验收内容" prop="checkOpinion">
<template>
<div style="margin: 15px 0;"></div>
<el-checkbox-group v-model="checkedItems" @change="handleCheckedCitiesChange">
<span style="display:inline-block">
<el-checkbox v-for="item in acceptanceArray" :label="item.checkLabel" :key="item.checkCode">{{item.checkLabel}}</el-checkbox>
</span>
</el-checkbox-group>
</template>
</el-form-item>
<el-form-item label="验收理由" prop="checkOpinion">
<el-input
type="textarea"
:rows="3"
v-model="dataForm.checkOpinion"
maxlength="200"
style="width:calc(100% - 110px)"></el-input>
</el-form-item>
</el-form>
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary" :disabled="isAble" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
</template>
</el-dialog>
</template>
<script>
import debounce from 'lodash/debounce'
export default {
data () {
return {
visible: false,
dataForm: {
infoId: '',
checkResult: '',
checkOpinion: ''
},
acceptanceArray:[],
checkedItems:[],
isAble: false
}
},
computed: {
dataRule () {
return {
checkResult: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
checkOpinion: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
]
}
}
},
mounted () {
if (this.$route.query.id !== '' && this.$route.query.id != null) {
this.dataForm.infoId = this.$route.query.infoId
this.getInfo()
}
},
methods: {
init () {
this.visible = true
this.isAble = false
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.infoId) {
this.getInfo()
}
})
},
// 获取验收内容信息
getInfo () {
this.$http.get(`/kpi/subcheckdictionary/getSubCheckDictList`).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
console.log(this.dataForm);
this.acceptanceArray = res.data
console.log(this.dataForm);
}).catch(() => {})
},
handleCheckAllChange(val) {
this.checkedCities = val ? cityOptions : [];
this.isIndeterminate = false;
},
handleCheckedCitiesChange(value) {
let checkedCount = value.length;
let allLength = this.acceptanceArray.length;
if(checkedCount != allLength){
console.log("未全选");
}
},
// 表单提交
dataFormSubmitHandle: debounce(function () {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false
}
this.isAble = true
this.$http['post']('/kpi/subpositioncheckinfo/acceptance', this.dataForm).then(({ data: res }) => {
if (res.code !== 0) {
this.isAble = false
return this.$message.error(res.msg)
}
this.$message({
message: this.$t('prompt.success'),
type: 'success',
duration: 500,
onClose: () => {
this.$emit('connectResponse')
this.visible = false
this.$emit('refreshDataList')
}
})
}).catch(() => {})
})
}, 1000, { 'leading': true, 'trailing': false })
}
}
</script>