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

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

parent a823a7fd
......@@ -174,7 +174,7 @@
type="primary"
plain
size="mini"
@click="handlePrint"
@click="handleChooseTemplate"
>打印</el-button>
</el-col>
<right-toolbar
......@@ -225,13 +225,24 @@
</el-card>
</el-col>
</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>
</template>
<script>
import { workorderList, buildPackagePrint, workorderPackageList, updatePackagePrintRecord, packagePrintRecordInfo } from "@/api/mes/pro/packageLablePrint";
import templatePrint from '@/views/mes/report/index'
export default {
name: 'packageLablePrint',
components: { templatePrint },
data() {
return {
// 查询参数
......@@ -253,7 +264,8 @@ export default {
packageTotal: 0,
currentData: {},
selectedItemId: null,
selectPackageTable: []
selectPackageTable: [],
visible: false
}
},
created() {
......@@ -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 => {
return {
workorderId : item.workorderId,
......@@ -328,7 +351,17 @@ export default {
packagePrintRecordInfo(params).then((response) => {
console.log(response, 'response')
if (response.code === 200) {
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 @@
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-col v-if="operation" :span="1.5">
<el-button
type="primary"
plain
......@@ -61,8 +61,17 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="listData" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table v-loading="loading" :data="listData" @selection-change="handleSelectionChange" highlight-current-row
@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="reportType" >
<template slot-scope="scope">
......@@ -83,7 +92,7 @@
</template>
</el-table-column>
<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">
<el-button
size="mini"
......@@ -152,6 +161,16 @@ import { listReport, getReport, delReport, addReport, updateReport } from "@/api
export default {
name: "ureport",
dicts: ["sys_report_type","sys_yes_no"],
props: {
type: {
type: String,
default: 'multiple'
},
operation: {
type: Boolean,
default: true
}
},
data() {
return {
// 遮罩层
......@@ -188,7 +207,9 @@ export default {
name: [
{ required: true, message: "模版名称不能为空", trigger: "blur" }
],
}
},
selectedItemId: null,
currentData: {}
};
},
created() {
......@@ -202,6 +223,8 @@ export default {
this.listData = response.rows;
this.total = response.total;
this.loading = false;
this.selectedItemId = null
this.currentData = {}
});
},
// 取消按钮
......@@ -291,6 +314,10 @@ export default {
this.download('ureport/export', {
...this.queryParams
}, `模版模块_${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