diff --git a/ant-design-vue-jeecg/src/views/course/AddCourse.vue b/ant-design-vue-jeecg/src/views/course/AddCourse.vue index 93d1eeb..c83ba22 100644 --- a/ant-design-vue-jeecg/src/views/course/AddCourse.vue +++ b/ant-design-vue-jeecg/src/views/course/AddCourse.vue @@ -13,14 +13,11 @@ @cancel="handleCancel" cancelText="关闭" > - - + + + + - - - - - @@ -36,25 +33,37 @@ + - + + + + - + + @@ -79,15 +89,7 @@ - - - - - - - - - + @@ -108,6 +110,16 @@ > + + + + + + + + + + @@ -166,22 +178,28 @@ + + + + @@ -198,22 +216,23 @@ - + - + + + - + @@ -224,19 +243,67 @@ - + + + + + + + + + + + + + + + + + - + - - + + + @@ -253,34 +320,35 @@ - + + + + +
- 关闭 + 关闭 + 确定 - 暂存 + + 增加下一门课
@@ -334,10 +404,31 @@ export default { JSearchSelectTag, JEditor, }, - data() { + 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, + showButton: true, selectContent: [], showPageInfo: '', dicodep: 'sss', @@ -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,27 +582,39 @@ export default { validateDuplicateValue('se_course', 'code', value, this.model.id, callback), }, ], - trigger: 'blur', + // trigger: 'blur', }, //课程名称 - name: { - rules: [ - { - required: true, - massage: '不能为空', - }, - { - // pattern: /^(([1]?\\d)|20)$/, - pattern: /^[^\\]{0,100}$/, - message: '字符串长度100 以内', - }, - ], - trigger: 'blur', + // name: { + // initiaValue: "水",//初始化值,也就是默认值 + // rules: [ + // { + // required: true, + // massage: '不能为空', + // }, + // { + // // pattern: /^(([1]?\\d)|20)$/, + // pattern: /^[^\\]{0,100}$/, + // message: '字符串长度100 以内', + // }, + // ], + // trigger: 'blur', + // }, + name: {//name与v-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 以内', + },] }, - }, + } } }, - created() { + created () { let that = this that.$bus.$on('headleUser', ({ restle, userSelect }) => { if (restle && userSelect) that.$set(that.selectContent, userSelect, restle) @@ -527,7 +630,7 @@ export default { }, methods: { //修改 新增点击关闭时的弹出框 - open() { + open () { this.$confirm('此操作将关闭页面, 是否继续?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', @@ -548,41 +651,50 @@ export default { }) }, //修改 - goBack() { + goBack () { this.$router.push({ path: '/src/views/course/SeCourseList' }) }, - change(ids) { - console.log('id+' + ids) - console.log(this.model.teacher) + // 全部清空 + handleReset () { + this.form.resetFields() + }, + change (ids) { + 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 // console.log(ids) }, - getMajor() { + getMajor () { this.dicodem = "se_major,name,id,dep='" + this.model.depid + "'" //修改 this.dicodep = "py_basic_info,version,id,college_id='" + this.model.depid + "' and major_id='" + this.model.majorid + "'" + + }, - getTrainProgram() { + getTrainProgram () { //修改 // this.dicodep = 'py_basic_info,version,id' //修改 this.dicodep = "py_basic_info,version,id,college_id='" + this.model.depid + "' and major_id='" + this.model.majorid + "'" }, - add() { + add () { this.edit({}) }, - edit(record) { + edit (record) { this.form.resetFields() this.model = Object.assign({}, record) // this.model=Object.assign(pagedOld,record) // Object.keys(model).map(res=>{ // console.log(res+'998---------------',this.model[res]) // }) - this.showButton=this.model.showButton + this.showButton = this.model.showButton console.log(this.model, '表单编辑数据') this.visible = true this.$nextTick(() => { @@ -592,6 +704,8 @@ export default { 'img', 'depid', 'majorid', + 'coursecategory', + 'cooperative_education_type', 'category', 'nature', 'programid', @@ -627,11 +741,53 @@ export default { ) }) }, - close() { + close () { this.$emit('close') this.visible = false }, - handleOk() { + 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 // 触发表单验证 this.form.validateFields((err, values) => { @@ -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,11 +836,13 @@ export default { }) } }) + + }, - handleCancel() { + handleCancel () { this.close() }, - popupCallback(row) { + popupCallback (row) { //修改增加了this.$ 增加了this. // this.row = Object.assign(this.row, values) // this.row = Object.assign({}, row) @@ -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; +// }