linwenxin 4 месяцев назад
Родитель
Сommit
f1ff438c47

+ 73 - 0
src/api/purchaseSchedule.js

@@ -0,0 +1,73 @@
+import request, { postBlob, getBlob, handleImport } from '@/utils/request'
+
+export function goodsPlanList(data) {
+  return request({
+    url: `/goods/plan/list?moduleId=${data.moduleId}`,
+    method: 'post',
+    data
+  })
+}
+
+export function goodsPlanItemList(data) {
+  return request({
+    url: `/goods/plan/item/list?moduleId=${data.moduleId}`,
+    method: 'post',
+    data
+  })
+}
+
+export function goodsPlanListExport(data, name) {
+  return postBlob({
+    url: '/goods/plan/list/export',
+    data,
+    name
+  })
+}
+
+export function goodsPlanAdd(data) {
+  return request({
+    url: '/goods/plan/add',
+    method: 'post',
+    data: data
+  })
+}
+
+export function goodsPlanUpdate(data) {
+  return request({
+    url: '/goods/plan/update',
+    method: 'post',
+    data: data
+  })
+}
+
+export function goodsPlanSubmit(data) {
+  return request({
+    url: '/goods/plan/submit',
+    method: 'post',
+    params: data
+  })
+}
+
+export function goodsPlanDetail(params) {
+  return request({
+    url: '/goods/plan/detail',
+    method: 'post',
+    params: params
+  })
+}
+
+export function goodsPlanConfirm(params) {
+  return request({
+    url: '/goods/plan/confirm',
+    method: 'post',
+    params: params
+  })
+}
+
+export function goodsPlanDel(params) {
+  return request({
+    url: '/goods/plan/del',
+    method: 'post',
+    params: params
+  })
+}

+ 316 - 0
src/views/mallManagement/purchaseScheduleManagement/mixins/common_form.js

@@ -0,0 +1,316 @@
+import { required, diyRequired } from '@/components/template/rules_verify.js'
+import { listPageV2 } from '@/api/auxiliaryFittings/supplier'
+import { goodsPurchaseList, goodsPurchaseDetail } from '@/api/goodsPurchasedStored.js'
+import { storageListPageV2 } from '@/api/storage.js'
+import ImageUpload from '@/components/file-upload'
+export default {
+  data() {
+    return {
+      gysList: []
+    }
+  },
+  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={3}
+                  colon={false}
+                  labelStyle={{ width: '8%' }}
+                  contentStyle={{ width: '17%' }}
+                  style="margin-top:-1px"
+                >
+                  <el-descriptions-item label="*供应商名称" contentStyle={{ width: '42%' }}>
+                    <div class="redbordererr">
+                      <el-form-item
+                        label=""
+                        lebel-width="0px"
+                        prop={`venderId`}
+                        rules={[
+                          diyRequired.bind(this)((rule, value) => {
+                            if (this.logs) {
+                              this.logs.push({ errMsg: `*供应商名称不能为空` })
+                            }
+                            this?.tishicuowu?.()
+                            return new Error('必须填写')
+                          })
+                        ]}
+                      >
+                        <el-select
+                          style="width:100%"
+                          value={this.formData.venderId}
+                          onInput={val => {
+                            this.formData.venderId = val
+                          }}
+                          placeholder="请选择"
+                          disabled={!!~['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>
+                  <el-descriptions-item label="订货类型">
+                    <div class="redbordererr">
+                      <el-form-item
+                        label=""
+                        lebel-width="0px"
+                        prop={`orderGoodsType`}
+                        rules={[
+                          diyRequired.bind(this)((rule, value) => {
+                            if (this.logs) {
+                              this.logs.push({ errMsg: `*orderGoodsType不能为空` })
+                            }
+                            this?.tishicuowu?.()
+                            return new Error('必须填写')
+                          })
+                        ]}
+                      >
+                        <el-select
+                          style="width:100%"
+                          value={this.formData.orderGoodsType}
+                          onInput={val => {
+                            this.formData.orderGoodsType = val
+                          }}
+                          placeholder="请选择"
+                          disabled={!!~['WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)}
+                        >
+                          <el-option label="工程机" value="E"></el-option>
+                          <el-option label="零售机" value="S"></el-option>
+                          <el-option label="非空类" value="O"></el-option>
+                        </el-select>
+                      </el-form-item>
+                    </div>
+                  </el-descriptions-item>
+                  <el-descriptions-item label="工程登入编号">
+                    <div class="redbordererr">
+                      <el-form-item
+                        label=""
+                        lebel-width="0px"
+                        prop={`enginCode`}
+                        rules={
+                          this.formData.orderGoodsType == 'E'
+                            ? [
+                                diyRequired.bind(this)((rule, value) => {
+                                  if (this.logs) {
+                                    this.logs.push({ errMsg: `*工程登入编号不能为空` })
+                                  }
+                                  this?.tishicuowu?.()
+                                  return new Error('必须填写')
+                                })
+                              ]
+                            : []
+                        }
+                      >
+                        <el-input
+                          placeholder="请输入内容"
+                          value={this.formData.enginCode}
+                          onInput={val => {
+                            this.formData.enginCode = val
+                          }}
+                          disabled={!!~['WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)}
+                        ></el-input>
+                      </el-form-item>
+                    </div>
+                  </el-descriptions-item>
+                </el-descriptions>
+                <el-descriptions
+                  border
+                  title=""
+                  column={3}
+                  colon={false}
+                  labelStyle={{ width: '8%' }}
+                  contentStyle={{ width: '17%' }}
+                  style="margin-top:-1px"
+                >
+                  <el-descriptions-item label="工程名称" contentStyle={{ width: '42%' }}>
+                    <div class="redbordererr">
+                      <el-form-item
+                        label=""
+                        lebel-width="0px"
+                        prop={`enginName`}
+                        rules={
+                          this.formData.orderGoodsType == 'E'
+                            ? [
+                                diyRequired.bind(this)((rule, value) => {
+                                  if (this.logs) {
+                                    this.logs.push({ errMsg: `*工程名称不能为空` })
+                                  }
+                                  this?.tishicuowu?.()
+                                  return new Error('必须填写')
+                                })
+                              ]
+                            : []
+                        }
+                      >
+                        <el-input
+                          placeholder="请输入内容"
+                          value={this.formData.enginName}
+                          onInput={val => {
+                            this.formData.enginName = val
+                          }}
+                          disabled={!!~['WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)}
+                        ></el-input>
+                      </el-form-item>
+                    </div>
+                  </el-descriptions-item>
+                  <el-descriptions-item label="运费(元)">
+                    <div class="redbordererr">
+                      <el-form-item
+                        label=""
+                        lebel-width="0px"
+                        prop={`freightAmount`}
+                        rules={[
+                          diyRequired.bind(this)((rule, value) => {
+                            if (this.logs) {
+                              this.logs.push({ errMsg: `*运费不能为空` })
+                            }
+                            this?.tishicuowu?.()
+                            return new Error('必须填写')
+                          })
+                        ]}
+                      >
+                        <el-input
+                          type="number"
+                          placeholder="请输入内容"
+                          value={this.formData.freightAmount}
+                          onInput={val => {
+                            this.formData.freightAmount = val
+                          }}
+                          disabled={!!~['WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)}
+                        ></el-input>
+                      </el-form-item>
+                    </div>
+                  </el-descriptions-item>
+                  <el-descriptions-item label="订货总额(元)">
+                    <div class="redbordererr">
+                      <el-form-item label="" lebel-width="0px">
+                        <el-input
+                          type="number"
+                          placeholder="请输入内容"
+                          value={this.formData.totalAmount}
+                          disabled={true}
+                        ></el-input>
+                      </el-form-item>
+                    </div>
+                  </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="制单人">{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={!!~['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={!~['WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)}
+                      fileType={['image']}
+                    />
+                  </el-descriptions-item>
+                </el-descriptions>
+              </div>
+            )
+          }
+        }
+      ]
+    }
+  },
+  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
+      })
+    }
+  }
+}

+ 614 - 0
src/views/mallManagement/purchaseScheduleManagement/mixins/storage_goods.js

@@ -0,0 +1,614 @@
+import { required, diyRequired } from '@/components/template/rules_verify.js'
+import { getBrandList } from '@/api/miniapp'
+import { getClassifyList } from '@/api/goods'
+import { goodsMaterialList } from '@/api/commercialMaterial.js'
+import { goodsPurchaseItemImportCode, goodsPurchaseDetail } from '@/api/goodsPurchasedStored.js'
+
+export default {
+  data() {
+    return {
+      brandList: [],
+      ClassifyList: [],
+      goodsMaterialList: []
+    }
+  },
+  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={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
+                >
+                  <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={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
+                >
+                  <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={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
+                >
+                  <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={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
+                >
+                  <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 (!!~[0, 1].indexOf(this.formDialogType)) {
+                            row['specsName'] = res?.specsName
+                            row['unit'] = res?.unit
+                            row['insideQty'] =
+                              res.items
+                                .filter(item => item.type === 'INSIDE')
+                                .map(item => item.qty)
+                                .reduce((accumulator, currentValue) => accumulator + currentValue, 0) * Number(row?.qty)
+                            row['outQty'] =
+                              res.items
+                                .filter(item => item.type === 'OUT')
+                                .map(item => item.qty)
+                                .reduce((accumulator, currentValue) => accumulator + currentValue, 0) * Number(row?.qty)
+                            row['partsQty'] =
+                              res.items
+                                .filter(item => item.type === 'PARTS')
+                                .map(item => item.qty)
+                                .reduce((accumulator, currentValue) => accumulator + currentValue, 0) * Number(row?.qty)
+                          }
+                        })
+                      } else {
+                        row[column.columnAttributes.propName] = ''
+                        row['specsName'] = ''
+                        row['unit'] = ''
+                        row['insideQty'] = ''
+                        row['outQty'] = ''
+                        row['partsQty'] = ''
+                      }
+                    }}
+                    filterable={true}
+                    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={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
+                >
+                  <el-input
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      row[column.columnAttributes.prop] = val <= 0 ? 0 : Number(val)
+                      this.getGoodsDetl(
+                        this.goodsMaterialList
+                          .filter(
+                            item =>
+                              item.brandId === row.brandId && item.mainId === row.mainId && item.smallId === row.smallId
+                          )
+                          .find(item => item.id == row.goodsMaterialId),
+                        res => {
+                          if (!!~[0, 1].indexOf(this.formDialogType)) {
+                            row['insideQty'] =
+                              res.items
+                                .filter(item => item.type === 'INSIDE')
+                                .map(item => item.qty)
+                                .reduce((accumulator, currentValue) => accumulator + currentValue, 0) *
+                              row[column.columnAttributes.prop]
+                            row['outQty'] =
+                              res.items
+                                .filter(item => item.type === 'OUT')
+                                .map(item => item.qty)
+                                .reduce((accumulator, currentValue) => accumulator + currentValue, 0) *
+                              row[column.columnAttributes.prop]
+                            row['partsQty'] =
+                              res.items
+                                .filter(item => item.type === 'PARTS')
+                                .map(item => item.qty)
+                                .reduce((accumulator, currentValue) => accumulator + currentValue, 0) *
+                              row[column.columnAttributes.prop]
+                          }
+                        }
+                      )
+                    }}
+                    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: '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={[
+                    diyRequired.bind(this)((rule, value) => {
+                      if (this.logs) {
+                        this.logs.push({ index: index, errMsg: `${column.columnAttributes.label}不能为空` })
+                      }
+                      this?.tishicuowu?.()
+                      return new Error('必须填写')
+                    })
+                  ]}
+                >
+                  <el-input
+                    value={row[column.columnAttributes.prop]}
+                    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>
+          }
+        },
+        ...(() => {
+          if (this.formDialogType < 2 && !~['WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)) {
+            return [
+              {
+                columnAttributes: {
+                  label: '操作',
+                  fixed: 'right',
+                  width: 140
+                },
+                render: (h, { row, column, index }) => {
+                  return (
+                    <div style="padding:0 6px" class="operation-btns">
+                      {[
+                        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 && this.formDialogType == 0 ? (
+                          <el-button
+                            type="text"
+                            onClick={() => {
+                              this.isEditIndex = index
+                            }}
+                          >
+                            编辑
+                          </el-button>
+                        ) : null,
+                        this.formDialogType == 0 ? (
+                          <el-button
+                            type="text"
+                            onClick={() => {
+                              this.delGoodsInfo(row, index)
+                            }}
+                          >
+                            删除
+                          </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
+          .filter(item => item.isVirtyual !== 'YES' && item.state == 'ON')
+          .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 = ''
+      }
+    },
+    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: '',
+              price: '',
+              amount: ''
+            })
+            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: '',
+          price: '',
+          amount: ''
+        })
+        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
+      }
+    }
+  }
+}

+ 48 - 0
src/views/mallManagement/purchaseScheduleManagement/mixins/storage_table.js

@@ -0,0 +1,48 @@
+import { goodsPurchaseDetail } from '@/api/goodsPurchasedStored.js'
+import { commonTemplateDownload } from '@/api/common.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>
+                {[
+                  !!~[0, 1].indexOf(this.formDialogType) ? (
+                    <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
+                    }}
+                  />
+                ]}
+              </div>
+            )
+          }
+        }
+      ]
+    }
+  },
+  methods: {}
+}

+ 294 - 0
src/views/mallManagement/purchaseScheduleManagement/purchaseSchedule/index.vue

@@ -0,0 +1,294 @@
+<template>
+  <template-page
+    ref="pageRef"
+    :get-list="getList"
+    :table-attributes="tableAttributes"
+    :table-events="tableEvents"
+    :options-evens-group="optionsEvensGroup"
+    :moreParameters="moreParameters"
+    :column-parsing="columnParsing"
+    :exportList="exportList"
+    :operation="operation()"
+  >
+    <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">
+                </zj-form-module>
+              </zj-form-container>
+            </div>
+          </zj-page-fill>
+          <div 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('OK')">审核通过</el-button>
+            <el-button v-if="formDialogType == 3" size="mini" type="primary" @click="examine('FAIL')"
+              >审核驳回</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 {
+  goodsPlanItemList,
+  goodsPlanListExport,
+  goodsPlanAdd,
+  goodsPlanUpdate,
+  goodsPlanSubmit,
+  goodsPlanDetail,
+  goodsPlanConfirm,
+  goodsPlanDel
+} from '@/api/purchaseSchedule.js'
+import form_ty from '../mixins/common_form'
+import storage_table from '../mixins/storage_table'
+import storage_goods from '../mixins/storage_goods'
+import { delayPerform, firstPerform, intervalPerform, passivePerform, queuePerform } from 'js-perform-lock'
+export default {
+  components: { TemplatePage },
+  mixins: [import_mixin, operation_mixin, form_ty, storage_table, storage_goods],
+  data() {
+    return {
+      // 表格属性
+      tableAttributes: {
+        // 启用勾选列
+        selectColumn: false
+      },
+      // 表格事件
+      tableEvents: {
+        'selection-change': this.selectionChange
+      },
+      // 勾选选中行
+      recordSelected: [],
+      /** 表单变量 */
+      formDialogType: 0,
+      formDialogTitles: ['新增', '编辑', '详情', '审核'],
+      formDialog: false,
+      formData: {
+        companyWechatId: '',
+        companyWechatName: '',
+        examineBy: '',
+        examineTime: '',
+        fileUrl: '',
+        remark: '',
+        status: '',
+        submitBy: '',
+        submitTime: '',
+        totalAmount: '',
+        totalQty: '',
+        updateBy: '',
+        updateTime: '',
+        venderId: '',
+        venderName: '',
+        storageId: '',
+        storageName: '',
+        enginCode: '',
+        enginName: '',
+        freightAmount: '',
+        orderGoodsType: '',
+        fileUrl: [],
+        items: [],
+        codeInfoList: []
+      },
+      logs: []
+    }
+  },
+  computed: {
+    // 事件组合
+    optionsEvensGroup() {
+      return [
+        [
+          [
+            this.optionsEvensAuth('add', {
+              click: () => {
+                this.openForm()
+                this.formDialog = true
+              }
+            })
+          ]
+        ]
+      ]
+    },
+    // 更多参数
+    moreParameters() {
+      return []
+    }
+  },
+  methods: {
+    tishicuowu: new delayPerform(500).refactor(function (/**可接收参数**/) {
+      if (this.logs) {
+        var logs = Array.from(
+          new Set(
+            JSON.parse(JSON.stringify(this.logs)).map(item => {
+              return `${item.index !== undefined ? '第' + (item.index + 1) + '行:' : ''}${item.errMsg}`
+            })
+          )
+        )
+        this.logs = []
+        this.$message({
+          dangerouslyUseHTMLString: true,
+          type: 'warning',
+          message: logs.join('<div/>'),
+          duration: 5000
+        })
+      }
+    }),
+    // 列表请求函数
+    getList(p, cb) {
+      return goodsPlanItemList(p)
+    },
+    // 列表导出函数
+    exportList: goodsPlanListExport,
+    // 表格列解析渲染数据更改
+    columnParsing(item, defaultData) {
+      return defaultData
+    },
+    // 监听勾选变化
+    selectionChange(data) {
+      this.recordSelected = data
+    },
+    // 打开创建弹窗
+    openForm() {
+      this.isEditIndex = -1
+      this.getGysList()
+      this.getBaseList()
+    },
+    // 打开详情弹窗
+    openDetailForm(row, type) {
+      goodsPlanDetail({ id: row.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.formDialogType = type
+        this.openForm()
+        this.formDialog = true
+      })
+    },
+    // 关闭弹窗
+    handleClose() {
+      this.$refs?.formRef?.resetFields()
+      this.$data.formData = this.$options.data().formData
+      this.formDialog = false
+      this.formDialogType = 0
+    },
+    // 操作按钮
+    operation() {
+      return this.operationBtn({
+        edit: {
+          conditions: ({ row, index, column }) => {
+            return row.status == 'SAVE'
+          },
+          click: ({ row, index, column }) => {
+            this.openDetailForm(row, 1)
+          }
+        },
+        del: {
+          prompt: '是否确定删除',
+          conditions: ({ row, index, column }) => {
+            return row.status == 'SAVE'
+          },
+          click: ({ row, index, column }) => {
+            goodsPlanDel({
+              id: row.id
+            }).then(res => {
+              this.$message({
+                type: 'success',
+                message: '删除成功'
+              })
+              this.$refs.pageRef.refreshList()
+            })
+          }
+        },
+        details: {
+          click: ({ row, index, column }) => {
+            this.openDetailForm(row, 2)
+          }
+        },
+        examine: {
+          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()) {
+          goodsPlanAdd({
+            ...this.formData,
+            items: this.formData.items.map((item, index) => ({ ...item, index: index + 1 })),
+            fileUrl: this.formData.fileUrl.map(item => item.url).join(','),
+            codeInfoList: undefined
+          }).then(res => {
+            this.$message({
+              type: 'success',
+              message: '保存成功'
+            })
+            this.handleClose()
+            this.$refs.pageRef.refreshList()
+          })
+        }
+      })
+    },
+    // 提交
+    submit() {
+      goodsPlanSubmit({
+        id: this.formData.id
+      }).then(res => {
+        this.$message({
+          type: 'success',
+          message: '提交成功'
+        })
+        this.handleClose()
+        this.$refs.pageRef.refreshList()
+      })
+    },
+    // 审核
+    examine(type) {
+      goodsPlanConfirm({
+        id: this.formData.id,
+        statusEnum: type
+      }).then(res => {
+        this.$message({
+          type: 'success',
+          message: '操作成功'
+        })
+        this.handleClose()
+        this.$refs.pageRef.refreshList()
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.tab {
+  padding: 20px 20px 0 20px;
+}
+
+::v-deep .teshudeshangchuananniu {
+  color: #409eff !important;
+}
+</style>

+ 27 - 15
src/views/salesPurchasing/commercialMaterial/index.vue

@@ -1,21 +1,33 @@
 <template>
   <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title + '-列表', essential: true }]">
     <template slot-scope="{ activeKey, data }">
-      <div :style="{
-        width: '100%',
-        height: activeKey == 'list' ? '100%' : '0px',
-        overflow: 'hidden'
-      }">
-        <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
-          :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
-          :exportList="exportList" :operation="operation()">
+      <div
+        :style="{
+          width: '100%',
+          height: activeKey == 'list' ? '100%' : '0px',
+          overflow: 'hidden'
+        }"
+      >
+        <template-page
+          ref="pageRef"
+          :get-list="getList"
+          :table-attributes="tableAttributes"
+          :table-events="tableEvents"
+          :options-evens-group="optionsEvensGroup"
+          :moreParameters="moreParameters"
+          :column-parsing="columnParsing"
+          :exportList="exportList"
+          :operation="operation()"
+        >
         </template-page>
       </div>
       <div v-if="~['add', 'edit'].indexOf(activeKey)" style="box-sizing: border-box; padding: 16px">
         <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">
-            <div slot="internal-bottom"
-              style="text-align: right; margin-bottom: 20px; box-sizing: border-box; padding-right: 10px">
+            <div
+              slot="internal-bottom"
+              style="text-align: right; margin-bottom: 20px; box-sizing: border-box; padding-right: 10px"
+            >
               <el-button size="mini" @click="data.removeTab()">取消</el-button>
               <el-button size="mini" type="primary" @click="queding(data.removeTab)">确定</el-button>
             </div>
@@ -70,7 +82,7 @@ export default {
         unit: '',
         isVirtyual: '',
         remark: '',
-        factoryNo: "",
+        factoryNo: '',
         items: []
       },
       isEditIndex: -1,
@@ -640,15 +652,15 @@ export default {
         },
         qiyjiny: {
           name: ({ row, index, column }) => {
-            return row.state == "ON" ? "禁用" : "启用"
+            return row.state == 'ON' ? '禁用' : '启用'
           },
           prompt: ({ row, index, column }) => {
-            return `是否${row.state == "ON" ? "禁用" : "启用"}?`
+            return `是否${row.state == 'ON' ? '禁用' : '启用'}?`
           },
           click: ({ row, index, column }) => {
             goodsMaterialBatchUpdateStatus({
               ids: row.id,
-              stateEnum: row.state == "ON" ? "OFF" : "ON"
+              stateEnum: row.state == 'ON' ? 'OFF' : 'ON'
             }).then(res => {
               this.$message({
                 type: 'success',
@@ -657,7 +669,7 @@ export default {
               this.$refs.pageRef.refreshList()
             })
           }
-        },
+        }
       })
     },
     openForm() {