|
|
<template>
|
|
|
<view class="jnpf-wrap jnpf-wrap-form" v-if="!loading">
|
|
|
<u-form :model="dataForm" :rules="rules" ref="dataForm" :errorType="['toast']" label-position="left"
|
|
|
label-align="right" :label-width="labelwidth" class="jnpf-form">
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item>
|
|
|
<view style="float: left; width:8px; height: 16px;background-color: cadetblue;margin-right: 8px;"></view>商品类型
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('productTypeId')" :required="requiredList.productTypeId" label="商品类型"
|
|
|
prop="productTypeId">
|
|
|
<jnpf-radio v-model="dataForm.productTypeId" :disabled="judgeWrite('productTypeId')"
|
|
|
@change="changeData('productTypeId',-1)" optionType="default" direction="horizontal"
|
|
|
:props="productTypeIdProps" :options="productTypeIdOptions" :showOnly="true">
|
|
|
</jnpf-radio>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item>
|
|
|
<view style="float: left; width:8px; height: 16px;background-color: cadetblue;margin-right: 8px;"></view>基本信息
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('photo')" :required="requiredList.photo" label="商品图片" prop="photo">
|
|
|
<jnpf-upload v-model="dataForm.photo" :disabled="judgeWrite('photo')"
|
|
|
@change="changeData('photo',-1)" tipText="建议尺寸:800 x 800 像素" sizeUnit="MB" :fileSize="10"
|
|
|
:limit="9" pathType="defaultPath" :isAccount="0" :value="dataForm.photo">
|
|
|
</jnpf-upload>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('code')" :required="requiredList.code" label="商品编码" prop="code">
|
|
|
<u-input v-model="dataForm.code" disabled @change="changeData('code',-1)" input-align='right'
|
|
|
placeholder="系统自动生成" :style='{"width":"100%"}' readonly>
|
|
|
</u-input>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('name')" :required="requiredList.name" label="商品名称" prop="name">
|
|
|
<u-input v-model="dataForm.name" :disabled="judgeWrite('name')" @change="changeData('name',-1)"
|
|
|
input-align='right' clearable placeholder="请输入" :style='{"width":"100%"}'>
|
|
|
</u-input>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('shortName')" :required="requiredList.shortName" label="商品简称"
|
|
|
prop="shortName">
|
|
|
<u-input v-model="dataForm.shortName" :disabled="judgeWrite('shortName')"
|
|
|
@change="changeData('shortName',-1)" input-align='right' clearable placeholder="请输入"
|
|
|
:style='{"width":"100%"}'>
|
|
|
</u-input>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('spec')" :required="requiredList.spec" label="商品规格" prop="spec">
|
|
|
<u-input v-model="dataForm.spec" :disabled="judgeWrite('spec')" @change="changeData('spec',-1)"
|
|
|
input-align='right' clearable placeholder="请输入" :style='{"width":"100%"}'>
|
|
|
</u-input>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('inventoryType')" :required="requiredList.inventoryType" label="存货类型"
|
|
|
prop="inventoryType">
|
|
|
<jnpf-select v-model="dataForm.inventoryType" :disabled="judgeWrite('inventoryType')"
|
|
|
@change="changeData('inventoryType',-1)" clearable placeholder="请选择" :props="inventoryTypeProps"
|
|
|
:options="inventoryTypeOptions" :style='{"width":"100%"}'>
|
|
|
</jnpf-select>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('brandId')" :required="requiredList.brandId" label="品牌" prop="brandId">
|
|
|
<jnpf-popup-select v-model="dataForm.brandId" :disabled="judgeWrite('brandId')"
|
|
|
@change="changeData('brandId',-1)" :rowIndex="null" :formData="dataForm"
|
|
|
:templateJson="interfaceRes.brandId" hasPage clearable propsValue="id" popupWidth="800px"
|
|
|
popupTitle="选择数据" popupType="dialog" relationField='brand_name' vModel='brandId'
|
|
|
:columnOptions="brandIdColumnOptions" interfaceId="518049412669244677" :pageSize="20"
|
|
|
placeholder="请选择" type="popup" :style='{"width":"100%"}'>
|
|
|
</jnpf-popup-select>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('productCategoryId')" :required="requiredList.productCategoryId"
|
|
|
label="商品分类" prop="productCategoryId">
|
|
|
<jnpf-select v-model="dataForm.productCategoryId" :disabled="judgeWrite('productCategoryId')"
|
|
|
@change="changeData('productCategoryId',-1)" clearable placeholder="请选择"
|
|
|
:props="productCategoryIdProps" :options="productCategoryIdOptions" :style='{"width":"100%"}'>
|
|
|
</jnpf-select>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('area')" :required="requiredList.area" label="产地" prop="area">
|
|
|
<jnpf-city-select v-model="dataForm.area" :disabled="judgeWrite('area')"
|
|
|
@change="changeData('area',-1)" selectType="all" clearable placeholder="请选择" :level="2"
|
|
|
:style='{"width":"100%"}'>
|
|
|
</jnpf-city-select>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item>
|
|
|
<view style="float: left; width:8px; height: 16px;background-color: cadetblue;margin-right: 8px;"></view>商品特性
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('dangerousFlag')" :required="requiredList.dangerousFlag" label="危险品"
|
|
|
prop="dangerousFlag">
|
|
|
<jnpf-radio v-model="dataForm.dangerousFlag" :disabled="judgeWrite('dangerousFlag')"
|
|
|
@change="changeData('dangerousFlag',-1)" optionType="default" direction="horizontal"
|
|
|
:props="dangerousFlagProps" :options="dangerousFlagOptions">
|
|
|
</jnpf-radio>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('importedFlag')" :required="requiredList.importedFlag" label="进口商品"
|
|
|
prop="importedFlag">
|
|
|
<jnpf-radio v-model="dataForm.importedFlag" :disabled="judgeWrite('importedFlag')"
|
|
|
@change="changeData('importedFlag',-1)" optionType="default" direction="horizontal"
|
|
|
:props="importedFlagProps" :options="importedFlagOptions">
|
|
|
</jnpf-radio>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('processedFlag')" :required="requiredList.processedFlag" label="加工商品"
|
|
|
prop="processedFlag">
|
|
|
<jnpf-radio v-model="dataForm.processedFlag" :disabled="judgeWrite('processedFlag')"
|
|
|
@change="changeData('processedFlag',-1)" optionType="default" direction="horizontal"
|
|
|
:props="processedFlagProps" :options="processedFlagOptions">
|
|
|
</jnpf-radio>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('outsourcedFlag')" :required="requiredList.outsourcedFlag" label="委外商品"
|
|
|
prop="outsourcedFlag">
|
|
|
<jnpf-radio v-model="dataForm.outsourcedFlag" :disabled="judgeWrite('outsourcedFlag')"
|
|
|
@change="changeData('outsourcedFlag',-1)" optionType="default" direction="horizontal"
|
|
|
:props="outsourcedFlagProps" :options="outsourcedFlagOptions">
|
|
|
</jnpf-radio>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item>
|
|
|
<view style="float: left; width:8px; height: 16px;background-color: cadetblue;margin-right: 8px;"></view>供应链/财务信息
|
|
|
</u-form-item>
|
|
|
<!-- <u-form-item>
|
|
|
<jnpf-text
|
|
|
:textStyle='{"color":"#62A2CB","font-weight":"bold","text-decoration":"none","font-size":16,"line-height":32,"font-style":"normal","text-align":"center"}'
|
|
|
value="供应链/财务信息" content="供应链/财务信息">
|
|
|
</jnpf-text>
|
|
|
</u-form-item> -->
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('firstSupplierId')" :required="requiredList.firstSupplierId" label="首选供应商"
|
|
|
prop="firstSupplierId">
|
|
|
<jnpf-popup-select v-model="dataForm.firstSupplierId" :disabled="judgeWrite('firstSupplierId')"
|
|
|
@change="changeData('firstSupplierId',-1)" :rowIndex="null" :formData="dataForm"
|
|
|
:templateJson="interfaceRes.firstSupplierId" clearable propsValue="id" popupWidth="800px"
|
|
|
popupTitle="选择数据" popupType="dialog" relationField='name' vModel='firstSupplierId'
|
|
|
:columnOptions="firstSupplierIdColumnOptions" interfaceId="530001731111617029" :pageSize="20"
|
|
|
placeholder="请选择" type="popup" :style='{"width":"100%"}'>
|
|
|
</jnpf-popup-select>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('outputTaxRate')" :required="requiredList.outputTaxRate" label="销项税率"
|
|
|
prop="outputTaxRate">
|
|
|
<jnpf-select v-model="dataForm.outputTaxRate" :disabled="judgeWrite('outputTaxRate')"
|
|
|
@change="changeData('outputTaxRate',-1)" placeholder="请选择" :props="outputTaxRateProps"
|
|
|
:options="outputTaxRateOptions" :style='{"width":"100%"}'>
|
|
|
</jnpf-select>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('inputTaxRate')" :required="requiredList.inputTaxRate" label="进项税率"
|
|
|
prop="inputTaxRate">
|
|
|
<jnpf-select v-model="dataForm.inputTaxRate" :disabled="judgeWrite('inputTaxRate')"
|
|
|
@change="changeData('inputTaxRate',-1)" clearable placeholder="请选择" :props="inputTaxRateProps"
|
|
|
:options="inputTaxRateOptions" :style='{"width":"100%"}'>
|
|
|
</jnpf-select>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('deliveryType')" :required="requiredList.deliveryType" label="配送方式"
|
|
|
prop="deliveryType">
|
|
|
<jnpf-radio v-model="dataForm.deliveryType" :disabled="judgeWrite('deliveryType')"
|
|
|
@change="changeData('deliveryType',-1)" optionType="default" direction="horizontal"
|
|
|
:props="deliveryTypeProps" :options="deliveryTypeOptions">
|
|
|
</jnpf-radio>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item>
|
|
|
<view style="float: left; width:8px; height: 16px;background-color: cadetblue;margin-right: 8px;"></view>单位/价格信息
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('manyUnitFlag')" :required="requiredList.manyUnitFlag" label="开启多单位"
|
|
|
prop="manyUnitFlag">
|
|
|
<jnpf-radio v-model="dataForm.manyUnitFlag" :disabled="judgeWrite('manyUnitFlag')"
|
|
|
@change="changeData('manyUnitFlag',-1)" optionType="default" direction="horizontal"
|
|
|
:props="manyUnitFlagProps" :options="manyUnitFlagOptions">
|
|
|
</jnpf-radio>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="jnpf-table" v-if="judgeShow('productUnitList')">
|
|
|
<view class="jnpf-table-item" v-for="(item,i) in dataForm.productUnitList" :key="i">
|
|
|
<view class="jnpf-table-item-title u-flex u-row-between">
|
|
|
<text class="jnpf-table-item-title-num">商品单位({{i+1}})</text>
|
|
|
<view class="jnpf-table-item-title-action"
|
|
|
v-if=" !judgeWrite('productUnitList') && dataForm.productUnitList.length>0"
|
|
|
@click="delProductUnitList(i)">删除</view>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('productUnitList-productUnitwarehouseId')"
|
|
|
:required="requiredList['productUnitList-productUnitwarehouseId']" label="单位名称">
|
|
|
<jnpf-select v-model="dataForm.productUnitList[i].productUnitwarehouseId"
|
|
|
:disabled="judgeWrite('productUnitList')||judgeWrite('productUnitList-productUnitwarehouseId')"
|
|
|
@change="changeData('productunit-productUnitwarehouseId',i)" clearable placeholder="请选择"
|
|
|
:props="productunitproductUnitwarehouseIdProps"
|
|
|
:options="dataForm.productUnitList[i].productUnitwarehouseIdOptions"
|
|
|
:style='{"width":"100%"}'>
|
|
|
</jnpf-select>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('productUnitList-conversionRules')"
|
|
|
:required="requiredList['productUnitList-conversionRules']" label="换算规则">
|
|
|
<u-input v-model="dataForm.productUnitList[i].conversionRules"
|
|
|
:disabled="judgeWrite('productUnitList')||judgeWrite('productUnitList-conversionRules')"
|
|
|
@change="changeData('productunit-conversionRules',i)" input-align='right' clearable
|
|
|
placeholder="请输入" :style='{"width":"100%"}'>
|
|
|
</u-input>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('productUnitList-productUnitCode')"
|
|
|
:required="requiredList['productUnitList-productUnitCode']" label="商品单位编码">
|
|
|
<u-input v-model="dataForm.productUnitList[i].productUnitCode"
|
|
|
:disabled="judgeWrite('productUnitList')||judgeWrite('productUnitList-productUnitCode')"
|
|
|
@change="changeData('productunit-productUnitCode',i)" input-align='right' clearable
|
|
|
placeholder="请输入" :style='{"width":"100%"}'>
|
|
|
</u-input>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="jnpf-table-addBtn" @click="addProductUnitList" v-if="!judgeWrite('productUnitList')">
|
|
|
<u-icon name="plus" color="#2979ff"></u-icon>
|
|
|
<span>{{dataForm.productUnitList.length==0?"添加商品单位":"添加"}}</span>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('inventoryUnitId')" :required="requiredList.inventoryUnitId" label="库存单位"
|
|
|
prop="inventoryUnitId">
|
|
|
<jnpf-select v-model="dataForm.inventoryUnitId" :disabled="judgeWrite('inventoryUnitId')"
|
|
|
@change="changeData('inventoryUnitId',-1)" clearable placeholder="请选择"
|
|
|
:props="inventoryUnitIdProps" :options="optsUnit" :style='{"width":"100%"}'>
|
|
|
</jnpf-select>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('orderMainUnitId')" :required="requiredList.orderMainUnitId" label="订货单位"
|
|
|
prop="orderMainUnitId">
|
|
|
<jnpf-select v-model="dataForm.orderMainUnitId" :disabled="judgeWrite('orderMainUnitId')"
|
|
|
@change="changeData('orderMainUnitId',-1)" clearable placeholder="请选择"
|
|
|
:props="orderMainUnitIdProps" :options="optsUnit" :multiple="true" :style='{"width":"100%"}'>
|
|
|
</jnpf-select>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('salesMainUnitId')" :required="requiredList.salesMainUnitId" label="销售单位"
|
|
|
prop="salesMainUnitId">
|
|
|
<jnpf-select v-model="dataForm.salesMainUnitId" :disabled="judgeWrite('salesMainUnitId')"
|
|
|
@change="changeData('salesMainUnitId',-1)" clearable placeholder="请选择"
|
|
|
:props="salesMainUnitIdProps" :options="optsUnit" :multiple="true" :style='{"width":"100%"}'>
|
|
|
</jnpf-select>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('operateUnitId')" :required="requiredList.operateUnitId" label="操作单位"
|
|
|
prop="operateUnitId">
|
|
|
<jnpf-select v-model="dataForm.operateUnitId" :disabled="judgeWrite('operateUnitId')"
|
|
|
@change="changeData('operateUnitId',-1)" clearable placeholder="请选择" :props="operateUnitIdProps"
|
|
|
:options="optsUnit" :style='{"width":"100%"}'>
|
|
|
</jnpf-select>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('pricingUnitId')" :required="requiredList.pricingUnitId" label="计价单位"
|
|
|
prop="pricingUnitId">
|
|
|
<jnpf-select v-model="dataForm.pricingUnitId" :disabled="judgeWrite('pricingUnitId')"
|
|
|
@change="changeData('pricingUnitId',-1)" clearable placeholder="请选择" :props="pricingUnitIdProps"
|
|
|
:options="optsUnit" :style='{"width":"100%"}'>
|
|
|
</jnpf-select>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item>
|
|
|
<view style="float: left; width:8px; height: 16px;background-color: cadetblue;margin-right: 8px;"></view>销售信息
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('salesStart')" :required="requiredList.salesStart" label="开售时间"
|
|
|
prop="salesStart">
|
|
|
<jnpf-date-time v-model="dataForm.salesStart" :disabled="judgeWrite('salesStart')"
|
|
|
@change="changeData('salesStart',-1)" :startTime="dateTime(false,1,1,'','')"
|
|
|
:endTime="dateTime(false,1,1,'','')" format="yyyy-MM-dd" clearable placeholder="请选择" type="date"
|
|
|
:style='{"width":"100%"}'>
|
|
|
</jnpf-date-time>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('salesEnd')" :required="requiredList.salesEnd" label="停售时间 "
|
|
|
prop="salesEnd">
|
|
|
<jnpf-date-time v-model="dataForm.salesEnd" :disabled="judgeWrite('salesEnd')"
|
|
|
@change="changeData('salesEnd',-1)" :startTime="dateTime(false,1,1,'','')"
|
|
|
:endTime="dateTime(false,1,1,'','')" format="yyyy-MM-dd" clearable placeholder="请选择" type="date"
|
|
|
:style='{"width":"100%"}'>
|
|
|
</jnpf-date-time>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item>
|
|
|
<view style="float: left; width:8px; height: 16px;background-color: cadetblue;margin-right: 8px;"></view>库存信息
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('safetyStock')" :required="requiredList.safetyStock" label="安全库存"
|
|
|
prop="safetyStock">
|
|
|
<u-input v-model="dataForm.safetyStock" :disabled="judgeWrite('safetyStock')"
|
|
|
@change="changeData('safetyStock',-1)" input-align='right' clearable placeholder="请输入"
|
|
|
:style='{"width":"100%"}'>
|
|
|
</u-input><span style="padding: 0px 5px">{{SKU}}</span>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('availableInventory')" :required="requiredList.availableInventory"
|
|
|
label="可售库存" prop="availableInventory">
|
|
|
<u-input v-model="dataForm.availableInventory" :disabled="judgeWrite('availableInventory')"
|
|
|
@change="changeData('availableInventory',-1)" input-align='right' clearable placeholder="请输入"
|
|
|
:style='{"width":"100%"}'>
|
|
|
</u-input><span style="padding: 0px 5px">{{SKU}}</span>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('inventoryDayDown')" :required="requiredList.inventoryDayDown"
|
|
|
label="库存天数下限" prop="inventoryDayDown">
|
|
|
<u-input v-model="dataForm.inventoryDayDown" :disabled="judgeWrite('inventoryDayDown')"
|
|
|
@change="changeData('inventoryDayDown',-1)" input-align='right' clearable placeholder="请输入"
|
|
|
:style='{"width":"100%"}'>
|
|
|
</u-input>
|
|
|
<span style="padding: 0px 5px">天</span>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('inventoryDayUpper')" :required="requiredList.inventoryDayUpper"
|
|
|
label="库存天数上限" prop="inventoryDayUpper">
|
|
|
<u-input v-model="dataForm.inventoryDayUpper" :disabled="judgeWrite('inventoryDayUpper')"
|
|
|
@change="changeData('inventoryDayUpper',-1)" input-align='right' clearable placeholder="请输入"
|
|
|
:style='{"width":"100%"}'>
|
|
|
</u-input>
|
|
|
<span style="padding: 0px 5px">天</span>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('inventoryDown')" :required="requiredList.inventoryDown" label="库存下限"
|
|
|
prop="inventoryDown">
|
|
|
<u-input v-model="dataForm.inventoryDown" :disabled="judgeWrite('inventoryDown')"
|
|
|
@change="changeData('inventoryDown',-1)" input-align='right' clearable placeholder="请输入"
|
|
|
:style='{"width":"100%"}'>
|
|
|
</u-input><span style="padding: 0px 5px">{{SKU}}</span>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('inventoryUpper')" :required="requiredList.inventoryUpper" label="库存上限"
|
|
|
prop="inventoryUpper">
|
|
|
<u-input v-model="dataForm.inventoryUpper" :disabled="judgeWrite('inventoryUpper')"
|
|
|
@change="changeData('inventoryUpper',-1)" input-align='right' clearable placeholder="请输入"
|
|
|
:style='{"width":"100%"}'>
|
|
|
</u-input><span style="padding: 0px 5px">{{SKU}}</span>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item>
|
|
|
<view style="float: left; width:8px; height: 16px;background-color: cadetblue;margin-right: 8px;"></view>适配业务范围
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
|
|
<u-form-item v-if="judgeShow('jnpf_jg_product_business_jnpf_businessLineId')"
|
|
|
:required="requiredList.jnpf_jg_product_business_jnpf_businessLineId" label="适配业务范围"
|
|
|
prop="jnpf_jg_product_business_jnpf_businessLineId">
|
|
|
<jnpf-checkbox v-model="dataForm.jnpf_jg_product_business_jnpf_businessLineId"
|
|
|
:disabled="judgeWrite('jnpf_jg_product_business_jnpf_businessLineId')"
|
|
|
@change="changeData('jnpf_jg_product_business_jnpf_businessLineId',-1)" optionType="default"
|
|
|
direction="horizontal" :props="jnpf_jg_product_business_jnpf_businessLineIdProps"
|
|
|
:options="jnpf_jg_product_business_jnpf_businessLineIdOptions" :showOnly="true">
|
|
|
</jnpf-checkbox>
|
|
|
</u-form-item>
|
|
|
</view>
|
|
|
</u-form>
|
|
|
<u-modal v-model="show" :content="content" width='70%' border-radius="16"
|
|
|
:content-style="{fontSize: '28rpx',padding: '20rpx',lineHeight: '44rpx',textAlign: 'left'}"
|
|
|
:titleStyle="{padding: '20rpx'}" :confirm-style="{height: '80rpx',lineHeight: '80rpx'}" :title="title"
|
|
|
confirm-text="确定">
|
|
|
</u-modal>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import {
|
|
|
getDictionaryDataSelector,
|
|
|
getDataInterfaceRes,
|
|
|
getDefaultCurrentValueUserId,
|
|
|
getDefaultCurrentValueDepartmentId
|
|
|
} from '@/api/common'
|
|
|
import comMixin from '../../../workFlow/workFlowForm/mixin'
|
|
|
import {
|
|
|
getDateDay,
|
|
|
getLaterData,
|
|
|
getBeforeData,
|
|
|
getBeforeTime,
|
|
|
getLaterTime
|
|
|
} from '@/components/index.js'
|
|
|
import request from '@/utils/request'
|
|
|
export default {
|
|
|
mixins: [comMixin],
|
|
|
data() {
|
|
|
return {
|
|
|
idList: [],
|
|
|
index: 0,
|
|
|
actionList: [],
|
|
|
actionListLength: false,
|
|
|
showAction: false,
|
|
|
btnLoading: false,
|
|
|
loading: false,
|
|
|
text: '提示:测试文本',
|
|
|
tableKey: '',
|
|
|
dataForm: {
|
|
|
id: "",
|
|
|
productTypeId: "1",
|
|
|
photo: [],
|
|
|
code: '',
|
|
|
name: '',
|
|
|
shortName: '',
|
|
|
barCode: '',
|
|
|
spec: '',
|
|
|
inventoryType: "",
|
|
|
brandId: "520546789800018053",
|
|
|
productCategoryId: "",
|
|
|
area: [],
|
|
|
dangerousFlag: "0",
|
|
|
importedFlag: "0",
|
|
|
processedFlag: "0",
|
|
|
outsourcedFlag: "0",
|
|
|
firstSupplierId: "",
|
|
|
outputTaxRate: "",
|
|
|
inputTaxRate: "",
|
|
|
deliveryType: "",
|
|
|
manyUnitFlag: "1",
|
|
|
inventoryUnitId: "",
|
|
|
orderMainUnitId: [],
|
|
|
salesMainUnitId: [],
|
|
|
operateUnitId: "",
|
|
|
pricingUnitId: "",
|
|
|
salesStart: '',
|
|
|
salesEnd: '',
|
|
|
safetyStock: '',
|
|
|
availableInventory: '',
|
|
|
inventoryDayDown: '',
|
|
|
inventoryDayUpper: '',
|
|
|
inventoryDown: '',
|
|
|
inventoryUpper: '',
|
|
|
creatorTime: "",
|
|
|
creatorUserId: "",
|
|
|
productbusiness: {
|
|
|
businessLineId: [],
|
|
|
},
|
|
|
jnpf_jg_product_business_jnpf_businessLineId: [],
|
|
|
productUnitList: [],
|
|
|
},
|
|
|
rules: {
|
|
|
productTypeId: [{
|
|
|
required: true,
|
|
|
message: '商品类型请至少选择一个',
|
|
|
}, ],
|
|
|
name: [{
|
|
|
required: true,
|
|
|
message: '商品名称请输入',
|
|
|
}, ],
|
|
|
spec: [{
|
|
|
required: true,
|
|
|
message: '商品规格请输入',
|
|
|
}, ],
|
|
|
inventoryType: [{
|
|
|
required: true,
|
|
|
message: '存货类型请选择',
|
|
|
}, ],
|
|
|
brandId: [{
|
|
|
required: true,
|
|
|
message: '品牌请至少选择一个',
|
|
|
}, ],
|
|
|
area: [{
|
|
|
required: true,
|
|
|
message: '产地请至少选择一个',
|
|
|
type: 'array',
|
|
|
}, ],
|
|
|
dangerousFlag: [{
|
|
|
required: true,
|
|
|
message: '危险品请至少选择一个',
|
|
|
}, ],
|
|
|
importedFlag: [{
|
|
|
required: true,
|
|
|
message: '进口商品请至少选择一个',
|
|
|
}, ],
|
|
|
processedFlag: [{
|
|
|
required: true,
|
|
|
message: '加工商品请至少选择一个',
|
|
|
}, ],
|
|
|
outsourcedFlag: [{
|
|
|
required: true,
|
|
|
message: '委外商品请至少选择一个',
|
|
|
}, ],
|
|
|
outputTaxRate: [{
|
|
|
required: true,
|
|
|
message: '销项税率请选择',
|
|
|
}, ],
|
|
|
inputTaxRate: [{
|
|
|
required: true,
|
|
|
message: '进项税率请选择',
|
|
|
}, ],
|
|
|
deliveryType: [{
|
|
|
required: true,
|
|
|
message: '配送方式不能为空',
|
|
|
}, ],
|
|
|
inventoryUnitId: [{
|
|
|
required: true,
|
|
|
message: '库存单位请选择',
|
|
|
}, ],
|
|
|
orderMainUnitId: [{
|
|
|
required: true,
|
|
|
message: '订货单位请至少选择一个',
|
|
|
type: 'array',
|
|
|
}, ],
|
|
|
salesMainUnitId: [{
|
|
|
required: true,
|
|
|
message: '销售单位请至少选择一个',
|
|
|
type: 'array',
|
|
|
}, ],
|
|
|
operateUnitId: [{
|
|
|
required: true,
|
|
|
message: '操作单位请选择',
|
|
|
}, ],
|
|
|
pricingUnitId: [{
|
|
|
required: true,
|
|
|
message: '计价单位请选择',
|
|
|
}, ],
|
|
|
salesStart: [{
|
|
|
required: true,
|
|
|
message: '开售时间请选择',
|
|
|
}, ],
|
|
|
availableInventory: [{
|
|
|
required: true,
|
|
|
message: '可售库存请输入',
|
|
|
}, ],
|
|
|
},
|
|
|
productTypeIdOptions: [],
|
|
|
productTypeIdProps: {
|
|
|
"label": "fullName",
|
|
|
"value": "enCode",
|
|
|
"multiple": false,
|
|
|
"children": ""
|
|
|
},
|
|
|
inventoryTypeOptions: [],
|
|
|
inventoryTypeProps: {
|
|
|
"label": "fullName",
|
|
|
"value": "enCode",
|
|
|
"multiple": false,
|
|
|
"children": ""
|
|
|
},
|
|
|
brandIdColumnOptions: [{
|
|
|
"label": "品牌",
|
|
|
"value": "brand_name"
|
|
|
}, ],
|
|
|
productCategoryIdOptions: [],
|
|
|
productCategoryIdProps: {
|
|
|
"label": "F_FullName",
|
|
|
"value": "id",
|
|
|
"multiple": false,
|
|
|
"children": ""
|
|
|
},
|
|
|
dangerousFlagOptions: [],
|
|
|
dangerousFlagProps: {
|
|
|
"label": "fullName",
|
|
|
"value": "enCode",
|
|
|
"multiple": false,
|
|
|
"children": ""
|
|
|
},
|
|
|
importedFlagOptions: [],
|
|
|
importedFlagProps: {
|
|
|
"label": "fullName",
|
|
|
"value": "enCode",
|
|
|
"multiple": false,
|
|
|
"children": ""
|
|
|
},
|
|
|
processedFlagOptions: [],
|
|
|
processedFlagProps: {
|
|
|
"label": "fullName",
|
|
|
"value": "enCode",
|
|
|
"multiple": false,
|
|
|
"children": ""
|
|
|
},
|
|
|
outsourcedFlagOptions: [],
|
|
|
outsourcedFlagProps: {
|
|
|
"label": "fullName",
|
|
|
"value": "enCode",
|
|
|
"multiple": false,
|
|
|
"children": ""
|
|
|
},
|
|
|
firstSupplierIdColumnOptions: [{
|
|
|
label: "供应商名称",
|
|
|
value: "name"
|
|
|
}],
|
|
|
outputTaxRateOptions: [],
|
|
|
outputTaxRateProps: {
|
|
|
"label": "fullName",
|
|
|
"value": "enCode",
|
|
|
"multiple": false,
|
|
|
"children": ""
|
|
|
},
|
|
|
inputTaxRateOptions: [],
|
|
|
inputTaxRateProps: {
|
|
|
"label": "fullName",
|
|
|
"value": "enCode",
|
|
|
"multiple": false,
|
|
|
"children": ""
|
|
|
},
|
|
|
deliveryTypeOptions: [],
|
|
|
deliveryTypeProps: {
|
|
|
"label": "fullName",
|
|
|
"value": "enCode",
|
|
|
"multiple": false,
|
|
|
"children": ""
|
|
|
},
|
|
|
manyUnitFlagOptions: [],
|
|
|
manyUnitFlagProps: {
|
|
|
"label": "fullName",
|
|
|
"value": "enCode",
|
|
|
"multiple": false,
|
|
|
"children": ""
|
|
|
},
|
|
|
inventoryUnitIdOptions: [{
|
|
|
"fullName": "选项一",
|
|
|
"id": "1"
|
|
|
}, {
|
|
|
"fullName": "选项二",
|
|
|
"id": "2"
|
|
|
}],
|
|
|
inventoryUnitIdProps: {
|
|
|
"label": "fullName",
|
|
|
"value": "id",
|
|
|
"multiple": false,
|
|
|
"children": ""
|
|
|
},
|
|
|
orderMainUnitIdOptions: [{
|
|
|
"fullName": "选项一",
|
|
|
"id": "1"
|
|
|
}, {
|
|
|
"fullName": "选项二",
|
|
|
"id": "2"
|
|
|
}],
|
|
|
orderMainUnitIdProps: {
|
|
|
"label": "fullName",
|
|
|
"value": "id",
|
|
|
"multiple": false,
|
|
|
"children": ""
|
|
|
},
|
|
|
salesMainUnitIdOptions: [{
|
|
|
"fullName": "选项一",
|
|
|
"id": "1"
|
|
|
}, {
|
|
|
"fullName": "选项二",
|
|
|
"id": "2"
|
|
|
}],
|
|
|
salesMainUnitIdProps: {
|
|
|
"label": "fullName",
|
|
|
"value": "id",
|
|
|
"multiple": false,
|
|
|
"children": ""
|
|
|
},
|
|
|
operateUnitIdOptions: [{
|
|
|
"fullName": "选项一",
|
|
|
"id": "1"
|
|
|
}, {
|
|
|
"fullName": "选项二",
|
|
|
"id": "2"
|
|
|
}],
|
|
|
operateUnitIdProps: {
|
|
|
"label": "fullName",
|
|
|
"value": "id",
|
|
|
"multiple": false,
|
|
|
"children": ""
|
|
|
},
|
|
|
pricingUnitIdOptions: [{
|
|
|
"fullName": "选项一",
|
|
|
"id": "1"
|
|
|
}, {
|
|
|
"fullName": "选项二",
|
|
|
"id": "2"
|
|
|
}],
|
|
|
pricingUnitIdProps: {
|
|
|
"label": "fullName",
|
|
|
"value": "id",
|
|
|
"multiple": false,
|
|
|
"children": ""
|
|
|
},
|
|
|
jnpf_jg_product_business_jnpf_businessLineIdOptions: [],
|
|
|
jnpf_jg_product_business_jnpf_businessLineIdProps: {
|
|
|
"label": "name",
|
|
|
"value": "id",
|
|
|
"multiple": false,
|
|
|
"children": ""
|
|
|
},
|
|
|
productunitproductUnitwarehouseIdOptions: [],
|
|
|
productunitproductUnitwarehouseIdProps: {
|
|
|
"label": "fullName",
|
|
|
"value": "id",
|
|
|
"multiple": false,
|
|
|
"children": ""
|
|
|
},
|
|
|
labelwidth: 130 * 1.5,
|
|
|
menuId: '',
|
|
|
jurisdictionType: '',
|
|
|
ruleList: {
|
|
|
productUnitList: {
|
|
|
'productUnitwarehouseId': '单位名称不能为空',
|
|
|
'conversionRules': '换算规则不能为空',
|
|
|
'productUnitCode': '商品单位编码不能为空',
|
|
|
},
|
|
|
},
|
|
|
interfaceRes: {
|
|
|
productTypeId: [],
|
|
|
photo: [],
|
|
|
code: [],
|
|
|
name: [],
|
|
|
shortName: [],
|
|
|
barCode: [],
|
|
|
spec: [],
|
|
|
inventoryType: [],
|
|
|
brandId: [],
|
|
|
productCategoryId: [],
|
|
|
area: [],
|
|
|
dangerousFlag: [],
|
|
|
importedFlag: [],
|
|
|
processedFlag: [],
|
|
|
outsourcedFlag: [],
|
|
|
firstSupplierId: [],
|
|
|
outputTaxRate: [],
|
|
|
inputTaxRate: [],
|
|
|
deliveryType: [],
|
|
|
manyUnitFlag: [],
|
|
|
inventoryUnitId: [],
|
|
|
orderMainUnitId: [],
|
|
|
salesMainUnitId: [],
|
|
|
operateUnitId: [],
|
|
|
pricingUnitId: [],
|
|
|
salesStart: [],
|
|
|
salesEnd: [],
|
|
|
safetyStock: [],
|
|
|
availableInventory: [],
|
|
|
inventoryDayDown: [],
|
|
|
inventoryDayUpper: [],
|
|
|
inventoryDown: [],
|
|
|
inventoryUpper: [],
|
|
|
creatorTime: [],
|
|
|
creatorUserId: [],
|
|
|
jnpf_jg_product_business_jnpf_businessLineId: [],
|
|
|
productunitproductUnitwarehouseId: [],
|
|
|
productunitconversionRules: [],
|
|
|
productunitproductUnitCode: [],
|
|
|
},
|
|
|
regList: {
|
|
|
productUnitList: {
|
|
|
productUnitwarehouseId: [],
|
|
|
conversionRules: [],
|
|
|
productUnitCode: [],
|
|
|
},
|
|
|
},
|
|
|
ableAll: {},
|
|
|
childIndex: -1,
|
|
|
dataValue: {},
|
|
|
isEdit: false,
|
|
|
userInfo: {},
|
|
|
formatType: {
|
|
|
"yyyy": "yyyy",
|
|
|
"yyyy-MM": "yyyy-mm",
|
|
|
"yyyy-MM-dd": "yyyy-mm-dd",
|
|
|
"yyyy-MM-dd HH:mm": "yyyy-mm-dd hh:MM",
|
|
|
"yyyy-MM-dd HH:mm:ss": "yyyy-mm-dd hh:MM:ss",
|
|
|
"HH:mm:ss": "hh:MM:ss",
|
|
|
"HH:mm": "hh:MM"
|
|
|
},
|
|
|
content: '',
|
|
|
title: '',
|
|
|
show: false,
|
|
|
optsUnitO: [],
|
|
|
optsUnit: []
|
|
|
}
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
uni.$on('linkPageConfirm', (subVal) => {
|
|
|
if (this.tableKey) {
|
|
|
for (let i = 0; i < subVal.length; i++) {
|
|
|
let t = subVal[i]
|
|
|
if (this['get' + this.tableKey]) {
|
|
|
this['get' + this.tableKey](t)
|
|
|
}
|
|
|
}
|
|
|
this.childIndex = -1
|
|
|
this.collapse()
|
|
|
}
|
|
|
})
|
|
|
this.jurisdictionType = option.jurisdictionType
|
|
|
this.menuId = option.menuId
|
|
|
this.userInfo = uni.getStorageSync('userInfo') || {}
|
|
|
this.dataForm.id = option.id || 0
|
|
|
let _title = ""
|
|
|
if (option.jurisdictionType == 'btn_edit') {
|
|
|
_title = "编辑"
|
|
|
}
|
|
|
if (option.jurisdictionType == 'btn_detail') {
|
|
|
_title = "详情"
|
|
|
}
|
|
|
if (option.jurisdictionType == 'btn_add') {
|
|
|
_title = "新增"
|
|
|
}
|
|
|
if (_title) {
|
|
|
uni.setNavigationBarTitle({
|
|
|
title: _title
|
|
|
})
|
|
|
}
|
|
|
this.selfInit()
|
|
|
this.initDefaultData()
|
|
|
this.dataAll()
|
|
|
this.initData()
|
|
|
this.dataValue = JSON.parse(JSON.stringify(this.dataForm))
|
|
|
this.idList = option.idList ? option.idList.split(",") : []
|
|
|
for (let i = 0; i < this.idList.length; i++) {
|
|
|
if (this.idList[i] == option.id) {
|
|
|
this.index = i;
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
onReady() {
|
|
|
this.$nextTick(() => {
|
|
|
setTimeout(() => {
|
|
|
this.$refs.dataForm.setRules(this.rules);
|
|
|
}, 100)
|
|
|
})
|
|
|
},
|
|
|
watch: {
|
|
|
dataForm: {
|
|
|
handler(val, oldVal) {
|
|
|
this.productunit()
|
|
|
},
|
|
|
deep: true
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
productUnitList() {
|
|
|
let productUnitListO = this.dataForm.productUnitList;
|
|
|
let productUnitListO2 = productUnitListO.filter(o1 => {
|
|
|
if (o1.conversionRules != "" && o1.productUnitwarehouseId != "") {
|
|
|
return true;
|
|
|
} else {
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
let productUnitListO3 = productUnitListO2.map(o1 => {
|
|
|
o1.id = o1.productUnitCode;
|
|
|
let optsA = this.optsUnitO;
|
|
|
let optsB = optsA.filter(o2 => {
|
|
|
return o2.id == o1.productUnitwarehouseId;
|
|
|
});
|
|
|
if (optsB.length > 0) {
|
|
|
o1.fullName = optsB[0]["fullName"];
|
|
|
}
|
|
|
return o1;
|
|
|
});
|
|
|
return productUnitListO3;
|
|
|
},
|
|
|
SKU() {
|
|
|
if (this.productUnitList.length > 0) {
|
|
|
console.log(this.productUnitList[0]["fullName"])
|
|
|
return this.productUnitList[0]["fullName"];
|
|
|
}
|
|
|
return "";
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
async fnGetUnitO() {
|
|
|
let res = await getDataInterfaceRes("522387417454346245", {
|
|
|
paramList: []
|
|
|
});
|
|
|
if (res.code == 200) {
|
|
|
this.optsUnitO = res.data;
|
|
|
}
|
|
|
},
|
|
|
async fnChangeDataUnit() {
|
|
|
let productUnitListO = this.dataForm.productUnitList;
|
|
|
let productUnitListO2 = productUnitListO.filter(o1 => {
|
|
|
if (o1.conversionRules != "" && o1.productUnitwarehouseId != "") {
|
|
|
return true;
|
|
|
} else {
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
let productUnitListO3 = productUnitListO2.map(o1 => {
|
|
|
o1.id = o1.productUnitCode;
|
|
|
let optsA = this.optsUnitO;
|
|
|
let optsB = optsA.filter(o2 => {
|
|
|
return o2.id == o1.productUnitwarehouseId;
|
|
|
});
|
|
|
if (optsB.length > 0) {
|
|
|
o1.fullName = optsB[0]["fullName"];
|
|
|
}
|
|
|
return o1;
|
|
|
});
|
|
|
this.optsUnit = productUnitListO3;
|
|
|
},
|
|
|
handleAction(index) {
|
|
|
if (this.actionList[index].id === 'save_add' || this.actionList[index].id === 'save_proceed') {
|
|
|
this.submitForm(1)
|
|
|
} else {
|
|
|
this.calculation(this.actionList[index].id, index)
|
|
|
}
|
|
|
},
|
|
|
calculation(type, index) {
|
|
|
if (type === 'upper') {
|
|
|
this.index--
|
|
|
this.actionList[index + 1].disabled = false
|
|
|
if (this.index == 0) this.actionList[index].disabled = true
|
|
|
} else {
|
|
|
this.index++
|
|
|
this.actionList[index - 1].disabled = false
|
|
|
if (this.index == this.idList.length - 1) this.actionList[index].disabled = true
|
|
|
}
|
|
|
this.dataForm.id = this.idList[this.index]
|
|
|
this.initData()
|
|
|
},
|
|
|
changeData(model, index) {
|
|
|
this.isEdit = false
|
|
|
this.childIndex = index
|
|
|
let modelAll = model.split("-");
|
|
|
let faceMode = "";
|
|
|
for (let i = 0; i < modelAll.length; i++) {
|
|
|
faceMode += modelAll[i];
|
|
|
}
|
|
|
for (let key in this.interfaceRes) {
|
|
|
if (key != faceMode) {
|
|
|
let faceReList = this.interfaceRes[key]
|
|
|
for (let i = 0; i < faceReList.length; i++) {
|
|
|
if (faceReList[i].relationField == model) {
|
|
|
let options = 'get' + key + 'Options';
|
|
|
if (this[options]) {
|
|
|
this[options]()
|
|
|
}
|
|
|
this.changeData(key, index)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
changeDataFormData(type, data, model, index, defaultValue, edit) {
|
|
|
if (!edit) {
|
|
|
if (type == 2) {
|
|
|
for (let i = 0; i < this.dataForm[data].length; i++) {
|
|
|
if (index == -1) {
|
|
|
this.dataForm[data][i][model] = defaultValue
|
|
|
} else if (index == i) {
|
|
|
this.dataForm[data][i][model] = defaultValue
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
this.dataForm[data] = defaultValue
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
clickIcon(label, tipLabel) {
|
|
|
this.content = tipLabel
|
|
|
this.title = label
|
|
|
this.show = true
|
|
|
},
|
|
|
exist() {
|
|
|
let title = [];
|
|
|
let _ruleList = this.ruleList
|
|
|
for (let k in _ruleList) {
|
|
|
let childData = this.dataForm[k]
|
|
|
childData.forEach((item, index) => {
|
|
|
for (let model in _ruleList[k]) {
|
|
|
if (item[model] instanceof Array) {
|
|
|
if (item[model].length == 0) {
|
|
|
title.push(_ruleList[k][model])
|
|
|
}
|
|
|
} else if (!item[model]) {
|
|
|
title.push(_ruleList[k][model])
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
let _regList = this.regList
|
|
|
for (let k in _regList) {
|
|
|
let childData = this.dataForm[k]
|
|
|
for (let n in _regList[k]) {
|
|
|
for (let i = 0; i < _regList[k][n].length; i++) {
|
|
|
const element = _regList[k][n][i]
|
|
|
if (element.pattern) {
|
|
|
element.pattern = element.pattern.toString()
|
|
|
let start = element.pattern.indexOf('/')
|
|
|
let stop = element.pattern.lastIndexOf('/')
|
|
|
let str = element.pattern.substring(start + 1, stop)
|
|
|
let reg = new RegExp(str)
|
|
|
element.pattern = reg
|
|
|
}
|
|
|
childData.forEach((item, index) => {
|
|
|
if (item[n] && !element.pattern.test(item[n])) {
|
|
|
title.push(element.message)
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (title.length > 0) {
|
|
|
return title[0]
|
|
|
}
|
|
|
},
|
|
|
resetForm() {
|
|
|
uni.navigateBack()
|
|
|
},
|
|
|
dataAll() {
|
|
|
this.getproductTypeIdOptions()
|
|
|
this.getinventoryTypeOptions()
|
|
|
this.getproductCategoryIdOptions()
|
|
|
this.getdangerousFlagOptions()
|
|
|
this.getimportedFlagOptions()
|
|
|
this.getprocessedFlagOptions()
|
|
|
this.getoutsourcedFlagOptions()
|
|
|
this.getoutputTaxRateOptions()
|
|
|
this.getinputTaxRateOptions()
|
|
|
this.getdeliveryTypeOptions()
|
|
|
this.getmanyUnitFlagOptions()
|
|
|
this.getjnpf_jg_product_business_jnpf_businessLineIdOptions()
|
|
|
this.getproductunitproductUnitwarehouseIdOptions()
|
|
|
this.collapse()
|
|
|
},
|
|
|
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
|
|
|
let timeDataValue = null;
|
|
|
let timeValue = Number(timeValueData)
|
|
|
if (timeRule) {
|
|
|
if (timeType == 1) {
|
|
|
timeDataValue = timeValueData ? timeValue : null
|
|
|
} else if (timeType == 2) {
|
|
|
timeDataValue = dataValue
|
|
|
} else if (timeType == 3) {
|
|
|
timeDataValue = new Date().getTime()
|
|
|
} else if (timeType == 4) {
|
|
|
let previousDate = '';
|
|
|
if (timeTarget == 1 || timeTarget == 2) {
|
|
|
previousDate = getDateDay(timeTarget, timeType, timeValue)
|
|
|
timeDataValue = new Date(previousDate).getTime()
|
|
|
} else if (timeTarget == 3) {
|
|
|
previousDate = getBeforeData(timeValue)
|
|
|
timeDataValue = new Date(previousDate).getTime()
|
|
|
} else {
|
|
|
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime()
|
|
|
}
|
|
|
} else if (timeType == 5) {
|
|
|
let previousDate = '';
|
|
|
if (timeTarget == 1 || timeTarget == 2) {
|
|
|
previousDate = getDateDay(timeTarget, timeType, timeValue)
|
|
|
timeDataValue = new Date(previousDate).getTime()
|
|
|
} else if (timeTarget == 3) {
|
|
|
previousDate = getLaterData(timeValue)
|
|
|
timeDataValue = new Date(previousDate).getTime()
|
|
|
} else {
|
|
|
timeDataValue = getLaterTime(timeTarget, timeValue).getTime()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return timeDataValue;
|
|
|
},
|
|
|
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
|
|
|
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType
|
|
|
let timeDataValue = null
|
|
|
if (timeRule) {
|
|
|
if (timeType == 1 && timeValue) {
|
|
|
timeDataValue = timeValue || '00:00:00'
|
|
|
if (timeDataValue.split(':').length == 3) {
|
|
|
timeDataValue = timeDataValue
|
|
|
} else {
|
|
|
timeDataValue = timeDataValue + ':00'
|
|
|
}
|
|
|
} else if (timeType == 2) {
|
|
|
timeDataValue = dataValue
|
|
|
} else if (timeType == 3) {
|
|
|
timeDataValue = this.jnpf.toDate(new Date(), format)
|
|
|
} else if (timeType == 4) {
|
|
|
let previousDate = '';
|
|
|
previousDate = getBeforeTime(timeTarget, timeValue)
|
|
|
timeDataValue = this.jnpf.toDate(previousDate, format)
|
|
|
} else if (timeType == 5) {
|
|
|
let previousDate = '';
|
|
|
previousDate = getLaterTime(timeTarget, timeValue)
|
|
|
timeDataValue = this.jnpf.toDate(previousDate, format)
|
|
|
}
|
|
|
}
|
|
|
return timeDataValue;
|
|
|
},
|
|
|
getproductTypeIdOptions() {
|
|
|
getDictionaryDataSelector('521699870097015173').then(res => {
|
|
|
this.productTypeIdOptions = res.data.list
|
|
|
})
|
|
|
},
|
|
|
getinventoryTypeOptions() {
|
|
|
getDictionaryDataSelector('521705509590401413').then(res => {
|
|
|
this.inventoryTypeOptions = res.data.list
|
|
|
})
|
|
|
},
|
|
|
getproductCategoryIdOptions() {
|
|
|
const edit = this.isEdit
|
|
|
const index = this.childIndex
|
|
|
let templateJsonList = JSON.parse(JSON.stringify(this.interfaceRes.productCategoryId))
|
|
|
for (let i = 0; i < templateJsonList.length; i++) {
|
|
|
let json = templateJsonList[i];
|
|
|
if (json.relationField) {
|
|
|
let relationFieldAll = json.relationField.split("-");
|
|
|
let val = json.defaultValue;
|
|
|
if (relationFieldAll.length > 1 && index > -1) {
|
|
|
val = this.dataForm[relationFieldAll[0] + 'List'] && this.dataForm[relationFieldAll[0] +
|
|
|
'List'].length ? this.dataForm[relationFieldAll[0] + 'List'][index][relationFieldAll[
|
|
|
1]] : ''
|
|
|
} else {
|
|
|
val = this.dataForm[relationFieldAll]
|
|
|
}
|
|
|
json.defaultValue = val
|
|
|
}
|
|
|
}
|
|
|
let template = {
|
|
|
paramList: templateJsonList
|
|
|
}
|
|
|
getDataInterfaceRes('521594673936990213', template).then(res => {
|
|
|
let data = res.data
|
|
|
this.productCategoryIdOptions = data
|
|
|
if (!edit) return
|
|
|
this.changeDataFormData(1, 'productCategoryId', 'productCategoryId', index, '', edit)
|
|
|
})
|
|
|
},
|
|
|
getdangerousFlagOptions() {
|
|
|
getDictionaryDataSelector('522424260874993797').then(res => {
|
|
|
this.dangerousFlagOptions = res.data.list
|
|
|
})
|
|
|
},
|
|
|
getimportedFlagOptions() {
|
|
|
getDictionaryDataSelector('522424260874993797').then(res => {
|
|
|
this.importedFlagOptions = res.data.list
|
|
|
})
|
|
|
},
|
|
|
getprocessedFlagOptions() {
|
|
|
getDictionaryDataSelector('522424260874993797').then(res => {
|
|
|
this.processedFlagOptions = res.data.list
|
|
|
})
|
|
|
},
|
|
|
getoutsourcedFlagOptions() {
|
|
|
getDictionaryDataSelector('522424260874993797').then(res => {
|
|
|
this.outsourcedFlagOptions = res.data.list
|
|
|
})
|
|
|
},
|
|
|
getoutputTaxRateOptions() {
|
|
|
getDictionaryDataSelector('522308907054399493').then(res => {
|
|
|
this.outputTaxRateOptions = res.data.list
|
|
|
})
|
|
|
},
|
|
|
getinputTaxRateOptions() {
|
|
|
getDictionaryDataSelector('522309142786867205').then(res => {
|
|
|
this.inputTaxRateOptions = res.data.list
|
|
|
})
|
|
|
},
|
|
|
getdeliveryTypeOptions() {
|
|
|
getDictionaryDataSelector('522318040524652549').then(res => {
|
|
|
this.deliveryTypeOptions = res.data.list
|
|
|
})
|
|
|
},
|
|
|
getmanyUnitFlagOptions() {
|
|
|
getDictionaryDataSelector('522677338626850821').then(res => {
|
|
|
this.manyUnitFlagOptions = res.data.list
|
|
|
})
|
|
|
},
|
|
|
getjnpf_jg_product_business_jnpf_businessLineIdOptions() {
|
|
|
const edit = this.isEdit
|
|
|
const index = this.childIndex
|
|
|
let templateJsonList = JSON.parse(JSON.stringify(this.interfaceRes
|
|
|
.jnpf_jg_product_business_jnpf_businessLineId))
|
|
|
for (let i = 0; i < templateJsonList.length; i++) {
|
|
|
let json = templateJsonList[i];
|
|
|
if (json.relationField) {
|
|
|
let relationFieldAll = json.relationField.split("-");
|
|
|
let val = json.defaultValue;
|
|
|
if (relationFieldAll.length > 1 && index > -1) {
|
|
|
val = this.dataForm[relationFieldAll[0] + 'List'] && this.dataForm[relationFieldAll[0] +
|
|
|
'List'].length ? this.dataForm[relationFieldAll[0] + 'List'][index][relationFieldAll[
|
|
|
1]] : ''
|
|
|
} else {
|
|
|
val = this.dataForm[relationFieldAll]
|
|
|
}
|
|
|
json.defaultValue = val
|
|
|
}
|
|
|
}
|
|
|
let template = {
|
|
|
paramList: templateJsonList
|
|
|
}
|
|
|
getDataInterfaceRes('517979330417001669', template).then(res => {
|
|
|
let data = res.data
|
|
|
this.jnpf_jg_product_business_jnpf_businessLineIdOptions = data
|
|
|
if (!edit) return
|
|
|
this.changeDataFormData(1, 'jnpf_jg_product_business_jnpf_businessLineId',
|
|
|
'jnpf_jg_product_business_jnpf_businessLineId', index, [], edit)
|
|
|
})
|
|
|
},
|
|
|
productunit() {
|
|
|
let table = this.dataForm.productUnitList
|
|
|
let summaryField = []
|
|
|
let summaryFieldName = {}
|
|
|
let data = {}
|
|
|
let thousandsField = []
|
|
|
for (let i in summaryField) {
|
|
|
let map = {}
|
|
|
let val = 0
|
|
|
for (let j = 0; j < table.length; j++) {
|
|
|
let summary = table[j][summaryField[i]];
|
|
|
if (summary) {
|
|
|
let data = isNaN(summary) ? 0 : Number(summary)
|
|
|
val += data
|
|
|
}
|
|
|
}
|
|
|
map.id = summaryField[i];
|
|
|
map.name = summaryFieldName[summaryField[i]];
|
|
|
map.val = (thousandsField.includes(summaryField[i])) ? Number(val).toLocaleString('zh', {
|
|
|
maximumFractionDigits: '2'
|
|
|
}) : val;
|
|
|
data[summaryField[i]] = map;
|
|
|
}
|
|
|
return data;
|
|
|
},
|
|
|
getproductunitproductUnitwarehouseIdOptions() {
|
|
|
const edit = this.isEdit
|
|
|
const index = this.childIndex
|
|
|
let templateJsonList = JSON.parse(JSON.stringify(this.interfaceRes.productunitproductUnitwarehouseId))
|
|
|
for (let i = 0; i < templateJsonList.length; i++) {
|
|
|
let json = templateJsonList[i];
|
|
|
if (json.relationField) {
|
|
|
let relationFieldAll = json.relationField.split("-");
|
|
|
let val = json.defaultValue;
|
|
|
if (relationFieldAll.length > 1 && index > -1) {
|
|
|
val = this.dataForm[relationFieldAll[0] + 'List'] && this.dataForm[relationFieldAll[0] +
|
|
|
'List'].length ? this.dataForm[relationFieldAll[0] + 'List'][index][relationFieldAll[
|
|
|
1]] : ''
|
|
|
} else {
|
|
|
val = this.dataForm[relationFieldAll]
|
|
|
}
|
|
|
json.defaultValue = val
|
|
|
}
|
|
|
}
|
|
|
let template = {
|
|
|
paramList: templateJsonList
|
|
|
}
|
|
|
getDataInterfaceRes('522387417454346245', template).then(res => {
|
|
|
let data = res.data
|
|
|
this.productunitproductUnitwarehouseIdOptions = data
|
|
|
if (index == -1) return
|
|
|
this.dataForm.productUnitList[index].productUnitwarehouseIdOptions = data
|
|
|
if (!edit) return
|
|
|
this.changeDataFormData(2, 'productUnitList', 'productUnitwarehouseId', index, '', edit)
|
|
|
})
|
|
|
},
|
|
|
initData() {
|
|
|
this.$nextTick(function() {
|
|
|
if (this.dataForm.id) {
|
|
|
this.loading = true
|
|
|
request({
|
|
|
url: '/api/scm/ProductWarehouse/' + this.dataForm.id,
|
|
|
method: 'get',
|
|
|
}).then(res => {
|
|
|
this.dataInfo(res.data)
|
|
|
this.loading = false
|
|
|
})
|
|
|
} else {
|
|
|
this.initDefaultData()
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
beforeSubmit() {
|
|
|
const _data = this.dataList()
|
|
|
return _data
|
|
|
},
|
|
|
initDefaultData() {},
|
|
|
selfInit() {
|
|
|
this.$store.commit('base/UPDATE_RELATION_DATA', {})
|
|
|
this.dataAll()
|
|
|
this.initDefaultData()
|
|
|
this.collapse()
|
|
|
},
|
|
|
async selfGetInfo(dataForm) {
|
|
|
this.dataForm.id = this.dataForm.id
|
|
|
await this.fnGetUnitO()
|
|
|
this.dataInfo(dataForm)
|
|
|
this.fnChangeDataUnit()
|
|
|
},
|
|
|
addProductUnitList() {
|
|
|
let value = {}
|
|
|
this.tableKey = 'productUnitList';
|
|
|
this.getProductUnitList(value)
|
|
|
this.childIndex = -1
|
|
|
this.collapse()
|
|
|
},
|
|
|
delProductUnitList(index) {
|
|
|
var that = this
|
|
|
uni.showModal({
|
|
|
title: '提示',
|
|
|
content: '确认删除该条信息吗?',
|
|
|
success: function(res) {
|
|
|
if (res.confirm) {
|
|
|
that.dataForm.productUnitList.splice(index, 1);
|
|
|
that.collapse()
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
getProductUnitList(value) {
|
|
|
let item = {
|
|
|
productUnitwarehouseId: "",
|
|
|
productUnitwarehouseIdOptions: [],
|
|
|
conversionRules: '',
|
|
|
productUnitCode: '',
|
|
|
}
|
|
|
let result = {
|
|
|
...item,
|
|
|
...value
|
|
|
}
|
|
|
this.dataForm.productUnitList.push(result)
|
|
|
this.childIndex = this.dataForm.productUnitList.length - 1
|
|
|
this.isEdit = true
|
|
|
this.getproductunitproductUnitwarehouseIdOptions()
|
|
|
this.isEdit = false
|
|
|
},
|
|
|
dataList() {
|
|
|
var _data = this.dataForm;
|
|
|
return _data;
|
|
|
},
|
|
|
dataInfo(dataAll) {
|
|
|
let _dataAll = dataAll
|
|
|
this.dataForm = _dataAll
|
|
|
this.isEdit = true
|
|
|
this.dataAll()
|
|
|
for (let i = 0; i < _dataAll.productUnitList.length; i++) {
|
|
|
this.childIndex = i
|
|
|
this.getproductunitproductUnitwarehouseIdOptions()
|
|
|
}
|
|
|
this.childIndex = -1
|
|
|
this.collapse()
|
|
|
},
|
|
|
collapse() {
|
|
|
setTimeout(() => {}, 1000);
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
</script>
|
|
|
<style>
|
|
|
page {
|
|
|
background-color: #f0f2f6;
|
|
|
}
|
|
|
</style> |