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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<template>
<a-spin :spinning="confirmLoading">
<j-form-container :disabled="formDisabled">
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-row>
<a-col :span="24">
<a-form-model-item label="分利规则名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ruleName">
<a-input v-model="model.ruleName" placeholder="请输入分利规则名称"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="总平台分利" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="saasBenefits">
<a-input-number
v-model="model.saasBenefits"
:min="0"
:max="99"
:precision="2"
:formatter="value => value ? `${value}%` : ''"
:parser="value => value.replace('%', '')"
style="width:100%"
/>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="物业小区分利" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="communityBenefits">
<a-input-number
v-model="model.communityBenefits"
:min="0"
:max="99"
:precision="2"
:formatter="value => value ? `${value}%` : ''"
:parser="value => value.replace('%', '')"
style="width:100%"
/>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="商铺收益" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input-number
v-model="shopBenefits"
:min="0"
:max="99"
:precision="2"
:formatter="value => value ? `${value}%` : ''"
:parser="value => value.replace('%', '')"
style="width:100%"
disabled
/>
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</j-form-container>
</a-spin>
</template>
<script>
import { editShareRuleDetailApi } from '@/api/api'
export default {
name: 'PropertyChargruleForm',
components: {
},
props: {
//表单禁用
disabled: {
type: Boolean,
default: false,
required: false
}
},
data () {
return {
model:{
ruleName: '',
saasBenefits: '',
communityBenefits: ''
},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules: {
ruleName: [{ required: true, message: '请输入收费名称', trigger: 'blur' }],
saasBenefits: [{ required: true, message: '请输入授权日期', trigger: 'blur' }],
communityBenefits: [{ required: true, message: '请输入授权小区数量', trigger: 'blur' }]
},
url: {
add: "/property-central/property/propertyChargrule/add",
edit: "/property-central/property/propertyChargrule/edit",
queryById: "/property-central/property/propertyChargrule/queryById"
},
dictOptions: []
}
},
computed: {
formDisabled(){
return this.disabled
},
shopBenefits() {
return 100 - (this.model.saasBenefits || 0) - (this.model.communityBenefits || 0)
}
},
created () {
//备份model原始值
this.modelDefault = JSON.parse(JSON.stringify(this.model));
},
methods: {
edit (record) {
console.log(record)
this.model = Object.assign({}, record);
this.visible = true;
},
submitForm () {
this.$refs.form.validate(valid => {
if (valid) {
this.confirmLoading = true;
editShareRuleDetailApi({...this.model}).then(res=> {
this.$message.success(res.message);
this.$emit('ok');
}).finally(err=> {
this.confirmLoading = false
})
}
})
}
}
}
</script>