diff --git a/src/api/server.js b/src/api/server.js index 7151d34..5b161e2 100644 --- a/src/api/server.js +++ b/src/api/server.js @@ -51,7 +51,7 @@ export const Train = new (class { //添加 insertCase(params) { return axios - .post(this.insertCaseApi, qs.stringify(params)) + .post(this.insertCaseApi, qs.stringify(params,{allowDots: true })) .then(res => res.data); } //修改 diff --git a/src/views/train/case-detail.vue b/src/views/train/case-detail.vue index cf26c53..0c62c9c 100644 --- a/src/views/train/case-detail.vue +++ b/src/views/train/case-detail.vue @@ -48,16 +48,15 @@ - + @@ -104,17 +103,17 @@ var validateScore = (rule, value, callback) => { if (!value) { callback(new Error('请输入分数')); - } else if (!(/^(([1-9][0-9]*)|(([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2})))$/.test(value)) || value > 100) { - callback(new Error('请输入0-100之间最多两位小数的数字')); + } else if (!(/^[1-9][0-9]{0,2}$/.test(value)) || value > 100) { + callback(new Error('请输入1-100之间的正整数')); } else { callback(); } }; - var validateContent = (rule, value, callback) => { - if (!value.trim()) { - callback(new Error('请填写案例描述')); - } else if (value.length > 3000) { - callback(new Error('长度在 1 到 3000 个字符')); + var validateTaskRate = (rule, value, callback) => { + if (!value) { + callback(new Error('请输入任务目标')); + } else if (!(/^(([1-9][0-9]*)|(([0]\.\d|[1-9][0-9]*\.\d)))$/.test(value)) || value > 100) { + callback(new Error('请输入100以内最多一位小数的正数')); } else { callback(); } @@ -137,10 +136,13 @@ type: [ { required: true, message: '请选择实训用途', trigger: 'change' } ], - // content: [ - // {validator: validateContent, trigger: 'blur'} - // ], - score: [ + taskOperate: [ + { required: true, message: '请选择设置项', trigger: 'change' } + ], + taskRate: [ + {validator: validateTaskRate, trigger: 'blur'} + ], + taskScore: [ {validator: validateScore, trigger: 'blur'} ], }, @@ -216,8 +218,8 @@ }, methods: { goBackList() { - // this.$router.push({name: 'CaseList'}); - this.$router.go(-1); + this.$router.push({name: 'CaseList'}); + // this.$router.go(-1); }, initTargetList(searchObj) { Train.getTargetList(searchObj).then(res => { @@ -247,8 +249,7 @@ item=Object.assign({}, item, { taskOperate: null, taskRate: null, - score: null, - taskSeq: null + taskScore: null }) //右侧添加选中的数据 this.rightTargetList.push(item); @@ -303,7 +304,7 @@ return; } if (index === 3) { // 分数栏 - values = data.map(item => Number(item['score'])); + values = data.map(item => Number(item['taskScore'])); sums[index] = values.reduce((prev, curr) => { const value = Number(curr); if (!isNaN(value)) { diff --git a/src/views/train/case-list.vue b/src/views/train/case-list.vue index f6b4b9f..04b0048 100644 --- a/src/views/train/case-list.vue +++ b/src/views/train/case-list.vue @@ -93,7 +93,7 @@ Train.getCaseList(searchObj).then(res => { if (res.code == 200) { this.listData = res.data.rows; - this.totalCount = res.totalCount; + this.totalCount = res.data.total; } }).catch(error => { console.info(error)