node删除 + 下载+导入+到处功能

删除 node_modules操作

1.安装npm包–rimraf
npm install rimraf -g
2.在cmd指令下,进入所需删除的node_modules文件夹的位置,再输入指令
rimraf node_modules
 

window.open(location.origin + location.pathname + '#/' + item.url, '_blank')

//新开窗口下载
openwin(url) {
  var a = document.createElement("a");
  a.setAttribute("href", url);
  a.setAttribute("target", "_blank");
  a.setAttribute("id", "openwin");
  document.body.appendChild(a);
  a.click();
},

// 导出人员信息
exportInfo(){
  let ids = this.selectedChangeData
  const loading = this.$loading({
  lock: true,
  text: '拼命加载中',
  spinner: 'el-icon-loading',
  customClass: 'el-icon-loadings'
});
exportEmps(ids).then(res => {
  let url = res.data.data
  this.openwin(url)
}, this.err).finally(() => loading.close())
},

 

//导入人员信息
<input  ref="filElem"  type="file"  class="upload-file"  accept=".xlsx, .xls,.csv"  style="display: none"  @change="getFile"/>
<el-button type="primary" @click.native="importFile">导入</el-button>
方法:   
    importFile() {
      this.$refs.filElem.dispatchEvent(new MouseEvent("click"));
    },
    getFile() {
      let that = this;
      let param = this.$refs.filElem.files[0];
      let formData = new FormData();
      formData.append("medical_import", param);
      // this.$axios({
      //   url: "http://195.195.8.157/v3/api/medical/service/excel/import", // 请求的 url 地址
      //   method: "post", // 请求方式
      //   data: formData, // 传递的参数
      // })
      //   .then((res) => {
      //     if (res.data.code == 200) {
      //       that.$message.success(res.data.message);
      //     } else {
      //       that.$message.error(res.data.message);
      //     }
      //   })
      //   .catch((err) => {
      //     console.log(err);
      //   });
 
      this.$familyNewAddUrl
        .post("/medical/service/excel/import", formData, {
          "Content-Type": "application/x-www-form-urlencoded",
        })
        .then((res) => {
          if (res.data.code == 200) {
            that.$message.success(res.data.message);
          } else {
            that.$message.error(res.data.message);
          }
        });
    },
 
 

//滚动

var scrollHeights = obj.parents('.readItem')[0].offsetTop
obj.parents('.infor_cont_kecheng').animate({ scrollTop: scrollHeights }, 200)

var height = document.getElementsByClassName('infor_cont_wrap')[1].scrollTop

var timer = setInterval(function(){
  height--
  if(height == 0){
    alert(11)
    clearInterval(timer)
    return false
  }
  document.getElementsByClassName('infor_cont_wrap') [1].scrollTo(0,height)

},10)

var height = document.getElementsByClassName('infor_cont_wrap')[1].scrollTop
console.log(height)
var timer = setInterval(function(){
height = height - 2
if(height < 2){
alert(11)
clearInterval(timer)
return false
}
document.getElementsByClassName('infor_cont_wrap') [1].scrollTo(0,height)

},1)

 

//大数据运用此方法去创建虚拟节点 只需要添加一次
function addSchoolNameListener() {
$('#registerPanel').on('input propertychange', '.schoolName', function() {
var name = $(this).val()
var schoolData = []
for (var i = 0, len = curSchoolList.length; i < len; i++) {
if (curSchoolList[i].itemValue.includes(name)) {
schoolData.push(curSchoolList[i])
}
}
var ul = document.getElementById('schoolList');
$('#schoolList').html('')
// 创建虚拟节点
var fragment = document.createDocumentFragment();
for (var i = 0, len = schoolData.length; i < len; i++) {
var li = document.createElement("option");
li.innerText = schoolData[i].itemValue;
fragment.appendChild(li);
}
ul.appendChild(fragment);
});

 
posted @ 2021-11-04 15:53  风雪中de冲破  阅读(157)  评论(0编辑  收藏  举报