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
280549fe
Commit
280549fe
authored
Dec 14, 2022
by
李苏
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
试题管理
parent
a40007f4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
360 additions
and
105 deletions
+360
-105
examination.js
src/api/train/examination.js
+17
-0
dtl.vue
src/views/train/paperManagement/dtl.vue
+47
-34
dtlEdit.vue
src/views/train/paperManagement/dtlEdit.vue
+295
-70
index.vue
src/views/train/paperManagement/index.vue
+1
-1
No files found.
src/api/train/examination.js
View file @
280549fe
...
@@ -89,6 +89,23 @@ export function doInitXtms(query) {
...
@@ -89,6 +89,23 @@ export function doInitXtms(query) {
})
})
}
}
/* 新查询细节 */
export
function
donDtlQuery
(
query
)
{
return
request
({
url
:
'/aqgl/pxgl/pxsj/query/detail'
,
method
:
'post'
,
data
:
query
||
{}
})
}
/* 新报存 */
export
function
donDtlSave
(
query
)
{
return
request
({
url
:
'/aqgl/pxgl/pxsj/save'
,
method
:
'post'
,
data
:
query
||
{}
})
}
...
...
src/views/train/paperManagement/dtl.vue
View file @
280549fe
<
template
>
<
template
>
<DefaultDialog
:app=
'app'
>
<DefaultDialog
:app=
'app'
>
<div
class=
"min_full"
slot=
'form'
style=
"height: 80vh;border: 0px;"
>
<!-- 查询条件-->
<div
class=
"min_full"
slot=
'form'
style=
"height: 550px;border: 0px;"
>
<div
class=
"search"
v-condition
>
<DtlEdit
:app=
'this'
v-if=
"showDialog"
></DtlEdit>
<SearchButton
:app=
'this'
></SearchButton>
<el-row
:gutter=
"20"
class=
"search-row-1"
>
<el-col
:span=
"12"
class=
"search-col"
>
<div
class=
"search-item"
>
<span
class=
"search-span"
>
名称:
</span>
<el-input
v-model=
"queryParams.info"
></el-input>
</div>
</el-col>
</el-row>
</div>
<!-- 按钮操作-->
<!-- 按钮操作-->
<el-row
class=
"tool-bar"
>
<el-row
class=
"tool-bar"
>
<ViewButton
ref=
"view"
:app=
'this'
></ViewButton>
<!--
<ViewButton
ref=
"view"
:app=
'this'
></ViewButton>
<AddButton
ref=
"add"
:app=
'this'
></AddButton>
<AddButton
ref=
"add"
:app=
'this'
></AddButton>
<CopyButton
ref=
"copy"
:app=
'this'
></CopyButton>
<CopyButton
ref=
"copy"
:app=
'this'
></CopyButton>
<EditButton
ref=
"edit"
:app=
'this'
></EditButton>
<EditButton
ref=
"edit"
:app=
'this'
></EditButton>
-->
<el-button
@
click=
"drst"
size=
'mini'
style=
"margin-left: 0px;"
type=
"primary"
>
导入试题
</el-button>
<!-- 额外按钮-->
<!-- 额外按钮-->
<!-- 表头设置 -->
<!-- 表头设置 -->
<!-- 权限-->
<!-- 权限-->
</el-row>
</el-row>
<!-- 表格-->
<!-- 表格-->
<div
class=
"tablePagers"
>
<div
class=
"tablePagers"
style=
"height: 380px;"
>
<TablePager
@
getData=
'getData'
:ref=
"'TablePager'"
:app=
'this'
:query=
'query'
@
selectItem=
'selectItem'
<TablePager
:showPagination=
'false'
@
getData=
'getData'
:ref=
"'TablePager'"
:app=
'this'
:query=
'query'
@
selectItem=
'selectItem'
:delParams=
"'mxid'"
@
getRow=
'getRow'
>
@
getRow=
'getRow'
>
</TablePager>
</TablePager>
...
@@ -38,13 +29,13 @@
...
@@ -38,13 +29,13 @@
<
script
>
<
script
>
/* 引入需要的接口*/
/* 引入需要的接口*/
import
{
import
{
doDtlQuery
,
do
n
DtlQuery
,
doDtlAdd
,
//
doDtlAdd,
doDtlUpdate
,
//
doDtlUpdate,
doDtlDelete
doDtlDelete
}
from
'@/api/train/examination.js'
;
}
from
'@/api/train/examination.js'
;
/* edit页面*/
/* edit页面*/
import
Edit
from
'./dtlEdit.vue'
import
Dtl
Edit
from
'./dtlEdit.vue'
import
{
import
{
tableMixin_noapp
tableMixin_noapp
}
from
'common'
}
from
'common'
...
@@ -55,17 +46,32 @@
...
@@ -55,17 +46,32 @@
/* 初始额外赋值*/
/* 初始额外赋值*/
async
mounted
()
{
async
mounted
()
{
this
.
queryParams
.
mid
=
this
.
app
.
singleItem
.
id
/* 存储试卷数据*/
this
.
queryParams
.
xmid
=
this
.
app
.
singleItem
.
xmid
this
.
sjdata
=
this
.
app
.
singleItem
this
.
$refs
[
'TablePager'
].
pageQuery
()
this
.
queryParams
.
mid
=
this
.
app
.
singleItem
.
id
this
.
queryParams
.
xmid
=
this
.
app
.
singleItem
.
xmid
this
.
$nextTick
(()
=>
{
this
.
$refs
[
'TablePager'
].
pageQuery
()
})
},
},
data
()
{
data
()
{
return
{
return
{
typeObj
:{
'M'
:
'多选题'
,
'S'
:
'单选题'
,
'J'
:
'判断题'
,
'F'
:
'填空题'
},
sjdata
:{},
/*需要的额外参数 */
/*需要的额外参数 */
showDialog
:
false
,
showDialog
:
false
,
DialogName
:
''
,
DialogName
:
''
,
type
:
''
,
type
:
''
,
DialogTitle
:
''
,
DialogWidth
:
'85%'
,
DialogTitle
:
'导入试题'
,
/* 基础url*/
/* 基础url*/
baseUrl
:
'/aqgl/pxgl/pxsjmx'
,
baseUrl
:
'/aqgl/pxgl/pxsjmx'
,
/* 查询参数*/
/* 查询参数*/
...
@@ -75,20 +81,27 @@
...
@@ -75,20 +81,27 @@
/* 表格标题对应参数*/
/* 表格标题对应参数*/
tableTitle
:
[
tableTitle
:
[
// {label: "试卷ID", prop: "mid", fieldType: "ftString",width:192},
// {label: "试卷ID", prop: "mid", fieldType: "ftString",width:192},
{
label
:
"试题"
,
prop
:
"stid"
,
fieldType
:
"ftString"
,
width
:
192
},
{
label
:
"序号"
,
prop
:
"xh"
,
fieldType
:
"int"
,
width
:
60
},
{
label
:
"序号"
,
prop
:
"xh"
,
fieldType
:
"int"
},
{
label
:
"试题"
,
prop
:
"cont"
,
fieldType
:
"ftString"
,
width
:
850
},
{
label
:
"类型"
,
prop
:
"type"
,
formatter
:(
a
,
b
,
c
)
=>
{
let
val
=
this
.
typeObj
[
c
]
return
val
},
width
:
200
},
]
]
}
}
},
},
methods
:
{
methods
:
{
drst
(){
this
.
showDialog
=
true
},
/* 基础查询*/
/* 基础查询*/
query
:
doDtlQuery
,
query
:
do
n
DtlQuery
,
/* 基础增*/
/* 基础增*/
apiAdd
:
doDtlAdd
,
//
apiAdd: doDtlAdd,
/* 基础更新*/
/
/ /
* 基础更新*/
apiUpdate
:
doDtlUpdate
,
//
apiUpdate: doDtlUpdate,
/* 删除操作*/
/
/ /
* 删除操作*/
apiDelete
:
doDtlDelete
,
apiDelete
:
doDtlDelete
,
/* 初始化赋值操作*/
/* 初始化赋值操作*/
init
()
{
init
()
{
...
@@ -96,7 +109,7 @@
...
@@ -96,7 +109,7 @@
}
}
},
},
components
:
{
components
:
{
Edit
,
Dtl
Edit
,
}
}
...
...
src/views/train/paperManagement/dtlEdit.vue
View file @
280549fe
<
template
>
<
template
>
<RelDialog
:type=
'type'
:editApp=
'editApp'
:app=
'app'
:buttonApp=
'buttonApp'
>
<DefaultDialog
:app=
'app'
>
<!-- 填写表单内容,slot=form必写-->
<div
slot=
'form'
class=
"min_full"
style=
"height: 70vh;border: 0px;"
>
<el-form
slot=
"form"
ref=
"form"
:model=
"form"
label-width=
"80px"
:rules=
"rules"
>
<el-row
:gutter=
"20"
>
<div
class=
"search"
v-condition
>
<el-col
:span=
"24"
>
<el-form-item
label=
"类型"
>
<SearchButton
@
click
.
native=
'search'
></SearchButton>
<RelSelect
style=
"width: 100%;"
src=
'aqgl/pxgl/pxsj/init/stlx'
:match=
"
{value:'id',label:'name'}" v-model='type_copy' >
</RelSelect>
<el-row
:gutter=
"20"
class=
"search-row-1"
>
</el-form-item>
</el-col>
<el-col
:span=
"6"
class=
"search-col"
>
</el-row>
<div
class=
"search-item"
>
<el-row
:gutter=
"20"
>
<span
class=
"search-span"
>
类型:
</span>
<el-col
:span=
"24"
>
<RelSelect
filterable
style=
"width: 100%;"
clearable
src=
'aqgl/pxgl/pxst/init/type'
<el-form-item
label=
"试题"
ref=
"stid"
prop=
"stid"
>
:match=
"
{value:'id',label:'name'}" v-model='type'>
</RelSelect>
<RelSelect
linkage
:linkParams=
"
{type:type_copy}" style="width: 100%;" src='aqgl/pxgl/pxst/query' :match="{value:'id',label:'cont'}" v-model='form.stid' >
</RelSelect>
</div>
</el-form-item>
</el-col>
</el-col>
<el-col
:span=
"18"
class=
"search-col"
>
</el-row>
<div
style=
"height: 50px;line-height: 50px;font-size: 12px;width: 450px;"
>
<el-row
:gutter=
"20"
>
填空题(
{{
fcount
}}
/
{{
sjdata
.
fcount
}}
) 单选题(
{{
scount
}}
/
{{
sjdata
.
scount
}}
)多选题(
{{
mcount
}}
/
{{
sjdata
.
mcount
}}
)判断题(
{{
jcount
}}
/
{{
sjdata
.
jcount
}}
)
<el-col
:span=
"24"
>
</div>
<el-form-item
label=
"序号"
ref=
"xh"
prop=
"xh"
>
</el-col>
<el-input
:readonly=
"readonly"
v-model=
"form.xh"
></el-input>
</el-row>
</el-form-item>
</div>
</el-col>
<div
class=
"tablePagers"
>
</el-row>
<el-table
</el-form>
height=
'50vh'
</RelDialog>
v-loading=
"loading"
ref=
"multipleTable"
:data=
"tableData"
@
select=
"selectChange"
@
select-all=
"selectAllChange"
>
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
>
</el-table-column>
<el-table-column
prop=
"cont"
label=
"题目"
align=
"center"
>
</el-table-column>
<el-table-column
prop=
"type"
label=
"类型"
align=
"center"
:formatter=
"transType"
>
</el-table-column>
</el-table>
<el-row
type=
"flex"
class=
"pageBanner"
style=
"padding-top: 20px;"
justify=
"center"
>
<el-pagination
background
:total=
"total"
:page-size=
"pageSize"
@
size-change=
"pageSizeChange"
@
current-change=
"currentPageChange"
:current-page=
"currentPage"
:page-sizes=
"[10, 20, 30]"
layout=
"total, sizes, prev, pager, next, jumper"
>
</el-pagination>
</el-row>
</div>
</div>
<div
slot=
"reFooter"
class=
"refooter"
>
<span
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"save()"
>
导 入
</el-button>
</span>
</div>
</DefaultDialog>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
editMixin
}
from
'common'
import
{
export
default
{
doQuery
,
mixins
:
[
editMixin
],
doAdd
,
/* 存放index页面传递的额外参数*/
doUpdate
,
mounted
()
{
doDelete
,
this
.
$nextTick
(()
=>
{
pxxmQuery
,
this
.
form
.
mid
=
this
.
app
.
queryParams
.
mid
excelimport
})
}
from
'@/api/train/questionManage'
;
},
import
{
/* 组件名称*/
donDtlSave
name
:
"aqgl.pxglPxsjmxEdit"
,
}
from
'@/api/train/examination'
;
/* 传递props模式一样必填,用于index,button,REdialog之间的组件通信*/
data
()
{
return
{
type_copy
:
'S'
,
xmid
:
''
,
/* 额外初始化,根据需求*/
systemType
:
[],
bmList
:
[],
/* 当前表单初始值,默认由RelDialog查询indexQuery赋值,copy时不赋值id,初始化时所有query的值都会赋值给form*/
form
:
{
//ID
id
:
''
,
//试卷ID
mid
:
''
,
//试题ID
stid
:
''
,
//序号
xh
:
''
,
},
/* form提交时的规则,具体规则参考官网*/
rules
:
{
}
}
},
methods
:
{
}
export
default
{
props
:[
'app'
],
data
()
{
return
{
typeObj
:{
'M'
:
'多选题'
,
'S'
:
'单选题'
,
'J'
:
'判断题'
,
'F'
:
'填空题'
},
type
:
''
,
pageSize
:
10
,
// 唯一标识符
id
:
"id"
,
loading
:
false
,
total
:
0
,
currentPage
:
1
,
selectedList
:
[
],
tableData
:
[],
};
},
created
()
{
this
.
sjdata
=
this
.
app
.
sjdata
this
.
selectedList
=
_
.
cloneDeep
(
this
.
app
.
tabData
)
console
.
log
(
this
.
selectedList
,
'传入已选'
)
/* 试题定量*/
/* 单选题*/
/* 多选题*/
/* 判断题*/
/* 填空题*/
},
mounted
()
{
this
.
$nextTick
(()
=>
{
this
.
getData
(
this
.
currentPage
,
this
.
pageSize
);
})
// 页面初始化时,首次加载数据
},
computed
:{
scount
(){
/* 单选数量*/
let
num
=
0
this
.
selectedList
.
forEach
(
item
=>
{
item
.
type
==
'S'
&&
num
++
})
return
num
},
mcount
(){
let
num
=
0
this
.
selectedList
.
forEach
(
item
=>
{
item
.
type
==
'M'
&&
num
++
})
/* 多选数量*/
return
num
},
jcount
(){
let
num
=
0
this
.
selectedList
.
forEach
(
item
=>
{
item
.
type
==
'J'
&&
num
++
})
/* 判断题数量*/
return
num
},
fcount
(){
let
num
=
0
this
.
selectedList
.
forEach
(
item
=>
{
item
.
type
==
'F'
&&
num
++
})
/* 填空题*/
return
num
}
}
</
script
>
},
methods
:
{
transType
(
a
,
b
,
c
){
let
val
=
this
.
typeObj
[
c
]
return
val
},
save
(){
/* 判断*/
if
(
this
.
scount
>
this
.
sjdata
.
scount
){
this
.
$warning
(
'单选题超出试卷允许设置范围'
)
return
}
if
(
this
.
mcount
>
this
.
sjdata
.
mcount
){
this
.
$warning
(
'多选题超出试卷允许设置范围'
)
return
}
if
(
this
.
jcount
>
this
.
sjdata
.
jcount
){
this
.
$warning
(
'判断题超出试卷允许设置范围'
)
return
}
if
(
this
.
fcount
>
this
.
sjdata
.
fcount
){
this
.
$warning
(
'填空题超出试卷允许设置范围'
)
return
}
let
params
=
{
id
:
this
.
sjdata
.
id
,
datas
:
this
.
selectedList
}
donDtlSave
(
params
).
then
(
res
=>
{
if
(
res
.
success
){
this
.
$success
(
'导入成功'
)
this
.
app
.
showDialog
=
false
this
.
app
.
$refs
[
'TablePager'
].
pageQuery
()
}
})
<
style
scoped
lang=
"scss"
>
},
search
(
event
){
event
.
preventDefault
();
this
.
getData
(
this
.
currentPage
,
this
.
pageSize
);
},
// 单行前的勾选状态切换
selectChange
(
selectedRows
,
row
)
{
// true为选中, 0或false为取消选中
let
selected
=
selectedRows
.
length
&&
selectedRows
.
indexOf
(
row
)
!==
-
1
;
if
(
selected
)
{
this
.
addItem
(
row
);
}
else
{
this
.
removeItem
(
row
);
}
},
// 全选/取消全选
selectAllChange
(
selectedRows
)
{
let
selectedMarkList
=
this
.
selectedList
.
map
((
item
)
=>
item
[
this
.
id
]);
// 当前页选中行的标记列表
let
pageSelectedMarkList
=
Array
.
isArray
(
selectedRows
)
?
selectedRows
.
map
((
item
)
=>
item
[
this
.
id
])
:
[];
this
.
tableData
.
forEach
((
row
)
=>
{
if
(
pageSelectedMarkList
.
includes
(
row
[
this
.
id
]))
{
if
(
!
selectedMarkList
.
includes
(
row
[
this
.
id
]))
{
this
.
addItem
(
row
);
}
}
else
if
(
selectedMarkList
.
includes
(
row
[
this
.
id
]))
{
this
.
removeItem
(
row
);
}
});
},
// 切换每页显示条数
pageSizeChange
(
newPageSize
)
{
this
.
pageSize
=
newPageSize
;
this
.
getData
(
this
.
currentPage
,
this
.
pageSize
);
},
// 切换页码--翻页
currentPageChange
(
newPage
)
{
this
.
currentPage
=
newPage
;
this
.
getData
(
this
.
currentPage
,
this
.
pageSize
);
},
// 更新勾选标记
updateMark
()
{
let
selectedMarkList
=
this
.
selectedList
.
map
((
item
)
=>
item
[
this
.
id
]);
this
.
tableData
.
forEach
((
row
)
=>
{
if
(
selectedMarkList
.
includes
(
row
[
this
.
id
]))
{
// toggleRowSelection 需在$nextTick中使用!
this
.
$nextTick
(()
=>
{
this
.
$refs
.
multipleTable
.
toggleRowSelection
(
row
);
});
}
});
},
// 模拟访问接口获取数据
getData
(
page
,
pageSize
)
{
this
.
loading
=
true
;
let
params
=
{
xmid
:
this
.
sjdata
.
xmid
,
type
:
this
.
type
,
pageSize
:
pageSize
,
pageNo
:
page
}
doQuery
(
params
).
then
(
res
=>
{
this
.
loading
=
false
;
this
.
tableData
=
res
.
data
.
records
||
[]
this
.
total
=
res
.
data
.
total
this
.
updateMark
();
})
},
// 新增选中项
addItem
(
item
)
{
this
.
selectedList
.
push
(
item
);
},
// 移除选中项
removeItem
(
item
)
{
for
(
let
[
index
,
itemTemp
]
of
this
.
selectedList
.
entries
())
{
if
(
itemTemp
[
this
.
id
]
===
item
[
this
.
id
])
{
this
.
removeItemByIndex
(
index
);
break
;
}
}
},
// 根据下标移除选中项
removeItemByIndex
(
index
,
item
)
{
this
.
selectedList
.
splice
(
index
,
1
);
// 若有item,则是点击标签上的关闭按钮,移除选中项
if
(
item
)
{
this
.
$nextTick
(()
=>
{
this
.
$refs
.
multipleTable
.
toggleRowSelection
(
// 此处必须在 tableData 中查找对应的数据,否则 toggleRowSelection 会失效
this
.
tableData
.
find
((
row
)
=>
{
return
row
[
this
.
id
]
===
item
[
this
.
id
];
}),
false
);
});
}
},
},
};
</
script
>
<
style
scoped
>
.mainBox
{
margin
:
10px
;
}
.el-tag
{
margin
:
10px
;
}
.pageBanner
{
margin
:
10px
;
margin-bottom
:
0px
;
}
</
style
>
</
style
>
src/views/train/paperManagement/index.vue
View file @
280549fe
...
@@ -65,7 +65,7 @@
...
@@ -65,7 +65,7 @@
return
{
return
{
/*需要的额外参数 */
/*需要的额外参数 */
showDialog
:
false
,
showDialog
:
false
,
DialogWidth
:
'8
0
%'
,
DialogWidth
:
'8
5
%'
,
DialogName
:
''
,
DialogName
:
''
,
type
:
''
,
type
:
''
,
DialogTitle
:
''
,
DialogTitle
:
''
,
...
...
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