瀏覽代碼

营养产品详情回显

HuRongxin 1 月之前
父節點
當前提交
ac1b8a3a8c
共有 1 個文件被更改,包括 30 次插入28 次删除
  1. 30 28
      src/views/warehouse/nutriProduct/index.vue

+ 30 - 28
src/views/warehouse/nutriProduct/index.vue

@@ -57,15 +57,20 @@
                         {{ getCategoryName(row.productCategory) }}
                     </template>
                 </el-table-column>
-                <el-table-column label="规格" align="center" prop="productSpec" />
+                <el-table-column label="规格" align="center" prop="productSpec">
+                    <template #default="scope">
+                        {{ scope.row.productSpec}}{{ product_spec_unit.find(item => item.value === scope.row.productSpecUnit)?.label || '--' }}/{{ product_package_unit.find(item => item.value === scope.row.packageUnit)?.label || '--' }}
+                    </template>
+                </el-table-column>
                 <el-table-column label="剂型/形态" align="center">
                     <template #default="{ row }">
-                        {{ dosage_form.find(item => item.value === row.dosageForm)?.label || row.dosageForm }}
+                        {{ dosage_form.find(item => item.value === row.dosageForm)?.label || '--' }}
                     </template>
                 </el-table-column>
                 <el-table-column label="许可证临期提醒" align="center" prop="licenseExpiryReminder" width="180">
                     <template #default="scope">
-                        <span>{{ scope.row.licenseExpiryReminder ? scope.row.licenseExpiryReminder+"个月" : ''}}</span>
+                        <span v-if="scope.row.licenseExpiryReminder>0">{{ scope.row.licenseExpiryReminder+"个月"}}</span>
+                        <span v-else>{{ '--'}}</span>
                     </template>
                 </el-table-column>
                 <el-table-column label="保质期临期提醒" align="center" prop="shelfLifeReminder" width="180">
@@ -282,11 +287,9 @@
                                         <div style="display: flex; align-items: center;">
                                             <el-input v-model="form.productSpec" placeholder="请输入" style="width: 500px; border-top-right-radius: 0; border-bottom-right-radius: 0;" :maxlength="10" />
                                             <el-select v-model="form.productSpecUnit" style="width: 80px; border-radius: 0; border-left: none; border-top-left-radius: 0; border-bottom-left-radius: 0;" :popper-append-to-body="false" size="default" @change="onSpecUnitChange">
-                                                <el-option label="g" value="g" />
-                                                <el-option label="ml" value="ml" />
-                                                <el-option label="mg" value="mg" />
+                                                <el-option v-for="dict in product_spec_unit" :key="dict.value" :label="dict.label" :value="dict.value" />
                                             </el-select>
-                                            <span style="margin-left: 8px; color: #606266; font-size: 14px;">/</span>
+                                            <span style="margin-left: 8px; color: #606266; font-size: 14px;">/{{getDictLabel(product_package_unit ,form.packageUnit )|| '--' }}</span>
                                         </div>
                                     </el-form-item>
                                 </el-col>
@@ -296,7 +299,7 @@
                                 <el-col :span="12">
                                     <el-form-item label="预包装销售价:" prop="packagePrice" required>
                                         <el-input v-model="form.packagePrice" placeholder="请输入">
-                                            <template #append>元/</template>
+                                            <template #append>元/{{getDictLabel(product_package_unit ,form.packageUnit )|| '--' }}</template>
                                         </el-input>
                                     </el-form-item>
                                 </el-col>
@@ -313,7 +316,7 @@
                                 <el-col :span="12">
                                     <el-form-item label="最小包装规格:" prop="minSpec">
                                         <el-input v-model="form.minSpec" placeholder="请输入">
-                                            <template #append>g/包</template>
+                                            <template #append>{{getDictLabel(product_spec_unit ,form.productSpecUnit )|| '--' }}/{{getDictLabel(product_package_unit ,form.minUnit )|| '--' }}</template>
                                         </el-input>
                                     </el-form-item>
                                 </el-col>
@@ -328,7 +331,7 @@
                                 <el-col :span="12">
                                     <el-form-item label="配置销售价格:" prop="configSalePrice" required>
                                         <el-input v-model="form.configSalePrice" placeholder="请输入">
-                                            <template #append>元/g</template>
+                                            <template #append>元/{{getDictLabel(product_spec_unit ,form.productSpecUnit )|| '--' }}</template>
                                         </el-input>
                                     </el-form-item>
                                 </el-col>
@@ -998,12 +1001,13 @@
                     <el-tab-pane label="商品附件" name="productAttachments">
                         <el-form ref="nutritionFormRef" :model="form" :rules="rules" label-width="200px" style="margin-top: 30px">
                             <el-form-item label="商品附件" prop="productAttachments">
-                                <el-upload class="upload-demo" action="#" :auto-upload="false" :on-change="handleFileChange" :file-list="fileList" multiple>
-                                    <el-button type="primary">选择文件</el-button>
-                                    <template #tip>
-                                        <div class="el-upload__tip">支持上传jpg/png/pdf文件</div>
-                                    </template>
-                                </el-upload>
+                                <FileUpload 
+                                    v-model="form.productAttachments" 
+                                    :limit="10"
+                                    :file-size="10"
+                                    :file-type="['jpg', 'png', 'pdf', 'doc', 'docx', 'xls', 'xlsx']"
+                                    :is-show-tip="true"
+                                />
                             </el-form-item>
                         </el-form>
                     </el-tab-pane>
@@ -1069,7 +1073,7 @@
                             <el-col :span="12">
                                 <div><b>入货价格:</b>{{ form.purchasePrice || '--' }} 元</div>
                                 <div><b>默认用法:</b>{{ getDictLabel(default_usage, form.defaultUsage) || '--' }}</div>
-                                <div><b>商品规格:</b>{{ form.productSpec || '--' }}/{{ form.productSpecUnit || '--' }}</div>
+                                <div><b>商品规格:</b>{{ form.productSpec || '--' }}{{getDictLabel(product_spec_unit ,form.productSpecUnit )|| '--' }}/{{getDictLabel(product_package_unit ,form.packageUnit )|| '--' }}</div>
                             </el-col>
                             <el-col :span="12">
                                 <div><b>入货单位:</b>{{ getDictLabel(product_package_unit, form.purchaseUnit) || '--' }}</div>
@@ -1079,8 +1083,8 @@
                         <el-divider content-position="left">预包装销售设置:</el-divider>
                         <el-row :gutter="40">
                             <el-col :span="12">
-                                <div><b>预包装销售价:</b>{{ form.packagePrice || '--' }} 元/袋</div>
-                                <div><b>最小包装规格:</b>{{ form.minSpec || '--' }} g/包</div>
+                                <div><b>预包装销售价:</b>{{ form.packagePrice || '--' }}元/{{ getDictLabel(product_package_unit, form.packageUnit) || '--' }}</div>
+                                <div><b>最小包装规格:</b>{{ form.minSpec || '--' }} {{getDictLabel(product_spec_unit ,form.productSpecUnit )|| '--' }}/{{ getDictLabel(product_package_unit, form.minUnit) || '--' }}</div>
                             </el-col>
                             <el-col :span="12">
                                 <div><b>最小包装单位:</b>{{ getDictLabel(product_package_unit, form.minUnit) || '--' }}</div>
@@ -1090,7 +1094,7 @@
                         <el-divider content-position="left">配置销售设置:</el-divider>
                         <el-row :gutter="40">
                             <el-col :span="12">
-                                <div><b>配置销售价格:</b>{{ form.configSalePrice || '--' }} 元/g</div>
+                                <div><b>配置销售价格:</b>{{ form.configSalePrice || '--' }} 元/{{getDictLabel(product_spec_unit ,form.productSpecUnit )|| '--' }}</div>
                             </el-col>
                             <el-col :span="12">
                                 <div><b>配置损耗率:</b>{{ form.configLossRate || '--' }} %</div>
@@ -1451,11 +1455,12 @@
     import { getCurrentInstance, ComponentInternalInstance, ref, reactive, toRefs, onMounted } from 'vue';
     import { log } from 'console';
     import lableDialog from './labelDialog.vue';
+    import FileUpload from '@/components/FileUpload/index.vue';
     const diseaseLabelDialogVisible = ref(false);
     const contraindicationLabelDialogVisible = ref(false);
 
     const { proxy } = getCurrentInstance() as ComponentInternalInstance;
-    const { product_qualification, dosage_form, product_package_unit, product_supplier, put_flag, product_manufacturer, default_usage } = toRefs < any > (proxy ?.useDict('product_qualification', 'dosage_form', 'product_package_unit', 'product_supplier', 'put_flag', 'product_manufacturer', 'default_usage'));
+    const { product_qualification, dosage_form, product_package_unit, product_supplier, put_flag, product_manufacturer, default_usage, product_spec_unit } = toRefs < any > (proxy ?.useDict('product_qualification', 'dosage_form', 'product_package_unit', 'product_supplier', 'put_flag', 'product_manufacturer', 'default_usage', 'product_spec_unit'));
 
 
     const nutritionList = ref < NutritionVO[] > ([]);
@@ -1472,9 +1477,9 @@
     const headers = ref(globalHeaders()); // 请求头设置
 
     const activeTab = ref('basic');
-    const fileList = ref < UploadFiles > ([]);
     const detailDialogVisible = ref(false);
     const batchSetDialogVisible = ref(false);
+    const fileList = ref([]); // 用于Excel导入的文件列表
     const batchSetForm = reactive({
         shelfLifeReminder: '',
         licenseExpiryReminder: ''
@@ -1607,7 +1612,7 @@
         productFeatures: undefined,
         storageConditions: undefined,
         warningInstructions: undefined,
-        productAttachments: undefined,
+        productAttachments: [],
         status: undefined,
         putFlag: undefined,
         outboundNumber: undefined,
@@ -1887,7 +1892,7 @@
             if (valid) {
                 buttonLoading.value = true;
                 form.value.putFlag = '1';
-                form.value.productSpec = form.value.productSpec && form.value.productSpecUnit ? `${form.value.productSpec}${form.value.productSpecUnit}` : '';
+                // form.value.productSpec = form.value.productSpec && form.value.productSpecUnit ? `${form.value.productSpec}${form.value.productSpecUnit}` : '';
                 if (form.value.id) {
                     await updateNutrition(form.value).finally(() => buttonLoading.value = false);
                 } else {
@@ -1916,10 +1921,7 @@
         }, `nutrition_${new Date().getTime()}.xlsx`)
     }
 
-    /** 文件上传相关操作 */
-    const handleFileChange = (file: UploadFile, uploadFiles: UploadFiles) => {
-        fileList.value = uploadFiles;
-    }
+
 
     const onSpecUnitChange = () => {
         if (!form.value.productSpecUnit) form.value.productSpecUnit = 'g';