ysy 2 лет назад
Родитель
Сommit
4b72b65e63

+ 11 - 1
src/api/materialPlan/index.js

@@ -97,4 +97,14 @@ export async function listBomBySalesOrderId(data) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}
+
+// 提交
+export async function submit(data) {
+  const res = await request.post(`/bpm/apspurchaseplan/submit`,data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+

+ 1 - 1
src/components/upload/fileUpload.vue

@@ -13,7 +13,7 @@
       :show-file-list="!showLib"
     >
       <slot>
-        <el-button type="primary" size="small" icon="el-icon-plus">点击上传</el-button>
+        <el-button type="primary" size="mini" icon="el-icon-plus">上传</el-button>
       </slot>
     </el-upload>
     <el-button type="primary" class="lib" @click="handleOpenLib" v-if="showLib"

+ 66 - 14
src/views/materialPlan/components/plan-edit-dialog.vue

@@ -95,24 +95,35 @@
                   "></el-input>
               </template>
 
+              <template v-slot:deliveryMethod="{ row }">
+                <el-select clearable class="ele-block" v-model="row.deliveryMethod" placeholder="请选择">
+                  <el-option label="一次性到货" :value="1" />
+                  <el-option label="分批到货" :value="2" @click.native="handleMethod(row)" />
+                </el-select>
+              </template>
+
               <template v-slot:requireDeliveryTime="{ row }">
                 <el-date-picker style="width: 100%" clearable v-model="row.requireDeliveryTime" type="date"
-                  value-format="yyyy-MM-dd" placeholder="请选择日期">
+                  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:deliveryMethod="{ row }">
-                <el-select clearable class="ele-block" v-model="row.deliveryMethod" placeholder="请选择">
-                  <el-option label="一次性到货" :value="1" />
-                  <el-option label="分批到货" :value="2" />
-                </el-select>
+
+
+              <template v-slot:imgUrl="{ row }">
+                <fileUpload v-model="row.imgUrl" module="main" :showLib="false" :limit="1" />
               </template>
 
               <template v-slot:annex="{ row }">
                 <fileUpload v-model="row.annex" module="main" :showLib="false" :limit="1" />
               </template>
 
-              
+
 
 
 
@@ -139,7 +150,7 @@
     <div slot="footer">
       <el-button @click="cancel">取消</el-button>
       <el-button type="primary" @click="confirm">保存</el-button>
-      <el-button type="primary" @click="confirm">提交</el-button>
+      <el-button type="primary" @click="confirm">保存并提交</el-button>
     </div>
 
 
@@ -151,6 +162,8 @@
 
     <ProductionVersion ref="versionRefs" @changeProduct="changeProduct"></ProductionVersion>
 
+    <timeDialog ref="timeDialogRef" @chooseTime="chooseTime"></timeDialog>
+
   </ele-modal>
 </template>
 
@@ -161,12 +174,14 @@ 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'
 export default {
   components: {
     saleOrderPop,
     ProductModal,
     ProductionVersion,
-    fileUpload
+    fileUpload,
+    timeDialog
 
   },
   data() {
@@ -347,22 +362,34 @@ export default {
           align: 'center',
         },
 
+        {
+          label: '到货方式',
+          slot: 'deliveryMethod',
+          action: 'deliveryMethod',
+          align: 'center',
+          minWidth: 140
+        },
+
         {
           label: '要求到货时间',
           slot: 'requireDeliveryTime',
-          action: ' requireDeliveryTime',
+          action: 'requireDeliveryTime',
           align: 'center',
+          minWidth: 140
         },
 
+
+
         {
-          label: '到货方式',
-          slot: 'deliveryMethod',
-          action: ' deliveryMethod',
+          label: '图纸',
+          slot: 'imgUrl',
+          action: ' imgUrl',
           align: 'center',
         },
 
+
         {
-          label: '附件图纸',
+          label: '附件',
           slot: 'annex',
           action: ' annex',
           align: 'center',
@@ -600,6 +627,31 @@ export default {
       })
 
     },
+
+    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) {
+          console.log(e)
+          e.materialList.forEach(m => {
+            if(m.id == current.id) {
+              m.timeList = timeList
+            }
+          })
+    
+
+
+        }
+      })
+
+      this.$refs.table.setData([...tableList]);
+    }
   }
 };
 </script>

+ 159 - 0
src/views/materialPlan/components/timeDialog.vue

@@ -0,0 +1,159 @@
+<template>
+    <el-dialog :title="title" :visible.sync="visible" :before-close="handleClose" :close-on-click-modal="false"
+        :close-on-press-escape="false" append-to-body width="35%">
+
+        <el-form :model="form" ref="tableForm" class="tableForm" :rules="tableFormRules">
+            <el-button type="primary" size="small" style="margin-bottom: 10px" @click="handleAdd()">新增</el-button>
+            <el-table ref="multipleTable" :data="form.timeList" tooltip-effect="dark" style="width: 100%" stripe
+                :header-cell-style="{ background: '#EEEEEE', border: 'none' }">
+
+
+
+                <el-table-column label="数量" prop="purchaseQuantity">
+                    <template slot-scope="{ row, $index }">
+                        <el-form-item :prop="'timeList.' + $index + '.purchaseQuantity'"
+                            :rules="tableFormRules.purchaseQuantity">
+                            <el-input placeholder="请输入" clearable v-model="row.purchaseQuantity"></el-input>
+                        </el-form-item>
+
+                    </template>
+                </el-table-column>
+
+
+
+                <el-table-column label="到货时间">
+                    <template slot-scope="{ row, $index }">
+                        <el-form-item :prop="'timeList.' + $index + '.requireDeliveryTime'"
+                            :rules="tableFormRules.requireDeliveryTime">
+                            <el-date-picker clearable v-model="row.requireDeliveryTime" type="date"
+                                value-format="yyyy-MM-dd" placeholder="请选择日期">
+                            </el-date-picker>
+                        </el-form-item>
+                    </template></el-table-column>
+
+                <el-table-column label="操作" prop="action" width="80">
+                    <template slot-scope="{ $index }">
+                        <el-link type="primary" :underline="false" @click="handleDel($index)">删除</el-link>
+                    </template>
+                </el-table-column>
+
+
+            </el-table>
+
+        </el-form>
+
+
+
+
+        <div class="btns">
+            <el-button type="primary" size="small" @click="handleOk">确认</el-button>
+            <el-button size="small" @click="handleClose">取消</el-button>
+        </div>
+    </el-dialog>
+</template>
+  
+<script>
+
+
+
+
+export default {
+    components: {
+    },
+    data() {
+        return {
+            visible: false,
+            title: '设置分批时间',
+
+            current: null,
+            form: {
+                timeList: [
+                    {
+                        requireDeliveryTime: null,
+                        purchaseQuantity: null
+                    }
+                ]
+            },
+
+            tableFormRules: {
+                purchaseQuantity: {
+                    required: true,
+                    message: '请输入数量',
+                    trigger: 'blur'
+                },
+
+                requireDeliveryTime: {
+                    required: true,
+                    message: '请选择日期',
+                    trigger: 'change'
+                }
+            }
+
+
+        }
+    },
+
+    watch: {
+
+    },
+    methods: {
+
+
+
+        open(row) {
+
+            this.form.timeList = row.timeList
+            this.current = row;
+            this.visible = true
+
+        },
+
+
+        handleAdd() {
+            this.form.timeList.push({
+                requireDeliveryTime: null,
+                purchaseQuantity: null
+            })
+        },
+
+        handleDel(index) {
+            this.timeList.splice(index, 1)
+        },
+
+
+
+        handleOk() {
+            this.$refs.tableForm.validate((valid) => {
+                if (valid) {
+                    this.$emit('chooseTime', this.current, this.form.timeList)
+                    this.handleClose()
+                }
+            })
+        },
+
+
+
+
+        handleClose() {
+            this.visible = false
+            this.form.timeList = [{
+                requireDeliveryTime: null,
+                purchaseQuantity: null
+            }];
+        },
+
+    }
+}
+</script>
+  
+<style lang="scss" scoped>
+.btns {
+    margin-top: 20px;
+    text-align: center;
+}
+
+.el-form-item {
+    margin-bottom: 20px !important;
+}
+</style>
+  

+ 49 - 1
src/views/materialPlan/index.vue

@@ -20,6 +20,12 @@
             {{ statusFormatter(row.status) }}
           </span>
         </template>
+
+        <template v-slot:approvalStatus="{ row }">
+          <span :class="{ 'ele-text-danger': row.status == 3 }">
+            {{ approvalStatusFormatter(row.approvalStatus) }}
+          </span>
+        </template>
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
 
@@ -30,6 +36,10 @@
           <el-link @click="handleDel(row)" type="danger" :underline="false" icon="el-icon-delete">
             删除
           </el-link>
+
+          <el-link type="primary" :underline="false" @click="todo(row)">
+            提交
+          </el-link>
         </template>
       </ele-pro-table>
     </el-card>
@@ -42,7 +52,7 @@
 import materialPlanSearch from './components/materialPlan-search.vue';
 import planEditDialog from './components/plan-edit-dialog.vue';
 import produceEditDialog from './components/produce-edit-dialog'
-import { getList, del } from '@/api/materialPlan/index';
+import { getList, del, submit } from '@/api/materialPlan/index';
 export default {
   components: {
     planEditDialog,
@@ -72,6 +82,18 @@ export default {
           { label: '已完成', value: '6' },
           { label: '已延期', value: '7' }
         ]
+      },
+
+
+
+      approvalStatusOpt: {
+        first: [
+
+          { label: '未提交', value: '0' },
+          { label: '审核中', value: '1' },
+          { label: '审核通过', value: '2' },
+          { label: '审核未通过', value: '3' },
+        ]
       }
     };
   },
@@ -111,6 +133,16 @@ export default {
           slot: 'status',
           action: 'status'
         },
+
+
+        {
+          columnKey: 'approvalStatus',
+          label: '审批状态',
+          align: 'center',
+          slot: 'approvalStatus',
+          action: 'approvalStatus'
+        },
+
         {
           prop: 'createUserName',
           label: '创建人',
@@ -142,6 +174,14 @@ export default {
 
       return obj && obj.label;
     },
+
+    approvalStatusFormatter(status) {
+      const obj = this.approvalStatusOpt[this.activeName].find(
+        (i) => i.value == status
+      );
+
+      return obj && obj.label;
+    },
     /* 表格数据源 */
     datasource({ page, limit, where, order }) {
       return getList({
@@ -167,6 +207,14 @@ export default {
       });
     },
 
+    todo(row) {
+      submit({ businessId: row.id }).then(res => {
+        if (res) {
+          this.$message.success('提交成功!');
+        }
+      })
+    },
+
     handleTabChange() {
       this.$refs.searchRef.reset();
     },

+ 4 - 1
src/views/saleOrder/index.vue

@@ -44,11 +44,14 @@
               @confirm="remove(row)"
             >
               <template v-slot:reference>
-                <el-link type="danger" :underline="false" icon="el-icon-delete">
+                <el-link type="danger"  :underline="false" icon="el-icon-delete">
                   删除
                 </el-link>
               </template>
             </el-popconfirm>
+
+
+
           </template>
         </template>
       </ele-pro-table>