From 0303c91ca39f20dec3cc735d5406d4ae40fab0ad Mon Sep 17 00:00:00 2001 From: Yuanjianghong Date: Wed, 25 Aug 2021 16:52:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/project/project.js | 17 ++-- src/config/router.config.js | 12 ++- src/views/project/ProjectForm.vue | 38 +++++++ src/views/project/ProjectList.vue | 163 +++++++++++++----------------- 4 files changed, 127 insertions(+), 103 deletions(-) create mode 100644 src/views/project/ProjectForm.vue diff --git a/src/api/project/project.js b/src/api/project/project.js index 4f99135..6edb944 100644 --- a/src/api/project/project.js +++ b/src/api/project/project.js @@ -1,7 +1,7 @@ import request from '@/utils/request' const projectApi = { -// add: 'sys/menu/add', + add: 'project/add', // get: 'sys/menu/get', // update: 'sys/menu/update', // del: 'sys/menu/delete', @@ -9,13 +9,13 @@ const projectApi = { list: 'project/pageList' } -// export function menuAdd (params) { -// return request({ -// url: menuApi.add, -// method: 'post', -// data: params -// }) -// } +export function projectAdd (params) { + return request({ + url: projectApi.add, + method: 'post', + data: params + }) +} // export function menuGet (params) { // return request({ // url: menuApi.get, @@ -38,6 +38,7 @@ const projectApi = { // }) // } export function getProjectList (params) { + console.log("------------{}",params) return request({ url: projectApi.list, method: 'get', diff --git a/src/config/router.config.js b/src/config/router.config.js index bc54d7f..bbb8161 100644 --- a/src/config/router.config.js +++ b/src/config/router.config.js @@ -74,15 +74,21 @@ export const asyncRouterMap = [ // 项目管理 { path: '/project', - redirect: '/project/projectList', + redirect: '/project/list', component: RouteView, meta: { title: '项目管理', icon: bxAnaalyse, permission: ['from'] }, children: [ { - path: '/project/projectList', + path: '/project/list', name: 'projectList', component: () => import('@/views/project/ProjectList'), - meta: { title: '自主项目', keepAlive: true, permission: ['form'] } + meta: { title: '自主项目', keepAlive: true, permission: ['form'] }, + }, + { + path: '/project/add', + name: 'ProjectForm', + component: () => import('@/views/project/ProjectForm'), + meta: { title: '新增项目', keepAlive: true, permission: ['form'] } }, { path: '/form/step-form', diff --git a/src/views/project/ProjectForm.vue b/src/views/project/ProjectForm.vue new file mode 100644 index 0000000..9352c05 --- /dev/null +++ b/src/views/project/ProjectForm.vue @@ -0,0 +1,38 @@ + + + + \ No newline at end of file diff --git a/src/views/project/ProjectList.vue b/src/views/project/ProjectList.vue index d1cba82..cb36494 100644 --- a/src/views/project/ProjectList.vue +++ b/src/views/project/ProjectList.vue @@ -1,6 +1,6 @@ @@ -70,102 +65,91 @@ import moment from 'moment' import { STable } from '@/components' import { getProjectList } from '@/api/project/project' +import ProjectForm from '@/views/project/ProjectForm' +import router from '@/router/index.js' export default { - name: 'TableList', + name: 'ProjectList', + props: { }, components: { STable, + ProjectForm, + router }, data() { return { - mdl: {}, - // 高级搜索 展开/关闭 - advanced: false, // 查询参数 queryParam: {}, // 表头 columns: [ - { - title: '序号', - width: 60, - scopedSlots: { customRender: 'serial' }, - }, - { - title: '项目名称', - dataIndex: 'projectName', - key: 'projectName' - }, + { title: '序号', width: 60, scopedSlots: { customRender: 'serial' } }, + { title: '项目名称', dataIndex: 'projectName', key: 'projectName' }, { title: '时间', - dataIndex: 'description', - }, - { - title: '人数', - dataIndex: 'callNo', - // sorter: true, - needTotal: true, - // customRender: (text) => text + ' 次', - }, - { - title: '项目类型', - dataIndex: 'description', + dataIndex: 'startDate', + customRender: (text, record, index) => { + return record.startDate + ' - ' + record.endDate + }, }, + { title: '人数', dataIndex: 'personNum', customRender: (text) => text + '人' }, + { title: '项目类型', dataIndex: 'projectType' }, { title: '项目状态', - dataIndex: 'description', + dataIndex: 'status', + customRender: (text, record, index) => { + //项目状态 1-未发布 2-未开始 3-进行中 4-已完成 5-已中止 + if (text == 1) { + return '未发布' + } + if (text == 2) { + return '未开始' + } + if (text == 3) { + return '进行中' + } + if (text == 4) { + return '已完成' + } + if (text == 5) { + return '已中止' + } + }, }, - { - title: '创建人员', - dataIndex: 'projectStatus', - }, - { - title: '创建时间', - dataIndex: 'updatedAt', - sorter: true, - }, - // { - // title: '操作', - // dataIndex: 'action', - // width: '150px', - // scopedSlots: { customRender: 'action' }, - // }, + { title: '创建人员', dataIndex: 'createBy' }, + { title: '创建时间', dataIndex: 'createDate' }, { title: '操作', key: 'operation', - width: 100, + width: 200, align: 'center', - scopedSlots: { customRender: 'action' } - } + scopedSlots: { customRender: 'action' }, + }, ], // 加载数据方法 必须为 Promise 对象 - loadData: parameter => { - return getProjectList(Object.assign(parameter, this.queryParam)).then(res => { return res; }) + loadData: (parameter) => { + return getProjectList(Object.assign(parameter, this.queryParam)).then((res) => { + return res + }) }, + selectedRowKeys: [], selectedRows: [], - - // custom table alert & rowSelection - options: { - alert: { - show: true, - clear: () => { - this.selectedRowKeys = [] - }, - }, - rowSelection: { - selectedRowKeys: this.selectedRowKeys, - onChange: this.onSelectChange, - }, - }, - optionAlertShow: false, } }, created() { this.tableOption() - getRoleList({ t: new Date() }) }, methods: { + // 增 + handledCreate() { + return this.$router.push( + // {name: 'ProjectForm'} + {path: 'project/project/add',} + ) + // router.push() + }, + tableOption() { if (!this.optionAlertShow) { this.options = { @@ -190,11 +174,6 @@ export default { } }, - handleEdit(record) { - this.$emit('onEdit', record) - }, - handleOk() { }, - onSelectChange(selectedRowKeys, selectedRows) { this.selectedRowKeys = selectedRowKeys this.selectedRows = selectedRows