| | |
| | | <el-dialog |
| | | v-model="dialogFormVisible" |
| | | title="生产派工" |
| | | width="70%" |
| | | width="50%" |
| | | @close="closeDia" |
| | | > |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="项目名称:" prop="projectName"> |
| | | <el-input v-model="form.projectName" placeholder="请输入" clearable disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="产品大类:" prop="productCategory"> |
| | | <el-input v-model="form.productCategory" placeholder="请输入" clearable disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="总数量:" prop="quantity"> |
| | | <el-input v-model="form.quantity" placeholder="请输入" clearable disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | |
| | | <el-col :span="12"> |
| | | <el-form-item label="待排产数量:" prop="pendingQuantity"> |
| | | <el-input v-model="form.pendingQuantity" placeholder="请输入" clearable disabled/> |
| | | </el-form-item> |
| | | <el-form-item label="待排产数量:" prop="pendingQuantity"> |
| | | <el-input v-model="form.pendingQuantity" placeholder="请输入" clearable disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="本次排产数量:" prop="schedulingNum"> |
| | | <el-input-number |
| | | v-model="form.schedulingNum" |
| | | placeholder="请输入" |
| | | :min="0" |
| | | :step="0.1" |
| | | :precision="2" |
| | | clearable |
| | | @change="changeNum" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="本次排产数量:" prop="schedulingNum"> |
| | | <el-input-number |
| | | v-model="form.schedulingNum" |
| | | placeholder="请输入" |
| | | :min="0" |
| | | :step="0.1" |
| | | :precision="2" |
| | | clearable |
| | | @change="changeNum" |
| | | style="width: 100%" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="派工人:" prop="schedulingUserId"> |
| | | <el-select |
| | | v-model="form.schedulingUserId" |
| | | placeholder="选择人员" |
| | | style="width: 100%;" |
| | | > |
| | | <el-option |
| | | v-for="user in userList" |
| | | :key="user.userId" |
| | | :label="user.nickName" |
| | | :value="user.userId" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="派工人:" prop="schedulingUserId"> |
| | | <el-select |
| | | v-model="form.schedulingUserId" |
| | | placeholder="选择人员" |
| | | style="width: 100%;" |
| | | > |
| | | <el-option |
| | | v-for="user in userList" |
| | | :key="user.userId" |
| | | :label="user.nickName" |
| | | :value="user.userId" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="派工日期:" prop="schedulingDate"> |
| | | <el-date-picker |
| | |
| | | const operationType = ref('') |
| | | const data = reactive({ |
| | | form: { |
| | | projectName: "", |
| | | productCategory: "", |
| | | quantity: "", |
| | | schedulingNum: "", |
| | | schedulingUserId: "", |
| | | schedulingDate: "", |
| | | pendingQuantity: "", |
| | | productCategory: "", |
| | | quantity: "", |
| | | schedulingNum: "", |
| | | schedulingUserId: "", |
| | | schedulingDate: "", |
| | | pendingQuantity: "", |
| | | salesLedgerProductId: "", |
| | | }, |
| | | rules: { |
| | | schedulingNum: [{ required: true, message: "请输入", trigger: "blur" },], |
| | | schedulingUserId: [{ required: true, message: "请选择", trigger: "change" },], |
| | | schedulingDate: [{ required: true, message: "请选择", trigger: "change" },], |
| | | schedulingNum: [{ required: true, message: "请输入", trigger: "blur" },], |
| | | schedulingUserId: [{ required: true, message: "请选择", trigger: "change" },], |
| | | schedulingDate: [{ required: true, message: "请选择", trigger: "change" },], |
| | | }, |
| | | }); |
| | | const { form, rules } = toRefs(data); |
| | |
| | | const openDialog = (type, row) => { |
| | | operationType.value = type; |
| | | dialogFormVisible.value = true; |
| | | userListNoPageByTenantId().then((res) => { |
| | | userList.value = res.data; |
| | | }); |
| | | form.value = {...row} |
| | | form.value.schedulingNum = 0 |
| | | form.value.schedulingUserId = userStore.id |
| | | form.value.schedulingDate = dayjs().format("YYYY-MM-DD"); |
| | | userListNoPageByTenantId().then((res) => { |
| | | userList.value = res.data; |
| | | }); |
| | | form.value = {...row} |
| | | // 绑定外层传入的产品ID到后端需要的 salesLedgerProductId 字段 |
| | | form.value.salesLedgerProductId = row.id; |
| | | // 确保不会把原始 id 当作排产记录主键传给后端 |
| | | delete form.value.id; |
| | | form.value.schedulingNum = 0 |
| | | form.value.schedulingUserId = userStore.id |
| | | form.value.schedulingDate = dayjs().format("YYYY-MM-DD"); |
| | | } |
| | | |
| | | // |
| | | const changeNum = (value) => { |
| | | if (value > form.value.pendingQuantity) { |
| | | form.value.schedulingNum = form.value.pendingQuantity; |
| | | proxy.$modal.msgWarning('排产数量不可大于待排产数量') |
| | | } |
| | | if (value > form.value.pendingQuantity) { |
| | | form.value.schedulingNum = form.value.pendingQuantity; |
| | | proxy.$modal.msgWarning('排产数量不可大于待排产数量') |
| | | } |
| | | } |
| | | // 提交产品表单 |
| | | const submitForm = () => { |
| | | proxy.$refs.formRef.validate(valid => { |
| | | if (valid) { |
| | | productionDispatch(form.value).then(res => { |
| | | proxy.$modal.msgSuccess("提交成功"); |
| | | closeDia(); |
| | | }) |
| | | productionDispatch(form.value).then(res => { |
| | | proxy.$modal.msgSuccess("提交成功"); |
| | | closeDia(); |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | | </style> |