269 lines
6.1 KiB
JavaScript
269 lines
6.1 KiB
JavaScript
|
|
var immcomponent = {
|
||
|
|
template:`
|
||
|
|
<div>
|
||
|
|
<div id="" style="display: flex">
|
||
|
|
<el-input v-model="f_v" placeholder="检验方法名称" clearable style="width: 160px;" @change="input_change"></el-input>
|
||
|
|
<el-button id ="bt_search" plain type="primary" icon="el-icon-search" @click="get_pf()">搜索</el-button>
|
||
|
|
<el-button plain type="primary" icon="el-icon-circle-plus-outline" @click="add()">新增</el-button>
|
||
|
|
<el-button id ="bt_del" plain type="primary" icon="el-icon-circle-plus-outline" @click="del_imn()">删除</el-button>
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<el-progress v-if="if_show_process" :percentage="percent_len" ></el-progress>
|
||
|
|
</div>
|
||
|
|
<div class="span">
|
||
|
|
<el-table
|
||
|
|
:data="tableData"
|
||
|
|
style="width: 100%"
|
||
|
|
:height="tHeight"
|
||
|
|
:cell-style="{background:'#fff'}"
|
||
|
|
border
|
||
|
|
@selection-change="handleSelectionChange"
|
||
|
|
>
|
||
|
|
<el-table-column
|
||
|
|
type="selection"
|
||
|
|
>
|
||
|
|
</el-table-column>
|
||
|
|
<el-table-column
|
||
|
|
prop="imn_cn"
|
||
|
|
label="检验方法名称(中)"
|
||
|
|
width="160"
|
||
|
|
:show-overflow-tooltip="true">
|
||
|
|
</el-table-column>
|
||
|
|
<el-table-column
|
||
|
|
prop="imn_en"
|
||
|
|
label="检验方法名称(英)"
|
||
|
|
width="160"
|
||
|
|
:show-overflow-tooltip="true">
|
||
|
|
</el-table-column>
|
||
|
|
</el-table>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="block">
|
||
|
|
<span class="demonstration"></span>
|
||
|
|
<el-pagination
|
||
|
|
@size-change="handleSizeChange"
|
||
|
|
@current-change="handleCurrentChange"
|
||
|
|
:current-page="currentPage"
|
||
|
|
:page-sizes="[50,100, 200, 300]"
|
||
|
|
:page-size="pagesize"
|
||
|
|
layout="total, sizes, prev, pager, next, jumper"
|
||
|
|
:total="recordTotal">
|
||
|
|
</el-pagination>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<el-dialog
|
||
|
|
title="检验方法"
|
||
|
|
:visible.sync="dialogVisible"
|
||
|
|
:lock-scroll ="false"
|
||
|
|
width="40%">
|
||
|
|
<el-form ref="userform" :model="form" label-width="140px" :rules="rules">
|
||
|
|
<el-form-item label="检验方法名称(中)" prop="imn_cn">
|
||
|
|
<el-input v-model="form.imn_cn"></el-input>
|
||
|
|
</el-form-item>
|
||
|
|
<el-form-item label="检验方法名称(英)" prop="imn_en">
|
||
|
|
<el-input v-model="form.imn_en" ></el-input>
|
||
|
|
</el-form-item>
|
||
|
|
</el-form>
|
||
|
|
<span slot="footer" class="dialog-footer">
|
||
|
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||
|
|
<el-button id ="bt_ok" plain type="primary" @click="postimn()">确 定</el-button>
|
||
|
|
</span>
|
||
|
|
</el-dialog>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
`,
|
||
|
|
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();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|