自定义列表里面实现多选功能

news2024/11/18 13:44:53

需求

我们在开发过程中有时候会遇到列表里面会有多选,然后列表样式也要进行自定义。这里我们如果直接使用ElementUI组件el-table表格的时候这里实现起来可能比较复杂不方便,我们这里手写自定义一下列表里面多选的功能。

实现效果如下图所示:

在这里插入图片描述

具体实现代码如下

1- 我们这里先建一个子组件LiteratureTable.vue

<template>
  <div class="mainComponent">
    <div v-if="tableData.length" class="allCheck">
      <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" v-if="$_has('documentDatabase:download')" @change="handleCheckAllChange">全选</el-checkbox>
    </div>
    <div style="text-align: center;padding: 20px 0;" v-else>
      <el-tag type="warning">暂无数据</el-tag>
    </div>
    <div class="tableList">
      <el-checkbox-group v-model="checkedCities" @change="handleCheckedCitiesChange">
        <el-checkbox class="tableItem" v-for="item in tableData" :label="item.literatureId" :key="item.literatureId">
          <div class="itemPart">
            <div class="TopPart">
              <div class="TopLeft">
                <div class="title">
                  <span class="centerTitle">{{item.title || '无'}}</span>
                  <span class="centerNumber">{{item.code || '无'}}</span>
                </div>
              </div>
              <div class="topRight" v-if="!followupSelectvalue">
                <template v-if="$_has('documentDatabase:edit')">
                  <i class="iconFont el-icon-edit" @click.prevent="editHandel(item)">编辑</i>
                  <el-divider direction="vertical"></el-divider>
                </template>
                <!-- <i class="iconFont el-icon-download" @click.prevent="downloadHandel(item.literatureId)">下载</i> -->
                <!-- <i class="iconFont el-icon-download"></i>
                <DownloadFileForInspection
                  style="margin: 0 -10px;"
                  textColor="#67C23A"
                  btnName="下载"
                  type="text"
                  :url="'/literature/literature/downloadUrl'"
                  :data="{ literatureId: item.literatureId }"
                  method="post"
                /> -->
                <!-- <el-divider direction="vertical"></el-divider> -->
                <i v-if="$_has('documentDatabase:delete')" class="iconFont el-icon-delete" @click.prevent="deleItem(item.literatureId)">删除</i>
              </div>
              <div class="topRight" v-else>
                <el-button type="primary" @click="addselectLiteratureId(item)" size="mini">选中</el-button>
              </div>
            </div>
            <div class="BottomText">
              <div class="text-tag">
                <!-- <span>{{ Projectnamepocket(item.projectId, 'allProject') }}</span>
                |
                <span>{{ tagListPocket(item.derivation, 'Derivation') }}</span>
                |
                <span>{{ tagListPocket(item.type, 'Type') }}</span>
                |
                <span>{{ item.publishYear }}</span>
                |
                <span>{{ tagListPocket(item.lang, 'Lang') }}</span>
                |
                <span>{{ item.provenance || '无' }}</span>
                |
                <span>{{ item.downloadCount || '无' }}</span> -->
                {{ item.tagName || '无' }}
              </div>
              <div>
                {{ item.created_at }}
              </div>
            </div>
          </div>
        </el-checkbox>
      </el-checkbox-group>
    </div>

     <el-dialog title="编辑" :visible.sync="editVisible" width="460px">
      <el-form
        :inline="false"
        class="edit-form"
        ref="editForm"
        :model="editForm"
        label-width="145px">
        <el-form-item
          :rules="{ required: true, message: '请输入标题', trigger: 'blur' }"
          label="标题"
          prop="title">
          <el-input v-model="editForm.title" placeholder="请输入标题" clearable></el-input>
        </el-form-item>
        <el-form-item
          :rules="{ required: true, message: '请选择项目', trigger: 'change' }"
          label="项目"
          prop="projectId">
          <SelectGeneric
            @change="projectValueChange(editForm.projectId)"
            :select.sync="editForm.projectId"
            filterable
            multiple
            :options="'allProject' | pocketOptions"
            placeholder="请选择项目"
          >
          </SelectGeneric>
        </el-form-item>
        <el-form-item
          :rules="{ required: true, message: '请选择年限', trigger: 'change' }"
          label="发表年限"
          prop="publishYear">
          <el-date-picker
            v-model="editForm.publishYear"
            :picker-options="pickerOptions"
            type="year"
            format="yyyy"
            value-format="yyyy"
            placeholder="请选择年限">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="来源" prop="provenance">
          <el-input v-model="editForm.provenance" placeholder="请输入来源" clearable></el-input>
        </el-form-item>
        <el-form-item label="影响因子" prop="influence">
          <!-- <el-input type="number" v-model="editForm.influence" placeholder="请输入影响因子" clearable></el-input> -->
          <MyInputNumber style="width: 200px;" v-model="editForm.influence" :min="0" :max="1000" :precision="3" placeholder="请输入影响因子" clearable></MyInputNumber>
        </el-form-item>
        <el-form-item
          v-if="derivationOptions.length > 0"
          :rules="{ required: true, message: '请选择出处', trigger: 'change' }"
          label="出处"
          prop="derivationId">
          <SelectGeneric
            :select.sync="editForm.derivationId"
            :options="derivationOptions"
            placeholder="请选择出处"
            multiple
            collapse-tags
            clearable
          >
          </SelectGeneric>
        </el-form-item>

        <el-form-item
          v-for="(activeFormItem, i) in activeFormItems"
          :key="i"
          :label="activeFormItem.label"
          :prop="activeFormItem.shortName"
          :rules="{ required: !!activeFormItem.required, message: '请选择' + activeFormItem.label, trigger: 'change' }"
        >
          <el-cascader
            v-if="activeFormItem.type === 'cascader'"
            :options="activeFormItem.ch"
            v-model="editForm[activeFormItem.shortName]"
            :show-all-levels="false"
            :props="cascaderProps"
            :placeholder="'请选择' + activeFormItem.label"
            clearable
            filterable>
          </el-cascader>
          <SelectGeneric
            v-else
            collapse-tags
            filterable
            clearable
            :multiple="activeFormItem.type === 'multiple'"
            :select.sync="editForm[activeFormItem.shortName]"
            :options="activeFormItem.ch"
            :placeholder="'请选择' + activeFormItem.label"
          >
          </SelectGeneric>
        </el-form-item>

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="editVisible = false">取 消</el-button>
        <el-button type="primary" @click="editConfirm">确 定</el-button>
      </div>
    </el-dialog>

    <el-dialog title="下载文献" :visible.sync="downloadVisible" width="460px" @closed="downloadClose">
      <el-form
        class="communication-form"
        ref="downloadForm"
        :model="downloadForm"
        label-width="80px">
        <el-form-item
          label="文献目的"
          prop="Goals"
          :rules="{ required: true, message: '请选文献目的', trigger: 'change' }">
          <el-radio-group v-model="downloadForm.Goals">
            <el-radio label="DoctorNeeds">医生需求</el-radio>
            <el-radio label="SelfLearning">自我学习</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item
          label="医生编号"
          prop="DoctorNo"
          v-if="downloadForm.Goals === 'DoctorNeeds'"
          :rules="{ required: true, message: '请输入医生编号', trigger: 'blur' }">
          <el-input v-model="downloadForm.DoctorNo" placeholder="请输入医生编号" clearable></el-input>
        </el-form-item>
        <el-form-item
          label="项目"
          prop="ProjectId"
          :rules="{ required: true, message: '请选择项目', trigger: 'change' }">
          <SelectGeneric
            :select.sync="downloadForm.ProjectId"
            :options="'allProject' | pocketOptions"
            placeholder="请选择项目"
            filterable
          >
          </SelectGeneric>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="downloadVisible = false">取 消</el-button>
        <el-button type="primary" @click="downloadConfirm">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { downloadByUrl } from '@utils/index'
export default {
  props: ['tableData', 'followupSelectvalue'],
  data () {
    return {
      downloadVisible: false,
      downloadForm: {
        Goals: 'DoctorNeeds',
        DoctorNo: undefined,
        ProjectId: undefined
      },
      selectLiteratureId: null,
      cascaderProps: {
        multiple: true,
        emitPath: false,
        checkStrictly: false,
        label: 'label',
        value: 'value',
        children: 'ch'
      },
      editVisible: false,
      editForm: {
        relationId: [],
        derivationId: []
      },
      derivationOptions: [],
      pickerOptions: {
        disabledDate: (val) => {
          var date = new Date()
          if (val.getFullYear() >= 2010 && val.getFullYear() <= date.getFullYear()) {
            return false
          } else {
            return true
          }
        }
      },
      checkAll: false,
      checkedCities: [],
      cities: [
        {
          literatureId: '1',
          name: '1'
        },
        {
          literatureId: '2',
          name: '2'
        },
        {
          literatureId: '3',
          name: '3'
        }
      ],
      isIndeterminate: false,
      activeFormItems: [],
      activeFormField: {}
    }
  },
  watch: {
  },
  methods: {
    projectValueChange (val) {
      if (val !== null && val !== '') {
        // this.editForm.derivationId = []
        this.$store.dispatch('scholarlyLiterature/getDerivationList', { ProjectId: val }).then(res => {
          this.derivationOptions = res.data
        })
      } else {
        this.editForm.derivationId = []
        this.derivationOptions = []
      }
    },
    // 获取项目名称
    Projectnamepocket (value, type, defalult) {
      var pocketLabel = []
      for (const i in this.$store.state.tool.pocket) {
        if (i === type) {
          if (Array.isArray(value)) {
            for (const item of value) {
              for (const v of this.$store.state.tool.pocket[type]) {
                if (item === v.value) {
                  pocketLabel.push(v.label)
                }
              }
            }
          } else {
            for (const v of this.$store.state.tool.pocket[type]) {
              if (value === v.value) {
                pocketLabel.push(v.label)
              }
            }
          }
          break
        }
      }
      return pocketLabel.length > 0 ? pocketLabel.join('、') : (defalult || '无')
    },
    tagListPocket (value, type, defalult) {
      if (!value) return '无'
      var pocketLabel = []
      const tagList = this.$store.state.tool.pocket.tagList || []
      for (let i = 0; i < tagList.length; i++) {
        const element = tagList[i]
        if (element.shortName === type) {
          if (Array.isArray(value)) {
            for (const item of value) {
              for (const v of element.ch) {
                if (item === v.value) {
                  pocketLabel.push(v.label)
                }
              }
            }
          } else {
            for (const v of i.ch) {
              if (value === v.value) {
                pocketLabel.push(v.label)
              }
            }
          }
          break
        }
      }
      return pocketLabel.length > 0 ? pocketLabel.join('、') : (defalult || '无')
    },
    editHandel (row) {
      this.$store.dispatch('scholarlyLiterature/getDerivationList', { ProjectId: row.projectId }).then(res => {
        this.derivationOptions = res.data
        this.editForm = row
        this.editVisible = true

        this.$refs.editForm && this.$refs.editForm.clearValidate()
      })
    },
    editConfirm () {
      const options = this.editForm
      // options.relation = this.editForm.relationId.map(e => e[1])
      this.$refs.editForm.validate((valid) => {
        if (valid) {
          this.$store.dispatch('scholarlyLiterature/LiteratureEdit', options).then(res => {
            if (res.data) {
              this.editVisible = false
              this.$message.success('编辑成功')
              this.$emit('refreshCurrentPage')
            }
          })
        } else {
          return false
        }
      })
    },
    handleCheckAllChange (val) {
      console.log(val)
      var arr = []
      for (var i = 0; i < this.tableData.length; i++) {
        arr.push(this.tableData[i].literatureId)
      }
      this.checkedCities = val ? arr : []
      this.$emit('change', this.checkedCities)
      this.isIndeterminate = false
    },
    handleCheckedCitiesChange (value) {
      const checkedCount = value.length
      this.checkAll = checkedCount === this.tableData.length
      this.isIndeterminate = checkedCount > 0 && checkedCount < this.tableData.length
      this.$emit('change', value)
    },
    downloadConfirm () {
      this.$refs.downloadForm.validate((valid) => {
        if (valid) {
          const options = {
            ...this.downloadForm,
            LiteratureId: this.selectLiteratureId
          }
          this.$store.dispatch('scholarlyLiterature/GetLiteratureDownloadUrl', options).then(res => {
            downloadByUrl(res.data.url)
            this.downloadVisible = false
            this.downloadForm = {
              Goals: 'DoctorNeeds',
              DoctorNo: undefined,
              ProjectId: undefined
            }
          })
        } else {
          return false
        }
      })
    },
    deleItem (literatureId) {
      this.$confirm('确定删除吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$store.dispatch('scholarlyLiterature/LiteratureDel', { literatureId }).then(res => {
          if (res.data) {
            this.$message.success('删除成功')
            this.$emit('refreshCurrentPage')
          }
        })
      }).catch(() => {})
    },
    addselectLiteratureId (row) {
      console.log(row)
      this.$emit('selectliteratureData', row)
    }
  }
}
</script>

<style lang="scss" scoped>
  .mainComponent {
    .tableList {
      ::v-deep .el-checkbox {
        user-select: auto;
        cursor: default;
      }

      .tableItem {
        display: block;
        width: 100%;
        position: relative;

        ::v-deep .el-checkbox__input {
          position: absolute;
          top: 50%;
          margin-top: -23px;
        }

        ::v-deep .el-checkbox__label {
          width: 100%;
          padding-left: 23px;

          .itemPart {
            border-bottom: 1px solid #ededed;
            padding: 10px 0px;

            .TopPart {
              display: flex;
              justify-content: space-between;
              align-items: center;
              margin-bottom: 10px;

              .TopLeft {
                display: flex;
                align-items: center;

                .topLeftCheck {
                  padding-right: 20px;
                  display: flex;
                }

                .title {
                  cursor: pointer;
                }

                .centerTitle {
                  font-size: 16px;
                  font-weight: 600;
                  padding-right: 15px;
                  color: #333;
                }

                .centerNumber {
                  display: inline-block;
                  width: 130px;
                  height: 17px;
                  font-weight: 600;
                  background-color: rgb(242, 242, 243);
                  border-color: rgb(155, 157, 163);
                  border-width: 1px;
                  border-style: solid;
                  color: rgb(133, 136, 142);
                  border-radius: 3px;
                  font-size: 12px;
                  padding: 0px;
                  text-align: center;
                  line-height: 17px;
                }

                .centerTime {
                  color: #9999;
                  font-size: 14px;
                  line-height: 28px;
                }
              }

              .topRight {
                color: #6666;
                font-size: 14px;
                padding-right: 50px;

                .iconFont {
                  cursor: pointer;
                  color: #60a4e7;

                  &.el-icon-download {
                    color: #67C23A;
                  }

                  &.el-icon-delete {
                    color: orange;
                  }
                }
              }
            }

            .BottomText {
              display: flex;
              justify-content: space-between;
              align-items: center;
              padding-right: 50px;
              color: #636363;
              font-size: 14px;

              .text-tag {
                min-width: 1000px;
                white-space: normal;
                word-break: break-all;
                word-wrap: break-word;
                white-space: pre-wrap;
                line-height: 1.5;
                margin-right: 35px;
              }

              &.noPadding {
                padding-left: 0;
                padding-right: 0;
              }
            }
          }
        }
      }
    }
  }

  ::v-deep .edit-form {
    .MyInputNumber {
      width: 200px;
    }
  }
</style>

2-父组件引入子组件LiteratureTable 如下:

<template>
  <section>
    <el-form :inline="true" class="communication-form" :model="formData">
      <el-form-item>
        <SelectGeneric
          :select.sync="formData.ProjectId"
          :options="'allProject' | pocketOptions"
          placeholder="请选择项目"
          filterable
        >
        </SelectGeneric>
      </el-form-item>
      <el-form-item>
        <SelectGeneric
          :select.sync="formData.derivationId"
          :options="'derivation' | pocketOptions"
          placeholder="请选择出处"
          filterable
        >
        </SelectGeneric>
      </el-form-item>
      <el-form-item>
        <el-date-picker
          v-model="formData.PublishYear"
          :picker-options="pickerOptions"
          value-format="yyyy"
          type="year"
          placeholder="选择年限">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-date-picker
          v-model="formData.Date"
          type="daterange"
          format="yyyy-MM-dd"
          value-format="yyyy-MM-dd"
          range-separator="至"
          start-placeholder="更新开始日期"
          end-placeholder="更新结束日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-input v-model="formData.Keyword" placeholder="请输入关键字" clearable></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="search('searchForm')">搜索</el-button>
        <DownloadFileForInspection
          v-if="$_has('documentDatabase:download')"
          btnName="下载"
          type="primary"
          :url="'/literature/literature/downloadPackage'"
          :data="{ literatureIds: selectBatchDownloadIds }"
          method="post"
        />
        <el-button type="primary" v-if="$_has('documentDatabase:upload')" @click="addLiterature" style="margin-left: 10px;">上传</el-button>
        <el-button type="primary" v-if="$_has('documentDatabase:create')" @click="creatRequire">新建需求</el-button>
      </el-form-item>
    </el-form>

    <LiteratureTable
      @change="costPlannedAmountChange($event)"
      :tableData="tableData"
      @refreshCurrentPage="search">
    </LiteratureTable>

    <Pagination
      :total="pagination.totalCount"
      :pageSize="pagination.pageSize"
      :pageNumber.sync="pagination.pageNumber"
      @sizeChange="handleSizeChange"
      @currentChange="handleCurrentChange"
      layout="total, sizes, prev, pager, next, jumper"
    >
    </Pagination>
  </section>
</template>

<script>
import { PageSearch } from '@/mixins'
import LiteratureTable from '../components/LiteratureTable'

export default {
  name: 'DocumentDatabase',
  components: { LiteratureTable },
  mixins: [PageSearch],
  data () {
    return {
      cascaderProps: {
        multiple: true,
        emitPath: false,
        checkStrictly: false,
        label: 'label',
        value: 'value',
        children: 'ch'
      },
      formData: {
        ProjectId: '',
        derivationId: '',
        PublishYear: '',
        Date: '',
        Keyword: ''
      },
      tableData: [],
      addLiteratureVisible: false,
      selectBatchDownloadIds: [],
      pickerOptions: {
        disabledDate: (val) => {
          var date = new Date()
          if (val.getFullYear() >= 2010 && val.getFullYear() <= date.getFullYear()) {
            return false
          } else {
            return true
          }
        }
      },
      activeFormItems: [],
      activeFormField: {}
    }
  },
  activated () {
    this.search()
  },
  watch: {
  },
  methods: {
    // 接收selectBatchDownloadIds
    async costPlannedAmountChange (value) {
      this.selectBatchDownloadIds = value
    },

    addLiterature () {
      this.addLiteratureVisible = true
    },

    addLiteratureConfirm () {
      this.$refs.addLiteratureRef.$refs.addLiteratureForm.validate((valid) => {
        if (valid) {
          // console.log(this.$refs.addLiteratureRef.literatureData)
          const options = JSON.parse(JSON.stringify(this.$refs.addLiteratureRef.literatureData.literatureList))
          if (options.length <= 0) return
          // options.forEach(e => {
          //   e.relation = e.relation.map(e => e[1])
          // })
          const fileNameList = options.map(e => e.fileName)

          this.$store.dispatch('scholarlyLiterature/CheckName', { fileNameList }).then(res => {
            if (res.data.length <= 0) {
              // 校验成功
              this.submitFileList(options)
            }
            if (res.data.length > 0) {
              this.$confirm('文献库中已有重复文件:' + res.data[0], '提示', {
                confirmButtonText: '忽略',
                cancelButtonText: '取消',
                type: 'warning'
              }).then(() => {
                this.submitFileList(options)
              }).catch(() => {})
            }
          })
        } else {
          return false
        }
      })
    },

    submitFileList (data) {
      this.$store.dispatch('scholarlyLiterature/UploadLiterature', { literatureList: data }).then(res => {
        if (res.data) {
          this.addLiteratureVisible = false
          this.$message.success('上传成功')
          this.search()

          this.$refs.addLiteratureRef.literatureData.literatureList = []
        }
      })
    },

    addLiteratureClose () {
      this.addLiteratureVisible = false
      this.$refs.addLiteratureRef.literatureData.literatureList = []
    },

    creatRequire () {
      this.$router.push({ name: 'CreatRequire' })
    },

    literatureRetrieval () {
      this.$router.push({ name: 'LiteratureRetrieval' })
    },

    search (type) {
      if (type === 'searchForm') {
        this.pagination.pageNumber = 1
      }
      const { pageSize, pageNumber } = this.pagination
      const options = {
        ...this.formData,
        // Relation: this.formData.Relation.map(e => e[1]),
        StartTime: this.formData.Date && this.formData.Date[0],
        EndTime: this.formData.Date && this.formData.Date[1],
        pageSize,
        pageNumber
      }
      this.$store.dispatch('scholarlyLiterature/GetLiteratureList', options).then(res => {
        const { list, page } = res.data
        this.tableData = list
        this.pagination = page
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.el-alert {
  margin-bottom: 20px;
}
</style>

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

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

相关文章

二叉搜索树与双向链表

解题思路一&#xff1a; /** public class TreeNode {int val 0;TreeNode left null;TreeNode right null;public TreeNode(int val) {this.val val;} } */ // 一定要用自己的理解真正弄出来才行&#xff0c;否则没有用&#xff01; // 再次提醒&#xff0c;计算机这种工科…

【Python案例实战】水质安全分析及建模预测

一、引言 1.水资源的重要性 水是生命之源,是人类生存和发展的基础。它是生态系统中不可或缺的组成部分,对于维系地球上的生命、农业、工业、城市发展等方面都具有至关重要的作用。 2.水质安全与人类健康的关系 水质安全直接关系到人类的健康和生存。水中的污染物和有害物…

C# OpenCvSharp DNN Gaze Estimation

目录 介绍 效果 模型信息 项目 代码 frmMain.cs GazeEstimation.cs 下载 C# OpenCvSharp DNN Gaze Estimation 介绍 训练源码地址&#xff1a;https://github.com/deepinsight/insightface/tree/master/reconstruction/gaze 效果 模型信息 Inputs ----------------…

正则表达式解析与应用:深度剖析正则表达式的威力

&#x1f604; 19年之后由于某些原因断更了三年&#xff0c;23年重新扬帆起航&#xff0c;推出更多优质博文&#xff0c;希望大家多多支持&#xff5e; &#x1f337; 古之立大事者&#xff0c;不惟有超世之才&#xff0c;亦必有坚忍不拔之志 &#x1f390; 个人CSND主页——Mi…

pytorch机器学习各种激活函数总结(不完整学习更新中~)

pytorch各种激活函数总结 0.思维导图预览1. ReLU函数1.1 改进版ReLU6函数 2. Sigmoid函数3. Softmax函数4. Tanh函数5.&#xff08;学习后更新&#xff09; 0.思维导图预览 1. ReLU函数 ReLU&#xff08;Rectified Linear Unit&#xff09;线性整流函数 其公式为&#xff1a; …

常用API(String,StringBuilder,StringJoiner)

文章目录 1.API1.1API概述1.2如何使用API帮助文档 2.String类2.1String类概述2.2String类的特点2.3String类的构造方法2.4创建字符串对象两种方式的区别2.5字符串的比较2.5.1号的作用2.5.2equals方法的作用 2.6用户登录案例2.6.1案例需求2.6.2代码实现 2.7遍历字符串案例2.7.1案…

软件测试|SQL AND和OR运算符解析

简介 在SQL&#xff08;Structured Query Language&#xff09;中&#xff0c;AND和OR是两个常用的逻辑运算符。它们用于组合条件来构建复杂的查询语句&#xff0c;帮助我们更精确地过滤和检索数据。本文将详细介绍SQL中的AND和OR运算符&#xff0c;包括其语法、用法以及使用时…

数据结构学习 jz63股票的最大利润

关键词&#xff1a;动态规划 滚动数组优化 这题不要被动态规划吓到了&#xff0c;其实很简单。 用时16min 题目&#xff1a; 思路&#xff1a; 最大利润的实现办法&#xff1a;在最低的时候买入&#xff0c;在最高的时候卖出。 dp状态&#xff1a; dp[i]第i天如果卖出的最…

uniapp中组件库的Checkbox 复选框 的丰富使用方法

目录 #平台差异说明 #基本使用 #自定义形状 #禁用checkbox #自定义形状 #自定义颜色 #横向排列形式 #横向两端排列形式 API #Checkbox Props #CheckboxGroup Props #CheckboxGroup Event 复选框组件一般用于需要多个选择的场景&#xff0c;该组件功能完整&#xff…

STM32疑难杂症

1.keil的奇怪问题 创建的数组分配内存到0x10000000地址的时候,数据总是莫名其妙的出现问题,取消勾选就正常了 stm32f407内部有一个CCM内存,这部分内存只能由内核控制,任何外设都不能够进行访问。这样问题就来了,如果使用keil5进行编程时勾选了这个选项(下图),则编译的…

八、Lua脚本详解—— 超详细操作演示!

八、Lua脚本详解 —— 超详细操作演示&#xff01; 八、Lua脚本详解8.1 Lua 简介8.2 Linux 系统的Lua8.2.1 Lua 下载8.2.2 Lua 安装8.2.3 Hello World 8.3 Win 系统的Lua8.4 Lua 脚本基础8.4.1 注释8.4.2 数据类型8.4.3 标识符8.4.4 运算符8.4.5 函数8.4.6 流程控制语句8.4.7 循…

2021-05-08 51单片机74HC164、74LS164、74HCT164、74HC154、74HCT154应用三极管控制继电器

74HC164、74HCT164是8位边沿触发式移位寄存器&#xff0c;串行输入数据&#xff0c;然后并行输出。数据通过两个输入端&#xff08;DSA或DSB&#xff09;之一串行输入&#xff1b;任一输入端可以用作高电平使能端&#xff0c;控制另一输入端的数据输入。两个输入端或者连接在一…

IMS SIP register消息中的Contact header field

SIP register中的Contact还要承载User Agent的能力信息。 实网下抓取的UE log如上&#xff0c;下面就主要看下Contact header field要包含的内容及其含义。 Contact header field设置为包括 UE IP地址或FQDN的SIP URI。 如上图contact中sip:69a5de6a-a03e-46d6-ad7a-b0d974c8f…

大创项目推荐 深度学习图像修复算法 - opencv python 机器视觉

文章目录 0 前言2 什么是图像内容填充修复3 原理分析3.1 第一步&#xff1a;将图像理解为一个概率分布的样本3.2 补全图像 3.3 快速生成假图像3.4 生成对抗网络(Generative Adversarial Net, GAN) 的架构3.5 使用G(z)生成伪图像 4 在Tensorflow上构建DCGANs最后 0 前言 &#…

函数式编程及应用

目录 什么是Lambdalambda表达式的类型及实现方式类型语法 常用函数式接口Customer 函数式编程在Stream中的应用总结参考资料 什么是Lambda Lambda 表达式是 JDK8 的一个新特性&#xff0c;可以取代大部分的匿名内部类&#xff0c;写出更优雅的Java代码。 Lambda 表达式描述了一…

图片剪切软件,让图片处理更加高效

随着数字技术的不断发展&#xff0c;图片剪切也在不断进步。从手动裁剪到自动识别&#xff0c;图片剪切正变得越来越简单、高效&#xff0c;在这里面&#xff0c;图片处理软件的作用是不可忽视的。 所需工具&#xff1a; 一个【首助编辑高手】软件 需要剪切的图片 操作步骤…

【python】魔术方法大全(一)--基础篇

如果对你有帮助&#xff0c;欢迎微信搜索【海哥python】关注这个互联网苟且偷生的工具人。 什么是魔术方法 所谓魔法方法&#xff0c;它的官方的名字实际上叫special method&#xff0c;是Python的一种高级语法&#xff0c;允许你在类中自定义函数&#xff0c;并绑定到类的特殊…

Weblogic安全漫谈(四)

黑名单机制必然会推动两种研究方向的发展&#xff1a;一是挖掘不在黑名单的新组件&#xff0c;是为绕过规则&#xff1b;二是发掘检查的盲区&#xff0c;是为绕过逻辑。 CVE-2020-14756 二次反序列化具有对抗检查逻辑的天生丽质&#xff0c;在CVE-2018-2893中就有利用字节数组…

Kubeadmin实现k8s集群:

Kubeadmin来快速搭建一个k8s集群&#xff1a; 二进制搭建适合大集群&#xff0c;50台以上的主机&#xff0c; 但是kubeadm更适合中小企业的业务集群 环境&#xff1a; Master&#xff1a;20.0.0.71 2核4G 或者4核8G docker kubelet kubectl flannel Node1&#xff1a;20.…

面试题:vue2中option API的和vue3中composition API中的数据和方法能否交互?

结论&#xff1a; vue2中option API中的数据和方法可以从vue3中的composition API中进行调用&#xff0c; 而vue3中的composition API是不可以从vue2中的数据进行调用。 原理&#xff1a; 因为composition API中的函数setup在页面的生命周期中要比vue2中option API中的data、…