Ver Fonte

no message

aXin-0810 há 1 ano atrás
pai
commit
9dc9ffac0d

+ 16 - 0
src/api/goodsPurchasedStored.js

@@ -56,6 +56,14 @@ export function goodsPurchaseAdd(data) {
   })
 }
 
+export function goodsPurchaseItemAddCode(data) {
+  return request({
+    url: `/goods/purchase/item/add/code`,
+    method: 'post',
+    data
+  })
+}
+
 export function goodsPurchaseDetail(params) {
   return request({
     url: `/goods/purchase/detail`,
@@ -79,3 +87,11 @@ export function goodsPurchaseConfirm(params) {
     params
   })
 }
+
+export function goodsPurchaseItemDelCode(params) {
+  return request({
+    url: `/goods/purchase/item/del/code`,
+    method: 'post',
+    params
+  })
+}

+ 6 - 3
src/views/salesPurchasing/goodsPurchasedStored/index.vue

@@ -71,10 +71,12 @@ import {
   goodsPurchaseConfirm
 } from '@/api/goodsPurchasedStored.js'
 import form_ty from '../mixins/form_ty'
-import table_cg from '../mixins/table_cg'
+import storage_table from '../mixins/storage_table'
+import storage_goods from '../mixins/storage_goods'
+import storage_codes from '../mixins/storage_codes'
 export default {
   components: { TemplatePage },
-  mixins: [import_mixin, operation_mixin, form_ty, table_cg],
+  mixins: [import_mixin, operation_mixin, form_ty, storage_table, storage_goods, storage_codes],
   data() {
     return {
       pageType: 'list',
@@ -192,7 +194,8 @@ export default {
     openDetailForm(row, type) {
       goodsPurchaseDetail({ id: row.id }).then(res => {
         Object.assign(this.formData, res.data, {
-          fileUrl: res.data.fileUrl ? [{ url: res.data.fileUrl }] : []
+          fileUrl: res.data.fileUrl ? [{ url: res.data.fileUrl }] : [],
+          items: res.data.items.map(item => ({ ...item, details: {} }))
         })
         this.formDialogType = type
         this.openForm()

+ 2 - 2
src/views/salesPurchasing/merchandisePurchaseReturn/index.vue

@@ -65,10 +65,10 @@ import {
   goodsPurchaseRetCodeListExport
 } from '@/api/merchandisePurchaseReturn.js'
 import form_ty from '../mixins/form_ty'
-import table_cg from '../mixins/table_cg'
+import storage_table from '../mixins/storage_table'
 export default {
   components: { TemplatePage },
-  mixins: [import_mixin, operation_mixin, form_ty, table_cg],
+  mixins: [import_mixin, operation_mixin, form_ty, storage_table],
   data() {
     return {
       pageType: 'list',

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

@@ -1,16 +1,10 @@
 import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
 import ImageUpload from '@/components/file-upload'
 import { listPageV2 } from '@/api/auxiliaryFittings/supplier'
-import { getBrandList } from '@/api/miniapp'
-import { getClassifyList } from '@/api/goods'
-import { goodsMaterialList, goodsMaterialDetail } from '@/api/commercialMaterial.js'
 export default {
   data() {
     return {
-      gysList: [],
-      brandList: [],
-      ClassifyList: [],
-      isEditIndex: -1
+      gysList: []
     }
   },
   computed: {
@@ -174,218 +168,6 @@ export default {
           }
         }
       ]
-    },
-    commonColumns() {
-      return [
-        {
-          columnAttributes: {
-            label: '品牌',
-            prop: 'brandId',
-            propName: 'brandName',
-            width: 160
-          },
-          render: (h, { row, column, index }) => {
-            return this.isEditIndex == index ? (
-              <div class="redbordererr">
-                <el-form-item
-                  label=""
-                  lebel-width="0px"
-                  prop={`items.${index}.${column.columnAttributes.prop}`}
-                  rules={required}
-                >
-                  <el-select
-                    value={row[column.columnAttributes.prop]}
-                    onInput={val => {
-                      row[column.columnAttributes.prop] = val
-                    }}
-                    onChange={val => {
-                      this.shanchujichu(row, 0)
-                      if (val) {
-                        row[column.columnAttributes.propName] = this.brandList.find(item => item.id == val).brandName
-                      } else {
-                        row[column.columnAttributes.propName] = ''
-                      }
-                    }}
-                    placeholder="请选择"
-                  >
-                    {this.brandList.map((item, index_) => (
-                      <el-option key={index_} label={item.brandName} value={item.id}></el-option>
-                    ))}
-                  </el-select>
-                </el-form-item>
-              </div>
-            ) : (
-              <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
-            )
-          }
-        },
-        {
-          columnAttributes: {
-            label: '商品大类',
-            prop: 'mainId',
-            propName: 'mainName',
-            width: 160
-          },
-          render: (h, { row, column, index }) => {
-            return this.isEditIndex == index ? (
-              <div class="redbordererr">
-                <el-form-item
-                  label=""
-                  lebel-width="0px"
-                  prop={`items.${index}.${column.columnAttributes.prop}`}
-                  rules={required}
-                >
-                  <el-select
-                    value={row[column.columnAttributes.prop]}
-                    onInput={val => {
-                      row[column.columnAttributes.prop] = val
-                    }}
-                    onChange={val => {
-                      this.shanchujichu(row, 1)
-                      if (val) {
-                        row[column.columnAttributes.propName] = this.ClassifyList.find(
-                          item => item.categoryId == val
-                        ).name
-                      } else {
-                        row[column.columnAttributes.propName] = ''
-                      }
-                    }}
-                    placeholder="请选择"
-                  >
-                    {this.ClassifyList.map((item, index_) => (
-                      <el-option key={index_} label={item.name} value={item.categoryId}></el-option>
-                    ))}
-                  </el-select>
-                </el-form-item>
-              </div>
-            ) : (
-              <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
-            )
-          }
-        },
-        {
-          columnAttributes: {
-            label: '商品小类',
-            prop: 'smallId',
-            propName: 'smallName',
-            width: 160
-          },
-          render: (h, { row, column, index }) => {
-            return this.isEditIndex == index ? (
-              <div class="redbordererr">
-                <el-form-item
-                  label=""
-                  lebel-width="0px"
-                  prop={`items.${index}.${column.columnAttributes.prop}`}
-                  rules={required}
-                >
-                  <el-select
-                    value={row[column.columnAttributes.prop]}
-                    onInput={val => {
-                      row[column.columnAttributes.prop] = val
-                    }}
-                    onChange={val => {
-                      this.shanchujichu(row, 2)
-                      if (val) {
-                        row[column.columnAttributes.propName] = (
-                          this.ClassifyList.find(item => item.categoryId == row.mainId)?.children || []
-                        ).find(item => item.categoryId == val).name
-                      } else {
-                        row[column.columnAttributes.propName] = ''
-                      }
-                    }}
-                    placeholder="请选择"
-                  >
-                    {(this.ClassifyList.find(item => item.categoryId == row.mainId)?.children || []).map(
-                      (item, index_) => (
-                        <el-option key={index_} label={item.name} value={item.categoryId}></el-option>
-                      )
-                    )}
-                  </el-select>
-                </el-form-item>
-              </div>
-            ) : (
-              <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
-            )
-          }
-        },
-        {
-          columnAttributes: {
-            label: '商品名称',
-            prop: 'goodsMaterialId',
-            propName: 'goodsMaterialName',
-            width: 160
-          },
-          render: (h, { row, column, index }) => {
-            return this.isEditIndex == index ? (
-              <div class="redbordererr">
-                <el-form-item
-                  label=""
-                  lebel-width="0px"
-                  prop={`items.${index}.${column.columnAttributes.prop}`}
-                  rules={required}
-                >
-                  <el-select
-                    value={row[column.columnAttributes.prop]}
-                    onInput={val => {
-                      row[column.columnAttributes.prop] = val
-                    }}
-                    onChange={val => {
-                      this.shanchujichu(row, 3)
-                      if (val) {
-                        var data = this.goodsMaterialList
-                          .filter(
-                            item =>
-                              item.brandId === row.brandId && item.mainId === row.mainId && item.smallId === row.smallId
-                          )
-                          .find(item => item.id == val)
-                        row[column.columnAttributes.propName] = data?.goodsName
-                        this.getGoodsDetl(data, res => {
-                          if (this.formDialogType == 0) {
-                            row['specsName'] = res?.specsName
-                            row['unit'] = res?.unit
-                            row['insideQty'] = res?.insideQty
-                            row['outQty'] = res?.outQty
-                            row['partsQty'] = res?.partsQty
-                            row['stockQty'] = res?.stockQty
-                          }
-                        })
-                      } else {
-                        row[column.columnAttributes.propName] = ''
-                        row['specsName'] = ''
-                        row['unit'] = ''
-                        row['insideQty'] = ''
-                        row['outQty'] = ''
-                        row['partsQty'] = ''
-                        row['stockQty'] = ''
-                      }
-                    }}
-                    placeholder="请选择"
-                  >
-                    {this.goodsMaterialList
-                      .filter(
-                        item =>
-                          item.brandId === row.brandId && item.mainId === row.mainId && item.smallId === row.smallId
-                      )
-                      .map((item, index_) => (
-                        <el-option key={index_} label={item.goodsName} value={item.id}></el-option>
-                      ))}
-                  </el-select>
-                </el-form-item>
-              </div>
-            ) : (
-              <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
-            )
-          }
-        },
-        {
-          columnAttributes: {
-            label: '规格型号',
-            prop: 'specsName',
-            width: 120
-          }
-        }
-      ]
     }
   },
   methods: {
@@ -401,54 +183,6 @@ export default {
       }).then(res => {
         this.gysList = res.data.records
       })
-    },
-    getBaseList() {
-      getBrandList({
-        status: true
-      }).then(res => {
-        this.brandList = res.data
-      })
-      getClassifyList({
-        type: 2,
-        status: true
-      }).then(res => {
-        this.ClassifyList = res.data
-      })
-      goodsMaterialList({
-        pageNum: 1,
-        pageSize: -1,
-        params: []
-      }).then(res => {
-        this.goodsMaterialList = res.data.records.map(item => ({ ...item, details: {} }))
-      })
-    },
-    shanchujichu(row, num) {
-      if (num <= 0) {
-      }
-      if (num <= 1) {
-        row.smallId = ''
-        row.smallName = ''
-      }
-      if (num <= 2) {
-        row.goodsMaterialId = ''
-        row.goodsMaterialName = ''
-        row.specsName = ''
-        row.unit = ''
-        row.insideQty = ''
-        row.outQty = ''
-        row.partsQty = ''
-        row.stockQty = ''
-      }
-    },
-    getGoodsDetl(row, cb) {
-      if (!row.details.id) {
-        goodsMaterialDetail({ id: row.id }).then(res => {
-          Object.assign(row.details, res.data || {})
-          cb(row.details)
-        })
-      } else {
-        cb(row.details)
-      }
     }
   }
 }

+ 618 - 0
src/views/salesPurchasing/mixins/storage_codes.js

@@ -0,0 +1,618 @@
+import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
+import {
+  goodsPurchaseItemAddCode,
+  goodsPurchaseCodeList,
+  goodsPurchaseItemDelCode
+} from '@/api/goodsPurchasedStored.js'
+export default {
+  data() {
+    return {}
+  },
+  computed: {
+    storage_codes() {
+      return [
+        {
+          columnAttributes: {
+            label: '品牌',
+            prop: 'brandId',
+            propName: 'brandName',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`items.${index}.${column.columnAttributes.prop}`}
+                  rules={required}
+                >
+                  <el-select
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    onChange={val => {
+                      this.shanchuCodejichu(row, 0)
+                      if (val) {
+                        row[column.columnAttributes.propName] = this.arrQC(this.formData.items, {
+                          value: 'brandId',
+                          label: 'brandName'
+                        }).find(item => item.value == val).label
+                      } else {
+                        row[column.columnAttributes.propName] = ''
+                      }
+                    }}
+                    placeholder="请选择"
+                  >
+                    {this.arrQC(this.formData.items, { value: 'brandId', label: 'brandName' }).map((item, index_) => (
+                      <el-option key={index_} label={item.label} value={item.value}></el-option>
+                    ))}
+                  </el-select>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '商品大类',
+            prop: 'mainId',
+            propName: 'mainName',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`items.${index}.${column.columnAttributes.prop}`}
+                  rules={required}
+                >
+                  <el-select
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    onChange={val => {
+                      this.shanchuCodejichu(row, 1)
+                      if (val) {
+                        row[column.columnAttributes.propName] = this.arrQC(
+                          this.formData.items.filter(item => item.brandId === row.brandId),
+                          { value: 'mainId', label: 'mainName' }
+                        ).find(item => item.value == val).label
+                      } else {
+                        row[column.columnAttributes.propName] = ''
+                      }
+                    }}
+                    placeholder="请选择"
+                  >
+                    {this.arrQC(
+                      this.formData.items.filter(item => item.brandId === row.brandId),
+                      { value: 'mainId', label: 'mainName' }
+                    ).map((item, index_) => (
+                      <el-option key={index_} label={item.label} value={item.value}></el-option>
+                    ))}
+                  </el-select>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '商品小类',
+            prop: 'smallId',
+            propName: 'smallName',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`items.${index}.${column.columnAttributes.prop}`}
+                  rules={required}
+                >
+                  <el-select
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    onChange={val => {
+                      this.shanchuCodejichu(row, 2)
+                      if (val) {
+                        row[column.columnAttributes.propName] = this.arrQC(
+                          this.formData.items.filter(
+                            item => item.brandId === row.brandId && item.mainId === row.mainId
+                          ),
+                          { value: 'smallId', label: 'smallName' }
+                        ).find(item => item.value == val).label
+                      } else {
+                        row[column.columnAttributes.propName] = ''
+                      }
+                    }}
+                    placeholder="请选择"
+                  >
+                    {this.arrQC(
+                      this.formData.items.filter(item => item.brandId === row.brandId && item.mainId === row.mainId),
+                      { value: 'smallId', label: 'smallName' }
+                    ).map((item, index_) => (
+                      <el-option key={index_} label={item.label} value={item.value}></el-option>
+                    ))}
+                  </el-select>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '商品名称',
+            prop: 'goodsMaterialId',
+            propName: 'goodsMaterialName',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`items.${index}.${column.columnAttributes.prop}`}
+                  rules={required}
+                >
+                  <el-select
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    onChange={val => {
+                      this.shanchuCodejichu(row, 3)
+                      if (val) {
+                        var data = this.arrQC(
+                          this.formData.items.filter(
+                            item =>
+                              item.brandId === row.brandId && item.mainId === row.mainId && item.smallId === row.smallId
+                          ),
+                          { value: 'goodsMaterialId', label: 'goodsMaterialName' }
+                        ).find(item => item.value == val)
+                        this.getGoodsDetl(data?.data, res => {}, 'goodsMaterialId')
+                        row[column.columnAttributes.propName] = data.label
+                        row['specsName'] = data?.data?.specsName
+                        row['goodsPurchaseItemId'] = data?.data?.id
+                      } else {
+                        row[column.columnAttributes.propName] = ''
+                        row['specsName'] = ''
+                        row['goodsPurchaseItemId'] = ''
+                      }
+                    }}
+                    placeholder="请选择"
+                  >
+                    {this.arrQC(
+                      this.formData.items.filter(
+                        item =>
+                          item.brandId === row.brandId && item.mainId === row.mainId && item.smallId === row.smallId
+                      ),
+                      { value: 'goodsMaterialId', label: 'goodsMaterialName' }
+                    ).map((item, index_) => (
+                      <el-option key={index_} label={item.label} value={item.value}></el-option>
+                    ))}
+                  </el-select>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '规格型号',
+            prop: 'specsName',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '物料类型',
+            prop: 'goodsMaterialItemType',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`codeInfoList.${index}.${column.columnAttributes.prop}`}
+                  rules={required}
+                >
+                  <el-select
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    onChange={val => {
+                      this.shanchuCodejichu(row, 4)
+                    }}
+                    placeholder="请选择"
+                  >
+                    {[
+                      { value: 'INSIDE', label: '内机' },
+                      { value: 'OUT', label: '外机' },
+                      { value: 'PARTS', label: '配件' }
+                    ].map((item, index_) => (
+                      <el-option key={index_} label={item.label} value={item.value}></el-option>
+                    ))}
+                  </el-select>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">
+                {[
+                  { value: 'INSIDE', label: '内机' },
+                  { value: 'OUT', label: '外机' },
+                  { value: 'PARTS', label: '配件' }
+                ].find(item => item.value == row[column.columnAttributes.prop])?.label || ''}
+              </div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '物料名称',
+            prop: 'goodsMaterialItemId',
+            propName: 'goodsMaterialItemName',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`codeInfoList.${index}.${column.columnAttributes.prop}`}
+                  rules={required}
+                >
+                  <el-select
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    onChange={val => {
+                      this.shanchuCodejichu(row, 5)
+                      if (val) {
+                        var data = (
+                          this.formData.items.find(
+                            item =>
+                              item.brandId === row.brandId &&
+                              item.mainId === row.mainId &&
+                              item.smallId === row.smallId &&
+                              item.goodsMaterialId === row.goodsMaterialId
+                          )?.details?.items || []
+                        )
+                          .filter(item => item.type == row.goodsMaterialItemType)
+                          .find(item => item.id == val)
+                        row[column.columnAttributes.propName] = data.name
+                        row['uniqueCode'] = data.uniqueCode
+                        row['codeQty'] = data.uniqueCode == 'YES' ? 1 : ''
+                      } else {
+                        row[column.columnAttributes.propName] = ''
+                        row['uniqueCode'] = ''
+                        row['codeQty'] = ''
+                      }
+                    }}
+                    placeholder="请选择"
+                  >
+                    {(
+                      this.formData.items.find(
+                        item =>
+                          item.brandId === row.brandId &&
+                          item.mainId === row.mainId &&
+                          item.smallId === row.smallId &&
+                          item.goodsMaterialId === row.goodsMaterialId
+                      )?.details?.items || []
+                    )
+                      .filter(item => item.type == row.goodsMaterialItemType)
+                      .map((item, index_) => (
+                        <el-option key={index_} label={item.name} value={item.id}></el-option>
+                      ))}
+                  </el-select>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '是否一物一码',
+            prop: 'uniqueCode',
+            width: 120
+          },
+          render: (h, { row, column, index }) => {
+            return (
+              <div style="padding:0 6px">
+                {[
+                  { value: 'YES', label: '是' },
+                  { value: 'NO', label: '否' }
+                ].find(item => item.value == row[column.columnAttributes.prop])?.label || ''}
+              </div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '条码',
+            prop: 'code',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`codeInfoList.${index}.${column.columnAttributes.prop}`}
+                  rules={required}
+                >
+                  <el-input
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    placeholder="请输入"
+                  ></el-input>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">{row[column.columnAttributes.prop]}</div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '数量',
+            prop: 'codeQty',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index && row.uniqueCode == 'NO' ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`codeInfoList.${index}.${column.columnAttributes.prop}`}
+                  rules={required}
+                >
+                  <el-input
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    placeholder="请输入"
+                  ></el-input>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">{row[column.columnAttributes.prop]}</div>
+            )
+          }
+        },
+        ...(() => {
+          if (this.formDialogType < 2) {
+            return [
+              {
+                columnAttributes: {
+                  label: '操作',
+                  fixed: 'right',
+                  width: 140
+                },
+                render: (h, { row, column, index }) => {
+                  return (
+                    <div style="padding:0 6px" class="operation-btns">
+                      {this.formDialogType == 0
+                        ? null
+                        : this.formDialogType == 1
+                        ? [
+                            this.isEditIndex == index ? (
+                              <el-button
+                                type="text"
+                                onClick={() => {
+                                  this.addCode(row)
+                                }}
+                              >
+                                保存
+                              </el-button>
+                            ) : null,
+                            this.isEditIndex == -1 ? (
+                              <el-button
+                                type="text"
+                                onClick={() => {
+                                  this.getGoodsDetl(
+                                    this.formData.items.find(
+                                      item =>
+                                        item.brandId === row.brandId &&
+                                        item.mainId === row.mainId &&
+                                        item.smallId === row.smallId &&
+                                        item.goodsMaterialId === row.goodsMaterialId
+                                    ),
+                                    res => {
+                                      this.isEditIndex = index
+                                    },
+                                    'goodsMaterialId'
+                                  )
+                                }}
+                              >
+                                编辑
+                              </el-button>
+                            ) : null,
+                            <el-button
+                              type="text"
+                              onClick={() => {
+                                this.delCode(row, index)
+                              }}
+                            >
+                              删除
+                            </el-button>
+                          ]
+                        : null}
+                    </div>
+                  )
+                }
+              }
+            ]
+          }
+          return []
+        })()
+      ]
+    }
+  },
+  methods: {
+    getGoodsPurchaseCodeList() {
+      if (this.formData.id) {
+        goodsPurchaseCodeList({
+          pageNum: 1,
+          pageSize: -1,
+          params: [{ param: 'c.goods_purchase_id', compare: '=', value: this.formData.id }]
+        }).then(res => {
+          this.formData.codeInfoList = res.data.records
+        })
+      }
+    },
+    arrQC(list, qz = { label: '', value: '' }) {
+      var obj = {}
+      for (var item of list) {
+        obj[item[qz?.value || 'value']] = item
+      }
+      return Object.keys(obj).map(key => {
+        return {
+          data: obj[key],
+          value: key,
+          label: obj[key][qz?.label || 'label']
+        }
+      })
+    },
+    shanchuCodejichu(row, num) {
+      if (num <= 0) {
+        row.mainId = ''
+        row.mainName = ''
+      }
+      if (num <= 1) {
+        row.smallId = ''
+        row.smallName = ''
+      }
+      if (num <= 2) {
+        row.goodsMaterialId = ''
+        row.goodsMaterialName = ''
+        row.goodsPurchaseItemId = ''
+        row.specsName = ''
+      }
+      if (num <= 3) {
+        row.goodsMaterialItemType = ''
+      }
+      if (num <= 4) {
+        row.goodsMaterialItemId = ''
+        row.goodsMaterialItemName = ''
+        row.codeQty = ''
+      }
+      if (num <= 5) {
+        row.uniqueCode = ''
+        row.code = ''
+      }
+    },
+    getCodeVfyKey() {
+      return [
+        `codeInfoList.${this.isEditIndex}.brandId`,
+        `codeInfoList.${this.isEditIndex}.mainId`,
+        `codeInfoList.${this.isEditIndex}.smallId`,
+        `codeInfoList.${this.isEditIndex}.goodsMaterialId`,
+        `codeInfoList.${this.isEditIndex}.goodsMaterialItemType`,
+        `codeInfoList.${this.isEditIndex}.goodsMaterialItemId`,
+        `codeInfoList.${this.isEditIndex}.code`,
+        `codeInfoList.${this.isEditIndex}.codeQty`
+      ]
+    },
+    eidtCodeItems() {
+      // try {
+      //   this.formData.codeInfoList.map((item, index) => {
+      //     this.formData.codeInfoList.map((item2, index2) => {
+      //       if (
+      //         index !== index2 &&
+      //         `${item.brandId}_${item.mainId}_${item.smallId}_${item.goodsMaterialId}_${item.goodsMaterialItemType}_${item.goodsMaterialItemId}` ==
+      //           `${item2.brandId}_${item2.mainId}_${item2.smallId}_${item2.goodsMaterialId}_${item2.goodsMaterialItemType}_${item2.goodsMaterialItemId}`
+      //       ) {
+      //         throw new Error('')
+      //       }
+      //     })
+      //   })
+      // } catch (error) {
+      //   this.$message.warning('重复')
+      //   return false
+      // }
+      return true
+    },
+    // 添加条码信息
+    addCodeInfo() {
+      this.formData.codeInfoList.unshift({
+        brandId: '',
+        brandName: '',
+        mainId: '',
+        mainName: '',
+        smallId: '',
+        smallName: '',
+        goodsMaterialId: '',
+        goodsMaterialName: '',
+        specsName: '',
+        goodsMaterialItemType: '',
+        goodsMaterialItemId: '',
+        goodsMaterialItemName: '',
+        uniqueCode: '',
+        code: '',
+        codeQty: '',
+        goodsPurchaseItemId: '',
+        goodsPurchaseId: this.formData.id
+      })
+      this.isEditIndex = 0
+    },
+    addCode(row) {
+      if (this.isEditIndex > -1) {
+        this.$refs.formRef.validateField(this.getCodeVfyKey(), (valid, invalidFields, errLabels) => {
+          if (valid && this.eidtCodeItems()) {
+            goodsPurchaseItemAddCode({
+              codeList: [{ ...row }]
+            }).then(res => {
+              this.isEditIndex = -1
+              this.getGoodsPurchaseCodeList()
+            })
+          }
+        })
+      }
+    },
+    delCode(row, index) {
+      if (row.id) {
+        goodsPurchaseItemDelCode({
+          codeId: row.id,
+          id: row.goodsPurchaseId
+        }).then(res => {
+          this.getGoodsPurchaseCodeList()
+        })
+      } else {
+        this.formData?.codeInfoList?.splice(index, 1)
+        if (index == this.isEditIndex) {
+          this.isEditIndex = -1
+        }
+      }
+    }
+  }
+}

+ 571 - 0
src/views/salesPurchasing/mixins/storage_goods.js

@@ -0,0 +1,571 @@
+import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
+import { getBrandList } from '@/api/miniapp'
+import { getClassifyList } from '@/api/goods'
+import { goodsMaterialList, goodsMaterialDetail } from '@/api/commercialMaterial.js'
+export default {
+  data() {
+    return {
+      brandList: [],
+      ClassifyList: [],
+      goodsMaterialList: [],
+      isEditIndex: -1
+    }
+  },
+  computed: {
+    storage_goods() {
+      return [
+        {
+          columnAttributes: {
+            label: '品牌',
+            prop: 'brandId',
+            propName: 'brandName',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`items.${index}.${column.columnAttributes.prop}`}
+                  rules={required}
+                >
+                  <el-select
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    onChange={val => {
+                      this.shanchujichu(row, 0)
+                      if (val) {
+                        row[column.columnAttributes.propName] = this.brandList.find(item => item.id == val).brandName
+                      } else {
+                        row[column.columnAttributes.propName] = ''
+                      }
+                    }}
+                    placeholder="请选择"
+                  >
+                    {this.brandList.map((item, index_) => (
+                      <el-option key={index_} label={item.brandName} value={item.id}></el-option>
+                    ))}
+                  </el-select>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '商品大类',
+            prop: 'mainId',
+            propName: 'mainName',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`items.${index}.${column.columnAttributes.prop}`}
+                  rules={required}
+                >
+                  <el-select
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    onChange={val => {
+                      this.shanchujichu(row, 1)
+                      if (val) {
+                        row[column.columnAttributes.propName] = this.ClassifyList.find(
+                          item => item.categoryId == val
+                        ).name
+                      } else {
+                        row[column.columnAttributes.propName] = ''
+                      }
+                    }}
+                    placeholder="请选择"
+                  >
+                    {this.ClassifyList.map((item, index_) => (
+                      <el-option key={index_} label={item.name} value={item.categoryId}></el-option>
+                    ))}
+                  </el-select>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '商品小类',
+            prop: 'smallId',
+            propName: 'smallName',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`items.${index}.${column.columnAttributes.prop}`}
+                  rules={required}
+                >
+                  <el-select
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    onChange={val => {
+                      this.shanchujichu(row, 2)
+                      if (val) {
+                        row[column.columnAttributes.propName] = (
+                          this.ClassifyList.find(item => item.categoryId == row.mainId)?.children || []
+                        ).find(item => item.categoryId == val).name
+                      } else {
+                        row[column.columnAttributes.propName] = ''
+                      }
+                    }}
+                    placeholder="请选择"
+                  >
+                    {(this.ClassifyList.find(item => item.categoryId == row.mainId)?.children || []).map(
+                      (item, index_) => (
+                        <el-option key={index_} label={item.name} value={item.categoryId}></el-option>
+                      )
+                    )}
+                  </el-select>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '商品名称',
+            prop: 'goodsMaterialId',
+            propName: 'goodsMaterialName',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`items.${index}.${column.columnAttributes.prop}`}
+                  rules={required}
+                >
+                  <el-select
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    onChange={val => {
+                      this.shanchujichu(row, 3)
+                      if (val) {
+                        var data = this.goodsMaterialList
+                          .filter(
+                            item =>
+                              item.brandId === row.brandId && item.mainId === row.mainId && item.smallId === row.smallId
+                          )
+                          .find(item => item.id == val)
+                        row[column.columnAttributes.propName] = data?.goodsName
+                        this.getGoodsDetl(data, res => {
+                          if (this.formDialogType == 0) {
+                            row['specsName'] = res?.specsName
+                            row['unit'] = res?.unit
+                            row['insideQty'] = res?.insideQty
+                            row['outQty'] = res?.outQty
+                            row['partsQty'] = res?.partsQty
+                            row['stockQty'] = res?.stockQty
+                          }
+                        })
+                      } else {
+                        row[column.columnAttributes.propName] = ''
+                        row['specsName'] = ''
+                        row['unit'] = ''
+                        row['insideQty'] = ''
+                        row['outQty'] = ''
+                        row['partsQty'] = ''
+                        row['stockQty'] = ''
+                      }
+                    }}
+                    placeholder="请选择"
+                  >
+                    {this.goodsMaterialList
+                      .filter(
+                        item =>
+                          item.brandId === row.brandId && item.mainId === row.mainId && item.smallId === row.smallId
+                      )
+                      .map((item, index_) => (
+                        <el-option key={index_} label={item.goodsName} value={item.id}></el-option>
+                      ))}
+                  </el-select>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
+            )
+          }
+        },
+        {
+          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: 'qty',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`items.${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: 'insideQty'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '外机数量',
+            prop: 'outQty'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '配件数量',
+            prop: 'partsQty'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '导入内机条码数量',
+            prop: 'insideCodeQty',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '导入外机条码数量',
+            prop: 'outCodeQty',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '导入配件条码数量',
+            prop: 'partsCodeQty',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '采购价格',
+            prop: 'price',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return this.isEditIndex == index ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`items.${index}.${column.columnAttributes.prop}`}
+                  rules={required}
+                >
+                  <el-input
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val
+                    }}
+                    type="number"
+                    placeholder="请输入"
+                  ></el-input>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">{row[column.columnAttributes.prop]}</div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '采购金额',
+            prop: 'amount',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return <div style="padding:0 6px">{Number(row['qty']) * Number(row['price'])}</div>
+          }
+        },
+        {
+          columnAttributes: {
+            label: '库存数量',
+            prop: 'stockQty'
+          }
+        },
+        ...(() => {
+          if (this.formDialogType < 2) {
+            return [
+              {
+                columnAttributes: {
+                  label: '操作',
+                  fixed: 'right',
+                  width: 140
+                },
+                render: (h, { row, column, index }) => {
+                  return (
+                    <div style="padding:0 6px" class="operation-btns">
+                      {!~['SAVE', 'WAIT', 'OK', 'FAIL'].indexOf(this.formData.status) ? (
+                        [
+                          this.isEditIndex == index ? (
+                            <el-button
+                              type="text"
+                              onClick={() => {
+                                this.$refs.formRef.validateField(
+                                  this.getVfyKey(this.isEditIndex),
+                                  (valid, invalidFields, errLabels) => {
+                                    if (valid && this.eidtItems()) {
+                                      this.isEditIndex = -1
+                                    }
+                                  }
+                                )
+                              }}
+                            >
+                              保存
+                            </el-button>
+                          ) : null,
+                          this.isEditIndex == -1 ? (
+                            <el-button
+                              type="text"
+                              onClick={() => {
+                                this.isEditIndex = index
+                              }}
+                            >
+                              编辑
+                            </el-button>
+                          ) : null,
+                          <el-button
+                            type="text"
+                            onClick={() => {
+                              this.delGoodsInfo(row, index)
+                            }}
+                          >
+                            删除
+                          </el-button>
+                        ]
+                      ) : !!~['SAVE'].indexOf(this.formData.status) ? (
+                        <el-button type="text" onClick={() => {}}>
+                          导入条码
+                        </el-button>
+                      ) : null}
+                    </div>
+                  )
+                }
+              }
+            ]
+          }
+          return []
+        })()
+      ]
+    }
+  },
+  methods: {
+    getBaseList() {
+      getBrandList({
+        status: true
+      }).then(res => {
+        this.brandList = res.data
+      })
+      getClassifyList({
+        type: 2,
+        status: true
+      }).then(res => {
+        this.ClassifyList = res.data
+      })
+      goodsMaterialList({
+        pageNum: 1,
+        pageSize: -1,
+        params: []
+      }).then(res => {
+        this.goodsMaterialList = res.data.records.map(item => ({ ...item, details: {} }))
+      })
+    },
+    shanchujichu(row, num) {
+      if (num <= 0) {
+      }
+      if (num <= 1) {
+        row.smallId = ''
+        row.smallName = ''
+      }
+      if (num <= 2) {
+        row.goodsMaterialId = ''
+        row.goodsMaterialName = ''
+        row.specsName = ''
+        row.unit = ''
+        row.insideQty = ''
+        row.outQty = ''
+        row.partsQty = ''
+        row.stockQty = ''
+      }
+    },
+    getGoodsDetl(row, cb, key = 'id') {
+      if (!row?.details?.id) {
+        goodsMaterialDetail({ id: row[key] }).then(res => {
+          Object.assign(row.details, res.data || {})
+          cb(row.details)
+        })
+      } else {
+        cb(row.details)
+      }
+    },
+    getVfyKey(index, bool = true) {
+      return [
+        ...(() => {
+          if (bool) {
+            return [`items`]
+          }
+          return []
+        })(),
+        ...(() => {
+          if (index > -1) {
+            return [
+              `items.${index}.brandId`,
+              `items.${index}.mainId`,
+              `items.${index}.smallId`,
+              `items.${index}.goodsMaterialId`,
+              `items.${index}.qty`,
+              `items.${index}.price`
+            ]
+          }
+          return []
+        })()
+      ]
+    },
+    eidtItems() {
+      try {
+        this.formData.items.map((item, index) => {
+          this.formData.items.map((item2, index2) => {
+            if (
+              index !== index2 &&
+              `${item.brandId}_${item.mainId}_${item.smallId}_${item.goodsMaterialId}` ==
+                `${item2.brandId}_${item2.mainId}_${item2.smallId}_${item2.goodsMaterialId}`
+            ) {
+              throw new Error('')
+            }
+          })
+        })
+      } catch (error) {
+        this.$message.warning('重复')
+        return false
+      }
+      return true
+    },
+    // 添加商品信息
+    addGoodsInfo() {
+      if (this.isEditIndex > -1) {
+        this.$refs.formRef.validateField(this.getVfyKey(this.isEditIndex), (valid, invalidFields, errLabels) => {
+          if (valid && this.eidtItems()) {
+            this.formData.items.unshift({
+              brandId: '',
+              brandName: '',
+              mainId: '',
+              mainName: '',
+              smallId: '',
+              smallName: '',
+              goodsMaterialId: '',
+              goodsMaterialName: '',
+              specsName: '',
+              unit: '',
+              qty: '',
+              insideQty: '',
+              outQty: '',
+              partsQty: '',
+              insideCodeQty: '',
+              outCodeQty: '',
+              partsCodeQty: '',
+              price: '',
+              amount: '',
+              stockQty: ''
+            })
+            this.isEditIndex = 0
+          }
+        })
+      } else if (this.eidtItems()) {
+        this.formData.items.unshift({
+          brandId: '',
+          brandName: '',
+          mainId: '',
+          mainName: '',
+          smallId: '',
+          smallName: '',
+          goodsMaterialId: '',
+          goodsMaterialName: '',
+          specsName: '',
+          unit: '',
+          qty: '',
+          insideQty: '',
+          outQty: '',
+          partsQty: '',
+          insideCodeQty: '',
+          outCodeQty: '',
+          partsCodeQty: '',
+          price: '',
+          amount: '',
+          stockQty: ''
+        })
+        this.isEditIndex = 0
+      }
+    },
+    delGoodsInfo(row, index) {
+      if (index > this.isEditIndex) {
+        this.formData?.items?.splice(index, 1)
+      } else if (index == this.isEditIndex) {
+        this.formData?.items?.splice(index, 1)
+        this.isEditIndex = -1
+      }
+    }
+  }
+}

+ 88 - 0
src/views/salesPurchasing/mixins/storage_table.js

@@ -0,0 +1,88 @@
+import { goodsPurchaseDetail } from '@/api/goodsPurchasedStored.js'
+export default {
+  data() {
+    return {}
+  },
+  computed: {
+    formItems2() {
+      return [
+        {
+          md: 24,
+          isShow: true,
+          name: 'slot-component',
+          formItemAttributes: {
+            label: '',
+            prop: '',
+            'label-width': '0px'
+          },
+          render: (h, { props, onInput }) => {
+            var { value } = props
+            return (
+              <div>
+                {this.activeName == 'goodsInfo'
+                  ? [
+                      this.formDialogType == 0 ? (
+                        <div style="margin-bottom:10px">
+                          <el-button type="primary" onClick={this.addGoodsInfo}>
+                            添加
+                          </el-button>
+                        </div>
+                      ) : null,
+                      <zj-table
+                        columns={this.storage_goods}
+                        tableData={this.formData.items}
+                        tableAttributes={{
+                          size: 'mini',
+                          border: true
+                        }}
+                      />
+                    ]
+                  : this.activeName == 'codeInfo'
+                  ? [
+                      this.formDialogType == 1 ? (
+                        <div style="margin-bottom:10px">
+                          <el-button type="primary" onClick={this.addCodeInfo} disabled={this.isEditIndex != -1}>
+                            添加
+                          </el-button>
+                        </div>
+                      ) : null,
+                      <zj-table
+                        columns={this.storage_codes}
+                        tableData={this.formData.codeInfoList}
+                        tableAttributes={{
+                          size: 'mini',
+                          border: true
+                        }}
+                      />
+                    ]
+                  : null}
+              </div>
+            )
+          }
+        }
+      ]
+    }
+  },
+  watch: {
+    activeName(newVal) {
+      this.isEditIndex = -1
+      if (newVal == 'codeInfo') {
+        // 获取单据下的条码
+        this.getGoodsPurchaseCodeList()
+      } else {
+        if (this.formData.id) {
+          // 更新表单信息
+          goodsPurchaseDetail({ 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.formData.codeInfoList = []
+      }
+    }
+  },
+  methods: {}
+}

+ 0 - 617
src/views/salesPurchasing/mixins/table_cg.js

@@ -1,617 +0,0 @@
-import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
-import { goodsPurchaseCodeList } from '@/api/goodsPurchasedStored.js'
-export default {
-  data() {
-    return {}
-  },
-  computed: {
-    formItems2() {
-      return [
-        {
-          md: 24,
-          isShow: true,
-          name: 'slot-component',
-          formItemAttributes: {
-            label: '',
-            prop: '',
-            'label-width': '0px'
-          },
-          render: (h, { props, onInput }) => {
-            var { value } = props
-            return (
-              <div>
-                {this.activeName == 'goodsInfo'
-                  ? [
-                      this.formDialogType == 0 ? (
-                        <div style="margin-bottom:10px">
-                          <el-button type="primary" onClick={this.addGoodsInfo}>
-                            添加
-                          </el-button>
-                        </div>
-                      ) : null,
-                      <zj-table
-                        columns={[
-                          ...this.commonColumns,
-                          {
-                            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: 'qty',
-                              width: 160
-                            },
-                            render: (h, { row, column, index }) => {
-                              return this.isEditIndex == index ? (
-                                <div class="redbordererr">
-                                  <el-form-item
-                                    label=""
-                                    lebel-width="0px"
-                                    prop={`items.${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.propName]}</div>
-                              )
-                            }
-                          },
-                          {
-                            columnAttributes: {
-                              label: '内机数量',
-                              prop: 'insideQty'
-                            }
-                          },
-                          {
-                            columnAttributes: {
-                              label: '外机数量',
-                              prop: 'outQty'
-                            }
-                          },
-                          {
-                            columnAttributes: {
-                              label: '配件数量',
-                              prop: 'partsQty'
-                            }
-                          },
-                          {
-                            columnAttributes: {
-                              label: '导入内机条码数量',
-                              prop: 'insideCodeQty',
-                              width: 120
-                            }
-                          },
-                          {
-                            columnAttributes: {
-                              label: '导入外机条码数量',
-                              prop: 'outCodeQty',
-                              width: 120
-                            }
-                          },
-                          {
-                            columnAttributes: {
-                              label: '导入配件条码数量',
-                              prop: 'partsCodeQty',
-                              width: 120
-                            }
-                          },
-                          {
-                            columnAttributes: {
-                              label: '采购价格',
-                              prop: 'price',
-                              width: 160
-                            },
-                            render: (h, { row, column, index }) => {
-                              return this.isEditIndex == index ? (
-                                <div class="redbordererr">
-                                  <el-form-item
-                                    label=""
-                                    lebel-width="0px"
-                                    prop={`items.${index}.${column.columnAttributes.prop}`}
-                                    rules={required}
-                                  >
-                                    <el-input
-                                      value={row[column.columnAttributes.prop]}
-                                      onInput={val => {
-                                        row[column.columnAttributes.prop] = val
-                                      }}
-                                      type="number"
-                                      placeholder="请输入"
-                                    ></el-input>
-                                  </el-form-item>
-                                </div>
-                              ) : (
-                                <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
-                              )
-                            }
-                          },
-                          {
-                            columnAttributes: {
-                              label: '采购金额',
-                              prop: 'amount',
-                              width: 160
-                            },
-                            render: (h, { row, column, index }) => {
-                              return <div style="padding:0 6px">{Number(row['qty']) * Number(row['price'])}</div>
-                            }
-                          },
-                          {
-                            columnAttributes: {
-                              label: '库存数量',
-                              prop: 'stockQty'
-                            }
-                          },
-                          ...(() => {
-                            if (this.formDialogType < 2) {
-                              return [
-                                {
-                                  columnAttributes: {
-                                    label: '操作',
-                                    fixed: 'right',
-                                    width: 140
-                                  },
-                                  render: (h, { row, column, index }) => {
-                                    return (
-                                      <div style="padding:0 6px" class="operation-btns">
-                                        {!~['SAVE', 'WAIT', 'OK', 'FAIL'].indexOf(this.formData.status) ? (
-                                          [
-                                            this.isEditIndex == index ? (
-                                              <el-button
-                                                type="text"
-                                                onClick={() => {
-                                                  this.$refs.formRef.validateField(
-                                                    this.getVfyKey(this.isEditIndex),
-                                                    (valid, invalidFields, errLabels) => {
-                                                      if (valid && this.eidtItems()) {
-                                                        this.isEditIndex = -1
-                                                      }
-                                                    }
-                                                  )
-                                                }}
-                                              >
-                                                保存
-                                              </el-button>
-                                            ) : null,
-                                            this.isEditIndex == -1 ? (
-                                              <el-button
-                                                type="text"
-                                                onClick={() => {
-                                                  this.isEditIndex = index
-                                                }}
-                                              >
-                                                编辑
-                                              </el-button>
-                                            ) : null,
-                                            <el-button
-                                              type="text"
-                                              onClick={() => {
-                                                this.delGoodsInfo(row, index)
-                                              }}
-                                            >
-                                              删除
-                                            </el-button>
-                                          ]
-                                        ) : !!~['SAVE'].indexOf(this.formData.status) ? (
-                                          <el-button type="text" onClick={() => {}}>
-                                            导入条码
-                                          </el-button>
-                                        ) : null}
-                                      </div>
-                                    )
-                                  }
-                                }
-                              ]
-                            }
-                            return []
-                          })()
-                        ]}
-                        tableData={this.formData.items}
-                        tableAttributes={{
-                          size: 'mini',
-                          border: true
-                        }}
-                      />
-                    ]
-                  : this.activeName == 'codeInfo'
-                  ? [
-                      this.formDialogType == 1 ? (
-                        <div style="margin-bottom:10px">
-                          <el-button type="primary" onClick={this.addCodeInfo} disabled={this.isEditIndex != -1}>
-                            添加
-                          </el-button>
-                        </div>
-                      ) : null,
-                      <zj-table
-                        columns={[
-                          ...this.commonColumns,
-                          {
-                            columnAttributes: {
-                              label: '物料类型',
-                              prop: 'goodsMaterialItemType',
-                              width: 160
-                            },
-                            render: (h, { row, column, index }) => {
-                              return this.isEditIndex == index ? (
-                                <div class="redbordererr">
-                                  <el-form-item
-                                    label=""
-                                    lebel-width="0px"
-                                    prop={`codeInfoList.${index}.${column.columnAttributes.prop}`}
-                                    rules={required}
-                                  >
-                                    <el-select
-                                      value={row[column.columnAttributes.prop]}
-                                      onInput={val => {
-                                        row[column.columnAttributes.prop] = val
-                                      }}
-                                      placeholder="请选择"
-                                    >
-                                      {[].map((item, index_) => (
-                                        <el-option
-                                          key={index_}
-                                          label={item.categoryName}
-                                          value={item.categoryId}
-                                        ></el-option>
-                                      ))}
-                                    </el-select>
-                                  </el-form-item>
-                                </div>
-                              ) : (
-                                <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
-                              )
-                            }
-                          },
-                          {
-                            columnAttributes: {
-                              label: '物料名称',
-                              prop: 'goodsMaterialItemName',
-                              width: 160
-                            },
-                            render: (h, { row, column, index }) => {
-                              return this.isEditIndex == index ? (
-                                <div class="redbordererr">
-                                  <el-form-item
-                                    label=""
-                                    lebel-width="0px"
-                                    prop={`codeInfoList.${index}.${column.columnAttributes.prop}`}
-                                    rules={required}
-                                  >
-                                    <el-select
-                                      value={row[column.columnAttributes.prop]}
-                                      onInput={val => {
-                                        row[column.columnAttributes.prop] = val
-                                      }}
-                                      placeholder="请选择"
-                                    >
-                                      {[].map((item, index_) => (
-                                        <el-option
-                                          key={index_}
-                                          label={item.categoryName}
-                                          value={item.categoryId}
-                                        ></el-option>
-                                      ))}
-                                    </el-select>
-                                  </el-form-item>
-                                </div>
-                              ) : (
-                                <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
-                              )
-                            }
-                          },
-                          {
-                            columnAttributes: {
-                              label: '是否一物一码',
-                              prop: 'uniqueCode',
-                              width: 120
-                            }
-                          },
-                          {
-                            columnAttributes: {
-                              label: '条码',
-                              prop: 'code',
-                              width: 160
-                            },
-                            render: (h, { row, column, index }) => {
-                              return this.isEditIndex == index ? (
-                                <div class="redbordererr">
-                                  <el-form-item
-                                    label=""
-                                    lebel-width="0px"
-                                    prop={`codeInfoList.${index}.${column.columnAttributes.prop}`}
-                                    rules={required}
-                                  >
-                                    <el-input
-                                      value={row[column.columnAttributes.prop]}
-                                      onInput={val => {
-                                        row[column.columnAttributes.prop] = val
-                                      }}
-                                      placeholder="请输入"
-                                    ></el-input>
-                                  </el-form-item>
-                                </div>
-                              ) : (
-                                <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
-                              )
-                            }
-                          },
-                          {
-                            columnAttributes: {
-                              label: '数量',
-                              prop: 'codeQty',
-                              width: 160
-                            },
-                            render: (h, { row, column, index }) => {
-                              return this.isEditIndex == index ? (
-                                <div class="redbordererr">
-                                  <el-form-item
-                                    label=""
-                                    lebel-width="0px"
-                                    prop={`codeInfoList.${index}.${column.columnAttributes.prop}`}
-                                    rules={required}
-                                  >
-                                    <el-input
-                                      value={row[column.columnAttributes.prop]}
-                                      onInput={val => {
-                                        row[column.columnAttributes.prop] = val
-                                      }}
-                                      placeholder="请输入"
-                                    ></el-input>
-                                  </el-form-item>
-                                </div>
-                              ) : (
-                                <div style="padding:0 6px">{row[column.columnAttributes.propName]}</div>
-                              )
-                            }
-                          },
-                          ...(() => {
-                            if (this.formDialogType < 2) {
-                              return [
-                                {
-                                  columnAttributes: {
-                                    label: '操作',
-                                    fixed: 'right',
-                                    width: 140
-                                  },
-                                  render: (h, { row, column, index }) => {
-                                    return (
-                                      <div class="operation-btns">
-                                        {this.formDialogType == 0
-                                          ? null
-                                          : this.formDialogType == 1
-                                          ? [
-                                              this.isEditIndex == index ? (
-                                                <el-button
-                                                  type="text"
-                                                  onClick={() => {
-                                                    this.addCode(row)
-                                                  }}
-                                                >
-                                                  保存
-                                                </el-button>
-                                              ) : null,
-                                              this.isEditIndex == -1 ? (
-                                                <el-button
-                                                  type="text"
-                                                  onClick={() => {
-                                                    this.isEditIndex = index
-                                                  }}
-                                                >
-                                                  编辑
-                                                </el-button>
-                                              ) : null,
-                                              <el-button
-                                                type="text"
-                                                onClick={() => {
-                                                  this.delCode(row)
-                                                }}
-                                              >
-                                                删除
-                                              </el-button>
-                                            ]
-                                          : null}
-                                      </div>
-                                    )
-                                  }
-                                }
-                              ]
-                            }
-                            return []
-                          })()
-                        ]}
-                        tableData={this.formData.codeInfoList}
-                        tableAttributes={{
-                          size: 'mini',
-                          border: true
-                        }}
-                      />
-                    ]
-                  : null}
-              </div>
-            )
-          }
-        }
-      ]
-    }
-  },
-  watch: {
-    activeName(newVal) {
-      this.isEditIndex = -1
-      if (newVal == 'codeInfo') {
-        this.getGoodsPurchaseCodeList()
-      } else {
-        // 清空条码数据列表
-        this.formData.codeInfoList = []
-      }
-    }
-  },
-  methods: {
-    getVfyKey(index, bool = true) {
-      return [
-        ...(() => {
-          if (bool) {
-            return [`items`]
-          }
-          return []
-        })(),
-        ...(() => {
-          if (index > -1) {
-            return [
-              `items.${index}.brandId`,
-              `items.${index}.mainId`,
-              `items.${index}.smallId`,
-              `items.${index}.goodsMaterialId`,
-              `items.${index}.qty`,
-              `items.${index}.price`
-            ]
-          }
-          return []
-        })()
-      ]
-    },
-    eidtItems() {
-      try {
-        this.formData.items.map((item, index) => {
-          this.formData.items.map((item2, index2) => {
-            if (
-              index !== index2 &&
-              `${item.brandId}_${item.mainId}_${item.smallId}_${item.goodsMaterialId}` ==
-                `${item2.brandId}_${item2.mainId}_${item2.smallId}_${item2.goodsMaterialId}`
-            ) {
-              throw new Error('')
-            }
-          })
-        })
-      } catch (error) {
-        this.$message.warning('重复')
-        return false
-      }
-      return true
-    },
-    // 添加商品信息
-    addGoodsInfo() {
-      if (this.isEditIndex > -1) {
-        this.$refs.formRef.validateField(this.getVfyKey(this.isEditIndex), (valid, invalidFields, errLabels) => {
-          if (valid && this.eidtItems()) {
-            this.formData.items.unshift({
-              brandId: '',
-              brandName: '',
-              mainId: '',
-              mainName: '',
-              smallId: '',
-              smallName: '',
-              goodsMaterialId: '',
-              goodsMaterialName: '',
-              specsName: '',
-              unit: '',
-              qty: '',
-              insideQty: '',
-              outQty: '',
-              partsQty: '',
-              insideCodeQty: '',
-              outCodeQty: '',
-              partsCodeQty: '',
-              price: '',
-              amount: '',
-              stockQty: ''
-            })
-            this.isEditIndex = 0
-          }
-        })
-      } else if (this.eidtItems()) {
-        this.formData.items.unshift({
-          brandId: '',
-          brandName: '',
-          mainId: '',
-          mainName: '',
-          smallId: '',
-          smallName: '',
-          goodsMaterialId: '',
-          goodsMaterialName: '',
-          specsName: '',
-          unit: '',
-          qty: '',
-          insideQty: '',
-          outQty: '',
-          partsQty: '',
-          insideCodeQty: '',
-          outCodeQty: '',
-          partsCodeQty: '',
-          price: '',
-          amount: '',
-          stockQty: ''
-        })
-        this.isEditIndex = 0
-      }
-    },
-    delGoodsInfo(row, index) {
-      if (index > this.isEditIndex) {
-        this.formData?.items?.splice(index, 1)
-      } else if (index == this.isEditIndex) {
-        this.formData?.items?.splice(index, 1)
-        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.formData.codeInfoList.unshift({
-        brandId: '',
-        brandName: '',
-        mainId: '',
-        mainName: '',
-        smallId: '',
-        smallName: '',
-        goodsMaterialId: '',
-        goodsMaterialName: '',
-        specsName: '',
-        goodsMaterialItemType: '',
-        goodsMaterialItemName: '',
-        uniqueCode: '',
-        code: '',
-        codeQty: ''
-      })
-      this.isEditIndex = 0
-    },
-    addCode(row) {},
-    delCode(row) {}
-  }
-}