outsourceAddOrEdit.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <ele-modal :visible.sync="visible" :closed="cancel" :title="`${ addOrEditFlag ? '创建' : '编辑'}委外计划`"
  3. custom-class="ele-dialog-form" :close-on-click-modal="true" :close-on-press-escape="false" width="80%">
  4. <div>
  5. <el-form :model="formData" ref="form" label-width="120px" class="ele-body" :rules="rules">
  6. <el-row :gutter="32">
  7. <el-col :span="4">
  8. <el-form-item label="计划名称:">
  9. <el-input clearable v-model="formData.name" placeholder="请输入" />
  10. </el-form-item>
  11. </el-col>
  12. </el-row>
  13. </el-form>
  14. <el-form :model="formData" ref="tableForm">
  15. <ele-pro-table ref="parentTable" :needPage="false" :columns="parentColumns" row-key="id">
  16. <template v-slot:toolbar>
  17. <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon" @click="addOrder">
  18. 添加销售订单
  19. </el-button>
  20. <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon" @click="addPlan">
  21. 添加生产计划
  22. </el-button>
  23. </template>
  24. <template v-slot:expand="{ row, $index }">
  25. <div style="width:calc(100% - 95px); min-height: 60px; margin-left: 95px;" v-if="row.childrenList || row.childrenList.length > 0">
  26. <ele-pro-table :toolbar="false" toolsTheme="none" ref="childTable" :need-page="false"
  27. :datasource="row.childrenList" :columns="childColumns" :key="row.id + '-'+ $index">
  28. </ele-pro-table>
  29. </div>
  30. </template>
  31. </ele-pro-table>
  32. </el-form>
  33. </div>
  34. <orderTablePopup ref="orderTablePopup" @selectOrder="selectOrder"></orderTablePopup>
  35. <planTablePopup ref="planTablePopup" @selectPlan="selectPlan"></planTablePopup>
  36. </ele-modal>
  37. </template>
  38. <script>
  39. import orderTablePopup from './orderTablePopup.vue';
  40. import planTablePopup from './planTablePopup.vue';
  41. export default {
  42. components: {
  43. orderTablePopup,
  44. planTablePopup
  45. },
  46. data() {
  47. return {
  48. visible: false,
  49. addOrEditFlag: true,
  50. formData: {
  51. name: '',
  52. },
  53. rules: {
  54. },
  55. parentColumns: [
  56. {
  57. width: 45,
  58. type: 'expand',
  59. columnKey: 'childrenList',
  60. align: 'center',
  61. slot: 'expand'
  62. },
  63. ],
  64. childColumns: [
  65. ],
  66. tableData: [],
  67. }
  68. },
  69. created() {
  70. },
  71. methods: {
  72. selectOrder(row){
  73. console.log(row);
  74. },
  75. selectPlan(row){
  76. console.log(row);
  77. },
  78. addOrder(){
  79. console.log('addOrder...........');
  80. // this.tableData = this.$refs.parentTable.getData();
  81. this.$refs.orderTablePopup.open();
  82. },
  83. addPlan(){
  84. console.log('addPlan...........');
  85. // this.tableData = this.$refs.parentTable.getData();
  86. this.$refs.planTablePopup.open();
  87. },
  88. open(row){
  89. // 有值为编辑
  90. if(row){
  91. this.addOrEditFlag = false;
  92. }
  93. this.visible = true;
  94. },
  95. cancel() {
  96. this.visible = false;
  97. }
  98. }
  99. }
  100. </script>
  101. <style scoped lang="scss">
  102. </style>