Blame view

pages/questionnaire/questDetail/questDetail.vue 3.03 KB
354e3811   杨鑫   '验收'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
  <template>
  	<view class="" style="padding: 20rpx 40rpx; background-color: #fff;">
  		<view class="" v-for="(val,index) in tableList.cereQuestionManagements" style="padding: 10rpx;" v-if="tableList.cereQuestionManagements">
  			<view class="" style="font-size: 20px;margin-bottom: 5px;">
  				<span style="margin-right: 10px;">{{index + 1}}.</span> {{val.tikuTitle}}
  			</view>
  			 <u-radio-group class="radio-box" v-model="selectedOption" :wrap="true" v-if="val.questionType == '单选'">
  			    <u-radio shape="circle" v-for="(value, key, ind) in val.optionSettings" :key="ind" :label="value" style="padding: 3px 0;" disabled>{{ value }}</u-radio>
  			  </u-radio-group>
  			  <u-checkbox-group  v-model="cheOption"  :wrap="true" v-if="val.questionType == '多选'">
  			  			<u-checkbox 
  							v-for="(value, key, ex) in val.optionSettings" :key="ex" :label="value" style="padding: 3px 0;" disabled
  			  			>{{value}}</u-checkbox>
  			  		</u-checkbox-group>
  		</view>
  		<view class="" v-for="(val,index) in tableList.msg" style="padding: 10rpx;" v-if="tableList.msg">
  			<view class="" style="font-size: 20px;margin-bottom: 5px;">
  				<span style="margin-right: 10px;">{{index + 1}}.</span> {{val.tikuTitle}}
  			</view>
  			 <u-radio-group class="radio-box" v-model="selectedOption" :wrap="true" v-if="val.questionType == '单选'">
  			    <u-radio shape="circle" v-for="(value, key, ind) in val.optionSettings" :key="ind" :label="value" style="padding: 3px 0;" disabled>{{ value }}</u-radio>
  			  </u-radio-group>
  			  <u-checkbox-group  v-model="cheOption"  :wrap="true" v-if="val.questionType == '多选'">
  			  			<u-checkbox 
  							v-for="(value, key, ex) in val.optionSettings" :key="ex" :label="value" style="padding: 3px 0;" disabled
  			  			>{{value}}</u-checkbox>
  			  		</u-checkbox-group>
  		</view>
  	</view>
  </template>
  
  <script>
  	export default {
  		data() {
  			return {
  				cheOption:null,
  				selectedOption:null,
  				tableList:{
  					
  				}
  			};
  		},
  		onLoad(option) {
  			this.tableList  = JSON.parse(option.detail)
  			if(this.tableList.cereQuestionManagements){
  				if(this.tableList.cereQuestionManagements.length >0){
  					this.tableList.cereQuestionManagements.map(item=>{
  					item.optionSettings  = JSON.parse(item.optionSettings)
  							if (Object.keys(item.optionSettings).length > 0) {
  							       this.selectedOption = Object.keys(item.optionSettings)[0];
  							     }
  						})
  				}
  			}else{
  				console.log(JSON.parse(this.tableList))
  				
  				this.tableList = JSON.parse(this.tableList)
  				// this.items.map(tem=>{
  				// 	tem.optionSettings = `{${tem.optionSettings.map(item => `"ules":"${item.ules}"`).join(',')}}`
  				
  				// })
  				this.tableList.msg.map(item=>{
  					item.optionSettings = `{${item.optionSettings.map(val => `"ules":"${val.ules}"`).join(',')}}`
  				item.optionSettings  = JSON.parse(item.optionSettings)
  						if (Object.keys(item.optionSettings).length > 0) {
  						       this.selectedOption = Object.keys(item.optionSettings)[0];
  						     }
  					})
  			}
  		 
  			
  		},
  		mounted() {
  	
  		},
  		methods:{
  			
  		}
  	}
  </script>
  
  <style>
  	
  </style>