<template>
  <div class="app-container">
    <el-form :inline="true" :model="queryParams" class="demo-form-inline">
      <el-form-item :label="$t('equipment.DeviceType')">
        <el-select
          v-model="queryParams.region"
          :placeholder="$t('share.PleaseChoose') + $t('equipment.DeviceType')"
        >
          <!-- <el-option label="区域一" value="shanghai"></el-option>
          <el-option label="区域二" value="beijing"></el-option> -->
        </el-select>
      </el-form-item>

      <el-form-item :label="$t('equipment.EquipmentName')">
        <el-input
          v-model="queryParams.user"
          :placeholder="$t('share.PleaseEnter') + $t('equipment.EquipmentName')"
        ></el-input>
      </el-form-item>

      <el-form-item :label="$t('equipment.EquipmentCode')">
        <el-input
          v-model="queryParams.user"
          :placeholder="$t('share.PleaseEnter') + $t('equipment.EquipmentCode')"
        ></el-input>
      </el-form-item>

      <el-form-item :label="$t('equipment.Manufacturer')">
        <el-input
          v-model="queryParams.user"
          :placeholder="$t('share.PleaseEnter') + $t('equipment.Manufacturer')"
        ></el-input>
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >{{ $t("share.search") }}</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{
          $t("share.reset")
        }}</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          >{{ $t("share.new") }}</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          >{{ $t("share.edit") }}</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          >{{ $t("share.delete") }}</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          plain
          icon="el-icon-upload2"
          size="mini"
          @click="handleExport"
          >{{ $t("share.import") }}</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          >{{ $t("share.export") }}</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-upload" size="mini">{{
          $t("equipment.ModelSynchronization")
        }}</el-button>
      </el-col>
    </el-row>
    <el-table :data="tableData" style="width: 100%">
      <el-table-column
        type="selection"
        width="55"
        align="center"
        fixed="left"
      />
      <el-table-column
        prop="date"
        min-width="130px"
        :label="$t('equipment.EquipmentName')"
        align="center"
        fixed="left"
      >
      </el-table-column>
      <el-table-column
        prop="name"
        min-width="130px"
        :label="$t('equipment.EquipmentCode')"
        align="center"
        fixed="left"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="150px"
        :label="$t('equipment.VideoNVREncoding')"
        align="center"
        fixed="left"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="110px"
        :label="$t('equipment.Manufacturer')"
        align="center"
        fixed="left"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="150px"
        :label="$t('equipment.MainSystemNumber')"
        align="center"
        fixed="left"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="140px"
        :label="$t('equipment.SubstationName')"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="140px"
        :label="$t('equipment.SubstationCode')"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="140px"
        :label="$t('equipment.areaName')"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="110px"
        :label="$t('equipment.DeviceType')"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="130px"
        :label="$t('equipment.EquipmentModel')"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="110px"
        :label="$t('equipment.UnitOfUse')"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="140px"
        :label="$t('equipment.EquipmentSource')"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="150px"
        :label="$t('equipment.dateOfManufacture')"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="130px"
        :label="$t('equipment.factoryNumber')"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="150px"
        :label="$t('equipment.IsItARotatingWheel')"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="100px"
        :label="$t('equipment.UseType')"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="100px"
        :label="$t('equipment.VideoType')"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="150px"
        :label="$t('equipment.InstallationPosition')"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="180px"
        :label="$t('equipment.RelativeSpatialPosition') + ' x'"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="180px"
        :label="$t('equipment.RelativeSpatialPosition') + ' y'"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="180px"
        :label="$t('equipment.RelativeSpatialPosition') + ' z'"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="130px"
        :label="$t('equipment.BelongingRobot')"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="100px"
        :label="$t('equipment.ipAddress')"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="100px"
        :label="$t('equipment.port')"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        :label="$t('equipment.user')"
        align="center"
      >
      </el-table-column>
      <el-table-column
        prop="address"
        min-width="100px"
        :label="$t('equipment.password')"
        align="center"
      >
      </el-table-column>
      <el-table-column
        :label="$t('share.operate')"
        align="center"
        fixed="right"
        width="200px"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            >{{ $t("share.edit") }}</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            >{{ $t("share.delete") }}</el-button
          >
          <el-button size="mini" type="text" icon="el-icon-s-promotion">{{
            $t("equipment.thoroughfare")
          }}</el-button>
          <el-button size="mini" type="text" icon="el-icon-upload">{{
            $t("equipment.uploadPictures")
          }}</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
    />

    <el-dialog
      :title="title"
      :visible.sync="dialogVisible"
      width="70%"
      :before-close="handleClose"
    >
      <el-row :gutter="10">
        <el-form
          :model="dialogForm"
          class="demo-form-inline"
          label-position="right"
          label-width="190px"
        >
          <el-col span="8">
            <el-form-item :label="$t('equipment.areaName')">
              <el-select
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseChoose') + $t('equipment.areaName')
                "
                style="display: block; width: 100%"
              >
                <!-- <el-option label="区域一" value="shanghai"></el-option>
                <el-option label="区域二" value="beijing"></el-option> -->
              </el-select>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item :label="$t('equipment.DeviceType')">
              <el-select
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseChoose') + $t('equipment.areaName')
                "
                style="display: block; width: 100%"
              >
                <!-- <el-option label="区域一" value="shanghai"></el-option>
                <el-option label="区域二" value="beijing"></el-option> -->
              </el-select>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item :label="$t('equipment.EquipmentName')">
              <el-input
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseEnter') + $t('equipment.EquipmentName')
                "
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item :label="$t('equipment.EquipmentCode')">
              <el-input
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseEnter') + $t('equipment.EquipmentCode')
                "
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item :label="$t('equipment.EquipmentModel')">
              <el-input
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseEnter') + $t('equipment.EquipmentModel')
                "
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item :label="$t('equipment.Manufacturer')">
              <el-input
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseEnter') + $t('equipment.Manufacturer')
                "
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item
              :label="$t('equipment.mainSystem')"
              class="mainSystem"
            >
              <el-select
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseChoose') + $t('equipment.mainSystem')
                "
                style="display: block; width: 100%"
              >
                <!-- <el-option label="区域一" value="shanghai"></el-option>
                <el-option label="区域二" value="beijing"></el-option> -->
              </el-select>
            </el-form-item>
          </el-col>

          <el-col span="8">
            <el-form-item :label="$t('equipment.UnitOfUse')">
              <el-input
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseEnter') + $t('equipment.UnitOfUse')
                "
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item :label="$t('equipment.EquipmentSource')">
              <el-input
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseEnter') + $t('equipment.EquipmentSource')
                "
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item :label="$t('equipment.dateOfManufacture')">
              <el-input
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseEnter') + $t('equipment.dateOfManufacture')
                "
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item :label="$t('equipment.factoryNumber')">
              <el-input
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseEnter') + $t('equipment.factoryNumber')
                "
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item :label="$t('equipment.IsItARotatingWheel')">
              <el-select
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseChoose') + $t('equipment.IsItARotatingWheel')
                "
                style="display: block; width: 100%"
              >
                <!-- <el-option label="区域一" value="shanghai"></el-option>
                <el-option label="区域二" value="beijing"></el-option> -->
              </el-select>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item :label="$t('equipment.UseType')">
              <el-select
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseChoose') + $t('equipment.UseType')
                "
                style="display: block; width: 100%"
              >
                <!-- <el-option label="区域一" value="shanghai"></el-option>
                <el-option label="区域二" value="beijing"></el-option> -->
              </el-select>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item :label="$t('equipment.VideoType')">
              <el-select
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseChoose') + $t('equipment.VideoType')
                "
                style="display: block; width: 100%"
              >
                <!-- <el-option label="区域一" value="shanghai"></el-option>
                <el-option label="区域二" value="beijing"></el-option> -->
              </el-select>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item :label="$t('equipment.InstallationPosition')">
              <el-input
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseEnter') + $t('equipment.InstallationPosition')
                "
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item :label="$t('equipment.BelongingRobot')">
              <el-input
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseEnter') + $t('equipment.BelongingRobot')
                "
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item
              :label="$t('equipment.RelativeSpatialPosition') + 'x'"
            >
              <el-input
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseEnter') +
                  $t('equipment.RelativeSpatialPosition') +
                  'x'
                "
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item
              :label="$t('equipment.RelativeSpatialPosition') + 'y'"
            >
              <el-input
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseEnter') +
                  $t('equipment.RelativeSpatialPosition') +
                  'y'
                "
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item
              :label="$t('equipment.RelativeSpatialPosition') + 'z'"
            >
              <el-input
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseEnter') +
                  $t('equipment.RelativeSpatialPosition') +
                  'z'
                "
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item :label="$t('equipment.ipAddress')">
              <el-input
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseEnter') + $t('equipment.ipAddress')
                "
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item :label="$t('equipment.port')">
              <el-input
                v-model="dialogForm.region"
                :placeholder="$t('share.PleaseEnter') + $t('equipment.port')"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item :label="$t('equipment.user')">
              <el-input
                v-model="dialogForm.region"
                :placeholder="$t('share.PleaseEnter') + $t('equipment.user')"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item :label="$t('equipment.password')">
              <el-input
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseEnter') + $t('equipment.password')
                "
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item :label="$t('equipment.VideoNVREncoding')">
              <el-input
                v-model="dialogForm.region"
                :placeholder="
                  $t('share.PleaseEnter') + $t('equipment.VideoNVREncoding')
                "
              ></el-input>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>

      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false"
          >确 定</el-button
        >
      </span>
    </el-dialog>
  </div>
</template>

<script >
import { getList } from "@/api/equipment/equipment";
export default {
  name: "equipment",
  data() {
    return {
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      tableData: [],
      total: 1,
      dialogVisible: false,
      title: "新增",
      dialogForm: {},
    };
  },
  mounted() {
    // this.init();
  },
  methods: {
    init() {
      getList(this.queryParams).then((res) => {
        console.log(res, 11111);
        if (res.code == 200) {
          this.tableData = res.rows;
          this.total = res.total;
        }
      });
    },
    handleClose() {
      this.dialogVisible = false;
    },
    handleAdd() {
      this.dialogVisible = true;
    },
  },
};
</script>

<style lang="scss" scoped>
.operate-left {
  height: 30px;
  display: flex;
  justify-content: flex-end;
  i {
    font-size: 20px;
    margin-left: 5px;
    cursor: pointer;
  }
}
::v-deep .el-tree-node:focus > .el-tree-node__content {
  color: #4a9de7 !important;
  // color: #fff !important;
}
/*节点失焦时的背景颜色*/
//   .el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content{
//     background-color: #4a9de7 !important;
//     color: #fff !important;
//   }
.grid-content-right {
  padding: 0 20%;
}
.titleName {
  font-size: 26px;
  padding: 10px;
}
.number-title {
  margin-left: 10px;
}
.serial-number {
  color: #999;
  font-size: 12px;
  margin-bottom: 30px;
  margin-top: 20px;
}
.mainSystem {
  ::v-deep.el-form-item__label {
    color: rgb(255, 200, 0);
  }
}
</style>
