'init'
This commit is contained in:
245
src/views/packing-manage/LabelTemplate.vue
Normal file
245
src/views/packing-manage/LabelTemplate.vue
Normal file
@@ -0,0 +1,245 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<head-form :form-config="headFormConfig" @headBtnClick="btnClick" />
|
||||
<base-table
|
||||
:top-btn-config="topBtnConfig"
|
||||
:table-config="tableProps"
|
||||
:table-data="tableDataList"
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
@clickTopBtn="clickTopBtn"
|
||||
>
|
||||
<method-btn slot="handleBtn" :width="calculateWidth" :method-list="tableBtn" @clickBtn="handleClick" />
|
||||
</base-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.current"
|
||||
:limit.sync="listQuery.size"
|
||||
@pagination="getList()"
|
||||
/>
|
||||
|
||||
<TemplateDesignEntry v-if="showTemplateDesignEntry" ref="templateDesignEntry" @destory="handleSearch()" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import TemplateDesignEntry from './components/TemplateDesignEntry.vue'
|
||||
|
||||
const topBtnConfig = [
|
||||
{
|
||||
type: 'add',
|
||||
btnName: 'btn.add'
|
||||
}
|
||||
]
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'view',
|
||||
btnName: 'btn.view'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: i18n.t('module.basicData.factory.createTime'),
|
||||
filter: timeFormatter
|
||||
},
|
||||
{
|
||||
prop: 'code',
|
||||
label: i18n.t('module.packingManage.LabelTemplate.LabelCode')
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: i18n.t('module.packingManage.LabelTemplate.LabelName')
|
||||
},
|
||||
{
|
||||
prop: 'type',
|
||||
label: i18n.t('module.packingManage.LabelTemplate.LabelType'), // type === 1 ? "模组标签" : "等级标签"
|
||||
filter: dataDict('type')
|
||||
},
|
||||
{
|
||||
prop: 'content',
|
||||
label: i18n.t('module.packingManage.LabelTemplate.LabelContent'),
|
||||
|
||||
// filter: handleLimit
|
||||
filter: val => {
|
||||
try {
|
||||
return handleLimit(JSON.parse(val).h)
|
||||
} catch (e) {
|
||||
return handleLimit(val)
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: i18n.t('module.packingManage.LabelTemplate.LabelRemark')
|
||||
}
|
||||
]
|
||||
|
||||
import HeadForm from '@/components/basicData/HeadForm'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
import { page, del } from '@/api/packing-manage/packing-label.js'
|
||||
import i18n from '@/lang'
|
||||
import { getLodop } from '@/assets/libs/LodopFuncs.js'
|
||||
import { timeFormatter, handleLimit } from '@/filters'
|
||||
import dataDict from './dataDict'
|
||||
|
||||
export default {
|
||||
components: { HeadForm, Pagination, BaseTable, MethodBtn, TemplateDesignEntry },
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
showTemplateDesignEntry: false,
|
||||
topBtnConfig,
|
||||
addOrUpdateVisible: false,
|
||||
tableBtn,
|
||||
trueWidth: 200,
|
||||
tableProps,
|
||||
total: 0,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 20,
|
||||
keywords: ''
|
||||
},
|
||||
tableDataList: [],
|
||||
headFormConfig: [
|
||||
{
|
||||
type: 'input',
|
||||
label: i18n.t('module.basicData.visual.keyword'),
|
||||
placeholder:
|
||||
i18n.t('module.packingManage.LabelTemplate.LabelCode') +
|
||||
i18n.t('module.basicData.visual.Or') +
|
||||
i18n.t('module.packingManage.LabelTemplate.LabelName'),
|
||||
param: 'keywords',
|
||||
width: 300
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: 'btn.search',
|
||||
name: 'search',
|
||||
color: 'primary'
|
||||
}
|
||||
],
|
||||
headFormValue: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
calculateWidth() {
|
||||
return this.tableBtn.length * 40 // 操作列的每个按钮宽度40
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.handleSearch()
|
||||
},
|
||||
methods: {
|
||||
handleSearch() {
|
||||
this.listQuery.keywords = this.headFormValue.keywords
|
||||
page({ ...this.listQuery }).then(res => {
|
||||
if (!res.data) {
|
||||
return
|
||||
}
|
||||
this.total = res.data && res.data.total
|
||||
if (!res.data.records) {
|
||||
this.tableDataList = []
|
||||
return
|
||||
}
|
||||
this.tableDataList = res.data.records
|
||||
this.listLoading = false
|
||||
|
||||
this.showTemplateDesignEntry = false
|
||||
})
|
||||
},
|
||||
handleAdd() {
|
||||
this.showTemplateDesignEntry = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.templateDesignEntry.init()
|
||||
})
|
||||
// this.$router.push({
|
||||
// path: '/packing/label-design-add',
|
||||
// query: {
|
||||
// redirect: '/packing/label-template',
|
||||
// title: '标签设计'
|
||||
// }
|
||||
// })
|
||||
},
|
||||
handleEdit(id) {
|
||||
this.showTemplateDesignEntry = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.templateDesignEntry.init(id)
|
||||
})
|
||||
// this.$router.push({
|
||||
// path: '/packing/label-design-add',
|
||||
// query: {
|
||||
// redirect: '/packing/label-template',
|
||||
// title: '标签设计',
|
||||
// id
|
||||
// }
|
||||
// })
|
||||
},
|
||||
handleView(printModel) {
|
||||
const LODOP = getLodop()
|
||||
|
||||
try {
|
||||
// 向后兼容的代码
|
||||
LODOP.ADD_PRINT_DATA('ProgramData', JSON.parse(printModel.content).e) // 装载模板
|
||||
} catch (e) {
|
||||
console.error('主页 handleView 预览时出错!', e)
|
||||
const modelCode = printModel.content
|
||||
LODOP.ADD_PRINT_DATA('ProgramData', modelCode) // 装载模板
|
||||
}
|
||||
// 按类名赋值
|
||||
LODOP.SET_PRINT_STYLEA('name', 'CONTENT', '张三')
|
||||
LODOP.SET_PRINT_STYLEA('code', 'CONTENT', '123455')
|
||||
LODOP.PREVIEW()
|
||||
},
|
||||
handleDelete(id) {
|
||||
this.$confirm(i18n.t('deleteMsgBox.content'), i18n.t('deleteMsgBox.hint'), {
|
||||
confirmButtonText: i18n.t('btn.confirm'),
|
||||
cancelButtonText: i18n.t('btn.cancel'),
|
||||
type: 'warning'
|
||||
}).then(async() => {
|
||||
del({ id }).then(res => {
|
||||
this.listQuery.current = 1
|
||||
this.handleSearch()
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: i18n.t('deleteMsgBox.doneMsg')
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'delete') {
|
||||
this.handleDelete(raw.data.id)
|
||||
} else if (raw.type === 'view') {
|
||||
this.handleView(raw.data)
|
||||
} else {
|
||||
this.handleEdit(raw.data.id)
|
||||
}
|
||||
},
|
||||
clickTopBtn(val) {
|
||||
if (val === 'add') {
|
||||
this.handleAdd() // 新增
|
||||
}
|
||||
},
|
||||
btnClick(val) {
|
||||
this.headFormValue = val
|
||||
// 如果点击的是搜索栏的其他按钮在这里继续写判断
|
||||
if (this.headFormValue.btnName === 'search') {
|
||||
this.handleSearch()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
258
src/views/packing-manage/PackingCost.vue
Normal file
258
src/views/packing-manage/PackingCost.vue
Normal file
@@ -0,0 +1,258 @@
|
||||
<!--
|
||||
* @Author: lb
|
||||
* @Date: 2022-03-24 13:30:00
|
||||
* @LastEditors: gtz
|
||||
* @LastEditTime: 2022-07-25 10:35:49
|
||||
* @Description: 包装费用
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<head-form :form-config="headFormConfig" @headBtnClick="btnClick" />
|
||||
<base-table
|
||||
:top-btn-config="topBtnConfig"
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="orderCostList"
|
||||
@clickTopBtn="clickTopBtn"
|
||||
>
|
||||
<method-btn
|
||||
slot="handleBtn"
|
||||
:width="calculateWidth"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.current"
|
||||
:limit.sync="listQuery.size"
|
||||
@pagination="getList()"
|
||||
/>
|
||||
<packing-cost-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import i18n from '@/lang'
|
||||
import { listMain, deleteMain, orders } from '@/api/packing-manage/PackingCost'
|
||||
import PackingCostAdd from './components/PackingCost-add.vue'
|
||||
|
||||
import HeadForm from '@/components/basicData/HeadForm'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
// import { timeFormatter } from '@/filters'
|
||||
/**
|
||||
* 表格表头配置项 TypeScript接口注释
|
||||
* tableConfig<ConfigItem> = []
|
||||
*
|
||||
* Interface ConfigItem = {
|
||||
* prop: string,
|
||||
* label: string,
|
||||
* width: string,
|
||||
* align: string,
|
||||
* subcomponent: function,
|
||||
* filter: function
|
||||
* }
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const topBtnConfig = [
|
||||
{
|
||||
type: 'add',
|
||||
btnName: 'btn.add'
|
||||
}
|
||||
]
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'detail',
|
||||
btnName: 'btn.detail'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
// {
|
||||
// prop: 'createTime',
|
||||
// label: i18n.t('module.basicData.factory.createTime'),
|
||||
// filter: timeFormatter,
|
||||
//
|
||||
// },
|
||||
{
|
||||
prop: 'orderName',
|
||||
label: i18n.t('module.packingManage.PackingCost.orderName')
|
||||
},
|
||||
{
|
||||
prop: 'orderCode',
|
||||
label: i18n.t('module.packingManage.PackingCost.orderCode')
|
||||
},
|
||||
{
|
||||
prop: 'cost',
|
||||
label: i18n.t('module.packingManage.PackingCost.packageCost')
|
||||
},
|
||||
{
|
||||
prop: 'explainText',
|
||||
label: i18n.t('module.packingManage.PackingCost.packageExplainText')
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: i18n.t('module.packingManage.PackingCost.remark')
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
name: 'PackingCost',
|
||||
components: { Pagination, BaseTable, MethodBtn, HeadForm, PackingCostAdd },
|
||||
filters: {
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
published: 'success',
|
||||
draft: 'info',
|
||||
deleted: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateVisible: false,
|
||||
topBtnConfig,
|
||||
tableBtn,
|
||||
trueWidth: 240,
|
||||
tableProps,
|
||||
orderList: [],
|
||||
orderCostList: [],
|
||||
total: 0,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 20
|
||||
},
|
||||
headFormConfig: [
|
||||
{
|
||||
type: 'autocomplete', // 过滤
|
||||
placeholder: i18n.t('module.packingManage.PackingCost.orderName'),
|
||||
querySearch: (queryString, cb) => {
|
||||
const orderList = this.orderList
|
||||
let result = queryString
|
||||
? orderList.filter(order => order.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
|
||||
: orderList
|
||||
// 需对服务器返回的结果添加一个 value 属性(如果有的话且是你需要的就不用添加)
|
||||
result = result.map(item => ({ ...item, value: item.name }))
|
||||
cb(result)
|
||||
},
|
||||
param: 'orderName',
|
||||
width: 300
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: 'btn.search',
|
||||
name: 'search',
|
||||
color: 'primary'
|
||||
}
|
||||
],
|
||||
headFormValue: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
calculateWidth() {
|
||||
return this.tableBtn.length * 40 // 操作列的每个按钮宽度40
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getOrderList()
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'delete') {
|
||||
this.$confirm(
|
||||
`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.orderName}]?`,
|
||||
this.$t('module.basicData.visual.Tips'),
|
||||
{
|
||||
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
|
||||
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
// 删除主费用,详细费用也会删除
|
||||
deleteMain(raw.data.id).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
} else if (raw.type === 'edit') {
|
||||
this.openEdit(raw.data, false)
|
||||
} else {
|
||||
// 详情
|
||||
this.openEdit(raw.data, true)
|
||||
}
|
||||
},
|
||||
// 获取订单列表
|
||||
getOrderList() {
|
||||
orders().then(res => {
|
||||
if (res.data) {
|
||||
this.orderList = res.data.map(o => ({ id: o.id, name: o.name }))
|
||||
} else {
|
||||
this.orderList.splice(0)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取订单费用列表
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
listMain({ ...this.listQuery, orderName: this.headFormValue.orderName || '' }).then(response => {
|
||||
if (response.data.records) {
|
||||
this.orderCostList = response.data.records
|
||||
} else {
|
||||
this.orderCostList.splice(0)
|
||||
}
|
||||
this.total = response.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
btnClick(val) {
|
||||
this.headFormValue = val
|
||||
if (this.headFormValue.btnName === 'search') {
|
||||
this.getList()
|
||||
}
|
||||
},
|
||||
clickTopBtn(val) {
|
||||
if (val === 'add') {
|
||||
this.addNew()
|
||||
}
|
||||
},
|
||||
// 新增
|
||||
addNew() {
|
||||
this.loadDialog(null, false)
|
||||
},
|
||||
openEdit(data, isdetail) {
|
||||
this.loadDialog(data, isdetail)
|
||||
},
|
||||
loadDialog(data, isdetail) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(data, isdetail)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
819
src/views/packing-manage/PackingList.vue
Normal file
819
src/views/packing-manage/PackingList.vue
Normal file
@@ -0,0 +1,819 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2021-02-27 14:39:57
|
||||
* @LastEditors: gtz
|
||||
* @LastEditTime: 2022-07-25 11:23:06
|
||||
* @Description: 包装/A型货架
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<head-form :form-config="headFormConfig" @headBtnClick="btnClick" />
|
||||
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="packingList"
|
||||
:is-loading="listLoading"
|
||||
@emitFun="handleTableEvents"
|
||||
>
|
||||
<!-- <method-btn
|
||||
slot="handleBtn"
|
||||
:width="trueWidth"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/> -->
|
||||
</base-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.current"
|
||||
:limit.sync="listQuery.size"
|
||||
@pagination="getList()"
|
||||
/>
|
||||
<Packing-list-detail v-if="addOrUpdateVisible" ref="addOrUpdate" @printDetail="printDetail" />
|
||||
|
||||
<!-- 检测信息 -->
|
||||
<inspection-info v-if="showInspectionInfo" ref="inspectionInfo" />
|
||||
|
||||
<!-- 获取批次 -->
|
||||
<batch-binding v-if="showBatchBinding" ref="batchBinding" />
|
||||
|
||||
<!-- 防止打印插件报错 -->
|
||||
<div v-show="false" id="lodopPrintTips" />
|
||||
|
||||
<!-- 打印表格框架 -->
|
||||
<table-for-print
|
||||
v-show="false"
|
||||
ref="tableForPrint"
|
||||
:print-table-config="printTableConfig"
|
||||
@dataReady="startPrint"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HeadForm from '@/components/basicData/HeadForm'
|
||||
import moment from 'moment'
|
||||
import i18n from '@/lang'
|
||||
import { list, getInfo, updatePrint, getOrderList, getShelfList, exportFile } from '@/api/packing-manage/PackingList'
|
||||
import { timeFormatter } from '@/filters'
|
||||
import { getLodop } from '@/assets/libs/LodopFuncs.js'
|
||||
import PackingListDetail from './components/packingList-detail'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import Pagination from '@/components/Pagination'
|
||||
// import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
import commonBtn from '@/components/BaseTable/subcomponents/CommonBtn.vue'
|
||||
import BatchBinding from './components/BatchBinding.vue'
|
||||
import InspectionInfo from './components/InspectionInfo.vue'
|
||||
import TableForPrint from './components/printTable.vue'
|
||||
import { refineData } from '@/utils/helpers'
|
||||
import { chunk } from 'lodash/array'
|
||||
import statusComponent from './components/statusComponent.vue'
|
||||
// const tableBtn = [
|
||||
// {
|
||||
// type: 'detail',
|
||||
// btnName: 'btn.detail'
|
||||
// },
|
||||
// {
|
||||
// type: 'print',
|
||||
// btnName: 'btn.print'
|
||||
// }
|
||||
// ]
|
||||
|
||||
const tableProps = [
|
||||
// {
|
||||
// prop: 'shelfName',
|
||||
// label: i18n.t('module.packingManage.PackingList.shelfId'),
|
||||
// width: 100
|
||||
// },
|
||||
{
|
||||
prop: 'productionLineCode',
|
||||
label: i18n.t('module.packingManage.PackingList.pl')
|
||||
},
|
||||
{
|
||||
prop: 'startTime',
|
||||
label: i18n.t('module.packingManage.PackingList.startTime'),
|
||||
filter: timeFormatter
|
||||
},
|
||||
{
|
||||
prop: 'endTime',
|
||||
label: i18n.t('module.packingManage.PackingList.endTime'),
|
||||
filter: timeFormatter
|
||||
},
|
||||
{
|
||||
prop: 'orderCode',
|
||||
// label: '订单号',
|
||||
label: i18n.t('module.packingManage.PackingList.orderNo')
|
||||
},
|
||||
{
|
||||
prop: 'productName',
|
||||
label: i18n.t('module.packingManage.PackingList.productsName')
|
||||
},
|
||||
{
|
||||
prop: 'productSize',
|
||||
label: i18n.t('module.packingManage.PackingList.productSize')
|
||||
},
|
||||
{
|
||||
prop: 'customerName',
|
||||
label: i18n.t('module.packingManage.PackingList.customerName')
|
||||
},
|
||||
// {
|
||||
// prop: 'dataCode',
|
||||
// label: i18n.t('module.packingManage.PackingList.substrateGrade'),
|
||||
// width: 80
|
||||
// },
|
||||
{
|
||||
prop: 'quantity',
|
||||
label: i18n.t('module.packingManage.PackingList.quantity')
|
||||
},
|
||||
{
|
||||
prop: 'printStatus',
|
||||
label: i18n.t('module.packingManage.PackingList.printStatus'),
|
||||
subcomponent: statusComponent
|
||||
},
|
||||
// {
|
||||
// prop: 'inspection',
|
||||
// label: i18n.t('module.packingManage.PackingList.inspection'),
|
||||
// subcomponent: commonBtn,
|
||||
// buttonContent: i18n.t('module.packingManage.PackingList.inspectionInfo'),
|
||||
// actionName: 'view-inspection-action'
|
||||
// },
|
||||
{
|
||||
prop: 'detail',
|
||||
label: i18n.t('module.packingManage.PackingList.viewDetail'),
|
||||
subcomponent: commonBtn,
|
||||
buttonContent: i18n.t('module.packingManage.PackingList.detail'),
|
||||
actionName: 'view-detail-action'
|
||||
},
|
||||
{
|
||||
prop: 'print-tag',
|
||||
label: i18n.t('module.packingManage.PackingList.printTag'),
|
||||
subcomponent: commonBtn,
|
||||
buttonContent: i18n.t('module.packingManage.PackingList.print'),
|
||||
actionName: 'print-tag-action',
|
||||
emitFullData: true // 打印必需
|
||||
},
|
||||
{
|
||||
prop: 'print-finish',
|
||||
label: i18n.t('module.packingManage.PackingList.finishedTag'),
|
||||
subcomponent: commonBtn,
|
||||
buttonContent: i18n.t('module.packingManage.PackingList.printFinished'),
|
||||
actionName: 'print-finish-action',
|
||||
emitFullData: true // 打印必需
|
||||
},
|
||||
{
|
||||
prop: 'get-batch',
|
||||
label: i18n.t('module.packingManage.PackingList.operation'),
|
||||
subcomponent: commonBtn,
|
||||
buttonContent: i18n.t('module.packingManage.PackingList.getRawMaterialBatch'),
|
||||
emitFullData: true,
|
||||
actionName: 'get-batch-action'
|
||||
}
|
||||
]
|
||||
|
||||
// 时间选择器的快捷选项
|
||||
const pickerOptions = {
|
||||
shortcuts: [
|
||||
{
|
||||
text: i18n.t('module.packingManage.PackingList.today'),
|
||||
onClick(picker) {
|
||||
const base = moment().set({ hour: 0, minute: 0, second: 0 })
|
||||
const start = base.format('YYYY-MM-DDTHH:mm:ss')
|
||||
const end = base.add(1, 'day').format('YYYY-MM-DDTHH:mm:ss')
|
||||
picker.$emit('pick', [new Date(start), new Date(end)])
|
||||
}
|
||||
},
|
||||
{
|
||||
text: i18n.t('module.packingManage.PackingList.threeDaysAgo'),
|
||||
onClick(picker) {
|
||||
const end = moment()
|
||||
.set({ hour: 23, minute: 59, second: 59 })
|
||||
.format('YYYY-MM-DDTHH:mm:ss')
|
||||
const start = moment()
|
||||
.set({ hour: 0, minute: 0, second: 0 })
|
||||
.subtract(2, 'days')
|
||||
.format('YYYY-MM-DDTHH:mm:ss')
|
||||
picker.$emit('pick', [new Date(start), new Date(end)])
|
||||
}
|
||||
},
|
||||
{
|
||||
text: i18n.t('module.packingManage.PackingList.aWeekAgo'),
|
||||
onClick(picker) {
|
||||
const end = moment()
|
||||
.set({ hour: 23, minute: 59, second: 59 })
|
||||
.format('YYYY-MM-DDTHH:mm:ss')
|
||||
const start = moment()
|
||||
.set({ hour: 0, minute: 0, second: 0 })
|
||||
.subtract(6, 'days')
|
||||
.format('YYYY-MM-DDTHH:mm:ss')
|
||||
picker.$emit('pick', [new Date(start), new Date(end)])
|
||||
}
|
||||
},
|
||||
{
|
||||
text: i18n.t('module.packingManage.PackingList.aMonthAgo'),
|
||||
onClick(picker) {
|
||||
const end = moment()
|
||||
.set({ hour: 23, minute: 59, second: 59 })
|
||||
.format('YYYY-MM-DDTHH:mm:ss')
|
||||
const start = moment()
|
||||
.set({ hour: 0, minute: 0, second: 0 })
|
||||
.subtract(1, 'months')
|
||||
.format('YYYY-MM-DDTHH:mm:ss')
|
||||
picker.$emit('pick', [new Date(start), new Date(end)])
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'PackingList',
|
||||
filters: {
|
||||
commonFilter: (source, filterType = a => a) => {
|
||||
return filterType(source)
|
||||
}
|
||||
},
|
||||
components: {
|
||||
HeadForm,
|
||||
BaseTable,
|
||||
Pagination,
|
||||
/** MethodBtn, */ PackingListDetail,
|
||||
BatchBinding,
|
||||
InspectionInfo,
|
||||
TableForPrint
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
timePicker: '',
|
||||
showBatchBinding: false,
|
||||
showInspectionInfo: false,
|
||||
tableProps,
|
||||
// tableBtn,
|
||||
trueWidth: 200,
|
||||
packingList: [],
|
||||
total: 0,
|
||||
listLoading: false,
|
||||
addOrUpdateVisible: false,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 20
|
||||
},
|
||||
orderList: [],
|
||||
orderInput: [],
|
||||
headFormConfig: [
|
||||
{
|
||||
type: 'input',
|
||||
label: i18n.t('module.packingManage.PackingList.orderNo'),
|
||||
placeholder: this.$t('module.packingManage.PackingList.orderNo'),
|
||||
param: 'orderCode'
|
||||
},
|
||||
// {
|
||||
// type: 'select',
|
||||
// label: this.$t('module.packingManage.PackingList.shelfId'),
|
||||
// selectOptions: [],
|
||||
// param: 'shelfId',
|
||||
// width: 200
|
||||
// },
|
||||
{
|
||||
type: 'datePicker',
|
||||
label: this.$t('module.packingManage.PackingList.PackingTime'),
|
||||
dateType: 'daterange',
|
||||
valueFormat: 'yyyy-MM-dd HH:mm:ss', // 解决时间早一天问题
|
||||
rangeSeparator: '-',
|
||||
startPlaceholder: this.$t('module.packingManage.PackingList.startTime'),
|
||||
endPlaceholder: this.$t('module.packingManage.PackingList.endTime'),
|
||||
width: 320,
|
||||
param: 'timeSlot',
|
||||
pickerOptions
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: 'btn.search',
|
||||
name: 'search',
|
||||
color: 'primary'
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: 'btn.export',
|
||||
name: 'export',
|
||||
color: 'success'
|
||||
}
|
||||
],
|
||||
headFormValue: {},
|
||||
printTableConfig: {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 选择快捷时间时的操作
|
||||
timePicker: function(val, oldVal) {
|
||||
const datePickerConfig = this.headFormConfig.find(item => item.param === 'timeSlot')
|
||||
const todayM = moment(new Date()).startOf('day')
|
||||
const today = todayM.format('YYYY-MM-DD HH:mm:ss')
|
||||
// const today = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
|
||||
if (!val) {
|
||||
// 清空值
|
||||
this.$set(datePickerConfig, 'defaultSelect', ['', ''])
|
||||
} else if (val === '0') {
|
||||
// 当天
|
||||
this.$set(datePickerConfig, 'defaultSelect', [today, today])
|
||||
} else if (val === '1') {
|
||||
// 前3天
|
||||
const threeDaysAgo = todayM.subtract(3, 'days').format('YYYY-MM-DD HH:mm:ss')
|
||||
this.$set(datePickerConfig, 'defaultSelect', [threeDaysAgo, today])
|
||||
} else if (val === '2') {
|
||||
// 一周
|
||||
const aWeekAgo = todayM.subtract(7, 'days').format('YYYY-MM-DD HH:mm:ss')
|
||||
this.$set(datePickerConfig, 'defaultSelect', [aWeekAgo, today])
|
||||
} else if (val === '3') {
|
||||
// 一月
|
||||
const aMonthAgo = todayM.subtract(1, 'months').format('YYYY-MM-DD HH:mm:ss')
|
||||
this.$set(datePickerConfig, 'defaultSelect', [aMonthAgo, today])
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getDict()
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
handleTableEvents({ action, data }) {
|
||||
switch (action) {
|
||||
// case 'view-inspection-action':
|
||||
// chosenAction = this.handleViewInspection
|
||||
// break
|
||||
case 'view-detail-action':
|
||||
this.handleViewDetail.call(null, data)
|
||||
return
|
||||
case 'print-tag-action':
|
||||
this.handlePrintTag.call(null, data)
|
||||
return
|
||||
case 'print-finish-action':
|
||||
this.handlePrintFinish.call(null, data)
|
||||
return
|
||||
case 'get-batch-action':
|
||||
this.handleGetBatch.call(null, data)
|
||||
return
|
||||
}
|
||||
},
|
||||
|
||||
// 明细打印
|
||||
printDetail(detailData) {
|
||||
// 获取包装规格
|
||||
const packSpec = this.getPackSpec(detailData.packSpec)?.dataName || '/'
|
||||
|
||||
// 转换原片批次
|
||||
const packagingMaterialDate = detailData.packagingMaterialDate.map(item => item.materialDateName || '')
|
||||
|
||||
// 需要打印的字段
|
||||
const printFields = [
|
||||
'orderName', // 订单名
|
||||
'orderCode', // 订单编码
|
||||
'productSize', // 产品规格
|
||||
'productionLineName', // 产线
|
||||
'quantity', // 数量
|
||||
'endTime', // 完成时间
|
||||
'packagingMaterialDate', // 批次(array)
|
||||
'customerName', // 客户名
|
||||
'packSpec' // 包装规格
|
||||
]
|
||||
|
||||
this.handlePrintAction(
|
||||
this.$t('module.packingManage.PackingList.printDetail'),
|
||||
{
|
||||
...detailData,
|
||||
packSpec,
|
||||
packagingMaterialDate
|
||||
},
|
||||
printFields
|
||||
)
|
||||
},
|
||||
|
||||
handleViewInspection({ id }) {
|
||||
this.showInspectionInfo = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.inspectionInfo.init(id)
|
||||
})
|
||||
},
|
||||
|
||||
handleViewDetail({ id }) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 打印接口
|
||||
* @param {string} title 打印的标题
|
||||
* @param {object} data 打印数据所在的对象
|
||||
* @param {Array} fields 需要打印的字段
|
||||
*/
|
||||
handlePrintAction(title, data, fields = []) {
|
||||
// 名称映射
|
||||
// 有新的就可以往这个map里加
|
||||
const nameMap = {
|
||||
orderName: this.$t('module.packingManage.PackingList.orderName'),
|
||||
orderCode: this.$t('module.packingManage.PackingList.orderCode'),
|
||||
productSize: this.$t('module.packingManage.PackingList.productSpec'),
|
||||
shelfName: this.$t('module.packingManage.PackingList.shelfName'),
|
||||
productionLineName: this.$t('module.packingManage.PackingList.plName'),
|
||||
productionLineCode: this.$t('module.packingManage.PackingList.pl'),
|
||||
quantity: this.$t('module.packingManage.PackingList.quantity'),
|
||||
endTime: this.$t('module.packingManage.PackingList.finishTime'),
|
||||
packagingMaterialDate: this.$t('module.packingManage.PackingList.batch'),
|
||||
customerName: this.$t('module.packingManage.PackingList.customer'),
|
||||
packSpec: this.$t('module.packingManage.PackingList.packSpec'),
|
||||
dataCode: this.$t('module.packingManage.PackingList.grade'),
|
||||
checkPerson: this.$t('module.packingManage.PackingList.checkPerson')
|
||||
}
|
||||
|
||||
// 默认要打印的字段,可通过参数屏蔽
|
||||
const defaultFields = [
|
||||
'orderName', // 订单名
|
||||
'orderCode', // 订单编码
|
||||
'productSize', // 产品规格
|
||||
// 'shelfName', // 货架,箱号
|
||||
// 'productionLineCode', // 产线
|
||||
'quantity', // 数量
|
||||
'endTime', // 完成时间
|
||||
'packagingMaterialDate', // 批次(array)(批次名列表)
|
||||
'customerName', // 客户名
|
||||
'packSpec' // 包装规格
|
||||
// 'dataCode', // 等级,基板等级
|
||||
// 'checkPerson' // 检查员
|
||||
]
|
||||
|
||||
const printFields = fields.length ? fields : defaultFields
|
||||
|
||||
// 数据过滤
|
||||
const prepareToPrint = refineData(data, printFields)
|
||||
|
||||
// 准备二维码内容
|
||||
const content = JSON.stringify(prepareToPrint)
|
||||
console.log('QRcode: ', content)
|
||||
const qrinfo = content
|
||||
// const content = []
|
||||
// for (const key in prepareToPrint) {
|
||||
// if (prepareToPrint[key]) {
|
||||
// if (prepareToPrint[key] instanceof Array) {
|
||||
// // 批次数组单独处理
|
||||
// const dateInfo = prepareToPrint[key].reduce((prev, curr) => {
|
||||
// return prev + '<' + curr.materialDateId + '-' + curr.materialDateName + '>'
|
||||
// }, '')
|
||||
// content.push(`${nameMap[key]}: ${dateInfo}`)
|
||||
// continue
|
||||
// }
|
||||
// content.push(`${nameMap[key]}: ${prepareToPrint[key]}`)
|
||||
// }
|
||||
// }
|
||||
// const qrinfo = content.join('; ')
|
||||
|
||||
// 准备表格数据
|
||||
function generateCols(obj) {
|
||||
const results = []
|
||||
for (const key in obj) {
|
||||
const col = {}
|
||||
// 映射一下字段
|
||||
col.key = nameMap[key]
|
||||
if (!(obj[key] instanceof Array)) {
|
||||
// 非数组型的数据
|
||||
col.value = obj[key]?.toString() || '/' // 没有数据就显示斜杠
|
||||
} else {
|
||||
// 数组类型的数据处理
|
||||
if (obj[key].every(item => typeof item === 'string')) {
|
||||
// 字符串数组
|
||||
col.value = obj[key].join(', ')
|
||||
} else {
|
||||
// 对象数组
|
||||
const arrayString = []
|
||||
obj[key].forEach(item => {
|
||||
arrayString.push(`<${item.materialDateId}:${item.materialDateName ? item.materialDateName : '-'}>`)
|
||||
})
|
||||
col.value = arrayString.join(',\r\n')
|
||||
}
|
||||
}
|
||||
results.push(col)
|
||||
}
|
||||
return results
|
||||
}
|
||||
|
||||
// 把 fields 分割成两两组队
|
||||
const rowsArray = chunk(Object.keys(prepareToPrint), 2)
|
||||
// 对齐数据
|
||||
if (rowsArray.length % 2 !== 0) rowsArray[rowsArray.length - 1].push(null)
|
||||
|
||||
// 准备行列数据
|
||||
const rows = []
|
||||
rowsArray.forEach(row => {
|
||||
// console.log('printing----row: ', refineData(prepareToPrint, row))
|
||||
// 不是用来对齐的空数据就过滤
|
||||
rows.push({ cols: generateCols(refineData(prepareToPrint, row)) })
|
||||
})
|
||||
|
||||
// 创建配置文件
|
||||
this.printTableConfig = {
|
||||
title,
|
||||
qrinfo,
|
||||
rows
|
||||
}
|
||||
|
||||
// 格式如下:
|
||||
// this.printTableConfig = {
|
||||
// title: '测试打印',
|
||||
// qrinfo: 'qrinfo',
|
||||
// rows: [
|
||||
// {
|
||||
// cols: [
|
||||
// {
|
||||
// key: 'T1-1',
|
||||
// value: 'D1-1'
|
||||
// },
|
||||
// {
|
||||
// key: 'T1-2',
|
||||
// value: 'D1-2'
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// cols: [
|
||||
// {
|
||||
// key: 'T2-1',
|
||||
// value: 'D2-1'
|
||||
// },
|
||||
// {
|
||||
// key: 'T2-2',
|
||||
// value: 'D2-2'
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
|
||||
// 修改打印状态
|
||||
this.changePrintStatus(data.id)
|
||||
},
|
||||
|
||||
changePrintStatus(id) {
|
||||
updatePrint(id).then(res => {
|
||||
if (res.data && res.data.id && res.data.id === id) {
|
||||
// 修改成功
|
||||
const item = this.packingList.find(item => item.id === id)
|
||||
item.printStatus = 1
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
_print(htmlElement) {
|
||||
const PAGE_MARGIN = 20 // px
|
||||
const HTML_CONTENT_MARGIN = 40 // px
|
||||
// const HTML_CONTENT_HEIGHT = +htmlElement.querySelector('#height').innerText.trim() || 500 // px,按需要计算
|
||||
const LODOP = getLodop()
|
||||
LODOP.PRINT_INIT(this.$t('module.packingManage.PackingList.print'))
|
||||
|
||||
LODOP.ADD_PRINT_RECT(
|
||||
`${PAGE_MARGIN}px`,
|
||||
`${PAGE_MARGIN}px`,
|
||||
`RightMargin: ${PAGE_MARGIN}px`,
|
||||
`BottomMargin: ${PAGE_MARGIN}px`,
|
||||
0,
|
||||
1
|
||||
)
|
||||
|
||||
// 打印二维码,首先打印,可抵消表格高度不确定的副作用
|
||||
LODOP.ADD_PRINT_BARCODE(
|
||||
`${HTML_CONTENT_MARGIN}px`,
|
||||
`${HTML_CONTENT_MARGIN}px`,
|
||||
150,
|
||||
150,
|
||||
'QRCode',
|
||||
htmlElement.lastChild.innerText
|
||||
)
|
||||
|
||||
const TableTop = +HTML_CONTENT_MARGIN + 150 + 10
|
||||
LODOP.ADD_PRINT_HTM(
|
||||
`${TableTop}px`,
|
||||
`${HTML_CONTENT_MARGIN}px`,
|
||||
`RightMargin: ${HTML_CONTENT_MARGIN}px`,
|
||||
// `BottomMargin: ${CONTENT_MARGIN}px`,
|
||||
// `${HTML_CONTENT_HEIGHT}px`,
|
||||
'100%',
|
||||
htmlElement.innerHTML
|
||||
)
|
||||
|
||||
// LODOP.SET_PRINT_PAGESIZE(3,1385,55,"");
|
||||
LODOP.PREVIEW()
|
||||
},
|
||||
startPrint(htmlElement) {
|
||||
this._print(htmlElement)
|
||||
},
|
||||
|
||||
// 获取原片批次
|
||||
async getBatchList(recordId) {
|
||||
const recordDetail = await getInfo({ id: recordId })
|
||||
const materialBatchList = recordDetail.data ? recordDetail.data.packagingMaterialDate : []
|
||||
return materialBatchList
|
||||
},
|
||||
|
||||
// 获取包装规格
|
||||
getPackSpec(packSpec) {
|
||||
const dictList =
|
||||
this.$store.getters.dictList.find(item => item.dictTypeId === '1522121700583342082')?.dataList || []
|
||||
return dictList.find(item => item.dataCode === packSpec)
|
||||
},
|
||||
|
||||
async handlePrintFinish(data) {
|
||||
if (!data.id) {
|
||||
console.error('Error: handlePrintFinish, no "data.id"')
|
||||
console.log('data is:', data)
|
||||
return
|
||||
}
|
||||
// 获取包装规格
|
||||
const packSpec = this.getPackSpec(data.packSpec)?.dataName || '/'
|
||||
|
||||
// 获取原片批次
|
||||
const materialBatchList = await this.getBatchList(data.id)
|
||||
// console.log('materialBatchList:', materialBatchList)
|
||||
const materialBatchNameList = materialBatchList.map(item => item.materialDateName || '') // 只剩批次名
|
||||
// console.log('handle print tag: ', materialBatchNameList) // 只剩批次名
|
||||
// 成品标签打印
|
||||
// 自行安排字段再调用 _print() 即可
|
||||
const printFields = [
|
||||
'orderName', // 订单名
|
||||
'orderCode', // 订单编码
|
||||
'productSize', // 产品规格
|
||||
'productionLineName', // 产线
|
||||
'quantity', // 数量
|
||||
'endTime', // 完成时间
|
||||
'packagingMaterialDate', // 批次(array)
|
||||
'customerName', // 客户名
|
||||
'packSpec' // 包装规格
|
||||
]
|
||||
this.handlePrintAction(
|
||||
this.$t('module.packingManage.PackingList.printFinished'),
|
||||
// this.$t('module.packingManage.PackingList.printFinished'),
|
||||
{ ...data, packagingMaterialDate: materialBatchNameList, packSpec },
|
||||
printFields
|
||||
)
|
||||
},
|
||||
|
||||
async handlePrintTag(data) {
|
||||
if (!data.id) {
|
||||
console.error('Error: handlePrintTag, no "data.id"')
|
||||
console.log('data is:', data)
|
||||
return
|
||||
}
|
||||
// 获取包装规格
|
||||
const packSpec = this.getPackSpec(data.packSpec)?.dataName || '/'
|
||||
|
||||
// 获取原片批次
|
||||
const materialBatchList = await this.getBatchList(data.id)
|
||||
const materialBatchNameList = materialBatchList.map(item => item.materialDateName || '') // 只剩批次名
|
||||
// console.log('handle print tag: ', materialBatchNameList) // 只剩批次名
|
||||
// 成品标签打印
|
||||
// 自行安排字段再调用 _print() 即可
|
||||
const printFields = [
|
||||
'orderName', // 订单名
|
||||
'orderCode', // 订单编码
|
||||
'productSize', // 产品规格
|
||||
'productionLineName', // 产线
|
||||
'quantity', // 数量
|
||||
'endTime', // 完成时间
|
||||
'packagingMaterialDate', // 批次(array)
|
||||
'customerName', // 客户名
|
||||
'packSpec' // 包装规格
|
||||
]
|
||||
this.handlePrintAction(
|
||||
this.$t('module.packingManage.PackingList.printTag'),
|
||||
// this.$t('module.packingManage.PackingList.printFinished'),
|
||||
{ ...data, packagingMaterialDate: materialBatchNameList, packSpec },
|
||||
printFields
|
||||
)
|
||||
},
|
||||
|
||||
handleGetBatch(data) {
|
||||
this.showBatchBinding = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.batchBinding.init(data)
|
||||
})
|
||||
},
|
||||
init() {
|
||||
this.getList()
|
||||
},
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
|
||||
const startTime = this.headFormValue.timeSlot ? this.headFormValue.timeSlot[0] : ''
|
||||
const endTime = this.headFormValue.timeSlot ? this.headFormValue.timeSlot[1] : ''
|
||||
// const shelfId = this.headFormValue.shelfId
|
||||
const orderCode = this.headFormValue.orderCode
|
||||
|
||||
list({ ...this.listQuery, startTime, endTime, /* shelfId, */ orderCode }).then(response => {
|
||||
if (response.data.records) {
|
||||
this.packingList = response.data.records
|
||||
} else {
|
||||
this.packingList.splice(0)
|
||||
}
|
||||
this.total = response.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
|
||||
async getDict() {
|
||||
const result1 = await getShelfList({
|
||||
current: 1,
|
||||
size: 999,
|
||||
enabled: 1
|
||||
})
|
||||
if (result1.code === 0) {
|
||||
this.headFormConfig[1].selectOptions = result1.data.records
|
||||
}
|
||||
const result = await getOrderList({
|
||||
current: 1,
|
||||
size: 999
|
||||
})
|
||||
if (result1.code === 0) {
|
||||
this.orderList = result.data.records
|
||||
this.orderInput = this.orderList.map(item => {
|
||||
return { value: item.code }
|
||||
})
|
||||
}
|
||||
this.getList()
|
||||
},
|
||||
|
||||
exportExcel() {
|
||||
// 构造请求,不复用 listQuery
|
||||
const requestParams = {
|
||||
current: this.listQuery.current,
|
||||
size: this.listQuery.size,
|
||||
enabled: 1,
|
||||
endTime: '',
|
||||
id: '',
|
||||
// shelfId: '',
|
||||
startTime: '',
|
||||
workOrderId: '',
|
||||
workOrderNo: ''
|
||||
}
|
||||
|
||||
// 填充数据
|
||||
requestParams.startTime = this.headFormValue.timeSlot ? this.headFormValue.timeSlot[0] : ''
|
||||
requestParams.endTime = this.headFormValue.timeSlot ? this.headFormValue.timeSlot[1] : ''
|
||||
// requestParams.shelfId = this.headFormValue.shelfId
|
||||
requestParams.workOrderNo = this.headFormValue.workOrderNo
|
||||
|
||||
// 下载文件
|
||||
exportFile(requestParams).then(response => {
|
||||
let fileName = ''
|
||||
const contentDisposition = response.headers['content-disposition']
|
||||
if (contentDisposition) {
|
||||
fileName = contentDisposition.slice(contentDisposition.indexOf('filename=') + 9)
|
||||
}
|
||||
const blob = new Blob([response.data])
|
||||
const reader = new FileReader()
|
||||
reader.readAsDataURL(blob)
|
||||
reader.onload = e => {
|
||||
const a = document.createElement('a')
|
||||
a.download = fileName
|
||||
a.href = e.target.result
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
document.body.removeChild(a)
|
||||
}
|
||||
})
|
||||
},
|
||||
btnClick(val) {
|
||||
this.headFormValue = val
|
||||
// 如果点击的是搜索栏的其他按钮在这里继续写判断
|
||||
if (this.headFormValue.btnName === 'search') {
|
||||
this.getList()
|
||||
} else if (this.headFormValue.btnName === 'export') {
|
||||
this.exportExcel()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-row {
|
||||
margin-top: 16px;
|
||||
/* margin-bottom: 16px; */
|
||||
}
|
||||
|
||||
.quick-selector {
|
||||
display: inline-block;
|
||||
font-weight: 500;
|
||||
padding-top: 5px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.quick-selector::before {
|
||||
display: inline-block;
|
||||
content: '';
|
||||
width: 4px;
|
||||
height: 16px;
|
||||
padding-top: 5px;
|
||||
border-radius: 1px;
|
||||
background-color: #0b58ff;
|
||||
margin-right: 8px;
|
||||
vertical-align: top;
|
||||
}
|
||||
</style>
|
||||
284
src/views/packing-manage/components/AddLablePanel.vue
Normal file
284
src/views/packing-manage/components/AddLablePanel.vue
Normal file
@@ -0,0 +1,284 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row>
|
||||
<el-button type="primary" @click="btnClickDesign">
|
||||
① {{ $t('module.packingManage.LabelTemplate.TemplateDesign') }}
|
||||
</el-button>
|
||||
<el-button type="success" @click="btnClickPrint">
|
||||
{{ $t('module.packingManage.LabelTemplate.TemplatePreview') }}
|
||||
</el-button>
|
||||
<!-- <el-button icon="md-help" @click="btnClickInfo">
|
||||
设计说明
|
||||
</el-button> -->
|
||||
</el-row>
|
||||
|
||||
<el-divider />
|
||||
|
||||
<small-title :size="'md'" style="margin-bottom: 16px;">{{ $t('module.packingManage.LabelTemplate.DesignDetail') }}</small-title>
|
||||
|
||||
<div style="border: 1px solid #dcdfe6; border-radius: 4px; padding: 26px; padding-right: 24px;">
|
||||
<el-form ref="printModel" :model="printModel" :rules="rules" label-width="100px" :class="$style.form">
|
||||
<el-form-item :label="$t('module.packingManage.LabelTemplate.LabelCode')" prop="code" :class="$style['form-item']">
|
||||
<el-input v-model="printModel.code" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.packingManage.LabelTemplate.LabelName')" prop="name" :class="$style['form-item']">
|
||||
<el-input v-model="printModel.name" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.packingManage.LabelTemplate.LabelType')" prop="type" :class="$style['form-item']">
|
||||
<el-select v-model="printModel.type" :class="$style.select" filterable clearable :placeholder="$t('module.packingManage.LabelTemplate.LabelType')">
|
||||
<el-option v-for="item in printModelTypeList" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.packingManage.LabelTemplate.LabelContent')" prop="humanFriendlyContent" :class="$style['form-item-remark']">
|
||||
<el-input
|
||||
v-model="printModel.humanFriendlyContent"
|
||||
:readonly="false"
|
||||
disabled
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 4, maxRows: 8 }"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.packingManage.LabelTemplate.LabelRemark')" prop="remark" :class="$style['form-item-remark']">
|
||||
<el-input v-model="printModel.remark" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row style="text-align: right">
|
||||
<el-button @click="close">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" @click.prevent.stop="handleSubmit('printModel')">
|
||||
{{ 'btn.confirm' | i18nFilter }}
|
||||
</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import i18n from '@/lang'
|
||||
import { add, getInfo, update } from '@/api/packing-manage/packing-label.js'
|
||||
import { getLodop } from '@/assets/libs/LodopFuncs.js'
|
||||
import SmallTitle from '@/components/BaseDrawer/components/SmallTitle.vue'
|
||||
|
||||
export default {
|
||||
name: 'AddLabelPanel',
|
||||
components: {
|
||||
SmallTitle
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// content: '',
|
||||
printModel: {
|
||||
id: '',
|
||||
code: '',
|
||||
name: '',
|
||||
content: '',
|
||||
base64Content: '',
|
||||
humanFriendlyContent: '',
|
||||
type: 1,
|
||||
isDefault: 0,
|
||||
isPreview: 1,
|
||||
state: 'normal',
|
||||
remark: ''
|
||||
},
|
||||
printModelTypeList: [
|
||||
{
|
||||
id: 0,
|
||||
name: i18n.t('module.packingManage.LabelTemplate.CustomTemplate')
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: i18n.t('module.packingManage.LabelTemplate.ModalTemplate')
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: i18n.t('module.packingManage.LabelTemplate.GradeTemplate') // 修改标签类型和主页的数据字典不对应问题
|
||||
}
|
||||
],
|
||||
rules: {
|
||||
code: [
|
||||
{ required: true, message: i18n.t('module.packingManage.LabelTemplate.LabelCodeHint'), trigger: 'blur' },
|
||||
{ min: 1, message: i18n.t('module.packingManage.LabelTemplate.LengthHint'), trigger: 'blur' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: i18n.t('module.packingManage.LabelTemplate.LabelNameHint'), trigger: 'blur' },
|
||||
{ min: 1, message: i18n.t('module.packingManage.LabelTemplate.LengthHint'), trigger: 'blur' }
|
||||
],
|
||||
type: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t('module.basicData.visual.hints.selectTags'),
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
content: [
|
||||
{ required: true, message: i18n.t('module.packingManage.LabelTemplate.LabelContentHint'), trigger: 'blur' },
|
||||
{ min: 1, message: i18n.t('module.packingManage.LabelTemplate.LengthHint'), trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
id: null
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
initDataForm() {
|
||||
this.printModel = {
|
||||
id: null,
|
||||
code: '',
|
||||
name: '',
|
||||
content: '',
|
||||
base64Content: '',
|
||||
humanFriendlyContent: '',
|
||||
type: 1,
|
||||
isDefault: 0,
|
||||
isPreview: 1,
|
||||
state: 'normal',
|
||||
remark: ''
|
||||
}
|
||||
},
|
||||
|
||||
init() {
|
||||
this.initDataForm()
|
||||
this.id = this.$route.query.id
|
||||
|
||||
if (this.id) {
|
||||
getInfo({ id: this.id }).then(res => {
|
||||
if (res.data) {
|
||||
this.printModel = res.data
|
||||
this.afterGetInfo() // 服务器来回数据后,先解析填充一下
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
afterGetInfo() {
|
||||
if (this.printModel.content !== '') {
|
||||
try {
|
||||
// aka. parseLabelContent()
|
||||
// 对打印设计返回来的数据进行解包装,将服务器返回的字符串转为明文和编码
|
||||
// obj: { h: xxx, e: xxx } ===> important, 'h' stands for 'humen' and 'e' stands for 'encodedContent'
|
||||
const strContent = JSON.parse(this.printModel.content)
|
||||
const { h, e } = strContent
|
||||
this.printModel.humanFriendlyContent = h
|
||||
this.printModel.base64Content = e
|
||||
} catch (error) {
|
||||
// 提示开发者
|
||||
console.error('afterGetInfo(): JSON 格式不正确', error)
|
||||
// 提供向后兼容的功能
|
||||
this.printModel.humanFriendlyContent = this.printModel.content
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
beforeSend() {
|
||||
// aka. encodeContent()
|
||||
// 对打印设计返回来的数据进行包装,将明文和编码包装到一起作为字符串上传到服务器
|
||||
this.printModel.content = JSON.stringify({
|
||||
h: this.printModel.humanFriendlyContent,
|
||||
e: this.printModel.base64Content
|
||||
})
|
||||
},
|
||||
|
||||
handleSubmit(formName) {
|
||||
// console.log('handleSubmit')
|
||||
this.$refs[formName].validate(valid => {
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
this.beforeSend() // 发送前的准备事项
|
||||
if (this.id) {
|
||||
update(this.printModel).then(res => {
|
||||
this.close()
|
||||
})
|
||||
} else {
|
||||
add(this.printModel).then(res => {
|
||||
this.close()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.$router.push({ path: this.$route.query.redirect })
|
||||
},
|
||||
|
||||
btnClickDesign() {
|
||||
const LODOP = getLodop()
|
||||
LODOP.PRINT_INIT('初始化打印')
|
||||
LODOP.SET_PRINT_MODE('PROGRAM_CONTENT_BYVAR', true) // 生成程序时,内容参数有变量用变量,无变量用具体值
|
||||
LODOP.SET_SHOW_MODE('DESIGN_IN_BROWSE', 1)
|
||||
LODOP.ADD_PRINT_DATA('ProgramData', this.printModel.base64Content) // 装载模板
|
||||
// this.printModel.content = LODOP.PRINT_DESIGN()
|
||||
LODOP.PRINT_DESIGN()
|
||||
|
||||
if (LODOP.CVERSION) {
|
||||
LODOP.On_Return = (TaskID, Value) => {
|
||||
// console.log('CVERSION')
|
||||
// console.log(typeof Value)
|
||||
// this.$set(this.printModel, humanFriendlyContent, Value)
|
||||
this.printModel.humanFriendlyContent = Value
|
||||
this.$forceUpdate()
|
||||
// console.log('printModel', this.printModel)
|
||||
// this.content = Value
|
||||
// console.log('here: ', this.printModel.humanFriendlyContent)
|
||||
this.getProgramData()
|
||||
}
|
||||
}
|
||||
},
|
||||
getProgramData() {
|
||||
const LODOP = getLodop()
|
||||
// console.log('getProgramData')
|
||||
LODOP.GET_VALUE('ProgramData', 0) // 获得文档式模板
|
||||
// const content = LODOP.GET_VALUE('ProgramData', 0) // 获得文档式模板
|
||||
// console.log('GET_VALUE: ', content)
|
||||
if (LODOP.CVERSION) {
|
||||
LODOP.On_Return = (TaskID, Value) => {
|
||||
// console.log('On_Return Value: ', Value)
|
||||
this.printModel.base64Content = Value
|
||||
}
|
||||
}
|
||||
},
|
||||
btnClickPrint() {
|
||||
const LODOP = getLodop()
|
||||
// const modelCode = this.printModel.content
|
||||
// LODOP.ADD_PRINT_DATA('ProgramData', modelCode) // 装载模板
|
||||
LODOP.ADD_PRINT_DATA('ProgramData', this.printModel.base64Content) // 装载模板
|
||||
// 按类名赋值
|
||||
LODOP.SET_PRINT_STYLEA('name', 'CONTENT', '张三')
|
||||
LODOP.SET_PRINT_STYLEA('code', 'CONTENT', '123455')
|
||||
LODOP.PREVIEW()
|
||||
},
|
||||
btnClickInfo() {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" module>
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
.form {
|
||||
width: 60%;
|
||||
margin-top: 30px;
|
||||
display: flex;
|
||||
flex-flow: wrap;
|
||||
.form-item {
|
||||
width: 50%;
|
||||
}
|
||||
.form-item-remark {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.input {
|
||||
display: flex;
|
||||
margin: 8px 16px 8px 4px;
|
||||
align-items: center;
|
||||
.select {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.select {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
233
src/views/packing-manage/components/BatchBinding.vue
Normal file
233
src/views/packing-manage/components/BatchBinding.vue
Normal file
@@ -0,0 +1,233 @@
|
||||
<!--
|
||||
* @Author: lb
|
||||
* @Date: 2022-04-20 13:13:50
|
||||
* @LastEditors: lb
|
||||
* @LastEditTime: 2022-05-05 13:13:50
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-dialog
|
||||
:visible.sync="visible"
|
||||
:title="$t('module.packingManage.PackingList.batchBinding')"
|
||||
class="dialog"
|
||||
width="45%"
|
||||
:close-on-click-modal="false"
|
||||
@close="close"
|
||||
>
|
||||
<!-- <small-title slot="title">{{ $t('module.packingManage.PackingList.batchBinding') }}</small-title> -->
|
||||
<!-- 表单 -->
|
||||
<el-form ref="dataForm" :model="dataForm">
|
||||
<!-- 批次绑定 -->
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item prop="batch">
|
||||
<el-select
|
||||
v-model="dataForm.selectedBatchId"
|
||||
:placeholder="$i18nForm(['placeholder.select', $t('module.packingManage.PackingList.batch')])"
|
||||
filterable
|
||||
multiple
|
||||
clearable
|
||||
>
|
||||
<el-option v-for="item in batchList" :key="item.id" :label="item.dateName" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<!-- <el-button type="primary" @click="addNew">绑定</el-button> -->
|
||||
<el-button type="primary" @click="addNew">{{ 'btn.bind' | i18nFilter }}</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<!-- 表格 -->
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="selectedBatchList"
|
||||
>
|
||||
<method-btn slot="handleBtn" :width="trueWidth" :method-list="tableBtn" @clickBtn="handleClick" />
|
||||
</base-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.current"
|
||||
:limit.sync="listQuery.size"
|
||||
:page-sizes="[5, 10, 15]"
|
||||
@pagination="getList()"
|
||||
/>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" @click="visible = false">{{ 'btn.confirm' | i18nFilter }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getAvailableList, list, del, add } from '@/api/packing-manage/PackingListMaterialDate'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
import Pagination from '@/components/Pagination'
|
||||
import i18n from '@/lang'
|
||||
// import SmallTitle from '@/components/BaseDrawer/components/SmallTitle.vue'
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
}
|
||||
]
|
||||
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'materialDateName',
|
||||
label: i18n.t('module.packingManage.PackingList.materialBatchName')
|
||||
// label: '物料批次名',
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
components: { BaseTable, MethodBtn, Pagination },
|
||||
data() {
|
||||
return {
|
||||
tableProps,
|
||||
tableBtn,
|
||||
trueWidth: 200,
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: null, // 订单id
|
||||
selectedBatchId: [] // 选择的批次ID, 数组
|
||||
},
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 5
|
||||
},
|
||||
total: 0,
|
||||
selectedBatchList: [],
|
||||
batchList: [],
|
||||
dataRule: {
|
||||
// name: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.department.departmentName')]),
|
||||
// trigger: 'blur'
|
||||
// }
|
||||
// ]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addNew() {
|
||||
if (this.dataForm.selectedBatchId.length <= 0) {
|
||||
return this.$message({
|
||||
message: i18n.t('module.packingManage.PackingList.batchHint'),
|
||||
type: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
|
||||
add({
|
||||
materialDateId: this.dataForm.selectedBatchId,
|
||||
packagingLogId: this.dataForm.id
|
||||
}).then(res => {
|
||||
this.$message({
|
||||
message: '添加成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
getList() {
|
||||
// 获取清单里的批次列表
|
||||
return list({ ...this.listQuery, id: this.dataForm.id }).then(res => {
|
||||
if (res.data.records) this.selectedBatchList = res.data.records
|
||||
else this.selectedBatchList.splice(0)
|
||||
|
||||
this.total = res.data.total || 0
|
||||
})
|
||||
},
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'delete') {
|
||||
this.$confirm(
|
||||
`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.materialDateName}]?`,
|
||||
this.$t('module.basicData.visual.Tips'),
|
||||
{
|
||||
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
|
||||
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
|
||||
type: 'warning'
|
||||
}
|
||||
).then(() => {
|
||||
del(raw.data.id).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
initDataForm() {
|
||||
this.dataForm = {
|
||||
id: null,
|
||||
selectedBatchId: []
|
||||
}
|
||||
},
|
||||
|
||||
initDialog() {
|
||||
this.initDataForm()
|
||||
this.listQuery = {
|
||||
current: 1,
|
||||
size: 5
|
||||
}
|
||||
this.total = 0
|
||||
},
|
||||
|
||||
init(data) {
|
||||
this.initDialog()
|
||||
|
||||
if (!data || !data.id || !data.orderId) {
|
||||
console.error('Error: init batchBinding, no "data" or no "data.id" or no "data.orderId"')
|
||||
return
|
||||
}
|
||||
|
||||
this.dataForm.id = data.id || ''
|
||||
this.visible = true
|
||||
|
||||
// 获取可用批次列表
|
||||
getAvailableList(data.orderId).then(res => {
|
||||
if (res.data.length) this.batchList = res.data
|
||||
else this.batchList.splice(0)
|
||||
})
|
||||
// 获取清单里批次列表
|
||||
this.getList()
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.selectedBatchList.splice(0)
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.visible = false
|
||||
},
|
||||
close() {
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.dialog >>> .el-dialog__body {
|
||||
padding: 30px 24px;
|
||||
}
|
||||
</style>
|
||||
402
src/views/packing-manage/components/InspectionInfo.vue
Normal file
402
src/views/packing-manage/components/InspectionInfo.vue
Normal file
@@ -0,0 +1,402 @@
|
||||
<!--
|
||||
* @Author: lb
|
||||
* @Date: 2022-05-06 09:33:37
|
||||
* @LastEditors: lb
|
||||
* @LastEditTime: 2022-05-06 09:33:37
|
||||
* @specifications: 本页面只用于包装清单检测详情的展示,不会做出修改请求
|
||||
-->
|
||||
<template>
|
||||
<el-drawer :visible.sync="visible" :show-close="false" :wrapper-closable="false" class="drawer" size="60%">
|
||||
<small-title slot="title" :size="'lg'" :no-padding="true">
|
||||
{{ $t('module.packingManage.PackingList.inspectionInfo') }}
|
||||
</small-title>
|
||||
|
||||
<el-divider />
|
||||
|
||||
<div class="content">
|
||||
<div class="visual-part">
|
||||
<el-form
|
||||
ref="dataForm"
|
||||
:model="dataForm"
|
||||
:rules="dataRule"
|
||||
label-width="100px"
|
||||
label-position="top"
|
||||
@keyup.enter.native="dataFormSubmit"
|
||||
>
|
||||
<el-row :gutter="20">
|
||||
<!-- 订单名 * fill-->
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('module.packingManage.PackingList.orderName')" prop="orderName">
|
||||
<el-input
|
||||
v-model="dataForm.orderName"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.packingManage.PackingList.orderName')])"
|
||||
clearable
|
||||
disabled
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 包装箱/货架ID fill-->
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('module.packingManage.PackingList.packageBox')" prop="shelfName">
|
||||
<el-input
|
||||
v-model="dataForm.shelfName"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.packingManage.PackingList.packageBox')])"
|
||||
clearable
|
||||
disabled
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<!-- 产品规格 fill-->
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('module.packingManage.PackingList.productSpec')" prop="productSize">
|
||||
<el-input
|
||||
v-model="dataForm.productSize"
|
||||
:placeholder="$i18nForm(['placeholder.select', $t('module.packingManage.PackingList.productSpec')])"
|
||||
clearable
|
||||
disabled
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 检测人 fill-->
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('module.packingManage.PackingList.checkPerson')" prop="checkPerson">
|
||||
<el-input
|
||||
v-model="dataForm.checkPerson"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.packingManage.PackingList.checkPerson')])"
|
||||
clearable
|
||||
disabled
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<!-- 检测时间(s) fill-->
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('module.packingManage.PackingList.checkTime')" prop="checkTime">
|
||||
<el-date-picker
|
||||
v-model="dataForm.checkTime"
|
||||
style="width: 100%"
|
||||
type="datetime"
|
||||
default-time="12:00:00"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.packingManage.PackingList.checkTime')])"
|
||||
clearable
|
||||
disabled
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- 来源 select-->
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('module.packingManage.PackingList.source')" prop="source">
|
||||
<el-select
|
||||
v-model="dataForm.source"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.packingManage.PackingList.source')])"
|
||||
clearable
|
||||
disabled
|
||||
>
|
||||
<el-option v-for="item in sourceList" :key="item.id" :label="item.value" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<!-- 等级 select-->
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('module.packingManage.PackingList.grade')" prop="dataCode">
|
||||
<el-select
|
||||
v-model="dataForm.dataCode"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.packingManage.PackingList.grade')])"
|
||||
filterable
|
||||
clearable
|
||||
disabled
|
||||
>
|
||||
<el-option
|
||||
v-for="item in substrateGradeList"
|
||||
:key="item.id"
|
||||
:label="item.dataName"
|
||||
:value="item.dataCode"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- 描述 fill-->
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('module.packingManage.PackingList.description')" prop="explainText">
|
||||
<el-input
|
||||
v-model="dataForm.explainText"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.packingManage.PackingList.description')])"
|
||||
clearable
|
||||
disabled
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<small-title :size="'md'">{{ $t('module.packingManage.PackingList.inspectionInfoDetail') }}</small-title>
|
||||
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="inspectionDetailList"
|
||||
>
|
||||
<method-btn v-if="!isdetail" slot="handleBtn" :method-list="tableBtn" @clickBtn="handleClick" />
|
||||
</base-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="listQuery.current" :limit.sync="listQuery.size" />
|
||||
<!-- @pagination="getList" -->
|
||||
</div>
|
||||
|
||||
<div style="position: absolute; bottom: 24px; right: 24px;">
|
||||
<el-button type="info" @click="close">{{ 'btn.back' | i18nFilter }}</el-button>
|
||||
<!-- <el-button type="primary" @click="close">{{ 'btn.confirm' | i18nFilter }}</el-button> -->
|
||||
</div>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import i18n from '@/lang'
|
||||
import { getCheckInfo, removeDetail /** getGradeDatedict */ } from '@/api/packing-manage/PackingList'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
// import productAttrAdd from './ProductAttr-add'
|
||||
import { timeFormatter } from '@/filters'
|
||||
import { refineData } from '@/utils/helpers'
|
||||
import Pagination from '@/components/Pagination'
|
||||
import SmallTitle from '@/components/BaseDrawer/components/SmallTitle.vue'
|
||||
// api/basic/platform-dict/selectPlatformDictDataListByPage
|
||||
// dictTypeId: "1522430769887698945"
|
||||
// res.data.records
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: i18n.t('module.basicData.factory.createTime'),
|
||||
filter: timeFormatter
|
||||
},
|
||||
// {
|
||||
// prop: 'checkTypeId',
|
||||
// label: i18n.t('module.packingManage.PackingList.checkType')
|
||||
// },
|
||||
{
|
||||
prop: 'checkType',
|
||||
label: i18n.t('module.packingManage.PackingList.checkType')
|
||||
},
|
||||
{
|
||||
prop: 'checkDet',
|
||||
label: i18n.t('module.packingManage.PackingList.checkDet')
|
||||
},
|
||||
{
|
||||
prop: 'checkValue',
|
||||
label: i18n.t('module.packingManage.PackingList.checkValue')
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
components: { BaseTable, MethodBtn, SmallTitle, Pagination },
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
addOrUpdateVisible: false,
|
||||
tableBtn,
|
||||
trueWidth: 200,
|
||||
tableProps,
|
||||
inspectionDetailList: [],
|
||||
sourceList: [{ id: 1, value: i18n.t('module.packingManage.PackingList.manual') }, { id: 2, value: 'PDA' }],
|
||||
// 基板等级列表字典
|
||||
substrateGradeList: [],
|
||||
dataForm: {
|
||||
id: null,
|
||||
orderName: '', // 订单名
|
||||
shelfId: '', // 货架ID
|
||||
shelfName: '', // 货架名称
|
||||
productSize: '', // 产品规格
|
||||
checkPerson: '', // 检测人
|
||||
checkTime: '', // 检测时间
|
||||
dataCode: '', // 基板等级
|
||||
explainText: '', // 描述
|
||||
source: 1 // 来源
|
||||
},
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 5
|
||||
},
|
||||
dataRule: {
|
||||
// processTime: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.productPool.processTime')]),
|
||||
// trigger: 'blur'
|
||||
// }
|
||||
// ]
|
||||
},
|
||||
isdetail: false,
|
||||
total: 0
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initDataForm() {
|
||||
this.dataForm = {
|
||||
id: null,
|
||||
orderName: '',
|
||||
shelfId: '',
|
||||
shelfName: '',
|
||||
productSize: '',
|
||||
checkPerson: '',
|
||||
checkTime: '',
|
||||
dataCode: '',
|
||||
explainText: '',
|
||||
source: 1
|
||||
}
|
||||
},
|
||||
fetchGradeList() {
|
||||
const dic = this.$store.getters.dictList.find(item => item.dictTypeId === '1522430769887698945')
|
||||
if (dic && dic.dataList) this.substrateGradeList = dic.dataList
|
||||
else this.substrateGradeList.splice(0)
|
||||
},
|
||||
init(id) {
|
||||
this.initDataForm()
|
||||
this.dataForm.id = id || null
|
||||
this.inspectionDetailList.splice(0)
|
||||
|
||||
// 获取等级数据字典
|
||||
this.fetchGradeList()
|
||||
// getGradeDatedict(this.listQuery).then(res => {
|
||||
// if (res.data.records) {
|
||||
// this.substrateGradeList = res.data.records
|
||||
// } else {
|
||||
// this.substrateGradeList.splice(0)
|
||||
// }
|
||||
// })
|
||||
|
||||
getCheckInfo(id).then(res => {
|
||||
// 可能没有检测记录 - 不过已经被请求模块捕获了
|
||||
if (res.data) {
|
||||
// 当有检测记录时,才展示该窗口
|
||||
this.visible = true
|
||||
// 填充表单
|
||||
this.dataForm = refineData(res.data, [
|
||||
'id',
|
||||
'orderName',
|
||||
'shelfId',
|
||||
'shelfName',
|
||||
'productSize',
|
||||
'checkPerson',
|
||||
'source',
|
||||
'dataCode',
|
||||
'checkTime',
|
||||
'explainText'
|
||||
])
|
||||
|
||||
// 展示列表
|
||||
if (res.data.checkDetList) {
|
||||
this.inspectionDetailList = res.data.checkDetList
|
||||
// console.log('检测信息详情列表:', res.data.checkDetList)
|
||||
} else {
|
||||
this.inspectionDetailList.splice(0)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'delete') {
|
||||
this.$confirm(
|
||||
`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.checkDet}]?`,
|
||||
this.$t('module.basicData.visual.Tips'),
|
||||
{
|
||||
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
|
||||
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
removeDetail(raw.data.id).then(response => {
|
||||
if (response.code === 0 && response.data && response.data.id !== '') {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
//
|
||||
const idx = this.inspectionDetailList.findIndex(item => item.id === raw.data.id)
|
||||
this.inspectionDetailList.splice(idx, 1)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.failed'),
|
||||
type: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
} else {
|
||||
// this.addNew(raw.data.id)
|
||||
}
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {},
|
||||
goEdit() {
|
||||
this.isdetail = false
|
||||
},
|
||||
// 新增 / 修改
|
||||
// addNew(id) {
|
||||
// this.addOrUpdateVisible = true
|
||||
// this.$nextTick(() => {
|
||||
// this.$refs.addOrUpdate.init(id)
|
||||
// })
|
||||
// },
|
||||
close() {
|
||||
this.$emit('refreshDataList')
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.drawer >>> .el-drawer {
|
||||
border-radius: 8px 0 0 8px;
|
||||
}
|
||||
|
||||
.drawer >>> .el-form-item__label {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.drawer >>> .el-drawer__header {
|
||||
padding: 0;
|
||||
margin: 32px 0 8px 32px;
|
||||
}
|
||||
|
||||
.drawer >>> .content {
|
||||
padding: 0 24px 30px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.drawer >>> .visual-part {
|
||||
flex: 1 auto;
|
||||
max-height: 76vh;
|
||||
overflow: hidden;
|
||||
overflow-y: scroll;
|
||||
padding-right: 10px; /* 调整滚动条样式 */
|
||||
}
|
||||
</style>
|
||||
517
src/views/packing-manage/components/PackingCost-add.vue
Normal file
517
src/views/packing-manage/components/PackingCost-add.vue
Normal file
@@ -0,0 +1,517 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: lb
|
||||
* @LastEditTime: 2022-05-07 13:00:00
|
||||
* @Description: 包装费用详情/编辑
|
||||
-->
|
||||
<template>
|
||||
<el-drawer :visible.sync="visible" :show-close="false" :wrapper-closable="false" class="drawer" size="60%">
|
||||
<small-title slot="title" :size="'lg'" :no-padding="true">
|
||||
{{ isdetail ? 'btn.detail' : !dataForm.recordId ? 'btn.add' : 'btn.edit' | i18nFilter }}
|
||||
</small-title>
|
||||
|
||||
<el-divider />
|
||||
|
||||
<div class="content">
|
||||
<div class="visual-part">
|
||||
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px" label-position="top">
|
||||
<!-- @keyup.enter.native="dataFormSubmit" -->
|
||||
<!-- hidden -->
|
||||
<el-form-item style="position:absolute; top: 0; left: 0; height: 0; width: 0; overflow: hidden">
|
||||
<el-select v-model="dataForm.id">
|
||||
<el-option value="1" />
|
||||
</el-select>
|
||||
<!-- 加上上面这个空select把自动出现下拉框屏蔽掉,代价:多渲染一个无用的组件 -->
|
||||
</el-form-item>
|
||||
|
||||
<!-- 第一行:订单名 + 订单编码 -->
|
||||
<el-row :gutter="20">
|
||||
<!-- 订单名 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('module.packingManage.PackingCost.orderName')" prop="orderName">
|
||||
<el-autocomplete
|
||||
ref="autocompleteInput"
|
||||
v-model="dataForm.orderName"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.packingManage.PackingCost.orderName')])"
|
||||
:fetch-suggestions="querySearch"
|
||||
clearable
|
||||
:hide-loading="true"
|
||||
:disabled="isdetail || isedit"
|
||||
:style="{ width: '100%' }"
|
||||
@select="handleOrderSelect"
|
||||
@clear="handleOrderClear"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- 订单编码,自动带出 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('module.packingManage.PackingCost.orderCode')" prop="code">
|
||||
<el-input v-model="dataForm.code" clearable disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 第二行:包装明细描述 + 备注 -->
|
||||
<el-row :gutter="20">
|
||||
<!-- 包装详细描述 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('module.packingManage.PackingCost.packageExplainText')" prop="explainText">
|
||||
<el-input
|
||||
v-model="dataForm.explainText"
|
||||
:placeholder="
|
||||
$i18nForm(['placeholder.input', $t('module.packingManage.PackingCost.packageExplainText')])
|
||||
"
|
||||
:disabled="isdetail"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- 备注 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('module.packingManage.PackingCost.remark')" prop="remark">
|
||||
<el-input
|
||||
v-model="dataForm.remark"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.packingManage.PackingCost.remark')])"
|
||||
:disabled="isdetail"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<small-title :size="'md'">{{ $t('module.packingManage.PackingCost.packageDetail') }}</small-title>
|
||||
|
||||
<!-- 给base-table加一个新增 -->
|
||||
<base-table
|
||||
:top-btn-config="!isdetail ? topBtnConfig : []"
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="dataForm.det"
|
||||
@clickTopBtn="clickTopBtn"
|
||||
>
|
||||
<method-btn
|
||||
v-if="!isdetail"
|
||||
slot="handleBtn"
|
||||
:width="trueWidth"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page-sizes="[5, 10, 15]"
|
||||
:page.sync="listQuery.current"
|
||||
:limit.sync="listQuery.size"
|
||||
@pagination="getList(null)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<packing-cost-attr-add
|
||||
v-if="addOrUpdateVisible"
|
||||
ref="addOrUpdate"
|
||||
:order-id="dataForm.orderId"
|
||||
:record-id="dataForm.recordId"
|
||||
@refreshDataList="getList(null)"
|
||||
@cache-the-det="cacheDet"
|
||||
@update-the-det="updateDet"
|
||||
/>
|
||||
|
||||
<div style="position: absolute; bottom: 24px; right: 24px;">
|
||||
<el-button @click="close()">{{ 'btn.back' | i18nFilter }}</el-button>
|
||||
<el-button v-if="!isdetail" type="primary" @click="save()">{{ 'btn.save' | i18nFilter }}</el-button>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import i18n from '@/lang'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
||||
import PackingCostAttrAdd from './PackingCostAttr-add'
|
||||
// import { timeFormatter } from '@/filters'
|
||||
// import { refineData } from '@/utils/helpers'
|
||||
import Pagination from '@/components/Pagination'
|
||||
import { orders, checkById, deleteDet, detail, add, updateMain } from '@/api/packing-manage/PackingCost'
|
||||
import SmallTitle from '@/components/BaseDrawer/components/SmallTitle.vue'
|
||||
|
||||
const topBtnConfig = [
|
||||
{
|
||||
type: 'add',
|
||||
btnName: 'btn.add'
|
||||
}
|
||||
]
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: 'btn.edit'
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: 'btn.delete'
|
||||
}
|
||||
]
|
||||
const tableProps = [
|
||||
// {
|
||||
// prop: 'createTime',
|
||||
// label: i18n.t('module.basicData.factory.createTime'),
|
||||
// filter: timeFormatter,
|
||||
//
|
||||
// },
|
||||
{
|
||||
prop: 'packagingType',
|
||||
label: i18n.t('module.packingManage.PackingCost.packageType')
|
||||
},
|
||||
{
|
||||
prop: 'cost',
|
||||
label: i18n.t('module.packingManage.PackingCost.costY')
|
||||
},
|
||||
{
|
||||
prop: 'explainText',
|
||||
label: i18n.t('module.packingManage.PackingCost.explainText')
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
components: { BaseTable, MethodBtn, PackingCostAttrAdd, SmallTitle, Pagination },
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
addOrUpdateVisible: false,
|
||||
tableBtn,
|
||||
trueWidth: 200,
|
||||
tableProps,
|
||||
topBtnConfig,
|
||||
costList: [],
|
||||
orderList: [], // 用于过滤的订单列表
|
||||
dataForm: {
|
||||
recordId: null,
|
||||
orderId: null,
|
||||
orderName: '',
|
||||
remark: '',
|
||||
explainText: '',
|
||||
code: '',
|
||||
det: []
|
||||
},
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 5
|
||||
},
|
||||
dataRule: {
|
||||
orderName: [
|
||||
{
|
||||
required: true,
|
||||
message: '此选项必填',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
},
|
||||
isdetail: false,
|
||||
isedit: false,
|
||||
hasRecord: false,
|
||||
total: 0
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
prepareHeadFormData() {
|
||||
// 获取订单列表
|
||||
orders().then(res => {
|
||||
if (res.data) {
|
||||
this.orderList = res.data.map(o => ({ orderId: o.id, orderName: o.name, orderCode: o.code, value: o.name }))
|
||||
} else {
|
||||
this.orderList.splice(0)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
initDataForm() {
|
||||
this.dataForm = {
|
||||
recordId: null,
|
||||
orderId: null,
|
||||
orderName: '',
|
||||
remark: '',
|
||||
explainText: '',
|
||||
code: '',
|
||||
det: []
|
||||
}
|
||||
},
|
||||
|
||||
init(data, isdetail) {
|
||||
// 初始化操作
|
||||
if (!(data || isdetail)) this.prepareHeadFormData()
|
||||
this.initDataForm()
|
||||
this.costList.splice(0)
|
||||
this.listQuery = { current: 1, size: 5 }
|
||||
this.isdetail = !!isdetail
|
||||
this.isedit = false
|
||||
this.visible = true
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.hasRecord = true
|
||||
this.isedit = false
|
||||
this.$refs['dataForm'].resetFields()
|
||||
|
||||
if (data) {
|
||||
// 编辑,外部传入了数据
|
||||
this.isedit = !!data.orderId
|
||||
this.dataForm.orderId = data.orderId
|
||||
this.dataForm.recordId = data.id
|
||||
this.dataForm.orderName = data.orderName
|
||||
this.dataForm.code = data.orderCode
|
||||
this.dataForm.explainText = data.explainText
|
||||
this.dataForm.remark = data.remark
|
||||
|
||||
this.getList()
|
||||
} else {
|
||||
// 新增,设置新增标志位
|
||||
this.hasRecord = false
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
async check() {
|
||||
let recordId = null
|
||||
// 检查是否有详细费用
|
||||
const response = await checkById(this.dataForm.orderId)
|
||||
if (response.data) {
|
||||
this.hasRecord = true
|
||||
recordId = response.data.id
|
||||
// 提示用户订单已存在
|
||||
this.$message({
|
||||
message: '该订单已存在费用明细',
|
||||
duration: 1000,
|
||||
type: 'warning',
|
||||
onClose: () => {
|
||||
// 订单已存在,把订单的 explainText 和 remark 一并保存下来
|
||||
this.dataForm.explainText = response.data.explainText
|
||||
this.dataForm.remark = response.data.remark
|
||||
}
|
||||
})
|
||||
return recordId
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取当前订单(id || this.dataForm.recordId)的详细费用列表
|
||||
*/
|
||||
getList(id = null) {
|
||||
if (this.dataForm.recordId) {
|
||||
// 服务器上有记录
|
||||
const queryId = id || this.dataForm.recordId
|
||||
// this.costList.splice(0)
|
||||
detail({ ...this.listQuery, id: queryId }).then(res => {
|
||||
if (res.data.records) {
|
||||
this.dataForm.det = res.data.records
|
||||
} else {
|
||||
this.dataForm.det.splice(0)
|
||||
}
|
||||
this.total = res.data.total
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'delete') {
|
||||
this.$confirm(
|
||||
`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.packagingType}]?`,
|
||||
this.$t('module.basicData.visual.Tips'),
|
||||
{
|
||||
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
|
||||
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
// 删除 - 要分情况
|
||||
if (this.hasRecord) {
|
||||
deleteDet(raw.data.id).then(res => {
|
||||
this.$message({
|
||||
message: '删除成功!',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
this.deleteDetInCache(raw.data.id)
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
} else {
|
||||
// 编辑
|
||||
this.addNew(raw.data)
|
||||
}
|
||||
},
|
||||
|
||||
goEdit() {
|
||||
this.isdetail = false
|
||||
},
|
||||
|
||||
clickTopBtn(val) {
|
||||
if (val === 'add') {
|
||||
this.addNew(null)
|
||||
}
|
||||
},
|
||||
|
||||
addNew(data) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(data)
|
||||
})
|
||||
},
|
||||
|
||||
// 缓存当前的det记录,只在特定的情况下会被调用,因此下面函数的操作是绝对安全的
|
||||
cacheDet(det) {
|
||||
this.dataForm.det.push(det)
|
||||
},
|
||||
|
||||
// 更新缓存的det记录,只在特定的情况下会被调用,因此下面函数的操作是绝对安全的
|
||||
updateDet(det) {
|
||||
const idx = this.dataForm.det.findIndex(item => item.id === det.id)
|
||||
this.dataForm.det.splice(idx, 1, det)
|
||||
},
|
||||
|
||||
// 删除某条缓存的det记录
|
||||
deleteDetInCache(id) {
|
||||
const idx = this.dataForm.det.findIndex(item => item.id === id)
|
||||
this.dataForm.det.splice(idx, 1)
|
||||
this.$message({
|
||||
message: '删除缓存记录成功!',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
close() {
|
||||
this.orderList.splice(0)
|
||||
this.$emit('refreshDataList')
|
||||
this.visible = false
|
||||
},
|
||||
|
||||
/**
|
||||
* 保存基础信息,不包含详细列表
|
||||
*/
|
||||
save() {
|
||||
this.$refs.dataForm.validate(valid => {
|
||||
if (valid) {
|
||||
const payload = {
|
||||
id: this.dataForm.recordId,
|
||||
explainText: this.dataForm.explainText,
|
||||
orderId: this.dataForm.orderId,
|
||||
remark: this.dataForm.remark
|
||||
}
|
||||
const ajaxAction = this.hasRecord ? updateMain : add
|
||||
|
||||
if (!this.hasRecord) {
|
||||
payload.det = this.dataForm.det.map(item => ({
|
||||
// 清空缓存里的临时id
|
||||
id: null,
|
||||
packagingType: item.packagingType,
|
||||
cost: item.cost,
|
||||
explainText: item.explainText
|
||||
}))
|
||||
}
|
||||
|
||||
ajaxAction(payload).then(res => {
|
||||
if (res.data) {
|
||||
this.$message({
|
||||
message: '保存成功!',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.close()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 订单名的输入过滤
|
||||
*/
|
||||
querySearch(queryString, cb) {
|
||||
const orderList = this.orderList
|
||||
const result =
|
||||
queryString && orderList.length
|
||||
? orderList.filter(order => order.orderName.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
|
||||
: orderList
|
||||
return cb(result)
|
||||
},
|
||||
|
||||
async handleOrderSelect(order) {
|
||||
// 首先清除一些缓存
|
||||
this.dataForm.recordId = null
|
||||
this.costList.splice(0)
|
||||
|
||||
// 填充订单id
|
||||
this.dataForm.orderId = order.orderId
|
||||
|
||||
// 1.修改订单编码
|
||||
this.dataForm.code = order.orderCode
|
||||
// 2.检查订单费用是否存在
|
||||
const recordId = await this.check()
|
||||
|
||||
// 如果存在订单费用记录
|
||||
if (recordId) {
|
||||
this.dataForm.recordId = recordId
|
||||
this.getList()
|
||||
} else {
|
||||
// 是新增
|
||||
this.dataForm.explainText = ''
|
||||
this.dataForm.remark = ''
|
||||
}
|
||||
},
|
||||
|
||||
handleOrderClear() {
|
||||
this.dataForm.code = ''
|
||||
this.dataForm.explainText = ''
|
||||
this.dataForm.remark = ''
|
||||
// 强制失去焦点
|
||||
document.activeElement.blur()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.drawer >>> .el-drawer {
|
||||
border-radius: 8px 0 0 8px;
|
||||
}
|
||||
|
||||
.drawer >>> .el-form-item__label {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.drawer >>> .el-drawer__header {
|
||||
padding: 0;
|
||||
margin: 32px 0 8px 32px;
|
||||
}
|
||||
|
||||
.drawer >>> .content {
|
||||
padding: 0 24px 30px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.drawer >>> .visual-part {
|
||||
flex: 1 auto;
|
||||
max-height: 76vh;
|
||||
overflow: hidden;
|
||||
overflow-y: scroll;
|
||||
padding-right: 10px; /* 调整滚动条样式 */
|
||||
}
|
||||
</style>
|
||||
190
src/views/packing-manage/components/PackingCostAttr-add.vue
Normal file
190
src/views/packing-manage/components/PackingCostAttr-add.vue
Normal file
@@ -0,0 +1,190 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: lb
|
||||
* @LastEditTime: 2022-05-09 13:00:50
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-dialog
|
||||
:visible.sync="visible"
|
||||
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
|
||||
:append-to-body="true"
|
||||
width="30%"
|
||||
class="dialog"
|
||||
@close="close"
|
||||
>
|
||||
<!-- <small-title slot="title">
|
||||
{{ !dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter }}
|
||||
</small-title> -->
|
||||
|
||||
<el-form
|
||||
ref="dataForm"
|
||||
:model="dataForm"
|
||||
:rules="dataRule"
|
||||
label-width="100px"
|
||||
@keyup.enter.native="dataFormSubmit()"
|
||||
>
|
||||
<!-- <el-form-item :label="$t('module.basicData.visual.AttributeName')" prop="name"> -->
|
||||
<el-form-item :label="$t('module.packingManage.PackingCost.packageType')" prop="packagingType">
|
||||
<el-input
|
||||
v-model="dataForm.packagingType"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.packingManage.PackingCost.packageType')])"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.packingManage.PackingCost.cost')" prop="cost">
|
||||
<el-input
|
||||
v-model="dataForm.cost"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.packingManage.PackingCost.cost')])"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.packingManage.PackingCost.explainText')" prop="explainText">
|
||||
<el-input
|
||||
v-model="dataForm.explainText"
|
||||
:placeholder="$i18nForm(['placeholder.input', $t('module.packingManage.PackingCost.explainText')])"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div style="text-align: right">
|
||||
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { updateDet as update, add } from '@/api/packing-manage/PackingCost'
|
||||
import { refineData } from '@/utils/helpers'
|
||||
// import SmallTitle from '@/components/BaseDrawer/components/SmallTitle.vue'
|
||||
|
||||
export default {
|
||||
// components: { SmallTitle },
|
||||
props: {
|
||||
orderId: {
|
||||
type: String,
|
||||
default: null
|
||||
},
|
||||
recordId: {
|
||||
type: String,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: null,
|
||||
packagingType: '',
|
||||
cost: 0,
|
||||
explainText: ''
|
||||
},
|
||||
dataRule: {
|
||||
cost: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$i18nForm(['placeholder.input', this.$t('module.packingManage.PackingCost.cost')]),
|
||||
trigger: 'blur'
|
||||
},
|
||||
{
|
||||
type: 'number',
|
||||
transform: val => Number(val),
|
||||
message: this.$i18nForm(['placeholder.input', this.$t('module.packingManage.PackingCost.costTypeMessage')])
|
||||
}
|
||||
],
|
||||
packagingType: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$i18nForm(['placeholder.input', this.$t('module.packingManage.PackingCost.packageType')]),
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initDataForm() {
|
||||
this.dataForm = {
|
||||
id: null,
|
||||
packagingType: '',
|
||||
cost: 0,
|
||||
explainText: ''
|
||||
}
|
||||
},
|
||||
|
||||
init(data) {
|
||||
// 在上一个页面把详细费用信息传递过来,因为没有相应的接口
|
||||
this.initDataForm()
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
|
||||
if (data) {
|
||||
// 编辑
|
||||
this.dataForm = refineData(data, ['id', 'cost', 'packagingType', 'explainText'])
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 表单提交
|
||||
// 1.如果是新建的费用,新增包装明细后就先缓存
|
||||
// 2.如果是已经有的费用记录,新增包装明细后可以直接调接口
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.recordId) {
|
||||
// 编辑费用记录
|
||||
const ajaxAction = this.dataForm.id ? update : add
|
||||
const payload = this.dataForm.id
|
||||
? {
|
||||
...this.dataForm
|
||||
}
|
||||
: {
|
||||
orderId: this.orderId,
|
||||
det: [
|
||||
{
|
||||
packagingType: this.dataForm.packagingType,
|
||||
cost: this.dataForm.cost,
|
||||
explainText: this.dataForm.explainText
|
||||
}
|
||||
]
|
||||
}
|
||||
ajaxAction(payload).then(res => {
|
||||
this.$message({
|
||||
message: this.$t('module.basicData.visual.success'),
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList', res.data.id)
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
// 新增费用记录
|
||||
if (!this.dataForm.id) {
|
||||
const tempId = Date.now()
|
||||
// 新增本地的包装记录
|
||||
this.dataForm.id = tempId
|
||||
// 把含虚拟id的det记录emit到外层,无论是当前是编辑还是更新
|
||||
this.$emit('cache-the-det', this.dataForm)
|
||||
} else {
|
||||
// 把含虚拟id的det记录emit到外层,无论是当前是编辑还是更新
|
||||
this.$emit('update-the-det', this.dataForm)
|
||||
}
|
||||
this.$emit('refreshDataList')
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.dialog >>> .el-dialog__body {
|
||||
padding: 30px 24px;
|
||||
}
|
||||
</style>
|
||||
302
src/views/packing-manage/components/TemplateDesignEntry.vue
Normal file
302
src/views/packing-manage/components/TemplateDesignEntry.vue
Normal file
@@ -0,0 +1,302 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:visible.sync="visible"
|
||||
:title="$t('module.packingManage.LabelTemplate.DesignDetail')"
|
||||
width="40%"
|
||||
class="template-design-entry-dialog"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<div style="padding-left: 12px; padding-right: 12px;">
|
||||
<el-row :gutter="20" style="margin-bottom: 24px;">
|
||||
<el-col :span="12">
|
||||
<el-button type="primary" style="width: 100%;" @click="btnClickDesign">
|
||||
① {{ $t('module.packingManage.LabelTemplate.TemplateDesign') }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-button type="success" style="width: 100%;" @click="btnClickPrint">
|
||||
{{ $t('module.packingManage.LabelTemplate.TemplatePreview') }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
|
||||
<!-- <el-button icon="md-help" @click="btnClickInfo">
|
||||
设计说明
|
||||
</el-button> -->
|
||||
</el-row>
|
||||
|
||||
<el-form ref="printModel" :model="printModel" :rules="rules" label-position="top">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.packingManage.LabelTemplate.LabelCode')" prop="code">
|
||||
<el-input v-model="printModel.code" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.packingManage.LabelTemplate.LabelName')" prop="name">
|
||||
<el-input v-model="printModel.name" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.packingManage.LabelTemplate.LabelType')" prop="type">
|
||||
<el-select
|
||||
v-model="printModel.type"
|
||||
filterable
|
||||
clearable
|
||||
:placeholder="$t('module.packingManage.LabelTemplate.LabelType')"
|
||||
>
|
||||
<el-option v-for="item in printModelTypeList" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item :label="$t('module.packingManage.LabelTemplate.LabelContent')" prop="humanFriendlyContent">
|
||||
<el-input
|
||||
v-model="printModel.humanFriendlyContent"
|
||||
:readonly="false"
|
||||
disabled
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 4, maxRows: 8 }"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('module.packingManage.LabelTemplate.LabelRemark')" prop="remark">
|
||||
<el-input v-model="printModel.remark" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<el-row style="text-align: right">
|
||||
<el-button @click="close">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" @click.prevent.stop="handleSubmit('printModel')">
|
||||
{{ 'btn.confirm' | i18nFilter }}
|
||||
</el-button>
|
||||
</el-row>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import i18n from '@/lang'
|
||||
import { add, getInfo, update } from '@/api/packing-manage/packing-label.js'
|
||||
import { getLodop } from '@/assets/libs/LodopFuncs.js'
|
||||
// import SmallTitle from '@/components/BaseDrawer/components/SmallTitle.vue'
|
||||
|
||||
export default {
|
||||
name: 'AddLabelPanel',
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
// content: '',
|
||||
printModel: {
|
||||
id: '',
|
||||
code: '',
|
||||
name: '',
|
||||
content: '',
|
||||
base64Content: '',
|
||||
humanFriendlyContent: '',
|
||||
type: 1,
|
||||
isDefault: 0,
|
||||
isPreview: 1,
|
||||
state: 'normal',
|
||||
remark: ''
|
||||
},
|
||||
printModelTypeList: [
|
||||
{
|
||||
id: 0,
|
||||
name: i18n.t('module.packingManage.LabelTemplate.CustomTemplate')
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: i18n.t('module.packingManage.LabelTemplate.ModalTemplate')
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: i18n.t('module.packingManage.LabelTemplate.GradeTemplate') // 修改标签类型和主页的数据字典不对应问题
|
||||
}
|
||||
],
|
||||
rules: {
|
||||
code: [
|
||||
{ required: true, message: i18n.t('module.packingManage.LabelTemplate.LabelCodeHint'), trigger: 'blur' },
|
||||
{ min: 1, message: i18n.t('module.packingManage.LabelTemplate.LengthHint'), trigger: 'blur' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: i18n.t('module.packingManage.LabelTemplate.LabelNameHint'), trigger: 'blur' },
|
||||
{ min: 1, message: i18n.t('module.packingManage.LabelTemplate.LengthHint'), trigger: 'blur' }
|
||||
],
|
||||
type: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t('module.basicData.visual.hints.selectTags'),
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
content: [
|
||||
{ required: true, message: i18n.t('module.packingManage.LabelTemplate.LabelContentHint'), trigger: 'blur' },
|
||||
{ min: 1, message: i18n.t('module.packingManage.LabelTemplate.LengthHint'), trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
id: null
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
initDataForm() {
|
||||
this.printModel = {
|
||||
id: null,
|
||||
code: '',
|
||||
name: '',
|
||||
content: '',
|
||||
base64Content: '',
|
||||
humanFriendlyContent: '',
|
||||
type: 1,
|
||||
isDefault: 0,
|
||||
isPreview: 1,
|
||||
state: 'normal',
|
||||
remark: ''
|
||||
}
|
||||
},
|
||||
|
||||
init(id) {
|
||||
this.initDataForm()
|
||||
this.id = id
|
||||
|
||||
if (id) {
|
||||
getInfo({ id: this.id }).then(res => {
|
||||
if (res.data) {
|
||||
this.printModel = res.data
|
||||
this.afterGetInfo() // 服务器来回数据后,先解析填充一下
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.visible = true
|
||||
})
|
||||
},
|
||||
|
||||
afterGetInfo() {
|
||||
if (this.printModel.content !== '') {
|
||||
try {
|
||||
// aka. parseLabelContent()
|
||||
// 对打印设计返回来的数据进行解包装,将服务器返回的字符串转为明文和编码
|
||||
// obj: { h: xxx, e: xxx } ===> important, 'h' stands for 'humen' and 'e' stands for 'encodedContent'
|
||||
const strContent = JSON.parse(this.printModel.content)
|
||||
const { h, e } = strContent
|
||||
this.printModel.humanFriendlyContent = h
|
||||
this.printModel.base64Content = e
|
||||
} catch (error) {
|
||||
// 提示开发者
|
||||
console.error('afterGetInfo(): JSON 格式不正确', error)
|
||||
// 提供向后兼容的功能
|
||||
this.printModel.humanFriendlyContent = this.printModel.content
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
beforeSend() {
|
||||
// aka. encodeContent()
|
||||
// 对打印设计返回来的数据进行包装,将明文和编码包装到一起作为字符串上传到服务器
|
||||
this.printModel.content = JSON.stringify({
|
||||
h: this.printModel.humanFriendlyContent,
|
||||
e: this.printModel.base64Content
|
||||
})
|
||||
},
|
||||
|
||||
handleSubmit(formName) {
|
||||
// console.log('handleSubmit')
|
||||
this.$refs[formName].validate(valid => {
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
this.beforeSend() // 发送前的准备事项
|
||||
if (this.id) {
|
||||
update(this.printModel).then(res => {
|
||||
this.$message.success({
|
||||
message: '操作成功',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
setTimeout(() => {
|
||||
this.close()
|
||||
}, 300)
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
add(this.printModel).then(res => {
|
||||
this.$message.success({
|
||||
message: '操作成功',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
setTimeout(() => {
|
||||
this.close()
|
||||
}, 300)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
close() {
|
||||
// this.$router.push({ path: this.$route.query.redirect })
|
||||
this.visible = false
|
||||
// this.$nextTick(() => {
|
||||
this.$emit('destory')
|
||||
// })
|
||||
},
|
||||
|
||||
btnClickDesign() {
|
||||
const LODOP = getLodop()
|
||||
LODOP.PRINT_INIT('初始化打印')
|
||||
LODOP.SET_PRINT_MODE('PROGRAM_CONTENT_BYVAR', true) // 生成程序时,内容参数有变量用变量,无变量用具体值
|
||||
LODOP.SET_SHOW_MODE('DESIGN_IN_BROWSE', 1)
|
||||
LODOP.ADD_PRINT_DATA('ProgramData', this.printModel.base64Content) // 装载模板
|
||||
// this.printModel.content = LODOP.PRINT_DESIGN()
|
||||
LODOP.PRINT_DESIGN()
|
||||
|
||||
if (LODOP.CVERSION) {
|
||||
LODOP.On_Return = (TaskID, Value) => {
|
||||
// console.log('CVERSION')
|
||||
// console.log(typeof Value)
|
||||
// this.$set(this.printModel, humanFriendlyContent, Value)
|
||||
this.printModel.humanFriendlyContent = Value
|
||||
this.$forceUpdate()
|
||||
// console.log('printModel', this.printModel)
|
||||
// this.content = Value
|
||||
// console.log('here: ', this.printModel.humanFriendlyContent)
|
||||
this.getProgramData()
|
||||
}
|
||||
}
|
||||
},
|
||||
getProgramData() {
|
||||
const LODOP = getLodop()
|
||||
// console.log('getProgramData')
|
||||
LODOP.GET_VALUE('ProgramData', 0) // 获得文档式模板
|
||||
// const content = LODOP.GET_VALUE('ProgramData', 0) // 获得文档式模板
|
||||
// console.log('GET_VALUE: ', content)
|
||||
if (LODOP.CVERSION) {
|
||||
LODOP.On_Return = (TaskID, Value) => {
|
||||
// console.log('On_Return Value: ', Value)
|
||||
this.printModel.base64Content = Value
|
||||
}
|
||||
}
|
||||
},
|
||||
btnClickPrint() {
|
||||
const LODOP = getLodop()
|
||||
// const modelCode = this.printModel.content
|
||||
// LODOP.ADD_PRINT_DATA('ProgramData', modelCode) // 装载模板
|
||||
LODOP.ADD_PRINT_DATA('ProgramData', this.printModel.base64Content) // 装载模板
|
||||
// 按类名赋值
|
||||
LODOP.SET_PRINT_STYLEA('name', 'CONTENT', '张三')
|
||||
LODOP.SET_PRINT_STYLEA('code', 'CONTENT', '123455')
|
||||
LODOP.PREVIEW()
|
||||
},
|
||||
btnClickInfo() {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.template-design-entry-dialog >>> .el-form--label-top .el-form-item__label {
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
52
src/views/packing-manage/components/detailBtn.vue
Normal file
52
src/views/packing-manage/components/detailBtn.vue
Normal file
@@ -0,0 +1,52 @@
|
||||
<!--
|
||||
* @Date: 2021-01-07 20:09:37
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-07-21 09:05:43
|
||||
* @FilePath:
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<span>
|
||||
<!-- <el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="btnClickPrint"
|
||||
>{{ "btn.print" | i18nFilter }}</el-button> -->
|
||||
<el-button
|
||||
type="text"
|
||||
size="small"
|
||||
@click="emitClick"
|
||||
>
|
||||
{{ 'routerTitle.order.workOrderManage.tagDetail' | i18nFilter }}
|
||||
</el-button>
|
||||
</span>
|
||||
<tag-detail v-if="tagDetailVisible" ref="tagDetail" :packaging-box-id="injectData.id" :order-code="injectData.workOrderNo" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tagDetail from './tagDetail'
|
||||
export default {
|
||||
components: { tagDetail },
|
||||
props: {
|
||||
injectData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tagDetailVisible: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
emitClick() {
|
||||
this.tagDetailVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.tagDetail.init()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
176
src/views/packing-manage/components/packingList-detail.vue
Normal file
176
src/views/packing-manage/components/packingList-detail.vue
Normal file
@@ -0,0 +1,176 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: lb
|
||||
* @LastEditTime: 2022-05-11 10:00:00
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-dialog
|
||||
:visible.sync="visible"
|
||||
:title="'btn.detail' | i18nFilter"
|
||||
class="dialog"
|
||||
width="45%"
|
||||
:close-on-click-modal="false"
|
||||
@close="close"
|
||||
>
|
||||
<!-- <small-title slot="title">{{ 'btn.detail' | i18nFilter }}</small-title> -->
|
||||
|
||||
<el-row>
|
||||
<el-form ref="dataForm" :model="dataForm" :rules="rules" size="medium" label-width="100px" label-position="right">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.packingManage.PackingList.shelfId')">
|
||||
<!-- <el-input disabled>{{ dataForm.shelfName }}</el-input> -->
|
||||
<span class="el-form-item__label" style="font-size: 18px; font-weight: 700">
|
||||
{{ dataForm.shelfName }}
|
||||
</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.packingManage.PackingList.pl')">
|
||||
<span class="el-form-item__label">
|
||||
{{ dataForm.productionLineCode }}
|
||||
</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.packingManage.PackingList.orderNo')">
|
||||
<span class="el-form-item__label">{{ dataForm.orderCode }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.packingManage.PackingList.quantity')">
|
||||
<span class="el-form-item__label">{{ dataForm.quantity }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.packingManage.PackingList.customerName')">
|
||||
<span class="el-form-item__label">{{ dataForm.customerName }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.packingManage.PackingList.finishTime')">
|
||||
<span class="el-form-item__label">
|
||||
{{ dataForm.endTime ? moment(dataForm.endTime).format('YYYY-MM-DD HH:mm:ss') : '' }}
|
||||
</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.packingManage.PackingList.productsName')">
|
||||
<span class="el-form-item__label">{{ dataForm.productName }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('module.packingManage.PackingList.productSize')">
|
||||
<span class="el-form-item__label">{{ dataForm.productSize }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<small-title :size="'md'" :no-padding="true">
|
||||
{{ $t('module.packingManage.PackingList.timeDetail') }}
|
||||
</small-title>
|
||||
|
||||
<el-row>
|
||||
<base-table :table-config="tableProps" :table-data="dataForm.enterTimeList" />
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" @click="handlePrint">{{ $t('module.packingManage.PackingList.print') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import i18n from '@/lang'
|
||||
import moment from 'moment'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import { getInfo } from '@/api/packing-manage/PackingList'
|
||||
import { timeFormatter } from '@/filters'
|
||||
import SmallTitle from '@/components/BaseDrawer/components/SmallTitle.vue'
|
||||
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'id',
|
||||
label: i18n.t('module.packingManage.PackingList.id')
|
||||
},
|
||||
{
|
||||
prop: 'enterTime',
|
||||
label: i18n.t('module.packingManage.PackingList.enterTime'),
|
||||
|
||||
filter: timeFormatter
|
||||
},
|
||||
{
|
||||
prop: 'location',
|
||||
label: i18n.t('module.packingManage.PackingList.location')
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
components: { BaseTable, SmallTitle },
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
endTime: null,
|
||||
customerName: null,
|
||||
productName: null,
|
||||
quantity: null,
|
||||
startTime: null,
|
||||
orderCode: null,
|
||||
shelfName: null,
|
||||
enterTimeList: []
|
||||
},
|
||||
tableProps,
|
||||
listLoading: false,
|
||||
moment,
|
||||
rules: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || ''
|
||||
this.visible = true
|
||||
this.listLoading = true
|
||||
this.$nextTick(() => {
|
||||
if (this.dataForm.id) {
|
||||
getInfo({ id: this.dataForm.id }).then(res => {
|
||||
this.dataForm = res.data
|
||||
console.log(this.dataForm)
|
||||
this.listLoading = false
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handlePrint() {
|
||||
this.$emit('printDetail', this.dataForm)
|
||||
},
|
||||
close() {
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.info {
|
||||
display: inline-block;
|
||||
height: 100%;
|
||||
vertical-align: middle;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.dialog >>> .el-dialog__body {
|
||||
padding: 30px 24px;
|
||||
}
|
||||
</style>
|
||||
73
src/views/packing-manage/components/printTable.vue
Normal file
73
src/views/packing-manage/components/printTable.vue
Normal file
@@ -0,0 +1,73 @@
|
||||
<!--
|
||||
* @Author: lb
|
||||
* @Date: 2022-05-10 14:39:57
|
||||
* @LastEditors: lb
|
||||
* @LastEditTime: 2022-07-25 14:23:06
|
||||
* @Description: 包装/A型货架
|
||||
-->
|
||||
<template>
|
||||
<div v-if="printTableConfig" ref="printTableWrapper" class="print-table">
|
||||
<h1 class="print-table__title">{{ printTableConfig.title }}</h1>
|
||||
|
||||
<table width="80%" cellspacing="0" cellpadding="8" border="1">
|
||||
<tr v-for="(row, outIdx) in printTableConfig.rows" :key="outIdx">
|
||||
<template v-for="(col, InrIdx) in row.cols">
|
||||
<th :key="outIdx + '-' + InrIdx + 'th'" align="center" bgcolor="#c0c0c0">
|
||||
{{ col.key }}
|
||||
</th>
|
||||
<td :key="outIdx + '-' + InrIdx + 'td'" align="center">{{ col.value }}</td>
|
||||
</template>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div id="qrcode" style="visibility: hidden">
|
||||
{{ printTableConfig.qrinfo }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
printTableConfig: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
// title: '默认标题',
|
||||
// qrcode: '默认二维码内容',
|
||||
// rows: []
|
||||
})
|
||||
}
|
||||
},
|
||||
updated() {
|
||||
this.$nextTick(() => {
|
||||
// const innerHTML = this.$refs.printTableWrapper.innerHTML
|
||||
this.$emit('dataReady', this.$refs.printTableWrapper)
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 需注意:使用css设置的表格样式,在打印时不会起作用,必须使用标签自己的属性来设置 */
|
||||
|
||||
/* .print-table__title {
|
||||
display: inline-block;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: 8px;
|
||||
border: 1px solid #000;
|
||||
}
|
||||
|
||||
table th {
|
||||
background-color: #ccc;
|
||||
color: #333;
|
||||
} */
|
||||
</style>
|
||||
25
src/views/packing-manage/components/statusComponent.vue
Normal file
25
src/views/packing-manage/components/statusComponent.vue
Normal file
@@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<el-tag size="mini" :type="status ? 'success' : 'info'">{{ statusText }}</el-tag>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import i18n from '@/lang'
|
||||
export default {
|
||||
props: {
|
||||
injectData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
status() {
|
||||
return +this.injectData[this.injectData.prop]
|
||||
},
|
||||
statusText() {
|
||||
return this.status
|
||||
? i18n.t('module.packingManage.PackingList.printed')
|
||||
: i18n.t('module.packingManage.PackingList.unprinted')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
203
src/views/packing-manage/components/tagDetail.vue
Normal file
203
src/views/packing-manage/components/tagDetail.vue
Normal file
@@ -0,0 +1,203 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2020-12-29 16:37:56
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2021-07-21 09:30:50
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-drawer
|
||||
:append-to-body="true"
|
||||
:show-close="false"
|
||||
:visible.sync="visible"
|
||||
size="55%"
|
||||
>
|
||||
<div
|
||||
slot="title"
|
||||
style=" background-color:#02BCFF;font-size:1.5em;color:white;padding:5px 20px"
|
||||
>
|
||||
{{ "routerTitle.order.workOrderManage.tagDetail" | i18nFilter }}
|
||||
</div>
|
||||
<div id="tablePrint">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span><b>{{ "BOX_ID:" + dataForm.id }}</b></span>
|
||||
<el-button
|
||||
type="primary"
|
||||
style="float:right"
|
||||
size="small"
|
||||
@click="btnClickPrint"
|
||||
>{{ "btn.print" | i18nFilter }}</el-button>
|
||||
</div>
|
||||
<div class="text item">
|
||||
<el-row :gutter="20">
|
||||
<el-col
|
||||
:span="6"
|
||||
><div>{{ "Power:" + dataForm.power }}</div></el-col>
|
||||
<el-col
|
||||
:span="6"
|
||||
><div>{{ "SAP Material:" + dataForm.sapMaterial }}</div></el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-card>
|
||||
<div>
|
||||
<base-table
|
||||
:page="listQuery.current"
|
||||
:limit="listQuery.size"
|
||||
:table-config="tableProps"
|
||||
:table-data="list"
|
||||
:is-loading="listLoading"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import i18n from '@/lang'
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import {
|
||||
packagingDetail,
|
||||
packagingBoxList
|
||||
} from '@/api/orderManage/workOrder/workOrder'
|
||||
// import { timeFormatter } from '@/filters'
|
||||
import { getLodop } from '@/assets/libs/LodopFuncs.js'
|
||||
import { getInfo } from '@/api/packing-manage/packing-label.js'
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'woSubstrateId',
|
||||
label: i18n.t('module.orderManage.packingTags.moduleId'),
|
||||
align: 'center'
|
||||
},
|
||||
// {
|
||||
// prop: 'finishProduceTime',
|
||||
// label: i18n.t('module.orderManage.packingTags.UnloadingTime'),
|
||||
// align: 'center',
|
||||
// filter: timeFormatter
|
||||
// },
|
||||
// {
|
||||
// prop: 'name',
|
||||
// label: i18n.t('module.orderManage.packingTags.UnloadingEquipment'),
|
||||
// align: 'center'
|
||||
// },
|
||||
{
|
||||
prop: 'oneCode',
|
||||
label: i18n.t('module.orderManage.packingTags.oneDimensionalCode'),
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
export default {
|
||||
components: { BaseTable },
|
||||
props: {
|
||||
packagingBoxId: {
|
||||
type: String,
|
||||
default: () => ({})
|
||||
},
|
||||
orderCode: {
|
||||
type: String,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
tableProps,
|
||||
list: [],
|
||||
total: 0,
|
||||
listLoading: false,
|
||||
dataForm: {},
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 500
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.visible = true
|
||||
this.listLoading = true
|
||||
packagingDetail(this.packagingBoxId).then(res => {
|
||||
this.dataForm = res.data
|
||||
})
|
||||
this.getList()
|
||||
},
|
||||
getList() {
|
||||
this.listQuery.packagingBoxId = this.packagingBoxId
|
||||
this.listLoading = true
|
||||
packagingBoxList(this.listQuery).then(response => {
|
||||
if (response.data.records) {
|
||||
this.list = response.data.records
|
||||
} else {
|
||||
this.list.splice(0, this.list.length)
|
||||
}
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
// btnClickPrint() {
|
||||
// const LODOP = getLodop()
|
||||
// const strHTML = document.getElementById('tablePrint').innerHTML
|
||||
// LODOP.ADD_PRINT_HTM(30, 5, '100%', '80%', strHTML) // 装载模板
|
||||
// LODOP.PREVIEW()
|
||||
// },
|
||||
btnClickPrint() {
|
||||
getInfo({ id: '1387070313172353025' }).then(res => {
|
||||
this.printPreview('预览', res.data.content)
|
||||
})
|
||||
},
|
||||
printPreview(name = '预览', modelCode) {
|
||||
const LODOP = getLodop()
|
||||
LODOP.PRINT_INIT(name)
|
||||
const aaa = LODOP.ADD_PRINT_DATA('ProgramData', modelCode)
|
||||
console.log(aaa)
|
||||
const obj = {
|
||||
time: this.dataForm.packagingTime,
|
||||
orderCode: this.orderCode,
|
||||
power: this.dataForm.power,
|
||||
sapMaterial: this.dataForm.sapMaterial,
|
||||
BarCode: this.dataForm.boxNo
|
||||
}
|
||||
this.list.forEach((item, index) => {
|
||||
const str = 'modul' + (index + 1)
|
||||
obj[str] = item.woSubstrateId
|
||||
})
|
||||
console.log(obj)
|
||||
Object.keys(obj).forEach(key => {
|
||||
LODOP.SET_PRINT_STYLEA(key, 'CONTENT', obj[key])
|
||||
})
|
||||
LODOP.NewPageA()
|
||||
LODOP.PREVIEW()
|
||||
},
|
||||
print(name = '打印') {
|
||||
console.log(name, this.currentIndex)
|
||||
// 装载模板
|
||||
const modelCode = this.printModels[this.currentIndex].printModelContent
|
||||
console.log(modelCode)
|
||||
this.objs.forEach(obj => {
|
||||
const LODOP = getLodop() // 调用getLodop获取LODOP对象
|
||||
LODOP.PRINT_INIT(name)
|
||||
const aaa = LODOP.ADD_PRINT_DATA('ProgramData', modelCode)
|
||||
console.log(aaa)
|
||||
obj.partCode = obj.itemCode
|
||||
obj.productTypeName = obj.itemTypeName
|
||||
Object.keys(obj).forEach(key => {
|
||||
LODOP.SET_PRINT_STYLEA(key, 'CONTENT', obj[key])
|
||||
})
|
||||
// LODOP.ADD_PRINT_HTM(10, 10, 350, 600, `--------${index}----------`);
|
||||
LODOP.NewPageA()
|
||||
LODOP.PRINT()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.drawer-footer {
|
||||
width: 100%;
|
||||
margin-top: 50px;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
padding: 10px 50px;
|
||||
text-align: left;
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
31
src/views/packing-manage/components/viewDetailBtn.vue
Normal file
31
src/views/packing-manage/components/viewDetailBtn.vue
Normal file
@@ -0,0 +1,31 @@
|
||||
<!--
|
||||
* @Author: lb
|
||||
* @Date: 2022-3-8 10:00:00
|
||||
* @LastEditors: lb
|
||||
* @LastEditTime: 2022-05-05 10:00:00
|
||||
* @Description: 查看详情的更新版本,更新日期2022.5.5
|
||||
-->
|
||||
<template>
|
||||
<span>
|
||||
<el-button type="text" @click="emitClick">{{ injectData.buttonContent }}</el-button>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
injectData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
emitClick() {
|
||||
this.$emit('emitData', {
|
||||
action: this.injectData.actionName || 'view-detail-action',
|
||||
data: this.injectData.emitFullData ? this.injectData : { id: this.injectData.id }
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
15
src/views/packing-manage/dataDict/index.js
Normal file
15
src/views/packing-manage/dataDict/index.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import i18n from '@/lang'
|
||||
|
||||
const table = {
|
||||
type: {
|
||||
0: '自定义',
|
||||
1: i18n.t('module.packingManage.LabelTemplate.ModuleTag'),
|
||||
2: i18n.t('module.packingManage.LabelTemplate.GradeTag')
|
||||
}
|
||||
}
|
||||
|
||||
export default function(dictTable) {
|
||||
return function(val) {
|
||||
return table?.[dictTable]?.[val]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user