qa-prevention-xgf-app/pages/eight_assignments/security_measures.vue

110 lines
3.2 KiB
Vue
Raw Normal View History

2024-07-09 18:01:48 +08:00
<template>
<view class="content">
<view class="card">
<view class="title">{{ questionnaireInfo.NAME }}</view>
<uni-table border class="mt-10">
<uni-tr>
<uni-th>主要安全措施</uni-th>
<uni-th width="200rpx">是否涉及</uni-th>
</uni-tr>
<uni-tr v-for="(item,index) in items" :key="item.itemInfo.EW_RE_QUES_ITEM_ID">
<uni-td>
<view>{{ item.itemInfo.TEXT_INFO }}</view>
<view v-for="item1 in item.inputBoxes" :key="item1.EW_RE_QUES_ITEM_FILL_ID">
<u-cell :title="item1.TEXT_INFO + ''" :border="false">
<template #value>
<u-input v-model="item1.MARKERS" :customStyle="{marginTop: '8px'}" border="bottom"/>
</template>
</u-cell>
</view>
</uni-td>
<uni-td>
<u-radio-group placement="column" v-model="item.optionsValue" @change="fnRadioChange($event,index)">
<u-radio :customStyle="{marginTop: '8px'}" v-for="item1 in item.options"
:key="item1.EW_RE_QUES_ITEM_FILL_ID" :label="item1.TEXT_INFO" :name="item1.VALUE_INFO"/>
</u-radio-group>
</uni-td>
</uni-tr>
</uni-table>
<view class="mt-10">
<u-button type="primary" text="下一步" @click="$u.debounce(fnSubmit, 1000,true)"/>
</view>
</view>
</view>
</template>
<script>
import {setSecurityMeasures} from "@/utils/submitHomeworkProcess";
export default {
data() {
return {
EW_RU_JOB_ID: '',
taskId: '',
TYPE: '',
CORP_ID: '',
questionnaireInfo: {},
items: []
}
},
onLoad() {
const eventChannel = this.getOpenerEventChannel();
eventChannel.on('questionnaire', (data) => {
this.EW_RU_JOB_ID = data.EW_RU_JOB_ID
this.taskId = data.taskId
this.TYPE = data.TYPE
this.CORP_ID = data.CORP_ID
this.questionnaireInfo = data.questionnaire.questionnaire
this.items = data.questionnaire.items
})
},
methods: {
fnRadioChange(event, index) {
for (let i = 0; i < this.items[index].options.length; i++) {
this.items[index].options[i].MARKERS = '0'
if (this.items[index].options[i].VALUE_INFO === event) {
this.items[index].options[i].MARKERS = '1'
}
}
},
async fnSubmit() {
for (let i = 0; i < this.items.length; i++) {
for (let j = 0; j < this.items[i].inputBoxes.length; j++) {
if (!this.items[i].inputBoxes[j].MARKERS) {
uni.$u.toast(`${i + 1}行第${j + 1}项未填写`)
return
}
}
for (let j = 0; j < this.items[i].options.length; j++) {
if (!this.items[i].options[j].MARKERS) {
uni.$u.toast(`${i + 1}行第${j + 1}项未选择`)
return
}
}
}
await setSecurityMeasures({
questionnaires: this.items,
questionnaireInfo: this.questionnaireInfo,
taskId: this.taskId,
EW_RU_JOB_ID: this.EW_RU_JOB_ID,
CORP_ID: this.CORP_ID,
TYPE: this.TYPE
})
}
},
}
</script>
<style scoped lang="scss">
.title {
text-align: center;
font-size: 36rpx;
}
::v-deep {
.u-cell__body {
padding: 0;
}
}
</style>