Commit 3a5cfe35 authored by 张海景's avatar 张海景

update:修改包装标签加上选择打印模板

parent a823a7fd
...@@ -174,7 +174,7 @@ ...@@ -174,7 +174,7 @@
type="primary" type="primary"
plain plain
size="mini" size="mini"
@click="handlePrint" @click="handleChooseTemplate"
>打印</el-button> >打印</el-button>
</el-col> </el-col>
<right-toolbar <right-toolbar
...@@ -225,13 +225,24 @@ ...@@ -225,13 +225,24 @@
</el-card> </el-card>
</el-col> </el-col>
</el-row> </el-row>
<!-- 添加或修改生产BOM对话框 -->
<el-dialog title="选择打印模版" :visible.sync="visible" width="960px" append-to-body>
<templatePrint ref="templatePrintRef" v-if="visible" type="single" :operation="false"></templatePrint>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleSubmitPrint">确 定</el-button>
<el-button @click="visible = false">取 消</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { workorderList, buildPackagePrint, workorderPackageList, updatePackagePrintRecord, packagePrintRecordInfo } from "@/api/mes/pro/packageLablePrint"; import { workorderList, buildPackagePrint, workorderPackageList, updatePackagePrintRecord, packagePrintRecordInfo } from "@/api/mes/pro/packageLablePrint";
import templatePrint from '@/views/mes/report/index'
export default { export default {
name: 'packageLablePrint', name: 'packageLablePrint',
components: { templatePrint },
data() { data() {
return { return {
// 查询参数 // 查询参数
...@@ -253,7 +264,8 @@ export default { ...@@ -253,7 +264,8 @@ export default {
packageTotal: 0, packageTotal: 0,
currentData: {}, currentData: {},
selectedItemId: null, selectedItemId: null,
selectPackageTable: [] selectPackageTable: [],
visible: false
} }
}, },
created() { created() {
...@@ -318,7 +330,18 @@ export default { ...@@ -318,7 +330,18 @@ export default {
} }
}); });
}, },
handlePrint() { handleChooseTemplate() {
if (this.selectPackageTable.length === 0) {
this.$message.warning('请至少选择一条数据')
return
}
this.visible = true
},
handleSubmitPrint() {
if (!this.$refs.templatePrintRef.selectedItemId) {
this.$message.warning('请选择打印模版')
return
}
const params = this.selectPackageTable.map(item => { const params = this.selectPackageTable.map(item => {
return { return {
workorderId : item.workorderId, workorderId : item.workorderId,
...@@ -328,7 +351,17 @@ export default { ...@@ -328,7 +351,17 @@ export default {
packagePrintRecordInfo(params).then((response) => { packagePrintRecordInfo(params).then((response) => {
console.log(response, 'response') console.log(response, 'response')
if (response.code === 200) { if (response.code === 200) {
this.getPackageList() const valueList = response.data.packagePrintList.map(item => {
return {
packagePrint: item
}
})
postPrintPdf({
reportName:"mysql:"+ this.$refs.templatePrintRef.currentData.name,
valueList
}).then(()=> {
this.getPackageList()
})
} }
}); });
}, },
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col v-if="operation" :span="1.5">
<el-button <el-button
type="primary" type="primary"
plain plain
...@@ -61,8 +61,17 @@ ...@@ -61,8 +61,17 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="listData" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="listData" @selection-change="handleSelectionChange" highlight-current-row
<el-table-column type="selection" width="55" align="center" /> @current-change="handleCurrentChange">
<el-table-column type="selection" v-if="type === 'multiple'" width="55" align="center" />
<el-table-column width="55" v-else align="center">
<template v-slot="scope">
<!-- 可以手动的修改label的值,从而控制选择哪一项 -->
<el-radio class="radio" v-model="selectedItemId" :label="scope.row.id"
>{{ "" }}</el-radio
>
</template>
</el-table-column>
<el-table-column label="模版名称" align="center" prop="name" /> <el-table-column label="模版名称" align="center" prop="name" />
<el-table-column label="模版类型" align="center" prop="reportType" > <el-table-column label="模版类型" align="center" prop="reportType" >
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -83,7 +92,7 @@ ...@@ -83,7 +92,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" v-if="operation" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
...@@ -152,6 +161,16 @@ import { listReport, getReport, delReport, addReport, updateReport } from "@/api ...@@ -152,6 +161,16 @@ import { listReport, getReport, delReport, addReport, updateReport } from "@/api
export default { export default {
name: "ureport", name: "ureport",
dicts: ["sys_report_type","sys_yes_no"], dicts: ["sys_report_type","sys_yes_no"],
props: {
type: {
type: String,
default: 'multiple'
},
operation: {
type: Boolean,
default: true
}
},
data() { data() {
return { return {
// 遮罩层 // 遮罩层
...@@ -188,7 +207,9 @@ export default { ...@@ -188,7 +207,9 @@ export default {
name: [ name: [
{ required: true, message: "模版名称不能为空", trigger: "blur" } { required: true, message: "模版名称不能为空", trigger: "blur" }
], ],
} },
selectedItemId: null,
currentData: {}
}; };
}, },
created() { created() {
...@@ -202,6 +223,8 @@ export default { ...@@ -202,6 +223,8 @@ export default {
this.listData = response.rows; this.listData = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
this.selectedItemId = null
this.currentData = {}
}); });
}, },
// 取消按钮 // 取消按钮
...@@ -291,6 +314,10 @@ export default { ...@@ -291,6 +314,10 @@ export default {
this.download('ureport/export', { this.download('ureport/export', {
...this.queryParams ...this.queryParams
}, `模版模块_${new Date().getTime()}.xlsx`) }, `模版模块_${new Date().getTime()}.xlsx`)
},
handleCurrentChange(row) {
this.currentData = row
this.selectedItemId = row.id
} }
} }
}; };
......
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