Browse Source

1、工位管理页面关联弹窗

master_hella_20240701
bjang03 8 months ago
parent
commit
1b7db2150a
  1. 156
      src/api/mes/workstation/index.ts
  2. 2
      src/utils/dict.ts
  3. 190
      src/views/mes/workstation/index.vue
  4. 163
      src/views/mes/workstation/workstation.data.ts

156
src/api/mes/workstation/index.ts

@ -6,7 +6,9 @@ export interface WorkstationVO {
expireTime: Date expireTime: Date
name: string name: string
} }
export const goalParams = {
workstationCode:null
}
// 查询工位列表 // 查询工位列表
export const getWorkstationPage = async (params) => { export const getWorkstationPage = async (params) => {
if (params.isSearch) { if (params.isSearch) {
@ -46,4 +48,154 @@ export const exportWorkstation = async (params) => {
// 下载用户导入模板 // 下载用户导入模板
export const importTemplate = () => { export const importTemplate = () => {
return request.download({ url: '/mes/workstation/get-import-template' }) return request.download({ url: '/mes/workstation/get-import-template' })
} }// 查询班组列表
export const getTeamPage = async (params) => {
console.log(goalParams.workstationCode)
params.workstationCode = goalParams.workstationCode
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/mes/team/senior', data })
} else {
return await request.get({ url: `/mes/team/pageListByWorkstationCode`, params })
}
}
// 查询选择班组列表
export const checkTeamPageList = async (params) => {
console.log(goalParams.workstationCode)
params.workstationCode = goalParams.workstationCode
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/mes/team/senior', data })
} else {
return await request.get({ url: `/mes/team/pageCheckListByWorkstationCode`, params })
}
}
// 添加班组关联
export const createTeamRelation = async (workstationCode,teamCodes:string[]) => {
const data = {
workstationCode : workstationCode,
teamCodes : teamCodes
}
return await request.post({ url: `/mes/team/createRelation`, data })
}
// 删除班组关联
export const deleteTeamRelation = async (workstationCode,teamCodes:string[]) => {
const data = {
workstationCode : workstationCode,
teamCodes : teamCodes
}
return await request.post({ url: `/mes/team/deleteRelation`, data })
}
export const getEquipmentPage = async (params) => {
console.log(goalParams.workstationCode)
params.workstationCode = goalParams.workstationCode
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/mes/equipment/senior', data })
} else {
return await request.get({ url: `/mes/equipment/pageListByWorkstationCode`, params })
}
}
// 查询选择设备列表
export const checkEquipmentPageList = async (params) => {
console.log(goalParams.workstationCode)
params.workstationCode = goalParams.workstationCode
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/mes/equipment/senior', data })
} else {
return await request.get({ url: `/mes/equipment/pageCheckListByWorkstationCode`, params })
}
}
// 添加设备关联
export const createEquipmentRelation = async (workstationCode,equipmentCodes:string[]) => {
const data = {
workstationCode : workstationCode,
equipmentCodes : equipmentCodes
}
return await request.post({ url: `/mes/team/createRelation`, data })
}
// 删除设备关联
export const deleteEquipmentRelation = async (workstationCode,equipmentCodes:string[]) => {
const data = {
workstationCode : workstationCode,
equipmentCodes : equipmentCodes
}
return await request.post({ url: `/mes/team/deleteRelation`, data })
}
export const getProcessPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/mes/production-process/senior', data })
} else {
return await request.get({ url: `/mes/production-process/pageListByWorkstationCode`, params })
}
}
export const checkProcessPageList = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/mes/production-process/senior', data })
} else {
return await request.get({ url: `/mes/production-process/pageCheckListByWorkstationCode`, params })
}
}
// 添加工序关联
export const createProcessRelation = async (workstationCode,processCodes:string[]) => {
const data = {
workstationCode : workstationCode,
processCodes : processCodes
}
return await request.post({ url: `/mes/production-process/createRelation`, data })
}
// 删除工序关联
export const deleteProcessRelation = async (workstationCode,processCodes:string[]) => {
const data = {
workstationCode : workstationCode,
processCodes : processCodes
}
return await request.post({ url: `/mes/production-process/deleteRelation`, data })
}
export const getProductionPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/mes/production-process/senior', data })
} else {
return await request.get({ url: `/mes/production-process/pageListByWorkstationCode`, params })
}
}
export const checkProductionPageList = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/mes/production-process/senior', data })
} else {
return await request.get({ url: `/mes/production-process/pageCheckListByWorkstationCode`, params })
}
}
// 添加产品关联
export const createProductionRelation = async (workstationCode,productionCodes:string[]) => {
const data = {
workstationCode : workstationCode,
productionCodes : productionCodes
}
return await request.post({ url: `/mes/production-process/createRelation`, data })
}
// 删除产品关联
export const deleteProductionRelation = async (workstationCode,productionCodes:string[]) => {
const data = {
workstationCode : workstationCode,
productionCodes : productionCodes
}
return await request.post({ url: `/mes/production-process/deleteRelation`, data })
}

2
src/utils/dict.ts

@ -280,7 +280,7 @@ export enum DICT_TYPE {
MESDO_STATUS= 'mes_do_status', // 工单执行状态 MESDO_STATUS= 'mes_do_status', // 工单执行状态
MES_WORKBILL_MODEL='mes_workbill_model',// 工单模式 单工单(根据产品数量生成多个工单)、批量工单(一个产品一个工单) MES_WORKBILL_MODEL='mes_workbill_model',// 工单模式 单工单(根据产品数量生成多个工单)、批量工单(一个产品一个工单)
MES_TASK_MODE='mes_task_mode', //生产模式 派工方式、领工方式 MES_TASK_MODE='mes_task_mode', //生产模式 派工方式、领工方式
MES_PLANDO_STATUS='mes_plando_status' //计划执行状态 MES_PLANDO_STATUS='mes_plando_status', //计划执行状态
PLAN_PRODUCTION_TYPE = "plan_production_type", // 生产计划类型 PLAN_PRODUCTION_TYPE = "plan_production_type", // 生产计划类型
DELIVER_TYPE="deliver_type",//发货类型 DELIVER_TYPE="deliver_type",//发货类型
BILL_TYPE="bill_type", // 发票类型 BILL_TYPE="bill_type", // 发票类型

190
src/views/mes/workstation/index.vue

@ -4,15 +4,15 @@
<Search :schema="Workstation.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search :schema="Workstation.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead <TableHead
:HeadButttondata="HeadButttondata" :HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick" @button-base-click="buttonBaseClick"
:routeName="routeName" :routeName="routeName"
@updataTableColumns="updataTableColumns" @updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick" @searchFormClick="searchFormClick"
:allSchemas="Workstation.allSchemas" :allSchemas="Workstation.allSchemas"
/> />
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
@ -51,26 +51,90 @@
/> />
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="Workstation.allSchemas" /> <Detail ref="detailRef"
:isBasic="false"
:allSchemas="Workstation.allSchemas"
:detailAllSchemas="detailAllSchemas"
:detailAllSchemasRules="WorkstationRules"
:apiPage="apiPage"
:tabs="TabsList"
@changeTabs="changeTabs"
:buttondataTable="buttondataTable"
@tableFormButton="tableFormButton"
/>
<!-- 记录子包装弹窗 -->
<BasicForm
ref="teamRef"
@success="getList"
:tableAllSchemas="Team.allSchemas"
:tableData="selectTeamListTableData.tableList"
:isBusiness="true"
:isShowButton="false"
:isShowReduceButton="false"
:isShowFooterButtton="false"
/>
<BasicForm
ref="equipmentListRef"
@success="getList"
:tableAllSchemas="Equipment.allSchemas"
:tableData="selectEquipmentListTableData.tableList"
:isBusiness="true"
:isShowButton="false"
:isShowReduceButton="false"
:isShowFooterButtton="false"
/>
<BasicForm
ref="processListRef"
@success="getList"
:tableAllSchemas="Process.allSchemas"
:tableData="selectProcessListTableData.tableList"
:isBusiness="true"
:isShowButton="false"
:isShowReduceButton="false"
:isShowFooterButtton="false"
/>
<BasicForm
ref="productionListRef"
@success="getList"
:tableAllSchemas="Production.allSchemas"
:tableData="selectProductionListTableData.tableList"
:isBusiness="true"
:isShowButton="false"
:isShowReduceButton="false"
:isShowFooterButtton="false"
/>
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/mes/workstation/import" :importTemplateData="importTemplateData" @success="importSuccess" /> <ImportForm ref="importFormRef" url="/mes/workstation/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { Workstation,WorkstationRules } from './workstation.data' import {
Equipment,
Process,
Production,
TabsList,
Team,
Workstation,
WorkstationRules
} from './workstation.data'
import * as WorkstationApi from '@/api/mes/workstation' import * as WorkstationApi from '@/api/mes/workstation'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue' import {
checkEquipmentPageList, checkProcessPageList, checkProductionPageList,
checkTeamPageList,
getEquipmentPage, getProcessPage, getProductionPage, getSelectEquipmentPage,
getSelectTeamPage,
goalParams,
} from "@/api/mes/workstation";
import * as PurchasereceiptRecordDetailApi from "@/api/wms/purchasereceiptRecordDetail";
defineOptions({ name: 'Workstation' }) defineOptions({ name: 'Workstation' })
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
const teamRef = ref()
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
@ -135,7 +199,6 @@ const buttonBaseClick = (val, item) => {
const butttondata = [ const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:workstation:update'}), // defaultButtons.mainListEditBtn({hasPermi:'wms:workstation:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:workstation:delete'}), // defaultButtons.mainListDeleteBtn({hasPermi:'wms:workstation:delete'}), //
defaultButtons.mainListBindBtn({hasPermi:'wms:workstation:update'}), //
] ]
// - // -
@ -144,11 +207,8 @@ const buttonTableClick = async (val, row) => {
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') { //
await handleDelete(row.id) await handleDelete(row.id)
}else if (val == 'bind') { //
await detailRef.value.openDetail(row, '绑定', row.name, 'mesWorkstation')
} }
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
const basicFormRef = ref() const basicFormRef = ref()
const openForm = (type: string, row?: any) => { const openForm = (type: string, row?: any) => {
@ -179,11 +239,6 @@ const formsSuccess = async (formType,data) => {
getList() getList()
} }
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicWorkstation')
}
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id: number) => { const handleDelete = async (id: number) => {
@ -243,5 +298,92 @@ onMounted(async () => {
getList() getList()
importTemplateData.templateUrl = await WorkstationApi.importTemplate() importTemplateData.templateUrl = await WorkstationApi.importTemplate()
}) })
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
goalParams.workstationCode = row.code
detailRef.value.openDetail(row, titleName, titleValue, 'basicWorkstation')
}
//
const detailAllSchemas = ref(Team.allSchemas)
const apiPage = ref(WorkstationApi.getTeamPage)
const tableKey = ref("workstationDetail");
// tabs
const changeTabs = (data) =>{
tableKey.value = data.prop
if(data.prop == 'Team'){
apiPage.value = WorkstationApi.getTeamPage
detailAllSchemas.value = Team.allSchemas
}else if(data.prop == 'Equipment'){
apiPage.value = WorkstationApi.getEquipmentPage
detailAllSchemas.value = Equipment.allSchemas
}else if(data.prop == 'Process'){
apiPage.value = WorkstationApi.getProcessPage
detailAllSchemas.value = Process.allSchemas
}else if(data.prop == 'Production'){
apiPage.value = WorkstationApi.getProductionPage
detailAllSchemas.value = Production.allSchemas
}
}
const buttondataTable = ref([{
label: '取消关联',
name: 'viewParentPickingNumber',
hide: false,
type: 'primary',
icon: '',
color: '',
hasPermi: '',
link: true, //
}])
const teamListRef = ref()
const { tableObject: selectTeamListTableData, tableMethods: selectTeamListTableMethods } = useTable({
getListApi: WorkstationApi.checkTeamPageList
})
const { getList:selectTeamList } = selectTeamListTableMethods
const equipmentListRef = ref()
const { tableObject: selectEquipmentListTableData, tableMethods: selectEquipmentListTableMethods } = useTable({
getListApi: WorkstationApi.checkEquipmentPageList
})
const { getList:selectEquipmentList } = selectEquipmentListTableMethods
const processListRef = ref()
const { tableObject: selectProcessListTableData, tableMethods: processListTableMethods } = useTable({
getListApi: WorkstationApi.checkProcessPageList
})
const { getList:selectProcessListList } = processListTableMethods
const productionListRef = ref()
const { tableObject: selectProductionListTableData, tableMethods: productionListTableMethods } = useTable({
getListApi: WorkstationApi.checkProductionPageList
})
const { getList:selectProductionList } = productionListTableMethods
const tableFormButton = async (val , row) => {
if(val == 'Team'){
selectTeamListTableData.params = {
workstationCode:row.workstationCode
}
await selectTeamList()
teamListRef.value.open('create', row, null,'viewDetail')//
}else if(val == 'Equipment'){
selectEquipmentListTableData.params = {
workstationCode:row.workstationCode
}
await selectEquipmentList()
equipmentListRef.value.open('create', row, null,'viewDetail')//
}else if(val == 'Process'){
selectProcessListTableData.params = {
workstationCode:row.workstationCode
}
await selectProcessListList()
processListRef.value.open('create', row, null,'viewDetail')//
}else if(val == 'Production'){
selectProductionListTableData.params = {
workstationCode:row.workstationCode
}
await selectProductionList()
productionListRef.value.open('create', row, null,'viewDetail')//
}
}
</script> </script>

163
src/views/mes/workstation/workstation.data.ts

@ -1,11 +1,28 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type {CrudSchema} from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime' import {dateFormatter} from '@/utils/formatTime'
// 表单校验 // 表单校验
export const WorkstationRules = reactive({ export const WorkstationRules = reactive({
code: [required] code: [required]
}) })
export const TabsList = [{
label: "班组",
prop: 'Team',
},
{
label: "设备",
prop: 'Equipment',
},
{
label: "工序",
prop: 'Process',
},
{
label: "产品",
prop: 'Production',
}
]
export const Workstation = useCrudSchemas(reactive<CrudSchema[]>([ export const Workstation = useCrudSchemas(reactive<CrudSchema[]>([
{ {
@ -46,26 +63,36 @@ export const Workstation = useCrudSchemas(reactive<CrudSchema[]>([
field: 'activeTime', field: 'activeTime',
sort: 'custom', sort: 'custom',
formatter: dateFormatter, formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
form: { form: {
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: {
style: {width: '100%'},
type: 'datetime', type: 'datetime',
valueFormat: 'x' dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
} }
} },
}, },
{ {
label: '失效时间', label: '失效时间',
field: 'expireTime', field: 'expireTime',
sort: 'custom', sort: 'custom',
formatter: dateFormatter, formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
form: { form: {
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: {
style: {width: '100%'},
type: 'datetime', type: 'datetime',
valueFormat: 'x' dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
} }
} },
}, },
{ {
label: '操作', label: '操作',
@ -77,3 +104,127 @@ export const Workstation = useCrudSchemas(reactive<CrudSchema[]>([
} }
} }
])) ]))
export const Team = 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 TeamSelect = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '代码',
field: 'code',
sort: 'custom',
isSearch: true,
isForm: false
},
{
label: '名称',
field: 'name',
sort: 'custom',
isSearch: true,
isForm: false
}
]))
export const Equipment = 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 Process = 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 Production = 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,
}
]))

Loading…
Cancel
Save