| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <template>
- <view>
- <!-- 选择类巡检操作 -->
- <u-checkbox-group size="40" wrap="true" width="690">
- <u-checkbox icon-size="28" label-size="28" shape="circle" active-color="orange" @change="checkboxChange"
- v-model="item.checked" v-for="(item, index) in list" :key="index" :name="item.id">{{item.name}}
- </u-checkbox>
- </u-checkbox-group>
- <!-- <u-toast ref="sacast" /> -->
- </view>
- </template>
- <script>
- export default {
- props: {
- // 巡检项规则
- options: {
- type: Array
- },
- //拍照选项项目巡检id
- scan_id: {
- type: Number
- },
-
- },
- data() {
- return {
- list: [],
- value: ''
- }
- },
- created() {
- // console.log("option", this.options)
- this.setData()
- },
- methods: {
- //处理选项数据
- setData() {
- this.options.forEach(j => {
- let obj = {}
- obj.name = j.optionName
- obj.id = j.id
- obj.checked = j.defaultSelect
- this.list.push(obj)
- })
- },
- //选中某个复选框时,由checkbox时触发
- checkboxChange(e) {
- },
- //巡检数据处理
- submit() {
- let item = {
- id: this.scan_id,
- value: null
- } //提交数据
- let newarr = JSON.parse(JSON.stringify(this.list))
- newarr.forEach(i => {
- if(i.checked === true) {
- if(item.value) {
- item.value =item.value + "," + `${i.id}`
- } else {
- item.value = `${i.id}`
- }
- }
- })
- this.$store.state.user.items.push(item)
- },
- //重置表单
- reset() {
- this.list = []
- }
- }
- }
- </script>
- <style>
- </style>
|