yusheng пре 11 месеци
родитељ
комит
efd811dd3c

+ 53 - 12
src/views/purchasingManage/purchaseOrder/components/inventoryTable.vue

@@ -269,20 +269,17 @@
           </el-input>
         </el-form-item>
       </template>
-      <!-- <template v-slot:notaxSinglePrice="scope">
-        <el-form-item
-          style="margin-bottom: 20px"
-          :prop="'datasource.' + scope.$index + '.notaxSinglePrice'"
-        >
-          <el-input
-            v-model="scope.row.notaxSinglePrice"
-            placeholder="请输入"
-            type="number"
+      <template v-slot:goodsPriceType="{ row, $index }">
+        <el-form-item :prop="'datasource.' + $index + '.goodsPriceType'">
+          <DictSelection
+            dictName="商品价格类型"
+            clearable
+            v-model="row.goodsPriceType"
+            @change="goodsPriceTypeChange(row, $index)"
           >
-            <template slot="append">元</template>
-          </el-input>
+          </DictSelection>
         </el-form-item>
-      </template> -->
+      </template>
       <template v-slot:goodsLevel="{ row, $index }">
         <el-form-item :prop="'datasource.' + $index + '.goodsLevel'">
           <el-select v-model="row.goodsLevel" style="width: 100%">
@@ -500,6 +497,7 @@
   import { getInventoryTotalAPI } from '@/api/wms';
   import tabMixins from '@/mixins/tableColumnsMixin';
   import { levelList } from '@/enum/dict.js';
+  import { getGoodsPriceByCondition } from '@/api/goodsManage/index';
 
   const dayjs = require('dayjs');
 
@@ -662,6 +660,13 @@
             slot: 'goodsLevel',
             align: 'center'
           },
+          {
+            width: 160,
+            prop: 'goodsPriceType',
+            label: '价格类型',
+            slot: 'goodsPriceType',
+            align: 'center'
+          },
           {
             width: 160,
             prop: 'singlePrice',
@@ -905,6 +910,8 @@
     },
     created() {
       this.requestDict('生产类型');
+      this.requestDict('商品价格类型');
+
     },
     methods: {
       handleGetBillDetail(row, type) {
@@ -948,6 +955,40 @@
         this.singleWeightChange(row, index);
         this.getTotalPrice();
       },
+      goodsPriceTypeChange(row, index) {
+        if (row.goodsId) {
+          getGoodsPriceByCondition({
+            id: row.goodsId,
+            priceType: row.goodsPriceType
+          }).then((res) => {
+            if (res.id) {
+              this.$set(this.form.datasource[index], 'goodsPriceId', res.id);
+              this.$set(
+                this.form.datasource[index],
+                'goodsPriceType',
+                res.priceType
+              );
+              this.$set(
+                this.form.datasource[index],
+                'singlePrice',
+                res.unitPrice
+              );
+              this.$set(
+                this.form.datasource[index],
+                'notaxSinglePrice',
+                res.excludeTaxPrice
+              );
+              this.$set(this.form.datasource[index], 'taxRate', res.taxRate);
+              this.$set(
+                this.form.datasource[index],
+                'discountSinglePrice',
+                res.unitPrice
+              );
+            }
+            this.changeCount();
+          });
+        }
+      },
       //计算总金额
       getTotalPrice(row, index) {
         this.getNotaxSinglePrice();

+ 60 - 20
src/views/saleManage/saleOrder/components/addDialog.vue

@@ -22,22 +22,7 @@
       <headerTitle title="订单信息"></headerTitle>
       <el-row>
         <el-col :span="12">
-          <el-form-item label="项目名称" prop="projectName">
-            <el-input
-              clearable
-              v-model="form.projectName"
-              @clear="clearContrcat('project')"
-              placeholder="请输入"
-              style="width: calc(100% - 80px)"
-            />
-            <el-button
-              style="margin-left: 5px"
-              size="small"
-              type="primary"
-              @click.native="handleProjectBtn"
-              >选择
-            </el-button>
-          </el-form-item>
+ 
           <el-form-item label="销售类型" prop="saleType">
             <DictSelection
               dictName="销售类型"
@@ -117,6 +102,22 @@
             >
             </DictSelection>
           </el-form-item>
+          <el-form-item label="项目名称" prop="projectName">
+            <el-input
+              clearable
+              v-model="form.projectName"
+              @clear="clearContrcat('project')"
+              placeholder="请输入"
+              style="width: calc(100% - 80px)"
+            />
+            <el-button
+              style="margin-left: 5px"
+              size="small"
+              type="primary"
+              @click.native="handleProjectBtn"
+              >选择
+            </el-button>
+          </el-form-item>
           <el-form-item
             label="总数"
             prop="totalPlanNum"
@@ -133,6 +134,7 @@
               </template>
             </el-input>
           </el-form-item>
+          
         </el-col>
       </el-row>
       <headerTitle title="基本信息" v-if="form.needProduce != 2"></headerTitle>
@@ -414,7 +416,10 @@
       v-if="processSubmitDialogFlag"
       ref="processSubmitDialogRef"
       @reload="reload"
+      :callBack="callBack"
     ></process-submit-dialog>
+  <bomDialog ref="bomDialogRef" @handleSubmit="bomDialogSuccess"></bomDialog>
+
   </ele-modal>
 </template>
 
@@ -437,7 +442,7 @@
     getSaleOrderDetail,
     UpdateInformation,
     addInformation,
-    submit
+    submit,getByRepeatBomAttribute
   } from '@/api/saleManage/saleorder';
   import { getcontactlink } from '@/api/saleManage/businessFollow';
   import headList from '@/BIZComponents/user-select/user-select.vue';
@@ -452,6 +457,8 @@
   import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
   import { getUserDetail } from '@/api/system/organization/index.js';
   import typeList from './typeList.vue';
+  import bomDialog from './bomDialog';
+  
   export default {
     mixins: [dictMixins],
     components: {
@@ -464,7 +471,7 @@
       paymentList,
       inventoryTable,
       parentList,
-      typeList
+      typeList,bomDialog
     },
     props: {
       contactData: {
@@ -538,6 +545,7 @@
         // 组织机构树形结构数据
         groupTreeData: [],
         groupData: [],
+        tableList:[],
         // rules: {
         //   settlementMode: [
         //     { required: true, message: '请选择结算方式', trigger: 'change' }
@@ -1115,7 +1123,7 @@
               updateContractStatus([this.form.contractId]);
             }
             if (type === 'sub') {
-              this.saleOrderSubmit(res, commitData);
+              this.saleOrderSubmitOrGenerate(res, commitData);
               return;
             } else {
               this.$message.success('操作成功');
@@ -1127,7 +1135,39 @@
             //this.loading = false;
           });
       },
-      async saleOrderSubmit(res, commitData) {
+
+      async callBack() {
+        if (!this.current.generatePurchase && !this.current.generateProduce) {
+          return 0;
+        }
+        const code = saveOrderBomList({
+          categoryDTOList: this.tableList || [],
+          orderId: this.current.id
+        });
+        return code;
+      },
+
+      async saleOrderSubmitOrGenerate(id) {
+        this.tableList = [];
+        this.current = await getSaleOrderDetail(this.businessId || id);
+        if (!this.current.generatePurchase && !this.current.generateProduce) {
+          this.saleOrderSubmit(this.current.id);
+        } else {
+          const data = await getByRepeatBomAttribute(this.current.id);
+          if (data && data.length) {
+            this.$refs.bomDialogRef.open(data);
+            return;
+          }
+          this.saleOrderSubmit(this.current.id);
+        }
+      },
+      bomDialogSuccess(tableList) {
+        this.tableList = tableList;
+
+        this.saleOrderSubmit(this.current.id);
+      },
+
+      async saleOrderSubmit(res) {
         const data = await getSaleOrderDetail(this.businessId || res);
         this.processSubmitDialogFlag = true;
         let businessType =

+ 521 - 0
src/views/saleManage/saleOrder/components/bomDialog.vue

@@ -0,0 +1,521 @@
+<template>
+  <ele-modal
+    custom-class="ele-dialog-form long-dialog-form"
+    :centered="true"
+    v-if="visible"
+    :visible.sync="visible"
+    :close-on-click-modal="false"
+    :append-to-body="true"
+    width="70%"
+    @close="cancel"
+    :maxable="true"
+    :resizable="true"
+    title="确认属性类型"
+  >
+    <ele-pro-table
+      ref="table"
+      :columns="columns"
+      :datasource="tableList"
+      class="dict-table"
+      tool-class="ele-toolbar-actions"
+      :needPage="false"
+    >
+      <template v-slot:componentAttribute="{ row }">
+        <div>
+          <el-select
+            v-model="row.componentAttribute"
+            filterable
+            :multiple="true"
+            :multiple-limit="1"
+            class="ele-block"
+            size="mini"
+          >
+            <el-option
+              v-for="item in sxtList"
+              :key="item.value"
+              :value="item.value"
+              :label="item.label"
+            ></el-option>
+          </el-select>
+        </div>
+      </template>
+
+      <template v-slot:demandQuantity="{ row }">
+        <el-input
+          v-model="row.demandQuantity"
+          placeholder="请输入"
+          :readonly="type == 'detail'"
+          @input="
+            (value) =>
+              (row.demandQuantity = value.replace(
+                /^(-)*(\d+)\.(\d\d\d\d\d\d).*$/,
+                '$1$2.$3'
+              ))
+          "
+        ></el-input>
+      </template>
+      <template v-slot:purchasingCycle="{ row }">
+        {{ row.purchasingCycle }}{{ row.purchasingCycleUnit }}
+      </template>
+
+      <template v-slot:purchaseQuantity="{ row }">
+        <el-input
+          v-model="row.purchaseQuantity"
+          placeholder="请输入"
+          :readonly="type == 'detail'"
+          @input="
+            (value) =>
+              (row.purchaseQuantity = value.replace(
+                /^(-)*(\d+)\.(\d\d\d\d\d\d).*$/,
+                '$1$2.$3'
+              ))
+          "
+        ></el-input>
+      </template>
+
+      <template v-slot:deliveryMethod="{ row, $index }">
+        <el-select
+          clearable
+          class="ele-block"
+          v-model="row.deliveryMethod"
+          placeholder="请选择"
+          :disabled="type == 'detail'"
+        >
+          <el-option
+            label="一次性到货"
+            :value="1"
+            @click.native="row.timeList = null"
+          />
+          <el-option
+            label="分批到货"
+            :value="2"
+            @click.native="
+              handleMethod(row, $index);
+              row.requireDeliveryTime = null;
+            "
+          />
+        </el-select>
+      </template>
+      <template v-slot:dosage="{ row, $index }">
+        <el-input
+          v-model="row.dosage"
+          placeholder="请输入"
+          :readonly="type == 'detail'"
+          type="number"
+        ></el-input>
+      </template>
+
+      <template v-slot:requireDeliveryTime="{ row, $index }">
+        <el-date-picker
+          style="width: 100%"
+          clearable
+          v-model="row.requireDeliveryTime"
+          type="date"
+          v-show="row.deliveryMethod == 1"
+          value-format="yyyy-MM-dd"
+          placeholder="请选择日期"
+          :pickerOptions="{
+            disabledDate: (time) =>
+              time.getTime() <
+              new Date(new Date().setHours(0, 0, 0, 0)).getTime()
+          }"
+          :readonly="type == 'detail'"
+        >
+        </el-date-picker>
+
+        <el-link
+          type="primary"
+          :underline="false"
+          v-show="row.deliveryMethod == 2"
+          @click.native="handleMethod(row, $index)"
+        >
+          设置分批时间
+        </el-link>
+      </template>
+
+      <template v-slot:imgUrl="{ row }">
+        <fileMain
+          v-model="row.imgUrl"
+          module="main"
+          :showLib="false"
+          :limit="1"
+          :disabled="type == 'detail'"
+        />
+      </template>
+
+      <template v-slot:files="{ row }">
+        <fileMain
+          v-model="row.files"
+          module="main"
+          :showLib="false"
+          :limit="1"
+          :disabled="type == 'detail'"
+        />
+      </template>
+
+      <template v-slot:action="{ row }" v-if="type != 'detail'">
+        <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 slot="footer" class="footer">
+      <el-button type="primary" @click="save" v-click-once>确认</el-button>
+      <el-button @click="cancel">返回</el-button>
+    </div>
+    <timeDialog
+      @chooseTime="chooseTime"
+      ref="timeDialogRef"
+      :isBatch="true"
+    ></timeDialog>
+  </ele-modal>
+</template>
+
+<script>
+  import timeDialog from '@/components/timeDialog/index.vue';
+
+  const statusOpt = {
+    '': '全部',
+    0: '草稿',
+    1: '已发布'
+  };
+  const rootCategoryLevelIdList = {
+    9: '产品',
+    1: '物料',
+    4: '生产设备',
+    5: '模具',
+    6: '备品备件',
+    3: '零部件',
+    8: '舟皿',
+    10: '消耗材料',
+    13: '包装材料',
+    14: '生产辅助设备',
+    15: '仪表计量设备',
+    23: '会计科目',
+    26: '周转盘',
+    28: '废品'
+  };
+  export default {
+    components: { timeDialog },
+    data() {
+      return {
+        tableList: [],
+        // 表格列配置
+        columns: [
+          {
+            label: '序号',
+            columnKey: 'index',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'code',
+            label: '物品编码',
+            showOverflowTooltip: true,
+            width: 120
+          },
+          {
+            prop: 'name',
+            label: '名称',
+            width: 150
+          },
+
+          {
+            prop: 'level',
+            label: '层级'
+          },
+
+          {
+            prop: 'brandNum',
+            label: '牌号'
+          },
+
+          {
+            prop: 'modelType',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'dosage',
+            label: '用量',
+            slot: 'dosage',
+            width: 150
+          },
+
+          {
+            prop: 'componentAttribute',
+            label: '属性类型',
+            slot: 'componentAttribute',
+            width: 260
+          },
+
+          {
+            prop: 'materialsCode',
+            label: '物料代号',
+            width: 150
+          },
+
+          {
+            prop: 'versions',
+            label: '版本',
+            formatter: (row) => {
+              return row.versions + '.0';
+            }
+          },
+          {
+            prop: 'status ',
+            label: '状态',
+            formatter: (row) => {
+              return statusOpt[+row.status];
+            }
+          },
+
+          {
+            prop: 'createName',
+            label: '创建人',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'createTime',
+            label: '创建日期',
+            width: 160
+          }
+          // {
+          //   columnKey: 'selection',
+          //   type: 'selection',
+          //   width: 50,
+          //   align: 'center',
+          //   fixed: 'left'
+          // },
+          // {
+          //   columnKey: 'index',
+          //   label: '序号',
+          //   type: 'index',
+          //   width: 55,
+          //   align: 'center',
+          //   showOverflowTooltip: true,
+          //   fixed: 'left'
+          // },
+          // {
+          //   prop: 'componentAttribute',
+          //   label: '属性类型',
+          //   slot: 'componentAttribute',
+          //   width: 260
+          // },
+          // {
+          //   label: '物料名称',
+          //   prop: 'name',
+          //   align: 'center',
+          //   minWidth: 120,
+          //   fixed: 'left'
+          // },
+
+          // {
+          //   label: '物料编码',
+          //   prop: 'code',
+          //   align: 'center',
+          //   minWidth: 120,
+          //   fixed: 'left'
+          // },
+          // {
+          //   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: 'secureInventory',
+          //   label: '安全库存',
+          //   showOverflowTooltip: true
+          // },
+          // {
+          //   prop: 'lockQuantity',
+          //   label: '锁库数量',
+          //   showOverflowTooltip: true
+          // },
+          // {
+          //   prop: 'inTransitNum',
+          //   label: '在途数量',
+          //   showOverflowTooltip: true
+          // },
+          // {
+          //   prop: 'inTransitOrdersNum',
+          //   label: '在途已关联数量',
+          //   showOverflowTooltip: true
+          // },
+          // {
+          //   prop: 'availableQuantity',
+          //   label: '可用数量',
+          //   showOverflowTooltip: true
+          // },
+          // {
+          //   prop: 'unit',
+          //   label: '计量单位',
+          //   showOverflowTooltip: true,
+          //   action: 'unit',
+          //   slot: 'unit'
+          // },
+
+          // {
+          //   label: '需求数量',
+          //   slot: 'demandQuantity',
+          //   action: 'demandQuantity',
+          //   align: 'center',
+          //   minWidth: 120
+          // },
+
+          // {
+          //   label: '采购数量',
+          //   slot: 'purchaseQuantity',
+          //   action: 'purchaseQuantity',
+          //   align: 'center',
+          //   minWidth: 120
+          // },
+          // {
+          //   label: '采购周期',
+          //   slot: 'purchasingCycle',
+          //   action: 'purchasingCycle',
+          //   align: 'center',
+          //   minWidth: 160
+          // },
+          // {
+          //   label: '到货方式',
+          //   slot: 'deliveryMethod',
+          //   action: 'deliveryMethod',
+          //   align: 'center',
+          //   minWidth: 140
+          // },
+
+          // {
+          //   label: '要求到货时间',
+          //   slot: 'requireDeliveryTime',
+          //   action: 'requireDeliveryTime',
+          //   align: 'center',
+          //   minWidth: 180
+          // },
+
+          // {
+          //   label: '图纸',
+          //   slot: 'imgUrl',
+          //   action: ' imgUrl',
+          //   align: 'center',
+          //   minWidth: 140
+          // },
+
+          // {
+          //   label: '附件',
+          //   slot: 'files',
+          //   action: ' files',
+          //   align: 'center',
+          //   minWidth: 140
+          // },
+          // {
+          //   columnKey: 'action',
+          //   label: '操作',
+          //   width: 80,
+          //   align: 'center',
+          //   resizable: false,
+          //   slot: 'action',
+          //   showOverflowTooltip: true
+          // }
+        ],
+
+        visible: false,
+
+        loading: false,
+
+        sxtList: [
+          {
+            label: '自制件',
+            value: 1
+          },
+          {
+            label: '采购件',
+            value: 2
+          },
+          {
+            label: '外协件',
+            value: 3
+          }
+          // {
+          //   label: '受托件',
+          //   value: 4
+          // }
+        ]
+      };
+    },
+    computed: {},
+    created() {},
+    methods: {
+      open(tableList) {
+        this.visible = true;
+        this.tableList = tableList.map((item) => {
+          if (item.componentAttribute?.length > 1) {
+            item.componentAttribute = [];
+          }
+          return item;
+        });
+      },
+      //设置分批到货时间
+      handleMethod(row, index) {
+        row.arrivalBatch = row.timeList;
+        this.$refs.timeDialogRef.open(row, index);
+      },
+      chooseTime({ arrivalBatch, index }) {
+        this.$set(this.tableList[index], 'timeList', copyObj(arrivalBatch));
+      },
+      save() {
+        const arr = this.tableList.filter(
+          (item) => !item.componentAttribute.length
+        );
+        if (arr.length) {
+          return this.$message.warning('请选择属性类型');
+        }
+        this.$emit('handleSubmit', this.tableList);
+        this.cancel();
+      },
+      cancel() {
+        this.visible = false;
+        this.tableList = [];
+      }
+    }
+  };
+</script>
+<style scoped lang="scss"></style>