培训计划增加选择单位,项目详情:如果是系统项目不显示考试次数与模拟考试,培训类型为 培训 或 培训-练习 时不显示考试次数;项目列表中去除人数列

This commit is contained in:
Yjhon 2022-05-11 17:52:30 +08:00
parent f5eff86650
commit 88f195eda0
3 changed files with 49 additions and 15 deletions

View File

@ -12,15 +12,16 @@
<a-descriptions-item v-if="projectBasicInfo.trainSdate != null" label="培训时间">{{projectBasicInfo.trainSdate + ' - ' + projectBasicInfo.trainEdate}}</a-descriptions-item>
<a-descriptions-item v-if="projectBasicInfo.practiceSdate != null" label="练习时间">{{projectBasicInfo.practiceSdate + ' - ' + projectBasicInfo.practiceEdate}}</a-descriptions-item>
<a-descriptions-item v-if="projectBasicInfo.examSdate != null" label="考试时间">{{projectBasicInfo.examSdate + ' - ' + projectBasicInfo.examEdate}}</a-descriptions-item>
<a-descriptions-item label="考试次数">{{projectBasicInfo.examNumber + '次'}}</a-descriptions-item>
<a-descriptions-item label="模拟考试">{{projectBasicInfo.mockExam == 1 ? '允许':'不允许'}}</a-descriptions-item>
<!-- 如果是系统项目不显示培训类型为 培训 培训-练习 时不显示-->
<a-descriptions-item v-if="projectBasicInfo.projectType != 0 || !['1','3'].includes(projectBasicInfo.trainWay)" label="考试次数">{{projectBasicInfo.examNumber + ''}}</a-descriptions-item>
<a-descriptions-item v-if="projectBasicInfo.projectType != 0" label="模拟考试">{{projectBasicInfo.mockExam == 1 ? '允许':'不允许'}}</a-descriptions-item>
<a-descriptions-item label="备注">{{projectBasicInfo.remark}}</a-descriptions-item>
</a-descriptions>
</a-card>
<a-card :bordered="false" title="课程信息">
<a-table :columns="courseColumns" :data-source="projectBasicInfo.courseLists" size="small" :pagination="false" />
</a-card>
<a-card :bordered="false" title="人员信息">
<a-card v-if="projectBasicInfo.projectType != 0" :bordered="false" title="人员信息">
<a-table :columns="personColumns" :data-source="projectBasicInfo.projectPersonLists" size="small" :pagination="false" />
</a-card>
<a-card :bordered="false" title="组卷信息">

View File

@ -97,7 +97,7 @@ export default {
return record.startDate + ' - ' + record.endDate
},
},
{ title: '人数', key: 'personNum', dataIndex: 'personNum', customRender: (text) => text + '人' },
// { title: '', key: 'personNum', dataIndex: 'personNum', customRender: (text) => text + '' },
{
title: '项目类型', dataIndex: 'trainType', key: 'trainType', customRender: (text, record, index) => {
//
@ -225,7 +225,7 @@ export default {
// 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 != 'personNum'})
c = c.filter(item => {return item.key != 'status'})
this.columns = c

View File

@ -9,8 +9,15 @@
<a-select-option v-for="entity in years" :key="entity"> {{ entity }}年度 </a-select-option>
</a-select>
</a-form-model-item>
<a-button v-if="!disabled" type="primary" size="default" icon="plus" @click="showDrawer" style="margin-right: 8px;">选择项目</a-button>
<a-table v-if="selectedRows.length > 0" rowKey="id" :columns="columns" :data-source="selectedRows" :pagination="false">
<a-form-model-item label="培训单位" prop="orgId">
<!-- v-decorator="['pid', { rules: [{ required: true, message: '请选择单位!' }] }]" -->
<a-tree-select style="width: 100%" v-model="form.orgId" :dropdownStyle="{ maxHeight: '300px', overflow: 'auto' }"
:treeData="orgTree" placeholder="请选择单位" :replaceFields="replaceFields" :disabled="disabled"/>
</a-form-model-item>
<a-button v-if="!disabled" type="primary" size="default" icon="plus" @click="showDrawer"
style="margin-right: 8px;">选择项目</a-button>
<a-table v-if="selectedRows.length > 0" rowKey="id" :columns="columns" :data-source="selectedRows"
:pagination="false">
<span slot="serial" slot-scope="text, record, index">
{{ index + 1 }}
</span>
@ -19,13 +26,17 @@
<a-input v-model="form.remark" type="textarea" :disabled="disabled" />
</a-form-model-item>
<a-col :span="24" style="text-align: center;">
<a-button v-if="!disabled" type="primary" size="default" @click="handleSave" style="margin-right: 8px;">保存</a-button>
<a-button v-if="!disabled" type="primary" size="default" @click="handleSave" style="margin-right: 8px;">保存
</a-button>
<a-button type="danger" size="default" @click="showConfirm">关闭</a-button>
</a-col>
</a-form-model>
<a-drawer title="选择项目" placement="right" :width="800" :closable="false" :visible="visible" :after-visible-change="afterVisibleChange" @close="onClose">
<s-table ref="table" size="default" rowKey="id" :columns="columns" :rowSelection="{ selectedRowKeys: selectedRowKeys, selectedRows: selectedRows,onChange: onSelectChange, onSelect: tableOnSelect ,onSelectAll: tableAllSelected }" :data="loadData" :pageNum="Number(this.$route.query.projectPageNum) || 1">
<a-drawer title="选择项目" placement="right" :width="800" :closable="false" :visible="visible"
:after-visible-change="afterVisibleChange" @close="onClose">
<s-table ref="table" size="default" rowKey="id" :columns="columns"
:rowSelection="{ selectedRowKeys: selectedRowKeys, selectedRows: selectedRows, onChange: onSelectChange, onSelect: tableOnSelect, onSelectAll: tableAllSelected }"
:data="loadData" :pageNum="Number(this.$route.query.projectPageNum) || 1">
</s-table>
</a-drawer>
</a-card>
@ -37,6 +48,9 @@
import { STable } from '@/components'
import { getProjectList } from '@/api/project/project'
import { trainPlanAdd, trainPlanGet } from '@/api/trainplan';
import { orgList } from '@/api/org/org'
import { listToTree } from '@/utils/util'
const rootParentId = 0
export default {
// import使
@ -47,6 +61,7 @@ export default {
return {
disabled: false,
title: '年度培训计划',
orgTree: [],
queryParam: {
pageNum: 1,
pageSize: 20
@ -58,6 +73,7 @@ export default {
type: 2, //
name: '',
year: '',
orgId: '',
projectIds: [],
status: 1, //
},
@ -65,13 +81,20 @@ export default {
selectedRowKeys: [],
rules: {
name: [{ required: true, message: '请输入培训计划名称', trigger: 'blur' }],
orgId: [{ required: true, message: '请选择培训单位', trigger: 'change' }],
year: [{ required: true, message: '请选择培训计划年度', trigger: 'change' }],
},
wayEmun:['培训','考试','培训-练习','培训-练习-考试'],
replaceFields: {
children: 'children',
title: 'name',
key: 'id',
value: 'id'
},
wayEmun: ['培训', '考试', '培训-练习', '培训-练习-考试'],
columns: [
{ title: '序号', key: 'id', dataIndex: 'id', width: 60, scopedSlots: { customRender: 'serial' } },
{ title: '项目名称', dataIndex: 'projectName', key: 'projectName' },
{ title: '项目类型', key: 'trainWay', dataIndex: 'trainWay',customRender: (text, record, index) => { return this.wayEmun[Number(text)-1] } },
{ title: '项目类型', key: 'trainWay', dataIndex: 'trainWay', customRender: (text, record, index) => { return this.wayEmun[Number(text) - 1] } },
{ title: '创建人', dataIndex: 'createBy', key: 'createBy' },
{ title: '创建时间', dataIndex: 'createDate', key: 'createDate' }
],
@ -205,12 +228,22 @@ export default {
this.years.push(new Date().getFullYear() - 2 + i);
}
console.log('YEARS', this.years)
}
},
/**
* 获取机构树并加载于表单中
*/
getOrgTree() {
const params = { orgType: this.orgType }
orgList(params).then((res) => {
const orgList = listToTree(res.data, [], rootParentId)
this.orgTree = orgList
})
},
},
// - 访this
created() {
let id = this.$route.query.trainPlanId;
this.getOrgTree();
this.initYears();
if (id) {
trainPlanGet({ id: id }).then((res) => {
@ -221,7 +254,7 @@ export default {
this.columns = this.columns.filter(item => { return item.key != 'createBy' })
this.columns = this.columns.filter(item => { return item.key != 'createDate' })
this.columns.push({title:'参与人数',dataIndex:'signCount',key:'signCount'});
this.columns.push({ title: '参与人数', dataIndex: 'signCount', key: 'signCount' });
})
}
if (this.$route.query.t != 'year') {