feat: 完成了物料总表,生产发料,入料,以及部分采购计划。
This commit is contained in:
@@ -2,11 +2,17 @@
|
||||
import BasePageableTable from "@/components/base/base-pageable-table/BasePageableTable.vue";
|
||||
import DefaultToolButton from "@/components/base/default-tool-button/DefaultToolButton.vue";
|
||||
import DefaultOperateButtonColumn from "@/components/base/default-column/DefaultOperateButtonColumn.vue";
|
||||
import DefaultStatusSwitchColumn from "@/components/base/default-column/DefaultStatusSwitchColumn.vue";
|
||||
import { usePage } from "@/composables/use-page";
|
||||
import BaseForm from "@/components/base/base-form/BaseForm.vue";
|
||||
import BaseFormWithTable from "@/components/base/base-form-with-table/BaseFormWithTable.vue";
|
||||
import { $t } from "@/common/languages";
|
||||
import type { FormInstance, FormRules } from "element-plus";
|
||||
import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from "element-plus";
|
||||
import { formatDate } from "@/common/utils/format-utils";
|
||||
import BaseItemDialog from "@/components/base/base-item-dialog/BaseItemDialog.vue";
|
||||
import BaseSelect from "@/components/base/base-select/BaseSelect.vue";
|
||||
import { generateDucumentNo } from "@/common/utils/document-no-generator/document-no-generator";
|
||||
import { get, post } from "@/common/http/request";
|
||||
import { useStatus } from "@/common/languages/mapping/base-info-mapping";
|
||||
|
||||
/**
|
||||
* 必须要的变量
|
||||
@@ -16,13 +22,48 @@ const getPageUrl = "/production/finishedproductshipment/getFinishedProductShipme
|
||||
const addUrl = "/production/finishedproductshipment/addFinishedProductShipment";
|
||||
const editUrl = "/production/finishedproductshipment/updateFinishedProductShipment";
|
||||
const removeUrl = "/production/finishedproductshipment/deleteFinishedProductShipment";
|
||||
const rules = reactive<FormRules>({});
|
||||
const approveUrl = "/production/finishedproductshipment/approveFinishedProductShipment";
|
||||
const unapproveUrl = "/production/finishedproductshipment/unapproveFinishedProductShipment";
|
||||
const getDetailUrl = "/production/finishedproductshipment/getFinishedProductShipmentDetail";
|
||||
const importItemsUrl = "/production/finishedproductshipment/importFinishedProductShipmentItems";
|
||||
const getWarehouseSelectListUrl = "/warehouse/warehouse/getWarehouseSelectList";
|
||||
const itemArrayName = "deviceItems";
|
||||
const searchers = [
|
||||
{ name: "searchCode", type: "text" as const, placeholder: $t("_prop.production.finishedproductshipment.formCode") },
|
||||
{ name: "formName", type: "text" as const, placeholder: $t("_prop.production.finishedproductshipment.formName") },
|
||||
];
|
||||
const rules = reactive<FormRules>({
|
||||
formCode: [
|
||||
{ required: true, message: $t("_message.production.finishedproductshipment.input_formCode"), trigger: "blur" },
|
||||
],
|
||||
formName: [
|
||||
{ required: true, message: $t("_message.production.finishedproductshipment.input_formName"), trigger: "blur" },
|
||||
],
|
||||
storeNo: [
|
||||
{ required: true, message: $t("_message.production.finishedproductshipment.select_storeId"), trigger: "blur" },
|
||||
],
|
||||
deviceItems: [
|
||||
{
|
||||
required: true,
|
||||
validator: (rule, value, callback) => {
|
||||
if (value === undefined || value.length === 0) {
|
||||
callback($t("_message.production.finishedproductshipment.no_module_sn_items"));
|
||||
}
|
||||
callback();
|
||||
},
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
});
|
||||
/**
|
||||
* 基本不变通用变量
|
||||
*/
|
||||
const tableRef = ref<InstanceType<typeof BasePageableTable> | null>(null);
|
||||
const { useAdd, useEdit, useRemove, useGeneralPageRef } = usePage(tableRef);
|
||||
const { title, visible, formType, form } = useGeneralPageRef();
|
||||
const { title, visible, formType, form, itemVisible, itemParentId } = useGeneralPageRef();
|
||||
const baseFormWithTableRef = ref<InstanceType<typeof BaseFormWithTable>>();
|
||||
const warehouseSelectRef = ref<InstanceType<typeof BaseSelect>>();
|
||||
const { getFormStatusLabel } = useStatus();
|
||||
/**
|
||||
* 可以自定义的变量
|
||||
*/
|
||||
@@ -30,6 +71,7 @@ const { title, visible, formType, form } = useGeneralPageRef();
|
||||
const add = () => {
|
||||
form.value = {};
|
||||
title.value = "_title.production.finishedproductshipment.add";
|
||||
form.value["formCode"] = generateDucumentNo("CPCK");
|
||||
visible.value = true;
|
||||
formType.value = false;
|
||||
};
|
||||
@@ -42,7 +84,42 @@ const edit = (row: any) => {
|
||||
const remove = (row: any) => {
|
||||
useRemove(removeUrl, row.id, "_message.production.finishedproductshipment.delete_message");
|
||||
};
|
||||
const approve = (row: any) => {
|
||||
ElMessageBox.confirm($t("_message.production.finishedproductshipment.approve_confirm"), $t("_level.warning"), {
|
||||
confirmButtonText: $t("_button.confirm"),
|
||||
cancelButtonText: $t("_button.cancel"),
|
||||
type: "warning",
|
||||
}).then(async () => {
|
||||
try {
|
||||
await post(approveUrl, { id: row.id });
|
||||
ElMessage.success($t("_message.production.finishedproductshipment.approve_success"));
|
||||
tableRef.value?.reload();
|
||||
} catch (err: any) {
|
||||
ElMessage.error($t("_message.production.finishedproductshipment.approve_fail") + err);
|
||||
}
|
||||
});
|
||||
};
|
||||
const unapprove = (row: any) => {
|
||||
ElMessageBox.confirm($t("_message.production.finishedproductshipment.reject_confirm"), $t("_level.warning"), {
|
||||
confirmButtonText: $t("_button.confirm"),
|
||||
cancelButtonText: $t("_button.cancel"),
|
||||
type: "warning",
|
||||
}).then(async () => {
|
||||
try {
|
||||
await post(unapproveUrl, { id: row.id });
|
||||
ElMessage.success($t("_message.production.finishedproductshipment.reject_success"));
|
||||
tableRef.value?.reload();
|
||||
} catch (err: any) {
|
||||
ElMessage.error($t("_message.production.finishedproductshipment.reject_fail") + err);
|
||||
}
|
||||
});
|
||||
};
|
||||
const showItem = (row: any) => {
|
||||
itemParentId.value = row.id;
|
||||
itemVisible.value = true;
|
||||
};
|
||||
const submit = (form: any, formRef: FormInstance | undefined) => {
|
||||
setName();
|
||||
if (formRef !== undefined) {
|
||||
formRef.validate(valid => {
|
||||
if (valid) {
|
||||
@@ -67,8 +144,23 @@ const operateButtonClick = (eventName: string, row: any) => {
|
||||
case "remove":
|
||||
remove(row);
|
||||
break;
|
||||
case "approve":
|
||||
approve(row);
|
||||
break;
|
||||
case "unapprove":
|
||||
unapprove(row);
|
||||
break;
|
||||
case "showItem":
|
||||
showItem(row);
|
||||
break;
|
||||
}
|
||||
};
|
||||
const setName = () => {
|
||||
form.value["storeName"] = warehouseSelectRef.value?.getLabel();
|
||||
};
|
||||
const handleReset = () => {
|
||||
form.value["formCode"] = generateDucumentNo("CPCK");
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<BasePageableTable :url="getPageUrl" :searchers="searchers" ref="tableRef">
|
||||
@@ -76,19 +168,196 @@ const operateButtonClick = (eventName: string, row: any) => {
|
||||
<DefaultToolButton @top-button-click="topButtonClick" />
|
||||
</template>
|
||||
<template #columns>
|
||||
<el-table-column prop="id" type="hidden" width="40" />
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.formCode')" prop="formCode" />
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.formStatus')" prop="formStatus" />
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.storeName')" prop="storeName" />
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.formName')" prop="formName" />
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.storeName')" prop="storeName" />
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.formMark')" prop="formMark" />
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.totalValue')" prop="totalValue" />
|
||||
<el-table-column :label="$t('_prop.common.createDate')" prop="createDate" :formatter="formatDate" />
|
||||
<DefaultStatusSwitchColumn status-param-name="formStatus" :status-label-mapping="getFormStatusLabel" />
|
||||
<DefaultOperateButtonColumn @operate-button-click="operateButtonClick" />
|
||||
</template>
|
||||
</BasePageableTable>
|
||||
<BaseForm v-model:visible="visible" @submit="submit" v-model:form="form" :title="$t(title)" :rules="rules">
|
||||
<BaseFormWithTable
|
||||
ref="baseFormWithTableRef"
|
||||
v-model:visible="visible"
|
||||
@submit="submit"
|
||||
v-model:form="form"
|
||||
:title="$t(title)"
|
||||
:rules="rules"
|
||||
:base-title="$t('_title.production.finishedproductshipment.baseTitle')"
|
||||
:table-title="$t('_title.production.finishedproductshipment.tableTitle')"
|
||||
:item-array-name="itemArrayName"
|
||||
upload-desc="设备信息"
|
||||
:import-url="importItemsUrl"
|
||||
@reset="handleReset"
|
||||
>
|
||||
<template #form-items>
|
||||
<el-form-item prop="id" v-if="false"><el-input v-model="form.id" /></el-form-item>
|
||||
<el-form-item prop="storeName" v-if="false"><el-input v-model="form.storeName" /></el-form-item>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('_prop.production.finishedproductshipment.formCode')" prop="formCode">
|
||||
<el-input
|
||||
v-model="form.formCode"
|
||||
:placeholder="$t('_message.production.finishedproductshipment.input_formCode')"
|
||||
disabled
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('_prop.production.finishedproductshipment.formName')" prop="formName">
|
||||
<el-input
|
||||
v-model="form.formName"
|
||||
:placeholder="$t('_message.production.finishedproductshipment.input_formName')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('_prop.production.finishedproductshipment.storeNo')" prop="storeNo">
|
||||
<BaseSelect v-model="form.storeNo" :url="getWarehouseSelectListUrl" ref="warehouseSelectRef" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item :label="$t('_prop.production.finishedproductshipment.formMark')" prop="formMark">
|
||||
<el-input
|
||||
v-model="form.formMark"
|
||||
:placeholder="$t('_message.production.finishedproductshipment.input_formMark')"
|
||||
type="textarea"
|
||||
autosize
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</BaseForm>
|
||||
<template #form-table-columns>
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.productType')" width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${itemArrayName}.${$index}.productType`">
|
||||
<el-input
|
||||
v-model="row.productType"
|
||||
size="small"
|
||||
:placeholder="$t('_message.production.finishedproductshipment.input_productType')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.productSn')" width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${itemArrayName}.${$index}.productSn`">
|
||||
<el-input
|
||||
v-model="row.productSn"
|
||||
size="small"
|
||||
:placeholder="$t('_message.production.finishedproductshipment.input_productSn')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.mac')" width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${itemArrayName}.${$index}.mac`">
|
||||
<el-input
|
||||
v-model="row.mac"
|
||||
size="small"
|
||||
:placeholder="$t('_message.production.finishedproductshipment.input_mac')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.serialNum')" width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${itemArrayName}.${$index}.serialNum`">
|
||||
<el-input
|
||||
v-model="row.serialNum"
|
||||
size="small"
|
||||
:placeholder="$t('_message.production.finishedproductshipment.input_serialNum')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.softVersion')" width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${itemArrayName}.${$index}.softVersion`">
|
||||
<el-input
|
||||
v-model="row.softVersion"
|
||||
size="small"
|
||||
:placeholder="$t('_message.production.finishedproductshipment.input_softVersion')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.alVersion')" width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${itemArrayName}.${$index}.alVersion`">
|
||||
<el-input
|
||||
v-model="row.alVersion"
|
||||
size="small"
|
||||
:placeholder="$t('_message.production.finishedproductshipment.input_alVersion')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.alNum')" width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${itemArrayName}.${$index}.alNum`">
|
||||
<el-input
|
||||
v-model="row.alNum"
|
||||
size="small"
|
||||
:placeholder="$t('_message.production.finishedproductshipment.input_alNum')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.alTxt')" width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${itemArrayName}.${$index}.alTxt`">
|
||||
<el-input
|
||||
v-model="row.alTxt"
|
||||
size="small"
|
||||
:placeholder="$t('_message.production.finishedproductshipment.input_alTxt')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.mark')" width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${itemArrayName}.${$index}.mark`">
|
||||
<el-input
|
||||
v-model="row.mark"
|
||||
size="small"
|
||||
:placeholder="$t('_message.production.finishedproductshipment.input_mark')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</BaseFormWithTable>
|
||||
<BaseItemDialog
|
||||
:title="$t('_title.production.finishedproductshipment.showItem')"
|
||||
v-model:visible="itemVisible"
|
||||
:url="getDetailUrl"
|
||||
parent-param-name="id"
|
||||
v-model:parent-param-value="itemParentId"
|
||||
>
|
||||
<template #columns>
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.productType')" prop="productType" />
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.productSn')" prop="productSn" />
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.mac')" prop="mac" />
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.serialNum')" prop="serialNum" />
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.softVersion')" prop="softVersion" />
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.alVersion')" prop="alVersion" />
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.alNum')" prop="alNum" />
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.alTxt')" prop="alTxt" />
|
||||
<el-table-column :label="$t('_prop.production.finishedproductshipment.mark')" prop="mark" />
|
||||
</template>
|
||||
</BaseItemDialog>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user