From e3d63f84a43db07fa5992de2937ee23fc67bad38 Mon Sep 17 00:00:00 2001 From: Your Name <123456> Date: 星期五, 06 一月 2023 16:43:58 +0800 Subject: [PATCH] 物资 --- src/views/facilityManagement/goodsDetailManage/components/goodsDetailEdit.vue | 43 +++++++++++++++++++++++-------------------- 1 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/views/facilityManagement/goodsDetailManage/components/goodsDetailEdit.vue b/src/views/facilityManagement/goodsDetailManage/components/goodsDetailEdit.vue index 3fe4fd8..c684721 100644 --- a/src/views/facilityManagement/goodsDetailManage/components/goodsDetailEdit.vue +++ b/src/views/facilityManagement/goodsDetailManage/components/goodsDetailEdit.vue @@ -13,22 +13,22 @@ <el-col :span="24" class="mb20"> <el-form-item label="选择物资" prop="smId"> <el-row :gutter="6"> - <el-col :span="8"> - <el-select - filterable - placeholder="请选择部门" - clearable - @change="changeDepartment" - v-model="goodsDetailEditState.depId"> - <el-option - v-for="item in goodsDetailEditState.departmentList" - :key="item.depId" - :value="item.depId" - :label="item.depName" - ></el-option> - </el-select> - </el-col> - <el-col :span="8"> +<!-- <el-col :span="8">--> +<!-- <el-select--> +<!-- filterable--> +<!-- placeholder="请选择部门"--> +<!-- clearable--> +<!-- @change="changeDepartment"--> +<!-- v-model="goodsDetailEditState.depId">--> +<!-- <el-option--> +<!-- v-for="item in goodsDetailEditState.departmentList"--> +<!-- :key="item.depId"--> +<!-- :value="item.depId"--> +<!-- :label="item.depName"--> +<!-- ></el-option>--> +<!-- </el-select>--> +<!-- </el-col>--> + <el-col :span="12"> <el-select v-model="goodsDetailEditState.classifyId" placeholder="选择分类" @change="changeClassify" filterable clearable> <el-option v-for="item in goodsDetailEditState.classifyList" @@ -38,7 +38,7 @@ ></el-option> </el-select> </el-col> - <el-col :span="8"> + <el-col :span="12"> <el-select v-model="goodsDetailEditState.goodsDetailForm.smId" placeholder="选择物资" filterable clearable> <el-option v-for="item in goodsDetailEditState.goodsList" @@ -101,8 +101,10 @@ import {isValidKey} from "/@/views/facilityManagement/safetyGoodsAndEquipment/index"; import {ElMessage} from "element-plus/es"; import {goodsDetailApi} from "/@/api/facilityManagement/goodsDetailManage"; +import {useUserInfo} from "/@/stores/userInfo"; const goodsDetailFormRef = ref() +const userInfo = useUserInfo() const goodsDetailEditState = reactive<GoodsDetailEditType>({ title: '编辑', @@ -128,7 +130,6 @@ }) // watch(() => goodsDetailEditState.depId ,(newVal, oldVal) => { -// debugger // goodsDetailEditState.classify = null // goodsDetailEditState.goodsDetailForm.smId = null // goodsDetailEditState.classifyList = goodsDetailEditState.departmentList.find(item => item.depId === newVal)?.classificationList as Array<ClassificationListType> @@ -140,7 +141,7 @@ setTimeout(() => { goodsDetailFormRef.value.clearValidate(); }); - await changeDepartment(value.depId) + await changeDepartment(userInfo.userInfos.depId) await changeClassify(value.bigClassifyId) goodsDetailEditState.depId = value.depId goodsDetailEditState.classifyId = value.bigClassifyId @@ -156,7 +157,9 @@ const changeDepartment = (value: number | null) => { goodsDetailEditState.classifyId = null goodsDetailEditState.goodsDetailForm.smId = null - goodsDetailEditState.classifyList = goodsDetailEditState.departmentList.find(item => item.depId === value)?.classificationList as Array<ClassificationListType> + goodsDetailEditState.classifyList = JSON.parse(JSON.stringify( + (goodsDetailEditState.departmentList.find(item => item.depId === value) ?? {classificationList:[]})?.classificationList as Array<ClassificationListType> + )) } const changeClassify = (value: number | null) => { -- Gitblit v1.9.2