Merge branch 'develop' of https://gitee.com/siwa-team/dawa-vue into develop

This commit is contained in:
qinjie 2021-09-08 17:39:54 +08:00
commit 9c25a47261
18 changed files with 879 additions and 514 deletions

45
src/api/org/org.js Normal file
View File

@ -0,0 +1,45 @@
import request from '@/utils/request'
const orgApi = {
add: 'sys/org/add',
edit: 'sys/org/edit',
del: 'sys/org/del',
list: 'sys/org/list',
page: 'sys/org/pageList',
}
export function orgAdd (params) {
return request({
url: orgApi.add,
method: 'post',
data: params
})
}
export function orgEdit (params) {
return request({
url: orgApi.edit,
method: 'post',
data: params
})
}
export function orgDel (params) {
return request({
url: orgApi.del,
method: 'post',
params: params
})
}
export function orgList (params) {
return request({
url: orgApi.list,
method: 'get',
params: params
})
}
export function orgPage (params) {
return request({
url: orgApi.page,
method: 'get',
params: params
})
}

38
src/api/project/class.js Normal file
View File

@ -0,0 +1,38 @@
import request from '@/utils/request'
const classApi = {
get: '/project/species/get',
add: '/project/species/add',
del: '/project/species/del',
list: '/project/species/pageList'
}
export function classAdd(params) {
return request({
url: classApi.add,
method: 'post',
data: params
})
}
export function classGet(params) {
return request({
url: classApi.getDict,
method: 'get',
params: params
})
}
export function classDel (params) {
return request({
url: classApi.get,
method: 'delete',
data: params
})
}
export function classList(params) {
console.log("------------{}", params)
return request({
url: classApi.list,
method: 'get',
params: params
})
}

View File

@ -34,3 +34,9 @@
} }
} }
.ant-layout-sider {
flex: 0 0 230px !important;
max-width: 230px !important;
min-width: 230px !important;
width: 230px !important;
}

View File

@ -120,4 +120,10 @@ export default {
<style lang="less"> <style lang="less">
@import "./BasicLayout.less"; @import "./BasicLayout.less";
/*隐藏原本的图标*/
.ant-pro-global-header-trigger{
display: none;
}
</style> </style>

View File

@ -5,7 +5,7 @@ const getters = {
color: state => state.app.color, color: state => state.app.color,
token: state => state.user.token, token: state => state.user.token,
avatar: state => state.user.avatar, avatar: state => state.user.avatar,
nickname: state => state.user.name, name: state => state.user.name,
welcome: state => state.user.welcome, welcome: state => state.user.welcome,
roles: state => state.user.roles, roles: state => state.user.roles,
buttons: state => state.user.buttons, buttons: state => state.user.buttons,

View File

@ -14,8 +14,8 @@ export function actionToObject (json) {
*/ */
export function hasBtnPermission (permission) { export function hasBtnPermission (permission) {
const myBtns = store.getters.buttons const myBtns = store.getters.buttons
const nickname = store.getters.nickname const name = store.getters.name
if (nickname == '超级管理员') { if (name == 'admin') {
return true return true
} }
return myBtns.indexOf(permission) > -1 return myBtns.indexOf(permission) > -1

205
src/views/org/OrgForm.vue Normal file
View File

@ -0,0 +1,205 @@
<template>
<a-modal
:title="modalTitle"
:width="900"
:visible="visible"
:confirmLoading="confirmLoading"
@ok="handleSubmit"
@cancel="handleCancel"
>
<a-spin :spinning="formLoading">
<a-form :form="form">
<a-form-item
style="display: none;"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input v-decorator="['id']" />
</a-form-item>
<a-form-item
label="机构名称"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input placeholder="请输入机构名称" v-decorator="['name', {rules: [{required: true, message: '请输入机构名称'}]}]" />
</a-form-item>
<a-form-item
label="唯一编码"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input placeholder="请输入唯一编码" v-decorator="['code', {rules: [{required: true, message: '请输入唯一编码'}]}]" />
</a-form-item>
<a-form-item
label="上级机构"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-tree-select
v-decorator="['pid', {rules: [{ required: true, message: '请选择上级机构!' }]}]"
style="width: 100%"
:dropdownStyle="{ maxHeight: '300px', overflow: 'auto' }"
:treeData="orgTree"
placeholder="请选择上级机构"
:replaceFields="replaceFields"
>
<span slot="title" slot-scope="{ id }">{{ id }}
</span>
</a-tree-select>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="排序"
>
<a-input-number placeholder="请输入排序" style="width: 100%" v-decorator="['sort', { initialValue: 100 }]" :min="1" :max="1000" />
</a-form-item>
<a-form-item
label="备注"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-textarea :rows="4" placeholder="请输入备注" v-decorator="['remark']"></a-textarea>
</a-form-item>
</a-form>
</a-spin>
</a-modal>
</template>
<script>
import { orgAdd, orgEdit, orgList } from '@/api/org/org'
import { listToTree } from '@/utils/util'
const rootParentId = 0
export default {
data () {
return {
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 15 }
},
orgTree: [],
modalTitle: "新增机构",
visible: false,
confirmLoading: false,
formLoading: true,
replaceFields: {
children:'children',
title:'name',
key:'id',
value:'id'
},
form: this.$form.createForm(this)
}
},
methods: {
//
add () {
this.visible = true
this.modalTitle = '新增机构'
this.getOrgTree()
},
//
edit (record) {
this.visible = true
this.modalTitle = '编辑机构'
this.getOrgTree()
setTimeout(() => {
this.form.setFieldsValue(
{
id: record.id,
name: record.name,
code: record.code,
sort: record.sort,
pid: record.pid,
remark: record.remark
}
)
}, 100)
},
/**
* 获取机构树并加载于表单中
*/
getOrgTree () {
orgList().then((res) => {
this.formLoading = false
if (!res.code === 200) {
this.orgTree = []
return
}
const orgList = listToTree(res.data, [], rootParentId)
this.orgTree = [{
'id': '-1',
'parentId': '0',
'name': '顶级',
'value': '0',
'pid': '0',
'children': orgList
}]
})
},
handleSubmit () {
const { form: { validateFields } } = this
this.confirmLoading = true
validateFields((errors, values) => {
if (!errors) {
if (values.id) {
orgEdit(values).then((res) => {
if (res.code === 200) {
this.$message.success('编辑成功')
this.visible = false
this.confirmLoading = false
this.$emit('ok', values)
this.form.resetFields()
} else {
this.$message.error('编辑失败:' + res.message)
}
}).finally((res) => {
this.confirmLoading = false
})
} else {
orgAdd(values).then((res) => {
if (res.code === 200) {
this.$message.success('新增成功')
this.visible = false
this.confirmLoading = false
this.$emit('ok', values)
this.form.resetFields()
} else {
this.$message.error('新增失败:' + res.message)
}
}).finally((res) => {
this.confirmLoading = false
})
}
} else {
this.confirmLoading = false
}
})
},
handleCancel () {
this.form.resetFields()
this.visible = false
}
}
}
</script>

150
src/views/org/OrgList.vue Normal file
View File

@ -0,0 +1,150 @@
<template>
<a-card :bordered="false">
<a-tabs default-active-key="1" >
<a-tab-pane key="1" tab="单位部门信息" @change="tabsCallback">
<div class="table-operator">
<a-button @click="$refs.orgForm.add()" icon="plus" type="primary" v-if="hasPerm('sys:org:add')">新增机构</a-button>
</div>
<s-table
ref="table"
:columns="columns"
:data="loadData"
:rowKey="(record) => record.id"
:showPagination="false"
:defaultExpandedRowKeys="expandedRowKeys"
>
<span slot="action" slot-scope="text, record">
<a v-if="hasPerm('sys:org:edit')" @click="$refs.orgForm.edit(record)">编辑</a>
<a-divider type="vertical" v-if="hasPerm('sys:org:edit') & hasPerm('sys:org:delete')"/>
<a-popconfirm v-if="hasPerm('sys:org:delete')" placement="topRight" title="确认删除?" @confirm="() => singleDelete(record)">
<a>删除</a>
</a-popconfirm>
</span>
</s-table>
<org-form ref="orgForm" @ok="handleOk" />
</a-tab-pane>
<a-tab-pane key="2" tab="项目工程信息" @change="tabsCallback">
<div class="table-operator">
<a-button @click="$refs.orgForm.add()" icon="plus" type="primary" v-if="hasPerm('sys:org:add')">新增项目</a-button>
</div>
<s-table
ref="table"
:columns="columns"
:data="loadData"
:rowKey="(record) => record.id"
:showPagination="false"
:defaultExpandedRowKeys="expandedRowKeys"
>
<span slot="action" slot-scope="text, record">
<a v-if="hasPerm('sys:org:edit')" @click="$refs.orgForm.edit(record)">编辑</a>
<a-divider type="vertical" v-if="hasPerm('sys:org:edit') & hasPerm('sys:org:delete')"/>
<a-popconfirm v-if="hasPerm('sys:org:delete')" placement="topRight" title="确认删除?" @confirm="() => singleDelete(record)">
<a>删除</a>
</a-popconfirm>
</span>
</s-table>
<org-form ref="orgForm" @ok="handleOk" />
</a-tab-pane>
</a-tabs>
</a-card>
</template>
<script>
import { STable } from '@/components'
import { orgList, orgDel } from '@/api/org/org'
import OrgForm from './OrgForm'
import { listToTree } from '@/utils/util'
const rootParentId = 0
export default {
components: {
STable,
OrgForm
},
data () {
return {
//
queryParam: {},
expandedRowKeys: [],
//
columns: [
{
title: '机构名称',
dataIndex: 'name'
},
{
title: '唯一编码',
dataIndex: 'code'
},
{
title: '排序',
dataIndex: 'sort'
},
{
title: '备注',
dataIndex: 'remark'
}
],
// Promise
loadData: parameter => {
return orgList(Object.assign(parameter, this.queryParam)).then((res) => {
const orgList = listToTree(res.data, [], rootParentId)
//
orgList.forEach(item => {
this.expandedRowKeys.push(item.id)
})
return orgList
})
}
}
},
created () {
if (this.hasPerm('sys:org:edit') || this.hasPerm('sys:org:del')) {
this.columns.push({
title: '操作',
width: '150px',
dataIndex: 'action',
scopedSlots: { customRender: 'action' }
})
}
},
methods: {
tabsCallback (key) {
if (key === '1') {
}
if (key === '2') {
}
},
/**
* 删除
*/
sysOrgDelete (record) {
orgDel({ id: record.id, deleteReason: '' }).then((res) => {
if (res.code === 200) {
this.$message.success('删除成功')
this.getOrgTree()
this.$refs.table.clearRefreshSelected()
} else {
this.$message.error('删除失败:' + res.message)
}
}).catch((err) => {
this.$message.error('删除错误:' + err.message)
})
},
handleOk () {
this.$refs.table.refresh()
}
}
}
</script>
<style lang="less">
.table-operator {
margin-bottom: 18px;
}
button {
margin-right: 8px;
}
</style>

View File

@ -1,36 +0,0 @@
<template>
<div></div>
</template>
<script>
//jsjsjson
//import from ''
export default {
//import使
components: {},
props: {},
data() {
//
return {};
},
// data
computed: {},
//data
watch: {},
//
methods: {},
created() {}, // - 访this
mounted() {}, // - 访DOM
beforeCreate() {}, // -
beforeMount() {}, // -
beforeUpdate() {}, // -
updated() {}, // -
beforeDestroy() {}, // -
destroyed() {}, // -
activated() {} //keep-alive
};
</script>
<style scoped>
</style>

View File

@ -38,9 +38,9 @@
<a-button icon="redo" @click="() => (queryParam = {})">重置</a-button> <a-button icon="redo" @click="() => (queryParam = {})">重置</a-button>
</a-space> </a-space>
<a-space direction="horizontal"> <a-space class="table-operator" direction="horizontal">
<a-button type="primary" icon="plus" @click="handledCreate()">新建</a-button> <a-button type="primary" icon="plus" @click="$refs.projectStepForm.add1()">新增项目</a-button>
<a-button type="primary" icon="minus" @click="handleEdit()">删除</a-button> <a-button type="primary" icon="minus" @click="handleEdit()">删除项目</a-button>
</a-space> </a-space>
<s-table <s-table
@ -67,6 +67,7 @@
</template> </template>
</span> </span>
</s-table> </s-table>
<project-step-form ref="projectStepForm"></project-step-form>
</a-space> </a-space>
</div> </div>
</template> </template>
@ -75,16 +76,12 @@
import moment from 'moment' import moment from 'moment'
import { STable } from '@/components' import { STable } from '@/components'
import { getProjectList } from '@/api/project/project' import { getProjectList } from '@/api/project/project'
import ProjectForm from '@/views/project/form/ProjectForm' import projectStepForm from './ProjectStepForm'
import router from '@/router/index.js'
export default { export default {
name: 'ProjectList',
props: {},
components: { components: {
STable, STable,
ProjectForm, projectStepForm,
router,
}, },
data() { data() {
return { return {
@ -153,10 +150,10 @@ export default {
methods: { methods: {
// //
handledCreate() { handledCreate() {
return this.$router.push( // return this.$router.push(
// {name: 'ProjectForm'} // // {name: 'ProjectForm'}
{ path: 'project/project/add' } // { path: 'project/project/add' }
) // )
// router.push() // router.push()
}, },

View File

@ -0,0 +1,147 @@
<template>
<a-modal
:title="modalTitle"
:width="1000"
:visible="visible"
:confirmLoading="confirmLoading"
:destroyOnClose="true"
@ok="handleSubmit"
@cancel="handleCancel"
>
<!-- PageHeader 第二种使用方式 (v-slot) -->
<a-card :bordered="false">
<a-steps class="steps" :current="currentTab">
<a-step title="基本信息" />
<a-step title="选择单位" />
<a-step title="选择课程" />
<a-step title="选择人员" />
<a-step title="完成" />
</a-steps>
<div class="content">
<step1 v-if="currentTab === 0" @nextStep="nextStep"/>
<step2 v-if="currentTab === 1" @nextStep="nextStep" @prevStep="prevStep"/>
<step3 v-if="currentTab === 2" @nextStep="nextStep" @prevStep="prevStep"/>
<step4 v-if="currentTab === 3" @nextStep="nextStep" @prevStep="prevStep"/>
<step5 v-if="currentTab === 4" @prevStep="prevStep" @finish="finish"/>
</div>
</a-card>
</a-modal>
</template>
<script>
import Step1 from './form/ProjectForm'
import Step2 from './form/ProjectUnitSelect'
import Step3 from './form/ProjectCourseSelect'
export default {
components: {
Step1,
Step2,
Step3,
},
data () {
return {
currentTab: 0,
labelCol: {
xs: { span: 24 },
sm: { span: 6 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
modalTitle: '新增项目',
visible: false,
confirmLoading: false,
menuTreeData: [],
componentShow: true,
componentDisabled: false,
componentRequired: true,
routerRequired: true,
routerShow: true,
pidShow: true,
permissionShow: true,
permissionRequired: true,
formLoading: true,
type: '',
form: this.$form.createForm(this),
}
},
methods: {
//
add1 (type) {
this.modalTitle = "新增菜单"
this.visible = true
// //
// this.form.getFieldDecorator('type', { valuePropName: 'checked', initialValue: '1' })
// this.meneTypeFunc('1')
// //
// this.form.getFieldDecorator('visible', { initialValue: true })
// //
// this.getMenuTree()
this.formLoading = false
},
//
edit (record) {
this.modalTitle = "编辑菜单"
this.visible = true
// //
// this.form.getFieldDecorator('type', { valuePropName: 'checked', initialValue: record.type.toString() })
// this.meneTypeFunc(record.type.toString())
// //
// // eslint-disable-next-line no-unused-vars
// const visibleDef = false
// // eslint-disable-next-line eqeqeq
// if (record.visible == 1) {
// this.visibleDef = true
// }
// this.form.getFieldDecorator('visible', { valuePropName: 'checked', initialValue: this.visibleDef })
// setTimeout(() => {
// this.setMenuItem(record)
// //
// this.getMenuTree()
// }, 100)
this.formLoading = false
},
// handler
//
nextStep () {
if (this.currentTab < 5) {
this.currentTab += 1
}
},
//
prevStep () {
if (this.currentTab > 0) {
this.currentTab -= 1
}
},
finish () {
this.currentTab = 0
},
handleSubmit() {
},
handleCancel() {
this.visible = false;
}
}
}
</script>
<style lang="less" scoped>
.steps {
max-width: 750px;
margin: 16px auto;
}
</style>

View File

@ -0,0 +1,65 @@
<template>
<page-header-wrapper title="新增种类">
<a-button type="primary" icon="rollback" @click="returnNext">返回</a-button>
<a-table ref="table" size="default" rowKey="id" :columns="columns" :data="dataTable" bordered>
<span slot="serial" slot-scope="text, record, index">
{{ index + 1 }}
</span>
<span slot="action" slot-scope="text, record">
<template>
<a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)">
<a-button @click="() => handleDetail(record)">删除</a-button>
</a-popconfirm>
</template>
</span>
</a-table>
</page-header-wrapper>
</template>
<script>
import { STable } from '@/components'
import { classDel, classList } from '@/api/project/class'
export default {
data() {
return {
// Promise
dataTable: (parameter) => {
return classList(Object.assign(parameter, this.queryParam)).then((res) => {
return res
})
},
columns: [
{ title: '序号', key: 'id', dataIndex: 'id', width: 80, scopedSlots: { customRender: 'serial' } },
{ title: '项目种类名称', dataIndex: 'value', key: 'value' },
{
title: '操作',
width: 200,
align: 'center',
scopedSlots: { customRender: 'action' },
},
],
}
},
components: {
STable,
classDel,
classList
},
methods: {
handledDel(){
classDel(Object.assign(parameter,params)).then((res) => {
if(res.code == 200){
return $this.$message = '操作成功';
}
})
},
returnNext(){
}
},
}
</script>
<style lang="less" scoped>
</style>

View File

@ -1,5 +1,4 @@
<template> <template>
<div>
<a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol" :layout="vertical"> <a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol" :layout="vertical">
<a-space direction="vertical" style="width: 100%"> <a-space direction="vertical" style="width: 100%">
<a-space direction="horizontal"> <a-space direction="horizontal">
@ -26,14 +25,9 @@
<a-button type="primary" icon="search" @click="$refs.table.refresh(true)">课程预览</a-button> <a-button type="primary" icon="search" @click="$refs.table.refresh(true)">课程预览</a-button>
<a-button type="primary" icon="search" @click="$refs.table.refresh(true)">题库预览</a-button> <a-button type="primary" icon="search" @click="$refs.table.refresh(true)">题库预览</a-button>
<a-button type="primary" icon="search" @click="$refs.table.refresh(true)">必选题设置</a-button> <a-button type="primary" icon="search" @click="$refs.table.refresh(true)">必选题设置</a-button>
<!-- <a href="javascript:;" @click="handleEdit(record)">修改</a>
<a-divider type="vertical" />
<a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)"> <a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)">
<a href="javascript:;">删除</a> <a-button type="primary" @click="$refs.table.refresh(true)">删除</a-button>
</a-popconfirm> </a-popconfirm>
<a-divider type="vertical" />
<a href="javascript:;" @click="handleDetail(record)">详情</a>
<a-divider type="vertical" /> -->
</template> </template>
</span> </span>
</s-table> </s-table>
@ -43,7 +37,6 @@
</a-form-model-item> </a-form-model-item>
</a-space> </a-space>
</a-form-model> </a-form-model>
</div>
</template> </template>
<script> <script>
@ -60,7 +53,7 @@ export default {
data() { data() {
// //
return { return {
form: {}, form: this.$form.createForm(this),
totalHours: 0, // totalHours: 0, //
totalLearnHours: 0, // totalLearnHours: 0, //
totalTopicNum: 0, // totalTopicNum: 0, //

View File

@ -1,31 +1,24 @@
<template> <template>
<!-- <page-header-wrapper :title="新增项目"> --> <!-- <page-header-wrapper :title="新增项目">
<a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol" :layout="vertical"> v-decorator="['form.XXX', { rules: [{ required: true, message: '项目名称为必填' }] }]"-->
<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">
<a-form-model-item label="项目名称"> <a-form-model-item label="项目名称">
<a-input <a-input v-model="form.projectName" />
v-model="form.projectName"
v-decorator="[
'projectName',
{
rules: [{ required: true, message: '项目名称为必填' }],
},
]"
/>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row> <a-row :gutter="24">
<a-col :span="12"> <a-col :md="24" :sm="24">
<a-form-model-item label="培训种类"> <a-form-model-item label="培训种类">
<a-select v-model="form.trainClass" placeholder="--请选择--"> <a-select v-model="form.trainClass" placeholder="--请选择--">
<a-select-option value="shanghai"> Zone one </a-select-option> <a-select-option value="shanghai"> 参数待替换 </a-select-option>
</a-select> </a-select>
<a-button type="primary" @click="createClass"> 新增种类 </a-button> <a-button type="primary" @click="createClass"> 新增种类 </a-button>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="24">
<a-form-model-item label="培训类型"> <a-form-model-item label="培训类型">
<a-select v-model="form.trainType" placeholder="--请选择--"> <a-select v-model="form.trainType" placeholder="--请选择--">
<a-select-option value="1"> 必修课 </a-select-option> <a-select-option value="1"> 必修课 </a-select-option>
@ -33,7 +26,7 @@
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="24">
<a-form-model-item label="培训方式"> <a-form-model-item label="培训方式">
<a-select v-model="form.trainWay" placeholder="--请选择--"> <a-select v-model="form.trainWay" placeholder="--请选择--">
<a-select-option value="1"> 培训 </a-select-option> <a-select-option value="1"> 培训 </a-select-option>
@ -43,7 +36,7 @@
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="24">
<a-form-model-item label="人员类型"> <a-form-model-item label="人员类型">
<a-select v-model="form.personType" placeholder="--请选择--"> <a-select v-model="form.personType" placeholder="--请选择--">
<a-select-option v-for="item in personType" :key="item.value"> {{ item.name }} </a-select-option> <a-select-option v-for="item in personType" :key="item.value"> {{ item.name }} </a-select-option>
@ -98,7 +91,7 @@
<a-input-number v-model="form.resitNumber" :min="0" style="width: 100%" /> <a-input-number v-model="form.resitNumber" :min="0" style="width: 100%" />
</a-form-item> </a-form-item>
<a-form-item :style="{ display: 'inline-block', width: 'calc(30% - 1px)' }"> <a-form-item :style="{ display: 'inline-block', width: 'calc(30% - 1px)' }">
<a-button type="primary" @click="javascript;"> 随机补考 </a-button> <a-button type="primary" @click="randomResit"> 随机补考 </a-button>
</a-form-item> </a-form-item>
</a-form-item> </a-form-item>
</a-col> </a-col>
@ -119,7 +112,7 @@
<a-col :span="24"> <a-col :span="24">
<a-form-model-item :wrapper-col="{ span: 14, offset: 4 }"> <a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
<a-button type="primary" @click="toNext"> 下一步 </a-button> <a-button type="primary" @click="toNext"> 下一步 </a-button>
<a-button style="margin-left: 10px"> 取消 </a-button> <a-button style="margin-left: 10px" @click="toNext"> 上一步 </a-button>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
</a-row> </a-row>
@ -129,13 +122,14 @@
<script> <script>
import { dictGet } from '@/api/project/project' import { dictGet } from '@/api/project/project'
export default { export default {
data() { data() {
return { return {
labelCol: { span: 4 }, labelCol: { span: 4 },
wrapperCol: { span: 14 }, wrapperCol: { span: 14 },
form: this.$form.createForm(this),
personType: [], personType: [],
form: this.$form.createForm(this),
} }
}, },
components: { components: {
@ -161,7 +155,7 @@ export default {
name: r.name, name: r.name,
}) })
}) })
console.log("----------------",this.personType) console.log('----------------', this.personType)
} }
}) })
}, },
@ -170,19 +164,17 @@ export default {
//from //from
toNext() { toNext() {
console.log('toNext', this.form) console.log('toNext', this.form)
const { this.$emit('nextStep', this.form)
form: { validateFields }, },
} = this
// createClass() {
validateFields((err, values) => { console.log('-------createClass--------')
if (!err) { },
this.$emit('nextStep')
} //
}) randomResit() {
this.form.resitNumber = Math.floor(Math.random() * (5 - 1) + 1)
}, },
createClass(){
console.log("-------createClass--------")
}
}, },
} }
</script> </script>

View File

@ -1,72 +0,0 @@
<template>
<page-header-wrapper>
<!-- PageHeader 第二种使用方式 (v-slot) -->
<template v-slot:content>
将一个冗长或用户不熟悉的表单任务分成多个步骤指导用户完成
</template>
<a-card :bordered="false">
<a-steps class="steps" :current="currentTab">
<a-step title="基本信息" />
<a-step title="选择单位" />
<a-step title="选择课程" />
<a-step title="选择人员" />
<a-step title="完成" />
</a-steps>
<div class="content">
<step1 v-if="currentTab === 0" @nextStep="nextStep"/>
<step2 v-if="currentTab === 1" @nextStep="nextStep" @prevStep="prevStep"/>
<step2 v-if="currentTab === 2" @nextStep="nextStep" @prevStep="prevStep"/>
<step2 v-if="currentTab === 3" @nextStep="nextStep" @prevStep="prevStep"/>
<step3 v-if="currentTab === 4" @prevStep="prevStep" @finish="finish"/>
</div>
</a-card>
</page-header-wrapper>
</template>
<script>
import Step1 from './ProjectForm'
import Step2 from './ProjectUnitSelect.vue'
import Step3 from './ProjectCourseSelect.vue'
export default {
name: 'StepForm',
components: {
Step1,
Step2,
Step3,
},
data () {
return {
currentTab: 0,
// form
form: null,
}
},
methods: {
// handler
//
nextStep () {
if (this.currentTab < 5) {
this.currentTab += 1
}
},
//
prevStep () {
if (this.currentTab > 0) {
this.currentTab -= 1
}
},
finish () {
this.currentTab = 0
}
}
}
</script>
<style lang="less" scoped>
.steps {
max-width: 750px;
margin: 16px auto;
}
</style>

View File

@ -1,10 +1,5 @@
<template> <template>
<page-header-wrapper title="请选择受训单位">
<a-form-model :model="form"> <a-form-model :model="form">
<a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
<a-button type="primary" @click="toNext"> 下一步 </a-button>
<a-button style="margin-left: 10px"> 取消 </a-button>
</a-form-model-item>
<!-- showSearch --> <!-- showSearch -->
<!-- height: '500px',overflowY: 'auto' --> <!-- height: '500px',overflowY: 'auto' -->
@ -42,8 +37,11 @@
/> />
</template> </template>
</a-transfer> </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"> 取消 </a-button>
</a-form-model-item>
</a-form-model> </a-form-model>
</page-header-wrapper>
</template> </template>

View File

@ -1,168 +0,0 @@
<template>
<a-card :bordered="false" :style="{ height: '100%' }">
<a-row :gutter="24">
<a-col :md="4">
<a-list itemLayout="vertical" :dataSource="roles">
<a-list-item slot="renderItem" slot-scope="item, index" :key="index">
<a-list-item-meta :style="{ marginBottom: '0' }">
<span slot="description" style="text-align: center; display: block">{{ item.describe }}</span>
<a slot="title" style="text-align: center; display: block" @click="edit(item)">{{ item.name }}</a>
</a-list-item-meta>
</a-list-item>
</a-list>
</a-col>
<a-col :md="20">
<div style="max-width: 800px">
<a-divider v-if="isMobile()" />
<div v-if="mdl.id">
<h3>角色{{ mdl.name }}</h3>
</div>
<a-form :form="form" :layout="isMobile() ? 'vertical' : 'horizontal'">
<a-form-item label="唯一键">
<a-input v-decorator="[ 'id', {rules: [{ required: true, message: 'Please input unique key!' }]} ]" placeholder="请填写唯一键" />
</a-form-item>
<a-form-item label="角色名称">
<a-input v-decorator="[ 'name', {rules: [{ required: true, message: 'Please input role name!' }]} ]" placeholder="请填写角色名称" />
</a-form-item>
<a-form-item label="状态">
<a-select v-decorator="[ 'status', {rules: []} ]">
<a-select-option :value="1">正常</a-select-option>
<a-select-option :value="2">禁用</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="备注说明">
<a-textarea :row="3" v-decorator="[ 'describe', {rules: [{ required: true, message: 'Please input role name!' }]} ]" placeholder="请填写角色名称" />
</a-form-item>
<a-form-item label="拥有权限">
<a-row :gutter="16" v-for="(permission, index) in permissions" :key="index">
<a-col :xl="4" :lg="24">
{{ permission.name }}
</a-col>
<a-col :xl="20" :lg="24">
<a-checkbox
v-if="permission.actionsOptions.length > 0"
:indeterminate="permission.indeterminate"
:checked="permission.checkedAll"
@change="onChangeCheckAll($event, permission)">
全选
</a-checkbox>
<a-checkbox-group :options="permission.actionsOptions" v-model="permission.selected" @change="onChangeCheck(permission)" />
</a-col>
</a-row>
</a-form-item>
</a-form>
</div>
</a-col>
</a-row>
</a-card>
</template>
<script>
import pick from 'lodash.pick'
import { getRoleList, getPermissions } from '@/api/manage'
import { actionToObject } from '@/utils/permissions'
import { baseMixin } from '@/store/app-mixin'
export default {
name: 'RoleList',
mixins: [baseMixin],
components: {},
data () {
return {
form: this.$form.createForm(this),
mdl: {},
roles: [],
permissions: []
}
},
created () {
getRoleList().then((res) => {
this.roles = res.result.data
this.roles.push({
id: '-1',
name: '新增角色',
describe: '新增一个角色'
})
console.log('this.roles', this.roles)
})
this.loadPermissions()
},
methods: {
callback (val) {
console.log(val)
},
add () {
this.edit({ id: 0 })
},
edit (record) {
this.mdl = Object.assign({}, record)
//
if (this.mdl.permissions && this.permissions) {
//
const permissionsAction = {}
this.mdl.permissions.forEach(permission => {
permissionsAction[permission.permissionId] = permission.actionEntitySet.map(entity => entity.action)
})
console.log('permissionsAction', permissionsAction)
// action
this.permissions.forEach(permission => {
const selected = permissionsAction[permission.id]
permission.selected = selected || []
this.onChangeCheck(permission)
})
console.log('this.permissions', this.permissions)
}
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.mdl, 'id', 'name', 'status', 'describe'))
})
console.log('this.mdl', this.mdl)
},
onChangeCheck (permission) {
permission.indeterminate = !!permission.selected.length && (permission.selected.length < permission.actionsOptions.length)
permission.checkedAll = permission.selected.length === permission.actionsOptions.length
},
onChangeCheckAll (e, permission) {
console.log('permission:', permission)
Object.assign(permission, {
selected: e.target.checked ? permission.actionsOptions.map(obj => obj.value) : [],
indeterminate: false,
checkedAll: e.target.checked
})
},
loadPermissions () {
getPermissions().then(res => {
const result = res.result
this.permissions = result.map(permission => {
const options = actionToObject(permission.actionData)
permission.checkedAll = false
permission.selected = []
permission.indeterminate = false
permission.actionsOptions = options.map(option => {
return {
label: option.describe,
value: option.action
}
})
return permission
})
})
}
}
}
</script>
<style scoped>
</style>

View File

@ -67,7 +67,6 @@
:dropdownStyle="{ maxHeight: '300px', overflow: 'auto' }" :dropdownStyle="{ maxHeight: '300px', overflow: 'auto' }"
:treeData="menuTreeData" :treeData="menuTreeData"
placeholder="请选择父级菜单" placeholder="请选择父级菜单"
treeDefaultExpandAll
:replaceFields="{ :replaceFields="{
children:'children', children:'children',
title:'name', title:'name',