| | |
| | | > |
| | | <el-option |
| | | v-for="ele in plcBrandList" |
| | | :key="ele.name" |
| | | :key="ele.purchaseTypeId" |
| | | :label="ele.name" |
| | | :value="ele.id" |
| | | ></el-option> |
| | |
| | | </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 |
| | |
| | | clearable |
| | | placeholder="选择日期" |
| | | value-format="yyyy-MM-dd" |
| | | :picker-options="pickerOptionsBefore" |
| | | > |
| | | </el-date-picker> |
| | | </el-form-item> |
| | |
| | | clearable |
| | | placeholder="选择日期" |
| | | value-format="yyyy-MM-dd" |
| | | :picker-options="pickerOptions" |
| | | > |
| | | </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"> |
| | |
| | | :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" |
| | |
| | | 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" |
| | |
| | | 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, |
| | |
| | | }, |
| | | { validator: this.validatorNumThree, trigger: "change" } |
| | | ], |
| | | number: [{ required: true, validator: this.validateCheckCode, trigger: ["change", "blur"] }] |
| | | 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" }], |
| | | }, |
| | | productTableList: {}, |
| | | showSummary: { |
| | |
| | | total: false, |
| | | sumProp: ["price", "total"], |
| | | multiply: ["amount", "price"], |
| | | titleProp: ["编号", "产品名称", "产品编号", "计量单位", "规格型号", "采购单价", "描述"], |
| | | titleProp: ["编号", "产品名称", "产品编号", "计量单位", "规格", "型号", "采购单价", "描述"], |
| | | mergeNumber: 4, |
| | | totalName: "小计" |
| | | }, |
| | |
| | | total: 0, |
| | | totalTwo: 0, |
| | | productListIdx: 0, |
| | | lacks: [] |
| | | lacks: [], |
| | | pickerOptions: { |
| | | disabledDate(time) { |
| | | return time.getTime() < Date.now() - 8.64e7 |
| | | } |
| | | }, |
| | | pickerOptionsBefore: { |
| | | disabledDate(time) { |
| | | return time.getTime() > Date.now() |
| | | } |
| | | }, |
| | | receiveWhouseList: [] // 收货仓库列表 |
| | | } |
| | | }, |
| | | created() { |
| | | this.handleGetBomKindDictList() |
| | | this.getWarehouseInfo() |
| | | this.$store.dispatch("getSupplier") |
| | | this.formInfo() |
| | | }, |
| | |
| | | ? this.editConfig.infomation.purchaseTypeId |
| | | : this.plcBrandList[i].id |
| | | this.$set(this.editConfig.infomation, "purchaseTypeId", this.editConfig.infomation.purchaseTypeId) |
| | | |
| | | break |
| | | } |
| | | } |
| | |
| | | if (res.code === 200) { |
| | | this.$message.success("创建成功") |
| | | this.$parent.getData() |
| | | } else { |
| | | this.$message.error(res.msg) |
| | | } |
| | | }) |
| | | } |
| | |
| | | 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) { |
| | |
| | | this.tableData = [ |
| | | { |
| | | purchaseId: 0, |
| | | productId:Number(this.productId), |
| | | productId: Number(this.productId), |
| | | productIndex: this.productIndex, |
| | | amount: 0, |
| | | amount: 1, |
| | | name: "", |
| | | number: "", |
| | | price: 0, |
| | |
| | | supplierId: undefined, |
| | | tableData: this.tableData, |
| | | disabled: this.editConfig.isDisabled, |
| | | isReturn: true, |
| | | tableColumn: [ |
| | | { |
| | | label: "产品名称", |
| | |
| | | }, |
| | | { 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 |
| | |
| | | }, |
| | | // 产品列表输入 |
| | | 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 |
| | | } |
| | | }) |
| | |
| | | }, |
| | | // 产品新增 |
| | | 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 |
| | | }, |
| | | // 产品清空 |
| | |
| | | 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 |
| | | }) |
| | | } |
| | | } |
| | | } |