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

生产工单->打印工单

parent 46752d79
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
"vue-ls": "4.0.0", "vue-ls": "4.0.0",
"vue-meta": "2.4.0", "vue-meta": "2.4.0",
"vue-plugin-hiprint": "^0.0.56", "vue-plugin-hiprint": "^0.0.56",
"vue-print-nb": "^1.7.5",
"vue-router": "3.4.9", "vue-router": "3.4.9",
"vuedraggable": "2.24.3", "vuedraggable": "2.24.3",
"vuex": "3.6.0" "vuex": "3.6.0"
......
...@@ -109,3 +109,11 @@ export function doCheckToolNum(workorderId){ ...@@ -109,3 +109,11 @@ export function doCheckToolNum(workorderId){
method: 'get' method: 'get'
}) })
} }
// 获取打印工单数据
export function printInfo(workorderId) {
return request({
url: '/mes/pro/workorder/printInfo?workorderIds=' + workorderId,
method: 'get'
})
}
...@@ -155,6 +155,15 @@ ...@@ -155,6 +155,15 @@
v-hasPermi="['mes:pro:workorder:dofinish']">生产打样下达 v-hasPermi="['mes:pro:workorder:dofinish']">生产打样下达
</el-button> </el-button>
</el-col> </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 <!-- <right-toolbar
:showSearch.sync="showSearch" :showSearch.sync="showSearch"
@queryTable="getList" @queryTable="getList"
...@@ -524,12 +533,23 @@ ...@@ -524,12 +533,23 @@
<ArrangeInfo :group-code="groupCode" :addBtn="false"></ArrangeInfo> <ArrangeInfo :group-code="groupCode" :addBtn="false"></ArrangeInfo>
</el-dialog> </el-dialog>
<WorkorderRecordSelect ref="WorkorderRecordSelectRef" :data="currentData" /> <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> </div>
</template> </template>
<script> <script>
import RoutesProcessSelect from "@/components/routesProcessSelect/index.vue"; import RoutesProcessSelect from "@/components/routesProcessSelect/index.vue";
import WorkorderRecordSelect from "@/components/workorderRecordSelect/index.vue"; import WorkorderRecordSelect from "@/components/workorderRecordSelect/index.vue";
import productOrderDetail from "./print/productOrderDetail.vue";
import productOrderSpecification from "./print/productOrderSpecification.vue";
import { import {
listWorkorder, listWorkorder,
...@@ -538,6 +558,7 @@ import { ...@@ -538,6 +558,7 @@ import {
addWorkorder, addWorkorder,
updateWorkorder, updateWorkorder,
dofinish, dofinish,
printInfo,
doCheckToolNum doCheckToolNum
} from "@/api/mes/pro/workorder"; } from "@/api/mes/pro/workorder";
...@@ -558,7 +579,9 @@ import { batchAddArrange } from "@/api/mes/pro/arrange"; ...@@ -558,7 +579,9 @@ import { batchAddArrange } from "@/api/mes/pro/arrange";
import ArrangeInfo from "@/views/mes/pro/arrange/info.vue"; import ArrangeInfo from "@/views/mes/pro/arrange/info.vue";
import CommandList from "./commandList.vue"; import CommandList from "./commandList.vue";
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import print from 'vue-print-nb';
export default { export default {
directives: { print },
name: "Workorder", name: "Workorder",
dicts: [ dicts: [
"mes_workorder_status", "mes_workorder_status",
...@@ -566,6 +589,8 @@ export default { ...@@ -566,6 +589,8 @@ export default {
"mes_workorder_type", "mes_workorder_type",
], ],
components: { components: {
productOrderDetail,
productOrderSpecification,
ArrangeInfo, ArrangeInfo,
CombinationInfos, CombinationInfos,
Treeselect, Treeselect,
...@@ -588,8 +613,30 @@ export default { ...@@ -588,8 +613,30 @@ export default {
autoGenFlag: false, autoGenFlag: false,
optType: undefined, optType: undefined,
combOpen: false, 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: [], combinationCodes: [],
arrangeOpen: false, arrangeOpen: false,
enablePrint: false,
arrangeOpen2: false, arrangeOpen2: false,
arrangeCode: [], arrangeCode: [],
groupCode: "", groupCode: "",
...@@ -687,6 +734,8 @@ export default { ...@@ -687,6 +734,8 @@ export default {
{ required: true, message: "需求日期不能为空", trigger: "blur" }, { required: true, message: "需求日期不能为空", trigger: "blur" },
], ],
}, },
productionSolutionTable: [],
workOrderTable: []
}; };
}, },
activated() { activated() {
...@@ -702,8 +751,20 @@ export default { ...@@ -702,8 +751,20 @@ export default {
this.daterangePurchaseDate = [dayjs().format('YYYY-MM-DD'), dayjs().add(7, 'day').format('YYYY-MM-DD')] 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() { handleCommandClick() {
this.currentData = this.selectedRows[0] this.currentData = this.selectedRows[0]
if (this.selectedRows[0].workorderType == 'prototype' && this.selectedRows[0].status === "PUBLISHED") { if (this.selectedRows[0].workorderType == 'prototype' && this.selectedRows[0].status === "PUBLISHED") {
...@@ -1220,3 +1281,9 @@ export default { ...@@ -1220,3 +1281,9 @@ export default {
}, },
}; };
</script> </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