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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
<template>
<div class="condition">
<div class="none-label mar-bottom10">
<a-button type="primary" @click="editConditionData(null)">
<Icon name="ssiadd" :size="14" />新增条件
</a-button>
</div>
<a-table
:columns="columns"
:locale="{ emptyText: 'No Data' }"
:data-source="conditionList"
row-key="id"
:pagination="false"
>
<template slot="operation" slot-scope="record">
<a-button type="link" @click.stop="editConditionData(record)">修改</a-button>
<a-popconfirm
title="你确定要删除吗?"
ok-text="确定"
cancel-text="取消"
@confirm="deleteData(record)"
>
<a-button type="link" class="danger">删除</a-button>
</a-popconfirm>
</template>
</a-table>
<a-modal
title="条件管理"
v-model="isConditionEditShow"
:footer="null"
@cancel="cancel"
>
<a-form-model ref="editForm" layout="vertical" :model="editForm" :rules="editRule">
<a-form-model-item label="保障限制" prop="frequencyCode">
<a-select v-model="editForm.frequencyCode" show-search allow-clear :filterOption="filterCode">
<a-select-option v-for="item in frequencyCode" :key="item.frequencyCode + item.frequencyDesc" :value="item.frequencyCode">
{{ item.frequencyDesc }}
</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item label="保障福利" prop="limitCode">
<a-select v-model="editForm.limitCode" show-search allow-clear :filterOption="filterCode">
<a-select-option v-for="item in limitCode" :key="item.limitCode + item.limitDesc" :value="item.limitCode">
{{ item.limitDesc }}
</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item label="福利限制">
<a-input-number v-model="editForm.maxValue"> </a-input-number>
</a-form-model-item>
<!-- <a-form-model-item label="开始时间" prop="startDate">
<a-date-picker v-model="editForm.startDate" placeholder="请选择开始时间" value-format="YYYY-MM-DD 00:00:00"></a-date-picker>
</a-form-model-item>
<a-form-model-item label="结束时间" prop="endDate">
<a-date-picker v-model="editForm.endDate" placeholder="请选择结束时间" value-format="YYYY-MM-DD 00:00:00"></a-date-picker>
</a-form-model-item> -->
<!-- <a-row :gutter="10">
<a-col :span="8">
<a-form-model-item label="年限额">
<a-input-number v-model="editForm.minValue"> </a-input-number>
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="最大值">
<a-input-number v-model="editForm.maxValue"> </a-input-number>
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="赔付比率">
<a-input-number v-model="editForm.familyMaxValue">
</a-input-number>
</a-form-model-item>
</a-col>
</a-row> -->
<a-form-model-item label="币种">
<a-select v-model="editForm.currency" show-search allow-clear :filterOption="filterCode">
<a-select-option v-for="item in currencyCode" :key="item.code + item.name" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-model-item>
<!-- <a-form-model-item label="状态">
<a-select
v-model="editForm.status"
show-search
allow-clear
:filterOption="filterCode"
>
<a-select-option
v-for="item in statusCode"
:key="item.code"
:value="item.code"
>
{{ item.name }}
</a-select-option>
</a-select>
</a-form-model-item> -->
<a-form-model-item label="备注" prop="remark">
<a-textarea v-model="editForm.remark" :autoSize="{ minRows: 2, maxRows: 5 }"></a-textarea>
</a-form-model-item>
<a-form-model-item class="text-r">
<a-button type="primary" @click="saveConditionData">
<Icon name="ssiadd" :size="14" />保存
</a-button>
<a-button class="mar-left10" @click="cancel">取消</a-button>
</a-form-model-item>
</a-form-model>
</a-modal>
</div>
</template>
<script>
export default {
props: {
formData: {
type: Object,
required: true,
},
},
data() {
const columns = [
{ title: "条件类型", dataIndex: "frequencyDesc" },
{ title: "条件内容", dataIndex: "limitDesc" },
{ title: "状态", dataIndex: "status", customRender: (val) => {
for(let i = 0; i < this.statusCode.length; i ++) {
if (val === this.statusCode[i].code) {
return this.statusCode[i].name
}
}
return val;
} },
// { title: "限额或限次", dataIndex: "index" },
{ title: "最大值", dataIndex: "maxValue", customRender: (val, row) => {
if (row.limitCode.indexOf('07') === 0) {
return val + '%'
}
return val
} },
{ title: "备注", dataIndex: "remark" },
{
title: "操作",
key: "operation",
width: "175px",
fixed: "right",
align: 'center',
scopedSlots: { customRender: "operation" },
},
];
return {
columns,
conditionList: [],
isConditionEditShow: false,
editForm: {},
frequencyCode: [],
limitCode: [],
currencyCode: [
{ code: "RMB", name: "人民币" },
{ code: "US", name: "美金" },
],
statusCode: [
{ code: "1", name: "有效" },
{ code: "2", name: "无效" },
],
editRule: {
frequencyCode: [{ required: true, message: "请选择限额" }],
limitCode: [{ required: true, message: "请选择保障福利" }],
},
};
},
mounted() {
this._getConditionList();
},
methods: {
// 选择框筛选
filterCode(input, option) {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
editConditionData(data) {
const { planCode, payorCode, coverageCode, corpCode, benefitCode, conditionType } = this.formData;
data = data || {
planCode,
payorCode,
coverageCode,
corpCode,
benefitCode,
conditionType,
currency: "RMB",
status: "1",
};
this.editForm = this.$lodash.cloneDeep(data);
this._getFrequencyCode();
this._getLimitCode();
this.isConditionEditShow = true;
},
saveConditionData() {
this.$refs.editForm.validate((valid) => {
if (!valid) {
return false;
}
if (this.editForm.id || this.editForm.id === 0) {
this._editConditionData(this.editForm);
} else {
this._addConditionData(this.editForm);
}
});
},
cancel() {
this.$refs.editForm.resetFields();
this.isConditionEditShow = false;
},
deleteData(record) {
const data = this.$lodash.cloneDeep(record);
data.status = "2"; // 置为无效状态即删除
this._editConditionData(data);
},
_getConditionList() {
const { planCode, payorCode, coverageCode, corpCode, benefitCode, conditionType } = this.formData;
const data = { planCode, payorCode, coverageCode, corpCode, benefitCode, conditionType };
this.$apis.GETCONDITIONLIST(data).then((res) => {
this.conditionList = res.content || [];
});
},
_getFrequencyCode() {
if (this.frequencyCode && this.frequencyCode.length) {
return true;
}
this.$apis.GETFREQUENCYCODE().then((res) => {
this.frequencyCode = res.content || [];
});
},
_getLimitCode() {
if (this.limitCode && this.limitCode.length) {
return true;
}
this.$apis.GETLIMITCODE().then((res) => {
this.limitCode = res.content || [];
});
},
_addConditionData(data) {
this.$apis.ADDCONDITIONDATA(data).then((res) => {
if (res.returnCode === "0000") {
this._getConditionList();
this.$message.success(res.returnMsg || "操作成功");
this.isConditionEditShow = false;
} else {
this.$message.error(res.returnMsg || "操作失败");
}
});
},
_editConditionData(data) {
this.$apis.EDITCONDITIONDATA(data).then((res) => {
if (res.returnCode === "0000") {
this._getConditionList();
this.$message.success(res.returnMsg || "操作成功");
this.isConditionEditShow = false;
} else {
this.$message.error(res.returnMsg || "操作失败");
}
});
},
},
};
</script>
<style lang="less" scoped>
.condition {
.pa(0, 20, 10, 20);
background-color: #fff;
}
</style>