|
|
|
@ -5,19 +5,20 @@ |
|
|
|
<el-button v-if="fillType === 'preFill'" slot="reference" type="text" size="small" class="delete-button"> |
|
|
|
删除 |
|
|
|
</el-button> |
|
|
|
|
|
|
|
|
|
|
|
</el-popconfirm> |
|
|
|
<template v-if="fillType === 'actFill'"> |
|
|
|
<el-button type="text" size="small" @click = "onSubPackage">分装</el-button> |
|
|
|
<el-button type="text" size="small" @click = "onStartConfig">开始配置</el-button> |
|
|
|
<el-button type="text" size="small" @click = "onConfigComplete">配置完成</el-button> |
|
|
|
<el-button type="text" size="small" @click = "onPrintLabel">打印标签</el-button> |
|
|
|
<el-button type="text" size="small" @click="onSubPackage">分装</el-button> |
|
|
|
<el-button type="text" size="small" @click="onStartConfig">开始配置</el-button> |
|
|
|
<el-button type="text" size="small" @click="onConfigComplete">配置完成</el-button> |
|
|
|
<el-button type="text" size="small" @click="onPrintLabel">打印标签</el-button> |
|
|
|
</template> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { EventBus } from "@/utils/eventBus"; |
|
|
|
import { addTj } from "@/utils/calUnitTools"; |
|
|
|
|
|
|
|
export default { |
|
|
|
name: "TableOpertaion", |
|
|
|
@ -39,7 +40,7 @@ export default { |
|
|
|
default: "preFill", |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
mounted() { |
|
|
|
EventBus.$on("dialogSubPackageSubmit", (data) => { |
|
|
|
this.onSubPackageSubmit(data) |
|
|
|
@ -53,51 +54,58 @@ export default { |
|
|
|
deep: true, |
|
|
|
} |
|
|
|
}, |
|
|
|
data(){ |
|
|
|
return{ |
|
|
|
data() { |
|
|
|
return { |
|
|
|
innerRow: this.row, |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 开始配置 |
|
|
|
onStartConfig() { |
|
|
|
this.$emit("startConfig", {rowData:this.innerRow,rowIndex:this.rowIndex,headerSelectFields:this.columns.headerSelectFields}) |
|
|
|
this.$emit("startConfig", { rowData: this.innerRow, rowIndex: this.rowIndex, headerSelectFields: this.columns.headerSelectFields }) |
|
|
|
}, |
|
|
|
// 配置完成 |
|
|
|
onConfigComplete() { |
|
|
|
this.$emit("configComplete", {rowData:this.innerRow,rowIndex:this.rowIndex,headerSelectFields:this.columns.headerSelectFields}) |
|
|
|
this.$emit("configComplete", { rowData: this.innerRow, rowIndex: this.rowIndex, headerSelectFields: this.columns.headerSelectFields }) |
|
|
|
}, |
|
|
|
// 打印标签 |
|
|
|
onPrintLabel() { |
|
|
|
this.$emit("printLabel", {rowData:this.innerRow,rowIndex:this.rowIndex,headerSelectFields:this.columns.headerSelectFields}) |
|
|
|
this.$emit("printLabel", { rowData: this.innerRow, rowIndex: this.rowIndex, headerSelectFields: this.columns.headerSelectFields }) |
|
|
|
}, |
|
|
|
// 分装 |
|
|
|
onSubPackage() { |
|
|
|
const {columns,innerRow} = this; |
|
|
|
const {headerSelectFields,columnsData} = columns; |
|
|
|
const col = columnsData.find((item)=>item.myCodeFields); |
|
|
|
const {myCodeFields,maxVolumeField,maxVolumeFieldUnit} = col; |
|
|
|
const fields = []; |
|
|
|
myCodeFields.forEach((key)=>{ |
|
|
|
const { columns, innerRow } = this; |
|
|
|
const { headerSelectFields, columnsData } = columns; |
|
|
|
const col = columnsData.find((item) => item.myCodeFields); |
|
|
|
const { myCodeFields, maxVolumeField, maxVolumeFieldUnit } = col; |
|
|
|
const fields = [], cols = [], units = []; |
|
|
|
myCodeFields.forEach((key) => { |
|
|
|
fields.push(innerRow[key]) |
|
|
|
}); |
|
|
|
let defaultData = {mybh:fields.join(""),maxVolume:innerRow[maxVolumeField],maxVolumeUnit:headerSelectFields[maxVolumeFieldUnit],rowIndex:this.rowIndex} |
|
|
|
if(innerRow.fzsj){ |
|
|
|
maxVolumeField.split(",").forEach((key) => { |
|
|
|
cols.push(innerRow[key] || 0) |
|
|
|
}) |
|
|
|
maxVolumeFieldUnit.split(",").forEach((key) => { |
|
|
|
units.push(headerSelectFields[key]) |
|
|
|
}) |
|
|
|
const {total,unit} = addTj(cols,units) |
|
|
|
let defaultData = { mybh: fields.join(""), maxVolume: total, maxVolumeUnit: unit, rowIndex: this.rowIndex } |
|
|
|
if (innerRow.fzsj) { |
|
|
|
defaultData = innerRow.fzsj |
|
|
|
} |
|
|
|
EventBus.$emit("showSubPackageDialog",defaultData) |
|
|
|
EventBus.$emit("showSubPackageDialog", defaultData) |
|
|
|
}, |
|
|
|
onSubPackageSubmit(data){ |
|
|
|
if(data.rowIndex === this.rowIndex){ |
|
|
|
onSubPackageSubmit(data) { |
|
|
|
if (data.rowIndex === this.rowIndex) { |
|
|
|
this.innerRow.fzsj = data; |
|
|
|
//通知后端保存数据 |
|
|
|
const params = { |
|
|
|
type: "fieldChanged", |
|
|
|
newRecord: null, |
|
|
|
resourceList: null, |
|
|
|
} |
|
|
|
EventBus.$emit('onModifyRecord', params); |
|
|
|
this.$emit("subPackageSubmit", {fzsj:data,rowData:this.innerRow,headerSelectFields:this.columns.headerSelectFields}); |
|
|
|
const params = { |
|
|
|
type: "fieldChanged", |
|
|
|
newRecord: null, |
|
|
|
resourceList: null, |
|
|
|
} |
|
|
|
EventBus.$emit('onModifyRecord', params); |
|
|
|
this.$emit("subPackageSubmit", { fzsj: data, rowData: this.innerRow, headerSelectFields: this.columns.headerSelectFields }); |
|
|
|
} |
|
|
|
}, |
|
|
|
// 删除行 |
|
|
|
@ -109,7 +117,7 @@ export default { |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
.delete-button{ |
|
|
|
color: red; |
|
|
|
.delete-button { |
|
|
|
color: red; |
|
|
|
} |
|
|
|
</style> |