完成了 BOM 管理和生产管理,完成部分发料单、采购计划和调拨单。
This commit is contained in:
97
src/views/purchase/purchase-plan/PurchasePlanView.vue
Normal file
97
src/views/purchase/purchase-plan/PurchasePlanView.vue
Normal file
@@ -0,0 +1,97 @@
|
||||
<script lang="ts" setup>
|
||||
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 { usePage } from "@/composables/use-page";
|
||||
import BaseForm from "@/components/base/base-form/BaseForm.vue";
|
||||
import { $t } from "@/common/languages";
|
||||
import type { FormInstance, FormRules } from "element-plus";
|
||||
import { formatDate } from "@/common/utils/format-utils";
|
||||
|
||||
/**
|
||||
* 必须要的变量
|
||||
*/
|
||||
|
||||
const getPageUrl = "/purchase/purchaseplan/getPurchasePlanPage";
|
||||
const addUrl = "/purchase/purchaseplan/addPurchasePlan";
|
||||
const editUrl = "/purchase/purchaseplan/updatePurchasePlan";
|
||||
const removeUrl = "/purchase/purchaseplan/deletePurchasePlan";
|
||||
const searchers = [
|
||||
{ name: "vendorName", type: "text" as const, placeholder: $t("_prop.purchase.purchaseplan.vendorName") },
|
||||
];
|
||||
const rules = reactive<FormRules>({});
|
||||
/**
|
||||
* 基本不变通用变量
|
||||
*/
|
||||
const tableRef = ref<InstanceType<typeof BasePageableTable> | null>(null);
|
||||
const { useAdd, useEdit, useRemove, useGeneralPageRef } = usePage(tableRef);
|
||||
const { title, visible, formType, form } = useGeneralPageRef();
|
||||
/**
|
||||
* 可以自定义的变量
|
||||
*/
|
||||
|
||||
const add = () => {
|
||||
form.value = {};
|
||||
title.value = "_title.purchase.purchaseplan.add";
|
||||
visible.value = true;
|
||||
formType.value = false;
|
||||
};
|
||||
const edit = (row: any) => {
|
||||
title.value = "_title.purchase.purchaseplan.edit";
|
||||
form.value = { ...row };
|
||||
visible.value = true;
|
||||
formType.value = true;
|
||||
};
|
||||
const remove = (row: any) => {
|
||||
useRemove(removeUrl, row.id, "_message.purchase.purchaseplan.delete_message");
|
||||
};
|
||||
const submit = (form: any, formRef: FormInstance | undefined) => {
|
||||
if (formRef !== undefined) {
|
||||
formRef.validate(valid => {
|
||||
if (valid) {
|
||||
if (formType.value) useEdit(editUrl, form, visible);
|
||||
else useAdd(addUrl, form, visible);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const topButtonClick = (eventName: string) => {
|
||||
switch (eventName) {
|
||||
case "add":
|
||||
add();
|
||||
break;
|
||||
}
|
||||
};
|
||||
const operateButtonClick = (eventName: string, row: any) => {
|
||||
switch (eventName) {
|
||||
case "edit":
|
||||
edit(row);
|
||||
break;
|
||||
case "remove":
|
||||
remove(row);
|
||||
break;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<BasePageableTable :url="getPageUrl" :searchers="searchers" ref="tableRef">
|
||||
<template #tool-button>
|
||||
<DefaultToolButton @top-button-click="topButtonClick" />
|
||||
</template>
|
||||
<template #columns>
|
||||
<el-table-column prop="id" type="hidden" width="40" />
|
||||
<el-table-column :label="$t('_prop.purchase.purchaseplan.planNo')" prop="planNo" />
|
||||
<el-table-column :label="$t('_prop.purchase.purchaseplan.planName')" prop="planName" />
|
||||
<el-table-column :label="$t('_prop.purchase.purchaseplan.storeName')" prop="storeName" />
|
||||
<el-table-column :label="$t('_prop.purchase.purchaseplan.planStatus')" prop="planStatus" />
|
||||
<el-table-column :label="$t('_prop.purchase.purchaseplan.remask')" prop="remask" />
|
||||
<el-table-column :label="$t('_prop.common.createDate')" prop="createDate" :formatter="formatDate" />
|
||||
<DefaultOperateButtonColumn @operate-button-click="operateButtonClick" />
|
||||
</template>
|
||||
</BasePageableTable>
|
||||
<BaseForm v-model:visible="visible" @submit="submit" v-model:form="form" :title="$t(title)" :rules="rules">
|
||||
<template #form-items>
|
||||
<el-form-item prop="id" v-if="false"><el-input v-model="form.id" /></el-form-item>
|
||||
</template>
|
||||
</BaseForm>
|
||||
</template>
|
||||
Reference in New Issue
Block a user