<template>
  <div class="airportInfo scroll-y">
    <div class="wrap">
      <Minheader :is-auth="true" :is-statuser="true" @addForm="addForm">
        <template #header>
          <div class="status flex-wrap">
            <div class="manageTitle">服务管理</div>
            <div class="status0"><span class="icon"></span>启动</div>
            <div class="status2"><span class="icon"></span>异常</div>
            <div class="status1"><span class="icon"></span>停止</div>
          </div>
        </template></Minheader
      >
      <div class="app-containers">
        <DataTable
          BtnGroupWidth="300px"
          :is-Status="true"
          :tableHeader="state.list"
          :tableData="tableData"
          :tableBtnGroup="tableBtnGroup"
          :tableProperty="{ rowKey: 'ID' }"
          @btnClick="btnClick"
        />
      </div>
      <Dialog
        width="600px"
        :flag="flag"
        :type="type"
        :msgTitle="msgTitle"
        @delRest="delRest"
      >
      </Dialog>
    </div>
  </div>
</template>
<script setup lang="ts">
import DataTable from "@/components/tableTemp/index.vue";
import Minheader from "@/components/minheader/index.vue";
import Dialog from "@/components/dialog/index.vue";
const router = useRouter();
const flag = ref<Boolean>(false); //弹窗开关
const type = ref<String>(""); //判断是否删除
const msgTitle = ref<String>("新增服务管理"); //弹窗标题
const tableColsCopys = reactive<Object>({}); //弹窗
const tableForm = reactive({
  name: "",
  china: "",
  englin: "",
  two: "",
  three: "",
  text: "",
}); //弹窗内容
//列表
const tableData = ref([
  {
    nodeState: "运行",
    name: "测试",
    china: "测试",
    englin: "测试",
    two: "测试",
    three: "测试",
    text: "测试",
    text1: "测试",
  },
  {
    nodeState: "运行",
    name: "测试",
    china: "测试",
    englin: "测试",
    two: "测试",
    three: "测试",
    text: "测试",
    text1: "测试",
  },
  {
    nodeState: "运行",
    name: "测试",
    china: "测试",
    englin: "测试",
    two: "测试",
    three: "测试",
    text: "测试",
    text1: "测试",
  },
]);
//表头
const state = reactive({
  list: [
    { label: "服务编号", key: "name" },
    { label: "名称", key: "china" },
    { label: "类型", key: "englin" },
    { label: "是否同步", key: "two" },
    { label: "数据类型", key: "three" },
    { label: "取值规则", key: "text" },
    { label: "检测规则", key: "text1" },
  ],
  listLoading: true,
});
const tableBtnGroup = ref([
  {
    name: "查看",
    className: "editBtn",
    param: 4,
  },
  {
    name: "编辑",
    className: "editBtn",
    param: 2,
  },
  {
    name: "停止",
    className: "editBtn",
    param: 5,
  },
  {
    name: "删除",
    className: "delBtn",
    param: 3,
  },
]);
//新增
const addForm = () => {};
//取消
const resetForm = () => {
  flag.value = false;
  tableForm.name = "";
  tableForm.china = "";
  tableForm.englin = "";
  tableForm.two = "";
  tableForm.three = "";
  tableForm.text = "";
};
//编辑
// const editDialog = (data) => {
//   msgTitle.value = "编辑航司信息维护";
//   flag.value = true;
//   type.value = "";
//   tableForm.name = data.name;
//   tableForm.china = data.china;
//   tableForm.englin = data.englin;
//   tableForm.two = data.two;
//   tableForm.three = data.three;
//   tableForm.text = data.text;
// };
//编辑-删除
const btnClick = (row, index, param) => {
  if (param === 2) {
    router.push({ path: "/systemSettings/serviceMonitorEdit" });
  } else if (param === 3) {
    msgTitle.value = "删除服务管理";
    flag.value = true;
    type.value = "del";
  } else if (param === 4) {
    router.push({ path: "/systemSettings/serviceManagement" });
  }
};
//删除
const eleDialog = () => {
  msgTitle.value = "删除服务管理";
  flag.value = true;
  type.value = "del";
};
//删除
const delRest = () => {
  flag.value = false;
};
</script>
<style lang="scss" scoped>
::v-deep .el-form-item__label {
  width: 100px;
}
.app-containers {
  height: calc(100vh - 180px);
}

.icon {
  width: 14px;
  height: 14px;
  background: #2d67e3;
  border-radius: 2px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 10px;
  position: relative;
  top: -2px;
}
.status0,
.status2 {
  margin-right: 28px;
  position: relative;
  top: 5px;
}
.status1 {
  position: relative;
  top: 5px;
  .icon {
    background-color: #afb4bf;
  }
}
.status2 {
  .icon {
    background-color: #eb2f3b;
  }
}
</style>
