| | |
| | | style="width: 85%" |
| | | v-if=" |
| | | editConfig.title == '编辑' || |
| | | (editConfig.title == '新建' && |
| | | codenumer && |
| | | (explain != '' || isIdDisabled)) |
| | | (editConfig.title == '新建' && codenumer && (explain != '' || isIdDisabled)) |
| | | " |
| | | :disabled="editConfig.title != '新建'" |
| | | v-model="editConfig.infomation.id" |
| | | placeholder="请输入编码" |
| | | > |
| | | </el-input> |
| | | <span v-else-if="editConfig.title == '新建'" style="color: #f56c6c;width: 85%" |
| | | <span v-else-if="editConfig.title == '新建'" style="color: #f56c6c; width: 85%" |
| | | >请优先配置编码规范 <el-button type="text" @click="numberClick"> 配置规范 </el-button></span |
| | | > |
| | | </el-form-item> |
| | | <el-form-item label="产品规格" prop="specs"> |
| | | <el-input style="width: 85%" :disabled="!showFooter" v-model="editConfig.infomation.specs" placeholder="请输入"></el-input> |
| | | <el-input |
| | | style="width: 85%" |
| | | :disabled="!showFooter" |
| | | v-model="editConfig.infomation.specs" |
| | | placeholder="请输入" |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="产品类型" prop="productType"> |
| | | <el-select |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="产品型号" prop="type"> |
| | | <el-input style="width: 85%" :disabled="!showFooter" v-model="editConfig.infomation.type" placeholder="请输入"></el-input> |
| | | <el-input |
| | | style="width: 85%" |
| | | :disabled="!showFooter" |
| | | v-model="editConfig.infomation.type" |
| | | placeholder="请输入" |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="采购类型" prop="purchaseType"> |
| | | <el-radio-group :disabled="!showFooter" v-model="editConfig.infomation.purchaseType"> |
| | | <el-radio v-for="item in purchaseTypeList" :key="item.id" :label="item.id">{{ item.name }}</el-radio> |
| | | <el-radio v-for="item in purchaseTypeList" :key="item.id" :label="item.id">{{ |
| | | item.name |
| | | }}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="内部编码" prop="internalReference"> |
| | |
| | | import { getProductCategoryList } from "@/api/product/productCategory" |
| | | import { getProductList, addProduct, updateProduct } from "@/api/product/product" |
| | | import { uploadFiles } from "@/api/common/other" |
| | | import codeMixin from "@/components/mixin/codeMixin"; |
| | | import { getDataByType } from "@/api/data"; |
| | | import codeMixin from "@/components/mixin/codeMixin" |
| | | import { getDataByType } from "@/api/data" |
| | | export default { |
| | | mixins: [codeMixin], |
| | | name: "AddProductDialog", |
| | |
| | | editConfig: this.editCommonConfig, |
| | | rules: { |
| | | name: [{ required: true, message: "请输入产品名称", trigger: "blur" }], |
| | | id: [{ required: true, validator: this.validateCheckCode, trigger: ["change",'blur' ]}], |
| | | 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: ["change", "blur"] }], |
| | | // 采购类型 |
| | | purchaseType: [{ required: true, message: "请选择", trigger: "blur" }], |
| | | purchaseType: [{ required: true, message: "请选择", trigger: "blur" }] |
| | | }, |
| | | memberOptions: [{ name: "管理员", id: 1 }], |
| | | productCategoryOptions: [], // 产品类别 |
| | |
| | | { name: "其他", id: "其他" } |
| | | ], |
| | | statisticsMap: { |
| | | amount: this.editCommonConfig.infomation.amount?this.editCommonConfig.infomation.amount:0,// 在库 |
| | | predictionAmount:this.editCommonConfig.infomation.predictionAmount?this.editCommonConfig.infomation.predictionAmount:0,//预测 |
| | | inputAmount:this.editCommonConfig.infomation.inputAmount?this.editCommonConfig.infomation.inputAmount:0,//进 |
| | | outputAmount:this.editCommonConfig.infomation.outputAmount?this.editCommonConfig.infomation.outputAmount:0,//出 |
| | | reorderRuleNum:this.editCommonConfig.infomation.reorderRuleNum?this.editCommonConfig.infomation.reorderRuleNum:0,//重订货规则数量 |
| | | minInventoryRule:this.editCommonConfig.infomation.minInventoryRule?this.editCommonConfig.infomation.minInventoryRule:0,//最小重订货 |
| | | maxInventoryRule:this.editCommonConfig.infomation.maxInventoryRule?this.editCommonConfig.infomation.maxInventoryRule:0,//最大重订货 |
| | | amount: this.editCommonConfig.infomation.amount ? this.editCommonConfig.infomation.amount : 0, // 在库 |
| | | predictionAmount: this.editCommonConfig.infomation.predictionAmount |
| | | ? this.editCommonConfig.infomation.predictionAmount |
| | | : 0, //预测 |
| | | inputAmount: this.editCommonConfig.infomation.inputAmount ? this.editCommonConfig.infomation.inputAmount : 0, //进 |
| | | outputAmount: this.editCommonConfig.infomation.outputAmount ? this.editCommonConfig.infomation.outputAmount : 0, //出 |
| | | reorderRuleNum: this.editCommonConfig.infomation.reorderRuleNum |
| | | ? this.editCommonConfig.infomation.reorderRuleNum |
| | | : 0, //重订货规则数量 |
| | | minInventoryRule: this.editCommonConfig.infomation.minInventoryRule |
| | | ? this.editCommonConfig.infomation.minInventoryRule |
| | | : 0, //最小重订货 |
| | | maxInventoryRule: this.editCommonConfig.infomation.maxInventoryRule |
| | | ? this.editCommonConfig.infomation.maxInventoryRule |
| | | : 0 //最大重订货 |
| | | }, |
| | | isView: false, |
| | | fileFormdata: null, // 上传图片入参 |
| | | purchaseTypeList: getDataByType("purchaseType"), |
| | | purchaseTypeList: getDataByType("purchaseType") |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | this.editClick() |
| | | } |
| | | this.setOptionalFieldsToEmpty() |
| | | this.formInfo(); |
| | | this.formInfo() |
| | | }, |
| | | methods: { |
| | | formInfo() { |
| | | this.objCode.type = "物料编码"; |
| | | this.objCode.codeStandID = ""; |
| | | this.objCode.type = "物料编码" |
| | | this.objCode.codeStandID = "" |
| | | if (this.editConfig.infomation.codeStandardID) { |
| | | this.objCode.codeStandID = this.editConfig.infomation.codeStandardID; |
| | | this.objCode.codeStandID = this.editConfig.infomation.codeStandardID |
| | | } |
| | | this.getRCodeStandardList(); |
| | | this.getRCodeStandardList() |
| | | }, |
| | | /** |
| | | * 非必填项后端返回的是数字 0,表单需要空串才能视为未选择回显 |
| | |
| | | this.showEdit = false |
| | | this.showButton = false |
| | | this.showFooter = true |
| | | this.isView = false |
| | | this.setTableForm() |
| | | }, |
| | | // 保存 |
| | |
| | | saveEditRequest(attachmentIDs) { |
| | | let requestUrl = this.editConfig.title === "新建" ? addProduct : updateProduct |
| | | this.unsetFieldsToNumber() |
| | | let params={ |
| | | let params = { |
| | | ...this.editConfig.infomation, |
| | | attachmentIDs |
| | | } |
| | | if (this.editConfig.title == "新建") { |
| | | params.codeStandardID = this.autoCodeObj.codeStandardID; |
| | | params.autoIncr = this.autoCodeObj.maxAutoIncr; |
| | | params.codeStandardID = this.autoCodeObj.codeStandardID |
| | | params.autoIncr = this.autoCodeObj.maxAutoIncr |
| | | } |
| | | requestUrl(params).then((res) => { |
| | | console.log(res) |
| | | this.editConfig.visible = false |
| | | if (res.code === 200) { |
| | | this.$message.success(this.editConfig.title === "新建"?'添加':'编辑'+'成功!') |
| | | this.$message.success(this.editConfig.title === "新建" ? "添加" : "编辑" + "成功!") |
| | | this.$parent.getData() |
| | | } |
| | | }, console.error) |