<template>
  <div class="dialog" v-if="dialogForm">
    <div class="head_box">
      <span class="title">智能采集设备信息{{ title }}</span>
      <div>
        <el-button type="primary" v-if="title != '详情'" size="small" :loading="loading" @click="submit">保存</el-button>
        <el-button size="small" @click="close">关闭</el-button>
      </div>
    </div>
    <div class="cntinfo">
      <el-form :model="listQuery" :label-width="230" label-position="left">
        <div class="form-row">
          <el-form-item label="视频设备代码">
            <el-input v-model="listQuery.sbbh" placeholder="011022"/>
          </el-form-item>
          <el-form-item label="设备名称">
            <el-input v-model="listQuery.sbmc" placeholder="设备1"/>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="品牌型号">
            <el-input v-model="listQuery.ppxh" placeholder="xxxxxx"/>
          </el-form-item>
          <el-form-item label="IP地址">
            <el-input v-model="listQuery.ip" placeholder="58.1265.5545.20"/>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="网络端口号">
            <el-input v-model="listQuery.wldkh" placeholder="100"/>
          </el-form-item>
          <el-form-item label="行政区划">
            <el-input v-model="listQuery.xzqh" placeholder="巴宜区纺织路派出所"/>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="设备工作状态">
            <el-input v-model="listQuery.sbgzzt" placeholder="正常工作"/>
          </el-form-item>
          <el-form-item label="场所名称">
            <el-input v-model="listQuery.csmc" placeholder="天上人间ktv"/>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="经度">
            <el-input v-model="listQuery.jd" placeholder="101.3235165515"/>
          </el-form-item>
          <el-form-item label="纬度">
            <el-input v-model="listQuery.wd" placeholder="28.132132156"/>
          </el-form-item>
        </div>
      </el-form>
    </div>
    
  </div>
</template>

<script setup>
import { ref, reactive } from 'vue';
import { Plus } from '@element-plus/icons-vue';

const dialogForm = ref(false);
const activeName = ref('basic');
const title = ref('详情');
const listQuery = ref({
  list: [
    {xm:'张三',zjhm:'510183199626565555'},
    {xm:'张三',zjhm:'510183199626565555'},
    {xm:'张三',zjhm:'510183199626565555'},
    {xm:'张三',zjhm:'510183199626565555'},
    {xm:'张三',zjhm:'510183199626565555'},
  ]
});

const areaOptions = ref([]); // 区域选项数据

// 提交
const submit = ()=>{
  elform.value.validate((valid) => {
    if (!valid) return false;
    // loading.value = true;
    let params = { ...listQuery.value}
    let url = title.value == '新增' ? '/mosty-lzcj/tbDwYy/insert' :'/mosty-lzcj/tbDwYy/update'
    // qcckPost(params, url).then((res) => {
    //   proxy.$message({ type: "success", message: title.value+'成功'});
    //   close()
    //   emit("updateDate",modelLx.value);
    // }).catch(()=>{
    //   loading.value = false;
    // });
  });
}

// 初始化数据
const init = (type, row,) => {
  dialogForm.value = true;
  title.value = type == 'add' ? '新增' : type == 'eidt' ? '编辑' : '详情'
  // 根据type和row初始化表单数据
};

const close = () => {
  dialogForm.value = false;
};

defineExpose({init})
</script>

<style lang="scss" scoped>
.dialog {
  padding: 20px;

  :deep(.el-form-item__label) {
    background-color: #F7FAFB;
    padding: 0px 8px;
    color: #000;
    font-weight: 500;
    border: 1px solid #E3E7ED;
  }

  .head_box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
  }
  .cntinfo{
    height: calc(100% - 70px);
    overflow: hidden;
    overflow-y: auto;
  }

  .labelTileile{
    background-color: #F7FAFB;
    border: 1px solid #E3E7ED;
    line-height: 30px;
    padding-left: 8px;
    // text-align: center;
    margin-top: 10px;
  }

  .form-row {
    display: flex;
    
    .el-form-item {
      flex: 1;
    }
  }

  .upload-group {
    display: flex;
    // gap: 20px;
    
    .el-form-item {
      flex: 1;
    }
  }

  .unit {
    margin-left: 5px;
  }
  ::v-deep .el-input__inner{
    height: 36px !important;
    line-height: 36px !important;
    border-radius: 0;
    color: #777575;
  }
}
.el-form-item--default{
  margin-bottom: 0px;
}
</style>