Merge branch 'develop' of https://gitee.com/siwa-team/dawa-vue into develop
This commit is contained in:
commit
9c25a47261
|
@ -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
|
||||
})
|
||||
}
|
|
@ -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
|
||||
})
|
||||
}
|
|
@ -34,3 +34,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
.ant-layout-sider {
|
||||
flex: 0 0 230px !important;
|
||||
max-width: 230px !important;
|
||||
min-width: 230px !important;
|
||||
width: 230px !important;
|
||||
}
|
||||
|
|
|
@ -120,4 +120,10 @@ export default {
|
|||
|
||||
<style lang="less">
|
||||
@import "./BasicLayout.less";
|
||||
|
||||
/*隐藏原本的图标*/
|
||||
.ant-pro-global-header-trigger{
|
||||
display: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -5,7 +5,7 @@ const getters = {
|
|||
color: state => state.app.color,
|
||||
token: state => state.user.token,
|
||||
avatar: state => state.user.avatar,
|
||||
nickname: state => state.user.name,
|
||||
name: state => state.user.name,
|
||||
welcome: state => state.user.welcome,
|
||||
roles: state => state.user.roles,
|
||||
buttons: state => state.user.buttons,
|
||||
|
|
|
@ -14,8 +14,8 @@ export function actionToObject (json) {
|
|||
*/
|
||||
export function hasBtnPermission (permission) {
|
||||
const myBtns = store.getters.buttons
|
||||
const nickname = store.getters.nickname
|
||||
if (nickname == '超级管理员') {
|
||||
const name = store.getters.name
|
||||
if (name == 'admin') {
|
||||
return true
|
||||
}
|
||||
return myBtns.indexOf(permission) > -1
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -1,36 +0,0 @@
|
|||
<template>
|
||||
<div></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
||||
//例如: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>
|
|
@ -38,9 +38,9 @@
|
|||
<a-button icon="redo" @click="() => (queryParam = {})">重置</a-button>
|
||||
</a-space>
|
||||
|
||||
<a-space direction="horizontal">
|
||||
<a-button type="primary" icon="plus" @click="handledCreate()">新建</a-button>
|
||||
<a-button type="primary" icon="minus" @click="handleEdit()">删除</a-button>
|
||||
<a-space class="table-operator" direction="horizontal">
|
||||
<a-button type="primary" icon="plus" @click="$refs.projectStepForm.add1()">新增项目</a-button>
|
||||
<a-button type="primary" icon="minus" @click="handleEdit()">删除项目</a-button>
|
||||
</a-space>
|
||||
|
||||
<s-table
|
||||
|
@ -67,6 +67,7 @@
|
|||
</template>
|
||||
</span>
|
||||
</s-table>
|
||||
<project-step-form ref="projectStepForm"></project-step-form>
|
||||
</a-space>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -75,16 +76,12 @@
|
|||
import moment from 'moment'
|
||||
import { STable } from '@/components'
|
||||
import { getProjectList } from '@/api/project/project'
|
||||
import ProjectForm from '@/views/project/form/ProjectForm'
|
||||
import router from '@/router/index.js'
|
||||
import projectStepForm from './ProjectStepForm'
|
||||
|
||||
export default {
|
||||
name: 'ProjectList',
|
||||
props: {},
|
||||
components: {
|
||||
STable,
|
||||
ProjectForm,
|
||||
router,
|
||||
projectStepForm,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -153,10 +150,10 @@ export default {
|
|||
methods: {
|
||||
// 增
|
||||
handledCreate() {
|
||||
return this.$router.push(
|
||||
// {name: 'ProjectForm'}
|
||||
{ path: 'project/project/add' }
|
||||
)
|
||||
// return this.$router.push(
|
||||
// // {name: 'ProjectForm'}
|
||||
// { path: 'project/project/add' }
|
||||
// )
|
||||
// router.push()
|
||||
},
|
||||
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -1,5 +1,4 @@
|
|||
<template>
|
||||
<div>
|
||||
<a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol" :layout="vertical">
|
||||
<a-space direction="vertical" style="width: 100%">
|
||||
<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 href="javascript:;" @click="handleEdit(record)">修改</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)">
|
||||
<a href="javascript:;">删除</a>
|
||||
<a-button type="primary" @click="$refs.table.refresh(true)">删除</a-button>
|
||||
</a-popconfirm>
|
||||
<a-divider type="vertical" />
|
||||
<a href="javascript:;" @click="handleDetail(record)">详情</a>
|
||||
<a-divider type="vertical" /> -->
|
||||
</template>
|
||||
</span>
|
||||
</s-table>
|
||||
|
@ -43,7 +37,6 @@
|
|||
</a-form-model-item>
|
||||
</a-space>
|
||||
</a-form-model>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -60,7 +53,7 @@ export default {
|
|||
data() {
|
||||
//这里存放数据
|
||||
return {
|
||||
form: {},
|
||||
form: this.$form.createForm(this),
|
||||
totalHours: 0, //总课时
|
||||
totalLearnHours: 0, //总学时
|
||||
totalTopicNum: 0, //题目数量
|
||||
|
|
|
@ -1,31 +1,24 @@
|
|||
<template>
|
||||
<!-- <page-header-wrapper :title="新增项目"> -->
|
||||
<a-form-model :model="form" :label-col="labelCol" :wrapper-col="wrapperCol" :layout="vertical">
|
||||
<!-- <page-header-wrapper :title="新增项目">
|
||||
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-col :md="24" :sm="24">
|
||||
<a-form-model-item label="项目名称">
|
||||
<a-input
|
||||
v-model="form.projectName"
|
||||
v-decorator="[
|
||||
'projectName',
|
||||
{
|
||||
rules: [{ required: true, message: '项目名称为必填' }],
|
||||
},
|
||||
]"
|
||||
/>
|
||||
<a-input v-model="form.projectName" />
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="12">
|
||||
<a-row :gutter="24">
|
||||
<a-col :md="24" :sm="24">
|
||||
<a-form-model-item label="培训种类">
|
||||
<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-button type="primary" @click="createClass"> 新增种类 </a-button>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="培训类型">
|
||||
<a-select v-model="form.trainType" placeholder="--请选择--">
|
||||
<a-select-option value="1"> 必修课 </a-select-option>
|
||||
|
@ -33,7 +26,7 @@
|
|||
</a-select>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="培训方式">
|
||||
<a-select v-model="form.trainWay" placeholder="--请选择--">
|
||||
<a-select-option value="1"> 培训 </a-select-option>
|
||||
|
@ -43,7 +36,7 @@
|
|||
</a-select>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-col :span="24">
|
||||
<a-form-model-item label="人员类型">
|
||||
<a-select v-model="form.personType" placeholder="--请选择--">
|
||||
<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-form-item>
|
||||
<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-col>
|
||||
|
@ -119,7 +112,7 @@
|
|||
<a-col :span="24">
|
||||
<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-button style="margin-left: 10px" @click="toNext"> 上一步 </a-button>
|
||||
</a-form-model-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
@ -129,13 +122,14 @@
|
|||
<script>
|
||||
import { dictGet } from '@/api/project/project'
|
||||
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
labelCol: { span: 4 },
|
||||
wrapperCol: { span: 14 },
|
||||
form: this.$form.createForm(this),
|
||||
personType: [],
|
||||
form: this.$form.createForm(this),
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
@ -161,7 +155,7 @@ export default {
|
|||
name: r.name,
|
||||
})
|
||||
})
|
||||
console.log("----------------",this.personType)
|
||||
console.log('----------------', this.personType)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
@ -170,19 +164,17 @@ export default {
|
|||
//下一步,跳转页面带上from对象
|
||||
toNext() {
|
||||
console.log('toNext', this.form)
|
||||
const {
|
||||
form: { validateFields },
|
||||
} = this
|
||||
// 先校验,通过表单校验后,才进入下一步
|
||||
validateFields((err, values) => {
|
||||
if (!err) {
|
||||
this.$emit('nextStep')
|
||||
}
|
||||
})
|
||||
this.$emit('nextStep', this.form)
|
||||
},
|
||||
|
||||
createClass() {
|
||||
console.log('-------createClass--------')
|
||||
},
|
||||
|
||||
//范回一个随机数
|
||||
randomResit() {
|
||||
this.form.resitNumber = Math.floor(Math.random() * (5 - 1) + 1)
|
||||
},
|
||||
createClass(){
|
||||
console.log("-------createClass--------")
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -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>
|
|
@ -1,10 +1,5 @@
|
|||
<template>
|
||||
<page-header-wrapper title="请选择受训单位">
|
||||
<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 -->
|
||||
<!-- height: '500px',overflowY: 'auto' -->
|
||||
|
@ -42,8 +37,11 @@
|
|||
/>
|
||||
</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"> 取消 </a-button>
|
||||
</a-form-model-item>
|
||||
</a-form-model>
|
||||
</page-header-wrapper>
|
||||
</template>
|
||||
|
||||
|
||||
|
|
|
@ -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>
|
|
@ -67,7 +67,6 @@
|
|||
:dropdownStyle="{ maxHeight: '300px', overflow: 'auto' }"
|
||||
:treeData="menuTreeData"
|
||||
placeholder="请选择父级菜单"
|
||||
treeDefaultExpandAll
|
||||
:replaceFields="{
|
||||
children:'children',
|
||||
title:'name',
|
||||
|
|
Loading…
Reference in New Issue