项目调整,培训计划变更

This commit is contained in:
Yjhon 2022-03-10 17:28:30 +08:00
parent 372890bc7a
commit 8f4387f5cc
11 changed files with 476 additions and 150 deletions

View File

@ -32,6 +32,7 @@
"mockjs2": "1.0.8",
"moment": "^2.24.0",
"nprogress": "^0.2.0",
"qs": "^6.10.3",
"react-draft-wysiwyg": "^1.14.7",
"store": "^2.0.12",
"viser-vue": "^2.4.6",

View File

@ -5,6 +5,7 @@ import notification from 'ant-design-vue/es/notification'
import { VueAxios } from './axios'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import router from '../router'
import qs from 'qs'
const SUCCESS_CODE = 200
const INVALID_TOKEN_CODE = 401
@ -60,6 +61,13 @@ request.interceptors.request.use(config => {
config.data = {}
}
}
// get方法传递数组的处理重点代码
if (config.method === 'get') {
config.paramsSerializer = function(params) {
return qs.stringify(params, { arrayFormat: 'repeat' })
}
}
return config
}, errorHandler)

View File

@ -40,19 +40,19 @@
<span slot="action" slot-scope="text, record">
<template>
<a-popconfirm title="是否发布?" @confirm="() => handledRelease(record)">
<a v-if="hasPerm(power.release) && record.status == '1'" href="javascript:;">发布</a>
<a v-if="hasPerm(power.release) && record.status == '1' && record.projectType != 0" href="javascript:;">发布</a>
</a-popconfirm>
<!-- <a v-if="hasPerm(power.release) && record.status == '1'" href="javascript:;" @click="handledRelease(record)">发布</a> -->
<a-divider type="vertical" v-if="hasPerm(power.edit) && hasPerm('project:list') && hasPerm(power.release) && record.status == '1'" />
<a v-if="hasPerm('project:list')" href="javascript:;" @click="getDetail(record)">详情</a>
<a-divider type="vertical" v-if="hasPerm(power.edit) && hasPerm('project:list') && ['1'].includes(record.status)" />
<a v-if="hasPerm(power.edit) && ['1'].includes(record.status)" href="javascript:;" @click="handledCreate(record)">修改</a>
<a-divider type="vertical" v-if="hasPerm(power.del) && hasPerm('project:list') && ['1'].includes(record.status)" />
<a-divider type="vertical" v-if="hasPerm(power.edit) && hasPerm('project:list') && hasPerm(power.release) && record.status == '1' && record.projectType != 0 " />
<a v-if="hasPerm('project:list') " href="javascript:;" @click="getDetail(record)">详情</a>
<a-divider type="vertical" v-if="hasPerm(power.edit) && hasPerm('project:list') && ['1'].includes(record.status) && (record.projectType != 0 || queryParam.type != 'model')" />
<a v-if="hasPerm(power.edit) && ['1'].includes(record.status) && (record.projectType != 0 || queryParam.type != 'model') " href="javascript:;" @click="handledCreate(record)">修改</a>
<a-divider type="vertical" v-if="hasPerm(power.del) && hasPerm('project:list') && ['1'].includes(record.status) && (record.projectType != 0 || queryParam.type != 'model') " />
<a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)">
<a v-if="hasPerm(power.del) && ['1'].includes(record.status)" href="javascript:;">删除</a>
<a v-if="hasPerm(power.del) && ['1'].includes(record.status) && (record.projectType != 0 || queryParam.type != 'model') " href="javascript:;">删除</a>
</a-popconfirm>
<a-divider type="vertical" v-if="queryParam.type == 'model'" />
<a v-if="queryParam.type == 'model'" href="javascript:;" @click="handledCreate(record)" >编辑后发布到自主项目</a>
<a v-if="queryParam.type == 'model'" href="javascript:;" @click="handledCreate(record)">编辑后发布到自主项目</a>
</template>
</span>
</s-table>
@ -111,6 +111,7 @@ export default {
},
{
title: '项目状态',
key: 'status',
dataIndex: 'status',
customRender: (text, record, index) => {
// 1- 2- 3- 4-
@ -124,7 +125,7 @@ export default {
return '进行中'
}
if (text == 4) {
return '已完成'
return '已结束'
}
},
},
@ -133,6 +134,7 @@ export default {
{
title: '操作',
width: 200,
key: 'action',
align: 'center',
scopedSlots: { customRender: 'action' },
},
@ -204,6 +206,7 @@ export default {
},
//
changeType(path) {
console.log('变更路由:',path)
var arr = []
if (path) {
arr = path.split('/')
@ -212,6 +215,23 @@ export default {
}
let str = arr[arr.length - 1]
this.queryParam.type = str
/** 控制表格列的显示 */
if (str === 'sys' || str === 'model') {
let c = this.columns;
// console.log('columns-------c', c)
// let d = c.filter(item => {return item.key != 'startDate'})
// let e = d.filter(item => {return item.key != 'personNum'})
// let f = e.filter(item => {return item.key != 'status'})
c = c.filter(item => {return item.key != 'startDate'})
c = c.filter(item => {return item.key != 'personNum'})
c = c.filter(item => {return item.key != 'status'})
this.columns = c
console.log('columns-------', this.columns)
}
//
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'

View File

@ -1,19 +1,21 @@
<template>
<!-- PageHeader 第二种使用方式 (v-slot) -->
<a-card :bordered="false" :title="title">
<a-steps class="steps" :current="currentTab">
<a-step title="基本信息" />
<a-steps ref="steps" class="steps" :current="currentTab">
<a-step key="basic" title="基本信息" :disabled="true" />
<!-- <a-step title="选择单位" /> -->
<a-step title="选择课程" />
<a-step v-if="this.form.projectType != 0" title="选择人员" />
<a-step v-if="['2', '4'].includes(form.trainWay)" title="组卷策略" />
<a-step :title="this.result ? '完成' : '失败'" />
<a-step key="course" title="选择课程" :disabled="true" />
<a-step key="person" title="选择人员" :disabled="true" />
<!-- v-if="this.form.projectType != 0" -->
<a-step key="zujuan" title="组卷策略" :disabled="true" />
<!-- v-if="['2', '4'].includes(form.trainWay)" -->
<a-step key="result" :title="this.result ? '完成' : '失败'" :disabled="true" />
</a-steps>
<div class="content">
<div class="content" >
<!-- <keep-alive exclude="result"> -->
<step1 v-if="currentTab === 0" :projectForm="form" @nextStep="nextStep" @close="close" @setFormType="setFormType"/>
<step1 v-if="currentTab === 0" :projectForm="form" @nextStep="nextStep" @close="close" @setFormType="setFormType" />
<!-- <step2 v-if="currentTab === 1" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" @executeSave="executeSave"/> -->
<step3 v-if="currentTab === 1" :projectForm="form" :courseChange="courseChange" @nextStep="nextStep" @prevStep="prevStep" />
<step3 v-if="currentTab === 1" :projectForm="form" :courseChange="courseChange" @nextStep="nextStep" @prevStep="prevStep" @executeSave="executeSave" @executeIssue="executeIssue" />
<step4 v-if="currentTab === 2" :projectForm="form" @nextStep="nextStep" @prevStep="prevStep" @executeSave="executeSave" @executeIssue="executeIssue" />
<step5 v-if="currentTab === 3" :projectForm="form" @prevStep="prevStep" @executeSave="executeSave" @executeIssue="executeIssue" />
<result v-if="currentTab === 4" :projectForm="form" @prevStep="prevStep" :projectSaveStatus="status" @close="close" />
@ -46,11 +48,11 @@ export default {
// - 访this
created() {
console.log('分步表单创建完成', this.$route)
if(this.$route.query.t === 'self') this.form.projectType = 1;
if (this.$route.query.t === 'self') this.form.projectType = 1;
// if(this.$route.query.t === 'year') this.form.projectType = 2;
// if(this.$route.query.t === 'unit') this.form.projectType = 3;
if(this.$route.query.t === 'year') this.form.projectType = 2;
if(this.$route.query.t === 'unit') this.form.projectType = 3;
if (this.$route.query.t === 'year') this.form.projectType = 2;
if (this.$route.query.t === 'unit') this.form.projectType = 3;
},
destroyed() {
console.log('分步表单销毁了。。。。。')
@ -59,15 +61,17 @@ export default {
return {
title: '',
currentTab: 0,
currentTab: 0,
sourcePath: '',
t: '',
labelCol: {xs: { span: 24 }, sm: { span: 6 } },
labelCol: { xs: { span: 24 }, sm: { span: 6 } },
wrapperCol: { xs: { span: 24 }, sm: { span: 16 } },
modalTitle: '新增项目',
visible: false,
confirmLoading: false,
type: '',
form: {
stag: 0, //0
t: this.$route.query.t,
projectType: 0,
trainWay: '4',
@ -80,7 +84,7 @@ export default {
},
methods: {
//
setFormType(type){
setFormType(type) {
this.form.trainWay = type
},
//
@ -114,31 +118,42 @@ export default {
},
//
nextStep(childValue,beChange) {
console.log('进入下一步', childValue,beChange)
if(beChange){
nextStep(childValue, beChange) {
console.log('进入下一步', childValue, beChange)
if (beChange) {
this.courseChange = beChange
}
if (this.currentTab < 5) {
if (this.currentTab < 4) {
if (childValue) {
this.form = childValue
}
if (this.form.projectType == 0 && this.currentTab == 1) {
this.currentTab = 3
} else {
this.currentTab += 1
}
}
console.log('currentTab key:', this.$refs.steps.$slots.default)
console.log('currentTab:', this.currentTab, 'currentTab:', this.currentTab)
console.log('ProjectStepForm表单数据', this.form)
},
//
prevStep(childValue,beChange) {
if(beChange){
prevStep(childValue, beChange) {
if (beChange) {
this.courseChange = beChange
}
console.log('返回上一步', childValue,beChange)
console.log('返回上一步', childValue, beChange)
if (this.currentTab > 0) {
if (childValue) {
this.form = childValue
}
if (this.form.projectType == 0 && this.currentTab == 2) {
this.currentTab = 1
} else {
this.currentTab -= 1
}
}
console.log('currentTab:', this.currentTab, 'currentTab:', this.currentTab)
console.log('ProjectStepForm表单数据', this.form)
},
//list

View File

@ -43,7 +43,9 @@
<project-course-select ref="CourseSelect" @selectKeyDataSubmit="selectKeyDataChange" :tabDisabled="tabDisabled" :selectRows="selData"></project-course-select>
<a-col :span="24" style="text-align: center;margin-top: 10px;">
<a-button type="primary" size="default" @click="toPrep" style="margin-right: 8px;">上一步</a-button>
<a-button type="primary" size="default" @click="toNext">下一步</a-button>
<a-button v-if="['2','4'].includes(form.trainWay) || form.projectType != 0 " type="primary" size="default" @click="toNext">下一步</a-button>
<a-button v-if="['1','3'].includes(form.trainWay) && form.projectType == 0 " type="primary" size="default" @click="toSaveOrIssue('save')" style="margin-right: 8px;">保存</a-button>
<a-button v-if="['1','3'].includes(form.trainWay) && form.projectType == 0 " type="primary" size="default" @click="toSaveOrIssue('issue')">发布</a-button>
</a-col>
<a-drawer title="课程预览" :destroyOnClose="true" placement="right" width="1200" :closable="true" :visible="courseVisible" @close="drawerClose">
<courseware-list :courseId="selectCourseId"></courseware-list>
@ -100,7 +102,7 @@ export default {
courseVisible: false, //
questionVisible: false, //
requiredTopicVisible:false, //
requiredTopicVisible: false, //
queryParam: {
ids: '',
@ -117,7 +119,7 @@ export default {
loadData: (parameter) => {
if (this.$route.query.projectId && !this.beChange) {
/** 编辑进来的有项目id 并且没有被编辑过*/
return getCourseList({id:this.$route.query.projectId}).then((res) => {
return getCourseList({ id: this.$route.query.projectId }).then((res) => {
this.selData = res.data;
this.calc(res.data)
return res.data
@ -140,22 +142,42 @@ export default {
//
methods: {
//
drawerClose(){
drawerClose() {
this.courseVisible = false;
this.requiredTopicVisible = false;
this.questionVisible = false;
},
//
openVisible(type,record) {
openVisible(type, record) {
this.selectCourseId = record.id;
if(type === 'course') this.courseVisible = true;
else if(type === 'topic') this.requiredTopicVisible = true;
else if(type === 'question') this.questionVisible = true;
if (type === 'course') this.courseVisible = true;
else if (type === 'topic') this.requiredTopicVisible = true;
else if (type === 'question') this.questionVisible = true;
},
/** 删除table项 */
handleDelete(record){
// &&
toSaveOrIssue(type) {
this.form.lessonIds = []
let ids = this.queryParam.ids.split(',')
ids.forEach((id, index, arr) => {
if (id != '') {
this.form.lessonIds.push({ ids: id, sort: index })
}
})
if (this.form.lessonIds.length > 0) {
console.log('进来了')
if (type != 'issue') {
console.log('save')
this.form.projectStatus = 1
this.$emit('executeSave', this.form)
} else {
console.log('issue')
this.form.projectStatus = 2
this.$emit('executeIssue', this.form)
}
} else {
this.$message.warning('培训课程不能为空')
}
},
//
calc(data) {
@ -174,10 +196,13 @@ export default {
let ids = this.queryParam.ids.split(',')
ids.forEach((id, index, arr) => {
// console.log('id-----------------------', id)
if (id != '') {
this.form.lessonIds.push({ ids: id, sort: index })
}
})
if (this.form.lessonIds.length > 0) {
this.$emit('nextStep', this.form,this.beChange)
console.log('----------', this.form.lessonIds)
this.$emit('nextStep', this.form, this.beChange)
} else {
this.$message.warning('培训课程不能为空')
}
@ -187,11 +212,13 @@ export default {
this.form.lessonIds = []
let ids = this.queryParam.ids.split(',')
ids.forEach((id, index, arr) => {
if (id != '') {
this.form.lessonIds.push({ ids: id, sort: index })
}
})
// console.log('toPrep', this.form)
this.$emit('prevStep', this.form,this.beChange)
this.$emit('prevStep', this.form, this.beChange)
},
//ids
initIds() {
@ -207,7 +234,7 @@ export default {
})
this.queryParam.ids = arr.join(',')
}
if(this.form.projectType === 0) this.tabDisabled = true;
if (this.form.projectType === 0) this.tabDisabled = true;
},
//list
selectKeyDataChange(childValue) {

View File

@ -5,7 +5,8 @@
<a-col :span="4" id="tree">
<a-menu v-model="menuKey" mode="horizontal" @select="menuChack">
<a-menu-item key="sys">系统课程</a-menu-item>
<a-menu-item key="self" :disabled="tabDis">自主课程</a-menu-item>
<a-menu-item key="self" >自主课程</a-menu-item>
<!-- :disabled="tabDis" -->
</a-menu>
<!-- :defaultExpandedKeys="defaultExpandedKeys" -->
<a-tree :treeData="treeData" @select="onSelect" :defaultExpandAll="true" :replaceFields="replaceFields">
@ -20,6 +21,13 @@
<a-form-item label="课程名称">
<a-input v-model="queryParam.name" placeholder="请输入课程名称" />
</a-form-item>
<a-form-item label="标签名称">
<a-select mode="tags" style="width: 300px" placeholder="标签选择" @change="handleTagChange" :value="queryParam.tags">
<a-select-option v-for="(item,index) in dictCourseTag" :key="index" :value="item.value">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
</a-row>
</a-form>
@ -31,7 +39,7 @@
</s-table>
</a-col>
<a-col :span="6" id="select">
<div class="alist" >
<div class="alist">
<p>点击列表项取消选择或<a @click="removeAllSelece">清空所有</a></p>
<a-list size="small" :data-source="selectedRows" :rowKey="(item) => item.id">
<a-list-item slot="renderItem" slot-scope="item" @click="changeList({ item })">
@ -51,6 +59,7 @@
// import from ''
import { coursewareClassList } from '@/api/course/courseware'
import { listByClass } from '@/api/course/course'
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
import { STable } from '@/components'
const rootParentId = 0
@ -75,10 +84,11 @@ export default {
tabDis: this.tabDisabled,
menuKey: ['sys'], //
//
queryParam: { name: '', classType: 1, type: 1 },
queryParam: { name: '', classType: 1, type: 1, tags: [] },
replaceFields: { children: 'children', title: 'name', key: 'value', value: 'id' },
expandedKeys: [],
autoExpandParent: true,
dictCourseTag: [], //
// defaultExpandedKeys: [],
selectedRowKeys: [],
selectedRows: [],
@ -111,12 +121,19 @@ export default {
//
menuChack() {
console.log('menuKey', this.menuKey)
//
this.queryParam.name = null
this.queryParam.tags = []
let type = 2;
console.log('菜单改变', this.menuKey[0])
if (this.menuKey[0] === 'self') type = 1;
this.queryParam.type = type
this.getCourseTreeData(type);
this.$refs.table.refresh(true);
this.queryParam.name = null
this.queryParam.tags = []
},
//
edit(record) {
@ -147,6 +164,21 @@ export default {
this.selectedRowKeys = this.uniqueKeys([...this.selectedRowKeys, ...selectedRowKeys])
this.selectedRows = this.unique([...this.selectedRows, ...selectedRows])
},
//
dictionaryItemDown(code) {
//
dictionaryDropDown({ dictionaryCode: code }).then((res) => {
const tagList = res.data
for (let i = 0; i < tagList.length; i++) {
tagList[i].value = tagList[i].value.toString()
}
this.dictCourseTag = tagList
})
},
//
handleTagChange(value) {
this.queryParam.tags = value
},
/** table取消勾选 */
tableOnSelect(record, selected, selectedRows, nativeEvent) {
@ -243,6 +275,7 @@ export default {
// - 访this
created() {
this.getCourseTreeData(0) //
this.dictionaryItemDown('0008') //
},
// - 访DOM
mounted() { },

View File

@ -93,13 +93,6 @@
<a-form-model-item :style="{ display: 'inline-block', width: 'calc(30% - 1px)' }" prop="examNumber">
<a-input-number v-model="form.examNumber" :min="0" style="width: 100%" />
</a-form-model-item>
<!-- <span> 补考次数: </span>
<a-form-model-item :style="{ display: 'inline-block', width: 'calc(30% - 1px)' }">
<a-input-number v-model="form.resitNumber" :min="0" style="width: 100%" />
</a-form-model-item>
<a-form-model-item :style="{ display: 'inline-block', width: 'calc(30% - 1px)' }">
<a-button type="primary" @click="randomResit"> 随机补考 </a-button>
</a-form-model-item> -->
</a-form-model-item>
</a-col>
@ -127,7 +120,7 @@
</template>
<script>
import { classList } from '@/api/project/class'
import { dictGet , getProjectDetail } from '@/api/project/project'
import { dictGet, getProjectDetail } from '@/api/project/project'
import { dictionaryDropDown } from '@/api/sys/dictionaryItem'
export default {
@ -167,17 +160,19 @@ export default {
dictGet,
classList
},
computed: {},
created(ClassList) {
console.log('第一个表单创建了')
if (this.$route.query.projectId) {
if (this.$route.query.projectId && this.projectForm.stag == 0) {
getProjectDetail({ id: this.$route.query.projectId }).then(res => {
let form = res.data;
if(this.$route.query.t == 'model') {
console.log('form',form)
if (this.$route.query.t == 'model') {
console.log('form', form)
form.projectType = 1;
form.id = null;
}
this.form = form;
this.$emit('setFormType',this.form.trainWay)
this.$emit('setFormType', this.form.trainWay)
})
}
// this.fetchTemplateData()
@ -223,10 +218,49 @@ export default {
})
},
/** 条件判断隐藏 */
condition() {
let f = this.form;
console.log('条件判断')
if (f.projectType == 0) {
f.trainSdate = null;
f.trainEdate = null;
f.practiceSdate = null;
f.practiceEdate = null;
f.examSdate = null;
f.examEdate = null;
f.examNumber = null;
f.mockExam = null;
} else {
if (f.trainWay == '1') {
f.practiceSdate = null;
f.practiceEdate = null;
f.examSdate = null;
f.examEdate = null;
f.examNumber = null;
f.mockExam = null;
}
if (f.trainWay == '2') {
f.practiceSdate = null;
f.practiceEdate = null;
f.trainSdate = null;
f.trainEdate = null;
}
if (f.trainWay == '3') {
f.examSdate = null;
f.examEdate = null;
f.examNumber = null;
f.mockExam = null;
}
}
this.form = f;
},
//
//from
toNext() {
// console.log('toNext', this.form)
this.form.stag = 1;
this.condition();
this.$refs.form.validate(validate => {
if (validate) {
this.$emit('nextStep', this.form)
@ -237,5 +271,6 @@ export default {
destroyed() {
console.log('第一个表单销毁了')
}
}
</script>

View File

@ -1,6 +1,6 @@
<template>
<a-card :bordered="false" title="组卷策略信息">
<a-form-model :rules="rules" :model="form" v-bind="formItemLayout">
<a-form-model ref="form" :rules="rules" :model="form" v-bind="formItemLayout">
<a-row :gutter="24">
<a-col :md="10" :sm="12">
<a-form-model-item label="总分" prop="totalScore">
@ -35,13 +35,7 @@
</a-row>
<a-card :bordered="false" title="组卷策略详情">
<a-table
:columns="columns"
:data-source="tableData"
bordered
:position="{ disabled: false }"
:pagination="false"
>
<a-table :columns="columns" :data-source="tableData" bordered :position="{ disabled: false }" :pagination="false">
<template slot="topicNum" slot-scope="text, record">
<a-input-number style="margin: -5px 0" v-model="record.topicNum" :min="0" :max="record.totalNum" />
</template>
@ -140,7 +134,7 @@ export default {
watch: {
tableData: {
deep: true,
handler: function() {
handler: function () {
let sum = 0
this.tableData.forEach(t => {
if (t.topicNum && t.topicScore) {
@ -156,15 +150,23 @@ export default {
methods: {
//
toSave() {
this.form.testPaperTactics = this.tableData.filter((Item) => {return Item.topicNum && Item.topicScore});
this.form.testPaperTactics = this.tableData.filter((Item) => { return Item.topicNum && Item.topicScore });
this.form.projectStatus = 1
this.$refs.form.validate(validate => {
if (validate) {
this.$emit('executeSave', this.form)
}
})
},
//
toIssue() {
this.form.testPaperTactics = this.tableData.filter((Item) => {return Item.topicNum && Item.topicScore});
this.form.testPaperTactics = this.tableData.filter((Item) => { return Item.topicNum && Item.topicScore });
this.form.projectStatus = 2
this.$refs.form.validate(validate => {
if (validate) {
this.$emit('executeIssue', this.form)
}
})
},
//
toPrev() {
@ -195,21 +197,21 @@ export default {
this.initTable()
},
// - 访DOM
mounted() {},
mounted() { },
// -
beforeCreate() {},
beforeCreate() { },
// -
beforeMount() {},
beforeMount() { },
// -
beforeUpdate() {},
beforeUpdate() { },
// -
updated() {},
updated() { },
// -
beforeDestroy() {},
beforeDestroy() { },
// -
destroyed() {},
destroyed() { },
// keep-alive
activated() {}
activated() { }
}
</script>
<style scoped>

View File

@ -5,7 +5,7 @@
:form="queryParam"
:list="queryOptions"
@search="handleRefresh"
@reset="() => {;(queryParam = {}), handleRefresh()}"
@reset="() => {(queryParam = {}), handleRefresh()}"
></SearchCom>
<br/>
<a-space class="table-operator" direction="horizontal">
@ -69,10 +69,10 @@ export default {
//
return {
queryParam: {
status: this.$route.query.terminalTrainStatus || null,
name: this.$route.query.terminalTrainName || null,
startDate: this.$route.query.terminalTrainStartDate || null,
endDate: this.$route.query.terminalTrainEndDate || null,
status: null, //this.$route.query.terminalTrainStatus ||
name: null, //this.$route.query.terminalTrainName ||
startDate: null, //this.$route.query.terminalTrainStartDate ||
endDate: null, //this.$route.query.terminalTrainEndDate ||
},
columns: [
{ title: '序号', width: 'auto', align: 'center', dataIndex: 'id', key: 'id', scopedSlots: { customRender: 'serial' }, },

View File

@ -0,0 +1,47 @@
<template>
<a-card :bordered="false" title="培训计划">
</a-card>
</template>
<script>
// jsjsjson
// import from ''
export default {
// import使
components: {},
props: {},
data() {
//
return {};
},
// data
computed: {},
// data
watch: {},
//
methods: {},
// - 访this
created() { },
// - 访DOM
mounted() { },
// -
beforeCreate() { },
// -
beforeMount() { },
// -
beforeUpdate() { },
// -
updated() { },
// -
beforeDestroy() { },
// -
destroyed() { },
// keep-alive
activated() { }
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,138 @@
<template>
<a-card :bordered="false" :title="title">
<a-space direction="vertical" style="width: 100%">
<a-space direction="horizontal">
培训计划名称:
<a-input v-model="queryParam.name" style="width: 100%" />
计划年度:
<a-select v-model="queryParam.year" placeholder="请选择" default-value="null" style="width: 150px">
<a-select-option value="null">全部</a-select-option>
<a-select-option value="2022">2022年度</a-select-option>
<a-select-option value="2023">2023年度</a-select-option>
<a-select-option value="2024">2024年度</a-select-option>
</a-select>
<a-button type="primary" icon="search" @click="$refs.table.refresh(true)">查询</a-button>
<a-button icon="redo" @click="() => (queryParam.name=null,queryParam.year=null)">重置</a-button>
<a-button type="primary" icon="plus" @click="handledCreate">新增培训计划</a-button>
</a-space>
<s-table 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">
{{ index + 1 }}
</span>
<span slot="action" slot-scope="text, record">
<template>
<a-popconfirm title="是否发布?" @confirm="() => handledRelease(record)">
<a href="javascript:;">发布</a>
</a-popconfirm>
</template>
</span>
</s-table>
</a-space>
</a-card>
</template>
<script>
// jsjsjson
// import from ''
import { STable } from '@/components'
import { getProjectList, releaseProject, projectDel } from '@/api/project/project'
export default {
// import使
components: {
STable,
},
props: {},
data() {
//
return {
title: '',
queryParam: {
name: '',
year: '',
type: '',
},
//
columns: [
{ title: '序号', key: 'id', dataIndex: 'id', width: 60, scopedSlots: { customRender: 'serial' } },
{ title: '计划名称', dataIndex: 'projectName', key: 'projectName' },
{ title: '年度', dataIndex: 'startDate', key: 'startDate', customRender: (text, record, index) => { return record.year + ' 年度 ' } },
{
title: '项目状态', key: 'status', dataIndex: 'status',
customRender: (text, record, index) => {
// 1- 2- 3- 4-
if (text == 1) {
return '未发布'
}
if (text == 2) {
return '未开始'
}
if (text == 3) {
return '进行中'
}
if (text == 4) {
return '已结束'
}
},
},
{ title: '创建人员', key: 'createBy', dataIndex: 'createBy' },
{ title: '创建时间', key: 'createDate', dataIndex: 'createDate' },
{ title: '操作', width: 200, key: 'action', align: 'center', scopedSlots: { customRender: 'action' }, },
],
// Promise
loadData: (parameter) => {
return getProjectList(Object.assign(parameter, this.queryParam)).then((res) => {
return res
})
},
};
},
// data
computed: {},
// data
watch: {
$route(to, from) { //to from
this.changeType(to.path)
this.$refs.table.refresh(true)
},
},
//
methods: {
//
changeType(path) {
console.log('变更路由:', path)
var arr = []
if (path) {
arr = path.split('/')
} else {
arr = this.$route.path.split('/')
}
let str = arr[arr.length - 1]
this.queryParam.type = str
str == 'year' ? this.title='年度培训计划列表' : this.title='单位培训计划列表'
},
// - 访this
created() { this.changeType(this.$route.path) },
// - 访DOM
mounted() { },
// -
beforeCreate() { },
// -
beforeMount() { },
// -
beforeUpdate() { },
// -
updated() { },
// -
beforeDestroy() { },
// -
destroyed() { },
// keep-alive
activated() { }
}
}
</script>
<style scoped>
</style>