فهرست منبع

对接采购入库单

aXin-0810 1 سال پیش
والد
کامیت
1b0d122fd9

+ 32 - 0
src/api/goodsPurchasedStored.js

@@ -47,3 +47,35 @@ export function goodsPurchaseCodeListExport(data, name) {
     name
   })
 }
+
+export function goodsPurchaseAdd(data) {
+  return request({
+    url: `/goods/purchase/add`,
+    method: 'post',
+    data
+  })
+}
+
+export function goodsPurchaseDetail(params) {
+  return request({
+    url: `/goods/purchase/detail`,
+    method: 'post',
+    params
+  })
+}
+
+export function goodsPurchaseSubmit(params) {
+  return request({
+    url: `/goods/purchase/submit`,
+    method: 'post',
+    params
+  })
+}
+
+export function goodsPurchaseConfirm(params) {
+  return request({
+    url: `/goods/purchase/confirm`,
+    method: 'post',
+    params
+  })
+}

+ 180 - 11
src/views/salesPurchasing/goodsPurchasedStored/index.vue

@@ -9,39 +9,76 @@
     :moreParameters="moreParameters"
     :column-parsing="columnParsing"
     :exportList="exportList"
+    :operation="operation()"
     key="pageType"
   >
     <div slot="moreSearch">
-      <el-radio-group v-model="pageType" size="mini" @change="changePageType">
+      <el-radio-group v-model="pageType" size="mini">
         <el-radio-button label="list">列表</el-radio-button>
         <el-radio-button label="goodsder">商品明细</el-radio-button>
         <el-radio-button label="codeder">条码明细</el-radio-button>
       </el-radio-group>
       <br /><br />
     </div>
+    <div class="cartographer_big">
+      <el-dialog
+        :title="formDialogTitles[formDialogType]"
+        width="100%"
+        :modal="false"
+        :visible.sync="formDialog"
+        :before-close="handleClose"
+      >
+        <zj-page-container>
+          <zj-page-fill>
+            <div style="box-sizing: border-box; padding: 20px 20px 0 20px">
+              <zj-form-container ref="formRef" :form-data="formData" :form-attributes="{ size: 'mini' }">
+                <zj-form-module title="单据信息" label-width="100px" :form-data="formData" :form-items="formItems">
+                </zj-form-module>
+                <zj-form-module title="" label-width="100px" :form-data="formData" :form-items="formItems2">
+                  <el-tabs slot="header" v-model="activeName">
+                    <el-tab-pane label="商品信息" name="goodsInfo"></el-tab-pane>
+                    <el-tab-pane v-if="formDialogType > 0" label="条码信息" name="codeInfo"></el-tab-pane>
+                  </el-tabs>
+                </zj-form-module>
+              </zj-form-container>
+            </div>
+          </zj-page-fill>
+          <div v-if="activeName == 'goodsInfo'" style="text-align: right; box-sizing: border-box; padding: 16px 20px">
+            <el-button v-if="formDialogType == 0" size="mini" type="primary" @click="save">保存</el-button>
+            <el-button v-if="formDialogType == 1" size="mini" type="primary" @click="submit">提交</el-button>
+            <el-button v-if="formDialogType == 3" size="mini" type="primary" @click="examine">审核通过</el-button>
+          </div>
+        </zj-page-container>
+      </el-dialog>
+    </div>
   </template-page>
 </template>
 
 <script>
 import TemplatePage from '@/components/template/template-page-1.vue'
 import import_mixin from '@/components/template/import_mixin.js'
+import operation_mixin from '@/components/template/operation_mixin.js'
 import {
   goodsPurchaseList,
   goodsPurchaseListExport,
   goodsPurchaseItemList,
   goodsPurchaseItemListExport,
   goodsPurchaseCodeList,
-  goodsPurchaseCodeListExport
+  goodsPurchaseCodeListExport,
+  goodsPurchaseAdd,
+  goodsPurchaseDetail,
+  goodsPurchaseSubmit,
+  goodsPurchaseConfirm
 } from '@/api/goodsPurchasedStored.js'
+import form_ty from '../mixins/form_ty'
+import table_cg from '../mixins/table_cg'
 export default {
   components: { TemplatePage },
-  mixins: [import_mixin],
+  mixins: [import_mixin, operation_mixin, form_ty, table_cg],
   data() {
     return {
       pageType: 'list',
       pageShow: true,
-      // 事件组合
-      optionsEvensGroup: [],
       // 表格属性
       tableAttributes: {
         // 启用勾选列
@@ -55,22 +92,61 @@ export default {
       recordSelected: [],
       /** 表单变量 */
       formDialogType: 0,
-      formDialogTitles: ['新增', '编辑', '详情'],
+      formDialogTitles: ['新增入库单', '编辑入库单', '入库单详情', '审核入库单'],
       formDialog: false,
-      appraise_status: ''
+      appraise_status: '',
+      formData: {
+        companyWechatId: '',
+        companyWechatName: '',
+        examineBy: '',
+        examineTime: '',
+        fileUrl: '',
+        remark: '',
+        status: '',
+        submitBy: '',
+        submitTime: '',
+        totalAmount: 0,
+        totalQty: 0,
+        updateBy: '',
+        updateTime: '',
+        venderId: '',
+        venderName: '',
+        fileUrl: [],
+        items: []
+      },
+      activeName: 'goodsInfo'
     }
   },
   computed: {
+    // 事件组合
+    optionsEvensGroup() {
+      if (this.pageType == 'list') {
+        return [
+          [
+            [
+              this.optionsEvensAuth('add', {
+                click: () => {
+                  this.openForm()
+                  this.formDialog = true
+                }
+              })
+            ]
+          ]
+        ]
+      } else if (this.pageType == 'goodsder') {
+        return []
+      } else if (this.pageType == 'codeder') {
+        return []
+      }
+    },
     // 更多参数
     moreParameters() {
       return []
-    },
-    formItems() {
-      return []
     }
   },
   watch: {
     pageType() {
+      this.handleClose()
       this.pageShow = false
       this.$nextTick(() => {
         this.pageShow = true
@@ -106,7 +182,100 @@ export default {
     selectionChange(data) {
       this.recordSelected = data
     },
-    changePageType() {}
+    // 打开创建弹窗
+    openForm() {
+      this.getGysList()
+      this.getBaseList()
+    },
+    // 打开详情弹窗
+    openDetailForm(row, type) {
+      goodsPurchaseDetail({ id: row.id }).then(res => {
+        Object.assign(this.formData, res.data, {
+          fileUrl: res.data.fileUrl ? [{ url: res.data.fileUrl }] : []
+        })
+        this.formDialogType = type
+        this.openForm()
+        this.formDialog = true
+      })
+    },
+    // 关闭弹窗
+    handleClose() {
+      this.$refs?.formRef?.resetFields()
+      this.$data.formData = this.$options.data().formData
+      this.formDialog = false
+    },
+    // 操作按钮
+    operation() {
+      return this.operationBtn({
+        edit: {
+          conditions: ({ row, index, column }) => {
+            return row.status == 'SAVE'
+          },
+          click: ({ row, index, column }) => {
+            this.openDetailForm(row, 1)
+          }
+        },
+        detail: {
+          click: ({ row, index, column }) => {
+            this.openDetailForm(row, 2)
+          }
+        },
+        shenhe: {
+          conditions: ({ row, index, column }) => {
+            return row.status == 'WAIT'
+          },
+          click: ({ row, index, column }) => {
+            this.openDetailForm(row, 3)
+          }
+        }
+      })
+    },
+    // 保存
+    save() {
+      this.$refs.formRef.validateField(this.getVfyKey(this.isEditIndex), (valid, invalidFields, errLabels) => {
+        if (valid && this.eidtItems()) {
+          goodsPurchaseAdd({
+            ...this.formData,
+            items: this.formData.items.map((item, index) => ({ ...item, index: index + 1 })),
+            fileUrl: this.formData.fileUrl.map(item => item.url).join(',')
+          }).then(res => {
+            this.$message({
+              type: 'success',
+              message: '保存成功'
+            })
+            this.handleClose()
+            this.$refs.pageRef.refreshList()
+          })
+        }
+      })
+    },
+    // 提交
+    submit() {
+      goodsPurchaseSubmit({
+        id: this.formData.id
+      }).then(res => {
+        this.$message({
+          type: 'success',
+          message: '提交成功'
+        })
+        this.handleClose()
+        this.$refs.pageRef.refreshList()
+      })
+    },
+    // 审核
+    examine() {
+      goodsPurchaseConfirm({
+        id: this.formData.id,
+        statusEnum: 'OK'
+      }).then(res => {
+        this.$message({
+          type: 'success',
+          message: '审核成功'
+        })
+        this.handleClose()
+        this.$refs.pageRef.refreshList()
+      })
+    }
   }
 }
 </script>

+ 453 - 0
src/views/salesPurchasing/mixins/form_ty.js

@@ -0,0 +1,453 @@
+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
+    }
+  },
+  computed: {
+    formItems() {
+      return [
+        {
+          md: 24,
+          isShow: true,
+          name: 'slot-component',
+          formItemAttributes: {
+            label: '',
+            prop: '',
+            'label-width': '0px'
+          },
+          render: (h, { props, onInput }) => {
+            var { value } = props
+            return (
+              <div>
+                <el-descriptions
+                  border
+                  title=""
+                  column={4}
+                  colon={false}
+                  labelStyle={{ width: '8%' }}
+                  contentStyle={{ width: '17%' }}
+                >
+                  <el-descriptions-item label="单据状态">
+                    {{ SAVE: '保存', WAIT: '待审核', OK: '通过', FAIL: '失败' }[this.formData.status] || ''}
+                  </el-descriptions-item>
+                  <el-descriptions-item label="单据编号">{this.formData.id || ''}</el-descriptions-item>
+                  <el-descriptions-item label="所属商户" contentStyle={{ width: '42%' }}>
+                    {JSON.parse(localStorage.getItem('greemall_user')).companyName}
+                  </el-descriptions-item>
+                </el-descriptions>
+                <el-descriptions
+                  border
+                  title=""
+                  column={2}
+                  colon={false}
+                  labelStyle={{ width: '8%' }}
+                  contentStyle={{ width: '42%' }}
+                  style="margin-top:-1px"
+                >
+                  <el-descriptions-item label="供应商名称">
+                    <div class="redbordererr">
+                      <el-form-item label="" lebel-width="0px" prop={`venderId`} rules={required}>
+                        <el-select
+                          style="width:100%"
+                          value={this.formData.venderId}
+                          onInput={val => {
+                            this.formData.venderId = val
+                          }}
+                          placeholder="请选择"
+                          disabled={!!~['SAVE', 'WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)}
+                          onChange={val => {
+                            if (val) {
+                              this.formData['venderName'] = this.gysList.find(item => item.venderId == val).venderName
+                            } else {
+                              this.formData['venderName'] = ''
+                            }
+                          }}
+                        >
+                          {this.gysList.map(item => (
+                            <el-option key={item.venderId} label={item.venderName} value={item.venderId}></el-option>
+                          ))}
+                        </el-select>
+                      </el-form-item>
+                    </div>
+                  </el-descriptions-item>
+                  {!!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name) ? (
+                    <el-descriptions-item label="采购入库单">
+                      <div class="redbordererr">
+                        <el-form-item label="" lebel-width="0px" prop={`venderId`} rules={required}>
+                          <el-select
+                            style="width:100%"
+                            value={this.formData.goodsPurchaseId}
+                            onInput={val => {
+                              this.formData.goodsPurchaseId = val
+                            }}
+                            placeholder="请选择"
+                            disabled={!!~['SAVE', 'WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)}
+                          >
+                            {[].map(item => (
+                              <el-option key={item.id} label={item.label} value={item.id}></el-option>
+                            ))}
+                          </el-select>
+                        </el-form-item>
+                      </div>
+                    </el-descriptions-item>
+                  ) : (
+                    <el-descriptions-item label=""></el-descriptions-item>
+                  )}
+                </el-descriptions>
+                <el-descriptions
+                  border
+                  title=""
+                  column={4}
+                  colon={false}
+                  labelStyle={{ width: '8%' }}
+                  contentStyle={{ width: '17%' }}
+                  style="margin-top:-1px"
+                >
+                  {!!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name)
+                    ? [
+                        <el-descriptions-item label="退货数量">{this.formData.totalQty}</el-descriptions-item>,
+                        <el-descriptions-item label="退款金额">{this.formData.totalAmount}</el-descriptions-item>,
+                        <el-descriptions-item label=""></el-descriptions-item>,
+                        <el-descriptions-item label=""></el-descriptions-item>
+                      ]
+                    : null}
+                  <el-descriptions-item label="制单人">{this.formData.createBy}</el-descriptions-item>
+                  <el-descriptions-item label="制单时间">{this.formData.createTime}</el-descriptions-item>
+                  <el-descriptions-item label="审核人">{this.formData.examineBy}</el-descriptions-item>
+                  <el-descriptions-item label="审核时间">{this.formData.examineTime}</el-descriptions-item>
+                </el-descriptions>
+                <el-descriptions
+                  border
+                  title=""
+                  column={4}
+                  colon={false}
+                  labelStyle={{ width: '8%' }}
+                  contentStyle={{ width: '17%' }}
+                  style="margin-top:-1px"
+                >
+                  <el-descriptions-item label="备注" contentStyle={{ width: '92%' }}>
+                    <el-input
+                      type="textarea"
+                      placeholder="请输入内容"
+                      value={this.formData.remark}
+                      onInput={val => {
+                        this.formData.remark = val
+                      }}
+                      maxlength="200"
+                      show-word-limit
+                      autosize={{ minRows: 2, maxRows: 4 }}
+                      disabled={!!~['SAVE', 'WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)}
+                    ></el-input>
+                  </el-descriptions-item>
+                </el-descriptions>
+                <el-descriptions
+                  border
+                  title=""
+                  column={4}
+                  colon={false}
+                  labelStyle={{ width: '8%' }}
+                  contentStyle={{ width: '17%' }}
+                  style="margin-top:-1px"
+                >
+                  <el-descriptions-item label="附件" contentStyle={{ width: '92%' }}>
+                    <ImageUpload
+                      fileList={this.formData.fileUrl}
+                      uid="imgSrc666_materials_drawing_images"
+                      limit={1}
+                      isEdit={!~['SAVE', 'WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)}
+                      fileType={['image']}
+                    />
+                  </el-descriptions-item>
+                </el-descriptions>
+              </div>
+            )
+          }
+        }
+      ]
+    },
+    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'
+          }
+        }
+      ]
+    }
+  },
+  methods: {
+    // 获取供应商列表
+    getGysList() {
+      listPageV2({
+        pageNum: 1,
+        pageSize: -1,
+        params: [
+          { param: 'a.status', compare: '=', value: 'ON' },
+          { param: 'a.vender_type', compare: 'like', value: '商品' }
+        ]
+      }).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)
+      }
+    }
+  }
+}

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

@@ -0,0 +1,576 @@
+import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
+export default {
+  data() {
+    return { codeInfoList: [] }
+  },
+  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}>
+                            添加
+                          </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={`items.${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={`items.${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={`items.${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={`items.${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={() => {}}>
+                                                  保存
+                                                </el-button>
+                                              ) : null,
+                                              !this.isEditIndex == index ? (
+                                                <el-button type="text" onClick={() => {}}>
+                                                  编辑
+                                                </el-button>
+                                              ) : null,
+                                              <el-button type="text" onClick={() => {}}>
+                                                删除
+                                              </el-button>
+                                            ]
+                                          : null}
+                                      </div>
+                                    )
+                                  }
+                                }
+                              ]
+                            }
+                            return []
+                          })()
+                        ]}
+                        tableData={this.codeInfoList}
+                        tableAttributes={{
+                          size: 'mini',
+                          border: true
+                        }}
+                      />
+                    ]
+                  : null}
+              </div>
+            )
+          }
+        }
+      ]
+    }
+  },
+  watch: {
+    activeName(newVal) {
+      if (newVal == 'codeInfo') {
+        // 获取条码列表数据
+      } else {
+        // 清空条码数据列表
+        this.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
+      }
+    },
+    // 添加条码信息
+    addCodeInfo() {
+      this.codeInfoList.unshift({
+        brandId: '',
+        brandName: '',
+        mainId: '',
+        mainName: '',
+        smallId: '',
+        smallName: '',
+        goodsMaterialId: '',
+        goodsMaterialName: '',
+        specsName: '',
+        goodsMaterialItemType: '',
+        goodsMaterialItemName: '',
+        uniqueCode: '',
+        code: '',
+        codeQty: ''
+      })
+    }
+  }
+}