当前位置: 首页 > news >正文

广东阳江最新消息西青seo

广东阳江最新消息,西青seo,爱网之家,有谁做网站功能需求: 列表进行批量查询,需要对输入的值做提交校验,分三种情况: 若部分字符串有误,部分字符串需要变更字体颜色做提示,再次点击确认则对部分正确数据执行批量查询 若全部数据有误则变更字体颜色做提示&…

功能需求:

列表进行批量查询,需要对输入的值做提交校验,分三种情况:
若部分字符串有误,部分字符串需要变更字体颜色做提示,再次点击确认则对部分正确数据执行批量查询
若全部数据有误则变更字体颜色做提示,再次点击确认查询为空
若全部数据正确则直接执行批量查询

需要变更字体颜色做提示的情况分三种:
一种为重复数据
一种为未通过校验数据
一种为既没有通过校验又重复的数据

知识点:

contenteditable:contenteditable为true可编辑元素内容

实现:

<el-button type="primary" :size="$formSize" @click="handleBatchQuery">批量查询</el-button><!--批量查询-->
<el-dialog title="批量查询" :visible.sync="batchQuery" width="600px"><div v-if="batchQuery" id="editor" class="editor" ref="editor" contenteditable="true" @click="showInput=true"><span v-if="!showInput" class="uninput">手动输入多个ICCID或设备id,以换行符分隔,如:<br/>94816c8ded8f<br/>94816c8ded8f</span></div><div slot="footer" class="dialog-footer"><el-button @click="cancelQuery">取消</el-button><el-button type="primary" @click="submitQuery">确定</el-button></div>
</el-dialog>
import request from "@/utils/request";
export default {data(){return{searchForm:{}batchQuery:false,showInput:false,queryInput:'',oldQueryInput:[],resultList:[],once:false,}},methods:{//批量查询handleBatchQuery(){this.showInput=falsethis.batchQuery=truethis.queryInput=undefinedthis.searchForm.batchStr=undefined //查询条件this.oldQueryInput=[]this.once=false},//取消批量查询cancelQuery(){this.showInput=falsethis.batchQuery=falsethis.queryInput=undefinedthis.searchForm.batchStr=undefinedthis.oldQueryInput=[]this.once=falsethis.$refs.editor.innerHTML=''},//提交批量查询submitQuery(){//无填写内容有提示语时确认if(this.$refs.editor.innerHTML.indexOf('手动输入多个ICCID或设备id')!=-1){this.handleQuery()this.batchQuery=falsereturn}this.queryInput=this.$refs.editor.innerText.split(/[(\r\n)\r\n]+/).filter(item=>item)//填写内容超过100条时确认if(this.queryInput.length>100){this.$message.warning('批量查询数据数量不能超过100条')this.batchQuery=truethis.once=falsereturn}//无填写内容无提示语时确认if(this.queryInput.length===0){this.handleQuery()this.batchQuery=falsereturn}let batchList=this.queryInputif(!this.once){this.oldQueryInput=this.queryInput}else{this.oldQueryInput=Array.from(new Set(this.oldQueryInput.filter(item=>!this.resultList.includes(item))))}let batchStr=this.oldQueryInput.join(',');//联调校验接口request({url: `接口路径`,method: 'post',data: {batchStr:batchStr},}).then((res) => {if (res.code === "200") {this.resultList=res.data || []this.once=trueif(this.resultList.length===0){this.batchQuery=falsethis.searchForm.batchStr=this.oldQueryInput.join(',');this.handleQuery()this.$refs.editor.innerHTML=''this.showInput=false}else{this.batchQuery=truelet repeat=[]for (let i = 0; i < batchList.length; i++) {if (batchList.indexOf(batchList[i]) !== i) {repeat.push(batchList[i]);}}batchList=batchList.map(item=>{if(repeat.includes(item)&&!this.resultList.includes(item)){return item=`<div style="color:red">${item+',数据重复'}</div>`}else if(this.resultList.includes(item)&&!repeat.includes(item)){return item=`<div style="color:red">${item+',无结果'}</div>`}else if(repeat.includes(item)&&this.resultList.includes(item)){return item=item=`<div style="color:red">${item+',无结果且数据重复'}</div>`}else{return item=`<div>${item}</div>`;}})this.$refs.editor.innerHTML=batchList.join('\n')}}})},}
}
.editor{width: 100%;height: 150px;overflow: auto;border: 1px solid #dcdfe6;
}
.uninput{color: #dcdfe6;color: #c0c4cc;line-height: 20px;
}

效果:
在这里插入图片描述
在这里插入图片描述

当文字颜色变更提示后,再次点击确认后只会查询正确的(包含数据重复的)数据

http://www.dinnco.com/news/50391.html

相关文章:

  • 洛阳恒凯做的网站有哪些360优化大师安卓版下载
  • 集团微信网站方案策划如何做营销活动
  • 英雄联盟做的广告视频网站沧州网站优化公司
  • 微信朋友圈的网站连接怎么做教育培训网站大全
  • 旅社网站建设网站页面
  • 做效果图网站有哪些引流获客工具
  • 云阿里云做网站上海培训机构排名榜
  • 常德做网站专业公司哪家好常用的搜索引擎有哪些?
  • 成都建设网站新闻 最新消息
  • 营销型网站设计方针最新网站推广方法
  • 电子政务和网站建设工作的总结京东关键词优化技巧
  • 网站 产品图片 尺寸大连百度关键词排名
  • 哪家公司提供专业的网站建设互联网营销推广渠道
  • 网站空间虚拟主机续费企业推广的网站
  • 工地模板图片大全seo内部优化方案
  • 四川旅游攻略东营网站seo
  • 本地建站软件百度seo排名培训
  • 找客户的100个渠道seo评测论坛
  • 做系统的网站公司企业网站模板
  • 做配资 怎么在网站联系客户站长工具seo综合查询工具
  • 南充网站建设新闻摘抄
  • 公共体育课程网站建设石家庄seo优化公司
  • 阿里云nas做网站代运营一家店铺多少钱
  • 多语种网站建设app推广是什么工作
  • 网站团队建设baike seotl
  • 建立网站专栏武汉标兵seo
  • 品牌查询网站网络推广产品要给多少钱
  • 宣传网站建设的步骤百度指数大数据分享平台
  • 珠峰网站建设如何做好网上销售
  • 七米网站建设搜索引擎竞价广告