1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
| <template>
| <GlobalAlertWindow
| :title="title"
| :visible.sync="visible"
| :confirm-working="isWorking"
| @confirm="confirm"
| width="500px"
| >
| <el-form :model="form" ref="form" label-suffix=":" :rules="rules" label-width="150px">
| <el-form-item label="评分等级" prop="name">
| <el-input v-model="form.name" placeholder="请输入评分等级" />
| </el-form-item>
| <el-form-item label="评分上限(不包含)" prop="maxNum">
| <el-input v-model="form.maxNum" @input="numInput(form, 'maxNum')" placeholder="请输入评分上限" />
| </el-form-item>
| <el-form-item label="评分系数(%)" prop="ratio">
| <el-input v-model="form.ratio" @input="numInput(form, 'ratio')" placeholder="请输入评分系数" />
| </el-form-item>
|
| </el-form>
| </GlobalAlertWindow>
| </template>
|
| <script>
| import BaseOpera from '@/components/base/BaseOpera'
| import GlobalAlertWindow from '@/components/common/GlobalAlertWindow'
| import { create } from '@/api/business/projectRatio'
| // import numRule from ''
| export default {
| name: 'OperaSettingSocreWindow',
| extends: BaseOpera,
| components: { GlobalAlertWindow },
| data () {
|
| return {
| // 表单数据
| form: {
| id: null,
| projectId: null,
| ratio: null,
| name: null,
| maxNum: null,
| minNum: null,
| sortnum: 1
| },
| // 验证规则
| rules: {
| name: [
| { required: true, message: '请输入评分等级', trigger: 'blur' },
| ],
| maxNum: [
| { required: true, message: '请输入评分上限', trigger: 'blur' },
| ],
| ratio: [
| { required: true, message: '请输入评分系数', trigger: 'blur' },
| ],
| }
| }
| },
| created () {
| this.config({
| api: '/business/projectRatio',
| 'field.id': 'id'
| })
| },
| methods: {
| inputZAction(item, key) {
| // item[key] = item[key].replace(/[0], '')
| // item[key]=item[key].replace(/0|[^\d]+/g, '')
| if (item[key]>=1) {
| item[key] = 1
| return
| }
| item[key] = item[key].replace(/[^\d.]/g, '') //清楚数字和.以外的字符
| .replace(/\.{2,}/g, '.')
| .replace('.', '$#$')
| .replace(/\./g, '')
| .replace('$#$', '.')
| .replace(/^(\-)*(\d+)\.(\d).*$/, '$1$2.$3')
| .replace(/^\./g, '')
| },
| numInput(item, key) {
| // =""
| if (item[key] < 0) {
| item[key] = ''
| }
| item[key]=item[key].replace(/[^\d]+/g, '')
| console.log(item[key]);
| },
| },
| }
|
| </script>
|
| <style lang="scss" scoped>
| @import "@/assets/style/alertstyle.scss";
| // .num-input {
| // display: flex;
| // .el-form-item--small.el-form-item{
| // margin-bottom: 0;
| // }
| // }
| </style>
|
|