优化
This commit is contained in:
parent
44497494fe
commit
28b7b7f5a0
@ -11,7 +11,7 @@ import './style/index.less'
|
||||
import '@/icons'
|
||||
import _ from 'lodash'
|
||||
import VueCookie from 'vue-cookies'
|
||||
import { debounce, departGetForm, personlGetForm, handleInput, messageSuccess, loading, loadingClose } from '@/utils/common'
|
||||
import { debounce, departGetForm, personlGetForm, handleInput, messageSuccess, loading, loadingClose, handleBlur } from '@/utils/common'
|
||||
import { format } from '@/utils/dateFormat'
|
||||
Vue.prototype._ = _
|
||||
Vue.mixin(Mixin)
|
||||
@ -24,6 +24,8 @@ Vue.prototype.debounce = debounce
|
||||
Vue.prototype.$personlGetForm = personlGetForm
|
||||
Vue.prototype.$departGetForm = departGetForm
|
||||
Vue.prototype.$handleInputInt = handleInput
|
||||
|
||||
Vue.prototype.$handleBlur = handleBlur
|
||||
Vue.prototype.$msg = messageSuccess
|
||||
|
||||
/* eslint-disable no-new */
|
||||
|
||||
@ -78,9 +78,14 @@ export function departGetForm (arr = []) {
|
||||
|
||||
export function handleInput (form) {
|
||||
let value = this[form.split('.')[0]][form.split('.')[1]]
|
||||
console.log('value: ', typeof value)
|
||||
if (String(value).split('.').length > 2) value = String(parseFloat(value))
|
||||
const a = Number(value) > 100 ? 0 : value.replace(/[^.\d]/g, '')
|
||||
this[form.split('.')[0]][form.split('.')[1]] = String(a) || 0
|
||||
this[form.split('.')[0]][form.split('.')[1]] = String(a)
|
||||
}
|
||||
|
||||
export function handleBlur (form) {
|
||||
this[form.split('.')[0]][form.split('.')[1]] = this[form.split('.')[0]][form.split('.')[1]] || '0'
|
||||
}
|
||||
|
||||
export function messageSuccess (params) {
|
||||
|
||||
@ -96,7 +96,7 @@
|
||||
<el-input size="small" clearable :rows="24" type="textarea" v-model="formIndicators.keyResult"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="权重" prop="weight">
|
||||
<el-input size="small" @input.native="$handleInputInt('formIndicators.checkWeight')" clearable v-model="formIndicators.checkWeight">
|
||||
<el-input size="small" @blur="$handleBlur('formIndicators.checkWeight')" @input.native="$handleInputInt('formIndicators.checkWeight')" v-model="formIndicators.checkWeight">
|
||||
<template slot="append">%</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
@ -331,7 +331,7 @@ export default {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
&-content{
|
||||
width: 1360px;
|
||||
padding: 0 80px;
|
||||
margin: 0 auto;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
<div style="padding:20px 0 0 0 ">
|
||||
<span>评分权重:</span>
|
||||
<div style="padding:10px 0 0 20px">
|
||||
<el-input @input.native="$handleInputInt('itemInfo.weight1')" style="width:200px;" size="small" v-model="itemInfo.weight1">
|
||||
<el-input @blur="$handleBlur('itemInfo.weight1')" @input.native="$handleInputInt('itemInfo.weight1')" style="width:200px;" size="small" v-model="itemInfo.weight1">
|
||||
<template slot="append">%</template>
|
||||
</el-input>
|
||||
</div>
|
||||
|
||||
@ -164,7 +164,7 @@
|
||||
<el-radio :label="0">不限权重</el-radio>
|
||||
<el-radio :label="1">自定义</el-radio>
|
||||
</el-radio-group>
|
||||
<el-input @input.native="$handleInputInt('form.weight')" size="small" style="width:160px;'" v-if="weight!==0" v-model="form.weight">
|
||||
<el-input @blur="$handleBlur('form.weight')" @input.native="$handleInputInt('form.weight')" size="small" style="width:160px;'" v-if="weight!==0" v-model="form.weight">
|
||||
<template slot="append">%</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
@ -190,7 +190,7 @@
|
||||
<el-input size="small" resize='vertical' :rows="24" clearable type="textarea" v-model="formIndicators.keyResult"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="权重" prop="weight">
|
||||
<el-input size="small" @input.native="$handleInputInt('formIndicators.weight')" v-model="formIndicators.weight">
|
||||
<el-input size="small" @blur="$handleBlur('formIndicators.weight')" @input.native="$handleInputInt('formIndicators.weight')" v-model="formIndicators.weight">
|
||||
<template slot="append">%</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
@ -227,7 +227,10 @@ export default {
|
||||
weight: 0,
|
||||
// 整个info
|
||||
info: info,
|
||||
form: {}, // 控制维度管理的表单
|
||||
form: {
|
||||
weight: '',
|
||||
maxCount: ''
|
||||
}, // 控制维度管理的表单
|
||||
rules: {
|
||||
name: [{ required: true,
|
||||
message: '请输入维度名称',
|
||||
@ -338,7 +341,9 @@ export default {
|
||||
// 添加考核维度
|
||||
handleAdd () {
|
||||
this.form = {
|
||||
type: this.dimensionsList.length > 0 ? this.dimensionsList[0].id : ''
|
||||
type: this.dimensionsList.length > 0 ? this.dimensionsList[0].id : '',
|
||||
weight: '',
|
||||
maxCount: ''
|
||||
}
|
||||
this.weiduTitle = '添加维度'
|
||||
this.show = true
|
||||
@ -412,7 +417,8 @@ export default {
|
||||
this.zanshi = item
|
||||
this.zhibiaoTitle = '添加指标'
|
||||
this.formIndicators = {
|
||||
zhibiao: item.type
|
||||
zhibiao: item.type,
|
||||
weight: ''
|
||||
}
|
||||
this.showIndicators = true
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user