Commit 550a9ad9 authored by 沈翠玲's avatar 沈翠玲

LPN

parent 28af525c
......@@ -18,10 +18,7 @@
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
size="mini"
@click="handleprint"
<el-button type="primary" size="mini" @click="handleprint"
>打印</el-button
>
</el-form-item>
......@@ -38,14 +35,15 @@
v-hasPermi="['pro:scheduleSetupRule:export']"
>导出</el-button>
</el-col> -->
<right-toolbar
<!-- <right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
></right-toolbar> -->
</el-row>
<el-table
v-loading="loading"
v-if="scheduleSetupRuleList.length > 0"
:data="scheduleSetupRuleList"
@selection-change="handleSelectionChange"
>
......@@ -78,21 +76,13 @@
<el-table-column label="创建时间" align="center" prop="createTime" />
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { listlpnrecord } from '@/api/mes/lpn/lpnLabel'
import { listReport } from '@/api/mes/report/ureport'
import { postBatchPrintPdf } from '@/utils/ruoyi'
export default {
name: 'lpnLabel',
......@@ -142,15 +132,31 @@ export default {
}
},
created() {
this.getList()
// this.getList()
},
methods: {
handleprint(){
if (this.timer !== null) return
this.timer = setTimeout(()=>{
console.log('打印', this.queryParams)
this.timer = null
},100)
handleprint() {
if (this.timer !== null) return
this.timer = setTimeout(async () => {
this.timer = null
await this.getList()
if (
!this.scheduleSetupRuleList ||
this.scheduleSetupRuleList.length === 0
)
return this.$modal.msgError('没有数据')
const valueList = this.scheduleSetupRuleList.map((v) => {
return {
packagePrint: {
lpnNo: v.lpnNo,
}
}
})
await postBatchPrintPdf('package-lpnV2', valueList).then(() => {
this.visible = false
this.getPackageList()
})
}, 100)
},
onItemSelected(obj) {
if (obj != undefined && obj != null) {
......@@ -160,9 +166,9 @@ export default {
}
},
/** 查询客户产品标签模板对照表列表 */
getList() {
async getList() {
this.loading = true
listlpnrecord(this.queryParams).then((response) => {
await listlpnrecord(this.queryParams).then((response) => {
this.scheduleSetupRuleList = response.rows
this.total = response.total
this.loading = false
......
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
@submit.native.prevent
label-width="100px"
>
<el-form-item label="生产工单号" prop="workorderCode">
<el-input
v-model="queryParams.workorderCode"
placeholder="请输入生产工单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
size="mini"
:disabled="multiple"
@click="handleprint"
>打印</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="scheduleSetupRuleList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column
label="工单号"
align="center"
width="120"
prop="workorderCode"
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
@submit.native.prevent
label-width="100px"
>
<el-form-item label="生产工单号" prop="workorderCode">
<el-input
v-model="queryParams.workorderCode"
placeholder="请输入生产工单号"
clearable
@keyup.enter.native="handleQuery"
/>
<el-table-column
label="销售编号"
align="center"
width="160"
prop="salesVoucher"
/>
<el-table-column
label="销售编号项次"
align="center"
width="160"
prop="salesVoucherItem"
/>
<el-table-column label="LPN码" align="center" prop="lpnNo" />
<el-table-column label="on" align="center" prop="是否打印">
<template slot-scope="scope">
{{ scope.row.on ? '是' : '否' }}
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" />
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page-sizes="[100, 500, 1000, 5000]"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
> -->
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
size="mini"
:disabled="multiple"
@click="handleprint"
>打印</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
v-if="scheduleSetupRuleList.length > 0"
:data="scheduleSetupRuleList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column
label="工单号"
align="center"
width="120"
prop="workorderCode"
/>
<el-table-column
label="销售编号"
align="center"
width="160"
prop="salesVoucher"
/>
<el-table-column
label="销售编号项次"
align="center"
width="160"
prop="salesVoucherItem"
/>
</div>
</template>
<el-table-column label="LPN码" align="center" prop="lpnNo" />
<el-table-column label="on" align="center" prop="是否打印">
<template slot-scope="scope">
{{ scope.row.on ? '是' : '否' }}
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" />
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page-sizes="[100, 500, 1000, 5000]"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { listlpnrecord } from '@/api/mes/lpn/lpnLabel'
import { listReport } from '@/api/mes/report/ureport'
export default {
name: 'lpnLabel',
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 客户产品标签模板对照表表格数据
scheduleSetupRuleList: [],
// 弹出层标题
title: '',
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 100,
workorderCode: null,
},
customerOptions: [],
brandOptions: [],
templateOptions: [],
selectedRows: [],
timer: null,
// 表单参数
form: {},
// 表单校验
rules: {
templateId: [
{
required: true,
message: '请选择模板',
trigger: ['blur', 'change'],
},
],
},
import { listlpnrecord } from '@/api/mes/lpn/lpnLabel'
import { postBatchPrintPdf } from '@/utils/ruoyi'
export default {
name: 'lpnLabel',
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 客户产品标签模板对照表表格数据
scheduleSetupRuleList: [],
// 弹出层标题
title: '',
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 100,
workorderCode: null,
},
customerOptions: [],
brandOptions: [],
templateOptions: [],
selectedRows: [],
// 表单参数
form: {},
// 表单校验
rules: {
templateId: [
{
required: true,
message: '请选择模板',
trigger: ['blur', 'change'],
},
],
},
}
},
created() {
// this.getList()
},
methods: {
handleprint() {
const valueList = this.selectedRows.map((v) => {
return {
packagePrint: {
lpnNo: v.lpnNo,
},
}
})
postBatchPrintPdf('package-lpnV2', valueList).then(() => {
this.visible = false
this.getPackageList()
})
},
onItemSelected(obj) {
if (obj != undefined && obj != null) {
this.form.itemId = obj.itemId
this.form.itemCode = obj.itemCode
this.form.itemName = obj.itemName
}
},
/** 查询客户产品标签模板对照表列表 */
async getList() {
this.loading = true
await listlpnrecord(this.queryParams).then((response) => {
this.scheduleSetupRuleList = response.rows
this.total = response.total
this.loading = false
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
itemCode: null,
customerName: null,
brandName: null,
brandCode: null,
brandId: null,
itemId: null,
itemName: null,
itemTypeCode: null,
itemTypeId: null,
itemTypeName: null,
sapItemCode: null,
templateName: null,
templateType: null,
templateCode: null,
templateId: null,
createBy: null,
}
this.resetForm('form')
},
created() {
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
methods: {
handleprint(){
if (this.timer !== null) return
this.timer = setTimeout(()=>{
console.log('打印', this.queryParams)
this.timer = null
},100)
},
onItemSelected(obj) {
if (obj != undefined && obj != null) {
this.form.itemId = obj.itemId
this.form.itemCode = obj.itemCode
this.form.itemName = obj.itemName
handleSelectProduct() {
this.$refs.itemSelect.showFlag = true
},
handleitemType() {
this.$refs.brSelect.showFlag = true
},
onitemTypeed(row) {
if (Object.values(row).length > 0) {
this.form.itemTypeId = row.itemTypeId
this.form.sapTypeCode = row.sapTypeCode
this.form.itemTypeCode = row.itemTypeCode
this.form.itemTypeName = row.itemTypeName
}
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id)
this.selectedRows = selection
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = '添加客户产品标签模板对照表'
},
/** 修改按钮操作 */
handleUpdate(row) {
if (!row || !row.id) row = this.selectedRows[0]
this.reset()
this.form = row
this.open = true
this.title = '修改客户产品标签模板对照表'
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.form.customerCode) {
this.form.customerName = this.customerOptions.find(
(v) => this.form.customerCode === v.KUNNR
).NAME
}
if (this.form.brandCode) {
this.form.brandName = this.brandOptions.find(
(v) => this.form.brandCode === v.brandCode
).brandName
}
if (this.form.templateId) {
const template = this.templateOptions.find(
(v) => this.form.templateId === v.id
)
this.form.templateName = template.name
this.form.templateType = template.reportType
this.form.templateCode = template.id + ''
}
if (this.form.id != null) {
updateCustomerLabel(this.form).then((response) => {
this.$modal.msgSuccess('修改成功')
this.open = false
this.getList()
})
} else {
addCustomerLabel(this.form).then((response) => {
this.$modal.msgSuccess('新增成功')
this.open = false
this.getList()
})
}
}
},
/** 查询客户产品标签模板对照表列表 */
getList() {
this.loading = true
listlpnrecord(this.queryParams).then((response) => {
this.scheduleSetupRuleList = response.rows
this.total = response.total
this.loading = false
})
},
/** 删除按钮操作 */
handleDelete(row) {
const Ids = row.id || this.ids
this.$modal
.confirm(
'是否确认删除客户产品标签模板对照表编号为"' + Ids + '"的数据项?'
)
.then(function () {
return delcustomerLabel(Ids)
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
itemCode: null,
customerName: null,
brandName: null,
brandCode: null,
brandId: null,
itemId: null,
itemName: null,
itemTypeCode: null,
itemTypeId: null,
itemTypeName: null,
sapItemCode: null,
templateName: null,
templateType: null,
templateCode: null,
templateId: null,
createBy: null,
}
this.resetForm('form')
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
handleSelectProduct() {
this.$refs.itemSelect.showFlag = true
},
handleitemType() {
this.$refs.brSelect.showFlag = true
},
onitemTypeed(row) {
if (Object.values(row).length > 0) {
this.form.itemTypeId = row.itemTypeId
this.form.sapTypeCode = row.sapTypeCode
this.form.itemTypeCode = row.itemTypeCode
this.form.itemTypeName = row.itemTypeName
}
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id)
this.selectedRows = selection
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = '添加客户产品标签模板对照表'
},
/** 修改按钮操作 */
handleUpdate(row) {
if (!row || !row.id) row = this.selectedRows[0]
this.reset()
this.form = row
this.open = true
this.title = '修改客户产品标签模板对照表'
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.form.customerCode) {
this.form.customerName = this.customerOptions.find(
(v) => this.form.customerCode === v.KUNNR
).NAME
}
if (this.form.brandCode) {
this.form.brandName = this.brandOptions.find(
(v) => this.form.brandCode === v.brandCode
).brandName
}
if (this.form.templateId) {
const template = this.templateOptions.find(
(v) => this.form.templateId === v.id
)
this.form.templateName = template.name
this.form.templateType = template.reportType
this.form.templateCode = template.id + ''
}
if (this.form.id != null) {
updateCustomerLabel(this.form).then((response) => {
this.$modal.msgSuccess('修改成功')
this.open = false
this.getList()
})
} else {
addCustomerLabel(this.form).then((response) => {
this.$modal.msgSuccess('新增成功')
this.open = false
this.getList()
})
}
}
.then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
})
},
/** 删除按钮操作 */
handleDelete(row) {
const Ids = row.id || this.ids
this.$modal
.confirm(
'是否确认删除客户产品标签模板对照表编号为"' + Ids + '"的数据项?'
)
.then(function () {
return delcustomerLabel(Ids)
})
.then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
})
.catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download(
'pro/scheduleSetupRule/export',
{
...this.queryParams,
},
`scheduleSetupRule_${new Date().getTime()}.xlsx`
)
},
.catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download(
'pro/scheduleSetupRule/export',
{
...this.queryParams,
},
`scheduleSetupRule_${new Date().getTime()}.xlsx`
)
},
}
</script>
},
}
</script>
\ No newline at end of file
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