var immcomponent = {
template:`
`,
data(){
// 获取当前屏幕的分辨率
let screenW = window.screen.width;
let screenH = window.screen.height;
console.log("screen width:",screenW);
console.log("screen height:",screenH);
return {
tHeight:screenH*0.7,
tableData: [],
currentPage: 1,
pagesize:50,
recordTotal:0,
f_v:'',
dialogVisible:false,
oper_type:0,
multipleSelection: [],
importdialogVisible:false,
fileListUpload:[],
importTableData:[],
disabled:true,
if_show_process:false,
percent_len:0,
interval:'',
if_show_process1:false,
fileList:[],
form:{
id:0,
imn_cn:'',
imn_en:'',
},
rules: {
imn_cn: [
{ required: true, message: '检验方法名称(中)不可为空', trigger: 'blur' }
],
imn_en: [
{ required: true, message: '检验方法名称(英)不可为空', trigger: 'blur' }
],
},
}
},
mounted() {
this.get_imn();
},
methods: {
input_change(value) {
console.log(value);
this.get_imn();
},
postimn(){
this.$refs['userform'].validate((valid) => {
if(valid){
this.$data.dialogVisible = false;
var _this = this;
console.log(_this.$data.form);
var objs;
axios.post('/pkpi/postimn', {
opuser:localStorage.getItem("online_user"),
opuser_uuid:localStorage.getItem("uuid"),
data:_this.$data.form,
})
.then(function (response) {
let r = response.data.r;
let s = ""
let errType = ""
if (r == 0) {
errType = "success"
} else{
errType = "error"
}
if (r ==0) {
s = "新增成功!";
} else{
s = "新增失败!";
}
_this.$message({
message: s,
type: errType,
duration: 1500
});
//更新页面
_this.get_imn();
})
.catch(function (error) {
console.log(error);
});
}
});
},
add(){
this.$data.form.imn_cn='';
this.$data.form.imn_en='';
this.$data.form.id=0;
this.$data.dialogVisible=true;
},
handleSelectionChange(val) {
console.log("已选择");
console.log(val);
this.multipleSelection = val;
},
del_imn(){
var _this = this;
axios.post('/pkpi/del_imn', {
opuser:localStorage.getItem("online_user"),
opuser_uuid:localStorage.getItem("uuid"),
ids: _this.$data.multipleSelection,
})
.then(function (response) {
let r = response.data.r;
let s = ""
let errType = ""
if (r == 0) {
s = "删除成功!";
errType = "success"
} else{
s = "删除失败!";
errType = "error"
}
_this.$message({
message: s,
type: errType,
duration: 1500
});
if (r ==0) {
_this.get_imn();//更新页面
}
})
.catch(function (error) {
console.log(error);
});
},
get_imn(cur_page){
document.getElementById("bt_search").blur();
if (cur_page==undefined){
this.$data.currentPage=1;
} else {
this.$data.currentPage=cur_page;
}
var _this = this;
var objs;
axios.post('/pkpi/get_imn', {
opuser:localStorage.getItem("online_user"),
opuser_uuid:localStorage.getItem("uuid"),
f_name: _this.$data.f_v,
index: this.$data.currentPage,
count: this.$data.pagesize
})
.then(function (response) {
console.log(response.data);
objs = response.data.data;
rcnt = response.data.total;
_this.$data.tableData = objs;
_this.$data.recordTotal = rcnt;
})
.catch(function (error) {
console.log(error);
});
},
handleSizeChange(val) {
this.$data.pagesize = val;
this.get_imn();
},
handleCurrentChange(val) {
this.$data.currentPage = val;
this.get_imn();
}
}
}