linwenxin 4 månader sedan
förälder
incheckning
dafc6bc01c

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

@@ -40,6 +40,13 @@
                     <el-tab-pane v-if="formDialogType > 0 && joinCode" label="条码信息" name="codeInfo"></el-tab-pane>
                   </el-tabs>
                 </zj-form-module>
+                <zj-form-module
+                  title="计划单明细"
+                  label-width="100px"
+                  :form-data="formData"
+                  :form-items="formItemsFeicTes"
+                >
+                </zj-form-module>
               </zj-form-container>
             </div>
           </zj-page-fill>
@@ -54,6 +61,23 @@
         </zj-page-container>
       </el-dialog>
     </div>
+
+    <el-dialog title="提示" :visible.sync="dialogVisible" width="1000px" :before-close="handleCloseTes">
+      <div style="width: 960px; height: 680px">
+        <template-page
+          v-if="dialogVisible"
+          ref="pageRefTes"
+          :get-list="getListTes"
+          :table-attributes="tableAttributesTes"
+          :table-events="tableEventsTes"
+        >
+        </template-page>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="quedingtianjia">确 定</el-button>
+      </span>
+    </el-dialog>
   </template-page>
 </template>
 
@@ -74,17 +98,20 @@ import {
   goodsPurchaseConfirm,
   goodsPurchaseDel
 } from '@/api/goodsPurchasedStored.js'
+import { goodsPlanItemList } from '@/api/purchaseSchedule.js'
 import form_ty from '../mixins/common_form'
 import storage_table from '../mixins/storage_table'
 import storage_goods from '../mixins/storage_goods'
 import storage_codes from '../mixins/storage_codes'
 import common from '../mixins/common_code'
+import jihuamingxi from '../mixins/jihuamingxi'
 import { delayPerform, firstPerform, intervalPerform, passivePerform, queuePerform } from 'js-perform-lock'
 export default {
   components: { TemplatePage },
-  mixins: [import_mixin, operation_mixin, form_ty, storage_table, storage_goods, storage_codes, common],
+  mixins: [import_mixin, operation_mixin, form_ty, storage_table, storage_goods, storage_codes, common, jihuamingxi],
   data() {
     return {
+      dialogVisible: false,
       pageType: 'list',
       pageShow: true,
       // 表格属性
@@ -92,6 +119,15 @@ export default {
         // 启用勾选列
         selectColumn: false
       },
+      tableAttributesTes: {
+        // 启用勾选列
+        selectColumn: true,
+        reserveSelection: true,
+        'row-key': 'id'
+      },
+      tableEventsTes: {
+        'selection-change': this.selectionChangeTes
+      },
       // 表格事件
       tableEvents: {
         'selection-change': this.selectionChange
@@ -123,13 +159,15 @@ export default {
         storageName: '',
         fileUrl: [],
         items: [],
+        planItems: [],
         codeInfoList: []
       },
       activeName: 'goodsInfo',
       goods_material_id: '',
       joinCode: false,
       joinCodeText: JSON.parse(localStorage.getItem('greemall_user')).joinCode,
-      logs: []
+      logs: [],
+      tesXuanXiang: []
     }
   },
   computed: {
@@ -158,6 +196,59 @@ export default {
     // 更多参数
     moreParameters() {
       return []
+    },
+    formItemsFeicTes() {
+      return [
+        {
+          md: 24,
+          isShow: true,
+          name: 'slot-component',
+          formItemAttributes: {
+            label: '',
+            prop: '',
+            'label-width': '0px'
+          },
+          render: (h, { props, onInput }) => {
+            var { value } = props
+            return (
+              <div>
+                {[
+                  !!~[0, 1].indexOf(this.formDialogType) ? (
+                    <div style="margin-bottom:10px">
+                      <el-button
+                        type="primary"
+                        onClick={() => {
+                          if (this.formData.venderId) {
+                            this.dialogVisible = true
+                            this.tesXuanXiang = []
+                          } else {
+                            this.$message({
+                              dangerouslyUseHTMLString: true,
+                              type: 'warning',
+                              message: '请选择供应商',
+                              duration: 5000
+                            })
+                          }
+                        }}
+                      >
+                        添加
+                      </el-button>
+                    </div>
+                  ) : null,
+                  <zj-table
+                    columns={this.teshumingxi}
+                    tableData={this.formData.planItems}
+                    tableAttributes={{
+                      size: 'mini',
+                      border: true
+                    }}
+                  />
+                ]}
+              </div>
+            )
+          }
+        }
+      ]
     }
   },
   watch: {
@@ -167,6 +258,9 @@ export default {
       this.$nextTick(() => {
         this.pageShow = true
       })
+    },
+    'formData.venderId'() {
+      this.formData.planItems = []
     }
   },
   methods: {
@@ -188,6 +282,65 @@ export default {
         })
       }
     }),
+
+    getListTes(p, cb) {
+      return goodsPlanItemList({
+        ...p,
+        params: [
+          ...p.params,
+          { param: 'a.vender_id', compare: '=', value: this.formData.venderId },
+          { param: 'b.surplus_qty', compare: '>', value: '0' }
+        ]
+      })
+    },
+
+    handleCloseTes() {
+      this.dialogVisible = false
+    },
+
+    selectionChangeTes(data) {
+      this.tesXuanXiang = data
+    },
+
+    quedingtianjia() {
+      this.tesXuanXiang.map(item => {
+        if (!this.formData.planItems.find(v => v.goodsPlanId == item.id)) {
+          this.formData.planItems.unshift({
+            amount: '', //
+            brandId: item.brandId,
+            brandName: item.brandName,
+            enginCode: item.enginCode,
+            enginName: item.enginName,
+            factoryNo: item.factoryNo,
+            goodsMaterialId: item.goodsMaterialId,
+            goodsMaterialName: item.goodsMaterialName,
+            goodsPlanId: item.id,
+            goodsPlanItemId: item.goodsPlanItemId,
+            goodsPurchaseId: '', //
+            goodsPurchasePlanItemId: '', //
+            inStockQty: item.inStockQty,
+            insideQty: '', //
+            mainId: item.mainId,
+            mainName: item.mainName,
+            orderGoodsType: item.orderGoodsType,
+            qty: item.qty,
+            outQty: '', //
+            partsQty: '', //
+            price: '', //
+            recQty: '', //
+            retQty: '', //
+            seriesName: item.seriesName,
+            smallId: item.smallId,
+            smallName: item.smallName,
+            specsName: item.specsName,
+            surplusQty: item.surplusQty,
+            unit: item.unit
+          })
+        }
+      })
+      this.dialogVisible = false
+    },
+
     changePageType() {
       this.goods_material_id = ''
     },
@@ -321,6 +474,16 @@ export default {
               message: '仓库不能为空'
             })
           }
+          try {
+            this.formData.planItems.map((item, index) => {
+              if (!item.recQty || item.recQty == 0) {
+                throw new Error('')
+              }
+            })
+          } catch (error) {
+            this.$message.warning('到货数量必须填写并且大于0')
+            return false
+          }
           goodsPurchaseAdd({
             ...this.formData,
             items: this.formData.items.map((item, index) => ({ ...item, index: index + 1 })),

+ 101 - 21
src/views/salesPurchasing/merchandisePurchaseReturn/index.vue

@@ -1,7 +1,17 @@
 <template>
-  <template-page v-if="pageShow" ref="pageRef" :get-list="getList" :table-attributes="tableAttributes"
-    :table-events="tableEvents" :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters"
-    :column-parsing="columnParsing" :exportList="exportList" :operation="operation()" key="pageType">
+  <template-page
+    v-if="pageShow"
+    ref="pageRef"
+    :get-list="getList"
+    :table-attributes="tableAttributes"
+    :table-events="tableEvents"
+    :options-evens-group="optionsEvensGroup"
+    :moreParameters="moreParameters"
+    :column-parsing="columnParsing"
+    :exportList="exportList"
+    :operation="operation()"
+    key="pageType"
+  >
     <div slot="moreSearch">
       <el-radio-group v-model="pageType" size="mini" @change="changePageType">
         <el-radio-button label="list">列表</el-radio-button>
@@ -11,8 +21,13 @@
       <br /><br />
     </div>
     <div class="cartographer_big">
-      <el-dialog :title="formDialogTitles[formDialogType]" width="100%" :modal="false" :visible.sync="formDialog"
-        :before-close="handleClose">
+      <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">
@@ -25,6 +40,13 @@
                     <el-tab-pane v-if="formDialogType > 0 && joinCode" label="条码信息" name="codeInfo"></el-tab-pane>
                   </el-tabs>
                 </zj-form-module>
+                <zj-form-module
+                  title="计划单明细"
+                  label-width="100px"
+                  :form-data="formData"
+                  :form-items="formItemsFeicTes"
+                >
+                </zj-form-module>
               </zj-form-container>
             </div>
           </zj-page-fill>
@@ -32,7 +54,9 @@
             <el-button v-if="formDialogType == 0" size="mini" type="primary" @click="save">保存</el-button>
             <el-button v-if="formDialogType == 1" size="mini" type="primary" @click="submit">提交</el-button>
             <el-button v-if="formDialogType == 3" size="mini" type="primary" @click="examine('OK')">审核通过</el-button>
-            <el-button v-if="formDialogType == 3" size="mini" type="primary" @click="examine('FAIL')">审核驳回</el-button>
+            <el-button v-if="formDialogType == 3" size="mini" type="primary" @click="examine('FAIL')"
+              >审核驳回</el-button
+            >
           </div>
         </zj-page-container>
       </el-dialog>
@@ -62,10 +86,20 @@ import out_storage_table from '../mixins/out_storage_table'
 import out_storage_goods from '../mixins/out_storage_goods'
 import out_storage_codes from '../mixins/out_storage_codes'
 import common from '../mixins/common_code'
-import { delayPerform, firstPerform, intervalPerform, passivePerform, queuePerform } from "js-perform-lock";
+import jihuamingxith from '../mixins/jihuamingxith'
+import { delayPerform, firstPerform, intervalPerform, passivePerform, queuePerform } from 'js-perform-lock'
 export default {
   components: { TemplatePage },
-  mixins: [import_mixin, operation_mixin, form_ty, out_storage_table, out_storage_goods, out_storage_codes, common],
+  mixins: [
+    import_mixin,
+    operation_mixin,
+    form_ty,
+    out_storage_table,
+    out_storage_goods,
+    out_storage_codes,
+    common,
+    jihuamingxith
+  ],
   data() {
     return {
       pageType: 'list',
@@ -103,14 +137,15 @@ export default {
         venderId: '',
         venderName: '',
         codeInfoList: [],
-		storageId: '',
-		storageName: '',
+        storageId: '',
+        storageName: '',
+        planItems: []
       },
       activeName: 'goodsInfo',
       goods_material_id: '',
       joinCode: false,
-	  joinCodeText: JSON.parse(localStorage.getItem('greemall_user')).joinCode,
-      logs:[]
+      joinCodeText: JSON.parse(localStorage.getItem('greemall_user')).joinCode,
+      logs: []
     }
   },
   computed: {
@@ -138,6 +173,37 @@ export default {
     // 更多参数
     moreParameters() {
       return []
+    },
+    formItemsFeicTes() {
+      return [
+        {
+          md: 24,
+          isShow: true,
+          name: 'slot-component',
+          formItemAttributes: {
+            label: '',
+            prop: '',
+            'label-width': '0px'
+          },
+          render: (h, { props, onInput }) => {
+            var { value } = props
+            return (
+              <div>
+                {[
+                  <zj-table
+                    columns={this.teshumingxi}
+                    tableData={this.formData.planItems}
+                    tableAttributes={{
+                      size: 'mini',
+                      border: true
+                    }}
+                  />
+                ]}
+              </div>
+            )
+          }
+        }
+      ]
     }
   },
   watch: {
@@ -150,18 +216,22 @@ export default {
     }
   },
   methods: {
-    tishicuowu:(new delayPerform(500)).refactor(function( /**可接收参数**/ ){
-      if(this.logs){
-        var logs = Array.from(new Set(JSON.parse(JSON.stringify(this.logs)).map(item=>{
-          return `${item.index!==undefined ? "第" + (item.index+1) +"行:" : ""}${item.errMsg}`
-        })))
+    tishicuowu: new delayPerform(500).refactor(function (/**可接收参数**/) {
+      if (this.logs) {
+        var logs = Array.from(
+          new Set(
+            JSON.parse(JSON.stringify(this.logs)).map(item => {
+              return `${item.index !== undefined ? '第' + (item.index + 1) + '行:' : ''}${item.errMsg}`
+            })
+          )
+        )
         this.logs = []
         this.$message({
           dangerouslyUseHTMLString: true,
           type: 'warning',
-          message: logs.join("<div/>"),
-          duration: 5000,
-        });
+          message: logs.join('<div/>'),
+          duration: 5000
+        })
       }
     }),
     changePageType() {
@@ -206,7 +276,7 @@ export default {
     openForm() {
       this.isEditIndex = -1
       this.getGysList()
-	  this.getWarehouseList()
+      this.getWarehouseList()
       this.getCgrkOrder()
     },
     // 打开详情弹窗
@@ -289,6 +359,16 @@ export default {
     save() {
       this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
         if (valid) {
+          try {
+            this.formData.planItems.map((item, index) => {
+              if (!item.retQty || item.retQty == 0) {
+                throw new Error('')
+              }
+            })
+          } catch (error) {
+            this.$message.warning('退货数量必须填写并且大于0')
+            return false
+          }
           goodsPurchaseRetAdd({
             ...this.formData,
             items: this.formData.items.map((item, index) => ({ ...item, index: index + 1 })),

+ 1 - 0
src/views/salesPurchasing/mixins/common_form.js

@@ -198,6 +198,7 @@ export default {
                                     retAmount: '',
                                     details: {}
                                   }))
+                                  this.formData.planItems = res.data.planItems
                                 })
                               }
                             }}

+ 172 - 0
src/views/salesPurchasing/mixins/jihuamingxi.js

@@ -0,0 +1,172 @@
+import { required } from '@/components/template/rules_verify.js'
+
+export default {
+  data() {
+    return {}
+  },
+  computed: {
+    teshumingxi() {
+      return [
+        {
+          columnAttributes: {
+            label: '计划单号',
+            prop: 'goodsPlanId',
+            width: 160
+          }
+        },
+
+        {
+          columnAttributes: {
+            label: '订货类型',
+            prop: 'orderGoodsType',
+            width: 120
+          },
+          render: (h, { row, column, index }) => {
+            return (
+              <div style="padding:0 6px">
+                {{ E: '工程机', S: '零售机', O: '非空类' }[row[column.columnAttributes.prop]] || ''}
+              </div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '工程登入编号',
+            prop: 'enginCode',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '工程名称',
+            prop: 'enginName',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '商品大类',
+            prop: 'mainName',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '商品小类',
+            prop: 'smallName',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '商品名称',
+            prop: 'goodsMaterialName',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '规格型号',
+            prop: 'specsName',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '单位',
+            prop: 'unit'
+          },
+          render: (h, { row, column, index }) => {
+            return <div style="padding:0 6px">{{ C: '整套', I: '单个' }[row[column.columnAttributes.prop]] || ''}</div>
+          }
+        },
+        {
+          columnAttributes: {
+            label: '到货数量',
+            prop: 'recQty',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return !!~[0, 1].indexOf(this.formDialogType) ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`planItems.${index}.${column.columnAttributes.prop}`}
+                  rules={[...required]}
+                >
+                  <el-input
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val <= 0 ? 0 : Number(val)
+                    }}
+                    type="number"
+                    placeholder="请输入"
+                  ></el-input>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">{row[column.columnAttributes.prop]}</div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '计划采购数量',
+            prop: 'qty'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '已入库数量',
+            prop: 'inStockQty'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '剩余数量',
+            prop: 'surplusQty'
+          }
+        },
+
+        ...(() => {
+          if (!!~[0, 1].indexOf(this.formDialogType)) {
+            return [
+              {
+                columnAttributes: {
+                  label: '操作',
+                  fixed: 'right',
+                  width: 140
+                },
+                render: (h, { row, column, index }) => {
+                  return (
+                    <div style="padding:0 6px" class="operation-btns">
+                      {[
+                        this.formDialogType == 0 ? (
+                          <el-button
+                            type="text"
+                            onClick={() => {
+                              this.delTesInfo(row, index)
+                            }}
+                          >
+                            删除
+                          </el-button>
+                        ) : null
+                      ]}
+                    </div>
+                  )
+                }
+              }
+            ]
+          }
+          return []
+        })()
+      ]
+    }
+  },
+  methods: {
+    delTesInfo(row, index) {
+      this.formData?.planItems?.splice(index, 1)
+    }
+  }
+}

+ 179 - 0
src/views/salesPurchasing/mixins/jihuamingxith.js

@@ -0,0 +1,179 @@
+import { required } from '@/components/template/rules_verify.js'
+
+export default {
+  data() {
+    return {}
+  },
+  computed: {
+    teshumingxi() {
+      return [
+        {
+          columnAttributes: {
+            label: '计划单号',
+            prop: 'goodsPlanId',
+            width: 160
+          }
+        },
+
+        {
+          columnAttributes: {
+            label: '订货类型',
+            prop: 'orderGoodsType',
+            width: 120
+          },
+          render: (h, { row, column, index }) => {
+            return (
+              <div style="padding:0 6px">
+                {{ E: '工程机', S: '零售机', O: '非空类' }[row[column.columnAttributes.prop]] || ''}
+              </div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '工程登入编号',
+            prop: 'enginCode',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '工程名称',
+            prop: 'enginName',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '商品大类',
+            prop: 'mainName',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '商品小类',
+            prop: 'smallName',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '商品名称',
+            prop: 'goodsMaterialName',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '规格型号',
+            prop: 'specsName',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '单位',
+            prop: 'unit'
+          },
+          render: (h, { row, column, index }) => {
+            return <div style="padding:0 6px">{{ C: '整套', I: '单个' }[row[column.columnAttributes.prop]] || ''}</div>
+          }
+        },
+        {
+          columnAttributes: {
+            label: '退货数量',
+            prop: 'retQty',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return !!~[0, 1].indexOf(this.formDialogType) ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`planItems.${index}.${column.columnAttributes.prop}`}
+                  rules={[...required]}
+                >
+                  <el-input
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val <= 0 ? 0 : val > row.recQty ? row.recQty : Number(val)
+                    }}
+                    type="number"
+                    placeholder="请输入"
+                  ></el-input>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">{row[column.columnAttributes.prop]}</div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '到货数量',
+            prop: 'recQty',
+            width: 160
+          }
+        },
+        {
+          columnAttributes: {
+            label: '计划采购数量',
+            prop: 'qty'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '已入库数量',
+            prop: 'inStockQty'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '剩余数量',
+            prop: 'surplusQty'
+          }
+        },
+
+        ...(() => {
+          if (!!~[0, 1].indexOf(this.formDialogType)) {
+            return [
+              {
+                columnAttributes: {
+                  label: '操作',
+                  fixed: 'right',
+                  width: 140
+                },
+                render: (h, { row, column, index }) => {
+                  return (
+                    <div style="padding:0 6px" class="operation-btns">
+                      {[
+                        this.formDialogType == 0 ? (
+                          <el-button
+                            type="text"
+                            onClick={() => {
+                              this.delTesInfo(row, index)
+                            }}
+                          >
+                            删除
+                          </el-button>
+                        ) : null
+                      ]}
+                    </div>
+                  )
+                }
+              }
+            ]
+          }
+          return []
+        })()
+      ]
+    }
+  },
+  methods: {
+    delTesInfo(row, index) {
+      this.formData?.planItems?.splice(index, 1)
+    }
+  }
+}