1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110 |
- <template>
- <div class="p-2">
- <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
- <div v-show="showSearch" class="mb-[10px]">
- <el-card shadow="hover">
- <el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="150px">
- <el-form-item label="产品分类" prop="productCategory">
- <el-cascader v-model="queryParams.productCategoryList" :options="categoryOptions" :props="{ checkStrictly: true, emitPath: true, value: 'value', label: 'label', children: 'children' }" placeholder="请选择" clearable filterable style="width: 200px" />
- </el-form-item>
- <el-form-item>
- <el-input v-model="queryParams.productName" placeholder="请输入名称/编码" clearable @keyup.enter="handleQuery" style="margin-left: 30px;" />
- </el-form-item>
- <el-form-item>
- <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
- <el-button icon="Refresh" @click="resetQuery">重置</el-button>
- </el-form-item>
- </el-form>
- </el-card>
- </div>
- </transition>
- <el-card shadow="never">
- <template #header>
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['warehouse:nutrition:add']">新增营养产品</el-button>
- </el-col>
- <!-- <el-col :span="1.5">
- <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['warehouse:nutrition:edit']">修改</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['warehouse:nutrition:remove']">删除</el-button>
- </el-col> -->
- <!-- <el-col :span="1.5">
- <el-button type="warning" plain @click="handleImport" v-hasPermi="['system:diseaseLabel:export']">导入</el-button>
- </el-col> -->
- <el-col :span="1.5">
- <el-button type="warning" plain @click="handleExport" v-hasPermi="['warehouse:nutrition:export']">导出</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button type="warning" plain @click="downLoadTemplate" v-hasPermi="['system:diseaseLabel:export']">下载模板下载</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button type="warning" plain @click="openBatchSetDialog">批量设置</el-button>
- </el-col>
- <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
- </el-row>
- </template>
- <el-table v-loading="loading" border :data="nutritionList" @selection-change="handleSelectionChange">
- <el-table-column type="selection" width="55" align="center" />
- <el-table-column label="产品名称" align="center" prop="productName" />
- <el-table-column label="商品编码" align="center" prop="productCode" />
- <el-table-column label="产品分类" align="center">
- <template #default="{ row }">
- {{ getCategoryName(row.productCategory) }}
- </template>
- </el-table-column>
- <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 || '--' }}
- </template>
- </el-table-column>
- <el-table-column label="许可证临期提醒" align="center" prop="licenseExpiryReminder" width="180">
- <template #default="scope">
- <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">
- <template #default="scope">
- <span>{{ scope.row.shelfLifeReminder }}个月</span>
- </template>
- </el-table-column>
- <el-table-column label="上架状态" align="center" prop="putFlag" width="100">
- <template #default="{ row }">
- {{ put_flag.find(item => item.value === row.putFlag)?.label || row.putFlag }}
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
- <template #default="scope">
- <el-button v-if="scope.row.putFlag === '1'" link type="danger" @click="handlePutFlag(scope.row, '0')">下架</el-button>
- <el-button v-else link type="success" @click="handlePutFlag(scope.row, '1')">上架</el-button>
- <el-button link type="primary" @click="handleDetail(scope.row)">详情</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
- </el-card>
- <!-- 添加或修改营养产品信息对话框 -->
- <el-dialog :title="dialog.title" v-model="dialog.visible" width="70%" append-to-body class="nutrition-dialog">
- <el-tabs v-model="activeTab">
- <el-scrollbar height="calc(70vh - 120px)">
- <el-tab-pane label="基本信息" name="basic">
- <el-form ref="nutritionFormRef" :model="form" :rules="rules" label-width="200px">
- <el-divider content-position="left">基本信息:</el-divider>
- <el-row :gutter="20">
- <el-col :span="12">
- <el-form-item label="产品名称:" prop="productName">
- <el-input v-model="form.productName" placeholder="请输入" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="商品资质:" prop="productQualification">
- <el-select v-model="form.productQualification" placeholder="请选择" clearable>
- <el-option v-for="dict in product_qualification" :key="dict.value" :label="dict.label" :value="dict.value" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="12">
- <el-form-item label="院方系统编码:" prop="hospitalSystemCode">
- <el-input v-model="form.hospitalSystemCode" placeholder="请输入" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="批准文号:" prop="approvalNumber">
- <el-input v-model="form.approvalNumber" placeholder="请输入" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="12">
- <el-form-item label="商品编码:" prop="productCode">
- <el-input v-model="form.productCode" placeholder="请输入" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="口味:" prop="taste">
- <el-input v-model="form.taste" placeholder="请输入" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="12">
- <el-form-item label="产品所属分类:" prop="productCategory">
- <el-cascader v-model="form.productCategoryList" :options="categoryOptions" :props="{ checkStrictly: true, emitPath: true, value: 'value', label: 'label', children: 'children' }" placeholder="请选择" clearable filterable style="width: 100%" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="剂型/形态:" prop="dosageForm">
- <el-select v-model="form.dosageForm" placeholder="请选择" clearable>
- <el-option v-for="dict in dosage_form" :key="dict.value" :label="dict.label" :value="dict.value" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="12">
- <el-form-item label="生产厂商:" prop="manufacturer">
- <el-select v-model="form.manufacturer" placeholder="请选择" clearable>
- <el-option v-for="item in productManufacturerList" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="供应商:" prop="supplier">
- <el-select v-model="form.supplier" placeholder="请选择" clearable>
- <el-option v-for="item in productSupplierList" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="12">
- <el-form-item label="品牌:" prop="brand">
- <el-input v-model="form.brand" placeholder="请输入" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="产品适用科室:" prop="applicableDepartment">
- <el-cascader v-model="form.applicableDepartmentList" :options="deptList" :props="{
- multiple: true,checkStrictly: true, // 允许任意层级选择emitPath: false, // 只返回选中节点的 value
- value: 'deptId',label: 'deptName',children: 'children'
- }" placeholder="请选择" clearable style="width: 100%" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="12">
- <el-form-item label="产品所属标签:" prop="productLabelList">
- <el-select v-model="form.productLabelList" multiple placeholder="请选择" style="width: 100%;" :disabled="true" @click="diseaseLabelDialogVisible = true" class="custom-label-select" value-key="labelId">
- <el-option v-for="item in form.productLabelList" :key="item.labelId" :label="item.labelName" :value="item">
- <el-tag type="info" size="small">{{ item.labelName }}</el-tag>
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="禁忌症所属标签:" prop="contraindicationLabelList">
- <el-select v-model="form.contraindicationLabelList" multiple placeholder="请选择" style="width: 100%;" :disabled="true" @mousedown.prevent="contraindicationLabelDialogVisible = true" class="custom-label-select" value-key="labelId">
- <el-option v-for="item in form.contraindicationLabelList" :key="item.labelId" :label="item.labelName" :value="item">
- <el-tag type="info" size="small">{{ item.labelName }}</el-tag>
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="12">
- <el-form-item label="许可证临期提醒:" prop="licenseExpiryReminder">
- <el-input v-model="form.licenseExpiryReminder" placeholder="请输入">
- <template #append>个月</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="保质期临期提醒:" prop="shelfLifeReminder">
- <el-input v-model="form.shelfLifeReminder" placeholder="请输入">
- <template #append>个月</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="12">
- <el-form-item label="商品许可证有效期至:" prop="productLicenseExpiry">
- <el-date-picker v-model="form.productLicenseExpiry" type="date" placeholder="选择一天" value-format="YYYY-MM-DD" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="保质期:" prop="shelfLife">
- <el-input v-model="form.shelfLife" placeholder="请输入">
- <template #append>个月</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <!-- 入货配置部分 -->
- <el-divider content-position="left">入货信息:</el-divider>
- <el-row :gutter="20">
- <el-col :span="12">
- <el-form-item label="入货价格:" prop="purchasePrice" required>
- <el-input v-model="form.purchasePrice" placeholder="请输入">
- <template #append>元</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="入货单位:" prop="purchaseUnit" required>
- <el-select v-model="form.purchaseUnit" placeholder="请选择" clearable>
- <el-option v-for="dict in product_package_unit" :key="dict.value" :label="dict.label" :value="dict.value" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="12">
- <el-form-item label="默认用法:" prop="defaultUsage" required>
- <el-select v-model="form.defaultUsage" placeholder="请选择" clearable>
- <el-option v-for="dict in default_usage" :key="dict.value" :label="dict.label" :value="dict.value" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="预包装单位:" prop="packageUnit">
- <el-select v-model="form.packageUnit" placeholder="请选择" clearable>
- <el-option v-for="dict in product_package_unit" :key="dict.value" :label="dict.label" :value="dict.value" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="12">
- <el-form-item label="商品规格:" prop="productSpec" required>
- <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 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;">/{{getDictLabel(product_package_unit ,form.packageUnit )|| '--' }}</span>
- </div>
- </el-form-item>
- </el-col>
- </el-row>
- <el-divider content-position="left">预包装销售设置:</el-divider>
- <el-row :gutter="20">
- <el-col :span="12">
- <el-form-item label="预包装销售价:" prop="packagePrice" required>
- <el-input v-model="form.packagePrice" placeholder="请输入">
- <template #append>元/{{getDictLabel(product_package_unit ,form.packageUnit )|| '--' }}</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="最小包装单位:" prop="minUnit">
- <el-select v-model="form.minUnit" placeholder="请选择" clearable>
- <el-option v-for="dict in product_package_unit" :key="dict.value" :label="dict.label" :value="dict.value" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="12">
- <el-form-item label="最小包装规格:" prop="minSpec">
- <el-input v-model="form.minSpec" placeholder="请输入">
- <template #append>{{getDictLabel(product_spec_unit ,form.productSpecUnit )|| '--' }}/{{getDictLabel(product_package_unit ,form.minUnit )|| '--' }}</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="净含量/规格:" prop="minUnit">
- <span>--</span>
- </el-form-item>
- </el-col>
- </el-row>
- <el-divider content-position="left">配置销售设置::</el-divider>
- <el-row :gutter="20">
- <el-col :span="12">
- <el-form-item label="配置销售价格:" prop="configSalePrice" required>
- <el-input v-model="form.configSalePrice" placeholder="请输入">
- <template #append>元/{{getDictLabel(product_spec_unit ,form.productSpecUnit )|| '--' }}</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="配置损耗率:" prop="configLossRate">
- <el-input v-model="form.configLossRate" placeholder="请输入">
- <template #append>%</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </el-tab-pane>
- <el-tab-pane label="热能及三大营养素" name="nutrition">
- <span style="color: red; font-size: 16px; margin-bottom: 20px">注:每100(g/ml) 含量</span>
- <el-form ref="nutritionFormRef" :model="form" :rules="rules" label-width="200px">
- <el-row :gutter="20" style="margin-top:20px">
- <el-col :span="8">
- <el-form-item label="热量:" prop="calorie">
- <el-input v-model="form.calorie" placeholder="请输入">
- <template #append>kcal</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="碳水化合物:" prop="carbohydrate">
- <el-input v-model="form.carbohydrate" placeholder="请输入">
- <template #append>g</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="热能:" prop="heatEnergy">
- <el-input v-model="form.heatEnergy" placeholder="请输入">
- <template #append>kj</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="蛋白质:" prop="protein">
- <el-input v-model="form.protein" placeholder="请输入">
- <template #append>g</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="脂肪:" prop="fat">
- <el-input v-model="form.fat" placeholder="请输入">
- <template #append>g</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </el-tab-pane>
- <el-tab-pane label="常量元素" name="macroElements">
- <span style="color: red; font-size: 16px; margin-bottom: 10px">注:每100(g/ml) 含量</span>
- <el-form ref="nutritionFormRef" :model="form" :rules="rules" label-width="200px">
- <el-row :gutter="20" style="margin-top:20px">
- <el-col :span="8">
- <el-form-item label="钙:" prop="ca">
- <el-input v-model="form.ca" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="磷:" prop="p">
- <el-input v-model="form.p" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="钾:" prop="k">
- <el-input v-model="form.k" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="钠:" prop="na">
- <el-input v-model="form.na" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="镁:" prop="mg">
- <el-input v-model="form.mg" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="氯:" prop="cl">
- <el-input v-model="form.cl" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </el-tab-pane>
- <el-tab-pane label="微量元素" name="microElements">
- <span style="color: red; font-size: 16px; margin-bottom: 10px">注:每100(g/ml) 含量</span>
- <el-form ref="nutritionFormRef" :model="form" :rules="rules" label-width="200px">
- <el-row :gutter="20" style="margin-top:20px">
- <el-col :span="8">
- <el-form-item label="铁:" prop="fe">
- <el-input v-model="form.fe" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="锌:" prop="zn">
- <el-input v-model="form.zn" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="硒:" prop="se">
- <el-input v-model="form.se" placeholder="请输入">
- <template #append>μg</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="铜:" prop="cu">
- <el-input v-model="form.cu" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="锰:" prop="mn">
- <el-input v-model="form.mn" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="碘:" prop="i">
- <el-input v-model="form.i" placeholder="请输入">
- <template #append>μg</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="氟:" prop="f">
- <el-input v-model="form.f" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="铬:" prop="cr">
- <el-input v-model="form.cr" placeholder="请输入">
- <template #append>μg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="钼:" prop="mo">
- <el-input v-model="form.mo" placeholder="请输入">
- <template #append>μg</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </el-tab-pane>
- <el-tab-pane label="氨基酸" name="aminoAcids">
- <span style="color: red; font-size: 16px; margin-bottom: 10px">注:每100(g/ml) 含量</span>
- <el-form ref="nutritionFormRef" :model="form" :rules="rules" label-width="200px">
- <el-row :gutter="20" style="margin-top:20px">
- <el-col :span="8">
- <el-form-item label="异亮氨酸:" prop="isoleucine">
- <el-input v-model="form.isoleucine" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="色氨酸:" prop="tryptophan">
- <el-input v-model="form.tryptophan" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="含硫氨基酸:" prop="sulfurAminoAcid">
- <el-input v-model="form.sulfurAminoAcid" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="组氨酸:" prop="histidine">
- <el-input v-model="form.histidine" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="芳香族氨基酸:" prop="aromaticAminoAcid">
- <el-input v-model="form.aromaticAminoAcid" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="谷氨酸:" prop="glutamicAcid">
- <el-input v-model="form.glutamicAcid" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="苏氨酸:" prop="threonine">
- <el-input v-model="form.threonine" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="丝氨酸:" prop="serine">
- <el-input v-model="form.serine" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="精氨酸:" prop="arginine">
- <el-input v-model="form.arginine" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="赖氨酸:" prop="lysine">
- <el-input v-model="form.lysine" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="天冬氨酸:" prop="asparticAcid">
- <el-input v-model="form.asparticAcid" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="胱氨酸:" prop="cysteine">
- <el-input v-model="form.cysteine" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="脯氨酸:" prop="proline">
- <el-input v-model="form.proline" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="酪氨酸:" prop="tyrosine">
- <el-input v-model="form.tyrosine" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="亮氨酸:" prop="leucine">
- <el-input v-model="form.leucine" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="缬氨酸:" prop="valine">
- <el-input v-model="form.valine" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="蛋氨酸:" prop="methionine">
- <el-input v-model="form.methionine" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="丙氨酸:" prop="alanine">
- <el-input v-model="form.alanine" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="苯丙氨酸:" prop="phenylalanine">
- <el-input v-model="form.phenylalanine" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="甘氨酸:" prop="glycine">
- <el-input v-model="form.glycine" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </el-tab-pane>
- <el-tab-pane label="脂肪酸" name="fattyAcids">
- <span style="color: red; font-size: 16px; margin-bottom: 10px">注:每100(g/ml) 含量</span>
- <el-form ref="nutritionFormRef" :model="form" :rules="rules" label-width="200px">
- <el-row :gutter="20" style="margin-top:20px">
- <el-col :span="8">
- <el-form-item label="脂肪酸:" prop="fattyAcid">
- <el-input v-model="form.fattyAcid" placeholder="请输入">
- <template #append>g</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="饱和脂肪酸:" prop="saturatedFattyAcid">
- <el-input v-model="form.saturatedFattyAcid" placeholder="请输入">
- <template #append>g</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="单不饱和脂肪酸:" prop="monounsaturatedFattyAcid">
- <el-input v-model="form.monounsaturatedFattyAcid" placeholder="请输入">
- <template #append>g</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="多不饱和脂肪酸:" prop="polyunsaturatedFattyAcid">
- <el-input v-model="form.polyunsaturatedFattyAcid" placeholder="请输入">
- <template #append>g</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </el-tab-pane>
- <el-tab-pane label="维生素" name="vitamins">
- <span style="color: red; font-size: 16px; margin-bottom: 10px">注:每100(g/ml) 含量</span>
- <el-form ref="nutritionFormRef" :model="form" :rules="rules" label-width="200px">
- <el-row :gutter="20" style="margin-top:20px">
- <el-col :span="8">
- <el-form-item label="维生素A:" prop="vitaminA">
- <el-input v-model="form.vitaminA" placeholder="请输入">
- <template #append>μgRAE</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="维生素A(胡萝卜素):" prop="vitaminACarotene">
- <el-input v-model="form.vitaminACarotene" placeholder="请输入">
- <template #append>μg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="维生素A醇:" prop="vitaminAAlcohol">
- <el-input v-model="form.vitaminAAlcohol" placeholder="请输入">
- <template #append>μg</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="维生素D:" prop="vitaminD">
- <el-input v-model="form.vitaminD" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="维生素E:" prop="vitaminE">
- <el-input v-model="form.vitaminE" placeholder="请输入">
- <template #append>mgα-TE</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="维生素E(生育酚):" prop="vitaminETocopherol">
- <el-input v-model="form.vitaminETocopherol" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="维生素K:" prop="vitaminK">
- <el-input v-model="form.vitaminK" placeholder="请输入">
- <template #append>ug</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="维生素B1:" prop="vitaminBOne">
- <el-input v-model="form.vitaminBOne" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="维生素B2:" prop="vitaminBTwo">
- <el-input v-model="form.vitaminBTwo" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="维生素B6:" prop="vitaminBSix">
- <el-input v-model="form.vitaminBSix" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="维生素B12:" prop="vitaminBTwelve">
- <el-input v-model="form.vitaminBTwelve" placeholder="请输入">
- <template #append>μg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="烟酸(尼克酸):" prop="niacin">
- <el-input v-model="form.niacin" placeholder="请输入">
- <template #append>mgNE</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="维生素C:" prop="vitaminC">
- <el-input v-model="form.vitaminC" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="叶酸:" prop="folicAcid">
- <el-input v-model="form.folicAcid" placeholder="请输入">
- <template #append>μgDFE</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="胆碱:" prop="choline">
- <el-input v-model="form.choline" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="生物素:" prop="biotin">
- <el-input v-model="form.biotin" placeholder="请输入">
- <template #append>μg</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="泛酸:" prop="pantothenicAcid">
- <el-input v-model="form.pantothenicAcid" placeholder="请输入">
- <template #append>mg</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </el-tab-pane>
- <el-tab-pane label="脂类" name="lipids">
- <span style="color: red; font-size: 16px; margin-bottom: 10px">注:每100(g/ml) 含量</span>
- <el-form ref="nutritionFormRef" :model="form" :rules="rules" label-width="200px">
- <el-row :gutter="20" style="margin-top:20px">
- <el-col :span="8">
- <el-form-item label="胆固醇:" prop="cholesterol">
- <el-input v-model="form.cholesterol" placeholder="请输入">
- <template #append>g</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </el-tab-pane>
- <el-tab-pane label="其他" name="others">
- <span style="color: red; font-size: 16px; margin-bottom: 10px">注:每100(g/ml) 含量</span>
- <el-form ref="nutritionFormRef" :model="form" :rules="rules" label-width="200px" style="margin-top:20px">
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="血糖生成指数:" prop="bloodGlucoseIndex">
- <el-input v-model="form.bloodGlucoseIndex" placeholder="请输入">
- <template #append>%</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="不可溶性膳食纤维:" prop="insolubleDietaryFiber">
- <el-input v-model="form.insolubleDietaryFiber" placeholder="请输入">
- <template #append>g</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="膳食纤维:" prop="dietaryFiber">
- <el-input v-model="form.dietaryFiber" placeholder="请输入">
- <template #append>g</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="8">
- <el-form-item label="灰分:" prop="ash">
- <el-input v-model="form.ash" placeholder="请输入">
- <template #append>g</template>
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="可溶性膳食纤维:" prop="solubleDietaryFiber">
- <el-input v-model="form.solubleDietaryFiber" placeholder="请输入">
- <template #append>g</template>
- </el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </el-tab-pane>
- <el-tab-pane label="商品说明" name="productDescription">
- <el-form ref="nutritionFormRef" :model="form" :rules="rules" label-width="200px">
- <el-row :gutter="20" style="margin-top:20px">
- <el-col :span="12">
- <el-form-item label="适用人群:" prop="applicableCrowd">
- <el-input v-model="form.applicableCrowd" type="textarea" maxlength="300" show-word-limit :rows="4" placeholder="请输入" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="不适用人群:" prop="unsuitableCrowd">
- <el-input v-model="form.unsuitableCrowd" type="textarea" maxlength="300" show-word-limit :rows="4" placeholder="请输入" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20" style="margin-top:20px">
- <el-col :span="12">
- <el-form-item label="渗透压:" prop="osmoticPressure">
- <el-input v-model="form.osmoticPressure" type="textarea" maxlength="300" show-word-limit :rows="4" placeholder="请输入" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="原料:" prop="rawMaterial">
- <el-input v-model="form.rawMaterial" type="textarea" maxlength="300" show-word-limit :rows="4" placeholder="请输入" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20" style="margin-top:20px">
- <el-col :span="12">
- <el-form-item label="适应症及禁忌:" prop="indicationsContraindications">
- <el-input v-model="form.indicationsContraindications" type="textarea" maxlength="300" show-word-limit :rows="4" placeholder="请输入" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="食用方法和食用量:" prop="usageAndDosage">
- <el-input v-model="form.usageAndDosage" type="textarea" maxlength="300" show-word-limit :rows="4" placeholder="请输入" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20" style="margin-top:20px">
- <el-col :span="12">
- <el-form-item label="产品特点:" prop="productFeatures">
- <el-input v-model="form.productFeatures" type="textarea" maxlength="300" show-word-limit :rows="4" placeholder="请输入" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="储存条件:" prop="storageConditions">
- <el-input v-model="form.storageConditions" type="textarea" maxlength="300" show-word-limit :rows="4" placeholder="请输入" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20" style="margin-top:20px">
- <el-col :span="12">
- <el-form-item label="警示说明及注意事项:" prop="warningInstructions">
- <el-input v-model="form.warningInstructions" type="textarea" maxlength="300" show-word-limit :rows="4" placeholder="请输入" />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </el-tab-pane>
- <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">
- <FileUpload v-model="form.productAttachmentList" :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>
- </el-scrollbar>
- </el-tabs>
- <template #footer>
- <div class="dialog-footer" style="text-align: center">
- <el-button type="primary" @click="submitForm">保存</el-button>
- <el-button type="primary" @click="submitFormAndPutaway">保存并上架</el-button>
- </div>
- </template>
- </el-dialog>
- <el-dialog title="批量设置" v-model="batchSetDialogVisible" width="400px" append-to-body>
- <el-form :model="batchSetForm" label-width="120px" :rules="batchRules">
- <el-form-item label="保质期临期提醒" prop="shelfLifeReminder">
- <el-input v-model="batchSetForm.shelfLifeReminder" min="1" placeholder="请输入" style="width: 200px;">
- <template #append>个月</template>
- </el-input>
- </el-form-item>
- <el-form-item label="许可证临期提醒" prop="licenseExpiryReminder">
- <el-input v-model="batchSetForm.licenseExpiryReminder" min="1" placeholder="请输入" style="width: 200px;">
- <template #append>个月</template>
- </el-input>
- </el-form-item>
- </el-form>
- <template #footer>
- <el-button type="primary" @click="handleBatchSetSubmit">提交</el-button>
- <el-button @click="batchSetDialogVisible = false">取消</el-button>
- </template>
- </el-dialog>
- <!-- 新增详情弹窗,内容全部静态分组展示,仿照a1.png -->
- <el-dialog title="营养产品详情" v-model="detailDialogVisible" width="60%" append-to-body class="nutrition-dialog">
- <el-tabs v-model="activeTab">
- <el-scrollbar height="calc(80vh - 120px)">
- <el-tab-pane label="基本信息" name="basic">
- <el-divider content-position="left">基本信息:</el-divider>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="12">
- <div><b><span style="color:red;margin-right: 3px">*</span>产品名称:</b>{{ form.productName || '--' }}</div>
- <div><b><span style="color:red;margin-right: 3px">*</span>院方系统编码:</b>{{ form.hospitalSystemCode || '--' }}</div>
- <div><b><span style="color:red;margin-right: 3px">*</span>商品编码:</b>{{ form.productCode || '--' }}</div>
- <div><b><span style="color:red;margin-right: 3px">*</span>产品所属分类:</b>{{ form.productCategory || '--' }}</div>
- <div><b>生产厂商:</b>{{ productManufacturerList.find(item => item.value === form.manufacturer)?.label || '--' }}</div>
- <div><b>品牌:</b>{{ form.brand || '--' }}</div>
- <div><b>产品所属标签:</b>{{ form.productLabel || '--' }}</div>
- <div><b>许可证临期提醒:</b>{{ form.licenseExpiryReminder || '--' }}</div>
- <div><b>商品许可证有效期至:</b>{{ form.productLicenseExpiry ? (form.productLicenseExpiry.slice(0, 10)) : '--' }}</div>
- </el-col>
- <el-col :span="12">
- <div><b><span style="color:red;margin-right: 3px">*</span>商品资质:</b>{{ getDictLabel(product_qualification, form.productQualification) || '--' }}</div>
- <div><b>批准文号:</b>{{ form.approvalNumber || '--' }}</div>
- <div><b>口味:</b>{{ form.taste || '--' }}</div>
- <div><b>剂型/形态:</b>{{ getDictLabel(dosage_form, form.dosageForm) || '--' }}</div>
- <div><b>供应商:</b>{{ productSupplierList.find(item => item.value === form.supplier)?.label || '--' }}</div>
- <div><b>产品适用科室:</b>{{ form.applicableDepartment|| '--' }}</div>
- <div><b>禁忌症所属标签:</b>{{ form.contraindicationLabel || '--' }}</div>
- <div><b><span style="color:red;margin-right: 3px">*</span>保质期临期提醒:</b>{{ form.shelfLifeReminder || '--' }}</div>
- <div><b>保质期:</b>{{ form.shelfLife || '--' }}</div>
- </el-col>
- </el-row>
- <el-divider content-position="left">入货信息:</el-divider>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="12">
- <div><b><span style="color:red;margin-right: 3px">*</span>入货价格:</b>{{ form.purchasePrice || '--' }} 元</div>
- <div><b>默认用法:</b>{{ getDictLabel(default_usage, form.defaultUsage) || '--' }}</div>
- <div><b><span style="color:red;margin-right: 3px">*</span>商品规格:</b>{{ form.productSpec || '--' }}{{getDictLabel(product_spec_unit ,form.productSpecUnit )|| '--' }}/{{getDictLabel(product_package_unit ,form.packageUnit )|| '--' }}</div>
- </el-col>
- <el-col :span="12">
- <div><b><span style="color:red;margin-right: 3px">*</span>入货单位:</b>{{ getDictLabel(product_package_unit, form.purchaseUnit) || '--' }}</div>
- <div><b><span style="color:red;margin-right: 3px">*</span>预包装单位:</b>{{ getDictLabel(product_package_unit, form.packageUnit) || '--' }}</div>
- </el-col>
- </el-row>
- <el-divider content-position="left">预包装销售设置:</el-divider>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="12">
- <div><b><span style="color:red;margin-right: 3px">*</span>预包装销售价:</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>
- <div><b>净含量/规格:</b>{{ form.netContent || '--' }}</div>
- </el-col>
- </el-row>
- <el-divider content-position="left">配置销售设置:</el-divider>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="12">
- <div><b><span style="color:red;margin-right: 3px">*</span>配置销售价格:</b>{{ form.configSalePrice || '--' }} 元/{{getDictLabel(product_spec_unit ,form.productSpecUnit )|| '--' }}</div>
- </el-col>
- <el-col :span="12">
- <div><b>配置损耗率:</b>{{ form.configLossRate || '--' }} %</div>
- </el-col>
- </el-row>
- </el-tab-pane>
- <el-tab-pane label="热能及三大营养素" name="nutrition">
- <span style="color: red; font-size: 16px; margin-bottom: 10px">注:每100(g/ml) 含量</span>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="6">
- <div><b>热量:</b>{{ form.calorie || '--' }} kcal</div>
- </el-col>
- <el-col :span="6">
- <div><b>碳水化合物:</b>{{ form.carbohydrate || '--' }} g</div>
- </el-col>
- <el-col :span="6">
- <div><b>热能:</b>{{ form.heatEnergy || '--' }} g</div>
- </el-col>
- <el-col :span="6">
- <div><b>蛋白质:</b>{{ form.protein || '--' }} g</div>
- </el-col>
- </el-row>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="6">
- <div><b>脂肪:</b>{{ form.fat || '--' }} g</div>
- </el-col>
- </el-row>
- </el-tab-pane>
- <el-tab-pane label="常量元素" name="macroElements">
- <span style="color: red; font-size: 16px; margin-bottom: 10px">注:每100(g/ml) 含量</span>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="6">
- <div><b>钙:</b>{{ form.ca || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>磷:</b>{{ form.p || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>钾:</b>{{ form.k || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>钠:</b>{{ form.na || '--' }} mg</div>
- </el-col>
- </el-row>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="6">
- <div><b>镁:</b>{{ form.mg || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>氯:</b>{{ form.cl || '--' }} mg</div>
- </el-col>
- </el-row>
- </el-tab-pane>
- <el-tab-pane label="微量元素" name="microElements">
- <span style="color: red; font-size: 16px; margin-bottom: 10px">注:每100(g/ml) 含量</span>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="6">
- <div><b>铁:</b>{{ form.fe || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>锌:</b>{{ form.zn || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>硒:</b>{{ form.se || '--' }} μg</div>
- </el-col>
- <el-col :span="6">
- <div><b>铜:</b>{{ form.cu || '--' }} mg</div>
- </el-col>
- </el-row>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="6">
- <div><b>锰:</b>{{ form.mn || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>碘:</b>{{ form.i || '--' }} μg</div>
- </el-col>
- <el-col :span="6">
- <div><b>氟:</b>{{ form.f || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>铬:</b>{{ form.cr || '--' }} μg</div>
- </el-col>
- </el-row>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="12">
- <div><b>钼:</b>{{ form.mo || '--' }} μg</div>
- </el-col>
- </el-row>
- </el-tab-pane>
- <el-tab-pane label="氨基酸" name="aminoAcids">
- <span style="color: red; font-size: 16px; margin-bottom: 10px">注:每100(g/ml) 含量</span>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="6">
- <div><b>异亮氨酸:</b>{{ form.isoleucine || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>色氨酸:</b>{{ form.tryptophan || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>含硫氨基酸:</b>{{ form.sulfurAminoAcid || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>组氨酸:</b>{{ form.histidine || '--' }} mg</div>
- </el-col>
- </el-row>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="6">
- <div><b>芳香族氨基酸:</b>{{ form.aromaticAminoAcid || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>谷氨酸:</b>{{ form.glutamicAcid || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>苏氨酸:</b>{{ form.threonine || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>丝氨酸:</b>{{ form.serine || '--' }} mg</div>
- </el-col>
- </el-row>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="6">
- <div><b>精氨酸:</b>{{ form.arginine || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>赖氨酸:</b>{{ form.lysine || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>天冬氨酸:</b>{{ form.asparticAcid || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>胱氨酸:</b>{{ form.cysteine || '--' }} mg</div>
- </el-col>
- </el-row>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="6">
- <div><b>脯氨酸:</b>{{ form.proline || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>酪氨酸:</b>{{ form.tyrosine || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>亮氨酸:</b>{{ form.leucine || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>缬氨酸:</b>{{ form.valine || '--' }} mg</div>
- </el-col>
- </el-row>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="6">
- <div><b>蛋氨酸:</b>{{ form.methionine || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>丙氨酸:</b>{{ form.alanine || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>苯丙氨酸:</b>{{ form.phenylalanine || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>甘氨酸:</b>{{ form.glycine || '--' }} mg</div>
- </el-col>
- </el-row>
- </el-tab-pane>
- <el-tab-pane label="脂肪酸" name="fattyAcids">
- <span style="color: red; font-size: 16px; margin-bottom: 10px">注:每100(g/ml) 含量</span>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="6">
- <div><b>脂肪酸:</b>{{ form.fattyAcid || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>饱和脂肪酸:</b>{{ form.saturatedFattyAcid || '--' }} g</div>
- </el-col>
- <el-col :span="6">
- <div><b>单不饱和脂肪酸:</b>{{ form.monounsaturatedFattyAcid || '--' }} g</div>
- </el-col>
- <el-col :span="6">
- <div><b>多不饱和脂肪酸:</b>{{ form.polyunsaturatedFattyAcid || '--' }} g</div>
- </el-col>
- </el-row>
- </el-tab-pane>
- <el-tab-pane label="维生素" name="vitamins">
- <span style="color: red; font-size: 16px; margin-bottom: 10px">注:每100(g/ml) 含量</span>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="6">
- <div><b>维生素A:</b>{{ form.vitaminA || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>维生素A(胡萝卜素):</b>{{ form.vitaminACarotene || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>维生素A醇:</b>{{ form.vitaminAAlcohol || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>维生素D:</b>{{ form.vitaminD || '--' }} mg</div>
- </el-col>
- </el-row>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="6">
- <div><b>维生素E:</b>{{ form.vitaminE || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>维生素E(生育酚):</b>{{ form.vitaminETocopherol || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>维生素K:</b>{{ form.vitaminK || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>维生素B1:</b>{{ form.vitaminBOne || '--' }} mg</div>
- </el-col>
- </el-row>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="6">
- <div><b>维生素B2:</b>{{ form.vitaminBTwo || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>维生素B6:</b>{{ form.vitaminBSix || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>维生素B12:</b>{{ form.vitaminBTwelve || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>烟酸(尼克酸):</b>{{ form.niacin || '--' }} mg</div>
- </el-col>
- </el-row>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="6">
- <div><b>维生素C:</b>{{ form.vitaminC || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>叶酸:</b>{{ form.folicAcid || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>胆碱:</b>{{ form.choline || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>生物素:</b>{{ form.biotin || '--' }} mg</div>
- </el-col>
- </el-row>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="6">
- <div><b>泛酸:</b>{{ form.pantothenicAcid || '--' }} mg</div>
- </el-col>
- </el-row>
- </el-tab-pane>
- <el-tab-pane label="脂类" name="lipids">
- <span style="color: red; font-size: 16px; margin-bottom: 10px">注:每100(g/ml) 含量</span>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="12">
- <div><b>胆固醇:</b>{{ form.cholesterol || '--' }} mg</div>
- </el-col>
- </el-row>
- </el-tab-pane>
- <el-tab-pane label="其他" name="others">
- <span style="color: red; font-size: 16px; margin-bottom: 10px">注:每100(g/ml) 含量</span>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="6">
- <div><b>血糖生成指数:</b>{{ form.bloodGlucoseIndex || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>不可溶性膳食纤维:</b>{{ form.insolubleDietaryFiber || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>膳食纤维:</b>{{ form.dietaryFiber || '--' }} mg</div>
- </el-col>
- <el-col :span="6">
- <div><b>灰分:</b>{{ form.ash || '--' }} mg</div>
- </el-col>
- </el-row>
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="6">
- <div><b>可溶性膳食纤维:</b>{{ form.solubleDietaryFiber || '--' }} mg</div>
- </el-col>
- </el-row>
- </el-tab-pane>
- <el-tab-pane label="商品说明" name="productDescription">
- <el-row :gutter="40" style="margin-top: 50px">
- <el-col :span="12">
- <div><b>适用人群:</b>{{ form.applicableCrowd || '--' }} </div>
- </el-col>
- <el-col :span="12">
- <div><b>不适用人群:</b>{{ form.unsuitableCrowd || '--' }} </div>
- </el-col>
- </el-row>
- <el-row :gutter="40" style="margin-top: 50px">
- <el-col :span="12">
- <div><b>渗透压:</b>{{ form.osmoticPressure || '--' }} </div>
- </el-col>
- <el-col :span="12">
- <div><b>原料:</b>{{ form.rawMaterial || '--' }} </div>
- </el-col>
- </el-row>
- <el-row :gutter="40" style="margin-top: 50px">
- <el-col :span="12">
- <div><b>适应症及禁忌:</b>{{ form.indicationsContraindications || '--' }} </div>
- </el-col>
- <el-col :span="12">
- <div><b>食用方法和食用量:</b>{{ form.usageAndDosage || '--' }} </div>
- </el-col>
- </el-row>
- <el-row :gutter="40" style="margin-top: 50px">
- <el-col :span="12">
- <div><b>产品特点:</b>{{ form.productFeatures || '--' }} </div>
- </el-col>
- <el-col :span="12">
- <div><b>储存条件:</b>{{ form.storageConditions || '--' }} </div>
- </el-col>
- </el-row>
- <el-row :gutter="40" style="margin-top: 50px">
- <el-col :span="12">
- <div><b>警示说明及注意事项:</b>{{ form.warningInstructions || '--' }} </div>
- </el-col>
- </el-row>
- </el-tab-pane>
- <el-tab-pane label="商品附件" name="productAttachments">
- <el-row :gutter="40" style="margin-top: 30px">
- <el-col :span="24">
- <div>
- <b>商品附件:</b>
- <div v-if="form.productAttachmentsList && form.productAttachmentsList.length">
- <div v-for="(file, idx) in form.productAttachmentsList" :key="idx">
- <a :href="file.url" target="_blank">{{ file.name }}</a>
- </div>
- </div>
- <div v-else>--</div>
- </div>
- </el-col>
- </el-row>
- </el-tab-pane>
- </el-scrollbar>
- </el-tabs>
- </el-dialog>
- <!-- 上传excel -->
- <el-dialog :title="dialogFile.title" v-model="dialogFile.visible" width="700px" append-to-body>
- <el-upload drag :action="uploadFileUrl" :headers="headers" :file-list="fileList" accept=".xlsx,.xls" ref="imageUploadRef" :on-success="handleUploadSuccess" :before-upload="handleBeforeUpload" :on-error="handleUploadError">
- <el-icon class="el-icon--upload">
- <upload-filled />
- </el-icon>
- <div class="el-upload__text">
- 将文件拖到此处,或 <em>点击上传</em>
- </div>
- </el-upload>
- <div class="el-upload__tip">
- 请上传 .xls , .xlsx 标准格式文件
- </div>
- </el-dialog>
- <!-- 添加疾病标签弹窗 -->
- <LabelDialog v-model="diseaseLabelDialogVisible" :initial-selected-labels="form.productLabelList || []" @confirm="onLabelConfirm" />
- <!-- 添加禁忌症标签弹窗 -->
- <LabelDialog v-model="contraindicationLabelDialogVisible" :initial-selected-labels="form.contraindicationLabelList || []" @confirm="onContraindicationLabelConfirm" />
- </div>
- </template>
- <script setup lang="ts">
- import { ref, reactive, onMounted, getCurrentInstance } from 'vue';
- import { listNutrition, getNutrition, delNutrition, addNutrition, updateNutrition, batchUpdateNutrition } from '@/api/warehouse/productNutrition/index';
- import { NutritionVO, NutritionQuery, NutritionForm } from '@/api/warehouse/productNutrition/types';
- import { listCategory } from '@/api/warehouse/productCategory/index';
- import { listDept } from '@/api/system/dept';
- import { listSupplier } from '@/api/warehouse/productSupplier'
- import { listManufacturer } from '@/api/warehouse/productManufacturer'
- import { globalHeaders } from '@/utils/request';
- import { FormInstance, ElMessageBox, UploadFile, UploadFiles } from 'element-plus';
- import { log } from 'console';
- import LabelDialog from './labelDialog.vue';
- import FileUpload from '@/components/FileUpload/index.vue';
- import { ManufacturerVO } from '@/api/warehouse/productManufacturer/types';
- import type { SupplierQuery } from '@/api/warehouse/productSupplier/types';
- import type { ManufacturerQuery } from '@/api/warehouse/productManufacturer/types';
- const diseaseLabelDialogVisible = ref(false);
- const contraindicationLabelDialogVisible = ref(false);
- const { proxy } = getCurrentInstance() as ComponentInternalInstance;
- const { product_qualification, dosage_form, product_package_unit, put_flag, default_usage, product_spec_unit } = toRefs < any > (proxy ?.useDict('product_qualification', 'dosage_form', 'product_package_unit', 'put_flag', 'default_usage', 'product_spec_unit'));
- const nutritionList = ref < NutritionVO[] > ([]);
- const baseUrl = import.meta.env.VITE_APP_BASE_API; // 上传文件地址
- const uploadFileUrl = ref(baseUrl + 'warehouse/nutrition/importExcel');
- const buttonLoading = ref(false);
- const loading = ref(true);
- const showSearch = ref(true);
- const ids = ref < Array < string | number >> ([]);
- const single = ref(true);
- const multiple = ref(true);
- const total = ref(0);
- const headers = ref(globalHeaders()); // 请求头设置
- const activeTab = ref('basic');
- const detailDialogVisible = ref(false);
- const batchSetDialogVisible = ref(false);
- const fileList = ref([]); // 用于Excel导入的文件列表
- const batchSetForm = reactive({
- shelfLifeReminder: '',
- licenseExpiryReminder: ''
- });
- const batchRules = {
- shelfLifeReminder: [{ required: true, message: "保质期临期提醒不能为空", trigger: "blur" }],
- licenseExpiryReminder: [{ required: true, message: "许可证临期提醒不能为空", trigger: "blur" }],
- };
- const treeData = ref([]); // 定义 treeData
- const deptList = ref([]); // 定义 科室list
- const queryFormRef = ref < FormInstance > ();
- const nutritionFormRef = ref < FormInstance > ();
- const dialog = reactive < DialogOption > ({
- visible: false,
- title: ''
- });
- const dialogFile = reactive < DialogOption > ({
- visible: false,
- title: '请上传'
- });
- const initFormData: NutritionForm = {
- id: undefined,
- ids: undefined,
- productName: undefined,
- hospitalSystemCode: undefined,
- productCode: undefined,
- productCategory: undefined,
- productCategoryList: undefined,
- manufacturer: undefined,
- brand: undefined,
- licenseExpiryReminder: undefined,
- productLicenseExpiry: undefined,
- productQualification: undefined,
- approvalNumber: undefined,
- taste: undefined,
- dosageForm: undefined,
- supplier: undefined,
- applicableDepartment: undefined,
- applicableDepartmentList: undefined,
- contraindicationLabel: undefined,
- shelfLifeReminder: undefined,
- shelfLife: undefined,
- purchasePrice: undefined,
- purchaseUnit: '2',
- defaultUsage: '2',
- packageUnit: '2',
- productSpec: undefined,
- productSpecValue: undefined,
- productSpecUnit: '1',
- packagePrice: undefined,
- minUnit: '3',
- minSpec: undefined,
- netContent: undefined,
- configSalePrice: undefined,
- configLossRate: undefined,
- calorie: undefined,
- carbohydrate: undefined,
- heatEnergy: undefined,
- protein: undefined,
- fat: undefined,
- moisture: undefined,
- ca: undefined,
- p: undefined,
- k: undefined,
- na: undefined,
- mg: undefined,
- cl: undefined,
- fe: undefined,
- zn: undefined,
- se: undefined,
- cu: undefined,
- mn: undefined,
- i: undefined,
- f: undefined,
- cr: undefined,
- mo: undefined,
- isoleucine: undefined,
- tryptophan: undefined,
- sulfurAminoAcid: undefined,
- histidine: undefined,
- aromaticAminoAcid: undefined,
- glutamicAcid: undefined,
- threonine: undefined,
- serine: undefined,
- arginine: undefined,
- lysine: undefined,
- asparticAcid: undefined,
- cysteine: undefined,
- proline: undefined,
- tyrosine: undefined,
- leucine: undefined,
- valine: undefined,
- methionine: undefined,
- alanine: undefined,
- phenylalanine: undefined,
- glycine: undefined,
- fattyAcid: undefined,
- saturatedFattyAcid: undefined,
- monounsaturatedFattyAcid: undefined,
- polyunsaturatedFattyAcid: undefined,
- vitaminA: undefined,
- vitaminACarotene: undefined,
- vitaminAAlcohol: undefined,
- vitaminD: undefined,
- vitaminE: undefined,
- vitaminETocopherol: undefined,
- vitaminK: undefined,
- vitaminBOne: undefined,
- vitaminBTwo: undefined,
- vitaminBSix: undefined,
- vitaminBTwelve: undefined,
- niacin: undefined,
- vitaminC: undefined,
- folicAcid: undefined,
- choline: undefined,
- biotin: undefined,
- pantothenicAcid: undefined,
- cholesterol: undefined,
- bloodGlucoseIndex: undefined,
- insolubleDietaryFiber: undefined,
- dietaryFiber: undefined,
- ash: undefined,
- solubleDietaryFiber: undefined,
- applicableCrowd: undefined,
- unsuitableCrowd: undefined,
- osmoticPressure: undefined,
- rawMaterial: undefined,
- indicationsContraindications: undefined,
- usageAndDosage: undefined,
- productFeatures: undefined,
- storageConditions: undefined,
- warningInstructions: undefined,
- productAttachments: undefined,
- productAttachmentsList: [],
- status: undefined,
- putFlag: undefined,
- outboundNumber: undefined,
- productLabel: undefined,
- productLabelList: [],
- contraindicationLabelList: [],
- };
- const data = reactive < PageData < NutritionForm,
- NutritionQuery >> ({
- form: { ...initFormData },
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- productName: undefined,
- productCategory: undefined,
- productCategoryList: [],
- },
- rules: {
- productName: [
- { required: true, message: "产品名称不能为空", trigger: "blur" }
- ],
- hospitalSystemCode: [
- { required: true, message: "院方系统编码不能为空", trigger: "blur" }
- ],
- productCode: [
- { required: true, message: "商品编码不能为空", trigger: "blur" }
- ],
- productCategory: [
- { required: true, message: "产品所属分类不能为空", trigger: "blur" }
- ],
- productQualification: [
- { required: true, message: "商品资质不能为空", trigger: "blur" }
- ],
- shelfLifeReminder: [
- { required: true, message: "保质期临期提醒不能为空", trigger: "blur" }
- ],
- shelfLife: [
- { required: true, message: "保质期不能为空", trigger: "blur" }
- ],
- purchasePrice: [
- { required: true, message: "入货价格不能为空", trigger: "blur" }
- ],
- purchaseUnit: [
- { required: true, message: "入货单位不能为空", trigger: "blur" }
- ],
- productSpec: [
- { required: true, message: "商品规格不能为空", trigger: "blur" }
- ],
- configSalePrice: [
- { required: true, message: "配置销售价格不能为空", trigger: "blur" }
- ],
- packagePrice: [
- { required: true, message: "预包装价格不能为空", trigger: "blur" }
- ],
- }
- });
- const { queryParams, form, rules } = toRefs(data);
- const categoryOptions = ref([]);
- function buildCategoryTree(flatList) {
- const idMap = {};
- const tree = [];
- flatList.forEach(item => {
- idMap[item.categoryId] = {
- label: item.categoryName,
- value: item.categoryId,
- children: []
- };
- });
- flatList.forEach(item => {
- if (item.parentId && item.parentId !== 0 && idMap[item.parentId]) {
- idMap[item.parentId].children.push(idMap[item.categoryId]);
- } else if (item.parentId === 0) {
- tree.push(idMap[item.categoryId]);
- }
- });
- // 去除没有children的children字段
- function clean(node) {
- if (node.children && node.children.length === 0) {
- delete node.children;
- } else if (node.children) {
- node.children.forEach(clean);
- }
- }
- tree.forEach(clean);
- return tree;
- }
- /** 查询营养产品信息列表 */
- const getList = async () => {
- loading.value = true;
- const res = await listNutrition(queryParams.value);
- nutritionList.value = res.rows;
- total.value = res.total;
- loading.value = false;
- }
- interface ManufacturerOption {
- value: string | number;
- label: string;
- }
- const productManufacturerList = ref < ManufacturerOption[] > ([]);
- const productSupplierList = ref < ManufacturerOption[] > ([]);
- /** 获取生产厂商列表 */
- const getManufacturerList = async () => {
- try {
- const params: ManufacturerQuery = {
- pageNum: 1,
- pageSize: 10,
- name: undefined,
- params: {}
- };
- const res = await listManufacturer(params);
- productManufacturerList.value = res.rows.map(item => ({
- value: item.id,
- label: item.name
- }));
- } catch (error) {
- proxy ?.$modal.msgError("获取生产厂商列表失败");
- console.error("获取生产厂商列表失败:", error);
- }
- }
- /** 获取供应商列表 */
- const getSupplierList = async () => {
- try {
- const params: SupplierQuery = {
- pageNum: 1,
- pageSize: 10,
- name: undefined,
- params: {}
- };
- const res = await listSupplier(params);
- productSupplierList.value = res.rows.map(item => ({
- value: item.id,
- label: item.name
- }));
- } catch (error) {
- proxy ?.$modal.msgError("获取供应商列表失败");
- console.error("获取供应商列表失败:", error);
- }
- }
- const getDeptList = async () => {
- loading.value = true;
- try {
- const res = await listDept({
- pageNum: 1,
- pageSize: 1000
- });
- if (!res.data) {
- console.warn("部门数据为空");
- deptList.value = [];
- return;
- }
- // 处理树形数据
- const processedData = proxy ?.handleTree(res.data, 'deptId');
- if (!processedData) {
- console.warn("树形数据处理失败");
- deptList.value = [];
- return;
- }
- deptList.value = processedData;
- } catch (error) {
- console.error('获取部门列表失败:', error);
- deptList.value = [];
- } finally {
- loading.value = false;
- }
- };
- /** 下载模板按钮操作 */
- const downLoadTemplate = () => {
- proxy ?.getDownload('warehouse/nutrition/downLoadTemplate', {}, `营养产品模版.xlsx`)
- }
- /** 导入按钮操作 */
- const handleImport = () => {
- dialogFile.visible = true;
- fileList.value = [];
- }
- // 上传失败
- const handleUploadError = () => {
- proxy ?.$modal.msgError('上传Excel失败');
- proxy ?.$modal.closeLoading();
- };
- // 上传成功回调
- const handleUploadSuccess = (res: any, file: UploadFile) => {
- if (res.code === 200) {
- dialogFile.visible = false;
- fileList.value = [];
- proxy ?.$modal.closeLoading();
- } else {
- proxy ?.$modal.msgError(res.msg);
- proxy ?.$modal.closeLoading();
- }
- fileList.value = [];
- };
- /** 上传前loading加载 */
- const handleBeforeUpload = (file: any) => {
- const isLt = file.size / 1024 / 1024 < 10;
- if (!isLt) {
- proxy ?.$modal.msgError(`上传头像图片大小不能超过10MB!`);
- return false;
- }
- proxy ?.$modal.loading('正在上传文件,请稍候...');
- return true;
- };
- function openBatchSetDialog() {
- if (!ids.value.length) {
- proxy ?.$modal.msgWarning('请先选择要批量设置的产品');
- return;
- }
- batchSetForm.shelfLifeReminder = '';
- batchSetForm.licenseExpiryReminder = '';
- batchSetDialogVisible.value = true;
- }
- async function handleBatchSetSubmit() {
- const params = {
- ids: ids.value,
- shelfLifeReminder: batchSetForm.shelfLifeReminder,
- licenseExpiryReminder: batchSetForm.licenseExpiryReminder
- };
- try {
- await batchUpdateNutrition(params);
- proxy ?.$modal.msgSuccess('批量设置成功');
- batchSetDialogVisible.value = false;
- getList();
- } catch (e) {
- proxy ?.$modal.msgError('批量设置失败');
- }
- }
- /** 取消按钮 */
- const cancel = () => {
- reset();
- dialog.visible = false;
- }
- /** 表单重置 */
- const reset = () => {
- form.value = { ...initFormData };
- nutritionFormRef.value ?.resetFields();
- fileList.value = [];
- }
- /** 搜索按钮操作 */
- const handleQuery = () => {
- // 取最后一级分类ID传给后端
- if (queryParams.value.productCategoryList && queryParams.value.productCategoryList.length) {
- queryParams.value.productCategory = queryParams.value.productCategoryList.slice(-1)[0];
- } else {
- queryParams.value.productCategory = undefined;
- }
- queryParams.value.pageNum = 1;
- getList();
- }
- /** 重置按钮操作 */
- const resetQuery = () => {
- queryFormRef.value ?.resetFields();
- queryParams.value.productCategoryList = [];
- queryParams.value.productCategory = undefined;
- queryParams.value.productName = undefined;
- handleQuery();
- }
- /** 多选框选中数据 */
- const handleSelectionChange = (selection: NutritionVO[]) => {
- ids.value = selection.map(item => item.id);
- single.value = selection.length != 1;
- multiple.value = !selection.length;
- }
- /** 新增按钮操作 */
- const handleAdd = () => {
- reset();
- dialog.visible = true;
- dialog.title = "添加营养产品信息";
- }
- /** 修改按钮操作 */
- const handleUpdate = async (row ? : NutritionVO) => {
- reset();
- const _id = row ?.id || ids.value[0]
- const res = await getNutrition(_id);
- Object.assign(form.value, res.data);
- dialog.visible = true;
- dialog.title = "修改营养产品信息";
- }
- /** 提交按钮 */
- const submitForm = () => {
- nutritionFormRef.value ?.validate(async (valid: boolean) => {
- if (valid) {
- buttonLoading.value = true;
- // 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 {
- await addNutrition(form.value).finally(() => buttonLoading.value = false);
- }
- proxy ?.$modal.msgSuccess("操作成功");
- dialog.visible = false;
- await getList();
- }
- });
- }
- /** 保存并上架按钮操作 */
- const submitFormAndPutaway = () => {
- nutritionFormRef.value ?.validate(async (valid: boolean) => {
- if (valid) {
- buttonLoading.value = true;
- form.value.putFlag = '1';
- // 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 {
- await addNutrition(form.value).finally(() => buttonLoading.value = false);
- }
- proxy ?.$modal.msgSuccess("操作成功");
- dialog.visible = false;
- await getList();
- }
- });
- }
- /** 删除按钮操作 */
- const handleDelete = async (row ? : NutritionVO) => {
- const _ids = row ?.id || ids.value;
- await proxy ?.$modal.confirm('是否确认删除营养产品信息编号为"' + _ids + '"的数据项?');
- await delNutrition(_ids);
- proxy ?.$modal.msgSuccess("删除成功");
- await getList();
- }
- /** 导出按钮操作 */
- const handleExport = () => {
- proxy ?.download('warehouse/nutrition/export', {
- ...queryParams.value
- }, `nutrition_${new Date().getTime()}.xlsx`)
- }
- const onSpecUnitChange = () => {
- if (!form.value.productSpecUnit) form.value.productSpecUnit = 'g';
- }
- // 详情弹窗逻辑
- const handleDetail = async (row: NutritionVO) => {
- reset();
- // 确保生产厂商列表已加载
- if (productManufacturerList.value.length === 0) {
- await getManufacturerList();
- }
- if (productSupplierList.value.length === 0) {
- await getSupplierList();
- }
- const res = await getNutrition(row.id);
- Object.assign(form.value, res.data);
- detailDialogVisible.value = true;
- activeTab.value = 'basic';
- };
- // 上下架切换
- const handlePutFlag = async (row: NutritionVO, flag: string) => {
- await proxy ?.$modal.confirm(`是否确认${flag === '1' ? '上架' : '下架'}该产品?`);
- const updateData = { ...row, putFlag: flag };
- await updateNutrition(updateData);
- proxy ?.$modal.msgSuccess(`${flag === '1' ? '上架' : '下架'}成功`);
- await getList();
- };
- onMounted(async () => {
- getList();
- getDeptList(); // 初始化时加载部门数据
- getSupplierList(); // 初始化时加载供应商数据
- getManufacturerList(); // 初始化时加载厂商数据
- const res = await listCategory();
- categoryOptions.value = buildCategoryTree(res.rows || []);
- if (!form.value.productSpecUnit) form.value.productSpecUnit = 'g';
- });
- const getCategoryName = (categoryIds) => {
- if (!categoryIds) return '--';
- // 处理多个分类ID的情况
- const ids = categoryIds.toString().split(',');
- const categoryNames = ids.map(id => {
- const findCategory = (categories, targetId) => {
- for (const category of categories) {
- if (category.value.toString() === targetId.toString()) {
- return category.label;
- }
- if (category.children) {
- const found = findCategory(category.children, targetId);
- if (found) return found;
- }
- }
- return null;
- };
- return findCategory(categoryOptions.value, id);
- }).filter(name => name !== null);
- return categoryNames.length > 0 ? categoryNames.join('/') : '--';
- };
- // 弹窗回填
- function onLabelConfirm(selectedLabels) {
- form.value.productLabelList = selectedLabels;
- }
- function onContraindicationLabelConfirm(selectedLabels) {
- form.value.contraindicationLabelList = selectedLabels;
- } // 字典label工具
- function getDictLabel(dictList, value) {
- if (!dictList || !Array.isArray(dictList)) return value || '--';
- const found = dictList.find(item => item.value === value);
- return found ? found.label : value || '--';
- }
- </script>
- <style lang="scss" scoped>
- .nutrition-dialog {
- :deep(.el-dialog) {
- height: 70vh;
- margin-top: 15vh !important;
- .el-dialog__body {
- height: calc(100% - 120px);
- padding: 10px 20px;
- overflow: hidden;
- }
- .el-tabs {
- height: 100%;
- .el-tabs__content {
- height: calc(100% - 40px);
- overflow: hidden;
- }
- }
- .el-scrollbar {
- height: 100%;
- .el-scrollbar__wrap {
- overflow-x: hidden;
- }
- }
- .el-form {
- padding: 20px;
- }
- }
- }
- .dialog-footer {
- padding: 20px;
- text-align: right;
- }
- .custom-label-select .el-select__tags {
- flex-wrap: wrap !important;
- max-height: none;
- }
- .custom-label-select .el-tag {
- background: #e6f7ff;
- color: #409eff;
- border: 1px solid #b3e5fc;
- margin-bottom: 4px;
- }
- </style>
|