feat: 0520 优化

演示数据2.0
chenhc 11 months ago
parent 21154d9d74
commit fc6c10fac0

@ -33,6 +33,15 @@ export function printOrder(data) {
data: data
});
}
export function printDev(data) {
return axios({
url: "/udiwms/inout/resultDetail/filterDevPrint",
method: "post",
headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
responseType: 'arraybuffer', //一定要设置响应类型否则页面会是空白pdf
data: data
});
}
export function excelInoutImport(params) {

@ -46,11 +46,16 @@
<el-button type="primary" icon="el-icon-search" @click="search"
>查询
</el-button>
<!-- <el-button type="primary" icon="el-icon-document" @click="selectExport">Excel</el-button>-->
<!-- <el-button type="primary" icon="el-icon-document" @click="searchExport">Excel</el-button>-->
<el-button type="primary" icon="el-icon-printer" @click="optinPrint"></el-button>
<el-button type="primary" icon="el-icon-printer" @click="selectPrint"></el-button>
</el-button-group>
</div>
<el-divider style="margin: 15px"></el-divider>
<el-table :data="list" @current-change="rowClickDetail" v-loading="loading" click-row-light>
<el-table :data="list" @current-change="rowClickDetail" v-loading="loading" click-row-light @selection-change="handleCheckedChange">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="序号" width="50" type="index"/>
<el-table-column label="科室" width="150" prop="deptName"/>
<el-table-column label="设备编码" width="150" prop="deviceCode"/>

@ -3,6 +3,12 @@ import {deviceChangeStatus, deviceChangeType, deviceStatus} from "@/utils/enum";
import {downloadBase64Image} from "@/utils";
import deptDeviceDetail from "@/views/dev/DeptDeviceDetail.vue";
import {updateOrderItem } from "@/api/dev/deviceInfoApi";//保存到info
import {
verifyTemplateFile,
printDev,
excelInoutImport, postExcelInoutImport
} from '@/api/inout/orderDetailResult'
let query = {
page: 1,
limit: 10,
@ -44,6 +50,7 @@ export default {
loading: false,
total: .0,
list: [],
orderSelection: [],
query: {...query},
//设备详情=============================================
detailLoading: false,
@ -156,7 +163,171 @@ export default {
}).catch(e => {
this.loading = false
})
}
},
handleCheckedChange(val) {
this.orderSelection = val;
},
optinPrint() {
this.$confirm("是否确定打印选中出入库明细, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
if (this.orderSelection == null || this.orderSelection.length <= 0) {
return this.$message.error("请选择打印的明细!");
}
let query = {id: 6};
verifyTemplateFile(query).then((res) => {
if (res.code === 20000) {
let printParams = {
deptCode :this.query.deptCode,
deviceCode: this.query.deviceCode,
productName: this.query.productName,
status: this.query.status,
templateId: res.data,
list: this.orderSelection
};
printDev(printParams).then((response) => {
//将pdf文件转换为url。
const binaryData = [];
binaryData.push(response);
//获取blob链接。
let url = window.URL.createObjectURL(
new Blob(binaryData, {type: "application/pdf"})
);
this.loading = false;
window.open(url);//打开新标签页预览pdf。
})
} else {
return this.$message.error(res.message);
}
}).catch((error) => {
this.loading = false;
this.$message.error(error.message);
})
})
.catch(() => {
});
},
selectPrint() {
this.$confirm("是否确定打印所有查询结果数据", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
let query = {id: 6};
verifyTemplateFile(query).then((res) => {
if (res.code === 20000) {
let printParams = {
templateId: res.data,
deptCode :this.query.deptCode,
deviceCode: this.query.deviceCode,
productName: this.query.productName,
status: this.query.status,
};
printDev(printParams).then((response) => {
//将pdf文件转换为url。
const binaryData = [];
binaryData.push(response);
//获取blob链接。
let url = window.URL.createObjectURL(
new Blob(binaryData, {type: "application/pdf"})
);
this.loading = false;
window.open(url);//打开新标签页预览pdf。
})
} else {
this.$message.error(res.message);
return
}
}).catch((error) => {
this.loading = false;
this.$message.error(error.message);
})
})
.catch(() => {
});
return;
},
selectExport() {
this.$confirm("是否确定导出选中出入库明细, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
if (this.orderSelection == null || this.orderSelection.length <= 0) {
return this.$message.error("请选择需要导出的明细!");
}
let printParams = {
list: this.orderSelection
};
postExcelInoutImport(printParams).then((response) => {
let blob = new Blob([response], {type: "application/vnd.ms-excel"});
let url = window.URL.createObjectURL(blob); // 创建一个临时的url指向blob对象
let a = document.createElement("a");
a.href = url;
a.click();
this.$message("成功")
})
});
},
searchExport() {
this.$confirm("是否确定导出所有查询结果数据", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
let printParams = {
orderIdFk: this.filterQuery.orderIdFk,
nameCode: this.filterQuery.nameCode,
coName: this.filterQuery.coName,
spec: this.filterQuery.spec,
batchNo: this.filterQuery.batchNo,
zczbhhzbapzbh: this.filterQuery.zczbhhzbapzbh,
manufacturer: this.filterQuery.manufacturer,
actionType: this.filterQuery.actionType,
keyWords: this.filterQuery.keyWords,
mainAction: this.filterQuery.mainAction,
action: this.filterQuery.action
};
if (this.filterQuery.actionType == 'preInDetail') {
printParams.invCode = '1000001'
} else if (this.filterQuery.actionType == 'preDetail') {
printParams.invCode = '1000002'
}
if (this.actDateRange !== null) {
printParams.startAduditTime = this.actDateRange[0];
printParams.endAduditTime = this.actDateRange[1];
} else {
printParams.startAduditTime = null;
printParams.endAduditTime = null;
}
excelInoutImport(printParams).then((response) => {
let blob = new Blob([response], {type: "application/vnd.ms-excel"});
let url = window.URL.createObjectURL(blob); // 创建一个临时的url指向blob对象
let a = document.createElement("a");
a.href = url;
a.click();
this.$message("成功")
})
});
},
},
components:{
deptDeviceDetail

Loading…
Cancel
Save