From 62dd7a29fb929865cfcd72e8412beb3b5d41a7fc Mon Sep 17 00:00:00 2001 From: zzq <a13193816592@163.com> Date: 星期四, 28 九月 2023 15:25:09 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/zzq' --- src/views/productManage/product/AddProductDialog.vue | 956 ++++++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 610 insertions(+), 346 deletions(-) diff --git a/src/views/productManage/product/AddProductDialog.vue b/src/views/productManage/product/AddProductDialog.vue index 7320da8..d92daeb 100644 --- a/src/views/productManage/product/AddProductDialog.vue +++ b/src/views/productManage/product/AddProductDialog.vue @@ -18,7 +18,14 @@ <i class="el-icon-s-tools"></i> <span>鍔ㄤ綔</span> </span> - <el-button v-if="showEdit" plain size="mini" style="margin-left: 15px" @click="editClick">缂栬緫</el-button> + <el-button + v-if="showEdit" + plain + size="mini" + style="margin-left: 15px" + @click="editClick" + >缂栬緫</el-button + > </div> </div> <!-- 鍐呭 --> @@ -36,209 +43,241 @@ <el-button plain size="mini" disabled>鏇存柊鏁伴噺</el-button> <el-button plain size="mini" disabled>鎵ц琛ヨ揣</el-button> </div> - <div class="basic-info"> - <div class="content-number"> - <div class="sub-number"> - <div class="left"><i class="el-icon-s-fold"></i></div> - <div class="right"> - <div class="right-label">{{ 0 }}</div> - <div class="right-label">棰濆鐨勪环鏍�</div> - </div> - </div> - <div class="sub-number"> - <div class="left"><i class="el-icon-present"></i></div> - <div class="right"> - <div class="right-label">{{ "0.00" + "浠�" }}</div> - <div class="right-label">鍦ㄦ墜</div> - </div> - </div> - <div class="sub-number"> - <div class="left"><i class="el-icon-present"></i></div> - <div class="right"> - <div class="right-label">{{ "0.00" + "浠�" }}</div> - <div class="right-label">棰勬祴</div> - </div> - </div> - <div class="sub-number" @click="inOutBoundClick" style="cursor: pointer"> - <div class="left icon-view"><i class="el-icon-sort"></i></div> - <div class="right"> - <div class="right-label">{{ "杩�: " + 0 }}</div> - <div class="right-label">{{ "鍑�: " + 0 }}</div> - </div> - </div> - <div class="sub-number"> - <div class="left"><i class="el-icon-refresh"></i></div> - <div class="right"> - <div class="right-label">{{ 0 }}</div> - <div class="right-label">閲嶈璐ц鍒�</div> - </div> - </div> - <div class="sub-number"> - <div class="left"><i class="el-icon-help"></i></div> - <div class="right"> - <div class="right-one">涓婃灦瑙勫垯</div> - </div> - </div> - <div class="sub-number"> - <div class="left"><i class="el-icon-s-data"></i></div> - <div class="right"> - <div class="right-label">{{ "0.00" + "浠�" }}</div> - <div class="right-label">宸插敭</div> - </div> - </div> - <div class="sub-number"> - <div class="left"><i class="el-icon-bank-card"></i></div> - <div class="right"> - <div class="right-label">{{ "0.00" + "浠�" }}</div> - <div class="right-label">宸查噰璐�</div> - </div> - </div> - </div> + <FormBtnsView + :add-product="addProduct" + @inOutBoundClick="inOutBoundClick" + :show-procure="showProcure" + :show-sale="showSale" + /> <div class="basic-info-view"> <el-row> - <el-col :span="20"> - <div style="margin-left: 20px">浜у搧鍚嶇О</div> - <el-form-item label="" prop="client_name" label-width="20px"> + <el-col :span="23"> + <div style="margin-left: 20px"> + <span style="color: #f56c6c">*</span>浜у搧鍚嶇О + </div> + <el-form-item label="" prop="name" label-width="20px"> <el-input - v-model="editConfig.infomation.client_name" + v-model="editConfig.infomation.name" placeholder="" :disabled="!showFooter" ></el-input> </el-form-item> </el-col> - <el-col :span="4"> + <!-- <el-col :span="4"> <div class="upload" @click="toGetImg"> <img v-if="imageSrc" :src="imageSrc" style="height: 90px; width: 90px" /> <div v-else class="upload-icon"><i class="el-icon-plus"></i></div> </div> - </el-col> - <el-col :span="24"> - <div style="margin-left: 20px; margin-top: -30px"> - <el-checkbox v-model="marketable" :disabled="!showFooter">鍙攢鍞�</el-checkbox> - <el-checkbox v-model="procurable" :disabled="!showFooter">鍙噰璐�</el-checkbox> + </el-col> --> + <!-- <el-col :span="24"> + <div style="margin-left: 20px"> + <el-checkbox v-model="marketable" :disabled="!showFooter" @change="checkboxChange('閿�鍞�', $event)" + >鍙攢鍞�</el-checkbox + > + <el-checkbox v-model="procurable" :disabled="!showFooter" @change="checkboxChange('閲囪喘', $event)" + >鍙噰璐�</el-checkbox + > </div> - </el-col> + </el-col> --> </el-row> </div> <div class="bottom"> <el-tabs v-model="activeName" type="card"> <el-tab-pane label="鍩烘湰淇℃伅" name="first"></el-tab-pane> - <el-tab-pane label="閲囪喘" name="second"></el-tab-pane> + <!-- <el-tab-pane label="閿�鍞�" name="sale"></el-tab-pane> + <el-tab-pane label="閲囪喘" name="second"></el-tab-pane> --> <el-tab-pane label="搴撳瓨" name="third"></el-tab-pane> - <el-tab-pane label="浼氳" name="four"></el-tab-pane> + <!-- <el-tab-pane label="浼氳" name="four"></el-tab-pane> --> </el-tabs> <!-- 鍩烘湰淇℃伅 --> <div v-if="activeName === 'first'"> <div class="purchase-view"> <div class="left"> - <el-form-item label="浜у搧绫诲瀷" prop="client_name" style="margin-left: 20px"> + <el-form-item + label="浜у搧绫诲瀷" + prop="productType" + style="margin-left: 20px" + > <el-select - v-model="editConfig.infomation.memberId" + v-model="editConfig.infomation.productType" placeholder="璇烽�夋嫨" size="mini" style="width: 85%" :disabled="!showFooter" > - <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> + <el-option + v-for="item in productTypeOptions" + :key="item.id" + :label="item.name" + :value="item.id" + > </el-option> </el-select> </el-form-item> - <el-form-item label="寮�绁ㄧ瓥鐣�" prop="client_name" style="margin-left: 20px"> + <el-form-item + label="寮�绁ㄧ瓥鐣�" + prop="invoicingStrategy" + style="margin-left: 20px" + > <el-select - v-model="editConfig.infomation.memberId" + v-model="editConfig.infomation.invoicingStrategy" placeholder="璇烽�夋嫨" size="mini" style="width: 85%" :disabled="!showFooter" > - <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> + <el-option + v-for="item in strategyOptions" + :key="item.id" + :label="item.name" + :value="item.id" + > + </el-option> + </el-select> + <div class="font_size_13" style="color: gray"> + 鍙偍瀛樼殑浜у搧鏄偍绠$悊搴撳瓨姘村钩鐨勫疄鐗╅」鐩�� + </div> + <div class="font_size_13" style="color: gray"> + 鎮ㄥ彲浠ュ湪鍙戣揣鍓嶄负鍏跺紑鍏风粨绠楀崟銆� + </div> + </el-form-item> + <el-form-item + label="鐗╂枡绫诲瀷" + prop="model" + style="margin-left: 20px" + > + <el-select + v-model="editConfig.infomation.model" + placeholder="璇烽�夋嫨" + filterable + clearable + style="width: 85%" + :popper-append-to-body="false" + :disabled="!showFooter" + > + <el-option + v-for="item in materialTypeList" + :key="item.id" + :label="item.name" + :value="item.id" + > </el-option> </el-select> </el-form-item> - <el-form-item label="浜у搧绫诲埆" prop="client_name" style="margin-left: 20px"> - <el-select - v-model="editConfig.infomation.memberId" - placeholder="璇烽�夋嫨" - size="mini" + <el-form-item + label="鍗曚綅" + prop="unit" + style="margin-left: 20px" + > + <el-input + v-model="editConfig.infomation.unit" + placeholder="璇疯緭鍏�" style="width: 85%" :disabled="!showFooter" - > - <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> - </el-option> - </el-select> + ></el-input> </el-form-item> - <el-form-item label="浜у搧鏍囩" prop="client_name" style="margin-left: 20px"> - <el-select - v-model="editConfig.infomation.memberId" - placeholder="璇烽�夋嫨" - size="mini" + <el-form-item + label="浜у搧鏍囩" + prop="productTagName" + style="margin-left: 20px" + > + <el-input + v-model="editConfig.infomation.productTagName" + placeholder="璇疯緭鍏�" style="width: 85%" :disabled="!showFooter" - > - <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> - </el-option> - </el-select> - </el-form-item> - <el-form-item label="鍏徃" prop="client_name" style="margin-left: 20px"> - <el-select - v-model="editConfig.infomation.memberId" - placeholder="璇烽�夋嫨" - size="mini" - style="width: 85%" - :disabled="!showFooter" - > - <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> - </el-option> - </el-select> + ></el-input> </el-form-item> </div> <div class="right"> - <el-form-item label="閿�鍞环鏍�" prop="name" style="margin-left: 20px"> + <el-form-item + label="閿�鍞环鏍�" + prop="salePrice" + style="margin-left: 20px" + > <span>锟�</span> - <el-input - v-model.trim="editConfig.infomation.name" + <el-input-number + v-model.trim="editConfig.infomation.salePrice" placeholder="璇疯緭鍏�" + :min="0" + :controls="false" size="mini" - style="width: 85%" + style="width: 81%" :disabled="!showFooter" - ></el-input> + ></el-input-number> </el-form-item> - <el-form-item label="閿�椤圭◣" prop="client_name" style="margin-left: 20px"> + <el-form-item + label="閿�椤圭◣" + prop="customerTaxes" + style="margin-left: 20px" + > + <el-input-number + v-model="editConfig.infomation.customerTaxes" + placeholder="璇疯緭鍏�" + :min="0" + :controls="false" + style="width: 85%; margin-right: 5px" + :disabled="!showFooter" + ></el-input-number> + </el-form-item> + <el-form-item + label="鎴愭湰" + prop="cost" + style="margin-left: 20px" + > + <span>锟�</span> + <el-input-number + v-model.trim="editConfig.infomation.cost" + placeholder="璇疯緭鍏�" + :min="0" + :controls="false" + size="mini" + style="width: 81%" + :disabled="!showFooter" + ></el-input-number> + </el-form-item> + <el-form-item + label="浜у搧绫诲埆" + prop="categoryId" + style="margin-left: 20px" + > <el-select - v-model="editConfig.infomation.memberId" - multiple + v-model="editConfig.infomation.categoryId" placeholder="璇烽�夋嫨" size="mini" style="width: 85%" :disabled="!showFooter" > - <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> + <el-option + v-for="item in productCategoryOptions" + :key="item.id" + :label="item.name" + :value="item.id" + > </el-option> </el-select> </el-form-item> - <el-form-item label="鎴愭湰" prop="name" style="margin-left: 20px"> - <span>锟�</span> + <el-form-item + label="鍐呴儴鍙傝��" + prop="internalReference" + style="margin-left: 20px" + > <el-input - v-model.trim="editConfig.infomation.name" + v-model.trim="editConfig.infomation.internalReference" placeholder="璇疯緭鍏�" size="mini" style="width: 85%" :disabled="!showFooter" ></el-input> </el-form-item> - <el-form-item label="鍐呴儴鍙傝��" prop="name" style="margin-left: 20px"> + <el-form-item + label="鏉$爜" + prop="barcode" + style="margin-left: 20px" + > <el-input - v-model.trim="editConfig.infomation.name" - placeholder="璇疯緭鍏�" - size="mini" - style="width: 85%" - :disabled="!showFooter" - ></el-input> - </el-form-item> - <el-form-item label="鏉$爜" prop="name" style="margin-left: 20px"> - <el-input - v-model.trim="editConfig.infomation.name" + v-model.trim="editConfig.infomation.barcode" placeholder="璇疯緭鍏�" size="mini" style="width: 85%" @@ -249,21 +288,260 @@ </div> <div class="all"> <div class="second-label">鍐呴儴璇存槑</div> - <el-form-item label="" prop="name" style="margin-left: 20px" label-width="0px"> + <el-form-item + label="" + prop="internalNotes" + style="margin-left: 20px" + label-width="0px" + > <el-input - v-model.trim="editConfig.infomation.desc" + v-model.trim="editConfig.infomation.internalNotes" placeholder="璇疯緭鍏�" size="mini" type="textarea" - style="width: 100%" + style="width: 95%" :autosize="{ minRows: 4 }" :disabled="!showFooter" ></el-input> </el-form-item> </div> </div> + <!-- 搴撳瓨 --> + <div v-if="activeName === 'third'"> + <div class="purchase-view"> + <div class="all"> + <div class="second-label">鐗╂祦</div> + </div> + </div> + <div class="purchase-view"> + <!-- <div class="left"> + <div class="second-label">鎿嶄綔</div> + <el-form-item label="璺嚎" prop="checkedRoute" style="margin-left: 20px"> + <el-checkbox-group v-model="checkedRoute" :min="1" :max="2"> + <el-checkbox v-for="city in route" :label="city" :key="city" class="list-item">{{ + city.length > 20 ? city.substring(0, 20) + "..." : city + }}</el-checkbox> + </el-checkbox-group> + </el-form-item> + </div> --> + <div class="left"> + <el-form-item + label="璐熻矗浜�" + prop="principal" + style="margin-left: 20px" + label-width="80px" + > + <el-select + v-model="editConfig.infomation.principal" + placeholder="璇烽�夋嫨" + size="mini" + style="width: 85%" + :disabled="!showFooter" + > + <el-option + v-for="item in memberOptions" + :key="item.id" + :label="item.name" + :value="item.name" + > + </el-option> + </el-select> + </el-form-item> + <el-form-item + label="閲嶉噺" + prop="weight" + style="margin-left: 20px" + label-width="80px" + > + <el-input-number + v-model="editConfig.infomation.weight" + placeholder="璇疯緭鍏�" + :min="0" + :precision="2" + :controls="false" + style="width: 85%" + :disabled="!showFooter" + ></el-input-number> + <span> kg</span> + </el-form-item> + <el-form-item + label="浣撶Н" + prop="volume" + style="margin-left: 20px" + label-width="80px" + > + <el-input-number + v-model="editConfig.infomation.volume" + placeholder="璇疯緭鍏�" + :min="0" + :precision="2" + :controls="false" + style="width: 85%" + :disabled="!showFooter" + ></el-input-number> + <span> m鲁</span> + </el-form-item> + </div> + <div class="right"> + <el-form-item + label="鍒堕�犲墠缃椂闂�" + prop="makeAdvanceTime" + style="margin-left: 20px" + label-width="130px" + > + <el-input-number + v-model="editConfig.infomation.makeAdvanceTime" + placeholder="璇疯緭鍏�" + :min="0" + :precision="0" + :controls="false" + style="width: 85%" + :disabled="!showFooter" + ></el-input-number> + <span> 澶╂暟</span> + </el-form-item> + <el-form-item + label="鐢熶骇璁㈠崟鍑嗗澶╂暟" + prop="orderAdvanceTime" + style="margin-left: 20px" + label-width="130px" + > + <el-input-number + v-model="editConfig.infomation.orderAdvanceTime" + placeholder="璇疯緭鍏�" + :min="0" + :precision="0" + :controls="false" + style="width: 85%" + :disabled="!showFooter" + ></el-input-number> + <span> 澶╂暟</span> + </el-form-item> + <el-form-item + label="瀹㈡埛鍓嶇疆鏃堕棿" + prop="deliveryAdvanceTime" + style="margin-left: 20px" + label-width="130px" + > + <el-input-number + v-model="editConfig.infomation.deliveryAdvanceTime" + placeholder="璇疯緭鍏�" + :min="0" + :precision="0" + :controls="false" + style="width: 85%" + :disabled="!showFooter" + ></el-input-number> + <span> 澶�</span> + </el-form-item> + </div> + </div> + <div class="purchase-view"> + <div class="left"> + <div class="second-label">鏀惰揣璇存槑</div> + <el-form-item + label="" + prop="inStorageExplain" + style="margin-left: 20px" + label-width="0px" + > + <el-input + v-model.trim="editConfig.infomation.inStorageExplain" + placeholder="姝よ鏄庢坊鍔犲埌鏀惰揣璁㈠崟涓�(渚嬪锛屼骇鍝佸湪浠撳簱鐨勫瓨鍌ㄤ綅缃�)" + size="mini" + type="textarea" + style="width: 95%" + :autosize="{ minRows: 4 }" + :disabled="!showFooter" + ></el-input> + </el-form-item> + </div> + <div class="right"> + <div class="second-label">鍑哄簱鍗曡鏄�</div> + <el-form-item + label="" + prop="outStorageExplain" + style="margin-left: 20px" + label-width="0px" + > + <el-input + v-model.trim="editConfig.infomation.outStorageExplain" + placeholder="姝ら�氱煡宸叉坊鍔犲埌閫佽揣鍗曚腑" + size="mini" + type="textarea" + style="width: 95%" + :autosize="{ minRows: 4 }" + :disabled="!showFooter" + ></el-input> + </el-form-item> + </div> + </div> + <div class="purchase-view"> + <div class="left"> + <div class="second-label">鍐呴儴璋冩嫧璇存槑</div> + <el-form-item + label="" + prop="internalTransferExplain" + style="margin-left: 20px" + label-width="0px" + > + <el-input + v-model.trim=" + editConfig.infomation.internalTransferExplain + " + placeholder="姝よ鏄庢坊鍔犲埌鍐呴儴璋冩嫧璁㈠崟涓�(渚嬪锛屽湪浠撳簱涓綍澶勬彁鍙栦骇鍝�)" + size="mini" + type="textarea" + style="width: 100%" + :autosize="{ minRows: 4 }" + :disabled="!showFooter" + ></el-input> + </el-form-item> + </div> + <div class="right"></div> + </div> + </div> + <!-- 涓嬮潰涓嶈鍒� 浜屾湡鎴栦笁鏈熶細鐢ㄥ埌 --> + <!-- 閿�鍞� --> + <!-- <div v-if="activeName === 'sale'"> + <div class="purchase-view"> + <div class="left"> + <div class="second-label">{{ "鍔犲敭&浜ゅ弶閿�鍞�" }}</div> + <el-form-item label="鍙�変骇鍝�" prop="selectProduct" style="margin-left: 20px"> + <el-select + v-model="editConfig.infomation.selectProduct" + multiple + placeholder="璇烽�夋嫨" + size="mini" + style="width: 85%" + :disabled="!showFooter" + > + <el-option + v-for="item in selectProductOptions" + :key="item.id" + :label="item.name" + :value="item.id" + > + </el-option> + </el-select> + </el-form-item> + <div class="second-label">閿�鍞鏄�</div> + <el-form-item label="" prop="sellExplain" style="margin-left: 20px" label-width="20px"> + <el-input + v-model.trim="editConfig.infomation.sellExplain" + size="mini" + type="textarea" + style="width: 85%" + :autosize="{ minRows: 2 }" + :disabled="!showFooter" + ></el-input> + </el-form-item> + </div> + <div class="right"></div> + </div> + </div> --> <!-- 閲囪喘 --> - <div v-if="activeName === 'second'"> + <!-- <div v-if="activeName === 'second'"> <CommonFormTableView :product-table-list="productTableList" :detail-enter="!showFooter" @@ -318,153 +596,33 @@ </el-form-item> </div> </div> - </div> - <!-- 搴撳瓨 --> - <div v-if="activeName === 'third'"> - <div class="purchase-view"> - <div class="left"> - <div class="second-label">浣滀笟</div> - <el-form-item label="璺嚎" prop="checkedCities" style="margin-left: 20px"> - <el-checkbox-group v-model="checkedCities" :min="1" :max="2"> - <el-checkbox v-for="city in cities" :label="city" :key="city" class="list-item">{{ - city.length > 20 ? city.substring(0, 20) + "..." : city - }}</el-checkbox> - </el-checkbox-group> - </el-form-item> - </div> - <div class="right"> - <div class="second-label">鐗╂祦</div> - <el-form-item label="璐熻矗浜�" prop="name" style="margin-left: 20px"> - <el-select - v-model="editConfig.infomation.memberId" - multiple - placeholder="璇烽�夋嫨" - size="mini" - style="width: 85%" - :disabled="!showFooter" - > - <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> - </el-option> - </el-select> - </el-form-item> - <el-form-item label="閲嶉噺" prop="client_name" style="margin-left: 20px"> - <el-input - v-model.trim="editConfig.infomation.name" - placeholder="璇疯緭鍏�" - size="mini" - style="width: 85%" - :disabled="!showFooter" - ></el-input> - <span> kg</span> - </el-form-item> - <el-form-item label="浣撶Н" prop="client_name" style="margin-left: 20px"> - <el-input - v-model.trim="editConfig.infomation.name" - placeholder="璇疯緭鍏�" - size="mini" - style="width: 85%" - :disabled="!showFooter" - ></el-input> - <span> m鲁</span> - </el-form-item> - <el-form-item label="瀹㈡埛鍓嶇疆鏃堕棿" prop="client_name" style="margin-left: 20px"> - <el-input - v-model.trim="editConfig.infomation.name" - placeholder="璇疯緭鍏�" - size="mini" - style="width: 85%" - :disabled="!showFooter" - ></el-input> - <span> 澶�</span> - </el-form-item> - <el-form-item label="HS缂栫爜" prop="name" style="margin-left: 20px"> - <el-input - v-model.trim="editConfig.infomation.name" - placeholder="璇疯緭鍏�" - size="mini" - style="width: 85%" - :disabled="!showFooter" - ></el-input> - </el-form-item> - <el-form-item label="璐х墿鍘熶骇鍦�" prop="name" style="margin-left: 20px"> - <el-select - v-model="editConfig.infomation.memberId" - multiple - placeholder="璇烽�夋嫨" - size="mini" - style="width: 85%" - :disabled="!showFooter" - > - <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id"> - </el-option> - </el-select> - </el-form-item> - </div> - </div> - <div class="purchase-view"> - <div class="left"> - <div class="second-label">鏀惰揣璇存槑</div> - <el-form-item label="" prop="name" style="margin-left: 20px" label-width="0px"> - <el-input - v-model.trim="editConfig.infomation.desc" - placeholder="姝よ鏄庢坊鍔犲埌鏀惰揣璁㈠崟涓�" - size="mini" - type="textarea" - style="width: 100%" - :autosize="{ minRows: 4 }" - :disabled="!showFooter" - ></el-input> - </el-form-item> - </div> - <div class="right"> - <div class="second-label">鍑哄簱鍗曡鏄�</div> - <el-form-item label="" prop="name" style="margin-left: 20px" label-width="0px"> - <el-input - v-model.trim="editConfig.infomation.desc" - placeholder="璇疯緭鍏�" - size="mini" - type="textarea" - style="width: 100%" - :autosize="{ minRows: 4 }" - :disabled="!showFooter" - ></el-input> - </el-form-item> - </div> - </div> - <div class="purchase-view"> - <div class="left"> - <div class="second-label">鍐呴儴璋冩嫧璇存槑</div> - <el-form-item label="" prop="name" style="margin-left: 20px" label-width="0px"> - <el-input - v-model.trim="editConfig.infomation.desc" - placeholder="璇疯緭鍏�" - size="mini" - type="textarea" - style="width: 100%" - :autosize="{ minRows: 4 }" - :disabled="!showFooter" - ></el-input> - </el-form-item> - </div> - <div class="right"></div> - </div> - </div> + </div> --> </div> </div> </el-form> <!-- 灏� --> <div v-if="showFooter" 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> - <el-button size="small" @click="editConfig.visible = false">鍙栨秷</el-button> + <el-button type="primary" size="small" @click="saveClick('form')" + >淇濆瓨</el-button + > + <el-button size="small" @click="editConfig.visible = false" + >鍙栨秷</el-button + > </div> </el-dialog> </div> </template> <script> -import CommonFormTableView from "@/components/makepager/CommonFormTableView" -let inputElement = null +// import CommonFormTableView from "@/components/makepager/CommonFormTableView" +import { getProductCategoryList } from "@/api/product/productCategory"; +import { + getProductList, + addProduct, + updateProduct, +} from "@/api/product/product"; + +let inputElement = null; export default { name: "AddProductDialog", props: { @@ -474,36 +632,43 @@ return { visible: false, title: "鏂板缓", - infomation: { type: [] } - } - } - } + infomation: {}, + }; + }, + }, }, - components: { CommonFormTableView }, + components: {}, computed: {}, data() { return { dialogWidth: "50%", editConfig: this.editCommonConfig, rules: { - client_name: [{ required: true, message: "璇烽�夋嫨瀹㈡埛鍚嶇О", trigger: "change" }], - number: [{ required: true, message: "璇疯緭鍏ラ��娆惧崟缂栧彿", trigger: "blur" }], - refundDate: [{ required: true, message: "璇烽�夋嫨閫�娆炬棩鏈�", trigger: "change" }], - memberId: [{ required: true, message: "璇烽�夋嫨閿�鍞礋璐d汉", trigger: "change" }], - sale_return_nunber: [{ required: true, message: "璇烽�夋嫨閿�鍞��璐у崟", trigger: "change" }] + name: [{ required: true, message: "璇疯緭鍏ヤ骇鍝佸悕绉�", trigger: "blur" }], + model: [ + { required: true, message: "璇烽�夋嫨鐗╂枡绫诲瀷", trigger: "change" }, + ], + salePrice: [ + { required: true, message: "璇疯緭鍏ラ攢鍞环鏍�", trigger: "blur" }, + ], + unit: [{ required: true, message: "璇疯緭鍏ュ崟浣�", trigger: "blur" }], }, - memberOptions: [], - paymentTypeListOptions: [], - numberList: [ - { label: "鑽夌", status: "todo" }, - { label: "姝e湪绛夊緟", status: "todo" }, - { label: "灏辩华", status: "todo" }, - { label: "瀹屾垚", status: "todo" } - ], + memberOptions: [{ name: "绠$悊鍛�", id: 1 }], + productCategoryOptions: [], // 浜у搧绫诲埆 + productTypeOptions: [ + { name: "鑳芥秷鑰�", id: 1 }, + { name: "鏈嶅姟", id: 2 }, + { name: "鍙簱瀛樹骇鍝�", id: 3 }, + ], // 浜у搧绫诲瀷 + strategyOptions: [ + { name: "璁㈣喘鏁伴噺", id: 1 }, + { name: "浜や粯鏁伴噺", id: 2 }, + ], // 寮�绁ㄧ瓥鐣� + selectProductOptions: [], // 鍙�変骇鍝� showButton: true, activeName: "first", productTableList: {}, - tableData: [{ name: "ssss" }], + tableData: [], isNoProduct: false, // 娣诲姞鏄庣粏琛屾椂鏄惁鏈変骇鍝佹湭閫夋嫨 showEdit: false, // 鏄惁鏄剧ず缂栬緫鎸夐挳 isDelClick: false, // 鍒犻櫎鎸夐挳鏄惁鍙偣鍑� @@ -511,39 +676,102 @@ imageSrc: "", // 鍥剧墖鍦板潃 marketable: true, // 鍙攢鍞� procurable: true, // 鍙噰璐� - checkedCities: ["涓婃捣", "鍖椾含"], - cities: ["涓婃捣瀵瑰瀵瑰瀵瑰澶氬澶氬澶氬澶氬寳浜瀵瑰瀵瑰瀵�", "鍖椾含瀵瑰瀵瑰瀵瑰澶�", "骞垮窞", "娣卞湷"] - } + checkedRoute: [], + route: ["鍒堕��", "娌虫睜鐢熶骇鍒堕�犱粨"], + addProduct: false, + showProcure: true, + showSale: true, + materialTypeList: [ + { name: "鍘熸潗鏂�", id: "鍘熸潗鏂�" }, + { name: "鍗婃垚鍝�", id: "鍗婃垚鍝�" }, + { name: "鎴愬搧", id: "鎴愬搧" }, + { name: "杈呮枡", id: "杈呮枡" }, + { name: "鑰楁潗", id: "鑰楁潗" }, + { name: "鍏朵粬", id: "鍏朵粬" }, + ], + }; }, created() { - this.setTableForm() - this.setBottonView() + this.getProductCategoryList(); + this.getProductList(); + this.setTableForm(); + this.setBottonView(); }, methods: { + // 鑾峰彇浜у搧绫诲埆 + async getProductCategoryList() { + await getProductCategoryList({ + keyWord: "", + page: 0, + pageSize: 0, + }).then((res) => { + if (res.code === 200) { + this.productCategoryOptions = res.data; + } + }); + }, + // 鑾峰彇鍙�変骇鍝� + async getProductList() { + await getProductList({ + keyWord: "", + page: 1, + pageSize: 20, + }).then((res) => { + if (res.code === 200) { + const list = res.data.map((item) => { + return { + id: item.id, + name: item.name, + }; + }); + this.selectProductOptions = list || []; + } + }); + }, // 璁剧疆鍒犻櫎/鎵撳嵃/缂栬緫鏄惁鏄剧ず setBottonView() { if (this.editConfig.title === "鏂板缓") { - this.showButton = false - this.showEdit = false - this.showFooter = true + this.showButton = false; + this.showEdit = false; + this.showFooter = true; + this.addProduct = true; } else { - this.showEdit = true - this.showFooter = false + this.showEdit = true; + this.showFooter = false; + this.addProduct = false; } }, // 鍏抽棴 handleClose() { - this.editConfig.visible = false + this.editConfig.visible = false; }, // 缂栬緫 editClick() { - this.showEdit = false - this.showButton = false - this.showFooter = true - this.setTableForm() + this.showEdit = false; + this.showButton = false; + this.showFooter = true; + this.setTableForm(); }, // 淇濆瓨 - saveClick() {}, + saveClick(formName) { + console.log(this.editConfig.infomation); + this.$refs[formName].validate((valid) => { + if (valid) { + let requestUrl = + this.editConfig.title === "鏂板缓" ? addProduct : updateProduct; + requestUrl({ + ...this.editConfig.infomation, + }).then((res) => { + console.log(res); + this.editConfig.visible = false; + if (res.code === 200) { + this.$message.success("娣诲姞鎴愬姛"); + this.$parent.getData(); + } + }); + } + }); + }, // 鍒犻櫎 delClick() {}, setTableForm() { @@ -558,33 +786,33 @@ { label: "鍏徃", prop: "total", select: true }, { label: "鏁伴噺", prop: "total", inputFloat: true }, { label: "浠锋牸", prop: "price", inputFloat: true }, - { label: "甯佺", prop: "total", select: true } + { label: "甯佺", prop: "total", select: true }, // { label: "浜よ揣鎻愬墠鏃堕棿", prop: "total", inputNumber: true } - ] - } + ], + }; }, // 浜у搧鍒楄〃杈撳叆 inputContent(val, prop, row) { - this.productId = row.productId + this.productId = row.productId; this.tableData.map((item) => { if (item.productId === row.productId) { - item[prop] = val + item[prop] = val; } - }) + }); }, // 浜у搧鏂板 addProductClick() { - console.log(this.tableData) + console.log(this.tableData); for (let i = 0; i < this.tableData.length; i++) { if (this.tableData[i].name.length === 0) { - this.isNoProduct = true - break + this.isNoProduct = true; + break; } else { - this.isNoProduct = false + this.isNoProduct = false; } } if (!this.isNoProduct) { - this.productId++ + this.productId++; this.tableData.push({ productId: this.productId, id: 0, @@ -593,67 +821,96 @@ name: "", number: "", price: 0, - total: 0 - }) + total: 0, + }); } }, // 浜у搧鍒犻櫎 handleDelClick(scope) { - console.log(scope) - this.tableData.splice(scope.$index, 1) + console.log(scope); + this.tableData.splice(scope.$index, 1); }, // 涓婁紶鍥剧墖 toGetImg() { if (this.showFooter) { if (inputElement === null) { // 鐢熸垚鏂囦欢涓婁紶鐨勬帶浠� - inputElement = document.createElement("input") - inputElement.setAttribute("type", "file") - inputElement.style.display = "none" + inputElement = document.createElement("input"); + inputElement.setAttribute("type", "file"); + inputElement.style.display = "none"; if (window.addEventListener) { - inputElement.addEventListener("change", this.uploadFile, false) + inputElement.addEventListener("change", this.uploadFile, false); } else { - inputElement.attachEvent("onchange", this.uploadFile) + inputElement.attachEvent("onchange", this.uploadFile); } - document.body.appendChild(inputElement) + document.body.appendChild(inputElement); } - inputElement.click() + inputElement.click(); } }, uploadFile(el) { if (el && el.target && el.target.files && el.target.files.length > 0) { - console.log(el) - const files = el.target.files[0] - const isLt2M = files.size / 1024 / 1024 < 2 - const size = files.size / 1024 / 1024 - console.log(size) + console.log(el); + const files = el.target.files[0]; + const isLt2M = files.size / 1024 / 1024 < 2; + const size = files.size / 1024 / 1024; + console.log(size); // 鍒ゆ柇涓婁紶鏂囦欢鐨勫ぇ灏� if (!isLt2M) { - this.$message.error("涓婁紶澶村儚鍥剧墖澶у皬涓嶈兘瓒呰繃 2MB!") + this.$message.error("涓婁紶澶村儚鍥剧墖澶у皬涓嶈兘瓒呰繃 2MB!"); } else if (files.type.indexOf("image") === -1) { //濡傛灉涓嶆槸鍥剧墖鏍煎紡 - this.$message.error("璇烽�夋嫨鍥剧墖鏂囦欢") + this.$message.error("璇烽�夋嫨鍥剧墖鏂囦欢"); } else { - const that = this - const reader = new FileReader() // 鍒涘缓璇诲彇鏂囦欢瀵硅薄 - reader.readAsDataURL(el.target.files[0]) // 鍙戣捣寮傛璇锋眰锛岃鍙栨枃浠� + const that = this; + const reader = new FileReader(); // 鍒涘缓璇诲彇鏂囦欢瀵硅薄 + reader.readAsDataURL(el.target.files[0]); // 鍙戣捣寮傛璇锋眰锛岃鍙栨枃浠� reader.onload = function () { // 璇诲彇瀹屾垚鍚庯紝灏嗙粨鏋滆祴鍊肩粰img鐨剆rc - that.imageSrc = this.result - console.log(this.result) + that.imageSrc = this.result; + console.log(this.result); // 鏁版嵁浼犲埌鍚庡彴 //const formData = new FormData() //formData.append('file', files); // 鍙互浼犲埌鍚庡彴鐨勬暟鎹� - } + }; } } }, // 杩涘嚭鐐瑰嚮 inOutBoundClick() { - this.$router.push({ path: "/reportForm/inOutboundDetail", query: { name: "浜у搧鍚嶇О/鍑哄叆搴撴槑缁�" } }) - } - } -} + if (this.editConfig.title !== "鏂板缓") { + console.log(this.editConfig.infomation); + this.$router.push({ + name: "inboundOutboundDetail", + params: { + name: this.editConfig.infomation.name, + id: this.editConfig.infomation.id, + pageName:"浜у搧", + paramsKey: { + amount: "amount", //鏁伴噺 + productName:"productName", //浜у搧鍚嶇О + status: "status", // 鐘舵�� + contactedName: "admin", //瀹屾垚鑰� + date: "operationDate", // 鏃ユ湡 + fromLocation: "from", // 浠� + number: "number", //鍗曞彿 + toLocation: "to", //鑷� + unit: "unit", //鍗曚綅 + }, + }, + }); + } + }, + // 鍙攢鍞�/鍙噰璐� + checkboxChange(val, param) { + if (val === "閲囪喘") { + this.showProcure = param; + } else if (val === "閿�鍞�") { + this.showSale = param; + } + }, + }, +}; </script> <!-- Add "scoped" attribute to limit CSS to this component only --> @@ -740,14 +997,18 @@ .right { width: 50%; } + .all { + width: 100%; + } } .second-label { margin-left: 20px; + margin-right: 20px; border-bottom: 1px solid #d9d9d9; margin-bottom: 10px; } .list-item { - width: 300px; + width: 100%; } .avatar-uploader .el-upload { border: 1px dashed #d9d9d9; @@ -792,5 +1053,8 @@ line-height: 30px; font-size: 13px; } + .el-input__inner { + text-align: left; + } } </style> -- Gitblit v1.8.0