Browse Source

1、订单月计划级联删除逻辑

master_hella_20240701
bjang03 8 months ago
parent
commit
744125699d
  1. 53
      src/api/mes/ordermonthplan/index.ts
  2. 44
      src/views/mes/ordermonthplan/index.vue
  3. 51
      src/views/mes/ordermonthplan/mesOrderMonthMain.data.ts
  4. 162
      src/views/mes/ordermonthplan/mesOrderMonthSub.data.ts

53
src/api/mes/ordermonthplan/index.ts

@ -58,3 +58,56 @@ export const exportMesOrderMonthMain = async (params) => {
export const importTemplate = () => {
return request.download({ url: '/plan/mes-order-month-main/get-import-template' })
}
export interface MesOrderMonthSubVO {
status: string
remark: string
productCode: string
bomCode: string
inStoreCode: string
planBegin: Date
planEnd: Date
realStart: string
realFinish: Date
planCount: number
finishCount: number
qualifiedCount: number
unqualifiedCount: number
flagBackwash: string
productBatchcode: string
}
// 查询订单月计划子列表
export const getMesOrderMonthSubPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/plan/mes-order-month-sub/senior', data })
} else {
return await request.get({ url: `/plan/mes-order-month-sub/page`, params })
}
}
// 查询订单月计划子详情
export const getMesOrderMonthSub = async (id: number) => {
return await request.get({ url: `/plan/mes-order-month-sub/get?id=` + id })
}
// 新增订单月计划子
export const createMesOrderMonthSub = async (data: MesOrderMonthSubVO) => {
return await request.post({ url: `/plan/mes-order-month-sub/create`, data })
}
// 修改订单月计划子
export const updateMesOrderMonthSub = async (data: MesOrderMonthSubVO) => {
return await request.put({ url: `/plan/mes-order-month-sub/update`, data })
}
// 删除订单月计划子
export const deleteMesOrderMonthSub = async (id: number) => {
return await request.delete({ url: `/plan/mes-order-month-sub/delete?id=` + id })
}
// 导出订单月计划子 Excel
export const exportMesOrderMonthSub = async (params) => {
return await request.download({ url: `/plan/mes-order-month-sub/export-excel`, params })
}

44
src/views/mes/ordermonthplan/index.vue

@ -27,9 +27,9 @@
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
<template #planMasterCode="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.planMasterCode)">
<span>{{ row.planMasterCode }}</span>
</el-button>
</template>
<template #action="{ row }">
@ -44,17 +44,26 @@
@success="formsSuccess"
:rules="MesOrderMonthMainRules"
:formAllSchemas="MesOrderMonthMain.allSchemas"
:apiUpdate="MesOrderMonthMainApi.updateMesOrderMonthMain"
:apiCreate="MesOrderMonthMainApi.createMesOrderMonthMain"
@searchTableSuccess="searchTableSuccess"
:apiUpdate="MesOrderMonthApi.updateMesOrderMonthMain"
:apiCreate="MesOrderMonthApi.createMesOrderMonthMain"
:apiDelete="MesOrderMonthApi.deleteMesOrderMonthMain"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef"
:isBasic="false"
:detailAllSchemasRules="MesOrderMonthMainRules"
:allSchemas="MesOrderMonthMain.allSchemas"
:detailAllSchemas="MesOrderMonthSub.allSchemas"
:detailAllSchemasRules="MesOrderMonthSubRules"
:apiPage="MesOrderMonthApi.getMesOrderMonthSubPage"
:apiCreate="MesOrderMonthApi.createMesOrderMonthSub"
:apiUpdate="MesOrderMonthApi.updateMesOrderMonthSub"
:apiDelete="MesOrderMonthApi.deleteMesOrderMonthSub"
:tabs="TabsList"
:detailButtonIsShowAdd="true"
:detailButtonIsShowDelete="true"
:detailButtonIsShowEdit="false"
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/plan/mes-order-month-main/import"
@ -63,18 +72,21 @@
<script setup lang="ts">
import download from '@/utils/download'
import {MesOrderMonthMain, MesOrderMonthMainRules} from './mesOrderMonthMain.data'
import * as MesOrderMonthMainApi from '@/api/mes/ordermonthplan'
import {MesOrderMonthMain, MesOrderMonthMainRules,TabsList} from './mesOrderMonthMain.data'
import * as MesOrderMonthApi from '@/api/mes/ordermonthplan'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
import {
MesOrderMonthSub,
MesOrderMonthSubRules
} from "@/views/mes/ordermonthplan/mesOrderMonthSub.data";
defineOptions({ name: 'MesOrderMonthMain' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
@ -95,7 +107,7 @@ const updataTableColumns = (val) => {
}
const { tableObject, tableMethods } = useTable({
getListApi: MesOrderMonthMainApi.getMesOrderMonthMainPage //
getListApi: MesOrderMonthApi.getMesOrderMonthMainPage //
})
//
@ -170,10 +182,10 @@ const formsSuccess = async (formType,data) => {
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await MesOrderMonthMainApi.createMesOrderMonthMain(data)
await MesOrderMonthApi.createMesOrderMonthMain(data)
message.success(t('common.createSuccess'))
} else {
await MesOrderMonthMainApi.updateMesOrderMonthMain(data)
await MesOrderMonthApi.updateMesOrderMonthMain(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
@ -192,7 +204,7 @@ const handleDelete = async (id: number) => {
//
await message.delConfirm()
//
await MesOrderMonthMainApi.deleteMesOrderMonthMain(id)
await MesOrderMonthApi.deleteMesOrderMonthMain(id)
message.success(t('common.delSuccess'))
//
await getList()
@ -207,7 +219,7 @@ const handleExport = async () => {
await message.exportConfirm()
//
exportLoading.value = true
const data = await MesOrderMonthMainApi.exportMesOrderMonthMain(tableObject.params)
const data = await MesOrderMonthApi.exportMesOrderMonthMain(tableObject.params)
download.excel(data, '订单计划月主.xlsx')
} catch {
} finally {
@ -242,7 +254,7 @@ const searchFormClick = (searchData) => {
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await MesOrderMonthMainApi.importTemplate()
importTemplateData.templateUrl = await MesOrderMonthApi.importTemplate()
})
</script>

51
src/views/mes/ordermonthplan/mesOrderMonthMain.data.ts

@ -1,39 +1,43 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import type {CrudSchema} from '@/hooks/web/useCrudSchemas'
import {dateFormatter} from '@/utils/formatTime'
// 表单校验
export const MesOrderMonthMainRules = reactive({
planMasterCode: [required],
planSubCode:[required],
planType:[required],
factoryCode:[required]
planSubCode: [required],
planType: [required],
factoryCode: [required]
})
export const MesOrderMonthMain = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '计划类型',
field: 'planType',
label: '主计划编码',
field: 'planMasterCode',
sort: 'custom',
isSearch: true
},
{
label: '计划辅助编码',
field: 'planSubCode',
sort: 'custom',
isSearch: true
}, {
label: '工厂编码',
field: 'factoryCode',
sort: 'custom',
isTable: false
},
{
label: '主计划编码',
field: 'planMasterCode',
label: '工厂名称',
field: 'factoryName',
sort: 'custom',
isTable: false,
isSearch: true
},
{
label: '计划辅助编码',
field: 'planSubCode',
isSearch: true,
isForm: false
}, {
label: '计划类型',
field: 'planType',
sort: 'custom',
isTable: true,
isSearch: true
},
{
@ -48,6 +52,9 @@ export const MesOrderMonthMain = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
search: {
component: 'DatePicker',
componentProps: {
@ -65,13 +72,6 @@ export const MesOrderMonthMain = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: true,
isForm: false
},
{
label: '工厂名称',
field: 'factoryName',
sort: 'custom',
isSearch: true,
isForm: false
},
{
label: '操作',
field: 'action',
@ -82,3 +82,8 @@ export const MesOrderMonthMain = useCrudSchemas(reactive<CrudSchema[]>([
}
}
]))
export const TabsList = [{
label: "子计划",
prop: 'mesOrderMonthSub',
}
]

162
src/views/mes/ordermonthplan/mesOrderMonthSub.data.ts

@ -0,0 +1,162 @@
import type {CrudSchema} from '@/hooks/web/useCrudSchemas'
import {dateFormatter} from '@/utils/formatTime'
// 表单校验
export const MesOrderMonthSubRules = reactive({
productCode: [required],
productName: [required],
bomCode: [required],
inStoreCode: [required],
planBegin: [required],
planEnd: [required],
planCount: [required],
productBatchcode: [required]
})
export const MesOrderMonthSub = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '产品编码',
field: 'productCode',
sort: 'custom',
isTable: false,
isSearch: true,
form: {
component: 'SelectV2'
}
},
{
label: '产品名称',
field: 'productName',
sort: 'custom',
isSearch: true,
isForm: false
},
{
label: 'BOM编号',
field: 'bomCode',
sort: 'custom',
isTable: false,
isSearch: true
},
{
label: '入库仓库编码',
field: 'inStoreCode',
sort: 'custom',
isSearch: true
},
{
label: '计划数量',
field: 'planCount',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
}
},
{
label: '完成数量',
field: 'finishCount',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
}
},
{
label: '合格数量',
field: 'qualifiedCount',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
}
},
{
label: '不合格数量',
field: 'unqualifiedCount',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
}
},
{
label: '是否回冲',
field: 'flagBackwash',
sort: 'custom',
isSearch: true
},
{
label: '产品批次号',
field: 'productBatchcode',
sort: 'custom',
isSearch: true
}, {
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
isForm: false
},
{
label: '计划开始日期',
field: 'planBegin',
sort: 'custom',
isSearch: true
},
{
label: '计划结束日期',
field: 'planEnd',
sort: 'custom',
isSearch: true
},
{
label: '实际开工日期',
field: 'realStart',
sort: 'custom',
isSearch: true
},
{
label: '实际完工日期',
field: 'realFinish',
sort: 'custom',
isSearch: true
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isTable: false
},
{
label: '状态',
field: 'status',
sort: 'custom',
isSearch: true,
form: {
component: 'Radio'
}
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
Loading…
Cancel
Save