Browse Source

1、班组功能调整

2、用户表增加字段
3、工序配置关联关系
4、工序功能代码移植
5、产品离线功能
6、产品返线功能
master_hella_20240701
TengXF 7 months ago
parent
commit
ef7b446792
  1. 158
      src/api/mes/process/index.ts
  2. 35
      src/api/mes/processroute/index.ts
  3. 59
      src/api/mes/productBackline/index.ts
  4. 71
      src/api/mes/productOffline/index.ts
  5. 18
      src/api/system/user/index.ts
  6. 5
      src/api/wms/team/index.ts
  7. 2
      src/utils/dict.ts
  8. 820
      src/views/mes/process/components/Detail.vue
  9. 368
      src/views/mes/process/index.vue
  10. 513
      src/views/mes/process/process.data.ts
  11. 109
      src/views/mes/processroute/components/configDialog.vue
  12. 22
      src/views/mes/processroute/index.vue
  13. 249
      src/views/mes/productBackline/index.vue
  14. 170
      src/views/mes/productBackline/productBackline.data.ts
  15. 250
      src/views/mes/productOffline/index.vue
  16. 185
      src/views/mes/productOffline/productOffline.data.ts
  17. 100
      src/views/mes/productionPlan/productionPlan.data.ts
  18. 47
      src/views/wms/basicDataManage/orderManage/team/index.vue
  19. 63
      src/views/wms/basicDataManage/orderManage/team/team.data.ts
  20. 441
      src/views/wms/basicDataManage/orderManage/team/teamForm.vue

158
src/api/mes/process/index.ts

@ -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 })
}

35
src/api/mes/processroute/index.ts

@ -61,38 +61,27 @@ export const importTemplate = () => {
}
// 获取工序工序列表-
export const getProcessList =async (params) => {
return await request.get({ url: `/wms/process/page`, params })
return await request.get({ url: `/mes/process/page`, params })
}
// 获取工序工序信息-
export const getProcesInfo = async(code:String) => {
return await request.get({ url: `/wms/process/getByCode?code=`,code })
return await request.get({ url: `/mes/process/getByCode?code=`+code })
}
// 获取产品信息列表-
export const getProductInfo =async (code:String) => {
return await request.get({ url: `/wms/itembasic/getProduct?code=`+code})
}
// 获取设备列表-参数为工序编码
export const getDeviceList =async (code:String) => {
//return request.get({ url: `/wms/itembasic/getProduct?code=`+code})
return request.get({ url: `/wms/itembasic/getProduct?code=`+code})
return {code:0,data:[{name:"冲压设备1",code:"CY0001"},{name:"冲压设备2",code:"CY0002"}]}
// 查询模具基本信息列表
export const getPatternPage = async (code:String) => {
return await request.get({ url: `/mes/mes-process-pattern/pagePatternByProcessCode?pageSize=25&processCode=`+code })
}
// 获取工作人员信息--参数为工序编码
export const getWorkerList =async (code:String) => {
// return request.get({ url: `/wms/itembasic/getProduct?code=`+code})
return {code:0,data:[{name:"张三",code:"冲压1班"},{name:"李四",code:"冲压1班"}]}
// 查询物料列表
export const getItembasicPage = async (code:String) => {
return await request.get({ url: `/mes/mes-process-itembasic/pageByProcessCode?pageSize=25&processCode=`+code})
}
// 获取工位信息
export const getWorkStation =async (code:String) => {
//return request.get({ url: `/wms/itembasic/getProduct?code=`+code})
return {code:0,data:{name:"冲压工位",code:"CYW0001"}}
export const getWorkstationPage = async (code:String) => {
return await request.get({ url: `/mes/workstation/page?pageSize=25&processCode=`+code})
}
// 获取车间信息列表-
// export const getWorkInfoList = () => {
// return request.get({ url: '/wms/workshop?code=',code })
// }
// 获取产品信息列表-
// export const getProductInfo = (code:String) => {
// return request.get({ url: '/wms/itembasic/getProduct?code=',code })
// }

59
src/api/mes/productBackline/index.ts

@ -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' })
}

71
src/api/mes/productOffline/index.ts

@ -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 })
}
}

18
src/api/system/user/index.ts

@ -15,13 +15,25 @@ export interface UserVO {
remark: string
loginDate: Date
createTime: Date
userType :string
}
// 查询用户管理列表
export const getUserPage = (params: PageParam) => {
return request.get({ url: '/system/user/page', params })
export const getUserPage = async (params) => {
console.log(params)
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/system/user/senior', data })
} else {
return await request.get({ url: '/system/user/page', params })
}
}
// 查询用户管理列表
// export const getUserPage = (params: PageParam) => {
// return request.get({ url: '/system/user/page', params })
// }
// 查询用户详情
export const getUser = (id: number) => {
return request.get({ url: '/system/user/get?id=' + id })

5
src/api/wms/team/index.ts

@ -9,6 +9,9 @@ export interface TeamVO {
expireTime: Date
remark: string
available: string
teamGroup: string
workshopCode: string
productionLineCode: string
}
// 查询班组列表
@ -55,4 +58,4 @@ export const exportTeam = async (params) => {
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/wms/team/get-import-template' })
}
}

2
src/utils/dict.ts

@ -322,4 +322,6 @@ export enum DICT_TYPE {
SUPPLIERINVOICE_REQUEST_STATUS = 'supplierinvoice_request_status', //发票申请状态
SUPPLIERINVOICE_STATUS = 'supplierinvoice_status', //待开票审核状态
BASIC_TEAM_TYPE='basic_team_type',//班组类型
}

820
src/views/mes/process/components/Detail.vue

@ -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>

368
src/views/mes/process/index.vue

@ -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>

513
src/views/mes/process/process.data.ts

@ -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
}]
}
}
}
]))

109
src/views/mes/processroute/components/configDialog.vue

@ -42,7 +42,7 @@
<el-table-column prop="name" label="工序名称" />
<el-table-column prop="oper" label="操作" width="60">
<template #default="scope">
<el-button size="mini" type="text" @click="deleteNode(scope.row)"
<el-button size="mini" type="text" @click="deleteNode(scope.row)"
>移除</el-button
>
</template>
@ -51,7 +51,7 @@
</el-card>
</el-col>
<el-col :span="12"><div ref="graphContainer" style="width: 90%; height: 90%"></div>
</el-col>
<el-col :span="6">
<ContentWrap class="w-[100%] ml-16px">
@ -95,11 +95,11 @@
<span>物料信息</span>
</div>
</template>
<el-table :data="materialData" ref="tableMaterial" style="width: 100%; height: 80%">
<el-table-column prop="name" label="物料名称"/>
<el-table :data="materialData" ref="tableMaterial" style="width: 100%; height: 80%;overflow-y: auto;">
<el-table-column prop="name" label="物料名称"/>
=
<el-table-column prop="code" label="物料编码"/>
<el-table-column prop="desc1" label="是否替代"/>
<el-table-column prop="code" label="物料编码"/>
<el-table-column prop="desc1" label="是否替代"/>
</el-table>
</el-card></el-col
>
@ -110,8 +110,8 @@
<span>模具信息</span>
</div>
</template>
<el-table :data="mouldData" ref="tableMould" style="width: 100%; height: 80%">
<el-table-column prop="name" label="模具名称"/>
<el-table :data="mouldData" ref="tableMould" style="width: 100%; height: 80%;overflow-y: auto;">
<el-table-column prop="name" label="模具名称"/>
<el-table-column prop="code" label="模具编码"/>
</el-table>
</el-card></el-col
@ -123,7 +123,7 @@
<span>工位信息</span>
</div>
</template>
<el-table :data="workstationData" ref="tableWorkstation" style="width: 100%; height: 80%">
<el-table :data="workStationList" ref="tableWorkstation" style="width: 100%; height: 80%;overflow-y: auto;">
<el-table-column prop="name" label="工位名称"/>
<el-table-column prop="code" label="工位编码"/>
</el-table>
@ -162,12 +162,10 @@ const titleValueRef = ref()
const processRouteId = ref()
const processData = ref([]) //
const tableProcess = ref()
// const workshopCodeOptions = ref([{ code: '', name: '1' }])
// const productionLineCodeOptions = ref([{ code: '', name: '线' }])
const productData = ref({ name: '', code: '', desc1: '--' }) //
const materialData=ref()
const mouldData = ref()
const workstationData = ref() //
const workStationList = ref() //
//
const annexData = reactive({
annexList: []
@ -182,7 +180,6 @@ const routeVersion=ref()
const searchTableRef = ref()
const opensearchTable = (
) => {
//console.log("opensearchTable")
const _searchCondition = {}
const _searchTableTitle = "工序查询"
const _searchTableAllSchemas = ProcessSearch.allSchemas
@ -216,8 +213,9 @@ const deleteNode=(row)=>{
}
//
const graph = ref<Graph>()
const openDetail = (rowData: any) => {
rowData.value = rowData
const rowData = ref()
const openDetail = (row: any) => {
rowData.value = row
console.log('rowData',rowData.value)
titleNameRef.value = rowData.value.processrouteCode
titleValueRef.value = rowData.value.processName
@ -230,54 +228,52 @@ const openDetail = (rowData: any) => {
if(rowData){
let graphJson = JSON.parse(rowData.value.graphJson)
isShowDrawer.value = true
nextTick(() => {
nextTick?.(() => {
graph.value = createGraph(graphContainer.value as HTMLElement,true,640,480)
//
materialData.value = []
mouldData.value = []
workStationList.value = []
graph.value.on('node:click', ({ e, x, y, node, view }) => {
nodeClick(e, x, y, node, view)
})
graph.value.fromJSON(graphJson.cells)
})
getItembasicInfo(rowData.value.productCode)
getRemarkList()
getFileList()
getChangeRecordList()}
getItembasicInfo(rowData.value.productCode)
getRemarkList()
getFileList()
getChangeRecordList()
}
}
//
const handleDrawerClose = () => {
//console.log('close')
if (graph && graph.value != undefined) {
//console.log(graph.value.toJSON())
rowData.value=null
}
}
//** */
const getProcessInfo = async (id: number) => {
const res = await ProcessrouteApi.getProcesInfo(id)
return res
const getProcessInfo = async (id: any) => {
return await ProcessrouteApi.getProcesInfo(id)
}
/** 获取产品信息 */
const getItembasicInfo = async (code: String) => {
const res = await ProcessrouteApi.getProductInfo(code)
productData.value = res
//console.log(productData.value)
}
/** 获取设备列表 */
const getDeviceList = async (code: String) => {
const res = await ProcessrouteApi.getDeviceList(code)
deviceList.value = res.data
//console.log(productData.value)
/** 获取物料列表 */
const getItembasicPage = async (code) => {
return await ProcessrouteApi.getItembasicPage(code);
}
/** 获取工位信息 */
const getWorkStation = async (code: String) => {
const res = await ProcessrouteApi.getWorkStation(code)
workStationData.value = res.data
//console.log(productData.value)
/** 查询模具基本信息列表 */
const getPatternPage = async (code) => {
return await ProcessrouteApi.getPatternPage(code);
}
/** 获取人员信息列表 */
const getWorkerList = async (code: String) => {
const res = await ProcessrouteApi.getWorkerList(code)
workerList.value = res.data
//console.log(productData.value)
/** 查询模具基本信息列表 */
const getWorkstationPage = async (code) => {
return await ProcessrouteApi.getWorkstationPage(code);
}
const processListParmas = ref({
name: '',
@ -288,20 +284,33 @@ const processListParmas = ref({
})
/**获取工序列表 */
const getProcessList = async () => {
//console.log(processListParmas.value)
const res = await ProcessrouteApi.getProcessList(processListParmas.value)
processData.value = res.list
//return res
}
//
const nodeClick = (e, x, y, node, view) => {
//console.log('nodeClick', e, x, y, node, view)
let data = getProcessInfo(node.id)
getDeviceList(node.id)
getWorkerList(node.id)
getWorkStation(node.id)
message.info(data.toString())
Promise.all([
getProcessInfo(node.id),
getItembasicPage(node.id),
getPatternPage(node.id),
getWorkstationPage(node.id)
]).then(([processIndoList,itembasicPage, patternPage,workstationInfoList]) => {
//
message.info(JSON.stringify(processIndoList))
console.log(processIndoList)
//
materialData.value = itembasicPage.list
//
mouldData.value = patternPage.list
//
workStationList.value = workstationInfoList.list
}).catch(error => {
console.error("Error:", error);
materialData.value = []
mouldData.value = []
workStationList.value = []
});
}
//
@ -341,7 +350,7 @@ const userAddNode = (row) => {
}
//-------
defineExpose({ openDetail, createGraph }) // open
onMounted(() => {
onMounted?.(() => {
//registerNodes()
getProcessList()
@ -418,7 +427,7 @@ const deleteAnnexSuccess = async () => {
getChangeRecordList()
}
//
onUnmounted(() => {})
onUnmounted?.(() => {})
const emit = defineEmits(['close'])
</script>

22
src/views/mes/processroute/index.vue

@ -51,7 +51,7 @@
/>
<!-- 详情 -->
<ProcessRouteConfig ref="configDialogRef" @close="dailogClose" />
<ProcessRouteConfig ref="configDialogRef" @close="dailogClose" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/mes/processroute/import" :importTemplateData="importTemplateData" @success="importSuccess" />
@ -140,7 +140,7 @@ const butttondata = [
defaultButtons.mainListHandleBtn({label: '配置',
name: 'config',
hide: false,
type: 'warning',
type: 'primary',
icon: '',
color: '',
hasPermi: ''}), //
@ -148,18 +148,22 @@ const butttondata = [
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
} else if (val == 'config') { //
} else if (val == 'config') { //
openDetail(row)
}
}
const dailogClose=() => {
console.log('close');
nextTick?.(()=>{
debugger
getList()
})
}
/** 添加/修改操作 */
const basicFormRef = ref()
@ -194,7 +198,8 @@ const formsSuccess = async (formType,data) => {
/** 详情操作 */
const configDialogRef = ref()
const openDetail =(row) => {
//
configDialogRef.value.openDetail(row)
}
@ -257,5 +262,10 @@ onMounted(async () => {
getList()
importTemplateData.templateUrl = await ProcessrouteApi.importTemplate()
})
//
// watch(
// () => tableObject.tableList,
// console.log(tableObject.tableList)
// )
</script>

249
src/views/mes/productBackline/index.vue

@ -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>

170
src/views/mes/productBackline/productBackline.data.ts

@ -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'
}
}
]))

250
src/views/mes/productOffline/index.vue

@ -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>

185
src/views/mes/productOffline/productOffline.data.ts

@ -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'
}
}
]))

100
src/views/mes/productionPlan/productionPlan.data.ts

@ -180,3 +180,103 @@ export const ProductionPlan = useCrudSchemas(reactive<CrudSchema[]>([
}
}
]))
export const workscheduling = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '产品编号',
field: 'productCode',
sort: 'custom',
isSearch: true,
table: {
width: 120
},
form: {
componentProps: {
disabled:true,
}
}
},
{
label: '产品名称',
field: 'productName',
sort: 'custom',
isSearch: true,
table: {
width: 120
},
form: {
componentProps: {
disabled:true,
}
}
},
{
label: '计划编号',
field: 'planMaserCode',
sort: 'custom',
isSearch: true,
table: {
width: 120,
fixed: 'left'
},
},
{
label: '当前工序',
field: 'workingNode',
sort: 'custom',
isSearch: false,
table: {
width: 120
}
},
{
label: '当前工位',
field: 'currentWorkstation',
sort: 'custom',
isSearch: false,
table: {
width: 120
}
},
{
label: '工单编码',
field: 'schedulingCode',
sort: 'custom',
isSearch: false,
disabled:true,
table: {
width: 120
},
},
{
label: '车间编号',
field: 'workroomCode',
sort: 'custom',
isSearch: true,
table: {
width: 120
},
form: {
componentProps: {
disabled:true,
}
}
},
{
label: '产线编号',
field: 'lineCode',
sort: 'custom',
isSearch: true,
isTable: true,
table: {
width: 120
}
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: false,
}
]))

47
src/views/wms/basicDataManage/orderManage/team/index.vue

@ -6,9 +6,9 @@
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:route-name="routeName"
:route-name="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="Team.allSchemas"
@ -39,15 +39,16 @@
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="TeamRules"
:formAllSchemas="Team.allSchemas"
:apiUpdate="TeamApi.updateTeam"
:apiCreate="TeamApi.createTeam"
:isBusiness="false"
/>
<teamForm ref="basicFormRef" @success="getData" :formAllSchemas="searchUser.allSchemas"/>
<!-- <BasicForm-->
<!-- ref="basicFormRef"-->
<!-- @success="formsSuccess"-->
<!-- :rules="TeamRules"-->
<!-- :formAllSchemas="Team.allSchemas"-->
<!-- :apiUpdate="TeamApi.updateTeam"-->
<!-- :apiCreate="TeamApi.createTeam"-->
<!-- :isBusiness="false"-->
<!-- />-->
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="Team.allSchemas" />
@ -60,11 +61,13 @@
import download from '@/utils/download'
import * as TeamApi from '@/api/wms/team'
import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import { Team, TeamRules } from './team.data'
import {searchUser, Team, TeamRules} from './team.data'
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 Detail from '@/components/Detail/src/Detail.vue'
import TeamForm from "@/views/wms/basicDataManage/orderManage/team/teamForm.vue";
import {sync} from "rimraf";
defineOptions({ name: 'Team' })
@ -106,7 +109,7 @@ const HeadButttondata = [
// },
]
//
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
@ -123,7 +126,7 @@ const buttonBaseClick = (val, item) => {
getList()
}
} else if (val == 'filtrate') { //
} else { //
} else { //
console.log('其他按钮', item)
}
}
@ -134,11 +137,12 @@ const butttondata = [
defaultButtons.mainListDeleteBtn({hasPermi:'wms:team:delete'}), //
]
// -
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
// const res = await TeamApi.getItempackaging(row.id)
openForm('update', row)
// openForm('update', row)
basicFormRef.value.open('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
@ -152,13 +156,13 @@ const openForm = (type: string, row?: any) => {
if (item.field == 'code') {
item.componentProps.disabled = true
}
})
})
}else {
Team.allSchemas.formSchema.forEach((item) => {
if (item.field == 'code') {
item.componentProps.disabled = false
}
})
})
}
basicFormRef.value.open(type, row)
}
@ -186,6 +190,9 @@ const formsSuccess = async (formType,data) => {
basicFormRef.value.dialogVisible = false
getList()
}
const getData = async() => {
getList();
}
/** 详情操作 */
const detailRef = ref()
@ -253,4 +260,4 @@ onMounted(async() => {
getList()
importTemplateData.templateUrl = await TeamApi.importTemplate()
})
</script>
</script>

63
src/views/wms/basicDataManage/orderManage/team/team.data.ts

@ -24,10 +24,43 @@ export const Team = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: true,
},
{
label: '成员',
label: '车间代码',
field: 'workshopCode',
sort: 'custom',
isSearch: true,
table: {
width: 120
}
},
{
label: '产线代码',
field: 'productionLineCode',
sort: 'custom',
isSearch: true,
table: {
width: 120
}
},
{
label: '班组类型',
field: 'teamGroup',
sort: 'custom',
dictType: DICT_TYPE.BASIC_TEAM_TYPE,
dictClass: 'string',
isSearch: true,
isTable: true,
table: {
width: 120
}
},
{
label: '班组成员',
field: 'members',
sort: 'custom',
isSearch: true,
table: {
width: 200
}
},
{
label: '是否可用',
@ -131,7 +164,8 @@ export const Team = useCrudSchemas(reactive<CrudSchema[]>([
isDetail: false,
isForm: false ,
table: {
fixed: 'right'
fixed: 'right',
width: 110
}
}
]))
@ -155,4 +189,27 @@ export const TeamRules = reactive({
available: [
{ required: true, message: '请选择是否可用', trigger: 'change' }
],
})
treamGroup: [
{ required: true, message: '请选择班组类型', trigger: 'change' },
],
})
export const searchUser = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '用户名',
field: 'username',
sort: 'custom',
isSearch: true,
},
{
label: '用户昵称',
field: 'nickname',
sort: 'custom',
isSearch: true,
},
{
label: '备注',
field: 'remark',
sort: 'custom',
}
]))

441
src/views/wms/basicDataManage/orderManage/team/teamForm.vue

@ -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) // 12
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…
Cancel
Save