触摸屏报工

This commit is contained in:
xielue 2023-10-03 13:51:07 +08:00
parent 0ec8b757a5
commit fa94da9856
3 changed files with 213 additions and 155 deletions

View File

@ -1,10 +1,11 @@
<template>
<basic-page-list :desc="desc" :options="pageOptions"></basic-page-list>
<basic-page-list :desc="desc" :options="pageOptions" @print="pagePrint"></basic-page-list>
</template>
<script>
import BASE_URL from '@/services/mes/api.js';
const settings = require('../../basic/settings.js');
export default {
i18n: require("./i18n"),
@ -38,7 +39,7 @@ export default {
keyName: 'id', //
listFieldName: 'BaseDepartment',
enabledPrint: true,
addPageUrl: "/BaseDepartment/BaseDepartmentAdd",
editPageUrl: "/BaseDepartment/BaseDepartmentUpdate/",
@ -83,7 +84,7 @@ export default {
id: 'datagrid_1', //
columns: [
{ type: 'checkbox', width: 'auto' }, //
{ type: 'checkbox', width: 60 }, //
{ title: '操作', slots: { default: 'op' }, width: 120 },
{ field: 'code', sortable: true, title: '编码', width: 250 }, //
@ -105,6 +106,27 @@ export default {
},
pagePrint({ tableData }) {
let hiprint = this.$hiPrint; //
let tdata = {};
tdata.table = JSON.parse(JSON.stringify(tableData));
tdata.table.forEach(item => {
item.qrcode = JSON.stringify({
id : item.id.toString(),
types :"department"
});
})
console.log(tdata.table)
hiprint.init(); //
var hiprintTemplate = new hiprint.PrintTemplate({ //
template: settings.printTemplate_department //
});
hiprintTemplate.print(tdata, { printer: '', title: '部门' }); //
},
},
watch: {

View File

@ -74,8 +74,9 @@ var config = {
],
printTemplate_processes: {"panels":[{"index":0,"name":1,"height":296.6,"width":210,"paperHeader":30,"paperFooter":804,"printElements":[{"options":{"left":18,"top":21,"height":135,"width":550,"tableFooterRepeat":"last","field":"table","tableHeaderRepeat":"first","fields":[{"field":"name","text":"名称"},{"field":"code","text":"编码"},{"field":"qrcode","text":"扫码"}],"right":568,"bottom":57,"vCenter":293,"hCenter":39,"coordinateSync":false,"widthHeightSync":false,"tableBodyRowHeight":28.5,"styler":"function(){ return { padding: \"40px\" } }","columns":[[{"width":150,"title":"名称","field":"name","checked":true,"columnId":"name","fixed":false,"rowspan":1,"colspan":1,"align":"center","tableColumnHeight":30,"tableTextType":"text","tableBarcodeMode":"CODE128A","tableQRCodeLevel":0},{"width":150,"title":"编码","field":"code","checked":true,"columnId":"code","fixed":false,"rowspan":1,"colspan":1,"align":"center","tableColumnHeight":30,"tableTextType":"text","tableBarcodeMode":"CODE128A","tableQRCodeLevel":0},{"width":150,"title":"扫码","field":"qrcode","checked":true,"columnId":"qrcode","fixed":false,"rowspan":1,"colspan":1,"align":"center","tableColumnHeight":"300","tableTextType":"qrcode","tableBarcodeMode":"CODE128A","tableQRCodeLevel":0,"tableSummaryTitle":true,"tableSummary":""}]]},"printElementType":{"title":"通用表格","type":"table","editable":true,"columnDisplayEditable":true,"columnDisplayIndexEditable":true,"columnTitleEditable":true,"columnResizable":true,"columnAlignEditable":true,"isEnableEditField":true,"isEnableContextMenu":true,"isEnableInsertRow":true,"isEnableDeleteRow":true,"isEnableInsertColumn":true,"isEnableDeleteColumn":true,"isEnableMergeCell":true}}],"paperNumberLeft":571.5,"paperNumberTop":817.5,"watermarkOptions":{}}]}
printTemplate_processes:{"panels":[{"index":0,"name":1,"height":296.6,"width":210,"paperHeader":10.5,"paperFooter":795,"printElements":[{"options":{"left":61.5,"top":24,"height":106.5,"width":462,"tableFooterRepeat":"last","field":"table","tableHeaderRepeat":"page","fields":[{"field":"name","text":"名称"},{"field":"code","text":"编码"},{"field":"qrcode","text":"扫码"}],"right":523.5,"bottom":129.75,"vCenter":292.5,"hCenter":76.5,"coordinateSync":false,"widthHeightSync":false,"columns":[[{"width":150,"title":"名称","field":"name","checked":true,"columnId":"name","fixed":false,"rowspan":1,"colspan":1,"align":"center","tableColumnHeight":"300","tableTextType":"text","tableBarcodeMode":"CODE128A","tableQRCodeLevel":0,"tableSummaryTitle":true,"tableSummary":""},{"width":150,"title":"编码","field":"code","checked":true,"columnId":"code","fixed":false,"rowspan":1,"colspan":1,"align":"center","tableColumnHeight":"300","tableTextType":"text","tableBarcodeMode":"CODE128A","tableQRCodeLevel":0,"tableSummaryTitle":true,"tableSummary":""},{"width":150,"title":"扫码","field":"qrcode","checked":true,"columnId":"qrcode","fixed":false,"rowspan":1,"colspan":1,"align":"center","tableColumnHeight":"300","tableTextType":"qrcode","tableBarcodeMode":"CODE128A","tableQRCodeLevel":0,"tableSummaryTitle":true,"tableSummary":""}]]},"printElementType":{"title":"通用表格","type":"table","editable":true,"columnDisplayEditable":true,"columnDisplayIndexEditable":true,"columnTitleEditable":true,"columnResizable":true,"columnAlignEditable":true,"isEnableEditField":true,"isEnableContextMenu":true,"isEnableInsertRow":true,"isEnableDeleteRow":true,"isEnableInsertColumn":true,"isEnableDeleteColumn":true,"isEnableMergeCell":true}}],"paperNumberLeft":576,"paperNumberTop":808.5,"watermarkOptions":{}}]}
}
config.printTemplate_department = config.printTemplate_processes
module.exports = config

View File

@ -1,91 +1,98 @@
<template>
<div class="page-body">
<vxe-pulldown ref="pulldownRef" transfer>
<template #default>
<vxe-input ref="inputx" style="width:400px" v-model="searchName" suffix-icon="vxe-icon-table"
placeholder="搜索工艺布产等信息" @keydown="keydownEvent" @suffix-click="suffixClick"></vxe-input>
<a-icon type="scan" :style="{ fontSize: '22px', color: '#08c', marginLeft: '10px' }" @click="inputFocus" />
</template>
<template #dropdown>
<div class="search-dropdown">
<div class="search-dropdown-column">
<h3>工艺布产</h3>
<vxe-grid border auto-resize height="400" :row-config="{ isHover: true }" :loading="loading"
:data="tableDataOrders" :columns="tableColumnOrders" @cell-click="cellClickEventOrders">
</vxe-grid>
<div>
<div class="page-body">
<vxe-input ref="inputx" style="width:400px" v-model="searchName" placeholder="搜索工艺布产等信息"
@keydown="keydownEvent"></vxe-input>
<a-icon type="scan" :style="{ fontSize: '22px', color: '#08c', marginLeft: '10px' }" @click="inputFocus" />
<div class="container">
<div class="left">
<div class="card">
<h4>工艺布产工序</h4>
<div v-for="item in detailsData" :key="item.id" class="card-item">
<div class="gx-item">
<div class="gx-item-col">
<div>部门{{ item.department_detail ? item.department_detail.name : '' }}</div>
<div>部件{{ item.component_detail ? item.component_detail.name : '' }}</div>
<div>工序{{ item.process_detail ? item.process_detail.name : '' }}</div>
<div>状态{{ item.is_complete ? "已完成" : (item.is_send ? "已发料" : "未发料") }}</div>
</div>
<div class="gx-item-col">
<a-button type="primary" @click="pageSend(item)" v-if="item.is_send !== 1">发料</a-button>
<a-button @click="pageSend(item, true)" v-else-if="!item.is_complete">撤销发料</a-button>
<a-button style="margin-left: 3px;" type="primary" @click="pageReport(item)"
v-if="item.is_send && item.is_complete !== 1">报工</a-button>
<a-button style="margin-left: 3px;" @click="pageReport(item, true)"
v-if="item.is_complete == 1">撤销报工</a-button>
</div>
</div>
<div class="card-item-progress">
<a-progress type="circle" :percent="item.progress" :width="50" />
</div>
</div>
</div>
<div class="card">
<h4>部门进度汇总</h4>
<vxe-table border show-overflow keep-source ref="xTable3" :height="200" :data="detailsData3">
<vxe-column field="name" title="部门名称" width="160"></vxe-column>
<vxe-column field="process_num" title="工序数量" width="160"></vxe-column>
<vxe-column field="progress" :cellRender="{ name: 'progress' }" title="进度" width="180"></vxe-column>
</vxe-table>
</div>
</div>
</template>
</vxe-pulldown>
<div class="right">
<div class="container">
<div class="left">
<div class="card">
<h4>工艺布产信息</h4>
<vxe-form :data="formOptions2.data" ref="xForm" :title-width="formOptions2.titleWidth"
:title-align="formOptions2.titleAlign" :rules="formOptions2.rules" :items="formOptions2.items" titleColon>
</vxe-form>
</div>
<div class="card">
<h4>工艺布产工序</h4>
<div class="card">
<h4>模具信息</h4>
<div v-for="item in detailsData" :key="item.id" class="card-item">
<div class="gx-item">
<div class="gx-item-col">
<div>部门{{ item.department_detail ? item.department_detail.name : '' }}</div>
<div>部件{{ item.component_detail ? item.component_detail.name : '' }}</div>
<div>工序{{ item.process_detail ? item.process_detail.name : '' }}</div>
<div>状态{{ item.is_complete ? "已完成" : (item.is_send ? "已发料" : "未发料") }}</div>
</div>
<div class="gx-item-col">
<a-button type="primary" @click="pageSend(item)" v-if="item.is_send !== 1">发料</a-button>
<a-button @click="pageSend(item, true)" v-else-if="!item.is_complete">撤销发料</a-button>
<a-button style="margin-left: 3px;" type="primary" @click="pageReport(item)"
v-if="item.is_send && item.is_complete !== 1">报工</a-button>
<a-button style="margin-left: 3px;" @click="pageReport(item, true)"
v-if="item.is_complete == 1">撤销报工</a-button>
</div>
</div>
<div class="card-item-progress">
<a-progress type="circle" :percent="item.progress" :width="50" />
</div>
<vxe-form :data="formOptions3.data" ref="xForm" :title-width="formOptions3.titleWidth"
:title-align="formOptions3.titleAlign" :rules="formOptions3.rules" :items="formOptions3.items" titleColon>
</vxe-form>
</div>
</div>
<div class="card">
<h4>部门进度汇总</h4>
<vxe-table border show-overflow keep-source ref="xTable3" :height="200" :data="detailsData3">
<vxe-column field="name" title="部门名称" width="160"></vxe-column>
<vxe-column field="process_num" title="工序数量" width="160"></vxe-column>
<vxe-column field="progress" :cellRender="{ name: 'progress' }" title="进度" width="180"></vxe-column>
</vxe-table>
</div>
</div>
<div class="right">
<div class="card">
<h4>工艺布产信息</h4>
<vxe-form :data="formOptions2.data" ref="xForm" :title-width="formOptions2.titleWidth"
:title-align="formOptions2.titleAlign" :rules="formOptions2.rules" :items="formOptions2.items" titleColon>
</vxe-form>
</div>
<div class="card">
<h4>模具信息</h4>
<vxe-form :data="formOptions3.data" ref="xForm" :title-width="formOptions3.titleWidth"
:title-align="formOptions3.titleAlign" :rules="formOptions3.rules" :items="formOptions3.items" titleColon>
</vxe-form>
</div>
</div>
</div>
<div data-show="true" class="ant-alert ant-alert-info ant-alert-with-description" style="padding: 5px 5px 5px 20px;border:none;">
<span class="ant-alert-message">操作性提示</span>
<span class="ant-alert-description" style="line-height:18px;">
<p>
1先选择布产单可以输入编码(输入后回车) 也可以扫码
</p>
<p>
2输入1#部门编码 搜索当前布产单的部门相关工序 也可以扫码
</p>
<p>
3输入2#工序编码 搜索当前布产单的相关工序追加 也可以扫码
</p>
</span>
</div>
@ -127,6 +134,7 @@ export default {
currentId: 0,
detailsData: [],
detailsData3: [],
tips: ["点一", "点二", "点三"],
current_mold_production_order_component_processes: [],
formOptions2: {
data: {
@ -285,8 +293,7 @@ export default {
],
tableDataStaff: [],
tableDataProcesses: [],
tableDataOrders: [],
allDetailsData: []
tableDataOrders: []
};
@ -320,24 +327,7 @@ export default {
this.$refs.inputx.focus();
},
doLoadData() {
const now = Date.now();
if (this.lastTriggerTime) {
const elapsedTime = now - this.lastTriggerTime;
if (elapsedTime < 1000) {
return;
}
}
const $pulldown = this.$refs.pulldownRef
if ($pulldown) {
$pulldown.showPanel()
}
this.lastTriggerTime = now;
this.loadData({ key: this.searchName })
},
loadData({ key }) {
@ -367,7 +357,10 @@ export default {
this.loading = false
this.tableDataOrders = JSON.parse(JSON.stringify(a.data.mold_production_order || []));
this.allDetailsData = JSON.parse(JSON.stringify(a.data.mold_production_order_component_processes || []));
if (this.tableDataOrders.length) {
this.loadProductionOrder({ id: this.tableDataOrders[0].id });
}
}).catch((a) => {
@ -389,7 +382,17 @@ export default {
inputValue = inputValue.substr(inputValue.indexOf('{'));
}
if (inputValue && inputValue.indexOf('{') == 0) {
if (inputValue && inputValue.indexOf('{') == -1 && inputValue.indexOf('2#') == 0) {
this.loadProcesses({ code: inputValue.substr(2) })
}
else if (inputValue && inputValue.indexOf('{') == -1 && inputValue.indexOf('1#') == 0) {
this.loadDepartment({ code: inputValue.substr(2) })
}
else if (inputValue && inputValue.indexOf('{') == -1) {
this.loadData({ key: inputValue })
}
else if (inputValue && inputValue.indexOf('{') == 0) {
inputValue = inputValue.replace(//g, ":");
inputValue = inputValue.replace(//g, ",");
inputValue = inputValue.replace(/”/g, "\"");
@ -404,6 +407,9 @@ export default {
if (v.types == "processes") {
this.loadProcesses({ id: v.id });
}
if (v.types == "department") {
this.loadDepartment({ id: v.id });
}
if (v.types == "mold_production_order") {
this.loadProductionOrder({ id: v.id });
}
@ -435,22 +441,6 @@ export default {
return;
}
setTimeout(() => {
if (this.lastScanTime) {
// 200
if (now - this.lastScanTime < 200) {
return;
}
}
this.doLoadData();
}, 100);
},
loadStaff({ id }) {
@ -463,20 +453,78 @@ export default {
this.selectStaff({ data: a.data.mes_staff })
});
},
loadProcesses({ id }) {
loadProcesses({ id, code }) {
let ds = this.detailsData || [];
if (ds.filter(a => a.process_id.toString() == id.toString()).length) {
return;
if (id) {
if (ds.filter(a => a.process_id.toString() == id.toString()).length) {
return;
}
this.current_mold_production_order_component_processes.forEach(item => {
if (item.process_id.toString() == id.toString()) {
ds.push(item);
}
})
this.detailsData = ds;
}
else if (code) {
if (ds.filter(item => item.process_detail && item.process_detail.code == code).length) {
return;
}
this.current_mold_production_order_component_processes.forEach(item => {
if (item.process_detail && item.process_detail.code == code) {
ds.push(item);
}
})
this.detailsData = ds;
}
this.current_mold_production_order_component_processes.forEach(item => {
if (item.process_id.toString() == id.toString()) {
ds.push(item);
}
})
this.detailsData = ds;
},
loadDepartment({ id, code }) {
let ds = [];
if (id) {
if (ds.filter(a => a.department_id.toString() == id.toString()).length) {
return;
}
this.current_mold_production_order_component_processes.forEach(item => {
if (item.department_id.toString() == id.toString()) {
ds.push(item);
}
})
this.detailsData = ds;
}
else if (code) {
if (ds.filter(item => item.department_detail && item.department_detail.code == code).length) {
return;
}
this.current_mold_production_order_component_processes.forEach(item => {
if (item.department_detail && item.department_detail.code == code) {
ds.push(item);
}
})
this.detailsData = ds;
}
},
loadProductionOrder({ id }) {
this.currentId = id;
@ -534,12 +582,6 @@ export default {
this.formOptions2.data = data2
},
suffixClick() {
const $pulldown = this.$refs.pulldownRef
if ($pulldown) {
$pulldown.togglePanel()
}
},
cellClickEventProcesses({ row }) {
let data = Object.assign({}, row);
this.formOptions3.data = data
@ -553,23 +595,6 @@ export default {
this.loadProductionOrder({ id: row.id });
/*
let data2 = Object.assign({}, row);
let data3 = Object.assign({}, row.mold_detail);
this.formOptions2.data = data2
this.formOptions3.data = data3
let ds = [];
this.allDetailsData.forEach(item => {
if ((item.production_id + '') == (row.id + '')) {
ds.push(item);
}
})
console.log(ds)
this.detailsData = ds;
*/
},
cellClickEventStaff({ row }) {
@ -794,4 +819,14 @@ export default {
right: 5px;
top: 5px;
}
.bottom-toast {
background-color: #5CB85C;
width: 100%;
padding: 10px;
box-sizing: border-box;
text-align: center;
font-size: 14px;
color: #333;
}
</style>