diff --git a/src/utils/api.js b/src/utils/api.js index 8ddafa6..d1792bf 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -39,6 +39,7 @@ export default { getOrderOtherTime: `nakadai/nakadai/orderOther/getOrderOtherTime`, refreshCache: `data/data/myDate/refreshCache`, getPartnerTeamRates: `nakadai/nakadai/partner-team/getPartnerTeamRates`, + getCustomerOrderRecord: `nakadai/nakadai/order/getCustomerOrderRecord`, // 客户管理 delCustomers: `nakadai/nakadai/customer/delCustomers`, diff --git a/src/views/customer/AddCustomer.vue b/src/views/customer/AddCustomer.vue index a1b4085..7d62243 100644 --- a/src/views/customer/AddCustomer.vue +++ b/src/views/customer/AddCustomer.vue @@ -565,7 +565,6 @@ export default { pageSizeOrder: 10, totalOrder: 0, orders: [], - orderAll: [], bmsKeyword: '', bms: [], @@ -625,7 +624,7 @@ export default { this.pageOrder = 1 clearTimeout(this.searchTimer) this.searchTimer = setTimeout(() => { - this.handlePageOrder() + this.initOrder() }, 500) }, bmsKeyword: function (val) { @@ -937,35 +936,31 @@ export default { // 订单记录 getOrder () { const { orderStatus, orderType } = this.form3 - this.$post(this.api.orderList, { + this.$post(this.api.getCustomerOrderRecord, { + customerId: this.customerId, cityId: '', customerName: this.form.customerName, orderStatus, orderType, - pageNo: 1, - pageSize: 10000, + pageNo: this.pageOrder, + pageSize: this.pageSizeOrder, provinceId: '' - }).then(({ orderPage }) => { - orderPage.orders.forEach(e => { + }).then(({ orders }) => { + orders.records.forEach(e => { e.orderType = this.orderTypeFn(e.orderType) e.orderStatus = this.orderStatusFn(e.orderStatus) - e.orderNature = this.orderNatureFn(e.orderNature) }); - this.orderAll = orderPage.orders - this.totalOrder = orderPage.total - this.handlePageOrder() + this.orders = orders.records + this.totalOrder = orders.total }).catch(res => { }) }, - // 分页 - handlePageOrder () { - const { keyword } = this.form3 - const list = keyword ? this.orderAll.filter(e => e.orderNumber.includes(keyword) || e.orderContent.includes(keyword)) : this.orderAll - this.totalOrder = list.length - this.orders = list.slice((this.pageOrder - 1) * this.pageSizeOrder, this.pageOrder * this.pageSizeOrder) + initOrder () { + this.pageOrder = 1 + this.getOrder() }, handleCurrentChangeOrder (val) { this.pageOrder = val - this.handlePageOrder() + this.getOrder() this.$router.push(`addcustomer?id=${this.customerId}&type=tab3&page=${val}`) }, // 订单详情 @@ -1014,7 +1009,7 @@ export default { this.pageProduct = 1 this.pageOrder = 1 this.pageBm = 1 - index === 'tab3' && this.handlePageOrder() + index === 'tab3' && this.initOrder() this.updateTime = this.form.customerId ? 1 : 0 } }, diff --git a/src/views/match/add/step3.vue b/src/views/match/add/step3.vue index 8b9b6bc..c6dcc37 100644 --- a/src/views/match/add/step3.vue +++ b/src/views/match/add/step3.vue @@ -167,6 +167,7 @@ export default { startTime: '', systemId: '', paperId: '', + paperName: '', offlineAddress: '', offlineButton: 0, onlineAddress: '', diff --git a/src/views/match/add/template.vue b/src/views/match/add/template.vue index 8cdafd9..f6d40d6 100644 --- a/src/views/match/add/template.vue +++ b/src/views/match/add/template.vue @@ -5,6 +5,31 @@ @closed="closeDia">
- 自定义理论试卷 +
- + @@ -41,15 +66,21 @@ - + + + + - 取消 + 取消 确定 @@ -59,38 +90,32 @@ import Setting from '@/setting' import Util from '@/libs/util' import _ from 'lodash' +import QuesConst from '@/const/ques' +import TestPaperConst from '@/const/testPaper' export default { - props: ['visible'], + props: ['visible', 'form'], data () { return { arabicToChinese: Util.arabicToChinese, + questionTypes: QuesConst.questionTypes, + difficults: TestPaperConst.difficults, + paperTypes: TestPaperConst.paperTypes, listVisible: false, searchTimer: null, - questionTypes: [ - { - name: '单选题' - }, - { - name: '多选题' - }, - { - name: '判断题' - }, - { - name: '填空题' - }, - { - name: '问答题' - }, - ], + questionType: [], + paperLibraries: [], filter: { + libraryId: '', + paperType: '', + difficult: [], keyWord: '', }, list: [], page: 1, pageSize: 10, total: 0, + paperId: '', submiting: false, }; @@ -113,13 +138,14 @@ export default { async getList () { try { const res = await this.$post(this.api.examPaperList, { + ...this.filter, pageNum: this.page, pageSize: this.pageSize, type: 1, keyWord: this.keyword, libraryId: this.systemId }) - this.projects = res.pageList.records + this.papers = res.pageList.records this.total = res.pageList.total } catch (e) { } }, @@ -128,103 +154,51 @@ export default { this.page = val this.getList() }, + handleCurrentChange (val) { + this.page = val + this.getList() + }, initData () { this.page = 1 this.getList() }, + // 排序回调 + sortChange (column) { + if (column.prop === 'updateTime') this.filter.updateTimeOrder = column.order ? column.order === 'ascending' ? 1 : 2 : '' + this.getList() + }, // 新增 add () { this.form = _.cloneDeep(this.originForm) this.detailVisible = true }, - // 试卷大纲添加行 - addLine (i) { - this.form.paperOutline.splice(i + 1, 0, { - examQuestions: [], - outlineName: '', - questionNum: '', - questionType: '', - targetScore: '', - }) - }, - // 试卷大纲移除行 - delLine (i) { - this.form.paperOutline.length > 1 && this.form.paperOutline.splice(i, 1) - }, - // 使用模板 - async useTemplate (row) { - const data = await this.getDetail(row.templateId) - this.$parent.form.paperOutline = data.paperOutline - this.listVisible = false - }, - // 获取详情 - async getDetail (id) { - const res = await this.$get(this.api.templateDetails, { - id - }) - return res.template - }, - // 编辑 - async edit (row) { - this.detailVisible = true - const data = await this.getDetail(row.templateId) - this.form = data - }, - // 删除 - async del (row) { - try { - await this.$confirm(`确认要删除【${row.templateName}】吗?`, '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - closeOnClickModal: false, - }) - await this.$post(this.api.deleteTemplate, { - ids: [row.templateId] - }) - Util.successMsg('删除成功') - this.getList() - } catch (e) { } + // 预览试卷 + previewPaper (row) { + this.$parent.previewPaper(row) }, // 提交 async submit () { - if (this.submiting) return false + const { paperId } = this.form + if (!paperId) return Util.warningMsg('请选择试卷') + + const curPaper = this.papers.find(e => e.paperId === paperId) + if (curPaper) this.form.paperName = curPaper.name + this.handlePaper() + }, + // 复制试卷 + async handlePaper () { const { form } = this - if (!form.templateName) return Util.warningMsg('请输入模板名称') - let invalid = 0 - for (const e of form.paperOutline) { - if (!e.questionType) { - Util.warningMsg('请选择题型') - invalid = 1 - break - } - if (!e.questionNum) { - Util.warningMsg('请输入目标题数') - invalid = 1 - break - } - if (!e.targetScore) { - Util.warningMsg('请输入目标分值') - invalid = 1 - break + // 老的试卷名称不等于新的试卷名称,则复制一份试卷,再把新的试卷id替换掉 + if (form.paperName !== form.originPaperName) { + const res = await this.$post(this.api.copyExamPaper, { + associatedID: form.stageId, + paperId: form.paperId, + typeId: 1 + }) + if (res.examPaper) { + form.paperId = res.examPaper.paperId } } - if (invalid) return false - this.submiting = true - form.createSource = 1 - form.questionNum = this.questionNum - form.totalScore = this.totalScore - form.outlineNum = form.paperOutline.length - form.questionType = [...new Set(form.paperOutline.map(e => e.questionType))].join('、') - try { - await this.$post(this.api.saveExamPaperTemplate, form) - Util.successMsg('保存成功') - this.detailVisible = false - this.submiting = false - this.getList() - } catch (e) { - this.submiting = false - } }, // 弹框关闭回调 closeDia () { diff --git a/src/views/match/manage/theoryReport.vue b/src/views/match/manage/theoryReport.vue index a29c29b..5c6f52a 100644 --- a/src/views/match/manage/theoryReport.vue +++ b/src/views/match/manage/theoryReport.vue @@ -18,7 +18,7 @@