华西海圻ELN前端工程
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.7 KiB

  1. <template>
  2. <div>
  3. <el-popconfirm confirm-button-text='确认' cancel-button-text='取消' icon="el-icon-info" icon-color="red"
  4. title="确认删除当前数据?" @confirm="deleteRow(rowIndex)">
  5. <el-button v-if="fillType === 'preFill'" slot="reference" type="text" size="small" class="delete-button">
  6. 删除
  7. </el-button>
  8. </el-popconfirm>
  9. <template v-if="fillType === 'actFill'">
  10. <el-button type="text" size="small" @click = "onSubPackage">分装</el-button>
  11. <el-button type="text" size="small" @click = "onStartConfig">开始配置</el-button>
  12. <el-button type="text" size="small" @click = "onConfigComplete">配置完成</el-button>
  13. <el-button type="text" size="small" @click = "onPrintLabel">打印标签</el-button>
  14. </template>
  15. </div>
  16. </template>
  17. <script>
  18. import { EventBus } from "@/utils/eventBus";
  19. export default {
  20. name: "TableOpertaion",
  21. props: {
  22. row: {
  23. type: Object,
  24. default: () => { },
  25. },
  26. columns: {
  27. type: Array,
  28. default: [],
  29. },
  30. rowIndex: {
  31. type: Number,
  32. default: 0,
  33. },
  34. fillType: {
  35. type: String,
  36. default: "preFill",
  37. },
  38. },
  39. mounted() {
  40. EventBus.$on("subPackageSubmit", (data) => {
  41. this.onSubPackageSubmit(data)
  42. })
  43. },
  44. methods: {
  45. // 开始配置
  46. onStartConfig() {
  47. this.$emit("startConfig", this.row)
  48. },
  49. // 配置完成
  50. onConfigComplete() {
  51. this.$emit("configComplete", this.row)
  52. },
  53. // 打印标签
  54. onPrintLabel() {
  55. this.$emit("printLabel", this.row)
  56. },
  57. // 分装
  58. onSubPackage() {
  59. console.log(this.row,this.columns,"this.row")
  60. const {columns,row} = this;
  61. const col = columns.find((item)=>item.myCodeFields);
  62. const {myCodeFields} = col;
  63. const fields = [];
  64. myCodeFields.forEach((key)=>{
  65. fields.push(row[key])
  66. })
  67. EventBus.$emit("showSubPackageDialog",{mybh:fields.join(""),maxVolume:10,volumeUnit:"ml",rowIndex:this.rowIndex})
  68. },
  69. onSubPackageSubmit(data){
  70. if(data.rowIndex === this.rowIndex){
  71. console.log(data,"onSubPackageSubmit")
  72. this.$emit("subPackageSubmit", data)
  73. }
  74. },
  75. // 删除行
  76. deleteRow(index) {
  77. this.$emit("deleteRow", index)
  78. }
  79. }
  80. }
  81. </script>
  82. <style lang="scss" scoped>
  83. .delete-button{
  84. color: red;
  85. }
  86. </style>