123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <template>
- <view>
- <view class="option">
- <view class="option_title">
- <text style="left: 20rpx;">关联策略</text>
- <text style="right: 20rpx;">{{publicName}}</text>
- </view>
- <radio-group @change="Sight">
- <view class="option_name" v-for="(item,index) in option" :key="index">
- <view class="option_radio">
- <radio :value="item.lightName" :checked="item.lightName === lightName"></radio>
- </view>
- <view class="option_information">
- <view class="tactics_name">
- <text style="left: 120rpx;">策略名称:</text>
- <text>{{item.lightName}}</text>
- </view>
- <view class="tactics_detail">
- <text style="left: 300rpx;">策略详情:</text>
- <text>{{item.combinationStr[0]}}</text>
- </view>
- </view>
- </view>
- </radio-group>
- <view class="operate">
- <button type="primary" @click="send()">确定</button>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { tactics, changeTactics, light } from '@/pages/api/lighting/lighting.js'
- export default {
- data() {
- return {
- option: [],
- //被选中的单选框下标
- current: 0,
- //改变策略的信息
- publicName: '',
- publicId: 0,
- relationType: 0,
- lightId: 0,
- lightName: '',
- }
- },
- methods: {
- Sight(e) {
- for (let i = 0; i < this.option.length; i++) {
- if (this.option[i].lightName === e.detail.value) {
- this.current = i
- }
- }
- },
- send() {
- const index = this.current
- const lightId = this.option[index].lightId
- changeTactics(this.publicId,lightId,this.relationType,this.publicName,this.lightName).then(res => {
- if(res.code == 200){
- console.log(res)
- }
- })
- },
- policy(e){
- this.publicName = e.publicName
- this.publicId = e.publicId
- this.relationType = e.relationType
- this.lightName = e.lightName
- console.log(this.lightName)
- // this.index = parseInt(e.index2)
- // this.pageSize = parseInt(e.pageSize)
- // this.Current = parseInt(e.current)
- //获取策略选项列表
- tactics().then(res => {
- if (res.code == 200) {
- this.option = res.data
- }
- })
- }
- },
- onLoad(e) {
- this.policy(e)
- }
- }
- </script>
- <style lang="scss">
- page {
- width: 100%;
- height: 100%;
- }
- .option {
- width: 750rpx;
- height: 100%;
- }
- .option_title {
- width: 100%;
- height: 100rpx;
- line-height: 100rpx;
- font-size: 36rpx;
- border-bottom: 1px solid #dedfe3;
- position: relative;
- text {
- position: absolute;
- }
- }
- .option_name {
- width: 100%;
- height: 160rpx;
- border-bottom: 1px solid #dedfe3;
- display: flex;
- }
- .option_radio {
- width: 150rpx;
- height: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .option_information {
- width: 600rpx;
- height: 100%;
- }
- .tactics_name {
- width: 600rpx;
- height: 50%;
- font-size: 30rpx;
- display: flex;
- align-items: center;
- }
- .tactics_detail {
- width: 600rpx;
- height: 50%;
- font-size: 30rpx;
- }
- .operate {
- width: 700rpx;
- height: 150rpx;
- margin: 50rpx auto;
- button {
- font-size: 30rpx;
- }
- }
- </style>
|