| | |
| | | :disabled="editConfig.isDisabled" |
| | | v-model="editConfig.infomation.phone" |
| | | placeholder="请填写" |
| | | maxlength="11" |
| | | show-word-limit |
| | | clearable |
| | | ></el-input> |
| | | </el-form-item> |
| | |
| | | @addProductClick="addProductClick" |
| | | @emptyProductClick="emptyProductClick" |
| | | @clearupProduct="clearupProduct" |
| | | @rowClick="rowClick" |
| | | @handleProduct="handleProduct" |
| | | /> |
| | | </div> |
| | | <div class="table-bottom"> |
| | |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <!-- <el-button type="primary" size="small" @click="editConfig.visible = false">保并提交审批</el-button> --> |
| | | <el-button type="primary" size="small" @click="saveClick('form')" |
| | | <el-button type="primary" v-if="this.editConfig.title != '查看'" size="small" @click="saveClick('form')" |
| | | >保存</el-button |
| | | > |
| | | <el-button size="small" @click="editConfig.visible = false" |
| | | <el-button size="small" v-if="this.editConfig.title != '查看'" @click="editConfig.visible = false" |
| | | >取消</el-button |
| | | > |
| | | </div> |
| | |
| | | } from "@/api/purchaseManage/purchase"; |
| | | |
| | | import SelectSupplierDialog from "@/views/purchaseManage/purchase/components/SelectSupplierDialog"; |
| | | // import { formToJSON } from "axios"; |
| | | export default { |
| | | name: "QuotationDialog", |
| | | components: { SelectSupplierDialog, CommonFormTableView,BomDialog }, |
| | |
| | | }, |
| | | supplierId: this.editCommonConfig.infomation.supplierId, |
| | | tableData: [], |
| | | productId: 1, |
| | | productIndex: 0, |
| | | productId:'', |
| | | isNoProduct: true, |
| | | clientList: [], |
| | | plcBrandList:[], |
| | |
| | | }, |
| | | total:0, |
| | | totalTwo:0, |
| | | productListIdx:0, |
| | | lacks:[], |
| | | }; |
| | | }, |
| | | created() { |
| | |
| | | this.$message.error("产品名称不能为空"); |
| | | } else { |
| | | const params = this.saveParams(); |
| | | //新建 |
| | | if (this.editConfig.title === "创建") { |
| | | addPurchase(params).then((res) => { |
| | | this.editConfig.visible = false; |
| | | if (res.code === 200) { |
| | | this.$message.success("添加成功"); |
| | | this.$parent.getData(); |
| | | this.lacks=[] |
| | | this.tableData.forEach((item)=>{ |
| | | if(this.productTableList.tableProductList.map(obj => obj.number).includes(item.number)) { |
| | | console.log(`${item.name} 在数组中存在`); |
| | | } else { |
| | | this.lacks.push(item.name) |
| | | } |
| | | }); |
| | | }) |
| | | if(this.lacks.length>0){ |
| | | this.$confirm(`当前供应商不能提供您选择的产品:${this.lacks}, 是否继续创建采购单?`, '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | console.log("确定创建") |
| | | //创建采购单 |
| | | addPurchase(params).then((res) => { |
| | | this.editConfig.visible = false; |
| | | if (res.code === 200) { |
| | | this.$message.success("创建成功"); |
| | | this.$parent.getData(); |
| | | } |
| | | }); |
| | | }).catch(() => { |
| | | console.log("取消创建") |
| | | }); |
| | | }else{ |
| | | addPurchase(params).then((res) => { |
| | | this.editConfig.visible = false; |
| | | if (res.code === 200) { |
| | | this.$message.success("创建成功"); |
| | | this.$parent.getData(); |
| | | } |
| | | }); |
| | | } |
| | | } else { |
| | | updatePurchase(params).then((res) => { |
| | | this.editConfig.visible = false; |
| | | if (res.code === 200) { |
| | | this.$message.success("编辑成功"); |
| | | this.$parent.getData(); |
| | | // 编辑 |
| | | getProductList({ |
| | | supplierId:this.editConfig.infomation.supplierId, |
| | | page:1, |
| | | pageSize:100 |
| | | }).then((res)=>{ |
| | | if(res.code===200){ |
| | | this.lacks=[] |
| | | // 编辑前先看看当前供应商对应的产品列表 |
| | | this.productTableList.tableProductList = res.data.list |
| | | //当前产品是否在当前供应商下存在 |
| | | this.tableData.forEach((item)=>{ |
| | | if(this.productTableList.tableProductList.map(obj => obj.number).includes(item.number)) { |
| | | console.log(`${item.name} 在数组中存在`); |
| | | } else { |
| | | this.lacks.push(item.name) |
| | | } |
| | | }) |
| | | // 不存在的产品信息 |
| | | if(this.lacks.length>0){ |
| | | this.$confirm(`当前供应商不能提供您选择的产品:${this.lacks}, 是否继续更新采购单?`, '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | console.log("确定更新") |
| | | //更新采购单 |
| | | updatePurchase(params).then((res) => { |
| | | this.editConfig.visible = false; |
| | | if (res.code === 200) { |
| | | this.$message.success("更新成功"); |
| | | this.$parent.getData(); |
| | | } |
| | | }); |
| | | }).catch(() => { |
| | | console.log("取消更新") |
| | | }); |
| | | }else { |
| | | updatePurchase(params).then((res) => { |
| | | this.editConfig.visible = false; |
| | | if (res.code === 200) { |
| | | this.$message.success("更新成功"); |
| | | this.$parent.getData(); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }) |
| | | |
| | | } |
| | | } |
| | | } else { |
| | |
| | | priceAdjustment:data.priceAdjustment?Number(data.priceAdjustment):0, |
| | | realTotalPrice:this.total?Number(this.total):0, |
| | | totalPrice:this.totalTwo?Number(this.totalTwo):0, |
| | | status:data.status, |
| | | quantity:data.quantity, // 采购数量 |
| | | } |
| | | }; |
| | | if(data.ID){ |
| | |
| | | ); |
| | | }; |
| | | }, |
| | | // 选择供应商 |
| | | async handleSelectClient(value, item) { |
| | | this.productTableList.supplierId=item.ID |
| | | if (value === "client") { |
| | |
| | | page:1, |
| | | pageSize:100 |
| | | }).then((res)=>{ |
| | | if(res.data.code===200){ |
| | | this.productTableList.tableProductList = res.data.data.list |
| | | if(res.code===200){ |
| | | this.productTableList.tableProductList = res.data.list |
| | | console.log(this.productTableList.tableProductList,"pop") |
| | | } |
| | | }) |
| | |
| | | selClientClick() { |
| | | this.editSelectSupplierConfig.editVisible = true; |
| | | }, |
| | | selClient(row) { |
| | | async selClient(row) { |
| | | await getProductList({ |
| | | supplierId:row.ID, |
| | | page:1, |
| | | pageSize:100 |
| | | }).then((res)=>{ |
| | | if(res.code===200){ |
| | | this.productTableList.tableProductList = res.data.list |
| | | } |
| | | }) |
| | | this.$set(this.editConfig.infomation,'supplierName',row.name) |
| | | this.editConfig.infomation.contact = row.contact; |
| | | this.editConfig.infomation.phone = row.phone; |
| | | this.supplierId = row.ID; |
| | | this.editConfig.infomation.supplierId = row.ID; |
| | | }, |
| | | // 清除已选择用户 |
| | | clearupClient(value) { |
| | | this.emptyProductClick() |
| | | if (value == "client") { |
| | | this.$set(this.editConfig.infomation, "supplierName", ""); |
| | | this.supplierId = null; |
| | |
| | | ) { |
| | | this.tableData = [ |
| | | { |
| | | purchaseId:0, |
| | | productId: this.productId, |
| | | id: 0, |
| | | productIndex:this.productIndex, |
| | | amount: 0, |
| | | desc: "", |
| | | name: "", |
| | | number: "", |
| | | price: 0, |
| | | total: 0, |
| | | remark:'', |
| | | unit:'', |
| | | purchasePrice:'', |
| | | deliveryTime:"", |
| | | shippingDuration:"", |
| | | specifications:"", |
| | | modelNumber:"", |
| | | }, |
| | | ]; |
| | | } else { |
| | |
| | | }, |
| | | // 产品列表输入 |
| | | inputContent(val, prop, row) { |
| | | this.productId = row.productId; |
| | | // this.productId = row.productId; |
| | | this.productIndex=row.productIndex; |
| | | let num=0 |
| | | this.tableData.map((item) => { |
| | | if (item.productId === row.productId) { |
| | | num+=item.amount |
| | | if (item.productIndex === row.productIndex) { |
| | | item[prop] = val; |
| | | } |
| | | }); |
| | | |
| | | if(prop==="amount"){ |
| | | this.editConfig.infomation.quantity=num |
| | | } |
| | | }, |
| | | getSummaries(total){ |
| | | this.totalTwo= JSON.parse(JSON.stringify(total)); |
| | |
| | | }, |
| | | // 产品新增 |
| | | addProductClick() { |
| | | this.productId++; |
| | | this.productIndex++; |
| | | this.tableData.push({ |
| | | productId: this.productId, |
| | | productIndex: this.productIndex, |
| | | productId:'', |
| | | id: 0, |
| | | amount: 0, |
| | | desc: "", |
| | |
| | | }, |
| | | // 产品清空 |
| | | emptyProductClick() { |
| | | this.productId = 1; |
| | | this.productIndex = 1; |
| | | this.tableData = [ |
| | | { |
| | | productId: this.productId, |
| | | productId: '', |
| | | productIndex:this.productIndex, |
| | | id: 0, |
| | | amount: 0, |
| | | amount: "0", |
| | | desc: "", |
| | | name: "", |
| | | number: "", |
| | |
| | | this.tableData = data; |
| | | this.productTableList.tableData = this.tableData; |
| | | }, |
| | | //选择行 |
| | | rowClick(row){ |
| | | console.log(row,"xuanze") |
| | | this.productListIdx=row.productIndex |
| | | }, |
| | | //选中产品 |
| | | handleProduct(item){ |
| | | this.tableData[this.productListIdx].productId=item.ID |
| | | console.log(item,"选中产品",this.tableData) |
| | | } |
| | | }, |
| | | }; |
| | | </script> |