培训通知、记录 添加编号显示

试题查看 添加考试答案显示
添加 位掩码 公共方法  获取多选结果
答题 多选 计算结果 加break 减少循环
This commit is contained in:
wyw 2026-03-05 14:09:20 +08:00
parent 2c582c53df
commit f7a425e367
3 changed files with 55 additions and 17 deletions

View File

@ -9,6 +9,10 @@
<u--input v-model="model.NAME" border="none" slot="right" inputAlign="right" disabled <u--input v-model="model.NAME" border="none" slot="right" inputAlign="right" disabled
disabledColor="#ffffff" fontSize="14px"></u--input> disabledColor="#ffffff" fontSize="14px"></u--input>
</u-form-item> </u-form-item>
<u-form-item label="编号:" prop="CODE" borderBottom>
<u--input v-model="model.CODE" border="none" slot="right" inputAlign="right" disabled
disabledColor="#ffffff" fontSize="14px"></u--input>
</u-form-item>
<u-form-item label="发起时间:" prop="LAUNCH_TIME" borderBottom> <u-form-item label="发起时间:" prop="LAUNCH_TIME" borderBottom>
<u--input v-model="model.LAUNCH_TIME" border="none" slot="right" inputAlign="right" disabled <u--input v-model="model.LAUNCH_TIME" border="none" slot="right" inputAlign="right" disabled
disabledColor="#ffffff" fontSize="14px"></u--input> disabledColor="#ffffff" fontSize="14px"></u--input>

View File

@ -9,6 +9,10 @@
<u--input v-if="model.Nav_Notify" v-model="model.Nav_Notify.NAME" border="none" slot="right" <u--input v-if="model.Nav_Notify" v-model="model.Nav_Notify.NAME" border="none" slot="right"
inputAlign="right" disabled disabledColor="#ffffff" fontSize="14px"></u--input> inputAlign="right" disabled disabledColor="#ffffff" fontSize="14px"></u--input>
</u-form-item> </u-form-item>
<u-form-item label="培训编号:" prop="CODE" borderBottom>
<u--input v-if="model.Nav_Notify" v-model="model.Nav_Notify.CODE" border="none" slot="right"
inputAlign="right" disabled disabledColor="#ffffff" fontSize="14px"></u--input>
</u-form-item>
<u-form-item label="培训类型:" prop="Nav_LaunchUser.NAME" borderBottom> <u-form-item label="培训类型:" prop="Nav_LaunchUser.NAME" borderBottom>
<u--input v-if="model.Nav_Notify" v-model="model.Nav_Notify.Nav_TrainType.NAME" border="none" <u--input v-if="model.Nav_Notify" v-model="model.Nav_Notify.Nav_TrainType.NAME" border="none"
slot="right" inputAlign="right" disabled disabledColor="#ffffff" fontSize="14px"></u--input> slot="right" inputAlign="right" disabled disabledColor="#ffffff" fontSize="14px"></u--input>

View File

@ -44,7 +44,7 @@
<u--input v-model="score" disabled disabledColor="#fff" border="none" <u--input v-model="score" disabled disabledColor="#fff" border="none"
inputAlign="right"></u--input> inputAlign="right"></u--input>
</u-form-item> </u-form-item>
<!-- <view class="video"> <view class="video" v-if="this.TaskID && this.TaskID.length > 0">
<uni-card margin="0" :is-shadow="true"> <uni-card margin="0" :is-shadow="true">
<u--form labelPosition="left" labelWidth="auto" labelAlign="center" ref="wForm" <u--form labelPosition="left" labelWidth="auto" labelAlign="center" ref="wForm"
errorType="border-bottom"> errorType="border-bottom">
@ -58,7 +58,7 @@
src='https://sps.cxtc.com:3199/BT/VIDEO/20251226/12345.mp4' controls></video> src='https://sps.cxtc.com:3199/BT/VIDEO/20251226/12345.mp4' controls></video>
</u--form> </u--form>
</uni-card> </uni-card>
</view> --> </view>
</u--form> </u--form>
</uni-card> </uni-card>
</view> </view>
@ -73,25 +73,41 @@
<view class="uni-flex uni-column"> <view class="uni-flex uni-column">
<view>{{(index+1)+'. '+ item.Nav_Test.NAME+getType(item.Nav_Test.TYPE)}}</view> <view>{{(index+1)+'. '+ item.Nav_Test.NAME+getType(item.Nav_Test.TYPE)}}</view>
<view> <view>
<u-radio-group v-if="item.Nav_Test.TYPE==0" v-model="item.ANSWER1" <!-- <u-radio-group v-if="item.Nav_Test.TYPE==0" v-model="item.ANSWER1"
placement="column"> placement="column">
<u-radio :customStyle="{marginBottom: '4px',marginTop: '4px'}" <u-radio :customStyle="{marginBottom: '4px',marginTop: '4px'}"
v-for="(item1, index1) in radiolist1" :key="index1" :label="item1.name" v-for="(item1, index1) in radiolist1" :key="index1" :label="item1.name"
:name="item1.name" @change="doTrueOrFalse(index1,item)" :name="item1.name" @change="doTrueOrFalse(index1,item)"
:disabled="readonly" /> :disabled="readonly" />
</u-radio-group> </u-radio-group> -->
<u-radio-group v-if="item.Nav_Test.TYPE==1" v-model="item.ANSWER2" <!-- <u-radio-group v-if="item.Nav_Test.TYPE==1" v-model="item.ANSWER2"
placement="column"> placement="column">
<u-radio :customStyle="{marginBottom: '4px',marginTop: '4px'}" <u-radio :customStyle="{marginBottom: '4px',marginTop: '4px'}"
v-for="(item2, index2) in radiolist2[item.ID]" :key="index2" v-for="(item2, index2) in radiolist2[item.ID]" :key="index2"
:label="item2.name" :name="item2.name" :label="item2.name" :name="item2.name"
@change="doOptionChange(index2,item)" :disabled="readonly" /> @change="doOptionChange(index2,item)" :disabled="readonly" />
</u-radio-group> -->
<u-radio-group v-if="item.Nav_Test.TYPE==0" v-model="item.ANSWER"
placement="column">
<u-radio :customStyle="{marginBottom: '4px',marginTop: '4px'}"
v-for="(item1, index1) in radiolist1" :key="item1.value"
:label="item1.name" :name="item1.value" :disabled="readonly"
@change="doTrueOrFalse(index1,item)">
</u-radio>
</u-radio-group>
<u-radio-group v-if="item.Nav_Test.TYPE==1" v-model="item.ANSWER"
placement="column">
<u-radio :customStyle="{marginBottom: '4px',marginTop: '4px'}"
v-for="(item2, index2) in radiolist2[item.ID]" :key="item2.name"
:label="item2.name" :name="item2.value"
@change="doOptionChange(index2,item)" :disabled="readonly" />
</u-radio-group> </u-radio-group>
<u-checkbox-group v-if="item.Nav_Test.TYPE==2" v-model="item.ANSWER3" <u-checkbox-group v-if="item.Nav_Test.TYPE==2" v-model="item.ANSWER3"
@change="checkboxChange($event,item)" placement="column"> @change="checkboxChange($event,item,item.ID)" placement="column">
<u-checkbox :customStyle="{marginBottom: '4px',marginTop: '4px'}" <u-checkbox :customStyle="{marginBottom: '4px',marginTop: '4px'}"
v-for="(item3, index3) in radiolist2[item.ID]" :key="index3" v-for="(item3, index3) in radiolist2[item.ID]" :key="item3.name"
:label="item3.name" :name="item3.name" :disabled="readonly"> :label="item3.name" :name="item3.value" :disabled="readonly">
</u-checkbox> </u-checkbox>
</u-checkbox-group> </u-checkbox-group>
</view> </view>
@ -121,7 +137,8 @@
extendRule, extendRule,
guid, guid,
initFilter, initFilter,
initFilterGroup initFilterGroup,
getSelectedOptions
} from '../../../../utils/common' } from '../../../../utils/common'
import { import {
getRequest, getRequest,
@ -147,10 +164,12 @@
tableKey: '0', tableKey: '0',
radiolist1: [{ radiolist1: [{
name: '正确', name: '正确',
value: 1,
disabled: false disabled: false
}, },
{ {
name: '错误', name: '错误',
value: 2,
disabled: false disabled: false
}, },
], ],
@ -228,6 +247,8 @@
extendInclude(json, 'Nav_User'); extendInclude(json, 'Nav_User');
getRequest(json, "/SE/SETrainRecord/GetUserPapers").then(res => { getRequest(json, "/SE/SETrainRecord/GetUserPapers").then(res => {
this.model = res this.model = res
if (res && res.Nav_Papers && res.Nav_Papers.length > 0) { if (res && res.Nav_Papers && res.Nav_Papers.length > 0) {
let papers = res.Nav_Papers.sort((a, b) => { let papers = res.Nav_Papers.sort((a, b) => {
return a.Nav_Test.TYPE - b.Nav_Test.TYPE return a.Nav_Test.TYPE - b.Nav_Test.TYPE
@ -243,24 +264,32 @@
} }
this.papers = papers; this.papers = papers;
this.papers.forEach(item => { this.papers.forEach(item => {
if (item.Nav_Test.TYPE == 2) {
item.ANSWER3 = getSelectedOptions(item.ANSWER)
}
let test = {} let test = {}
if (item.Nav_Test.TYPE != 0) { if (item.Nav_Test.TYPE != 0) {
this.radiolist2[item.ID] = []; this.radiolist2[item.ID] = [];
this.radiolist2[item.ID].push({ this.radiolist2[item.ID].push({
name: item.Nav_Test.OPTION_A name: item.Nav_Test.OPTION_A,
value: 1
}, { }, {
name: item.Nav_Test.OPTION_B name: item.Nav_Test.OPTION_B,
value: 2
}, { }, {
name: item.Nav_Test.OPTION_C name: item.Nav_Test.OPTION_C,
value: 4
}, ) }, )
if (item.Nav_Test.OPTION_D != undefined && item.Nav_Test.OPTION_D != "") { if (item.Nav_Test.OPTION_D != undefined && item.Nav_Test.OPTION_D != "") {
this.radiolist2[item.ID].push({ this.radiolist2[item.ID].push({
name: item.Nav_Test.OPTION_D name: item.Nav_Test.OPTION_D,
value: 8
}) })
} }
if (item.Nav_Test.OPTION_E != undefined && item.Nav_Test.OPTION_E != "") { if (item.Nav_Test.OPTION_E != undefined && item.Nav_Test.OPTION_E != "") {
this.radiolist2[item.ID].push({ this.radiolist2[item.ID].push({
name: item.Nav_Test.OPTION_E name: item.Nav_Test.OPTION_E,
value: 16
}) })
} }
} }
@ -386,8 +415,8 @@
item.ANSWER = 16; item.ANSWER = 16;
} }
}, },
checkboxChange(arr, item) { checkboxChange(arr, item,itemID) {
let indexArr = this.findCommonElementsIndices(arr, this.radiolist2[item.ID]) let indexArr = this.findCommonElementsIndices(arr, this.radiolist2[itemID])//item.ID
item.ANSWER3 = arr; item.ANSWER3 = arr;
item.ANSWER = 0; item.ANSWER = 0;
indexArr.forEach(index => { indexArr.forEach(index => {
@ -408,8 +437,9 @@
const commonElements = []; const commonElements = [];
for (let i = 0; i < arr1.length; i++) { for (let i = 0; i < arr1.length; i++) {
for (let j = 0; j < arr2.length; j++) { for (let j = 0; j < arr2.length; j++) {
if (arr1[i] === arr2[j].name) { if (arr1[i] === arr2[j].value) {//name
commonElements.push(j); commonElements.push(j);
break
} }
} }
} }