|
@@ -162,14 +162,14 @@
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="生产厂商:" prop="manufacturer">
|
|
|
<el-select v-model="form.manufacturer" placeholder="请选择" clearable>
|
|
|
- <el-option v-for="dict in product_manufacturer" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
+ <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="dict in product_supplier" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
+ <el-option v-for="item in productSupplierList" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -1036,7 +1036,7 @@
|
|
|
<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>{{ getDictLabel(product_manufacturer, form.manufacturer) || '--' }}</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>
|
|
@@ -1047,7 +1047,7 @@
|
|
|
<div><b>批准文号:</b>{{ form.approvalNumber || '--' }}</div>
|
|
|
<div><b>口味:</b>{{ form.taste || '--' }}</div>
|
|
|
<div><b>剂型/形态:</b>{{ getDictLabel(dosage_form, form.dosageForm) || '--' }}</div>
|
|
|
- <div><b>供应商:</b>{{ getDictLabel(product_supplier, form.supplier) || '--' }}</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>
|
|
@@ -1430,573 +1430,630 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
<!-- 添加疾病标签弹窗 -->
|
|
|
- <LabelDialog
|
|
|
- v-model="diseaseLabelDialogVisible"
|
|
|
- :initial-selected-labels="form.productLabelList || []"
|
|
|
- @confirm="onLabelConfirm"
|
|
|
- />
|
|
|
+ <LabelDialog v-model="diseaseLabelDialogVisible" :initial-selected-labels="form.productLabelList || []" @confirm="onLabelConfirm" />
|
|
|
<!-- 添加禁忌症标签弹窗 -->
|
|
|
- <LabelDialog
|
|
|
- v-model="contraindicationLabelDialogVisible"
|
|
|
- :initial-selected-labels="form.contraindicationLabelList || []"
|
|
|
- @confirm="onContraindicationLabelConfirm"
|
|
|
- />
|
|
|
+ <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 { 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';
|
|
|
-
|
|
|
-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, 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[] > ([]);
|
|
|
-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" }
|
|
|
- ],
|
|
|
- }
|
|
|
+ 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 { queryParams, form, rules } = toRefs(data);
|
|
|
+ const batchRules = {
|
|
|
+ shelfLifeReminder: [{ required: true, message: "保质期临期提醒不能为空", trigger: "blur" }],
|
|
|
+ licenseExpiryReminder: [{ required: true, message: "许可证临期提醒不能为空", trigger: "blur" }],
|
|
|
+
|
|
|
+ };
|
|
|
|
|
|
-const categoryOptions = ref([]);
|
|
|
+ const treeData = ref([]); // 定义 treeData
|
|
|
+ const deptList = ref([]); // 定义 科室list
|
|
|
|
|
|
-function buildCategoryTree(flatList) {
|
|
|
- const idMap = {};
|
|
|
- const tree = [];
|
|
|
- flatList.forEach(item => {
|
|
|
- idMap[item.categoryId] = {
|
|
|
- label: item.categoryName,
|
|
|
- value: item.categoryId,
|
|
|
- children: []
|
|
|
- };
|
|
|
+ const queryFormRef = ref < FormInstance > ();
|
|
|
+ const nutritionFormRef = ref < FormInstance > ();
|
|
|
+
|
|
|
+ const dialog = reactive < DialogOption > ({
|
|
|
+ visible: false,
|
|
|
+ title: ''
|
|
|
});
|
|
|
- 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]);
|
|
|
- }
|
|
|
+ const dialogFile = reactive < DialogOption > ({
|
|
|
+ visible: false,
|
|
|
+ title: '请上传'
|
|
|
});
|
|
|
- // 去除没有children的children字段
|
|
|
- function clean(node) {
|
|
|
- if (node.children && node.children.length === 0) {
|
|
|
- delete node.children;
|
|
|
- } else if (node.children) {
|
|
|
- node.children.forEach(clean);
|
|
|
+
|
|
|
+ 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;
|
|
|
}
|
|
|
- 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;
|
|
|
-}
|
|
|
-
|
|
|
-const getDeptList = async () => {
|
|
|
- loading.value = true;
|
|
|
- try {
|
|
|
- const res = await listDept({});
|
|
|
- if (!res.data) {
|
|
|
- console.warn("部门数据为空");
|
|
|
- deptList.value = [];
|
|
|
- return;
|
|
|
+
|
|
|
+ /** 查询营养产品信息列表 */
|
|
|
+ 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 processedData = proxy ?.handleTree(res.data, 'deptId');
|
|
|
- if (!processedData) {
|
|
|
- console.warn("树形数据处理失败");
|
|
|
- deptList.value = [];
|
|
|
- return;
|
|
|
+ /** 获取供应商列表 */
|
|
|
+ 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);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- deptList.value = processedData;
|
|
|
+ const getDeptList = async () => {
|
|
|
+ loading.value = true;
|
|
|
+ try {
|
|
|
+ const res = await listDept({
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 1000
|
|
|
+ });
|
|
|
+ if (!res.data) {
|
|
|
+ console.warn("部门数据为空");
|
|
|
+ deptList.value = [];
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- } catch (error) {
|
|
|
- console.error('获取部门列表失败:', error);
|
|
|
- deptList.value = [];
|
|
|
- } finally {
|
|
|
- loading.value = false;
|
|
|
+ // 处理树形数据
|
|
|
+ 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 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;
|
|
|
+
|
|
|
+ /** 导入按钮操作 */
|
|
|
+ const handleImport = () => {
|
|
|
+ dialogFile.visible = true;
|
|
|
fileList.value = [];
|
|
|
+ }
|
|
|
+
|
|
|
+ // 上传失败
|
|
|
+ const handleUploadError = () => {
|
|
|
+ proxy ?.$modal.msgError('上传Excel失败');
|
|
|
proxy ?.$modal.closeLoading();
|
|
|
- } else {
|
|
|
- proxy ?.$modal.msgError(res.msg);
|
|
|
- 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;
|
|
|
}
|
|
|
- fileList.value = [];
|
|
|
-};
|
|
|
|
|
|
+ async function handleBatchSetSubmit() {
|
|
|
+ const params = {
|
|
|
+ ids: ids.value,
|
|
|
+ shelfLifeReminder: batchSetForm.shelfLifeReminder,
|
|
|
+ licenseExpiryReminder: batchSetForm.licenseExpiryReminder
|
|
|
+ };
|
|
|
|
|
|
-/** 上传前loading加载 */
|
|
|
-const handleBeforeUpload = (file: any) => {
|
|
|
- const isLt = file.size / 1024 / 1024 < 10;
|
|
|
- if (!isLt) {
|
|
|
- proxy ?.$modal.msgError(`上传头像图片大小不能超过10MB!`);
|
|
|
- return false;
|
|
|
+ try {
|
|
|
+ await batchUpdateNutrition(params);
|
|
|
+ proxy ?.$modal.msgSuccess('批量设置成功');
|
|
|
+ batchSetDialogVisible.value = false;
|
|
|
+ getList();
|
|
|
+ } catch (e) {
|
|
|
+ proxy ?.$modal.msgError('批量设置失败');
|
|
|
+ }
|
|
|
}
|
|
|
- proxy ?.$modal.loading('正在上传文件,请稍候...');
|
|
|
- return true;
|
|
|
-};
|
|
|
-
|
|
|
-function openBatchSetDialog() {
|
|
|
- if (!ids.value.length) {
|
|
|
- proxy ?.$modal.msgWarning('请先选择要批量设置的产品');
|
|
|
- return;
|
|
|
+ /** 取消按钮 */
|
|
|
+ const cancel = () => {
|
|
|
+ reset();
|
|
|
+ dialog.visible = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 表单重置 */
|
|
|
+ const reset = () => {
|
|
|
+ form.value = { ...initFormData };
|
|
|
+ nutritionFormRef.value ?.resetFields();
|
|
|
+ fileList.value = [];
|
|
|
}
|
|
|
- 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;
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ 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();
|
|
|
- } 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 {
|
|
|
+
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ 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 = "修改营养产品信息";
|
|
|
}
|
|
|
- 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);
|
|
|
+
|
|
|
+ /** 提交按钮 */
|
|
|
+ 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();
|
|
|
}
|
|
|
- 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);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 保存并上架按钮操作 */
|
|
|
+ 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();
|
|
|
}
|
|
|
- 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 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();
|
|
|
- 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(); // 初始化时加载部门数据
|
|
|
- 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;
|
|
|
+
|
|
|
+ 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 || '--';
|
|
|
-}
|
|
|
+ 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>
|