whj 1 年間 前
コミット
1142bb8612

+ 0 - 7
src/views/purchase/purchase-order-page/PurchaseOrderPage.vue

@@ -117,13 +117,6 @@ export default {
             return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
           }
         },
-
-        {
-          title: '计划名称',
-          dataIndex: 'orderName',
-          checked: true,
-          width: 150
-        },
         {
           title: '计划类型',
           dataIndex: 'type',

+ 25 - 50
src/views/purchase/purchase-order-page/modules/BaseForm.vue

@@ -6,11 +6,7 @@
     :confirmLoading="confirmLoading"
     @cancel="handleCancel"
   >
-    <a-steps :current="current" style="width:400px;margin:20px auto;">
-      <a-step title="计划信息" />
-      <a-step title="计划明细" />
-    </a-steps>
-    <a-card v-show="current===0">
+    <a-card >
       <a-form :form="form">
         <row-list :col="1" v-show="false">
           <row-item>
@@ -21,15 +17,6 @@
           </row-item>
         </row-list>
         <row-list :col="2">
-          <row-item >
-            <a-form-item
-              label="计划名称"
-              :labelCol="BaseTool.Constant.labelCol"
-              :wrapperCol="BaseTool.Constant.wrapperCol"
-            >
-              <a-input v-decorator="['orderName', {rules: [{required: true, message: '采购计划名称不能为空'}]}]" />
-            </a-form-item>
-          </row-item>
           <row-item >
             <a-form-item
               label="计划类型"
@@ -173,7 +160,7 @@
               <a-input
                 style="width: 70%"
                 disabled
-                v-decorator="['positionNo', {rules: [{required: true, message: '设备位号不能为空'}]}]" />
+                v-decorator="['positionNo']" />
               <a-button :disabled="title==='编辑'" style="width: 30%" type="primary" @click="handleSbSelect">选择</a-button>
             </a-form-item>
           </row-item>
@@ -196,13 +183,13 @@
         </row-list>
       </a-form>
     </a-card>
-    <a-card v-show="current===1">
+    <a-card>
       <div class="table-operator" style="margin-bottom: 8px;">
-        <a-button size="small" type="primary" @click="handleSpareStoreSelect">
+        <a-button size="small" :disabled="!oldOrNew" type="primary" @click="handleSpareStoreSelect">
           <a-icon type="plus"/>
           物料库添加
         </a-button>
-        <!-- <a-button size="small" style="margin-left:20px;" type="primary" @click="handleBomSpareStoreSelect">
+        <!-- <a-button size="small" :disabled="!(oldOrNew&&sbId)" style="margin-left:20px;" type="primary" @click="handleBomSpareStoreSelect">
           <a-icon type="plus"/>
           BOM添加
         </a-button> -->
@@ -227,9 +214,7 @@
       </a-table>
     </a-card>
     <template slot="footer">
-      <a-button v-show="current===0" type="primary" @click="next()">下一步</a-button>
-      <a-button v-show="current===1" type="primary" @click="back()">上一步</a-button>
-      <a-button v-show="current===1" :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
+      <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
     </template>
     <sb-info-select-modal ref="sbInfoSelectModal" @selected="handleSbSelectd"/>
     <spare-store-select-modal ref="spareStoreSelectModal" @selected="handleSpareStoreSelected"/>
@@ -260,7 +245,6 @@ export default {
       form: this.$form.createForm(this),
       visible: false,
       title: '新增',
-      current: 0,
       data: [],
       treeData: [],
       columns: [
@@ -309,7 +293,7 @@ export default {
       flagMap: {},
       tokenType: 1,
       model: {},
-      sbIds: [],
+      sbId: null,
       rows: [],
       sortNums: [],
       params: {},
@@ -320,7 +304,9 @@ export default {
       soMap: {},
       date: false,
       cbustypeMap: {},
-      confirmLoading: false
+      confirmLoading: false,
+      oldOrNew: null
+
     }
   },
 
@@ -359,7 +345,6 @@ export default {
         setFieldsValue(Object.assign(pick(record, [
           'id',
           'sbId',
-          'orderName',
           'type',
           'oldOrNew',
           'projectId',
@@ -393,6 +378,7 @@ export default {
     },
     setTree (val) {
       console.log(val)
+      this.oldOrNew = val
       fetchSbTypeTree({
         flag: val,
         type: 2
@@ -401,23 +387,6 @@ export default {
       })
     },
     save () {
-      const params = {
-        ...this.params,
-        detailDTOS: this.data
-      }
-      if (params.id) {
-        updatePurchaseOrder2(params).then(res => {
-          this.$message.success('修改成功!')
-          this.handleCancel()
-        })
-      } else {
-        addPurchaseOrder2(params).then(res => {
-          this.$message.success('创建成功!')
-          this.handleCancel()
-        })
-      }
-    },
-    next () {
       const { form: { validateFieldsAndScroll } } = this
       // this.confirmLoading = true
       validateFieldsAndScroll((errors, values) => {
@@ -430,18 +399,25 @@ export default {
         }
         values.needDate = values.needDate ? this.BaseTool.Date.formatter(values.needDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN) : null
         values.planGetDate = values.planGetDate ? this.BaseTool.Date.formatter(values.planGetDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN) : null
-        this.params = values
-        this.current = 1
+        values.detailDTOS = this.data
+        if (values.id) {
+          updatePurchaseOrder2(values).then(res => {
+            this.$message.success('修改成功!')
+            this.handleCancel()
+          })
+        } else {
+          addPurchaseOrder2(values).then(res => {
+            this.$message.success('创建成功!')
+            this.handleCancel()
+          })
+        }
       })
     },
-    back () {
-      this.current = 0
-    },
     handleSpareStoreSelect () {
       this.$refs.spareStoreSelectModal.base({ tokenType: this.params.oldOrNew })
     },
     handleBomSpareStoreSelect () {
-      this.$refs.bomSpareStoreSelectModal.base({ tokenType: this.params.oldOrNew, sbId: this.params.sbId })
+      this.$refs.bomSpareStoreSelectModal.base({ tokenType: this.params.oldOrNew, sbId: this.sbId })
     },
     handleSpareStoreSelected (record, keys, rows) {
       console.log(rows)
@@ -468,12 +444,11 @@ export default {
     },
     handleCancel (values) {
       this.visible = false
-      this.current = 0
       this.data = []
       this.date = null
       this.params = {}
       this.form.resetFields()
-      this.sbIds = []
+      this.sbId = null
       this.$emit('ok', values)
     }