系统推荐更改

This commit is contained in:
Yjhon 2022-03-09 15:41:10 +08:00
parent 9a0bde409d
commit 08b286976d
3 changed files with 33 additions and 35 deletions

View File

@ -19,18 +19,18 @@
培训方式:
<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="1"> 培训 </a-select-option>
<a-select-option value="2"> 考试 </a-select-option>
<a-select-option value="3"> 培训/练习</a-select-option>
<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-option value="4">培训/练习/考试</a-select-option>
</a-select>
<a-button type="primary" icon="search" @click="$refs.table.refresh(true)">查询</a-button>
<a-button icon="redo" @click="() => (queryParam = {})">重置</a-button>
<a-button icon="redo" @click="() => (queryParam.projectName=null,queryParam.status=null,queryParam.status=null,queryParam.startDate=null,queryParam.endDate= null,queryParam.trainWay= null)">重置</a-button>
</a-space>
<br/>
<br />
<a-space class="table-operator" direction="horizontal">
<a-button v-if="hasPerm(power.add)" type="primary" icon="plus" @click="handledCreate">新增项目</a-button>
<a-button v-if="hasPerm(power.add) && queryParam.type != 'model' " 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">
@ -51,6 +51,8 @@
<a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)">
<a v-if="hasPerm(power.del) && ['1'].includes(record.status)" 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>
</template>
</span>
</s-table>
@ -60,7 +62,7 @@
<script>
import { STable } from '@/components'
import { getProjectList,releaseProject,projectDel } from '@/api/project/project'
import { getProjectList, releaseProject, projectDel } from '@/api/project/project'
export default {
components: {
@ -96,7 +98,8 @@ export default {
},
},
{ 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) => {
//
if (text == 1) {
return '必修课'
@ -105,7 +108,7 @@ export default {
return '选修课'
}
},
},
},
{
title: '项目状态',
dataIndex: 'status',
@ -158,10 +161,10 @@ export default {
},
methods: {
//
handledRelease(record){
releaseProject({id: record.id}).then((res) => {
if(res.code == 200){
this.$message.success('项目:'+record.projectName+' 发布成功!');
handledRelease(record) {
releaseProject({ id: record.id }).then((res) => {
if (res.code == 200) {
this.$message.success('项目:' + record.projectName + ' 发布成功!');
this.$refs.table.refresh(false);
}
})
@ -189,12 +192,12 @@ export default {
},
})
},
handleDelete(record){
projectDel({id:record.id}).then((res) => {
if(res.code == 200){
handleDelete(record) {
projectDel({ id: record.id }).then((res) => {
if (res.code == 200) {
this.$message.success('删除成功')
this.$refs.table.refresh(false);
}else{
} else {
this.$message.success('删除失败')
}
})
@ -214,18 +217,6 @@ export default {
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'
//
// 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'
//
// 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'
},
},
}

View File

@ -47,6 +47,8 @@ export default {
created() {
console.log('分步表单创建完成', this.$route)
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;
},

View File

@ -51,7 +51,7 @@
</a-form-model-item>
</a-col> -->
<!-- 时间选择器呢 -->
<a-col :span="24">
<a-col v-if="form.projectType != 0" :span="24">
<a-form-model-item v-if="['1', '3' ,'4'].includes(form.trainWay)" label="培训时间" style="margin-bottom: 0">
<a-form-model-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }" prop="trainSdate">
<a-date-picker v-model="form.trainSdate" style="width: 100%" valueFormat="YYYY-MM-DD HH:mm:ss" />
@ -63,7 +63,7 @@
</a-form-model-item>
</a-col>
<!-- 时间选择器 -->
<a-col :span="24">
<a-col v-if="form.projectType != 0" :span="24">
<a-form-model-item v-if="['3', '4'].includes(form.trainWay)" label="练习时间" style="margin-bottom: 0">
<a-form-model-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }" prop="practiceSdate">
<a-date-picker v-model="form.practiceSdate" style="width: 100%" valueFormat="YYYY-MM-DD HH:mm:ss" />
@ -75,7 +75,7 @@
</a-form-model-item>
</a-col>
<!-- 时间选择器 -->
<a-col :span="24">
<a-col v-if="form.projectType != 0" :span="24">
<a-form-model-item v-if="['2', '4'].includes(form.trainWay)" label="考试时间" style="margin-bottom: 0">
<a-form-model-item :style="{ display: 'inline-block', width: 'calc(50% - 12px)' }" prop="examSdate">
<a-date-picker v-model="form.examSdate" style="width: 100%" valueFormat="YYYY-MM-DD HH:mm:ss" />
@ -88,7 +88,7 @@
</a-col>
<!-- 考试次数 -->
<a-col :span="24">
<a-col v-if="form.projectType != 0" :span="24">
<a-form-model-item v-if="['2', '4'].includes(form.trainWay)" label="考试次数" style="margin-bottom: 0">
<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%" />
@ -103,7 +103,7 @@
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-col v-if="form.projectType != 0" :span="24">
<a-form-model-item label="模拟考试" v-if="['2', '4'].includes(form.trainWay)" prop="mockExam">
<a-radio-group v-model="form.mockExam">
<a-radio value="1"> 允许 </a-radio>
@ -171,7 +171,12 @@ export default {
console.log('第一个表单创建了')
if (this.$route.query.projectId) {
getProjectDetail({ id: this.$route.query.projectId }).then(res => {
this.form = res.data
let form = res.data;
if(this.$route.query.t == 'model') {
console.log('form',form)
form.projectType = 1;
}
this.form = form;
this.$emit('setFormType',this.form.trainWay)
})
}