|
|
- <template>
- <div>
- <el-popconfirm confirm-button-text='确认' cancel-button-text='取消' icon="el-icon-info" icon-color="red"
- title="确认删除当前数据?" @confirm="deleteRow(rowIndex)">
- <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>
- </template>
- </div>
- </template>
-
- <script>
- import { EventBus } from "@/utils/eventBus";
-
- export default {
- name: "TableOpertaion",
- props: {
- row: {
- type: Object,
- default: () => { },
- },
- columns: {
- type: Array,
- default: [],
- },
- rowIndex: {
- type: Number,
- default: 0,
- },
- fillType: {
- type: String,
- default: "preFill",
- },
- },
-
- mounted() {
- EventBus.$on("subPackageSubmit", (data) => {
- this.onSubPackageSubmit(data)
- })
- },
- methods: {
- // 开始配置
- onStartConfig() {
- this.$emit("startConfig", this.row)
- },
- // 配置完成
- onConfigComplete() {
- this.$emit("configComplete", this.row)
- },
- // 打印标签
- onPrintLabel() {
- this.$emit("printLabel", this.row)
- },
- // 分装
- onSubPackage() {
- console.log(this.row,this.columns,"this.row")
- const {columns,row} = this;
- const col = columns.find((item)=>item.myCodeFields);
- const {myCodeFields} = col;
- const fields = [];
- myCodeFields.forEach((key)=>{
- fields.push(row[key])
- })
- EventBus.$emit("showSubPackageDialog",{mybh:fields.join(""),maxVolume:10,volumeUnit:"ml",rowIndex:this.rowIndex})
- },
- onSubPackageSubmit(data){
- if(data.rowIndex === this.rowIndex){
- console.log(data,"onSubPackageSubmit")
- this.$emit("subPackageSubmit", data)
- }
- },
- // 删除行
- deleteRow(index) {
- this.$emit("deleteRow", index)
- }
- }
- }
- </script>
-
- <style lang="scss" scoped>
- .delete-button{
- color: red;
- }
- </style>
|