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

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',
courseTree: 'Course tree:',
mapName:'Map Name',
copy: 'Copy'
copy: 'Copy',
prdType:'Product Type'
};

View File

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

View File

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