aXin-0810 1 год назад
Родитель
Сommit
192a327e69

+ 5 - 2
src/views/salesPurchasing/goodsPurchasedStored/index.vue

@@ -112,7 +112,8 @@ export default {
         venderId: '',
         venderName: '',
         fileUrl: [],
-        items: []
+        items: [],
+        codeInfoList: []
       },
       activeName: 'goodsInfo'
     }
@@ -203,6 +204,7 @@ export default {
       this.$refs?.formRef?.resetFields()
       this.$data.formData = this.$options.data().formData
       this.formDialog = false
+      this.formDialogType = 0
     },
     // 操作按钮
     operation() {
@@ -237,7 +239,8 @@ export default {
           goodsPurchaseAdd({
             ...this.formData,
             items: this.formData.items.map((item, index) => ({ ...item, index: index + 1 })),
-            fileUrl: this.formData.fileUrl.map(item => item.url).join(',')
+            fileUrl: this.formData.fileUrl.map(item => item.url).join(','),
+            codeInfoList: undefined
           }).then(res => {
             this.$message({
               type: 'success',

+ 66 - 9
src/views/salesPurchasing/merchandisePurchaseReturn/index.vue

@@ -19,12 +19,43 @@
       </el-radio-group>
       <br /><br />
     </div>
+    <div class="cartographer_big">
+      <el-dialog
+        :title="formDialogTitles[formDialogType]"
+        width="100%"
+        :modal="false"
+        :visible.sync="formDialog"
+        :before-close="handleClose"
+      >
+        <zj-page-container>
+          <zj-page-fill>
+            <div style="box-sizing: border-box; padding: 20px 20px 0 20px">
+              <zj-form-container ref="formRef" :form-data="formData" :form-attributes="{ size: 'mini' }">
+                <zj-form-module title="单据信息" label-width="100px" :form-data="formData" :form-items="formItems">
+                </zj-form-module>
+                <zj-form-module title="" label-width="100px" :form-data="formData" :form-items="formItems2">
+                  <el-tabs slot="header" v-model="activeName">
+                    <el-tab-pane label="商品信息" name="goodsInfo"></el-tab-pane>
+                    <el-tab-pane v-if="formDialogType > 0" label="条码信息" name="codeInfo"></el-tab-pane>
+                  </el-tabs>
+                </zj-form-module>
+              </zj-form-container>
+            </div>
+          </zj-page-fill>
+          <div style="text-align: right; box-sizing: border-box; padding: 16px 20px">
+            <el-button size="mini">取消</el-button>
+            <el-button size="mini" type="primary">确定</el-button>
+          </div>
+        </zj-page-container>
+      </el-dialog>
+    </div>
   </template-page>
 </template>
 
 <script>
 import TemplatePage from '@/components/template/template-page-1.vue'
 import import_mixin from '@/components/template/import_mixin.js'
+import operation_mixin from '@/components/template/operation_mixin.js'
 import {
   goodsPurchaseRetList,
   goodsPurchaseRetListExport,
@@ -33,15 +64,15 @@ import {
   goodsPurchaseRetCodeList,
   goodsPurchaseRetCodeListExport
 } from '@/api/merchandisePurchaseReturn.js'
+import form_ty from '../mixins/form_ty'
+import table_cg from '../mixins/table_cg'
 export default {
   components: { TemplatePage },
-  mixins: [import_mixin],
+  mixins: [import_mixin, operation_mixin, form_ty, table_cg],
   data() {
     return {
       pageType: 'list',
       pageShow: true,
-      // 事件组合
-      optionsEvensGroup: [],
       // 表格属性
       tableAttributes: {
         // 启用勾选列
@@ -55,22 +86,45 @@ export default {
       recordSelected: [],
       /** 表单变量 */
       formDialogType: 0,
-      formDialogTitles: ['新增', '编辑', '详情'],
+      formDialogTitles: ['新增退货单', '编辑退货单', '退货单详情'],
       formDialog: false,
-      appraise_status: ''
+      appraise_status: '',
+      formData: {
+        fileUrl: [],
+        items: []
+      },
+      activeName: 'goodsInfo'
     }
   },
   computed: {
+    // 事件组合
+    optionsEvensGroup() {
+      if (this.pageType == 'list') {
+        return [
+          [
+            [
+              this.optionsEvensAuth('add', {
+                click: () => {
+                  this.formDialog = true
+                }
+              })
+            ]
+          ]
+        ]
+      } else if (this.pageType == 'goodsder') {
+        return []
+      } else if (this.pageType == 'codeder') {
+        return []
+      }
+    },
     // 更多参数
     moreParameters() {
       return []
-    },
-    formItems() {
-      return []
     }
   },
   watch: {
     pageType() {
+      this.handleClose()
       this.pageShow = false
       this.$nextTick(() => {
         this.pageShow = true
@@ -106,7 +160,10 @@ export default {
     selectionChange(data) {
       this.recordSelected = data
     },
-    changePageType() {}
+    changePageType() {},
+    handleClose() {
+      this.formDialog = false
+    }
   }
 }
 </script>

+ 2 - 1
src/views/salesPurchasing/mixins/form_ty.js

@@ -381,7 +381,8 @@ export default {
         {
           columnAttributes: {
             label: '规格型号',
-            prop: 'specsName'
+            prop: 'specsName',
+            width: 120
           }
         }
       ]

+ 56 - 15
src/views/salesPurchasing/mixins/table_cg.js

@@ -1,7 +1,8 @@
 import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
+import { goodsPurchaseCodeList } from '@/api/goodsPurchasedStored.js'
 export default {
   data() {
-    return { codeInfoList: [] }
+    return {}
   },
   computed: {
     formItems2() {
@@ -234,7 +235,7 @@ export default {
                   ? [
                       this.formDialogType == 1 ? (
                         <div style="margin-bottom:10px">
-                          <el-button type="primary" onClick={this.addCodeInfo}>
+                          <el-button type="primary" onClick={this.addCodeInfo} disabled={this.isEditIndex != -1}>
                             添加
                           </el-button>
                         </div>
@@ -254,7 +255,7 @@ export default {
                                   <el-form-item
                                     label=""
                                     lebel-width="0px"
-                                    prop={`items.${index}.${column.columnAttributes.prop}`}
+                                    prop={`codeInfoList.${index}.${column.columnAttributes.prop}`}
                                     rules={required}
                                   >
                                     <el-select
@@ -291,7 +292,7 @@ export default {
                                   <el-form-item
                                     label=""
                                     lebel-width="0px"
-                                    prop={`items.${index}.${column.columnAttributes.prop}`}
+                                    prop={`codeInfoList.${index}.${column.columnAttributes.prop}`}
                                     rules={required}
                                   >
                                     <el-select
@@ -335,7 +336,7 @@ export default {
                                   <el-form-item
                                     label=""
                                     lebel-width="0px"
-                                    prop={`items.${index}.${column.columnAttributes.prop}`}
+                                    prop={`codeInfoList.${index}.${column.columnAttributes.prop}`}
                                     rules={required}
                                   >
                                     <el-input
@@ -364,7 +365,7 @@ export default {
                                   <el-form-item
                                     label=""
                                     lebel-width="0px"
-                                    prop={`items.${index}.${column.columnAttributes.prop}`}
+                                    prop={`codeInfoList.${index}.${column.columnAttributes.prop}`}
                                     rules={required}
                                   >
                                     <el-input
@@ -398,16 +399,31 @@ export default {
                                           : this.formDialogType == 1
                                           ? [
                                               this.isEditIndex == index ? (
-                                                <el-button type="text" onClick={() => {}}>
+                                                <el-button
+                                                  type="text"
+                                                  onClick={() => {
+                                                    this.addCode(row)
+                                                  }}
+                                                >
                                                   保存
                                                 </el-button>
                                               ) : null,
-                                              !this.isEditIndex == index ? (
-                                                <el-button type="text" onClick={() => {}}>
+                                              this.isEditIndex == -1 ? (
+                                                <el-button
+                                                  type="text"
+                                                  onClick={() => {
+                                                    this.isEditIndex = index
+                                                  }}
+                                                >
                                                   编辑
                                                 </el-button>
                                               ) : null,
-                                              <el-button type="text" onClick={() => {}}>
+                                              <el-button
+                                                type="text"
+                                                onClick={() => {
+                                                  this.delCode(row)
+                                                }}
+                                              >
                                                 删除
                                               </el-button>
                                             ]
@@ -421,7 +437,7 @@ export default {
                             return []
                           })()
                         ]}
-                        tableData={this.codeInfoList}
+                        tableData={this.formData.codeInfoList}
                         tableAttributes={{
                           size: 'mini',
                           border: true
@@ -438,11 +454,12 @@ export default {
   },
   watch: {
     activeName(newVal) {
+      this.isEditIndex = -1
       if (newVal == 'codeInfo') {
-        // 获取条码列表数据
+        this.getGoodsPurchaseCodeList()
       } else {
         // 清空条码数据列表
-        this.codeInfoList = []
+        this.formData.codeInfoList = []
       }
     }
   },
@@ -553,9 +570,30 @@ export default {
         this.isEditIndex = -1
       }
     },
+    getCodeVfyKey() {
+      return [
+        `codeInfoList.${this.isEditIndex}.brandId`,
+        `codeInfoList.${this.isEditIndex}.mainId`,
+        `codeInfoList.${this.isEditIndex}.smallId`,
+        `codeInfoList.${this.isEditIndex}.goodsMaterialId`,
+        `codeInfoList.${this.isEditIndex}.qty`,
+        `codeInfoList.${this.isEditIndex}.price`
+      ]
+    },
+    getGoodsPurchaseCodeList() {
+      if (this.formData.id) {
+        goodsPurchaseCodeList({
+          pageNum: 1,
+          pageSize: -1,
+          params: [{ param: 'a.id', compare: '=', value: this.formData.id }]
+        }).then(res => {
+          this.formData.codeInfoList = res.data.records
+        })
+      }
+    },
     // 添加条码信息
     addCodeInfo() {
-      this.codeInfoList.unshift({
+      this.formData.codeInfoList.unshift({
         brandId: '',
         brandName: '',
         mainId: '',
@@ -571,6 +609,9 @@ export default {
         code: '',
         codeQty: ''
       })
-    }
+      this.isEditIndex = 0
+    },
+    addCode(row) {},
+    delCode(row) {}
   }
 }