Your Name
2023-01-06 e3d63f84a43db07fa5992de2937ee23fc67bad38
src/views/facilityManagement/goodsDetailManage/components/goodsDetailAdd.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="goodsDetailAddState.depId">
                                        <el-option
                                            v-for="item in goodsDetailAddState.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="goodsDetailAddState.depId">-->
<!--                                        <el-option-->
<!--                                            v-for="item in goodsDetailAddState.departmentList"-->
<!--                                            :key="item.depId"-->
<!--                                            :value="item.depId"-->
<!--                                            :label="item.depName"-->
<!--                                        ></el-option>-->
<!--                                    </el-select>-->
<!--                                </el-col>-->
                                <el-col :span="12">
                                    <el-select v-model="goodsDetailAddState.classifyId" placeholder="选择分类" @change="changeClassify" filterable clearable>
                                        <el-option
                                            v-for="item in goodsDetailAddState.classifyList"
@@ -38,7 +38,7 @@
                                        ></el-option>
                                    </el-select>
                                </el-col>
                                <el-col :span="8">
                                <el-col :span="12">
                                    <el-select v-model="goodsDetailAddState.goodsDetailForm.smId" placeholder="选择物资" filterable clearable>
                                        <el-option
                                            v-for="item in goodsDetailAddState.goodsList"
@@ -130,8 +130,10 @@
import {ElMessage} from "element-plus/es";
import {goodsDetailApi} from "/@/api/facilityManagement/goodsDetailManage";
import {verifiyNumberInteger, verifyString} from "/@/utils/toolsValidate";
import {useUserInfo} from "/@/stores/userInfo";
const goodsDetailFormRef = ref()
const userInfo = useUserInfo()
const goodsDetailAddState = reactive<GoodsDetailAddType>({
    title: '新增入库',
@@ -174,8 +176,8 @@
    setTimeout(() => {
        goodsDetailFormRef.value.clearValidate();
    });
    goodsDetailAddState.startRfid = ''
    goodsDetailAddState.endRfid = ''
    goodsDetailAddState.startRfid = '';
    goodsDetailAddState.endRfid = '';
    goodsDetailAddState.goodsDetailForm = {
        id: null,
        smId: null,
@@ -184,18 +186,21 @@
        startRfid:  null,
        endRfid:  null ,
        wareHousingCount:  null,
    }
    };
    goodsDetailAddState.classifyList = goodsDetailAddState.departmentList.find(item => item.depId === userInfo.userInfos.depId)?.classificationList as Array<ClassificationListType>
}
const changeDepartment = (value: number | null) => {
    goodsDetailAddState.classifyId = null
    goodsDetailAddState.goodsDetailForm.smId = null
    goodsDetailAddState.classifyList = goodsDetailAddState.departmentList.find(item => item.depId === value)?.classificationList as Array<ClassificationListType>
}
// const changeDepartment = (value: number | null) => {
//     goodsDetailAddState.classifyId = null
//     goodsDetailAddState.goodsDetailForm.smId = null
//     goodsDetailAddState.classifyList = goodsDetailAddState.departmentList.find(item => item.depId === value)?.classificationList as Array<ClassificationListType>
// }
const changeClassify = (value: number | null) => {
    goodsDetailAddState.goodsDetailForm.smId = null
    goodsDetailAddState.goodsList = goodsDetailAddState.classifyList.find(item => item.materialClassifyId === value)?.baseMaterialList as Array<BaseMaterialListType>
    goodsDetailAddState.goodsList = JSON.parse(JSON.stringify(
        (goodsDetailAddState.classifyList.find(item => item.materialClassifyId === value) ?? {baseMaterialList:[]})?.baseMaterialList as Array<BaseMaterialListType>
    ))
}
const submitGoodsDetail = () => {