From 5ecb7958c96d3f0b6d47b79aff7eb306c2cf690f Mon Sep 17 00:00:00 2001 From: charles <981744753@qq.com> Date: 星期二, 06 八月 2024 11:16:58 +0800 Subject: [PATCH] gitlab上面的wms转移到公司git --- src/views/productManage/product/AddProductDialog.vue | 271 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 226 insertions(+), 45 deletions(-) diff --git a/src/views/productManage/product/AddProductDialog.vue b/src/views/productManage/product/AddProductDialog.vue index 6de1c2b..7e042ab 100644 --- a/src/views/productManage/product/AddProductDialog.vue +++ b/src/views/productManage/product/AddProductDialog.vue @@ -86,6 +86,7 @@ <el-input style="width: 85%" :disabled="!showFooter" + clearable v-model="editConfig.infomation.specs" placeholder="璇疯緭鍏�" ></el-input> @@ -95,6 +96,7 @@ v-model="editConfig.infomation.productType" placeholder="璇烽�夋嫨" size="mini" + clearable style="width: 85%" :disabled="!showFooter" > @@ -141,11 +143,12 @@ <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: calc(85% - 120px)" > <el-option v-for="ele in unitList" @@ -159,6 +162,12 @@ style="font-size: 20px; color: gray" @click="handleUnitShow" ></i> + <el-checkbox + class="margin_left_10px" + :disabled="editConfig.infomation.unit&&showFooter?false:true" + v-model="editConfig.infomation.moreUnit" + @change="moreUnitChange">鍚敤澶氬崟浣�</el-checkbox> + <!-- <span class="margin_left_10px cursor_pointer" @click="handleUnitMore">鍚敤澶氬崟浣�</span> --> </el-form-item> <el-form-item label="浜у搧鏍囩" prop="productTagName"> @@ -218,6 +227,8 @@ v-model="editConfig.infomation.categoryId" placeholder="璇烽�夋嫨" size="mini" + clearable + filterable style="width: 85%" :disabled="!showFooter" > @@ -234,6 +245,7 @@ <el-input style="width: 85%" :disabled="!showFooter" + filterable v-model="editConfig.infomation.type" placeholder="璇疯緭鍏�" ></el-input> @@ -255,9 +267,9 @@ :disabled="!showFooter" ></el-input> </el-form-item> - <el-form-item label="鏉$爜" prop="barcode"> + <el-form-item label="鏉$爜" prop="barCode"> <el-input - v-model.trim="editConfig.infomation.barcode" + v-model.trim="editConfig.infomation.barCode" placeholder="璇疯緭鍏�" size="mini" style="width: 85%" @@ -265,6 +277,23 @@ ></el-input> </el-form-item> </div> + </div> + <div class="dynamic-attribute"> + <el-form-item :label="attribute.name+':'" v-for="(attribute,index) in editConfig.attributeList" :key="attribute.id"> + <el-select v-if="attribute.dataType==3" v-model="attribute.value" style="width: 60%"> + <el-option v-for="ele in attribute.selectValues" :label="ele" :value="ele" :key="ele"></el-option> + </el-select> + <el-input + v-else + v-model.trim="attribute.value" + :type="attribute.dataType==2?'number':'text'" + :placeholder="`璇疯緭鍏�${attribute.name}`" + size="mini" + style="width: 60%" + :disabled="!showFooter" + ></el-input> + <el-button :disabled="editConfig.title==='鏌ョ湅'" size="mini" @click="deleteDynamicAttribute(index)" style="margin-left: 10px">鍒犻櫎</el-button> + </el-form-item> </div> <div class="all"> <!-- <div class="second-label">澶囨敞</div> --> @@ -305,7 +334,7 @@ v-model="editConfig.infomation.principal" placeholder="璇烽�夋嫨" size="mini" - style="width: 85%" + style="width: 88%" disabled > <el-option @@ -317,7 +346,7 @@ </el-option> </el-select> </el-form-item> - <el-form-item label="閲嶉噺" prop="weight" label-width="80px"> + <!-- <el-form-item label="閲嶉噺" prop="weight" label-width="80px"> <el-input-number v-model="editConfig.infomation.weight" placeholder="璇疯緭鍏�" @@ -328,7 +357,63 @@ :disabled="!showFooter" ></el-input-number> <span> kg</span> - </el-form-item> + </el-form-item> --> + <el-form-item label="姣涢噸" prop="grossWeight" label-width="80px"> + <el-col :span="15" + > + <el-input + v-model="editConfig.infomation.grossWeight" + placeholder="璇疯緭鍏�" + :disabled="!showFooter" + ></el-input> + </el-col> + <el-col :span="1"> </el-col> + <el-col :span="5"> + <el-select + v-model="editConfig.infomation.grossUnit" + placeholder="鍗曚綅" + filterable + :disabled="!showFooter" + style="width: 100%; float: right" + :popper-append-to-body="false" + > + <el-option + v-for="ele in grossUnitList" + :key="ele.id" + :label="ele.name" + :value="ele.name" + ></el-option> + </el-select> + </el-col> + </el-form-item> + <el-form-item label="鍑�閲�" prop="netWeight" label-width="80px"> + <el-col :span="15" + > + <el-input + v-model="editConfig.infomation.netWeight" + :disabled="!showFooter" + placeholder="璇疯緭鍏�" + ></el-input> + </el-col> + <el-col :span="1"> </el-col> + <el-col :span="5"> + <el-select + v-model="editConfig.infomation.netUnit" + placeholder="鍗曚綅" + filterable + :disabled="!showFooter" + style="width: 100%; float: right" + :popper-append-to-body="false" + > + <el-option + v-for="ele in grossUnitList" + :key="ele.id" + :label="ele.name" + :value="ele.name" + ></el-option> + </el-select> + </el-col> + </el-form-item> <el-form-item label="浣撶Н" prop="volume" label-width="80px"> <el-input-number v-model="editConfig.infomation.volume" @@ -537,26 +622,33 @@ <BomDialog ref="editDialog" :editRow="editRow" - @sucessSet="handleGetBomKindDictList" @handleConfirmSave="handleConfirmSave" :workList="unitList" title="璁¢噺鍗曚綅" ></BomDialog> + <UnitMoreDialog + ref="unitMoreDialog" + @saveUnitMore="saveUnitMore" + @cancelUnitMore='cancelUnitMore' + :workList="unitList" + :unitRight='editConfig.infomation.unit' + :dataList="editConfig.infomation.moreUnitList" + title="鍚敤澶氬崟浣�" + ></UnitMoreDialog> </div> </template> <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"; import {getUnitInfo, } from "@/api/basic/standard"; // import { postGetSaveSUnitDict } from "@/api/basic/standard"; - - +import UnitMoreDialog from "./components/UnitMoreDialog"; export default { mixins: [codeMixin], name: "AddProductDialog", @@ -576,6 +668,7 @@ components: { IconCropper, BomDialog, + UnitMoreDialog, }, computed: { modalTitle() { @@ -597,9 +690,31 @@ 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" }] + purchaseTypeList: [{ required: true, message: "璇烽�夋嫨", trigger: "blur" }], + netWeight: [ + { + required: false, + message: "璇峰~鍐�", + trigger: "change", + }, + { + validator: this.validatorNumFour, + trigger: "blur", + }, + ], + grossWeight: [ + { + required: false, + message: "璇峰~鍐�", + trigger: "change", + }, + { + validator: this.validatorNumFour, + trigger: "blur", + }, + ], }, memberOptions: [], productCategoryOptions: [], // 浜у搧绫诲埆 @@ -657,6 +772,7 @@ isView: false, fileFormdata: null, // 涓婁紶鍥剧墖鍏ュ弬 bomPurchaseTypeList: getDataByType("purchaseType"), + grossUnitList:getDataByType("grossUnit"), unitList: [], editRow:{ editDialogVisible:false, @@ -683,43 +799,82 @@ this.formInfo() this.getUserInfo() this.getUnitInfo() + //this.queryAttribute() }, methods: { + deleteDynamicAttribute(index){ + this.editConfig.attributeList.splice(index,1); + }, + + validatorNumFour(rule, value, callback) { + if (value != "") { + if (value == undefined || value == null) { + callback(new Error("璇疯緭鍏ユ湁鏁堟暟瀛�")); + } else { + let reg2 = + /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/; + if (!reg2.test(value) || value == 0) { + callback(new Error("璇峰~鍐欏ぇ浜庨浂鐨�2浣嶅皬鏁扮殑鏁板瓧")); + } else { + callback(); + } + } + } else { + callback(); + } + }, // 鍗曚綅 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; - // } - // } - // } - // }); + // 鍚敤澶氬崟浣� + handleUnitMore(){ + if(this.editConfig.infomation.unit){ + this.$refs.unitMoreDialog.editDialogVisible = true; + }else{ + this.$message.error('璇峰厛閫夋嫨鍗曚綅锛�') + } }, - 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(); - // } - // }); + saveUnitMore(list){ + this.editConfig.infomation.moreUnit=true + this.editConfig.infomation.moreUnitList=list + }, + cancelUnitMore(){ + this.editConfig.infomation.moreUnit=false + }, + // 鍚敤澶氬崟浣嶇殑寮�鍏� + moreUnitChange(){ + // let string=false; + if(this.editConfig.infomation.unit){ + // if(this.editConfig.infomation.moreUnitList&&this.editConfig.infomation.moreUnitList.length>0){ + // for(let i in this.editConfig.infomation.moreUnitList){ + // if(this.editConfig.infomation.moreUnitList[i].unit&&this.editConfig.infomation.moreUnitList[i].amount){ + // string=true; + // break; + // } + // } + // } + if(this.editConfig.infomation.moreUnit){ + // this.editConfig.infomation.moreUnit=false + // this.$message.error('璇峰厛閰嶇疆澶氬崟浣嶏紒') + this.$refs.unitMoreDialog.editDialogVisible = true; + } + }else{ + this.editConfig.infomation.moreUnit=false + this.$message.error('璇峰厛閫夋嫨鍗曚綅锛�') + } + + }, + handleConfirmSave(dataList) { + saveUnitDict({ data: dataList }).then((res) => { + if (res.code == 200) { + this.$message({ + message: "鎿嶄綔鎴愬姛锛�", + type: "success", + }); + this.getUnitInfo() + } + }); this.editRow.editDialogVisible = false; }, @@ -860,6 +1015,12 @@ params.codeStandardID = this.autoCodeObj.codeStandardID params.autoIncr = this.autoCodeObj.maxAutoIncr } + if(params.moreUnitList&¶ms.moreUnitList.length>0){ + for(let i in params.moreUnitList){ + params.moreUnitList[i].amount=Number(params.moreUnitList[i].amount) + } + } + params.attributes=this.editConfig.attributeList||[]; requestUrl(params).then((res) => { console.log(res) this.editConfig.visible = false @@ -1000,11 +1161,21 @@ 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 }) } } @@ -1013,6 +1184,16 @@ <!-- Add "scoped" attribute to limit CSS to this component only --> <style lang="scss" scoped> + .dynamic-attribute{ + display:flex; + flex-wrap: wrap; + flex: 1; + ::v-deep{ + .el-form-item{ + width: 50%; + } + } + } .dialog-header { display: flex; align-items: center; -- Gitblit v1.8.0