惩治标题党,vue2监听父组件传过来的值,el-tree一键全选多个树形

news2024/11/18 22:25:47

vue2监听父组件传过来的值

父组件使用的动态组件,然后父传子

<component :is="checkedIt" :riskQuarter='riskQuarter' :riskYear='riskYear'></component>

子组件打印 

  console.log('riskQuarter :>> ', this.$props.riskQuarter);

监听

 props: {
    riskQuarter: {
      type: String,
      required: true
    },
    riskYear: {
      type: String,
      default: 0
    }
  },

watch: {
    riskYear: function() {
      this.getPage();//调列表
    },
    riskQuarter: function() {
      this.getPage();
    },
  
  },

vue2引入文件外部css文件,这玩意可以结合媒体查询用。@import引入的css会在页面加载完毕后加载

<style lang="scss" scoped>
@import 'report.scss';
</style>

设置伪元素作为图标

 

.setButtonShow::after {
  content: "";
  position: absolute;
  pointer-events: auto;
  font-weight: bold;
  bottom: -18px;
  left: 50%;
  font-size: 20px;
  background: url(../../../images/down.png) no-repeat left center;
  background-size: 100%;
  color: var(--mainColor);
  display: inline-block;
  width: 25px;
  height: 20px;
  line-height: 20px;
  cursor: pointer;
  border-radius: 50%;
  margin-right: 5px;
  margin-left: 5px;
  text-align: center;
}

实现树形结构数据全选,el-tree全选多个树形,使用elementUi实现

 

定义data中的值。。。懒得过滤给你们看具体有哪几个了,主要看功能的实现吧 

 data() {
    const that = this;
    return {
      props: {
        label: "name"
      },
      tree1Data: [],
      tree2Data: [],
      editCheckOrg: true,
      editCheckDep: true,
      newCheckOrg: true,
      newCheckDep: true,
      timeRange: [],
      importTime: "",
      importlogShow: false,
      header: {
        Authorization: sessionStorage.getItem("header")
      },
      editBtnFlag: false,
      loginUl: JSON.parse(sessionStorage.getItem("loginUl")),
      userName: that.userName,
      isRole: false, //打开用户组
      loading: true,
      missionList: [],
      cur: 1, //分页
      all: 0,
      rows: 15, //条数
      totalCount: 0, //总条数
      list: {},
      searchVal: "", //搜索
      gridData: [],
      options: "", //地域
      value: "",
      optionsUnit: "", //单位名称
      valueUnit: "",
      optionsSubordinate: "", //下级单位
      valueSubordinate: "",
      checked: false, //全选框状态
      checkeds: false,
      isHint: false, //删除
      deleteId: "",
      item: {
        name: "确定删除选中的数据吗?"
      },
      tradeSettingShow: false,
      saveLoading: false,
      tradeSetting: {},
      editSHow: false,
      addressId: "",
      orgId: "",
      deleteIds: "",
      editList: "",
      addListsj: [],
      addListsjs: [],
      uploadLoading: false,
      addxz: "", //新建 /条线
      loginList: { orgId: "" }, //登录信息
      departmentName: "", //新建部门
      LineList: [
        {
          name: "业务条线",
          id: 2
        },
        {
          name: "品牌条线",
          id: 1
        }
      ],
      perentAdd: [], //新建/上级部门
      unitList: [], //新建/上级单位
      prendId: "",
      lineVal: "",
      type: "",
      orgShortNames: "",
      num: 1,
      parentDepName: "",
      orderBy: 0,
      unitXID: JSON.parse(localStorage.getItem("loginUl")).orgId,
      parentId: "",
      parentList: [],
      parentName: "",
      seeDetail: false,
      isAllSign: true,
      fileList: [],
      fileName: "",
      attachmentLists: [],
      valueInfo: "",
      optionss: [],
      receiveDepIds: [],
      uniqueArray: [],
      optionas: "",
      depDetailList: [],
      setOrgId: [],
      saveItemInfo: {},
      optionTime: [
        {
          value: "",
          label: "全部"
        },
        {
          value: 1,
          label: "一天"
        },
        {
          value: 7,
          label: "一周"
        },
        {
          value: 30,
          label: "一月"
        },
        {
          value: -1,
          label: "自定义"
        }
      ]
    };
  },

 

 

  //获取接口数据后给树形结构全选时的标题命名并赋值子元素

if (this.optionss && this.optionss.length) {
            var name = "全部省分公司";
            if (this.loginUl.orgParentId == 7) {
              name = "全部市分公司";
            }
            if (this.loginUl.orgParentId != 7 && this.loginUl.orgParentId) {
              name = "全部县分公司";
            }
            this.tree1Data = [{ name: name, children: this.optionss }];
          }

默认全选

 // 默认是全选,局部也选上
      this.isAllSign = true;

      this.newCheckOrg = true;
      this.newCheckDep = true;
      if (this.isAllSign) {
        this.valueInfo = [];
        this.addxz = [];
        this.$nextTick(()=>{
            this.$refs.tree1.setCheckedNodes(this.optionss);//获取完接口传给树组件,视觉上
         this.valueInfo = this.$refs.tree1.getCheckedKeys();//要给接口的数据赋值
         this.$refs.tree2.setCheckedNodes(this.optionas);
           this.addxz = this.$refs.tree2.getCheckedKeys();
        })


      }

 页面样式与引入的插件-el-tree

  <div class="item" style="height:auto;">
              <label class="titleLabel"
                >可见范围<span class="popRed">*</span></label
              >
              <div style="width:84%">
                <input
                  type="checkbox"
                  class="check"
                  @click="checkAll('新建')"
                  v-model="isAllSign"
                />&nbsp;所有人可见
                <div style="display: flex;">
                  <div style="width: 50%;">
                    <el-tree
                      ref="tree1"
                      v-if="tree1Data.length"
                      node-key="id"
                      style="min-width: 200px"
                      :props="props"
                      show-checkbox
                      :data="tree1Data"
                    >
                    </el-tree>
                  </div>
                  <div style="width: 50%;">
                    <el-tree
                      ref="tree2"
                      node-key="id"
                      style="min-width: 200px"
                      :props="props"
                      show-checkbox
                      :data="tree2Data"
                    >
                    </el-tree>
                  </div>
                </div>
              </div>
            </div>
  checkAll(type = "") {
      if (!this.isAllSign) {
        if (type === "新建") {
          this.valueInfo = [];
          this.addxz = [];
          this.$nextTick(() => {
            this.$refs.tree1.setCheckedNodes(this.optionss);
            this.valueInfo = this.$refs.tree1.getCheckedKeys();
            this.$refs.tree2.setCheckedNodes(this.optionas);
            this.addxz = this.$refs.tree2.getCheckedKeys();
          });
        }
      } else {
        this.valueInfo = [];
        this.addxz = [];
        this.$nextTick(() => {
          this.$refs.tree1.setCheckedNodes([]);
          this.$refs.tree2.setCheckedNodes([]);
        });
      }
    },

 编辑时回显

 <div class="item" style="height:auto;">
              <label class="titleLabel"
                >可见范围<span class="popRed">*</span></label
              >
              <div style="width:84%">
                <input
                  type="checkbox"
                  class="check"
                  v-model="editList.receiveType"
                  @change="checkAll('编辑')"
                />&nbsp;所有人可见
               <div style="display: flex;">
                  <div style="width: 50%;">
                    <el-tree
                      ref="tree1"
                      v-if="tree1Data.length"
                      node-key="id"
                      style="min-width: 200px"
                      :props="props"
                      show-checkbox
                      :data="tree1Data"
                    >
                    </el-tree>
                  </div>
                  <div style="width: 50%;">
                    <el-tree
                      ref="tree2"
                      node-key="id"
                      style="min-width: 200px"
                      :props="props"
                      show-checkbox
                      :data="tree2Data"
                    >
                    </el-tree>
                  </div>
                </div>
              </div>
            </div>

 点击编辑按钮时的回显

 //如果是全选
 if (this.editList.receiveType) {
        this.editList.orgIds = [];
        this.editList.depIds = [];

        this.$nextTick(() => {
          this.$refs.tree1.setCheckedNodes(this.optionss);
          this.editList.orgIds = this.$refs.tree1.getCheckedKeys();
          this.$refs.tree2.setCheckedNodes(this.optionas);
          this.editList.depIds = this.$refs.tree2.getCheckedKeys();
        });

      } else {
        this.$nextTick(() => {
          this.$refs.tree1.setCheckedNodes(this.editList.orgIds);
          this.$refs.tree2.setCheckedNodes(this.editList.depIds);
        });
      }
      this.$forceUpdate();

方法补充,如果是编辑点击总全选按钮

    checkAll(type = "") {
      if (type === "新建") {
        if (!this.isAllSign) {
          this.valueInfo = [];
          this.addxz = [];
          this.$nextTick(() => {
            this.$refs.tree1.setCheckedNodes(this.optionss);
            this.valueInfo = this.$refs.tree1.getCheckedKeys();
            this.$refs.tree2.setCheckedNodes(this.optionas);
            this.addxz = this.$refs.tree2.getCheckedKeys();
          });
        } else {
          this.valueInfo = [];
          this.addxz = [];
          this.$nextTick(() => {
            this.$refs.tree1.setCheckedNodes([]);
            this.$refs.tree2.setCheckedNodes([]);
          });
        }
      }
      if(type==='编辑'){
 if (this.editList.receiveType) {
        this.editList.orgIds = [];
        this.editList.depIds = [];

        this.$nextTick(() => {
          this.$refs.tree1.setCheckedNodes(this.optionss);
          this.editList.orgIds = this.$refs.tree1.getCheckedKeys();
          this.$refs.tree2.setCheckedNodes(this.optionas);
          this.editList.depIds = this.$refs.tree2.getCheckedKeys();
        });

      } else {
        this.$nextTick(() => {
          this.$refs.tree1.setCheckedNodes([]);
          this.$refs.tree2.setCheckedNodes([]);
        });
      }
      }
    },

 提交的时候再次获取记得过滤一下值

 this.valueInfo = this.$refs.tree1
          .getCheckedKeys()
          .filter(item => item !== undefined);
        this.addxz = this.$refs.tree2
          .getCheckedKeys()
          .filter(item => item !== undefined);

 待完成:如果两个都是全选中,把总全选也勾上

全部代码,有点乱,是整个页面的代码

<template>
  <div
    class="commentInformationSearch specialA extractCommont extractSearch userControl extractDataMaintenanceSearch"
    id="container"
  >
    <v-header></v-header>
    <div class="with90">
      <v-sidebar style="width: 14%; float: left"></v-sidebar>
      <div style="width: 85%; float: right">
        <div class="commentInformationSearchBox">
          <h5>
            <span>资料下载</span>
          </h5>
          <transition name="mybox">
            <div class="commentInformationSearch box" v-show="boxshow">
              <div class="titleLabel col-3">
                <label class="titleLabel">标题</label>
                <el-input
                  type="text"
                  placeholder="输入搜索关键字"
                  class="col-2"
                  clearable
                  v-model="searchVal"
                />
              </div>
              <div class="titleLabel col-10">
                <label class="title">时间范围</label>
                <el-radio-group
                  style="width: 365px;"
                  v-model="importTime"
                  size="mini"
                >
                  <el-radio-button
                    v-for="lab in optionTime"
                    :key="lab.value"
                    :label="lab.value"
                    >{{ lab.label }}</el-radio-button
                  > </el-radio-group
                >&nbsp;<el-date-picker
                  v-if="importTime == -1"
                  v-model="timeRange"
                  type="datetimerange"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  range-separator="至"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                >
                </el-date-picker>
                <button class="blue" style="height:30px" @click="search()">
                  <img src="../../images/search.png" />查询
                </button>
              </div>
            </div>
          </transition>

          <div class="odd">
            <div class="fl">
              <!-- 品牌部 -->
              <button
                v-if="loginUl.depType === 1"
                class="green"
                @click="addList"
              >
                上传资料
              </button>

              <button
                v-if="loginUl.depType === 1"
                class="green"
                title="删除"
                @click="delUsers()"
              >
                删除
              </button>
            </div>
          </div>
        </div>
        <div class="TableBox">
          <div v-loading="loading" v-if="loading" class="loadedTip400"></div>
          <table class="table" v-show="!loading">
            <thead>
              <tr>
                <th style="width: 3%">
                  <input
                    type="checkbox"
                    class="check"
                    @click="allCheck('id')"
                    v-model="checked"
                  />
                </th>
                <th style="width: 10%">文件名称</th>
                <th style="width: 8%">品牌条线</th>
                <th style="width: 10%">业务条线</th>
                <th style="width: 10%">发布单位</th>
                <th class="lead" style="width: 8%">
                  创建/修改时间
                  <img
                    key="1"
                    v-if="orderBy === 1"
                    @click="
                      (orderBy = 0), (missionList = missionList.reverse())
                    "
                    src="@/images/positive.png"
                    alt="倒序"
                  />
                  <img
                    key="0"
                    v-if="orderBy === 0"
                    @click="
                      (orderBy = 1), (missionList = missionList.reverse())
                    "
                    src="@/images/inverted.png"
                    alt="正序"
                  />
                </th>
                <th style="width: 8%">创建/修改人</th>
                <th style="width: 6%">操作</th>
              </tr>
            </thead>
            <tbody v-if="missionList.length > 0">
              <tr v-for="missions in missionList" :key="missions.id">
                <td>
                  <input
                    type="checkbox"
                    class="check"
                    :value="missions.id"
                    @click="addChecked(missions.id, 'id')"
                    v-model="checkedIds"
                  />
                </td>
                <td
                  :title="missions.customFileName || missions.defaultFileName"
                >
                  {{ missions.customFileName || missions.defaultFileName }}
                </td>
                <td :title="missions.mainCount">
                  <span
                    @click="seeDetailNow(missions.id, 1)"
                    style="color:var(--mainColor);cursor: pointer;"
                  >
                    {{ missions.mainCount }}</span
                  >
                </td>
                <td :title="missions.deputyCount">
                  <span
                    @click="seeDetailNow(missions.id, 2)"
                    style="color:var(--mainColor);cursor: pointer;"
                    >{{ missions.deputyCount }}</span
                  >
                </td>

                <td :title="missions.orgName">
                  {{ missions.orgName || "暂无" }}
                </td>
                <td :title="missions.updateTime || missions.createTime">
                  {{ missions.updateTime || missions.createTime }}
                </td>
                <td :title="missions.updateUserName || missions.userName">
                  {{ missions.updateUserName || missions.userName }}
                </td>

                <td>
                  <span
                    v-if="loginUl.depType === 1"
                    title="编辑"
                    class="handle edit"
                    style="cursor: pointer;"
                    @click="amend(missions)"
                  ></span>
                  <span
                    title="下载"
                    class="handle download"
                    style="cursor: pointer;"
                    @click="down(missions)"
                  ></span>
                </td>
              </tr>
            </tbody>
          </table>
          <div
            v-if="missionList.length == 0"
            v-show="!loading"
            class="noContentPrompt noContentPrompt100"
          >
            暂无数据
          </div>
        </div>
        <v-pageBox></v-pageBox>

        <transition name="el-fade-in-linear">
          <Hint
            :isHint="isHint"
            v-if="isHint"
            :item="item"
            @close="close"
            @ok="ok"
          ></Hint>
        </transition>
        <!-- 授权人员明细 -->
        <cwDialog
          title="授权人员明细"
          :visible="seeDetail"
          dialogWidth="50%"
          @close="seeDetail = false"
        >
          <div class="form styleSet">
            <table class="table" v-show="!loading">
              <thead>
                <tr>
                  <th style="width: 8%">单位</th>
                  <th style="width: 10%">所属条线</th>
                  <th style="width: 12%">部门</th>
                  <th style="width: 10%">人员</th>
                </tr>
              </thead>
              <tbody v-if="depDetailList.length > 0">
                <tr v-for="missions in depDetailList" :key="missions.id">
                  <td :title="missions.receiveOrgName">
                    {{ missions.receiveOrgName }}
                  </td>
                  <td :title="missions.depType === 1 ? '品牌条线' : '业务条线'">
                    {{ missions.depType === 1 ? "品牌条线" : "业务条线" }}
                  </td>
                  <td style="border:1px solid #dee6ea;padding: 0;">
                    <div
                      :style="
                        Array.from(missions.receiveDepName.split(',')).length >
                        1
                          ? 'border-bottom: 1px solid #dee6ea;'
                          : ''
                      "
                      v-for="item in Array.from(
                        missions.receiveDepName.split(',')
                      )"
                      :key="item"
                    >
                      <span :title="item" style="text-align: center">{{
                        item
                      }}</span>
                    </div>
                  </td>
                  <td style="border:1px solid #dee6ea;padding: 0;">
                    <div
                      :style="
                        Array.from(missions.receiveUserName.split(',')).length >
                        1
                          ? 'border-bottom: 1px solid #dee6ea;'
                          : ''
                      "
                      v-for="item in Array.from(
                        missions.receiveUserName.split(',')
                      )"
                      :key="item"
                    >
                      <span :title="item" style="text-align: center">{{
                        item
                      }}</span>
                    </div>
                  </td>
                </tr>
              </tbody>
            </table>
            <div
              v-if="depDetailList.length == 0"
              v-show="!loading"
              class="noContentPrompt noContentPrompt100"
              style="left: 48%;top: 60%;"
            >
              暂无数据
            </div>
          </div>
        </cwDialog>
        <!-- 编辑 -->
        <cwDialog
          title="编辑"
          :visible="tradeSettingShow"
          dialogWidth="50%"
          @close="tradeSettingShow = false"
        >
          <div class="form styleSet">
            <div
              style="display: flex;line-height: 40px;justify-content: space-between;align-items: center;"
            >
              <label class="titleLabel"
                >上传文件<span class="popRed">*</span></label
              >
              <div style="width:84%">
                <el-upload
                  class="upload"
                  action="/cbrc/file/upload"
                  :on-success="upsuccess"
                  :headers="header"
                  :on-remove="deletefile"
                  :before-upload="handleChange"
                  :file-list="editList.fileList"
                  :on-exceed="judegLimit"
                  :limit="1"
                  ref="upload"
                >
                  <el-button type="primary" class="blue"
                    >添加文件<i class="el-icon-upload el-icon--right"></i
                  ></el-button>
                  <div class="upload__tip">
                    备注:只可上传一个文件,不可上传可执行的文件
                  </div>
                </el-upload>
              </div>
            </div>
            <div class="item">
              <label class="titleLabel"
                >文件名称<span class="popRed">*</span></label
              >
              <div style="width:84%">
                <el-input
                  type="text"
                  placeholder="请输入文件名称"
                  class="col-2"
                  v-model="editList.customFileName"
                />
              </div>
            </div>
            <div class="item" style="height:auto;">
              <label class="titleLabel"
                >可见范围<span class="popRed">*</span></label
              >
              <div style="width:84%">
                <input
                  type="checkbox"
                  class="check"
                  v-model="editList.receiveType"
                  @change="checkAll('编辑')"
                />&nbsp;所有人可见
                <div style="display: flex;">
                  <div style="width: 50%;">
                    <el-tree
                      ref="tree1"
                      v-if="tree1Data.length"
                      node-key="id"
                      style="min-width: 200px"
                      :props="props"
                      show-checkbox
                      :data="tree1Data"
                    >
                    </el-tree>
                  </div>
                  <div style="width: 50%;">
                    <el-tree
                      ref="tree2"
                      node-key="id"
                      style="min-width: 200px"
                      :props="props"
                      show-checkbox
                      :data="tree2Data"
                    >
                    </el-tree>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <template slot="footer">
            <div style="text-align: right">
              <el-button class="blue" @click="amend('reset')">重置</el-button>
              <el-button
                :loading="saveLoading"
                class="blues"
                type="primary"
                @click="saveTradeSetting('set')"
                >保存</el-button
              >
            </div>
          </template>
        </cwDialog>
        <!-- 上传资料 -->
        <cwDialog
          title="上传资料"
          :visible="editSHow"
          dialogWidth="50%"
          @close="editSHow = false"
        >
          <div class="form styleSet">
            <div
              style="display: flex;line-height: 40px;justify-content: space-between;align-items: center;"
            >
              <label class="titleLabel"
                >上传文件<span class="popRed">*</span></label
              >
              <div style="width:84%">
                <el-upload
                  class="upload"
                  action="/cbrc/file/upload"
                  :on-success="upsuccess"
                  :headers="header"
                  :on-remove="deletefile"
                  :before-upload="handleChange"
                  :file-list="fileList"
                  :on-exceed="judegLimit"
                  :limit="1"
                  ref="upload"
                >
                  <el-button type="primary" class="blue"
                    >添加文件<i class="el-icon-upload el-icon--right"></i
                  ></el-button>
                  <div class="upload__tip">
                    备注:只可上传一个文件,不可上传可执行的文件
                  </div>
                </el-upload>
              </div>
            </div>
            <div class="item">
              <label class="titleLabel"
                >文件名称<span class="popRed">*</span></label
              >
              <div style="width:84%">
                <el-input
                  type="text"
                  placeholder="请输入文件名称"
                  class="col-2"
                  v-model="fileName"
                />
              </div>
            </div>
            <div class="item" style="height:auto;">
              <label class="titleLabel"
                >可见范围<span class="popRed">*</span></label
              >
              <div style="width:84%">
                <input
                  type="checkbox"
                  class="check"
                  @click="checkAll('新建')"
                  v-model="isAllSign"
                />&nbsp;所有人可见
                <div style="display: flex;">
                  <div style="width: 50%;">
                    <el-tree
                      ref="tree1"
                      v-if="tree1Data.length"
                      node-key="id"
                      style="min-width: 200px"
                      :props="props"
                      show-checkbox
                      :data="tree1Data"
                    >
                    </el-tree>
                  </div>
                  <div style="width: 50%;">
                    <el-tree
                      ref="tree2"
                      node-key="id"
                      style="min-width: 200px"
                      :props="props"
                      show-checkbox
                      :data="tree2Data"
                    >
                    </el-tree>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <template slot="footer">
            <div style="text-align: right">
              <el-button class="blue" @click="addList">重置</el-button>
              <el-button
                :loading="saveLoading"
                class="blues"
                type="primary"
                @click="saveTradeSetting"
                >保存</el-button
              >
            </div>
          </template>
        </cwDialog>
      </div>
    </div>
    <v-footer></v-footer>
  </div>
</template>

<script>
import checkMixin from "@/js/checkMisIn.js";
import Hint from "../SystemSetup/poput/Hint.vue";

export default {
  components: {
    Hint
  },
  mixins: [checkMixin],
  data() {
    const that = this;
    return {
      props: {
        label: "name"
      },
      tree1Data: [],
      tree2Data: [],
      editCheckOrg: true,
      editCheckDep: true,
      newCheckOrg: true,
      newCheckDep: true,
      timeRange: [],
      importTime: "",
      importlogShow: false,
      header: {
        Authorization: sessionStorage.getItem("header")
      },
      editBtnFlag: false,
      loginUl: JSON.parse(sessionStorage.getItem("loginUl")),
      userName: that.userName,
      isRole: false, //打开用户组
      loading: true,
      missionList: [],
      cur: 1, //分页
      all: 0,
      rows: 15, //条数
      totalCount: 0, //总条数
      list: {},
      searchVal: "", //搜索
      gridData: [],
      options: "", //地域
      value: "",
      optionsUnit: "", //单位名称
      valueUnit: "",
      optionsSubordinate: "", //下级单位
      valueSubordinate: "",
      checked: false, //全选框状态
      checkeds: false,
      isHint: false, //删除
      deleteId: "",
      item: {
        name: "确定删除选中的数据吗?"
      },
      tradeSettingShow: false,
      saveLoading: false,
      tradeSetting: {},
      editSHow: false,
      addressId: "",
      orgId: "",
      deleteIds: "",
      editList: "",
      addListsj: [],
      addListsjs: [],
      uploadLoading: false,
      addxz: "", //新建 /条线
      loginList: { orgId: "" }, //登录信息
      departmentName: "", //新建部门
      LineList: [
        {
          name: "业务条线",
          id: 2
        },
        {
          name: "品牌条线",
          id: 1
        }
      ],
      perentAdd: [], //新建/上级部门
      unitList: [], //新建/上级单位
      prendId: "",
      lineVal: "",
      type: "",
      orgShortNames: "",
      num: 1,
      parentDepName: "",
      orderBy: 0,
      unitXID: JSON.parse(localStorage.getItem("loginUl")).orgId,
      parentId: "",
      parentList: [],
      parentName: "",
      seeDetail: false,
      isAllSign: true,
      fileList: [],
      fileName: "",
      attachmentLists: [],
      valueInfo: "",
      optionss: [],
      receiveDepIds: [],
      uniqueArray: [],
      optionas: "",
      depDetailList: [],
      setOrgId: [],
      saveItemInfo: {},
      optionTime: [
        {
          value: "",
          label: "全部"
        },
        {
          value: 1,
          label: "一天"
        },
        {
          value: 7,
          label: "一周"
        },
        {
          value: 30,
          label: "一月"
        },
        {
          value: -1,
          label: "自定义"
        }
      ]
    };
  },

  watch: {
    rows: function() {
      this.getPage();
    },
    cur: function() {
      this.getPage();
    },
    importTime: function(val) {
      if (val === 0) {
        this.timeRange = [];
      }
    }
  },
  mounted() {
    this.getSelfAndChildren();
    console.log("this.userName :>> ", this.userName);
    this.addSearch();
    this.getPage();
  },
  methods: {
    judegLimit() {
      this.fileList.length > 0 ? this.$message.warning("只可上传一个文件") : "";
    },
    getPage() {
      this.$http({
        method: "GET",
        url: "/cbrc/work/file/queryPageFile",
        params: {
          pageNo: this.cur,
          pageSize: this.rows,
          time: this.importTime,
          customFileName: this.searchVal,
          begin: this.timeRange.length > 0 ? this.timeRange[0] : "",
          end: this.timeRange.length > 1 ? this.timeRange[1] : "",
          orderBy: "create_time",
          order: "asc"
        }
      }).then(res => {
        if (res) {
          this.loading = false;
          var data = res.data.data;
          if (data.totalCount >= 0) {
            this.totalCount = data.totalCount;
            this.all = Math.ceil(this.totalCount / this.rows);
            if (this.orderBy === 0) {
              this.missionList = data.result.reverse();
            } else {
              this.missionList = data.result;
            }
          }
        }
      });
      this.$http({
        method: "GET",
        url: "/cbrc/user_center/organization/query/next/children", //全部省分公司
        params: {
          type: 1
        }
      }).then(res => {
        if (res) {
          this.optionss = res.data.data;
          if (this.optionss && this.optionss.length) {
            var name = "全部省分公司";
            if (this.loginUl.orgParentId == 7) {
              name = "全部市分公司";
            }
            if (this.loginUl.orgParentId != 7 && this.loginUl.orgParentId) {
              name = "全部县分公司";
            }
            this.tree1Data = [{ name: name, children: this.optionss }];
          }
        }
      });
    },
    //查询所属地域
    addSearch() {
      this.$http({
        method: "GET",
        url: "/cbrc/user_center/address/list"
      }).then(res => {
        if (res) {
          this.options = res.data.data;
        }
      });
    },
    //编辑/ 条线
    async editTx(val, i) {
      //上级部门
      await this.$http({
        method: "GET",
        url: "/cbrc/user_center/department/query/byOrgId",
        params: {
          type: val || this.type,
          orgId: i || this.orgId
        }
      }).then(res => {
        this.optionas = res.data.data;
        this.tree2Data = [{ name: "全部业务条线", children: this.optionas }];
        this.perentAdd = res.data.data;

        this.$forceUpdate();
      });
    },
    editDw(id) {
      this.parentList = JSON.parse(
        JSON.stringify(
          this.addListsj.filter(function(ele) {
            return ele.id === id;
          })[0]
        )
      );
      this.editList.parentOrgName = this.parentList.parentName || "暂无";
      this.editList.parentId = this.parentList.parentId;
      this.$forceUpdate();
    },
    changeDy() {
      this.$http({
        method: "GET",
        url: "/cbrc/user_center/department/query/byOrgId",
        params: {
          orgId: this.orgId
        }
      }).then(res => {
        if (res) {
          this.optionsUnit = res.data.data;
        }
      });
    },
    changeDis(id) {
      console.log(id);
    },
    oneVlue() {},
    itemVlue(id) {
      this.deleteIds = this.missionList.filter(item => item.id == id)[0].id;
    },
    //删除
    delUsers() {
      if (!this.checkedIds.length) return this.$message.warning("请勾选数据");
      this.isHint = true;
    },
    close() {
      //删除弹框关闭
      this.isHint = false;
    },
    //确定删除
    ok() {
      this.$http({
        method: "GET",
        url: "/cbrc/work/file/delFileByIds",
        params: {
          idStr: this.checkedIds.join(",")
        }
      }).then(res => {
        if (res) {
          this.isHint = false;
          this.$message.success("删除成功");
          this.getPage();
        } else {
          this.$message.success("删除失败");
        }
      });
    },
    //编辑
    async amend(item) {
      await this.editTx(2, "");
      if (item !== "reset") {
        this.saveItemInfo = JSON.parse(JSON.stringify(item));
        this.editList = JSON.parse(JSON.stringify(item));
      } else {
        this.editList = JSON.parse(JSON.stringify(this.saveItemInfo));
      }
      this.editList.fileList = [
        {
          name: this.editList.defaultFileName,
          url: this.editList.excelPath
          // fileLength: this.editList.excelPath
        }
      ];
      this.editList.orgIds =
        typeof this.editList.depIds === "string" &&
        this.editList.orgIds &&
        this.editList.orgIds.length
          ? this.editList.orgIds.split(",")
          : this.editList.orgIds;
      this.editList.depIds =
        typeof this.editList.depIds === "string" &&
        this.editList.depIds &&
        this.editList.depIds.length
          ? this.editList.depIds.split(",")
          : this.editList.depIds;
      if (this.editList.depIds !== "string") {
        this.editList.depIds.pop();
      }

      // 处理全选
      this.editList.receiveType = this.editList.receiveType ? true : false;

      if (this.editList.receiveType) {
        this.editList.orgIds = [];
        this.editList.depIds = [];

        this.$nextTick(() => {
          this.$refs.tree1.setCheckedNodes(this.optionss);
          this.editList.orgIds = this.$refs.tree1.getCheckedKeys();
          this.$refs.tree2.setCheckedNodes(this.optionas);
          this.editList.depIds = this.$refs.tree2.getCheckedKeys();
        });
      } else {
        this.$nextTick(() => {
          this.$refs.tree1.setCheckedNodes(this.editList.orgIds);
          this.$refs.tree2.setCheckedNodes(this.editList.depIds);
        });
      }
      this.$forceUpdate();

      if (!this.tradeSettingShow) this.tradeSettingShow = true;
    },
    checkAll(type = "") {
      if (type === "新建") {
        if (!this.isAllSign) {
          this.valueInfo = [];
          this.addxz = [];
          this.$nextTick(() => {
            this.$refs.tree1.setCheckedNodes(this.optionss);
            this.valueInfo = this.$refs.tree1.getCheckedKeys();
            this.$refs.tree2.setCheckedNodes(this.optionas);
            this.addxz = this.$refs.tree2.getCheckedKeys();
          });
        } else {
          this.valueInfo = [];
          this.addxz = [];
          this.$nextTick(() => {
            this.$refs.tree1.setCheckedNodes([]);
            this.$refs.tree2.setCheckedNodes([]);
          });
        }
      }
      if (type === "编辑") {
        if (this.editList.receiveType) {
          this.editList.orgIds = [];
          this.editList.depIds = [];

          this.$nextTick(() => {
            this.$refs.tree1.setCheckedNodes(this.optionss);
            this.editList.orgIds = this.$refs.tree1.getCheckedKeys();
            this.$refs.tree2.setCheckedNodes(this.optionas);
            this.editList.depIds = this.$refs.tree2.getCheckedKeys();
          });
        } else {
          this.$nextTick(() => {
            this.$refs.tree1.setCheckedNodes([]);
            this.$refs.tree2.setCheckedNodes([]);
          });
        }
      }
    },
    //新建
    async addList() {
      await this.editTx(2, "");
      this.attachmentLists = [];
      this.fileList = [];
      this.fileName = "";
      this.valueInfo = [];
      this.addxz = [];

      // 默认是全选,局部也选上
      this.isAllSign = true;
      this.newCheckOrg = true;
      this.newCheckDep = true;
      if (this.isAllSign) {
        this.valueInfo = [];
        this.addxz = [];
        this.$nextTick(() => {
          this.$refs.tree1.setCheckedNodes(this.optionss);
          this.valueInfo = this.$refs.tree1.getCheckedKeys();
          this.$refs.tree2.setCheckedNodes(this.optionas);
          this.addxz = this.$refs.tree2.getCheckedKeys();
        });
      }

      if (!this.editSHow) this.editSHow = true;
    },
    async getFileNameRepeatStatus(id, name) {
      let status = false;
      await this.$http({
        method: "POST",
        url: "/cbrc/work/file/checkFile",
        data: { customFileName: name, id: id }
      }).then(res => {
        const { data, code } = res.data;
        if (code == 200) {
          if (data.length > 0) {
            status = true;
          }
        }
      });
      return status;
    },
    //保存
    async saveTradeSetting(res) {
      let query = {};
      let depIds = [];
      let orgIds = [];

      if (res === "set") {
        if (!this.editList || this.editList.length < 1)
          return this.$message.warning("请上传文件后再保存");
        if (!this.editList.customFileName)
          return this.$message.warning("请填写文件名称");

        if (
          await this.getFileNameRepeatStatus(
            this.editList.id,
            this.editList.customFileName
          )
        )
          return this.$message.warning(
            "该文件名称与之前创建的数据重复,请重新填写"
          );
        this.editList.orgIds = this.$refs.tree1
          .getCheckedKeys()
          .filter(item => item !== undefined);
        this.editList.depIds = this.$refs.tree2
          .getCheckedKeys()
          .filter(item => item !== undefined);
        if (
          !this.editList.receiveType &&
          (!this.editList.orgIds || this.editList.orgIds.length < 1) &&
          (!this.editList.depIds || this.editList.depIds.length < 1)
        )
          return this.$message.warning("请填写可见范围");
        // 全选
        if (this.editList.receiveType) {
          const firm = this.optionss.map(item => item.id);
          const line = this.optionas.map(item => item.id);
          depIds = [...line, this.loginUl.depId];
          orgIds = firm && firm.length ? firm.join(",") : "";
        } else {
          // 机构/单位
          if (
            !(typeof this.editList.orgIds === "string") &&
            this.editList.orgIds &&
            this.editList.orgIds.length
          ) {
            orgIds = this.editList.orgIds.join(",");
          } else {
            orgIds = "";
          }
          // 部门,传参顺带把本人的部门id给到
          if (this.editList.depIds && this.editList.depIds.length) {
            depIds = [...this.editList.depIds, this.loginUl.depId];
          }
        }
        // 转成接口要的Array<number>类型
        depIds = depIds.map(item => Number(item));
        query = {
          id: this.editList.id,
          defaultFileName: this.editList.defaultFileName,
          customFileName: this.editList.customFileName,
          excelPath: this.editList.fileList[0].url,
          // fileLength: this.editList.fileList[0].fileLength,// 可以不传,要传得转成kb
          receiveDepIds: depIds,
          orgIds: orgIds,
          receiveType: this.editList.receiveType ? 1 : 0
        };
      } else {
        if (!this.attachmentLists || this.attachmentLists.length < 1)
          return this.$message.warning("请上传文件后再保存");
        if (!this.fileName) return this.$message.warning("请填写文件名称");
        if (await this.getFileNameRepeatStatus("", this.fileName))
          return this.$message.warning(
            "该文件名称与之前创建的数据重复,请重新填写"
          );
        this.valueInfo = this.$refs.tree1
          .getCheckedKeys()
          .filter(item => item !== undefined);
        this.addxz = this.$refs.tree2
          .getCheckedKeys()
          .filter(item => item !== undefined);
        if (
          !this.isAllSign &&
          (!this.valueInfo || this.valueInfo.length < 1) &&
          (!this.addxz || this.addxz.length < 1)
        )
          return this.$message.warning("请填写可见范围");
        if (this.isAllSign) {
          const firm = this.optionss.map(item => item.id);
          const line = this.optionas.map(item => item.id);
          depIds = [...line, this.loginUl.depId];
          orgIds = firm && firm.length ? firm.join(",") : "";
        } else {
          // 机构/单位
          if (this.valueInfo && this.valueInfo.length) {
            orgIds = this.valueInfo.join(",");
          }
          // 部门,传参顺带把本人的部门id给到
          if (this.addxz && this.addxz.length) {
            depIds = [...this.addxz, this.loginUl.depId];
          }
        }
        depIds = depIds.map(item => Number(item));
        query = {
          id: "",
          defaultFileName: this.fileList[0].name,
          customFileName: this.fileName,
          excelPath: this.fileList[0].url,
          // fileLength: this.attachmentLists[0].response.data[0].fileSize,// 可以不传,要传得转成kb
          receiveDepIds: depIds,
          orgIds: orgIds,
          receiveType: this.isAllSign ? 1 : 0
        };
      }
      this.saveLoading = true;
      this.$http({
        method: "POST",
        url: "/cbrc/work/file/saveOrUpdateFile",
        data: query
      })
        .then(response => {
          if (!response) return this.$message.error("保存出错");
          res === "set"
            ? this.$message.success("编辑成功")
            : this.$message.success("上传成功");
          this.getPage();
          this.editSHow = false;
          this.tradeSettingShow = false;
        })
        .finally(() => {
          this.saveLoading = false;
          if (res === "openNew") {
            this.addList();
          }
        });
    },

    //新建/单位
    addUnits(val) {
      this.parentList = JSON.parse(
        JSON.stringify(
          this.addListsj.filter(function(ele) {
            return ele.id === val;
          })[0]
        )
      );
      this.parentName = this.parentList.parentName || "暂无";
      this.parentId = this.parentList.parentId;
      this.$forceUpdate();
    },
    //新建/条线
    addXzvalue(e) {
      // this.uniqueArrays = this.uniqueArray.concat(...e);
      // this.uniqueArrays.push(151);
      // //上级部门
      // this.$http({
      //   method: "GET",
      //   url: "/cbrc/user_center/department/query/byOrgId",
      //   params: {
      //     type: this.addxz[0],
      //     orgId: this.orgId
      //   }
      // }).then(res => {
      //   this.perentAdd = res.data.data;
      // });
    },
    //新建/上级部门
    prentChange() {
      console.log(this.prendId.toString());
    },
    //搜索
    search() {
      this.cur = 1;
      this.getPage();
    },
    //批量导出
    batchExport() {
      if (!this.checkedIds.length) return this.$message.warning("请勾选数据");
      var token = sessionStorage.getItem("header");
      window.location.href =
        "/cbrc/user_center/department/export?token=" +
        token +
        "&ids=" +
        this.checkedIds.join(",");
    },
    //下载导入模板
    downloadTemplate() {
      window.open("http://123.57.88.10:9000/template/department_template.xls");
    },
    upsuccess() {
      this.uploadLoading = false;
      this.$message.success("导入成功");
      this.getPage();
    },
    onError() {
      this.uploadLoading = false;
      this.$message.error("导入失败");
    },
    beforeUpload() {
      this.uploadLoading = true;
    },
    // 获取自身和上级部门信息
    getSelfAndChildren() {
      this.$http({
        method: "GET",
        url: "/cbrc/user_center/organization/query/selfAndChildren"
      }).then(res => {
        if (res) {
          this.addListsj = res.data.data;
        }
      });
    },
    //下载
    down(mission) {
      // window.open("http://123.57.88.10:9000/template"+mission.excelPath);
      //  this.$http({
      //         method: 'get',
      //         url: '/cbrc/file/getTokenUrl?url='+mission.excelPath
      //         }).then(res=>{if(res){
      //         	const urls = res.data.data;
      window.open(
        "/cbrc" + mission.excelPath + "?name=" + mission.customFileName
      );
      // }
      // })
    },
    upsuccess(response, file, fileList) {
      if (response.code == 200) {
        this.attachmentLists = fileList;
        this.attachmentLists[0].response.data.forEach(item => {
          this.fileList.push({
            name: item.attachName,
            url: item.attachPath
          });
        });
        this.fileName = this.fileList[0].name;
        console.log(this.fileList);
      } else {
        this.$message.error("附件添加失败");
      }
    },
    //附件删除
    deletefile(file, fileList) {
      if (this.clones) {
        this.attachmentLists = fileList;
        if (file.response) {
          this.$http({
            method: "GET",
            url: "/cbrc/file/del?filePath=" + url
          }).then(res => {
            if (res) {
              this.fileList = [];
              this.fileName = "";
              this.$message.success("删除成功");
            }
          });
        }
        return;
      }
      var url = "";
      if (file.url) {
        url = file.url;
      } else {
        url = file.response.data[0].attachPath;
      }
      this.$http({
        method: "GET",
        url: "/cbrc/file/del?filePath=" + url
      }).then(res => {
        if (res) {
          this.fileList = [];
          this.fileName = "";
          this.attachmentLists = fileList;
          this.$message.success("删除成功");
        }
      });
    },
    handleChange(file, fileList) {
      var size = file.size / 1024 / 1024;
      if (size > 10) {
        this.$message.warning("上传文件大小不能大于10M");
        return false;
      }
    },
    changeValue(e) {
      // var arr = [];
      // e.forEach((item, index) => {
      //   arr.push(this.optionss.filter(item => item.id == e[index]));
      // });
      // arr.map((item, index) => {
      //   if (item[0].departmentList[0]) {
      //     return this.receiveDepIds.push(item[0].departmentList[0].id);
      //   }
      // });
      // this.uniqueArray = this.receiveDepIds.filter((item, index, array) => {
      //   return array.indexOf(item) === index;
      // });
    },
    seeDetailNow(id, typeId) {
      this.loading = true;
      this.depDetailList = [];
      // typeId品牌部1/业务部2
      this.$http({
        method: "POST",
        url: "/cbrc/work/file/queryFileInfoCountId",
        data: {
          depType: typeId,
          id: id
        }
      }).then(res => {
        if (res) {
          this.depDetailList = res.data.data;
        }
      });
      this.loading = false;
      this.seeDetail = true;
    }
  }
};
</script>
<style lang="less" scoped>
.col {
  display: inline !important;
}

.blue {
  cursor: pointer;
  min-width: 80px;
  color: #fff;
  font-size: 14px;
  border-radius: 6px !important;
}

.blues {
  min-width: 80px;
  height: 38px;
  color: #fff;
  font-size: 14px;
  border-radius: 6px !important;
}

.green {
  float: right !important;
}

.fl {
  width: 100% !important;
  margin: 6px 0 !important;
}

.popRed {
  color: red;
}

.el-cascader {
  width: 100%;
}

.extractDataMaintenanceSearch .odd .fl button {
  margin-bottom: 0px;
}

.setTb {
  border: none;
}

.lead {
  position: relative;

  img {
    position: absolute;
    width: 25px;
    bottom: 25px;
    cursor: pointer;
  }
}

.styleSet {
  .item {
    height: 40px;
    line-height: 40px;
    display: flex;
    justify-content: space-between;

    .el-input,
    .el-select,
    .el-cascader,
    .col-1-1 {
      width: 80%;
    }
  }
}

.upload {
  position: relative;
  margin-bottom: 8px;
}

.upload__tip {
  position: absolute;
  top: 2px;
  left: 150px;
  font-size: 12px;
}

tr {
  border: 1px solid #dee6ea;
}
</style>
<style lang="scss">
.specialA {
  .el-upload {
    display: inline !important;
  }

  .el-select {
    width: auto;
  }

  .el-upload-list__item-name:hover {
    color: var(--mainColor) !important;
  }
}
</style>

 使用es6的filter过滤数组的数据

 this.valueInfo = this.$refs.tree1.getCheckedKeys().filter(item => {
          if (item!==undefined) return item;
        });

//简写
 this.valueInfo = this.$refs.tree1.getCheckedKeys().filter(item => item!==undefined);

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/492414.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

BOM概述

目录 什么是BOM 浏览器对象模型&#xff08;Browser Object Model (BOM)&#xff09; Window对象 一些常用方法 JavaScript Window Screen Window Screen Window Screen 高度 Window Screen 可用宽度 Window Screen 可用高度 Window Screen 色深 Window Screen 像素深…

【AI实战】训练一个自己的ChatGPT

【AI实战】训练一个自己的ChatGPT 准备环境代码模型 数据集Belle下载 Belle 的开源中文数据集&#xff08;仅限研究使用&#xff0c;禁止商用&#xff01;&#xff09;清洗自己的数据集上述工作完成后&#xff0c;大概是这样子的 训练测试参考 本文使用 Alpaca-LoRA 来训练一个…

Linux_top命令

top命令是Linux系统下常用的性能分析工具&#xff0c;能够实时显示系统中各个进程的资源占用状况&#xff0c;类似于Windows的任务管理器。它是一个动态显示过程,执行该命令后,它展示的信息会将独占前台,直到用户终止该程序为止&#xff08;可以用Ctrl C终止&#xff09;。 t…

汇编仿真 — 比较大小

项目文件 文件 关于项目的内容知识点可以见专栏单片机原理及应用 的第三章 汇编 题目&#xff1a;编程实现如下功能:比较片内 RAM的30H和40H单元中两个无符号数的大小&#xff0c;并将大数存入50H&#xff0c;小数存入51H&#xff0c;若两数相等&#xff0c;则使位单元7FH置1…

内网:域内信息收集

一&#xff0c;判断是否有域 ipconfig /all systeminfo workgroup net config workstation net time /domain&#xff08;该命令有三种情况&#xff09; 1&#xff0c;存在域&#xff0c;当前用户不是域用户。 2&#xff0c;存在域&#xff0c;当前用户是域用户。 3&#xff0c…

使用dataFEED OPC Suite将西门子PLC数据转发至REST API

一 背景 在工业4.0或工业物联网的项目方案中&#xff0c;逐渐紧密融合的OT&IT技术给工业制造带来了新活力。与此同时&#xff0c;利用IT级别的协议和应用来对制造数据进行收集和分析也成为了指导工业生产和优化流程的重要力量&#xff0c;尤其是基于HTTP的轻量级协议REST …

Python---学生管理系统、hashlib模块

1. 学生管理系统 学生管理系统的数据结构设置: 一个学生信息对应一个字典 整个系统的所有学生&#xff1a;所有学生对应一个列表&#xff0c;列表中的元素全是字典 整个系统&#xff1a;一个字典, 字典中有一个key(all_student) 对应的值是所有学生; 这个字典需要做数据持久化…

从传统Java应用到现代微服务,SpringBoot入门的基础指南

目录 一. 创建SpringBoot项目1.1 使用Spring Initializr快速构建项目1.2 手动创建springboot项目 二. SpringBoot入门案例解析2.1 依赖管理特性2.2 starter场景启动器2.3 引导类自动配置 三. REST风格四. 配置文件4.1 配置文件类型4.2 YAML文件的简介与使用4.3 Value与Configur…

VSCode 开发flutter 实现安卓设备远程调试

1&#xff0c;首先安装 ADB Commanads for VSCode扩展 并且必须确保ADB已经添加到系统环境变量中 如未添加请按照下面的方式添加&#xff0c;如添加请直接跳到下面。 2&#xff0c;添加环境变量&#xff08;windows可参考&#xff0c;mac忽略此项&#xff09; 我将ADB安装到这…

3分钟快速实现mysql全量增量备份

需求说明&#xff1a; mysql数据库ip地址为192.168.1.100&#xff0c;端口3306&#xff0c;root密码111111&#xff0c; 服务器cantos7中ip地址192.168.1.101 利用xtrabackup每周六进行全量备份&#xff0c;每天进行增量备份&#xff0c;保留2个礼拜的备份&#xff0c;并且保存…

睡眠经济2.0时代来了,老巨头们有护城河吗?

在第23个世界睡眠日&#xff0c;中国睡眠研究会等机构发布了《中国睡眠研究报告2023》&#xff0c;近半数人每晚平均睡眠时长不足8小时&#xff0c;“失眠”已成为了当代人的生活常态。 越是睡不好&#xff0c;越要想办法。年轻人纷纷求助于好的寝具、好的助眠产品乃至保健品&…

【C语言进阶C++】 C++基础--让你丝滑的从C语言进阶到C++

目录 前言 正文 1. 面向过程、面向对象 面向过程思维 面向对象思维 面向过程语言优缺点 面向对象语言优缺点 C面向对象特点 2. 输入、输出 C中的输入输出 总结C和C输入输出 3. 命名空间 作用域 命名空间 4. 动态申请空间 C动态申请空间&#xff08;new、delete&…

Leetcode刷题之回文链表和交换链表中的结点

竭力履行你的义务&#xff0c;你应该就会知道&#xff0c;你到底有多大的价值。 --列夫.托尔斯泰 目录 &#x1fab4;一.回文链表 &#x1f33b;1.快慢指针 &#x1f341;2.把值存入数组中&#xff0c;然后使用双指针 &#x1f33c;二.交换链表中的结点 &#x1…

经典论文解读 — 端到端的VL预训练网络SOHO

来源&#xff1a;投稿 作者&#xff1a;摩卡 编辑&#xff1a;学姐 论文标题&#xff1a; Seeing Out of tHe bOx :End-to-End Pre-training for Visual-Language Representation Learning》 Motivation 本文针对目前大量Visual-Language(VL) tasks使用由Faster-RCNN提取出的…

余弦相似度公式推导及代码实现

余弦相似度公式推导 1. 为什么使用余弦值相似度&#xff1f;2. 公式推导2.1 三角函数余弦公式推导2.2 三角函数向量余弦公式推导 3. 余弦相似度代码实现 1. 为什么使用余弦值相似度&#xff1f; 空间维度上两个点之间相似定义 在空间维度上两个点之间是有夹角和方向&#xff0…

计算机操作系统实验:页面置换算法的实现

目录 前言实验目的实验内容实验过程最佳置换算法代码实现算法流程流程图设计思路运行结果 先进先出算法代码实现算法流程流程图设计思路运行结果 最近最久未使用算法代码实现算法流程流程图设计思路运行结果 总结 前言 本实验的目的是通过编程模拟不同的页面置换算法&#xff…

基于思科模拟器的路由与交换实训报告(单臂路由、三层交换机实现vlan通信、ospf、rip、dhcp、acl、nat技术总结)

本博客是路由与交换实训报告&#xff0c;基于思科模拟器分别做了单臂路由、三层交换机实现vlan间通信、ospf、rip、dhcp、nat的实验&#xff0c;最后的nat综合实验是本次实训的大拓扑&#xff0c;综合了上述的几个技术。 大家可以当作一些思科小实验的总结&#xff0c;供网络工…

数据库管理-第七十二期 复盘(20230505)

数据库管理 2023-05-05 第七十二期 复盘1 再测试2 对照分析&#xff1a; 3 如何解决总结 第七十二期 复盘 上一期的内容&#xff0c;我承认主要是在放假&#xff0c;分析过程还是水了一点&#xff0c;SR转回国内之后&#xff0c;处理效率还是提升了一大截。 1 再测试 在客户…

Linux - 第11节 - 网络基础(一)

1.计算机网络背景 1.1.网络发展 独立模式&#xff1a;计算机之间相互独立 在早期的时候&#xff0c;计算机之间是相互独立的&#xff0c;此时如果多个计算机要协同完成某种业务&#xff0c;那么就只能等一台计算机处理完后再将数据传递给下一台计算机&#xff0c;然后下一台计…

Python进阶——实现人脸识别

前言 嗨喽&#xff0c;大家好呀~这里是爱看美女的茜茜呐 今天我们来实现一下人脸识别~ 先问大家一个问题 什么是百度Aip模块&#xff1f; 百度AI平台提供了很多的API接口供开发者快速的调用运用在项目中 本文写的是使用百度AI的在线接口SDK模块&#xff08;baidu-aip&#…