Commit e976f0eb authored by xioln's avatar xioln

报废出库流程签审对象

parent d5436d4c
<!--
* @Author: Lean
* @Date: 2021-03-01 14:40:26
* @LastEditTime: 2021-03-09 20:17:23
* @Description: 打印标签
* @FilePath: applications/dee-mes/src/privateComponents/components/WarehousingConfirmationConfirm/component/PrintTag.vue
-->
<!--
@prop config
@prop Number config.width 设置宽度 default = 300
@prop Array config.prints 打印的数据
@prop String config.prints[].QRcode 二维码
@prop String config.prints[].propertys 二维码下显示的属性
* 测试参数结构
config: {
width: 300,
prints: [
{
text: 'asdasdasd',
propertys: [
{ label: '编码', value: '' },
{ label: '名称', value: '' }
]
},
{
text: 'asdasdasd',
propertys: [
{ label: '编码', value: '' },
{ label: '名称', value: '' }
]
}
]
}
-->
<template>
<section ref="print" class="print">
<section
v-for="(item, index) in config.prints || []"
:key="index"
:style="{ width: '19%' }"
class="item"
>
<header>
<vue-qr style="height:218px;" :size="config.width" :margin="0" :text="item.text.toString()" :qid="index.toString()" />
</header>
<footer>
<ul>
<li
v-for="property in item.propertys"
:key="property.label"
>
<p>{{ property.label }}</p>
<span>{{ property.value }}</span>
</li>
</ul>
</footer>
</section>
</section>
</template>
<script>
import VueQr from 'vue-qr'
export default {
name: 'Print',
components: {
VueQr
},
props: {
config: {
type: Object,
default: () => {
return {
width: 300,
prints: []
}
}
}
},
data() {
return {
timer: null,
flag: true
}
},
beforeDestroy() {
this.timer = null
},
methods: {
print() {
if (this.flag) {
this.flag = false
this.timer = setInterval(() => {
if (this.$refs.print.innerHTML) {
this.printTag()
clearInterval(this.timer)
}
}, 300)
setTimeout(() => {
this.flag = true
}, 1000)
}
},
printTag() {
var iframe = document.createElement('IFRAME')
var doc = null
iframe.setAttribute('style', 'position:absolute; width:0; height:0; margin-top: -1000px; margin-left: -1000px;')
document.body.appendChild(iframe)
doc = iframe.contentWindow.document
doc.write(`
<style>
ul, li {
margin: 0;
padding: 0;
list-style: none;
font-size: 17px;
}
.item {
min-height:700px;
}
li {
position: relative;
width: 306px;
display: flex;
padding: 0 5px;
align-items: center;
border-left: 2px solid #222;
border-right: 2px solid #222;
border-bottom: 2px solid #222;
}
li::after{
content: '';
position: absolute;
left: calc(35% - 5px);
top: 0;
height: 100%;
border-left: 2px solid #222;
width: 0;
}
ul {
width: 320px;
border-top: 4px solid #222;
}
li p {
margin: 0;
width: 35%;
padding: 3.5px 0;
}
li span {
display: inline-block;
width: 65%;
text-align: left;
padding-left: 6px;
}
img {
width: 320px;
height:290px;
margin-bottom: 4px;
}
</style>
`)
doc.write(this.$refs.print.innerHTML)
doc.close()
iframe.contentWindow.focus()
iframe.contentWindow.print()
}
}
}
</script>
<style lang="scss" scoped>
.print {
position: absolute;
z-index: -999;
left: -1000px;
top: -1110px;
}
</style>
<template>
<div>
<DeeAsCom
v-if="basicData"
ref="list"
:basic-data="basicData"
:lay-config="{
typeName: 'OutStorageScrap',
layKey: 'flowTable'
}"
@tb-printCode="tbPrintCode"
/>
<!-- <DeeAsCom
v-if="basicData"
ref="list"
:basic-data="basicData"
:lay-config="{
typeName: 'OutStorageExpireItem',
layKey: 'OutStorageExpireFlow'
}"
@tb-printCode="tbPrintCode"
/> -->
<PrintTag ref="print" :config="printConfig" />
</div>
</template>
<script>
import PrintTag from './PrintTag.vue'
export default {
componentName: '报废出库申请单',
name: 'OutStorageScrappedFlow',
components: { PrintTag },
props: {
basicData: {
type: Object,
default: () => null
}
},
data() {
return {
// 打印标签
printConfig: {
visible: false,
width: 300,
prints: [],
dic: []
}
}
},
mounted() {
this.$utils.getDicListByCode('ObjStatus').then(res => {
this.dic = res
})
// defaultQueryParams = [{
// items: [{
// 'fieldName': 'id',
// 'operator': 'EQ',
// 'value': obtainedParams.basicData.id
// }],
// operator: 'AND'
// }]
},
methods: {
tbPrintCode() {
const selection = this.$refs['list'].$refs['asCom'].selectedData
// 获取需要打印的数据
this.printConfig.prints = []
selection.forEach((row) => {
this.printConfig = Object.assign({}, this.printConfig, {
visible: true
})
const state = this.dic.find(item => item.value === row.state)
this.printConfig.prints.push({
text: row.id,
propertys: [
{ label: '状态', value: state ? state.label : row.state },
{ label: '申请单编号', value: row.reqNo },
{ label: '申请依据', value: row.reqBill },
{ label: '申请部门', value: row.reqDept },
{ label: '创建人', value: row.creator.userName },
{ label: '创建时间', value: row.createTime }
// { label: '名称', value: row.extMaterial.resName },
// { label: '型号/牌号/件号', value: row.extMaterial.modelNo },
// { label: '规格', value: row.extMaterial.spec },
// { label: '批号', value: row.lotNo },
// { label: '系列号/序列号', value: row.serialNo },
// { label: '机型', value: row.airModel },
// { label: '验收单号', value: row.purchaseOrderNo },
// { label: '保证保管期', value: '' },
// { label: '出库数量', value: row.reqAmount },
// { label: '贮存期', value: '' },
// { label: '库位号', value: '' },
// { label: '计量单位', value: row.extMaterial.extUnit.unitName },
// { label: 'AO号', value: '' },
// { label: '备注', value: row.remark || '' }
]
})
})
this.$refs.print.print()
}
}
}
</script>
<style lang="scss" scoped>
</style>
...@@ -347,7 +347,6 @@ export default { ...@@ -347,7 +347,6 @@ export default {
{ {
title: '物料类型', key: 'typeName', headerAlign: 'center', formatter: (row, column, cellValue, index) => { title: '物料类型', key: 'typeName', headerAlign: 'center', formatter: (row, column, cellValue, index) => {
const value = row.extMaterial ? row.extMaterial.resType2.typeName : row.materialTypeName const value = row.extMaterial ? row.extMaterial.resType2.typeName : row.materialTypeName
console.log('value', value)
return value return value
} }
}, },
...@@ -678,7 +677,6 @@ export default { ...@@ -678,7 +677,6 @@ export default {
}) })
} }
}) })
console.log('res.items', { ...data[0] })
if (data.length > 0) { if (data.length > 0) {
this.formData[0].data.forEach(item => { this.formData[0].data.forEach(item => {
item.component.disabled = true item.component.disabled = true
...@@ -696,9 +694,7 @@ export default { ...@@ -696,9 +694,7 @@ export default {
addTableData(formData) { addTableData(formData) {
const tableData = Array.from(this.tableData) const tableData = Array.from(this.tableData)
this.tableData = [] this.tableData = []
console.log('ffff', { ...formData })
this.addData = formData this.addData = formData
console.log('formData', formData)
const tableDataItem = { const tableDataItem = {
...formData, ...formData,
children: [] children: []
...@@ -718,7 +714,6 @@ export default { ...@@ -718,7 +714,6 @@ export default {
for (const item of tableData) { for (const item of tableData) {
// 父类修改 // 父类修改
if (item.id === tableDataItem.id) { if (item.id === tableDataItem.id) {
// console.log('item', tableDataItem)
tableData.splice(tableData.indexOf(item), 1, tableDataItem) tableData.splice(tableData.indexOf(item), 1, tableDataItem)
break break
} }
......
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