项目管理表单更新

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

View File

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

View File

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

View File

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

View File

@ -1,8 +1,16 @@
<template> <template>
<a-form-model :model="form"> <a-card :bordered="false" title="选择培训单位">
<!-- showSearch --> <template slot="extra">
<!-- height: '500px',overflowY: 'auto' --> <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 <a-transfer
class="tree-transfer" class="tree-transfer"
:data-source="dataSource" :data-source="dataSource"
@ -14,8 +22,7 @@
:filter-option="filterOption" :filter-option="filterOption"
@change="onChange" @change="onChange"
> >
<template slot="children" slot-scope="{ props: { direction, selectedKeys }, on: { itemSelect } }"> <template slot="children" slot-scope="{ props: { direction, selectedKeys }, on: { itemSelect, itemSelectAll } }">
<!-- checkStrictly -->
<a-tree <a-tree
v-if="direction === 'left'" v-if="direction === 'left'"
blockNode blockNode
@ -36,66 +43,16 @@
/> />
</template> </template>
</a-transfer> </a-transfer>
<a-form-model-item :wrapper-col="{ span: 14, offset: 4 }"> </a-card>
<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>
</template> </template>
<script> <script>
const treeData = [ import { orgList } from '@/api/org/org'
{ import { listToTree } from '@/utils/util'
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
}
//
function handleTreeData(data, targetKeys = []) { function handleTreeData(data, targetKeys = []) {
// console.log('handleTreeData', data, targetKeys)
data.forEach((item) => { data.forEach((item) => {
item['disabled'] = targetKeys.includes(item.key) item['disabled'] = targetKeys.includes(item.key)
if (item.children) { if (item.children) {
@ -105,6 +62,10 @@ function handleTreeData(data, targetKeys = []) {
return data return data
} }
function isChecked(selectedKeys, eventKey) {
return selectedKeys.indexOf(eventKey) !== -1;
}
export default { export default {
props: { props: {
projectForm: { projectForm: {
@ -115,41 +76,47 @@ export default {
return { return {
form: this.projectForm, form: this.projectForm,
targetKeys: [], targetKeys: [],
dataSource: transferDataSource, dataSource: [],
treeData: [],
// Promise checkedKeys:[],
loadData: (parameter) => {
console.log('加载数据方法', parameter)
return transferDataSource
// return getProjectList(Object.assign(parameter, this.queryParam)).then((res) => {
// return res
// })
},
} }
}, },
created() { created() {
console.log('第2个表单创建了') console.log('第2个表单创建了')
this.getSourceList()
}, },
computed: { computed: {
treeData() { treeDataComputed() {
return handleTreeData(treeData, this.targetKeys) return handleTreeData(treeData, this.targetKeys)
}, },
}, },
methods: { 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() { toNext() {
this.form.unitIds = this.targetKeys this.form.unitIds = this.targetKeys
console.log('toNext', this.form) console.log('toNext', this.form)
this.$emit('nextStep', this.form) this.$emit('nextStep', this.form)
// const {
// form: { validateFields },
// } = this
// //
// validateFields((err, values) => {
// if (!err) {
// this.$emit('nextStep',this.form)
// }
// })
}, },
//
toPrep() { toPrep() {
this.form.unitIds = this.targetKeys this.form.unitIds = this.targetKeys
console.log('toPrep', this.form) console.log('toPrep', this.form)