| | |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | v-model="dialogFormVisible" |
| | | title="生产派工" |
| | | width="50%" |
| | | @close="closeDia" |
| | | > |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-dialog v-model="dialogFormVisible" |
| | | title="生产派工" |
| | | 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 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 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 label="总数量:" |
| | | prop="quantity"> |
| | | <el-input v-model="form.quantity" |
| | | placeholder="请输入" |
| | | clearable |
| | | disabled /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <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-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="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="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 |
| | | v-model="form.schedulingDate" |
| | | type="date" |
| | | placeholder="请选择日期" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | style="width: 100%" |
| | | /> |
| | | <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 v-model="form.schedulingDate" |
| | | type="date" |
| | | placeholder="请选择日期" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button type="primary" |
| | | @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDia">取消</el-button> |
| | | </div> |
| | | </template> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {ref} from "vue"; |
| | | import {getStaffJoinInfo, staffJoinAdd, staffJoinUpdate} from "@/api/personnelManagement/onboarding.js"; |
| | | import {userListNoPageByTenantId} from "@/api/system/user.js"; |
| | | import {productionDispatch} from "@/api/productionManagement/productionOrder.js"; |
| | | import useUserStore from "@/store/modules/user.js"; |
| | | import dayjs from "dayjs"; |
| | | const { proxy } = getCurrentInstance() |
| | | const emit = defineEmits(['close']) |
| | | import { ref } from "vue"; |
| | | import { |
| | | getStaffJoinInfo, |
| | | staffJoinAdd, |
| | | staffJoinUpdate, |
| | | } from "@/api/personnelManagement/onboarding.js"; |
| | | import { userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | // import {productionDispatch} from "@/api/productionManagement/productionOrder.js"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import dayjs from "dayjs"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const emit = defineEmits(["close"]); |
| | | |
| | | const dialogFormVisible = ref(false); |
| | | const operationType = ref('') |
| | | const data = reactive({ |
| | | form: { |
| | | projectName: "", |
| | | productCategory: "", |
| | | quantity: "", |
| | | schedulingNum: "", |
| | | schedulingUserId: "", |
| | | schedulingDate: "", |
| | | pendingQuantity: "", |
| | | }, |
| | | rules: { |
| | | schedulingNum: [{ required: true, message: "请输入", trigger: "blur" },], |
| | | schedulingUserId: [{ required: true, message: "请选择", trigger: "change" },], |
| | | schedulingDate: [{ required: true, message: "请选择", trigger: "change" },], |
| | | }, |
| | | }); |
| | | const { form, rules } = toRefs(data); |
| | | const userList = ref([]) |
| | | const userStore = useUserStore() |
| | | const dialogFormVisible = ref(false); |
| | | const operationType = ref(""); |
| | | const data = reactive({ |
| | | form: { |
| | | projectName: "", |
| | | productCategory: "", |
| | | quantity: "", |
| | | schedulingNum: "", |
| | | schedulingUserId: "", |
| | | schedulingDate: "", |
| | | pendingQuantity: "", |
| | | }, |
| | | rules: { |
| | | schedulingNum: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | schedulingUserId: [ |
| | | { required: true, message: "请选择", trigger: "change" }, |
| | | ], |
| | | schedulingDate: [{ required: true, message: "请选择", trigger: "change" }], |
| | | }, |
| | | }); |
| | | const { form, rules } = toRefs(data); |
| | | const userList = ref([]); |
| | | const userStore = useUserStore(); |
| | | |
| | | // 打开弹框 |
| | | 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"); |
| | | } |
| | | // 打开弹框 |
| | | 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"); |
| | | }; |
| | | |
| | | // |
| | | const changeNum = (value) => { |
| | | 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(); |
| | | }) |
| | | // |
| | | const changeNum = value => { |
| | | 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(); |
| | | // }) |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // 关闭弹框 |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | emit('close') |
| | | }; |
| | | defineExpose({ |
| | | openDialog, |
| | | }); |
| | | // 关闭弹框 |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | emit("close"); |
| | | }; |
| | | defineExpose({ |
| | | openDialog, |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |