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 | 1299 +++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 917 insertions(+), 382 deletions(-)

diff --git a/src/views/productManage/product/AddProductDialog.vue b/src/views/productManage/product/AddProductDialog.vue
index 7320da8..7e042ab 100644
--- a/src/views/productManage/product/AddProductDialog.vue
+++ b/src/views/productManage/product/AddProductDialog.vue
@@ -1,14 +1,14 @@
 <template>
   <div class="add-common">
     <el-dialog
-      :title="editCommonConfig.title + '閲囪喘鍏ュ簱'"
+      :title="modalTitle + '浜у搧'"
       :visible.sync="editConfig.visible"
       :width="dialogWidth"
       :before-close="handleClose"
     >
       <!-- 澶� -->
       <div slot="title" class="dialog-header">
-        <span>{{ editCommonConfig.title + "閲囪喘鍏ュ簱" }}</span>
+        <span>{{ modalTitle + "浜у搧" }}</span>
         <div class="header_btns">
           <span class="btn">
             <i class="el-icon-printer"></i>
@@ -26,219 +26,250 @@
         ref="form"
         :model="editConfig.infomation"
         :rules="rules"
-        label-position="left"
+        label-position="right"
         label-width="110px"
         size="mini"
-        style="height: 60vh; overflow-x: hidden"
       >
-        <div class="content-btn">
+        <!-- <div class="content-btn">
           <el-button plain size="mini" disabled>鏍囩鎵撳嵃</el-button>
           <el-button plain size="mini" disabled>鏇存柊鏁伴噺</el-button>
           <el-button plain size="mini" disabled>鎵ц琛ヨ揣</el-button>
-        </div>
-
+        </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>
-          <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-input
-                    v-model="editConfig.infomation.client_name"
-                    placeholder=""
-                    :disabled="!showFooter"
-                  ></el-input>
-                </el-form-item>
-              </el-col>
-              <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>
-                </div>
-              </el-col>
-            </el-row>
-          </div>
+          <FormBtnsView
+            :add-product="addProduct"
+            @inOutBoundClick="inOutBoundClick"
+            @inLibraryClick="inLibraryClick"
+            :show-procure="showProcure"
+            :countObject="statisticsMap"
+            :show-sale="showSale"
+            @listingRulesClick="listingRulesClick"
+            @reorderRulesClick="reorderRulesClick"
+          />
           <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="name">
+                    <el-input
+                      v-model="editConfig.infomation.name"
+                      placeholder=""
+                      :disabled="!showFooter"
+                      style="width: 85%"
+                    ></el-input>
+                  </el-form-item>
+                  <el-form-item label="浜у搧缂栫爜" prop="id">
+                    <el-input
+                      style="width: 85%"
+                      v-if="
+                        editConfig.title == '缂栬緫' ||
+                        (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%"
+                      >璇蜂紭鍏堥厤缃紪鐮佽鑼� <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"
+                      clearable
+                      v-model="editConfig.infomation.specs"
+                      placeholder="璇疯緭鍏�"
+                    ></el-input>
+                  </el-form-item>
+                  <el-form-item label="浜у搧绫诲瀷" prop="productType">
                     <el-select
-                      v-model="editConfig.infomation.memberId"
+                      v-model="editConfig.infomation.productType"
                       placeholder="璇烽�夋嫨"
                       size="mini"
+                      clearable
                       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" >
                     <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">
+                    <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="鍗曚綅old" prop="unit">
+                    <el-input
+                      v-model="editConfig.infomation.unit"
+                      placeholder="璇疯緭鍏�"
                       style="width: 85%"
                       :disabled="!showFooter"
+                    ></el-input>
+                  </el-form-item> -->
+
+                  <el-form-item label="鍗曚綅" prop="unit">
+                    <el-select
+                      :disabled="!showFooter"
+                      v-model="editConfig.infomation.unit"
+                      placeholder="鍗曚綅"
+                      filterable
+                      @change="Gtechange"
+                      style="width: calc(85% - 120px)"
                     >
-                      <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id">
-                      </el-option>
+                      <el-option
+                        v-for="ele in unitList"
+                        :key="ele.id"
+                        :label="ele.name"
+                        :value="ele.name"
+                      ></el-option>
                     </el-select>
+                    <i
+                      class="el-icon-setting margin_left_10px cursor_pointer"
+                      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="client_name" style="margin-left: 20px">
-                    <el-select
-                      v-model="editConfig.infomation.memberId"
-                      placeholder="璇烽�夋嫨"
-                      size="mini"
+                  
+                  <el-form-item label="浜у搧鏍囩" prop="productTagName">
+                    <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-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="imageUrl">
+                    <IconCropper
+                      :isView="isView"
+                      :image-url="editConfig.infomation.imageSrc"
+                      @getImageData="getImageData"
                       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 class="right">
-                  <el-form-item label="閿�鍞环鏍�" prop="name" style="margin-left: 20px">
-                    <span>锟�</span>
-                    <el-input
-                      v-model.trim="editConfig.infomation.name"
+                  <el-form-item label="閿�鍞环鏍�" prop="salePrice">
+                    <!-- <span>锟�</span> -->
+                    <el-input-number
+                      v-model.trim="editConfig.infomation.salePrice"
                       placeholder="璇疯緭鍏�"
+                      :min="0"
+                      :controls="false"
                       size="mini"
                       style="width: 85%"
                       :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" >
+                    <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">
+                    <!-- <span>锟�</span> -->
+                    <el-input-number
+                      v-model.trim="editConfig.infomation.cost"
+                      placeholder="璇疯緭鍏�"
+                      :min="0"
+                      :controls="false"
+                      size="mini"
+                      style="width: 85%"
+                      :disabled="!showFooter"
+                    ></el-input-number>
+                  </el-form-item>
+                  <el-form-item label="浜у搧绫诲埆" prop="categoryId">
                     <el-select
-                      v-model="editConfig.infomation.memberId"
-                      multiple
+                      v-model="editConfig.infomation.categoryId"
                       placeholder="璇烽�夋嫨"
                       size="mini"
+                      clearable
+                      filterable
                       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="type">
                     <el-input
-                      v-model.trim="editConfig.infomation.name"
+                      style="width: 85%"
+                      :disabled="!showFooter"
+                      filterable
+                      v-model="editConfig.infomation.type"
+                      placeholder="璇疯緭鍏�"
+                    ></el-input>
+                  </el-form-item>
+                  <el-form-item label="閲囪喘绫诲瀷" prop="purchaseTypeList">
+                    <el-checkbox-group 
+                      v-model="editConfig.infomation.purchaseTypeList" 
+                      :disabled="!showFooter"
+                    >
+                      <el-checkbox v-for="item in bomPurchaseTypeList" :key="item.id" :label="item.id">{{ item.name }}</el-checkbox>
+                    </el-checkbox-group>
+                  </el-form-item>
+                  <el-form-item label="鍐呴儴缂栫爜" prop="internalReference">
+                    <el-input
+                      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">
                     <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%"
@@ -247,23 +278,283 @@
                   </el-form-item>
                 </div>
               </div>
-              <div class="all">
-                <div class="second-label">鍐呴儴璇存槑</div>
-                <el-form-item label="" prop="name" style="margin-left: 20px" label-width="0px">
+              <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-model.trim="editConfig.infomation.desc"
+                          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> -->
+                <el-form-item label="澶囨敞" prop="note">
+                  <el-input
+                    v-model.trim="editConfig.infomation.note"
                     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" >
+                    <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" label-width="80px">
+                    <el-select
+                      v-model="editConfig.infomation.principal"
+                      placeholder="璇烽�夋嫨"
+                      size="mini"
+                      style="width: 88%"
+                      disabled
+                    >
+                      <el-option
+                        v-for="(item, index) in memberOptions"
+                        :key="index"
+                        :label="item.userName"
+                        :value="item.userName"
+                      >
+                      </el-option>
+                    </el-select>
+                  </el-form-item>
+                  <!-- <el-form-item label="閲嶉噺" prop="weight" 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="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">&nbsp;</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">&nbsp;</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"
+                      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" 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" 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" 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"  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"  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"  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" >
+                    <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"  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"
@@ -283,7 +574,7 @@
               <div class="purchase-view">
                 <div class="left">
                   <div class="second-label">渚涘簲鍟嗚处鍗�</div>
-                  <el-form-item label="杩涢」绋�" prop="client_name" style="margin-left: 20px">
+                  <el-form-item label="杩涢」绋�" prop="client_name" >
                     <el-select
                       v-model="editConfig.infomation.memberId"
                       multiple
@@ -296,7 +587,7 @@
                       </el-option>
                     </el-select>
                   </el-form-item>
-                  <el-form-item label="鎺у埗绛栫暐" prop="client_name" style="margin-left: 20px">
+                  <el-form-item label="鎺у埗绛栫暐" prop="client_name" >
                     <el-radio-group v-model="editConfig.infomation.resource">
                       <el-radio label="璁㈠崟鏁伴噺"></el-radio>
                       <el-radio label="鏀跺埌鏁伴噺"></el-radio>
@@ -305,7 +596,7 @@
                 </div>
                 <div class="right">
                   <div class="second-label">閲囪喘璇存槑</div>
-                  <el-form-item label="" prop="name" style="margin-left: 20px" label-width="0px">
+                  <el-form-item label="" prop="name"  label-width="0px">
                     <el-input
                       v-model.trim="editConfig.infomation.desc"
                       placeholder="鏈潯澶囨敞琚坊鍔犲埌閲囪喘璁㈠崟"
@@ -318,154 +609,48 @@
                   </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>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" size="small" @click="saveClick('form')" :disabled="!showFooter">淇濆瓨</el-button>
         <el-button size="small" @click="editConfig.visible = false">鍙栨秷</el-button>
       </div>
     </el-dialog>
+    <BomDialog
+      ref="editDialog"
+      :editRow="editRow"
+      @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 CommonFormTableView from "@/components/makepager/CommonFormTableView"
-let inputElement = null
+import IconCropper from "./IconCropper"
+import { getProductCategoryList } from "@/api/product/productCategory"
+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",
   props: {
     editCommonConfig: {
@@ -474,36 +659,79 @@
         return {
           visible: false,
           title: "鏂板缓",
-          infomation: { type: [] }
+          infomation: {},
+          autoEdit: false
         }
       }
     }
   },
-  components: { CommonFormTableView },
-  computed: {},
+  components: { 
+    IconCropper,
+    BomDialog, 
+    UnitMoreDialog,
+  },
+  computed: {
+    modalTitle() {
+      if (this.editConfig.title === "缂栬緫" && this.editConfig.autoEdit) {
+        return "缂栬緫"
+      } else if (this.editConfig.title === "缂栬緫") {
+        return !this.showEdit ? "缂栬緫" : "鏌ョ湅"
+      } else {
+        return "鏂板缓"
+      }
+    }
+  },
   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" }],
+        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: ["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: [],
-      paymentTypeListOptions: [],
-      numberList: [
-        { label: "鑽夌", status: "todo" },
-        { label: "姝e湪绛夊緟", status: "todo" },
-        { label: "灏辩华", status: "todo" },
-        { label: "瀹屾垚", status: "todo" }
-      ],
+      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,24 +739,227 @@
       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: "鍏朵粬" }
+      ],
+      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 //鏈�澶ч噸璁㈣揣
+      },
+      isView: false,
+      fileFormdata: null, // 涓婁紶鍥剧墖鍏ュ弬
+      bomPurchaseTypeList: getDataByType("purchaseType"),
+      grossUnitList:getDataByType("grossUnit"),
+      unitList: [],
+      editRow:{
+        editDialogVisible:false,
+        BomTableData:[]
+      }
     }
   },
   created() {
+    if (this.editConfig.title === "缂栬緫" && !this.editConfig.autoEdit) {
+      this.isView = true
+    }
+    this.getProductCategoryList()
+    this.getProductList()
     this.setTableForm()
     this.setBottonView()
+    this.statisticsMap.inLibrary = this.editConfig?.infomation?.amount ?? 0
+    // 杩涘嚭鍙g殑浜у搧 鏁伴噺 杩樻病鏈�
+    this.statisticsMap.enter = this.editConfig?.infomation?.amount ?? 0
+    this.statisticsMap.exit = this.editConfig?.infomation?.amount ?? 0
+    if (this.editConfig.autoEdit) {
+      this.editClick()
+    }
+    this.setOptionalFieldsToEmpty()
+    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.editRow.editDialogVisible = true;
+    },
+    // 鍚敤澶氬崟浣�
+    handleUnitMore(){
+      if(this.editConfig.infomation.unit){
+        this.$refs.unitMoreDialog.editDialogVisible = true;
+      }else{
+        this.$message.error('璇峰厛閫夋嫨鍗曚綅锛�')
+      }
+    },
+    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;
+
+    },
+    // 鑾峰彇鐧诲綍鐢ㄦ埛淇℃伅
+    getUserInfo() {
+      getUserInfo().then((res) => {
+        console.log(res)
+        if (res.code == 200) {
+          this.editConfig.infomation.principal = res.data.userName
+          this.memberOptions.push(res.data)
+        }
+        console.log(this.memberOptions)
+      })
+    },
+    formInfo() {
+      this.objCode.type = "鐗╂枡缂栫爜"
+      this.objCode.codeStandID = ""
+      if (this.editConfig.infomation.codeStandardID) {
+        this.objCode.codeStandID = this.editConfig.infomation.codeStandardID
+      }
+      this.getRCodeStandardList()
+    },
+    /**
+     * 闈炲繀濉」鍚庣杩斿洖鐨勬槸鏁板瓧 0,琛ㄥ崟闇�瑕佺┖涓叉墠鑳借涓烘湭閫夋嫨鍥炴樉
+     */
+    setOptionalFieldsToEmpty() {
+      let arr = ["productType", "categoryId"]
+      arr
+        .filter((filed) => this.editConfig.infomation[filed] === 0)
+        .forEach((filed) => {
+          this.editConfig.infomation[filed] = ""
+        })
+    },
+    /**
+     * 鍚庣鍙帴鍙楁暟瀛楀舰寮�, 淇濆瓨鏃惰繕寰楀啀杞洖鍘�
+     */
+    unsetFieldsToNumber() {
+      let arr = ["productType", "categoryId"]
+      arr
+        .filter((filed) => this.editConfig.infomation[filed] === "")
+        .forEach((filed) => {
+          this.editConfig.infomation[filed] = 0
+        })
+    },
+    // 鑾峰彇浜у搧绫诲埆
+    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.addProduct = true
       } else {
         this.showEdit = true
         this.showFooter = false
+        this.addProduct = false
       }
     },
     // 鍏抽棴
@@ -540,10 +971,65 @@
       this.showEdit = false
       this.showButton = false
       this.showFooter = true
+      this.isView = false
       this.setTableForm()
     },
     // 淇濆瓨
-    saveClick() {},
+    saveClick(formName) {
+      console.log(this.editConfig.infomation)
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          console.log(this.fileFormdata == null)
+          let attachmentIDs = []
+          if (this.fileFormdata == null) {
+            if (this.editConfig.infomation.attachmentList?.length > 0) {
+              this.editConfig.infomation.attachmentList.forEach((ele) => {
+                attachmentIDs.push(ele.id)
+              })
+            } else {
+              attachmentIDs = []
+            }
+            this.saveEditRequest(attachmentIDs)
+          } else {
+            uploadFiles(this.fileFormdata).then((res) => {
+              if (res.code == 200) {
+                res.data.forEach((ele) => {
+                  attachmentIDs.push(ele.id)
+                })
+              }
+              this.saveEditRequest(attachmentIDs)
+            })
+          }
+        }
+      })
+    },
+    // 淇濆瓨/缂栬緫鎺ュ彛璇锋眰
+    saveEditRequest(attachmentIDs) {
+      let requestUrl = this.editConfig.title === "鏂板缓" ? addProduct : updateProduct
+      this.unsetFieldsToNumber()
+      let params = {
+        ...this.editConfig.infomation,
+        attachmentIDs
+      }
+      if (this.editConfig.title == "鏂板缓") {
+        params.codeStandardID = this.autoCodeObj.codeStandardID
+        params.autoIncr = this.autoCodeObj.maxAutoIncr
+      }
+      if(params.moreUnitList&&params.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
+        if (res.code === 200) {
+          this.$message.success(this.editConfig.title === "鏂板缓" ? "娣诲姞" : "缂栬緫" + "鎴愬姛!")
+          this.$parent.getData()
+        }
+      }, console.error)
+    },
     // 鍒犻櫎
     delClick() {},
     setTableForm() {
@@ -603,54 +1089,94 @@
       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"
-          if (window.addEventListener) {
-            inputElement.addEventListener("change", this.uploadFile, false)
-          } else {
-            inputElement.attachEvent("onchange", this.uploadFile)
-          }
-          document.body.appendChild(inputElement)
-        }
-        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)
-        // 鍒ゆ柇涓婁紶鏂囦欢鐨勫ぇ灏�
-        if (!isLt2M) {
-          this.$message.error("涓婁紶澶村儚鍥剧墖澶у皬涓嶈兘瓒呰繃 2MB!")
-        } else if (files.type.indexOf("image") === -1) {
-          //濡傛灉涓嶆槸鍥剧墖鏍煎紡
-          this.$message.error("璇烽�夋嫨鍥剧墖鏂囦欢")
-        } else {
-          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)
-            // 鏁版嵁浼犲埌鍚庡彴
-            //const formData = new FormData()
-            //formData.append('file', files); // 鍙互浼犲埌鍚庡彴鐨勬暟鎹�
-          }
-        }
-      }
+    getImageData(formdata) {
+      this.fileFormdata = formdata
+      // console.log(formdata, "鍥剧墖鏁版嵁")
     },
     // 杩涘嚭鐐瑰嚮
-    inOutBoundClick() {
-      this.$router.push({ path: "/reportForm/inOutboundDetail", query: { name: "浜у搧鍚嶇О/鍑哄叆搴撴槑缁�" } })
+    inOutBoundClick(val) {
+      if (this.editConfig.title !== "鏂板缓") {
+        console.log(this.editConfig.infomation)
+        let url=''
+        if(val=='杩�'){
+          url='inboundOutboundDetail'
+        }else{
+          url='outboundDetail'
+        }
+        this.$router.push({
+          name:url,
+          params: {
+            name: this.editConfig.infomation.name,
+            id: this.editConfig.infomation.id
+          }
+        })
+      }
+    },
+    // 鍦ㄥ簱鐐瑰嚮
+    inLibraryClick() {
+      if (this.editConfig.title !== "鏂板缓") {
+        console.log(this.editConfig.infomation)
+        this.$router.push({
+          name: "inventoryReport",
+          params: {
+            name: this.editConfig.infomation.name,
+            id: this.editConfig.infomation.id
+          }
+        })
+      }
+    },
+    // 涓婃灦瑙勫垯
+    listingRulesClick() {
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          this.$router.push({
+            path: "/warehouseManage/listingRules",
+            query: {
+              productName: this.editConfig.infomation.name,
+              productId: this.editConfig.title === "鏂板缓" ? "" : this.editConfig.infomation.id
+            }
+          })
+        }
+      })
+    },
+    // 閲嶈璐鍒�
+    reorderRulesClick() {
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          this.$router.push({
+            path: "/productManage/reorderRules",
+            query: {
+              productName: this.editConfig.infomation.name,
+              productId: this.editConfig.title === "鏂板缓" ? "" : this.editConfig.infomation.id
+            }
+          })
+        }
+      })
+    },
+    // 鍙攢鍞�/鍙噰璐�
+    checkboxChange(val, param) {
+      if (val === "閲囪喘") {
+        this.showProcure = param
+      } else if (val === "閿�鍞�") {
+        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;
+        this.unitList=res.data
+      })
     }
   }
 }
@@ -658,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;
@@ -680,16 +1216,19 @@
 .basic-info {
   height: calc(100% - 80px);
   overflow: auto;
-  margin: 20px;
-  border: 1px solid #dcdfe6;
-  box-shadow: inset 0 0 2px #dee2e6;
-  -moz-box-shadow: inset 0 0 2px #dee2e6;
-  -webkit-box-shadow: inset 0 0 2px #dee2e6;
+  margin: 10px;
+  // border: 1px solid #dcdfe6;
+  // box-shadow: inset 0 0 2px #dee2e6;
+  // -moz-box-shadow: inset 0 0 2px #dee2e6;
+  // -webkit-box-shadow: inset 0 0 2px #dee2e6;
+  .bottom {
+    margin-top: 10px;
+  }
   .content-number {
     display: flex;
     justify-content: right;
     height: 44px;
-    border-bottom: 1px solid #e9e9e9;
+    // border-bottom: 1px solid #e9e9e9;
     font-size: 13px;
     .sub-number {
       width: 12.5%;
@@ -716,22 +1255,6 @@
       }
     }
   }
-  .basic-info-view {
-    margin-top: 20px;
-    .upload {
-      position: relative;
-      width: 90px;
-      height: 90px;
-      margin-left: 40px;
-      border: 1px dotted #d9d9d9;
-      border-radius: 4px;
-      .upload-icon {
-        position: absolute;
-        top: 40%;
-        right: 43%;
-      }
-    }
-  }
   .purchase-view {
     display: flex;
     .left {
@@ -740,14 +1263,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;
@@ -784,13 +1311,21 @@
       color: #333;
     }
   }
-  .el-tabs--card > .el-tabs__header .el-tabs__nav {
-    margin-left: 20px;
+  .el-tabs--card > .el-tabs__header {
+    border-bottom: none;
+  }
+  .el-tabs__item.is-active {
+    color: #fff;
+    background: #2a78fb;
   }
   .el-tabs__item {
     height: 30px;
     line-height: 30px;
     font-size: 13px;
+    background: #f3f3f3;
+  }
+  .el-input__inner {
+    text-align: left;
   }
 }
 </style>

--
Gitblit v1.8.0