Merge branch 'develop' of https://gitee.com/siwa-team/dawa-vue into develop

This commit is contained in:
18571350067 2021-12-23 14:43:02 +08:00
commit a6c33e5f86
12 changed files with 749 additions and 130 deletions

View File

@ -1,15 +1,10 @@
import request from '@/utils/request' import request from '@/utils/request'
const coursewareApi = { const coursewareApi = {
add: '/courseManagement/xmCourseCourseware/addOrUpdate', add: '/courseManagement/xmCourseCourseware/addOrUpdate',
get: '/courseManagement/xmCourseCourseware/details', get: '/courseManagement/xmCourseCourseware/details',
// update: 'sys/menu/update', del: 'courseManagement/xmCourseCourseware/delete',
del: 'courseManagement/xmCourseCourseware/delete', classList: '/courseManagement/coursewareClassify/listPage'
// updateStatus: 'sys/menu/updateStatus',
// list: '/courseManagement/course/listPage',
// coursewareList:'/courseManagement/course/courseware/details',
// questionList:'/courseManagement/course/questionList'
classList: '/courseManagement/coursewareClassify/listPage'
} }
@ -17,37 +12,37 @@ const coursewareApi = {
//删除课件 //删除课件
export function deleteCourseware(params) { export function deleteCourseware(params) {
return request({ return request({
url: coursewareApi.del, url: coursewareApi.del,
method: 'delete', method: 'delete',
params: params params: params
}) })
} }
// 课件新增 // 课件新增
export function coursewareAdd(params) { export function coursewareAdd(params) {
return request({ return request({
url: coursewareApi.add, url: coursewareApi.add,
method: 'post', method: 'post',
data: params data: params
}) })
} }
// 课件分类列表 // 课件分类列表
export function coursewareClassList(params) { export function coursewareClassList(params) {
return request({ return request({
url: coursewareApi.classList, url: coursewareApi.classList,
method: 'get', method: 'get',
params: params params: params
}) })
} }
// 课件详情 // 课件详情
export function coursewareDeatil(params) { export function coursewareDeatil(params) {
return request({ return request({
url: coursewareApi.get, url: coursewareApi.get,
method: 'get', method: 'get',
params: params params: params
}) })
} }

54
src/api/notice/notice.js Normal file
View File

@ -0,0 +1,54 @@
import request from '@/utils/request'
const noticeApi = {
add: 'notice/addOrUpdate',
del: 'notice/del',
get: 'notice/get',
page: 'notice/pageList',
read: 'notice/read',
pagePerson: 'notice/pagePersonList'
}
export function noticeAdd (params) {
return request({
url: noticeApi.add,
method: 'post',
data: params
})
}
export function noticeDel (params) {
return request({
url: noticeApi.del,
method: 'post',
params: params
})
}
export function noticeGet (params) {
return request({
url: noticeApi.get,
method: 'get',
params: params
})
}
export function noticePage (params) {
return request({
url: noticeApi.page,
method: 'post',
params: {pageSize: params.pageSize, pageNum: params.pageNum},
data: params
})
}
export function noticeRead (params) {
return request({
url: noticeApi.read,
method: 'get',
params: params
})
}
export function noticePagePerson (params) {
return request({
url: noticeApi.pagePerson,
method: 'post',
params: params
})
}

View File

@ -73,5 +73,5 @@ export default {
} }
</script> </script>
<style lang="scss" scoped> <style lang="less" scoped>
</style> </style>

View File

@ -0,0 +1,138 @@
<template>
<div>
<a-card :bordered="false">
<template slot="extra">
<a-button size="small" @click="close">返回</a-button>
</template>
<div>
<div>
<h1 class="article-title">{{ model.title }}</h1>
<div class="article-attr">
<div class="article-attr__item">
<span>{{ model.createOrgName }}</span>
</div>
<div class="article-attr__item">
<span>({{ model.createTime | moment }})</span>
</div>
</div>
<div class="article-body">
<div v-html="model.content"></div>
</div>
</div>
</div>
</a-card>
<a-card v-if="hasPerm('notice:edit')" >
<a-tabs default-active-key="1" @change="tabsCallback">
<a-tab-pane key="1" tab="已读人员">
<s-table
ref="table"
:columns="columns"
:data="loadData"
:rowKey="(record) => record.id"
:pagination="{ pageSize: 5 }"
:showSizeChanger="false"
>
<template slot="readTime" slot-scope="text, record">
{{ record.readTime | moment('YYYY-MM-DD HH:mm:ss') }}
</template>
</s-table>
</a-tab-pane>
<a-tab-pane key="1" tab="未读人员" >
<s-table
ref="table"
:columns="columns"
:data="loadData"
:rowKey="(record) => record.id"
:pagination="{ pageSize: 5 }"
:showSizeChanger="false"
>
<template slot="readTime" slot-scope="text, record">
{{ record.readTime | moment('YYYY-MM-DD HH:mm:ss') }}
</template>
</s-table>
</a-tab-pane>
</a-tabs>
</a-card>
</div>
</template>
<script>
import { noticeGet, noticePagePerson } from '@/api/notice/notice'
export default {
data () {
return {
model: {},
queryParam: { noticeId: this.$route.query.id, isRead: 1 },
//
columns: [
{
title: '公告标题',
dataIndex: 'title'
},
{
title: '发布单位/人',
dataIndex: 'createOrgName'
},
{
title: '发布时间',
width: 200,
dataIndex: 'readTime',
key: 'readTime',
scopedSlots: { customRender: 'readTime' }
},
{
title: '菜单类型',
dataIndex: 'type',
scopedSlots: { customRender: 'type' }
}
],
// Promise
loadData: parameter => {
return noticePagePerson(Object.assign(parameter, this.queryParam)).then((res) => {
console.log(res)
return res
})
}
}
},
created () {
const noticeId = this.$route.query.id
console.log(noticeId)
this.getDetail(noticeId)
},
methods: {
//
close () {
this.$router.push({ path: '/notice/list', query: {} })
},
getDetail (id) {
noticeGet({ id: id }).then(res => {
this.model = res.data
})
},
tabsCallback (key) {
if (key === '1') {
this.queryParam.isRead = 1
this.$refs.table.refresh(true)
}
if (key === '2') {
this.queryParam.isRead = 0
this.$refs.table.refresh(true)
}
}
}
}
</script>
<style>
.article-attr {
color: black;
text-align: center;
}
.article-title {
text-align: center;
}
</style>

View File

@ -0,0 +1,216 @@
<template>
<a-card :bordered="false">
<template slot="extra">
<a-button size="small" @click="save" type="primary">保存</a-button>
<a-button size="small" @click="close">返回</a-button>
</template>
<a-form-model ref="ruleForm" :model="form" :rules="rules" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-row :gutter="16">
<a-col :span="12">
<a-form-model-item ref="title" label="公告标题" prop="title" :wrapper-col="{ span: 18 }">
<a-input v-model="form.title" />
</a-form-model-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :span="12">
<a-form-model-item ref="rangeName" label="发布范围" prop="rangeName" :wrapper-col="{ span: 18 }">
<a-input v-model="form.rangeName" readOnly @click="openOrgTree" />
</a-form-model-item>
<a-form-model-item style="display: none;">
<a-input v-model="form.rangeId" />
</a-form-model-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :span="12">
<a-form-model-item ref="isTop" label="是否置顶" prop="isTop">
<a-radio-group v-model="form.isTop" >
<a-radio :value="1"></a-radio>
<a-radio :value="0"></a-radio>
</a-radio-group>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item ref="isCalculate" label="是否计算学时" prop="isCalculate">
<a-radio-group v-model="form.isCalculate" >
<a-radio :value="1"></a-radio>
<a-radio :value="0"></a-radio>
</a-radio-group>
</a-form-model-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :span="12">
<a-form-model-item ref="isNowPublish" label="即时发布" prop="isNowPublish" >
<a-switch v-model="form.isNowPublish" @change="onChangeNow" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<div v-if="timeShow" >
<a-form-model-item ref="publishTime" label="发布时间" prop="publishTime">
<a-date-picker
v-model="form.publishTime"
show-time
type="date"
placeholder="选择发布时间"
style="width: 100%;"
:format="'YYYY-MM-DD HH:mm:ss'"
valueFormat="YYYY-MM-DD HH:mm:ss"
/>
</a-form-model-item>
</div>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :span="12">
<a-form-model-item ref="type" label="发布类型" prop="type">
<a-select v-model="form.type" >
<a-select-option :value="1">新闻资讯</a-select-option>
<a-select-option :value="2">公告详情</a-select-option>
<a-select-option :value="3">通知</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col>
<a-form-model-item ref="content" label="详细内容" prop="content" :label-col="{ span: 3 }" :wrapper-col="{ span: 21 }">
<!-- <wang-editor ref="wangEditor" groupName="notice" :value="form.content"></wang-editor> -->
<a-textarea :autoSize="{ minRows: 3, maxRows: 10 }" v-model="form.content"/>
</a-form-model-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :span="12">
<a-form-model-item label="上传附件" >
<db-upload v-model="fileList" type="file" accept="*"></db-upload>
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
<org-tree @selectOrg="selectOrg($event)" ref="orgModal"/>
</a-card>
</template>
<script>
import { noticeGet, noticeAdd } from '@/api/notice/notice'
import WangEditor from '@/components/Editor/WangEditor'
import DbUpload from '@/components/DbUpload/DbUpload.vue'
import OrgTree from '../org/OrgTree'
// import moment from 'moment'
export default {
props: {
id: {
type: String,
default: undefined
}
},
components: {
OrgTree,
WangEditor,
DbUpload
},
data () {
return {
labelCol: {
span: 6
},
wrapperCol: {
span: 18
},
form: {
id: '',
title: '',
rangeId: 0,
rangeName: '',
isTop: 0,
isCalculate: 0,
isNowPublish: false,
publishTime: '',
type: 1,
content: ''
},
fileList: [],
timeShow: true,
rules: {
title: [{ required: true, message: '请输入公告标题', trigger: 'blur' }],
rangeName: [{ required: true, message: '请选择发布范围', trigger: 'blur' }],
isTop: [{ required: true, message: '请选择是否置顶', trigger: 'change' }],
isCalculate: [{ required: true, message: '请选择是否计算学时', trigger: 'change' }],
isNowPublish: [{ required: true, message: '请选择即时发布', trigger: 'change' }],
publishTime: [{ required: true, message: '请选择发布时间', trigger: 'change' }],
type: [{ required: true, message: '请选择发布类型', trigger: 'change' }],
content: [{ required: true, message: '请输入详细内容', trigger: 'change' }]
}
}
},
created () {
console.log(!this.$route.query.id)
if (!this.$route.query.id) return
this.edit(this.$route.query.id)
},
methods: {
//
close () {
this.$router.push({ path: '/notice/list', query: {} })
},
edit (id) {
this.modalTitle = '修改'
this.visible = true
noticeGet({ id: id }).then(res => {
console.log(res)
const form = res.data
form.isNowPublish = form.isNowPublish === 1
// form.publishTime = moment(form.publishTime)
this.form = form
this.fileList = JSON.parse(res.data.file)
})
},
save () {
this.$refs.ruleForm.validate(valid => {
if (valid) {
const { form } = this
// form.content = this.$refs.wangEditor.content()
if (this.form.isNowPublish) {
form.isNowPublish = 1
form.publishTime = new Date().getTime()
} else {
form.isNowPublish = 0
}
form.file = JSON.stringify(this.fileList)
console.log(form)
noticeAdd(form).then((res) => {
if (res.code === 200) {
this.$message.success('操作成功')
this.close()
} else {
this.$message.error('操作失败:' + res.msg)
}
})
} else {
return false
}
})
},
openOrgTree () {
this.$refs.orgModal.loadOrg()
},
selectOrg (orgData) {
this.form.rangeId = orgData.id
this.form.rangeName = orgData.name
},
onChangeNow (checked) {
console.log(`a-switch to ${checked}`)
this.timeShow = !checked
}
}
}
</script>
<style>
</style>

View File

@ -0,0 +1,198 @@
<template>
<a-card :bordered="false">
<a-tabs default-active-key="2" @change="tabsCallback">
<a-tab-pane key="2" tab="我接收的">
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="48">
<a-col :md="6" :sm="24">
<a-form-item label="公告标题"><a-input v-model="queryParam.title" placeholder="请输入公告标题" @pressEnter="loadData" /></a-form-item>
</a-col>
<a-col :md="8" :sm="24">
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
<a-button style="margin-left: 8px" @click="() => {queryParam = {}, this.loadData()}">重置</a-button>
</a-col>
</a-row>
</a-form>
</div>
<s-table
ref="table"
:columns="columns"
:data="loadData"
:rowKey="(record) => record.id"
>
<template slot="type" slot-scope="text, record">
<a-tag>{{ record.type | typeFilter }}</a-tag>
</template>
<template slot="publishTime" slot-scope="text, record">
{{ record.publishTime | moment('YYYY-MM-DD HH:mm:ss') }}
</template>
<span slot="action" slot-scope="text, record">
<a v-if="hasPerm('notice:list')" @click="showGetPage(record.id)">查看</a>
<a-divider type="vertical" />
</span>
</s-table>
</a-tab-pane>
<a-tab-pane key="1" tab="我发布的" v-if="hasPerm('notice:edit')" >
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="48">
<a-col :md="6" :sm="24">
<a-form-item label="公告标题"><a-input v-model="queryParam.title" placeholder="请输入公告标题" @pressEnter="loadData" /></a-form-item>
</a-col>
<a-col :md="8" :sm="24">
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
<a-button style="margin-left: 8px" @click="() => {queryParam = {}, this.loadData()}">重置</a-button>
</a-col>
</a-row>
</a-form>
</div>
<div class="table-operator">
<a-button @click="showAddPage()" icon="plus" type="primary" v-if="hasPerm('notice:edit')">发布</a-button>
</div>
<s-table
ref="table"
:columns="columns"
:data="loadData"
:rowKey="(record) => record.id"
>
<template slot="type" slot-scope="text, record">
<a-tag>{{ record.type | typeFilter }}</a-tag>
</template>
<template slot="publishTime" slot-scope="text, record">
{{ record.publishTime | moment('YYYY-MM-DD HH:mm:ss') }}
</template>
<span slot="action" slot-scope="text, record">
<a v-if="hasPerm('notice:edit')" @click="showAddPage(record.id)">编辑</a>
<a-divider type="vertical" v-if="hasPerm('notice:edit')" />
<a v-if="hasPerm('notice:list')" @click="showGetPage(record.id)">查看</a>
<a-divider type="vertical" v-if="hasPerm('notice:list')"/>
<a-popconfirm v-if="hasPerm('notice:del')" placement="topRight" title="确认删除?" @confirm="() => handleDel(record)">
<a>删除</a>
</a-popconfirm>
</span>
</s-table>
</a-tab-pane>
</a-tabs>
</a-card>
</template>
<script>
import { STable } from '@/components'
import { noticePage, noticeDel } from '@/api/notice/notice'
export default {
components: {
STable
},
data () {
return {
//
queryParam: { noticeRange: 2 },
//
columns: [
{
title: '公告标题',
dataIndex: 'title'
},
{
title: '发布单位/人',
dataIndex: 'createOrgName'
},
{
title: '发布时间',
width: 200,
dataIndex: 'publishTime',
key: 'publishTime',
scopedSlots: { customRender: 'publishTime' }
},
{
title: '菜单类型',
dataIndex: 'type',
scopedSlots: { customRender: 'type' }
}
],
// Promise
loadData: parameter => {
return noticePage(Object.assign(parameter, this.queryParam)).then((res) => {
console.log(res)
return res
})
}
}
},
filters: {
typeFilter (type) {
const typeMap = {
1: '新闻资讯',
2: '公告详情',
3: '通知'
}
return typeMap[type]
}
},
created () {
if (this.hasPerm('notice:edit') || this.hasPerm('notice:del') || this.hasPerm('notice:list')) {
this.columns.push({
title: '操作',
width: '150px',
dataIndex: 'action',
scopedSlots: { customRender: 'action' }
})
}
},
methods: {
tabsCallback (key) {
if (key === '1') {
this.queryParam.noticeRange = 1
this.$refs.table.refresh(true)
}
if (key === '2') {
this.queryParam.noticeRange = 2
this.$refs.table.refresh(true)
}
},
/**
* 删除
*/
handleDel (record) {
noticeDel({ id: record.id, deleteReason: '' }).then((res) => {
if (res.code === 200) {
this.$message.success('删除成功')
this.$refs.table.refresh(true)
} else {
this.$message.error('删除失败:' + res.msg)
}
})
},
showAddPage (id) {
console.log(id)
this.$router.push({
path: '/notice/add',
query: {
id: id
}
})
},
showGetPage (id) {
this.$router.push({
path: '/notice/detail',
query: {
id: id
}
})
}
}
}
</script>
<style lang="less">
.table-operator {
margin-bottom: 18px;
}
button {
margin-right: 8px;
}
</style>

View File

@ -104,7 +104,7 @@ export default {
}) })
}, },
loadOrg () { loadOrg () {
orgList().then(res => { orgList({ orgType: 1 }).then(res => {
if (!res.code === 200 || !res.data.length) { if (!res.code === 200 || !res.data.length) {
return return
} }

View File

@ -12,19 +12,9 @@
<a-select-option value="3">未发布</a-select-option> <a-select-option value="3">未发布</a-select-option>
</a-select> </a-select>
开始时间: 开始时间:
<a-date-picker <a-date-picker v-model="queryParam.startDate" style="width: 100%" placeholder="请输入开始时间" valueFormat="YYYY-MM-DD HH:mm:ss" />
v-model="queryParam.startDate"
style="width: 100%"
placeholder="请输入开始时间"
valueFormat="YYYY-MM-DD HH:mm:ss"
/>
结束时间: 结束时间:
<a-date-picker <a-date-picker v-model="queryParam.endDate" style="width: 100%" placeholder="请输入结束时间" valueFormat="YYYY-MM-DD HH:mm:ss" />
v-model="queryParam.endDate"
style="width: 100%"
placeholder="请输入结束时间"
valueFormat="YYYY-MM-DD HH:mm:ss"
/>
培训方式: 培训方式:
<a-select v-model="queryParam.trainWay" placeholder="请选择" default-value="null" style="width: 120px"> <a-select v-model="queryParam.trainWay" placeholder="请选择" default-value="null" style="width: 120px">
<a-select-option value="null">全部</a-select-option> <a-select-option value="null">全部</a-select-option>
@ -39,28 +29,23 @@
</a-space> </a-space>
<a-space class="table-operator" direction="horizontal"> <a-space class="table-operator" direction="horizontal">
<a-button v-if="hasPerm('project:add')" type="primary" icon="plus" @click="handledCreate">新增项目</a-button> <a-button v-if="hasPerm(power.add)" type="primary" icon="plus" @click="handledCreate">新增项目</a-button>
</a-space> </a-space>
<s-table <s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData" :pageNum="Number(this.$route.query.projectPageNum) || 1">
ref="table"
size="default"
rowKey="id"
:columns="columns"
:data="loadData"
:pageNum="Number(this.$route.query.projectPageNum) || 1"
>
<span slot="serial" slot-scope="text, record, index"> <span slot="serial" slot-scope="text, record, index">
{{ index + 1 }} {{ index + 1 }}
</span> </span>
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<template> <template>
<a v-if="hasPerm('project:edit')" href="javascript:;" @click="handledCreate(record)">修改</a> <a v-if="hasPerm(power.release) && record.status == 1" href="javascript:;" @click="handledRelease(record)">发布</a>
<a-divider type="vertical" /> <a-divider type="vertical" v-if="hasPerm(power.edit) && hasPerm('project:list')" />
<a v-if="hasPerm('project:list')" href="javascript:;" @click="getDetail(record)">详情</a> <a v-if="hasPerm('project:list')" href="javascript:;" @click="getDetail(record)">详情</a>
<a-divider type="vertical" /> <a-divider type="vertical" v-if="hasPerm(power.edit) && hasPerm('project:list')" />
<a v-if="hasPerm(power.edit)" href="javascript:;" @click="handledCreate(record)">修改</a>
<a-divider type="vertical" v-if="hasPerm(power.del) && hasPerm('project:list')" />
<a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)"> <a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)">
<a v-if="hasPerm('project:del')" href="javascript:;">删除</a> <a v-if="hasPerm(power.del)" href="javascript:;">删除</a>
</a-popconfirm> </a-popconfirm>
</template> </template>
</span> </span>
@ -79,6 +64,12 @@ export default {
}, },
data() { data() {
return { return {
power: {
add: '',
del: '',
edit: '',
release: '',
},
// //
queryParam: { queryParam: {
projectName: null, projectName: null,
@ -129,7 +120,7 @@ export default {
{ {
title: '操作', title: '操作',
width: 200, width: 200,
align: 'center', align: 'right',
scopedSlots: { customRender: 'action' }, scopedSlots: { customRender: 'action' },
}, },
], ],
@ -147,7 +138,7 @@ export default {
this.changeType() this.changeType()
}, },
// - // -
destroyed() {}, destroyed() { },
// data // data
watch: { watch: {
$route(to, from) { //to from $route(to, from) { //to from
@ -156,12 +147,17 @@ export default {
}, },
}, },
methods: { methods: {
getDetail(record){ //
handledRelease(record){
},
//
getDetail(record) {
this.$router.push({ this.$router.push({
path: '/project/detail', path: '/project/detail',
query: { query: {
id: record.id, // id: record.id, //
t:this.queryParam.type, t: this.queryParam.type,
projectId: record.id, //id projectId: record.id, //id
projectPageNum: this.$refs.table.localPagination.current, // projectPageNum: this.$refs.table.localPagination.current, //
}, },
@ -181,14 +177,23 @@ export default {
// //
changeType(path) { changeType(path) {
var arr = [] var arr = []
if(path){ if (path) {
arr = path.split('/') arr = path.split('/')
}else{ } else {
arr = this.$route.path.split('/') arr = this.$route.path.split('/')
} }
this.queryParam.type = arr[arr.length - 1] let str = arr[arr.length - 1]
this.queryParam.type = str
//
str === 'sys' ? this.power.add = 'project:sys:add' : this.power.add = 'project:add'
str === 'sys' ? this.power.del = 'project:sys:del' : this.power.del = 'project:del'
str === 'sys' ? this.power.edit = 'project:sys:edit' : this.power.edit = 'project:edit'
str === 'sys' ? this.power.release = 'project:sys:release' : this.power.release = 'project:release'
}, },
}, },
} }
</script> </script>

View File

@ -1,11 +1,5 @@
<template> <template>
<a-card class="coures" :bordered="false" title="项目课程信息"> <a-card class="coures" :bordered="false" title="项目课程信息">
<!-- <template slot="extra">
<a-button type="primary" size="default" @click="toNext">下一步</a-button>
</template>
<template slot="extra">
<a-button type="primary" size="default" @click="toPrep">上一步</a-button>
</template> -->
<a-space direction="vertical" style="width: 100%"> <a-space direction="vertical" style="width: 100%">
<a-space direction="horizontal"> <a-space direction="horizontal">
<span>总课时{{ form.totalCourseHours }}H , 总学时要求{{ form.totalLearnHours }}H , 总题目数量{{ form.totalTopicNumber }} </span> <span>总课时{{ form.totalCourseHours }}H , 总学时要求{{ form.totalLearnHours }}H , 总题目数量{{ form.totalTopicNumber }} </span>
@ -111,7 +105,6 @@ export default {
{ title: '课时', dataIndex: 'courseHours', key: 'courseHours', customRender: (text) => text + 'H' }, { title: '课时', dataIndex: 'courseHours', key: 'courseHours', customRender: (text) => text + 'H' },
{ title: '学时要求', dataIndex: 'learnHours', key: 'learnHours', customRender: (text) => text + 'H' }, { title: '学时要求', dataIndex: 'learnHours', key: 'learnHours', customRender: (text) => text + 'H' },
{ title: '题量', dataIndex: 'topicNumber', key: 'topicNumber' }, { title: '题量', dataIndex: 'topicNumber', key: 'topicNumber' },
// { title: '', dataIndex: 'projectName', key: 'projectName' },
{ title: '操作', width: 200, align: 'center', scopedSlots: { customRender: 'action' } }, { title: '操作', width: 200, align: 'center', scopedSlots: { customRender: 'action' } },
], // ], //
loadData: (parameter) => { loadData: (parameter) => {
@ -119,7 +112,6 @@ export default {
/** 编辑进来的有项目id */ /** 编辑进来的有项目id */
return getCourseList({id:this.$route.query.projectId}).then((res) => { return getCourseList({id:this.$route.query.projectId}).then((res) => {
this.selData = res.data; this.selData = res.data;
this.calc(res.data) this.calc(res.data)
return res.data return res.data
}) })
@ -127,7 +119,6 @@ export default {
/** 新建的没有项目id传当前的所选的课程id */ /** 新建的没有项目id传当前的所选的课程id */
return getCourseListByCourseIds(Object.assign(parameter, this.queryParam)).then((res) => { return getCourseListByCourseIds(Object.assign(parameter, this.queryParam)).then((res) => {
this.selData = res.data; this.selData = res.data;
// console.log('list----selData',this.selData)
this.calc(res.data) this.calc(res.data)
return res.data return res.data
}) })

View File

@ -1,24 +1,17 @@
<template> <template>
<a-modal <a-modal id="modal" :title="modalTitle" :width="1500" height="auto" :visible="visible" @ok="handleSubmit" @cancel="handleCancel">
id="modal"
:title="modalTitle"
:width="1500"
height="auto"
:visible="visible"
@ok="handleSubmit"
@cancel="handleCancel"
>
<a-card :bordered="false" title="项目课程选择"> <a-card :bordered="false" title="项目课程选择">
<a-row type="flex" justify="center" align="top"> <a-row type="flex" justify="center" align="top">
<a-col :span="4" id="tree"> <a-col :span="4" id="tree">
<a-page-header title="单位列表" sub-title="" /> <a-menu v-model="menuKey" mode="horizontal" @click="menuChack()">
<a-tree <a-menu-item key="sys">
:treeData="treeData" 系统课程
@select="onSelect" </a-menu-item>
:defaultExpandAll="true" <a-menu-item key="self">
:defaultExpandedKeys="defaultExpandedKeys" 自主课程
:replaceFields="replaceFields" </a-menu-item>
> </a-menu>
<a-tree :treeData="treeData" @select="onSelect" :defaultExpandAll="true" :defaultExpandedKeys="defaultExpandedKeys" :replaceFields="replaceFields">
<a-icon slot="switcherIcon" type="down" /> <a-icon slot="switcherIcon" type="down" />
</a-tree> </a-tree>
</a-col> </a-col>
@ -33,13 +26,7 @@
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button> <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
</a-row> </a-row>
</a-form> </a-form>
<s-table <s-table ref="table" :columns="columns" :data="loadData" :rowKey="(record) => record.id" :rowSelection="{ selectedRowKeys: selectedRowKeys, selectedRows: selectedRows, onChange: onSelectChange }">
ref="table"
:columns="columns"
:data="loadData"
:rowKey="(record) => record.id"
:rowSelection="{ selectedRowKeys: selectedRowKeys, selectedRows: selectedRows, onChange: onSelectChange }"
>
<span slot="serial" slot-scope="text, record, index"> <span slot="serial" slot-scope="text, record, index">
{{ index + 1 }} {{ index + 1 }}
</span> </span>
@ -83,6 +70,8 @@ export default {
visible: false, // visible: false, //
modalTitle: '', modalTitle: '',
menuKey: ['sys'], //
// //
queryParam: { name: '', classType: 0 }, queryParam: { name: '', classType: 0 },
replaceFields: { children: 'children', title: 'name', key: 'id', value: 'id' }, replaceFields: { children: 'children', title: 'name', key: 'id', value: 'id' },
@ -116,6 +105,14 @@ export default {
watch: {}, watch: {},
// //
methods: { methods: {
//
menuChack(){
console.log('menuKey',this.menuKey)
let type = 0;
if(this.menuKey[0] === 'self') type = 1;
this.getCourseTreeData(type);
this.$refs.table.refresh();
},
// //
edit(record) { edit(record) {
console.log('课程选择打开了', record) console.log('课程选择打开了', record)
@ -188,6 +185,7 @@ export default {
this.expandedKeys = expandedKeys this.expandedKeys = expandedKeys
this.autoExpandParent = false this.autoExpandParent = false
}, },
// //
queryCourseList() { queryCourseList() {
console.log('this.treeDataOne-------', this.treeDataOne) console.log('this.treeDataOne-------', this.treeDataOne)
@ -195,9 +193,10 @@ export default {
this.courseData = res.data this.courseData = res.data
}) })
}, },
// //
getCourseTreeData(key) { getCourseTreeData(type) {
coursewareClassList().then((res) => { coursewareClassList({type:type}).then((res) => {
//list🌲 //list🌲
const list2tree1 = (list, parentId) => { const list2tree1 = (list, parentId) => {
return list.filter((item) => { return list.filter((item) => {
@ -216,24 +215,24 @@ export default {
}, },
// - 访this // - 访this
created() { created() {
this.getCourseTreeData() this.getCourseTreeData(0) //
}, },
// - 访DOM // - 访DOM
mounted() {}, mounted() { },
// - // -
beforeCreate() {}, beforeCreate() { },
// - // -
beforeMount() {}, beforeMount() { },
// - // -
beforeUpdate() {}, beforeUpdate() { },
// - // -
updated() {}, updated() { },
// - // -
beforeDestroy() {}, beforeDestroy() { },
// - // -
destroyed() {}, destroyed() { },
// keep-alive // keep-alive
activated() {}, activated() { },
} }
</script> </script>
<style scoped> <style scoped>

View File

@ -1,5 +1,12 @@
<template> <template>
<a-modal :title="modalTitle" :width="1000" :visible="visible" :confirmLoading="confirmLoading" @ok="handleSubmit" @cancel="handleCancel" :destroyOnClose="true"> <a-modal
:title="modalTitle"
:width="1000"
:visible="visible"
:confirmLoading="confirmLoading"
@ok="handleSubmit"
@cancel="handleCancel"
:destroyOnClose="true">
<a-spin :spinning="formLoading"> <a-spin :spinning="formLoading">
<a-form :form="form"> <a-form :form="form">
@ -33,7 +40,13 @@
<a-col :md="12" :sm="24"> <a-col :md="12" :sm="24">
<div v-show="pidShow"> <div v-show="pidShow">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="父级菜单" has-feedback> <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="父级菜单" has-feedback>
<a-tree-select v-decorator="['pid', {initialValue: treeSelDefaultValue},{rules: [{ required: true, message: '请选择父级菜单' }]}]" style="width: 100%" :dropdownStyle="{ maxHeight: '300px', overflow: 'auto' }" :treeData="menuTreeData" placeholder="请选择父级菜单" :replaceFields="{ <a-tree-select
v-decorator="['pid', {initialValue: treeSelDefaultValue},{rules: [{ required: true, message: '请选择父级菜单!' }]}]"
style="width: 100%"
:dropdownStyle="{ maxHeight: '300px', overflow: 'auto' }"
:treeData="menuTreeData"
placeholder="请选择父级菜单"
:replaceFields="{
children:'children', children:'children',
title:'name', title:'name',
key:'id', key:'id',
@ -112,7 +125,7 @@
import { menuTree, menuAdd, menuEdit } from '@/api/security/menu' import { menuTree, menuAdd, menuEdit } from '@/api/security/menu'
export default { export default {
data() { data () {
return { return {
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
@ -122,7 +135,7 @@ export default {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 16 } sm: { span: 16 }
}, },
modalTitle: "新增菜单", modalTitle: '新增菜单',
visible: false, visible: false,
confirmLoading: false, confirmLoading: false,
menuTreeData: [], menuTreeData: [],
@ -137,14 +150,14 @@ export default {
formLoading: true, formLoading: true,
type: '', type: '',
form: this.$form.createForm(this), form: this.$form.createForm(this),
treeSelDefaultValue: 1, treeSelDefaultValue: 1
} }
}, },
methods: { methods: {
// //
add(type) { add (type) {
this.modalTitle = "新增菜单" this.modalTitle = '新增菜单'
this.visible = true this.visible = true
// //
@ -153,7 +166,7 @@ export default {
// //
this.form.getFieldDecorator('visible', { initialValue: true }) this.form.getFieldDecorator('visible', { initialValue: true })
this.treeSelDefaultValue = type; this.treeSelDefaultValue = type
// //
this.getMenuTree() this.getMenuTree()
@ -161,8 +174,8 @@ export default {
this.formLoading = false this.formLoading = false
}, },
// //
edit(record) { edit (record) {
this.modalTitle = "编辑菜单" this.modalTitle = '编辑菜单'
this.visible = true this.visible = true
// //
@ -175,7 +188,7 @@ export default {
this.visibleDef = true this.visibleDef = true
} }
this.form.getFieldDecorator('visible', { valuePropName: 'checked', initialValue: this.visibleDef }) this.form.getFieldDecorator('visible', { valuePropName: 'checked', initialValue: this.visibleDef })
this.treeSelDefaultValue = record.id; this.treeSelDefaultValue = record.id
setTimeout(() => { setTimeout(() => {
this.setMenuItem(record) this.setMenuItem(record)
@ -185,7 +198,7 @@ export default {
this.formLoading = false this.formLoading = false
}, },
getMenuTree() { getMenuTree () {
menuTree().then((res) => { menuTree().then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.form.resetFields(`pid`, []) this.form.resetFields(`pid`, [])
@ -206,7 +219,7 @@ export default {
/** /**
* 选择菜单类型执行初始化表单变量 * 选择菜单类型执行初始化表单变量
*/ */
meneTypeFunc(type) { meneTypeFunc (type) {
this.type = type this.type = type
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if (type == '0' || type == '1') { if (type == '0' || type == '1') {
@ -221,6 +234,7 @@ export default {
} }
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
if (type == '0') { if (type == '0') {
console.log(type)
// PageView // PageView
this.componentShow = true this.componentShow = true
this.componentDisabled = false this.componentDisabled = false
@ -228,6 +242,7 @@ export default {
this.componentRequired = true this.componentRequired = true
// //
this.form.getFieldDecorator('pid', { initialValue: '0' }) this.form.getFieldDecorator('pid', { initialValue: '0' })
this.treeSelDefaultValue = 0
this.pidShow = false this.pidShow = false
} else { } else {
// eslint-disable-next-line eqeqeq // eslint-disable-next-line eqeqeq
@ -256,7 +271,7 @@ export default {
this.form.getFieldDecorator('permission', { initialValue: '' }) this.form.getFieldDecorator('permission', { initialValue: '' })
} }
}, },
handleSubmit() { handleSubmit () {
const { form: { validateFields } } = this const { form: { validateFields } } = this
this.confirmLoading = true this.confirmLoading = true
validateFields((errors, values) => { validateFields((errors, values) => {
@ -299,12 +314,12 @@ export default {
} }
}) })
}, },
handleCancel() { handleCancel () {
this.form.resetFields() this.form.resetFields()
this.confirmLoading = false this.confirmLoading = false
this.visible = false this.visible = false
}, },
setMenuItem(record) { setMenuItem (record) {
console.log(record) console.log(record)
this.form.setFieldsValue( this.form.setFieldsValue(
{ {

View File

@ -1,6 +1,12 @@
<template> <template>
<div class="main"> <div class="main">
<a-form-model ref="ruleForm" class="user-layout-login" :model="form" :rules="rules" @submit.prevent="handleSubmit"> <a-form-model ref="ruleForm" class="user-layout-login" :model="form" :rules="rules" @submit.prevent="handleSubmit">
<a-form-model-item>
<a-select v-model="form.roleCode" placeholder="请选择">
<a-select-option value="student">学员</a-select-option>
<a-select-option value="platform_manager">管理员</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item> <a-form-model-item>
<a-input size="large" v-model="form.username" placeholder="请输入用户名"> <a-input size="large" v-model="form.username" placeholder="请输入用户名">
<a-icon slot="prefix" type="user" style="color:rgba(0,0,0,.25)" /> <a-icon slot="prefix" type="user" style="color:rgba(0,0,0,.25)" />
@ -23,22 +29,24 @@ import { mapActions } from 'vuex'
import { timeFix } from '@/utils/util' import { timeFix } from '@/utils/util'
export default { export default {
data() { data () {
return { return {
form: { form: {
username: '', username: '',
password: '' password: '',
roleCode: 'student'
}, },
rules: { rules: {
username: [{ required: true, message: '请输入用户名' }], username: [{ required: true, message: '请输入用户名' }],
password: [{ required: true, message: '请输入密码', trigger: 'blur' }] password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
roleCode: [{ required: true, message: '请输入密码', trigger: 'change' }]
}, },
loading: false loading: false
} }
}, },
methods: { methods: {
...mapActions(['Login', 'Logout']), ...mapActions(['Login', 'Logout']),
handleSubmit() { handleSubmit () {
if (this.loading) { if (this.loading) {
return false return false
} }
@ -57,7 +65,7 @@ export default {
} }
}) })
}, },
loginSuccess(res) { loginSuccess (res) {
this.loading = false this.loading = false
this.$router.push({ path: '/' }) this.$router.push({ path: '/' })
// 1 // 1
@ -68,7 +76,7 @@ export default {
}) })
}, 1000) }, 1000)
}, },
requestFailed() { requestFailed () {
this.loading = false this.loading = false
} }
} }