<template>
  <div class="deviceSet manage-page">
    <div class="table-title">
      <img src="../../assets/manageImg/deviceInfoManage.png" alt="">设备信息管理
    </div>
    <div class="flex-view">
      <div class="manage-btn" @click="active = 0" :class="active == 0 ? 'active' : ''">
        <img src="../../assets/manageImg/manage-btn-icon2.png" alt="">
        施肥机
      </div>
      <div class="manage-btn" @click="active = 1" :class="active == 1 ? 'active' : ''">
        <img src="../../assets/manageImg/manage-btn-icon1.png" alt="">
        控制器
      </div>
      <div class="manage-btn" @click="active = 2" :class="active == 2 ? 'active' : ''">
        <img src="../../assets/manageImg/manage-btn-icon1.png" alt="">
        智能控制器
      </div>
          <div class="manage-btn" @click="active = 3" :class="active == 3 ? 'active' : ''">
        <img src="../../assets/manageImg/manage-btn-icon1.png" alt="">
        生态气象站
      </div>
          <div class="manage-btn" @click="active = 4" :class="active == 4 ? 'active' : ''">
        <img src="../../assets/manageImg/manage-btn-icon1.png" alt="">
        数据采集器
      </div>
    </div>
    <div class="table-view" style="width: 100%;" v-if="active === 0">
      <el-table :data="tableData" :row-class-name="tableRowClassName" height="620" style="width: 100%">
        <!-- <el-table-column  label="序号">
          <template slot-scope="scope">
              <div>{{scope.$index+1 }}
              </div>
            </template>
</el-table-column> -->
        <el-table-column prop="deviceId" label="设备code码">
        </el-table-column>
        <el-table-column prop="deviceTypeName" label="设备名称">
        </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <div class="table-flex">
              <div class="table-operate blue" @click="openModel(scope.row, scope.$index)">
                <img src="../../assets/manageImg/table-edit.png" alt="">编辑
              </div>
              <div class="table-operate red" @click="openModelName(scope.row, scope.$index)">
                <img src="../../assets/manageImg/table-edit.png" alt="">修改更多名称
              </div>
            </div>

          </template>
        </el-table-column>
      </el-table>
    </div>
    
    <div class="table-view" style="width: 100%;" v-if="active===1">
      <el-table :data="tableData1" :row-class-name="tableRowClassName" height="620" style="width: 100%">
        <!-- <el-table-column  label="序号">
          <template slot-scope="scope">
              <div>{{scope.$index+1 }}
              </div>
            </template>
        </el-table-column> -->
        <el-table-column prop="deviceId" label="设备code码">
        </el-table-column>
        <el-table-column prop="deviceTypeName" label="设备名称">
        </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <div class="table-flex">
              <div class="table-operate blue" @click="openModel1(scope.row, scope.$index)">
                <img src="../../assets/manageImg/table-edit.png" alt="">编辑
              </div>
              <div class="table-operate blue"  @click="openRoleModel(scope.row.deviceId)">
                <img src="../../assets/manageImg/table-edit.png" alt="">权限编辑
              </div>
            </div>

          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="table-view" style="width: 100%;" v-if="active===2">
      <el-table :data="tableData2" :row-class-name="tableRowClassName" height="620" style="width: 100%">
        <!-- <el-table-column  label="序号">
          <template slot-scope="scope">
              <div>{{scope.$index+1 }}
              </div>
            </template>
        </el-table-column> -->
        <el-table-column prop="deviceId" label="设备code码">
        </el-table-column>
        <el-table-column prop="deviceTypeName" label="设备名称">
        </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <div class="table-flex">
              <div class="table-operate blue" @click="openModel1(scope.row, scope.$index)">
                <img src="../../assets/manageImg/table-edit.png" alt="">编辑
              </div>
              <div class="table-operate red" @click="openModelName1(scope.row, scope.$index)">
                <img src="../../assets/manageImg/table-edit.png" alt="">修改更多名称
              </div>
            </div>

          </template>
        </el-table-column>
      </el-table>
    </div>
        <div class="table-view" style="width: 100%;" v-if="active === 3">
      <el-table :data="tableData3" :row-class-name="tableRowClassName" height="620" style="width: 100%">
        <!-- <el-table-column  label="序号">
          <template slot-scope="scope">
              <div>{{scope.$index+1 }}
              </div>
            </template>
</el-table-column> -->
        <el-table-column prop="deviceId" label="设备code码">
        </el-table-column>
        <el-table-column prop="deviceTypeName" label="设备名称">
        </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <div class="table-flex">
              <div class="table-operate blue" @click="openModel(scope.row, scope.$index)">
                <img src="../../assets/manageImg/table-edit.png" alt="">编辑
              </div>
            
            </div>

          </template>
        </el-table-column>
      </el-table>
    </div>
       <div class="table-view" style="width: 100%;" v-if="active === 4">
      <el-table :data="tableData4" :row-class-name="tableRowClassName" height="620" style="width: 100%">
        <!-- <el-table-column  label="序号">
          <template slot-scope="scope">
              <div>{{scope.$index+1 }}
              </div>
            </template>
</el-table-column> -->
        <el-table-column prop="deviceId" label="设备code码">
        </el-table-column>
        <el-table-column prop="deviceTypeName" label="设备名称">
        </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <div class="table-flex">
              <div class="table-operate blue" @click="openModel(scope.row, scope.$index)">
                <img src="../../assets/manageImg/table-edit.png" alt="">编辑
              </div>
           
            </div>

          </template>
        </el-table-column>
      </el-table>
    </div>
    <el-dialog  :close-on-click-modal="false" title="提示" top="10vh" :visible.sync="addModel" width="700px" class="vrcode-model manage-model"
      :append-to-body="true">
      <div class="vrcode-model-title">
        编辑
      </div>
      <div class="vrcode-content" v-if="nowData">
        <div class="manage-left">
          <div class="manage-input">
            <div class="input-title">设备code码</div>
            <input type="text" v-model="nowData.deviceId" disabled placeholder="请输入设备code码">
          </div>
          <div class="manage-input">
            <div class="input-title">设备名称</div>
            <input type="text" v-model="nowData.deviceTypeName" placeholder="请输入设备名称">
          </div>
          <div class="manage-input">
            <div class="input-title">施肥机状态页名称</div>
            <input type="text" v-model="nowData.stationName" placeholder="请输入施肥机状态页名称">
          </div>
          <div class="manage-input">
            <div class="input-title">摄像机名称</div>
            <input type="text" v-model="nowData.cameraSerialNumber" placeholder="请输入摄像机名称">
          </div>
          <div class="manage-input">
            <div class="input-title">摄像机通道号</div>
            <input type="number" v-model="nowData.cameraChannelNumber" placeholder="请输入对应摄像机通道号">
          </div>
          <div class="manage-input">
            <div class="input-title">排序</div>
            <input type="number" v-model="nowData.equipmentStatu" placeholder="请输入排序">
          </div>
        </div>
        <div class="manage-right">
          <div class="manage-img">
            <label for="sel-img">
              <img class="" :src="nowData.hls" alt="小程序图片">
            </label>
            <input ref="fileInput" type="file" :multiple="false" id="sel-img" accept="image/*"
              @change="handleImageChange($event, 0)" />
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <div class="vrcode-btn blue-btn w-100" @click="changeAddModel">确定</div>
        <div class="vrcode-btn cancle-btn w-100" @click="addModel = false">取消</div>
      </span>
    </el-dialog>
<!-- 施肥机的修改名字 -->
    <el-dialog  :close-on-click-modal="false" title="提示" top="10vh" :visible.sync="changeName" width="760px" class="vrcode-model manage-model"
      :append-to-body="true">
      <div class="vrcode-model-title">
        修改更多名称
      </div>
      <div class="vrcode-content" v-if="nameList">
        <div class="manage-left">
          <div class="manage-input w-160">
            <div class="input-title">施肥配方1-8</div>
            <input type="text" v-model="nameList.fertilizationOne" placeholder="施肥1">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.fertilizationTwo" placeholder="施肥2">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.fertilizationThree" placeholder="施肥3">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.fertilizationFour" placeholder="施肥4">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.fertilizationFive" placeholder="施肥5">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.fertilizationSix" placeholder="施肥6">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.fertilizationSeven" placeholder="施肥7">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.fertilizationEight" placeholder="施肥8">
          </div>
        </div>
        <div class="manage-center">
          <div class="manage-input w-160">
            <div class="input-title">灌溉组1-8</div>
            <input type="text" v-model="nameList.solenoidOne" placeholder="灌溉组1">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.solenoidTwo" placeholder="灌溉组2">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.solenoidThree" placeholder="灌溉组3">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.solenoidFour" placeholder="灌溉组4">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.solenoidFive" placeholder="灌溉组5">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.solenoidSix" placeholder="灌溉组6">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.solenoidSeven" placeholder="灌溉组7">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.solenoidEight" placeholder="灌溉组8">
          </div>
        </div>
      
        <div class="manage-center">
          <div class="manage-input w-160">
            <div class="input-title">灌溉组9-16</div>
            <input type="text" v-model="nameList.solenoidNine" placeholder="灌溉组9">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.solenoidTen" placeholder="灌溉组10">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.solenoidElven" placeholder="灌溉组11">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.solenoidTwelve" placeholder="灌溉组12">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.solenoidThirteen" placeholder="灌溉组13">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.solenoidFourteen" placeholder="灌溉组14">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.solenoidFifteen" placeholder="灌溉组15">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.solenoidSixteen" placeholder="灌溉组16">
          </div>
        </div>
   
        <div class="manage-right">
          <div class="manage-input w-160">
            <div class="input-title">外控设备1-4</div>
            <input type="text" v-model="nameList.externalOne" placeholder="外控设备1">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.externalTwo" placeholder="外控设备2">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.externalThree" placeholder="外控设备3">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="nameList.externalFour" placeholder="外控设备4">
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <div class="vrcode-btn blue-btn w-100" @click="changeAddModel2">确定</div>
        <div class="vrcode-btn cancle-btn w-100" @click="changeName = false">取消</div>
      </span>
    </el-dialog>
    <!-- 控制器编辑 -->
    <el-dialog  :close-on-click-modal="false" title="提示" top="10vh" :visible.sync="addModel1" width="564px" class="vrcode-model manage-model"
      :append-to-body="true">
      <div class="vrcode-model-title">
        编辑
      </div>
      <div class="vrcode-content" v-if="nowData1">
        <div class="manage-left">
          <div class="manage-input">
            <div class="input-title">设备code码</div>
            <input type="text" v-model="nowData1.deviceId" disabled placeholder="请输入设备code码">
          </div>
          <div class="manage-input">
            <div class="input-title">摄像机名称</div>
            <input type="text" v-model="nowData1.cameraSerialNumber" placeholder="请输入摄像机名称">
          </div>
          <div class="manage-input">
            <div class="input-title">排序</div>
            <input type="number" v-model="nowData1.equipmentStatu" placeholder="请输入排序">
          </div>
          <div class="manage-img-small">
            <label for="sel-img">
              <img class="" :src="nowData1.hls" alt="">
            </label>
            <input ref="fileInput1" type="file" :multiple="false" id="sel-img" accept="image/*"
              @change="handleImageChange($event,1)" />
          </div>
        </div>
        <div class="manage-right">
          <div class="manage-input">
            <div class="input-title">设备名称</div>
            <input type="text" v-model="nowData1.deviceTypeName" placeholder="请输入设备名称">
          </div>

          <div class="manage-input">
            <div class="input-title">摄像机通道号</div>
            <input type="number" v-model="nowData1.cameraChannelNumber" placeholder="请输入摄像机通道号">
          </div>
          <div class="manage-text">
            如果有摄像机则每小时都会定时更新<br>
            小程序摄像机主页面图片，<br>
            如果没有摄像机则可以自定义更改图片<br>
            地址信息。
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <div class="vrcode-btn blue-btn w-100" @click="changeAddModel1">确定</div>
        <div class="vrcode-btn cancle-btn w-100" @click="addModel1 = false">取消</div>
      </span>
    </el-dialog>
<!-- 智能灌溉 -->
<el-dialog  :close-on-click-modal="false" title="提示" top="10vh" :visible.sync="changeName1" width="760px" class="vrcode-model manage-model"
      :append-to-body="true">
      <div class="vrcode-model-title">
        修改更多名称
      </div>
      <div class="vrcode-content" v-if="name20List">
        <div class="manage-left">
          <div class="manage-input w-160">
            <div class="input-title">智能灌溉1-8</div>
            <input type="text" v-model="name20List.name1" placeholder="灌溉组1">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="name20List.name2" placeholder="灌溉组2">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="name20List.name3" placeholder="灌溉组3">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="name20List.name4" placeholder="灌溉组4">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="name20List.name5" placeholder="灌溉组5">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="name20List.name6" placeholder="灌溉组6">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="name20List.name7" placeholder="灌溉组7">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="name20List.name8" placeholder="灌溉组8">
          </div>
        </div>
        <div class="manage-center">
          <div class="manage-input w-160">
            <div class="input-title">智能灌溉9-16</div>
            <input type="text" v-model="name20List.name9" placeholder="灌溉组1">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="name20List.name10" placeholder="灌溉组2">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="name20List.name11" placeholder="灌溉组3">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="name20List.name12" placeholder="灌溉组4">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="name20List.name13" placeholder="灌溉组5">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="name20List.name14" placeholder="灌溉组6">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="name20List.name15" placeholder="灌溉组7">
          </div>
          <div class="manage-input w-160">
            <input type="text" v-model="name20List.name16" placeholder="灌溉组8">
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <div class="vrcode-btn blue-btn w-100" @click="changeAddModel3">确定</div>
        <div class="vrcode-btn cancle-btn w-100" @click="changeName = false">取消</div>
      </span>
    </el-dialog>

    
    <el-dialog  :close-on-click-modal="false" title="控制器权限管理" :append-to-body="true" :visible.sync="roleModel" width="70%">
      <div class="model-title">控制器权限管理</div>
      <div class="model-sel scroll">
        <div v-for="item, index in allDevicestatus" :key="index">
          <div @click="selClick(item)" :class="item.state==0 ? 'sel' : 'no-sel'"></div>
          {{ item.nickName }}
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <!-- <div class="vrcode-btn blue-btn">添加标准控制器</div> -->
        <div class="vrcode-btn cancle-btn w-100" @click="roleModel = false">确定</div>
      </span>
    </el-dialog>
  </div>
</template>
<script>
export default {
  data() {
    return {
      active: 0,
      tableData: [],
      tableData1: [],
      tableData2: [],
      tableData3: [],
      tableData4: [],
      addModel: false,
      addModel1: false,
      changeName: false,
      nowData: null,
      nowData1: null,
      nameList:null,//施肥机名字
      name20List:null,//智能灌溉名字
      changeName1:false,//智能灌溉的弹窗

      allDevicestatus:[],
      roleModel:false,
      nowDeviceId:'',
    }
  },
  // watch:{
  //   active(){
  //     setTimeout(() => {
  //       this.$forceUpdate()
  //     }, 10);
  //   },
  // },
  mounted() { this.dataInit() },
  methods: {

    dataInit() {
      var user = JSON.parse(localStorage.getItem('userInfo'))
      this.api.selUserbyid(user.userid).then(res => {
        this.tableData = []
        this.tableData1 = []
        this.tableData2 = []
        this.tableData3 = []
        this.tableData4 = []
        if (res.data.code == 200) {
          res.data.data.devices.forEach((el, index) => {
            if (el.deviceName == 10) {
              this.tableData1.push(el)
            } else if (el.deviceName == 1) {
              this.tableData.push(el)
            } else if (el.deviceName == 20) {
              this.tableData2.push(el)
            } else if (el.deviceName == 30) {
              this.tableData3.push(el)
            } else if (el.deviceName == 40) {
              this.tableData4.push(el)
            }
          })
        }
      })
    },
    selClick(item){
      var data
      if(item.state==0){
          data=  {
            "deviceId": this.nowDeviceId,
            "permission": item.id,
            "state":1
        }
      }else{
        data=  {
            "deviceId": this.nowDeviceId,
            "permission": item.id,
            "state":0
        }
      }
      item.state = data.state
                this.$forceUpdate();
               var apiData=JSON.parse(JSON.stringify(data))
                this.api.updatePermissionState(apiData).then((res => {
                    if (res.data.code == 200) {
                        this.$message({
                            message: '修改成功',
                            type: "success",
                        });
                        // this.getcontrol_cpermission()
                    } else {
                        this.$message({
                            message: res.data.msg,
                            type: "warning",
                        });
                    }
                }))
    },
openRoleModel(deviceId) {
      this.loading = this.$loading({
        lock: true,
        text: this.$t('message.loading'),
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      this.selDevicestatus = []
      this.nowDeviceId=deviceId
  
      // 线调取全部权限
      this.api.getcontrol_cpermission(deviceId).then(res => {
        if (res.data.code == 200) {
          this.allDevicestatus = res.data.data
          this.roleModel=true
          this.loading.close()
          // 再根据deviceId调取单个设备权限 并且查询共同name
          // this.getcontrol_cpermission()
        } else {
          this.loading.close()
          this.$message.error(res.data.msg);
        }
      })
    },
    changeAddModel() {
      this.loading = this.$loading({
        lock: true,
        text: this.$t('message.loading'),
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      var data = this.nowData
      this.api.updatedevice(data).then(res => {
        this.loading.close()
        if (res.data.code == 200) {
          this.dataInit()
          this.$message.success(res.data.msg);
          this.addModel = false
        } else {
          this.$message.error(res.data.msg);
          this.addModel = false
        }
      })
    },
    openModelName(item,index){
      this.loading = this.$loading({
        lock: true,
        text: this.$t('message.loading'),
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      var data={deviceId:item.deviceId}
      this.api.getByid(data).then(res=>{
        this.loading.close()
        if (res.data.code == 200) {
          this.nameList=res.data.data
          this.changeName=true
        } else {
          this.$message.error(res.data.msg);
        }
      })
},
openModelName1(item,index){
      this.loading = this.$loading({
        lock: true,
        text: this.$t('message.loading'),
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      var data={deviceId:item.deviceId}
      this.api.getFi_getName(data).then(res=>{
        this.loading.close()
        if (res.data.code == 200) {
          this.name20List=res.data.data
          this.changeName1=true
        } else {
          this.$message.error(res.data.msg);
        }
      })
},
changeAddModel3(){
  this.loading = this.$loading({
        lock: true,
        text: this.$t('message.loading'),
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      var data = this.name20List
      this.api.getFi_updateName(data).then(res=>{
        this.loading.close()
        if (res.data.code == 200) {
          this.$message.success(res.data.msg);
          this.changeName1 = false
        } else {
          this.$message.error(res.data.msg);
          this.changeName1 = false
        }
      })
},
    changeAddModel1() {
      this.loading = this.$loading({
        lock: true,
        text: this.$t('message.loading'),
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      var data = this.nowData1
      this.api.updatedevice(data).then(res => {
        this.loading.close()
        if (res.data.code == 200) {
          this.dataInit()
          this.$message.success(res.data.msg);
          this.addModel1 = false
        } else {
          this.$message.error(res.data.msg);
          this.addModel1 = false
        }
      })
    },
    changeAddModel2(){
      this.loading = this.$loading({
        lock: true,
        text: this.$t('message.loading'),
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      var data = this.nameList
      this.api.updateFsname(data).then(res=>{
        this.loading.close()
        if (res.data.code == 200) {
          this.$message.success(res.data.msg);
          this.changeName = false
        } else {
          this.$message.error(res.data.msg);
          this.changeName = false
        }
      })
    },
    handleImageChange(event,type) {
      this.loading = this.$loading({
        lock: true,
        text: '上传中',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      const file = event.target.files[0];
      const reader = new FileReader();
      reader.onload = (e) => {
        const imageData = e.target.result;
        const convertedFile = new File([imageData], file.name, { type: file.type });
        // 处理转换后的文件...

        var data = { file: convertedFile }
        this.api.manageUploadImage(data).then(res => {
          this.loading.close()
        if (res.data.code == 200) {
          if(type==0){
            this.nowData.hls=res.data.msg
            this.$refs.fileInput.value = '';
          }else{
            this.nowData1.hls=res.data.msg 
            this.$refs.fileInput1.value = '';
          }
         
        } else {
         
        }
        })
      };
      reader.readAsArrayBuffer(file);

    },
    openModel(item, index) {
      this.nowData = JSON.parse(JSON.stringify(item))
      this.addModel = true
    },
    openModel1(item, index) {
      this.nowData1 = JSON.parse(JSON.stringify(item))
      this.addModel1 = true
    },
    tableRowClassName({ row, rowIndex }) {
      if (rowIndex % 2 == 1) {
        return 'warning-row';
      } else if (rowIndex % 2 == 0) {
        return 'success-row';
      }
      return '';
    }
  },

}
</script>
<style lang="scss"></style>