理论考试系统列表、题库管理

dev_review
yujialong 4 months ago
parent 300e917d1e
commit 2669f15962
  1. 7
      src/assets/css/main.css
  2. 8
      src/router/index.js
  3. 142
      src/views/theoreticalCourse/list/buildPlatform/index.vue
  4. 10
      src/views/theoreticalCourse/list/index.vue
  5. 57
      src/views/theoryExam/list/index.vue
  6. 139
      src/views/theoryExam/list/program.vue
  7. 321
      src/views/theoryExam/list/system.vue
  8. 357
      src/views/theoryExam/quesBank.vue

@ -442,12 +442,15 @@ li {
.el-switch__label span {
font-size: 12px;
}
.m-b-20 {
margin-bottom: 20px;
.m-r-5 {
margin-right: 5px;
}
.m-r-10 {
margin-right: 10px;
}
.m-b-20 {
margin-bottom: 20px;
}
@media (max-width: 720px) {
.el-message {
min-width: auto !important;

@ -237,6 +237,14 @@ let router = new Router({
path: '/shop/addProduct',
component: () => import('../views/shop/addProduct'),
},
{
path: '/theoryExam/list',
component: () => import('../views/theoryExam/list/index'),
},
{
path: '/theoryExam/quesBank',
component: () => import('../views/theoryExam/quesBank'),
},
{
path: '/404',
component: () => import('../views/404.vue'),

@ -2,161 +2,87 @@
<!-- 平台自建 -->
<div style="padding-top: 24px">
<div class="tool">
<ul class="filter"
style="align-items: flex-start">
<ul class="filter" style="align-items: flex-start">
<li>
<label>可见范围</label>
<el-select v-model="form.visibleRange"
clearable
placeholder="请选择可见范围"
@change="getData">
<el-option v-for="(item,index) in regions"
:key="index"
:label="item.name"
:value="item.id"></el-option>
<el-select v-model="form.visibleRange" clearable placeholder="请选择可见范围" @change="getData">
<el-option v-for="(item, index) in regions" :key="index" :label="item.name" :value="item.id"></el-option>
</el-select>
</li>
<li>
<label>课程分类</label>
<el-select v-model="form.categoryId"
clearable
placeholder="请选择课程分类"
@change="getData">
<el-option label="不限"
value=""></el-option>
<el-option label="暂无分类"
value="0"></el-option>
<el-option v-for="(item,index) in classificationList"
:key="index"
:label="item.classificationName"
<el-select v-model="form.categoryId" clearable placeholder="请选择课程分类" @change="getData">
<el-option label="不限" value=""></el-option>
<el-option label="暂无分类" value="0"></el-option>
<el-option v-for="(item, index) in classificationList" :key="index" :label="item.classificationName"
:value="item.id"></el-option>
</el-select>
</li>
<li>
<label>课程类型</label>
<el-select v-model="form.courseType"
clearable
placeholder="请选择课程类型"
@change="getData">
<el-option v-for="(item,index) in types"
:key="index"
:label="item.name"
:value="item.id"></el-option>
<el-select v-model="form.courseType" clearable placeholder="请选择课程类型" @change="getData">
<el-option v-for="(item, index) in types" :key="index" :label="item.name" :value="item.id"></el-option>
</el-select>
</li>
<li>
<label>搜索</label>
<el-input placeholder="请输入理论课程名称/创建人"
suffix-icon="el-icon-search"
v-model="form.keyWord"
clearable
<el-input placeholder="请输入理论课程名称/创建人" suffix-icon="el-icon-search" v-model="form.keyWord" clearable
size="small"></el-input>
</li>
</ul>
<div>
<el-button v-auth="'平台自建:新增'"
type="primary"
round
@click="addCourse">新增</el-button>
<el-button v-auth="'平台自建:批量删除'"
type="primary"
round
@click="delAllData">批量删除</el-button>
<el-button v-auth="'平台自建:新增'" type="primary" round @click="addCourse">新增</el-button>
<el-button v-auth="'平台自建:批量删除'" type="primary" round @click="delAllData">批量删除</el-button>
</div>
</div>
<el-table :data="list"
class="table"
ref="table"
stripe
header-align="center"
@selection-change="handleSelectionChange"
row-key="id">
<el-table-column type="selection"
width="80"
align="center"
:reserve-selection="true"></el-table-column>
<el-table-column type="index"
width="100"
label="序号"
align="center">
<el-table :data="list" class="table" ref="table" stripe header-align="center"
@selection-change="handleSelectionChange" row-key="id">
<el-table-column type="selection" width="80" align="center" :reserve-selection="true"></el-table-column>
<el-table-column type="index" width="100" label="序号" align="center">
<template slot-scope="scope">
{{ scope.$index + (page - 1) * pageSize + 1 }}
</template>
</el-table-column>
<el-table-column prop="courseName"
label="课程名称"
align="center">
<el-table-column prop="courseName" label="课程名称" align="center">
</el-table-column>
<el-table-column label="可见范围"
align="center">
<el-table-column label="可见范围" align="center">
<template slot-scope="scope">
{{ regionName[scope.row.visibleRange] }}
</template>
</el-table-column>
<el-table-column prop="createTime"
label="创建时间"
align="center">
<el-table-column prop="createTime" label="创建时间" align="center">
</el-table-column>
<el-table-column prop="courseClassification"
label="课程类型"
align="center">
<el-table-column prop="courseClassification" label="课程类型" align="center">
<template slot-scope="scope">
{{ scope.row.courseType == 1 ? '付费' : '免费' }}
</template>
</el-table-column>
<el-table-column prop="founder"
label="创建人"
align="center">
<el-table-column prop="founder" label="创建人" align="center">
</el-table-column>
<el-table-column prop="courseClassification"
label="课程分类"
align="center"
show-overflow-tooltip>
<el-table-column prop="courseClassification" label="课程分类" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column label="操作"
align="center"
width="250">
<el-table-column label="操作" align="center" width="250">
<template slot-scope="scope">
<el-button v-auth="'平台自建:编辑信息'"
type="text"
@click="editCourse(scope.row)">编辑信息</el-button>
<el-divider v-auth="'平台自建:编辑信息'"
direction="vertical"></el-divider>
<el-button v-auth="'平台自建:内容设置'"
type="text"
@click="config(scope.row)">内容设置</el-button>
<el-divider v-auth="'平台自建:内容设置'"
direction="vertical"></el-divider>
<el-button v-auth="'平台自建:预览'"
type="text"
@click="preview(scope.row)">预览</el-button>
<el-divider v-auth="'平台自建:预览'"
direction="vertical"></el-divider>
<el-button v-auth="'平台自建:删除'"
type="text"
@click="handleDelete(scope.row)">删除</el-button>
<el-button v-auth="'平台自建:编辑信息'" type="text" @click="editCourse(scope.row)">编辑信息</el-button>
<el-divider v-auth="'平台自建:编辑信息'" direction="vertical"></el-divider>
<el-button v-auth="'平台自建:内容设置'" type="text" @click="config(scope.row)">内容设置</el-button>
<el-divider v-auth="'平台自建:内容设置'" direction="vertical"></el-divider>
<el-button v-auth="'平台自建:预览'" type="text" @click="preview(scope.row)">预览</el-button>
<el-divider v-auth="'平台自建:预览'" direction="vertical"></el-divider>
<el-button v-auth="'平台自建:删除'" type="text" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
<el-table-column label="可授权状态"
align="center"
width="120">
<el-table-column label="可授权状态" align="center" width="120">
<template slot-scope="scope">
<el-switch v-auth="'平台自建:禁用'"
v-model="scope.row.ztOpen"
:active-value="0"
:inactive-value="1"
style="margin: 0 10px 0 5px"
:active-text="scope.row.ztOpen ? '关' : '开'"
<el-switch v-auth="'平台自建:禁用'" v-model="scope.row.ztOpen" :active-value="0" :inactive-value="1"
style="margin: 0 10px 0 5px" :active-text="scope.row.ztOpen ? '关' : '开'"
@change="switchOff($event, scope.row, scope.$index)"></el-switch>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination background
layout="total, prev, pager, next"
:total="total"
@current-change="handleCurrentChange"
<el-pagination background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange"
:current-page="page">
</el-pagination>
</div>

@ -2,11 +2,8 @@
<!-- 理论课程管理 -->
<div class="page">
<div class="tabs">
<a class="item"
v-for="(item, i) in tabs"
:key="i"
:class="{active: i == active}"
@click="tabChange(i)">{{ item }}</a>
<a class="item" v-for="(item, i) in tabs" :key="i" :class="{ active: i == active }" @click="tabChange(i)">{{ item
}}</a>
</div>
<div class="page-content">
<!-- 平台自建 -->
@ -61,5 +58,4 @@ export default {
};
</script>
<style lang="scss" scoped>
</style>
<style lang="scss" scoped></style>

@ -0,0 +1,57 @@
<template>
<div>
<el-card shadow="hover" class="m-b-20">
<div class="flex-between">
<el-page-header @back="back" content="理论考试系统程序"></el-page-header>
</div>
</el-card>
<div class="page">
<div class="tabs m-b-20">
<a class="item" v-for="(item, i) in tabs" :key="i" :class="{ active: i == active }" @click="tabChange(i)">{{
item
}}</a>
</div>
<System v-if="active == 'tab1'" />
<Program v-if="active == 'tab2'" />
</div>
</div>
</template>
<script>
import System from './system'
import Program from './program'
export default {
components: {
System,
Program,
},
data () {
return {
active: 'tab1',
tabs: {
tab1: '系统列表',
tab2: '程序后台',
},
};
},
mounted () {
},
methods: {
tabChange (i) {
this.active = i
},
back () {
this.$router.back()
},
}
};
</script>
<style scoped>
.card {
min-height: calc(100vh - 300px);
}
</style>

@ -0,0 +1,139 @@
<template>
<div>
<el-table v-loading="loading" :data="list" class="table" ref="table" stripe header-align="center" row-key="id">
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column>
<el-table-column prop="curriculumName" label="程序名称" align="center"></el-table-column>
<el-table-column prop="curriculumType" label="供应商" align="center"></el-table-column>
<el-table-column prop="userName" label="程序类型" align="center"></el-table-column>
<el-table-column prop="orderVolume" label="程序归属" align="center"></el-table-column>
</el-table>
<div class="pagination">
<el-pagination background @current-change="handleCurrentChange" :current-page="page"
layout="total, prev, pager, next" :total="total"></el-pagination>
</div>
</div>
</template>
<script>
import qs from 'qs'
export default {
data () {
return {
list: [],
form: {
curriculumName: this.$route.query.curriculumName || ''
},
page: +this.$route.query.page || 1,
pageSize: 10,
total: 0,
loading: false,
searchTimer: null
};
},
watch: {
"form.curriculumName": function (val) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.initData();
}, 500);
}
},
mounted () {
this.getData()
},
methods: {
//
getData () {
const sid = this.$store.state.dataPer.find(e => e.permissionName === '课程管理')
let data = {
...this.form,
pageNum: this.page,
pageSize: this.pageSize,
supplierId: sid ? sid.supplierId : ''
};
this.$post(this.api.curriculumList, data).then(res => {
this.list = res.page.records
this.total = res.page.total
this.loading = false
}).catch(err => { })
},
initData () {
this.page = 1
this.getData()
},
// url
setReferrer () {
this.$store.commit('setReferrer', `${this.$route.path}?${qs.stringify(this.form)}&page=${this.page}`)
},
//
addcourse () {
this.setReferrer()
this.$router.push("/addcurriculum");
},
//
edit (row) {
this.setReferrer()
this.$router.push(`/addcurriculum?cid=${row.cid}`);
},
//
config (row) {
this.setReferrer()
this.$router.push(`/contentSettings?cid=${row.cid}&name=${row.curriculumName}`);
},
//
handleDelete (row) {
this.$post(`${this.api.deleteCoursePrompt}?cids=${row.cid}`).then(({ status }) => {
if (status === 200) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
this.$post(`${this.api.delCourse}?cids=${row.cid}`).then(res => {
this.getData();
this.$message.success("删除成功");
}).catch(err => { })
}).catch(() => {
});
}
}).catch(err => { })
},
//
delAllSelection () {
if (this.multipleSelection.length) {
let cids = []
this.multipleSelection.forEach(i => {
cids.push('cids=' + i.cid)
});
this.$post(`${this.api.deleteCoursePrompt}?${cids.join('&')}`).then(({ status }) => {
if (status === 200) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
let ids = this.multipleSelection.map(i => i.cid);
this.$post(`${this.api.delCourse}?cids=${ids.toString()}`).then(res => {
if (ids.length == this.list.length) {
if (this.page > 1) {
this.page = this.page - 1
}
}
this.getData();
this.$message.success("删除成功");
this.$refs.table.clearSelection()
}).catch(err => { })
}).catch(() => { })
}
}).catch(err => { })
} else {
this.$message.warning("请先选择课程 !");
}
},
//
handleCurrentChange (val) {
this.page = val;
this.$router.push(`/curriculum?page=${val}`)
this.getData();
},
}
};
</script>
<style scoped></style>

@ -0,0 +1,321 @@
<template>
<div>
<div class="tool">
<ul class="filter">
<li>
<label>搜索</label>
<el-input placeholder="请输入系统名称" suffix-icon="el-icon-search" v-model="curriculumName" clearable
size="small"></el-input>
</li>
</ul>
<div>
<el-button type="primary" round @click="add">新增系统</el-button>
</div>
</div>
<el-table v-loading="loading" :data="list" class="table" ref="table" stripe header-align="center" row-key="id">
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column>
<el-table-column prop="curriculumName" label="系统名称" align="center"></el-table-column>
<el-table-column prop="curriculumType" label="系统分类" align="center"></el-table-column>
<el-table-column prop="userName" label="系统描述" align="center"></el-table-column>
<el-table-column label="创建时间" align="center"></el-table-column>
<el-table-column prop="orderVolume" label="创建人" align="center"></el-table-column>
<el-table-column prop="expectedCourse" label="系统后台" align="center">
<template slot-scope="scope">
<el-button type="text" @click="edit(scope.row)">进入</el-button>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="text" @click="edit(scope.row)">编辑</el-button>
<el-button type="text" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination background @current-change="handleCurrentChange" :current-page="page"
layout="total, prev, pager, next" :total="total"></el-pagination>
</div>
<!-- 新增编辑系统 -->
<el-dialog :title="(form.accountId ? '编辑' : '新增') + '系统'" :visible.sync="systemVisible" width="400px"
:close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item prop="workNumber" label="关联程序">
<el-input value="理论考试系统程序" disabled class="m-r-10" style="width: 240px;" />
<el-button type="text" @click="showProgram">查看</el-button>
</el-form-item>
<el-form-item prop="userName" label="系统名称">
<el-input v-model.trim="form.userName" placeholder="请输入系统名称"></el-input>
</el-form-item>
<el-form-item prop="account" label="系统分类">
<el-select v-model="form.operator" class="m-r-10" style="width: 230px;">
<!-- <el-option v-for="i in operators" :key="i" :label="i" :value="i"></el-option> -->
</el-select>
<el-button type="text" @click="customType">自定义</el-button>
</el-form-item>
<el-form-item prop="email" label="系统描述">
<el-input v-model.trim="form.email" type="textarea" :rows="4" placeholder="请输入系统描述"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="systemVisible = false">取消</el-button>
<el-button type="primary" @click="submitSystem">确定</el-button>
</span>
</el-dialog>
<!-- 程序列表 -->
<el-dialog title="程序列表" :visible.sync="programVisible" width="600px" :close-on-click-modal="false">
<Program />
<span slot="footer" class="dialog-footer">
<el-button @click="programVisible = false">关闭</el-button>
</span>
</el-dialog>
<!-- 系统分类设置 -->
<el-dialog title="系统分类设置" :visible.sync="typeVisible" width="600px" :close-on-click-modal="false"
class="manage-dia">
<div class="plus">
<i class="el-icon-circle-plus-outline" @click="addClass"></i>
</div>
<el-table :data="types" ref="table" header-align="center" row-key="id">
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column>
<el-table-column prop="classificationName" label="分类名称" align="center" min-width="130">
<template slot-scope="scope">
<el-input v-if="scope.row.edit" placeholder="请输入分类名称" v-model="scope.row.classificationName" clearable
maxlength="30"></el-input>
<span v-else>{{ scope.row.classificationName }}</span>
</template>
</el-table-column>
<el-table-column prop="updateTime1" label="已引用系统数量" align="center" min-width="60"></el-table-column>
<el-table-column label="操作" align="center" min-width="60">
<template slot-scope="scope">
<i v-if="scope.row.edit" class="el-icon-check action m-r-10" @click="submitClass(scope.row)"></i>
<i v-else class="el-icon-edit action m-r-10" @click="editClass(scope.row)"></i>
<i class="el-icon-delete action" @click="delClass(scope.row, scope.$index)"></i>
</template>
</el-table-column>
</el-table>
<span slot="footer">
<el-button @click="closeClass">返回</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import Program from './program'
export default {
components: {
Program,
},
data () {
return {
list: [],
curriculumName: this.$route.query.curriculumName || '',
page: +this.$route.query.page || 1,
pageSize: 10,
total: 0,
loading: false,
searchTimer: null,
systemVisible: false,
form: {},
rules: {
roleList: [
{ required: true, message: '请输入系统名称', trigger: 'blur' }
],
type: [
{ required: true, message: '请选择系统分类', trigger: 'change' }
],
},
programVisible: false,
types: [],
typeVisible: false,
};
},
watch: {
curriculumName: function (val) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.initData();
}, 500);
}
},
mounted () {
// this.getData()
},
methods: {
//
getData () {
let data = {
curriculumName: this.curriculumName,
pageNum: this.page,
pageSize: this.pageSize,
};
this.$post(this.api.curriculumList, data).then(res => {
this.list = res.page.records
this.total = res.page.total
this.loading = false
}).catch(err => { })
},
initData () {
this.page = 1
this.getData()
},
//
add () {
this.systemVisible = true
},
//
edit (row) {
this.$router.push(`/addcurriculum?cid=${row.cid}`);
},
//
config (row) {
this.$router.push(`/contentSettings?cid=${row.cid}&name=${row.curriculumName}`);
},
//
handleDelete (row) {
this.$post(`${this.api.deleteCoursePrompt}?cids=${row.cid}`).then(({ status }) => {
if (status === 200) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
this.$post(`${this.api.delCourse}?cids=${row.cid}`).then(res => {
this.getData();
this.$message.success("删除成功");
}).catch(err => { })
}).catch(() => {
});
}
}).catch(err => { })
},
//
delAllSelection () {
if (this.multipleSelection.length) {
let cids = []
this.multipleSelection.forEach(i => {
cids.push('cids=' + i.cid)
});
this.$post(`${this.api.deleteCoursePrompt}?${cids.join('&')}`).then(({ status }) => {
if (status === 200) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
let ids = this.multipleSelection.map(i => i.cid);
this.$post(`${this.api.delCourse}?cids=${ids.toString()}`).then(res => {
if (ids.length == this.list.length) {
if (this.page > 1) {
this.page = this.page - 1
}
}
this.getData();
this.$message.success("删除成功");
this.$refs.table.clearSelection()
}).catch(err => { })
}).catch(() => { })
}
}).catch(err => { })
} else {
this.$message.warning("请先选择课程 !");
}
},
//
handleCurrentChange (val) {
this.page = val;
this.$router.push(`/curriculum?page=${val}`)
this.getData();
},
//
showProgram () {
this.programVisible = true
},
//
customType () {
this.typeVisible = true
},
//
getType (detail) {
this.$post(`${this.api.queryClassificationByType}?typeId=${this.typeId}`).then(({ data }) => {
this.types = data
// id
if (detail) {
const id = this.form.classificationId
if (!data.find(e => e.id == id)) this.form.classificationId = ''
setTimeout(() => {
this.updateTime = 0
}, 500)
}
}).catch(err => { })
},
//
addClass () {
this.types.find(e => e.edit) ?
Util.errorMsg('请先保存分类!') :
this.types.push({
edit: true,
id: '',
classificationName: ''
})
},
//
editClass (row) {
this.types.find(e => e.edit) ?
Util.errorMsg('请先保存分类!') :
this.$set(row, 'edit', 1)
},
//
delClass (row, i) {
if (row.id) {
this.$confirm('确定要删除吗?', '提示', {
type: 'warning'
}).then(() => {
this.$post(`${this.api.batchDeletionParnerClass}?ids=${row.id}`).then(res => {
Util.successMsg('删除成功')
this.getType()
}).catch(res => { })
}).catch(() => { })
} else {
this.types.splice(i, 1)
}
},
//
submitClass (row, showMsg = 1) {
if (!row.classificationName) return Util.errorMsg('请输入分类名称')
this.$post(`${this.api.checkForHeavyParnerClass}?classificationName=${row.classificationName}&typeId=${this.typeId}&classificationId=${row.id}`).then(res => {
this.$post(this.api[row.id ? 'updateParnerClass' : 'saveParnerClass'], {
classificationName: row.classificationName,
typeId: this.typeId, // (1.2.)
id: row.id,
}).then(res => {
showMsg && Util.successMsg((row.id ? '修改' : '新增') + '成功')
this.getType()
}).catch(res => { })
}).catch(res => { })
},
//
submitSystem () {
},
}
};
</script>
<style lang="scss" scoped>
.plus {
margin-bottom: 10px;
font-size: 18px;
color: #9278ff;
text-align: right;
cursor: pointer;
}
.action {
cursor: pointer;
}
</style>

@ -0,0 +1,357 @@
<template>
<div class="page">
<div class="side">
<div class="m-b-20">
<h6 class="p-title">题库分类</h6>
<el-radio-group v-model="type" @change="typeChange">
<div class="m-b-20">
<el-radio :label="1">所有题库</el-radio>
</div>
<div>
<el-radio :label="2">未加入分类的题库</el-radio>
</div>
</el-radio-group>
</div>
<el-divider></el-divider>
<div>
<el-input class="m-b-10" placeholder="请输入题库分类" prefix-icon="el-icon-search" size="small" clearable></el-input>
<div style="height: 504px; max-height: 504px; overflow: auto">
<el-tree :data="orgList" default-expand-all ref="orgTree" node-key="id" highlight-current
:expand-on-click-node="false" @node-click="handleNodeClick"
:props="{ children: 'children', label: 'partnerClassificationName', isLeaf: 'leaf' }"></el-tree>
</div>
</div>
</div>
<div class="right">
<h6 class="p-title">筛选</h6>
<div class="tool">
<ul class="filter">
<li>
<label>状态</label>
<el-select v-model="filter.status" clearable placeholder="请选择状态" @change="getList">
<el-option v-for="(item, i) in status" :key="i" :label="item.name" :value="item.id"></el-option>
</el-select>
</li>
<li>
<label>搜索</label>
<el-input style="width: 250px;" placeholder="请输入题库名称" prefix-icon="el-icon-search" v-model="filter.keyWord"
clearable></el-input>
</li>
</ul>
<div>
<el-button type="primary" @click="add">创建题库</el-button>
</div>
</div>
<el-table :data="list" class="table" ref="table" stripe header-align="center"
@selection-change="handleSelectionChange" row-key="id">
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column>
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column>
<el-table-column prop="userName" label="题库名称" align="center" min-width="100"></el-table-column>
<el-table-column prop="account" label="描述" align="center" min-width="100"></el-table-column>
<el-table-column prop="phone" label="题库分类" align="center" min-width="120"></el-table-column>
<el-table-column prop="invitationAccount" label="题目数量" align="center" min-width="120"></el-table-column>
<el-table-column prop="loginNumber" label="创建时间" align="center" width="120"></el-table-column>
<el-table-column prop="lastLoginTime" label="创建人" align="center" width="120"></el-table-column>
<el-table-column label="操作" align="center" width="300">
<template slot-scope="scope">
<el-button type="text" @click="edit(scope.row)">试题管理</el-button>
<el-button type="text" @click="edit(scope.row)">编辑</el-button>
<el-button type="text" @click="del(scope.row)">复制</el-button>
<el-button type="text" @click="del(scope.row)">删除</el-button>
<el-switch v-model="scope.row.ztOpen" :active-value="0" :inactive-value="1" style="margin: 0 10px 0 5px"
:active-text="scope.row.ztOpen ? '关' : '开'"
@change="switchOff($event, scope.row, scope.$index)"></el-switch>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next"
:total="total"></el-pagination>
</div>
<el-dialog :title="!form.id ? '创建题库' : '编辑题库'" :visible.sync="quesBankVisible" width="400px"
:close-on-click-modal="false">
<el-form label-width="80px">
<el-form-item prop="userName" label="分类">
<el-select style="width: 100%" v-model="form.provinceId" placeholder="请选择题库分类">
<el-option v-for="(item, i) in types" :key="i" :label="item.provinceName"
:value="item.provinceId"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="userName" label="题库名称">
<el-input placeholder="请输入题库名称" v-model="form.name"></el-input>
</el-form-item>
<el-form-item prop="userName" label="题库描述">
<el-input placeholder="请输入题库描述" type="textarea" :rows="3" v-model="form.name"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="quesBankVisible = false"> </el-button>
<el-button type="primary" @click="quesBankSubmit"> </el-button>
</span>
</el-dialog>
</div>
</div>
</template>
<script>
import Util from "@/libs/util";
import Setting from "@/setting";
import OrgTree from "@/components/org-tree/src/tree";
export default {
components: { OrgTree },
data () {
return {
type: 1,
orgList: [],
status: [
{
id: 1,
name: '启用'
},
{
id: 2,
name: '禁用'
},
],
filter: {
status: '',
keyWord: '',
},
list: [],
page: 1,
pageSize: 10,
total: 0,
multipleSelection: [],
types: [],
form: {
userName: '',
provinceId: '',
cityId: '',
roleList: []
},
rules: {
userName: [
{ required: true, message: "请输入姓名", trigger: "blur" }
],
provinceId: [
{ required: true, message: '请选择省份', trigger: "change" }
],
cityId: [
{ required: true, message: '请选择城市', trigger: "change" }
],
roleList: [
{ required: true, message: '请选择角色', trigger: "change" }
],
},
quesBankVisible: false,
submiting: false, //
setKey: '',
transferVisible: false,
chooseVisible: false,
members: [],
choosePartnerId: '',
curRow: '',
provinces: [],
cities: [],
editVisible: false
};
},
watch: {
keyWord: function (val) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(this.initData, 500);
}
},
mounted () {
this.getOrg()
},
methods: {
//
async getOrg () {
const res = await this.$post(this.api.listParner)
const list = res.treeList
// children
const handleLeaf = (list, ids) => {
list.map(e => {
e.ids = ids ? [...ids, e.id] : [e.id]
if (e.children.length) {
if (e.isTeam) {
delete e.children
} else {
handleLeaf(e.children, e.ids)
}
} else {
delete e.children
}
})
}
handleLeaf(list)
this.orgList = list
//
this.setKey && this.$nextTick(() => {
this.$refs.orgTree.setCurrentKey(this.setKey)
})
this.getList()
},
//
typeChange () {
this.$refs.orgTree.setCurrentKey(null)
this.curTeamId = ''
this.initData()
},
// id
getTeamId (list) {
for (const i in list) {
const e = list[i]
if (e.isTeam && !this.curTeamId) {
this.curTeamId = e.id
break
} else {
this.getTeamId(e.children)
}
}
},
//
handleNodeClick (data) {
this.type = ''
this.curTeamId = ''
if (data.isTeam) {
this.curTeamId = data.id
} else {
// this.getTeamId(data.children)
}
if (!this.curTeamId) this.curTeamId = data.id
this.initData()
this.$refs.table.clearSelection()
},
//
getAll () {
this.curTeamId = ''
this.getList()
},
//
getList () {
this.$post(this.api[this.type ? 'partnerAccountMergeList' : 'partnerAccountList'], {
type: this.type || 1,
partnerClassificationId: this.curTeamId,
pageNum: this.page,
pageSize: this.pageSize
}).then(({ pageList }) => {
pageList.records.forEach((e, i) => {
e.id = i
})
this.list = pageList.records
this.total = pageList.total
}).catch(err => { })
},
//
currentChange (val) {
this.page = val
this.getList()
},
handleSelectionChange (val) { //
this.multipleSelection = val
},
initData () {
this.$refs.table.clearSelection()
this.page = 1
this.getList()
},
//
del (row) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
this.$post(`${this.api.delPartnerAccount}?accountId=${row.accountId}`).then(res => {
Util.successMsg("删除成功")
this.getList()
}).catch(res => { })
}).catch(() => { })
},
async switchOff (val, row) {
this.$post(this.api.disabledEventsCompetition, {
competitionId: row.id,
isOpen: val,
type: 0 // (01)
}).then(res => {
Util.successMsg(val == 1 ? '禁用成功' : '启用成功')
}).catch(err => { })
await this.$post(`${this.api.refreshPageNotification}?content=1`)
},
//
edit (row) {
if (!row.provinceId) row.provinceId = ''
if (!row.cityId) row.cityId = ''
row.roleList = row.roleId.split(',').map(e => +e)
this.editVisible = true
this.form = JSON.parse(JSON.stringify(row))
},
//
submitEdit () {
this.$refs.form.validate((valid) => {
if (valid) {
if (this.submiting) return false
this.submiting = true
const form = JSON.parse(JSON.stringify(this.form))
form.classificationId = form.partnerClassificationId
this.$post(this.api.editProvinceCity, form).then(res => {
this.getList()
Util.successMsg("编辑成功!")
this.editVisible = false
setTimeout(() => {
this.submiting = false
}, 2000)
}).catch(res => {
setTimeout(() => {
this.submiting = false
}, 2000)
})
}
})
},
//
add () {
this.quesBankVisible = true
},
//
quesBankSubmit () {
},
}
};
</script>
<style lang="scss" scoped>
.org-name {
margin-right: 20px;
}
.w-100 {
width: 100%;
}
.page {
display: flex;
padding: 0 24px;
.side {
width: 300px;
padding: 24px 10px 24px 0;
margin-right: 24px;
border-right: 1px solid rgba(0, 0, 0, 0.06);
}
.right {
width: calc(100% - 324px);
padding: 24px 0;
}
}
</style>
Loading…
Cancel
Save