zuozhengqing
2024-03-20 f4ed5ae8873f65c36b5cf37be264f6ec1e154647
合并分支冲突解决
8个文件已修改
1509 ■■■■ 已修改文件
src/api/data.js 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/purchaseManage/purchase.js 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/makepager/CommonFormTableView.vue 522 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/makepager/TableCommonView.vue 308 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/other/commonDialog/SelectCommonDialog.vue 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/purchaseManage/purchase/components/AddPurchase.vue 145 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/purchaseManage/purchase/index.vue 276 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/supplierManage/supplier/AddNewProduct.vue 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/data.js
@@ -1,48 +1,58 @@
// 采购状态
const purchaseStatus=[
  {id:1,name:"待确认"},
  {id:2,name:"待入库"},
  {id:3,name:"已入库"},
  {id:4,name:"已完成"},
  {id:5,name:"已取消"}
const purchaseStatus = [
  { id: 1, name: "待确认" },
  { id: 2, name: "待入库" },
  { id: 3, name: "已入库" },
  { id: 4, name: "已完成" },
  { id: 5, name: "已取消" }
]
// 收货状态
const receiveStatus = [
  { id: 1, name: "待确认" },
  { id: 2, name: "待入库" },
  { id: 3, name: "就绪" },
  { id: 4, name: "已完成" },
  { id: 5, name: "已取消" }
]
// 质检单状态
const qualityStatus=[
const qualityStatus = [
  {
    name:'待质检',
    id:1,
    name: "待质检",
    id: 1
  },
  {
    name:'已完成',
    id:2,
    name: "已完成",
    id: 2
  }
]
// 退货单状态
const returnedStatus=[
const returnedStatus = [
  {
    name:'待发货',
    id:1,
    name: "待发货",
    id: 1
  },
  {
    name:'待签收',
    id:2,
    name: "待签收",
    id: 2
  },
  {
    name:'待发货',
    id:3,
    name: "待发货",
    id: 3
  },
  {
    name:'已完成',
    id:4,
  },
    name: "已完成",
    id: 4
  }
]
export const getDataByType = type => {
  if(type =='purchaseStatus'){
    return purchaseStatus;
  }else if(type=='qualityStatus'){
    return qualityStatus;
  }else if(type=='returnedStatus'){
    return returnedStatus;
export const getDataByType = (type) => {
  if (type == "purchaseStatus") {
    return purchaseStatus
  } else if (type == "qualityStatus") {
    return qualityStatus
  } else if (type == "returnedStatus") {
    return returnedStatus
  } else if (type == "receiveStatus") {
    return receiveStatus
  }
}
src/api/purchaseManage/purchase.js
@@ -49,7 +49,7 @@
    method: "get"
  })
}
// 采购单列表
// 采购单列表
// export const getPurchaseList = async (data) => {
//     return await axios.get(`/api/purchase/purchaseList`, {
//       params: data
@@ -72,36 +72,36 @@
}
// 更新采购单
export function updatePurchase(data) {
    return request({
      url: "/api/purchase/purchase",
      method: "put",
      data
    })
  }
  return request({
    url: "/api/purchase/purchase",
    method: "put",
    data
  })
}
//   获取采购单信息
export function getPurchaseInfo(data) {
    return request({
      url: "/api/purchase/purchase/"+data.id,
      method: "get",
      data
    })
  }
  //  删除采购单信息
  return request({
    url: "/api/purchase/purchase/" + data.id,
    method: "get",
    data
  })
}
//  删除采购单信息
export function deletePurchase(data) {
    return request({
      url: "/api/purchase/purchase/"+data.id,
      method: "delete",
      data
    })
  }
  return request({
    url: "/api/purchase/purchase/" + data.id,
    method: "delete",
    data
  })
}
//   提交采购单
export function submitPurchase(data) {
    return request({
      url: "/api/purchase/submit",
      method: "post",
      data
    })
  }
  return request({
    url: "/api/purchase/submit",
    method: "post",
    data
  })
}
// 新建采购类型
export function savePurchaseType(data) {
  return request({
@@ -123,4 +123,19 @@
  return await axios.get(`/api/purchase/qualityInspectList`, {
    params: data
  })
}
}
//   获取仓库列表
export function getWarehouseInfo() {
  return request({
    url: "/api/purchase/getWarehouseInfo/",
    method: "get"
  })
}
//   获取产品/收货信息
export function getOperationInfo(data) {
  return request({
    url: "/api/purchase/getOperationInfo/" + data.id,
    method: "get",
    data
  })
}
src/components/makepager/CommonFormTableView.vue
@@ -1,18 +1,28 @@
<template>
  <div class="page-view">
    <el-form ref="form" :model="tableList" :show-message="false" label-position="right">
      <el-table
      :data="tableList.tableData"
      style="width: 100%"
      :show-summary="showSummary.show"
      :summary-method="getSummaries"
      :span-method="arraySpanMethod"
      @row-click="rowClick"
      <el-table
        ref="fromTable"
        :data="tableList.tableData"
        :show-summary="showSummary.show"
        :summary-method="getSummaries"
        :span-method="arraySpanMethod"
        style="width: 100%"
        @selection-change="handleSelectionChange"
        :row-key="(row) => row.productId"
      >
        <el-table-column type="index" v-if="tableList.tableColumn && tableList.tableColumn.length > 0" label="编号"
          width="50" align="center"></el-table-column>
        <el-table-column v-for="(item, i) in tableList.tableColumn" :key="i" :prop="item.prop" :label="item.label"
          :width="item.width" :min-width="item.min" align="center">
        <el-table-column v-if="selectBox" type="selection" :reserve-selection="true" width="40" align="center">
        </el-table-column>
        <el-table-column v-if="tableList.isReturn" type="index" label="#" width="50" align="center"></el-table-column>
        <el-table-column
          v-for="(item, i) in tableList.tableColumn"
          :key="i"
          :prop="item.prop"
          :label="item.label"
          :width="item.width"
          :min-width="item.min"
          align="center"
        >
          <!-- 表头样式 -->
          <template slot="header">
            <span v-if="item.isRequird" style="color: #f56c6c">*</span>
@@ -20,81 +30,187 @@
          </template>
          <!-- column样式 -->
          <template slot-scope="scope">
            <!-- <template v-if="!detailEnter"> -->
            <el-form-item v-if="item.input" label=" " :prop="'tableData.' + scope.$index + '.' + item.prop"
              :rules="[{ required: item.isRequird ? true : false, message: '输入不能为空' }]">
              <el-input :disabled="item.disabled" v-model.trim="scope.row[item.prop]" maxlength="50" size="mini" @change="(val) => {
                commonInputChange(val, item.prop, scope.row)
              }
                "></el-input>
            </el-form-item>
            <el-form-item v-else-if="item.productName" label=" " :prop="'tableData.' + scope.$index + '.' + item.prop">
              <div class="custom-name">
                <el-autocomplete :disabled="item.disabled" v-model="scope.row[item.prop]"
                  :fetch-suggestions="querySearchAsync" value-key="name" style="width: calc(100% - 70px)" size="mini"
                  @select="(val) => {
                    handleSelectClient(val, item.prop, scope.row)
                  }
                    "></el-autocomplete>
                <div v-if="!item.disabled" class="common-select-btn" @click="selClientClick(scope.row, item.prop, scope)">
                  <i class="el-icon-circle-plus-outline" title="选择"></i>
            <template v-if="!detailEnter || isOperate">
              <el-form-item
                v-if="item.input"
                label=" "
                :prop="'tableData.' + scope.$index + '.' + item.prop"
                :rules="[{ required: item.isRequird ? true : false, message: '输入不能为空' }]"
              >
                <el-input
                  v-model.trim="scope.row[item.prop]"
                  maxlength="50"
                  size="mini"
                  :disabled="!isOperate"
                  @change="
                    (val) => {
                      commonInputChange(val, item.prop, scope.row, scope)
                    }
                  "
                ></el-input>
              </el-form-item>
              <el-form-item
                v-else-if="item.productName"
                label=" "
                :prop="'tableData.' + scope.$index + '.' + item.prop"
              >
                <div class="custom-name">
                  <el-autocomplete
                    v-model="scope.row[item.prop]"
                    :fetch-suggestions="querySearchAsync"
                    value-key="name"
                    :disabled="!isOperate"
                    size="mini"
                    @select="
                      (val) => {
                        handleSelectClient(val, item.prop, scope.row)
                      }
                    "
                  ></el-autocomplete>
                  <div
                    v-if="scope.row[item.prop] && scope.row[item.prop].length > 0 && isOperate"
                    class="common-select-btn"
                    @click="handleEditClient(scope, item.prop)"
                  >
                    <i class="el-icon-edit" title="编辑"></i>
                  </div>
                  <div
                    v-if="scope.row[item.prop] && scope.row[item.prop].length > 0 && isOperate"
                    class="common-select-btn"
                    @click="clearupClient(scope)"
                  >
                    <i class="el-icon-remove-outline" title="清除"></i>
                  </div>
                  <div class="common-select-btn" v-else @click="selClientClick(scope, item.prop)">
                    <i class="el-icon-circle-plus-outline" title="选择"></i>
                  </div>
                </div>
                <div v-if="!item.disabled" class="common-select-btn" @click="clearupClient(scope.row, scope)">
                  <i class="el-icon-remove-outline" title="清除"></i>
                </div>
                <div class="common-select-btn" v-if="scope.$index != 0 || !item.disabled"
                  @click="deleteClient(scope.row, scope)">
                  <i class="el-icon-delete" title="删除"></i>
                </div>
              </div>
            </el-form-item>
            <el-form-item v-else-if="item.date" label=" " :prop="'tableData.' + scope.$index + '.' + item.prop"
              :rules="[{ required: item.isRequird ? true : false, message: '输入不能为空' }]">
              <!-- <el-input v-model.trim="scope.row[item.prop]" maxlength="50" size="mini"></el-input> -->
              <el-date-picker v-model="scope.row[item.prop]" type="date" size="mini" style="width: 110px">
              </el-date-picker>
            </el-form-item>
            <el-form-item v-else-if="item.inputNumber" label=" " :prop="'tableData.' + scope.$index + '.' + item.prop"
              :rules="[{ required: item.isRequird ? true : false, message: '输入不能为空' }]">
              <el-input-number :disabled="item.disabled" v-model="scope.row[item.prop]" placeholder="" :min="0"
                :controls="false" size="mini" style="width: 100%; margin-right: 5px" @change="(val) => {
                  commonInputChange(val, item.prop, scope.row)
                }
                  "></el-input-number>
            </el-form-item>
            <el-form-item v-else-if="item.inputFloat" label=" " :prop="'tableData.' + scope.$index + '.' + item.prop"
              :rules="[{ required: item.isRequird ? true : false, message: '输入不能为空' }]">
              <!-- 采购管理 -->
              <template v-if="item.multiply">
                <el-input-number :disabled="item.disabled"
                  :value="scope.row[showSummary.multiply[0]] * scope.row[showSummary.multiply[1]]" placeholder="" :min="0"
                  :precision="2" :controls="false" size="mini" style="width: 100%; margin-right: 5px" @input="(val) => {
                    commonInputChange(val, item.prop, scope.row)
              </el-form-item>
              <el-form-item
                v-else-if="item.date"
                label=" "
                :prop="'tableData.' + scope.$index + '.' + item.prop"
                :rules="[{ required: item.isRequird ? true : false, message: '输入不能为空' }]"
              >
                <!-- <el-input v-model.trim="scope.row[item.prop]" maxlength="50" size="mini"></el-input> -->
                <el-date-picker
                  :disabled="!isOperate"
                  v-model="scope.row[item.prop]"
                  type="date"
                  size="mini"
                  style="width: 110px"
                >
                </el-date-picker>
              </el-form-item>
              <el-form-item
                v-else-if="item.inputNumber"
                label=" "
                :prop="'tableData.' + scope.$index + '.' + item.prop"
                :rules="[{ required: item.isRequird ? true : false, message: '输入不能为空' }]"
              >
                <el-input-number
                  v-model="scope.row[item.prop]"
                  placeholder=""
                  :min="0"
                  :controls="false"
                  :disabled="!isOperate"
                  size="mini"
                  style="width: 100%; margin-right: 5px"
                  @change="
                    (val) => {
                      commonInputChange(val, item.prop, scope.row, scope)
                    }
                  "
                ></el-input-number>
              </el-form-item>
              <el-form-item
                v-else-if="item.inputFloat"
                label=" "
                :prop="'tableData.' + scope.$index + '.' + item.prop"
                :rules="[{ required: item.isRequird ? true : false, message: '输入不能为空' }]"
              >
                <el-input-number
                  v-model="scope.row[item.prop]"
                  placeholder=""
                  :min="0"
                  :precision="2"
                  :disabled="!isOperate"
                  :controls="false"
                  size="mini"
                  style="width: 100%; margin-right: 5px"
                  @change="
                    (val) => {
                      commonInputChange(val, item.prop, scope.row, scope)
                    }
                  "
                ></el-input-number>
              </el-form-item>
              <span v-else>
                <template>
                  {{ scope.row[item.prop] }}
                </template>
              </span>
            </template>
            <el-form-item
              v-else-if="item.inputNumber && selectBox"
              label=" "
              :prop="'tableData.' + scope.$index + '.' + item.prop"
              :rules="[{ required: item.isRequird ? true : false, message: '输入不能为空' }]"
            >
              <el-input-number
                v-model="scope.row[item.prop]"
                placeholder=""
                :min="0"
                :controls="false"
                :disabled="!isOperate"
                size="mini"
                style="width: 100%; margin-right: 5px"
                @change="
                  (val) => {
                    commonInputChange(val, item.prop, scope.row, scope)
                  }
                    "></el-input-number>
              </template>
              <template v-else>
                <el-input-number :disabled="item.disabled" v-model="scope.row[item.prop]" placeholder="" :min="0"
                  :precision="2" :controls="false" size="mini" style="width: 100%; margin-right: 5px" @change="(val) => {
                    commonInputChange(val, item.prop, scope.row)
                  }
                    "></el-input-number>
              </template>
                "
              ></el-input-number>
            </el-form-item>
            <span v-else>{{ scope.row[item.prop] }}</span>
            <!-- </template> -->
            <!-- <span v-else>{{ scope.row[item.prop] }}</span> -->
            <span v-else style="text-align: right">{{ scope.row[item.prop] }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="40" v-if="!detailEnter" align="center">
          <template slot-scope="scope">
            <el-button type="text" size="small" :disabled="!isOperate" @click="deleteClick(scope)">删除</el-button>
          </template>
        </el-table-column>
        <slot name="tableButton" />
      </el-table>
    </el-form>
    <div v-if="!detailEnter" style="margin: 10px">
      <el-button :disabled="tableList.disabled" size="small" type="primary" @click="add">新增</el-button>
      <el-button :disabled="tableList.disabled" size="small" type="primary" @click="empty">清空</el-button>
      <el-button size="small" type="primary" :disabled="!isOperate" @click="add">新增</el-button>
      <!-- <el-button size="small" type="primary" disabled>导入明细</el-button> -->
      <el-button size="small" type="primary" :disabled="!isOperate" @click="empty">清空</el-button>
    </div>
    <!-- 产品名称 -->
    <SelectCommonDialog v-if="editSelCommonConfig.editVisible" :edit-common-config="editSelCommonConfig" :sign="sign"
      @selClient="selClient" />
    <div v-if="false && (showSummary.total || showSummary.refundable)" style="height: 42px; line-height: 42px">
      <el-row :gutter="10">
        <el-col v-if="showSummary.total" :span="3" :offset="21">
          <span style="font-weight: bold">合计</span>
          <span style="margin-left: 10px">{{ total }}</span>
        </el-col>
        <el-col v-if="showSummary.refundable" :span="3" :offset="21">
          <span style="font-weight: bold">应退款</span>
          <span style="margin-left: 10px">0.00</span>
        </el-col>
      </el-row>
    </div>
    <!-- 合同订单 -->
    <SelectCommonDialog
      v-if="editSelCommonConfig.editVisible"
      :edit-common-config="editSelCommonConfig"
      :sign="sign"
      :selectBoxList="tableList.tableData"
      :quotationNumber="quotationNumber"
      @selClient="selClient"
      @getSelectArray="getSelectArray"
    />
  </div>
</template>
@@ -113,13 +229,36 @@
      type: String,
      default: ""
    },
    selectBox: {
      type: Boolean,
      default: false
    },
    // 那个页面 用来判断计算方式
    pageName: {
      type: String,
      default: ""
    },
    // 列表新增是否多选
    addTypeIdMultiple: {
      type: Boolean,
      default: false
    },
    // 根据报价单查询产品
    quotationNumber: {
      type: [String, Number],
      default: ""
    },
    // 是否可以操作 添加等
    isOperate: {
      type: Boolean,
      default: true
    },
    productTableList: {
      type: Object,
      default: () => {
        return {
          tableProductList: [],
          disabled: false,
          tableData: [], // 接口返回数据
          isReturn: false,
          tableColumn: [
            // table表单
            { label: "", prop: "", min: 200, tooltip: true }
@@ -135,15 +274,9 @@
          total: false,
          refundable: false,
          sumProp: [],
          multiply: [],
          titleProp: ["#", "产品名称"],
          mergeNumber: 1
        }
      }
    },
    recalculateShow: {
      type: [Boolean],
      defalut: true
    }
  },
  data() {
@@ -153,27 +286,31 @@
      tableList: [],
      editSelCommonConfig: {
        editVisible: false,
        isSelectBox: false,
        title: "",
        infomation: {}
      },
      productIndex: 0,
      tableProductLists: [],
      productIndex: 0
    }
  },
  created() {
    this.getProductList()
    this.tableList = this.productTableList
    if (!this.selectBox) {
      this.getProductList()
    }
    this.getTableInfo()
  },
  watch: {
    productTableList: {
      handler() {
        this.getTableInfo()
      },
      immediate: true
    }
  },
  computed: {},
  watch: {
    productTableList() {
      this.tableList = this.productTableList
    },
  },
  methods: {
    // 选择行
    rowClick(row){
      this.$emit("rowClick",row)
    getTableInfo() {
      this.tableList = this.productTableList
    },
    // 产品名称
    async getProductList() {
@@ -193,6 +330,7 @@
    handleReserve(row) {
      return row._id ? row._id : row.id
    },
    // 多选
    handleSelectionChange(val) {
      this.$emit("getSelectArray", val)
    },
@@ -222,9 +360,13 @@
          sums[index] = "小计:"
          return
        }
        const title = this.showSummary.titleProp
        const title = ["#", "产品名称", "产品编号", "单位", "销售单价", "成本单价"]
        // 去除某些不需要计算的数据
        if (title.includes(column.label)) {
          sums[index] = ""
          return
        }
        if (this.pageName == "quotation" && column.label == "毛利") {
          sums[index] = ""
          return
        }
@@ -251,7 +393,6 @@
      })
      return sums
    },
    // 数字换行为金额显示格式
    number_format(number, decimals, dec_point, thousands_sep) {
      decimals = 2 //这里默认设置保留两位小数,也可以注释这句采用传入的参数
@@ -282,18 +423,61 @@
    },
    // 新增
    add() {
      this.$emit("addProductClick")
      if (this.addTypeIdMultiple) {
        this.productIndex = this.tableList.tableData.length
        this.editSelCommonConfig.title = "产品名称"
        this.editSelCommonConfig.isSelectBox = true
        this.editSelCommonConfig.editVisible = true
      } else {
        this.$emit("addProductClick")
      }
    },
    commonInputChange(val, prop, row) {
      this.$emit("inputContent", val, prop, row)
    commonInputChange(val, prop, row, scope) {
      if (prop === "amount") {
        this.tableList.tableData.map((ite) => {
          if (ite.name === row.name) {
            ite.total = row.amount * row.purchasePrice
          }
        })
      }
      if (this.pageName == "quotation" && prop == "cost" && scope.row.cost) {
        let value = scope.row.cost
        let reg2 = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
        if (!reg2.test(value) || value == 0) {
          this.$message.error("成本单价需要填写大于0的2位小数!")
          return true
        }
        this.$forceUpdate()
      }
      if (this.pageName == "quotation") {
        if (prop == "purchasePrice" || prop == "cost") {
          if (scope.row.purchasePrice && scope.row.cost) {
            let profit = Number(scope.row.purchasePrice) - Number(scope.row.cost)
            scope.row.profit = profit + ""
            let margin = (
              ((Number(scope.row.purchasePrice) - Number(scope.row.cost)) * 100) /
              Number(scope.row.cost)
            ).toFixed(2)
            scope.row.margin = margin + ""
          }
        }
      }
      this.$emit("inputContent", val, prop, row, scope)
    },
    // 清空
    empty() {
      this.$emit("emptyProductClick")
    },
    // 删除
    deleteClick(scope) {
      this.tableList.tableData.splice(scope.$index, 1)
      this.$forceUpdate()
      this.$message.success("删除成功!")
      this.$emit("deleteClick", scope)
    },
    // 选择产品名称相关方法
    querySearchAsync(queryString, cb) {
      var restaurants = this.tableProductLists
      var restaurants = this.productList
      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
      cb(results)
    },
@@ -303,98 +487,82 @@
      }
    },
    handleSelectClient(item, prop, row) {
      // this.clientId = item.id
      console.log(item, prop, row)
      this.tableList.tableData.map((ite) => {
        if (ite.name === item.name) {
          ite.id = row.id
          ite.amount = item.amount || 1
          ite.number = item.number
          ite.purchasePrice = item.purchasePrice
          ite.price = item.purchasePrice
          ite.total = item.amount ? item.amount * item.purchasePrice : 1 * item.purchasePrice
          ite.unit = item.unit
          ite.deliveryTime = item.deliveryTime
          ite.shippingDuration = item.shippingDuration
          ite.modelNumber = item.modelNumber
        }
      })
      if (this.detailEnter) {
        this.setEditName(item, row.id)
      }
      this.$emit("handleProduct",item,row)
    },
    setEditName(item, id) {
      let selRow = {
        id: id,
        deliveryTime: item.deliveryTime,
        maximumStock: item.maximumStock,
        minimumStock: item.minimumStock,
        modelNumber: item.modelNumber,
        name: item.name,
        number: item.number,
        productType: item.productType,
        purchasePrice: item.purchasePrice,
        remark: item.remark,
        shippingDuration: item.shippingDuration,
        specifications: item.specifications,
        supplierId: item.supplierId,
        unit: item.unit
      }
      this.$emit("selCommonName", selRow)
    },
    selClientClick(row, prop, scope) {
      console.log(row, prop)
    // 新增
    selClientClick(scope, prop) {
      console.log(scope, prop)
      this.productIndex = scope.$index
      this.editSelCommonConfig.title = "产品名称"
      this.editSelCommonConfig.isSelectBox = true
      this.editSelCommonConfig.editVisible = true
    },
    // 编辑
    handleEditClient(scope, prop) {
      console.log(scope, prop)
      this.productIndex = scope.$index
      this.editSelCommonConfig.title = "产品名称"
      this.editSelCommonConfig.isSelectBox = false
      this.editSelCommonConfig.editVisible = true
    },
    selClient(item) {
      console.log(item)
      console.log(this.tableList.tableData)
      if (this.detailEnter) {
        this.tableList.tableData.map((ite) => {
          ite.id
          ite.name = item.name
          ite.amount = item.amount || 1
          ite.number = item.number
          ite.purchasePrice = item.purchasePrice
          ite.unit = item.unit
          ite.deliveryTime = item.deliveryTime
          ite.shippingDuration = item.shippingDuration
        })
        this.setEditName(item, this.tableList.tableData[0].id)
      } else {
      let list = this.tableList.tableData.map((item) => item.number)
      if (list.findIndex((v) => v == item.number) == -1) {
        // this.editConfig.infomation.client_name = row.name
        this.tableList.tableData.map((ite, index) => {
          if (index === this.productIndex) {
            ite.name = item.name
            ite.productId = item.id
            ite.productIndex = this.productIndex+1
            ite.amount = item.amount || 1
            ite.number = item.number
            ite.purchasePrice = item.purchasePrice
            ite.price = item.purchasePrice
            ite.total = item.amount ? item.amount * item.purchasePrice : 1 * item.purchasePrice
            ite.unit = item.unit
            ite.deliveryTime = item.deliveryTime
            ite.shippingDuration = item.shippingDuration
            this.$set(this.tableList.tableData, index, ite)
            this.$forceUpdate()
            // this.$set(this.tableList.tableData, index, ite)
            // this.$forceUpdate()
          }
        })
        console.log(this.tableList.tableData, "=====chanp")
      } else {
        this.$message.error("不能选择重复的产品, 请重新选择")
      }
    },
    getSelectArray(val) {
      let list = val.map((item) => {
        let productId = item.id
        this.$delete(item, "id")
        return {
          ...item,
          productId: productId,
          amount: 1,
          price: item.purchasePrice,
          total: 1 * item.purchasePrice
        }
      })
      this.$emit("getSelectArray", list, this.productIndex)
    },
    // 清除已选择用户
    clearupClient(row, scope) {
    clearupClient(scope) {
      this.productIndex = scope.$index
      this.tableList.tableData.map((ite, index) => {
        console.log(scope.$index)
        if (scope.$index && scope.$index >= 0) {
          if (index === this.productIndex) {
            ite.name = ""
            ite.amount = 1
            ite.number = ""
            ite.purchasePrice = 0
            ite.unit = ""
            ite.deliveryTime = 0
            ite.shippingDuration = 0
          }
        } else {
        if (index === this.productIndex) {
          ite.productId = ""
          ite.name = ""
          ite.amount = 1
          ite.number = ""
@@ -405,14 +573,18 @@
        }
      })
      this.$emit("clearupProduct", this.tableList.tableData)
    },
    deleteClient(row, scope) {
      if (this.tableList.tableData.length == 1) {
        this.$message.error("至少保留一条,不能刪除了!")
        return true
      }
      this.tableList.tableData.splice(scope.$index, 1)
    }
    // 多选设置已选中
    // toggleSelection(rows) {
    //   console.log("88888888888888888888888888888888888888888")
    //   console.log(rows)
    //   if (rows) {
    //     rows.forEach((row) => {
    //       this.$refs.fromTable.toggleRowSelection(row, true)
    //       console.log(row)
    //     })
    //   }
    // }
  }
}
</script>
@@ -420,14 +592,10 @@
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.page-view {
  min-width: 100px;
  .el-form-item {
    margin-bottom: 0;
    .custom-name {
      display: flex;
      .common-select-btn {
        margin-left: 5px;
        font-size: 18px;
@@ -436,29 +604,25 @@
    }
  }
}
::v-deep {
  .el-form-item__label {
    display: none;
  }
  .el-table__footer-wrapper tbody td.el-table__cell {
    background-color: #fff;
    // text-align: right;
    font-weight: bold;
  }
  .el-input--suffix .el-input__inner {
    padding-right: 0px;
  }
  .el-table .cell,
  .el-table th.el-table__cell>.cell {
  .el-table th.el-table__cell > .cell {
    padding: 0 5px;
  }
  .el-input__inner {
    text-align: left;
    // text-align: left;
    text-align: center !important;
  }
}
</style>
src/components/makepager/TableCommonView.vue
@@ -1,109 +1,140 @@
<!-- eslint-disable vue/no-use-v-if-with-v-for -->
<template>
  <div class="table-view">
  <div class="table-view" v-loading="loading">
    <el-table
      ref="table"
      border
      :data="tableList.tableInfomation"
      tooltip-effect="dark"
      style="width: 100%"
      :height="'calc(100% - 0px)'"
      :max-height="tableList.maxHeight"
      style="width: 100%"
      :lazy="tableList.lazy"
      size="mini"
      :show-summary="showSummary.show"
      :summary-method="getSummaries"
      :span-method="arraySpanMethod"
      @selection-change="handleSelectionChange"
      :header-cell-style="{ background: '#f1f3f8', color: '#000009', 'font-size': '14px' }"
      :highlight-current-row="tableList.highlight"
      :row-class-name="tableRowClassName"
      :header-cell-style="{ background: '#f1f3f8', color: '#000009', 'font-size': '12px', 'font-family': 'PingFangSC' }"
      size="mini"
      @row-click="tableRowClick"
      :row-key="tableList.key"
      :default-expand-all="tableList.isDefaultExpandAll"
      :tree-props="{ children: 'child', hasChildren: 'hasChildren' }"
      :row-class-name="tableRowClassName"
    >
      <el-table-column align="center" v-if="tableList.selectBox" type="selection" width="40"> </el-table-column>
      <el-table-column align="center" v-if="tableList.selectIndex" type="index" label="序号" width="50">
      </el-table-column>
      <template v-for="(item, i) in tableList.tableColumn">
        <el-table-column
          align="center"
          :key="i"
          :prop="item.prop"
          :label="item.label"
          :width="item.width"
          :min-width="item.min"
          show-overflow-tooltip
          :sortable="item.sortable"
          v-if="item.isShowColumn"
        >
          <template slot-scope="scope">
            <span v-if="item.price">{{ "¥" + number_format(scope.row[item.prop], 2, ".", ",") }}</span>
            <div v-else-if="item.status" :class="scope.row.status">{{ scope.row[item.prop] }}</div>
            <span v-else-if="item.isTime">{{
              dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop]) === "1900-01-01 00:06:26"
                ? "--"
                : dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop])
      <el-table-column v-if="selectBox" type="selection" width="40" :selectable="selectable"> </el-table-column>
      <el-table-column v-if="tableList.selectIndex" type="index" label="序号" width="50"></el-table-column>
      <el-table-column
        v-for="(item, i) in tableList.tableColumn"
        :key="i"
        :prop="item.prop"
        :label="item.label"
        :width="item.width"
        :min-width="item.min"
        show-overflow-tooltip
        :sortable="item.sortable"
        v-if="item.isShowColumn"
      >
        <template slot-scope="scope">
          <span v-if="item.price">{{ "¥" + number_format(scope.row[item.prop], 2, ".", ",") }}</span>
          <div v-else-if="item.status" :class="scope.row.status">{{ scope.row[item.prop] }}</div>
          <span v-else-if="item.isTime">{{
            dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop]) === "1900-01-01 00:06:26"
              ? "--"
              : dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop])
          }}</span>
          <span v-else-if="item.isClick && scope.row[item.prop]" class="sel-name" @click="selNameClick(scope.row)">{{
            scope.row[item.prop]
          }}</span>
          <span v-else-if="item.isFirst">{{ scope.row[item.prop] ? "是" : "否" }}</span>
          <span
            v-else-if="item.isSalesLeadClick && scope.row[item.prop]"
            class="sel-name"
            @click="selSalesLeadClick(scope.row)"
            >{{ scope.row[item.prop] }}</span
          >
          <span
            v-else-if="item.isClientClick && scope.row[item.prop]"
            class="sel-name"
            @click="selClientClick(scope.row)"
            >{{ scope.row[item.prop] ? scope.row[item.prop] : "--" }}</span
          >
          <span
            v-else-if="item.isContactClick && scope.row[item.prop]"
            class="sel-name"
            @click="selContactsClick(scope.row)"
            >{{ scope.row[item.prop] }}</span
          >
          <span
            v-else-if="item.isMasterClick && scope.row[item.prop]"
            class="sel-name"
            @click="selMasterClick(scope.row)"
            >{{ scope.row[item.prop] }}</span
          >
          <span
            v-else-if="item.isServiceOrder && scope.row[item.prop]"
            class="sel-name"
            @click="selServiceOrderClick(scope.row)"
            >{{ scope.row[item.prop] }}</span
          >
          <span
            v-else-if="item.isCommonClick && scope.row[item.prop]"
            class="sel-name"
            @click="selCommonClick(scope.row)"
            >{{ scope.row[item.prop] }}</span
          >
          <div v-else-if="item.isProductName" class="product-view">
            <ul v-if="scope.row.products && scope.row.products.length > 0">
              <li v-for="(item, index) in scope.row.products" :key="index">
                <div class="name-view">
                  {{ item.name }}
                </div>
              </li>
            </ul>
            <div v-else class="no-product">{{ "--" }}</div>
          </div>
          <div v-else-if="item.isProductAmount" class="product-view">
            <ul v-if="scope.row.products && scope.row.products.length > 0">
              <li v-for="(item, index) in scope.row.products" :key="index">
                <div class="name-view">
                  {{ item.amount }}
                </div>
              </li>
            </ul>
            <div v-else class="no-product">{{ "--" }}</div>
          </div>
          <div v-else-if="item.isProductPrice" class="product-view">
            <ul v-if="scope.row.products && scope.row.products.length > 0">
              <li v-for="(item, index) in scope.row.products" :key="index">
                <div class="name-view">
                  {{ item.price }}
                </div>
              </li>
            </ul>
            <div v-else class="no-product">{{ "--" }}</div>
          </div>
          <div v-else-if="item.isProductTotal" class="product-view">
            <ul v-if="scope.row.products && scope.row.products.length > 0">
              <li v-for="(item, index) in scope.row.products" :key="index">
                <div class="name-view">
                  {{ item.total }}
                </div>
              </li>
            </ul>
            <div v-else class="no-product">{{ "--" }}</div>
          </div>
          <!-- 调用方法显示文字 -->
          <div v-else-if="item.isCallMethod">
            <span :class="item.isClass ? item.getClassName(scope.row[item.prop], scope.row) : ''">{{
              item.getCallMethod(scope.row[item.prop], scope.row)
            }}</span>
            <span
              v-else-if="item.isClick && scope.row[item.prop]"
              class="sel-name"
              @click="selCommonClick(scope.row)"
              >{{ scope.row[item.prop] }}</span
            >
            <span v-else-if="item.isFirst">{{ scope.row[item.prop] ? "是" : "否" }}</span>
            <span
              v-else-if="item.isCommonClick && scope.row[item.prop]"
              class="sel-name"
              @click="selCommonClick(scope.row)"
              >{{ scope.row[item.prop] }}</span
            >
            <div v-else-if="item.isProductName" class="product-view">
              <ul v-if="scope.row.products && scope.row.products.length > 0">
                <li v-for="(item, index) in scope.row.products" :key="index">
                  <div :class="scope.row.products.length === 1 ? 'name-view no-bottom' : 'name-view'">
                    {{ item.name }}
                  </div>
                </li>
              </ul>
              <div v-else class="no-product">{{ "--" }}</div>
            </div>
            <div v-else-if="item.isProductAmount" class="product-view">
              <ul v-if="scope.row.products && scope.row.products.length > 0">
                <li v-for="(item, index) in scope.row.products" :key="index">
                  <div :class="scope.row.products.length === 1 ? 'name-view no-bottom' : 'name-view'">
                    {{ item.amount }}
                  </div>
                </li>
              </ul>
              <div v-else class="no-product">{{ "--" }}</div>
            </div>
            <div v-else-if="item.isProductPrice" class="product-view">
              <ul v-if="scope.row.products && scope.row.products.length > 0">
                <li v-for="(item, index) in scope.row.products" :key="index">
                  <div :class="scope.row.products.length === 1 ? 'name-view no-bottom' : 'name-view'">
                    {{ item.price }}
                  </div>
                </li>
              </ul>
              <div v-else class="no-product">{{ "--" }}</div>
            </div>
            <div v-else-if="item.isProductTotal" class="product-view">
              <ul v-if="scope.row.products && scope.row.products.length > 0">
                <li v-for="(item, index) in scope.row.products" :key="index">
                  <div :class="scope.row.products.length === 1 ? 'name-view no-bottom' : 'name-view'">
                    {{ item.total }}
                  </div>
                </li>
              </ul>
              <div v-else class="no-product">{{ "--" }}</div>
            </div>
            <span v-else>{{ scope.row[item.prop] ? scope.row[item.prop] : "--" }}</span>
          </template>
        </el-table-column>
      </template>
          </div>
          <span v-else>{{ scope.row[item.prop] ? scope.row[item.prop] : "--" }}</span>
        </template>
      </el-table-column>
      <slot name="tableButton" />
      <div slot="empty">
        <el-empty description="暂无数据"></el-empty>
      </div>
    </el-table>
    <div class="overSpread1" v-show="iscolopen" @click="onMaskClick"></div>
    <div class="styleBtn">
      <i @click="checkCol()" class="label">...</i>
@@ -118,16 +149,18 @@
export default {
  name: "TableCommonView",
  props: {
    selectBox: {
      type: Boolean,
      default: false
    },
    tableList: {
      type: Object,
      default: () => {
        return {
          selectBox: false,
          selectIndex: false,
          selectIndex: true,
          tableInfomation: [], // 接口返回数据
          showcol: [],
          allcol: [],
          highlight: false,
          tableColumn: [
            // table表单
            { label: "", prop: "", min: 200, tooltip: true }
@@ -141,8 +174,7 @@
        return {
          show: false,
          sumProp: [],
          mergeNumber: 1,
          totalName: "本页总计"
          mergeNumber: 1
        }
      }
    },
@@ -152,14 +184,24 @@
      default: () => {
        return {}
      }
    },
    loading: {
      type: Boolean,
      default: false
    },
    selectBoxList: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      iscolopen: false,
      showcol: []
    }
  },
  computed: {},
  watch: {
    "tableList.showcol": {
      handler(newVal) {
@@ -168,7 +210,6 @@
      immediate: true
    }
  },
  computed: {},
  methods: {
    onMaskClick() {
      this.iscolopen = false
@@ -195,10 +236,16 @@
              .querySelector(".el-table__footer")
            var cell = current.rows[0].cells
            for (let i = 0; i < this.showSummary.mergeNumber; i++) {
              cell[i].style.display = "none"
              cell[i] && cell[i].style && (cell[i].style.display = "none")
            }
            cell[this.showSummary.mergeNumber].classList.remove("is-left")
            cell[this.showSummary.mergeNumber].colSpan = this.showSummary.mergeNumber.toString()
            if (cell[this.showSummary.mergeNumber]) {
              if (cell[this.showSummary.mergeNumber].classList) {
                cell[this.showSummary.mergeNumber].classList.remove("is-left")
              }
              if (cell[this.showSummary.mergeNumber].colSpan) {
                cell[this.showSummary.mergeNumber].colSpan = this.showSummary.mergeNumber.toString()
              }
            }
          }
        })
      }
@@ -210,7 +257,7 @@
        const sums = []
        columns.forEach((column, index) => {
          if (index === this.showSummary.mergeNumber) {
            sums[index] = this.showSummary.totalName
            sums[index] = "本页总计"
          }
          const values = data.map((item) => Number(item[column.property]))
          if (this.showSummary.sumProp.includes(column.property)) {
@@ -309,7 +356,31 @@
      }
      return fmt
    },
    // 公共详情
    // 新建编辑选择弹窗
    selNameClick(row) {
      this.$emit("selCommonClick", row)
    },
    // 销售线索
    selSalesLeadClick(row) {
      this.$emit("selSalesLeadClick", row)
    },
    // 客户名称
    selClientClick(row) {
      this.$emit("selClientClick", row)
    },
    // 联系人姓名
    selContactsClick(row) {
      this.$emit("selContactsClick", row)
    },
    // 销售总单
    selMasterClick(row) {
      this.$emit("selMasterClick", row)
    },
    // 客户服务单
    selServiceOrderClick(row) {
      this.$emit("selServiceOrderClick", row)
    },
    // 公共(销售机会、报价单、销售总单、销售子单。。。)
    selCommonClick(row) {
      this.$emit("selCommonClick", row)
    },
@@ -325,6 +396,14 @@
        }
      }
      this.$emit("tableRowClassName", row)
    },
    selectable(row) {
      let list = this.selectBoxList.map((item) => item.number)
      if (list.findIndex((v) => v == row.number) == -1) {
        return true
      } else {
        return false
      }
    }
  }
}
@@ -333,9 +412,6 @@
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.table-view {
  // margin-top: 20px;
  // margin-right: 10px;
  // margin-bottom: 40px;
  position: relative;
  height: 100%;
  .blue {
@@ -354,19 +430,22 @@
    margin-left: -10px;
    margin-right: -11px;
    li {
      height: 57px;
      line-height: 57px;
      height: 22px;
      line-height: 22px;
      .name-view {
        padding-left: 10px;
        border-bottom: 1px solid #ebeef5;
      }
      .no-bottom {
        border-bottom: 0px;
        border-bottom: 0;
      }
    }
    li:last-child .name-view {
      border-bottom: none;
    }
    .no-product {
      height: 57px;
      line-height: 57px;
      height: 22px;
      line-height: 22px;
    }
  }
}
@@ -400,9 +479,12 @@
  .el-table .cell .el-button--text.el-button--small {
    padding: 4px 0;
  }
  .el-table .onSelect {
    background: #ebf2ff;
  }
}
::v-deep .el-table .el-table__cell {
  padding: 6px 0 !important;
  height: 35px;
  text-align: center;
}
.overSpread1 {
@@ -422,8 +504,8 @@
  // line-height: 26px;
  // background: #06c062;
  top: 0;
  right: 2px;
  z-index: 9999;
  right: -6px;
  z-index: 11;
  .label {
    position: absolute;
    top: 6px;
@@ -435,7 +517,7 @@
  }
  .checkbox-group {
    width: 160px;
    height: 330px;
    height: 300px;
    overflow: auto;
    display: flex;
    flex-direction: column;
src/views/other/commonDialog/SelectCommonDialog.vue
@@ -28,12 +28,15 @@
            <el-button type="primary" size="mini" disabled>快速创建</el-button> -->
          </div>
        </div>
        <TableCommonView
        <TableCommonView
          class="bg-list"
          ref="tableListRef"
          :table-list="tableList"
          :select-box="false"
          :select-box="editCommonConfig.isSelectBox"
          :selectBoxList="selectBoxList"
          @selCommonClick="selNameClick"
          @selTableCol="selTableCol"
          @getSelectArray="getSelectArray"
        >
        </TableCommonView>
        <div slot="footer" class="dialog-footer">
@@ -42,6 +45,10 @@
            <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
          </div>
        </div>
      </div>
      <div slot="footer" class="dialog-footer" v-if="editCommonConfig.isSelectBox">
        <el-button type="primary" size="small" @click="saveClick()">确定</el-button>
        <el-button size="small" @click="editConfig.editVisible = false">取消</el-button>
      </div>
    </el-dialog>
  </div>
@@ -60,7 +67,11 @@
      default: () => {
        return {
          editVisible: false,
          isSelectBox: false,
          title: "",
          clientId: 0,
          isRequest: true,
          client_name: "",
          tableInfomation: []
        }
      }
@@ -68,6 +79,10 @@
    sign: {
      type: String,
      default: ""
    },
    selectBoxList: {
      type: Array,
      default: () => []
    }
  },
  components: {},
@@ -87,13 +102,18 @@
      searchSel: {},
      keyword: "",
      keywordType: "",
      showProductCol: ["产品名称", "产品编号"],
      showProductCol: ["产品名称", "产品编号", "销售单价", "单位", "产品规格", "型号"],
      tableProductColumn: [
        { label: "产品名称", prop: "name", isClick: true },
        { label: "产品编号", prop: "number" }
        { label: "产品编号", prop: "number" },
        { label: "销售单价", prop: "purchasePrice" },
        { label: "单位", prop: "unit" },
        { label: "产品规格", prop: "specifications" },
        { label: "型号", prop: "modelNumber" }
      ],
      showCol: [],
      tableColumn: []
      tableColumn: [],
      selectArray: []
    }
  },
  created() {
@@ -133,17 +153,17 @@
      }
    },
    selTableCol(val) {
      this.showcol = val;
      this.tableList.tableColumn = this.setColumnVisible(val);
      this.showcol = val
      this.tableList.tableColumn = this.setColumnVisible(val)
    },
    // setColumnVisible(showCol){
    //   return  this.tableColumn.map(ele=>{
    //     return {
    //       ...ele,
    //       isShowColumn:showCol.includes(ele.label)
    //     }
    //   })
    // },
    // 列表多选
    getSelectArray(val) {
      this.selectArray = val
    },
    saveClick() {
      this.$emit("getSelectArray", this.selectArray)
      this.editConfig.editVisible = false
    },
    // 请求数据
    async getData() {
      this.loading = true
@@ -155,7 +175,7 @@
    async getProductList() {
      let fn = this.sign == "purchase" ? getProductList : getProductListFromGrpc
      await fn({
        keyword:this.keyword,
        keyword: this.keyword,
        page: this.pagerOptions.currPage,
        pageSize: this.pagerOptions.pageSize
      }).then((res) => {
@@ -186,7 +206,7 @@
    },
    // 搜索
    searchClick(content) {
      console.log( content)
      console.log(content)
      this.keyword = content
      this.getData()
    },
src/views/purchaseManage/purchase/components/AddPurchase.vue
@@ -97,11 +97,11 @@
                  </div>
                </el-form-item>
              </el-col>
              <el-col :span="12">
              <!-- <el-col :span="12">
                <el-form-item label="单据来源" prop="orderSource">
                  <el-input v-model="editConfig.infomation.orderSource" disabled placeholder="请填写"></el-input>
                </el-form-item>
              </el-col>
              </el-col> -->
              <el-col :span="12">
                <el-form-item label="采购单名称" prop="name">
                  <el-input
@@ -164,6 +164,54 @@
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="收货仓库" prop="warehouse">
                  <el-select
                    placeholder="请选择收货仓库"
                    v-model="editConfig.infomation.warehouse"
                    clearable
                    style="width: calc(100% - 0px)"
                    :disabled="editConfig.isDisabled"
                  >
                    <el-option
                      v-for="(ele, index) in receiveWhouseList"
                      :key="index"
                      :label="ele.name"
                      :value="ele.name"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="地址" prop="warehouseAddress">
                  <el-input
                    :disabled="editConfig.isDisabled"
                    v-model="editConfig.infomation.warehouseAddress"
                    placeholder="请填写"
                    clearable
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="接收人" prop="principal">
                  <el-input
                    :disabled="editConfig.isDisabled"
                    v-model="editConfig.infomation.principal"
                    placeholder="请填写"
                    clearable
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="来源单据" prop="sourceOrder">
                  <el-input
                    :disabled="editConfig.isDisabled"
                    v-model="editConfig.infomation.sourceOrder"
                    placeholder="请填写"
                    clearable
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="备注信息" prop="remark">
                  <el-input
@@ -185,11 +233,13 @@
              :detailEnter="editCommonConfig.detailEnter"
              :show-summary="showSummary"
              :recalculateShow="false"
              :addTypeIdMultiple="true"
              :product-table-list="productTableList"
              sign="purchase"
              @inputContent="inputContent"
              @getSummaries="getSummaries"
              @addProductClick="addProductClick"
              @getSelectArray="getSelectArray"
              @emptyProductClick="emptyProductClick"
              @clearupProduct="clearupProduct"
              @rowClick="rowClick"
@@ -289,7 +339,13 @@
import CommonFormTableView from "@/components/makepager/CommonFormTableView"
import BomDialog from "@/components/makepager/BomDialog"
import { getProductList } from "@/api/productManage/product"
import { addPurchase, updatePurchase, savePurchaseType, getPurchaseType } from "@/api/purchaseManage/purchase"
import {
  addPurchase,
  updatePurchase,
  savePurchaseType,
  getPurchaseType,
  getWarehouseInfo
} from "@/api/purchaseManage/purchase"
import SelectSupplierDialog from "@/views/purchaseManage/purchase/components/SelectSupplierDialog"
// import { formToJSON } from "axios";
import codeMixin from "@/components/mixin/codeMixin"
@@ -316,7 +372,7 @@
      editConfig: this.editCommonConfig,
      rules: {
        purchaseTypeId: [{ required: true, message: "请选择", trigger: "change" }],
        supplierName: [{ required: true, message: "请选择", trigger: "change" }],
        supplierName: [{ required: true, message: "请选择供应商名称", trigger: "change" }],
        phone: [
          {
            required: false,
@@ -342,6 +398,7 @@
          { validator: this.validatorNumThree, trigger: "change" }
        ],
        number: [{ required: true, validator: this.validateCheckCode, trigger: ["change", "blur"] }],
        warehouse: [{ required: true, message: "请选择收货仓库", trigger: "change" }],
        signingDate: [{ required: true, message: "请选择签约日期", trigger: "change" }],
        deliveryDate: [{ required: true, message: "请选择交付日期", trigger: "change" }],
      },
@@ -351,7 +408,7 @@
        total: false,
        sumProp: ["price", "total"],
        multiply: ["amount", "price"],
        titleProp: ["编号", "产品名称", "产品编号", "计量单位", "规格型号", "采购单价", "描述"],
        titleProp: ["编号", "产品名称", "产品编号", "计量单位", "规格", "型号", "采购单价", "描述"],
        mergeNumber: 4,
        totalName: "小计"
      },
@@ -384,13 +441,12 @@
          return time.getTime() > Date.now()
        }
      },
      receiveWhouseList: [] // 收货仓库列表
    }
  },
  created() {
    let date= new Date()
    this.editConfig.infomation.signingDate=date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + (date.getDate())
    console.log(this.editConfig,"参数")
    this.handleGetBomKindDictList()
    this.getWarehouseInfo()
    this.$store.dispatch("getSupplier")
    this.formInfo()
  },
@@ -463,9 +519,6 @@
        this.plcBrandList = res.data
        this.setTableForm()
        if (val) {
          // this.plcBrandList.map((item)=>{
          //   item.purchaseTypeId=item.id
          // })
          for (let i in this.plcBrandList) {
            if (this.plcBrandList[i][this.editRow.isDefault]) {
              this.editConfig.infomation.purchaseTypeId = this.editConfig.infomation.purchaseTypeId
@@ -576,6 +629,8 @@
                  if (res.code === 200) {
                    this.$message.success("创建成功")
                    this.$parent.getData()
                  } else {
                    this.$message.error(res.msg)
                  }
                })
              }
@@ -667,7 +722,11 @@
          realTotalPrice: this.total ? Number(this.total) : 0,
          totalPrice: this.totalTwo ? Number(this.totalTwo) : 0,
          status: data.status,
          quantity: data.quantity // 采购数量
          quantity: data.quantity, // 采购数量
          warehouse: data.warehouse || "", // 收货仓库
          warehouseAddress: data.warehouseAddress || "", // 收货仓库地址
          principal: data.principal || "", // 仓库负责人
          sourceOrder: data.sourceOrder || "" //  来源单据
        }
      }
      if (data.id) {
@@ -742,9 +801,9 @@
        this.tableData = [
          {
            purchaseId: 0,
            productId:Number(this.productId),
            productId: Number(this.productId),
            productIndex: this.productIndex,
            amount: 0,
            amount: 1,
            name: "",
            number: "",
            price: 0,
@@ -769,6 +828,7 @@
        supplierId: undefined,
        tableData: this.tableData,
        disabled: this.editConfig.isDisabled,
        isReturn: true,
        tableColumn: [
          {
            label: "产品名称",
@@ -780,11 +840,12 @@
          },
          { label: "产品编号", prop: "number", min: 150 },
          { label: "计量单位", prop: "unit" },
          { label: "规格型号", prop: "specifications" },
          { label: "规格", prop: "specifications" },
          { label: "型号", prop: "modelNumber" },
          { label: "数量", prop: "amount", inputNumber: true, disabled: this.editConfig.isDisabled },
          {
            label: "采购单价",
            prop: "price",
            prop: "purchasePrice",
            inputFloat: true,
            isRequird: true,
            disabled: this.editConfig.isDisabled
@@ -797,12 +858,10 @@
    },
    // 产品列表输入
    inputContent(val, prop, row) {
      // this.productId = row.productId;
      this.productIndex = row.productIndex
      let num = 0
      this.tableData.map((item) => {
        num += item.amount
        if (item.productIndex === row.productIndex) {
        if (item.number === row.number) {
          item[prop] = val
        }
      })
@@ -836,18 +895,35 @@
    },
    // 产品新增
    addProductClick() {
      this.productIndex++
      this.tableData.push({
        productIndex: this.productIndex,
        productId: "",
        id: 0,
        amount: 0,
        desc: "",
        name: "",
        number: "",
        price: 0,
        total: 0
      })
      // this.productIndex++
      // this.tableData.push({
      //   productIndex: this.productIndex,
      //   productId: "",
      //   id: 0,
      //   amount: 0,
      //   desc: "",
      //   name: "",
      //   number: "",
      //   price: 0,
      //   total: 0
      // })
      // this.showSummary.show = true
    },
    // 新增方式修改
    getSelectArray(val, index) {
      console.log(val, "ddd99999")
      if (this.tableData.length == 1 && this.tableData[0].number.length == 0) {
        this.tableData = []
      }
      if (index < this.tableData.length) {
        this.tableData.splice(index, 1)
        val.map((item, ind) => {
          this.tableData.splice(index + ind, 0, item)
        })
      } else {
        this.tableData = this.tableData.concat(val)
      }
      this.productTableList.tableData = this.tableData
      this.showSummary.show = true
    },
    //  产品清空
@@ -881,6 +957,13 @@
    handleProduct(item) {
      this.tableData[this.productListIdx].productId = Number(item.id)
      console.log(item, "选中产品", this.tableData)
    },
    // 获取收货仓库列表
    async getWarehouseInfo() {
      await getWarehouseInfo().then((res) => {
        console.log(res)
        this.receiveWhouseList = res.data.info
      })
    }
  }
}
src/views/purchaseManage/purchase/index.vue
@@ -16,13 +16,15 @@
    </div>
    <div class="body">
      <div class="body-card">
      <div class="content-top">
        <div class="list-view">
          <TableCommonView
            ref="tableListRef"
            :table-list="tableList"
            @selCommonClick="selCommonClick"
            @selTableCol="selTableCol"
            @tableRowClick="tableRowClick"
            :selectClassRow="selectRow"
          >
            <template slot="tableButton">
              <el-table-column label="状态" width="120">
@@ -78,6 +80,41 @@
          <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
        </div>
      </div>
      <div class="content-bottom">
        <div class="bottom-tabs">
          <div
            class="tab-pane"
            @click="getTab(0)"
            :style="{
              background: TabsIndex == 0 ? '#2a78fb' : '#F1F3F8',
              color: TabsIndex == 0 ? '#fff' : '#666'
            }"
          >
            产品信息
          </div>
          <div
            class="tab-pane"
            @click="getTab(1)"
            :style="{
              background: TabsIndex == 1 ? '#2a78fb' : '#F1F3F8',
              color: TabsIndex == 1 ? '#fff' : '#666'
            }"
          >
            收货信息
          </div>
        </div>
        <div class="list-view">
          <TableCommonView :loading="loading" :table-list="productTableList" @selTableCol="selBottomTableCol">
            <!-- <template slot="tableButton">
              <el-table-column label="操作" width="160" fixed="right">
                <template slot-scope="scope">
                  <el-button @click="viewClick(scope.row)" type="text" size="small">查看</el-button>
                </template>
              </el-table-column>
            </template> -->
          </TableCommonView>
        </div>
      </div>
    </div>
    <!-- 新建/编辑销售线索 -->
@@ -91,7 +128,13 @@
<script>
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import { getPurchaseList, getPurchaseInfo, submitPurchase, deletePurchase } from "@/api/purchaseManage/purchase"
import {
  getPurchaseList,
  getPurchaseInfo,
  submitPurchase,
  deletePurchase,
  getOperationInfo
} from "@/api/purchaseManage/purchase"
import DetailSupplier from "@/views/purchaseManage/purchase/DetailSupplier"
import AddPurchase from "@/views/purchaseManage/purchase/components/AddPurchase"
import { getSupplierList } from "@/api/supplierManage/supplier"
@@ -103,8 +146,33 @@
  mixins: [pageMixin],
  computed: {},
  data() {
    // 产品信息
    const productColumn = [
      { label: "产品编号", prop: "number", default: true },
      { label: "产品名称", prop: "name" },
      { label: "规格", prop: "specifications" },
      { label: "型号", prop: "modelNumber" },
      { label: "采购数量", prop: "amount" },
      { label: "已发货数量", prop: "sendAmount" },
      { label: "已入库数量", prop: "overAmount" },
      { label: "单位", prop: "unit" },
      { label: "采购单价", prop: "purchasePrice", price: true },
      { label: "价税合计", prop: "total", price: true }
    ]
    // 收货信息
    const recriveColumn = [
      { label: "入库单号", prop: "operationNumber", default: true },
      { label: "收货仓库", prop: "warehouseName" },
      { label: "产品名称", prop: "name" },
      { label: "产品编码", prop: "number" },
      { label: "数量", prop: "amount" },
      { label: "入库时间", prop: "overTime" },
      { label: "收货人", prop: "principal" },
      { label: "状态", prop: "status", isCallMethod: true, getCallMethod: this.getreceiveStatusStatus }
    ]
    return {
      purchaseStatusList: getDataByType("purchaseStatus"),
      receiveStatusList: getDataByType("receiveStatus"),
      tableLoading: false,
      tableList: {}, // 列表
      selValueList: [],
@@ -133,7 +201,30 @@
        { label: "经办人", prop: "handledBy", min: 130 },
        { label: "制单人", prop: "creator", min: 130 }
      ],
      showCol: ["采购单号", "采购单名称", "单据类型", "供应商名称", "采购数量", "收货仓库", "经办人", "制单人"]
      showCol: ["采购单号", "采购单名称", "单据类型", "供应商名称", "采购数量", "收货仓库", "经办人", "制单人"],
      tableBottomColumn: [],
      showBottomCol: [],
      TabsIndex: "0",
      productTableList: {},
      // 产品信息
      productColumn: productColumn,
      showProductCol: [
        "产品编号",
        "产品名称",
        "规格",
        "型号",
        "采购数量",
        "已发货数量",
        "已入库数量",
        "单位",
        "采购单价",
        "价税合计"
      ],
      // 收货信息
      recriveColumn: recriveColumn,
      showReceiveCol: ["入库单号", "收货仓库", "产品名称", "产品编码", "数量", "入库时间", "收货人", "状态"],
      loading: false,
      selectRow: {}
    }
  },
  created() {
@@ -175,8 +266,19 @@
        return "--"
      }
    },
    setColumnVisible(showCol) {
      return this.tableColumn.map((ele) => {
    getreceiveStatusStatus(val) {
      if (val) {
        for (let i in this.receiveStatusList) {
          if (this.receiveStatusList[i].id == val) {
            return this.receiveStatusList[i].name
          }
        }
      } else {
        return "--"
      }
    },
    setColumnVisible(showCol, tableColumn) {
      return tableColumn.map((ele) => {
        return {
          ...ele,
          isShowColumn: showCol.includes(ele.label)
@@ -189,9 +291,13 @@
        selectIndex: true,
        showcol: this.showCol,
        allcol: [],
        tableColumn: this.setColumnVisible(this.showCol)
        tableColumn: this.setColumnVisible(this.showCol, this.tableColumn)
      }
      this.tableList.allcol = this.tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label)
      // bottom 产品信息/收货信息
      this.tableBottomColumn = this.productColumn
      this.showBottomCol = this.showProductCol
      this.setBottomList()
    },
    selTableCol(val) {
      this.showcol = val
@@ -212,6 +318,10 @@
            })
            this.tableList.tableInfomation = list || []
            this.pagerOptions.totalCount = res.data.total
            if (res.data.total > 0) {
              this.selectRow = this.tableList.tableInfomation.length > 0 ? this.tableList.tableInfomation[0] : {}
              this.tableRowClick(this.selectRow)
            }
          }
        })
        .catch((err) => {
@@ -255,7 +365,7 @@
        number: "",
        contact: "",
        phone: "",
        signingDate: "",
        signingDate: this.getCurrentDate(),
        deliveryDate: "",
        remark: "",
        wholeDiscountType: null,
@@ -265,7 +375,14 @@
        realTotalPrice: 0
      }
    },
    // 获取当前日期
    getCurrentDate() {
      let now = new Date()
      let year = now.getFullYear()
      let month = now.getMonth() + 1
      let day = now.getDate()
      return year + "-" + month + "-" + day
    },
    // 编辑
    btnEdit(row) {
      this.editConfig.detailEnter = false
@@ -291,9 +408,8 @@
      setTimeout(() => {
        this.tableLoading = false
      }, 3000)
      // this.editRow = row;
      // this.$refs.add.islook = true;
    },
    // 确认发货
    btnConfirm(row) {
      let string = "是否提交?"
@@ -412,6 +528,98 @@
      setTimeout(() => {
        this.tableLoading = false
      }, 3000)
    },
    // top 行点击
    tableRowClick(row) {
      this.selectRow = row
      if (row.status == 1 && this.TabsIndex == 0) {
        getPurchaseInfo({ id: row.id }).then((res) => {
          if (res.code == 200) {
            this.productTableList.tableInfomation = res.data.productList
          } else {
            this.$message.error(res.msg ? res.msg + "," : "" + "获取信息失败!")
          }
        })
      } else if (this.TabsIndex == 1 && row.status == 1) {
        this.productTableList.tableInfomation = []
      } else {
        getOperationInfo({ id: row.id }).then((res) => {
          if (res.code == 200) {
            this.productTableList.tableInfomation = res.data
          } else {
            this.$message.error(res.msg ? res.msg + "," : "" + "获取信息失败!")
          }
        })
      }
    },
    // bom 列表
    setBottomList() {
      this.productTableList = {
        selectIndex: true,
        tableInfomation: [],
        allcol: [],
        showcol: this.showBottomCol,
        tableColumn: this.setColumnVisible(this.showBottomCol, this.tableBottomColumn)
      }
      this.setTableList(this.productTableList)
    },
    setTableList(tableList) {
      tableList.allcol = tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label)
      this.searchOptions = []
      for (let i = 0; i < tableList.tableColumn.length; i++) {
        const label = tableList.tableColumn[i].label
        const value = tableList.tableColumn[i].prop
        this.searchOptions.push({ value: value, label: label })
      }
    },
    // bottom 产品信息
    selBottomTableCol(val) {
      this.showcol = val
      this.productTableList.tableColumn = this.setColumnVisible(val, this.tableBottomColumn)
    },
    //获取当前选中资源的id
    getTab(tab) {
      this.TabsIndex = tab
      if (this.TabsIndex == 0) {
        // 产品信息列表
        this.tableBottomColumn = this.productColumn
        this.showBottomCol = this.showProductCol
        this.setBottomList()
        this.getProductInventoryInfo(this.selectRow)
      } else if (this.TabsIndex == 1) {
        // 收货信息列表
        this.tableBottomColumn = this.recriveColumn
        this.showBottomCol = this.showReceiveCol
        this.setBottomList()
        this.getProductInventoryInfo(this.selectRow)
      }
    },
    // 状态
    getStatus(val) {
      return val === 1 ? "待确认" : val === 2 ? "待出库" : val === 3 ? "出库完成" : val === 4 ? "已关闭" : "--"
    },
    // 获取产品/收货信息
    async getProductInventoryInfo(row) {
      console.log(row)
      if (this.TabsIndex == 0 && row.status == 1) {
        getPurchaseInfo({ id: row.id }).then((res) => {
          if (res.code == 200) {
            this.productTableList.tableInfomation = res.data.productList
          } else {
            this.$message.error(res.msg ? res.msg + "," : "" + "获取信息失败!")
          }
        })
      } else if (this.TabsIndex == 1 && row.status == 1) {
        this.productTableList.tableInfomation = []
      } else {
        getOperationInfo({ id: row.id }).then((res) => {
          if (res.code == 200) {
            this.productTableList.tableInfomation = res.data
          } else {
            this.$message.error(res.msg ? res.msg + "," : "" + "获取信息失败!")
          }
        })
      }
    }
  }
}
@@ -444,15 +652,51 @@
    padding: 10px 20px;
    border-radius: 12px;
    height: calc(100% - 92px);
    &-card {
    .content-top {
      background-color: #fff;
      border-radius: 12px;
      height: 100%;
      overflow: hidden;
      min-height: 70px;
      height: 48%;
      position: relative;
      .list-view {
        height: calc(100% - 60px);
      }
    }
    .list-view {
      height: calc(100% - 60px);
      overflow: hidden;
    .content-bottom {
      .bottom-tabs {
        height: 40px;
        line-height: 40px;
        background: #e6ecf2;
        display: flex;
        .tab-pane {
          width: 100px;
          margin-right: 20px;
          font-size: 14px !important;
          text-align: center;
          cursor: pointer;
          background: #2a78fb;
          border-top-left-radius: 20px;
          border-top-right-radius: 20px;
        }
      }
      .lable-view {
        background: #e6ecf2;
        height: 40px;
        line-height: 40px;
        .name {
          border-left: 4px solid #2a78fb;
          padding-left: 10px;
        }
      }
      background-color: #fff;
      border-radius: 12px;
      min-height: 70px;
      height: calc(52% - 60px);
      margin-top: 10px;
      // padding: 10px 20px;
      .list-view {
        height: calc(100% - 10px);
      }
    }
    .btn-pager {
      display: flex;
src/views/supplierManage/supplier/AddNewProduct.vue
@@ -15,10 +15,13 @@
        <div class="basic-info-view">
          <CommonFormTableView
            ref="productTable"
            :addTypeIdMultiple="true"
            :product-table-list="productTableList"
            :detail-enter="detailEnter"
            :isOperate="isOperate"
            @inputContent="inputContent"
            @addProductClick="addProductClick"
            @getSelectArray="getSelectArray"
            @emptyProductClick="emptyProductClick"
            @clearupProduct="clearupProduct"
            @selCommonName="selCommonName"
@@ -63,6 +66,7 @@
      isNoProduct: true,
      supplierId: this.addCommonConfig.infomation.supplierId,
      detailEnter: true,
      isOperate: true,
      deliveryTime: this.addCommonConfig.infomation.deliveryTime, // 供货时长
      shippingDuration: this.addCommonConfig.infomation.shippingDuration, // 物流时长
      purchasePrice: this.addCommonConfig.infomation.purchasePrice // 采购价格
@@ -144,8 +148,8 @@
      }
      return params
    },
    handleProduct(item,row){
      this.editConfig.infomation.id=row.id
    handleProduct(item, row) {
      this.editConfig.infomation.id = row.id
    },
    setTableForm() {
      if (this.editConfig.title === "添加") {
@@ -160,15 +164,16 @@
            number: "",
            price: 0,
            total: 0,
            supplierId:this.supplierId
            supplierId: this.supplierId
          }
        ]
      } else {
        this.tableData = [{ ...this.editConfig.infomation}]
        this.tableData = [{ ...this.editConfig.infomation }]
        this.detailEnter = true
      }
      this.productTableList = {
        tableData: this.tableData,
        isReturn: true,
        tableColumn: [
          { label: "产品名称", prop: "name", productName: true, isRequird: true, width: 250 },
          { label: "产品编码", prop: "number" },
@@ -182,36 +187,46 @@
    },
    // 产品列表输入
    inputContent(val, prop, row) {
      this.productId = row.productId
      this.deliveryTime = row.deliveryTime
      this.shippingDuration = row.shippingDuration
      this.purchasePrice = row.purchasePrice
      this.tableData.map((item) => {
        if (item.productId === row.productId) {
        if (item.number === row.number) {
          item[prop] = val
          item.supplierId =Number(this.supplierId)
          item.deliveryTime = this.deliveryTime
          item.shippingDuration = this.shippingDuration
          item.purchasePrice = this.purchasePrice
          item.supplierId = Number(this.supplierId)
        }
      })
    },
    // 产品新增
    addProductClick() {
      this.productId++
      this.tableData.push({
        productId: this.productId,
        id: 0,
        amount: 0,
        desc: "",
        name: "",
        number: "",
        purchasePrice: 0,
        total: 0,
        deliveryTime: 0,
        shippingDuration: 0,
        supplierId: this.supplierId
      })
      // this.productId++
      // this.tableData.push({
      //   productId: this.productId,
      //   id: 0,
      //   amount: 0,
      //   desc: "",
      //   name: "",
      //   number: "",
      //   purchasePrice: 0,
      //   total: 0,
      //   deliveryTime: 0,
      //   shippingDuration: 0,
      //   supplierId: this.supplierId
      // })
    },
    // 新增方式修改
    getSelectArray(val, index) {
      console.log(val, "ddd99999")
      if (this.tableData.length == 1 && this.tableData[0].number.length == 0) {
        this.tableData = []
      }
      if (index < this.tableData.length) {
        this.tableData.splice(index, 1)
        val.map((item, ind) => {
          this.tableData.splice(index + ind, 0, item)
        })
      } else {
        this.tableData = this.tableData.concat(val)
      }
      this.productTableList.tableData = this.tableData
      // this.showSummary.show = true
    },
    //  产品清空
    emptyProductClick() {