zhousq
8 months ago
9 changed files with 2006 additions and 13 deletions
@ -0,0 +1,74 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface OrderDayVO { |
|||
status: string |
|||
remark: string |
|||
planNoMonth: string |
|||
planNoDay: string |
|||
productCode: string |
|||
workroomCode: string |
|||
lineCode: string |
|||
planCount: number |
|||
processrouteCode: string |
|||
tempProcessroute: string |
|||
standardBom: string |
|||
tempBom: string |
|||
workMode: string |
|||
planDate: Date |
|||
startTime: Date |
|||
endTime: Date |
|||
taskMode: string |
|||
} |
|||
|
|||
// 查询生产日计划列表
|
|||
export const getOrderDayPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/mes/orderday/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/mes/orderday/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询生产日计划详情
|
|||
export const getOrderDay = async (id: number) => { |
|||
return await request.get({ url: `/mes/orderday/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增生产日计划
|
|||
export const createOrderDay = async (data: OrderDayVO) => { |
|||
return await request.post({ url: `/mes/orderday/create`, data }) |
|||
} |
|||
|
|||
// 修改生产日计划
|
|||
export const updateOrderDay = async (data: OrderDayVO) => { |
|||
return await request.put({ url: `/mes/orderday/update`, data }) |
|||
} |
|||
|
|||
// 删除生产日计划
|
|||
export const deleteOrderDay = async (id: number) => { |
|||
return await request.delete({ url: `/mes/orderday/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出生产日计划 Excel
|
|||
export const exportOrderDay = async (params) => { |
|||
return await request.download({ url: `/mes/orderday/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/mes/orderday/get-import-template' }) |
|||
} |
|||
// 根据产品编码获取Bom
|
|||
export const getBoms = async (code: String) => { |
|||
return request.get({ url: '/mes/common/geBomByProductCode?code='+code }) |
|||
} |
|||
// 根据产品编码获取工艺路线
|
|||
export const getProcessroutes = async (code: String) => { |
|||
return request.get({ url: '/mes/common/getProcessRouteByProductCode?code='+code }) |
|||
} |
|||
// 根据车间编码获取产线列表
|
|||
export const getProductlines = async (code: String) => { |
|||
return request.get({ url: '/mes/common/getLinesByWorkRoomCode?code='+code }) |
|||
} |
@ -0,0 +1,559 @@ |
|||
<template> |
|||
<Dialog |
|||
:title="dialogTitle" |
|||
v-model="dialogVisible" |
|||
:width="dialogWidth" |
|||
:close-on-click-modal="false" |
|||
> |
|||
<div style="max-height: 60vh;overflow-y: auto;"> |
|||
<Form |
|||
ref="formRef" |
|||
v-loading="formLoading" |
|||
:rules="rules" |
|||
:schema="formSchema" |
|||
:is-col="true" |
|||
@opensearchTable="opensearchTable" |
|||
@onChange="onChange" |
|||
@onBlur="onBlur" /> |
|||
</div> |
|||
<template #footer> |
|||
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" /> |
|||
</template> |
|||
</Dialog> |
|||
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" /> |
|||
</template> |
|||
<script setup lang="ts"> |
|||
import { SearchTable } from '@/components/SearchTable' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
import ButtonBase from '@/components/XButton/src/ButtonBase.vue' |
|||
import TableForm from '@/components/TableForm/src/TableForm.vue' |
|||
|
|||
const props = defineProps({ |
|||
// 查询弹窗是否显示筛选按钮 |
|||
isSearchFilterButtonHide: { |
|||
type: Boolean, |
|||
default: false |
|||
}, |
|||
// 显示窗口宽度设置 |
|||
basicFormWidth: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
// 是否显示TableForm 新增/删除按钮 |
|||
isShowButton: { |
|||
type: Boolean, |
|||
default: true |
|||
}, |
|||
// 是否显示tableForm 删除按钮 |
|||
isShowReduceButton: { |
|||
type: Boolean, |
|||
default: true |
|||
}, |
|||
// 校验rules |
|||
rules: { |
|||
type: Object, |
|||
required: true, |
|||
default: null |
|||
}, |
|||
// 表单,列表 相关信息 |
|||
formAllSchemas: { |
|||
type: Object, |
|||
required: true, |
|||
default: null |
|||
}, |
|||
// 列表 相关信息 |
|||
tableAllSchemas: { |
|||
type: Array, |
|||
required: true, |
|||
default: null |
|||
}, |
|||
// 列表数据 |
|||
tableData: { |
|||
type: Array, |
|||
required: true, |
|||
default: null |
|||
}, |
|||
tableFormRules: { |
|||
type: Array, |
|||
required: true, |
|||
default: null |
|||
}, |
|||
// 查询参数 |
|||
// searchTableParams: { |
|||
// type: Array, |
|||
// required: false, |
|||
// default: null |
|||
// }, |
|||
// API——Vo |
|||
apiVo: { |
|||
type: Object, |
|||
required: true, |
|||
default: null |
|||
}, |
|||
// API——创建 |
|||
apiCreate: { |
|||
type: Function, |
|||
required: true, |
|||
default: null |
|||
}, |
|||
// API——编辑 |
|||
apiUpdate: { |
|||
type: Function, |
|||
required: true, |
|||
default: null |
|||
}, |
|||
// 是否是业务表单(区分是不显示tableForm) |
|||
isBusiness: { |
|||
type: Boolean, |
|||
required: true, |
|||
default: true |
|||
}, |
|||
// 表单form |
|||
form: { |
|||
type: Object, |
|||
required: true, |
|||
default: null |
|||
}, |
|||
// 详情数据 |
|||
detailData: { |
|||
type: Object, |
|||
required: true, |
|||
default: null |
|||
}, |
|||
// // 主表参数 |
|||
// masterParmas: { |
|||
// type: Object, |
|||
// required: false, |
|||
// default: null |
|||
// }, |
|||
// 来源 countPlan盘点计划进入 |
|||
fromeWhere: { |
|||
type: String, |
|||
required: false, |
|||
default: '' |
|||
}, |
|||
// 盘点范围类型 |
|||
countScopeType: { |
|||
type: Array, |
|||
required: false, |
|||
default: null |
|||
}, |
|||
// 是否从详情进入 |
|||
isDetail: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
// 窗体底部按钮:保存,关闭 |
|||
isShowFooterButtton: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: true |
|||
}, |
|||
// 明细数据长度校验 |
|||
tableFormDataLength: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: true |
|||
} |
|||
}) |
|||
|
|||
const { t } = useI18n() // 国际化 |
|||
const message = useMessage() // 消息弹窗 |
|||
const dialogWidth = ref() |
|||
if (props.basicFormWidth) { |
|||
dialogWidth.value = props.basicFormWidth + '%' |
|||
} else { |
|||
dialogWidth.value = props.isBusiness ? '60%' : '40%' |
|||
} |
|||
|
|||
const dialogVisible = ref(false) // 弹窗的是否展示 |
|||
const dialogTitle = ref('') // 弹窗的标题 |
|||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
|||
const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
|||
|
|||
const formRef = ref() // 表单 Ref |
|||
const formSchema = ref(props.formAllSchemas?.formSchema) |
|||
const tableAllSchemas = ref(props.tableAllSchemas) |
|||
const tableFormRules = ref(props.tableFormRules) |
|||
const searchFilterButtonHide=ref(props.isSearchFilterButtonHide) |
|||
// 列表-按钮 |
|||
// const buttondata = [ |
|||
// defaultButtons.mainListEditBtn(null), // 编辑 |
|||
// defaultButtons.mainListDeleteBtn(null) |
|||
// ] |
|||
// // 列表-操作按钮事件 |
|||
// const buttonTableClick = async (val, row) => { |
|||
// if (val == 'edit') { |
|||
|
|||
// } else if (val == 'delete') { |
|||
|
|||
// } else { |
|||
// } |
|||
// } |
|||
|
|||
/** 弹层操作 */ |
|||
// formField form表单中的字段 |
|||
// searchField 查询列表中的字段 |
|||
// type 发起事件位置 type=tableForm 是明细中发起的 否则 为主表发起的 |
|||
// searchCondition 查询条件 |
|||
const searchTableRef = ref() |
|||
const opensearchTable = ( |
|||
formField, |
|||
searchField, |
|||
searchTitle, |
|||
searchAllSchemas, |
|||
searchPage, |
|||
searchCondition, |
|||
multiple, |
|||
type, |
|||
row |
|||
) => { |
|||
const _searchCondition = {} |
|||
// 判断查询条件中,是否存在指向主表的数据 |
|||
if (searchCondition && searchCondition.length > 0) { |
|||
// 转换筛选条件所需 |
|||
let filters: any[] = [] |
|||
for (var i=0; i< searchCondition.length; i++ ) { |
|||
// searchCondition.forEach((item) => { |
|||
// 查询条件为主表某字段,需要赋值主表数据,数据来源是详情的,赋值需要从row中获取 |
|||
if (searchCondition[i].isMainValue) { |
|||
_searchCondition[searchCondition[i].key] = formRef.value.formModel[searchCondition[i].value] |
|||
? formRef.value.formModel[searchCondition[i].value] |
|||
: props.detailData |
|||
? props.detailData[searchCondition[i].value] |
|||
: row |
|||
? row[searchCondition[i].value] |
|||
: '' |
|||
// 是否含有空参数情况 |
|||
let isNull = false |
|||
if (_searchCondition[searchCondition[i].key] == '' || _searchCondition[searchCondition[i].key] == undefined) { |
|||
isNull = true |
|||
} |
|||
if (isNull) { |
|||
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!') |
|||
return |
|||
} |
|||
} else { |
|||
// 扩展 转换为筛选条件进行查询 |
|||
if (searchCondition[i].isSearch) { |
|||
filters.push({ |
|||
action: searchCondition[i].action, |
|||
column: searchCondition[i].key, |
|||
value: searchCondition[i].value |
|||
}) |
|||
} else { |
|||
_searchCondition[searchCondition[i].key] = searchCondition[i].value |
|||
} |
|||
} |
|||
} |
|||
if (filters.length > 0) { |
|||
_searchCondition.isSearch = true |
|||
_searchCondition.filters = filters |
|||
} |
|||
} |
|||
const _searchTableTitle = searchTitle |
|||
const _searchTableAllSchemas = searchAllSchemas |
|||
const _searchTablePage = searchPage |
|||
searchTableRef.value.open( |
|||
_searchTableTitle, |
|||
_searchTableAllSchemas, |
|||
_searchTablePage, |
|||
formField, |
|||
searchField, |
|||
multiple, |
|||
type, |
|||
row, |
|||
_searchCondition, |
|||
false, |
|||
searchFilterButtonHide.value |
|||
) |
|||
} |
|||
// 弹层确定返回所选数据 |
|||
// val : 弹层列表row 数据 |
|||
const searchTableSuccess = (formField, searchField, val, type, row) => { |
|||
emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row) |
|||
} |
|||
|
|||
/** 打开弹窗 */ |
|||
const open = async (type: string, row?: any, masterParmas?: any, titleName?: any) => { |
|||
dialogVisible.value = true |
|||
if (titleName) { |
|||
dialogTitle.value = t('action.' + titleName) |
|||
} else { |
|||
dialogTitle.value = t('action.' + type) |
|||
} |
|||
formType.value = type |
|||
resetForm() |
|||
// 修改时,设置数据 |
|||
// 如果是从主表的详情页面进图添加子表,需要添加masterId,number参数 |
|||
if (masterParmas) { |
|||
if (!row) { |
|||
row = { |
|||
masterId: masterParmas.masterId, |
|||
number: masterParmas.number |
|||
} |
|||
} |
|||
} |
|||
if (row?.id || row?.masterId) { |
|||
formLoading.value = true |
|||
try { |
|||
nextTick(() => { |
|||
formRef.value.setValues(row) |
|||
}) |
|||
} finally { |
|||
formLoading.value = false |
|||
} |
|||
} |
|||
} |
|||
defineExpose({ open, formRef, opensearchTable, dialogVisible, formLoading }) // 提供 open 方法,用于打开弹窗 |
|||
|
|||
/** 弹窗按钮 */ |
|||
let Butttondata:any = [] |
|||
if (props.isShowFooterButtton) { |
|||
Butttondata = [ |
|||
defaultButtons.formSaveBtn(null), // 保存 |
|||
defaultButtons.formCloseBtn(null) // 关闭 |
|||
] |
|||
} |
|||
|
|||
/** 按钮事件 */ |
|||
const buttonBaseClick = (val) => { |
|||
// 保存 |
|||
if (val == 'save') { |
|||
submitForm() |
|||
} |
|||
// 关闭 |
|||
else if (val == 'close') { |
|||
dialogVisible.value = false |
|||
} |
|||
} |
|||
|
|||
/** 提交表单 */ |
|||
// const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |
|||
|
|||
const tableFormRef = ref() |
|||
const submitForm = async () => { |
|||
const elForm = unref(formRef)?.getElFormRef() |
|||
// 校验表单 |
|||
if (!elForm) return |
|||
const valid = await elForm.validate() |
|||
if (!valid) return |
|||
// 针对主子表 明细校验 |
|||
if (props.isBusiness) { |
|||
formLoading.value = true |
|||
if (formType.value == 'create') { |
|||
const validateForm = await tableFormRef.value.validateForm() |
|||
formRef.value.setValues({status:'1'}) |
|||
if (!validateForm && props.tableFormDataLength) { |
|||
if (props.tableData.length == 0) { |
|||
message.warning('请填写明细信息!') |
|||
formLoading.value = false |
|||
return |
|||
} |
|||
formLoading.value = false |
|||
return |
|||
} |
|||
// 主子表——提交请求 |
|||
try { |
|||
const data = unref(formRef)?.formModel |
|||
emit('submitForm', formType.value, data) |
|||
} finally { |
|||
} |
|||
} else { |
|||
// 编辑 |
|||
try { |
|||
const data = unref(formRef)?.formModel |
|||
emit('submitForm', formType.value, data) |
|||
} finally { |
|||
} |
|||
} |
|||
} else { |
|||
// 基础数据单表——提交请求 |
|||
formLoading.value = true |
|||
try { |
|||
const data = unref(formRef)?.formModel |
|||
emit('success', formType.value, data) |
|||
} finally { |
|||
formLoading.value = false |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** 重置表单 */ |
|||
const resetForm = () => { |
|||
unref(formRef)?.resetFields() |
|||
} |
|||
|
|||
// 传递给父类 |
|||
const emit = defineEmits([ |
|||
'success', |
|||
'tableSelectionChange', |
|||
'tableFormSelectOnBlur', |
|||
'extendedButtonsClick', |
|||
'formSelectChange', |
|||
'formSelectvVisibleChange', |
|||
'tableSortChange', |
|||
'selectCallback', |
|||
'handleTableSelect', |
|||
'handleDeleteTable', |
|||
'handleAddTable', |
|||
'inpuFocus', |
|||
'searchTableSuccess', |
|||
'opensearchTable', |
|||
'submitForm', |
|||
'selectChange', |
|||
'selectChangeDetail', |
|||
'tableFormChange', |
|||
'buttonOperationClick', |
|||
'inputStringBlur', |
|||
'onChange', |
|||
'onBlur', |
|||
'inputNumberChange', |
|||
'formFormDateChange' |
|||
]) |
|||
//普通下拉改变事件 |
|||
const formSelectChange = (field, val, row) => { |
|||
emit('formSelectChange', field, val, row) |
|||
} |
|||
// 日期改变事件 |
|||
const formFormDateChange = (field, val,row, index) => { |
|||
emit('formFormDateChange', field, val,row, index) |
|||
} |
|||
const formSelectvVisibleChange = (field, val, row) => { |
|||
emit('formSelectvVisibleChange', field, val, row) |
|||
} |
|||
// 点击selection框 |
|||
const tableSelectionChange = (val) => { |
|||
emit('tableSelectionChange', val) |
|||
} |
|||
// tableform select bulr |
|||
const tableFormSelectOnBlur = (field, val, row, index) => { |
|||
emit('tableFormSelectOnBlur', field, val, row, index) |
|||
} |
|||
// 列表排序 |
|||
const tableSortChange = (column, prop, order) => { |
|||
emit('tableSortChange', column, prop, order) |
|||
} |
|||
|
|||
// 数字输入-改变事件 |
|||
const inputNumberChange = (field, index, row, val) => { |
|||
emit('inputNumberChange', field, index, row, val) |
|||
} |
|||
//下拉框回显方法 |
|||
// const showSelect = (val, statusID) => { |
|||
// return getDictForStatusID(val, statusID) |
|||
// } |
|||
|
|||
// 行点击 |
|||
const handleTableSelect = (row, column, event) => { |
|||
emit('handleTableSelect', row, column, event) |
|||
} |
|||
|
|||
// 删除数据 |
|||
const handleDeleteTable = (row, index) => { |
|||
emit('handleDeleteTable', row, index,formRef.value) |
|||
} |
|||
// 添加数据 |
|||
const handleAddTable = () => { |
|||
emit('handleAddTable') |
|||
} |
|||
// 输入框聚焦 |
|||
const inpuFocus = (headerItem, row, index) => { |
|||
opensearchTable( |
|||
headerItem.field, |
|||
headerItem.tableForm.searchField, |
|||
headerItem.tableForm.searchTitle, |
|||
headerItem.tableForm.searchAllSchemas, |
|||
headerItem.tableForm.searchPage, |
|||
headerItem.tableForm.searchCondition, |
|||
headerItem.tableForm.multiple, |
|||
'tableForm', |
|||
row |
|||
) |
|||
} |
|||
/** |
|||
* 监听改变事件 |
|||
* @param field 当前操作字段 |
|||
* @param cur 改变后值 |
|||
*/ |
|||
const onChange = (field, cur) => { |
|||
emit('onChange', field, cur) |
|||
} |
|||
|
|||
/** |
|||
* 监听失焦事件 |
|||
* @param field 当前操作字段 |
|||
* @param e |
|||
*/ |
|||
const onBlur = (field, e) => { |
|||
emit('onBlur', field, e) |
|||
} |
|||
|
|||
// 修改盘点类型 |
|||
const selectChange = (field, val) => { |
|||
emit('selectChange', field, val) |
|||
} |
|||
// 修改盘点范围类型 |
|||
const selectChangeDetail = (field, val,formSchema) => { |
|||
formSchema.value = '' |
|||
emit('selectChangeDetail', field, val) |
|||
} |
|||
|
|||
|
|||
const tableFormChange = (field, val, row) => { |
|||
emit('tableFormChange', field, val, row) |
|||
} |
|||
|
|||
const buttonOperationClick = (row, label, index)=> { |
|||
emit("buttonOperationClick", row, label, index); |
|||
} |
|||
|
|||
const inputStringBlur = (headerItem, row, index)=> { |
|||
emit("inputStringBlur", headerItem, row, index); |
|||
} |
|||
|
|||
</script> |
|||
<style lang="scss" scoped> |
|||
.table { |
|||
border: 1px solid #dedede; |
|||
border-radius: 8px; |
|||
padding: 10px; |
|||
width: calc(100% - 32px); |
|||
display: flex; |
|||
} |
|||
::v-deep(.el-table__body) { |
|||
padding: 10px 0px; |
|||
} |
|||
::v-deep(.el-table--default .el-table__cell) { |
|||
padding: 2px 0px; |
|||
border: none; |
|||
} |
|||
|
|||
::v-deep(.el-table td.el-table__cell .el-form-item__content) { |
|||
display: flex !important; |
|||
align-items: center !important; |
|||
justify-content: center !important; |
|||
} |
|||
::v-deep(.el-table td.el-table__cell div) { |
|||
overflow: visible; |
|||
} |
|||
|
|||
::v-deep(.el-icon) { |
|||
display: block; |
|||
}button |
|||
.button { |
|||
> div { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
cursor: pointer; |
|||
|
|||
> div { |
|||
margin-left: 6px; |
|||
text-decoration: underline; |
|||
color: #409eff; |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,597 @@ |
|||
<template> |
|||
<div> |
|||
<el-drawer |
|||
v-model="isShowDrawer" |
|||
title="详情" |
|||
direction="rtl" |
|||
size="80%" |
|||
v-loading="detailLoading" |
|||
> |
|||
<template #header> |
|||
<div class="font-size-18px"> |
|||
{{ titleValueRef }} <span class="ml-20px font-size-16px">{{ titleNameRef }}</span> |
|||
</div> |
|||
</template> |
|||
<ContentWrap v-if="!isBasic"> |
|||
<Descriptions |
|||
:data="detailData" |
|||
labelClassName="label-class-name" |
|||
label-align="left" |
|||
direction="vertical" |
|||
:column="8" |
|||
:schema="allSchemas.detailSchema" |
|||
:columns="2" |
|||
width="200px" |
|||
/> |
|||
</ContentWrap> |
|||
<div class="flex mt-20px"> |
|||
<ContentWrap class="w-[27%] ml-16px"> |
|||
<!-- 附件组件 --> |
|||
<Annex |
|||
:annexData="annexData" |
|||
@handleAnnexSuccess="handleAnnexSuccess" |
|||
@deleteAnnexSuccess="deleteAnnexSuccess" |
|||
:upData="remarksData.data" |
|||
/> |
|||
<!-- 备注组件 --> |
|||
<Remarks |
|||
:remarksData="remarksData" |
|||
class="mt-20px" |
|||
@remarksSubmitScuess="remarksSubmitScuess" |
|||
/> |
|||
<!-- 变更记录组件 --> |
|||
<ChangeRecord :changeRecordData="changeRecordData" class="mt-20px" /> |
|||
</ContentWrap> |
|||
</div> |
|||
</el-drawer> |
|||
|
|||
</div> |
|||
</template> |
|||
|
|||
<script lang="ts" setup> |
|||
import Annex from '@/components/Annex/src/Annex.vue' |
|||
import Remarks from '@/components/Remarks/src/Remarks.vue' |
|||
import ChangeRecord from '@/components/ChangeRecord/src/ChangeRecord.vue' |
|||
|
|||
import * as RemarkApi from '@/api/wms/remark' |
|||
import * as FileApi from '@/api/wms/file' |
|||
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|||
|
|||
defineOptions({ name: 'Detail' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
routeName.value = routeName.value.substring(0, routeName.value.length - 4) + 'Detail' |
|||
const updateKey = ref(0) |
|||
|
|||
const props = defineProps({ |
|||
// 标签参数 |
|||
tabs: { |
|||
type: Object, |
|||
required: true, |
|||
default: null |
|||
}, |
|||
// 是否是基础数据 展现详情顶部表单 |
|||
isBasic: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
// 表单,列表 相关信息 |
|||
allSchemas: { |
|||
type: Object, |
|||
required: true, |
|||
default: null |
|||
}, |
|||
// 明细列表相关信息 |
|||
detailAllSchemas: { |
|||
type: Object, |
|||
required: true, |
|||
default: null |
|||
}, |
|||
// 明细验证 |
|||
detailAllSchemasRules: { |
|||
type: Object, |
|||
required: true, |
|||
default: null |
|||
}, |
|||
// 子表新增API |
|||
apiCreate: { |
|||
type: Function, |
|||
required: false, |
|||
default: null |
|||
}, |
|||
// 子表编辑API |
|||
apiUpdate: { |
|||
type: Function, |
|||
required: false, |
|||
default: null |
|||
}, |
|||
// 子表分页列表API |
|||
apiPage: { |
|||
type: Function, |
|||
required: false, |
|||
default: null |
|||
}, |
|||
// 子表删除API |
|||
apiDelete: { |
|||
type: Function, |
|||
required: false, |
|||
default: null |
|||
}, |
|||
// 子表新增修改校验 |
|||
detailValidate: { |
|||
type: Function, |
|||
required: false, |
|||
default: null |
|||
}, |
|||
// 来源 countPlan盘点计划进入 |
|||
fromeWhere: { |
|||
type: String, |
|||
required: false, |
|||
default: '' |
|||
}, |
|||
// 获取接口列表集合 |
|||
allList: { |
|||
type: Object, |
|||
required: true, |
|||
default: null |
|||
}, |
|||
// 盘点范围类型 |
|||
countScopeType: { |
|||
type: Array, |
|||
required: false, |
|||
default: null |
|||
}, |
|||
//盘点详情子表新增的时候判断盘点范围值显示输入框还是下拉框 |
|||
formTypeDetail: { |
|||
type: String, |
|||
required: false, |
|||
default: 'InputString' |
|||
}, |
|||
//盘点详情子表新增的时候判断盘点范围值的下拉列表 |
|||
countPlanAllList: { |
|||
type: Array, |
|||
required: false, |
|||
default: null |
|||
}, |
|||
// 详情列表扩展操作按钮 |
|||
buttondataTable: { |
|||
type: Array, |
|||
required: false, |
|||
default: ()=>{ |
|||
return [] |
|||
} |
|||
}, |
|||
// 针对基础数据tabs扩展 显示table列表 默认false |
|||
tabsExtend: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
}, |
|||
// tableObject 数据过滤条件 针对 详情扩展标签页 传入不同条件 |
|||
tableObjectExtend: { |
|||
type: Array, |
|||
required: false, |
|||
default: null |
|||
}, |
|||
// 子列表 筛选 展示与隐藏 ,默认展示 |
|||
detailButtonIsShowFilter:{ |
|||
type: Boolean, |
|||
required: false, |
|||
default: true |
|||
}, |
|||
// 子列表 新增 展示与隐藏 ,默认展示 |
|||
detailButtonIsShowAdd:{ |
|||
type: Boolean, |
|||
required: false, |
|||
default: true |
|||
}, |
|||
// 子列表 编辑 展示与隐藏 ,默认展示 |
|||
detailButtonIsShowEdit:{ |
|||
type: Boolean, |
|||
required: false, |
|||
default: true |
|||
}, |
|||
// 子列表 删除 展示与隐藏 ,默认展示 |
|||
detailButtonIsShowDelete:{ |
|||
type: Boolean, |
|||
required: false, |
|||
default: true |
|||
} |
|||
}) |
|||
const isShowDrawer = ref(false) |
|||
const detailLoading = ref(false) |
|||
const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : ''))) |
|||
|
|||
if (props.isBasic == true) { |
|||
if (tabsList.value && tabsList.value.length > 0) { |
|||
tabsList.value.unshift({ |
|||
label: '详情', |
|||
prop: 'Detail' |
|||
}) |
|||
} |
|||
} else { |
|||
if (tabsList.value && tabsList.value.length > 0) { |
|||
} else { |
|||
tabsList.value = [ |
|||
{ |
|||
label: '明细', |
|||
prop: 'Detail' |
|||
} |
|||
] |
|||
} |
|||
} |
|||
if (tabsList.value) { |
|||
} |
|||
|
|||
// 附件默认数据 |
|||
const annexData = reactive({ |
|||
annexList: [] |
|||
}) |
|||
|
|||
// 备注数据 |
|||
const remarksData = reactive({ |
|||
remarksList: [], |
|||
data: {} |
|||
}) |
|||
|
|||
// 变更记录默认数据 |
|||
const changeRecordData = reactive({ |
|||
changeRecordList: [] |
|||
}) |
|||
const detailData = ref({}) //详情数据 |
|||
// 获取附件列表篇 |
|||
const getFileList = async () => { |
|||
detailLoading.value = true |
|||
try { |
|||
annexData.annexList = await FileApi.getFileList(remarksData.data) |
|||
} finally { |
|||
detailLoading.value = false |
|||
} |
|||
} |
|||
/** 添加附件 */ |
|||
const handleAnnexSuccess = () => { |
|||
getFileList() |
|||
getChangeRecordList() |
|||
} |
|||
// 删除附件成功之后所走的方法 |
|||
const deleteAnnexSuccess = async () => { |
|||
getFileList() |
|||
getChangeRecordList() |
|||
} |
|||
|
|||
// Tabs当前选择 |
|||
const current = ref(0) |
|||
const change = (item, index) => { |
|||
current.value = index |
|||
emit('changeTabs', item) |
|||
} |
|||
|
|||
//主表所需的参数 |
|||
const masterParmas = ref({ |
|||
masterId: '', //主表id |
|||
number: '', //主表单据号 |
|||
status: '' //主表状态 用于控制子表新增编辑按钮显示情况 |
|||
}) |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = ref() |
|||
// 列表-操作按钮 |
|||
const buttondata = ref() |
|||
|
|||
/** 打开弹窗 */ |
|||
const formRef = ref() |
|||
const titleNameRef = ref() |
|||
const titleValueRef = ref() |
|||
const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => { |
|||
titleNameRef.value = titleName |
|||
titleValueRef.value = titleValue |
|||
remarksData.data = { |
|||
tableId: row.id, |
|||
tableName: tableName |
|||
} |
|||
// 加载明细列表 |
|||
if (!props.isBasic) { |
|||
// 设置主表id |
|||
masterParmas.value.masterId = row.id |
|||
masterParmas.value.number = row.number |
|||
masterParmas.value.status = row.status |
|||
tableObjectRef.value.params = { |
|||
masterId: row.id |
|||
} |
|||
await getList() |
|||
} |
|||
isShowDrawer.value = true |
|||
if (row) { |
|||
detailLoading.value = true |
|||
try { |
|||
detailData.value = row |
|||
getRemarkList() |
|||
getFileList() |
|||
getChangeRecordList() |
|||
// 判断详情按钮是否显示 |
|||
let detailButtonFilter: any = [] |
|||
let detailButtonAdd: any = [] |
|||
if (props.detailButtonIsShowFilter) { |
|||
// 筛选 |
|||
detailButtonFilter = [ |
|||
defaultButtons.defaultFilterBtn(null) |
|||
] |
|||
} |
|||
if (props.detailButtonIsShowAdd) { |
|||
// 新增 |
|||
detailButtonAdd = [ |
|||
defaultButtons.defaultAddBtn({ |
|||
hide: isShowMainButton(row, ['1']) |
|||
}) |
|||
] |
|||
} |
|||
HeadButttondata.value = [...detailButtonFilter,...detailButtonAdd] |
|||
|
|||
// 针对特殊处理 当业务是任务的 只显示筛选 正常情况下应在业务页面设置 后期再作优化 |
|||
if (routeName.value.indexOf('Job') > -1) { |
|||
HeadButttondata.value = [ |
|||
defaultButtons.defaultFilterBtn(null) // 筛选 |
|||
] |
|||
} |
|||
|
|||
let detailButtonEdit: any = [] |
|||
let detailButtonDelete: any = [] |
|||
if (props.detailButtonIsShowEdit) { |
|||
// 编辑 |
|||
detailButtonEdit = [ |
|||
defaultButtons.mainListEditBtn({ |
|||
hide: isShowMainButton(row, ['1']) |
|||
}) |
|||
] |
|||
} |
|||
if (props.detailButtonIsShowDelete) { |
|||
// 删除 |
|||
detailButtonDelete = [ |
|||
defaultButtons.mainListDeleteBtn({ |
|||
hide: isShowMainButton(row, ['1']) |
|||
}) |
|||
] |
|||
} |
|||
buttondata.value = [...detailButtonEdit,...detailButtonDelete,...props.buttondataTable] |
|||
|
|||
} finally { |
|||
detailLoading.value = false |
|||
} |
|||
} |
|||
} |
|||
defineExpose({ openDetail, formRef }) // 提供 open 方法,用于打开弹窗 |
|||
|
|||
// 获取备注列表 |
|||
const getRemarkList = async () => { |
|||
detailLoading.value = true |
|||
try { |
|||
remarksData.remarksList = await RemarkApi.getRemarkPage(remarksData.data) |
|||
} finally { |
|||
detailLoading.value = false |
|||
} |
|||
} |
|||
// 备注提交成功之后 |
|||
const remarksSubmitScuess = async (remark) => { |
|||
detailLoading.value = false |
|||
getRemarkList() |
|||
getChangeRecordList() |
|||
} |
|||
// 获取变更记录 |
|||
const getChangeRecordList = async () => { |
|||
changeRecordData.changeRecordList = await RemarkApi.getChangeRecordPage(remarksData.data) |
|||
} |
|||
|
|||
const tableObjectRef = ref() |
|||
const tableMethodsRef = ref() |
|||
const detailAllSchemasRef = ref() |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: props.apiPage // 分页接口 |
|||
}) |
|||
|
|||
tableObjectRef.value = tableObject |
|||
tableMethodsRef.value = tableMethods |
|||
detailAllSchemasRef.value = props.detailAllSchemas |
|||
|
|||
// 根据状态返回该按钮是否显示 |
|||
const isShowMainButton = (row, val) => { |
|||
if (val.indexOf(row.status) > -1) { |
|||
return false |
|||
} else { |
|||
return true |
|||
} |
|||
} |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList } = tableMethodsRef.value |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'add') { |
|||
// 新增 |
|||
openForm('create') |
|||
} else if (val == 'import') { |
|||
// 导入 |
|||
handleImport() |
|||
} else if (val == 'export') { |
|||
// 导出 |
|||
handleExport() |
|||
} else if (val == 'refresh') { |
|||
// 刷新 |
|||
getList() |
|||
} else if (val == 'filtrate') { |
|||
// 筛选 |
|||
} else { |
|||
// 其他按钮 |
|||
console.log('其他按钮', item) |
|||
} |
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
// const updataTableColumns = (val) => { |
|||
// detailAllSchemas.tableColumns.value = val |
|||
// } |
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { |
|||
// 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { |
|||
// 删除 |
|||
handleDelete(row.id) |
|||
} else { |
|||
emit('tableFormButton',val, row) |
|||
} |
|||
} |
|||
/** 添加/修改操作 */ |
|||
const openForm = async (type: string, row?: number) => { |
|||
formRef.value.open(type, row, masterParmas.value) |
|||
emit('detailOpenForm', type, row) |
|||
} |
|||
// form 提交 |
|||
const submitForm = async (formType, data) => { |
|||
try { |
|||
// 子表新增编辑校验 如果业务需要子表提交校验 需在主页详情组件添加 detailValidate 参数及方法 |
|||
const rs = (await props.detailValidate) ? await props.detailValidate(data) : true |
|||
if (!rs) return |
|||
if (formType === 'create') { |
|||
await props.apiCreate(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await props.apiUpdate(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
formRef.value.dialogVisible = false |
|||
// 刷新当前列表 |
|||
await getList() |
|||
updateKey.value += 1 |
|||
} finally { |
|||
formRef.value.formLoading = false |
|||
} |
|||
} |
|||
|
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
emit('searchTableSuccessDetail', formField, searchField, val, formRef) |
|||
} |
|||
// 传递给父类 |
|||
const emit = defineEmits([ |
|||
'searchTableSuccessDetail', |
|||
'changeTabs', |
|||
'selectChangeDetail', |
|||
'detailOpenForm', |
|||
'tableFormButton', |
|||
'openImage', |
|||
'onBlur', |
|||
'detailBasicFormOnChange', |
|||
'formFormDateChange' |
|||
]) |
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
tableObject.loading = true |
|||
// 发起删除 |
|||
await props.apiDelete(id) |
|||
tableObject.loading = false |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
updateKey.value += 1 |
|||
} catch {} |
|||
} |
|||
// 筛选提交 |
|||
const searchFormClick = async (searchData) => { |
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: props.apiPage // 分页接口 |
|||
}) |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
? searchData.filters |
|||
: [{ column: 'masterId', action: '==', value: masterParmas.value.masterId }] |
|||
} |
|||
detailAllSchemasRef.value = props.detailAllSchemas |
|||
tableObjectRef.value = tableObject |
|||
tableMethodsRef.value = tableMethods |
|||
tableObjectRef.value.tableList = [] |
|||
const { getList } = tableMethods |
|||
await getList() |
|||
updateKey.value += 1 |
|||
// tableObjectRef.value.params = { |
|||
// isSearch: true, |
|||
// filters: searchData.filters |
|||
// ? searchData.filters |
|||
// : [{ column: 'masterId', action: '==', value: masterParmas.value.masterId }] |
|||
// } |
|||
// getList() // 刷新当前列表 |
|||
} |
|||
// 选择盘点类型的时候针对限值的操作 |
|||
const selectChangeDetail = (field, val) => { |
|||
emit('selectChangeDetail', field, val) |
|||
} |
|||
// 打开图片 |
|||
const openImage=(item)=>{ |
|||
emit('openImage', item) |
|||
} |
|||
/** |
|||
* 监听改变事件 |
|||
* @param field 当前操作字段 |
|||
* @param cur 改变后值 |
|||
*/ |
|||
const detailBasicFormOnChange = (field, cur) => { |
|||
emit('detailBasicFormOnChange', field, cur) |
|||
} |
|||
|
|||
/** |
|||
* 监听失焦事件 |
|||
* @param field 当前操作字段 |
|||
* @param e |
|||
*/ |
|||
const onBlur = (field, e) => { |
|||
emit('onBlur', field, e) |
|||
} |
|||
|
|||
// 日期改变事件 |
|||
const formFormDateChange = (field, val,row, index) => { |
|||
emit('formFormDateChange', field, val,row, index) |
|||
} |
|||
//监视属性 |
|||
watch( |
|||
() => props.apiPage, |
|||
() => { |
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: props.apiPage // 分页接口 |
|||
}) |
|||
tableObject.params.masterId = masterParmas.value.masterId |
|||
detailAllSchemasRef.value = props.detailAllSchemas |
|||
if (props.tableObjectExtend) { |
|||
props.tableObjectExtend.forEach(item => { |
|||
tableObject.params[item.key] = item.value |
|||
}) |
|||
} |
|||
tableObjectRef.value = tableObject |
|||
tableMethodsRef.value = tableMethods |
|||
const { getList } = tableMethods |
|||
getList() |
|||
} |
|||
) |
|||
</script> |
|||
<style lang="scss"> |
|||
.el-drawer__body { |
|||
background: #f5f5f5 !important; |
|||
} |
|||
|
|||
::v-deep(.label-class-name) { |
|||
color: #dedede; |
|||
} |
|||
</style> |
|||
<style scoped lang="scss"></style> |
@ -0,0 +1,323 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search |
|||
:schema="OrderDay.allSchemas.searchSchema" |
|||
@search="setSearchParams" |
|||
@reset="setSearchParams" |
|||
/> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="OrderDay.allSchemas" |
|||
/> |
|||
|
|||
<!-- 列表 --> |
|||
<ContentWrap> |
|||
<Table |
|||
:columns="tableColumns" |
|||
:data="tableObject.tableList" |
|||
:loading="tableObject.loading" |
|||
:pagination="{ |
|||
total: tableObject.total |
|||
}" |
|||
v-model:pageSize="tableObject.pageSize" |
|||
v-model:currentPage="tableObject.currentPage" |
|||
v-model:sort="tableObject.sort" |
|||
> |
|||
<template #planNoDay="{ row }"> |
|||
<el-button type="primary" link @click="openDetail(row, '计划编码', row.planNoDay)"> |
|||
<span>{{ row.planNoDay }}</span> |
|||
</el-button> |
|||
</template> |
|||
<template #action="{ row }"> |
|||
<ButtonBase |
|||
:Butttondata="butttondata(row)" |
|||
@button-base-click="buttonTableClick($event, row)" |
|||
/> |
|||
</template> |
|||
</Table> |
|||
</ContentWrap> |
|||
|
|||
<!-- 表单弹窗:添加/修改 --> |
|||
<BasicFormV2 |
|||
ref="basicFormRef" |
|||
@success="formsSuccess" |
|||
:rules="OrderDayRules" |
|||
:formAllSchemas="OrderDay.allSchemas" |
|||
:apiUpdate="OrderDayApi.updateOrderDay" |
|||
:apiCreate="OrderDayApi.createOrderDay" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
:isSearchFilterButtonHide="true" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="OrderDay.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm |
|||
ref="importFormRef" |
|||
url="/mes/orderday/import" |
|||
:importTemplateData="importTemplateData" |
|||
@success="importSuccess" |
|||
/> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { OrderDay,OrderDayRules } from './orderDay.data' |
|||
import * as OrderDayApi from '@/api/mes/orderDay' |
|||
import BasicFormV2 from './components/BasicFormV2.vue' |
|||
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' |
|||
|
|||
defineOptions({ name: 'MesOrderDay' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(OrderDay.allSchemas.tableColumns) |
|||
const lineOptions=ref([]) |
|||
const processRouteOptions=ref([]) |
|||
const bomOptions=ref([]) |
|||
//**获取 工序信息 */ |
|||
const getProcessroutes = async (code: String) => { |
|||
processRouteOptions.value = await OrderDayApi.getProcessroutes(code) |
|||
OrderDay.allSchemas.formSchema.forEach(item => { |
|||
if (item.field == 'processrouteCode') { |
|||
console.log('processrouteCode',item.field) |
|||
item.componentProps.options = processRouteOptions.value |
|||
} |
|||
}) |
|||
} |
|||
const getProductlines = async (code: String) => { |
|||
lineOptions.value = await OrderDayApi.getProductlines(code) |
|||
OrderDay.allSchemas.formSchema.forEach(item => { |
|||
if (item.field == 'lineCode') { |
|||
item.componentProps.options = lineOptions.value |
|||
} |
|||
}) |
|||
} |
|||
const getBoms = async (code: String) => { |
|||
bomOptions.value = await OrderDayApi.getBoms(code) |
|||
OrderDay.allSchemas.formSchema.forEach(item => { |
|||
if (item.field == 'standardBom') { |
|||
item.componentProps.options = bomOptions.value |
|||
} |
|||
}) |
|||
} |
|||
// 查询页面返回 |
|||
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|||
nextTick(() => { |
|||
const setV = {} |
|||
setV[formField] = val[0][searchField] |
|||
formRef.setValues(setV) |
|||
if(formField=='productCode'){ |
|||
//formRef.setValues({standardBom:'bomddd'}) |
|||
getProcessroutes(val[0][searchField]) |
|||
getBoms(val[0][searchField]) |
|||
} |
|||
if(formField=='workroomCode'){ |
|||
getProductlines(val[0][searchField]) |
|||
} |
|||
|
|||
}) |
|||
|
|||
} |
|||
|
|||
// 字段设置 更新主列表字段 |
|||
const updataTableColumns = (val) => { |
|||
tableColumns.value = val |
|||
} |
|||
|
|||
const { tableObject, tableMethods } = useTable({ |
|||
getListApi: OrderDayApi.getOrderDayPage // 分页接口 |
|||
|
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'mes:orderDay:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'mes:orderDay:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'mes:orderDay:export'}), // 导出 |
|||
defaultButtons.defaultFreshBtn(null), // 刷新 |
|||
defaultButtons.defaultFilterBtn(null), // 筛选 |
|||
defaultButtons.defaultSetBtn(null), // 设置 |
|||
] |
|||
|
|||
// 头部按钮事件 |
|||
const buttonBaseClick = (val, item) => { |
|||
if (val == 'add') { // 新增 |
|||
openForm('create') |
|||
} else if (val == 'import') { // 导入 |
|||
handleImport() |
|||
} else if (val == 'export') { // 导出 |
|||
handleExport() |
|||
} else if (val == 'refresh') { // 刷新 |
|||
getList() |
|||
} else if (val == 'filtrate') { // 筛选 |
|||
} else { // 其他按钮 |
|||
console.log('其他按钮', item) |
|||
} |
|||
} |
|||
// 根据状态返回该按钮是否显示 |
|||
const isShowMainButton = (row,val) => { |
|||
//console.log('row',row) |
|||
if (val.indexOf(row.status) > -1) { |
|||
return false |
|||
} else { |
|||
return true |
|||
} |
|||
} |
|||
// 列表-操作按钮 |
|||
// 列表-操作按钮 |
|||
const butttondata = (row) => { |
|||
//console.log('row2',row) |
|||
return [ |
|||
defaultButtons.mainListEditBtn({ hide: isShowMainButton(row,['1']),hasPermi:'mes:orderDay:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({ hide: isShowMainButton(row,['1']),hasPermi:'mes:orderDay:delete'}), // 删除 |
|||
defaultButtons.mainListHandleBtn({label: '排产', |
|||
name: 'schedule', |
|||
hide: isShowMainButton(row,['1']), |
|||
type: 'warning', |
|||
icon: '', |
|||
color: '', |
|||
hasPermi: ''}), // |
|||
defaultButtons.mainListHandleBtn({label: '发布', |
|||
name: 'publish', |
|||
hide: isShowMainButton(row,['2']), |
|||
type: 'warning', |
|||
icon: '', |
|||
color: '', |
|||
hasPermi: ''}), // 路由设置 |
|||
defaultButtons.mainListHandleBtn({label: '终止', |
|||
name: 'publish', |
|||
hide: isShowMainButton(row,['1','2','3']), |
|||
type: 'warning', |
|||
icon: '', |
|||
color: '', |
|||
hasPermi: ''}), // 路由设置 |
|||
] |
|||
} |
|||
|
|||
|
|||
// 列表-操作按钮事件 |
|||
const buttonTableClick = async (val, row) => { |
|||
if (val == 'edit') { // 编辑 |
|||
openForm('update', row) |
|||
} else if (val == 'delete') { // 删除 |
|||
handleDelete(row.id) |
|||
} |
|||
} |
|||
|
|||
/** 添加/修改操作 */ |
|||
const basicFormRef = ref() |
|||
const openForm = (type: string, row?: any) => { |
|||
basicFormRef.value.open(type, row) |
|||
} |
|||
|
|||
// form表单提交 |
|||
const formsSuccess = async (formType,data) => { |
|||
var isHave =OrderDay.allSchemas.formSchema.some(function (item) { |
|||
return item.field === 'activeTime' || item.field === 'expireTime'; |
|||
}); |
|||
if(isHave){ |
|||
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ |
|||
message.error('失效时间要大于生效时间') |
|||
return; |
|||
} |
|||
} |
|||
if(data.activeTime==0)data.activeTime = null; |
|||
if(data.expireTime==0)data.expireTime = null; |
|||
if (formType === 'create') { |
|||
await OrderDayApi.createOrderDay(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await OrderDayApi.updateOrderDay(data) |
|||
message.success(t('common.updateSuccess')) |
|||
} |
|||
basicFormRef.value.dialogVisible = false |
|||
getList() |
|||
} |
|||
|
|||
/** 详情操作 */ |
|||
const detailRef = ref() |
|||
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|||
detailRef.value.openDetail(row, titleName, titleValue, 'basicOrderDay') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await OrderDayApi.deleteOrderDay(id) |
|||
message.success(t('common.delSuccess')) |
|||
// 刷新列表 |
|||
await getList() |
|||
} catch {} |
|||
} |
|||
|
|||
/** 导出按钮操作 */ |
|||
const exportLoading = ref(false) // 导出的加载中 |
|||
const handleExport = async () => { |
|||
try { |
|||
// 导出的二次确认 |
|||
await message.exportConfirm() |
|||
// 发起导出 |
|||
exportLoading.value = true |
|||
const data = await OrderDayApi.exportOrderDay(tableObject.params) |
|||
download.excel(data, '生产日计划.xlsx') |
|||
} catch { |
|||
} finally { |
|||
exportLoading.value = false |
|||
} |
|||
} |
|||
|
|||
/** 导入 */ |
|||
const importFormRef = ref() |
|||
const handleImport = () => { |
|||
importFormRef.value.open() |
|||
} |
|||
// 导入附件弹窗所需的参数 |
|||
const importTemplateData = reactive({ |
|||
templateUrl: '', |
|||
templateTitle: '生产日计划导入模版.xlsx' |
|||
}) |
|||
// 导入成功之后 |
|||
const importSuccess = () => { |
|||
getList() |
|||
} |
|||
|
|||
// 筛选提交 |
|||
const searchFormClick = (searchData) => { |
|||
tableObject.params = { |
|||
isSearch: true, |
|||
filters: searchData.filters |
|||
} |
|||
getList() // 刷新当前列表 |
|||
} |
|||
|
|||
/** 初始化 **/ |
|||
onMounted(async () => { |
|||
getList() |
|||
importTemplateData.templateUrl = await OrderDayApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,327 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
import * as ItembasicApi from '@/api/wms/itembasic' |
|||
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' |
|||
import * as WorkshopApi from '@/api/wms/workshop' |
|||
import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data' |
|||
import { on } from '@/utils/domUtils' |
|||
|
|||
// 表单校验
|
|||
export const OrderDayRules = reactive({ |
|||
planNoDay: [ |
|||
{ required: true, message: '请输入一个日计划编号', trigger: 'blur' } |
|||
], |
|||
planNoMonth: [ |
|||
{ required: true, message: '请输入一个月计划编号', trigger: 'blur' } |
|||
], |
|||
productCode: [ |
|||
{ required: true, message: '请选择一个产品', trigger: 'blur' } |
|||
], |
|||
workroomCode: [ |
|||
{ required: true, message: '请选择一个车间', trigger: 'blur' } |
|||
], |
|||
lineCode: [ |
|||
{ required: true, message: '请选择一个产线', trigger: 'blur' } |
|||
], |
|||
workMode: [ |
|||
{ required: true, message: '请选择工单生成方式', trigger: 'blur' } |
|||
], |
|||
startTime: [ |
|||
{ required: true, message: '请输入计划生产开始时间', trigger: 'blur' } |
|||
], |
|||
endTime: [ |
|||
{ required: true, message: '请输入计划生产完成时间', trigger: 'blur' } |
|||
], |
|||
planDate: [ |
|||
{ required: true, message: '请输入计划日期', trigger: 'blur' } |
|||
], |
|||
taskMode: [ |
|||
{ required: true, message: '请选择一个生产方式', trigger: 'blur' } |
|||
], |
|||
}) |
|||
|
|||
export const OrderDay = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: '主键', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
width: '60px', |
|||
}, |
|||
{ |
|||
label: '日计划单号', |
|||
field: 'planNoDay', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
required: true, |
|||
}, |
|||
{ |
|||
label: '月计划单号', |
|||
field: 'planNoMonth', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
required: false, |
|||
}, |
|||
{ |
|||
label: '状态', |
|||
field: 'status', |
|||
sort: 'custom', |
|||
isForm: false, |
|||
isTable: true, |
|||
isDetail:true, |
|||
isSearch: false, |
|||
width: '80px', |
|||
dictType: DICT_TYPE.MES_PLANDO_STATUS, |
|||
dictClass: 'string', |
|||
form: { |
|||
component: 'Select', |
|||
}, |
|||
}, |
|||
{ |
|||
label: '产品编号', |
|||
field: 'productCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
required: true, |
|||
form: { |
|||
// labelMessage: '信息提示说明!!!',
|
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '产品编码', // 输入框占位文本
|
|||
searchField: 'code', // 查询弹窗赋值字段
|
|||
searchTitle: '产品信息', // 查询弹窗标题
|
|||
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
|
|||
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
|
|||
isHideFilterButton:true, |
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}, |
|||
{ |
|||
key: 'type', |
|||
action: 'in', // 查询拼接条件
|
|||
isSearch: true, // 使用自定义拼接条件
|
|||
value: 'FG,SEMI',//,SEMI]
|
|||
isMainValue: false |
|||
}, |
|||
|
|||
] |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '车间编码', |
|||
field: 'workroomCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
required: true, |
|||
form: { |
|||
// labelMessage: '信息提示说明!!!',
|
|||
componentProps: { |
|||
isSearchList: true, // 开启查询弹窗
|
|||
searchListPlaceholder: '车间', // 输入框占位文本
|
|||
searchField: 'code', // 查询弹窗赋值字段
|
|||
searchTitle: '车间信息', // 查询弹窗标题
|
|||
searchAllSchemas: Workshop.allSchemas, // 查询弹窗所需类
|
|||
searchPage: WorkshopApi.getWorkshopPage, // 查询弹窗所需分页方法
|
|||
searchCondition: [{ |
|||
key: 'available', |
|||
value: 'TRUE', |
|||
isMainValue: false |
|||
}] |
|||
} |
|||
}, |
|||
|
|||
}, |
|||
{ |
|||
label: '产线编码', |
|||
field: 'lineCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
required: true, |
|||
form:{ |
|||
component:'Select', |
|||
componentProps:{ |
|||
options:[{lablel:'1',value:'1'}] |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '计划数量', |
|||
field: 'planCount', |
|||
sort: 'custom', |
|||
required: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 1 |
|||
}, |
|||
}, |
|||
{ |
|||
label: '工艺路线编码', |
|||
field: 'processrouteCode', |
|||
sort: 'custom', |
|||
form: { |
|||
component:'Select', |
|||
componentProps: { |
|||
options: [] |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '临时工艺', |
|||
field: 'tempProcessroute', |
|||
sort: 'custom', |
|||
width: '80px', |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', |
|||
form: { |
|||
component: 'Switch', |
|||
value: 'TRUE', |
|||
componentProps: { |
|||
inactiveValue: 'FALSE', |
|||
activeValue: 'TRUE' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: 'BOM编码', |
|||
field: 'standardBom', |
|||
sort: 'custom', |
|||
form: { |
|||
component:'Select', |
|||
componentProps: { |
|||
options: [{lablel:'bom',value:'bom'}] |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '替代BOM', |
|||
field: 'tempBom', |
|||
sort: 'custom', |
|||
width: '80px', |
|||
dictType: DICT_TYPE.TRUE_FALSE, |
|||
dictClass: 'string', |
|||
form: { |
|||
component: 'Switch', |
|||
value: 'TRUE', |
|||
componentProps: { |
|||
inactiveValue: 'FALSE', |
|||
activeValue: 'TRUE', |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '工单模式', |
|||
field: 'workMode', |
|||
width: '80px', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.MES_WORKBILL_MODEL, |
|||
dictClass: 'string', |
|||
form: { |
|||
component: 'Select', |
|||
value: 'BATCH', |
|||
}, |
|||
}, |
|||
{ |
|||
label: '计划日期', |
|||
field: 'planDate', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'date', |
|||
valueFormat: 'YYYY-MM-DD', |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'date', |
|||
valueFormat: 'x' |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '开始时间', |
|||
field: 'startTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
required: true, |
|||
form: { |
|||
component: 'TimePicker', |
|||
componentProps: { |
|||
type: 'time', |
|||
dateFormat: 'HH:mm', |
|||
//valueFormat: 'x',
|
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '结束时间', |
|||
field: 'endTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isReadonly:true, |
|||
form: { |
|||
component: 'TimePicker', |
|||
componentProps: { |
|||
type: 'time', |
|||
dateFormat: 'HH:mm', |
|||
} |
|||
}, |
|||
}, |
|||
{ |
|||
label: '生产模式', |
|||
field: 'taskMode', |
|||
width : '80px', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.MES_TASK_MODE, |
|||
dictClass: 'string', |
|||
form: { |
|||
component: 'Select', |
|||
value:'ASSIGN' |
|||
}, |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'datetime', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '创建者', |
|||
field: 'creator', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
isForm: false, |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: false, |
|||
isTable:false, |
|||
}, |
|||
{ |
|||
label: '操作', |
|||
field: 'action', |
|||
isForm: false, |
|||
table: { |
|||
width: 200, |
|||
fixed: 'right' |
|||
} |
|||
} |
|||
])) |
Loading…
Reference in new issue