穿梭框测试提交

This commit is contained in:
Yuanjianghong 2021-08-27 17:52:21 +08:00
parent 86d80a3b1a
commit ece529ec06
4 changed files with 138 additions and 52 deletions

View File

@ -88,7 +88,7 @@ export const asyncRouterMap = [
path: '/project/add', path: '/project/add',
name: 'ProjectForm', name: 'ProjectForm',
component: () => import('@/views/project/ProjectForm'), component: () => import('@/views/project/ProjectForm'),
meta: { title: '新增项目', keepAlive: true, permission: ['form'] } meta: { title: '新增项目', keepAlive: true, permission: ['form'], show: false}
}, },
{ {
path: '/project/unitSelect', path: '/project/unitSelect',

View File

@ -45,7 +45,9 @@ import {
Descriptions, Descriptions,
message, message,
notification, notification,
space space,
Transfer,
Tree
} from 'ant-design-vue' } from 'ant-design-vue'
import Viser from 'viser-vue' import Viser from 'viser-vue'
@ -99,6 +101,8 @@ Vue.use(Result)
Vue.use(Statistic) Vue.use(Statistic)
Vue.use(Descriptions) Vue.use(Descriptions)
Vue.use(space) Vue.use(space)
Vue.use(Tree)
Vue.use(Transfer)
Vue.prototype.$confirm = Modal.confirm Vue.prototype.$confirm = Modal.confirm
Vue.prototype.$message = message Vue.prototype.$message = message

View File

@ -9,12 +9,22 @@
<a-select-option value="null">全部</a-select-option> <a-select-option value="null">全部</a-select-option>
<a-select-option value="1">运行中</a-select-option> <a-select-option value="1">运行中</a-select-option>
<a-select-option value="2">已结束</a-select-option> <a-select-option value="2">已结束</a-select-option>
<a-select-option value="1">未发布</a-select-option> <a-select-option value="3">未发布</a-select-option>
</a-select> </a-select>
开始时间: 开始时间:
<a-date-picker v-model="queryParam.startDate" style="width: 100%" placeholder="请输入开始时间" valueFormat="YYYY-MM-DD HH:mm:ss"/> <a-date-picker
v-model="queryParam.startDate"
style="width: 100%"
placeholder="请输入开始时间"
valueFormat="YYYY-MM-DD HH:mm:ss"
/>
结束时间: 结束时间:
<a-date-picker v-model="queryParam.endDate" style="width: 100%" placeholder="请输入结束时间" valueFormat="YYYY-MM-DD HH:mm:ss"/> <a-date-picker
v-model="queryParam.endDate"
style="width: 100%"
placeholder="请输入结束时间"
valueFormat="YYYY-MM-DD HH:mm:ss"
/>
培训方式: 培训方式:
<a-select v-model="queryParam.trainWay" placeholder="请选择" default-value="null" style="width: 120px"> <a-select v-model="queryParam.trainWay" placeholder="请选择" default-value="null" style="width: 120px">
<a-select-option value="null">全部</a-select-option> <a-select-option value="null">全部</a-select-option>
@ -36,7 +46,7 @@
<s-table <s-table
ref="table" ref="table"
size="default" size="default"
rowKey="key" rowKey="id"
:columns="columns" :columns="columns"
:data="loadData" :data="loadData"
:rowSelection="options.rowSelection" :rowSelection="options.rowSelection"
@ -70,11 +80,11 @@ import router from '@/router/index.js'
export default { export default {
name: 'ProjectList', name: 'ProjectList',
props: { }, props: {},
components: { components: {
STable, STable,
ProjectForm, ProjectForm,
router router,
}, },
data() { data() {
return { return {
@ -82,20 +92,22 @@ export default {
queryParam: {}, queryParam: {},
// //
columns: [ columns: [
{ title: '序号', width: 60, scopedSlots: { customRender: 'serial' } }, { title: '序号', key: 'id', dataIndex: 'id', width: 60, scopedSlots: { customRender: 'serial' } },
{ title: '项目名称', dataIndex: 'projectName', key: 'projectName' }, { title: '项目名称', dataIndex: 'projectName', key: 'projectName' },
{ {
title: '时间', title: '时间',
dataIndex: 'startDate', dataIndex: 'startDate',
key: 'startDate',
customRender: (text, record, index) => { customRender: (text, record, index) => {
return record.startDate + ' - ' + record.endDate return record.startDate + ' - ' + record.endDate
}, },
}, },
{ title: '人数', dataIndex: 'personNum', customRender: (text) => text + '人' }, { title: '人数', key: 'personNum', dataIndex: 'personNum', customRender: (text) => text + '人' },
{ title: '项目类型', dataIndex: 'projectType' }, { title: '项目类型', dataIndex: 'projectType', key: 'projectType' },
{ {
title: '项目状态', title: '项目状态',
dataIndex: 'status', dataIndex: 'status',
key: 'status',
customRender: (text, record, index) => { customRender: (text, record, index) => {
// 1- 2- 3- 4- 5- // 1- 2- 3- 4- 5-
if (text == 1) { if (text == 1) {
@ -115,15 +127,15 @@ export default {
} }
}, },
}, },
{ title: '创建人员', dataIndex: 'createBy' }, { title: '创建人员', key: 'createBy', dataIndex: 'createBy' },
{ title: '创建时间', dataIndex: 'createDate' }, { title: '创建时间', key: 'createDate', dataIndex: 'createDate' },
{ // {
title: '操作', // title: '',
key: 'operation', // width: 200,
width: 200, // key: 'status',
align: 'center', // align: 'center',
scopedSlots: { customRender: 'action' }, // scopedSlots: { customRender: 'action' },
}, // },
], ],
// Promise // Promise
@ -145,7 +157,7 @@ export default {
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

@ -1,38 +1,108 @@
<template> <template>
<div> <div>
<h1>我是张三</h1> <a-transfer
</div> class="tree-transfer"
:data-source="treeData"
:list-style="{
height: '600px',
}"
:titles="['全部单位列表', '已经选中单位']"
:target-keys="targetKeys"
:render="(item) => item.title"
:show-select-all="false"
@change="onChange"
>
<template slot="children" slot-scope="{ props: { direction, selectedKeys }, on: { itemSelect } }">
<a-tree
v-if="direction === 'left'"
blockNode
checkable
checkStrictly
defaultExpandAll
:checkedKeys="[...selectedKeys, ...targetKeys]"
:treeData="treeData"
@check="
(_, props) => {
onChecked(_, props, [...selectedKeys, ...targetKeys], itemSelect)
}
"
@select="
(_, props) => {
onChecked(_, props, [...selectedKeys, ...targetKeys], itemSelect)
}
"
/>
</template>
</a-transfer>
</div>
</template> </template>
<script> <script>
//jsjsjson const treeData = [
//import from '' { id: '0-0', title: '0-0' },
{
id: '0-1',
title: '0-1',
children: [
{ id: '0-1-0', title: '0-1-0' },
{ id: '0-1-1', title: '0-1-1' },
],
},
{ id: '0-2', title: '0-3' },
]
const transferDataSource = []
function flatten(list = []) {
list.forEach((item) => {
transferDataSource.push(item)
flatten(item.children)
})
}
flatten(JSON.parse(JSON.stringify(treeData)))
function isChecked(selectedKeys, eventKey) {
return selectedKeys.indexOf(eventKey) !== -1
}
function handleTreeData(data, targetKeys = []) {
data.forEach((item) => {
item['disabled'] = targetKeys.includes(item.id)
if (item.children) {
handleTreeData(item.children, targetKeys)
}
})
return data
}
export default { export default {
//import使 data() {
components: {}, return {
props: {}, targetKeys: [],
data() { dataSource: transferDataSource,
// }
return {}; },
}, computed: {
// data treeData() {
computed: {}, return handleTreeData(treeData, this.targetKeys)
//data },
watch: {}, },
// methods: {
methods: {}, onChange(targetKeys) {
created() {}, // - 访this console.log('Target Keys:', targetKeys)
mounted() {}, // - 访DOM this.targetKeys = targetKeys
beforeCreate() {}, // - },
beforeMount() {}, // - onChecked(_, e, checkedKeys, itemSelect) {
beforeUpdate() {}, // - const { eventKey } = e.node
updated() {}, // - itemSelect(eventKey, !isChecked(checkedKeys, eventKey))
beforeDestroy() {}, // - },
destroyed() {}, // - },
activated() {} //keep-alive }
};
</script> </script>
<style scoped> <style scoped>
</style> .tree-transfer .ant-transfer-list:first-child {
width: 50%;
flex: none;
height: 100%;
}
</style>