kpi-web/scripts/ledger.js

983 lines
30 KiB
JavaScript
Raw Normal View History

2026-04-03 16:14:45 +08:00
var ledgercomponent = {
template:`
<div>
<div id="" style="display: flex">
<el-input v-model="p_name_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_ledger()">搜索</el-button>
<el-button v-if='role_id!=3' plain type="primary" icon="el-icon-circle-plus-outline" @click="add()">新增(无附件)</el-button>
<el-button v-if='role_id!=3' plain type="primary" icon="el-icon-circle-plus-outline" @click="add1()">新增(有附件)</el-button>
<el-button v-if='role_id!=3' id ="bt_del" plain type="primary" icon="el-icon-circle-plus-outline" @click="del_ledger()">删除</el-button>
</div>
<div class="span">
<el-table
:data="tableData"
style="width: 100%"
:height="tHeight"
:cell-style="{background:'#fff'}"
border
@selection-change="handleSelectionChange"
@cell-dblclick="celldblclick_1"
>
<el-table-column
type="selection"
>
</el-table-column>
<el-table-column
prop="id"
label="序号"
width="80"
:show-overflow-tooltip="true">
</el-table-column>
<el-table-column
prop="inspection_node"
label="检验节点"
width="100"
:show-overflow-tooltip="true">
</el-table-column>
<el-table-column
prop="time"
label="日期"
width="80"
:show-overflow-tooltip="true">
</el-table-column>
<el-table-column
prop="p_name_cn"
label="产品型号及名称"
width="160"
:show-overflow-tooltip="true">
</el-table-column>
<el-table-column
prop="serial"
label="序列号"
width="80"
:show-overflow-tooltip="true">
</el-table-column>
<el-table-column
prop="id"
label="检验报告"
width="120"
:show-overflow-tooltip="true">
<template slot-scope="scope">
<el-button @click="down_file_cn(scope.row)" type="text" size="medium" >中文</el-button>
<el-button @click="down_file_en(scope.row)" type="text" size="medium" >英文</el-button>
</template>
</el-table-column>
<el-table-column
prop="fin_result"
label="是否合格"
width="100"
:show-overflow-tooltip="true">
</el-table-column>
<el-table-column
prop="non_conformity_treatment"
label="不合格处理方式"
width="140"
:show-overflow-tooltip="true">
</el-table-column>
<el-table-column
prop="Inspector"
label="检验员"
width="100"
:show-overflow-tooltip="true">
</el-table-column>
<el-table-column
prop="Auditor"
label="审核人"
width="100"
: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="90%">
<div style="display: inline-block;width: 100%;">
<span >产品型号及名称</span>
<el-select style="width: 30%;" v-model="g_p_name" clearable filterable placeholder="请选择产品" :disabled="disabled" @change="selectChanged">
<el-option
v-for="item in p_name_options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<span style="margin-left: 20px;">检验依据</span>
<el-input
placeholder="请输入内容" style="width: 30%;"
v-model="template_data.p_ibase_cn"
:disabled="true">
</el-input>
</div>
<div style="margin-top: 15px;">
<span >&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp检验时间</span>
<el-input
placeholder="请输入内容" style="width: 30%;"
v-model="template_data.time"
:disabled="true">
</el-input>
<span style="margin-left: 20px;">检验节点</span>
<el-select clearable v-model="template_data.inspection_node" style="width: 30%;">
<el-option-group
key="1"
label="">
<el-option label="入库" value="入库"></el-option>
<el-option label="出库" value="出库"></el-option>
<el-option label="退库" value="退库"></el-option>
</el-option-group>
</el-select>
</div>
<div style="margin-top: 15px;">
<span >&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp检验员</span>
<el-input
placeholder="请输入内容" style="width: 30%;"
v-model="template_data.Inspector"
:disabled="true">
</el-input>
<span style="margin-left: 20px;">&nbsp&nbsp&nbsp&nbsp审核员</span>
<el-input
placeholder="请输入内容" style="width: 30%;"
v-model="template_data.Auditor"
:disabled="true">
</el-input>
</div>
<div style="margin-top: 15px;">
<span >&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp序列号</span>
<el-input
placeholder="格式11,12,13,14" style="width: 30%;"
v-model="template_data.serial_sets"
:disabled="false">
</el-input>
</div>
<el-tag style="width: 100%;margin-top: 20px;font-size: 16px;">检验内容</el-tag>
<div style="display: flex;margin-top: 15px;">
<span style="width: 15%;margin-right: 10px;">&nbsp&nbsp&nbsp检验项目</span>
<span style="width: 20%;margin-right: 10px;">检验要求</span>
<span style="width: 10%;margin-right: 10px;">检验方法</span>
<span style="width: 15%;margin-right: 10px;">结果</span>
<span style="width: 15%;margin-right: 10px;">不合格序列号</span>
<!--<span style="width: 10%;margin-right: 10px;">附件</span>-->
</div>
<div v-for="item in template_data.inspection_data">
<div style="display: flex;margin-top: 10px;">
<span style="width: 15%;margin-right: 10px;vertical-align: middle;line-height: 40px;">&nbsp&nbsp&nbsp{{item.inspection_items_cn}}</span>
<span style="width: 20%;margin-right: 10px;vertical-align: middle;line-height: 40px;">{{item.inspection_rs_cn}}</span>
<span style="width: 10%;margin-right: 10px;vertical-align: middle;line-height: 40px;">{{item.inspection_scheme_cn}}</span>
<el-input
v-if='item.inspection_type=="值"'
placeholder="格式11,12,13,14" style="width: 15%;margin-right: 10px;"
v-model="item.result"
:disabled="false">
<!--<el-button slot="append" icon="el-icon-close" style="background-color: #409EFF;color: #FFFFFF;margin-right: 1px;"></el-button>
<el-button slot="append" icon="el-icon-plus" style="background-color: #409EFF;color: #FFFFFF;margin-left: 0px;"></el-button>
-->
</el-input>
<el-input
v-if='item.inspection_type=="文本"'
placeholder="格式11,12,13,14" style="width: 15%;margin-right: 10px;height: 40px;"
v-model="item.result"
:disabled="true">
<el-button slot="append" icon="el-icon-plus" style="height: 40px;" @click="show_result(template_data.serial_sets,item)"></el-button>
</el-input>
<el-input
placeholder="格式11,12,13,14" style="width: 15%;margin-right: 10px;"
v-model="item.serial_sets"
:disabled="false">
<!--<el-button slot="append" icon="el-icon-close" style="background-color: #409EFF;color: #FFFFFF;margin-right: 1px;"></el-button>
<el-button slot="append" icon="el-icon-plus" style="background-color: #409EFF;color: #FFFFFF;margin-left: 0px;"></el-button>
-->
</el-input>
<!--
<el-input
placeholder="" style="width: 10%;margin-right: 10px;"
v-model="item.attach_file"
:disabled="true">
</el-input>
<el-button @click="show_dis(scope.row)" type="text" size="medium" >上传附件</el-button>
-->
</div>
</div>
<div style="margin-top: 20px;margin-left: 10px;">
<span >最终结果</span>
<el-select clearable v-model="template_data.fin_result" style="width: 15%;">
<el-option-group
key="1"
label="">
<el-option label="合格" value="合格"></el-option>
<el-option label="不合格" value="不合格"></el-option>
</el-option-group>
</el-select>
<span style="margin-left: 20px;">不合格处理方式</span>
<el-select clearable v-model="template_data.non_conformity_treatment" style="width: 15%;">
<el-option-group
key="1"
label="">
<el-option label="退货或换货" value="退货或换货"></el-option>
<el-option label="返工返修" value="返工返修"></el-option>
<el-option label="报废" value="报废"></el-option>
<el-option label="其他" value="其他"></el-option>
</el-option-group>
</el-select>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button id ="bt_ok" plain type="primary" @click="post_report_multi_template()"> </el-button>
</span>
</el-dialog>
<el-drawer
title="结果设置"
:visible.sync="drawer_result"
:direction="direction"
:before-close="handleClose"
size="35%"
>
<div v-for="item in ins_result">
<div style="display: flex;margin-top: 10px;">
<span style="margin-left: 20px;vertical-align: middle;line-height: 40px;">序列号{{item.id}}</span>
<span style="margin-left: 20px;vertical-align: middle;line-height: 40px;">结果</span>
<el-select v-model="item.result" clearable filterable placeholder="请选择"
>
<el-option
v-for="it in item.result_contain"
:key="it.result_cn"
:label="it.result_cn"
:value="it.result_cn">
</el-option>
</el-select>
</div>
</div>
<el-button type="primary" plain style="margin-top: 20px;margin-left: 20px;" @click="save_ins_result">保存</el-button>
</el-drawer>
<el-dialog
title="检验报告录入"
:visible.sync="dialogVisible1"
:lock-scroll ="false"
width="90%">
<div style="display: inline-block;width: 100%;">
<span >产品型号及名称</span>
<el-select style="width: 30%;" v-model="g_p_name" clearable filterable placeholder="请选择产品"
:disabled='role_id==3' @change="selectChanged">
<el-option
v-for="item in p_name_options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<span style="margin-left: 20px;">检验依据</span>
<el-input
placeholder="请输入内容" style="width: 30%;"
v-model="template_data.p_ibase_cn"
:disabled="true">
</el-input>
</div>
<div style="margin-top: 15px;">
<span >&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp检验时间</span>
<el-input
placeholder="请输入内容" style="width: 30%;"
v-model="template_data.time"
:disabled="true">
</el-input>
<span style="margin-left: 20px;">检验节点</span>
<el-select clearable v-model="template_data.inspection_node" style="width: 30%;">
<el-option-group
key="1"
label="">
<el-option label="入库" value="入库"></el-option>
<el-option label="出库" value="出库"></el-option>
<el-option label="退库" value="退库"></el-option>
</el-option-group>
</el-select>
</div>
<div style="margin-top: 15px;">
<span >&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp检验员</span>
<el-input
placeholder="请输入内容" style="width: 30%;"
v-model="template_data.Inspector"
:disabled="true">
</el-input>
<span style="margin-left: 20px;">&nbsp&nbsp&nbsp&nbsp审核员</span>
<el-input
placeholder="请输入内容" style="width: 30%;"
v-model="template_data.Auditor"
:disabled="true">
</el-input>
</div>
<div style="margin-top: 15px;">
<span >&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp序列号</span>
<el-input
placeholder="序列号" style="width: 30%;"
v-model="template_data.serial_sets"
:disabled="false">
</el-input>
</div>
<el-tag style="width: 100%;margin-top: 20px;font-size: 16px;">检验内容</el-tag>
<div style="display: flex;margin-top: 15px;">
<span style="width: 15%;margin-right: 10px;">&nbsp&nbsp&nbsp检验项目</span>
<span style="width: 20%;margin-right: 10px;">检验要求</span>
<span style="width: 10%;margin-right: 10px;">检验方法</span>
<span style="width: 15%;margin-right: 10px;">结果</span>
<span style="width: 15%;margin-right: 10px;">判定</span>
<span style="width: 10%;margin-right: 10px;">附件</span>
</div>
<div v-for="item in template_data.inspection_data">
<div style="display: flex;margin-top: 10px;">
<span style="width: 15%;margin-right: 10px;vertical-align: middle;line-height: 40px;">&nbsp&nbsp&nbsp{{item.inspection_items_cn}}</span>
<span style="width: 20%;margin-right: 10px;vertical-align: middle;line-height: 40px;">{{item.inspection_rs_cn}}</span>
<span style="width: 10%;margin-right: 10px;vertical-align: middle;line-height: 40px;">{{item.inspection_scheme_cn}}</span>
<el-input
v-if='item.inspection_type=="值"'
placeholder="" style="width: 15%;margin-right: 10px;"
v-model="item.result"
:disabled="false">
<!--<el-button slot="append" icon="el-icon-close" style="background-color: #409EFF;color: #FFFFFF;margin-right: 1px;"></el-button>
<el-button slot="append" icon="el-icon-plus" style="background-color: #409EFF;color: #FFFFFF;margin-left: 0px;"></el-button>
-->
</el-input>
<el-select style="width: 15%;margin-right: 10px;" v-model="item.result" clearable filterable placeholder="请选择"
v-if='item.inspection_type=="文本"'>
<el-option
v-for="it in item.result_contain"
:key="it.result_cn"
:label="it.result_cn"
:value="it.result_cn">
</el-option>
</el-select>
<el-select clearable v-model="item.if_ok" style="width: 15%;">
<el-option-group
key="1"
label="">
<el-option label="√" value="√"></el-option>
<el-option label="×" value="×"></el-option>
</el-option-group>
</el-select>
<el-input
placeholder="" style="width: 10%;margin-right: 10px;"
v-model="item.attach_file"
:disabled="true">
</el-input>
<el-upload
class="upload-demo"
ref="upload"
action="/pkpi/upload_report_file"
:on-change="handleChange_file"
:file-list="fileList"
:show-file-list="false"
:on-success="upload_file_success"
:on-error="upload_file_error"
:data="upload_param(item)"
:before-upload="beforeAvatarUpload">
<el-button slot="trigger" size="medium" type="success" >上传附件</el-button>
</el-upload>
</div>
</div>
<div style="margin-top: 20px;margin-left: 10px;">
<span >最终结果</span>
<el-select clearable v-model="template_data.fin_result" style="width: 15%;">
<el-option-group
key="1"
label="">
<el-option label="合格" value="合格"></el-option>
<el-option label="不合格" value="不合格"></el-option>
</el-option-group>
</el-select>
<span style="margin-left: 20px;">不合格处理方式</span>
<el-select clearable v-model="template_data.non_conformity_treatment" style="width: 15%;">
<el-option-group
key="1"
label="">
<el-option label="退货或换货" value="退货或换货"></el-option>
<el-option label="返工返修" value="返工返修"></el-option>
<el-option label="报废" value="报废"></el-option>
<el-option label="其他" value="其他"></el-option>
</el-option-group>
</el-select>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible1 = false"> </el-button>
<el-button v-if="show_ok" id ="bt_ok" plain type="primary" @click="post_report_multi_template_s()"> </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,
p_name_v:'',
g_p_name:'',
dialogVisible:false,
multipleSelection: [],
importdialogVisible:false,
fileListUpload:[],
importTableData:[],
disabled:false,
if_show_process:false,
percent_len:0,
interval:'',
if_show_process1:false,
fileList:[],
rules: {
p_name_cn: [
{ required: true, message: '产品型号及名称(中)不可为空', trigger: 'blur' }
],
p_name_en: [
{ required: true, message: '产品型号及名称(英)不可为空', trigger: 'blur' }
],
p_ibase_cn: [
{ required: true, message: '检验依据(中)不可为空', trigger: 'blur' }
],
p_ibase_en: [
{ required: true, message: '检验依据(英)不可为空', trigger: 'blur' }
],
},
p_name_options:[],
template_data:{},
dialogVisible1:false,
show_ok:true,
role_id:0,
drawer:false,
direction: 'rtl',
drawer_result:false,
ins_result:[],
}
},
mounted() {
this.$data.role_id = localStorage.getItem("level");
this.get_ledger();
},
methods: {
save_ins_result(){
if(this.$data.ins_result.length>0){
console.log(this.$data.ins_result);
var result =""
for(var i=0;i<this.$data.ins_result.length;++i){
if(i==0){
result=this.$data.ins_result[i].result
console.log("0",result);
}else{
result += ","+this.$data.ins_result[i].result
}
}
console.log("结果:",result);
for(var i =0; i<this.$data.template_data.inspection_data.length;++i){
if (this.$data.ins_result[0].inspection_items_cn==this.$data.template_data.inspection_data[i].inspection_items_cn &&
this.$data.ins_result[0].inspection_rs_cn==this.$data.template_data.inspection_data[i].inspection_rs_cn){
this.$data.template_data.inspection_data[i].result = result;
}
}
this.$data.drawer_result=false;
}
},
handleClose(done) {
done();
},
show_result(ids,item){
if(ids ==""){
return;
}
this.$data.ins_result=[];
this.$data.ids=ids.split(",");
console.log("序列号",this.$data.ids);
if(item.result==""){
for(var i=0;i<this.$data.ids.length;++i){
let obj = {};
obj.inspection_items_cn=item.inspection_items_cn;
obj.inspection_rs_cn=item.inspection_rs_cn;
obj.result=item.result;
obj.result_contain=item.result_contain;
obj.id=this.$data.ids[i];
this.$data.ins_result.push(obj);
}
}else{
let result = item.result.split(",")
for(var i=0;i<this.$data.ids.length;++i){
let obj = {};
obj.inspection_items_cn=item.inspection_items_cn;
obj.inspection_rs_cn=item.inspection_rs_cn;
obj.result=result[i];
obj.result_contain=item.result_contain;
obj.id=this.$data.ids[i];
this.$data.ins_result.push(obj);
}
}
console.log(this.$data.ins_result)
if(this.$data.ids.length>0){
this.$data.drawer_result=true;
}
},
beforeAvatarUpload(file) {
var isJPG =false
console.log(file.type);
if(file.type === 'image/jpeg' ||file.type === 'image/png'||file.type === 'image/jpg'||file.type=="text/plain"){
isJPG=true
}
if (!isJPG) {
this.$message.error('上传头像图片只能是 JPG/JPEG/PNG/TXT 格式!');
}
return isJPG;
},
celldblclick_1(row, column, cell, event){
this.show_report_dialog(row);
},
show_report_dialog(row){
if(this.$data.role_id =="3"){
this.$data.show_ok=true;
}else{
this.$data.show_ok=false;
}
this.$data.template_data=JSON.parse(row.data);
this.$data.g_p_name=this.$data.template_data.p_name_cn
if(this.$data.role_id =="3"){
this.$data.template_data.Auditor=localStorage.getItem("online_user");
}
this.get_p_names();
this.$data.dialogVisible1=true;
},
upload_param(item){
/*console.log("file:",this.fileList)
if (this.fileList.length>0){
item.attach_file= this.fileList[0].name;
this.fileList=[];
console.log(item);
}*/
console.log("---",item);
return {
inspection_items_cn: item.inspection_items_cn,
inspection_rs_cn: item.inspection_rs_cn,
}
},
upload_file_error(response, file, fileList){
console.log(response)
this.$message({
message: "上传失败",
type: "error",
duration: 1500
});
},
upload_file_success(response, file, fileList){
console.log(response);
for(var i=0;i<this.template_data.inspection_data.length;++i){
if(this.template_data.inspection_data[i].inspection_items_cn==response.inspection_items_cn &&
this.template_data.inspection_data[i].inspection_rs_cn == response.inspection_rs_cn){
this.template_data.inspection_data[i].attach_file=response.file;
}
}
console.log(file.name);
this.$message({
message: "上传成功",
type: "success",
duration: 1500
});
},
handleChange_file(file, fileList) {
console.log(file);
this.fileList = [];
this.fileList.push(file);
console.log(this.fileList);
},
down_file_cn(row){
if(row.Auditor ==""){
this.$message({
showClose: true,
message: '审核员为空,不可下载!',
type: 'warning'
});
return;
}
var downUrl = '/pkpi/download_report_file'+"?id="+row.file;
downloadUrl(row.file,downUrl);
},
down_file_en(row){
if(row.Auditor ==""){
this.$message({
showClose: true,
message: '审核员为空,不可下载!',
type: 'warning'
});
return;
}
var downUrl = '/pkpi/download_report_file'+"?id="+row.file_en;
downloadUrl(row.file_en,downUrl);
},
post_report_multi_template_s(){
var _this = this;
var objs;
axios.post('/pkpi/post_report_s', {
opuser:localStorage.getItem("online_user"),
opuser_uuid:localStorage.getItem("uuid"),
data:_this.$data.template_data,
})
.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.$data.dialogVisible1=false;
_this.get_ledger();//更新页面
setTimeout(_this.get_ledger,3000);
}
})
.catch(function (error) {
console.log(error);
});
},
post_report_multi_template(){
//document.getElementById("bt_search").blur();
var _this = this;
var objs;
axios.post('/pkpi/post_report', {
opuser:localStorage.getItem("online_user"),
opuser_uuid:localStorage.getItem("uuid"),
data:_this.$data.template_data,
})
.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.$data.dialogVisible=false;
_this.get_ledger();//更新页面
setTimeout(_this.get_ledger,3000);
}
})
.catch(function (error) {
console.log(error);
});
},
handleChange(file, fileList) {
document.getElementById("bt_upload").blur();
this.fileTemp = file.raw
console.log("filetype:",this.fileTemp);
if (this.fileTemp) {
console.log("begin ...")
console.log(this.fileTemp.type);
if ((this.fileTemp.type == 'text/csv') || (this.fileTemp.type == '.csv') || (this.fileTemp.type == 'application/vnd.ms-excel')) {
let _this = this//如果需要点击事件结束之后对DOM进行操作使用)_this.xx=xx进行操作
Papa.parse(_this.fileTemp, {
encoding:'gb2312',
complete (results) {
console.log(results)//这个是csv文件的数据
let data = []
//遍历csv文件中的数据存放到data中 方法不唯一,可自己更改
for (let i = 0; i < results.data.length; ++i) {
if(i==0){
continue;
}
let obj = {}
obj.inspection_items_cn = results.data[i][0]
if(obj.inspection_items_cn==""|| obj.inspection_items_cn==undefined){
continue;
}
obj.inspection_items_en = results.data[i][1]
obj.inspection_rs_cn = results.data[i][2]
if(obj.inspection_rs_cn==""|| obj.inspection_rs_cn==undefined){
continue;
}
obj.inspection_rs_en = results.data[i][3]
data.push(obj)
}
//data.splice(0, 1)//将数组第一位的表格名称去除
console.log('data', data)
_this.$data.importTableData=data;
}
})
} else {
this.$data.fileListUpload=[];
this.$message({
type: 'warning',
message: '附件格式错误,请删除后重新上传!'
})
}
} else {
this.$message({
type: 'warning',
message: '请上传附件!'
})
}
},
get_p_names(){
var _this = this;
axios.post('/pkpi/get_p_name_options',{
opuser:localStorage.getItem("online_user"),
opuser_uuid:localStorage.getItem("uuid"),
})
.then(function (response) {
_this.$data.p_name_options=[];
console.log(response.data);
objs = response.data.data;
for(var i=0;i<objs.length;++i){
var obj ={
value:objs[i],
label:objs[i],
}
_this.$data.p_name_options.push(obj);
}
})
.catch(function (error) {
console.log(error);
});
},
get_template_data(){
var _this = this;
axios.post('/pkpi/get_report_multi_template',{
opuser:localStorage.getItem("online_user"),
opuser_uuid:localStorage.getItem("uuid"),
p_name :_this.$data.g_p_name,
})
.then(function (response) {
_this.$data.template_data={};
console.log(response.data);
_this.$data.template_data = response.data;
})
.catch(function (error) {
console.log(error);
});
},
input_change(value) {
console.log(value);
this.get_ledger();
},
selectChanged(value) {
console.log(value)
this.get_template_data();
this.$data.template_data.Inspector = localStorage.getItem("online_user");
console.log(this.$data.template_data.Inspector)
},
add(){
this.$data.template_data = {};
this.$data.g_p_name='';
this.get_p_names();
this.$data.dialogVisible=true;
},
add1(){
this.$data.show_ok=true;
this.$data.template_data = {};
this.$data.g_p_name='';
this.$data.fileList=[];
this.get_p_names();
this.$data.dialogVisible1=true;
},
handleSelectionChange(val) {
console.log("已选择");
console.log(val);
this.multipleSelection = val;
},
del_ledger(){
var _this = this;
axios.post('/pkpi/del_ledger', {
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_ledger();//更新页面
}
})
.catch(function (error) {
console.log(error);
});
},
get_ledger(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_ledger', {
opuser:localStorage.getItem("online_user"),
opuser_uuid:localStorage.getItem("uuid"),
p_name: _this.$data.p_name_v,
index: this.$data.currentPage,
count: this.$data.pagesize,
node:"入库",
})
.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_ledger();
},
handleCurrentChange(val) {
this.$data.currentPage = val;
this.get_ledger();
}
}
}