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

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.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.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 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-item label="备注">{{projectBasicInfo.remark}}</a-descriptions-item>
</a-descriptions> </a-descriptions>
</a-card> </a-card>
<a-card :bordered="false" title="课程信息"> <a-card :bordered="false" title="课程信息">
<a-table :columns="courseColumns" :data-source="projectBasicInfo.courseLists" size="small" :pagination="false" /> <a-table :columns="courseColumns" :data-source="projectBasicInfo.courseLists" size="small" :pagination="false" />
</a-card> </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-table :columns="personColumns" :data-source="projectBasicInfo.projectPersonLists" size="small" :pagination="false" />
</a-card> </a-card>
<a-card :bordered="false" title="组卷信息"> <a-card :bordered="false" title="组卷信息">

View File

@ -97,7 +97,7 @@ export default {
return record.startDate + ' - ' + record.endDate 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) => { title: '项目类型', dataIndex: 'trainType', key: 'trainType', customRender: (text, record, index) => {
// //
@ -225,7 +225,7 @@ export default {
// let f = e.filter(item => {return item.key != 'status'}) // let f = e.filter(item => {return item.key != 'status'})
c = c.filter(item => {return item.key != 'startDate'}) 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'}) c = c.filter(item => {return item.key != 'status'})
this.columns = c 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-option v-for="entity in years" :key="entity"> {{ entity }}年度 </a-select-option>
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
<a-button v-if="!disabled" type="primary" size="default" icon="plus" @click="showDrawer" style="margin-right: 8px;">选择项目</a-button> <a-form-model-item label="培训单位" prop="orgId">
<a-table v-if="selectedRows.length > 0" rowKey="id" :columns="columns" :data-source="selectedRows" :pagination="false"> <!-- 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"> <span slot="serial" slot-scope="text, record, index">
{{ index + 1 }} {{ index + 1 }}
</span> </span>
@ -19,13 +26,17 @@
<a-input v-model="form.remark" type="textarea" :disabled="disabled" /> <a-input v-model="form.remark" type="textarea" :disabled="disabled" />
</a-form-model-item> </a-form-model-item>
<a-col :span="24" style="text-align: center;"> <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-button type="danger" size="default" @click="showConfirm">关闭</a-button>
</a-col> </a-col>
</a-form-model> </a-form-model>
<a-drawer title="选择项目" placement="right" :width="800" :closable="false" :visible="visible" :after-visible-change="afterVisibleChange" @close="onClose"> <a-drawer title="选择项目" placement="right" :width="800" :closable="false" :visible="visible"
<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"> :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> </s-table>
</a-drawer> </a-drawer>
</a-card> </a-card>
@ -37,6 +48,9 @@
import { STable } from '@/components' import { STable } from '@/components'
import { getProjectList } from '@/api/project/project' import { getProjectList } from '@/api/project/project'
import { trainPlanAdd, trainPlanGet } from '@/api/trainplan'; import { trainPlanAdd, trainPlanGet } from '@/api/trainplan';
import { orgList } from '@/api/org/org'
import { listToTree } from '@/utils/util'
const rootParentId = 0
export default { export default {
// import使 // import使
@ -47,6 +61,7 @@ export default {
return { return {
disabled: false, disabled: false,
title: '年度培训计划', title: '年度培训计划',
orgTree: [],
queryParam: { queryParam: {
pageNum: 1, pageNum: 1,
pageSize: 20 pageSize: 20
@ -58,6 +73,7 @@ export default {
type: 2, // type: 2, //
name: '', name: '',
year: '', year: '',
orgId: '',
projectIds: [], projectIds: [],
status: 1, // status: 1, //
}, },
@ -65,8 +81,15 @@ export default {
selectedRowKeys: [], selectedRowKeys: [],
rules: { rules: {
name: [{ required: true, message: '请输入培训计划名称', trigger: 'blur' }], name: [{ required: true, message: '请输入培训计划名称', trigger: 'blur' }],
orgId: [{ required: true, message: '请选择培训单位', trigger: 'change' }],
year: [{ required: true, message: '请选择培训计划年度', trigger: 'change' }], year: [{ required: true, message: '请选择培训计划年度', trigger: 'change' }],
}, },
replaceFields: {
children: 'children',
title: 'name',
key: 'id',
value: 'id'
},
wayEmun: ['培训', '考试', '培训-练习', '培训-练习-考试'], wayEmun: ['培训', '考试', '培训-练习', '培训-练习-考试'],
columns: [ columns: [
{ title: '序号', key: 'id', dataIndex: 'id', width: 60, scopedSlots: { customRender: 'serial' } }, { title: '序号', key: 'id', dataIndex: 'id', width: 60, scopedSlots: { customRender: 'serial' } },
@ -205,12 +228,22 @@ export default {
this.years.push(new Date().getFullYear() - 2 + i); this.years.push(new Date().getFullYear() - 2 + i);
} }
console.log('YEARS', this.years) 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 // - 访this
created() { created() {
let id = this.$route.query.trainPlanId; let id = this.$route.query.trainPlanId;
this.getOrgTree();
this.initYears(); this.initYears();
if (id) { if (id) {
trainPlanGet({ id: id }).then((res) => { trainPlanGet({ id: id }).then((res) => {