古得运维
- PageAdmin入门
- 10
- 16
- 2021-06-18
|
4#
t
T
发表于 2021-06-18 17:20
|显示全部
回复 4楼xiyou的帖子谢谢版主,下面是我做的表单的js部分,你帮我看看哪里有问题
- <script type="text/javascript">
- var employmentFormData = { "Id": "", "ColumnId": "3333", "State": "", "IsGood": "", "IsHot": "", "IsTop": "", "PublishFrom": "", "IsOnline": "", "IsExpire": "", "HasThumbnail": "", "IsSubColumnData": "", "Uid": "", "Username": "", "Clicks": "", "Title": "", "Thumbnail": "", "Thedate": "", "IDCard": "", "Sex": "", "NativePlace": "", "Nation": "", "Telephone": "", "MaritalStatus": "", "Mailbox": "", "Politic": "", "Level": "", "Education": "", "ResidenceAddress": "", "MailAddress": "", "ExpectedSalary": "", "Turn": "", "Accept": "", "OtherPositions": "", "WorkExtrahours": "", "Relation": "", "ContactName": "", "LinkTel": "", "DriverLicense": "", "Reward": "", "Punish": "", "Post": "机械设计", "EduHistory":"",WorkHistory:""};
- employmentFormData.Guid = guid();
- employmentFormData.verificationCode = "";
- new Vue({
- el: "#employmentForm",
- data: {
- submitOk:false,//是否提交成功
- showWorkHistory:true,
- formData: employmentFormData,
- workHistory: [{ workTime: "", workCompany: "", workContent: "", workPay: "", workPosition: "", leavingReason: "" }],//工作经历
- eduHistory: [{ eduTime: "", eduSchool: "", eduMajor: "", eduDegree: "", eduPosts: "" }],//教育经历
- },
- created: function () {
- this.formData.Guid = guid();
- this.formData.verificationCode = "";
- },
- methods: {
- addHistory: function (type) {//添加工作或教育经历
- if (type ==0) {
- this.workHistory.push({ workTime: "", workCompany: "", workContent: "", workPay: "", workPosition: "", leavingReason: "" });
- } else
- {
- this.eduHistory.push({ eduTime: "", eduSchool: "", eduMajor: "", eduDegree: "", eduPosts: "" });
- }
- },
- removeHistory: function (type, idx) {//移除工作或教育经历
- if (type == 0) {
- this.workHistory.splice(idx, 1)
- }
- else {
- this.eduHistory.splice(idx, 1)
- }
- },
- hideWorkHistory: function () {//应届生隐藏工作经历
- this.showWorkHistory = !this.showWorkHistory;
- },
- postSubmit: function () {
- var _this = this;
- var validated = this.validateForm({ tipsStyle: 0, beforeSubmit: function () { return _this.beforeSubmitExecute() } });//表单验证
- if (validated) {
- _this.formData.WorkHistory = _this.workHistory;
- _this.formData.EduHistory =_this.eduHistory;
- _this.submit({ url: "/e/InfoData/Add?table=employment",data: _this.formData,showSuccessMsg: false, failCallback: _this.failSubmit, success: _this.submitSuccess });
- }
- },
- beforeSubmitExecute: function () {
- return true;
- },
- failSubmit: function () {
- var _this = this;
- if (_this.$refs.verificationCodeImg != undefined) {
- _this.$refs.verificationCodeImg.change();//改变验证码。
- }
- },
- submitSuccess: function (tipsInfo) {
- var _this = this;
- //回调内容,以下内容可根据需求自行修改。
- _this.formData.Guid = guid();//在有附属表的情况下,多次提交必须更新Guid属性值,否则附属表数据会混乱
- //重置验证码
- if (_this.$refs.verificationCodeImg != undefined) {
- _this.$refs.verificationCodeImg.change();//改变验证码。
- }
- _this.submitOk = true;
- }
- },
- });
- </script>
复制代码已经按你说的了,下面这两属性都改为数组 - _this.formData.WorkHistory = _this.workHistory;
- _this.formData.EduHistory =_this.eduHistory;
复制代码但是提交后附属表没有数据,这两个属性我前端调试已经有值,版主帮看看哪里出了问题?
|