ysy 1 yıl önce
ebeveyn
işleme
81ee94bf98

+ 1 - 9
src/views/materialPlan/components/plan-edit-dialog.vue

@@ -66,15 +66,7 @@
             添加销售订单
           </el-button>
 
-          <el-button
-            size="small"
-            type="primary"
-            icon="el-icon-plus"
-            class="ele-btn-icon"
-            @click="produceAdd"
-          >
-            添加生产计划
-          </el-button>
+  
 
         </template>
 

+ 411 - 0
src/views/materialPlan/components/produceOrder.vue

@@ -0,0 +1,411 @@
+<template>
+    <el-dialog
+      :title="title"
+      v-if="visible"
+      :visible.sync="visible"
+      :before-close="handleClose"
+      :close-on-click-modal="true"
+      :close-on-press-escape="false"
+      append-to-body
+      width="90%"
+    >
+      <el-card shadow="never">
+        <productionPlanSearch 
+        @search="reload"
+        ref="searchRef"
+        :statusOpt="statusOpt"
+        :planType="planType"
+        :activeName="activeName"
+        />
+  
+        <!-- 数据表格 -->
+        <ele-pro-table
+          ref="table"
+          :columns="columns"
+          :datasource="datasource"
+          :selection.sync="selection"
+          row-key="id"
+        >
+        </ele-pro-table>
+      </el-card>
+  
+      <div class="btns">
+        <el-button type="primary" size="small" @click="selected">选择1</el-button>
+        <el-button size="small" @click="handleClose">关闭</el-button>
+      </div>
+    </el-dialog>
+  </template>
+  
+  <script>
+  import productionPlanSearch from '@/views/productionPlan/components/productionPlan-search.vue';
+    import { getList } from '@/api/productionPlan/index.js';
+    import dictMixins from '@/mixins/dictMixins';
+    export default {
+      components: { productionPlanSearch },
+      mixins: [dictMixins],
+      data() {
+        return {
+          visible: false,
+          title: '生产订单',
+
+          statusOpt: {
+          first: [
+            { label: '所有状态', value: '3,2' },
+            { label: '待发布', value: '2' },
+            { label: '发布失败', value: '3' },
+            { label: '已发布', value: '4' }
+          ],
+          second: [
+            { label: '所有状态', value: '7,4,5,6' },
+            { label: '待生产', value: '4' },
+            { label: '生产中', value: '5' },
+            { label: '已完成', value: '6' },
+            { label: '已延期', value: '7' }
+          ],
+          change: [{ label: '已变更', value: '9' }]
+        },
+        planType: [
+          { label: '所有计划类型', value: null },
+          { label: '内销计划', value: '1' },
+          { label: '外销计划', value: '2' },
+          { label: '预制计划', value: '3' }
+        ],
+
+        activeName: 'first',
+
+  
+          // 表格列配置
+          columns: [
+            {
+              columnKey: 'selection',
+              type: 'selection',
+              width: 45,
+              align: 'center',
+              selectable: (row, index) => {
+                return !this.tableData.some(
+                  (it) => it.id == row.id || it.salesOrderId == row.id
+                );
+              },
+              reserveSelection: true,
+              fixed: 'left'
+            },
+           
+            
+          {
+            slot: 'batchNo',
+            prop: 'batchNo',
+            label: '批次号',
+            align: 'center',
+            minWidth: 140,
+            sortable: true
+          },
+
+          {
+            slot: 'code',
+            prop: 'code',
+            action: 'code',
+            label: '计划编号',
+            align: 'center',
+
+            minWidth: 160,
+            sortable: true
+          },
+
+          {
+            prop: 'salesCode',
+            action: 'salesCode',
+            label: '销售订单号',
+            align: 'center',
+            minWidth: 160
+          },
+
+          {
+            prop: 'productCode',
+            label: '编码',
+            align: 'center',
+
+            minWidth: 140
+          },
+          {
+            prop: 'productName',
+            label: '名称',
+            align: 'center',
+
+            minWidth: 140
+          },
+
+          {
+            prop: 'brandNo',
+            label: '牌号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            minWidth: 150,
+
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'model',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'priority',
+            label: '优先级',
+            align: 'center',
+            minWidth: 120,
+            slot: 'priority',
+            sortable: 'custom'
+          },
+
+          {
+            prop: 'produceRoutingName',
+            label: '工艺路线',
+            align: 'center',
+            width: 140,
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'productNum',
+            label: '计划数量',
+            align: 'center',
+
+            slot: 'productNum'
+          },
+          {
+            prop: 'productWeight',
+            label: '计划重量',
+            align: 'center',
+
+            slot: 'productWeight'
+          },
+          {
+            prop: 'requiredFormingNum',
+            label: '要求生产数量',
+            align: 'center',
+
+            slot: 'requiredFormingNum'
+          },
+
+          {
+            prop: 'newSumOrderWeight',
+            label: '要求生产重量',
+            align: 'center',
+
+            slot: 'newSumOrderWeight'
+          },
+
+          {
+            prop: 'scheduleStatusName',
+            label: '进度状态',
+            align: 'center',
+            minWidth: 100
+          },
+
+          {
+            prop: '',
+            label: '已排产数量',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: '',
+            label: '未排产数量',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: '',
+            label: '已生产数量',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: '',
+            label: '未生产数量',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'factoryName',
+            label: '所属工厂',
+            align: 'center'
+          },
+
+          {
+            prop: '',
+            label: '合格品数',
+            align: 'center'
+          },
+
+          {
+            prop: '',
+            label: '不合格品数',
+            align: 'center'
+          },
+
+          {
+            prop: '',
+            label: '合格率',
+            align: 'center'
+          },
+
+          {
+            prop: 'moCount',
+            label: '模数',
+            align: 'center',
+            show: this.clientEnvironmentId == '4'
+          },
+
+          {
+            prop: 'blockCount',
+            label: '块数',
+            align: 'center',
+            show: this.clientEnvironmentId == '4'
+          },
+          {
+            prop: 'noWordCount',
+            label: '未排程块数',
+            align: 'center',
+
+            show: this.clientEnvironmentId == '4',
+            minWidth: 110
+          },
+          {
+            prop: 'reqMoldTime',
+            label: '计划完成日期',
+            align: 'center',
+            width: 110,
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'startTime',
+            label: '计划开始日期',
+            align: 'center',
+            width: 110,
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'endTime',
+            label: '计划结束日期',
+            align: 'center',
+            width: 110,
+            showOverflowTooltip: true
+          },
+
+
+
+          {
+            prop: 'orderType',
+            label: '计划类型',
+            align: 'center',
+
+            formatter: (row) => {
+              const obj = this.planType.find((i) => i.value == row.planType);
+              return obj && obj.label;
+            }
+          },
+          {
+            prop: 'version',
+            label: '版本',
+            align: 'center',
+
+            minWidth: 80
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            width: 110,
+            showOverflowTooltip: true
+          },
+
+          ],
+  
+          // 表格选中数据
+          selection: [],
+  
+          tableData: [],
+          current: null,
+          planType: [
+          { label: '所有计划类型', value: null },
+          { label: '内销计划', value: '1' },
+          { label: '外销计划', value: '2' },
+          { label: '预制计划', value: '3' }
+        ],
+          
+        };
+      },
+  
+      computed: {
+      clientEnvironmentId() {
+        return this.$store.state.user.info.clientEnvironmentId;
+      },
+    },
+      created() {
+   
+      },
+      methods: {
+        open(item) {
+          if (item) {
+            this.tableData = item;
+          }
+  
+          this.visible = true;
+        },
+  
+        /* 表格数据源 */
+        async datasource({ page, limit, where }) {
+
+          const data = await getList({
+            ...where,
+            pageNum: page,
+            size: limit
+          });
+  
+          return data;
+        },
+  
+        /* 刷新表格 */
+        reload(where) {
+          this.$refs.table.reload({ page: 1, where: where });
+        },
+  
+        handleClose() {
+          this.visible = false;
+          this.$refs.table.setSelectedRows([]);
+          this.selection = [];
+        },
+        selected() {
+          if (!this.selection.length) {
+            this.$message.error('请至少选择一条数据');
+            return;
+          }
+          this.$emit('chooseOrder', this.selection);
+          this.handleClose();
+        }
+      }
+    };
+  </script>
+  
+  <style lang="scss" scoped>
+    .btns {
+      text-align: center;
+      padding: 10px 0;
+    }
+  </style>
+  

+ 794 - 0
src/views/materialPlan/components/producePlan.vue

@@ -0,0 +1,794 @@
+<template>
+    <ele-modal
+      :visible.sync="visible"
+      :closed="cancel"
+      :title="`${type == 'add' ? '创建' : '编辑'}配料计划`"
+      custom-class="ele-dialog-form"
+      :close-on-click-modal="true"
+      :close-on-press-escape="false"
+      width="80%"
+    >
+      <el-form
+        :model="formData"
+        ref="formRef"
+        label-width="120px"
+        class="ele-body"
+        :rules="rules"
+      >
+        <el-row :gutter="24">
+          <el-col :span="8">
+            <el-form-item label="需求类型" prop="demandType">
+              <el-select
+                v-model="formData.demandType"
+                placeholder="请选择"
+                style="width: 100%"
+              >
+                <el-option
+                  v-for="item in demandTypeList"
+                  :key="item.dictCode"
+                  :label="item.dictValue"
+                  :value="item.dictCode"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+  
+          <el-col :span="8">
+            <el-form-item label="计划名称" prop="name">
+              <el-input placeholder="请选择" v-model="formData.name"></el-input>
+            </el-form-item>
+          </el-col>
+  
+          <el-col :span="8">
+            <el-form-item label="备注" prop="remark">
+              <el-input placeholder="备注" v-model="formData.remark"></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+  
+      <el-form :model="formData" ref="tableForm">
+        <ele-pro-table
+          ref="table"
+          :needPage="false"
+          :columns="columns"
+          row-key="id"
+        >
+          <template v-slot:toolbar>
+            <el-button
+              size="small"
+              type="primary"
+              icon="el-icon-plus"
+              class="ele-btn-icon"
+              @click="produceAdd"
+            >
+              添加生产订单
+            </el-button>
+  
+    
+  
+          </template>
+  
+          <template v-slot:code="{ row }">
+            <el-input
+              placeholder="请输入"
+              readonly
+              :value="row.code || row.salesOrderCode"
+            ></el-input>
+          </template>
+  
+          <template v-slot:productionPlanId="{ row }">
+            <el-link
+              type="primary"
+              v-if="!row.productionPlanId"
+              :underline="false"
+              @click.native="openVersion(row)"
+              >选择</el-link
+            >
+          </template>
+  
+          <template v-slot:action="{ row, $index }">
+            <template>
+              <el-link
+                type="primary"
+                :underline="false"
+                @click="categorySelect(row)"
+              >
+                添加物料
+              </el-link>
+              <el-popconfirm
+                class="ele-action"
+                title="确定要删除此销售订单吗?"
+                @confirm="remove(row, $index)"
+              >
+                <template v-slot:reference>
+                  <el-link type="danger" :underline="false" icon="el-icon-delete">
+                    删除
+                  </el-link>
+                </template>
+              </el-popconfirm>
+            </template>
+          </template>
+  
+          <!-- 展开内容 -->
+          <template v-slot:expand="{ row, $index }">
+            <div
+              style="
+                width: calc(100% - 95px);
+                min-height: 60px;
+                margin-left: 95px;
+              "
+              v-if="row.materialList.length > 0"
+            >
+              <ele-pro-table
+                :toolbar="false"
+                toolsTheme="none"
+                ref="table2"
+                :need-page="false"
+                :datasource="row.materialList"
+                :columns="columns2"
+                :key="row.categoryId + '-' + $index"
+              >
+                <template v-slot:sort="{ $index }">
+                  {{ $index }}
+                </template>
+  
+                <template v-slot:unit="{ row }">
+                  {{ row.unit }}
+                </template>
+  
+                <template v-slot:demandQuantity="{ row }">
+                  <el-input
+                    v-model="row.demandQuantity"
+                    placeholder="请输入"
+                    @input="
+                      (value) =>
+                        (row.demandQuantity = value.replace(
+                          /^(-)*(\d+)\.(\d\d\d\d\d\d).*$/,
+                          '$1$2.$3'
+                        ))
+                    "
+                  ></el-input>
+                </template>
+  
+                <template v-slot:purchaseQuantity="{ row }">
+                  <el-input
+                    v-model="row.purchaseQuantity"
+                    placeholder="请输入"
+                    @input="
+                      (value) =>
+                        (row.purchaseQuantity = value.replace(
+                          /^(-)*(\d+)\.(\d\d\d\d\d\d).*$/,
+                          '$1$2.$3'
+                        ))
+                    "
+                  ></el-input>
+                </template>
+  
+                <template v-slot:deliveryMethod="{ row }">
+                  <el-select
+                    clearable
+                    class="ele-block"
+                    v-model="row.deliveryMethod"
+                    placeholder="请选择"
+                  >
+                    <el-option
+                      label="一次性到货"
+                      :value="1"
+                      @click.native="row.timeList = null"
+                    />
+                    <el-option
+                      label="分批到货"
+                      :value="2"
+                      @click.native="
+                        handleMethod(row);
+                        row.requireDeliveryTime = null;
+                      "
+                    />
+                  </el-select>
+                </template>
+  
+                <template v-slot:requireDeliveryTime="{ row }">
+                  <el-date-picker
+                    style="width: 100%"
+                    clearable
+                    v-model="row.requireDeliveryTime"
+                    type="date"
+                    v-if="row.deliveryMethod == 1"
+                    value-format="yyyy-MM-dd"
+                    placeholder="请选择日期"
+                  >
+                  </el-date-picker>
+  
+                  <el-link
+                    type="primary"
+                    :underline="false"
+                    v-if="row.deliveryMethod == 2"
+                    @click.native="handleMethod(row)"
+                  >
+                    设置分批时间
+                  </el-link>
+                </template>
+  
+                <template v-slot:imgUrl="{ row }">
+                  <fileUpload
+                    v-model="row.imgUrl"
+                    module="main"
+                    :showLib="false"
+                    :limit="1"
+                  />
+                </template>
+  
+                <template v-slot:files="{ row }">
+                  <fileUpload
+                    v-model="row.files"
+                    module="main"
+                    :showLib="false"
+                    :limit="1"
+                  />
+                </template>
+  
+                <template v-slot:action="{ row }">
+                  <el-popconfirm
+                    class="ele-action"
+                    title="确定要删除当前物料吗?"
+                    @confirm="remove2(row)"
+                  >
+                    <template v-slot:reference>
+                      <el-link
+                        type="danger"
+                        :underline="false"
+                        icon="el-icon-delete"
+                      >
+                        删除
+                      </el-link>
+                    </template>
+                  </el-popconfirm>
+                </template>
+              </ele-pro-table>
+            </div>
+          </template>
+        </ele-pro-table>
+      </el-form>
+  
+      <div slot="footer">
+        <el-button @click="cancel">取消</el-button>
+        <el-button type="primary" @click="confirm">保存</el-button>
+      </div>
+  
+      <produceOrder ref="produceOrderRef" @chooseOrder="chooseOrder"></produceOrder>
+  
+      <ProductModal ref="productRefs" @chooseModal="chooseModal" />
+  
+      <ProductionVersion
+        ref="versionRefs"
+        @changeProduct="changeProduct"
+      ></ProductionVersion>
+  
+      <timeDialog ref="timeDialogRef" @chooseTime="chooseTime"></timeDialog>
+    </ele-modal>
+  </template>
+  
+  <script>
+    import produceOrder from './produceOrder.vue';
+    import ProductModal from './ProductModal.vue';
+    import {
+      listBomBySalesOrderIds,
+      listBomBySalesOrderId,
+      save,
+      getById
+    } from '@/api/materialPlan/index';
+    import ProductionVersion from '@/components/CreatePlan/ProductionVersion2.vue';
+    import fileUpload from '@/components/upload/fileUpload';
+    import timeDialog from './timeDialog';
+    import dictMixins from '@/mixins/dictMixins';
+    export default {
+      components: {
+        produceOrder,
+        ProductModal,
+        ProductionVersion,
+        fileUpload,
+        timeDialog
+      },
+      mixins: [dictMixins],
+      data() {
+        return {
+          visible: false,
+          type: 'add',
+  
+          tableData: [],
+  
+          xsId: null,
+  
+          // 表格列配置
+          columns: [
+            {
+              width: 45,
+              type: 'expand',
+              columnKey: 'materialList',
+              align: 'center',
+              slot: 'expand'
+            },
+  
+            {
+              width: 50,
+              label: '序号',
+              type: 'index',
+              align: 'center',
+              slot: 'index'
+            },
+  
+            {
+              prop: 'code',
+              label: '销售订单号',
+              slot: 'code',
+              showOverflowTooltip: true,
+              align: 'center',
+              minWidth: 170,
+              sortable: true
+            },
+            {
+              prop: 'customerName',
+              label: '客户名称',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+            {
+              prop: 'deliveryNum',
+              label: '客户代号',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+            {
+              prop: 'productCode',
+              label: '产品编码',
+              align: 'center',
+              showOverflowTooltip: true,
+              minWidth: 140
+            },
+  
+            {
+              prop: 'productName',
+              label: '产品名称',
+              align: 'center',
+              minWidth: 120
+            },
+  
+            {
+              prop: 'model',
+              label: '型号',
+              align: 'center',
+              minWidth: 120
+            },
+  
+            {
+              prop: 'brandNo',
+              label: '牌号',
+              align: 'center'
+            },
+  
+            {
+              prop: 'deliveryTime',
+              label: '交付日期',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+            {
+              prop: 'contractNum',
+              label: '订单数量',
+              align: 'center'
+            },
+            {
+              prop: 'lackNum',
+              label: '欠交数量',
+              align: 'center'
+            },
+  
+            {
+              prop: 'productionPlanId',
+              label: '工艺路线',
+              slot: 'productionPlanId',
+              align: 'center',
+              minWidth: 110
+            },
+  
+            {
+              columnKey: 'action',
+              label: '操作',
+              width: 150,
+              align: 'center',
+              resizable: false,
+              slot: 'action',
+              showOverflowTooltip: true
+            }
+          ],
+  
+          columns2: [
+            {
+              width: 50,
+              label: '序号',
+              prop: 'sort',
+              slot: 'sort',
+              align: 'center'
+            },
+  
+            {
+              label: '物料名称',
+              prop: 'name',
+              align: 'center'
+            },
+  
+            {
+              label: '物料编码',
+              prop: 'code',
+              align: 'center'
+            },
+            {
+              label: '牌号',
+              prop: 'brandNum',
+              align: 'center'
+            },
+            {
+              prop: 'specification',
+              label: '规格',
+              align: 'center',
+              showOverflowTooltip: true,
+              minWidth: 110
+            },
+            {
+              label: '型号',
+              prop: 'modelType',
+              align: 'center'
+            },
+  
+            {
+              prop: 'inventoryQuantity',
+              label: '库存',
+              showOverflowTooltip: true
+            },
+  
+            {
+              prop: 'unit',
+              label: '计量单位',
+              showOverflowTooltip: true,
+              action: 'unit',
+              slot: 'unit'
+            },
+  
+            {
+              label: '需求数量',
+              slot: 'demandQuantity',
+              action: 'demandQuantity',
+              align: 'center'
+            },
+  
+            {
+              label: '采购数量',
+              slot: 'purchaseQuantity',
+              action: 'purchaseQuantity',
+              align: 'center'
+            },
+  
+            {
+              label: '到货方式',
+              slot: 'deliveryMethod',
+              action: 'deliveryMethod',
+              align: 'center',
+              minWidth: 140
+            },
+  
+            {
+              label: '要求到货时间',
+              slot: 'requireDeliveryTime',
+              action: 'requireDeliveryTime',
+              align: 'center',
+              minWidth: 140
+            },
+  
+            {
+              label: '图纸',
+              slot: 'imgUrl',
+              action: ' imgUrl',
+              align: 'center',
+              minWidth: 140
+            },
+  
+            {
+              label: '附件',
+              slot: 'files',
+              action: ' files',
+              align: 'center',
+              minWidth: 140
+            },
+  
+            {
+              columnKey: 'action',
+              label: '操作',
+              width: 70,
+              align: 'center',
+              resizable: false,
+              slot: 'action',
+              showOverflowTooltip: true
+            }
+          ],
+          rules: {
+            demandType: [
+            {
+                required: true,
+                message: '请选择需求类型',
+                trigger: ['blur', 'change']
+              }
+            ],
+            name: [
+              {
+                required: true,
+                message: '请输入配料计划名称',
+                trigger: ['blur', 'change']
+              }
+            ]
+          },
+          formData: {
+            name: '',
+            remark: '',
+            detailRemoveIds: [],
+            materialRemoveIds: []
+          },
+  
+          demandTypeList: []
+        };
+      },
+  
+      methods: {
+        async open(type, row) {
+          this.type = type;
+  
+          this.typeList();
+  
+          this.visible = true;
+  
+          if (row) {
+            this.getDetail(row.id);
+          } else {
+            this.$nextTick(() => {
+              this.$refs.table.setData([]);
+            });
+          }
+        },
+  
+        typeList() {
+          this.requestDict('需求类型').then((res) => {
+            let _res = res || [];
+         
+            this.demandTypeList = _res.filter(
+              (f) => f.dictCode == 1 || f.dictCode == 6
+            );
+  
+  
+          });
+        },
+  
+        getDetail(id) {
+          getById(id).then((res) => {
+            this.$set(this.formData, 'name', res.name);
+            this.$set(this.formData, 'remark', res.remark);
+            this.formData['id'] = res.id;
+            this.$refs.table.setData([...res.salesOrderList]);
+  
+            this.$nextTick(() => {
+              this.$refs.table.toggleRowExpansionAll();
+              this.$forceUpdate();
+            });
+          });
+        },
+  
+        confirm() {
+          this.$refs.formRef.validate(async (value) => {
+            if (value) {
+              let _arr = this.$refs.table.getData() ?? [];
+  
+              if (_arr.length == 0) {
+                this.$message.info('请添加销售订单');
+                return false;
+              }
+              let _arr2 = [];
+  
+              _arr2 = _arr.map((m) => {
+                if (
+                  Object.prototype.hasOwnProperty.call(m, 'salesOrderId') &&
+                  m.salesOrderId
+                ) {
+                } else {
+                  m.salesOrderId = m.id;
+                  m.salesOrderCode = m.code;
+                  delete m.id;
+                  delete m.code;
+                }
+  
+                return {
+                  ...m
+                };
+              });
+  
+              this.formData['type'] = 1;
+              this.formData['salesOrderList'] = _arr2;
+              await save(this.formData);
+              this.$message.success('保存成功!');
+              this.$emit('success');
+              this.cancel();
+            }
+          });
+        },
+        cancel() {
+          this.visible = false;
+          this.formData = {};
+          this.formData.detailRemoveIds = [];
+          this.formData.materialRemoveIds = [];
+          this.$refs.table.setData([]);
+          this.$refs.formRef.resetFields();
+        },
+  
+        datasource({}) {
+          return [];
+        },
+  
+        reload() {
+          this.$refs.table.reload();
+        },
+  
+        produceAdd() {
+          this.tableData = this.$refs.table.getData();
+          this.$refs.produceOrderRef.open(this.tableData);
+        },
+  
+
+  
+        chooseOrder(list) {
+          let salesOrderIds = [];
+          list.map((m) => {
+            salesOrderIds.push(m.id);
+            return {
+              ...m
+            };
+          });
+  
+          if (salesOrderIds.length > 0) {
+            listBomBySalesOrderIds({ salesOrderIds: salesOrderIds }).then(
+              (res) => {
+                res.forEach((m) => {
+                  if (m.materialList.length > 0) {
+                    m.materialList.forEach((p) => {
+                      p.detailId = m.id;
+                    });
+                  }
+                });
+  
+                this.$refs.table.setData([...this.tableData, ...res]);
+  
+                this.$nextTick(() => {
+                  this.$refs.table.toggleRowExpansionAll();
+                  this.$forceUpdate();
+                });
+              }
+            );
+          }
+        },
+  
+        remove(row, index) {
+          this.formData.detailRemoveIds.push(row.id);
+          let _arr = this.$refs.table.getData() || [];
+          _arr.splice(index, 1);
+          this.$refs.table.setData([..._arr]);
+        },
+  
+        categorySelect(row) {
+          this.$refs.productRefs.open(row.materialList, row, this.type);
+        },
+  
+        chooseModal(data, current) {
+          data.map((m) => {
+            m.detailId = current.id;
+  
+            return {
+              ...m
+            };
+          });
+  
+          let tableList = [];
+          tableList = this.$refs.table.getData();
+  
+          tableList.forEach((e) => {
+            if (e.id == current.id) {
+              if (e.materialList.length == 0) {
+                e.materialList = data;
+              } else {
+                e.materialList = [...e.materialList, ...data];
+              }
+            }
+          });
+  
+          console.log(tableList);
+          this.$refs.table.setData([...tableList]);
+          this.$forceUpdate();
+        },
+  
+        remove2(row) {
+          const data = this.$refs.table.getData() ?? [];
+          this.formData.materialRemoveIds.push(row.categoryId);
+          data.forEach((e) => {
+            if (row.detailId == e.id) {
+              e.materialList = e.materialList.filter(
+                (d) => d.categoryId !== row.categoryId
+              );
+            }
+          });
+  
+          this.$refs.table.setData([...data]);
+          this.$forceUpdate();
+        },
+  
+        openVersion(row) {
+          this.xsId = row.id;
+          this.$refs.versionRefs.open();
+        },
+        changeProduct(data) {
+          let param = {
+            salesOrderIds: [this.xsId],
+            produceRoutingId: data.id
+          };
+  
+          listBomBySalesOrderId(param).then((res) => {
+            let tableList = [];
+            tableList = this.$refs.table.getData();
+  
+            tableList.forEach((e) => {
+              if (e.id == this.xsId) {
+                res.map((m) => {
+                  m.detailId = this.xsId;
+                  return {
+                    ...m
+                  };
+                });
+  
+                e.materialList = res;
+  
+                this.$nextTick(() => {
+                  this.$refs.table.setData([...tableList]);
+                  this.$refs.table.toggleRowExpansionAll();
+                });
+              }
+            });
+          });
+        },
+  
+        handleMethod(row) {
+          this.$refs.timeDialogRef.open(row);
+        },
+        chooseTime(current, timeList) {
+          let tableList = [];
+          tableList = this.$refs.table.getData();
+  
+          tableList.forEach((e) => {
+            if (e.id == current.detailId) {
+              e.materialList.forEach((m) => {
+                if (m.categoryId == current.categoryId) {
+                  m.timeList = timeList || [];
+                }
+              });
+            }
+          });
+  
+          this.$refs.table.setData([...tableList]);
+          this.$forceUpdate();
+        }
+      }
+    };
+  </script>
+  
+  <style lang="scss" scoped>
+    :deep(.el-table__expanded-cell) {
+      padding-bottom: 30px !important;
+      border-bottom: 12px solid #ccffcc !important;
+    }
+  </style>
+  

+ 11 - 3
src/views/materialPlan/index.vue

@@ -9,7 +9,9 @@
       <ele-pro-table ref="table"  :initLoad="false" :columns="columns" :datasource="datasource"
         cache-key="`materialPlanTable`">
         <template v-slot:toolbar>
-          <el-button type="primary" @click="handleEdit('add')">创建计划</el-button>
+          <el-button type="primary"   icon="el-icon-plus" @click="handleEdit('add')">创建销售计划</el-button>
+
+          <el-button type="primary"   icon="el-icon-plus" @click="produceAdd('add')">创建生产计划</el-button>
         </template>
 
         <template v-slot:status="{ row }">
@@ -41,6 +43,7 @@
       </ele-pro-table>
     </el-card>
     <planEditDialog ref="planEditDialogRef" @success="reload" />
+    <producePlan ref="produceRef"></producePlan>
    
     <detail ref="detailRef"></detail>
   </div>
@@ -49,6 +52,7 @@
 <script>
 import materialPlanSearch from './components/materialPlan-search.vue';
 import planEditDialog from './components/plan-edit-dialog.vue';
+import producePlan from './components/producePlan.vue'
 
 import detail from './components/detail.vue'
 import { getList, del, submit } from '@/api/materialPlan/index';
@@ -57,7 +61,8 @@ export default {
     planEditDialog,
 
     materialPlanSearch,
-    detail
+    detail,
+    producePlan
   },
 
   data() {
@@ -186,7 +191,6 @@ export default {
     },
     handleEdit(type, row) {
       this.$refs.planEditDialogRef.open(type, row);
-
     },
     handleDel({ id }) {
       this.$confirm('确认删除当前数据!', '提示').then(async () => {
@@ -209,6 +213,10 @@ export default {
       this.$refs.searchRef.reset();
     },
 
+    produceAdd(type, row) {
+      this.$refs.produceRef.open(type, row);
+    },
+
     /* 刷新表格 */
     reload(where = {}) {
        if(where.statusList) {

+ 2 - 2
vue.config.js

@@ -33,8 +33,8 @@ module.exports = {
       '/api': {
         // target: 'http://192.168.1.210:86/',
         // target: 'http://192.168.1.116:18086',
-        // target: 'http://192.168.1.125:18086',
-        target: 'http://192.168.1.144:18086',
+        target: 'http://192.168.1.125:18086',
+        // target: 'http://192.168.1.144:18086',
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {
           '^/api': ''