dev_2307
gegeya 1 year ago
parent 51afa34604
commit 558ccc423a
  1. 328
      ant-design-vue-jeecg/src/views/course/AddCourse.vue

@ -13,14 +13,11 @@
@cancel="handleCancel"
cancelText="关闭"
>
<el-page-header @back="goBack"> </el-page-header>
<a-form :form="form">
<el-page-header @back="goBack" content="新增课程" style="color: #0683f7; line-height: 60px; margin-left: 6px">
</el-page-header>
<!-- style="color: #0683f7" -->
<a-form :form="form" class="form">
<a-row>
<a-col :span="27">
<a-form-item label="图片" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-image-upload isMultiple v-decorator="['img']"></j-image-upload>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="所属院系" :labelCol="labelCol" :wrapperCol="wrapperCol">
<!-- 删除multi -->
@ -36,25 +33,37 @@
<a-col :span="8">
<a-form-item label="课程类别" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag
type="list"
v-decorator="['category']"
:trigger-change="true"
type="radio"
v-model="model.coursecategory"
dictCode="coursecategory"
placeholder="请选择课程类别"
/>
<!-- v-decorator="['category']"
:trigger-change="true" -->
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="课程性质" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-tree-select
<j-dict-select-tag
type="radio"
v-decorator="['nature', { initialValue: '1298167997234712578' }]"
:trigger-change="true"
dictCode="se_nature,content,id,(pid='0' and id!='1298168032655609858') or pid='1298168032655609858'"
placeholder="请选择课程类别"
/>
<!-- :trigger-change="true" -->
<!-- <j-tree-select
v-model="treeValue"
v-decorator="['nature']"
placeholder="课程性质"
dict="se_nature,content,id"
pidField="pid"
pidValue="0"
/>
/> -->
<!-- {{ treeValue }} v-model="model.nature" -->
</a-form-item>
</a-col>
<!-- <a-col :span="8">
<a-form-item label="培养方案版本" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-search-select-tag v-decorator="['programid']" :dict="dicodep" />
@ -68,7 +77,8 @@
</a-col> -->
<a-col :span="8">
<a-form-item label="课程名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="['name', validatorRules.name]" placeholder="请输入课程名称" rows="4"></a-input>
<a-input v-decorator="['name', validatorRules.name]" placeholder="请输入"></a-input>
<!-- <a-input v-decorator="['name', validatorRules.name]" placeholder="请输入课程名称" rows="4"></a-input> -->
</a-form-item>
</a-col>
<a-col :span="8">
@ -79,15 +89,7 @@
<a-input v-decorator="['code', validatorRules.code]" placeholder="请输入课程编码" rows="4"></a-input>
</a-form-item>
</a-col>
<a-col :span="8">
<!-- 为下拉框 -->
<a-form-item label="开课学期" :labelCol="labelCol" :wrapperCol="wrapperCol">
<!-- <a-input v-decorator="['semester']" placeholder="请输入开课学期"></a-input> -->
<!-- 修改 -->
<!-- <j-search-select-tag dict="se_semester,name,id"></j-search-select-tag>-->
<j-search-select-tag dict="xueqi" v-model="model.year" ></j-search-select-tag>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="课程学分" :labelCol="labelCol" :wrapperCol="wrapperCol">
<!-- <a-input-number v-decorator="['credit']" placeholder="请输入课程学分" style="width: 100%" /> -->
@ -108,6 +110,16 @@
></a-input>
</a-form-item>
</a-col>
<a-col :span="8">
<!-- 为下拉框 -->
<a-form-item label="开课学期" :labelCol="labelCol" :wrapperCol="wrapperCol">
<!-- <a-input v-decorator="['semester']" placeholder="请输入开课学期"></a-input> -->
<!-- 修改 -->
<!-- <j-search-select-tag dict="se_semester,name,id"></j-search-select-tag>-->
<!-- <j-search-select-tag dict="xueqi" v-model="model.year"></j-search-select-tag> -->
<j-dict-select-tag type="radio" v-model="model.year" dictCode="xueqi" placeholder="请选择" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="理论学时" :labelCol="labelCol" :wrapperCol="wrapperCol">
<!-- <a-form-item label="理论学时" :labelCol="{ span: 7 }" :wrapperCol="{ span: 16 }"> -->
@ -166,22 +178,28 @@
<a-form-item label="考核类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag
type="radio"
v-decorator="['assessmenttype']"
v-decorator="['assessmenttype', { initialValue: '1298174364108492802' }]"
:trigger-change="true"
dictCode="se_assessmenttype,content,id"
placeholder="请选择考核类型"
/>
<!-- , rules: [{ required: true, message: '请选择类型' }] -->
<!-- v-decorator="['assessmenttype', { initialValue: '1' }]"
:trigger-change="true" -->
<!-- v-model="model.assessmenttype" -->
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="考核方式" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag
type="radio"
v-decorator="['assessmentway']"
v-decorator="['assessmentway', { initialValue: '1298174700034494466' }]"
:trigger-change="true"
dictCode="se_assessmentway,content,id"
placeholder="请选择考核方式"
/>
<!-- v-model="model.assessmentway"
:trigger-change="true" -->
</a-form-item>
</a-col>
<a-col :span="8">
@ -198,22 +216,23 @@
</a-col>
<a-col :span="8">
<a-form-item label="负责教师" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-select-user-by-dep userSelect="changedUser" v-model="model.teacher" @change="change()" />
<j-select-user-by-dep userSelect="changedUser" v-model="model.teacher" @change="change" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="制定人" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-select-user-by-dep userSelect="maker" v-decorator="['maker']" v-model="model.teacher" @change="change" />
<j-select-user-by-dep
v-decorator="['maker', { initialValue: 'mladmin' }]"
:trigger-change="true"
placeholder="请选择考核类型"
/>
<!-- <j-select-user-by-dep userSelect="maker" v-model="model.maker" @change="change" /> -->
<!-- v-decorator="['maker', { initialValue: 123 }]" -->
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="执笔人" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-select-user-by-dep
userSelect="writer"
v-decorator="['writer']"
v-model="model.teacher"
@change="change"
/>
<j-select-user-by-dep userSelect="writer" v-model="model.writer" @change="change" />
</a-form-item>
</a-col>
<a-col :span="8">
@ -224,19 +243,67 @@
</a-col>
<a-col :span="8">
<a-form-item label="审定人" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-select-user-by-dep
userSelect="verifier"
v-decorator="['verifier']"
v-model="model.teacher"
@change="change"
<j-select-user-by-dep userSelect="verifier" v-model="model.verifier" @change="change" />
</a-form-item>
</a-col>
<!-- 新加的字段 -->
<a-col :span="8">
<a-form-item label="是否合作办学课程" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag
type="radio"
v-model="model.cooperativeEducation"
dictCode="isShow"
placeholder="是否合作办学课程"
/>
</a-form-item>
<!-- <a-form-item
label="请选择"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
v-show="model.cooperativeEducation === '1'"
>
<j-dict-select-tag
type="radio"
v-decorator="['assessmenttype']"
:trigger-change="true"
dictCode="cooperative_education_type"
placeholder="请选择考核类型"
/>
</a-form-item> -->
</a-col>
<a-col :span="8">
<a-form-item
label="请选择"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
v-show="model.cooperativeEducation === '1'"
>
<j-dict-select-tag
type="radio"
v-decorator="['assessmenttype']"
:trigger-change="true"
dictCode="cooperative_education_type"
placeholder="请选择考核类型"
/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="图片" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-image-upload isMultiple v-decorator="['img']"></j-image-upload>
</a-form-item>
</a-col>
</a-row>
<!-- <a-row>
<a-col :span="8">
<a-form-item label="图片" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-image-upload isMultiple v-decorator="['img']"></j-image-upload>
</a-form-item>
</a-col>
</a-row> -->
<a-row>
<a-col :span="24">
<a-form-item label="课程简介" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-col :span="12">
<a-form-item label="课程简介" :label-col="labelCol2" :wrapper-col="wrapperCol2">
<!-- :labelCol="labelCol" :wrapperCol="wrapperCol" -->
<!-- <j-editor style="width: 200%" v-decorator="['synopsis', { trigger: 'input' }]" /> -->
<!-- 修改 -->
@ -253,34 +320,35 @@
</a-form-item>
</a-col>
</a-row>
<a-row>
<!-- <a-row>
<a-col :span="24">
<a-form-item label="教学方式" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-editor style="width: 200%" v-decorator="['teacherway', { trigger: 'input' }]" />
</a-form-item>
</a-col>
</a-row>
<a-row>
</a-row> -->
<!-- <a-row>
<a-col :span="24">
<a-form-item label="教学方法" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-editor style="width: 200%" v-decorator="['teachermethod', { trigger: 'input' }]" />
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :span="24">
</a-row> -->
<!-- <a-row>
<a-col :span="12">
<a-form-item label="考核细则" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-editor style="width: 200%" v-decorator="['assessmentrules', { trigger: 'input' }]" />
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :span="24">
</a-row> -->
<!-- <a-row>
<a-col :span="12">
<a-form-item label="考核内容" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-editor style="width: 200%" v-decorator="['contentdistribution', { trigger: 'input' }]" />
</a-form-item>
</a-col>
</a-row>
</a-row> -->
<!-- <a-row>
<a-col :span="24">
<a-form-item label="达成度标准" :labelCol="labelCol" :wrapperCol="wrapperCol">
@ -291,9 +359,11 @@
</a-form>
<!-- 修改 -->
<div v-if="showButton">
<el-button type="danger" @click="open" size="small">关闭</el-button>
<el-button type="danger" @click="open" size="small" class="el-right">关闭</el-button>
<!-- <el-button type="primary" size="small" @click="handleReset" class="el-left">清空</el-button> -->
<el-button type="primary" size="small" @click="handleOk" class="el-left">确定</el-button>
<el-button type="primary" size="small" @click="handleOk" class="el-right">暂存</el-button>
<!-- <el-button type="primary" size="small" @click="handleOk" class="el-right">暂存</el-button> -->
<el-button type="primary" size="small" @click="handleAdd" class="el-right">增加下一门课</el-button>
</div>
<!-- 修改 -->
<!-- <add-course ref="modalForm" @ok="modalFormOk"></add-course> -->
@ -336,6 +406,27 @@ export default {
},
data () {
return {
// maker2: '20071057',
show: false,
model: {
coursecategory: 1,
cooperativeEducation: 0,
year: '1'
// assessmentway: 1298174700034494466,
// assessmentway: 'defaultValue', //
// nature: 1298167997234712578,
// name: '11',
// code: '',
// maker: 123, // 123
},
kcoptions: [{
id: 1,
label: '课程',
}, {
id: 2,
label: '共建课程',
}],
//
showButton: true,
selectContent: [],
@ -350,20 +441,23 @@ export default {
title: '操作',
width: 800,
visible: false,
model: {},
// model: {},
//
// dicodemp:'sys_user,realname,id',
//
dicodem: 'se_major,name,id',
//
dicodep: 'py_basic_info,version,id',
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
sm: { span: 6 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
labelCol2: { span: 4 },
wrapperCol2: { span: 20 },
confirmLoading: false,
// validatorRules: {},
@ -477,10 +571,7 @@ export default {
//
code: {
rules: [
{
required: true,
massage: '请输入正整数',
},
{ required: true, message: '请输入正整数!' },
{
// pattern: /^(([1]?\\d)|20)$/,
pattern: /^[^\\]{0,50}$/,
@ -491,24 +582,36 @@ export default {
validateDuplicateValue('se_course', 'code', value, this.model.id, callback),
},
],
trigger: 'blur',
// trigger: 'blur',
},
//
name: {
rules: [
{
required: true,
massage: '不能为空',
},
// name: {
// initiaValue: "",//
// rules: [
// {
// required: true,
// massage: '',
// },
// {
// // pattern: /^(([1]?\\d)|20)$/,
// pattern: /^[^\\]{0,100}$/,
// message: '100 ',
// },
// ],
// trigger: 'blur',
// },
name: {//namev-decorator
// initialValue: "",//
rules: [{ required: true, message: '不能为空!' },//
// { validator: (rule, value, callback) => validateDuplicateValue('em_project_info', 'project_name', value, this.model.id, callback) },//
// { pattern: /^1[3456789]\d{9}$/, message: '!' },//
{
// pattern: /^(([1]?\\d)|20)$/,
pattern: /^[^\\]{0,100}$/,
message: '字符串长度100 以内',
},]
},
],
trigger: 'blur',
},
},
}
}
},
created () {
@ -551,9 +654,16 @@ export default {
goBack () {
this.$router.push({ path: '/src/views/course/SeCourseList' })
},
//
handleReset () {
this.form.resetFields()
},
change (ids) {
console.log('id+' + ids)
console.log(this.model.teacher)
console.log('000', 'id+' + ids)
console.log('111', this.model.teacher)
console.log('222', this.model.verifier)
console.log('333', this.model.writer)
// this.model.maker = this.model.teacher
//
// this.dicodemp="sys_user,realname,id"+this.model.teacher
// this.username = ids
@ -564,6 +674,8 @@ export default {
//
this.dicodep =
"py_basic_info,version,id,college_id='" + this.model.depid + "' and major_id='" + this.model.majorid + "'"
},
getTrainProgram () {
//
@ -592,6 +704,8 @@ export default {
'img',
'depid',
'majorid',
'coursecategory',
'cooperative_education_type',
'category',
'nature',
'programid',
@ -631,6 +745,48 @@ export default {
this.$emit('close')
this.visible = false
},
handleAdd () {
const that = this
//
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true
let httpurl = ''
let method = ''
if (!this.model.id) {
httpurl += this.url.add
method = 'post'
this.form.setFieldsValue({
name: '',
code: ''
})
} else {
httpurl += this.url.edit
method = 'put'
}
// let formData = Object.assign(this.model, values)
//
let formData = Object.assign(this.model, values)
httpAction(httpurl, formData, method)
.then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
} else {
that.$message.warning(res.message)
}
})
.finally(() => {
that.confirmLoading = false
that.close()
})
}
})
},
handleOk () {
const that = this
//
@ -642,6 +798,19 @@ export default {
if (!this.model.id) {
httpurl += this.url.add
method = 'post'
console.log('12345', this.model.name)
// ok
this.$set(this.model, "name", "")
// this.model.name = '' //
this.model.code = '' //
console.log('11111', this.model.name)
// this.form = this.$form.createForm(this, {
// //
// name: '',
// code: '',
// // ...
// })
} else {
httpurl += this.url.edit
method = 'put'
@ -656,6 +825,7 @@ export default {
that.$message.success(res.message)
that.$emit('ok')
this.$router.push({ path: '/src/views/course/SeCourseList' })
} else {
that.$message.warning(res.message)
}
@ -666,6 +836,8 @@ export default {
})
}
})
},
handleCancel () {
this.close()
@ -681,6 +853,8 @@ export default {
'img',
'depid',
'majorid',
'coursecategory',
'cooperative_education_type',
'category',
'nature',
'programid',
@ -708,7 +882,9 @@ export default {
'contentdistribution',
'achievement',
'synopsis',
'year'
'year',
'isShow'
)
)
// })
@ -728,4 +904,12 @@ export default {
float: right;
margin: 10px;
}
.form {
margin-top: 40px;
}
// /deep/.ant-upload.ant-upload-select-picture-card {
// width: 300px;
// height: 150px;
// }
</style>

Loading…
Cancel
Save