watch: {
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())
},
时间组件为空的一些判断
<el-date-picker v-model="cond.leaveDateReal"
value-format="yyyy-MM-dd" format="yyyy-MM-dd"
type="date" @change="changeDateTime"
placeholder="请选择实际离职日期">
</el-date-picker>
changeDateTime(value){
if (value == null) value = ''
},
this.cond.leaveDate == '1970-01-01'||this.cond.leaveDate== 'NaN-NaN-NaN'||this.cond.leaveDate== 'NaNNaNNaN'||!this.cond.leaveDate||this.cond.leaveDate==NaN||this.cond.leaveDate==null
this.$forceUpdate()
新增 清空校验
this.$nextTick(()=>{
// this.$refs[form].clearValidate();
this.$refs.form.resetFields();//等弹窗里的form表单的dom渲染完在执行this.$refs.staffForm.resetFields(),去除验证
});
修改时 清空校验显示数据
this.$nextTick(()=>{
// this.$refs[form].clearValidate();
this.$refs.form.resetFields();//等弹窗里的form表单的dom渲染完在执行this.$refs.staffForm.resetFields(),去除验证
});
this.$nextTick(()=>{
this.$refs.ruleForm.resetFields();
});
this.$nextTick(function(){
this.dialogVisible = true
this.Id = true
this.ruleForm.ID = r.tenantId
this.ruleForm.name = r.tenantName
this.ruleForm.imageUrl = r.logoUrl
let time1 = this.time(r.effectStartTime)
let time2 = null
if(r.effectEndTime){
time2 = this.time(r.effectEndTime)
}else{
time2 = ''
}
this.ruleForm.date1 = time1
this.ruleForm.date2 = time2
})
this.a this.a.b this.a.b='aaa'
this.$set(this.groupsTenan,?'group'+item,?res.data.data.list)
//日期的简单封装 兼容安卓端 苹果端
示例:2020-12-15 12:05:56
动态循环的图片
//css默认
清除浮动
.cf:before, .cf:after {
content:"";
display:table;
}
.cf:after {
clear:both;
}
.cf {
zoom:1;
}
submit () {
let loading = this.$loading()
let div = document.getElementById('form')
let f = div.getElementsByTagName('form')[0]
let inputs = f.getElementsByTagName('input')
let action = f.action + `?mtId=${this.id}`
for (let i of inputs) {
action += `&${i.name}=${i.value}`
}
axios.post(action).then(() => {
this.$message({type: 'success', message: '操作成功'})
this.val = false
}, this.err).finally(() => loading.close())
},
//监听input不是数字 自动清除最后一位
$('#oneInput').on('keyup',function(){
var limitNum = $(this).val().replace(/[^d]/g, "")
limitNum = limitNum.replace(/[`~!@#$%^&*()_-+=<>?:"{}|,./;'\[]·~!@#¥%……&*()——-+={}|《》?:“”【】、;‘’,。、,.]/im, "");
if(limitNum ==0){
limitNum = ''
}
$('#oneInput').val(limitNum)
})
//滚动
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
console.log(height)
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);
});