| | |
| | | <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" |
| | |
| | | ></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" |
| | |
| | | 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: '编辑', |
| | |
| | | }) |
| | | |
| | | // 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> |
| | |
| | | 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 |
| | |
| | | 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) => { |