Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sgaqgl-vue
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李苏
sgaqgl-vue
Commits
82d4af61
Commit
82d4af61
authored
Dec 15, 2022
by
李苏
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
多选转化bug
parent
059dafaa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
149 additions
and
11 deletions
+149
-11
edit.vue
src/views/train/questionManage/edit.vue
+78
-11
transSelect.vue
src/views/train/questionManage/transSelect.vue
+71
-0
No files found.
src/views/train/questionManage/edit.vue
View file @
82d4af61
<
template
>
<
template
>
<RelDialog
:type=
'type'
:editApp=
'editApp'
:app=
'app'
:buttonApp=
'buttonApp'
>
<RelDialog
:type=
'type'
:editApp=
'editApp'
:app=
'app'
:buttonApp=
'buttonApp'
>
<!-- 填写表单内容,slot=form必写-->
<!-- 填写表单内容,slot=form必写-->
<el-form
slot=
"form"
ref=
"form"
:model=
"form"
label-width=
"80px"
:rules=
"rules"
>
<el-form
slot=
"form"
ref=
"form"
:model=
"form"
label-width=
"80px"
:rules=
"rules"
>
<el-row
:gutter=
"20"
>
<el-col
:span=
"24"
>
<el-form-item
label=
"题目 "
ref=
"cont"
prop=
"cont"
>
<el-input
:readonly=
"readonly"
v-model=
"form.cont"
></el-input>
<el-row
:gutter=
"20"
>
<el-col
:span=
"24"
>
<el-form-item
label=
"题目 "
ref=
"cont"
prop=
"cont"
>
<el-input
:readonly=
"readonly"
v-model=
"form.cont"
></el-input>
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
</el-col>
</el-col>
</el-row>
</el-row>
<el-row
:gutter=
"20"
v-show=
"this.form.type=='S'||this.form.type=='M'"
>
<el-col
:span=
"12"
>
<el-row
:gutter=
"20"
v-show=
"this.form.type=='S'||this.form.type=='M'"
>
<el-col
:span=
"12"
>
<el-form-item
label=
"选项A"
ref=
"opta"
prop=
"opta"
>
<el-form-item
label=
"选项A"
ref=
"opta"
prop=
"opta"
>
<el-input
:readonly=
"readonly"
v-model=
"form.opta"
></el-input>
</el-form-item>
</el-col>
<el-input
:readonly=
"readonly"
v-model=
"form.opta"
></el-input>
</el-form-item>
</el-col>
...
@@ -50,15 +50,47 @@
...
@@ -50,15 +50,47 @@
</el-form-item>
</el-form-item>
</el-col>
</el-col>
<el-col
:span=
"24"
>
<el-col
:span=
"24"
>
<el-form-item
label=
"答案"
ref=
"ans"
prop=
"ans"
>
<el-form-item
v-show=
"this.form.type"
label=
"答案"
ref=
"ans"
prop=
"ans"
>
<el-input
:readonly=
"readonly"
v-model=
"form.ans"
></el-input>
<!--
<el-input
:readonly=
"readonly"
v-model=
"form.ans"
></el-input>
-->
<!-- 填空题-->
<el-input
v-show=
"this.form.type=='F'"
type=
"textarea"
:readonly=
"readonly"
v-model=
"form.ans"
></el-input>
<!-- 单选题-->
<el-select
style=
"width: 100%;"
v-show=
"this.form.type=='S'"
v-model=
"form.ans"
placeholder=
"请选择"
>
<el-option
v-for=
"item in soptions"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
<!-- 判断题-->
<el-select
style=
"width: 100%;"
v-show=
"this.form.type=='J'"
v-model=
"form.ans"
placeholder=
"请选择"
>
<el-option
v-for=
"item in joptions"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
<!-- 多选题-->
<TransSelect
v-if=
"this.form.type=='M'"
v-model=
"form.ans"
/>
<!--
<el-select
style=
"width: 100%;"
multiple
v-model=
"form.ans"
placeholder=
"请选择"
>
<el-option
v-for=
"item in moptions"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
-->
</el-form-item>
</el-form-item>
</el-col>
</el-col>
</el-row>
</el-row>
<el-row
:gutter=
"20"
>
<el-row
:gutter=
"20"
>
<el-col
:span=
"24"
>
<el-col
:span=
"24"
>
<el-form-item
label=
"答案描述"
ref=
"desc"
prop=
"desc"
>
<el-form-item
label=
"答案描述"
ref=
"desc"
prop=
"desc"
>
<el-input
type=
"textarea"
:readonly=
"readonly"
v-model=
"form.desc"
></el-input>
<el-input
type=
"textarea"
:readonly=
"readonly"
v-model=
"form.desc"
></el-input>
</el-form-item>
</el-form-item>
</el-col>
</el-col>
<el-col
:span=
"24"
>
<el-col
:span=
"24"
>
...
@@ -70,7 +102,8 @@
...
@@ -70,7 +102,8 @@
</el-form>
</el-form>
</RelDialog>
</RelDialog>
</
template
>
</
template
>
<
script
>
<
script
>
import
TransSelect
from
'./transSelect.vue'
import
{
import
{
editMixin
editMixin
}
from
'common'
}
from
'common'
...
@@ -78,14 +111,44 @@
...
@@ -78,14 +111,44 @@
mixins
:
[
editMixin
],
mixins
:
[
editMixin
],
/* 存放index页面传递的额外参数*/
/* 存放index页面传递的额外参数*/
mounted
()
{
mounted
()
{
/* form.ans拦截*/
},
},
/* 组件名称*/
/* 组件名称*/
name
:
"pxglPxstEdit"
,
name
:
"pxglPxstEdit"
,
/* 传递props模式一样必填,用于index,button,REdialog之间的组件通信*/
/* 传递props模式一样必填,用于index,button,REdialog之间的组件通信*/
computed
:{
typess
(){
return
this
.
form
.
type
}
},
watch
:{
typess
(){
if
(
this
.
type
==
'add'
){
this
.
form
.
ans
=
''
}
}
},
data
()
{
data
()
{
return
{
return
{
// moptions:[
// {value:'A',label:'A'},
// {value:'B',label:'B'},
// {value:'C',label:'C'},
// {value:'D',label:'D'},
// {value:'E',label:'E'},
// {value:'F',label:'F'}
// ],
mtrans
:
''
,
soptions
:[
{
value
:
'A'
,
label
:
'A'
},
{
value
:
'B'
,
label
:
'B'
},
{
value
:
'C'
,
label
:
'C'
},
{
value
:
'D'
,
label
:
'D'
}
],
joptions
:[
{
value
:
'A'
,
label
:
'正确'
},
{
value
:
'B'
,
label
:
'错误'
},
],
/* 额外初始化,根据需求*/
/* 额外初始化,根据需求*/
systemType
:
[],
systemType
:
[],
...
@@ -133,10 +196,14 @@
...
@@ -133,10 +196,14 @@
required
:
true
required
:
true
},
],
},
],
ans
:
[{
ans
:
[{
required
:
true
required
:
true
,
message
:
'请填写答案'
},
]
},
]
}
}
}
}
},
components
:{
TransSelect
},
},
methods
:
{
methods
:
{
...
...
src/views/train/questionManage/transSelect.vue
0 → 100644
View file @
82d4af61
<
template
>
<el-select
@
change=
'change'
style=
"width: 100%;"
v-model=
"newValue"
multiple
placeholder=
"请选择"
>
<el-option
v-for=
"item in moptions"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
</
template
>
<
script
>
export
default
{
props
:[
'value'
],
watch
:{
'value'
:{
handler
:
function
(
val
)
{
if
(
val
){
this
.
newValue
=
val
.
split
(
','
)
}
},
deep
:
true
,
// 立即以obj.name的当前值触发回调
immediate
:
true
},
// value(val){
// console.log(val,'val改变')
// if(val){
// if(typeof val!='object')
// this.newValue=val.split(',')
// }
// }
},
data
(){
return
{
newValue
:
''
,
moptions
:[
{
value
:
'A'
,
label
:
'A'
},
{
value
:
'B'
,
label
:
'B'
},
{
value
:
'C'
,
label
:
'C'
},
{
value
:
'D'
,
label
:
'D'
},
{
value
:
'E'
,
label
:
'E'
},
{
value
:
'F'
,
label
:
'F'
}
],
}
},
methods
:{
change
(
val
){
console
.
log
(
this
.
value
)
let
value
=
val
.
sort
((
s1
,
s2
)
=>
{
let
a1
=
s1
.
toUpperCase
();
let
a2
=
s2
.
toUpperCase
();
if
(
a1
<
a2
)
{
return
-
1
;
}
if
(
a1
>
a2
)
{
return
1
;
}
return
0
;
}).
join
(
','
)
this
.
$emit
(
'input'
,
value
)
}
}
}
</
script
>
<
style
>
</
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment