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

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

@ -10,30 +10,34 @@ export const MesOrderMonthMainRules = reactive({
}) })
export const MesOrderMonthMain = useCrudSchemas(reactive<CrudSchema[]>([ export const MesOrderMonthMain = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '计划类型', label: '主计划编码',
field: 'planType', field: 'planMasterCode',
sort: 'custom', sort: 'custom',
isSearch: true isSearch: true
}, },
{ {
label: '计划辅助编码',
field: 'planSubCode',
sort: 'custom',
isSearch: true
}, {
label: '工厂编码', label: '工厂编码',
field: 'factoryCode', field: 'factoryCode',
sort: 'custom', sort: 'custom',
isTable: false isTable: false
}, },
{ {
label: '主计划编码', label: '工厂名称',
field: 'planMasterCode', field: 'factoryName',
sort: 'custom', sort: 'custom',
isTable: false, isSearch: true,
isSearch: true isForm: false
}, }, {
{ label: '计划类型',
label: '计划辅助编码', field: 'planType',
field: 'planSubCode',
sort: 'custom', sort: 'custom',
isTable: true,
isSearch: true isSearch: true
}, },
{ {
@ -48,6 +52,9 @@ export const MesOrderMonthMain = useCrudSchemas(reactive<CrudSchema[]>([
sort: 'custom', sort: 'custom',
formatter: dateFormatter, formatter: dateFormatter,
isSearch: true, isSearch: true,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
search: { search: {
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: {
@ -65,13 +72,6 @@ export const MesOrderMonthMain = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: true, isSearch: true,
isForm: false isForm: false
}, },
{
label: '工厂名称',
field: 'factoryName',
sort: 'custom',
isSearch: true,
isForm: false
},
{ {
label: '操作', label: '操作',
field: 'action', 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