Compare commits

..

No commits in common. '8d78a823fbab1cbbb4fc1a7badeb343cc3538d57' and '6a7a55310c636add7efdf68cb56a1e9d0831f1a1' have entirely different histories.

  1. 465
      ant-design-vue-jeecg/src/views/py/modules/PyBasicInfoModal.vue

@ -154,258 +154,249 @@
</template> </template>
<script> <script>
import {httpAction, getAction} from '@/api/manage' import {httpAction, getAction} from '@/api/manage'
import pick from 'lodash.pick' import pick from 'lodash.pick'
import {validateDuplicateValue} from '@/utils/util' import {validateDuplicateValue} from '@/utils/util'
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart' import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
import JDictSelectTag from '@/components/dict/JDictSelectTag' import JDictSelectTag from '@/components/dict/JDictSelectTag'
import JMarkdownEditor from '@/components/jeecg/JMarkdownEditor/index' import JMarkdownEditor from '@/components/jeecg/JMarkdownEditor/index'
import JEditor from '@/components/jeecg/JEditor' import JEditor from '@/components/jeecg/JEditor'
export default { export default {
name: 'PyBasicInfoModal', name: 'PyBasicInfoModal',
components: { components: {
JSelectDepart, JSelectDepart,
JDictSelectTag, JDictSelectTag,
JMarkdownEditor, JMarkdownEditor,
JEditor JEditor
}, },
data() { data() {
return { return {
// colledge: {}, // colledge: {},
// id: "", // id: "",
// dicode1: "", // dicode1: "",
form: this.$form.createForm(this), form: this.$form.createForm(this),
title: '操作', title: '操作',
width: 1200, width: 1200,
visible: false, visible: false,
model: {}, model: {},
labelCol: { labelCol: {
xs: {span: 24}, xs: {span: 24},
sm: {span: 5} sm: {span: 5}
}, },
wrapperCol: { wrapperCol: {
xs: {span: 24}, xs: {span: 24},
sm: {span: 16} sm: {span: 16}
}, },
confirmLoading: false, confirmLoading: false,
validatorRules: { validatorRules: {
majorCode: { majorCode: {
rules: [{required: true, message: '请输入专业代号!'}], rules: [{required: true, message: '请输入专业代号!'}],
trigger: 'blur' trigger: 'blur'
}, },
collegeId: { collegeId: {
rules: [{required: true, message: '请输入学院!'}], rules: [{required: true, message: '请输入学院!'}],
trigger: 'blur' trigger: 'blur'
}, },
majorId: { majorId: {
rules: [{required: true, message: '请输入专业!'}], rules: [{required: true, message: '请输入专业!'}],
trigger: 'blur' trigger: 'blur'
}, },
version: { version: {
rules: [{required: true, message: '请输入版本!'}, rules: [{required: true, message: '请输入版本!'},
/*{ {
pattern: /(^[0-9]{1,2}$)|(^[0-9]{1,6}[\.]{1}[0-9]{1,1}$)/, pattern: /(^[0-9]{1,2}$)|(^[0-9]{1,6}[\.]{1}[0-9]{1,1}$)/,
message: '版本整数部分输入长度最长为2位,小数点后最多一位!' message: '版本整数部分输入长度最长为2位,小数点后最多一位!'
}*/ }],
{ trigger: 'blur'
pattern: /(^[\u4e00-\u9fa5_a-zA-Z0-9_]{1,15}$)/, },
message: '版本不能为空且长度不能超过15!' mainSubject: {
} rules: [{required: true, message: '请输入主干学科名字!'},
], {pattern: /(^[\u4e00-\u9fa5_a-zA-Z0-9_]{1,15}$)/, message: '输入主干学科名字不能为空且长度不能超过15!'}],
trigger: 'blur' trigger: 'blur'
}, },
mainSubject: { majorDirection: {
rules: [{required: true, message: '请输入主干学科名字!'}, rules: [{required: true, message: '请输入专业方向名字!'},
{ {pattern: /(^[\u4e00-\u9fa5_a-zA-Z0-9_]{1,10}$)/, message: '输入专业方向名字不能为空且长度不能超过10!'}],
pattern: /(^[\u4e00-\u9fa5_a-zA-Z0-9_]{1,15}$)/, trigger: 'blur'
message: '输入主干学科名字不能为空且长度不能超过15!' },
} coreCourse: {
], rules: [{required: true, message: '请输入核心课程!'},
trigger: 'blur' {pattern: /^[^\\]{0,500}$/, message: '输入核心课程不能为空且长度不能超过500!'}],
}, trigger: 'blur'
majorDirection: { },
rules: [{required: true, message: '请输入专业方向名字!'}, practiceTeach: {
{pattern: /(^[\u4e00-\u9fa5_a-zA-Z0-9_]{1,10}$)/, message: '输入专业方向名字不能为空且长度不能超过10!'}], rules: [{required: true, message: '请输入实践性教学环节!'},
trigger: 'blur' {pattern: /^[^\\]{0,500}$/, message: '输入实践性教学环节不能为空且长度不能超过500!'}],
}, trigger: 'blur'
coreCourse: { },
rules: [{required: true, message: '请输入核心课程!'}, eduTime: {
{pattern: /^[^\\]{0,500}$/, message: '输入核心课程不能为空且长度不能超过500!'}], rules: [{required: true, message: '请输入学制!'}],
trigger: 'blur'
},
practiceTeach: {
rules: [{required: true, message: '请输入实践性教学环节!'},
{pattern: /^[^\\]{0,500}$/, message: '输入实践性教学环节不能为空且长度不能超过500!'}],
trigger: 'blur'
},
eduTime: {
rules: [{required: true, message: '请输入学制!'}],
},
degree: {
rules: [{required: true, message: '请输入学位!'}],
trigger: 'blur'
},
credit: {
rules: [
{required: true, message: '请输入学分!'},
{validator: (rule, value, callback) => validateDuplicateValue('py_basic_info', 'credit', value, this.model.id, callback)},
{pattern: /^[1-9]\d*$/, message: '学分只能输入正整数!'}
],
trigger: 'blur'
},
studyYear: {
rules: [{required: true, message: '请输入修学年限!'}],
trigger: 'blur'
}
/*,
fulltt: {
rules: [{ required: true, message: '请输入第九点富文本!' }]
}*/
}, },
url: { degree: {
add: '/py/basicinfo', rules: [{required: true, message: '请输入学位!'}],
edit: '/py/basicinfo/ubyid/' trigger: 'blur'
}, },
// credit: {
eduTimeOption: [ rules: [
{ {required: true, message: '请输入学分!'},
id: 0, {validator: (rule, value, callback) => validateDuplicateValue('py_basic_info', 'credit', value, this.model.id, callback)},
eduTime: '3年' {pattern: /^[1-9]\d*$/, message: '学分只能输入正整数!'}
}, ],
{ trigger: 'blur'
id: 1, },
eduTime: '4年' studyYear: {
} rules: [{required: true, message: '请输入修学年限!'}],
], trigger: 'blur'
// }
studyYearOption: [ /*,
{ fulltt: {
id: 0, rules: [{ required: true, message: '请输入第九点富文本!' }]
studyYear: '3~6年' }*/
}, },
{ url: {
id: 1, add: '/py/basicinfo',
studyYear: '4~8年' edit: '/py/basicinfo/ubyid/'
} },
], //
myRecord: {} eduTimeOption: [
} {
id: 0,
eduTime: '3年'
},
{
id: 1,
eduTime: '4年'
}
],
//
studyYearOption: [
{
id: 0,
studyYear: '3~6年'
},
{
id: 1,
studyYear: '4~8年'
}
],
myRecord: {}
}
},
created() {
},
methods: {
add() {
this.edit({})
}, },
created() { edit(record) {
console.log("basic info edit data obj ==", record);
this.myRecord = record
this.form.resetFields()
this.model = Object.assign({}, record)
this.visible = true
this.$nextTick(() => {
getAction('/py/basicinfo/findById/' + record.basicId)
.then(res => {
if (res.code == 200)
console.log("findById 查询成功==", res)
})
.finally(() => {
this.form.setFieldsValue(
pick(
this.model,
'majorCode',
'chartHead',
'collegeId',
'majorId',
'version',
'mainSubject',
'majorDirection',
'coreCourse',
'practiceTeach',
'eduTime',
'degree',
'credit',
'studyYear',
'fulltt'
)
)
// console.log(this.model);
})
})
}, },
methods: { close() {
add() { this.$emit('close');
this.edit({}) this.visible = false;
}, },
edit(record) { handleOk() {
console.log("basic info edit data obj ==", record); const that = this
this.myRecord = record //
this.form.resetFields() this.form.validateFields((err, values) => {
this.model = Object.assign({}, record) if (!err) {
this.visible = true that.confirmLoading = true
this.$nextTick(() => { let httpurl = ''
getAction('/py/basicinfo/findById/' + record.basicId) let method = ''
if (!this.model.basicId) {
httpurl += this.url.add
method = 'post'
} else {
// httpurl+=this.url.edit;
httpurl = httpurl + this.url.edit
method = 'put'
}
let formData = Object.assign(this.model, values)
console.log("编辑-提交数据", JSON.stringify(formData))
httpAction(httpurl, formData, method)
.then(res => { .then(res => {
if (res.code == 200) this.edit(this.myRecord)
console.log("findById 查询成功==", res) console.log("编辑修改结果-res:" + JSON.stringify(res))
if (res.code == 0) {
// console.log("11111")
that.$message.success(res.msg)
this.close()
that.$emit('ok')
// console.log("2222")
} else {
that.$message.warning("修改失败")
}
}) })
.finally(() => { .finally(() => {
this.form.setFieldsValue( that.confirmLoading = false
pick( that.close()
this.model,
'majorCode',
'chartHead',
'collegeId',
'majorId',
'version',
'mainSubject',
'majorDirection',
'coreCourse',
'practiceTeach',
'eduTime',
'degree',
'credit',
'studyYear',
'fulltt'
)
)
// console.log(this.model);
}) })
}) }
}, })
close() { },
this.$emit('close'); handleCancel() {
this.visible = false; this.close()
}, },
handleOk() { popupCallback(row) {
const that = this this.form.setFieldsValue(
// pick(
this.form.validateFields((err, values) => { row,
if (!err) { 'majorCode',
that.confirmLoading = true 'chartHead',
let httpurl = '' 'collegeId',
let method = '' 'majorId',
if (!this.model.basicId) { 'version',
httpurl += this.url.add 'mainSubject',
method = 'post' 'majorDirection',
} else { 'coreCourse',
// httpurl+=this.url.edit; 'practiceTeach',
httpurl = httpurl + this.url.edit 'eduTime',
method = 'put' 'degree',
} 'credit',
let formData = Object.assign(this.model, values) 'studyYear',
console.log("编辑-提交数据", JSON.stringify(formData)) 'fulltt'
httpAction(httpurl, formData, method)
.then(res => {
this.edit(this.myRecord)
console.log("编辑修改结果-res:" + JSON.stringify(res))
if (res.code == 0) {
// console.log("11111")
that.$message.success(res.msg)
this.close()
that.$emit('ok')
// console.log("2222")
} else {
that.$message.warning("修改失败")
}
})
.finally(() => {
that.confirmLoading = false
that.close()
})
}
})
},
handleCancel() {
this.close()
},
popupCallback(row) {
this.form.setFieldsValue(
pick(
row,
'majorCode',
'chartHead',
'collegeId',
'majorId',
'version',
'mainSubject',
'majorDirection',
'coreCourse',
'practiceTeach',
'eduTime',
'degree',
'credit',
'studyYear',
'fulltt'
)
) )
} )
} }
} }
}
</script> </script>
<!--<style lang="stylus">--> <!--<style lang="stylus">-->

Loading…
Cancel
Save