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

This commit is contained in:
qinjie 2021-11-03 16:42:11 +08:00
commit 4660e88510
3 changed files with 43 additions and 30 deletions

View File

@ -31,13 +31,13 @@ export default {
}, },
data() { data() {
return { return {
queryParam: { id: this.$route.query.terminalTrainId }, queryParam: this.$route.query.terminalTrainId,
detailData: {}, detailData: {},
} }
}, },
created: function () { created: function () {
let parameter = {} let parameter = {}
terminalTrainGet(Object.assign(parameter, this.queryParam)).then((res) => { terminalTrainGet(this.queryParam).then((res) => {
this.detailData = res.data this.detailData = res.data
}) })
}, },

View File

@ -1,6 +1,6 @@
<template> <template>
<a-card :bordered="false" :title="titleName"> <a-card :bordered="false" :title="titleName">
<a-form-model @submit="handleSubmit" :model="form" > <a-form-model @submit="handleSubmit" :model="form">
<a-form-model-item label="培训名称"> <a-form-model-item label="培训名称">
<a-input v-model="form.trainName" /> <a-input v-model="form.trainName" />
</a-form-model-item> </a-form-model-item>
@ -31,7 +31,8 @@
<a-form-model-item label="备注"> <a-form-model-item label="备注">
<a-input v-model="form.remark" type="textarea" /> <a-input v-model="form.remark" type="textarea" />
</a-form-model-item> </a-form-model-item>
<a-button htmlType="submit" type="primary"> 保存 </a-button> <a-button htmlType="submit" type="primary" > 保存 </a-button>
<a-button htmlType="submit" type="primary" @click="() => { this.form.status = 2 }"> 保存并发布 </a-button>
</a-form-model> </a-form-model>
</a-card> </a-card>
</template> </template>
@ -63,6 +64,7 @@ export default {
contact: '', contact: '',
phone: '', phone: '',
remark: '', remark: '',
status: 1,
}, },
titleName: '新增终端培训', titleName: '新增终端培训',
} }
@ -77,25 +79,34 @@ export default {
console.log('提交的数据', this.form) console.log('提交的数据', this.form)
terminalTrainEdit(this.form).then((res) => { terminalTrainEdit(this.form).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.$message.success('新增成功') this.$message.success('保存成功!')
this.handleCancel() this.$router.push({
//list
path: '/project/project/terminalTrain/list',
query: {
terminalTrainName: this.$route.query.terminalTrainName,
terminalTrainStatus: this.$route.query.terminalTrainStatus,
terminalTrainStartDate: this.$route.query.terminalTrainStartDate,
terminalTrainEndDate: this.$route.query.terminalTrainEndDate,
terminalTrainPageNum: this.$route.query.terminalTrainPageNum,
},
})
} else { } else {
this.$message.error('新增失败:' + res.msg) this.$message.error('保存失败:' + res.msg)
this.handleCancel()
} }
}) })
}, },
}, },
created() { created() {
if(this.$route.query.id){ console.log('1---', this.$store.state.user)
if (this.$route.query.id) {
this.form = terminalTrainGet(this.$route.query.id).then((res) => { this.form = terminalTrainGet(this.$route.query.id).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.form = res.data; this.form = res.data
} else { } else {
this.$message.error('获取数据失败:' + res.msg) this.$message.error('获取数据失败:' + res.msg)
} }
} })
)
} }
}, // - 访this }, // - 访this
mounted() {}, // - 访DOM mounted() {}, // - 访DOM

View File

@ -113,9 +113,11 @@ export default {
dataIndex: 'status', dataIndex: 'status',
key: 'status', key: 'status',
customRender: (text, record, index) => { customRender: (text, record, index) => {
// 0- 1- if (text == '1') return '未发布'
if (text == 0) return '未完成' else if (text == '2') return '未开始'
else if (text == 1) return '已完成' else if (text == '3') return '进行中'
else if (text == '4') return '已结束'
else if (text == '5') return '已终止'
}, },
}, },
{ title: '创建人员', width: 'auto', align: 'center', dataIndex: 'createBy', key: 'createBy' }, { title: '创建人员', width: 'auto', align: 'center', dataIndex: 'createBy', key: 'createBy' },
@ -148,8 +150,8 @@ export default {
{ id: '5', name: '已终止' }, { id: '5', name: '已终止' },
], ],
}, },
{ type: 'date', placeholder: '开始时间', key: 'startDate' }, { type: 'date', placeholder: '开始时间', key: 'startDate', format:'YYYY-MM-DD' },
{ type: 'date', placeholder: '结束时间', key: 'endDate' }, { type: 'date', placeholder: '结束时间', key: 'endDate', format:'YYYY-MM-DD' },
] ]
}, },
}, },
@ -168,7 +170,8 @@ export default {
terminalTrainDel({ ids: record.id }).then((res) => { terminalTrainDel({ ids: record.id }).then((res) => {
console.log(res) console.log(res)
if (res.code == 200) { if (res.code == 200) {
this.$message.info('删除成功') this.$message.info('删除成功');
this.$refs.table.refresh();
} }
}) })
}, },
@ -182,11 +185,11 @@ export default {
path: '/project/terminalTrain/detail', path: '/project/terminalTrain/detail',
query: { query: {
terminalTrainId: record.id, terminalTrainId: record.id,
terminalTrainName: this.$route.query.terminalTrainName, terminalTrainName: this.queryParam.name,
terminalTrainStatus: this.$route.query.terminalTrainStatus, terminalTrainStatus: this.queryParam.status,
terminalTrainStartDate: this.$route.query.terminalTrainStartDate, terminalTrainStartDate: this.queryParam.startDate,
terminalTrainEndDate: this.$route.query.terminalTrainEndDate, terminalTrainEndDate: this.queryParam.endDate,
terminalTrainPageNum: this.$route.query.terminalTrainPageNum, terminalTrainPageNum: this.$refs.table.localPagination.current,
}, },
}) })
console.log('跳转详情页面 id:', record.id) console.log('跳转详情页面 id:', record.id)
@ -197,20 +200,19 @@ export default {
path: '/project/terminalTrain/form', path: '/project/terminalTrain/form',
query: { query: {
id: record.id, // id: record.id, //
terminalTrainName: this.$route.query.terminalTrainName, terminalTrainName: this.queryParam.name || null,
terminalTrainStatus: this.$route.query.terminalTrainStatus, terminalTrainStatus: this.queryParam.status || null,
terminalTrainStartDate: this.$route.query.terminalTrainStartDate, terminalTrainStartDate: this.queryParam.startDate || null,
terminalTrainEndDate: this.$route.query.terminalTrainEndDate, terminalTrainEndDate: this.queryParam.endDate || null,
terminalTrainPageNum: this.$route.query.terminalTrainPageNum, terminalTrainPageNum: this.$refs.table.localPagination.current || null,
}, },
}) })
console.log('编辑 id:', record) console.log('编辑 id:', record)
}, },
handledCreate() { handledCreate() { //
this.$router.push({ this.$router.push({
path: '/project/terminalTrain/form', path: '/project/terminalTrain/form',
query: { query: {
type: 1, //
terminalTrainName: this.$route.query.terminalTrainName, terminalTrainName: this.$route.query.terminalTrainName,
terminalTrainStatus: this.$route.query.terminalTrainStatus, terminalTrainStatus: this.$route.query.terminalTrainStatus,
terminalTrainStartDate: this.$route.query.terminalTrainStartDate, terminalTrainStartDate: this.$route.query.terminalTrainStartDate,