库存明细打印代码提交

prod
郑明梁 2 years ago
parent c8b4537803
commit 9dc05b3112

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

@ -23,7 +23,8 @@
</el-col>
<el-col :span="6">
<el-form-item class="query-form-item" label="规格型号:">
<el-input v-model="filterQuery.spec" placeholder="请输入规格型号" style="width: 90%" clearable="true"></el-input>
<el-input v-model="filterQuery.spec" placeholder="请输入规格型号" style="width: 90%"
clearable="true"></el-input>
</el-form-item>
</el-col>
</el-row>
@ -69,20 +70,16 @@
<div class="top-right-btn">
<el-button-group>
<el-button icon="el-icon-view" type="primary" @click="hideSearch">/</el-button>
<el-button
type="primary"
icon="el-icon-refresh"
@click="onReset"
>重置
</el-button>
<el-button type="primary" icon="el-icon-search" @click="onSubmit"
>查询
</el-button
>
<el-button type="primary" icon="el-icon-refresh" @click="optinPrint"></el-button>
<el-button type="primary" icon="el-icon-refresh" @click="selectPrint"></el-button>
<el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button>
<el-button type="primary" icon="el-icon-search" @click="onSubmit"></el-button>
</el-button-group>
</div>
<el-divider style="margin: 15px"></el-divider>
<el-table v-loading="loading" :data="list" style="width: 100%" highlight-current-row border>
<el-table v-loading="loading" :data="list" style="width: 100%" highlight-current-row border
@selection-change="handleCheckedChange">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column label="供应商" prop="fromCorpName" width="160" v-if="showSup"></el-table-column>
<el-table-column label="出入库单号" prop="orderIdFk" width="160"></el-table-column>
@ -113,7 +110,7 @@
</template>
<script>
import {getResultDetailList, getResultOrderList} from '@/api/inout/orderDetailResult'
import {getResultDetailList, getResultOrderList, verifyTemplateFile, printOrder} from '@/api/inout/orderDetailResult'
export default {
name: "supInoutSearchOrder",
@ -132,14 +129,15 @@ export default {
limit: 10,
startAduditTime: null,
endAduditTime: null,
actionType: "norDetail",
actionType: null,
},
loading: false,
total: 0,
orderSelection: [],
showSup: false,
customerId: this.$store.getters.customerId,
actDateRange: [],
actionType: "norDetail",
actionType: null,
auditDateRange: [],
pickerOptions: {
shortcuts: [
@ -191,12 +189,14 @@ export default {
limit: 10,
startAduditTime: null,
endAduditTime: null,
actionType: "norDetail",
actionType: null,
};
this.actDateRange=[]
this.actDateRange = []
this.getList();
},
handleCheckedChange(val) {
this.orderSelection = val;
},
onSubmit() {
this.loading = true;
@ -216,7 +216,7 @@ export default {
},
getList() {
this.loading = true;
// this.filterQuery.actionType = this.actionType;
this.filterQuery.actionType = this.actionType;
getResultOrderList(this.filterQuery)
.then((response) => {
if (response.code === 20000) {
@ -233,6 +233,74 @@ export default {
this.total = 0;
});
},
optinPrint() {
if (this.orderSelection == null || this.orderSelection.length <= 0) {
return this.$message.error("请选择打印的明细!");
}
let query = {id: 4};
verifyTemplateFile(query).then((res) => {
if (res.code === 20000) {
let printParams = {
templateId: res.data,
list: this.orderSelection
};
printOrder(printParams).then((response) => {
//pdfurl
const binaryData = [];
binaryData.push(response);
//blob
let url = window.URL.createObjectURL(
new Blob(binaryData, {type: "application/pdf"})
);
this.loading = false;
window.open(url);//pdf
})
}
}).catch((error) => {
this.loading = false;
this.$message.error(error.message);
})
},
selectPrint(){
let query = {id: 4};
verifyTemplateFile(query).then((res) => {
if (res.code === 20000) {
let printParams = {
templateId: res.data,
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
};
if (this.actDateRange !== null) {
printParams.startAduditTime = this.actDateRange[0];
printParams.endAduditTime = this.actDateRange[1];
} else {
printParams.startAduditTime = null;
printParams.endAduditTime = null;
}
printOrder(printParams).then((response) => {
//pdfurl
const binaryData = [];
binaryData.push(response);
//blob
let url = window.URL.createObjectURL(
new Blob(binaryData, {type: "application/pdf"})
);
this.loading = false;
window.open(url);//pdf
})
}
}).catch((error) => {
this.loading = false;
this.$message.error(error.message);
})
}
}
,
mounted() {

Loading…
Cancel
Save