|
@@ -276,6 +276,37 @@
|
|
|
</el-dialog>
|
|
|
|
|
|
<el-dialog
|
|
|
+ :title="'工单下发'"
|
|
|
+ v-model="dialogVisibleTwo"
|
|
|
+ width="500"
|
|
|
+ v-loading="submitLoading"
|
|
|
+ destroy-on-close
|
|
|
+ >
|
|
|
+ <byForm
|
|
|
+ :formConfig="formConfigTwo"
|
|
|
+ :formOption="formOption"
|
|
|
+ v-model="formData.dataTwo"
|
|
|
+ :rules="rulesTwo"
|
|
|
+ ref="byformTwo"
|
|
|
+ >
|
|
|
+ </byForm>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="dialogVisibleTwo = false" size="large"
|
|
|
+ >取 消</el-button
|
|
|
+ >
|
|
|
+
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="submitFormTwo()"
|
|
|
+ size="large"
|
|
|
+ :loading="submitLoading"
|
|
|
+ >
|
|
|
+ 提 交
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
v-model="openMaterial"
|
|
|
title="选择产品"
|
|
|
width="70%"
|
|
@@ -411,6 +442,12 @@ const config = computed(() => {
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
+ label: "生产数量",
|
|
|
+ prop: "productionQuantity",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
label: "完成率",
|
|
|
prop: "completionRate",
|
|
|
},
|
|
@@ -423,8 +460,8 @@ const config = computed(() => {
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "操作",
|
|
|
- width: "200",
|
|
|
- align: "right",
|
|
|
+ width: "220",
|
|
|
+ align: "center",
|
|
|
},
|
|
|
// 渲染 el-button,一般用在最后一列。
|
|
|
renderHTML(row) {
|
|
@@ -456,6 +493,19 @@ const config = computed(() => {
|
|
|
},
|
|
|
}
|
|
|
: {},
|
|
|
+ row.productionQuantity == null
|
|
|
+ ? {
|
|
|
+ attrs: {
|
|
|
+ label: "下发",
|
|
|
+ type: "primary",
|
|
|
+ text: true,
|
|
|
+ },
|
|
|
+ el: "button",
|
|
|
+ click() {
|
|
|
+ handleOut(row);
|
|
|
+ },
|
|
|
+ }
|
|
|
+ : {},
|
|
|
];
|
|
|
},
|
|
|
},
|
|
@@ -465,6 +515,7 @@ const config = computed(() => {
|
|
|
let formData = reactive({
|
|
|
data: {},
|
|
|
dataOne: {},
|
|
|
+ dataTwo: {},
|
|
|
treeData: [],
|
|
|
});
|
|
|
const formOption = reactive({
|
|
@@ -495,6 +546,52 @@ const formConfigOne = reactive([
|
|
|
label: "上传附件",
|
|
|
},
|
|
|
]);
|
|
|
+const formConfigTwo = reactive([
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ label: "产品名称",
|
|
|
+ prop: "productName",
|
|
|
+ disabled: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ label: "工单数量",
|
|
|
+ prop: "orderQuantity",
|
|
|
+ disabled: true,
|
|
|
+ itemWidth: 51,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ label: "库存数量",
|
|
|
+ prop: "availableStockQuantity",
|
|
|
+ disabled: true,
|
|
|
+ itemWidth: 51,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "number",
|
|
|
+ prop: "stockWaitQuantity",
|
|
|
+ label: "出库数量",
|
|
|
+ itemWidth: 51,
|
|
|
+ precision: 0,
|
|
|
+ min: 0,
|
|
|
+ controls: false,
|
|
|
+ style: {
|
|
|
+ width: "100%",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "number",
|
|
|
+ prop: "productionQuantity",
|
|
|
+ label: "生产数量",
|
|
|
+ itemWidth: 51,
|
|
|
+ precision: 0,
|
|
|
+ min: 0,
|
|
|
+ controls: false,
|
|
|
+ style: {
|
|
|
+ width: "100%",
|
|
|
+ },
|
|
|
+ },
|
|
|
+]);
|
|
|
const getList = async (req) => {
|
|
|
sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
loading.value = true;
|
|
@@ -625,7 +722,7 @@ const getDtlOne = (row) => {
|
|
|
dialogVisibleOne.value = true;
|
|
|
res = res.map((x) => ({
|
|
|
...x,
|
|
|
- fileList: x.oldId
|
|
|
+ fileList: x.fileName
|
|
|
? [
|
|
|
{
|
|
|
fileName: x.fileName,
|
|
@@ -633,7 +730,7 @@ const getDtlOne = (row) => {
|
|
|
},
|
|
|
]
|
|
|
: [],
|
|
|
- fileListCopy: x.oldId
|
|
|
+ fileListCopy: x.fileName
|
|
|
? [
|
|
|
{
|
|
|
fileName: x.fileName,
|
|
@@ -744,10 +841,66 @@ const handleSuccess = (any, UploadFile) => {
|
|
|
const onPreviewFile = (file) => {
|
|
|
window.open(file.raw.fileUrl, "_blank");
|
|
|
};
|
|
|
+const dialogVisibleTwo = ref(false);
|
|
|
+const byformTwo = ref(null);
|
|
|
+const handleOut = (row) => {
|
|
|
+ dialogVisibleTwo.value = true;
|
|
|
+ proxy.post("/workOrder/detail", { id: row.id }).then((res) => {
|
|
|
+ formData.dataTwo = {
|
|
|
+ id: row.id,
|
|
|
+ productName: row.productName,
|
|
|
+ orderQuantity: row.quantity,
|
|
|
+ productionQuantity: res.productionQuantity
|
|
|
+ ? res.productionQuantity
|
|
|
+ : null,
|
|
|
+ availableStockQuantity: res.availableStockQuantity,
|
|
|
+ };
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const submitFormTwo = (type) => {
|
|
|
+ byformTwo.value.handleSubmit((valid) => {
|
|
|
+ if (
|
|
|
+ formData.dataTwo.productionQuantity +
|
|
|
+ formData.dataTwo.stockWaitQuantity !=
|
|
|
+ Number(formData.dataTwo.orderQuantity)
|
|
|
+ ) {
|
|
|
+ return ElMessage({
|
|
|
+ message: "出库数量和生产数量合必须等于工单数量",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ formData.dataTwo.stockWaitQuantity >
|
|
|
+ Number(formData.dataTwo.availableStockQuantity)
|
|
|
+ ) {
|
|
|
+ return ElMessage({
|
|
|
+ message: "出库数量不可大于库存数量",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ submitLoading.value = true;
|
|
|
+ proxy.post("/workOrder/distribute", formData.dataTwo).then(
|
|
|
+ (res) => {
|
|
|
+ ElMessage({
|
|
|
+ message: "操作成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ dialogVisibleTwo.value = false;
|
|
|
+ submitLoading.value = false;
|
|
|
+ getList();
|
|
|
+ },
|
|
|
+ (err) => (submitLoading.value = false)
|
|
|
+ );
|
|
|
+ });
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
.tenant {
|
|
|
padding: 20px;
|
|
|
}
|
|
|
+::v-deep(.el-input-number .el-input__inner) {
|
|
|
+ text-align: left;
|
|
|
+}
|
|
|
</style>
|