| | |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="存储柜:" prop="cupboardId" > |
| | | <el-select |
| | | v-model="state.form.cupboardId" |
| | | placeholder="请选择存储柜" |
| | | style="width: 100%" |
| | | > |
| | | <el-option |
| | | v-for="item in state.cupList" |
| | | :key="item.id" |
| | | :label="item.cupboardName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="数量:" prop="num" > |
| | | <el-input v-model.trim="state.form.num" oninput="value=value.replace(/^\.+|[^\d]/g,'')" placeholder="请输入最小包装数量" @input="changeNum"></el-input> |
| | | </el-form-item> |
| | |
| | | <script setup> |
| | | import {reactive, ref, toRefs} from 'vue' |
| | | import {ElMessage} from "element-plus"; |
| | | import {addWarehouse, checkName, editWarehouse, getWarehouse} from "@/api/hazardousChemicals/warehouse"; |
| | | import {addWarehouse, checkName, editWarehouse, getCupById, getWarehouse} from "@/api/hazardousChemicals/warehouse"; |
| | | import {verifyPhone} from "@/utils/validate"; |
| | | import {checkBasicName, getBasicList} from "@/api/hazardousChemicals/basicInfo"; |
| | | import {addProductRecord, editProductRecord, getProductRecord} from "@/api/hazardousChemicals/productRecord"; |
| | |
| | | basicName:'', |
| | | warehouseName: '', |
| | | warehouseId: null, |
| | | cupboardName: '', |
| | | cupboardId: null, |
| | | num: null, |
| | | batchNo: '' |
| | | |
| | |
| | | num: [{ required: true, trigger: "blur", validator: validateNum }], |
| | | warehouseName: [{ required: true, trigger: "blur", message: '请选择入库仓库' }], |
| | | basicName: [{ required: true, trigger: "blur", message: '请选择入库成品' }], |
| | | // batchNo: [{ required: true, trigger: "blur", message: '请输入批号' }] |
| | | cupboardId: [{ required: true, trigger: "blur", message: '请选择存储柜' }] |
| | | }, |
| | | rawList: [], |
| | | wareHouseList: [], |
| | | message: '' |
| | | message: '', |
| | | cupList: [] |
| | | }) |
| | | |
| | | |
| | |
| | | title.value = type === 'add' ? '新增' : type ==='edit' ? '编辑':'' ; |
| | | if(type === 'edit' ) { |
| | | state.form = JSON.parse(JSON.stringify(value)); |
| | | await getCupList(value.warehouseId) |
| | | state.form.basicName = value.hazmatBasic.name + '—' + value.hazmatBasic.productSn + ' (' + value.hazmatBasic.metering + value.hazmatBasic.unit+') ' |
| | | state.form.warehouseName = value.warehouse.name; |
| | | choosePro.value = value.hazmatBasic |
| | |
| | | } |
| | | const res = await getWarehouse(param) |
| | | if(res.code == 200){ |
| | | state.wareHouseList = res.data.list |
| | | state.wareHouseList = res.data.list.map(item => { |
| | | return { |
| | | ...item, |
| | | children: item.warehouseCupboards && item.warehouseCupboards.length>0 ? item.warehouseCupboards : null |
| | | } |
| | | }) |
| | | }else{ |
| | | ElMessage.warning(res.message) |
| | | } |
| | |
| | | state.message = `您将入库 { ${choosePro.value.name.substring(0,choosePro.value.name.lastIndexOf('—')) } },编号:{ ${choosePro.value.productSn} },最小包装${choosePro.value.metering}${choosePro.value.unit},类别:${minPackageType}。 \n 共计:${state.form.num}${minPackageType}` |
| | | } |
| | | const selectWareValue = (val) => { |
| | | state.form.cupboardId = null |
| | | state.wareHouseList.forEach(item => { |
| | | if(item.name === val){ |
| | | state.form.warehouseId = item.id |
| | | getCupList(item.id) |
| | | } |
| | | }) |
| | | } |
| | | const getCupList = async (val) => { |
| | | const res = await getCupById(val) |
| | | if(res.code == 200) { |
| | | state.cupList = res.data |
| | | }else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | } |
| | | |
| | | const handleClose = () => { |
| | |
| | | warehouseName: '', |
| | | warehouseId: null, |
| | | num: null, |
| | | batchNo: '' |
| | | batchNo: '', |
| | | cupboardName: '', |
| | | cupboardId: null, |
| | | } |
| | | state.rawList = []; |
| | | state.wareHouseList = []; |