From 15a836e28bfa40918ebe8343ec883470bd7126f8 Mon Sep 17 00:00:00 2001 From: Yuanjianghong Date: Mon, 13 Sep 2021 18:30:32 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86=E6=96=B0?= =?UTF-8?q?=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/project/ProjectList.vue | 2 +- .../terminalTrain/TerminalTrainList.vue | 86 ++++++++++++++----- 2 files changed, 66 insertions(+), 22 deletions(-) diff --git a/src/views/project/ProjectList.vue b/src/views/project/ProjectList.vue index 5b4fa5f..ab956ad 100644 --- a/src/views/project/ProjectList.vue +++ b/src/views/project/ProjectList.vue @@ -1,5 +1,5 @@ @@ -34,22 +55,30 @@ //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等) //例如:import 《组件名称》 from '《组件路径》' import { SearchCom, STable } from '@/components' -import { terminalTrainList } from '@/api/project/terminalTrain' +import { terminalTrainList,terminalTrainDel } from '@/api/project/terminalTrain' export default { //import引入的组件需要注入到对象中才能使用 - components: { SearchCom, STable, terminalTrainList }, + components: { SearchCom, STable, terminalTrainList,terminalTrainDel }, props: {}, data() { //这里存放数据 return { queryParam: { - status: this.$route.query.terminalTrainQueryProjectStatus || '', - name: this.$route.query.terminalTrainQueryProjectName || '', + status: this.$route.query.terminalTrainQueryProjectStatus || null, + name: this.$route.query.terminalTrainQueryProjectName || null, startDate: this.$route.query.terminalTrainQueryStartDate || null, endDate: this.$route.query.terminalTrainQueryEndDate || null, }, columns: [ + { + title: '序号', + width: 'auto', + align: 'center', + dataIndex: 'id', + key: 'id', + scopedSlots: { customRender: 'serial' }, + }, { title: '项目名称', width: 'auto', align: 'center', dataIndex: 'projectName', key: 'projectName' }, { title: '时间', @@ -63,17 +92,19 @@ export default { title: '人数', width: 'auto', align: 'center', - dataIndex: 'personNum', - key: 'personNum', - customRender: (record) => record.signNum + '/' + record.personNum, + dataIndex: 'num', + key: 'num', + customRender: (text, record, index) => { + return record.signNum + ' / ' + record.personNum + }, }, { title: '培训类型', width: 'auto', align: 'center', dataIndex: 'projectType', key: 'projectType' }, { title: '项目状态', width: 'auto', align: 'center', - dataIndex: 'finishState', - key: 'finishState', + dataIndex: 'status', + key: 'status', customRender: (text, record, index) => { // 完成状态 0-未完成 1-已完成 if (text == 0) return '未完成' @@ -86,6 +117,8 @@ export default { ], loadData: (parameter) => { return terminalTrainList(Object.assign(parameter, this.queryParam)).then((res) => { + const record = {signNum : 20, personNum: 40} + console.log(record.signNum + '/' + record.personNum) return res }) }, @@ -119,8 +152,19 @@ export default { watch: {}, //方法集合 methods: { - handleRefresh() { - console.log('handleRefresh',this.queryParam) + //刷新列表 + handleRefresh(bool) { + console.log('handleRefresh', this.queryParam) + this.$refs.table.refresh(bool) + }, + delTerminalTrain(record){ + console.log("delete Id:",record.id) + terminalTrainDel({ids:record.id}).then((res => { + console.log(res) + if(res.code == 200){ + this.$message.info('删除成功') + } + })) }, }, created() {}, //生命周期 - 创建完成(可以访问当前this实例)