Your Name
2023-01-06 e3d63f84a43db07fa5992de2937ee23fc67bad38
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) => {