소스 검색

no message

linwenxin 9 달 전
부모
커밋
9c52ffe8a8

+ 1 - 0
src/api/AuxiliaryAccessoriesWarehouse.js

@@ -55,3 +55,4 @@ export function websitGoodsMoveDel(params) {
     params
   })
 }
+

+ 264 - 40
src/views/auxiliaryFittings/AuxiliaryAccessoriesWarehouse/index.vue

@@ -15,21 +15,34 @@
       >
       </template-page>
       <div v-if="~['add', 'examine', 'detail'].indexOf(activeKey)">
-        <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
-          <zj-form-module
-            title=""
-            label-width="100px"
-            :showPackUp="false"
-            :form-data="formData"
-            :form-items="formItems"
-          >
-          </zj-form-module>
-        </zj-form-container>
-        <div slot="footer" class="dialog-footer">
-          <el-button size="mini" @click="data.removeTab()">取 消</el-button>
-          <el-button v-if="formDialogType !== 2" size="mini" @click="formConfirm(data.removeTab)" type="primary"
-            >确 定</el-button
-          >
+        <div style="box-sizing: border-box; padding: 20px">
+          <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
+            <zj-form-module
+              title="单据信息"
+              label-width="100px"
+              :showPackUp="false"
+              :form-data="formData"
+              :form-items="formItems"
+            >
+            </zj-form-module>
+            <zj-form-module
+              title="产品信息"
+              label-width="100px"
+              :showPackUp="false"
+              :form-data="formData"
+              :form-items="formItems2"
+            >
+            </zj-form-module>
+          </zj-form-container>
+          <div slot="footer" class="dialog-footer">
+            <el-button size="mini" @click="data.removeTab()">取 消</el-button>
+            <el-button v-if="formDialogType !== 2" size="mini" @click="formSubmit(data.removeTab)" type="primary"
+              >保 存</el-button
+            >
+            <el-button v-if="formDialogType == 1" size="mini" @click="formConfirm(data.removeTab)" type="primary"
+              >审 核</el-button
+            >
+          </div>
         </div>
       </div>
     </template>
@@ -44,17 +57,21 @@ import {
   websitGoodsMoveList,
   websitGoodsMoveListExport,
   websitGoodsMoveAdd,
+  websitGoodsMoveSubmit,
   websitGoodsMoveDetail,
   websitGoodsMoveConfirm,
-  websitGoodsMoveSubmit,
   websitGoodsMoveDel
 } from '@/api/AuxiliaryAccessoriesWarehouse'
-
 import ImageUpload from '@/components/file-upload'
 import operation_mixin from '@/components/template/operation_mixin.js'
+import editTable from '@/components/template/editTable.js'
+import { getWebsit } from '@/api/customerManagement.js'
+import { storageListPageV2 } from '@/api/storage'
+import { materialCategoryList } from '@/api/auxiliaryMaterialClass'
+import storage_table from './storage_table.js'
 export default {
   components: { TemplatePage, ImageUpload },
-  mixins: [import_mixin, operation_mixin],
+  mixins: [import_mixin, operation_mixin, storage_table],
   data() {
     return {
       // 表格属性
@@ -71,19 +88,27 @@ export default {
       /** 表单变量 */
       formDialogType: 0,
       formDialogTitles: ['新增', '审核', '查看'],
-      formDialog: false,
       formData: {
-        chargingStandardTypeId: '',
-        brandId: '',
-        oneCategoryId: '',
-        twoCategoryId: '',
-        status: true
+        companyWechatId: '',
+        companyWechatName: '',
+        examineBy: '',
+        examineTime: '',
+        inStorageId: '',
+        inStorageName: '',
+        items: [],
+        outStorageId: '',
+        outStorageName: '',
+        remark: '',
+        status: '',
+        submitBy: '',
+        submitTime: '',
+        totalQty: '',
+        type: '',
+        websitId: '',
+        websitName: ''
       },
-      businessTypeList: [], // 业务类型列表
-      brandList: [], // 品牌列表
-      mainList: [], // 一级分类列表
-      smallList: [], // 二级分类列表
-      formVisible: false
+      websitSelectList: [],
+      warehouseList: []
     }
   },
   computed: {
@@ -106,7 +131,177 @@ export default {
       return []
     },
     formItems() {
-      return []
+      return [
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-select',
+          options: [
+            { label: '保存', value: 'SAVE' },
+            { label: '待审核', value: 'WAIT' },
+            { label: '通过', value: 'OK' },
+            { label: '失败', value: 'FAIL' }
+          ],
+          attributes: { disabled: true },
+          formItemAttributes: {
+            label: '单据状态',
+            prop: 'status',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '', disabled: true },
+          formItemAttributes: {
+            label: '单据编号',
+            prop: 'id',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', disabled: true },
+          formItemAttributes: {
+            label: '所属商户',
+            prop: 'companyWechatName',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-select',
+          options: this.websitSelectList.map(item => ({ label: item.name, value: item.websitId })),
+          attributes: {},
+          formItemAttributes: {
+            label: '网点名称',
+            prop: 'websitId',
+            rules: [...required]
+          }
+        },
+        {
+          md: 6,
+          name: 'el-radio',
+          options: [
+            // { label: '商品', value: 'G' }
+            { label: '辅材', value: 'M' },
+            { label: '配件', value: 'P' }
+          ],
+          attributes: {
+            disabled: this.formDialogType == 2
+          },
+          formItemAttributes: {
+            label: '调仓产品',
+            prop: 'type',
+            rules: [...required]
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-select',
+          options: this.warehouseList
+            .map(item => ({ label: item.storageName, value: item.storageId }))
+            .filter(item => item.value !== this.formData.inStorageId),
+          attributes: {
+            disabled: this.formDialogType == 2
+          },
+          formItemAttributes: {
+            label: '调出仓库',
+            prop: 'outStorageId',
+            rules: [...required]
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-select',
+          options: this.warehouseList
+            .map(item => ({ label: item.storageName, value: item.storageId }))
+            .filter(item => item.value !== this.formData.outStorageId),
+          attributes: {
+            disabled: this.formDialogType == 2
+          },
+          formItemAttributes: {
+            label: '调入仓库',
+            prop: 'inStorageId',
+            rules: [...required]
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'slot-component',
+          attributes: { placeholder: '' },
+          formItemAttributes: {
+            label: '',
+            prop: '',
+            'label-width': '0px'
+          },
+          render: (h, { props, onInput }) => {
+            return <div></div>
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', disabled: true },
+          formItemAttributes: {
+            label: '制单人',
+            prop: 'createBy',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', disabled: true },
+          formItemAttributes: {
+            label: '制单时间',
+            prop: 'createTime',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', disabled: true },
+          formItemAttributes: {
+            label: '审核人',
+            prop: 'examineBy',
+            rules: []
+          }
+        },
+        {
+          md: 6,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', disabled: true },
+          formItemAttributes: {
+            label: '审核时间',
+            prop: 'examineTime',
+            rules: []
+          }
+        },
+        {
+          md: 24,
+          isShow: true,
+          name: 'el-input',
+          attributes: { placeholder: '请输入', type: 'textarea', rows: 5, disabled: this.formDialogType == 2 },
+          formItemAttributes: {
+            label: '备注',
+            prop: 'remark',
+            rules: []
+          }
+        }
+      ]
     }
   },
   methods: {
@@ -141,7 +336,6 @@ export default {
     },
     // 取消 新增编辑
     formCancel() {
-      this.formVisible = false
       this.$refs?.formRef?.resetFields()
       this.$data.formData = this.$options.data().formData
     },
@@ -153,12 +347,11 @@ export default {
         // 唯一标识
         key: type,
         // 页签名称
-        label: { edit: 'examine', add: '新增', detail: '查看' }[type],
+        label: { examine: '审核', add: '新增', detail: '查看' }[type],
         // 打开时事件
         triggerEvent: () => {
           this.formCancel()
           this.$nextTick(() => {
-            this.formVisible = true
             if (type == 'add') {
               this.formDialogType = 0
               this.initData()
@@ -182,27 +375,39 @@ export default {
       })
     },
     initData() {
-      // Promise.all([
-      // ]).then(([res1, res2, res3]) => {
-      // })
+      this.getBaseList()
+      Promise.all([
+        getWebsit({ type: 'C', status: true }),
+        storageListPageV2({
+          pageNum: 1,
+          pageSize: -1,
+          params: [
+            { param: 'a.type', compare: 'like', value: '商品' },
+            { param: 'a.status', compare: '=', value: 'true' }
+          ]
+        })
+      ]).then(([res1, res2]) => {
+        this.websitSelectList = res1.data
+        this.warehouseList = res2.data.records
+      })
     },
-    formConfirm(cancel) {
+    formSubmit(cancel) {
       this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
         if (valid) {
           if (this.formDialogType == 0) {
             websitGoodsMoveAdd({ ...this.formData }).then(res => {
               this.$message({
                 type: 'success',
-                message: this.formDialogTitles[this.formDialogType] + `成功!`
+                message: `保存成功!`
               })
               cancel('list')
               this.$refs.pageRef.refreshList()
             })
           } else if (this.formDialogType == 1) {
-            websitGoodsMoveConfirm({ ...this.formData }).then(res => {
+            websitGoodsMoveAdd({ ...this.formData }).then(res => {
               this.$message({
                 type: 'success',
-                message: this.formDialogTitles[this.formDialogType] + `成功!`
+                message: `保存成功!`
               })
               cancel('list')
               this.$refs.pageRef.refreshList()
@@ -210,6 +415,25 @@ export default {
           }
         }
       })
+    },
+    formConfirm(cancel) {
+      this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
+        if (valid) {
+          websitGoodsMoveAdd({ ...this.formData }).then(res => {
+            websitGoodsMoveSubmit({ id: this.formData.id }).then(res => {
+              websitGoodsMoveConfirm({ id: this.formData.id, statusEnum: 'OK' }).then(res => {
+                this.$message({
+                  type: 'success',
+                  message: `审核成功!`
+                })
+                cancel('list')
+                this.$refs.pageRef.refreshList()
+                // 备注
+              })
+            })
+          })
+        }
+      })
     }
   }
 }

+ 564 - 0
src/views/auxiliaryFittings/AuxiliaryAccessoriesWarehouse/storage_table.js

@@ -0,0 +1,564 @@
+import { listPageV2 } from '@/api/auxiliaryFittings/supplier'
+import { materialCategoryList } from '@/api/auxiliaryMaterialClass'
+import { materialNormList } from '@/api/auxiliaryPriceManagement'
+import { listPageV2 as peijianList } from '@/api/auxiliaryFittings/attachmentProfile'
+import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
+export default {
+  data() {
+    return {
+      materialCategoryListL1: [],
+      materialCategoryListL2: [],
+      materialNormList: [],
+      peijianList: [],
+      listPageV2Data: []
+    }
+  },
+  computed: {
+    // 事件组合
+    columns() {
+      return [
+        ...(() => {
+          if (this.formData.type == 'M') {
+            return [
+              {
+                columnAttributes: {
+                  label: '大类名称',
+                  prop: 'parentCategoryId'
+                },
+                render: (h, { row, column, index }) => {
+                  return row.isEditRow ? (
+                    <div class="redbordererr">
+                      <el-form-item
+                        label=""
+                        lebel-width="0px"
+                        prop={`items.${index}.parentCategoryId`}
+                        rules={required}
+                      >
+                        <el-select
+                          value={row[column.columnAttributes.prop]}
+                          onInput={val => {
+                            row[column.columnAttributes.prop] = val
+                          }}
+                          onChange={val => {
+                            row['goodsCategoryId'] = ''
+                            row['goodsCategoryName'] = ''
+                            row['goodsId'] = ''
+                            row['goodsName'] = ''
+                            this.materialNormList = []
+                            this.qkrow(row)
+                            if (val) {
+                              row['parentCategoryName'] = this.materialCategoryListL1.find(
+                                item => item.categoryId == val
+                              ).categoryName
+                            } else {
+                              row['parentCategoryName'] = ''
+                            }
+                            this.$nextTick(this.jiaoyan)
+                          }}
+                          placeholder="请选择"
+                        >
+                          {this.materialCategoryListL1.map((item, index_) => (
+                            <el-option key={index_} label={item.categoryName} value={item.categoryId}></el-option>
+                          ))}
+                        </el-select>
+                      </el-form-item>
+                    </div>
+                  ) : (
+                    <div>{row['parentCategoryName']}</div>
+                  )
+                }
+              }
+            ]
+          }
+          return []
+        })(),
+        ...(() => {
+          if (this.formData.type == 'M') {
+            return [
+              {
+                columnAttributes: {
+                  label: '小类名称',
+                  prop: 'goodsCategoryId'
+                },
+                render: (h, { row, column, index }) => {
+                  var selectList = row['parentCategoryId']
+                    ? this.materialCategoryListL2.filter(item => item.parentCategoryId == row['parentCategoryId'])
+                    : []
+                  return row.isEditRow ? (
+                    <div class="redbordererr">
+                      <el-form-item label="" lebel-width="0px" prop={`items.${index}.goodsCategoryId`} rules={required}>
+                        <el-select
+                          value={row[column.columnAttributes.prop]}
+                          onInput={val => {
+                            row[column.columnAttributes.prop] = val
+                          }}
+                          placeholder="请选择"
+                          onChange={val => {
+                            row['goodsId'] = ''
+                            row['goodsName'] = ''
+                            this.qkrow(row)
+                            if (val) {
+                              row['goodsCategoryName'] = selectList.find(item => item.categoryId == val).categoryName
+                              materialNormList({
+                                isShowStockQty: true,
+                                websitId: this.formData.websitId,
+                                storageId: this.formData.storageId,
+                                pageNum: 1,
+                                pageSize: -1,
+                                params: [
+                                  { param: 'b.category_id', compare: '=', value: val },
+                                  { param: 'a.status', compare: '=', value: 'ON' }
+                                ]
+                              }).then(res => {
+                                this.materialNormList = res.data.records
+                              })
+                            } else {
+                              this.materialNormList = []
+                              row['goodsCategoryName'] = ''
+                            }
+                            this.$nextTick(this.jiaoyan)
+                          }}
+                        >
+                          {selectList.map((item, index_) => (
+                            <el-option key={index_} label={item.categoryName} value={item.categoryId}></el-option>
+                          ))}
+                        </el-select>
+                      </el-form-item>
+                    </div>
+                  ) : (
+                    <div>{row['goodsCategoryName']}</div>
+                  )
+                }
+              }
+            ]
+          }
+          return []
+        })(),
+        ...(() => {
+          if (this.formData.type == 'M') {
+            return [
+              {
+                columnAttributes: {
+                  label: '辅材',
+                  prop: 'goodsId'
+                },
+                render: (h, { row, column, index }) => {
+                  return row.isEditRow ? (
+                    <div class="redbordererr">
+                      <el-form-item label="" lebel-width="0px" prop={`items.${index}.goodsId`} rules={required}>
+                        <el-select
+                          value={row[column.columnAttributes.prop]}
+                          onInput={val => {
+                            row[column.columnAttributes.prop] = val
+                          }}
+                          placeholder="请选择"
+                          onChange={val => {
+                            if (val) {
+                              var data = this.materialNormList.find(item => item.goodsId == val)
+                              row['goodsName'] = data.goodsName
+                              this.qkrow(row, {
+                                goodsStockUnit: data.goodsStockUnit,
+                                goodsCode: data.goodsCode,
+                                goodsSpecification: data.goodsSpecification,
+                                brand: '',
+                                productCategory: ''
+                              })
+                            } else {
+                              row['goodsName'] = ''
+                              this.qkrow(row)
+                            }
+                            this.$nextTick(this.jiaoyan)
+                          }}
+                        >
+                          {this.materialNormList
+                            .filter(
+                              item =>
+                                !~[
+                                  ...this.formData.items.map(val => val.goodsId).filter(val => val != row.goodsId)
+                                ].indexOf(item.goodsId)
+                            )
+                            .map((item, index_) => (
+                              <el-option key={index_} label={item.goodsName} value={item.goodsId}></el-option>
+                            ))}
+                        </el-select>
+                      </el-form-item>
+                    </div>
+                  ) : (
+                    <div>{row['goodsName']}</div>
+                  )
+                }
+              }
+            ]
+          }
+          return []
+        })(),
+        ...(() => {
+          if (this.formData.type == 'P') {
+            return [
+              {
+                columnAttributes: {
+                  label: '配件',
+                  prop: 'goodsId'
+                },
+                render: (h, { row, column, index }) => {
+                  return row.isEditRow ? (
+                    <div class="redbordererr">
+                      <el-form-item label="" lebel-width="0px" prop={`items.${index}.goodsId`} rules={required}>
+                        <el-select
+                          value={row[column.columnAttributes.prop]}
+                          onInput={val => {
+                            row[column.columnAttributes.prop] = val
+                          }}
+                          placeholder="请选择"
+                          onChange={val => {
+                            this.materialNormList = []
+                            if (val) {
+                              var data = this.peijianList.find(item => item.goodsId == val)
+                              row['goodsName'] = data.goodsName
+                              this.qkrow(row, {
+                                goodsStockUnit: data.goodsStockUnit,
+                                goodsCode: data.goodsCode,
+                                goodsSpecification: data.goodsSpecification,
+                                brand: data.brandRelaName,
+                                productCategory: data.productRelaName
+                              })
+                            } else {
+                              row['goodsName'] = ''
+                              this.qkrow(row)
+                            }
+                            this.$nextTick(this.jiaoyan)
+                          }}
+                        >
+                          {this.peijianList
+                            .filter(
+                              item =>
+                                !~[
+                                  ...this.formData.items.map(val => val.goodsId).filter(val => val != row.goodsId)
+                                ].indexOf(item.goodsId)
+                            )
+                            .map((item, index_) => (
+                              <el-option key={index_} label={item.goodsName} value={item.goodsId}></el-option>
+                            ))}
+                        </el-select>
+                      </el-form-item>
+                    </div>
+                  ) : (
+                    <div>{row['goodsName']}</div>
+                  )
+                }
+              }
+            ]
+          }
+          return []
+        })(),
+        {
+          columnAttributes: {
+            label: '单位',
+            prop: 'goodsStockUnit'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '数量',
+            prop: 'qty'
+          },
+          render: (h, { row, column, index }) => {
+            return row.isEditRow ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`items.${index}.${column.columnAttributes.prop}`}
+                  rules={required}
+                >
+                  <el-input
+                    type="number"
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    placeholder="请选择"
+                  ></el-input>
+                </el-form-item>
+              </div>
+            ) : (
+              <div>{row[column.columnAttributes.prop]}</div>
+            )
+          }
+        },
+        ...(() => {
+          if (this.formData.type == 'M') {
+            return [
+              {
+                columnAttributes: {
+                  label: '商品代码',
+                  prop: 'goodsCode'
+                }
+              },
+              {
+                columnAttributes: {
+                  label: '规格型号',
+                  prop: 'goodsSpecification'
+                }
+              }
+            ]
+          }
+          return []
+        })(),
+        ...(() => {
+          if (this.formData.type == 'P') {
+            return [
+              {
+                columnAttributes: {
+                  label: '配件编码',
+                  prop: 'goodsCode'
+                }
+              },
+              {
+                columnAttributes: {
+                  label: '适用品牌',
+                  prop: 'brand'
+                }
+              },
+              {
+                columnAttributes: {
+                  label: '适用产品大类',
+                  prop: 'productCategory'
+                }
+              }
+            ]
+          }
+          return []
+        })(),
+        ...(() => {
+          if (!!~[0, 1].indexOf(this.formDialogType)) {
+            return [
+              {
+                columnAttributes: {
+                  label: '操作',
+                  prop: ''
+                },
+                render: (h, { row, column, index }) => {
+                  return (
+                    <div class="operation-btns">
+                      <el-button
+                        type="text"
+                        onClick={() => {
+                          this.formData.items.splice(index, 1)
+                        }}
+                      >
+                        删除
+                      </el-button>
+                      {row.isEditRow ? (
+                        <el-button
+                          type="text"
+                          onClick={() => {
+                            this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
+                              if (valid) {
+                                this.formData.items[index].isEditRow = false
+                              }
+                            })
+                          }}
+                        >
+                          确定
+                        </el-button>
+                      ) : null}
+                      {!row.isEditRow ? (
+                        <el-button
+                          type="text"
+                          onClick={() => {
+                            this.formData.items.map((item, index_) => {
+                              if (index_ == index) {
+                                item.isEditRow = true
+                                if (this.formData.type == 'M' && row.goodsCategoryId) {
+                                  materialNormList({
+                                    isShowStockQty: true,
+                                    websitId: this.formData.websitId,
+                                    pageNum: 1,
+                                    pageSize: -1,
+                                    params: [
+                                      { param: 'b.category_id', compare: '=', value: row.goodsCategoryId },
+                                      { param: 'a.status', compare: '=', value: 'ON' }
+                                    ]
+                                  }).then(res => {
+                                    this.materialNormList = res.data.records
+                                  })
+                                }
+                              } else {
+                                item.isEditRow = false
+                              }
+                            })
+                          }}
+                        >
+                          编辑
+                        </el-button>
+                      ) : null}
+                    </div>
+                  )
+                }
+              }
+            ]
+          }
+          return []
+        })()
+      ]
+    },
+    formItems2() {
+      return [
+        {
+          md: 24,
+          isShow: true,
+          name: 'slot-component',
+          formItemAttributes: {
+            label: '',
+            prop: 'items',
+            'label-width': '0px',
+            rules: [...required]
+          },
+          render: (h, { props, onInput }) => {
+            var { value } = props
+            return (
+              <div>
+                {!!~[0, 1].indexOf(this.formDialogType) ? (
+                  <div style="margin-bottom:8px">
+                    <el-button
+                      onClick={() => {
+                        // this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
+                        //   if (valid || (Object.keys(invalidFields).length == 1 && invalidFields.items)) {
+                        //     this.formData.items.map(item => {
+                        //       item.isEditRow = false
+                        //     })
+                        this.formData.items.push({
+                          isEditRow: true,
+                          brand: '',
+                          goodsCategoryId: '',
+                          goodsCategoryName: '',
+                          goodsCode: '',
+                          goodsId: '',
+                          goodsName: '',
+                          goodsSpecification: '',
+                          goodsStockUnit: '',
+                          goodsType: '',
+                          parentCategoryId: '',
+                          parentCategoryName: '',
+                          productCategory: '',
+                          qty: 0,
+                          websitGoodsMoveId: '',
+                          websitId: '',
+                          websitName: ''
+                        })
+                        //   }
+                        // })
+                      }}
+                    >
+                      添加
+                    </el-button>
+                  </div>
+                ) : null}
+                <zj-table
+                  columns={this.columns}
+                  tableData={this.formData.items}
+                  tableAttributes={{
+                    size: 'mini',
+                    border: true
+                  }}
+                />
+              </div>
+            )
+          }
+        }
+      ]
+    }
+  },
+  watch: {
+    'formData.type'(newVal) {
+      if (newVal === 'M') {
+        listPageV2({
+          pageNum: 1,
+          pageSize: -1,
+          params: [
+            { param: 'a.status', compare: '=', value: 'ON' },
+            { param: 'a.vender_type', compare: 'like', value: '辅材' }
+          ]
+        }).then(res => {
+          this.listPageV2Data = res.data.records
+        })
+        materialCategoryList({
+          pageNum: 1,
+          pageSize: -1,
+          params: [
+            { param: 'a.status', compare: '=', value: 'ON' },
+            { param: 'a.category_level', compare: '=', value: '1' }
+          ]
+        }).then(res => {
+          this.materialCategoryListL1 = res.data.records
+        })
+        materialCategoryList({
+          pageNum: 1,
+          pageSize: -1,
+          params: [
+            { param: 'a.status', compare: '=', value: 'ON' },
+            { param: 'a.category_level', compare: '=', value: '2' }
+          ]
+        }).then(res => {
+          this.materialCategoryListL2 = res.data.records
+        })
+      } else if (newVal === 'P') {
+        listPageV2({
+          pageNum: 1,
+          pageSize: -1,
+          params: [
+            { param: 'a.status', compare: '=', value: 'ON' },
+            { param: 'a.vender_type', compare: 'like', value: '配件' }
+          ]
+        }).then(res => {
+          this.listPageV2Data = res.data.records
+        })
+        peijianList({
+          isShowStockQty: true,
+          websitId: this.formData.websitId,
+          storageId: this.formData.storageId,
+          pageNum: 1,
+          pageSize: -1,
+          params: [
+            { param: 'a.status', compare: '=', value: 'ON' },
+            { param: 'a.norm_type', compare: '=', value: 'M' }
+          ]
+        }).then(res => {
+          this.peijianList = res.data.records
+        })
+      } else {
+        this.listPageV2Data = []
+        this.peijianList = []
+        this.materialCategoryListL1 = []
+        this.materialCategoryListL2 = []
+      }
+    }
+  },
+  methods: {
+    qkrow(row, data = {}) {
+      ;['goodsStockUnit', 'goodsCode', 'goodsSpecification', 'brand', 'productCategory'].map(key => {
+        if (row[key] !== undefined) {
+          row[key] = data[key] !== undefined ? data[key] : ''
+        }
+      })
+    },
+    // 添加
+    addData() {
+      this.formDialogType = 0
+      this.openForm()
+    },
+    // 关闭弹窗
+    formCancel() {
+      this.$refs.formRef.$refs.inlineForm.clearValidate()
+      this.$data.formData = this.$options.data().formData
+      this.formDialog = false
+    },
+    jiaoyan() {
+      this.$refs.formRef.validate((valid, invalidFields, errLabels) => {}, false)
+    },
+    setNumber(val) {
+      return Number(val.toFixed(2))
+    }
+  }
+}

+ 25 - 10
src/views/auxiliaryFittings/GoodsTransferPeceipt/index.vue

@@ -336,6 +336,9 @@ export default {
         },
         examine: {
           btnType: 'text',
+          conditions: ({ row, index, column }) => {
+            return row.status !== 'OK'
+          },
           click: ({ row, index, column }) => {
             this.openForm('examine', row.id)
           }
@@ -427,19 +430,31 @@ export default {
     formConfirm(cancel) {
       this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
         if (valid) {
-          goodsMoveUpdate({ ...this.formData }).then(res => {
-            goodsMoveSubmit({ id: this.formData.id }).then(res => {
-              goodsMoveConfirm({ id: this.formData.id, statusEnum: 'OK' }).then(res => {
-                this.$message({
-                  type: 'success',
-                  message: `审核成功!`
+          if (this.formData.status == 'WAIT') {
+            goodsMoveConfirm({ id: this.formData.id, statusEnum: 'OK' }).then(res => {
+              this.$message({
+                type: 'success',
+                message: `审核成功!`
+              })
+              cancel('list')
+              this.$refs.pageRef.refreshList()
+              // 备注
+            })
+          } else {
+            goodsMoveUpdate({ ...this.formData }).then(res => {
+              goodsMoveSubmit({ id: this.formData.id }).then(res => {
+                goodsMoveConfirm({ id: this.formData.id, statusEnum: 'OK' }).then(res => {
+                  this.$message({
+                    type: 'success',
+                    message: `审核成功!`
+                  })
+                  cancel('list')
+                  this.$refs.pageRef.refreshList()
+                  // 备注
                 })
-                cancel('list')
-                this.$refs.pageRef.refreshList()
-                // 备注
               })
             })
-          })
+          }
         }
       })
     }

+ 12 - 12
src/views/auxiliaryFittings/GoodsTransferPeceipt/storage_goods.js

@@ -304,18 +304,18 @@ export default {
             )
           }
         },
-        {
-          columnAttributes: {
-            label: '内机数量',
-            prop: 'insideQty'
-          }
-        },
-        {
-          columnAttributes: {
-            label: '外机数量',
-            prop: 'outQty'
-          }
-        },
+        // {
+        //   columnAttributes: {
+        //     label: '内机数量',
+        //     prop: 'insideQty'
+        //   }
+        // },
+        // {
+        //   columnAttributes: {
+        //     label: '外机数量',
+        //     prop: 'outQty'
+        //   }
+        // },
         {
           columnAttributes: {
             label: '配件数量',

+ 26 - 18
src/views/salesPurchasing/mixins/out_storage_goods.js

@@ -65,19 +65,21 @@ export default {
             width: 160
           },
           render: (h, { row, column, index }) => {
-            return !!~[0,1].indexOf(this.formDialogType) ? (
+            return !!~[0, 1].indexOf(this.formDialogType) ? (
               <div class="redbordererr">
                 <el-form-item
                   label=""
                   lebel-width="0px"
                   prop={`items.${index}.${column.columnAttributes.prop}`}
-                  rules={[diyRequired.bind(this)((rule, value)=>{
-                    if(this.logs){
-                      this.logs.push({index:index, errMsg:`${column.columnAttributes.label}不能为空`})
-                    }
-                    this?.tishicuowu?.()
-                    return new Error('必须填写')
-                  })]}
+                  rules={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
                 >
                   <el-input
                     value={row[column.columnAttributes.prop]}
@@ -202,7 +204,7 @@ export default {
           }
         },
         ...(() => {
-			let arr = this.joinCodeText == 'CODE'?['SAVE','WAIT', 'OK', 'FAIL']:['WAIT', 'OK', 'FAIL']
+          let arr = this.joinCodeText == 'CODE' ? ['SAVE', 'WAIT', 'OK', 'FAIL'] : ['WAIT', 'OK', 'FAIL']
           if (this.formDialogType < 2 && !~arr.indexOf(this.formData.status)) {
             return [
               {
@@ -238,17 +240,23 @@ export default {
                 render: (h, { row, column, index }) => {
                   return (
                     <div style="padding:0 6px" class="operation-btns">
-                      {this.importButton(goodsPurchaseRetItemImportCode, '导入条码', { id: this.formData.id, purchaseRetItemId: row.id }, () => { }, () => {
-                        if (this.formData.id) {
-                          // 更新表单信息
-                          goodsPurchaseRetDetail({ id: this.formData.id }).then(res => {
-                            Object.assign(this.formData, res.data, {
-                              fileUrl: res.data.fileUrl ? [{ url: res.data.fileUrl }] : [],
-                              items: res.data.items.map(item => ({ ...item, details: {} }))
+                      {this.importButton(
+                        goodsPurchaseRetItemImportCode,
+                        '导入条码',
+                        { id: this.formData.id, purchaseRetItemId: row.id },
+                        () => {},
+                        () => {
+                          if (this.formData.id) {
+                            // 更新表单信息
+                            goodsPurchaseRetDetail({ id: this.formData.id }).then(res => {
+                              Object.assign(this.formData, res.data, {
+                                fileUrl: res.data.fileUrl ? [{ url: res.data.fileUrl }] : [],
+                                items: res.data.items.map(item => ({ ...item, details: {} }))
+                              })
                             })
-                          })
+                          }
                         }
-                      })}
+                      )}
                     </div>
                   )
                 }

+ 18 - 18
src/views/salesPurchasing/mixins/out_storage_table.js

@@ -22,24 +22,24 @@ export default {
               <div>
                 {this.activeName == 'goodsInfo'
                   ? [
-                    this.formDialogType == 1 && this.joinCode ? (
-                      <div style="margin-bottom:10px">
-                        <el-button type="primary" onClick={this.domlMban}>
-                          下载导入模板
-                        </el-button>
-                      </div>
-                    ) : null,
-                    <zj-table
-                      columns={this.storage_goods}
-                      tableData={this.formData.items}
-                      tableAttributes={{
-                        size: 'mini',
-                        border: true
-                      }}
-                    />
-                  ]
+                      this.formDialogType == 1 && this.joinCode ? (
+                        <div style="margin-bottom:10px">
+                          <el-button type="primary" onClick={this.domlMban}>
+                            下载导入模板
+                          </el-button>
+                        </div>
+                      ) : null,
+                      <zj-table
+                        columns={this.storage_goods}
+                        tableData={this.formData.items}
+                        tableAttributes={{
+                          size: 'mini',
+                          border: true
+                        }}
+                      />
+                    ]
                   : this.activeName == 'codeInfo' && this.joinCode
-                    ? [
+                  ? [
                       this.formDialogType == 1 ? (
                         <div style="margin-bottom:10px">
                           <el-button type="primary" onClick={this.addCodeInfo} disabled={this.isEditIndex != -1}>
@@ -56,7 +56,7 @@ export default {
                         }}
                       />
                     ]
-                    : null}
+                  : null}
               </div>
             )
           }

+ 27 - 25
src/views/salesPurchasing/mixins/storage_table.js

@@ -22,31 +22,33 @@ export default {
               <div>
                 {this.activeName == 'goodsInfo'
                   ? [
-                    !!~[0,1].indexOf(this.formDialogType) ? (
-                      this.joinCodeText != 'CODE' || this.formDialogType == 0?(<div style="margin-bottom:10px">
-                        <el-button type="primary" onClick={this.addGoodsInfo}>
-                          添加
-                        </el-button>
-                      </div>):null
-                    ) : this.formDialogType == 1 && this.joinCode ? (
-                      <div style="margin-bottom:10px">
-                        <el-button type="primary" onClick={this.domlMban}>
-                          下载导入模板
-                        </el-button>
-                      </div>
-                    ) : null,
-                    <zj-table
-                      columns={this.storage_goods}
-                      tableData={this.formData.items}
-                      tableAttributes={{
-                        size: 'mini',
-                        border: true
-                      }}
-                    />
-                  ]
+                      !!~[0, 1].indexOf(this.formDialogType) ? (
+                        this.joinCodeText != 'CODE' || this.formDialogType == 0 ? (
+                          <div style="margin-bottom:10px">
+                            <el-button type="primary" onClick={this.addGoodsInfo}>
+                              添加
+                            </el-button>
+                          </div>
+                        ) : null
+                      ) : this.formDialogType == 1 && this.joinCode ? (
+                        <div style="margin-bottom:10px">
+                          <el-button type="primary" onClick={this.domlMban}>
+                            下载导入模板
+                          </el-button>
+                        </div>
+                      ) : null,
+                      <zj-table
+                        columns={this.storage_goods}
+                        tableData={this.formData.items}
+                        tableAttributes={{
+                          size: 'mini',
+                          border: true
+                        }}
+                      />
+                    ]
                   : this.activeName == 'codeInfo' && this.joinCode
-                    ? [
-                      !!~[0,1].indexOf(this.formDialogType) ? (
+                  ? [
+                      !!~[0, 1].indexOf(this.formDialogType) ? (
                         <div style="margin-bottom:10px">
                           <el-button type="primary" onClick={this.addCodeInfo} disabled={this.isEditIndex != -1}>
                             添加
@@ -62,7 +64,7 @@ export default {
                         }}
                       />
                     ]
-                    : null}
+                  : null}
               </div>
             )
           }