20 changed files with 3579 additions and 106 deletions
@ -0,0 +1,158 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface ProcessVO { |
||||
|
code: string |
||||
|
name: string |
||||
|
description: string |
||||
|
type: string |
||||
|
workshopCode: string |
||||
|
productionLineCode: string |
||||
|
available: number |
||||
|
activeTime: Date |
||||
|
expireTime: Date |
||||
|
remark: string |
||||
|
} |
||||
|
|
||||
|
export const goalParams = { |
||||
|
processCode:null |
||||
|
} |
||||
|
// 查询工序列表
|
||||
|
export const getProcessPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return request.post({ url: '/mes/process/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/mes/process/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询工序详情
|
||||
|
export const getProcess = async (id: number) => { |
||||
|
return await request.get({ url: `/mes/process/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增工序
|
||||
|
export const createProcess: (data: ProcessVO) => Promise<any> = async (data: ProcessVO) => { |
||||
|
return await request.post({ url: `/mes/process/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改工序
|
||||
|
export const updateProcess = async (data: ProcessVO) => { |
||||
|
return await request.put({ url: `/mes/process/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除工序
|
||||
|
export const deleteProcess: (id: number) => Promise<any> = async (id: number) => { |
||||
|
return await request.delete({ url: `/mes/process/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出工序 Excel
|
||||
|
export const exportProcess = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
const data = {...params} |
||||
|
return await request.downloadPost({ url: `/mes/process/export-excel-senior`, data }) |
||||
|
} else { |
||||
|
return await request.download({ url: `/mes/process/export-excel`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/mes/process/get-import-template' }) |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// 查询模具基本信息列表
|
||||
|
export const getPatternPage = async (params) => { |
||||
|
params.processCode = goalParams.processCode |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return request.post({ url: '/mes/mes-process-pattern/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/mes/mes-process-pattern/pagePatternByProcessCode`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//创建工序模具关联
|
||||
|
export const createPatternRelation = async (Codes:string[]) => { |
||||
|
const data = { |
||||
|
processCode : goalParams.processCode, |
||||
|
listPatternCode : Codes |
||||
|
} |
||||
|
return await request.post({ url: `/mes/mes-process-pattern/createRelation`, data }) |
||||
|
} |
||||
|
|
||||
|
//删除工序模具关联
|
||||
|
export const deletePatternRelation = async (Codes:string[]) => { |
||||
|
const data = { |
||||
|
processCode : goalParams.processCode, |
||||
|
listPatternCode : Codes |
||||
|
} |
||||
|
return await request.post({ url: `/mes/mes-process-pattern/deleteRelation`, data }) |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
// 查询产线列表
|
||||
|
export const getProductionlinePage = async (params) => { |
||||
|
params.processCode = goalParams.processCode |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return request.post({ url: '/mes/mes-process-productionline/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/mes/mes-process-productionline/pageByProcessCode`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//创建工序产线关联
|
||||
|
export const createProductionlineRelation = async (Codes:string[]) => { |
||||
|
const data = { |
||||
|
processCode : goalParams.processCode, |
||||
|
listProductionlineCode : Codes |
||||
|
} |
||||
|
return await request.post({ url: `/mes/mes-process-productionline/createRelation`, data }) |
||||
|
} |
||||
|
|
||||
|
//删除工序产线关联
|
||||
|
export const deleteProductionlineRelation = async (Codes:string[]) => { |
||||
|
const data = { |
||||
|
processCode : goalParams.processCode, |
||||
|
listProductionlineCode : Codes |
||||
|
} |
||||
|
return await request.post({ url: `/mes/mes-process-productionline/deleteRelation`, data }) |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
// 查询物料列表
|
||||
|
export const getItembasicPage = async (params) => { |
||||
|
params.processCode = goalParams.processCode |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return request.post({ url: '/mes/mes-process-itembasic/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/mes/mes-process-itembasic/pageByProcessCode`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//创建工序物料关联
|
||||
|
export const createItembasicRelation = async (Codes:string[]) => { |
||||
|
const data = { |
||||
|
processCode : goalParams.processCode, |
||||
|
listItembasicCode : Codes |
||||
|
} |
||||
|
return await request.post({ url: `/mes/mes-process-itembasic/createRelation`, data }) |
||||
|
} |
||||
|
|
||||
|
//删除工序物料关联
|
||||
|
export const deleteItembasicRelation = async (Codes:string[]) => { |
||||
|
const data = { |
||||
|
processCode : goalParams.processCode, |
||||
|
listItembasicCode : Codes |
||||
|
} |
||||
|
return await request.post({ url: `/mes/mes-process-itembasic/deleteRelation`, data }) |
||||
|
} |
@ -0,0 +1,59 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface ProductBacklineVO { |
||||
|
offlineCode: string |
||||
|
productCode: string |
||||
|
workBillno: string |
||||
|
processCode: string |
||||
|
operCode: string |
||||
|
backlineBillno: string |
||||
|
planCode: string |
||||
|
deleteTime: Date |
||||
|
id: number |
||||
|
status: string |
||||
|
remark: string |
||||
|
deleter: string |
||||
|
siteId: number |
||||
|
workstationCode: string |
||||
|
} |
||||
|
|
||||
|
// 查询产品返线登记列表
|
||||
|
export const getProductBacklinePage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/mes/product-backline/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/mes/product-backline/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询产品返线登记详情
|
||||
|
export const getProductBackline = async (id: number) => { |
||||
|
return await request.get({ url: `/mes/product-backline/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增产品返线登记
|
||||
|
export const createProductBackline = async (data: ProductBacklineVO) => { |
||||
|
return await request.post({ url: `/mes/product-backline/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改产品返线登记
|
||||
|
export const updateProductBackline = async (data: ProductBacklineVO) => { |
||||
|
return await request.put({ url: `/mes/product-backline/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除产品返线登记
|
||||
|
export const deleteProductBackline = async (id: number) => { |
||||
|
return await request.delete({ url: `/mes/product-backline/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出产品返线登记 Excel
|
||||
|
export const exportProductBackline = async (params) => { |
||||
|
return await request.download({ url: `/mes/product-backline/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/mes/product-backline/get-import-template' }) |
||||
|
} |
@ -0,0 +1,71 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
|
||||
|
export interface ProductOfflineVO { |
||||
|
offlineCode: string |
||||
|
workBillno: string |
||||
|
planCode: string |
||||
|
productCode: string |
||||
|
offlineReson: string |
||||
|
productDestination: string |
||||
|
deleteTime: Date |
||||
|
id: number |
||||
|
status: string |
||||
|
concurrencyStamp: number |
||||
|
remark: string |
||||
|
deleter: string |
||||
|
siteId: number |
||||
|
processCode: string |
||||
|
stationCode: string |
||||
|
checkPersonCode: string |
||||
|
} |
||||
|
|
||||
|
// 查询产品离线登记记录列表
|
||||
|
export const getProductOfflinePage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/mes/product-offline/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/mes/product-offline/page`, params }) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 查询产品离线登记记录详情
|
||||
|
export const getProductOffline = async (id: number) => { |
||||
|
return await request.get({ url: `/mes/product-offline/get?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 新增产品离线登记记录
|
||||
|
export const createProductOffline = async (data: ProductOfflineVO) => { |
||||
|
return await request.post({ url: `/mes/product-offline/create`, data }) |
||||
|
} |
||||
|
|
||||
|
// 修改产品离线登记记录
|
||||
|
export const updateProductOffline = async (data: ProductOfflineVO) => { |
||||
|
return await request.put({ url: `/mes/product-offline/update`, data }) |
||||
|
} |
||||
|
|
||||
|
// 删除产品离线登记记录
|
||||
|
export const deleteProductOffline = async (id: number) => { |
||||
|
return await request.delete({ url: `/mes/product-offline/delete?id=` + id }) |
||||
|
} |
||||
|
|
||||
|
// 导出产品离线登记记录 Excel
|
||||
|
export const exportProductOffline = async (params) => { |
||||
|
return await request.download({ url: `/mes/product-offline/export-excel`, params }) |
||||
|
} |
||||
|
|
||||
|
// 下载用户导入模板
|
||||
|
export const importTemplate = () => { |
||||
|
return request.download({ url: '/mes/product-offline/get-import-template' }) |
||||
|
} |
||||
|
|
||||
|
export const getworkSchedulingPage = async (params) => { |
||||
|
if (params.isSearch) { |
||||
|
delete params.isSearch |
||||
|
const data = {...params} |
||||
|
return await request.post({ url: '/mes/work-scheduling/senior', data }) |
||||
|
} else { |
||||
|
return await request.get({ url: `/mes/work-scheduling/page`, params }) |
||||
|
} |
||||
|
} |
@ -0,0 +1,820 @@ |
|||||
|
<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> |
||||
|
|
||||
|
<Tabs :tabsList="tabsList" :current="current" @change="change" :key="updateKey"/> |
||||
|
<div class="flex"> |
||||
|
<!-- 详情 --> |
||||
|
<ContentWrap class="w-[73%]" > |
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
v-if="!isBasic" |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
:code="masterParmas.code" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="detailAllSchemas" |
||||
|
/> |
||||
|
<!-- 默认单表展现 --> |
||||
|
<Descriptions |
||||
|
v-if="isBasic && !tabsExtend" |
||||
|
:data="detailData" |
||||
|
:schema="allSchemas.detailSchema" |
||||
|
:columns="2" |
||||
|
/> |
||||
|
<!-- 单表切换tabs 展现table --> |
||||
|
|
||||
|
|
||||
|
<Table |
||||
|
v-if="!isBasic && fromeWhere != 'countPlan'" |
||||
|
:columns="detailAllSchemasRef.tableColumns" |
||||
|
:data="tableObjectRef.tableList" |
||||
|
:loading="tableObjectRef.loading" |
||||
|
:pagination="{ total: tableObjectRef.total }" |
||||
|
v-model:pageSize="tableObjectRef.pageSize" |
||||
|
v-model:currentPage="tableObjectRef.currentPage" |
||||
|
:key="updateKey" |
||||
|
> |
||||
|
<template #photos="{ row }"> |
||||
|
<div v-for="(item,index) in row.photos.split(',')" :key="index" style="color:#409eff ; cursor: pointer;" @click="openImage(item)">{{ item }}</div> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase |
||||
|
:Butttondata="buttondata" |
||||
|
@button-base-click="buttonTableClick($event, row)" |
||||
|
/> |
||||
|
</template> |
||||
|
</Table> |
||||
|
<DetailTable |
||||
|
v-if="!isBasic && fromeWhere == 'countPlan' && isShowDrawer" |
||||
|
:columns="detailAllSchemasRef.tableColumns" |
||||
|
:data="tableObjectRef.tableList" |
||||
|
:allList="allList" |
||||
|
:countScopeType="countScopeType" |
||||
|
:key="updateKey" |
||||
|
> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase |
||||
|
:Butttondata="buttondata" |
||||
|
@button-base-click="buttonTableClick($event, row)" |
||||
|
/> |
||||
|
</template> |
||||
|
</DetailTable> |
||||
|
</ContentWrap> |
||||
|
<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> |
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="formRef" |
||||
|
@success="submitForm" |
||||
|
:rules="detailAllSchemasRules" |
||||
|
:formAllSchemas="detailAllSchemas" |
||||
|
:isBusiness="false" |
||||
|
:apiUpdate="apiUpdate" |
||||
|
:apiCreate="apiCreate" |
||||
|
:fromeWhere="fromeWhere" |
||||
|
:isDetail="true" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:detailData="detailData" |
||||
|
@submitForm="submitForm" |
||||
|
@selectChangeDetail="selectChangeDetail" |
||||
|
:formTypeDetail="formTypeDetail" |
||||
|
:countPlanAllList="countPlanAllList" |
||||
|
@onChange="detailBasicFormOnChange" |
||||
|
@onBlur="onBlur" |
||||
|
@formFormDateChange="formFormDateChange" |
||||
|
/> |
||||
|
<!-- 表格弹窗 --> |
||||
|
<SearchTable ref="searchTableRef" @search-table-success="searchTableSuccess1" /> |
||||
|
|
||||
|
</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 Tabs from '@/components/Tabs/src/Tabs.vue' |
||||
|
import * as RemarkApi from '@/api/wms/remark' |
||||
|
import * as FileApi from '@/api/wms/file' |
||||
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
||||
|
import BasicForm from '@/components/BasicForm/src/BasicForm.vue' |
||||
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
||||
|
import DetailTable from '@/components/DetailTable/src/DetailTable.vue' |
||||
|
|
||||
|
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 |
||||
|
}, |
||||
|
//是否直接展示搜索表单 |
||||
|
isOpenSearchTable:{ |
||||
|
type: Boolean, |
||||
|
required: false, |
||||
|
default: false |
||||
|
}, |
||||
|
searchTableSchema: { |
||||
|
type: Array, |
||||
|
required: false, |
||||
|
default: null |
||||
|
}, |
||||
|
}) |
||||
|
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({ |
||||
|
code: '', //主表id |
||||
|
number: '', //主表单据号 |
||||
|
status: '', //主表状态 用于控制子表新增编辑按钮显示情况 |
||||
|
}) |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = ref() |
||||
|
// 列表-操作按钮 |
||||
|
const buttondata = ref() |
||||
|
|
||||
|
|
||||
|
/** isOpenSearchTable 对应 表格弹窗 */ |
||||
|
const initModel = (schema: FormSchema[], formModel: Recordable) => { |
||||
|
const model: Recordable = { ...formModel } |
||||
|
schema.map((v) => { |
||||
|
// 如果是hidden,就删除对应的值 |
||||
|
if (v.hidden) { |
||||
|
delete model[v.field] |
||||
|
} else if (v.component && v.component !== 'Divider') { |
||||
|
const hasField = Reflect.has(model, v.field) |
||||
|
// 如果先前已经有值存在,则不进行重新赋值,而是采用现有的值 |
||||
|
model[v.field] = hasField ? model[v.field] : v.value !== void 0 ? v.value : '' |
||||
|
} |
||||
|
}) |
||||
|
return model |
||||
|
} |
||||
|
const searchTableRef = ref() |
||||
|
const searchTableFormModel = ref<Recordable>({}) |
||||
|
if(props.isOpenSearchTable){ |
||||
|
searchTableFormModel.value = initModel(props.searchTableSchema.formSchema, unref(searchTableFormModel)) |
||||
|
} |
||||
|
const searchTableFormType = ref('') // 表单的类型:create - 新增;update - 修改 |
||||
|
|
||||
|
|
||||
|
// 直接打开表格数据 --> 对应:isOpenSearchTable === true |
||||
|
const opensearchTable = ( |
||||
|
formField, |
||||
|
searchField, |
||||
|
searchTitle, |
||||
|
searchAllSchemas, |
||||
|
searchPage, |
||||
|
searchCondition, |
||||
|
multiple, |
||||
|
type, |
||||
|
row |
||||
|
) => { |
||||
|
const _searchCondition = {} |
||||
|
// 判断查询条件中,是否存在指向主表的数据 |
||||
|
if (searchCondition && searchCondition.length > 0) { |
||||
|
// 转换筛选条件所需 |
||||
|
for (var i=0; i< searchCondition.length; i++ ) { |
||||
|
// 查询条件为主表某字段,需要赋值主表数据,数据来源是详情的,赋值需要从row中获取 |
||||
|
if (searchCondition[i].isMainValue) { |
||||
|
_searchCondition[searchCondition[i].key] = detailData |
||||
|
? detailData.value[searchCondition[i].value] |
||||
|
: '' |
||||
|
}else{ |
||||
|
_searchCondition[searchCondition[i].key] = searchCondition[i].value |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
searchTableRef.value.open( |
||||
|
searchTitle, |
||||
|
searchAllSchemas, |
||||
|
searchPage, |
||||
|
formField, |
||||
|
searchField, |
||||
|
multiple, |
||||
|
type, |
||||
|
row, |
||||
|
_searchCondition |
||||
|
) |
||||
|
} |
||||
|
const searchTableSuccess1 = (formField, searchField, val, formRef) => { |
||||
|
searchTableFormModel.value[formField] = val.map(item=>item[searchField]).join(',') |
||||
|
console.log('searchTableSuccess1',searchTableFormModel) |
||||
|
submitForm(searchTableFormType.value,searchTableFormModel.value) |
||||
|
emit('searchTableSuccessDetail', formField, searchField, val, formRef) |
||||
|
} |
||||
|
|
||||
|
/** 打开弹窗 */ |
||||
|
const formRef = ref() |
||||
|
const titleNameRef = ref() |
||||
|
const titleValueRef = ref() |
||||
|
const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => { |
||||
|
|
||||
|
// current.value = 100 |
||||
|
const item = { |
||||
|
label: "产线", |
||||
|
prop: "ProductionlineTab" |
||||
|
}; |
||||
|
if (current.value !== 0){ |
||||
|
change(item, 0) |
||||
|
} |
||||
|
else { |
||||
|
current.value = 1 |
||||
|
change({ |
||||
|
label: "模具", |
||||
|
prop: "PatternTab" |
||||
|
}, 1) |
||||
|
} |
||||
|
|
||||
|
titleNameRef.value = titleName |
||||
|
titleValueRef.value = titleValue |
||||
|
remarksData.data = { |
||||
|
tableId: row.id, |
||||
|
tableName: tableName |
||||
|
} |
||||
|
// 加载明细列表 |
||||
|
if (!props.isBasic) { |
||||
|
// 设置主表id |
||||
|
masterParmas.value.code = row.code |
||||
|
masterParmas.value.number = row.number |
||||
|
masterParmas.value.status = row.status |
||||
|
tableObjectRef.value.params = { |
||||
|
processCode: row.code |
||||
|
} |
||||
|
await getList() |
||||
|
updateKey.value += 1 |
||||
|
} |
||||
|
|
||||
|
updateKey.value+=1 |
||||
|
|
||||
|
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] |
||||
|
|
||||
|
if (current.value === 1){ |
||||
|
change(item, 0) |
||||
|
} |
||||
|
|
||||
|
} 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') { |
||||
|
// 新增 |
||||
|
if(props.isOpenSearchTable){ |
||||
|
searchTableFormType.value = 'create' |
||||
|
// 如果需要直接打开表格数据 |
||||
|
const item = props.searchTableSchema.formSchema[0] |
||||
|
opensearchTable( |
||||
|
item.field, item?.componentProps?.searchField, |
||||
|
item?.componentProps?.searchTitle, |
||||
|
item?.componentProps?.searchAllSchemas, |
||||
|
item?.componentProps?.searchPage, |
||||
|
item?.componentProps?.searchCondition, |
||||
|
item?.componentProps?.multiple, |
||||
|
undefined,undefined |
||||
|
) |
||||
|
}else{ |
||||
|
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.code) |
||||
|
} else { |
||||
|
emit('tableFormButton',val, row) |
||||
|
} |
||||
|
} |
||||
|
/** 添加/修改操作 */ |
||||
|
const openForm = async (type: string, row?: number) => { |
||||
|
// formRef.value.open(type, row, masterParmas.value) |
||||
|
emit('detailOpenForm', type, masterParmas.value) |
||||
|
} |
||||
|
// 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.list.split(",")) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await props.apiUpdate(data) |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
} |
||||
|
formRef.value.dialogVisible = false |
||||
|
// 刷新当前列表 |
||||
|
await getList() |
||||
|
updateKey.value += 1 |
||||
|
console.log(updateKey.value) |
||||
|
} 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')) |
||||
|
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: 'code', action: '==', value: masterParmas.value.code }] |
||||
|
} |
||||
|
detailAllSchemasRef.value = props.detailAllSchemas |
||||
|
tableObjectRef.value = tableObject |
||||
|
tableMethodsRef.value = tableMethods |
||||
|
tableObjectRef.value.tableList = [] |
||||
|
const { getList } = tableMethods |
||||
|
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.code = masterParmas.value.code |
||||
|
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() |
||||
|
} |
||||
|
) |
||||
|
watch( |
||||
|
() => updateKey.value, |
||||
|
() => { |
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: props.apiPage // 分页接口 |
||||
|
}) |
||||
|
tableObject.params.code = masterParmas.value.code |
||||
|
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,368 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="Process.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:route-name="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="Process.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 #code="{row}">--> |
||||
|
<!-- <el-button type="primary" link @click="openDetail(row, '代码', row.code)">--> |
||||
|
<!-- <span>{{ row.code }}</span>--> |
||||
|
<!-- </el-button>--> |
||||
|
<!-- </template>--> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="ProcessRules" |
||||
|
:formAllSchemas="Process.allSchemas" |
||||
|
:apiUpdate="ProcessApi.updateProcess" |
||||
|
:apiCreate="ProcessApi.createProcess" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" |
||||
|
:isBasic="false" |
||||
|
:isOpenSearchTable="true" |
||||
|
:apiCreate="tabsCreateApi" |
||||
|
:apiDelete="tabsDeleteApi" |
||||
|
:allSchemas="Process.allSchemas" |
||||
|
:detailAllSchemas="detailAllSchemas" |
||||
|
:searchTableSchema="tmpPopList" |
||||
|
:detailAllSchemasRules="ProcessRules" |
||||
|
:apiPage="apiPage" |
||||
|
:tabs="TabsList" |
||||
|
@changeTabs="changeTabs" |
||||
|
:detailButtonIsShowAdd="true" |
||||
|
:detailButtonIsShowDelete="true" |
||||
|
:detailButtonIsShowEdit="false" |
||||
|
@detailOpenForm="detailOpenForm" |
||||
|
|
||||
|
|
||||
|
/> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/mes/process/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import * as ProcessApi from '@/api/mes/process' |
||||
|
import BasicForm from '@/components/BasicForm/src/BasicForm.vue' |
||||
|
import { |
||||
|
PatternTab, |
||||
|
PatternPopList, |
||||
|
Process, |
||||
|
ProcessRules, |
||||
|
ProductionlineTab, |
||||
|
ProductionlinePopList, |
||||
|
TabsList, |
||||
|
ItembasicPopList, |
||||
|
ItembasicTab |
||||
|
} from './process.data' |
||||
|
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.vue' |
||||
|
import {goalParams} from "@/api/mes/process"; |
||||
|
|
||||
|
defineOptions({ name: 'Process' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() //路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(Process.allSchemas.tableColumns) |
||||
|
|
||||
|
//字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: ProcessApi.getProcessPage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'mes:process:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'mes:process:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'mes:process:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null),//刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), //筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
const buttonBaseClick = (val, item) => { |
||||
|
if (val == 'add') { // 新增 |
||||
|
openForm('create') |
||||
|
} else if (val == 'import') { // 导入 |
||||
|
handleImport() |
||||
|
} else if (val == 'export') { // 导出 |
||||
|
handleExport() |
||||
|
} else if (val == 'refresh') { // 刷新 |
||||
|
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { |
||||
|
searchFormClick({ |
||||
|
filters: tableObject.params.filters |
||||
|
}) |
||||
|
} else { |
||||
|
getList() |
||||
|
} |
||||
|
} else if (val == 'filtrate') { // 筛选 |
||||
|
} else { // 其他按钮 |
||||
|
console.log('其他按钮', item) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 列表-操作按钮 |
||||
|
const butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'mes:process:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'mes:process:delete'}), // 删除 |
||||
|
defaultButtons.mainListHandleBtn({label: '配置', |
||||
|
name: 'config', |
||||
|
hide: false, |
||||
|
type: 'primary', |
||||
|
icon: '', |
||||
|
color: '', |
||||
|
hasPermi: ''}), // 路由设置 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
const buttonTableClick = async (val, row) => { |
||||
|
if (val == 'edit') { // 编辑 |
||||
|
// const res = await ProcessApi.getItempackaging(row.id) |
||||
|
openForm('update', row) |
||||
|
} else if (val == 'delete') { // 删除 |
||||
|
handleDelete(row.id) |
||||
|
} |
||||
|
else if (val == 'config') { // |
||||
|
openDetail(row,row.name,row.code) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const basicFormRef = ref() |
||||
|
const openForm = (type: string, row?: any) => { |
||||
|
if(type == "update"){ |
||||
|
Process.allSchemas.formSchema.forEach((item) => { |
||||
|
if (item.field == 'code') { |
||||
|
item.componentProps.disabled = true |
||||
|
} |
||||
|
if (item.field == 'workshopCode') { |
||||
|
item.componentProps.disabled = true |
||||
|
item.componentProps.isSearchList = false |
||||
|
} |
||||
|
if (item.field == 'productionLineCode') { |
||||
|
item.componentProps.disabled = true |
||||
|
item.componentProps.isSearchList = false |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
}else { |
||||
|
Process.allSchemas.formSchema.forEach((item) => { |
||||
|
if (item.field == 'code') { |
||||
|
item.componentProps.disabled = false |
||||
|
} |
||||
|
if (item.field == 'workshopCode') { |
||||
|
item.componentProps.disabled = false |
||||
|
item.componentProps.isSearchList = true |
||||
|
} |
||||
|
if (item.field == 'productionLineCode') { |
||||
|
item.componentProps.disabled = false |
||||
|
item.componentProps.isSearchList = true |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
basicFormRef.value.open(type, row) |
||||
|
} |
||||
|
|
||||
|
// form表单提交 |
||||
|
const formsSuccess = async (formType,data) => { |
||||
|
var isHave =Process.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 ProcessApi.createProcess(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await ProcessApi.updateProcess(data) |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
} |
||||
|
basicFormRef.value.dialogVisible = false |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
// 查询页面返回 |
||||
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
||||
|
nextTick?.(() => { |
||||
|
debugger |
||||
|
const setV = {} |
||||
|
if (formField === 'productionLineCode'){ |
||||
|
const concatenatedValues = val.map(item => item['code']).join(',') |
||||
|
setV[formField] = concatenatedValues |
||||
|
} |
||||
|
else { |
||||
|
setV[formField] = val[0][searchField] |
||||
|
} |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// 子包装数据 |
||||
|
let tabsDeleteApi = ProcessApi.deleteProductionlineRelation |
||||
|
let tabsCreateApi = ProcessApi.createProductionlineRelation |
||||
|
const detailAllSchemas = ref(ProductionlineTab.allSchemas) |
||||
|
const apiPage = ref(ProcessApi.getProductionlinePage) |
||||
|
const tableKey = ref("ProductionlineTab"); |
||||
|
let tmpPopList = ProductionlinePopList.allSchemas |
||||
|
// tabs 切换事件 |
||||
|
const changeTabs = (data) =>{ |
||||
|
tableKey.value = data.prop |
||||
|
if(data.prop == 'ProductionlineTab'){ |
||||
|
apiPage.value = ProcessApi.getProductionlinePage |
||||
|
detailAllSchemas.value = ProductionlineTab.allSchemas |
||||
|
tabsDeleteApi = ProcessApi.deleteProductionlineRelation |
||||
|
tabsCreateApi = ProcessApi.createProductionlineRelation |
||||
|
tmpPopList = ProductionlinePopList.allSchemas |
||||
|
}else if(data.prop == 'PatternTab'){ |
||||
|
apiPage.value = ProcessApi.getPatternPage |
||||
|
detailAllSchemas.value = PatternTab.allSchemas |
||||
|
tabsDeleteApi = ProcessApi.deletePatternRelation |
||||
|
tabsCreateApi = ProcessApi.createPatternRelation |
||||
|
tmpPopList = PatternPopList.allSchemas |
||||
|
} |
||||
|
else if(data.prop == 'ItembasicTab'){ |
||||
|
apiPage.value = ProcessApi.getItembasicPage |
||||
|
detailAllSchemas.value = ItembasicTab.allSchemas |
||||
|
tabsDeleteApi = ProcessApi.deleteItembasicRelation |
||||
|
tabsCreateApi = ProcessApi.createItembasicRelation |
||||
|
tmpPopList = ItembasicPopList.allSchemas |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 详情操作 */ |
||||
|
const detailRef = ref() |
||||
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
||||
|
goalParams.processCode = row.code |
||||
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicProcess') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
tableObject.loading = true |
||||
|
// 发起删除 |
||||
|
await ProcessApi.deleteProcess(id) |
||||
|
tableObject.loading = false |
||||
|
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 ProcessApi.exportProcess(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 ProcessApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
const ListRef = ref() |
||||
|
const detailOpenForm = async (type, params) => { |
||||
|
ListRef.value.open('create', null, null, 'viewDetail')//查看明细数据 |
||||
|
} |
||||
|
</script> |
@ -0,0 +1,513 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
|
||||
|
import * as WorkshopApi from '@/api/wms/workshop' |
||||
|
import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data' |
||||
|
|
||||
|
import * as ProductionlineApi from '@/api/wms/productionline' |
||||
|
import { Productionline } from '@/views/wms/basicDataManage/factoryModeling/productionline/productionline.data' |
||||
|
|
||||
|
import { validateYS } from '@/utils/validator' |
||||
|
|
||||
|
import * as PatternApi from "@/api/mes/pattern"; |
||||
|
import * as ItembasicApi from "@/api/wms/itembasic"; |
||||
|
import {Itembasic} from "@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data"; |
||||
|
|
||||
|
const { t } = useI18n() // 国际化
|
||||
|
|
||||
|
/** |
||||
|
* @returns {Array} 工序 |
||||
|
*/ |
||||
|
export const Process = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '代码', |
||||
|
field: 'code', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'left' |
||||
|
}, |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '名称', |
||||
|
field: 'name', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isSearch: true, |
||||
|
}, |
||||
|
{ |
||||
|
label: '类型', |
||||
|
field: 'type', |
||||
|
dictType: DICT_TYPE.PROCESS_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '工序节拍', |
||||
|
field: 'actionClock', |
||||
|
sort: 'custom', |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
componentProps: { |
||||
|
min: 1 |
||||
|
} |
||||
|
}, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '车间代码', |
||||
|
field: 'workshopCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择车间代码', // 输入框占位文本
|
||||
|
searchField: 'code', // 查询弹窗赋值字段
|
||||
|
searchTitle: '车间信息', // 查询弹窗标题
|
||||
|
searchAllSchemas: Workshop.allSchemas, // 查询弹窗所需类
|
||||
|
searchPage: WorkshopApi.getWorkshopPage, // 查询弹窗所需分页方法
|
||||
|
searchCondition: [{ |
||||
|
key: 'available', |
||||
|
value: 'TRUE', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '生产线代码', |
||||
|
field: 'productionLineCode', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择生产线代码', // 输入框占位文本
|
||||
|
multiple:true, |
||||
|
searchField: 'code', // 查询弹窗赋值字段
|
||||
|
searchTitle: '生产线信息', // 查询弹窗标题
|
||||
|
searchAllSchemas: Productionline.allSchemas, // 查询弹窗所需类
|
||||
|
searchPage: ProductionlineApi.getProductionlinePage, // 查询弹窗所需分页方法
|
||||
|
searchCondition: [{ |
||||
|
key:'workshopCode', |
||||
|
value:'workshopCode', |
||||
|
message: '请填写车间代码!', |
||||
|
isMainValue: true |
||||
|
},{ |
||||
|
key: 'available', |
||||
|
value: 'TRUE', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否报工', |
||||
|
field: 'isReport', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否质检', |
||||
|
field: 'isCheck', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否关键', |
||||
|
field: 'isSerious', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '生效时间', |
||||
|
field: 'activeTime', |
||||
|
isTable: true, |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '失效时间', |
||||
|
field: 'expireTime', |
||||
|
isTable: true, |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
}, |
||||
|
isTable: false, |
||||
|
isForm: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
isTable: false, |
||||
|
isForm: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isDetail: false, |
||||
|
isForm: false , |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
//表单检验
|
||||
|
export const ProcessRules = reactive({ |
||||
|
code: [ |
||||
|
{ required: true, message: '请输入代码', trigger: 'blur' }, |
||||
|
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }, |
||||
|
{ validator:validateYS, message: '请输入正确的代码', trigger: 'blur'} |
||||
|
], |
||||
|
name: [ |
||||
|
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
||||
|
], |
||||
|
workshopCode: [ |
||||
|
{ required: true, message: '请输入车间代码', trigger: 'change' } |
||||
|
], |
||||
|
productionLineCode: [ |
||||
|
{ required: true, message: '请输入生产线代码', trigger: 'change' } |
||||
|
], |
||||
|
remark: [ |
||||
|
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
||||
|
], |
||||
|
available: [ |
||||
|
{ required: true, message: '请选择是否可用', trigger: 'change' } |
||||
|
], |
||||
|
isReport: [ |
||||
|
{ required: true, message: '请选择是否报工', trigger: 'change' } |
||||
|
], |
||||
|
isCheck: [ |
||||
|
{ required: true, message: '请选择是否质检', trigger: 'change' } |
||||
|
], |
||||
|
isSerious: [ |
||||
|
{ required: true, message: '请选择是否关键', trigger: 'change' } |
||||
|
], |
||||
|
}) |
||||
|
|
||||
|
export const ProductionlineTab = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '代码', |
||||
|
field: 'code', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '名称', |
||||
|
field: 'name', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isDetail: false, |
||||
|
isForm: false , |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
}, |
||||
|
isTableForm:true, |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
export const PatternTab = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '代码', |
||||
|
field: 'code', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '名称', |
||||
|
field: 'name', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isDetail: false, |
||||
|
isForm: false , |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
}, |
||||
|
isTableForm:true |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
export const ItembasicTab = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '代码', |
||||
|
field: 'code', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '名称', |
||||
|
field: 'name', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isDetail: false, |
||||
|
isForm: false , |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
}, |
||||
|
isTableForm:true |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
|
||||
|
|
||||
|
export const TabsList = [ |
||||
|
{ |
||||
|
label: "产线", |
||||
|
prop: 'ProductionlineTab', |
||||
|
}, |
||||
|
{ |
||||
|
label: "模具", |
||||
|
prop: 'PatternTab', |
||||
|
}, |
||||
|
{ |
||||
|
label: "物料", |
||||
|
prop: 'ItembasicTab', |
||||
|
} |
||||
|
|
||||
|
] |
||||
|
|
||||
|
export const ProductionlinePopList = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '选择产线', |
||||
|
field: 'list', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
multiple:true, |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '选择产线', // 输入框占位文本
|
||||
|
searchField: 'code', // 查询弹窗赋值字段
|
||||
|
searchTitle: '选择产线', // 查询弹窗标题
|
||||
|
searchAllSchemas: ProductionlineTab.allSchemas, // 查询弹窗所需类
|
||||
|
searchPage: ProductionlineApi.getProductionlinePage, // 查询弹窗所需分页方法
|
||||
|
searchCondition: [{ |
||||
|
key: 'available', |
||||
|
value: 'TRUE', |
||||
|
isMainValue: false |
||||
|
},{ |
||||
|
key:'workshopCode', |
||||
|
value:'workshopCode', |
||||
|
message: '请填写车间代码!', |
||||
|
isMainValue: true |
||||
|
}] |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
export const PatternPopList = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '选择模具', |
||||
|
field: 'list', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
multiple:true, |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '选择模具', // 输入框占位文本
|
||||
|
searchField: 'code', // 查询弹窗赋值字段
|
||||
|
searchTitle: '选择模具', // 查询弹窗标题
|
||||
|
searchAllSchemas: PatternTab.allSchemas, // 查询弹窗所需类
|
||||
|
searchPage: PatternApi.getPatternPage, // 查询弹窗所需分页方法
|
||||
|
// searchCondition: [{
|
||||
|
// key: 'available',
|
||||
|
// value: 'TRUE',
|
||||
|
// isMainValue: false
|
||||
|
// }]
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
])) |
||||
|
|
||||
|
export const ItembasicPopList = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '选择物料', |
||||
|
field: 'list', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
multiple:true, |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '选择物料', // 输入框占位文本
|
||||
|
searchField: 'code', // 查询弹窗赋值字段
|
||||
|
searchTitle: '选择物料', // 查询弹窗标题
|
||||
|
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
|
||||
|
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
|
||||
|
searchCondition: [{ |
||||
|
key: 'available', |
||||
|
value: 'TRUE', |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,249 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="ProductBackline.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="ProductBackline.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 #backlineBillno="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.backlineBillno)"> |
||||
|
<span>{{ row.backlineBillno }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="ProductBacklineRules" |
||||
|
:formAllSchemas="ProductBackline.allSchemas" |
||||
|
:apiUpdate="ProductBacklineApi.updateProductBackline" |
||||
|
:apiCreate="ProductBacklineApi.createProductBackline" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="ProductBackline.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/mes/product-backline/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { ProductBackline,ProductBacklineRules } from './productBackline.data' |
||||
|
import * as ProductBacklineApi from '@/api/mes/productBackline' |
||||
|
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: 'MesProductBackline' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(ProductBackline.allSchemas.tableColumns) |
||||
|
|
||||
|
// 查询页面返回 |
||||
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
||||
|
nextTick?.(() => { |
||||
|
const setV = {} |
||||
|
setV[formField] = val[0][searchField] |
||||
|
setV['workBillno'] = val[0]['workBillno']//工单编码 |
||||
|
setV['planCode'] = val[0]['planCode']//计划编码 |
||||
|
setV['processCode'] = val[0]['processCode']//工序编码 |
||||
|
setV['workstationCode'] = val[0]['stationCode']//工位编码 |
||||
|
setV['productCode'] = val[0]['productCode']//产品编码 |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: ProductBacklineApi.getProductBacklinePage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'mes:product-backline:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'mes:product-backline:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'mes:product-backline:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
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 butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'mes:product-backline:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'mes:product-backline:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
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 =ProductBackline.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 ProductBacklineApi.createProductBackline(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await ProductBacklineApi.updateProductBackline(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, 'basicProductBackline') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await ProductBacklineApi.deleteProductBackline(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 ProductBacklineApi.exportProductBackline(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 ProductBacklineApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,170 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
import {workscheduling} from "@/views/mes/productionPlan/productionPlan.data"; |
||||
|
import * as ProductOfflineApi from "@/api/mes/productOffline"; |
||||
|
import {ProductOffline} from "@/views/mes/productOffline/productOffline.data"; |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ProductBacklineRules = reactive({ |
||||
|
productCode: [ |
||||
|
{ required: true, message: '请选择产品编码', trigger: 'change' }, |
||||
|
], |
||||
|
}) |
||||
|
|
||||
|
export const ProductBackline = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '返线工单号', |
||||
|
field: 'backlineBillno', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 200 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '离线编码', |
||||
|
field: 'offlineCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
isForm: true, |
||||
|
table: { |
||||
|
width: 200 |
||||
|
}, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择离线编码', // 输入框占位文本
|
||||
|
searchField: 'offlineCode', // 查询弹窗赋值字段
|
||||
|
searchTitle: '产品离线登记信息', // 查询弹窗标题
|
||||
|
searchAllSchemas: ProductOffline.allSchemas, // 查询弹窗所需类
|
||||
|
searchPage: ProductOfflineApi.getProductOfflinePage, // 查询弹窗所需分页方法
|
||||
|
// searchCondition: [{
|
||||
|
// key: 'flagDo',
|
||||
|
// value: '3',
|
||||
|
// action: '==',
|
||||
|
// isSearch: true,
|
||||
|
// isMainValue: false
|
||||
|
// }]
|
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '产品编码', |
||||
|
field: 'productCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
disabled:true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '计划编码', |
||||
|
field: 'planCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
disabled:true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '工单编码', |
||||
|
field: 'workBillno', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 140 |
||||
|
}, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
disabled:true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '返线工序', |
||||
|
field: 'processCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
disabled:true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '返线工位', |
||||
|
field: 'workstationCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
disabled:true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '加工人员', |
||||
|
field: 'operCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
isTable: true, |
||||
|
formatter: dateFormatter, |
||||
|
isForm: false, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,250 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<Search :schema="ProductOffline.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表头部 --> |
||||
|
<TableHead |
||||
|
:HeadButttondata="HeadButttondata" |
||||
|
@button-base-click="buttonBaseClick" |
||||
|
:routeName="routeName" |
||||
|
@updataTableColumns="updataTableColumns" |
||||
|
@searchFormClick="searchFormClick" |
||||
|
:allSchemas="ProductOffline.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 #offlineCode="{row}"> |
||||
|
<el-button type="primary" link @click="openDetail(row, '代码', row.offlineCode)"> |
||||
|
<span>{{ row.offlineCode }}</span> |
||||
|
</el-button> |
||||
|
</template> |
||||
|
<template #action="{ row }"> |
||||
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
||||
|
</template> |
||||
|
</Table> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<BasicForm |
||||
|
ref="basicFormRef" |
||||
|
@success="formsSuccess" |
||||
|
:rules="ProductOfflineRules" |
||||
|
:formAllSchemas="ProductOffline.allSchemas" |
||||
|
:apiUpdate="ProductOfflineApi.updateProductOffline" |
||||
|
:apiCreate="ProductOfflineApi.createProductOffline" |
||||
|
@searchTableSuccess="searchTableSuccess" |
||||
|
:isBusiness="false" |
||||
|
/> |
||||
|
|
||||
|
<!-- 详情 --> |
||||
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="ProductOffline.allSchemas" /> |
||||
|
|
||||
|
<!-- 导入 --> |
||||
|
<ImportForm ref="importFormRef" url="/mes/product-offline/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import download from '@/utils/download' |
||||
|
import { ProductOffline,ProductOfflineRules } from './productOffline.data' |
||||
|
import * as ProductOfflineApi from '@/api/mes/productOffline' |
||||
|
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: 'MesProductOffline' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const route = useRoute() // 路由信息 |
||||
|
const routeName = ref() |
||||
|
routeName.value = route.name |
||||
|
const tableColumns = ref(ProductOffline.allSchemas.tableColumns) |
||||
|
|
||||
|
// 查询页面返回 |
||||
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
||||
|
nextTick?.(() => { |
||||
|
debugger |
||||
|
const setV = {} |
||||
|
setV[formField] = val[0][searchField] |
||||
|
setV['workBillno'] = val[0]['schedulingCode']//工单编码 |
||||
|
setV['planCode'] = val[0]['planMaserCode']//计划编码 |
||||
|
setV['processCode'] = val[0]['workingNode']//工序编码 |
||||
|
setV['stationCode'] = val[0]['currentWorkstation']//工位编码 |
||||
|
// 以上字段的值从job_mes_work_scheduling表中获取 |
||||
|
formRef.setValues(setV) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 字段设置 更新主列表字段 |
||||
|
const updataTableColumns = (val) => { |
||||
|
tableColumns.value = val |
||||
|
} |
||||
|
|
||||
|
const { tableObject, tableMethods } = useTable({ |
||||
|
getListApi: ProductOfflineApi.getProductOfflinePage // 分页接口 |
||||
|
}) |
||||
|
|
||||
|
// 获得表格的各种操作 |
||||
|
const { getList, setSearchParams } = tableMethods |
||||
|
|
||||
|
// 列表头部按钮 |
||||
|
const HeadButttondata = [ |
||||
|
defaultButtons.defaultAddBtn({hasPermi:'mes:product-offline:create'}), // 新增 |
||||
|
defaultButtons.defaultImportBtn({hasPermi:'mes:product-offline:import'}), // 导入 |
||||
|
defaultButtons.defaultExportBtn({hasPermi:'mes:product-offline:export'}), // 导出 |
||||
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
||||
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
||||
|
defaultButtons.defaultSetBtn(null), // 设置 |
||||
|
// { |
||||
|
// label: '自定义扩展按钮', |
||||
|
// name: 'zdy', |
||||
|
// hide: false, |
||||
|
// type: 'primary', |
||||
|
// icon: 'Select', |
||||
|
// color: '' |
||||
|
// }, |
||||
|
] |
||||
|
|
||||
|
// 头部按钮事件 |
||||
|
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 butttondata = [ |
||||
|
defaultButtons.mainListEditBtn({hasPermi:'mes:product-offline:update'}), // 编辑 |
||||
|
defaultButtons.mainListDeleteBtn({hasPermi:'mes:product-offline:delete'}), // 删除 |
||||
|
] |
||||
|
|
||||
|
// 列表-操作按钮事件 |
||||
|
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 =ProductOffline.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 ProductOfflineApi.createProductOffline(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await ProductOfflineApi.updateProductOffline(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, 'basicProductOffline') |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await ProductOfflineApi.deleteProductOffline(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 ProductOfflineApi.exportProductOffline(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 ProductOfflineApi.importTemplate() |
||||
|
}) |
||||
|
|
||||
|
</script> |
@ -0,0 +1,185 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
import {workscheduling} from "@/views/mes/productionPlan/productionPlan.data"; |
||||
|
import * as ProductOfflineApi from "@/api/mes/productOffline"; |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const ProductOfflineRules = reactive({ |
||||
|
checkPersonCode: [ |
||||
|
{ required: true, message: '请输入质检人员', trigger: 'blur' }, |
||||
|
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }, |
||||
|
], |
||||
|
remark: [ |
||||
|
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
||||
|
], |
||||
|
offlineReson: [ |
||||
|
{ required: true, message: '请输入离线原因', trigger: 'blur' }, |
||||
|
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
||||
|
], |
||||
|
productCode: [ |
||||
|
{ required: true, message: '请选择产品编码', trigger: 'change' }, |
||||
|
], |
||||
|
}) |
||||
|
|
||||
|
export const ProductOffline = useCrudSchemas(reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '离线编码', |
||||
|
field: 'offlineCode', |
||||
|
sort: 'custom', |
||||
|
isForm: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '产品编码', |
||||
|
field: 'productCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 120, |
||||
|
fixed: 'left' |
||||
|
}, |
||||
|
form: { |
||||
|
// labelMessage: '信息提示说明!!!',
|
||||
|
componentProps: { |
||||
|
isSearchList: true, // 开启查询弹窗
|
||||
|
searchListPlaceholder: '请选择产品编码', // 输入框占位文本
|
||||
|
searchField: 'productCode', // 查询弹窗赋值字段
|
||||
|
searchTitle: '生产任务信息表', // 查询弹窗标题
|
||||
|
searchAllSchemas: workscheduling.allSchemas, // 查询弹窗所需类
|
||||
|
searchPage: ProductOfflineApi.getworkSchedulingPage, // 查询弹窗所需分页方法
|
||||
|
searchCondition: [{ |
||||
|
key: 'flagDo', |
||||
|
value: '3', |
||||
|
action: '==', |
||||
|
isSearch: true, |
||||
|
isMainValue: false |
||||
|
}] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '工单编码', |
||||
|
field: 'workBillno', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
disabled:true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
disabled:true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '计划编码', |
||||
|
field: 'planCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
disabled:true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '工序编码', |
||||
|
field: 'processCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
disabled:true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '工位编码', |
||||
|
field: 'stationCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form: { |
||||
|
componentProps: { |
||||
|
disabled:true, |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '产品去向', |
||||
|
field: 'productDestination', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '离线原因', |
||||
|
field: 'offlineReson', |
||||
|
sort: 'custom', |
||||
|
// dictType: DICT_TYPE.BASIC_TEAM_TYPE,
|
||||
|
// dictClass: 'string',
|
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '质检人员', |
||||
|
field: 'checkPersonCode', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
isTable: true, |
||||
|
formatter: dateFormatter, |
||||
|
isForm: false, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
style: {width:'100%'}, |
||||
|
type: 'datetime', |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss', |
||||
|
valueFormat: 'x', |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: '备注', |
||||
|
field: 'remark', |
||||
|
sort: 'custom', |
||||
|
isSearch: false, |
||||
|
}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isForm: false, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
} |
||||
|
} |
||||
|
])) |
@ -0,0 +1,441 @@ |
|||||
|
<template> |
||||
|
<Dialog v-model="dialogVisible" :title="dialogTitle"> |
||||
|
<el-form |
||||
|
ref="basicFormRef" |
||||
|
v-loading="formLoading" |
||||
|
:model="formData" |
||||
|
:rules="formRules" |
||||
|
label-width="80px" |
||||
|
> |
||||
|
<el-row> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="班组编码" prop="code"> |
||||
|
<el-input v-model="formData.code" placeholder="请输入班组编码" :disabled="isDisabled"/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="班组名称" prop="name"> |
||||
|
<el-input v-model="formData.name" placeholder="请输入班组名称" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-row> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="班组类型" prop="teamGroup"> |
||||
|
<el-select v-model="formData.teamGroup" placeholder="请选择班组类型"> |
||||
|
<el-option |
||||
|
v-for="dict in getStrDictOptions(DICT_TYPE.BASIC_TEAM_TYPE)" |
||||
|
:key="dict.value" |
||||
|
:label="dict.label" |
||||
|
:value="dict.value" |
||||
|
/> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="是否可用" prop="available"> |
||||
|
<el-switch v-model="formData.available" active-value="TRUE" inactive-value="FALSE" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-row> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="车间代码" prop="workshopCode"> |
||||
|
<div class="input-with-button"> |
||||
|
<el-input v-model="formData.workshopCode" placeholder="请选择车间代码" disabled :style="{ width: '35%' }"/> |
||||
|
<el-button :icon="Search" @click="addWorkShop"/> |
||||
|
</div> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="产线代码" prop="productionLineCode"> |
||||
|
<div class="input-with-button"> |
||||
|
<el-input v-model="formData.productionLineCode" placeholder="请选择产线代码" disabled :style="{ width: '35%' }"/> |
||||
|
<el-button :icon="Search" @click="addProductionLine"/> |
||||
|
</div> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-row> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="生效时间" prop="activeTime"> |
||||
|
<el-date-picker |
||||
|
v-model="formData.activeTime" |
||||
|
type="datetime" |
||||
|
placeholder="请选择生效时间" |
||||
|
format="YYYY-MM-DD HH:mm:ss" |
||||
|
value-format="x" |
||||
|
style="width: 100%;" |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="失效时间" prop="expireTime"> |
||||
|
<el-date-picker |
||||
|
v-model="formData.expireTime" |
||||
|
type="datetime" |
||||
|
placeholder="请选择失效时间" |
||||
|
format="YYYY-MM-DD HH:mm:ss" |
||||
|
value-format="x" |
||||
|
style="width: 100%;" |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-row> |
||||
|
<el-col :span="24"> |
||||
|
<el-form-item label="班组成员"> |
||||
|
<div class="tag-container flex gap-2"> |
||||
|
<el-tag v-for="ent in tags" :key="ent.username" closable :disable-transitions="false" |
||||
|
@close="handleClose(ent.username)"> |
||||
|
{{ ent.nickname}} |
||||
|
</el-tag> |
||||
|
<el-input |
||||
|
v-if="inputVisible" |
||||
|
ref="InputRef" |
||||
|
v-model="inputValue" |
||||
|
class="w-20" |
||||
|
size="small" |
||||
|
/> |
||||
|
<el-button v-else class="button-new-tag" size="small" @click="addUser"> |
||||
|
添加成员 + |
||||
|
</el-button> |
||||
|
</div> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-row> |
||||
|
<el-col :span="24"> |
||||
|
<el-form-item label="备注" prop="remark"> |
||||
|
<el-input v-model="formData.remark" placeholder="请输入内容" type="textarea" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
</el-form> |
||||
|
<template #footer> |
||||
|
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button> |
||||
|
<el-button @click="dialogVisible = false">取 消</el-button> |
||||
|
</template> |
||||
|
</Dialog> |
||||
|
|
||||
|
<!--添加班组人员弹窗--> |
||||
|
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" /> |
||||
|
|
||||
|
</template> |
||||
|
<script lang="ts" setup> |
||||
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' |
||||
|
import * as TeamApi from '@/api/wms/team' |
||||
|
import request from "@/config/axios"; |
||||
|
import { SearchTable } from '@/components/SearchTable' |
||||
|
import {searchUser} from "@/views/wms/basicDataManage/orderManage/team/team.data"; |
||||
|
import * as UserApi from "@/api/system/user"; |
||||
|
import {validateYS} from "@/utils/validator"; |
||||
|
import { Search } from '@element-plus/icons-vue' |
||||
|
import * as WorkshopApi from "@/api/wms/workshop"; |
||||
|
import {Workshop} from "@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data"; |
||||
|
import * as ProductionlineApi from '@/api/wms/productionline' |
||||
|
import { Productionline } from "@/views/wms/basicDataManage/factoryModeling/productionline/productionline.data"; |
||||
|
import {ElInput} from "element-plus"; |
||||
|
|
||||
|
defineOptions({ name: 'TeamForm' }) |
||||
|
|
||||
|
const { t } = useI18n() // 国际化 |
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
|
||||
|
const dialogVisible = ref(false) // 弹窗的是否展示 |
||||
|
const dialogTitle = ref('') // 弹窗的标题 |
||||
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
||||
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
||||
|
const tags=ref([]) |
||||
|
|
||||
|
const inputValue = ref('') |
||||
|
const inputVisible = ref(false) |
||||
|
const isDisabled = ref(false) |
||||
|
const InputRef = ref<InstanceType<typeof ElInput>>() |
||||
|
|
||||
|
const formData = ref({ |
||||
|
code: '', |
||||
|
name: '', |
||||
|
teamGroup: '', |
||||
|
available: 'TRUE', |
||||
|
activeTime: '', |
||||
|
expireTime: '', |
||||
|
remark: '', |
||||
|
createTime: '', |
||||
|
members: '', |
||||
|
workshopCode:'', |
||||
|
workshopName:'', |
||||
|
productionLineCode:'', |
||||
|
productionLineName:'' |
||||
|
}) |
||||
|
const formRules = reactive({ |
||||
|
code: [ |
||||
|
{ required: true, message: '班组编码不能为空', trigger: 'blur' }, |
||||
|
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }, |
||||
|
{ validator:validateYS, message: '请输入正确的代码', trigger: 'blur'} |
||||
|
], |
||||
|
name: [ |
||||
|
{ required: true, message: '班组名称不能为空', trigger: 'blur' }, |
||||
|
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
||||
|
], |
||||
|
remark: [ |
||||
|
{ max: 50, message: '不得超过50个字符', trigger: 'blur' } |
||||
|
], |
||||
|
teamGroup: [{ required: true, message: '班组类别不能为空', trigger: 'change' }], |
||||
|
workshopCode: [{ required: true, message: '请选择车间代码', trigger: 'blur' },], |
||||
|
productionLineCode: [{ required: true, message: '请选择产线代码', trigger: 'blur' },], |
||||
|
}) |
||||
|
const basicFormRef = ref() // 表单 Ref |
||||
|
const handleClose = (username: string) => { |
||||
|
const index = tags.value.findIndex(tag => tag.username === username); |
||||
|
if (index !== -1) { |
||||
|
tags.value.splice(index, 1); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 弹窗相关参数 */ |
||||
|
const searchTableRef = ref(); |
||||
|
const _searchTableTitle = ref(); |
||||
|
const _searchTableAllSchemas = ref(); |
||||
|
const _searchTablePage = ref(); |
||||
|
const _formField = ref(); |
||||
|
const _searchField = ref(); |
||||
|
const _multiple = ref(); |
||||
|
const _type = ref(); |
||||
|
const _row = ref(); |
||||
|
|
||||
|
/** 选择班组成员弹窗 */ |
||||
|
const addUser = () => { |
||||
|
const _searchCondition = {} |
||||
|
const filters: any[] = [] |
||||
|
filters.push({ |
||||
|
action: "==", |
||||
|
column: 'userType', |
||||
|
value: 'WORKER' |
||||
|
}) |
||||
|
// 参数整理 |
||||
|
_searchCondition.isSearch = true |
||||
|
_searchCondition.filters = filters |
||||
|
_searchTableTitle.value = '选择组员' |
||||
|
_multiple.value = true |
||||
|
_formField.value = 'username' |
||||
|
_searchField.value = 'username' |
||||
|
_searchTablePage.value = UserApi.getUserPage |
||||
|
_searchTableAllSchemas.value = searchUser.allSchemas |
||||
|
|
||||
|
searchTableRef.value.open( |
||||
|
_searchTableTitle.value, |
||||
|
_searchTableAllSchemas.value, |
||||
|
_searchTablePage.value, |
||||
|
_formField.value, |
||||
|
_searchField.value, |
||||
|
_multiple.value, |
||||
|
_type, |
||||
|
_row, |
||||
|
_searchCondition |
||||
|
) |
||||
|
} |
||||
|
|
||||
|
/** 选择车间弹窗 */ |
||||
|
const addWorkShop = () => { |
||||
|
const _searchCondition = {} |
||||
|
const filters: any[] = [] |
||||
|
filters.push({ |
||||
|
action: "==", |
||||
|
column: 'available', |
||||
|
value: 'TRUE' |
||||
|
}) |
||||
|
// 参数整理 |
||||
|
_searchCondition.isSearch = true |
||||
|
_searchCondition.filters = filters |
||||
|
_searchTableTitle.value = '选择车间' |
||||
|
_multiple.value = false |
||||
|
_formField.value = 'workshop' |
||||
|
_searchField.value = 'workshop' |
||||
|
_searchTablePage.value = WorkshopApi.getWorkshopPage |
||||
|
_searchTableAllSchemas.value = Workshop.allSchemas |
||||
|
|
||||
|
searchTableRef.value.open( |
||||
|
_searchTableTitle.value, |
||||
|
_searchTableAllSchemas.value, |
||||
|
_searchTablePage.value, |
||||
|
_formField.value, |
||||
|
_searchField.value, |
||||
|
_multiple.value, |
||||
|
_type, |
||||
|
_row, |
||||
|
_searchCondition |
||||
|
) |
||||
|
} |
||||
|
|
||||
|
/** 选择产线弹窗 */ |
||||
|
const addProductionLine = () => { |
||||
|
if (formData.value.workshopCode == '' || formData.value.workshopCode == null ){ |
||||
|
message.warning('请先选择车间代码'); |
||||
|
return |
||||
|
} |
||||
|
const _searchCondition = {} |
||||
|
const filters: any[] = [] |
||||
|
filters.push({ |
||||
|
action: "==", |
||||
|
column: 'available', |
||||
|
value: 'TRUE' |
||||
|
},{ |
||||
|
action: "==", |
||||
|
column: 'workshopCode', |
||||
|
value: formData.value.workshopCode |
||||
|
}) |
||||
|
// 参数整理 |
||||
|
_searchCondition.isSearch = true |
||||
|
_searchCondition.filters = filters |
||||
|
_searchTableTitle.value = '选择产线' |
||||
|
_multiple.value = false |
||||
|
_formField.value = 'productionLine' |
||||
|
_searchField.value = 'productionLine' |
||||
|
_searchTablePage.value = ProductionlineApi.getProductionlinePage |
||||
|
_searchTableAllSchemas.value = Productionline.allSchemas |
||||
|
|
||||
|
searchTableRef.value.open( |
||||
|
_searchTableTitle.value, |
||||
|
_searchTableAllSchemas.value, |
||||
|
_searchTablePage.value, |
||||
|
_formField.value, |
||||
|
_searchField.value, |
||||
|
_multiple.value, |
||||
|
_type, |
||||
|
_row, |
||||
|
_searchCondition |
||||
|
) |
||||
|
} |
||||
|
|
||||
|
/** 弹窗选择之后 回调函数 */ |
||||
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
||||
|
nextTick?.(() => { |
||||
|
if (formField === 'workshop') { |
||||
|
if (formData.value.workshopCode != val[0].code){ |
||||
|
formData.value.productionLineCode = null |
||||
|
formData.value.productionLineName = null |
||||
|
} |
||||
|
formData.value.workshopCode = val[0].code |
||||
|
formData.value.workshopName = val[0].name |
||||
|
} |
||||
|
else if (formField === 'productionLine'){ |
||||
|
formData.value.productionLineCode = val[0].code |
||||
|
formData.value.productionLineName = val[0].name |
||||
|
} |
||||
|
else { |
||||
|
val.forEach(item => { |
||||
|
const isExist = tags.value.some(tag => tag.username === item.username); |
||||
|
if (!isExist){ |
||||
|
const newUser = {}; |
||||
|
if (formField === 'username') { |
||||
|
newUser['username'] = item.username; |
||||
|
newUser['nickname'] = item.nickname; |
||||
|
} |
||||
|
tags.value.push(newUser); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
/** 初始化弹窗 */ |
||||
|
const open = async (type: string, row?: object) => { |
||||
|
dialogVisible.value = true |
||||
|
dialogTitle.value = t('action.' + type) |
||||
|
formType.value = type |
||||
|
resetForm() |
||||
|
// 修改时,设置数据 |
||||
|
if (row) { |
||||
|
isDisabled.value = true; |
||||
|
formLoading.value = true |
||||
|
try { |
||||
|
formData.value = await request.get({ url: `/wms/team/get?id=` + row.id }); |
||||
|
tags.value=JSON.parse(formData.value.members) |
||||
|
} finally { |
||||
|
formLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
isDisabled.value = false; |
||||
|
tags.value=[]; |
||||
|
} |
||||
|
} |
||||
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
||||
|
|
||||
|
/** 提交表单 */ |
||||
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |
||||
|
const submitForm = async () => { |
||||
|
// 校验表单 |
||||
|
if (!basicFormRef) return |
||||
|
const valid = await basicFormRef.value.validate() |
||||
|
if (!valid) return |
||||
|
if (tags.value.length > 15 ){ |
||||
|
message.warning('班组成员最多15人'); |
||||
|
return |
||||
|
} |
||||
|
// 提交请求 |
||||
|
formLoading.value = true |
||||
|
formData.value.members = JSON.stringify(tags.value) |
||||
|
try { |
||||
|
const data = formData.value as unknown as TeamApi.TeamVO |
||||
|
if (formType.value === 'create') { |
||||
|
await TeamApi.createTeam(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await TeamApi.updateTeam(data) |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
} |
||||
|
dialogVisible.value = false |
||||
|
// 发送操作成功的事件 |
||||
|
emit('success') |
||||
|
} finally { |
||||
|
formLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 重置表单 */ |
||||
|
const resetForm = () => { |
||||
|
formData.value = { |
||||
|
code: '', |
||||
|
name: '', |
||||
|
teamGroup: '', |
||||
|
available: 'TRUE', |
||||
|
activeTime: '', |
||||
|
expireTime: '', |
||||
|
remark: '', |
||||
|
createTime: '', |
||||
|
members: '', |
||||
|
workshopCode:'', |
||||
|
workshopName:'', |
||||
|
productionLineCode:'', |
||||
|
productionLineName:'' |
||||
|
} |
||||
|
basicFormRef.value?.resetFields() |
||||
|
} |
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
.tag-container { |
||||
|
margin-top: 10px; /* 可根据需要调整标签容器与表单项之间的间距 */ |
||||
|
border: 1px solid #ccc; /* 添加边框样式 */ |
||||
|
padding: 10px; /* 可根据需要调整容器内边距 */ |
||||
|
width: 950px; /* 设置固定宽度为 950px */ |
||||
|
overflow-y: auto; /* 当内容溢出容器高度时显示滚动条 */ |
||||
|
word-wrap: break-word; /* 使用 word-wrap 属性实现超出范围换行 */ |
||||
|
overflow-wrap: break-word; /* 兼容性更好的写法 */ |
||||
|
flex-wrap: wrap; |
||||
|
} |
||||
|
.input-with-button { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
.input-with-button > .el-input { |
||||
|
flex: 1; |
||||
|
/*margin-right: 10px;*/ |
||||
|
} |
||||
|
|
||||
|
</style> |
Loading…
Reference in new issue