Commit 49bd2403 authored by 沈翠玲's avatar 沈翠玲

生产工单->打印工单

parent 46752d79
......@@ -65,6 +65,7 @@
"vue-ls": "4.0.0",
"vue-meta": "2.4.0",
"vue-plugin-hiprint": "^0.0.56",
"vue-print-nb": "^1.7.5",
"vue-router": "3.4.9",
"vuedraggable": "2.24.3",
"vuex": "3.6.0"
......
......@@ -109,3 +109,11 @@ export function doCheckToolNum(workorderId){
method: 'get'
})
}
// 获取打印工单数据
export function printInfo(workorderId) {
return request({
url: '/mes/pro/workorder/printInfo?workorderIds=' + workorderId,
method: 'get'
})
}
......@@ -155,6 +155,15 @@
v-hasPermi="['mes:pro:workorder:dofinish']">生产打样下达
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain size="mini" v-print="printContent" id="printbtn" style="display: none"
>打印工单
</el-button>
<el-button type="warning" plain size="mini" ref="printbtn" @click="handlePrint"
>打印工单
</el-button>
</el-col>
<!-- <right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
......@@ -524,12 +533,23 @@
<ArrangeInfo :group-code="groupCode" :addBtn="false"></ArrangeInfo>
</el-dialog>
<WorkorderRecordSelect ref="WorkorderRecordSelectRef" :data="currentData" />
<div style="overflow: hidden;width: 0;height: 0;">
<div id="productOrderDetail">
<div v-for="(item, index) in productionSolutionTable" :key="'productionSolutionTable' + index">
<productOrderSpecification :productionSolutionTable="item" style="page-break-after:always"></productOrderSpecification>
<productOrderDetail :workOrderTable="workOrderTable[index]" style="page-break-after:always"></productOrderDetail>
</div>
</div>
</div>
</div>
</template>
<script>
import RoutesProcessSelect from "@/components/routesProcessSelect/index.vue";
import WorkorderRecordSelect from "@/components/workorderRecordSelect/index.vue";
import productOrderDetail from "./print/productOrderDetail.vue";
import productOrderSpecification from "./print/productOrderSpecification.vue";
import {
listWorkorder,
......@@ -538,6 +558,7 @@ import {
addWorkorder,
updateWorkorder,
dofinish,
printInfo,
doCheckToolNum
} from "@/api/mes/pro/workorder";
......@@ -558,7 +579,9 @@ import { batchAddArrange } from "@/api/mes/pro/arrange";
import ArrangeInfo from "@/views/mes/pro/arrange/info.vue";
import CommandList from "./commandList.vue";
import dayjs from 'dayjs';
import print from 'vue-print-nb';
export default {
directives: { print },
name: "Workorder",
dicts: [
"mes_workorder_status",
......@@ -566,6 +589,8 @@ export default {
"mes_workorder_type",
],
components: {
productOrderDetail,
productOrderSpecification,
ArrangeInfo,
CombinationInfos,
Treeselect,
......@@ -588,8 +613,30 @@ export default {
autoGenFlag: false,
optType: undefined,
combOpen: false,
printContent: {
id: 'productOrderDetail',
// preview: true, // 预览工具是否启用
// previewTitle: '储能服务费结算单', // 预览页面的标题
popTitle: '', // 打印页面的页眉
extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
previewBeforeOpenCallback() {
console.log('previewBeforeOpenCallback')
},
previewOpenCallback() {},
beforeOpenCallback(vue) {
// vue.printLoading = true;
},
openCallback(vue) {
// vue.printLoading = false;
},
closeCallback() {},
clickMounted(vue) {
console.log('clickMounted')
},
},
combinationCodes: [],
arrangeOpen: false,
enablePrint: false,
arrangeOpen2: false,
arrangeCode: [],
groupCode: "",
......@@ -687,6 +734,8 @@ export default {
{ required: true, message: "需求日期不能为空", trigger: "blur" },
],
},
productionSolutionTable: [],
workOrderTable: []
};
},
activated() {
......@@ -702,8 +751,20 @@ export default {
this.daterangePurchaseDate = [dayjs().format('YYYY-MM-DD'), dayjs().add(7, 'day').format('YYYY-MM-DD')]
},
handlePrint(){
printInfo(this.ids).then(res=>{
if(!res.data || res.data.length === 0) {
return this.$message.warning('没有数据')
}
if(res.code === 200 && res.data) {
this.productionSolutionTable = res.data.map(v=>v.productionSolutionTable)
this.workOrderTable = res.data.map(v=>v.workOrderTable)
this.$nextTick(() => {
document.getElementById('printbtn').click()
})
}
})
},
handleCommandClick() {
this.currentData = this.selectedRows[0]
if (this.selectedRows[0].workorderType == 'prototype' && this.selectedRows[0].status === "PUBLISHED") {
......@@ -1220,3 +1281,9 @@ export default {
},
};
</script>
<style>
@page {
size: auto;
margin: 0mm;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment