b441010d
yangzhi
超哥牛批 超时yyds
|
1
|
<template>
|
94c54e92
周超
1
|
2
|
<el-dialog title="维度编辑" :visible.sync="dialogFormVisible" @closed="handleclose" width="75%">
|
f7d4b60e
周超
完成维度编辑
|
3
4
5
|
<el-form :model="data">
<el-form-item label="名称">
<el-input v-model="data.ClassificationName"></el-input>
|
b441010d
yangzhi
超哥牛批 超时yyds
|
6
|
</el-form-item>
|
f7d4b60e
周超
完成维度编辑
|
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
|
<el-form-item label="规则">
<div style="padding:10px 5px 0px 5px">
<el-table v-if="data.rules" :data="data.rules" style="width: 100%;">
<el-table-column align="left" label="状态">
<template slot-scope="{row}">
<div style="display: flex;">
<el-input placeholder="请输入标题" v-model="row.DimensionTitle"></el-input>
<div style="width:60px;margin-left:5px;padding-top:3px">
<el-button type="text" style="font-size:16px" size="mini" icon="el-icon-circle-plus-outline"
@click="addtablerow(row.sort,data)"></el-button>
<el-button type="text" style="font-size:16px;margin-left:5px" size="mini"
icon="el-icon-remove-outline" @click="deltablerow(row.sort,data)"></el-button>
</div>
</div>
</template>
</el-table-column>
<el-table-column align="center" label="计分规则">
<template slot-scope="{row}">
<el-select style="width:16%;margin-right:1%" v-model="row.ScoreType" placeholder="计分类型" clearable>
<el-option :value="1" label="按照总分"> 按照总分 </el-option>
<el-option :value="2" label="按照平均分"> </el-option>
</el-select>
<el-select style="width:18%;margin-right:1%" v-model="row.StartFormula" placeholder="规则" clearable>
<el-option v-for="item in ruleOptions" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
<el-input style="width:20%;margin-right:1%" type="number" v-model="row.StartScore"
:placeholder="'开始分值'">
</el-input>
<el-select style="width:18%;margin-right:1%" v-model="row.EndFormula" placeholder="规则" clearable>
<el-option v-for="item in ruleOptions" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
<el-input style="width:22%" v-model="row.EndScore" type="number" :placeholder="'结束分值'"></el-input>
</template>
</el-table-column>
<el-table-column align="center" width="50" label="排序">
<template slot-scope="{row}">
<el-button v-if="row.sort > 0" type="text" size="small" icon="el-icon-top"
@click="tablesort(0,row.sort,data)">
</el-button>
<el-button v-if="row.sort < (data.rules.length-1) && data.rules.length >1" type="text" size="small"
icon="el-icon-bottom" @click="tablesort(1,row.sort,data)"></el-button>
</template>
</el-table-column>
</el-table>
<div>
<el-collapse v-model="activeName" accordion>
<el-collapse-item v-for="(citem,index) in data.rules" :title="citem.DimensionTitle" :name="index"
:key="index">
<div>
<div style="width:100%;margin-top:10px;color:#409EFF;">
分值解析
</div>
<div style="display: flex;">
<div style="width:50%">
<tinymce ref="content" v-model="citem.DimensionContent" :height="650" />
</div>
<div style="width:50%;padding:0px 20px" v-html="citem.DimensionContent">
</div>
</div>
</div>
</el-collapse-item>
</el-collapse>
</div>
</div>
|
b441010d
yangzhi
超哥牛批 超时yyds
|
85
86
87
88
|
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
f7d4b60e
周超
完成维度编辑
|
89
|
<el-button type="primary" @click="handleSave">确 定</el-button>
|
b441010d
yangzhi
超哥牛批 超时yyds
|
90
91
92
93
|
</div>
</el-dialog>
</template>
<script>
|
f7d4b60e
周超
完成维度编辑
|
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
|
import Tinymce from '@/components/Tinymce'
import {
EditQuestionClass,
getQuestionClass,
} from "@/api/QuestionClass";
export default {
components: {
Tinymce
},
props: {
model: {
type: Object,
default() {
return {};
}
},
},
data() {
return {
data: {
scoring_type: 0
|
b441010d
yangzhi
超哥牛批 超时yyds
|
121
|
},
|
f7d4b60e
周超
完成维度编辑
|
122
123
124
|
activeName: '',
dialogFormVisible: false,
form: {},
|
4ee13894
周超
给大志哥
|
125
|
|
f7d4b60e
周超
完成维度编辑
|
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
ruleOptions: [
{ label: '大于', value: '>' },
{ label: '小于', value: '<' },
{ label: '大于等于', value: '>=' },
{ label: '小于等于', value: '<=' },
{ label: '等于', value: '=' },
],
evalutionRules: [
{
id: '',
QuestionClassId: 0,
DimensionTitle: '',
DimensionContent: '',
StartScore: '',
StartFormula: '',
EndScore: '',
EndFormula: '',
ScoreType: 1
}
],
};
|
b441010d
yangzhi
超哥牛批 超时yyds
|
147
|
},
|
f7d4b60e
周超
完成维度编辑
|
148
149
150
151
152
153
154
155
156
157
158
159
160
|
watch: {
model: {
deep: true,
handler(val) {
this.form = val;
}
}
},
created() {
// this.show();
},
methods: {
|
94c54e92
周超
1
|
161
162
163
164
|
handleclose(){
this.dialogFormVisible = false;
this.$emit('close',this.data);
},
|
f7d4b60e
周超
完成维度编辑
|
165
166
167
168
169
170
171
172
173
174
|
handleSave() {
if (!this.data.ClassificationName) {
this.$message.warning('请填写名称!', "消息");
return;
}
this.data.ClassType = 2;//默认维度
EditQuestionClass(this.data).then(res => {
if (res.data.code == 200) {
this.$message.success('保存成功!', "消息");
this.dialogFormVisible = false;
|
94c54e92
周超
1
|
175
|
this.$emit('save',this.data);
|
f7d4b60e
周超
完成维度编辑
|
176
177
|
this.data = {
rules: [
|
b441010d
yangzhi
超哥牛批 超时yyds
|
178
|
{
|
f7d4b60e
周超
完成维度编辑
|
179
180
181
182
183
184
185
186
187
|
QuestionClassId: 0,
DimensionTitle: '',
DimensionContent: '',
StartScore: '',
StartFormula: '',
EndScore: '',
EndFormula: '',
ScoreType: 1,
sort: 0
|
b441010d
yangzhi
超哥牛批 超时yyds
|
188
|
}
|
f7d4b60e
周超
完成维度编辑
|
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
|
]
};
}
else {
this.$message.error('保存失败!', "消息");
}
});
},
addtablerow(index, row) {
row.rules.splice(index + 1, 0, { sort: index + 1, id: (new Date().valueOf() + 1).toString(), ScoreType: 1 })
this.sortdata(index + 1)
},
deltablerow(index, row) {
if (row.rules.length <= 1) return;
row.rules.splice(index, 1)
var sort = index - 1;
if (sort < 0) sort = 0;
this.sortdata(sort)
},
tablesort(type, index, row) {
if (type == 0) { //-
var prevsort = row.rules[index - 1].sort;
row.rules[index - 1].sort = row.rules[index].sort;
row.rules[index].sort = prevsort;
row.rules = row.rules.sort((a, b) => {
return a.sort - b.sort;
});
}
else { //+
var prevsort = row.rules[index + 1].sort;
row.rules[index + 1].sort = row.rules[index].sort;
row.rules[index].sort = prevsort;
row.rules = row.rules.sort((a, b) => {
return a.sort - b.sort;
});
}
},
sortdata(index) {
try {
var tmp = index;
var data = this.tableData;
data = data.forEach((e, itemindex) => {
if (itemindex > index) {
tmp++;
e.sort = tmp;
}
});
this.tableData = tmpdata
} catch (e) { }
},
show(id) {
|
e011bf15
周超
我先走一步
|
246
|
this.data = {
|
f7d4b60e
周超
完成维度编辑
|
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
|
// id: Date.parse(new Date()) + '_' + Math.ceil(Math.random() * 99999),
// key: Date.parse(new Date()) + '_' + Math.ceil(Math.random() * 99999),
rules: [
{
QuestionClassId: 0,
DimensionTitle: '',
DimensionContent: '',
StartScore: '',
StartFormula: '',
EndScore: '',
EndFormula: '',
ScoreType: 1,
sort: 0
}
]
};
|
e011bf15
周超
我先走一步
|
263
264
|
if (id) {
|
f7d4b60e
周超
完成维度编辑
|
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
|
this.dialogFormVisible = true;
getQuestionClass({ id }).then(res => {
if (res) {
var data = res.data.data;
if (!data.rules) {
data.rules = [
{
QuestionClassId: 0,
DimensionTitle: '',
DimensionContent: '',
StartScore: '',
StartFormula: '',
EndScore: '',
EndFormula: '',
ScoreType: 1,
sort: 0
}
];
}
this.data = data;
|
b441010d
yangzhi
超哥牛批 超时yyds
|
287
|
}
|
f7d4b60e
周超
完成维度编辑
|
288
|
});
|
b441010d
yangzhi
超哥牛批 超时yyds
|
289
|
}
|
f7d4b60e
周超
完成维度编辑
|
290
291
292
293
294
|
}
}
}
|
b441010d
yangzhi
超哥牛批 超时yyds
|
295
|
</script>
|