| | |
| | | data |
| | | }) |
| | | } |
| | | // 保存单位 |
| | | export function saveUnitDict(data) { |
| | | return request({ |
| | | url: "/api-wms/v1/product/saveUnitDict", |
| | | method: "post", |
| | | data |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | <el-form-item label="单位" prop="unit"> |
| | | <el-select |
| | | :disabled="!showFooter" |
| | | v-model="editConfig.infomation.unit" |
| | | placeholder="单位" |
| | | filterable |
| | | @change="$forceUpdate()" |
| | | style="width: calc(100% - 30px)" |
| | | @change="Gtechange" |
| | | style="width: 85%" |
| | | > |
| | | <el-option |
| | | v-for="ele in unitList" |
| | |
| | | <BomDialog |
| | | ref="editDialog" |
| | | :editRow="editRow" |
| | | @sucessSet="handleGetBomKindDictList" |
| | | @handleConfirmSave="handleConfirmSave" |
| | | :workList="unitList" |
| | | title="计量单位" |
| | |
| | | <script> |
| | | import IconCropper from "./IconCropper" |
| | | import { getProductCategoryList } from "@/api/product/productCategory" |
| | | import { getProductList, addProduct, updateProduct } from "@/api/product/product" |
| | | import { uploadFiles, getUserInfo } from "@/api/common/other" |
| | | import { getProductList, addProduct, updateProduct,saveUnitDict } from "@/api/product/product" |
| | | import { uploadFiles, getUserInfo, } from "@/api/common/other" |
| | | import codeMixin from "@/components/mixin/codeMixin" |
| | | import { getDataByType } from "@/api/data" |
| | | import BomDialog from "./components/bomDialog"; |
| | |
| | | id: [{ required: true, validator: this.validateCheckCode, trigger: ["change", "blur"] }], |
| | | model: [{ required: true, message: "请选择物料类型", trigger: "change" }], |
| | | // salePrice: [{ required: true, message: "请输入销售价格", trigger: "blur" }], |
| | | unit: [{ required: true, message: "请输入单位", trigger: ["change", "blur"] }], |
| | | unit: [{ required: true, message: "请输入单位", trigger: ["blur"] }], |
| | | // 采购类型 |
| | | purchaseTypeList: [{ required: true, message: "请选择", trigger: "blur" }] |
| | | }, |
| | |
| | | methods: { |
| | | // 单位 |
| | | handleUnitShow() { |
| | | this.handleGetBomKindDictList(); |
| | | this.editRow.editDialogVisible = true; |
| | | }, |
| | | // 单位 |
| | | handleGetBomKindDictList(val) { |
| | | console.log(val) |
| | | // postGetUnitDictList().then((res) => { |
| | | // this.unitList = res.data; |
| | | // if (val) { |
| | | // for (let i in this.unitList) { |
| | | // if (this.unitList[i].isDefault) { |
| | | // this.form.unit = this.form.unit |
| | | // ? this.form.unit |
| | | // : this.unitList[i].name; |
| | | // // this.$set(this.form, "unit", this.form.unit); |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | // }); |
| | | }, |
| | | handleConfirmSave(data) { |
| | | console.log(data) |
| | | // postGetSaveSUnitDict({ data: data }).then((res) => { |
| | | // if (res.code == 200) { |
| | | // this.$message({ |
| | | // message: "操作成功!", |
| | | // type: "success", |
| | | // }); |
| | | // this.$refs.editDialog.editDialogVisible = false; |
| | | // this.handleGetBomKindDictList(); |
| | | // } |
| | | // }); |
| | | handleConfirmSave(dataList) { |
| | | saveUnitDict({ data: dataList }).then((res) => { |
| | | if (res.code == 200) { |
| | | this.$message({ |
| | | message: "操作成功!", |
| | | type: "success", |
| | | }); |
| | | this.getUnitInfo() |
| | | } |
| | | }); |
| | | this.editRow.editDialogVisible = false; |
| | | |
| | | }, |
| | |
| | | this.showSale = param |
| | | } |
| | | }, |
| | | Gtechange(){ |
| | | this.$forceUpdate() |
| | | }, |
| | | // 获取单位列表数据 |
| | | async getUnitInfo(){ |
| | | await getUnitInfo().then((res)=>{ |
| | | if( this.editConfig.title==="新建"){ |
| | | res.data.map((item)=>{ |
| | | if(item.isDefault){ |
| | | this.editConfig.infomation.unit=item.name |
| | | } |
| | | }) |
| | | } |
| | | this.editRow.BomTableData = res.data; |
| | | console.log( this.editRow.BomTableData,"看下",res.data) |
| | | this.unitList=res.data |
| | | }) |
| | | } |
| | | } |
| | |
| | | style="margin-left: 16px; color: #fff; background-color: #ee790c" |
| | | >新增</el-button |
| | | > --> |
| | | <el-button @click="shutdown">取消</el-button><el-button type="primary" @click="handleConfirmSave()" |
| | | <el-button @click="shutdown">取消</el-button> |
| | | <el-button type="primary" @click="handleConfirmSave()" |
| | | style="margin-left: 16px; color: #fff; background-color: #2a78fb">确定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | |
| | | default: () => { |
| | | return { |
| | | editDialogVisible: false, |
| | | BomTableData:[] |
| | | }; |
| | | }, |
| | | }, |
| | |
| | | thatEditRow:this.editRow, |
| | | isTableShow: true, |
| | | form: {}, |
| | | // BomTableData: JSON.parse(this.thatEditRow.BomTableData), |
| | | // BomTableData:[], |
| | | BomTableData: this.editRow.BomTableData, |
| | | // BomTableData: JSON.parse(this.editRow.BomTableData), |
| | | // BomTableData: [{ id: 303, createdAt: "2024-02-05 18:02:47", updatedAt: "2024-02-05 18:02:47",name: "kg", isDefault: false }], |
| | | work: 1, |
| | | flag: "add", |
| | |
| | | }; |
| | | }, |
| | | watch: { |
| | | // editDialogVisible(newVal) { |
| | | // console.log(newVal,"看看val") |
| | | // if (newVal) { |
| | | // this.BomTableData = this.workList; |
| | | // } |
| | | // }, |
| | | // workList(newVal) { |
| | | // console.log(newVal) |
| | | // this.BomTableData = this.workList; |
| | | // }, |
| | | }, |
| | | created() { |
| | | console.log(this.thatEditRow,"thatEditRow") |
| | |
| | | mounted() { }, |
| | | methods: { |
| | | handleAdd() { |
| | | this.BomTableData=this.thatEditRow.BomTableData |
| | | this.BomTableData.push({ name: "", isDefault: false }); |
| | | }, |
| | | handleDelete(id) { |
| | | this.BomTableData = this.BomTableData.filter((i) => { |
| | | if (this.BomTableData.length === 1) { |
| | | this.$message.warning("至少保留一条数据"); |
| | | return; |
| | | } |
| | | this.BomTableData = this.thatEditRow.BomTableData.filter((i) => { |
| | | return i.id != id; |
| | | }); |
| | | this.thatEditRow.BomTableData=this.BomTableData |
| | | }, |
| | | async getCodeStandardList() { |
| | | const res = await getCodeStandardList(this.obj); |
| | |
| | | let fn = this.flag == "set" ? updateMaterial : addMaterial; |
| | | const res = await fn(this.form); |
| | | this.shutdown(); |
| | | this.$sucessSet("sucessSet"); |
| | | // this.$sucessSet("sucessSet"); |
| | | if (res.code == 200) { |
| | | this.$message({ |
| | | message: this.flag == "set" ? "修改成功!" : "添加成功!", |