parent
300e917d1e
commit
2669f15962
8 changed files with 1215 additions and 408 deletions
@ -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 // 禁用平台来源(0中台,1职站) |
||||
}).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…
Reference in new issue