创建课程时,所属产品变为产品类型

This commit is contained in:
joylink_cuiweidong 2019-12-25 19:40:49 +08:00
parent b70daac9bf
commit 4a30ced825
3 changed files with 23 additions and 14 deletions

View File

@ -121,5 +121,6 @@ export default {
courseDetails: 'Course details', courseDetails: 'Course details',
courseTree: 'Course tree:', courseTree: 'Course tree:',
mapName:'Map Name', mapName:'Map Name',
copy: 'Copy' copy: 'Copy',
prdType:'Product Type'
}; };

View File

@ -120,6 +120,7 @@ export default {
courseDetails: '课程详情', courseDetails: '课程详情',
courseTree: '课程树:', courseTree: '课程树:',
mapName:'地图名称', mapName:'地图名称',
copy: '复制' copy: '复制',
prdType:'产品类型'
}; };

View File

@ -20,13 +20,13 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="this.$t('lesson.associatedProducts')" prop="prdId"> <el-form-item :label="this.$t('lesson.prdType')" prop="prdType">
<el-select v-model="courseModel.prdId" :placeholder="$t('rules.pleaseSelect')" :disabled="isEdit"> <el-select v-model="courseModel.prdType" :placeholder="$t('rules.pleaseSelect')" :disabled="isEdit">
<el-option <el-option
v-for="(item,index) in productList" v-for="(item,index) in prdTypeList"
:key="index" :key="index"
:label="item.name" :label="item.label"
:value="item.id" :value="item.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -61,6 +61,8 @@ import { createLesson, updateLesson, getLessonDetail } from '@/api/jmap/lessondr
import { getCommodityMapProduct } from '@/api/management/mapprd'; import { getCommodityMapProduct } from '@/api/management/mapprd';
import { getPublishMapListOnline } from '@/api/jmap/map'; import { getPublishMapListOnline } from '@/api/jmap/map';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
import Cookies from 'js-cookie';
import ConstConfig from '@/scripts/ConstConfig';
export default { export default {
name: 'CourseEdit', name: 'CourseEdit',
@ -70,11 +72,10 @@ export default {
return { return {
isEdit: false, isEdit: false,
display: 1, display: 1,
productList: [],
mapIdList: [], mapIdList: [],
courseModel: { courseModel: {
id: '', id: '',
prdId: '', prdType: '',
product: [], product: [],
mapId: '', mapId: '',
name: '', name: '',
@ -86,6 +87,12 @@ export default {
title() { title() {
return this.isEdit ? this.$t('lesson.editCourse') : this.$t('lesson.createCourse'); return this.isEdit ? this.$t('lesson.editCourse') : this.$t('lesson.createCourse');
}, },
prdTypeList() {
const productTypeList = ConstConfig.ConstSelect.prdType;
return Cookies.get('user_lang') == 'en'
? productTypeList.map(elem => { return { value: elem.value, label: elem.enlabel }; })
: productTypeList.map(elem => { return { value: elem.value, label: elem.label }; });
},
rules() { rules() {
const baseRules = { const baseRules = {
name: [ name: [
@ -94,8 +101,8 @@ export default {
mapId: [ mapId: [
{ required: true, message: this.$t('rules.selectMapName'), trigger: 'change' } { required: true, message: this.$t('rules.selectMapName'), trigger: 'change' }
], ],
prdId: [ prdType: [
{ required: true, message: this.$t('rules.selectAssociatedProduct'), trigger: 'change' } { required: true, message: this.$t('rules.productTypeInput'), trigger: 'change' }
], ],
remarks: [ remarks: [
{ required: true, message: this.$t('rules.enterCourseDescription'), trigger: 'change' } { required: true, message: this.$t('rules.enterCourseDescription'), trigger: 'change' }
@ -133,7 +140,7 @@ export default {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
const model = { const model = {
prdId: this.courseModel.prdId, prdType: this.courseModel.prdType,
name: this.courseModel.name, name: this.courseModel.name,
mapId: this.courseModel.mapId, mapId: this.courseModel.mapId,
remarks: this.courseModel.remarks remarks: this.courseModel.remarks
@ -153,7 +160,7 @@ export default {
if (valid) { if (valid) {
const model = { const model = {
id: this.courseModel.id, id: this.courseModel.id,
prdId: this.courseModel.prdId, prdType: this.courseModel.prdType,
name: this.courseModel.name, name: this.courseModel.name,
mapId: this.courseModel.mapId, mapId: this.courseModel.mapId,
remarks: this.courseModel.remarks remarks: this.courseModel.remarks
@ -174,7 +181,7 @@ export default {
this.courseModel = { this.courseModel = {
id: data.id, id: data.id,
mapId: this.$route.query.mapId, mapId: this.$route.query.mapId,
prdId: data.prdId, prdType: data.prdType,
name: data.name, name: data.name,
remarks: data.remarks remarks: data.remarks
}; };