Browse Source

Merge branch 'master_hella' of http://dev.ccwin-in.com:3000/sfms3.0/sfms3.0-ui into master_hella

master_hella_20240701
陈薪名 8 months ago
parent
commit
b7f36ae197
  1. 102
      src/api/mes/orderDay/index.ts
  2. 53
      src/api/qms/samplingProcess/index.ts
  3. 56
      src/components/Detail/src/Detail.vue
  4. 8
      src/utils/dict.ts
  5. 459
      src/views/mes/orderDay/components/BasicFormV2.vue
  6. 237
      src/views/mes/orderDay/components/orderDetail.vue
  7. 332
      src/views/mes/orderDay/components/schedule.vue
  8. 331
      src/views/mes/orderDay/index.vue
  9. 327
      src/views/mes/orderDay/orderDay.data.ts
  10. 102
      src/views/mes/processroute/components/configDialog.vue
  11. 8
      src/views/mes/processroute/components/graphbase.data.ts
  12. 244
      src/views/qms/samplingProcess/index.vue
  13. 84
      src/views/qms/samplingProcess/samplingProcess.data.ts

102
src/api/mes/orderDay/index.ts

@ -0,0 +1,102 @@
import request from '@/config/axios'
export interface OrderDayVO {
status: string
remark: string
planNoMonth: string
planNoDay: string
productCode: string
workroomCode: string
lineCode: string
planCount: number
processrouteCode: string
tempProcessroute: string
standardBom: string
tempBom: string
workMode: string
planDate: Date
startTime: Date
endTime: Date
taskMode: string
}
// 查询生产日计划列表
export const getOrderDayPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/mes/orderday/senior', data })
} else {
return await request.get({ url: `/mes/orderday/page`, params })
}
}
// 查询生产日计划详情
export const getOrderDay = async (id: number) => {
return await request.get({ url: `/mes/orderday/get?id=` + id })
}
// 新增生产日计划
export const createOrderDay = async (data: OrderDayVO) => {
return await request.post({ url: `/mes/orderday/create`, data })
}
// 修改生产日计划
export const updateOrderDay = async (data: OrderDayVO) => {
return await request.put({ url: `/mes/orderday/update`, data })
}
// 删除生产日计划
export const deleteOrderDay = async (id: number) => {
return await request.delete({ url: `/mes/orderday/delete?id=` + id })
}
// 导出生产日计划 Excel
export const exportOrderDay = async (params) => {
return await request.download({ url: `/mes/orderday/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/mes/orderday/get-import-template' })
}
// 根据产品编码获取Bom
export const getBoms = async (code: String) => {
return request.get({ url: '/mes/common/geBomByProductCode?code='+code })
}
// 根据产品编码获取工艺路线
export const getProcessroutes = async (code: String) => {
return request.get({ url: '/mes/common/getProcessRouteByProductCode?code='+code })
}
// 根据车间编码获取产线列表
export const getProductlines = async (code: String) => {
return request.get({ url: '/mes/common/getLinesByWorkRoomCode?code='+code })
}
// 获取产线信息
export const getProductlineInfo = async (code: String) => {
return request.get({ url: '/mes/common/getLinesByWorkRoomCode?code='+code })
}
// 根据工艺路线的工序信息
export const getProcessroutesDetail = async (code) => {
return await request.get({ url: `/mes/orderday/getProcessInfo?code=`+ code })
}
// 根据获取计划BOM信息
export const getPlanBom = async (params) => {
return await request.get({ url: `/mes/orderday/getBomInfo`,params })
}
// 根据计划的车间、产线、计划时间 查询已经配置的人员
export const getPlanWorks = async (params) => {
return await request.get({ url: `/mes/orderday/getWorkGroup`,params })
}
// 根据车间、产线 查询已配置的设备
export const getPlanDevices = async (params) => {
return await request.get({ url: `/mes/orderday/getDeviceInfo`,params })
}
///发布计划
export const publishPlan = async (params) => {
return await request.post({ url: `/mes/orderday/publishPlan`,params })
}
//终止计划
export const stopPlan = async (params) => {
return await request.post({ url: `/mes/orderday/stopPlan`,params })
}

53
src/api/qms/samplingProcess/index.ts

@ -0,0 +1,53 @@
import request from '@/config/axios'
export interface SamplingProcessVO {
id: number
code: string
describe: string
sampleType: string
evaluationMode: string
sampleSize: number
sampleProgCode: number
available: string
}
// 查询采样过程列表
export const getSamplingProcessPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/qms/sampling-process/senior', data })
} else {
return await request.get({ url: `/qms/sampling-process/page`, params })
}
}
// 查询采样过程详情
export const getSamplingProcess = async (id: number) => {
return await request.get({ url: `/qms/sampling-process/get?id=` + id })
}
// 新增采样过程
export const createSamplingProcess = async (data: SamplingProcessVO) => {
return await request.post({ url: `/qms/sampling-process/create`, data })
}
// 修改采样过程
export const updateSamplingProcess = async (data: SamplingProcessVO) => {
return await request.put({ url: `/qms/sampling-process/update`, data })
}
// 删除采样过程
export const deleteSamplingProcess = async (id: number) => {
return await request.delete({ url: `/qms/sampling-process/delete?id=` + id })
}
// 导出采样过程 Excel
export const exportSamplingProcess = async (params) => {
return await request.download({ url: `/qms/sampling-process/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/qms/sampling-process/get-import-template' })
}

56
src/components/Detail/src/Detail.vue

@ -25,7 +25,7 @@
/>
</ContentWrap>
<Tabs :tabsList="tabsList" :current="current" @change="change" />
<Tabs ref="tabRef" :tabsList="tabsList" :current="current" @change="change" />
<div class="flex">
<!-- 详情 -->
<ContentWrap class="w-[100%]" v-show="tabsList[current].label!='附件'&&tabsList[current].label!='备注'&&tabsList[current].label!='变更记录'"> <!-- 列表头部 -->
@ -97,22 +97,25 @@
</DetailTable>
</ContentWrap>
<!-- 附件/备注/变更记录 -->
<ContentWrap class="w-[100%]" v-show="tabsList[current].label=='附件'||tabsList[current].label=='备注'||tabsList[current].label=='变更记录'">
<ContentWrap class="w-[100%]" v-show="tabsList[current].label=='附件'||tabsList[current].label=='备注'||tabsList[current].label=='变更记录'" :style="{height:remarkHeight+'px'}">
<!-- 附件组件 -->
<Annex v-show="tabsList[current].label=='附件'"
:annexData="annexData"
@handleAnnexSuccess="handleAnnexSuccess"
@deleteAnnexSuccess="deleteAnnexSuccess"
:upData="remarksData.data"
/>
<!-- 备注组件 -->
<Remarks v-show="tabsList[current].label=='备注'"
:remarksData="remarksData"
class="mt-20px"
@remarksSubmitScuess="remarksSubmitScuess"
/>
<!-- 变更记录组件 -->
<ChangeRecord v-show="tabsList[current].label=='变更记录'" :changeRecordData="changeRecordData" class="mt-20px" /> </ContentWrap>
<ElScrollbar ref="scrollbar" :style="{height:(remarkHeight-40)+'px'}">
<Annex v-show="tabsList[current].label=='附件'"
:annexData="annexData"
@handleAnnexSuccess="handleAnnexSuccess"
@deleteAnnexSuccess="deleteAnnexSuccess"
:upData="remarksData.data"
/>
<!-- 备注组件 -->
<Remarks v-show="tabsList[current].label=='备注'"
:remarksData="remarksData"
class="mt-20px"
@remarksSubmitScuess="remarksSubmitScuess"
/>
<!-- 变更记录组件 -->
<ChangeRecord v-show="tabsList[current].label=='变更记录'" :changeRecordData="changeRecordData" class="mt-20px" />
</ElScrollbar>
</ContentWrap>
</div>
</el-drawer>
<!-- 表格弹窗 -->
@ -142,6 +145,7 @@
</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'
@ -350,6 +354,21 @@ if (!tabsList.value || tabsList.value && tabsList.value.length == otherList.leng
})
}
// Tabs
const tabRef = ref()
//
const scrollbar = ref()
//
const remarkHeight = computed(() => {
const tab = unref(tabRef)
const tabTop = tab?.$el.getBoundingClientRect().top
const tabHeight = tab?.$el.getBoundingClientRect().height
console.log('tabTop',tabTop)
const height = window.innerHeight - (tabTop) - (tabHeight) - 60
return height
})
//
const annexData = reactive({
annexList: []
@ -391,6 +410,11 @@ const current = ref(0)
const change = (item, index) => {
current.value = index
emit('changeTabs', item)
if(otherList.find(other=>other.label==item.label)){
// // --
scrollbar.value.scrollTo({ top: 0});
}
}
//

8
src/utils/dict.ts

@ -279,4 +279,12 @@ export enum DICT_TYPE {
PLAN_PRODUCTION_TYPE = "plan_production_type", // 生产计划类型
DELIVER_TYPE="deliver_type",//发货类型
BILL_TYPE="bill_type", // 发票类型
// ========== 业务 - mes ==========
MESDO_STATUS= 'mes_do_status', // 工单执行状态
MES_WORKBILL_MODEL='mes_workbill_model',// 工单模式 单工单(根据产品数量生成多个工单)、批量工单(一个产品一个工单)
MES_TASK_MODE='mes_task_mode', //生产模式 派工方式、领工方式
MES_PLANDO_STATUS='mes_plando_status', //计划执行状
//========== mes-QMS ==========
SAMPLING_TYPE = "sampling_type", // 取样类型
EVALUATION_MODE = "evaluation_mode", // 评估模式
}

459
src/views/mes/orderDay/components/BasicFormV2.vue

@ -0,0 +1,459 @@
<template>
<Dialog
:title="dialogTitle"
v-model="dialogVisible"
:width="dialogWidth"
:close-on-click-modal="false"
>
<div style="max-height: 60vh;overflow-y: auto;">
<Form
ref="formRef"
v-loading="formLoading"
:rules="rules"
:schema="formSchema"
:is-col="true"
@opensearchTable="opensearchTable"
@onChange="onChange"
@onBlur="onBlur" />
</div>
<template #footer>
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" />
</template>
</Dialog>
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" />
</template>
<script setup lang="ts">
import { SearchTable } from '@/components/SearchTable'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import ButtonBase from '@/components/XButton/src/ButtonBase.vue'
const props = defineProps({
//
isSearchFilterButtonHide: {
type: Boolean,
default: false
},
//
basicFormWidth: {
type: String,
default: ''
},
// TableForm /
isShowButton: {
type: Boolean,
default: true
},
// tableForm
isShowReduceButton: {
type: Boolean,
default: true
},
// rules
rules: {
type: Object,
required: true,
default: null
},
//
formAllSchemas: {
type: Object,
required: true,
default: null
},
//
tableAllSchemas: {
type: Array,
required: true,
default: null
},
//
tableData: {
type: Array,
required: true,
default: null
},
tableFormRules: {
type: Array,
required: true,
default: null
},
//
// searchTableParams: {
// type: Array,
// required: false,
// default: null
// },
// APIVo
apiVo: {
type: Object,
required: true,
default: null
},
// API
apiCreate: {
type: Function,
required: true,
default: null
},
// API
apiUpdate: {
type: Function,
required: true,
default: null
},
// tableForm
isBusiness: {
type: Boolean,
required: true,
default: true
},
// form
form: {
type: Object,
required: true,
default: null
},
//
detailData: {
type: Object,
required: true,
default: null
},
// //
// masterParmas: {
// type: Object,
// required: false,
// default: null
// },
// countPlan
fromeWhere: {
type: String,
required: false,
default: ''
},
//
countScopeType: {
type: Array,
required: false,
default: null
},
//
isDetail: {
type: Boolean,
required: false,
default: false
},
//
isShowFooterButtton: {
type: Boolean,
required: false,
default: true
},
//
tableFormDataLength: {
type: Boolean,
required: false,
default: true
}
})
const { t } = useI18n() //
const message = useMessage() //
const dialogWidth = ref()
if (props.basicFormWidth) {
dialogWidth.value = props.basicFormWidth + '%'
} else {
dialogWidth.value = props.isBusiness ? '60%' : '40%'
}
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formRef = ref() // Ref
const formSchema = ref(props.formAllSchemas?.formSchema)
const searchFilterButtonHide=ref(props.isSearchFilterButtonHide)
/** 弹层操作 */
// formField form
// searchField
// type type=tableForm
// searchCondition
const searchTableRef = ref()
const opensearchTable = (
formField,
searchField,
searchTitle,
searchAllSchemas,
searchPage,
searchCondition,
multiple,
type,
row
) => {
const _searchCondition = {}
//
if (searchCondition && searchCondition.length > 0) {
//
let filters: any[] = []
for (var i=0; i< searchCondition.length; i++ ) {
// searchCondition.forEach((item) => {
// row
if (searchCondition[i].isMainValue) {
_searchCondition[searchCondition[i].key] = formRef.value.formModel[searchCondition[i].value]
? formRef.value.formModel[searchCondition[i].value]
: props.detailData
? props.detailData[searchCondition[i].value]
: row
? row[searchCondition[i].value]
: ''
//
let isNull = false
if (_searchCondition[searchCondition[i].key] == '' || _searchCondition[searchCondition[i].key] == undefined) {
isNull = true
}
if (isNull) {
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!')
return
}
} else {
//
if (searchCondition[i].isSearch) {
filters.push({
action: searchCondition[i].action,
column: searchCondition[i].key,
value: searchCondition[i].value
})
} else {
_searchCondition[searchCondition[i].key] = searchCondition[i].value
}
}
}
if (filters.length > 0) {
_searchCondition.isSearch = true
_searchCondition.filters = filters
}
}
const _searchTableTitle = searchTitle
const _searchTableAllSchemas = searchAllSchemas
const _searchTablePage = searchPage
searchTableRef.value.open(
_searchTableTitle,
_searchTableAllSchemas,
_searchTablePage,
formField,
searchField,
multiple,
type,
row,
_searchCondition,
false,
searchFilterButtonHide.value
)
}
//
// val row
const searchTableSuccess = (formField, searchField, val, type, row) => {
emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row)
}
/** 打开弹窗 */
const open = async (type: string, row?: any, masterParmas?: any, titleName?: any) => {
dialogVisible.value = true
if (titleName) {
dialogTitle.value = t('action.' + titleName)
} else {
dialogTitle.value = t('action.' + type)
}
formType.value = type
resetForm()
//
// masterIdnumber
if (masterParmas) {
if (!row) {
row = {
masterId: masterParmas.masterId,
number: masterParmas.number
}
}
}
if (row?.id || row?.masterId) {
formLoading.value = true
try {
nextTick(() => {
formRef.value.setValues(row)
})
} finally {
formLoading.value = false
}
}
}
defineExpose({ open, formRef, opensearchTable, dialogVisible, formLoading }) // open
/** 弹窗按钮 */
let Butttondata:any = []
if (props.isShowFooterButtton) {
Butttondata = [
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null) //
]
}
/** 按钮事件 */
const buttonBaseClick = (val) => {
//
if (val == 'save') {
submitForm()
}
//
else if (val == 'close') {
dialogVisible.value = false
}
}
/** 提交表单 */
// const emit = defineEmits(['success']) // success
const tableFormRef = ref()
const submitForm = async () => {
const elForm = unref(formRef)?.getElFormRef()
//
if (!elForm) return
const valid = await elForm.validate()
if (!valid) return
//
if (props.isBusiness) {
formLoading.value = true
if (formType.value == 'create') {
const validateForm = await tableFormRef.value.validateForm()
formRef.value.setValues({status:'1'})
if (!validateForm && props.tableFormDataLength) {
if (props.tableData.length == 0) {
message.warning('请填写明细信息!')
formLoading.value = false
return
}
formLoading.value = false
return
}
//
try {
const data = unref(formRef)?.formModel
emit('submitForm', formType.value, data)
} finally {
}
} else {
//
try {
const data = unref(formRef)?.formModel
emit('submitForm', formType.value, data)
} finally {
}
}
} else {
//
formLoading.value = true
try {
const data = unref(formRef)?.formModel
emit('success', formType.value, data)
} finally {
formLoading.value = false
}
}
}
/** 重置表单 */
const resetForm = () => {
unref(formRef)?.resetFields()
}
//
const emit = defineEmits([
'success',
'tableSelectionChange',
'tableFormSelectOnBlur',
'extendedButtonsClick',
'formSelectChange',
'formSelectvVisibleChange',
'tableSortChange',
'selectCallback',
'handleTableSelect',
'handleDeleteTable',
'handleAddTable',
'inpuFocus',
'searchTableSuccess',
'opensearchTable',
'submitForm',
'selectChange',
'selectChangeDetail',
'tableFormChange',
'buttonOperationClick',
'inputStringBlur',
'onChange',
'onBlur',
'inputNumberChange',
'formFormDateChange'
])
/**
* 监听改变事件
* @param field 当前操作字段
* @param cur 改变后值
*/
const onChange = (field, cur) => {
emit('onChange', field, cur)
}
/**
* 监听失焦事件
* @param field 当前操作字段
* @param e
*/
const onBlur = (field, e) => {
emit('onBlur', field, e)
}
</script>
<style lang="scss" scoped>
.table {
border: 1px solid #dedede;
border-radius: 8px;
padding: 10px;
width: calc(100% - 32px);
display: flex;
}
::v-deep(.el-table__body) {
padding: 10px 0px;
}
::v-deep(.el-table--default .el-table__cell) {
padding: 2px 0px;
border: none;
}
::v-deep(.el-table td.el-table__cell .el-form-item__content) {
display: flex !important;
align-items: center !important;
justify-content: center !important;
}
::v-deep(.el-table td.el-table__cell div) {
overflow: visible;
}
::v-deep(.el-icon) {
display: block;
}button
.button {
> div {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
> div {
margin-left: 6px;
text-decoration: underline;
color: #409eff;
}
}
}
</style>

237
src/views/mes/orderDay/components/orderDetail.vue

@ -0,0 +1,237 @@
<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>
<Descriptions
:data="detailData"
labelClassName="label-class-name"
label-align="left"
direction="vertical"
:column="8"
:schema="allSchemas.detailSchema"
:columns="2"
width="200px"
/>
</ContentWrap>
<el-tabs v-model="activeName" type="card" @tab-click="handleClick">
<el-tab-pane label="工艺路线信息" name="processRouteInfo">
<div class="mt-20px">
<el-space :size="10" spacer="|">
<span>名称<el-tag v-if="processRouteInfoSchema.processrouteInfo!=null">{{ processRouteInfoSchema.processrouteInfo.processName}} </el-tag></span>
<span>编码<el-tag v-if="processRouteInfoSchema.processrouteInfo!=null">{{ processRouteInfoSchema.processrouteInfo.processrouteCode}} </el-tag> </span>
<span>版本<el-tag v-if="processRouteInfoSchema.processrouteInfo!=null">{{ processRouteInfoSchema.processrouteInfo.routeVersion}} </el-tag> </span>
</el-space>
<el-divider />
<el-table
ref="tableRoute"
:data="nodeData"
:columns="nodeColumns"
border
stripe="true"
style="width: 100%"
>
<el-table-column prop="nodeSort" label="序号" align="center"/>
<el-table-column prop="preCode" label="前置工序" align="center">
<template #default="scope">
<div style="display: flex; align-items: center">
<el-tag
>{{ scope.row.preNodeName }}</el-tag
>
</div>
</template>
</el-table-column>
<el-table-column prop="processCode" label="当前工序" align="center" >
<template #default="scope">
<div style="display: flex; align-items: center">
<el-tag
>{{ scope.row.nodeName }}</el-tag
>
</div>
</template>
</el-table-column>
<el-table-column prop="nextCode" label="后置工序" align="center">
<template #default="scope">
<div style="display: flex; align-items: center">
<el-tag
>{{ scope.row.nextNodeName }}</el-tag
>
</div>
</template>
</el-table-column>
</el-table>
</div>
</el-tab-pane>
<el-tab-pane label="BOM信息" name="bomInfo"
><div class="mt-20px">
<el-table
ref="tableRoute"
:data="bomInfoSchemaData"
style="width: 100%"
>
<el-table-column prop="productItemCode" label="父物料代码" align="center" />
<el-table-column prop="componentItemCode" label="子物料代码" align="center" />
<el-table-column prop="componentUom" label="子物料计量单位" align="center" />
<el-table-column prop="componentQty" label="子物料数量" align="center"/>
<el-table-column prop="version" label="版本" align="center" />
</el-table> </div
></el-tab-pane>
<el-tab-pane label="班组人员信息" name="workTeamInfo"
><div class="mt-20px">
<el-table
ref="tableRoute"
:data="workTeamInfoSchema"
style="width: 100%"
>
<el-table-column prop="id" label="ID" align="center" />
<el-table-column prop="userName" label="人员工号" align="center" />
<el-table-column prop="nickeName" label="显示名称" align="center" />
<el-table-column prop="workGroup" label="所属班组" align="center" />
<el-table-column prop="lineCode" label="所属产线" align="center" />
<el-table-column prop="abliity" label="技能岗位" align="center" />
</el-table> </div
></el-tab-pane>
<el-tab-pane label="设备信息" name="deviceInfo"
><div class="mt-20px">
<el-table
ref="tableRoute"
:data="deviceInfoSchema"
style="width: 100%"
>
<el-table-column prop="productItemCode" label="设备编码" align="center" />
<el-table-column prop="componentItemCode" label="设备名称" align="center" />
<el-table-column prop="componentUom" label="所属车间" align="center" />
<el-table-column prop="componentQty" label="所属产线" align="center"/>
<el-table-column prop="status" label="设备状态" align="center" />
</el-table> </div
></el-tab-pane>
</el-tabs>
</el-drawer>
</div>
</template>
<script lang="ts" setup>
import * as OrderDayApi from '@/api/mes/orderDay'
defineOptions({ name: 'orderDetail' })
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 activeName = ref('processRouteInfo')
const props = defineProps({
allSchemas: {
type: Object,
required: true,
default: null
}
})
const detailData = ref(props.allSchemas)
const bomInfoSchemaData = ref( [{productItemCode:'----',
componentItemCode:'----',
componentUom:'----',
componentQty:'----',
version:'----'}])
const workTeamInfoSchema = ref( [] )
const deviceInfoSchema = ref([])
const processRouteInfoSchema = ref({
processrouteInfo: { processrouteCode: '', processName: '', routeVersion: '' },
processrouteNodeDetailList: []
})
const isShowDrawer = ref(false)
const detailLoading = ref(false)
const nodeColumns = ref([
{
label: '序号',
field: 'nodeSort'
},
{
label: '当前工序',
field: 'processCode'
},
{
label: '前置工序',
field: 'preCode'
},
{
label: '后置工序',
field: 'nextCode'
}
])
const nodeData = ref([{}])
// Tabs
const current = ref(0)
const handleClick = (item, index) => {
current.value = index
emit('changeTabs', item)
}
/** 打开弹窗 */
const formRef = ref()
const titleNameRef = ref()
const titleValueRef = ref()
const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => {
titleNameRef.value = titleName
titleValueRef.value = titleValue
isShowDrawer.value = true
if (row) {
detailLoading.value = true
try {
detailData.value = row
getDetailData(row)
} finally {
detailLoading.value = false
}
}
}
defineExpose({ openDetail, formRef }) // open
const getDetailData = async (row: any) => {
processRouteInfoSchema.value = await OrderDayApi.getProcessroutesDetail(row.processrouteCode)
let pam={code:row.standardBom.slice(0,row.standardBom.lastIndexOf('-')),version:row.standardBom.slice(row.standardBom.lastIndexOf('-')+1)}
//console.log(pam)
bomInfoSchemaData.value = await OrderDayApi.getPlanBom(pam)
nodeData.value = processRouteInfoSchema.value.processrouteNodeDetailList
}
//
const emit = defineEmits([
'searchTableSuccessDetail',
'changeTabs',
'selectChangeDetail',
'detailOpenForm',
'tableFormButton',
'openImage',
'onBlur',
'detailBasicFormOnChange',
'formFormDateChange'
])
//
watch()
</script>
<style lang="scss">
.el-drawer__body {
background: #f5f5f5 !important;
}
::v-deep(.label-class-name) {
color: #dedede;
}
</style>
<style scoped lang="scss"></style>

332
src/views/mes/orderDay/components/schedule.vue

@ -0,0 +1,332 @@
<template>
<Dialog
:title="dialogTitle"
v-model="dialogVisible"
:width="dialogWidth"
:close-on-click-modal="false"
>
<ContentWrap>
<Descriptions
:data="detailData"
labelClassName="label-class-name"
label-align="left"
direction="vertical"
:column="8"
:schema="allSchemas.detailSchema"
:columns="2"
width="200px"
/>
</ContentWrap>
<div style="height: 480px; overflow-y: auto">
<el-tabs type="border-card" :active-name="activeName">
<el-tab-pane label="调整工艺路线" name="process">
<el-container>
<el-aside>
<el-card style="max-width: 480px">
<template #header>
<div class="card-header">
<span>原有工序</span>
</div>
</template>
<el-table :data="processData" ref="tableProcess" style="width: 100%; height: 80%">
<el-table-column prop="name" label="工序名称">
<template #default="scope">
<el-button size="mini" text @click="userAddNode(scope.row)" style="width: 100%"
>{{ scope.row.name }}[{{ scope.row.code }}]</el-button
>
</template>
</el-table-column>
<el-table-column prop="code" label="工序编码" width="180" v-if="false" />
</el-table>
</el-card>
</el-aside>
<el-main><div ref="graphContainer"></div></el-main>
<!-- <el-aside
><el-card style="max-width: 480px">
<template #header>
<div class="card-header">
<span>可选工序</span>
</div>
</template>
<p v-for="o in 4" :key="o" class="text item">{{ 'List item ' + o }}</p>
<template #footer>Footer content</template>
</el-card></el-aside
> -->
</el-container>
</el-tab-pane>
<el-tab-pane label="调整临时BOM" name="boms">
<TableForm
ref="tableProcess"
:table-data="tableDataProcess"
:table-fields="tableColumnsProcess"
:loading="loading"
@handleAddTable="handleAddTable(tableDataProcess)"
@handle-delete-table="handleDeleteTable(item, index,tableDataProcess)"
/>
</el-tab-pane>
<el-tab-pane label="调整可用设备" name="device"
><TableForm
ref="tableProcess"
:table-data="tableDataProcess"
:table-fields="tableColumnsProcess"
:loading="loading"
@handleAddTable="handleAddTable(tableDataProcess)"
@handle-delete-table="handleDeleteTable(item, index,tableDataProcess)"
/></el-tab-pane>
<el-tab-pane label="调整班组人员" name="worker"
><TableForm
ref="tableProcess"
:table-data="tableDataProcess"
:table-fields="tableColumnsProcess"
:loading="loading"
@handleAddTable="handleAddTable(tableDataProcess)"
@handle-delete-table="handleDeleteTable(item, index,tableDataProcess)"
/></el-tab-pane>
</el-tabs>
</div>
<template #footer>
<el-button @click="dialogVisible = false">发布计划</el-button>
</template>
</Dialog>
<!-- <SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" /> -->
</template>
<script lang="ts" setup>
defineOptions({ name: 'sechledDetail' })
//import { dateFormatter } from '@/utils/formatTime'
import {
start_node,
end_node,
createGraph,
getNewNode
} from '@/views/mes/processroute/components/graphbase.data'
import * as ProcessrouteApi from '@/api/mes/processroute'
import { Graph } from '@antv/x6'
const graphContainer = ref<HTMLElement | null>(null)
const graph = ref<Graph>()
const message = useMessage() //
const { t } = useI18n() //
const activeName = ref('process')
const loading = ref(true)
const processData=ref()
const props = defineProps({
//
isSearchFilterButtonHide: {
type: Boolean,
default: false
},
//
basicFormWidth: {
type: String,
default: ''
},
allSchemas: {
type: Object,
required: true,
default: null
}
})
const detailData = ref(props.allSchemas)
const route = useRoute() //
const routeName = ref()
const tableDataProcess = ref([
{
type: '',
value: ''
}
])
const tableColumnsProcess = ref([
{
label: '结束时间',
field: 'endTime',
sort: 'custom',
isReadonly: true,
form: {
component: 'TimePicker',
componentProps: {
type: 'time',
dateFormat: 'HH:mm'
}
}
},
{
label: '生产模式',
field: 'taskMode',
width: '80px',
sort: 'custom',
dictType: 'mes_task_mode',
dictClass: 'string',
form: {
component: 'Select',
value: 'ASSIGN'
}
}
])
//
const handleAddTable = (name:any) => {
message.success('添加成功')
let tableFormKeys = {
type: '',
value: ''
}
name.push(JSON.parse(JSON.stringify(tableFormKeys)))
}
//
const handleDeleteTable = (item, index,name) => {
console.log(name)
name.splice(index, 1)
}
routeName.value = route.name
routeName.value = routeName.value.substring(0, routeName.value.length - 4) + 'Detail'
//const updateKey = ref(0)
const dialogWidth = ref()
// if (props.basicFormWidth) {
// dialogWidth.value = props.basicFormWidth + '%'
// } else {
// dialogWidth.value = props.isBusiness ? '60%' : '40%'
// }
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
let graphJson = {
cells: [
{
position: {
x: 40,
y: 40
},
size: {
width: 100,
height: 40
},
attrs: {
text: {
text: 'Hello'
},
body: {
stroke: '#8f8f8f',
strokeWidth: 1,
fill: '#fff',
rx: 6,
ry: 6
}
},
visible: true,
shape: 'rect',
id: 'adbc20c6-96e4-4792-9e5b-42df6066cff0',
zIndex: 1
},
{
position: {
x: 240,
y: 180
},
size: {
width: 100,
height: 40
},
attrs: {
text: {
text: 'World'
},
body: {
stroke: '#8f8f8f',
strokeWidth: 1,
fill: '#fff',
rx: 6,
ry: 6
}
},
visible: true,
shape: 'ellipse',
id: '9b1f1e94-a01f-4902-bfae-4e6e81029261',
zIndex: 2
},
{
shape: 'edge',
attrs: {
line: {
stroke: '#8f8f8f',
strokeWidth: 1
}
},
id: '8fd50f13-22ba-41ff-b54a-eb6d8553c3d7',
source: {
cell: 'adbc20c6-96e4-4792-9e5b-42df6066cff0'
},
target: {
cell: '9b1f1e94-a01f-4902-bfae-4e6e81029261'
},
labels: [
{
attrs: {
label: {
text: 'X6'
}
}
}
],
zIndex: 3
}
]
}
/** 打开弹窗 */
const open = async (type: string, row?: any, titleName?: any) => {
dialogVisible.value = true
detailData.value = row
dialogWidth.value = props.basicFormWidth + '%'
//console.log(props.allSchemas)
//console.log(row)
if (titleName) {
dialogTitle.value = t('action.' + titleName)
} else {
dialogTitle.value = t('action.' + type)
}
nextTick(() => {
graph.value = createGraph(graphContainer.value as HTMLElement, false, dialogWidth.value-200, 320)
// graph.value.on('node:click', ({ e, x, y, node, view }) => {
// nodeClick(e, x, y, node, view)
// })
graph.value?.fromJSON(graphJson.cells)
})
}
//
const userAddNode = (row) => {
if (graph && graph.value != undefined) {
let node_template = getNewNode(row.code, row.name, row.code)
node_template.x = end_node.value.x - 100
node_template.y = end_node.value.y + 100
let noden = graph.value.addNode(node_template)
if (graph.value.getNodes().length == 1) {
let start = graph.value.addNode(start_node.value)
let end = graph.value.addNode(end_node.value)
graph.value.addEdge({
id: 'startEdge',
source: start.id, // ID
target: noden.id
})
graph.value.addEdge({
id: 'endEdge',
source: noden.id, // ID
target: end.id
})
}
}
}
defineExpose({ open }) // open
</script>
<style lang="scss">
.el-drawer__body {
background: #f5f5f5 !important;
}
::v-deep(.label-class-name) {
color: #dedede;
}
</style>
<style scoped lang="scss"></style>

331
src/views/mes/orderDay/index.vue

@ -0,0 +1,331 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search
:schema="OrderDay.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="OrderDay.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #planNoDay="{ row }">
<el-button type="primary" link @click="openDetail(row, '计划编码', row.planNoDay)">
<span>{{ row.planNoDay }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase
:Butttondata="butttondata(row)"
@button-base-click="buttonTableClick($event, row)"
/>
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicFormV2
ref="basicFormRef"
@success="formsSuccess"
:rules="OrderDayRules"
:formAllSchemas="OrderDay.allSchemas"
:apiUpdate="OrderDayApi.updateOrderDay"
:apiCreate="OrderDayApi.createOrderDay"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
:isSearchFilterButtonHide="true"
/>
<!-- 详情 -->
<orderDetail ref="detailRef" :all-schemas="OrderDay.allSchemas" />
<scheduleDetail ref="scheduleDetailRef" :all-schemas="OrderDay.allSchemas" :basicFormWidth="75"/>
<!-- 导入 -->
<ImportForm
ref="importFormRef"
url="/mes/orderday/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { OrderDay,OrderDayRules } from './orderDay.data'
import * as OrderDayApi from '@/api/mes/orderDay'
import BasicFormV2 from './components/BasicFormV2.vue'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import orderDetail from './components/orderDetail.vue'
import scheduleDetail from './components/schedule.vue'
defineOptions({ name: 'MesOrderDay' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(OrderDay.allSchemas.tableColumns)
const lineOptions=ref([])
const processRouteOptions=ref([])
const bomOptions=ref([])
//** */
const getProcessroutes = async (code: String) => {
processRouteOptions.value = await OrderDayApi.getProcessroutes(code)
OrderDay.allSchemas.formSchema.forEach(item => {
if (item.field == 'processrouteCode') {
console.log('processrouteCode',item.field)
item.componentProps.options = processRouteOptions.value
}
})
}
//** 线 */
const getProductlines = async (code: String) => {
lineOptions.value = await OrderDayApi.getProductlines(code)
OrderDay.allSchemas.formSchema.forEach(item => {
if (item.field == 'lineCode') {
item.componentProps.options = lineOptions.value
}
})
}
const getBoms = async (code: String) => {
bomOptions.value = await OrderDayApi.getBoms(code)
OrderDay.allSchemas.formSchema.forEach(item => {
if (item.field == 'standardBom') {
item.componentProps.options = bomOptions.value
}
})
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
if(formField=='productCode'){
//formRef.setValues({standardBom:'bomddd'})
getProcessroutes(val[0][searchField])
getBoms(val[0][searchField])
}
if(formField=='workroomCode'){
getProductlines(val[0][searchField])
}
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: OrderDayApi.getOrderDayPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'mes:orderDay:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'mes:orderDay:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'mes:orderDay:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
}else{ //
console.log('其他按钮', item)
}
}
//
const isShowMainButton = (row,val) => {
//console.log('row',row)
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
// -
// -
const butttondata = (row) => {
//console.log('row2',row)
return [
defaultButtons.mainListEditBtn({ hide: isShowMainButton(row,['1']),hasPermi:'mes:orderDay:update'}), //
defaultButtons.mainListDeleteBtn({ hide: isShowMainButton(row,['1']),hasPermi:'mes:orderDay:delete'}), //
defaultButtons.mainListHandleBtn({label: '发布',
name: 'publish',
hide: isShowMainButton(row,['1']),
type: 'warning',
icon: '',
color: '',
hasPermi: ''}), //
// defaultButtons.mainListHandleBtn({label: '',
// name: 'publish',
// hide: isShowMainButton(row,['2']),
// type: 'warning',
// icon: '',
// color: '',
// hasPermi: ''}), //
defaultButtons.mainListHandleBtn({label: '终止',
name: 'stopPlan',
hide: isShowMainButton(row,['1','2','3']),
type: 'warning',
icon: '',
color: '',
hasPermi: ''}), //
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
} else if(val=='schedule'){ //
openScheduledDetail( '发布计划', row,row.planNoDay)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =OrderDay.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await OrderDayApi.createOrderDay(data)
message.success(t('common.createSuccess'))
} else {
await OrderDayApi.updateOrderDay(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicOrderDay')
}
/** 发布操作 */
const scheduleDetailRef = ref()
const openScheduledDetail = (row: any, titleName: any, titleValue: any) => {
scheduleDetailRef.value.open(row, titleName, titleValue)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await OrderDayApi.deleteOrderDay(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await OrderDayApi.exportOrderDay(tableObject.params)
download.excel(data, '生产日计划.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '生产日计划导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await OrderDayApi.importTemplate()
})
</script>

327
src/views/mes/orderDay/orderDay.data.ts

@ -0,0 +1,327 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as ItembasicApi from '@/api/wms/itembasic'
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data'
import * as WorkshopApi from '@/api/wms/workshop'
import { Workshop } from '@/views/wms/basicDataManage/factoryModeling/workshop/workshop.data'
import { on } from '@/utils/domUtils'
// 表单校验
export const OrderDayRules = reactive({
planNoDay: [
{ required: true, message: '请输入一个日计划编号', trigger: 'blur' }
],
planNoMonth: [
{ required: true, message: '请输入一个月计划编号', trigger: 'blur' }
],
productCode: [
{ required: true, message: '请选择一个产品', trigger: 'blur' }
],
workroomCode: [
{ required: true, message: '请选择一个车间', trigger: 'blur' }
],
lineCode: [
{ required: true, message: '请选择一个产线', trigger: 'blur' }
],
workMode: [
{ required: true, message: '请选择工单生成方式', trigger: 'blur' }
],
startTime: [
{ required: true, message: '请输入计划生产开始时间', trigger: 'blur' }
],
endTime: [
{ required: true, message: '请输入计划生产完成时间', trigger: 'blur' }
],
planDate: [
{ required: true, message: '请输入计划日期', trigger: 'blur' }
],
taskMode: [
{ required: true, message: '请选择一个生产方式', trigger: 'blur' }
],
})
export const OrderDay = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '主键',
field: 'id',
sort: 'custom',
isForm: false,
width: '60px',
},
{
label: '日计划单号',
field: 'planNoDay',
sort: 'custom',
isSearch: true,
required: true,
},
{
label: '月计划单号',
field: 'planNoMonth',
sort: 'custom',
isSearch: true,
required: false,
},
{
label: '状态',
field: 'status',
sort: 'custom',
isForm: false,
isTable: true,
isDetail:true,
isSearch: false,
width: '80px',
dictType: DICT_TYPE.MES_PLANDO_STATUS,
dictClass: 'string',
form: {
component: 'Select',
},
},
{
label: '产品编号',
field: 'productCode',
sort: 'custom',
isSearch: true,
required: true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '产品编码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '产品信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
isHideFilterButton:true,
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
},
{
key: 'type',
action: 'in', // 查询拼接条件
isSearch: true, // 使用自定义拼接条件
value: 'FG,SEMI',//,SEMI]
isMainValue: false
},
]
}
}
},
{
label: '车间编码',
field: 'workroomCode',
sort: 'custom',
isSearch: true,
required: true,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '车间', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '车间信息', // 查询弹窗标题
searchAllSchemas: Workshop.allSchemas, // 查询弹窗所需类
searchPage: WorkshopApi.getWorkshopPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
},
{
label: '产线编码',
field: 'lineCode',
sort: 'custom',
isSearch: true,
required: true,
form:{
component:'Select',
componentProps:{
options:[{lablel:'1',value:'1'}]
}
}
},
{
label: '计划数量',
field: 'planCount',
sort: 'custom',
required: true,
form: {
component: 'InputNumber',
value: 1
},
},
{
label: '工艺路线编码',
field: 'processrouteCode',
sort: 'custom',
form: {
component:'Select',
componentProps: {
options: []
}
}
},
{
label: '临时工艺',
field: 'tempProcessroute',
sort: 'custom',
width: '80px',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE'
}
},
},
{
label: 'BOM编码',
field: 'standardBom',
sort: 'custom',
form: {
component:'Select',
componentProps: {
options: [{lablel:'bom',value:'bom'}]
}
}
},
{
label: '替代BOM',
field: 'tempBom',
sort: 'custom',
width: '80px',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
form: {
component: 'Switch',
value: 'TRUE',
componentProps: {
inactiveValue: 'FALSE',
activeValue: 'TRUE',
}
}
},
{
label: '工单模式',
field: 'workMode',
width: '80px',
sort: 'custom',
dictType: DICT_TYPE.MES_WORKBILL_MODEL,
dictClass: 'string',
form: {
component: 'Select',
value: 'BATCH',
},
},
{
label: '计划日期',
field: 'planDate',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
type: 'date',
valueFormat: 'YYYY-MM-DD',
}
},
form: {
component: 'DatePicker',
componentProps: {
type: 'date',
valueFormat: 'x'
}
},
},
{
label: '开始时间',
field: 'startTime',
sort: 'custom',
formatter: dateFormatter,
required: true,
form: {
component: 'TimePicker',
componentProps: {
type: 'time',
dateFormat: 'HH:mm',
//valueFormat: 'x',
}
},
},
{
label: '结束时间',
field: 'endTime',
sort: 'custom',
formatter: dateFormatter,
isReadonly:true,
form: {
component: 'TimePicker',
componentProps: {
type: 'time',
dateFormat: 'HH:mm',
}
},
},
{
label: '生产模式',
field: 'taskMode',
width : '80px',
sort: 'custom',
dictType: DICT_TYPE.MES_TASK_MODE,
dictClass: 'string',
form: {
component: 'Select',
value:'ASSIGN'
},
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'datetime',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
},
isForm: false,
},
{
label: '创建者',
field: 'creator',
sort: 'custom',
isSearch: false,
isForm: false,
},
{
label: '备注',
field: 'remark',
sort: 'custom',
isSearch: false,
isTable:false,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 200,
fixed: 'right'
}
}
]))

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

@ -43,7 +43,28 @@
<el-table-column prop="code" label="工序编码" width="180" v-if="false" />
</el-table>
</el-col>
<el-col :span="18"><div ref="graphContainer"></div></el-col>
<el-col :span="12"><div ref="graphContainer"></div>
</el-col>
<el-col :span="6">
<ContentWrap class="w-[100%] 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>
</el-col>
</el-row>
<el-row style="height: 150px" :gutter="5">
<el-col :span="6">
@ -53,9 +74,9 @@
<span>产品信息</span>
</div>
</template>
<p>产品名称{{ productData.name }}</p>
<p>产品编码{{ productData.code }}</p>
<p>产品描述{{ productData.desc1 }}</p>
<p >产品名称<span v-if="productData!=null">{{ productData.name }}</span></p>
<p>产品编码<span v-if="productData!=null">{{ productData.code }}</span></p>
<p>产品描述<span v-if="productData!=null">{{ productData.desc1 }}</span></p>
</el-card>
</el-col>
<el-col :span="6"
@ -94,12 +115,14 @@
</div>
</template>
<script lang="ts" setup>
import Annex from '@/components/Annex/src/Annex.vue'
import Remarks from '@/components/Remarks/src/Remarks.vue'
import ChangeRecord from '@/components/ChangeRecord/src/ChangeRecord.vue'
import * as RemarkApi from '@/api/wms/remark'
import * as FileApi from '@/api/wms/file'
import { start_node, end_node, createGraph, registerNodes, getNewNode } from './graphbase.data'
import * as ProcessrouteApi from '@/api/mes/processroute'
import { Search } from '@/components/Search'
import { Graph } from '@antv/x6'
//import { async } from '@antv/x6/lib/registry/marker/async'
//import { object } from 'vue-types'
const graphContainer = ref<HTMLElement | null>(null)
defineOptions({ name: 'ProcessRouteConfig' })
const isShowDrawer = ref(false)
@ -123,8 +146,18 @@ const deviceList = ref([
{ name: '设备', code: '0000' },
{ name: '设备', code: '0000' }
]) //
const workerList = ref([{ name: '--' }, { name: '--' }]) //
const workStationData = ref({ name: '工位', code: '' }) //
//
const annexData = reactive({
annexList: []
})
//
const remarksData = reactive({
remarksList: [],
data: {}
})
//
const graph = ref<Graph>()
const openDetail = async (rowData: any) => {
@ -132,16 +165,24 @@ const openDetail = async (rowData: any) => {
titleNameRef.value = rowData.value.processrouteCode
titleValueRef.value = rowData.value.processName
processRouteId.value = rowData.value.id
remarksData.data = {
tableId: rowData.value.id,
tableName: rowData.value.processrouteCode
}
if(rowData){
let graphJson = JSON.parse(rowData.value.graphJson)
isShowDrawer.value = true
nextTick(() => {
graph.value = createGraph(graphContainer.value as HTMLElement)
graph.value = createGraph(graphContainer.value as HTMLElement,true,800,600)
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()}
}
//
const handleDrawerClose = () => {
@ -243,7 +284,7 @@ const userAddNode = (row) => {
//-------
defineExpose({ openDetail, createGraph }) // open
onMounted(() => {
registerNodes()
//registerNodes()
getProcessList()
})
@ -274,6 +315,49 @@ const saveResult = async () => {
emit('close')
//return res
}
//
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 changeRecordData = reactive({
changeRecordList: []
})
//
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()
}
//
onUnmounted(() => {})
const emit = defineEmits(['close'])

8
src/views/mes/processroute/components/graphbase.data.ts

@ -163,11 +163,13 @@ export const end_node = ref({
shape: 'base-node',
ports: [{ id: 'in', group: 'in' }]
})
export const createGraph = (graphContainer: any) => {
export const createGraph = (graphContainer: any,autoResizer:boolean,width:number,height:number) => {
const ret = ref<Graph>()
ret.value= new Graph({
container: graphContainer,
autoResize: true,
autoResize: autoResizer,
width:width,
height:height,
background: { color: '#F2F7FA' }, // 创建画布时初始化背景相关配置对象
grid: { size: 10, visible: true, type: 'mesh' }, //创建画布时,通过配置对象来设置背景网格
mousewheel: {
@ -255,6 +257,8 @@ export const createGraph = (graphContainer: any) => {
ret.value.on('edge:mouseleave', ({ cell }) => {
cell.removeTools()
})
Graph.registerNode('process-node', process_node.value, true)
Graph.registerNode('base-node', base_node.value, true)
return ret.value
}
//注册节点

244
src/views/qms/samplingProcess/index.vue

@ -0,0 +1,244 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="SamplingProcess.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="SamplingProcess.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="SamplingProcessRules"
:formAllSchemas="SamplingProcess.allSchemas"
:apiUpdate="SamplingProcessApi.updateSamplingProcess"
:apiCreate="SamplingProcessApi.createSamplingProcess"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="SamplingProcess.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/qms/sampling-process/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { SamplingProcess,SamplingProcessRules } from './samplingProcess.data'
import * as SamplingProcessApi from '@/api/qms/samplingProcess'
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: 'SamplingProcess' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(SamplingProcess.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: SamplingProcessApi.getSamplingProcessPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:samplingProcess:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:samplingProcess:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:samplingProcess: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:'wms:samplingProcess:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:samplingProcess: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 =SamplingProcess.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 SamplingProcessApi.createSamplingProcess(data)
message.success(t('common.createSuccess'))
} else {
await SamplingProcessApi.updateSamplingProcess(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, 'basicSamplingProcess')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await SamplingProcessApi.deleteSamplingProcess(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 SamplingProcessApi.exportSamplingProcess(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 SamplingProcessApi.importTemplate()
})
</script>

84
src/views/qms/samplingProcess/samplingProcess.data.ts

@ -0,0 +1,84 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const SamplingProcessRules = reactive({
code: [required],
sampleType: [required],
evaluationMode: [required],
available: [required],
})
export const SamplingProcess = useCrudSchemas(reactive<CrudSchema[]>([
{
label: 'id',
field: 'id',
sort: 'custom',
isTable: false,
isForm: false,
},
{
label: '编码',
field: 'code',
sort: 'custom',
isSearch: true,
},
{
label: '描述',
field: 'describe',
sort: 'custom',
isSearch: true,
},
{
label: '取样类型',
field: 'sampleType',
sort: 'custom',
dictType: DICT_TYPE.SAMPLING_TYPE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
isSearch: true,
form: {
component: 'SelectV2'
},
},
{
label: '评估模式',
field: 'evaluationMode',
sort: 'custom',
dictType: DICT_TYPE.EVALUATION_MODE,
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
form: {
component: 'SelectV2'
},
},
{
label: '样品量',
field: 'sampleSize',
sort: 'custom',
},
{
label: '采样方案编码',
field: 'sampleProgCode',
sort: 'custom',
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isForm: false,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
Loading…
Cancel
Save