| | |
| | | <script> |
| | | import { getProductList } from "@/api/product/product" |
| | | import { getLocationList } from "@/api/overview/overview" |
| | | import { addDisuse, finishDisuse } from "@/api/operate/scrap" |
| | | import { addDisuse, finishDisuse, updateScrap } from "@/api/operate/scrap" |
| | | import SimpleSearchInput from "@/components/makepager/SimpleSearchInput" |
| | | export default { |
| | | name: "AddScrapDialog", |
| | |
| | | currentState: "todo", // 当前状态 |
| | | unit: "", |
| | | showButton: true, |
| | | isValidateClick: false // 验证是否显示 |
| | | isValidateClick: false, // 验证是否显示 |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | }, |
| | | // 保存 |
| | | saveClick(formName) { |
| | | this.$refs[formName].validate((valid) => { |
| | | if (valid) { |
| | | this.editConfig.infomation.productId = this.productId |
| | | this.editConfig.infomation.productName = this.productName |
| | | this.editConfig.infomation.unit = this.unit |
| | | addDisuse({ |
| | | ...this.editConfig.infomation |
| | | }).then((res) => { |
| | | console.log(res) |
| | | this.editConfig.visible = false |
| | | if (res.code === 200) { |
| | | this.$message.success("添加成功") |
| | | this.$parent.getData() |
| | | if (this.editCommonConfig.title === "新建") { |
| | | this.$refs[formName].validate((valid) => { |
| | | if (valid) { |
| | | this.editConfig.infomation.productId = this.productId |
| | | this.editConfig.infomation.productName = this.productName |
| | | this.editConfig.infomation.unit = this.unit |
| | | addDisuse({ |
| | | ...this.editConfig.infomation |
| | | }).then((res) => { |
| | | console.log(res) |
| | | this.editConfig.visible = false |
| | | if (res.code === 200) { |
| | | this.$message.success("添加成功") |
| | | this.$parent.getData() |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } else if (this.editCommonConfig.title === "编辑") { |
| | | this.$refs[formName].validate((valid) => { |
| | | if (valid) { |
| | | let params={ |
| | | amount: this.editConfig.infomation.amount, |
| | | baseOperationType: this.editConfig.infomation.baseOperationType, |
| | | fromLocationId: this.editConfig.infomation.fromLocationId, |
| | | id: this.editConfig.infomation.id, |
| | | number: this.editConfig.infomation.number, |
| | | operationDate: this.editConfig.infomation.operationDate, |
| | | productId: this.editConfig.infomation.productId, |
| | | sourceNumber: this.editConfig.infomation.sourceNumber, |
| | | status: this.editConfig.infomation.status, |
| | | toLocationId: this.editConfig.infomation.toLocationId |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | updateScrap( |
| | | params |
| | | ).then((res) => { |
| | | console.log(res) |
| | | this.editConfig.visible = false |
| | | if (res.code === 200) { |
| | | this.$message.success("修改成功") |
| | | this.$parent.getData() |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | // 选择产品 |
| | | selProductChange(val) { |
| | |
| | | }, |
| | | // 验证 |
| | | async validateClick() { |
| | | console.log(this.editConfig.infomation.id, "xxx") |
| | | await finishDisuse(this.editConfig.infomation.id).then((res) => { |
| | | console.log(res) |
| | | this.editConfig.visible = false |