<script lang="ts">
export default {
  name: "makeTask",
};
</script>

<script setup lang="ts">
import { ref, onMounted, nextTick, watch } from "vue";
import { ElMessageBox, ElMessage, ElTable, } from "element-plus";
import {
  getdata,
  addTask,
  changeSwitch,
  editTask,
  delTask,
  getelect,
  getBayTree,
  getmaintype,
  getmaindata,
  QueryTour,
  checkTask,
  PatrolTask,
  getRobotAndUavList
} from "@/api/makeTask";
import dayjs from 'dayjs'
import { secondauthPassword } from '@/api/robotmonitoring'
import { getdevicedata } from "@/api/device";
import { encrypt, decrypt } from '@/utils/sm4';
import { getSubstationBayByArea } from "@/api/task";
import { getTreeList } from "@/api/linksignal";
import { getBayType } from "@/api/device";
import Page from '@/components/Pagination/page.vue'
import { useAppStore } from '@/store/modules/app';
import { getDeviceByType } from "@/api/device";
import { stationOnline } from '@/api/substation';
import { useUserStore } from '@/store/modules/user';
// import Seccmsdialog from '@/components/seccmsdialog/index.vue';
import Eldialog from '@/components/seccmsdialog/eldialog.vue';
const userStore = useUserStore();
//tabbas 定义和点击事件
const activeName: any = ref('1')
const handleClick = () => {
  getData()
}

//搜索框数据定义
// 输入框数据
const taskName = ref()
//启用状态
const startUsing = [
  {
    value: 1,
    label: '启动',
  },
  {
    value: 2,
    label: '终止',
  },
  {
    value: 0,
    label: '停止',
  },
]

//执行方式
const ExecutionMethod = [
  {
    value: '1',
    label: '立即执行',
  },
  {
    value: '2',
    label: '定时执行',
  },
  {
    value: '3',
    label: '周期执行',
  },
]
//时间
const tableData: any = ref([])
const total = ref()
const SearchBox: any = ref({
  type: activeName.value,
  taskName: taskName.value,
  enable: '',
  taskType: '',
  taskTodoType: '',
  startDate: '',
  endDate: '',
  size: 10,
  current: 1
})
//表格值
const tableDataList: any = ref([])
const tableTempDataList: any = ref([])
// 搜索_时间赋值
function dataChange() {
  if (tableData.value.length == 2) {
    SearchBox.value.startDate = tableData.value[0]
    SearchBox.value.endDate = tableData.value[1]
  }
}
const treeloading = ref(false)
//获取机器人-无人机
const robotUAV: any = ref([])
function getrobotUAV() {
  getRobotAndUavList().then((res: any) => {
    robotUAV.value = res.data
  })
}
// 获取表格参数
function getData() {
  treeloading.value = true
  SearchBox.value.type = activeName.value
  SearchBox.value.taskName = taskName.value
  getdata(SearchBox.value).then((res: any) => {
    treeloading.value = false
    tableDataList.value = res.data.records
    tableTempDataList.value = JSON.parse(JSON.stringify(res.data.records))
    SearchBox.value.size = res.data.size
    SearchBox.value.current = res.data.current
    total.value = res.data.total
  })
}
//重置
function resetting() {
  SearchBox.value = {
    type: activeName.value,
    taskName: '',
    enable: '',
    taskType: '',
    taskTodoType: '',
    startDate: '',
    endDate: '',
    size: 10,
    current: 1
  }
  taskName.value = ''
  tableData.value = ''
  getData()
}
//上报
function patroltask() {
  const allTaskId: any = ref([])
  deviceInfos.value.forEach((res: any) => {
    allTaskId.value.push(res.taskId)
  })
  const params = {
    taskIds: allTaskId.value.toString()
  }
  PatrolTask(params).then((res: any) => {
    if (res.code != 1) {
      ElMessage({
        type: "success",
        message: "上报成功",
      });
      getData()
    }
  })
}
// 表格选择事件
const deviceInfos: any = ref([])
function handleSelectionChange(val: any) {
  deviceInfos.value = val
}
const timeData: any = ref([])
// 弹窗数据定义
const dialogVisible = ref(false)
const title = ref()
const tabs = ref(1)
const info: any = ref({
  type: activeName.value,
  taskCode: '',
  taskName: '',
  taskType: '',
  taskTodoType: '',
  fixedStartTime: '',
  cronValue: '',
  invalidStartTime: '',
  invalidEndTime: '',
  custom1: '',
  priority: '',
  stationAll: '',
  robotCode: ''
})
//二次密码验证
const password = ref()
const control = ref(false)
const tableRow: any = ref()
const inputTrue = ref(false)
function verification(row: any, index: any) {
  control.value = true
  tableRow.value = row
  tableIndex.value = index
  password.value = ''
}
function secondPass() {
  secondauthPassword({ username: userStore.username, password: encrypt(password.value) }).then((res: any) => {
    if (res.code != 1) {
      if (res.data == '二次密码认证错误！') {
        inputTrue.value = true
        getData()
        return false
      }
      switchChange(tableRow.value)
      ElMessage({
        type: 'success',
        message: '验证成功',
      })
      control.value = false
      inputTrue.value = false
    }
  })
}
const tableIndex: any = ref(0)
function inputCLOse() {
  control.value = false
  inputTrue.value = false
  tableDataList.value[tableIndex.value] = tableTempDataList.value[tableIndex.value]
  // getData()
}
//修改状态
function switchChange(row: any) {
  if (row.isStationFlag == 1) {
    const paramsa = {
      stationcode: row.stationCode
    }
    stationOnline(paramsa).then((res: any) => {
      if (res == 1) {
        if (row.isenable == 0) {
          row.isenable = 2
        }
        const params = {
          taskId: row.taskId,
          enable: row.isenable
        }
        changeSwitch(params).then((res: any) => {
          if (res.code != 1) {
            ElMessage({
              type: "success",
              message: "改变成功",
            });
            getData()
          }
        })
      } else if (res == 0) {
        ElMessage({
          type: 'error',
          message: '当前变电站节点不在线，请稍后重试！',
        })
        getData()
        return false
      }

    })
  } else {
    if (row.isenable == 0) {
      row.isenable = 2
    }
    const params = {
      taskId: row.taskId,
      enable: row.isenable
    }
    changeSwitch(params).then((res: any) => {
      if (res.code != 1) {
        ElMessage({
          type: "success",
          message: "改变成功",
        });
        getData()
      }
    })
  }
  // const elMessage = ref('')
  // if (row.isenable == '2') {
  //   elMessage.value = "确定终止该巡视设备吗？"
  // } else if (row.isenable == '1') {
  //   elMessage.value = "确定启动该巡视设备吗？"
  // }
  // ElMessageBox.confirm(elMessage.value, "提示信息", {
  //   confirmButtonText: "确定",
  //   cancelButtonText: "取消",
  //   type: "warning",
  // })
  //   .then(() => {



  //   })
  //   .catch(() => {
  //     getData()
  //   });

}

//新增
function addClick() {
  info.value.stationAll = ''
  dialogVisible.value = true
  title.value = "新建巡视任务"
  tabs.value = 1
  info.value = {
    type: activeName.value,
    taskCode: '',
    taskName: '',
    taskType: '',
    taskTodoType: '',
    fixedStartTime: '',
    cronValue: '',
    invalidStartTime: '',
    invalidEndTime: '',
    custom1: '',
    priority: '',
    robotCode: ''
  }
  info.value.datastatus = 1
  allData.value = []
  deviceLevel.value = 0
}
//修改
function handleEdit(row: any) {
  row.lastmodifydate = ''
  const infoAll = ref()
  infoAll.value = JSON.parse(JSON.stringify(row))
  info.value = JSON.parse(JSON.stringify(row))
  optionSelect.value.forEach((res: any) => {
    if (row.stationCode == res.stationCode) {
      info.value.stationAll = res.stationId
    }
  })
  dialogVisible.value = true
  allData.value = []
  deviceLevel.value = 0
  if (row.datastatus == 1) {
    title.value = "修改巡视任务"
  } else {
    title.value = "查看巡视任务"
  }

  tabs.value = 1
  timeData.value = []
  if (row.taskTodoType == 3) {
    timeData.value.push(row.invalidStartTime)
    timeData.value.push(row.invalidEndTime)
  }

  if (row.deviceLevel) {
    queryTour(row.taskId, row.deviceLevel)
  }

}
//复制
function duplicate(row: any, index: any) {
  optionSelect.value.forEach((res: any) => {
    if (row.stationCode == res.stationCode) {
      info.value.stationAll = res.stationId
    }
  })
  const infotask: any = ref()
  infotask.value = JSON.parse(JSON.stringify(row))
  infotask.value.taskId = ''
  infotask.value.deviceList = undefined
  info.value = infotask.value
  info.value.stationAll = info.value.stationId
  dialogVisible.value = true
  title.value = "复制巡视任务"
  tabs.value = 1
  timeData.value = []
  // allData.value.length = 0
  // deviceLevel.value = 0
  if (row.taskTodoType == 3) {
    timeData.value.push(row.invalidStartTime)
    timeData.value.push(row.invalidStartTime)
  }
  if (row.deviceLevel) {
    queryTour(row.taskId, row.deviceLevel)
  }
}

//新增弹窗-基本信息-确定
const infoForm = ref()
const stationlist = ref({
  stationCode: '',
  stationName: '',
})
function confirmClick(formEl: any) {
  formEl.validate((valid: any) => {
    if (valid) {
      if (info.value.fixedStartTime) {
        info.value.fixedStartTime = dateFormat(info.value.fixedStartTime)
      }
      if (timeData.value.length == 2) {
        if (timeData.value[0]) {
          info.value.invalidStartTime = dateFormat(timeData.value[0])
          info.value.invalidEndTime = dateFormat(timeData.value[1])
        }
      }
      if (deviceLevel.value != 0) {
        allDataID.value.length = 0
        allData.value.forEach((element: any) => {
          if (deviceLevel.value == 1) {
            allDataID.value.push(element.bayId)
          } else if (deviceLevel.value == 2) {
            allDataID.value.push(element.mainDeviceId)
          } else if (deviceLevel.value == 4) {
            allDataID.value.push(element.componentId)
          } else if (deviceLevel.value == 3) {
            allDataID.value.push(element.deviceId)
          }

        });
        info.value['deviceLevel'] = deviceLevel.value
        info.value['deviceList'] = allDataID.value.toString()
      }
      if (info.value.lastmodifydate) {
        info.value.lastmodifydate = ''
      }
      const params = Object.assign({}, info.value, cronValue.value)
      optionSelect.value.forEach((res: any) => {
        if (info.value.stationAll == res.stationId) {
          stationlist.value.stationCode = res.stationCode
          stationlist.value.stationName = res.stationName
        }
      })
      const paramsall = Object.assign({}, params, stationlist.value)
      if (info.value.taskId) {
        allData.value.forEach((ros: any) => {
          if (stationlist.value.stationCode == ros.stationCode) {
          } else {
            paramsall.deviceList = ''
          }
        })

        editTask(paramsall).then((res: any) => {
          if (res.code != '1') {
            dialogVisible.value = false;
            ElMessage({
              type: 'success',
              message: '修改成功',
            })
            getData()
          }

        })
      } else {
        addTask(paramsall).then((res: any) => {
          if (res.code != '1') {
            ElMessage({
              type: 'success',
              message: '添加成功',
            })
            dialogVisible.value = false;
            getData()
          }

        })
      }
    }
  })
}
//删除
function deleteTask(row: any) {
  ElMessageBox.confirm('确定删除此巡视任务吗？', '删除提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning'
  }).then(() => {
    const params = {
      taskId: row.taskId
    }
    delTask(params).then((res: any) => {
      if (res.code != 1) {
        getData()
        ElMessage({
          message: '删除成功',
          type: 'success',
        })
      }

    })
  })

}
//多选删除
function delClick() {
  ElMessageBox.confirm('确定删除此巡视任务吗？', '删除提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning'
  }).then(() => {
    const allTaskId: any = ref([])
    deviceInfos.value.forEach((res: any) => {
      allTaskId.value.push(res.taskId)
    })
    const params = {
      taskId: allTaskId.value.toString()
    }
    delTask(params).then((res: any) => {
      if (res.code != 1) {
        ElMessage({
          type: "success",
          message: "删除成功",
        });
        getData()
      }
    })
  })

}
//表格多选禁用

//复核
function CheckTask(row: any) {
  ElMessageBox.confirm('确定审核通过此巡视任务吗？', "提示信息", {
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(() => {
      if (row.isStationFlag == 1) {
        const params = {
          stationcode: row.stationCode
        }
        stationOnline(params).then((res: any) => {
          if (res == 1) {
            checkTask(paramsa).then((res: any) => {
              if (res.code != 1) {
                getData()
                ElMessage({
                  message: '审核生效',
                  type: 'success',
                })
              }
            })
          } else if (res == 0) {
            ElMessage({
              type: 'error',
              message: '当前变电站节点不在线，请稍后重试！',
            })
            getData()
            return false
          }
        })
      } else {
        checkTask(paramsa).then((res: any) => {
          if (res.code != 1) {
            getData()
            ElMessage({
              message: '审核生效',
              type: 'success',
            })
          }
        })
      }

    })
    .catch(() => {
      getData()
    });
  const paramsa = {
    taskId: row.taskId
  }

}
//弹窗关闭事件
function handleClose() {
  if (infoForm.value != null) infoForm.value.resetFields();
  dialogVisible.value = false

}
//表单校验
const rules = ref({
  taskCode: [
    { required: true, message: '请输入任务编码', trigger: 'blur' }, { validator: stringlength1, trigger: 'blur' }
  ],
  taskName: [
    { required: true, message: '请输入任务名称', trigger: 'blur' }, { validator: stringlength, trigger: 'blur' }
  ],
  stationAll: [{ required: true, message: '请选择变电站', trigger: 'blur' }]
})
//区域名称长度
function stringlength(rule: any, value: any, callback: any) {
  if (value.length > 100) {
    return callback(new Error('字符最大长度不超过100'))
  }
  callback()
}
function stringlength1(rule: any, value: any, callback: any) {
  if (value.length > 40) {
    return callback(new Error('字符最大长度不超过40'))
  }
  callback()
}
//关联设备
//变电站下拉列表获取
// const stationAll = ref()
const optionSelect: any = ref([])
const tasktypearr = ref()
function GetSelect() {
  if (info.value.taskType == 1) {
    tasktypearr.value = 0
  } else if (info.value.taskType == 3) {
    tasktypearr.value = 1
  } else {
    tasktypearr.value = ''
  }
  const parmas = {
    flag: tasktypearr.value
  }
  getelect(parmas).then((res: any) => {
    if (allData.value.length != 0) {
      res.data.forEach((row: any) => {
        allData.value.forEach((item: any) => {
          if (row.stationCode == item.stationCode) {
            item['stationId'] = row.stationId
          }
        })
      })
    }
    info.value.stationAll = res.data[0].stationId
    optionSelect.value = res.data
    areaTree()
    getbaytree()
  })

}

//左侧树形控件
interface Tree {
  [x: string]: any;
  label: string;
  children?: Tree[];
}
const defaultProps = {
  children: "children",
  label: "name"
};

//关联间隔
const treedatalist: any = ref([]);
const treeReflist = ref();
const currentNodeKeylist = ref("")
const areaId = ref()
//变电站区域树获取
function areaTree() {
  const parmas = {
    stationId: info.value.stationAll
  }
  getTreeList(parmas).then((res: any) => {
    if (res.data.length == 0) {
      intervalData.value = []
    }
    treedatalist.value = res.data
    areaId.value = res.data[0].children[0].areaId

    nextTick(() => {
      if (areaId.value) {
        treeRefbay.value?.setCurrentKey(areaId.value);
      }

    });
    getInterval()

  })
}
// 导航树点击事件
function handlelistClick(data: Tree, node: any) {
  if (data.children) {
    node.isCurrent = false
    currentNodeKeylist.value = ""
    nextTick(() => {
      currentNodeKeylist.value = areaId.value
    })
  } else {
    areaId.value = data.areaId;
    getInterval()
  }
}
//获取间隔数据
const bayName = ref()
const intervalData = ref()
const loadingComponent = ref(false)
function getInterval() {
  loadingComponent.value = true
  const params = {
    areaId: areaId.value,
    bayName: bayName.value
  }
  getSubstationBayByArea(params).then((res: any) => {
    loadingComponent.value = false
    res.data.forEach((res: any) => {
      res['id'] = res.bayId
    })
    intervalData.value = res.data
    allData.value.forEach((row: any) => {
      intervalData.value.forEach((items: any) => {
        if (items.id == row.id) {
          nextTick(() => {
            multipleTableReflist.value.toggleRowSelection(items, true)
          })
        }
      });
    })
  })
}

//关联主设备
const treedatabay: any = ref([]);
const treeRefbay = ref();
const currentNodeKeybay = ref("")
const bayId = ref()
function getbaytree() {
  const params = {
    stationId: info.value.stationAll
  }
  getBayTree(params).then((res: any) => {
    if (res.data.length == 0) {
      MainvalData.value = []
      componentData.value = []
      deviceData.value = []
    }
    treedatabay.value = res.data
    bayId.value = res.data[0].children[0].children[0].bayId

    // bayId.value = res.data[0].children[0].children[0].bayId
    nextTick(() => {
      treeRefbay.value?.setCurrentKey(bayId.value);
    });
    getMainData()
    getComponentData()
    getPointsData()
  })
}
//导航树点击事件
function handlebayClick(data: Tree, node: any) {
  if (data.children) {
    node.isCurrent = false
    currentNodeKeybay.value = ""
    nextTick(() => {
      currentNodeKeybay.value = bayId.value
    })
  } else {
    bayId.value = data.bayId;
    getMainData()
    getComponentData()
    getPointsData()
  }
}
//获取主设备类型
const paramsMaintable = ref()
const PatrolEquipmentType: any = ref([])
const Mainnmae = ref()
function getMainType() {
  getmaintype().then((res: any) => {
    PatrolEquipmentType.value = res.data
  })
}
//获取主设备
const MainvalData: any = ref([])
const loadingMain = ref(false)
function getMainData() {
  loadingMain.value = true
  MainvalData.value = []
  const params = {
    bayId: bayId.value,
    mainDeviceName: Mainnmae.value,
    deviceType: paramsMaintable.value
  }

  getmaindata(params).then((res: any) => {

    PatrolEquipmentType.value.forEach((row: any) => {
      res.data.forEach((item: any) => {
        if (row.itemcode == item.deviceType) {
          item.deviceType = row.dictname
        }
      })

    })
    res.data.forEach((res: any) => {
      res['id'] = res.mainDeviceId
    })
    loadingMain.value = false
    MainvalData.value = res.data
    allData.value.forEach((row: any) => {
      MainvalData.value.forEach((items: any) => {
        if (items.id == row.id) {
          nextTick(() => {
            multipleTableMain.value.toggleRowSelection(items, true)
          })
        }
      });
    })
  })
}
//重置
function resettingmain() {
  Mainnmae.value = ''
  paramsMaintable.value = ''
  getMainData()
}

//关联部件
const componentName = ref()
const mainDeviceId = ref()
const componentData = ref()
const loadingInterval = ref(false)
function getComponentData() {
  loadingInterval.value = true
  const params = {
    bayId: bayId.value,
    componentName: componentName.value,
    mainDeviceId: mainDeviceId.value,
  }
  getBayType(params).then((res: any) => {
    loadingInterval.value = false
    componentData.value = res.data
    res.data.forEach((res: any) => {
      res['id'] = res.componentId
    })
    allData.value.forEach((row: any) => {
      componentData.value.forEach((items: any) => {
        if (items.id == row.id) {
          nextTick(() => {
            multipleTableComponents.value.toggleRowSelection(items, true)
          })
        }
      });
    })
  })
}
//重置
function resetComponent() {
  componentName.value = ''
  mainDeviceId.value = ''
  getComponentData()
}

//关联巡视点位
const mainDeviceIds = ref()
const componentIds = ref()
const deviceData = ref()
const loadingPoints = ref(false)
function getPointsData() {
  loadingPoints.value = true
  const params = {
    bayId: bayId.value,
    componentId: componentIds.value,
    mainDeviceId: mainDeviceIds.value,
    status: 0,
    patrolDeviceCode: info.value.robotCode,
    deviceName: bayName.value
  }
  getdevicedata(params).then((res: any) => {
    loadingPoints.value = false
    deviceData.value = res.data.records
    res.data.records.forEach((res: any) => {
      res['id'] = res.deviceId
    })
    allData.value.forEach((row: any) => {
      deviceData.value.forEach((items: any) => {
        if (items.id == row.id) {
          nextTick(() => {
            multipleTablePoints.value.toggleRowSelection(items, true)
          })
        }
      });
    })

  })
}


// 设备类型定义
const deviceLevel = ref(0)
//定义接收关联的数组
const allData: any = ref([])
const allDataID: any = ref([])
const multipleTableReflist: any = ref()
//关联间隔
// 定义间隔添加数据数组
const DataInterval: any = ref([])
const Bindinginterval = ref(false)
function associationInterval() {
  if (info.value.stationAll == undefined) {
    ElMessage({
      message: '请选择变电站',
      type: 'warning',
    })
    return false
  }
  loadingComponent.value = true
  Bindinginterval.value = true
  nextTick(() => {
    areaTree()
  })
}
//关联间隔 - 多选
function handChangeInterval(val: any) {
  const flag = ref(false)
  if (allData.value.length != 0) {
    for (var i = 0; i < allData.value.length; i++) {
      for (var j = 0; j < val.length; j++) {
        if (allData.value[i].stationCode == val[j].stationCode) {
          DataInterval.value = val
        } else {
          ElMessageBox.confirm('该操作会解除上一变电站所绑定的点位信息，是否继续？', '删除提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            allData.value = []
            DataInterval.value = val
          }).catch(() => {
            multipleTableReflist.value!.clearSelection()
          })
          flag.value = true
          if (flag.value == true) {
            return false
          }
        }
      }
    }
  } else {
    DataInterval.value = val
  }
  // DataInterval.value = val
}
//关联间隔 - 添加
function addInterval() {
  const hasId: any = ref([])
  // if (allData.value.length != 0) {
  //   intervalData.value.forEach((res: any) => {
  //     allData.value.forEach((row: any) => {
  //         hasId.value.push(res.id)
  //     })
  //   })
  // }

  if (allData.value.length != 0 && deviceLevel.value != 1) {
    const messageBox = ref()
    if (allData.value[0].deviceId) {
      messageBox.value = '巡视点位'
    } else if (allData.value[0].componentName) {
      messageBox.value = '部件'
    } else if (allData.value[0].mainDeviceId) {
      messageBox.value = '主设备'
    } else if (allData.value[0].bayId) {
      messageBox.value = '间隔'
    }
    ElMessageBox.confirm('当前已有关联的' + messageBox.value + '信息,您确定要替换关联吗？', '删除提示', {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning'
    }).then(() => {
      allDataID.value = []
      allData.value = []
      deviceLevel.value = 1
      ElMessage({
        type: 'success',
        message: '添加成功',
      })
      DataInterval.value.forEach((res: any) => {
        allData.value.push(res)
      })
      for (var i = 0; i < allData.value.length - 1; i++) {
        for (var j = i + 1; j < allData.value.length; j++) {
          if (allData.value[i].bayId == allData.value[j].bayId) {
            allData.value.splice(j, 1);
            j--;
          }
        }
      }
      allData.value.forEach((row: any) => {
        allDataID.value.push(row.bayId)
      })
    })

  } else {
    allDataID.value = []
    // allData.value = DataInterval.value
    DataInterval.value.forEach((res: any) => {
      allData.value.push(res)
    })
    for (var i = 0; i < allData.value.length - 1; i++) {
      for (var j = i + 1; j < allData.value.length; j++) {
        if (allData.value[i].bayId == allData.value[j].bayId) {
          allData.value.splice(j, 1);
          j--;
        }
      }
    }
    allData.value.forEach((row: any) => {
      allDataID.value.push(row.bayId)
    })
    deviceLevel.value = 1
    ElMessage({
      type: 'success',
      message: '添加成功',
    })
    Bindpoints.value = false
    BindComponents.value = false
    BindDevice.value = false
    Bindinginterval.value = false
  }

}
//关联主设备
const multipleTableMain: any = ref([])
const DataMainval: any = ref([])
const BindDevice = ref(false)
function associateMasterDevice() {
  if (info.value.stationAll == undefined) {
    ElMessage({
      message: '请选择变电站',
      type: 'warning',
    })
    return false
  }
  loadingMain.value = true
  BindDevice.value = true
  nextTick(() => {
    getbaytree()
  })
  getMainType()


}
//关联主设备-多选
function handMainChange(val: any) {
  const flag = ref(false)
  if (allData.value.length != 0) {
    for (var i = 0; i < allData.value.length; i++) {
      for (var j = 0; j < val.length; j++) {
        if (allData.value[i].stationCode == val[j].stationCode) {
          DataMainval.value = val
        } else {
          ElMessageBox.confirm('该操作会解除上一变电站所绑定的点位信息，是否继续？', '删除提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            allData.value = []
            DataMainval.value = val
          }).catch(() => {
            multipleTableMain.value!.clearSelection()
          })
          flag.value = true
          if (flag.value == true) {
            return false
          }
        }
      }
    }
  } else {
    DataMainval.value = val
  }
  // DataMainval.value = val
}
//关联主设备-添加
function addMainBinding() {
  const hasId: any = ref([])
  if (allData.value.length != 0) {
    MainvalData.value.forEach((res: any) => {
      allData.value.forEach((row: any) => {
        if (res.id == row.id) {
          hasId.value.push(res.id)
        }
      })
    })
  }
  //  let b= hasId.value.indexOf("香蕉");
  if (allData.value.length != 0 && deviceLevel.value != 2) {
    const messageBox = ref()
    if (allData.value[0].deviceId) {
      messageBox.value = '巡视点位'
    } else if (allData.value[0].componentName) {
      messageBox.value = '部件'
    } else if (allData.value[0].mainDeviceId) {
      messageBox.value = '主设备'
    } else if (allData.value[0].bayId) {
      messageBox.value = '间隔'
    }
    ElMessageBox.confirm('当前已有关联的' + messageBox.value + '信息,您确定要替换关联吗？', '删除提示', {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning'
    }).then(() => {
      // allData.value = DataMainval.value
      deviceLevel.value = 2
      allData.value = []
      allDataID.value = []
      DataMainval.value.forEach((res: any) => {
        allData.value.push(res)
      })
      for (var i = 0; i < allData.value.length - 1; i++) {
        for (var j = i + 1; j < allData.value.length; j++) {
          if (allData.value[i].mainDeviceId == allData.value[j].mainDeviceId) {
            allData.value.splice(j, 1);
            j--;
          }
        }
      }
      allData.value.forEach((row: any) => {
        allDataID.value.push(row.mainDeviceId)
      })
      ElMessage({
        type: 'success',
        message: '添加成功',
      })
    })

  } else {
    deviceLevel.value = 2
    // allData.value = DataMainval.value
    allDataID.value = []
    DataMainval.value.forEach((res: any) => {
      allData.value.push(res)
    })
    for (var i = 0; i < allData.value.length - 1; i++) {
      for (var j = i + 1; j < allData.value.length; j++) {
        if (allData.value[i].mainDeviceId == allData.value[j].mainDeviceId) {
          allData.value.splice(j, 1);
          j--;
        }
      }
    }
    // allData.value = DataMainval.value
    allData.value.forEach((row: any) => {
      allDataID.value.push(row.mainDeviceId)
    })
    ElMessage({
      type: 'success',
      message: '添加成功',
    })
  }

}

//关联部件
const DataComponentsval: any = ref([])
const multipleTableComponents: any = ref()
const BindComponents = ref(false)
function AssociatedComponents() {
  if (info.value.stationAll == undefined) {
    ElMessage({
      message: '请选择变电站',
      type: 'warning',
    })
    return false
  }
  loadingInterval.value = true
  BindComponents.value = true
  nextTick(() => {
    getbaytree()
  })



}
//关联部件-多选
function handComponentChange(val: any) {
  // DataComponentsval.value = val
  const flag = ref(false)
  if (allData.value.length != 0) {
    for (var i = 0; i < allData.value.length; i++) {
      for (var j = 0; j < val.length; j++) {
        if (allData.value[i].stationCode == val[j].stationCode) {
          DataComponentsval.value = val
        } else {
          ElMessageBox.confirm('该操作会解除上一变电站所绑定的点位信息，是否继续？', '删除提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            allData.value = []
            DataComponentsval.value = val
          }).catch(() => {
            multipleTableComponents.value!.clearSelection()
          })
          flag.value = true
          if (flag.value == true) {
            return false
          }
        }
      }
    }
  } else {
    DataComponentsval.value = val
  }
}
//关联部件-添加
function addComponentBinding() {
  const hasId: any = ref([])
  if (allData.value.length != 0) {
    componentData.value.forEach((res: any) => {
      allData.value.forEach((row: any) => {
        if (res.id == row.id) {
          hasId.value.push(res.id)
        }
      })
    })
  }
  if (allData.value.length != 0 && deviceLevel.value != 4) {
    const messageBox = ref()
    if (allData.value[0].deviceId) {
      messageBox.value = '巡视点位'
    } else if (allData.value[0].componentName) {
      messageBox.value = '部件'
    } else if (allData.value[0].mainDeviceId) {
      messageBox.value = '主设备'
    } else if (allData.value[0].bayId) {
      messageBox.value = '间隔'
    }
    ElMessageBox.confirm('当前已有关联的' + messageBox.value + '信息,您确定要替换关联吗？', '删除提示', {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning'
    }).then(() => {
      // allData.value = DataComponentsval.value
      deviceLevel.value = 4
      allData.value = []
      allDataID.value = []
      // DataComponentsval.value.forEach((res: any) => {
      //   allDataID.value.push(res.componentId)
      // })
      DataComponentsval.value.forEach((res: any) => {
        allData.value.push(res)
      })
      for (var i = 0; i < allData.value.length - 1; i++) {
        for (var j = i + 1; j < allData.value.length; j++) {
          if (allData.value[i].componentId == allData.value[j].componentId) {
            allData.value.splice(j, 1);
            j--;
          }
        }
      }
      allData.value.forEach((row: any) => {
        allDataID.value.push(row.componentId)
      })
      ElMessage({
        type: 'success',
        message: '添加成功',
      })
    })

  } else {
    // allData.value = DataComponentsval.value
    deviceLevel.value = 4
    allDataID.value = []

    DataComponentsval.value.forEach((res: any) => {
      allData.value.push(res)
    })
    for (var i = 0; i < allData.value.length - 1; i++) {
      for (var j = i + 1; j < allData.value.length; j++) {
        if (allData.value[i].componentId == allData.value[j].componentId) {
          allData.value.splice(j, 1);
          j--;
        }
      }
    }
    allData.value.forEach((row: any) => {
      allDataID.value.push(row.componentId)
    })
    // DataComponentsval.value.forEach((res: any) => {
    //   allDataID.value.push(res.componentId)
    // })
    ElMessage({
      type: 'success',
      message: '添加成功',
    })
  }
}

//关联巡视点位
const DataPointsval: any = ref([])
const multipleTablePoints: any = ref()
const Bindpoints = ref(false)
function AssociatedInspection() {
  if (info.value.stationAll == undefined) {
    ElMessage({
      message: '请选择变电站',
      type: 'warning',
    })
    return false
  }
  loadingPoints.value = true
  Bindpoints.value = true
  nextTick(() => {
    getbaytree()
  })

}
//关联巡视点位-多选
function handPointsChange(val: any) {
  DataPointsval.value = val
  const flag = ref(false)
  if (allData.value.length != 0) {
    for (var i = 0; i < allData.value.length; i++) {
      for (var j = 0; j < val.length; j++) {
        if (allData.value[i].stationCode == val[j].stationCode) {
          DataPointsval.value = val
        } else {
          ElMessageBox.confirm('该操作会解除上一变电站所绑定的点位信息，是否继续？', '删除提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            allData.value = []
            DataPointsval.value = val
          }).catch(() => {
            multipleTablePoints.value!.clearSelection()
          })
          flag.value = true
          if (flag.value == true) {
            return false
          }
        }
      }
    }
  } else {
    DataPointsval.value = val
  }
}
//关联巡视点位-添加
function addPointsBinding() {
  const hasId: any = ref([])
  if (allData.value.length != 0 && deviceLevel.value != 3) {
    const messageBox = ref()
    if (allData.value[0].deviceId) {
      messageBox.value = '巡视点位'
    } else if (allData.value[0].componentName) {
      messageBox.value = '部件'
    } else if (allData.value[0].mainDeviceId) {
      messageBox.value = '主设备'
    } else if (allData.value[0].bayId) {
      messageBox.value = '间隔'
    }
    ElMessageBox.confirm('当前已有关联的' + messageBox.value + '信息,您确定要替换关联吗？', '删除提示', {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning'
    }).then(() => {
      // allData.value = DataPointsval.value
      deviceLevel.value = 3
      allDataID.value = []
      allData.value = []
      DataPointsval.value.forEach((res: any) => {
        allData.value.push(res)
      })
      for (var i = 0; i < allData.value.length - 1; i++) {
        for (var j = i + 1; j < allData.value.length; j++) {
          if (allData.value[i].deviceId == allData.value[j].deviceId) {
            allData.value.splice(j, 1);
            j--;
          }
        }
      }
      allData.value.forEach((row: any) => {
        allDataID.value.push(row.deviceId)
      })
      ElMessage({
        type: 'success',
        message: '添加成功',
      })
    })

  } else {
    // allData.value = DataPointsval.value
    deviceLevel.value = 3
    allDataID.value = []
    DataPointsval.value.forEach((res: any) => {
      allData.value.push(res)
    })
    for (var i = 0; i < allData.value.length - 1; i++) {
      for (var j = i + 1; j < allData.value.length; j++) {
        if (allData.value[i].deviceId == allData.value[j].deviceId) {
          allData.value.splice(j, 1);
          j--;
        }
      }
    }
    allData.value.forEach((row: any) => {
      allDataID.value.push(row.deviceId)
    })
    ElMessage({
      type: 'success',
      message: '添加成功',
    })
  }

}
//关闭关联弹窗
function delBinding() {
  Bindinginterval.value = false
  BindDevice.value = false
  BindComponents.value = false
  Bindpoints.value = false
  control.value = false
  multipleTableReflist.value?.clearSelection()
  multipleTableMain.value?.clearSelection()
  multipleTableComponents.value?.clearSelection()
  multipleTablePoints.value?.clearSelection()
}
//查询巡视任务
function queryTour(val: any, type: any) {
  deviceLevel.value = type
  const parmas = {
    taskId: val,
    deviceLevel: type
  }
  QueryTour(parmas).then((res: any) => {
    if (type == 1) {
      res.data.forEach((res: any) => {
        res['id'] = res.bayId
      })
    } else if (type == 2) {
      res.data.forEach((res: any) => {
        res['id'] = res.mainDeviceId
      })
    } else if (type == 4) {
      res.data.forEach((res: any) => {
        res['id'] = res.componentId
      })
    } else if (type == 3) {
      res.data.forEach((res: any) => {
        res['id'] = res.deviceId
      })
    }
    allData.value = res.data
  })
}
//关联删除
function delTour(row: any) {
  allDataID.value.length = 0
  for (var i = 0; i < allData.value.length; i++) {
    if (allData.value[i].id == row.id) {
      allData.value.splice(i, 1);
      allData.value.forEach((res: any) => {
        allDataID.value.push(res.id)
      })
      ElMessage({
        type: 'success',
        message: '删除成功',
      })
    }
  }
}
//控制行变色
const tableRowClassName = ({
  row,
  rowIndex,
}: {
  row: any
  rowIndex: number
}) => {
  if (rowIndex % 2 === 0) {
    return 'warning-row'
  } else if (rowIndex % 2 === 1) {
    return 'success-row'
  }
  return ''
}
// //控制行变色
// const tableRowClassName = ({
//     row,
//     rowIndex,
// }: {
//     row: any
//     rowIndex: number
// }) => {
//     if (rowIndex % 2 === 0) {
//         return 'warning-row'
//     } else if (rowIndex % 2 === 1) {
//         return 'success-row'
//     }
//     return ''
// }

//获取tabbas数据
onMounted(() => {
  getData()
  getarrType()
  GetSelect()
  getrobotUAV()
  gettoday()
});
function gettoday() {
  // 获取今天0点
  let startTime = dayjs().startOf('day').format('YYYY-MM-DD HH:mm:ss')
  // 获取当前时间
  let endTime = dayjs().format('YYYY-MM-DD HH:mm:ss')
  tableData.value[0] = startTime
  tableData.value[1] = endTime
}
//新增优先级回显  
function changeType(row: any) {
  info.value.priority = row
}
//获取任务优先级和类型
//任务类型
const TaskType: any = ref([])
const TaskType1: any = ref([])
const TaskTypeOne: any = ref([])
// 优先级
const priority: any = ref([])
function getarrType() {
  TaskType1.value.length = 0
  const params = {
    dictcode: 'TaskType'
  }
  getDeviceByType(params).then((res: any) => {
    res.data.forEach((res: any) => {
      if (res.itemcode == 1 || res.itemcode == 3) {
        TaskType1.value.push(res)
      }
      if (res.itemcode == 1 || res.itemcode == 3 || res.itemcode == 4) {
        TaskTypeOne.value.push(res)
      }
    });
    TaskType.value = Array.from(new Set(TaskTypeOne.value))

  })
  const paramstype = {
    dictcode: 'TaskPriority'
  }
  getDeviceByType(paramstype).then((res: any) => {
    priority.value = res.data
  })
}


// cron表达式-弹窗
const cycleTime = ref(false)
const index = ref()
//时间周期 - 弹窗
function cycleCron() {
  cycleTime.value = true
  index.value = 1
  Echo()
}
//时间周期弹窗-取消
function Closeassign() {
  cycleTime.value = false
}
//时间周期表达式-单选
//秒
const second = ref()
//分
const divide = ref()
//时
const time = ref()
//日
const sun = ref()
//月
const moon = ref()
//周
const week = ref()
//时间周期-周期-时
const periodtime = ref({
  periodInput3: '0',
  periodInput4: '2'
})
//时间周期-周期-日
const periodsun = ref({
  periodInput3: '1',
  periodInput4: '1',
})
////时间周期-指定-秒
const checkListsecond = ref([])
const appointsecond = ref(['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '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'])
////时间周期-指定-分
const checkListdivide = ref([])
const appointdivide = ref(['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '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'])
////时间周期-指定-时
const checkListtime = ref([])
const appointtime1 = ref(['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11'])
const appointtime2 = ref(['12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23',])
////时间周期-指定-月
const checkListmoon = ref([])
const appointmoon = ref(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12',])
////时间周期-指定-周
const checkListweek: any = ref([])
const appointweek = ref(['日', '一', '二', '三', '四', '五', '六'])
//多选 - 秒
function ahangesecond() {
  rediosecond(4)
}
//表达式字段
const field = ref({
  fieldsecond: '*',
  fielddivide: '*',
  fieldtime: '*',
  fieldsun: '?',
  fieldmoon: '*',
  fieldweek: '?',
  fieldyear: '',
})
//表达式
const resentation = ref('***?*?')
//时间周期
//秒
const secondarr: any = ref([])
function rediosecond(val: any) {
  second.value = val
  if (val == 4) {
    const arraysecond: any = ref([])
    if (checkListsecond.value.length == 2) {
      checkListsecond.value.shift()
    }
    secondarr.value = JSON.parse(JSON.stringify(checkListsecond.value))
    secondarr.value.forEach((item: any) => {
      arraysecond.value.push(parseInt(item))
    })
    if (arraysecond.value.toString()) {
      field.value.fieldsecond = arraysecond.value.toString()
    }

  }

}
//分
const dividearr: any = ref([])
function rediodivide(val: any) {
  divide.value = val
  if (val == 4) {

    const arraysecond: any = ref([])
    // if (checkListdivide.value.length == 2) {
    //   checkListdivide.value.shift()
    // }
    dividearr.value = JSON.parse(JSON.stringify(checkListdivide.value))
    dividearr.value.forEach((item: any) => {
      arraysecond.value.push(parseInt(item))
    })
    if (arraysecond.value.toString()) {
      field.value.fielddivide = arraysecond.value.toString()
    }
  }
}
//时
const timearr: any = ref([])
function rediodtime(val: any) {
  time.value = val
  if (val == 3) {
    field.value.fieldtime = periodtime.value.periodInput3 + '/' + periodtime.value.periodInput4
    checkListtime.value = []
  } else if (val == 4) {

    const arraysecond: any = ref([])
    // if (checkListtime.value.length == 2) {
    //   checkListtime.value.shift()
    // }
    timearr.value = JSON.parse(JSON.stringify(checkListtime.value))
    timearr.value.forEach((item: any) => {
      arraysecond.value.push(parseInt(item))
    })
    if (arraysecond.value.toString()) {
      field.value.fieldtime = arraysecond.value.toString()
    }
  }
}
//日
function rediodsun(val: any) {
  sun.value = val
  if (val == 2) {
    field.value.fieldsun = '?'
  } else if (val == 4) {
    field.value.fieldsun = periodsun.value.periodInput3 + '/' + periodsun.value.periodInput4
  }
}
//月
function rediodmoon(val: any) {
  moon.value = val
  if (val == 1) {
    field.value.fieldmoon = '*'
    checkListmoon.value = []
  } else if (val == 4) {
    const secondarr: any = ref([])
    const arraysecond: any = ref([])
    secondarr.value = JSON.parse(JSON.stringify(checkListmoon.value))
    secondarr.value.forEach((item: any) => {
      arraysecond.value.push(parseInt(item))
    })
    if (arraysecond.value.toString()) {
      field.value.fieldmoon = arraysecond.value.toString()
    }
  }
}
//周
function rediodweek(val: any) {
  week.value = val
  if (val == 2) {
    field.value.fieldweek = '?'
    checkListweek.value = []
  } else if (val == 6) {
    const secondarr: any = ref([])
    const arraysecond: any = ref([])
    secondarr.value = JSON.parse(JSON.stringify(checkListweek.value))
    secondarr.value.forEach((res: any, index: any) => {
      if (res == '日') {
        secondarr.value[index] = 1
      } else if (res == '一') {
        secondarr.value[index] = 2
      } else if (res == '二') {
        secondarr.value[index] = 3
      } else if (res == '三') {
        secondarr.value[index] = 4
      } else if (res == '四') {
        secondarr.value[index] = 5
      } else if (res == '五') {
        secondarr.value[index] = 6
      } else if (res == '六') {
        secondarr.value[index] = 7
      }
    })
    secondarr.value.forEach((item: any) => {
      arraysecond.value.push(parseInt(item))
    })
    if (arraysecond.value.toString()) {
      field.value.fieldweek = arraysecond.value.toString()
    } else {
      field.value.fieldweek = '*'
    }
  }
}
//拼接表达式字段
function montage() {
  resentation.value = field.value.fieldsecond + ' ' + field.value.fielddivide + ' ' + field.value.fieldtime + ' ' + field.value.fieldsun + ' ' + field.value.fieldmoon + ' ' + field.value.fieldweek + ' ' + field.value.fieldyear
}
//时间周期弹窗-确定
function assignment() {
  if (timearr.value.indexOf("/") != -1) {
    cronValue.value.cycleExecuteTime = timearr.value.toString() + ':' + dividearr.value.toString() + ':' + secondarr.value.toString()
  } else {
    var Timetype = ref()
    if (periodtime.value.periodInput3 < '9') {
      Timetype.value = '0' + periodtime.value.periodInput3
    } else {
      Timetype.value = periodtime.value.periodInput3
    }
    cronValue.value.cycleExecuteTime = Timetype.value + ':' + dividearr.value.toString() + ':' + secondarr.value.toString()
  }

  if (field.value.fieldmoon == '*') {
    cronValue.value.cycleMonth = appointmoon.value.toString()
  } else {
    cronValue.value.cycleMonth = field.value.fieldmoon
  }
  if (field.value.fieldweek == '*') {
    cronValue.value.cycleWeek = appointweek.value.toString()
  } else if (field.value.fieldweek == '?') {
    cronValue.value.cycleWeek = ''
  } else {
    cronValue.value.cycleWeek = field.value.fieldweek
  }
  if (sun.value == 4) {
    cronValue.value.intervalNumber = periodsun.value.periodInput4
  } else if (time.value == 3) {
    cronValue.value.intervalNumber = periodtime.value.periodInput4
  }
  if (sun.value == 4) {
    cronValue.value.intervalType = '2'
  } else if (time.value == 3) {
    cronValue.value.intervalType = '1'
  }
  cronValue.value.intervalExecuteTime = cronValue.value.cycleExecuteTime
  if (sun.value == 4) {
    cronValue.value.intervalStartTime = periodsun.value.periodInput3
  } else if (time.value == 3) {
    cronValue.value.intervalStartTime = periodtime.value.periodInput3
  }
  if (sun.value == 4) {
    cronValue.value.intervalEndTime = '31'
  } else if (time.value == 3) {
    cronValue.value.intervalEndTime = '24'
  }
  if (field.value.fieldsecond == '*' || field.value.fielddivide == '*' || field.value.fieldtime == '*') {
    ElMessage({
      type: 'warning',
      message: '请选择时，分，秒',
    })
    return false
  }
  if (field.value.fieldsun == '?' && field.value.fieldweek == '?') {
    ElMessage({
      type: 'warning',
      message: '日和周不支持都选择不指定，请重新选择',
    })
    return false
  }



  if (resentation.value !== '') {
    info.value.cronValue = resentation.value
  } else {
    info.value.cronValue = field.value.fieldsecond + ' ' + field.value.fielddivide + ' ' + field.value.fieldtime + ' ' + field.value.fieldsun + ' ' + field.value.fieldmoon + ' ' + field.value.fieldweek + ' ' + field.value.fieldyear
  }

  cycleTime.value = false
}
//时间周期回显
function Echo() {
  resentation.value = info.value.cronValue
  if (info.value.cronValue == '') {
    second.value = ''
    divide.value = ''
    time.value = ''
    sun.value = ''
    moon.value = ''
    week.value = ''
    checkListsecond.value = []
    checkListdivide.value = []
    checkListtime.value = []
    checkListmoon.value = []
    checkListweek.value = []
    resentation.value = ''
    field.value = {
      fieldsecond: '*',
      fielddivide: '*',
      fieldtime: '*',
      fieldsun: '*',
      fieldmoon: '*',
      fieldweek: '?',
      fieldyear: '',
    }
  } else {
    const arrEcho = JSON.parse(JSON.stringify(info.value.cronValue))
    const arrayEcho = arrEcho.split(" ");
    //秒
    if (arrayEcho[0] == '*') {
      second.value = ''
      checkListsecond.value = []
      field.value.fieldsecond = '*'
    } else if (arrayEcho[0] != '*') {
      second.value = 4
      field.value.fieldsecond = arrayEcho[0]

      const secondArr = arrayEcho[0].split(",");
      const secondARR: any = ref([])
      secondArr.forEach((item: any) => {
        item = '0' + item
        secondARR.value.push(item)
      })
      checkListsecond.value = secondARR.value
    }
    //分
    if (arrayEcho[1] == '*') {
      divide.value = ''
      checkListdivide.value = []
      field.value.fielddivide = '*'
    } else if (arrayEcho[1] != '*') {
      divide.value = 4
      field.value.fielddivide = arrayEcho[1]
      const secondArr = arrayEcho[1].split(",");
      const secondARR: any = ref([])
      secondArr.forEach((item: any) => {
        if (item < 10) {
          item = '0' + item
        }
        secondARR.value.push(item)
      })
      checkListdivide.value = secondARR.value
    }
    //时
    if (arrayEcho[2] == '*') {
      time.value = ''
      checkListtime.value = []
      field.value.fieldtime = '*'
    } else if (arrayEcho[2].indexOf("/") != -1) {
      time.value = 3
      field.value.fieldtime = arrayEcho[2]
      checkListtime.value = []
      const secondArr = arrayEcho[2].split("/");
      periodtime.value.periodInput3 = secondArr[0]
      periodtime.value.periodInput4 = secondArr[1]
    } else if (arrayEcho[2].indexOf("/") == -1 && arrayEcho[2] != '*') {
      time.value = 4
      field.value.fieldtime = arrayEcho[2]
      const secondArr = arrayEcho[2].split(",");
      const secondARR: any = ref([])

      secondArr.forEach((item: any) => {
        if (item < 10) {
          item = '0' + item
        }
        // item = '0' + item
        secondARR.value.push(item)
      })
      checkListtime.value = secondARR.value
    }
    //日
    if (arrayEcho[3] == '?') {
      sun.value = 2
      field.value.fieldsun = '?'
    } else if (arrayEcho[3].indexOf("/") != -1) {
      sun.value = 4
      field.value.fieldsun = arrayEcho[3]
      const secondArr = arrayEcho[3].split("/");
      periodsun.value.periodInput3 = secondArr[0]
      periodsun.value.periodInput4 = secondArr[1]
    }
    //月
    if (arrayEcho[4] == '*') {
      moon.value = 1
      checkListmoon.value = []
      field.value.fieldmoon = '*'
    } else if (arrayEcho[4] != '*') {
      moon.value = 4
      field.value.fieldmoon = arrayEcho[4]
      const secondArr = arrayEcho[4].split(",");

      checkListmoon.value = secondArr
    }
    //周
    if (arrayEcho[5] == '?') {
      week.value = 2
      checkListweek.value = []
      field.value.fieldweek = '?'
    } else if (arrayEcho[5] != '?') {
      week.value = 6
      field.value.fieldweek = arrayEcho[5]
      const secondArr = arrayEcho[5].split(",");
      checkListweek.value = secondArr
      checkListweek.value.forEach((res: any, index: any) => {
        if (res == 1) {
          checkListweek.value[index] = '日'
        } else if (res == 2) {
          checkListweek.value[index] = '一'
        } else if (res == 3) {
          checkListweek.value[index] = '二'
        } else if (res == 4) {
          checkListweek.value[index] = '三'
        } else if (res == 5) {
          checkListweek.value[index] = '四'
        } else if (res == 6) {
          checkListweek.value[index] = '五'
        } else if (res == 7) {
          checkListweek.value[index] = '六'
        }
      })
    }
  }
}
//监听表达式变化
watch(() => field, (newValue, oldValue) => {
  montage()
}, { deep: true })

// cron表达式所传参数
const cronValue = ref({
  cycleMonth: '',
  cycleWeek: '',
  cycleExecuteTime: '',
  intervalNumber: '',
  intervalType: '',
  intervalExecuteTime: '',
  intervalStartTime: '',
  intervalEndTime: ''
})
function tabClick(e: any) {

}
//更改时间格式
function dateFormat(row: any) {
  const daterc = row;
  if (daterc != null) {
    var date = new Date(daterc);
    var year = date.getFullYear();
    var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
    date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
    var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
    var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
    var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
    var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
    // 拼接
    return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
  }
}
const stationIds = ref()
const open = () => {
  optionSelect.value.forEach((row: any) => {
    if (row.stationId == info.value.stationAll) {
      stationIds.value = row.stationCode
    }
  })
  allData.value.forEach((res: any) => {
    if (res.stationCode == stationIds.value) {
    } else {
      ElMessageBox({
        title: '提示',
        message: '请重新绑定关联设备信息'
      })
    }
  })

}
</script>

<template>
  <div style="padding: 0 15px;">
    <!-- <Seccmsdialog v-if="Bindinginterval" :title="'aaaa'" :width="'90vh'" @before-close="delBinding" >
      <template v-slot:PopFrameContent>
			我是需要子组件展示的内容1
  		</template>
</Seccmsdialog> -->
    <div class="modeltopbox"></div>
    <section class="silderRight">
      <div>
        <el-tabs v-model="activeName" @tab-change="handleClick">
          <el-tab-pane name="1">
            <template #label>
              <span class="custom-tabs-label">
                <svg style="margin-right:5px" version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg"
                  xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16" height="16" viewBox="0 0 16 16"
                  xml:space="preserve">
                  <path class="st0" d="M14,6.3V1.5H1.3v13.2H8c0.3,0,0.5,0.2,0.6,0.4c0,0,0,0,0,0c0.2,0.5-0.1,1-0.6,1H0.5c-0.3,0-0.6-0.3-0.6-0.6V0.7
                                  c0-0.3,0.3-0.6,0.6-0.6h14.3c0.3,0,0.6,0.3,0.6,0.6v5.6c0,0.4-0.3,0.7-0.7,0.7C14.3,7,14,6.7,14,6.3L14,6.3z M8.7,4.4h3.4
                                  c0.4,0,0.7,0.3,0.7,0.7c0,0.4-0.3,0.7-0.7,0.7H8.7c-0.4,0-0.7-0.3-0.7-0.7C7.9,4.8,8.3,4.4,8.7,4.4z M2.5,5.1c0.2-0.3,0.7-0.4,1-0.1
                                  c0.2,0.2,0.5,0.2,0.7,0l1.2-1.2c0.3-0.3,0.7-0.3,1,0.1l0,0c0.2,0.3,0.2,0.6-0.1,0.9L4.3,6.8C4.2,6.9,4.1,7,3.9,7S3.6,6.9,3.5,6.8
                                  L2.6,5.9C2.4,5.7,2.3,5.3,2.5,5.1z M2.5,9.6c0.2-0.3,0.7-0.4,1-0.1c0.2,0.2,0.5,0.2,0.7,0l1.2-1.2c0.3-0.3,0.7-0.3,1,0.1l0,0
                                  c0.2,0.3,0.2,0.6-0.1,0.9l-2.1,2.1c-0.1,0.1-0.3,0.2-0.4,0.2c-0.2,0-0.3-0.1-0.4-0.2l-0.9-0.9C2.4,10.3,2.3,9.9,2.5,9.6z M12.7,11.8
                                  h-2.3c0,0,0,0.1,0,0.1v2.7h2.3v-2.7C12.7,11.9,12.7,11.8,12.7,11.8z M13.2,10.2l0.2-0.3c0.2-0.3,0-0.7-0.4-0.7h-3
                                  c-0.3,0-0.5,0.4-0.4,0.7l0.2,0.3c0.1,0.1,0.2,0.2,0.4,0.2h2.7C13,10.4,13.2,10.3,13.2,10.2z M9.3,15.4V12c0-0.1,0-0.2-0.1-0.3
                                  L7.2,8.3C7.2,8.2,7.2,8.1,7.2,8c0.1-0.1,0.1-0.1,0.3-0.1h8.1c0.1,0,0.2,0.1,0.3,0.1c0.1,0.1,0,0.2,0,0.3l-1.9,3.4
                                  c-0.1,0.1-0.1,0.2-0.1,0.3v3.4c0,0.3-0.3,0.6-0.6,0.6H9.8C9.5,16,9.3,15.8,9.3,15.4z"
                    fill="currentColor" />
                </svg>
                <span>例行巡视</span>
              </span>
            </template>
          </el-tab-pane>
          <el-tab-pane name="2">
            <template #label><span class="custom-tabs-label">
                <svg style="margin-right:5px" version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg"
                  xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16" height="16" viewBox="0 0 16 16"
                  xml:space="preserve">
                  <title>特殊巡视</title>
                  <path class="st0"
                    d="M10.3,14.5H1.7c-0.2,0-0.4-0.2-0.4-0.4V2.7c0-0.2,0.2-0.4,0.4-0.4C2,2.3,2.3,2,2.3,1.7S2,1,1.7,1
                                  C0.7,1,0,1.8,0,2.7v11.4c0,0.9,0.8,1.7,1.7,1.7h8.7c0.4,0,0.6-0.3,0.6-0.6C11,14.8,10.7,14.5,10.3,14.5z"
                    fill="currentColor" />
                  <path class="st0" d="M13,2.3L13,2.3c0.3,0,0.4,0.2,0.4,0.4v6c0,0.4,0.3,0.6,0.6,0.6v0c0.4,0,0.6-0.3,0.6-0.6v-6
                                  C14.7,1.8,13.9,1,13,1h0c-0.4,0-0.6,0.3-0.6,0.6S12.6,2.3,13,2.3z"
                    fill="currentColor" />
                  <rect x="4.8" y="0.7" class="st0" width="4.9" height="1.3" fill="currentColor" />
                  <rect x="2.9" y="-0.2" class="st0" width="1.3" height="2.3" fill="currentColor" />
                  <rect x="10.3" y="-0.2" class="st0" width="1.3" height="2.3" fill="currentColor" />
                  <path class="st0" d="M15.5,12.7c-0.1-0.2-0.3-0.4-0.6-0.4h-2.7l0.8-0.8c0.3-0.3,0.3-0.6,0-0.9c-0.2-0.3-0.6-0.3-0.9,0l-1.9,1.9
                                  c-0.2,0.2-0.2,0.5-0.1,0.7c0.1,0.2,0.3,0.4,0.6,0.4h2.7l-0.7,0.7c-0.3,0.3-0.3,0.6,0,0.9c0.1,0.1,0.3,0.2,0.5,0.2
                                  c0.2,0,0.3-0.1,0.5-0.2l1.8-1.8C15.6,13.2,15.6,13,15.5,12.7z" fill="currentColor" />
                  <path class="st0"
                    d="M3.3,6h7.9c0.4,0,0.6-0.3,0.6-0.6c0-0.4-0.3-0.6-0.6-0.6H3.3C2.9,4.7,2.7,5,2.7,5.3C2.7,5.7,2.9,6,3.3,6z"
                    fill="currentColor" />
                  <path class="st0" d="M3.3,12.4h2.5c0.4,0,0.6-0.3,0.6-0.6c0-0.4-0.3-0.6-0.6-0.6H3.3c-0.4,0-0.6,0.3-0.6,0.6
                                  C2.7,12.1,2.9,12.4,3.3,12.4z" fill="currentColor" />
                  <path class="st0"
                    d="M3.3,9.2h7.4c0.4,0,0.6-0.3,0.6-0.6S11,7.9,10.7,7.9H3.3c-0.4,0-0.6,0.3-0.6,0.6S2.9,9.2,3.3,9.2z"
                    fill="currentColor" />
                </svg>
                <span>特殊巡视</span>
              </span>
            </template>
          </el-tab-pane>
          <el-tab-pane name="3">
            <template #label>
              <span class="custom-tabs-label">
                <svg style="margin-right:5px" version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg"
                  xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16" height="16" viewBox="0 0 16 16"
                  xml:space="preserve">
                  <path class="st0"
                    d="M1.9,14.8c-0.1-0.1-0.2-0.3-0.2-0.5V1.8c0-0.2,0.1-0.4,0.2-0.5C2,1.1,2.2,1,2.4,1h7.4v2.5
                                  c0,0.8,0.7,1.5,1.5,1.5h2.5l0,1.1h1l0-2.1l-4-4.1H2.1C1.3,0,0.7,0.7,0.6,1.5v12.9c0,0.8,0.7,1.5,1.5,1.5h6.3l0-1H2.4
                                  C2.2,15,2,14.9,1.9,14.8z M10.8,1.2l2.8,2.9h-2.1c-0.2,0-0.4-0.1-0.5-0.2c-0.1-0.1-0.2-0.3-0.2-0.5L10.8,1.2z"
                    fill="currentColor" />
                  <path class="st0" d="M7.9,7.8L7.9,7.8l-4.1,0c-0.3,0-0.6,0.2-0.6,0.5c0,0.3,0.2,0.5,0.6,0.5h4.1c0.3,0,0.6-0.2,0.6-0.5
                                  C8.4,8.1,8.2,7.8,7.9,7.8z" fill="currentColor" />
                  <path class="st0" d="M14.5,7.3h-3.8c-0.5,0-1,0.4-1,1v6.4c0,0.5,0.4,1,1,1c0,0,0.1,0,0.2-0.1c0,0,1.7-1.7,1.7-1.7s1.6,1.7,1.7,1.7
                                  c0.1,0.1,0.2,0.1,0.2,0.1c0.5,0,1-0.4,1-1V8.2C15.5,7.7,15,7.3,14.5,7.3z M14.5,14.2c0,0.1-0.1,0.2-0.2,0.2l-1.8-1.6l-1.8,1.6
                                  c-0.1,0-0.2-0.1-0.2-0.2V8.4c0-0.1,0.1-0.2,0.2-0.2h3.5c0.1,0,0.2,0.1,0.2,0.2V14.2z"
                    fill="currentColor" />
                  <path class="st0" d="M3.7,10.8c-0.3,0-0.6,0.2-0.6,0.5c0,0.3,0.2,0.5,0.6,0.5h4.1c0.3,0,0.6-0.2,0.6-0.5c0-0.3-0.2-0.5-0.6-0.5H3.7
                                  z" fill="currentColor" />
                </svg>
                <span>专项巡视</span>
              </span>
            </template>
          </el-tab-pane>
          <el-tab-pane name="4">
            <template #label>
              <span class="custom-tabs-label">
                <svg style="margin-right:5px" version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg"
                  xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16" height="16" viewBox="0 0 16 16"
                  xml:space="preserve">
                  <title>自定义巡视</title>
                  <path class="st0" d="M13.8,9.2c-0.3,0-0.6,0.3-0.6,0.6v4.9H2.1V1.2h9l2.1,2.3v2c0,0.3,0.3,0.6,0.6,0.6c0.3,0,0.6-0.3,0.6-0.6V3.3
                                    c0-0.2-0.1-0.3-0.2-0.4l-2.5-2.7C11.7,0.1,11.5,0,11.3,0H1.5C1.2,0,0.9,0.3,0.9,0.6v14.8c0,0.3,0.3,0.6,0.6,0.6h12.3
                                    c0.3,0,0.6-0.3,0.6-0.6V9.8C14.4,9.5,14.1,9.2,13.8,9.2z" fill="currentColor" />
                  <path class="st0" d="M15.5,6.4c-0.2-0.3-0.6-0.3-0.9-0.1l-8.6,6.2c0,0,0,0,0,0c-0.3,0.2-0.3,0.6-0.1,0.9c0.1,0.2,0.3,0.3,0.5,0.3
                                    c0.1,0,0.3,0,0.4-0.1l8.6-6.2C15.7,7.1,15.7,6.7,15.5,6.4z" fill="currentColor" />
                  <path class="st0"
                    d="M8.9,3.7H4C3.6,3.7,3.3,4,3.3,4.3c0,0.3,0.3,0.6,0.6,0.6h4.9c0.3,0,0.6-0.3,0.6-0.6C9.5,4,9.2,3.7,8.9,3.7z"
                    fill="currentColor" />
                  <path class="st0"
                    d="M8.9,7.4H4C3.6,7.4,3.3,7.7,3.3,8S3.6,8.6,4,8.6h4.9c0.3,0,0.6-0.3,0.6-0.6S9.2,7.4,8.9,7.4z"
                    fill="currentColor" />
                </svg>
                <span>自定义巡视</span>
              </span>
            </template>
          </el-tab-pane>
          <el-tab-pane name="5">
            <template #label>
              <span class="custom-tabs-label">
                <svg style="margin-right:5px" t="1692839864618" class="icon" viewBox="0 0 1024 1024" version="1.1"
                  xmlns="http://www.w3.org/2000/svg" p-id="4060" xmlns:xlink="http://www.w3.org/1999/xlink" width="16"
                  height="16">
                  <title>熄灯巡视</title>
                  <path
                    d="M655.536 945.967h-275.53a9 9 0 0 0-9.18 8.68v34.672c0 19.18 16.41 34.681 36.74 34.681h220.419c20.32 0 36.741-15.5 36.741-34.681v-34.672a9 9 0 0 0-9.19-8.68z m50.522-77.003H365.475l-36.001-166.266c-180.087-104.004-241.77-334.313-137.765-514.4S526.02-53.47 706.108 50.535a376.564 376.564 0 0 1 188.237 326.012c0 136.125-71.543 259.01-188.287 326.162z m-277.66-78.003h199.637V655.116l21.75-10.75c102.705-50.742 166.537-153.346 166.537-267.83a296.421 296.421 0 0 0-87.473-211.078c-112.774-112.844-309.372-112.844-422.136 0a296.391 296.391 0 0 0-87.483 211.078c0 112.464 62.262 214.298 162.456 265.77l16.42 8.42z"
                    fill="currentColor" p-id="4061"></path>
                  <path d="M43.515 57.176l974.212 562.46-37.242 64.505L6.274 121.681z" fill="currentColor" p-id="4062">
                  </path>
                </svg>
                <span>熄灯巡视</span>
              </span>
            </template>
          </el-tab-pane>
        </el-tabs>
      </div>
      <div
        style="display: flex;display: -webkit-flex; justify-content: space-between; -webkit-justify-content: space-between;  margin:0px 0px 15px 0px">
        <div style="display: flex;display: -webkit-flex; align-items: center;">
          <el-input v-model="taskName" placeholder="请输入巡视任务名称" clearable @clear="getData()" @keyup.enter="getData()"
            style="margin-right:10px ;width: 200px;" />
          <el-select clearable v-model="SearchBox.enable" placeholder="启动状态" style="margin-right:10px ;width: 150px;"
            @change="getData()">
            <el-option v-for="item in startUsing" :key="item.value" :label="item.label" :value="item.value" />
          </el-select>
          <el-select clearable v-model="SearchBox.taskType" placeholder="任务类型" style="margin-right:10px ;width: 150px;"
            @change="getData()">
            <span v-if="activeName == 2"><el-option v-for="item in TaskType" :key="item.id" :label="item.dictname"
                :value="item.itemcode" /></span>
            <span v-else><el-option v-for="item in TaskType1" :key="item.id" :label="item.dictname"
                :value="item.itemcode" /></span>
          </el-select>
          <el-select clearable v-model="SearchBox.taskTodoType" placeholder="执行方式"
            style="margin-right:10px ;width: 150px;" @change="getData()">
            <el-option v-for="item in ExecutionMethod" :key="item.value" :label="item.label" :value="item.value" />
          </el-select>
          <el-date-picker popper-class="elDatePicker" style="width: 300px; margin-right: 10px;" v-model="tableData"
            type="daterange" range-separator="至" start-placeholder="开始日期" @change="dataChange" end-placeholder="结束日期"
            value-format="YYYY-MM-DD" format="YYYY-MM-DD" />
          <el-button class="searchButton" @click="getData()">搜索</el-button>
          <el-button class="searchButton" @click="resetting()">重置</el-button>
        </div>
        <div>
          <el-button v-hasPerm="['add:task']" class="searchButton" @click="addClick">
            新增</el-button>
          <!-- <el-button class="searchButton" v-hasPerm="['add:task']" @click="patroltask" :disabled="deviceInfos.length == 0"
            :type="deviceInfos.length > 0 ? 'primary' : ''">
            上报</el-button> -->
          <el-button class="searchButton" v-hasPerm="['del:task']" @click="delClick" :disabled="deviceInfos.length == 0"
            :type="deviceInfos.length > 0 ? 'primary' : ''">
            删除</el-button>
        </div>

      </div>
      <div>
        <el-table ref="multipleTableRef" :data="tableDataList" style="width: 100%;margin-bottom: 10px;height: calc(70vh);
                  overflow: auto;" :header-cell-style="tableBg" stripe @selection-change="handleSelectionChange"
          :row-class-name="tableRowClassName" v-loading="treeloading">
          <el-table-column type="selection" width="30" align="center" />
          <el-table-column type="index" label="序号" width="50px" align="center" />
          <el-table-column property="stationName" label="变电站名称" align="center">
            <template #default="scope">
              <span>{{ scope.row.stationName }} <span style="display: inline-block;color: #409EFF;"
                  v-if="scope.row.isStationFlag == '1'">(边缘节点)</span></span>
            </template>
          </el-table-column>
          <el-table-column property="taskCode" label="任务编码" align="center" />
          <el-table-column property="taskName" label="任务名称" align="center" />
          <el-table-column property="taskType" label="任务类型" width="130px" align="center">
            <template #default="scope">
              <span v-if="scope.row.taskType == 1">站端日常巡视任务</span>
              <span v-else-if="scope.row.taskType == 2">上级系统控制</span>
              <span v-else-if="scope.row.taskType == 3">区域巡视系统控制</span>
              <span v-else-if="scope.row.taskType == 4">主辅设备联动</span>
              <span v-else>--</span>
            </template>
          </el-table-column>
          <el-table-column property="fixedStartTime" label="开始时间" width="170px" align="center">
            <template #default="scope">
              <span v-if="scope.row.fixedStartTime">{{ scope.row.fixedStartTime }}</span>
              <span v-else>--</span>
            </template>
          </el-table-column>

          <el-table-column label="优先级" width="105px" align="center">
            <template #default="scope">
              <span v-if="scope.row.priority != ''">{{ "优先级" + scope.row.priority }}</span>
              <span v-else>--</span>
            </template>
          </el-table-column>
          <el-table-column property="taskTodoType" label="执行方式" width="100px" align="center">
            <template #default="scope">
              <span v-if="scope.row.taskTodoType == 1">立即执行</span>
              <span v-else-if="scope.row.taskTodoType == 2">定时执行</span>
              <span v-else-if="scope.row.taskTodoType == 3">周期执行</span>
              <span v-else>--</span>
            </template>
          </el-table-column>
          <el-table-column label="上报状态" width="100px" align="center">
            <template #default="scope">
              <span v-if="scope.row.isReport == 1"> <span
                  style="display: flex; align-items: center;justify-content: center;"><img
                    src="@/assets/newimg/u387.png" alt=""> <span
                    style="color: rgb(0, 249, 162);display: inline-block;margin-left:5px ;">已上报</span></span></span>
              <span v-else><span style="display: flex; align-items: center;justify-content: center;"><img
                    src="@/assets/MenuIcon/u448.png" alt="">
                  <span style="color:#FF9900;display: inline-block;margin-left:5px ;">未上报</span></span></span>
            </template>
          </el-table-column>
          <el-table-column property="deviceList" label="关联状态" width="100px" align="center">
            <template #default="scope">
              <span v-if="scope.row.deviceList"> <span
                  style="display: flex; align-items: center;justify-content: center;"><img
                    src="@/assets/newimg/u387.png" alt=""><span
                    style="color: rgb(0, 249, 162);display: inline-block;margin-left:5px ;">已关联</span></span> </span>
              <span v-else> <span style="display: flex; align-items: center;justify-content: center;"><img
                    src="@/assets/MenuIcon/u448.png" alt=""> <span
                    style="color:#FF9900;display: inline-block;margin-left:5px ;">未关联</span></span> </span>
            </template>
          </el-table-column>
          <el-table-column property="datastatus" label="复核状态" width="110px" align="center">
            <template #default="scope">
              <span v-if="scope.row.datastatus == 2"><span
                  style="display: flex; align-items: center;justify-content: center;"><img
                    src="@/assets/newimg/u387.png" alt=""><span
                    style="color: rgb(0, 249, 162);display: inline-block;margin-left:5px ;">复核生效</span></span></span>
              <span v-else-if="scope.row.datastatus == 1"><span
                  style="display: flex; align-items: center;;justify-content: center;"><img
                    src="@/assets/MenuIcon/u455.png" alt=""><span
                    style="color: #409EFF;display: inline-block;margin-left:5px ;">初始创建</span></span></span>
            </template>
          </el-table-column>
          <el-table-column property="isenable" label="任务状态" width="100px" align="center">
            <template #default="scope">
              <el-switch v-model="scope.row.isenable" active-value="1"
                :inactive-value="scope.row.isenable == '0' ? '0' : '2'" @change="verification(scope.row, scope.$index)"
                style="margin-right: 4px"
                :disabled="scope.row.datastatus == 1 || scope.row.deviceList == null || scope.row.isenable == 2"></el-switch>
              <span v-if="scope.row.isenable == 1" class="effective">启动</span>
              <span v-else-if="scope.row.isenable == 0" style="color: #d7d7d7">停止</span>
              <span v-else-if="scope.row.isenable == 2" style="color: #d7d7d7">终止</span>
            </template>
          </el-table-column>
          <el-table-column property="address" label="操作" width="160px" align="center">
            <template #default="scope">
              <span
                style="display: flex;display: -webkit-flex; justify-content: space-around;-webkit-justify-content: space-around; ">
                <img v-hasPerm="['update:task']" src="@/assets/newimg/ht_xg.png" v-if="scope.row.datastatus == 1"
                  :title="scope.row.datastatus == 1 ? '修改' : '查看'" @click="handleEdit(scope.row)"
                  style="cursor: pointer;">
                <img v-hasPerm="['update:task']" src="@/assets/newimg/ht_wxjl.png"
                  :title="scope.row.datastatus == 1 ? '修改' : '查看'" v-else @click="handleEdit(scope.row)"
                  style="cursor: pointer;">
                <!-- <img v-hasPerm="['update:task']" v-if="scope.row.datastatus == 2"
                    src="@/assets/MenuIcon/u470_disabled.png" title="修改" style="cursor: pointer;"> -->
                <img v-if="scope.row.datastatus == 1" src="@/assets/tableIcon/ht_gl.png" title="关联设置"
                  @click="handleEdit(scope.row), tabs = 2" style="cursor: pointer;">
                <img v-if="scope.row.datastatus == 2" src="@/assets/tableIcon/ht_gl1.png" title="关联设置"
                  style="cursor: no-drop;">
                <img v-if="scope.row.datastatus == 1 && scope.row.deviceList" src="@/assets/tableIcon/ht_sh.png"
                  title="复核" @click="CheckTask(scope.row)" style="cursor: pointer;">
                <img v-else src="@/assets/tableIcon/ht_sh1.png" title="复核" style="cursor: no-drop;">

                <img src="@/assets/tableIcon/ht_fz.png" title="复制" @click="duplicate(scope.row, 1)"
                  style="cursor: pointer;">

                <img v-hasPerm="['del:task']" v-if="scope.row.datastatus == 1" src="@/assets/tableIcon/ht_sc.png"
                  title="删除" @click="deleteTask(scope.row)" style="cursor: pointer;">
                <img v-hasPerm="['del:task']" v-if="scope.row.datastatus == 2" src="@/assets/tableIcon/ht_sc1.png"
                  title="删除" @click="" style="cursor: no-drop;">
              </span>
            </template>
          </el-table-column>
        </el-table>
        <div style="display: flex;justify-content: center;margin-top: 5px;">
          <Page style="position: relative;z-index: 100;" :total="total" v-model:size="SearchBox.size"
            v-model:current="SearchBox.current" @pagination="getData()"></Page>
        </div>
      </div>
    </section>
    <Eldialog v-if="dialogVisible" :title="title" :zIndex="2000" :width="'1175px'" :height="'560px'"
      @before-close="handleClose">
      <template v-slot:PopFrameContent>
        <!-- <div class="tabbas">
          <div @click="tabs = 1" :class="tabs == 1 ? 'tabbas1' : 'tabbas-left'">基本信息</div>
          <div @click="tabs = 2" :class="tabs == 2 ? 'tabbas2' : 'tabbas-rigth'">关联设备</div>
        </div> -->
        <el-tabs v-model="tabs" @tab-change="tabClick">
          <el-tab-pane :name="1" label="基本信息">
          </el-tab-pane>
          <el-tab-pane :name="2" label="关联设备">
          </el-tab-pane>
        </el-tabs>
        <div v-show="tabs == 1" class="tabbas1-toner">
          <el-form ref="infoForm" :model="info" label-width="90px" style="display: flex; flex-wrap: wrap; margin: 5px;"
            :rules="rules">
            <el-form-item label="任务编码" style="width:50%" prop="taskCode">
              <el-input v-model="info.taskCode" style="width: 100%;margin-left: 8px;" placeholder="请输入任务编码"
                :disabled="info.datastatus == 2 && title != '复制巡视任务'"></el-input>
            </el-form-item>
            <el-form-item label="任务名称" style="width:50%" prop="taskName">
              <el-input v-model="info.taskName" style="width: 100%;margin-left: 8px;" placeholder="请输入任务名称"
                :disabled="info.datastatus == 2 && title != '复制巡视任务'"></el-input>
            </el-form-item>
            <el-form-item label="变电站" prop="stationAll" style="width:50%">
              <el-select v-model="info.stationAll"
                style="width: 100% !important;  display: flex; justify-content: center" @change="areaTree(), open()"
                :disabled="info.datastatus == 2 && title != '复制巡视任务'">
                <el-option v-for="item in optionSelect" :key="item.stationId" :label="item.stationName"
                  :value="item.stationId" style="width:100%" />
              </el-select>
            </el-form-item>
            <el-form-item label="机器人-无人机" style="width:50%">
              <el-select v-model="info.robotCode" placeholder="请选择机器人-无人机" style="width: 100%" clearable
                :disabled="info.datastatus == 2 && title != '复制巡视任务'">
                <el-option v-for="item in robotUAV" :key="item.patroldeviceId" :label="item.patroldeviceName"
                  :value="item.patroldeviceCode" />
              </el-select>
            </el-form-item>
            <el-form-item label="任务类型" style="width:50%">
              <el-select v-model="info.taskType" placeholder="请选择任务类型" style="width: 100%" @change="changeType"
                :disabled="info.datastatus == 2 && title != '复制巡视任务'">
                <el-option v-for="item in TaskType1" :key="item.id" :label="item.dictname" :value="item.itemcode" />
              </el-select>
            </el-form-item>
            <el-form-item label="任务优先级" style="width:50%">
              <el-select :disabled="info.taskType == '' || (info.datastatus == 2 && title != '复制巡视任务')"
                v-model="info.priority" placeholder="请选择任务优先级" style="width: 100%">
                <el-option v-for="item in priority" :key="item.id" :label="item.dictname" :value="item.itemcode" />
              </el-select>
            </el-form-item>
            <el-form-item label="执行方式" style="width:50%">
              <el-select v-model="info.taskTodoType" placeholder="请选择执行方式" style="width: 100%"
                :disabled="info.datastatus == 2 && title != '复制巡视任务'">
                <el-option v-for="item in ExecutionMethod" :key="item.label" :label="item.label" :value="item.value" />
              </el-select>
            </el-form-item>
            <el-form-item label="开始时间" style="width:50%;">
              <el-date-picker v-model="info.fixedStartTime" type="datetime" placeholder="请选择"
                style="margin-left: 8px;width: 100%;" popper-class="elDatePicker"
                :disabled="info.taskTodoType == 1 || info.taskTodoType == '' || info.taskTodoType == undefined || (info.datastatus == 2 && title != '复制巡视任务')" />
            </el-form-item>
            <el-form-item label="cron表达式" style="width:50%">
              <el-input v-model="info.cronValue" style="width: 365px;margin-left: 8px;" disabled
                placeholder="请输入任务编码"></el-input>
              <el-button class="searchButton" type="primary" style="margin-left: 10px;" @click="cycleCron"
                :disabled="(info.datastatus == 2 && title != '复制巡视任务') || info.taskTodoType == 1 || info.taskTodoType == 2 || info.taskTodoType == '' || info.taskTodoType == undefined">
                <!-- <img
                  src="@/assets/MenuIcon/u697.png" alt="" style="margin-right: 5px;"> -->
                设置</el-button>
            </el-form-item>
            <el-form-item label="不可用时间" style="width:50%">
              <el-date-picker popper-class="elDatePicker" v-model="timeData" type="datetimerange" range-separator="至"
                start-placeholder="开始日期" end-placeholder="结束日期" style="margin:0px 0px 0px 8px; width: 100%;"
                :disabled="(info.datastatus == 2 && title != '复制巡视任务') || info.taskTodoType == 1 || info.taskTodoType == 2 || info.taskTodoType == '' || info.taskTodoType == undefined" />
            </el-form-item>
            <el-form-item label="备注信息" style="width:100%;display:flex;align-items:flex-start !important;">
              <el-input type="textarea" v-model="info.custom1" :autosize="{ minRows: 5, maxRows: 8 }"
                style="width: 100% ;margin-left: 8px;height  " placeholder="请输入备注信息"
                :disabled="info.datastatus == 2 && title != '复制巡视任务'"></el-input>
            </el-form-item>
          </el-form>
          <span class="dialog-footer" v-if="info.datastatus == 1 || title == '复制巡视任务'"
            style="width:100%;margin:auto ; display: flex;display: -webkit-flex; justify-content: flex-end;-webkit-justify-content: flex-end;margin-top: 20px;">
            <div class="details-button" @click="handleClose">取消</div>
            <div class="details-button" @click="confirmClick(infoForm)">保存</div>
          </span>
        </div>
        <div v-show="tabs == 2" class="tabbas1-toner">
          <div class="essential">
            <div class="essential-top">
              <div style="margin-bottom: 20px;">
                <el-button class="searchButton" style="margin-left:0" type="primary"
                  v-if="info.datastatus == 1 && title == '复制巡视任务'" @click="associationInterval">关联间隔</el-button>
                <el-button class="searchButton" type="primary" v-if="info.datastatus == 1 && title == '复制巡视任务'"
                  @click="associateMasterDevice">关联主设备</el-button>
                <el-button class="searchButton" type="primary" v-if="info.datastatus == 1 && title == '复制巡视任务'"
                  @click="AssociatedComponents">关联部件</el-button>
                <el-button class="searchButton" type="primary" v-if="info.datastatus == 1 && title == '复制巡视任务'"
                  @click="AssociatedInspection">关联巡视点位</el-button>
              </div>
            </div>
            <div class="suo">
              <div>
                <div class="essentialTop">关联结果 </div>
                <div v-if="deviceLevel == 0" class="essentialBottom">
                  暂未绑定
                </div>
                <div v-if="deviceLevel == 1">
                  <el-scrollbar height="300px">
                    <el-table :data="allData" style="width: 100%;margin-bottom: 15px;" row-key="id" default-expand-all
                      :header-cell-style="tableBg" :row-class-name="tableRowClassName">
                      <el-table-column label="序号" type="index" align="center" width="50px" />
                      <el-table-column label="间隔名称" prop="bayName" width="110"></el-table-column>
                      <el-table-column label="所属变电站" prop="stationName"></el-table-column>
                      <el-table-column label="所属区域" prop="areaName"></el-table-column>
                      <el-table-column v-if="info.datastatus == 1" label="操作" width="60px">
                        <template #default="scope">
                          <img src="@/assets/MenuIcon/lbcz_sc.png" alt="" @click="delTour(scope.row)"
                            style="cursor: pointer;">
                        </template>
                      </el-table-column>
                    </el-table>
                  </el-scrollbar>

                </div>
                <div v-if="deviceLevel == 2">
                  <el-scrollbar height="300px">
                    <el-table :data="allData" style="width: 100%;margin-bottom: 15px;" row-key="id" default-expand-all
                      :header-cell-style="tableBg" :row-class-name="tableRowClassName">
                      <el-table-column label="序号" type="index" align="center" width="50px" />
                      <el-table-column label="主设备名称" prop="mainDeviceName" width="110"></el-table-column>
                      <el-table-column label="所属变电站" prop="stationName"></el-table-column>
                      <el-table-column label="所属区域" prop="areaName"></el-table-column>
                      <el-table-column label="所属间隔" prop="bayName"></el-table-column>
                      <el-table-column v-if="info.datastatus == 1" label="操作" width="60px">
                        <template #default="scope">
                          <img src="@/assets/MenuIcon/lbcz_sc.png" alt="" @click="delTour(scope.row)"
                            style="cursor: pointer;">
                        </template>
                      </el-table-column>
                    </el-table>
                  </el-scrollbar>

                </div>
                <div v-if="deviceLevel == 4">
                  <el-scrollbar height="300px">
                    <el-table :data="allData" style="width: 100%;margin-bottom: 15px;" row-key="id" default-expand-all
                      :header-cell-style="tableBg" :row-class-name="tableRowClassName">
                      <el-table-column label="序号" type="index" align="center" width="50px" />
                      <el-table-column label="部件名称" prop="componentName" width="110"></el-table-column>
                      <el-table-column label="所属变电站" prop="stationName"></el-table-column>
                      <el-table-column label="所属区域" prop="areaName"></el-table-column>
                      <el-table-column label="所属间隔" prop="bayName"></el-table-column>
                      <el-table-column label="所属主设备" prop="mainDeviceName"></el-table-column>
                      <el-table-column v-if="info.datastatus == 1" label="操作" width="60px">
                        <template #default="scope">
                          <img src="@/assets/MenuIcon/lbcz_sc.png" alt="" @click="delTour(scope.row)"
                            style="cursor: pointer;">
                        </template>
                      </el-table-column>
                    </el-table>
                  </el-scrollbar>

                </div>
                <div v-if="deviceLevel == 3">
                  <el-scrollbar height="300px">
                    <el-table :data="allData" style="width: 100%;margin-bottom: 15px;" row-key="id" default-expand-all
                      :header-cell-style="tableBg" :row-class-name="tableRowClassName">
                      <el-table-column label="序号" type="index" align="center" width="50px" />
                      <el-table-column label="巡视点位名称" prop="deviceName"></el-table-column>
                      <el-table-column label="所属变电站" prop="stationName" width="170px"></el-table-column>
                      <el-table-column label="所属区域" prop="areaName" width="120px"></el-table-column>
                      <el-table-column label="所属间隔" prop="bayName" width="120px"></el-table-column>
                      <el-table-column label="所属主设备" prop="mainDeviceName" width="120px"></el-table-column>
                      <el-table-column label="所属部件" prop="componentName" width="120px"></el-table-column>
                      <el-table-column v-if="info.datastatus == 1" label="操作" width="60px">
                        <template #default="scope">
                          <img src="@/assets/MenuIcon/lbcz_sc.png" alt="" @click="delTour(scope.row)"
                            style="cursor: pointer;">
                        </template>
                      </el-table-column>
                    </el-table>
                  </el-scrollbar>

                </div>
              </div>
            </div>
          </div>
          <span class="dialog-footer" v-if="info.datastatus == 1 || title == '复制巡视任务'"
            style="width: 95%;margin: auto; display: flex;display: -webkit-flex; justify-content: flex-end;-webkit-justify-content: flex-end;margin-top: 10px;">
            <div class="details-button" @click="handleClose">取消</div>
            <div class="details-button" @click="confirmClick(infoForm)">保存</div>
          </span>
          <!-- </div> -->
        </div>
      </template>
    </Eldialog>
    <Eldialog v-if="Bindinginterval" :title="'关联间隔'" :zIndex="2001" :width="'1175px'" @before-close="delBinding">
      <template v-slot:PopFrameContent>
        <div class="faulttemplate-box">
          <aside id="silderLeft">
            <div class="displayflex" style="    margin-bottom: 10px;
              padding-left: 20px;
              height: 30px;">
              <div class="title" style="font-size: 14px;color: #fff;">数据列表</div>
            </div>
            <el-scrollbar height="calc(100vh - 350px)" style="padding:0px 15px;">
              <el-tree ref="treeRefbay"
                :class="useAppStore().size === 'default' ? 'silderLeft-large' : 'silderLeft-default'" node-key="areaId"
                :data="treedatalist" :current-node-key="currentNodeKeybay" :highlight-current="true"
                :props="defaultProps" @node-click="handlelistClick" style="">
              </el-tree>
            </el-scrollbar>
          </aside>
          <section class="silderRightDialog">
            <div
              style="display: flex;display: -webkit-flex; justify-content: space-between; -webkit-justify-content: space-between; margin:5px ">
              <div style="display: flex;display: -webkit-flex; align-items: center;">

                <el-input v-model="bayName" clearable placeholder="请输入间隔名称" @clear="getInterval()"
                  @keyup.enter="getInterval()" style="margin-right:15px ;width: 200px;" />
                <el-button class="searchButton" @click="getInterval()">搜索</el-button>
              </div>
              <div><el-button class="searchButton" @click="addInterval">添加</el-button></div>
            </div>
            <div class="draggable">
              <el-table :data="intervalData" ref="multipleTableReflist" v-loading="loadingComponent"
                style="width: 100%;height:calc(100vh - 370px);" row-key="bayId" @selection-change="handChangeInterval"
                default-expand-all :header-cell-style="tableBg" :row-class-name="tableRowClassName">
                <el-table-column type="selection" width="30" align="center" />
                <el-table-column label="序号" type="index" width="50"></el-table-column>
                <el-table-column label="间隔名称" prop="bayName"></el-table-column>
              </el-table>
            </div>

          </section>
        </div>
      </template>
    </Eldialog>
    <Eldialog v-if="BindDevice" :title="'关联主设备'" :zIndex="2001" :width="'1175px'" @before-close="delBinding">
      <template v-slot:PopFrameContent>
        <div class="faulttemplate-box">
          <aside id="silderLeft">
            <div class="displayflex" style="    margin-bottom: 10px;
              padding-left: 20px;
              height: 30px;">
              <div class="title" style="font-size: 14px;color: #fff;">数据列表</div>
            </div>
            <el-scrollbar height="calc(100vh - 350px)" style="padding:0px 15px;">
              <el-tree ref="treeRefbay"
                :class="useAppStore().size === 'default' ? 'silderLeft-large' : 'silderLeft-default'" node-key="bayId"
                :data="treedatabay" :current-node-key="currentNodeKeybay" :highlight-current="true"
                :props="defaultProps" @node-click="handlebayClick" style="">
              </el-tree>
            </el-scrollbar>
          </aside>
          <section class="silderRightDialog">
            <div
              style="display: flex;display: -webkit-flex; justify-content: space-between; -webkit-justify-content: space-between;  margin:5px">
              <div style="display: flex;display: -webkit-flex; align-items: center;">

                <el-input clearable v-model="Mainnmae" placeholder="请输入主设备名称" @clear="getMainData()"
                  @keyup.enter="getMainData()" style="margin-right:15px ;width: 200px;" />
                <el-select clearable v-model="paramsMaintable" placeholder="主设备类型"
                  style="margin-right:15px ;width: 40%;" @visible-change="getMainType()" @change="getMainData()">
                  <el-option v-for="item in PatrolEquipmentType" :key="item.id" :label="item.dictname"
                    :value="item.itemcode" />
                </el-select>
                <el-button class="searchButton" type="primary" @click="getMainData()">搜索</el-button>
                <el-button class="searchButton" @click="resettingmain()">重置</el-button>
              </div>
              <div><el-button class="searchButton" type="primary" @click="addMainBinding">添加</el-button></div>
            </div>
            <div class="draggable">
              <el-table :data="MainvalData" style="width: 100%;height:calc(100vh - 370px);" row-key="mainDeviceId"
                @selection-change="handMainChange" default-expand-all ref="multipleTableMain" v-loading="loadingMain"
                :header-cell-style="tableBg" :row-class-name="tableRowClassName">
                <el-table-column type="selection" width="30" align="center" />
                <el-table-column label="序号" type="index" width="50"></el-table-column>
                <el-table-column label="主设备名称" prop="mainDeviceName"></el-table-column>
                <el-table-column label="主设备类型" prop="deviceType"></el-table-column>
              </el-table>
            </div>
          </section>
        </div>
      </template>
    </Eldialog>
    <Eldialog v-if="BindComponents" :title="'关联部件'" :zIndex="2001" :width="'1175px'" @before-close="delBinding">
      <template v-slot:PopFrameContent>
        <div class="faulttemplate-box">
          <aside id="silderLeft">
            <div class="displayflex" style=" margin-bottom: 10px;
              padding-left: 20px;
              height: 30px;">
              <div class="title" style="font-size: 14px;color: #fff;">数据列表</div>
            </div>
            <el-scrollbar height="calc(100vh - 350px)" style="padding:0px 15px;">
              <el-tree ref="treeRefbay"
                :class="useAppStore().size === 'default' ? 'silderLeft-large' : 'silderLeft-default'" node-key="bayId"
                :data="treedatabay" :current-node-key="currentNodeKeybay" :highlight-current="true"
                :props="defaultProps" @node-click="handlebayClick" style="">
              </el-tree>
            </el-scrollbar>
          </aside>
          <section class="silderRightDialog">
            <div
              style="display: flex;display: -webkit-flex; justify-content: space-between; -webkit-justify-content: space-between; margin:5px">
              <div style="display: flex;display: -webkit-flex; align-items: center;">

                <el-input v-model="componentName" placeholder="请输入部件名称" clearable @clear="getComponentData()"
                  @keyup.enter="getComponentData()" style="margin-right:15px ;width: 200px;" />
                <el-select clearable v-model="mainDeviceId" placeholder="主设备" style="margin-right:15px ;width: 40%;"
                  @visible-change="getMainType()" @change="getComponentData()">
                  <el-option v-for="item in MainvalData" :key="item.mainDeviceId" :label="item.mainDeviceName"
                    :value="item.mainDeviceId" />
                </el-select>
                <el-button class="searchButton" @click="getComponentData()">搜索</el-button>
                <el-button class="searchButton" @click="resetComponent()">重置</el-button>

              </div>
              <div><el-button class="searchButton" type="primary" @click="addComponentBinding">添加</el-button></div>
            </div>
            <div class="draggable">
              <el-table :data="componentData" style="width: 100%;height:calc(100vh - 370px);" row-key="componentId"
                @selection-change="handComponentChange" default-expand-all ref="multipleTableComponents"
                v-loading="loadingInterval" :header-cell-style="tableBg" :row-class-name="tableRowClassName">
                <el-table-column type="selection" width="30" align="center" />
                <el-table-column label="序号" type="index" width="50"></el-table-column>
                <el-table-column label="部件名称" prop="componentName"></el-table-column>
                <el-table-column label="所属主设备" prop="mainDeviceName"></el-table-column>
              </el-table>
            </div>

          </section>
        </div>
      </template>
    </Eldialog>
    <Eldialog v-if="Bindpoints" :title="'关联巡视点位'" :zIndex="2001" :width="'1175px'" @before-close="delBinding">
      <template v-slot:PopFrameContent>
        <div class="faulttemplate-box">
          <aside id="silderLeft">
            <div class="displayflex" style="    margin-bottom: 10px;
              padding-left: 20px;
              height: 30px;">
              <div class="title" style="font-size: 14px;color: #fff;">数据列表</div>
            </div>
            <el-scrollbar height="calc(100vh - 350px)" style="padding:0px 15px;">
              <el-tree ref="treeRefbay"
                :class="useAppStore().size === 'default' ? 'silderLeft-large' : 'silderLeft-default'" node-key="bayId"
                :data="treedatabay" :current-node-key="currentNodeKeybay" :highlight-current="true"
                :props="defaultProps" @node-click="handlebayClick" style="">
              </el-tree>
            </el-scrollbar>
          </aside>
          <section class="silderRightDialog">
            <div
              style="display: flex;display: -webkit-flex; justify-content: space-between; -webkit-justify-content: space-between;  margin:5px">
              <div style="display: flex;display: -webkit-flex; align-items: center;width: 80%;">

                <el-input v-model="bayName" placeholder="请输入巡视点位名称" clearable @clear="getPointsData()"
                  @keyup.enter="getPointsData()" style="margin-right:15px ;width: 30%;" />
                <el-select clearable v-model="mainDeviceIds" placeholder="主设备" style="margin-right:15px ;width: 30%;"
                  @visible-change="getMainType()" @change="getPointsData()">
                  <el-option v-for="item in MainvalData" :key="item.mainDeviceId" :label="item.mainDeviceName"
                    :value="item.mainDeviceId" />
                </el-select>
                <el-select clearable v-model="componentIds" placeholder="部件" style="margin-right:15px ;width: 30%;"
                  @visible-change="getMainType()" @change="getPointsData()">
                  <el-option v-for="item in componentData" :key="item.componentId" :label="item.componentName"
                    :value="item.componentId" />
                </el-select>
                <el-button class="searchButton" @click="getPointsData()">搜索</el-button>
                <el-button class="searchButton" @click="resetComponent()">重置</el-button>
              </div>
              <div><el-button class="searchButton" @click="addPointsBinding">添加</el-button></div>
            </div>
            <div class="draggable">
              <el-table :data="deviceData" style="width: 100%;height:calc(100vh - 370px);" row-key="deviceId"
                @selection-change="handPointsChange" default-expand-all ref="multipleTablePoints"
                v-loading="loadingPoints" :header-cell-style="tableBg" :row-class-name="tableRowClassName">
                <el-table-column type="selection" width="30" align="center" />
                <el-table-column label="序号" type="index" width="50"></el-table-column>
                <el-table-column label="巡视点位名称" prop="deviceName"></el-table-column>
                <el-table-column label="所属主设备" prop="mainDeviceName"></el-table-column>
                <el-table-column label="所属部件" prop="componentName"></el-table-column>
              </el-table>
            </div>
          </section>
        </div>
      </template>
    </Eldialog>
    <Eldialog v-if="cycleTime" :title="'时间周期表达式设置'" :zIndex="2001" :width="'960px'" @before-close="Closeassign">
      <template v-slot:PopFrameContent>
        <div class="tabs">
          <div class="divcursorpointer" @click="index = 1" :class="index == 1 ? 'tabsTitle' : ''">秒</div>
          <div class="divcursorpointer" @click="index = 2" :class="index == 2 ? 'tabsTitle' : ''">分</div>
          <div class="divcursorpointer" @click="index = 3" :class="index == 3 ? 'tabsTitle' : ''">时</div>
          <div class="divcursorpointer" @click="index = 4" :class="index == 4 ? 'tabsTitle' : ''">日</div>
          <div class="divcursorpointer" @click="index = 5" :class="index == 5 ? 'tabsTitle' : ''">月</div>
          <div class="divcursorpointer" @click="index = 6" :class="index == 6 ? 'tabsTitle' : ''">周</div>
          <div style="width: 80%;"></div>
        </div>
        <div class="tabsContent">
          <div v-show="index == 1" style="height:230px">
            <el-radio-group v-model="second" @change="rediosecond">
              <el-radio :label="4" style="height: 230px; ">
                <div style="display: flex;">
                  <div style="margin-top:-3px ;">指定</div>
                  <el-checkbox-group v-model="checkListsecond" @change="ahangesecond">
                    <div
                      style="margin-left: 15px; display: flex;flex-wrap: wrap ;align-items: center;justify-content: flex-start;">
                      <el-checkbox style="display: block;" v-for="item in appointsecond" :key="index" :label="item"
                        size="large" />
                    </div>
                  </el-checkbox-group>
                </div>
              </el-radio>
            </el-radio-group>
          </div>
          <div v-show="index == 2" style="height:230px">
            <el-radio-group v-model="divide" @change="rediodivide">
              <el-radio :label="4" style="height: 230px; ">
                <div style="display: flex;">
                  <div style="margin-top: -3px;">指定</div>
                  <el-checkbox-group v-model="checkListdivide" @change="rediodivide(4)">
                    <div
                      style="margin-left: 15px; display: flex;flex-wrap: wrap ;align-items: center;justify-content: flex-start;">
                      <el-checkbox style="display: block;" v-for="item in appointdivide" :label="item" size="large" />
                    </div>
                  </el-checkbox-group>
                </div>
              </el-radio>
            </el-radio-group>
          </div>
          <div v-show="index == 3" style="height:230px">
            <el-radio-group v-model="time" @change="rediodtime">
              <el-radio :label="3" :disabled="sun == 4"><span>
                  <span style="color: #ffffff">从</span>
                  <el-input class="spanmarg" @change="rediodtime(3)" v-model="periodtime.periodInput3"
                    style="width:80px" />
                  <span class="spanmarg">小时开始，每</span>
                  <el-input class="spanmarg" @change="rediodtime(3)" v-model="periodtime.periodInput4"
                    style="width:80px" />
                  <span class="spanmarg">小时执行一次</span>
                </span></el-radio>
              <el-radio :label="4" style="height: 230px; ">
                <div style="display: flex;">
                  <div style="margin-top: -3px;">指定</div>

                  <div style="width:1000px; color: #ffffff">
                    <div style="display: flex; margin-left: 15px; ">
                      <div style="margin-top: -3px;">上午：</div>
                      <el-checkbox-group v-model="checkListtime" @change="rediodtime(4)">
                        <div style=" display: flex;flex-wrap: wrap ;align-items: center;justify-content: flex-start;">
                          <el-checkbox style="display: block;" v-for="item in appointtime1" :label="item"
                            size="large" />
                        </div>
                      </el-checkbox-group>
                    </div>
                    <div style="display: flex; margin-left: 15px;">
                      <div style="margin-top: -3px;">下午：</div>
                      <el-checkbox-group v-model="checkListtime" @change="rediodtime(4)">
                        <div style=" display: flex;flex-wrap: wrap ;align-items: center;justify-content: flex-start;">
                          <el-checkbox style="display: block;" v-for="item in appointtime2" :label="item"
                            size="large" />
                        </div>
                      </el-checkbox-group>

                    </div>
                  </div>
                </div>
              </el-radio>
            </el-radio-group>
          </div>
          <div v-show="index == 4" style="height:230px">
            <el-radio-group v-model="sun" @change="rediodsun">
              <el-radio :label="2">不指定</el-radio>
              <el-radio :label="4" :disabled="week == 6 || time == 3" id="dayRadio"><span>
                  <span style="color: #ffffff">从</span>
                  <el-input class="spanmarg" @change="rediodsun(4)" v-model="periodsun.periodInput3" style="width:80px"
                    :disabled="week == 6" />
                  <span class="spanmarg">日开始，每</span>
                  <el-input class="spanmarg" @change="rediodsun(4)" v-model="periodsun.periodInput4" style="width:80px"
                    :disabled="week == 6" />
                  <span class="spanmarg">天执行一次</span>
                </span></el-radio>
            </el-radio-group>
          </div>
          <div v-show="index == 5" style="height:230px">
            <el-radio-group v-model="moon" @change="rediodmoon">
              <el-radio :label="4" style="height: 230px; ">
                <div style="display: flex;">
                  <div style="margin-top: -3px;">指定</div>
                  <el-checkbox-group v-model="checkListmoon" @change="rediodmoon(4)">
                    <div
                      style="margin-left: 15px; display: flex;flex-wrap: wrap ;align-items: center;justify-content: flex-start;width: 1000px;">
                      <el-checkbox style="display: block;" v-for="item in appointmoon" :label="item" size="large" />
                    </div>
                  </el-checkbox-group>
                </div>
              </el-radio>
            </el-radio-group>
          </div>
          <div v-show="index == 6" style="height:230px">
            <el-radio-group v-model="week" @change="rediodweek">
              <el-radio :label="2">不指定</el-radio>
              <el-radio :label="6" style="height: 230px; " :disabled="sun == 4">
                <div style="display: flex;">
                  <div style="margin-top: -3px;">指定</div>
                  <el-checkbox-group v-model="checkListweek" @change="rediodweek(6)">
                    <div
                      style="margin-left: 15px; display: flex;flex-wrap: wrap ;align-items: center;justify-content: flex-start;width: 600px;">
                      <el-checkbox style="display: block;" v-for="item in appointweek" :label="item" size="large"
                        :disabled="sun == 4" />
                    </div>
                  </el-checkbox-group>
                </div>
              </el-radio>
            </el-radio-group>
          </div>
        </div>
        <div style="display: flex;align-items: center; justify-content: space-between; width: 65px; margin-top: 20px;">
          <div style="width: 5px;height: 15px;background-color: #009BFF;"></div>
          <div style="color:#009BFF;font-size: 16px;font-weight: 700;">表达式</div>
        </div>
        <div style="margin-top: 20px;margin-bottom:10px;">表达式字段</div>
        <div style="display: flex; justify-content: space-between;">
          <div class="field"><el-input class="fieldInput" v-model="field.fieldsecond" disabled />
            <div class="fieldText">秒</div>
          </div>
          <div class="field"><el-input class="fieldInput" v-model="field.fielddivide" disabled />
            <div class="fieldText">分</div>
          </div>
          <div class="field"><el-input class="fieldInput" v-model="field.fieldtime" disabled />
            <div class="fieldText">时</div>
          </div>
          <div class="field"><el-input class="fieldInput" v-model="field.fieldsun" disabled />
            <div class="fieldText">日</div>
          </div>
          <div class="field"><el-input class="fieldInput" v-model="field.fieldmoon" disabled />
            <div class="fieldText">月</div>
          </div>
          <div class="field"><el-input class="fieldInput" v-model="field.fieldweek" disabled />
            <div class="fieldText">周</div>
          </div>
        </div>
        <div style="margin-top: 20px;margin-bottom:10px;">表达式</div>
        <div> <el-input v-model="resentation" style="height: 40px;" disabled /></div>
        <span class="dialog-footer"
          style="display: flex;display: -webkit-flex; justify-content: flex-end;-webkit-justify-content: flex-end;margin-top: 10px;">
          <div class="details-button" @click="Closeassign">取消</div>
          <div class="details-button" @click="assignment">确定</div>
        </span>
      </template>
    </Eldialog>
    <Eldialog v-if="control" :title="'二次密码验证'" :zIndex="2000" :width="'400px'" @before-close="inputCLOse">
      <template v-slot:PopFrameContent>
        <el-input v-model="password" autocomplete="new-password" :name="'pwd-' + Date.now()" placeholder="请输入账号密码"
          style="margin-top:30px;width: 100%;" type="password" show-password />
        <div style="padding:5px 0">
          <div v-if="inputTrue" style="color:red;">密码错误，请重新输入</div>
        </div>
        <span class="dialog-footer" style="display: flex;justify-content: center;margin-top: 10px;">
          <div class="details-button" @click="inputCLOse">取消</div>
          <div class="details-button" @click="secondPass">确定</div>
        </span>
      </template>
    </Eldialog>
  </div>
</template>

<style scoped lang="scss">
.displayflex {
  display: flex;
  align-items: center;

  .line {
    width: 5px;
    height: 14px;
    background: #179f84;
  }

  .title {
    padding-left: 10px;
    font-family: 'Arial Negreta', 'Arial Normal', 'Arial';
    font-weight: 700;
    font-style: normal;
    font-size: 16px;
    color: #303133;
    text-decoration: none !important;
  }

}

.silderLeft-default {
  :deep(.el-tree-node__label) {
    font-size: 16px !important;
  }
}

#silderLeft {
  width: 300px;
  padding: 5px 0px 10px;
  box-sizing: border-box;
  // background: #fff; riis-web/src/assets/navigation/ty_260x988.png
  background-image: url(@/assets/navigation/ty_260x988.png);
  background-size: 100% 100%;
  border-radius: 3px;
  position: relative;
  height: calc(100vh - 290px);
  overflow: auto;
}

.faulttemplate-box {
  height: 100%;
  display: flex;
  display: -webkit-flex;
  padding-top: 15px;
  // background-color: #f2f4f9;

}

.silderRight {
  width: 100%;
  height: calc(100vh - 160px);
  overflow: auto;
  // background-color: #131a25;
  border: none;
  border-radius: 3px;
  padding: 5px 20px 0px;
  box-sizing: border-box;
  background: url(@/assets/newimg/cjrw_1890.png);
  background-size: 100% 100%;
  border-radius: 3px;
  padding: 15px;
  padding-bottom: 0px;
  box-sizing: border-box;
  // margin-left: 15px;
}

.silderRightDialog {
  flex: 1;
  width: 100%;
  height: calc(100vh - 290px);
  overflow: auto;
  // background-color: rgba(255, 255, 255, 1); navigation/ty_260x988.png riis-web/src/assets/navigation/ty_1614x988.png
  border-radius: 3px;
  box-sizing: border-box;
  margin-left: 15px;
  background: url(@/assets/navigation/ty_1614x988.png);
  background-size: 100% 100%;
  padding: 10px;
}


//tabs
.tabbas {
  width: 100%;
  border-bottom: 1px solid #009bff;
  display: flex;
  color: #B5D7FF;

  div {
    width: 70px;
    height: 51px;
    line-height: 51px;
    text-align: center;
    cursor: pointer;
  }

  .tabbas1 {
    width: 70px;
    height: 51px;
    text-align: center;
    line-height: 51px;
    color: #009bff !important;
    border-bottom: 2px solid #009bff !important;
    box-sizing: border-box;
    margin-left: 10px;
    cursor: pointer;
  }

  .tabbas2 {
    width: 70px;
    height: 51px;
    text-align: center;
    line-height: 51px;
    color: #009bff;
    border-bottom: 2px solid #009bff;
    box-sizing: border-box;
    margin-left: 10px;
    cursor: pointer;
  }
}

.tabbas1-toner {
  margin-top: 20px;
  height: calc(100vh - 500px)
}

:deep(.el-form-item) {
  display: flex;
  align-items: center;
}

:deep(.el-form-item__label) {
  width: 115px !important;
}

:deep(.el-form-item__error) {
  margin-left: 10px;
}

.essentialTop {
  font-size: 16px;
  width: 95px;
  height: 16px;
  font-weight: 700;
  border-left: 6px solid #009bff;
  text-align: center;
  line-height: 16px;
  margin-bottom: 20px;
  color: #ffffff;
}

.essentialBottom {
  border: 1px solid rgb(228, 228, 228, 0.1);
  background-color: rgb(250, 250, 250, 0.1);
  width: 100%;
  height: 265px;
  text-align: center;
  line-height: 265px;
  font-size: 18px;
  color: #949494;
  font-weight: 400;
  margin: auto;
}

.essential {
  width: 100%;
  margin: auto;
}

:deep(.el-form-item__content .select-trigger.el-tooltip__trigger) {
  width: 100% !important;
  padding-left: 8px;
}

:deep(.el-tree-node.is-current>.el-tree-node__content) {
  width: 100%;
  height: 40px;
  color: #fff !important;
}

:deep(.el-tree-node__content) {
  width: 100% !important;
  height: 40px !important;
  margin: auto !important;
}

.tabs {
  width: 100%;
  display: flex;
  display: -webkit-flex;
  margin-top: 15px;
  border-bottom: 1px solid rgba(0, 155, 255, 0.3);

  .divcursorpointer {
    width: 43px;
    height: 31px;
    line-height: 31px;
    text-align: center;
    box-sizing: border-box;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;

  }

  .tabsTitle {
    box-sizing: border-box;
    border: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 5px 5px 0px 0px;
    background-color: rgba(0, 155, 255, 1);
  }
}

.tabsContent {
  width: 100%;
  border-top: 0px;
  padding: 0px 10px 20px 10px;
  box-sizing: border-box;
  border-radius: 0px 5px 5px 5px;
}

:deep(.el-radio-group) {
  flex-direction: column;
  align-items: flex-start !important;

}

:deep(.el-radio:last-child) {
  align-items: flex-start
}

:deep(.el-radio) {
  margin-top: 25px;
}

.field {
  width: 150px;
  position: relative;

  .fieldText {
    position: absolute;
    top: 0;
    right: 5px;
    z-index: 100;
    height: 40px;
    line-height: 40px;
    color: #009bff;
  }

  .fieldInput {
    height: 40px;
  }
}

.spanmarg {
  display: inline-block;
  margin-left: 10px;
  color: #ffffff
}

#dayRadio {
  align-items: center;

}

.disMakeUse {
  width: 100%;
  height: 50px;
  font-size: 16px;
  text-align: center;
  line-height: 50px;
  color: rgb(0, 249, 162);
  border: 1px solid #e4e4e4;
  border-radius: 10px;
  margin-top: 5px;
  background: #fcfcfc;
}

:deep(.el-scrollbar) {
  height: calc(100vh - 360px);
}
.suo{
  :deep(.el-scrollbar) {
  height: 100% !important;
}
}

.draggable {
  padding-top: 15px;
}
</style>
