项目管理表单更新

This commit is contained in:
Yuanjianghong 2021-11-23 18:59:47 +08:00
parent 55aefae2e6
commit f1097f3fc6
5 changed files with 152 additions and 178 deletions

View File

@ -1,50 +1,54 @@
<template>
<a-space direction="vertical" style="width: 100%">
<a-space direction="horizontal">
<span>总课时{{ totalHours }}, 总学时要求{{ totalLearnHours }}, 总题目数量{{ totalTopicNum }} </span>
课程名:
<a-input v-model="queryParam.courseName" style="width: 100%" />
<a-button type="primary" icon="search" @click="$refs.table.refresh(true)">查询</a-button>
<a-button icon="select" @click="$refs.CourseSelect.edit({})">添加课程</a-button>
</a-space>
<a-card :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="horizontal">
<span>总课时{{ totalHours }}, 总学时要求{{ totalLearnHours }}, 总题目数量{{ totalTopicNum }} </span>
课程名:
<a-input v-model="queryParam.courseName" style="width: 100%" />
<a-button type="primary" icon="search" @click="$refs.table.refresh(true)">查询</a-button>
<a-button icon="select" @click="$refs.CourseSelect.edit({})">添加课程</a-button>
</a-space>
<s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData" :showPagination="false">
<span slot="serial" slot-scope="text, record, index">
{{ index + 1 }}
</span>
<span slot="action" slot-scope="text, record">
<template>
<a-dropdown>
<a class="ant-dropdown-link"
>操作
<a-icon type="down" />
</a>
<a-menu slot="overlay">
<a-menu-item>
<a href="javascript:;" @click="$refs.table.refresh(false)">课程预览</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:;" @click="$refs.table.refresh(false)">题库预览</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:;" @click="$refs.table.refresh(false)">必选题设置</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)">
<a href="javascript:;" @click="$refs.table.refresh(true)">删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</template>
</span>
</s-table>
<a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
<a-button type="primary" @click="toNext"> 下一步 </a-button>
<a-button style="margin-left: 10px" @click="toPrep"> 上一步 </a-button>
</a-form-model-item>
<project-course-select ref="CourseSelect"></project-course-select>
</a-space>
<s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData" :showPagination="false">
<span slot="serial" slot-scope="text, record, index">
{{ index + 1 }}
</span>
<span slot="action" slot-scope="text, record">
<template>
<a-dropdown>
<a class="ant-dropdown-link"
>操作
<a-icon type="down" />
</a>
<a-menu slot="overlay">
<a-menu-item>
<a href="javascript:;" @click="$refs.table.refresh(false)">课程预览</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:;" @click="$refs.table.refresh(false)">题库预览</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:;" @click="$refs.table.refresh(false)">必选题设置</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)">
<a href="javascript:;" @click="$refs.table.refresh(true)">删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</template>
</span>
</s-table>
<project-course-select ref="CourseSelect"></project-course-select>
</a-space>
</a-card>
</template>
<script>
@ -97,7 +101,6 @@ export default {
} else {
/** 新建的没有项目id传当前的所选的课程id */
return getCourseListByCourseIds(Object.assign(parameter, this.queryParam)).then((res) => {
return res.data
})
}
@ -115,12 +118,12 @@ export default {
this.form.lessonIds = []
let ids = this.queryParam.ids.split(',')
ids.forEach((id, index, arr) => {
console.log('id-----------------------',id)
console.log('id-----------------------', id)
this.form.lessonIds.push({ ids: id, sort: index })
})
console.log('ProjectCourseSelect-toNext', this.form)
this.$emit('nextStep',this.form)
this.$emit('nextStep', this.form)
},
//
toPrep() {
@ -134,10 +137,10 @@ export default {
this.$emit('prevStep', this.form)
},
//ids
initIds(){
initIds() {
let str = this.projectForm.lessonIds.join(',')
console.log('initIds',str)
if(str){
console.log('initIds', str)
if (str) {
this.queryParam.ids = str
}
},

View File

@ -1,6 +1,11 @@
<template>
<!-- <page-header-wrapper :title="新增项目">
v-decorator="['form.XXX', { rules: [{ required: true, message: '项目名称为必填' }] }]"-->
<a-card :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="close">退出</a-button>
</template>
<a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol" layout="horizontal">
<a-row :gutter="24">
<a-col :md="24" :sm="24">
@ -109,13 +114,9 @@
<a-input v-model="form.remark" type="textarea" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
<a-button type="primary" @click="toNext"> 下一步 </a-button>
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</a-card>
<!-- </page-header-wrapper> -->
<!-- <class-list ref="ClassList"></class-list> -->
</template>
@ -153,6 +154,11 @@ export default {
this.getTrainClass()
},
methods: {
close() {
this.$router.push({
path: '/project/list',
})
},
add(type) {
this.modalTitle = '新增菜单'
this.visible = true

View File

@ -1,8 +1,14 @@
<template>
<div>
<a-card :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="toPrev">上一步</a-button>
</template>
<a-row type="flex" justify="center" align="top">
<a-col :span="4" id="tree">
<a-page-header title="单位列表" sub-title="" />
<a-page-header title="单位列表" sub-title="" />
<div v-if="this.orgTree != ''">
<a-tree
:treeData="orgTree"
@ -17,7 +23,7 @@
</div>
</a-col>
<a-col :span="20" id="content">
<a-page-header title="人员选择" sub-title="" />
<a-page-header title="人员选择" sub-title="" />
<a-col :span="18" id="table">
<a-form layout="inline">
<a-row>
@ -58,9 +64,7 @@
</a-col>
</a-col>
</a-row>
<a-button type="primary" @click="toNext">下一步</a-button>
<a-button type="primary" @click="toPrev">上一步</a-button>
</div>
</a-card>
</template>
<script>
@ -81,7 +85,7 @@ export default {
props: {
projectForm: {
type: Object,
}
},
},
data() {
//
@ -93,8 +97,8 @@ export default {
expandedKeys: [],
autoExpandParent: true,
defaultExpandedKeys: [],
selectedRowKeys: [],
selectedRows: [],
selectedRowKeys: this.projectForm.personIds || [],
selectedRows: this.projectForm.projectPersonLists || [],
orgTree: [],
orgId: '',
orgType: 1,
@ -123,13 +127,15 @@ export default {
methods: {
//
toNext() {
this.form.projectPersonLists = this.selectedRows
this.form.personIds = this.selectedRowKeys
this.$emit('nextStep',this.form)
this.$emit('nextStep', this.form)
},
//
toPrev() {
this.form.projectPersonLists = this.selectedRows
this.form.personIds = this.selectedRowKeys
this.$emit('prevStep',this.form)
this.$emit('prevStep', this.form)
},
/** 表格行选中后触发 */
@ -184,9 +190,8 @@ export default {
},
//
initPersonList(){
if(this.form.personIds){
initPersonList() {
if (this.form.personIds) {
}
},

View File

@ -1,7 +1,15 @@
<template>
<div>
<a-card :bordered="false" title="组卷策略信息">
<template slot="extra">
<a-button type="primary" size="default" @click="toPrev">上一步</a-button>
</template>
<template slot="extra">
<a-button type="primary" size="default" @click="toSave">保存</a-button>
</template>
<template slot="extra">
<a-button type="primary" size="default" @click="toIssue">发布</a-button>
</template>
<a-form-model :model="form" v-bind="formItemLayout">
<a-card :bordered="false" title="组卷策略信息">
<a-row :gutter="24">
<a-col :md="10" :sm="12">
<a-form-model-item label="总分">
@ -9,7 +17,7 @@
</a-form-model-item>
</a-col>
<a-col :md="14" :sm="12">
<a-form-model-item label="及格分">
<a-form-model-item label="及格分">
<a-input-number v-model="form.passScore" :min="1" :max="100" />
</a-form-model-item>
</a-col>
@ -34,10 +42,9 @@
</a-form-model-item>
</a-col>
</a-row>
</a-card>
<a-card :bordered="false" title="组卷策略详情">
<a-table :columns="columns" :data-source="tableData" bordered>
<a-table :columns="columns" :data-source="tableData" bordered :position="{ disabled: false }">
<template slot="topicNum" slot-scope="text, record">
<a-input-number style="margin: -5px 0" v-model="record.topicNum" />
</template>
@ -47,25 +54,12 @@
</a-table>
</a-card>
</a-form-model>
<a-button type="primary" @click="toSave"> </a-button>
<a-button type="primary" @click="toIssue"> </a-button>
<a-button type="primary" @click="toPrev">上一步</a-button>
</div>
</a-card>
</template>
<script>
// jsjsjson
// import from ''
const renderContent = (value, row, index) => {
const obj = {
children: value,
attrs: {},
}
if (index === 4) {
obj.attrs.colSpan = 0
}
return obj
}
export default {
// import使
@ -110,15 +104,14 @@ export default {
{
title: '总分',
dataIndex: 'totalScore',
customRender: (value,row,index) => {
return { children: value, attrs: { rowSpan: index == 0 ? 3 : 0 }}
customRender: (value, row, index) => {
return { children: value, attrs: { rowSpan: index == 0 ? 3 : 0 } }
},
},
],
tableData: this.projectForm.testPaperTactics ||
[
tableData: this.projectForm.testPaperTactics || [
{
i : 1,
i: 1,
topicType: 1,
totalNum: 20,
topicNum: 0,
@ -126,7 +119,7 @@ export default {
totalScore: 100,
},
{
i : 2,
i: 2,
topicType: 2,
totalNum: 20,
topicNum: 0,
@ -134,7 +127,7 @@ export default {
totalScore: 100,
},
{
i : 3,
i: 3,
topicType: 3,
totalNum: 20,
topicNum: 0,

View File

@ -1,8 +1,16 @@
<template>
<a-form-model :model="form">
<!-- showSearch -->
<!-- height: '500px',overflowY: 'auto' -->
<a-card :bordered="false" title="选择培训单位">
<template slot="extra">
<a-button type="primary" v-if="['2', '3', '4'].includes(form.trainWay)" size="default" @click="toNext"
>下一步</a-button
>
</template>
<template slot="extra">
<a-button type="primary" size="default" @click="toPrep">上一步</a-button>
</template>
<template type="primary" v-if="form.trainWay === '1'" slot="extra">
<a-button size="default" @click="close">完成</a-button>
</template>
<a-transfer
class="tree-transfer"
:data-source="dataSource"
@ -14,8 +22,7 @@
:filter-option="filterOption"
@change="onChange"
>
<template slot="children" slot-scope="{ props: { direction, selectedKeys }, on: { itemSelect } }">
<!-- checkStrictly -->
<template slot="children" slot-scope="{ props: { direction, selectedKeys }, on: { itemSelect, itemSelectAll } }">
<a-tree
v-if="direction === 'left'"
blockNode
@ -36,66 +43,16 @@
/>
</template>
</a-transfer>
<a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
<a-button type="primary" @click="toNext"> 下一步 </a-button>
<a-button style="margin-left: 10px" @click="toPrep">上一步</a-button>
</a-form-model-item>
</a-form-model>
</a-card>
</template>
<script>
const treeData = [
{
title: '三峡大学',
key: '0001',
children: [
{ title: '三峡大学文学院', key: '00010001' },
{
title: '三峡大学水利学院',
key: '00010002',
children: [
{ title: '三峡大学水利学院第一学院', key: '000100020001' },
{ title: '三峡大学水利学院第二学院', key: '000100020002' },
{ title: '三峡大学水利学院第三学院', key: '000100020003' },
{ title: '三峡大学水利学院第四学院', key: '000100020004' },
{ title: '三峡大学水利学院第五学院', key: '000100020005' },
{ title: '三峡大学水利学院第六学院', key: '000100020006' },
{ title: '三峡大学水利学院第一学院', key: '000100020007' },
{ title: '三峡大学水利学院第二学院', key: '000100020008' },
{ title: '三峡大学水利学院第三学院', key: '000100020009' },
{ title: '三峡大学水利学院第四学院', key: '000100020010' },
{ title: '三峡大学水利学院第五学院', key: '000100020011' },
{ title: '三峡大学水利学院第六学院', key: '000100020012' },
{ title: '三峡大学水利学院第一学院', key: '000100020013' },
{ title: '三峡大学水利学院第二学院', key: '000100020014' },
{ title: '三峡大学水利学院第三学院', key: '000100020015' },
{ title: '三峡大学水利学院第四学院', key: '000100020016' },
{ title: '三峡大学水利学院第五学院', key: '000100020017' },
{ title: '三峡大学水利学院第六学院', key: '000100020018' },
],
},
],
},
]
const transferDataSource = []
function flatten(list = []) {
// console.log('flattenlist', list)
list.forEach((item) => {
transferDataSource.push(item)
flatten(item.children)
})
}
flatten(JSON.parse(JSON.stringify(treeData)))
function isChecked(selectedKeys, eventKey) {
// console.log('isChecked', eventKey, selectedKeys)
return selectedKeys.indexOf(eventKey) !== -1
}
import { orgList } from '@/api/org/org'
import { listToTree } from '@/utils/util'
//
function handleTreeData(data, targetKeys = []) {
// console.log('handleTreeData', data, targetKeys)
data.forEach((item) => {
item['disabled'] = targetKeys.includes(item.key)
if (item.children) {
@ -105,6 +62,10 @@ function handleTreeData(data, targetKeys = []) {
return data
}
function isChecked(selectedKeys, eventKey) {
return selectedKeys.indexOf(eventKey) !== -1;
}
export default {
props: {
projectForm: {
@ -115,41 +76,47 @@ export default {
return {
form: this.projectForm,
targetKeys: [],
dataSource: transferDataSource,
// Promise
loadData: (parameter) => {
console.log('加载数据方法', parameter)
return transferDataSource
// return getProjectList(Object.assign(parameter, this.queryParam)).then((res) => {
// return res
// })
},
dataSource: [],
treeData: [],
checkedKeys:[],
}
},
created() {
console.log('第2个表单创建了')
this.getSourceList()
},
computed: {
treeData() {
treeDataComputed() {
return handleTreeData(treeData, this.targetKeys)
},
},
methods: {
//
getSourceList(orgType) {
return orgList({ orgType: orgType || 1 }).then((res) => {
if (res.data) {
res.data.forEach((item) => {
this.dataSource.push({
key: item.id,
title: item.name,
children: [],
pid: item.pid
})
})
console.log('dataSource', this.dataSource)
this.treeData = listToTree(this.dataSource, [], 0)
}
})
},
//
toNext() {
this.form.unitIds = this.targetKeys
console.log('toNext', this.form)
this.$emit('nextStep', this.form)
// const {
// form: { validateFields },
// } = this
// //
// validateFields((err, values) => {
// if (!err) {
// this.$emit('nextStep',this.form)
// }
// })
},
//
toPrep() {
this.form.unitIds = this.targetKeys
console.log('toPrep', this.form)