|
|
|
@ -33,6 +33,7 @@ Page({ |
|
|
|
data: { |
|
|
|
data: { |
|
|
|
questions: [] as IQuestion[], |
|
|
|
questions: [] as IQuestion[], |
|
|
|
hasData: false, |
|
|
|
hasData: false, |
|
|
|
|
|
|
|
showPage: false, |
|
|
|
caseReportList: [ |
|
|
|
caseReportList: [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
icon: 'icon126.png', |
|
|
|
icon: 'icon126.png', |
|
|
|
@ -63,15 +64,12 @@ Page({ |
|
|
|
], |
|
|
|
], |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
onLoad() { |
|
|
|
onLoad() {}, |
|
|
|
app.waitLogin({}).then(() => { |
|
|
|
|
|
|
|
this.loadData() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
onShow() { |
|
|
|
onShow() { |
|
|
|
if (this.data.questions.length) { |
|
|
|
this.setData({ questions: [], hasData: false, showPage: false }) |
|
|
|
|
|
|
|
app.waitLogin().then(() => { |
|
|
|
this.loadData() |
|
|
|
this.loadData() |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
loadData() { |
|
|
|
loadData() { |
|
|
|
@ -134,8 +132,11 @@ Page({ |
|
|
|
questions.forEach((q, i) => { |
|
|
|
questions.forEach((q, i) => { |
|
|
|
const found = answers.find((a: any) => a.QuestionNo === q.QuestionNo) |
|
|
|
const found = answers.find((a: any) => a.QuestionNo === q.QuestionNo) |
|
|
|
if (!found) return |
|
|
|
if (!found) return |
|
|
|
const answer = found.Answer |
|
|
|
let answer = found.Answer |
|
|
|
if (answer === null || answer === undefined) return |
|
|
|
if (answer === null || answer === undefined) return |
|
|
|
|
|
|
|
if (Array.isArray(answer)) { |
|
|
|
|
|
|
|
answer = answer.filter((item) => item != 99) |
|
|
|
|
|
|
|
} |
|
|
|
if (q.QuestionType === 1) { |
|
|
|
if (q.QuestionType === 1) { |
|
|
|
updates[`questions[${i}].Answer`] = Number(answer) |
|
|
|
updates[`questions[${i}].Answer`] = Number(answer) |
|
|
|
updates[`questions[${i}].answerText`] = this.getAnswerText(q, Number(answer)) |
|
|
|
updates[`questions[${i}].answerText`] = this.getAnswerText(q, Number(answer)) |
|
|
|
@ -206,6 +207,7 @@ Page({ |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
if (Object.keys(updates).length) { |
|
|
|
if (Object.keys(updates).length) { |
|
|
|
|
|
|
|
updates.showPage = true |
|
|
|
this.setData(updates) |
|
|
|
this.setData(updates) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
@ -226,4 +228,10 @@ Page({ |
|
|
|
url: '/pages/qaForm/index', |
|
|
|
url: '/pages/qaForm/index', |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
handleDetail(e) { |
|
|
|
|
|
|
|
const { name, imagefield } = e.currentTarget.dataset |
|
|
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
|
|
url: `/pages/caseReport/index?name=${name}&imageField=${imagefield}`, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
}) |
|
|
|
}) |
|
|
|
|