<template>
  <div class="app-container">
    <div class="box-lfet">
      <div class="data">
        <p>日期</p>
        <!-- <el-date-picker
          v-model="value"
          type="date"
          size="mini"
          align="right"
          placeholder="日期"
        >
        </el-date-picker> -->
        <div class="a1"></div>
        <el-date-picker
          v-model="tiem"
          type="date"
          :editable="false"
          placeholder="选择日期"
        >
        </el-date-picker>
      </div>
      <div class="dadui">
        <img src="../../../images/星星.png" alt="" />
        单位
      </div>
      <div class="tree">
        <el-tree
          :data="deptOptions"
          :props="defaultProps"
          @node-click="handleNodeClick"
          default-expand-all
          :expand-on-click-node="false"
        ></el-tree>
      </div>
    </div>

    <div class="box-right">
      <!-- 搜索条件区域 -->
      <el-form
        :model="queryParams"
        ref="queryForm"
        :inline="true"
        v-show="showSearch"
        label-width="68px"
      >
      </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"
            v-hasPermi="['grassrootsregistration :bdgldiary:add']"
            >新增</el-button
          >
        </el-col>
        <el-col :span="1.5">
          <el-button
            type="success"
            plain
            icon="el-icon-edit"
            size="mini"
            :disabled="single"
            @click="handleUpdate"
            v-hasPermi="['grassrootsregistration :bdgldiary: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"
            v-hasPermi="['grassrootsregistration :bdgldiary:remove']"
            >删除</el-button
          >
        </el-col>
        <el-col :span="1.5">
          <el-button
            type="warning"
            plain
            icon="el-icon-download"
            size="mini"
            :loading="exportLoading"
            @click="handleExport"
            v-hasPermi="['grassrootsregistration :bdgldiary:export']"
            >导出</el-button
          >
        </el-col>
      </el-row>

      <!-- 搜索结果区域 -->
      <el-table
        v-loading="loading"
        :data="bdgldiaryList"
        @selection-change="handleSelectionChange"
        :header-cell-style="{ background: '#003C69', color: 'white' }"
      >
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="序号" align="center" prop="id" />
        <el-table-column label="单位" align="center" prop="unitName" />
        <el-table-column label="值班人员" align="center" prop="peopleName" />
        <el-table-column
          label="值班日期"
          align="center"
          prop="blogDate"
          width="180"
          :editable="false"
        >
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.blogDate, "{y}-{m}-{d}") }}</span>
          </template>
        </el-table-column>
        <el-table-column label="编制干部" align="center" prop="orgcadre" />
        <el-table-column label="编制战士" align="center" prop="orgsoldier" />
        <el-table-column label="编制文职" align="center" prop="orgcivilian" />
        <el-table-column
          width="200"
          label="操作"
          align="center"
          class-name="small-padding fixed-width"
        >
          <template slot-scope="scope">
            <el-button
              size="btk"
              type="text"
              @click="handleChakan(scope.row)"
              v-hasPermi="['grassrootsregistration :bdgldiary:edit']"
              ><span class="chakan">查看</span></el-button
            >
            <el-button
              size="btu"
              type="text"
              @click="handleUpdate(scope.row)"
              v-hasPermi="['grassrootsregistration :bdgldiary:edit']"
              ><span class="edit">修改</span></el-button
            >
            <el-button
              size="btd"
              type="text"
              @click="handleDelete(scope.row)"
              v-hasPermi="['grassrootsregistration :bdgldiary:remove']"
              ><span class="delete">删除</span></el-button
            >
          </template>
        </el-table-column>
      </el-table>

      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />

      <!-- 添加或修改要事日记对话框 -->

      <el-dialog
        :title="title"
        :visible.sync="open"
        width="1016px"
        append-to-body
        :lock-scroll="false"
      >
        <el-form
          ref="form"
          :model="form"
          :rules="rules"
          label-width="80px"
          :inline="true"
        >
          <div class="jiben">基本信息</div>
          <el-form-item label="单位" prop="unitId">
            <treeselect
              @select="selectPeo"
              v-model="form.unitId"
              :options="rese"
              placeholder="选择单位"
            />
          </el-form-item>

          <el-form-item label="值班人员" prop="peopleId">
            <el-select
              v-model="form.peopleName"
              placeholder="请输入单位"
              clearable
              @change="btn"
            >
              <el-option
                :label="item.name"
                v-for="(item, i) in renYuan"
                :key="i"
                :value="item"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="值班日期" prop="blogDate">
            <el-date-picker
              clearable
              size="small"
              v-model="form.blogDate"
              type="date"
              value-format="yyyy-MM-dd"
              placeholder="选择值班日期"
              class="text"
              :editable="false"
              @change="blogDate"
            >
            </el-date-picker>
          </el-form-item>
          <el-form-item label="天气" prop="weather">
            <el-input v-model="form.weather" placeholder="请输入天气" />
          </el-form-item>
          <el-form-item label="值班首长" prop="peopleId">
            <el-select v-model="form.lead" placeholder="请选择首长" clearable>
              <el-option
                :label="item.userName"
                v-for="(item, i) in shouZhang"
                :key="i"
                :value="item.userId"
              ></el-option>
            </el-select>
          </el-form-item>
          <div class="jiben">实力情况</div>
          <el-form-item label="编制干部" prop="orgcadre">
            <el-input-number
              v-model="form.orgcadre"
              controls-position="right"
              :min="0"
              :max="99999999"
            ></el-input-number>
          </el-form-item>
          <el-form-item label="编制战士" prop="orgsoldier">
            <!-- <el-input v-model="form.orgsoldier" placeholder="请输入编制战士" /> -->
            <el-input-number
              v-model="form.orgsoldier"
              controls-position="right"
              :min="0"
              :max="99999999"
            ></el-input-number>
          </el-form-item>
          <el-form-item label="编制文职" prop="orgcivilian">
            <!-- <el-input v-model="form.orgcivilian" placeholder="请输入编制文职" /> -->
            <el-input-number
              v-model="form.orgcivilian"
              controls-position="right"
              :min="0"
              :max="99999999"
            ></el-input-number>
          </el-form-item>
          <el-form-item label="现有干部" prop="nowcadre">
            <!-- <el-input v-model="form.nowcadre" placeholder="请输入现有干部" /> -->
            <el-input-number
              v-model="form.nowcadre"
              controls-position="right"
              :min="0"
              :max="99999999"
            ></el-input-number>
          </el-form-item>
          <el-form-item label="现有战士" prop="nowsoldier">
            <el-input-number
              v-model="form.nowsoldier"
              controls-position="right"
              :min="0"
              :max="99999999"
            ></el-input-number>
          </el-form-item>
          <el-form-item label="现有文职" prop="nowcivilian">
            <!-- <el-input v-model="form.nowcivilian" placeholder="请输入现有文职" /> -->
            <el-input-number
              v-model="form.nowcivilian"
              controls-position="right"
              :min="0"
              :max="99999999"
            ></el-input-number>
          </el-form-item>
          <div class="jiben">训练、教育或者执行其他任务情况</div>
          <div class="box">
            <table
              border="1"
              width="920"
              cellspacing="0"
              align="center"
              style="border-color: white"
            >
              <tr align="center">
                <td width="200">区分</td>
                <td colspan="2" width="420">内容</td>
                <td width="100">应到人数</td>
                <td width="100">实到人数</td>
                <td width="100">到课率</td>
              </tr>
              <tr align="center">
                <td>
                  <el-input v-model="input" placeholder="请输入时间"></el-input>
                </td>
                <td rowspan="2" colspan="2">
                  <el-input
                    type="textarea"
                    :rows="1"
                    placeholder="请输入内容"
                    v-model="textarea"
                  >
                  </el-input>
                </td>
                <td>
                  <el-input v-model="input" placeholder="应到人数"></el-input>
                </td>
                <td>
                  <el-input v-model="input" placeholder="实到人数"></el-input>
                </td>
                <td>
                  <el-input v-model="input" placeholder="到课率"></el-input>
                </td>
              </tr>
            </table>
          </div>

          <div class="jiben">公差勤务</div>
          <el-form-item prop="tolerance">
            <el-input
              v-model="form.tolerance"
              type="textarea"
              placeholder="请输入内容"
            />
          </el-form-item>
          <div class="jiben">人员调动</div>
          <el-form-item prop="transfer">
            <el-input
              v-model="form.transfer"
              type="textarea"
              placeholder="请输入内容"
            />
          </el-form-item>
          <div class="jiben">装备变动</div>
          <el-form-item prop="equip">
            <el-input
              v-model="form.equip"
              type="textarea"
              placeholder="请输入内容"
            />
          </el-form-item>
          <div class="jiben">内务情况</div>
          <el-form-item prop="internal">
            <el-input
              v-model="form.internal"
              type="textarea"
              placeholder="请输入内容"
            />
          </el-form-item>
          <div class="jiben">配班情况</div>
          <el-form-item label="值班组织人" prop="dutylead">
            <el-select
              v-model="form.dutylead"
              placeholder="请输入单位"
              clearable
              @change="dutylead"
            >
              <el-option
                :label="item.name"
                :value="item"
                v-for="(item, i) in renYuan"
                :key="i"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="值班交班人" prop="dutya">
            <!-- <el-input v-model="form.dutya" placeholder="请输入值班交班人" /> -->
            <el-select
              v-model="form.dutyA"
              placeholder="请输入单位"
              clearable
              @change="dutya"
            >
              <el-option
                :label="item.name"
                :value="item"
                v-for="(item, i) in renYuan"
                :key="i"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="值班接班人" prop="dutyb">
            <!-- <el-input v-model="form.dutyb" placeholder="请输入值班接班人" /> -->
            <el-select
              v-model="form.dutyB"
              placeholder="请输入单位"
              clearable
              @change="dutyb"
            >
              <el-option
                :label="item.name"
                :value="item"
                v-for="(item, i) in renYuan"
                :key="i"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="值日交班人" prop="dutyc">
            <!-- <el-input v-model="form.dutyc" placeholder="请输入值日交班人" /> -->
            <el-select
              v-model="form.dutyC"
              placeholder="请输入单位"
              clearable
              @change="dutyc"
            >
              <el-option
                :label="item.name"
                :value="item"
                v-for="(item, i) in renYuan"
                :key="i"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="值日接班人" prop="dutyd">
            <!-- <el-input v-model="form.dutyd" placeholder="请输入值日接班人" /> -->
            <el-select
              v-model="form.dutyD"
              placeholder="请输入单位"
              clearable
              @change="dutyd"
            >
              <el-option
                :label="item.name"
                :value="item"
                v-for="(item, i) in renYuan"
                :key="i"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="厨房交班人" prop="dutye">
            <!-- <el-input v-model="form.dutye" placeholder="请输入厨房交班人" /> -->
            <el-select
              v-model="form.dutyE"
              placeholder="请输入单位"
              clearable
              @change="dutye"
            >
              <el-option
                :label="item.name"
                :value="item"
                v-for="(item, i) in renYuan"
                :key="i"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="厨房接班人" prop="dutyf">
            <el-select
              v-model="form.dutyF"
              placeholder="请输入单位"
              clearable
              @change="dutyf"
            >
              <el-option
                :label="item.name"
                :value="item"
                v-for="(item, i) in renYuan"
                :key="i"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="交接时间" prop="dutyDate">
            <el-date-picker
              clearable
              size="small"
              v-model="form.dutyDate"
              type="date"
              value-format="yyyy-MM-dd"
              placeholder="选择交接时间"
            >
            </el-date-picker>
          </el-form-item>
          <div class="jiben">病号处理情况</div>
          <el-form-item prop="invalid">
            <el-input
              v-model="form.invalid"
              type="textarea"
              placeholder="请输入内容"
            />
          </el-form-item>
          <div class="jiben">上级通知</div>
          <el-form-item prop="notice">
            <el-input
              v-model="form.notice"
              type="textarea"
              placeholder="请输入内容"
            />
          </el-form-item>
          <div class="jiben">一周工作计划合集</div>
          <el-form-item prop="weekwork">
            <el-input
              v-model="form.weekwork"
              type="textarea"
              placeholder="请输入内容"
            />
          </el-form-item>
          <el-form-item label="审批" prop="examine" v-show="false">
            <el-input v-model="form.examine" placeholder="请输入审批" />
          </el-form-item>
          <el-form-item label="审批" prop="peopleId1" v-show="false">
            <el-input v-model="form.peopleId1" placeholder="请输入审批" />
          </el-form-item>
          <div class="jiben">审批不通过原因</div>
          <el-form-item prop="contents">
            <el-input
              v-model="form.contents"
              placeholder="请输入审批不通过原因"
              type="textarea"
            />
          </el-form-item>

          <div class="jiben">查铺查哨</div>
          <div class="box3">
            <el-form v-for="(item1, e) in checkShop" :key="e">
              <div >
                <el-form-item label="" prop="">
                  <el-input
                    v-model="item1.peopleName"
                    placeholder="检查人"
                  ></el-input>
                </el-form-item>
                <el-form-item label="" prop="">
                  <el-input
                    v-model="item1.foremanName"
                    placeholder="领班员"
                  ></el-input>
                </el-form-item>
                <el-form-item label="" prop="">
                  <el-input
                    v-model="item1.sentryName"
                    placeholder="哨兵姓名"
                  ></el-input>
                </el-form-item>
                <el-form-item label="" prop="">
                  <el-date-picker
                    v-model="item1.examineDate"
                    type="date"
                    :editable="false"
                    size="mini"
                    placeholder="选择日期"
                    value-format="yyyy-MM-dd"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="" prop="">
                  <el-input
                    v-model="item1.dialogue"
                    placeholder="检查情况"
                  ></el-input>
                </el-form-item>
                <el-form-item>
                   <el-button
                    type="primary"
                    icon="el-icon-plus"
                    size="mini"
                    @click="addForms"
                    v-if="e==checkShop.length-1"
                  ></el-button>
                  <el-button
                    type="primary"
                    icon="el-icon-delete"
                    size="mini"
                    v-if="e > 0"
                    @click="delForms(e)"
                  ></el-button>
                 
                  
                </el-form-item>
              </div>
            </el-form>
          </div>
          <div class="jiben">临时来队亲属</div>
          <div class="box3" >
            <el-form v-for="(item1, i) in relatives" :key="i">
              <el-form-item label="" prop="">
                <el-select v-model="item1.peopleId" placeholder="军人姓名">
                  <el-option
                    v-for="item in renYuan"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="" prop="">
                <el-input
                  v-model="item1.name"
                  placeholder="家属姓名"
                ></el-input>
              </el-form-item>
              <el-form-item label="" prop="">
                <el-input
                  v-model="item1.relation"
                  placeholder="关系"
                ></el-input>
              </el-form-item>
              <el-form-item label="" prop="">
                <el-date-picker
                  v-model="item1.comeDate"
                  type="date"
                  :editable="false"
                  size="mini"
                  placeholder="来队时间"
                  value-format="yyyy-MM-dd"
                >
                </el-date-picker>
              </el-form-item>
              <el-form-item label="" prop="">
                <el-date-picker
                  v-model="item1.leaveDate"
                  type="date"
                  :editable="false"
                  size="mini"
                  placeholder="离队时间"
                  value-format="yyyy-MM-dd"
                >
                </el-date-picker>
              </el-form-item>
              <el-form-item>
                <el-button
                  type="primary"
                  icon="el-icon-plus"
                  size="mini"
                  @click="addFormss"
                  v-if="i==relatives.length-1"
                ></el-button>
                <el-button
                  type="primary"
                  icon="el-icon-delete"
                  size="mini"
                  v-if="i > 0"
                  @click="delFormss(i)"
                ></el-button>
              
                
              </el-form-item>
            </el-form>
          </div>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="resertwo">重置</el-button>
          <el-button type="primary" @click="submitForm(1)">确 定</el-button>
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script>
import {
  listBdgldiary,
  getBdgldiary,
  delBdgldiary,
  addBdgldiary,
  updateBdgldiary,
  exportBdgldiary,
} from "@/api/grassrootsregistration/bdgldiary";

import {
  getDept,
  getZhuChiRen,
  getUser,
  getBdgDay,
  getShiLi,
  getRed,
} from "@/api/grassrootsregistration/bdglmeeting";

import { getDicts } from "@/api/system/dict/data";
// 导入树形结构
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { treeselect } from "@/api/system/dept";
export default {
  components: { Treeselect },
  name: "Bdgldiary",
  data() {
    return {
      //判断关闭
      style: "2",
      // 获取首长
      shouZhang: [],
      // 人员组织
      renYuan: [],
      // 添加的树形单位
      rese: [],
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 要事日记表格数据
      bdgldiaryList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        unitId: null,
        peopleId: null,
        blogDate: null,
        weather: null,
        orgcadre: null,
        orgsoldier: null,
        orgcivilian: null,
        nowcadre: null,
        nowsoldier: null,
        nowcivilian: null,
        tolerance: null,
        transfer: null,
        equip: null,
        internal: null,
        dutylead: null,
        dutyA: null,
        dutyB: null,
        dutyC: null,
        dutyD: null,
        dutyE: null,
        dutyF: null,
        dutyinfoa: null,
        dutyinfoc: null,
        dutyinfoe: null,
        dutyDate: null,
        invalid: null,
        notice: null,
        lead: null,
        weekwork: null,
        examine: null,
        peopleId1: null,
        contents: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        unitId: [
          { required: true, message: "单位名称不能为空", trigger: "blur" },
        ],
        peopleId: [
          // { required: true, message: "值班人员不能为空", trigger: "blur" },
        ],
        blogDate: [
          { required: true, message: "值班日期不能为空", trigger: "blur" },
        ],
        weather: [{ required: true, message: "天气不能为空", trigger: "blur" }],
        peopleId: [
          // { required: true, message: "值班首长不能为空", trigger: "blur" },
        ],
        orgcadre: [
          { required: true, message: "编制干部不能为空", trigger: "blur" },
        ],
        orgsoldier: [
          { required: true, message: "编制战士不能为空", trigger: "blur" },
        ],
        orgcivilian: [
          { required: true, message: "编制文职不能为空", trigger: "blur" },
        ],
        nowcadre: [
          { required: true, message: "现有干部不能为空", trigger: "blur" },
        ],
        nowsoldier: [
          { required: true, message: "现有战士不能为空", trigger: "blur" },
        ],
        nowcivilian: [
          { required: true, message: "现有文职不能为空", trigger: "blur" },
        ],
      },
      BdgDay: [],
      // 搜索人员
      Renyuan: [],
      // 字典类型查询
      dictType: {
        dictType: "yssp",
      },
      // 字典数据
      ziDian: [],
      //左侧树状
      deptOptions: undefined,
      //左侧时间选择
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now();
        },
      },
      defaultProps: {
        children: "children",
        label: "label",
      },
      // 组织人搜索列表00
      list: [],
      // 下拉选项显示隐藏
      xiaLa: false,
      // 查铺查岗数组
      // checkShop: [
      //   {
      //     peopleName: null,
      //     foremanName: null,
      //     sentryName: null,
      //     examineDate: null,
      //     dialogue: null,
      //   },
      // ],
      //添加对话框查铺表格为空
      checkShop: [
        {
         peopleName: null,
          foremanName: null,
          sentryName: null,
          examineDate: null,
          dialogue: null,
        },
      ],
      //添加对话框来访人员表格为空
      relatives: [
        {
         peopleId: null,
          name: null,
          relation: null,
          comeDate: null,
          leaveDate: null,
        },
      ],
      // 临时来队亲属
      relatives: [
        {
          peopleId: null,
          name: null,
          relation: null,
          comeDate: null,
          leaveDate: null,
        },
      ],
      // 搜索时间保存
      tiem: null,
      input2: "",
      options: "",
      input: "",
      textarea: "",
    };
  },

  created() {
    this.getList();
    // 获取单位
    this.getDept();
    // 获取字典通过未通过
    this.getdict();
    // 获取部门树形
    this.treeselect();
    // 外部树形
    this.getTreeselect();
    this.getGreeg();
  },
  methods: {
    // 获取小红小绿状态
    getGreeg() {
      getRed().then((res) => {
        console.log(res);
      });
    },
    // 选中军人触发
    junRen(val) {
      this.relatives[0].peopleId = val.id;
      this.relatives[0].peopleName = val.name;
    },
    /** 查询部门下拉树结构 */
    getTreeselect() {
      getDept().then((response) => {
        this.rese = response.data;
      });
    },

    // 增加对话框查铺
    addForms() {
      this.checkShop.push({
        peopleName: null,
        foremanName: null,
        sentryName: null,
        examineDate: null,
        dialogue: null,
      });
    },

    // 删除对话框查铺
    delForms(i) {
      this.checkShop.splice(i, 1);
    },

    //增加对话框临时来访人员
    addFormss() {
      this.relatives.push({
        peopleId: null,
        name: null,
        relation: null,
        comeDate: null,
        leaveDate: null,
      });
    },
    //删除对话框临时来访人员
    delFormss(e) {
      this.relatives.splice(e, 1);
    },

    // 获取部门树形
    treeselect() {
      getDept().then((res) => {
        this.deptOptions = res.data;
      });
    },
    //外面树形选择搜索
    handleNodeClick(data) {
      this.queryParams.unitId = data.id;
      this.getList();
    },

    // 选择值班人触发
    btn(val) {
      // console.log(val);
      this.form.peopleId1 = val.id;
      this.form.peopleName = val.name;
    },
    // 选择值班组织人触发
    dutylead(val) {
      this.form.dutylead = val.name;
    },
    // 配班情况
    dutya(val) {
      this.form.dutya = val.name;
    },
    dutyb(val) {
      this.form.dutyb = val.name;
    },
    dutyc(val) {
      this.form.dutyc = val.name;
    },
    dutyd(val) {
      this.form.dutyd = val.name;
    },
    dutye(val) {
      this.form.dutye = val.name;
    },
    dutyf(val) {
      this.form.dutyf = val.name;
    },
    // 当选择单位时候重置人员
      chongZhi(){
        this.form={
          peopleId:null,
          lead:null,
         dutyA:null,
         dutyB:null,
         dutyC:null,
         dutyD:null,
         dutyE:null,
         dutyF:null,
         dutylead:null,
        },
        this.relatives=[
          {
            peopleId:null
          }
        ]
      },
    // 当点击完成值班时间的选择发起请求
    blogDate() {
      //  console.log(11);
      getBdgDay(this.form).then((res) => {
        this.BdgDay = res.data;
      });
    },
    // 获取实力情况
    getShiLiRen(id) {
      getShiLi(id).then((res) => {
        console.log(res, "获得实力情况");
        this.form.orgcadre = res.data.ganbu;
        this.form.orgsoldier = res.data.shiBin;
        this.form.orgcivilian = res.data.wenZhi;
        this.form.nowcadre = res.data.xianYouGanBu;
        this.form.nowsoldier = res.data.xianYouShiBin;
        this.form.nowcivilian = res.data.xianYouWenZhi;
      });
    },
    // 单位选折触发
    selectPeo(data) {
      this.chongZhi()
      this.form.unitId = data.id;
      // 获取实力情况
      this.form.deptId = data.id;
      this.getShiLiRen(this.form.deptId);
      this.getRenYuan(this.form.unitId);
      this.getShou(this.form.unitId);
    },
    // 根据部门获取人员
    getRenYuan(id) {
      getZhuChiRen(id).then((res) => {
        console.log(res);
        this.renYuan = res.data;
      });
    },
    // 获取首长
    getShou(id) {
      getUser(id).then((res) => {
        console.log(res, "获取首长");
        this.shouZhang = res.data;
      });
    },
    // 搜索第一个选中触发
    search() {
      getZhuChiRen(this.queryParams.deptId).then((res) => {
        this.Renyuan = res.data;
      });
      this.getList();
    },
    // 搜索审批触发
    approve(val) {
      this.queryParams.examine = val * 1;
      this.getList();
    },
    // 字典查询
    getdict() {
      getDicts(this.dictType.dictType).then((res) => {
        // console.log(res);
        this.ziDian = res.data;
      });
    },
    /** 查询要事日记列表 */
    getList() {
      this.loading = true;
      listBdgldiary(this.queryParams).then((response) => {
        this.bdgldiaryList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 查询单位列表
    async getDept() {
      const res = await getDept();
      this.rese = res.data;
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        unitId: null,
        peopleId: null,
        blogDate: null,
        weather: null,
        orgcadre: null,
        orgsoldier: null,
        orgcivilian: null,
        nowcadre: null,
        nowsoldier: null,
        nowcivilian: null,
        tolerance: null,
        transfer: null,
        equip: null,
        internal: null,
        dutylead: null,
        dutya: null,
        dutyb: null,
        dutyc: null,
        dutyd: null,
        dutye: null,
        dutyf: null,
        dutyinfoa: null,
        dutyinfoc: null,
        dutyinfoe: null,
        dutyDate: null,
        invalid: null,
        notice: null,
        lead: null,
        weekwork: null,
        examine: null,
        peopleId1: null,
        contents: null,
        createId: null,
        createName: null,
      };
       this.relatives= [
          {
            name: null,
            relation: null,
            comeDate: null,
            leaveDate: null,
            peopleId: null,
            peopleName: null,
          },
        ],
       this. checkShop=[
          {
            peopleName: null,
            foremanName: null,
            sentryName: null,
            examineDate: null,
            dialogue: null,
          },
        ],
      this.resetForm("form");
    },
    /** 对话框重置按钮操作 */
    resertwo() {
      this.reset();
    },

    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd(e) {
       // 获取首长
      this.shouZhang= [],
      // 人员组织
      this.renYuan= [],
      this.treeselect();
      this.getTreeselect();
      this.reset();
      this.open = true;
      this.title = "添加要事日记";
      this.style = 2;
      e.preventDefault();
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.getTreeselect();
      this.treeselect();
      this.reset();
      const id = row.id || this.ids;
      getBdgldiary(id).then((response) => {
        this.form = response.data;
        // 请求人员
        this.getRenYuan(this.form.unitId);
        //  请求首长
        this.getShou(this.form.unitId);

        this.open = true;
        this.checkShop = response.data.inspect;
        this.relatives = response.data.kinsfolk;
        this.title = "修改要事日记";
      });
    },
    // 查看按钮操作
    handleChakan(row) {
      this.reset();
      const id = row.id || this.ids;
      getBdgldiary(id).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = "查看要事日记";
      });
    },
    /** 提交按钮 */
    submitForm(style) {
      this.style = style;
      this.$refs["form"].validate((valid) => {
        if (valid) {
          this.form.inspect = this.checkShop;
          this.form.kinsfolk = this.relatives;
          if (this.form.id != null) {
            updateBdgldiary(this.form).then((response) => {
              console.log(this.form);
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            // 查铺查哨
            this.form.inspect = this.checkShop;
            // 来对亲属
            this.form.kinsfolk = this.relatives;
            addBdgldiary(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal
        .confirm('是否确认删除要事日记编号为"' + ids + '"的数据项？')
        .then(function () {
          return delBdgldiary(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$modal
        .confirm("是否确认导出所有要事日记数据项？")
        .then(() => {
          this.exportLoading = true;
          return exportBdgldiary(queryParams);
        })
        .then((response) => {
          this.$download.name(response.msg);
          this.exportLoading = false;
        })
        .catch(() => {});
    },
  },
};
</script>

<style scoped>
/deep/.el-dialog {
  width: 1016px !important;
  background-color: #004d86;
}
/deep/.el-dialog__header {
  border-bottom: 1px solid #718a9d;
}
/deep/.el-dialog__title {
  color: #fff;
  font: 18px;
}
/deep/.el-dialog__headerbtn .el-dialog__close {
  color: #fff;
}
/deep/.el-form-item__label {
  font: 16px;
  color: #fff;
  width: 100px !important;
}
/deep/.el-input--small .el-input__inner {
  width: 200px !important;
  height: 36px;
}
/deep/.el-textarea__inner {
  width: 920px;
  height: 104px;
}
/deep/.el-select-dropdown__list {
  border: none;
}
.el-date-table,
.el-select-dropdown__item {
  color: #fff;
}
.el-select-dropdown__item.hover,
.el-select-dropdown__item:hover {
  background-color: #196299;
}
.el-select-dropdown__item.hover,
.el-select-dropdown__item:hover {
  color: #fff !important;
}
/deep/.el-dialog__body {
  margin: 0px 20px;
  box-sizing: border-box;
  padding: 30px 12px 30px 28px;
}
/* 表单背景 */
/deep/.el-input__inner {
  background-color: transparent;
  color: #fff;
}
/* 调整表单间距 */
::v-deep .el-date-editor.el-input,
.el-date-editor.el-input__inner {
  width: 200px;
}
.el-dialog__body .roll-dialog {
  padding: 3px, 30px;
  overflow-y: auto;
}
.box {
  font-size: 14px;
  color: #fff;
  padding: 0 12px 0 0;
}
/deep/.btn {
  width: 76px;
  height: 36px;
  color: #fff;
  background-color: #1d96ff;
  border-radius: 4px;
  border: none;
  margin-left: 20px;
  font-size: 14px;
}
/deep/.el-icon-refresh {
  font-size: 16px;
  margin-left: -3px;
}
/deep/.el-input-number__increase {
  background-color: transparent !important;
  border: none;
  color: #cccccc;
  border-bottom: none !important;
}
/deep/.el-input-number__decrease {
  background-color: transparent !important;
  border: none !important;
  color: #cccccc;
}

::v-deep .el-form-item__content {
  width: 200px;
  cursor: pointer !important;
}
/* 单位框背景颜色 */
::v-deep .vue-treeselect__control {
  background: #004d86 !important;
  color: #fff;
}
/* 单位下拉菜单选中字体颜色 */
::v-deep .vue-treeselect__single-value {
  color: #fff !important;
}
/* 分页按钮 */
::v-deep .el-pagination.is-background .el-pager li {
  background-color: #004d86;
  color: #fff;
}
::v-deep .el-pagination.is-background .btn-next {
  background-color: #004d86;
  color: #fff;
}
::v-deep .el-pagination.is-background .btn-prev,
.el-pagination.is-background .btn-next,
.el-pagination.is-background .el-pager li {
  background: #004d86 !important;
  color: #fff !important;
}

.app-container {
  display: flex;
}
/* 左侧树状盒子 */
.app-container .box-lfet {
  width: 15%;
  height: 740px;
  /* background: #003156; */
  /* padding: 10px; */
  margin-right: 10px;
  /* border: 1px solid white; */
}
/* 右侧内容盒子 */
.app-container .box-right {
  flex: 1;
}
.app-container .box-lfet .data {
  height: 40px;
  background: #003156;
  margin-bottom: 12px;
  color: #fff;
  display: flex;
  font-size: 13px;
  line-height: 25px;
  position: relative;
}
.el-tree {
  padding: 10px;
  background: #003156;
  color: #fff;
}
::v-deep .el-tree-node__content:hover {
  background-color: #004d86 !important;
}
::v-deep .el-tree-node:focus > .el-tree-node__content {
  background-color: #003156 !important;
}
::v-deep .el-table__empty-block {
  background-color: #004d86 !important;
}
::v-deep .el-table .el-table__header-wrapper th,
.el-table .el-table__fixed-header-wrapper th {
  word-break: break-word;
  background-color: #004d86 !important;
  color: #fff;
}
/* ::v-deep .box-lfet .data .el-input__inner {
  background-color: transparent;
  color: #fff;
  width: 130px;
  border: none;
} */
/* ::v-deep .box-lfet .data .el-input__prefix {
  right: 0px;
} */

.box-lfet .dadui {
  height: 40px;
  background: #003156;
  /* border-bottom: 1px solid #718A9D ; */
  background-image: url(../../../images/矩形底部边框.png);
  background-repeat: no-repeat;
  background-position: 0px 39px;
  font-size: 16px;
  color: #1d96ff;
}
.box-lfet .dadui img {
  margin: 10px 10px 0px 10px;
}

.box-lfet .data p {
  position: absolute;
  top: -5px;
  left: 15px;
}
.box-lfet .data .a1 {
  width: 128px;
  height: 26px;
  background: rgba(23, 74, 112, 0.4);
  border-radius: 13px;
  position: absolute;
  top: 7px;
  left: 60px;
}
::v-deep .data .el-date-editor.el-input {
  width: 100%;
  border: none;
}
::v-deep .data .el-input__inner {
  width: 100% !important;
  border: none;
}
::v-deep .data .el-input--medium .el-input__icon {
  line-height: 36px;
  position: absolute;
  right: -223px;
  top: 2px;
}
::v-deep .data .el-input__inner {
  background-color: transparent;
  color: #fff;
  text-align: center;
  margin-top: 2px;
}
::v-deep .data .el-input__suffix {
  position: absolute;
  right: 281px;
}
/* 输入框显示手指 */
::v-deep .el-input__inner {
  cursor: pointer !important;
}
/* 训练、教育或者执行其他任务情况 */
.box {
  margin-bottom: 25px;
}
::v-deep .box .el-textarea__inner {
  width: 395px;
  border: none;
  height: 50px;
}
::v-deep .box .el-input__inner {
  width: 100%;
  height: 100%;
  border: none;
  text-align: center;
}

/* 查铺查哨-临时来对亲属 */
.box3 {
  width: 920px;
  min-height: 70px;
  border: 1px solid white;
  border-radius: 5px;
  /* background: #409eff; */
  margin-bottom: 30px;
  padding-top: 15px;
  padding-left: 15px;
}
/* 表单长度 */
::v-deep .box3 .el-form-item__content {
  width: 116px;
}
::v-deep .box3 .el-input__inner {
  width: 116px;
  height: 37px;
}
/* 添加删除按钮 */
::v-deep .box3 .el-button {
  width: 32px;
  height: 32px;
  text-align: center;
  margin-left: -6px;
  margin-right: 3px;
  margin-left: 8px;
}
::v-deep .box3 .el-button .el-icon-plus {
  margin-left: -6px;
}
::v-deep .box3 .el-button .el-icon-delete {
  margin-left: -6px;
}
::v-deep .el-input__prefix {
  display: none;
}
::v-deep .el-date-editor.el-input {
  width: 116px;
  height: 36px;
  line-height: 36px;
}
::v-deep .box3 .el-form-item__content .el-input__inner {
  padding: 0px 15px;
}

.el-dialog__body {
  color: #fff;
}
::v-deep .vue-treeselect__menu {
  background: #004d86;
}
</style>
