zzq
2023-09-28 62dd7a29fb929865cfcd72e8412beb3b5d41a7fc
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: "请选择销售负责人", 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: "正在等待", 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的src
            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>